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