You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 line
2.8KB

  1. import{d as O,b as B,r as _,L as T,c as n,e as x,I as R,i as l,g as k,h as o,j as v,$}from"./index.622ee9e7.js";const z={class:"search mb-16"},E={class:"dialog-footer"},J=O({name:"userListDialog"}),A=Object.assign(J,{props:{visible:{type:Boolean,default:!1,required:!0},data:{type:Array,default:void 0},params:{type:Object,default:()=>({})}},emits:["close","getProjectData"],setup(y,{emit:w}){const p=y,g=w,d=B({name:void 0}),u=_(),N=_(0),I=[{type:"selection",reserveSelection:!0,width:"55"},{label:"\u59D3\u540D",key:"name",prop:"name"},{label:"\u624B\u673A\u53F7\u7801",key:"phoneNo",prop:"phoneNo",width:"150"},{label:"\u6240\u5C5E\u5355\u4F4D\uFF08\u4E3B\u804C\uFF09",key:"orgName",prop:"orgName",showOverflowTooltip:!0,width:250},{label:"\u6240\u5C5E\u533A\u57DF",key:"regionName",prop:"regionName",width:"150"}],i=_([]),f=async(s=(e=>(e=u.value)==null?void 0:e.pageParams)())=>{const a=await $({...s,...d,...p.params});N.value=a.data.total,i.value=a.data.records||[];const t=JSON.parse(JSON.stringify(r.value))||[];t!=null&&t.length&&i.value&&i.value.forEach(c=>{t.map(b=>b.userId).includes(c.userId)&&u.value.toggleRowSelect(c,!0)})},C=()=>{u.value.pageParams.pageNumber=1,f()},j=()=>{d.name=void 0,u.value.pageParams.pageNumber=1,u.value.pageParams.pageSize=10,f()},r=_([]),D=s=>{const e=s.map(a=>a.userId);i.value.forEach(a=>{e.includes(a.userId)?r.value.push(a):r.value=r.value.filter(t=>t.userId!==a.userId)})},P=()=>{const s={},e=r.value.reduce((a,t)=>(s[t.userId]||(s[t.userId]=a.push(t)),a),[]);g("getProjectData",e)};return T(()=>p.visible,async s=>{var e;s&&((e=p.data)!=null&&e.length?r.value=p.data.map(a=>a):r.value=[],f())}),(s,e)=>{const a=n("el-input"),t=n("el-form-item"),c=n("el-col"),m=n("el-button"),b=n("el-row"),S=n("el-form"),V=n("table-list"),L=n("el-dialog");return x(),R(L,{"model-value":y.visible,title:"\u6DFB\u52A0\u4EBA\u5458",width:"70%","destroy-on-close":"",onClose:e[2]||(e[2]=h=>g("close"))},{footer:l(()=>[k("span",E,[o(m,{onClick:e[1]||(e[1]=h=>g("close"))},{default:l(()=>[v("\u5173\u95ED")]),_:1}),o(m,{type:"primary",onClick:P},{default:l(()=>[v(" \u786E\u5B9A ")]),_:1})])]),default:l(()=>[k("div",z,[o(S,{"label-suffix":":",model:d,size:"small"},{default:l(()=>[o(b,{gutter:16},{default:l(()=>[o(c,{span:8},{default:l(()=>[o(t,{label:"\u7528\u6237\u59D3\u540D"},{default:l(()=>[o(a,{modelValue:d.name,"onUpdate:modelValue":e[0]||(e[0]=h=>d.name=h),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),o(c,{span:16},{default:l(()=>[o(t,{class:"btn"},{default:l(()=>[o(m,{type:"primary",onClick:C},{default:l(()=>[v("\u67E5\u8BE2")]),_:1}),o(m,{onClick:j},{default:l(()=>[v("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),o(V,{ref_key:"tableListRef",ref:u,column:I,data:i.value,total:N.value,"row-key":"userId",onSelectionChange:D,onGetTableData:f},null,8,["data","total"])]),_:1},8,["model-value"])}}});export{A as default};