import{c as O}from"./expertStore.9ebe3e61.js";import{d as j,b as P,r as m,L as $,H as J,D as q,c as i,e as A,I as F,i as a,h as t,j as y,g as k,t as G,x as H}from"./index.5bb861d3.js";const K={class:"search mb-16"},M=j({name:"driverDialog"}),X=Object.assign(M,{props:{visible:{type:Boolean,default:!1,required:!0},data:{type:Array,default:void 0},selectExpertType:{type:Number,default:1}},emits:["close","getUserData"],setup(I,{emit:C}){const{proxy:V}=H(),f=I,x=C,o=P({expertRegionLevel:void 0,expertName:void 0,company:void 0}),u=m(),h=m(0),S=[{type:"selection",reserveSelection:!0,width:"55"},{label:"\u59D3\u540D",key:"expertName",prop:"expertName"},{label:"\u5DE5\u4F5C\u5355\u4F4D",key:"company",prop:"company",showOverflowTooltip:!0,width:250},{label:"\u4E13\u5BB6\u7EA7\u522B",key:"expertRegionInfo",slot:"expertRegionInfo",width:"150"},{label:"\u624B\u673A\u53F7\u7801",key:"phoneNo",prop:"phoneNo",width:"150"},{label:"\u4E13\u5BB6\u7C7B\u578B",key:"expertType[0].dictionaryName",prop:"expertType[0].dictionaryName",width:"150"}],c=m([]),g=async(s=(e=>(e=u.value)==null?void 0:e.pageParams)())=>{const n=await O({...s,...o,expertRegionInfo:o.expertRegionInfo?{regionCode:o.expertRegionInfo.slice(-1)[0].split("##")[0],regionLevel:o.expertRegionInfo.slice(-1)[0].split("##")[2],regionName:o.expertRegionInfo.slice(-1)[0].split("##")[1]}:void 0});h.value=n.data.total,c.value=n.data.records||[];const l=JSON.parse(JSON.stringify(p.value));l!=null&&l.length&&c.value&&c.value.forEach(d=>{l.map(_=>_.userId*1).includes(d.userId)&&u.value.toggleRowSelect(d,!0)})},T=()=>{g()},D=()=>{o.expertRegionInfo=void 0,o.expertName=void 0,o.company=void 0,u.value.pageParams.pageNumber=1,u.value.pageParams.pageSize=10,g()},p=m([]),L=s=>{const e=s.map(n=>n.userId);c.value.forEach(n=>{e.includes(n.userId)?p.value.push(n):p.value=p.value.filter(l=>l.userId!==n.userId)})},E=()=>{const s={},e=p.value.reduce((n,l)=>(s[l.userId]||(s[l.userId]=n.push(l)),n),[]);f.selectExpertType===1&&(e==null?void 0:e.length)>10?V.$message.warning("\u6700\u591A\u9009\u62E910\u4F4D\u4EBA\u5458"):x("getUserData",e)},N=m([]);return $(()=>f.visible,async s=>{var e;if(s){(e=f.data)!=null&&e.length&&(p.value=f.data.map(l=>l));const n=await J({regionCode:330500,regionLevel:2});N.value=[n.data],g(),q.userStore.setRoleStore()}}),(s,e)=>{const n=i("el-cascader"),l=i("el-form-item"),d=i("el-col"),b=i("el-input"),_=i("el-row"),v=i("el-button"),U=i("el-form"),z=i("table-list"),B=i("el-dialog");return A(),F(B,{"model-value":I.visible,title:"\u9009\u62E9\u4EBA\u5458",width:"840px","destroy-on-close":"",onClose:e[4]||(e[4]=r=>x("close"))},{footer:a(()=>[t(v,{type:"primary",size:"small",onClick:E},{default:a(()=>[y(" \u786E\u5B9A ")]),_:1}),t(v,{size:"small",onClick:e[3]||(e[3]=r=>x("close"))},{default:a(()=>[y(" \u5173\u95ED ")]),_:1})]),default:a(()=>[k("div",K,[t(U,{"label-suffix":":",model:o,size:"small"},{default:a(()=>[t(_,{gutter:16,class:"mb-16"},{default:a(()=>[t(d,{span:8},{default:a(()=>[t(l,{label:"\u4E13\u5BB6\u7EA7\u522B"},{default:a(()=>[t(n,{modelValue:o.expertRegionInfo,"onUpdate:modelValue":e[0]||(e[0]=r=>o.expertRegionInfo=r),options:N.value,placeholder:"\u8BF7\u9009\u62E9",class:"w-full",props:{value:"unionCode",label:"name"}},null,8,["modelValue","options"])]),_:1})]),_:1}),t(d,{span:8},{default:a(()=>[t(l,{label:"\u4E13\u5BB6\u59D3\u540D"},{default:a(()=>[t(b,{modelValue:o.expertName,"onUpdate:modelValue":e[1]||(e[1]=r=>o.expertName=r),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),t(d,{span:8},{default:a(()=>[t(l,{label:"\u5DE5\u4F5C\u5355\u4F4D"},{default:a(()=>[t(b,{modelValue:o.company,"onUpdate:modelValue":e[2]||(e[2]=r=>o.company=r),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),t(_,null,{default:a(()=>[t(d,{span:24},{default:a(()=>[t(l,{class:"btn"},{default:a(()=>[t(v,{type:"primary",onClick:T},{default:a(()=>[y("\u67E5\u8BE2")]),_:1}),t(v,{onClick:D},{default:a(()=>[y("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),t(z,{ref_key:"tableListRef",ref:u,column:S,data:c.value,total:h.value,"row-key":"userId",onSelectionChange:L,onGetTableData:g},{expertRegionInfo:a(({scope:r})=>{var w,R;return[k("span",null,G(((R=(w=r.row)==null?void 0:w.expertRegionInfo)==null?void 0:R.regionName)||"-"),1)]}),_:1},8,["data","total"])]),_:1},8,["model-value"])}}});export{X as default};
