import{_ as J}from"./index.vue_vue_type_script_setup_true_name_svgIcon_lang.278ff746.js";import{d as Q,r as u,w as W,a9 as s,o as x,c as C,M as t,u as c,t as E,a as v,G as a,H as y,N,K as H,L as g,F as X,a8 as Y,a5 as Z,aq as ee,ar as te}from"./vue.65d9dadc.js";import{g as oe}from"./index.es.d2375c1e.js";import{s as ae,H as ne}from"./elementPlus.c5b0e04f.js";import{l as le,d as se,a as ie}from"./api.0bfb3a06.js";import{P as L}from"./index.373e4c1e.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 F=oe(Y),M={children:"children",label:"name",isLeaf:(o,e)=>!e.data.hasChild},k=B;let p=u(""),r=u(!1),f=u(!1),l=u({}),z=u(null);const w=u();W(p,o=>{w.value.filter(o)});const P=(o,e)=>{var n;return o?((n=Z(e).name)==null?void 0:n.indexOf(o))!==-1:!0},R=(o,e)=>{o.level!==0&&le({parent:o.data.id}).then(n=>{e(n.data)})},$=(o,e)=>{l.value=o,z.value=e,k("treeClick",o)},S=o=>{if(o==="update"){if(!l.value.id){L("请选择菜单！");return}k("updateDept",o,l.value)}else k("updateDept",o)},U=()=>{if(!l.value.id){L("请选择菜单！");return}k("deleteDept",l.value.id,()=>{l.value={}})},T=async o=>{var i;if(!l.value.id){L("请选择菜单！");return}if(f.value)return;const e=((i=z.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"),q=s("Hide"),V=J,G=s("Plus"),m=s("el-tooltip"),K=s("Edit"),O=s("Top"),j=s("Bottom"),A=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),[[N,!c(r)]]),y(t(q,null,null,512),[[N,c(r)]])]),_:1})]),t(c(ne),{ref_key:"treeRef",ref:w,data:o.treeData,props:M,"filter-node-method":P,load:R,lazy:"",indent:38,onNodeClick:$,"highlight-current":""},{default:a(({node:d,data:b})=>[t(c(F),{node:d,showLabelLine:!1,indent:32},{default:a(()=>[b.status?(x(),C("span",fe,[t(V,{name:"iconfont icon-shouye",color:"var(--el-color-primary)"}),H(" "+g(d.label)+" ",1),y(v("span",null,"（"+g(b.dept_user_count)+"人）",513),[[N,c(r)]])])):(x(),C("span",_e,[t(V,{name:"iconfont icon-shouye"}),H(" "+g(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=>S("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=>S("update")),class:"mlt-icon"},{default:a(()=>[t(K)]),_: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(O)]),_: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(j)]),_:1})]),_:1}),t(m,{effect:"dark",content:"删除"},{default:a(()=>[t(i,{size:"16",onClick:U,class:"mlt-icon"},{default:a(()=>[t(A)]),_:1})]),_:1})])])],64)}}});const ge=de(ve,[["__scopeId","data-v-0a1dffe4"]]);export{ge as default};
