import{X as b,O as g}from"./index.ae7ce77b.js";import V from"./index.f973ab4e.js";import B from"./index.0cf92373.js";import M from"./index.0c70ad89.js";import{G as N,D as E}from"./api.c3f42cf6.js";import{E as F}from"./elementPlus.346c766a.js";import{d as C,r as l,j as A,a9 as c,o as w,E as x,G as d,M as s,a as y,u as n,J as G,t as j}from"./vue.6daa721c.js";import{_ as O}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";import"./index.es.d2375c1e.js";import"./crud.58882cf5.js";import"./dictionary.4409c00a.js";import"./dictionary.270d3d72.js";import"./index.vue_vue_type_script_setup_true_name_importExcel_lang.0f2e9ebe.js";const X={class:"dept-box dept-left"},z={class:"dept-box dept-table"},I=C({name:"dept"}),J=C({...I,setup(K){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=b.toArrayTree(e.data,{parentKey:"parent",children:"children",strict:!0});p.value=t}},T=e=>{var t;(t=f.value)==null||t.handleDoRefreshUser(e.id)},U=(e,t)=>{F.confirm("您确认删除该部门吗?","温馨提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then(async()=>{var r;const a=await E(e);t(),(a==null?void 0:a.code)===2e3&&(g(a.msg),m(),(r=f.value)==null||r.handleDoRefreshUser(""))})},k=(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 A(()=>{m()}),(e,t)=>{const a=c("el-col"),r=c("el-row"),u=c("el-drawer"),R=c("fs-page");return w(),x(R,null,{default:d(()=>[s(r,{class:"dept-el-row"},{default:d(()=>[s(a,{span:6},{default:d(()=>[y("div",X,[s(V,{ref_key:"deptTreeRef",ref:D,treeData:n(p),onTreeClick:T,onUpdateDept:k,onDeleteDept:U},null,8,["treeData"])])]),_:1}),s(a,{span:18},{default:d(()=>[y("div",z,[s(M,{ref_key:"deptUserRef",ref:f},null,512)])]),_:1})]),_:1}),s(u,{modelValue:n(o),"onUpdate:modelValue":t[0]||(t[0]=v=>j(o)?o.value=v:o=v),title:"部门配置",direction:"rtl",size:"500px","close-on-click-modal":!1,"before-close":h},{default:d(()=>[n(o)?(w(),x(B,{key:0,initFormData:n(i),treeData:n(p),cacheData:n(_),onDrawerClose:h},null,8,["initFormData","treeData","cacheData"])):G("",!0)]),_:1},8,["modelValue"])]),_:1})}}});const re=O(J,[["__scopeId","data-v-1f6d3107"]]);export{re as default};
