import{X as R,n as V,F as g}from"./index.Df8UJ10K.js";import B from"./index.Bv0zyVQu.js";import F from"./index.BIBYolf2.js";import M from"./index.RnR9RrDc.js";import{G as N,D as A}from"./api.CryKD3hM.js";import{a as y,r as l,q as j,aj as d,J as w,o as C,K as c,S as n,b as x,u as s,y as E,M as G}from"./vue.D1BjjNmv.js";import{_ as K}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./index.es.DmevZXPX.js";import"./md5.DLPczxzP.js";import"./crud.Fhh5uWPw.js";import"./dictionary.BEN7awPC.js";import"./authFunction.Cmg2kwFe.js";import"./echarts.Bm4fHez2.js";const X={class:"dept-box dept-left"},q={class:"dept-box dept-table"},z=y({name:"dept"}),I=y({...z,setup(J){let p=l([]),_=l([]),o=l(!1),i=l({}),f=l(null),D=l(null);const m=async()=>{let e=await N({});if((e==null?void 0:e.code)===2e3&&Array.isArray(e.data)){const t=R.toArrayTree(e.data,{parentKey:"parent",children:"children"});p.value=t}},T=e=>{var t;(t=f.value)==null||t.handleDoRefreshUser(e.id)},U=(e,t)=>{V.confirm("您确认删除该部门吗?","温馨提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(async()=>{var r;const a=await A(e);t(),(a==null?void 0:a.code)===2e3&&(g(a.msg),m(),(r=f.value)==null||r.handleDoRefreshUser(""))})},b=(e,t)=>{var a,r;if(e==="update"&&t){const u=((r=(a=D.value)==null?void 0:a.treeRef)==null?void 0:r.currentNode.parent.data)||{};_.value=[u],i.value=t}o.value=!0},h=e=>{e==="submit"&&m(),o.value=!1,i.value={}};return j(()=>{m()}),(e,t)=>{const a=d("el-col"),r=d("el-row"),u=d("el-drawer"),k=d("fs-page");return C(),w(k,null,{default:c(()=>[n(r,{class:"dept-el-row"},{default:c(()=>[n(a,{span:3},{default:c(()=>[x("div",X,[n(B,{ref_key:"deptTreeRef",ref:D,treeData:s(p),onTreeClick:T,onUpdateDept:b,onDeleteDept:U},null,8,["treeData"])])]),_:1}),n(a,{span:21},{default:c(()=>[x("div",q,[n(M,{ref_key:"deptUserRef",ref:f},null,512)])]),_:1})]),_:1}),n(u,{modelValue:s(o),"onUpdate:modelValue":t[0]||(t[0]=v=>E(o)?o.value=v:o=v),title:"部门配置",direction:"rtl",size:"500px","close-on-click-modal":!1,"before-close":h},{default:c(()=>[s(o)?(C(),w(F,{key:0,initFormData:s(i),treeData:s(p),cacheData:s(_),onDrawerClose:h},null,8,["initFormData","treeData","cacheData"])):G("",!0)]),_:1},8,["modelValue"])]),_:1})}}}),oe=K(I,[["__scopeId","data-v-31d84f24"]]);export{oe as default};
