import{d as J,r as u,w as Q,a8 as l,o as x,c as C,M as t,u as c,t as I,a as v,G as a,H as g,N as y,K as E,L as N,F as W,a7 as X,a4 as Y,ap as Z,aq as ee}from"./vue.95e072e2.js";import{g as te}from"./index.es.d2375c1e.js";import{s as oe,A as ae}from"./elementPlus.58179425.js";import{l as ne,d as le,a as se}from"./api.351ab3b0.js";import{P as L}from"./index.8a64ecdf.js";import{_ as ie}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const de=h=>(Z("data-v-0a1dffe4"),h=h(),ee(),h),ce={class:"dept-tree-com"},re={class:"tc-head"},ue=de(()=>v("span",{class:"tc-head-txt"},"部门架构",-1)),pe={key:0,class:"text-center font-black font-normal"},fe={key:1,color:"var(--el-color-primary)"},_e={class:"tree-tags"},me=J({__name:"index",props:{treeData:{default:()=>[]}},emits:["treeClick","deleteDept","updateDept"],setup(h,{expose:B,emit:F}){const H=te(X),M={children:"children",label:"name",isLeaf:(o,e)=>!e.data.hasChild},k=F;let p=u(""),r=u(!1),f=u(!1),s=u({}),S=u(null);const w=u();Q(p,o=>{w.value.filter(o)});const P=(o,e)=>{var n;return o?((n=Y(e).name)==null?void 0:n.indexOf(o))!==-1:!0},R=(o,e)=>{o.level!==0&&ne({parent:o.data.id}).then(n=>{e(n.data)})},U=(o,e)=>{s.value=o,S.value=e,k("treeClick",o)},z=o=>{if(o==="update"){if(!s.value.id){L("请选择菜单！");return}k("updateDept",o,s.value)}else k("updateDept",o)},$=()=>{if(!s.value.id){L("请选择菜单！");return}k("deleteDept",s.value.id,()=>{s.value={}})},T=async o=>{var i;if(!s.value.id){L("请选择菜单！");return}if(f.value)return;const e=((i=S.value)==null?void 0:i.parent.childNodes)||[],n=e.findIndex(_=>_.data.id===s.value.id),D=e.find(_=>_.data.id===s.value.id);if(o==="up"){if(n===0)return;e.splice(n-1,0,D),e.splice(n+1,1),f.value=!0,await le({dept_id:s.value.id}),f.value=!1}o==="down"&&(e.splice(n+2,0,D),e.splice(n,1),f.value=!0,await se({dept_id:s.value.id}),f.value=!1)};return B({treeRef:w}),(o,e)=>{const n=l("el-input"),D=l("HomeFilled"),i=l("el-icon"),_=l("View"),q=l("Hide"),V=l("SvgIcon"),A=l("Plus"),m=l("el-tooltip"),G=l("Edit"),K=l("Top"),O=l("Bottom"),j=l("Delete");return x(),C(W,null,[t(n,{modelValue:c(p),"onUpdate:modelValue":e[0]||(e[0]=d=>I(p)?p.value=d:p=d),"prefix-icon":c(oe),placeholder:"请输入部门名称"},null,8,["modelValue","prefix-icon"]),v("div",ce,[v("div",re,[t(i,{size:"16",color:"#606266",class:"tc-head-icon"},{default:a(()=>[t(D)]),_:1}),ue,t(i,{size:"16",color:"#606266",onClick:e[1]||(e[1]=()=>I(r)?r.value=!c(r):r=!c(r)),class:"tc-head-icon"},{default:a(()=>[g(t(_,null,null,512),[[y,!c(r)]]),g(t(q,null,null,512),[[y,c(r)]])]),_:1})]),t(c(ae),{ref_key:"treeRef",ref:w,data:o.treeData,props:M,"filter-node-method":P,load:R,lazy:"",indent:38,onNodeClick:U,"highlight-current":""},{default:a(({node:d,data:b})=>[t(c(H),{node:d,showLabelLine:!1,indent:32},{default:a(()=>[b.status?(x(),C("span",pe,[t(V,{name:"iconfont icon-shouye",color:"var(--el-color-primary)"}),E(" "+N(d.label)+" ",1),g(v("span",null,"（"+N(b.dept_user_count)+"人）",513),[[y,c(r)]])])):(x(),C("span",fe,[t(V,{name:"iconfont icon-shouye"}),E(" "+N(d.label),1)]))]),_:2},1032,["node"])]),_:1},8,["data"]),v("div",_e,[t(m,{effect:"dark",content:"新增"},{default:a(()=>[t(i,{size:"16",onClick:e[2]||(e[2]=d=>z("create")),class:"mlt-icon"},{default:a(()=>[t(A)]),_:1})]),_:1}),t(m,{effect:"dark",content:"编辑"},{default:a(()=>[t(i,{size:"16",onClick:e[3]||(e[3]=d=>z("update")),class:"mlt-icon"},{default:a(()=>[t(G)]),_:1})]),_:1}),t(m,{effect:"dark",content:"上移"},{default:a(()=>[t(i,{size:"16",onClick:e[4]||(e[4]=d=>T("up")),class:"mlt-icon"},{default:a(()=>[t(K)]),_:1})]),_:1}),t(m,{effect:"dark",content:"下移"},{default:a(()=>[t(i,{size:"16",onClick:e[5]||(e[5]=d=>T("down")),class:"mlt-icon"},{default:a(()=>[t(O)]),_:1})]),_:1}),t(m,{effect:"dark",content:"删除"},{default:a(()=>[t(i,{size:"16",onClick:$,class:"mlt-icon"},{default:a(()=>[t(j)]),_:1})]),_:1})])])],64)}}});const ge=ie(me,[["__scopeId","data-v-0a1dffe4"]]);export{ge as default};
