text: var A=Object.defineProperty;var B=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var E=(e,l,t)=>l in e?A(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,_=(e,l)=>{for(var t in l||(l={}))$.call(l,t)&&E(e,t,l[t]);if(B)for(var t of B(l))I.call(l,t)&&E(e,t,l[t]);return e};var w=(e,l,t)=>new Promise((o,d)=>{var v=c=>{try{n(t.next(c))}catch(r){d(r)}},i=c=>{try{n(t.throw(c))}catch(r){d(r)}},n=c=>c.done?o(c.value):Promise.resolve(c.value).then(v,i);n((t=t.apply(e,l)).next())});import{B as R,a as V}from"./index.309f7e13.js";import{P as F}from"./index.37a89528.js";import{A as W,ba as H,aP as z,ct as q,r as f,S as x,$ as O,j as G,a0 as g,bo as Q,B as C,a1 as T,a6 as b,H as U,D as X,ap as Y,ae as Z,J as ee,ab as te,ad as se,w as J,F as ae,a4 as le,u as ne}from"./vendor.5879c5ca.js";/* empty css               */import{a as re}from"./dept.1a4c42ff.js";import{_ as oe,bd as j}from"./index.aeb7d9f7.js";import{_ as ie}from"./Tree.vue_vue_type_style_index_0_lang.6dd32286.js";import"./useWindowSizeFn.6a6adedd.js";/* empty css                *//* empty css                */import"./useContentViewHeight.6345b5e8.js";import"./useContextMenu.c42040e5.js";/* empty css               */const ce=W({props:{title:{type:String,default:"\u4EBA\u5458\u9009\u62E9"}},name:"OrgSelector",components:{BasicModal:R,PageWrapper:F,Tag:H,BasicTree:ie,Spin:z,CloseCircleOutlined:q},setup(e,{emit:l}){const t=f([]),o=f(!1),d=f([]),v=f(!1),i=f([]),n=f([]),c=f(null);function r(){const s=ne(c);if(!s)throw new Error("tree is null!");return s}x(n,(s,u)=>{if(o.value){const m=s.map(p=>{let a=j(d.value,h=>h.id===p,{id:"id",pid:"pid",children:"children"});return a=_({},a),delete a.children,a});O(()=>{t.value=JSON.parse(JSON.stringify(m)),r().setCheckedKeys(s)})}else{const m=s.map(p=>{let a=j(d.value,h=>h.id===p,{id:"id",pid:"pid",children:"children"});return a=_({},a),delete a.children,a});O(()=>{t.value=JSON.parse(JSON.stringify(m)),r().setSelectedKeys(s)})}},{immediate:!0,deep:!0}),x(i,(s,u)=>{if(!o.value){const m=s.map(p=>{let a=j(d.value,h=>h.id===p,{id:"id",pid:"pid",children:"children"});return a=_({},a),delete a.children,a});O(()=>{t.value=JSON.parse(JSON.stringify(m)),r().setSelectedKeys(s)})}},{immediate:!0,deep:!0});const[y,{setModalProps:k,closeModal:S}]=V(s=>w(this,null,function*(){const{selectorProps:u}=s;v.value=!0,o.value=u.multiSelect,re().then(m=>{d.value=m,console.log(u.selectedList);let p=u.selectedList.map(a=>a.id);o.value?(n.value=p,setTimeout(()=>{r().setCheckedKeys(n.value),r().setExpandedKeys(n.value)},200)):(i.value=p,setTimeout(()=>{r().setSelectedKeys(i.value),r().setExpandedKeys(i.value)},200))}).finally(()=>{v.value=!1}),k({wrapClassName:"selector-content"})}));function N(s){o.value?n.value=JSON.parse(JSON.stringify(s.checked)):n.value=JSON.parse(JSON.stringify(s.checked.length>0?[s.checked[0]]:[]))}function D(s){if(!o.value)i.value=s;else debugger}const K=G(()=>"\u9009\u62E9\u4EBA\u5458");function M(){o.value?n.value=[]:i.value=[]}function P(s){o.value?n.value.splice(n.value.findIndex(u=>u===s),1):i.value.splice(i.value.findIndex(u=>u===s),1)}function L(){l("success",t),S()}return{treeRef:c,multiSelect:o,treeData:d,treeLoading:v,registerModal:y,getTitle:K,selectedList:t,removeAllSelected:M,removeSelectedItem:P,handleSubmit:L,handleCheck:N,handleSelect:D}}}),de={class:"selected-items"};function ue(e,l,t,o,d,v){const i=g("Tag"),n=g("CloseCircleOutlined"),c=g("BasicTree"),r=g("PageWrapper"),y=g("BasicModal"),k=Q("loading");return C(),T(y,le({wrapClassName:"selector-body org"},e.$attrs,{onRegister:e.registerModal,title:e.getTitle,onOk:e.handleSubmit}),{default:b(()=>[U("div",de,[(C(!0),X(te,null,Y(e.selectedList,S=>(C(),T(i,{color:"processing",closable:"",onClose:N=>{N.preventDefault(),e.removeSelectedItem(S.id)}},{default:b(()=>[Z(ee(S.shortName),1)]),_:2},1032,["onClose"]))),256)),e.selectedList.length>0?(C(),T(n,{key:0,class:"close-all",title:"\u6E05\u7A7A",onClick:e.removeAllSelected},null,8,["onClick"])):se("",!0)]),J(r,{dense:"",contentClass:"flex"},{default:b(()=>[ae(J(c,{ref:"treeRef",class:"w-4/4 org-tree",title:"\u7EC4\u7EC7",search:"",clickRowToExpand:!1,treeData:e.treeData,replaceFields:{key:"id",title:"shortName"},onCheck:e.handleCheck,onSelect:e.handleSelect,checkable:!!e.multiSelect,selectable:!e.multiSelect,checkStrictly:!0,autoExpandParent:""},null,8,["treeData","onCheck","onSelect","checkable","selectable"]),[[k,e.treeLoading]])]),_:1})]),_:1},16,["onRegister","title","onOk"])}var be=oe(ce,[["render",ue]]);export{be as default};
  