SelectUser-fef02984.js 4.3 KB

1
  1. var _=(a,m,r)=>new Promise((o,l)=>{var I=i=>{try{u(r.next(i))}catch(p){l(p)}},e=i=>{try{u(r.throw(i))}catch(p){l(p)}},u=i=>i.done?o(i.value):Promise.resolve(i.value).then(I,e);u((r=r.apply(a,m)).next())});import{O,e as D,a as H,E as P,M as X,__tla as q}from"./index-67f9e311.js";import{U as B,__tla as F}from"./UserCard-5a5e66ad.js";import{b as G,a as J,__tla as K}from"./index-7914b44e.js";import{d as M,a4 as Q,f as R,A as T,j as V,n as W,D as $,y as S,o as n,c as h,w as b,e as f,u as d,H as k,l as v,N as Y,O as Z,X as ee,a as te,__tla as se}from"./index-b5895273.js";import{__tla as ae}from"./index-7fb58e79.js";import{__tla as le}from"./Tree-6c35f2c0.js";import{__tla as de}from"./useContextMenu-c4ffe073.js";import{__tla as ie}from"./difference-9954c5db.js";import{__tla as ce}from"./Index-281ee613.js";import{__tla as re}from"./index-3862eebd.js";let C,ne=Promise.all([(()=>{try{return q}catch(a){}})(),(()=>{try{return F}catch(a){}})(),(()=>{try{return K}catch(a){}})(),(()=>{try{return se}catch(a){}})(),(()=>{try{return ae}catch(a){}})(),(()=>{try{return le}catch(a){}})(),(()=>{try{return de}catch(a){}})(),(()=>{try{return ie}catch(a){}})(),(()=>{try{return ce}catch(a){}})(),(()=>{try{return re}catch(a){}})()]).then(()=>_(void 0,null,function*(){let a,m;a={key:1,class:"list-page-box"},m={class:"page-box"},C=M({__name:"SelectUser",props:{selectedIds:{default:()=>[]},disabledIds:{default:()=>[]},multiple:{},visible:{}},emits:["change","changeNames","close"],setup(r,{emit:o}){const l=r,{t:I}=Q();let e=R({multiSelect:!1,page:{current:1,total:0,pageSize:9},selectedIds:[],list:[],selectedList:[],searchConfig:{keyword:"",deptId:""}});const u=T(()=>({limit:e.page.current,size:e.page.pageSize,departmentId:e.searchConfig.deptId,keyword:e.searchConfig.keyword}));V(()=>e.page.current,()=>{g()}),W(()=>{i()});function i(){return _(this,null,function*(){e.selectedIds=[],e.selectedList=[],e.page.current=1,e.page.total=0,e.searchConfig.deptId="",l.selectedIds&&Array.isArray(l.selectedIds)&&(e.selectedIds=$(l.selectedIds)),yield g(),yield j()})}function p(){o("change",e.selectedIds),w(),L()}function L(){e.list=[],e.selectedIds=[],e.selectedList=[],o("close",!1)}function x(t){l.disabledIds&&Array.isArray(l.disabledIds)&&l.disabledIds.includes(t.id)||(l.multiple&&l.multiple==!0?e.selectedIds.includes(t.id)?(e.selectedIds.splice(e.selectedIds.findIndex(s=>s===t.id),1),e.selectedList.splice(e.selectedList.findIndex(s=>s.id===t.id),1)):(e.selectedIds.push(t.id),e.selectedList.push(t)):e.selectedIds.includes(t.id)?(e.selectedIds=[],e.selectedList=[]):e.selectedIds=[t.id])}function g(){return _(this,null,function*(){e.list=[],e.page.total=0;let t=yield G(u.value);t.total&&(e.page.total=t.total),t.list.length>0&&t.list.forEach(s=>{let y={name:s.name,id:s.id,code:s.code,gender:s.gender};e.list.push(y)})})}function z(t){e.page.current=1,e.searchConfig.keyword=t,g()}function A(t=""){e.page.current=1,e.searchConfig.deptId=t,g()}function j(){return _(this,null,function*(){let t=yield J(e.selectedIds.join(","));t.length>0&&(t.forEach(s=>{e.selectedList.push({name:s.name,id:s.id,code:s.code,gender:s.gender})}),w())})}function w(){let t=e.selectedList.map(s=>s.name).join(",");o("changeNames",t)}function U(t){e.selectedList=e.selectedList.filter(s=>s.id!=t),e.selectedIds.splice(e.selectedIds.findIndex(s=>s===t),1)}return(t,s)=>{const y=S("a-checkbox"),E=S("a-pagination");return n(),h(d(X),{visible:t.visible,width:1200,title:d(I)("\u6DFB\u52A0\u4EBA\u5458"),onSubmit:p,onClose:L},{left:b(()=>[f(O,{onSelect:A})]),default:b(()=>[t.visible?(n(),h(D,{key:0,type:"user",list:d(e).selectedList,onAbolish:U,disabledIds:l.disabledIds},null,8,["list","disabledIds"])):k("",!0),f(d(H),{onSearch:z}),t.visible&&d(e).list.length>0?(n(),v("div",a,[(n(!0),v(Y,null,Z(d(e).list,(c,N)=>(n(),h(B,{class:ee(d(e).selectedIds.includes(c.id)?"picked":"not-picked"),disabled:!!(l.disabledIds&&l.disabledIds.includes(c.id)),key:N,item:c,onClick:oe=>x(c)},{check:b(()=>[f(y,{size:"small",checked:d(e).selectedIds.includes(c.id)},null,8,["checked"])]),_:2},1032,["class","disabled","item","onClick"]))),128)),te("div",m,[f(E,{current:d(e).page.current,"onUpdate:current":s[0]||(s[0]=c=>d(e).page.current=c),pageSize:d(e).page.pageSize,total:d(e).page.total,"show-less-items":""},null,8,["current","pageSize","total"])])])):k("",!0),d(e).list.length==0?(n(),h(d(P),{key:2})):k("",!0)]),_:1},8,["visible","title"])}}})}));export{ne as __tla,C as default};