var g=(v,f,c)=>new Promise((d,p)=>{var r=t=>{try{o(c.next(t))}catch(i){p(i)}},n=t=>{try{o(c.throw(t))}catch(i){p(i)}},o=t=>t.done?d(t.value):Promise.resolve(t.value).then(r,n);o((c=c.apply(v,f)).next())});import{d as N,c as P,f as l,n as k,U as w,a2 as u,a3 as D,k as M,af as V,u as s,F as b,ad as E,V as F}from"./vue-vendor-CxLCUzY4.js";import{u as I,_ as L}from"./index-CLZzJyTP.js";import{_ as R}from"./index-44tRnyoF.js";import{l as j,s as q}from"./depart.user.api-Bvirj8Bq.js";import"./antd-vue-vendor-CahNzUUa.js";import"./vxe-table-vendor-Cdi8WfTx.js";import"./index-DvqyyN77.js";import"./bem-DT3DdmOs.js";import"./props-CG-jAkbI.js";import"./index-DS3utcig.js";import"./index-BZbg0EjM.js";import"./index-CrdW4fN1.js";import"./useTimeout-KpZCXEcl.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./useContextMenu-BGU2vdqV.js";const U={class:"bg-white m-4 mr-0 overflow-hidden"},W=N({__name:"DepartTree",emits:["select"],setup(v,{emit:f}){const c=P("prefixCls"),d=f,{createMessage:p}=I();let r=l(!1),n=l([]),o=l([]),t=l([]),i=l(!0),h=l("2"),m=l(!1);function x(){r.value=!0,n.value=[],j().then(e=>{e.success?Array.isArray(e.result)&&(n.value=e.result,h.value=e.message,T()):p.warning(e.message)}).finally(()=>r.value=!1)}x();function T(){let e=[];n.value.forEach((a,_)=>{a.children&&a.children.length>0&&e.push(a.key),_===0&&y(a.id,a)}),e.length>0&&(C(),o.value=e)}function C(){return g(this,null,function*(){yield k(),m.value=!0,yield k(),m.value=!1})}function y(e,a){t.value=[e],a&&d("select",a)}function K(e){e?(r.value=!0,q({keyWord:e,myDeptSearch:"1"}).then(a=>{Array.isArray(a)?n.value=a:(p.warning("未查询到部门信息"),n.value=[])}).finally(()=>r.value=!1)):x()}function S(e,a){e.length>0&&t.value[0]!==e[0]?y(e[0],a.selectedNodes[0]):y(t.value[0])}function A(e){o.value=e,i.value=!1}return(e,a)=>{const _=w("a-empty"),B=w("a-spin");return u(),D("div",U,[M(B,{spinning:s(r)},{default:V(()=>[s(h)==="2"?(u(),D(b,{key:0},[s(m)?F("",!0):(u(),E(s(R),{key:0,title:"部门列表",toolbar:"",search:"",showLine:"",checkStrictly:!0,clickRowToExpand:!1,treeData:s(n),selectedKeys:s(t),expandedKeys:s(o),autoExpandParent:s(i),onSelect:S,onExpand:A,onSearch:K},null,8,["treeData","selectedKeys","expandedKeys","autoExpandParent"]))],64)):(u(),E(_,{key:1,description:"普通员工无此权限"}))]),_:1},8,["spinning"])])}}}),oe=L(W,[["__scopeId","data-v-0cfa4334"]]);export{oe as default};
