import{d as Q,Q as X,J as Z,r as o,A as $,b as j,a1 as E,o as p,c as A,k as a,B as e,a as s,F,i as G,a3 as H,N as M,g as i,O as u,P as y,D as K,h as L,aF as aa,a7 as ea,S as la,$ as sa,R as ta,U as ra,V as oa,W as pa,X as ua,Y as da,Z as na}from"./index-CHTXMeh8.js";import{_ as ia}from"./DictTag.vue_vue_type_script_lang-DPOZRs0A.js";import{_ as ma}from"./ContentWrap.vue_vue_type_script_setup_true_lang-BjvrLlUT.js";import{d as ca}from"./formatTime-DG99nHw2.js";import{h as fa}from"./tree-BBZY150N.js";import{b as _a,d as ya}from"./index-BFn6KXm4.js";import{_ as va}from"./DeptForm.vue_vue_type_script_setup_true_lang-DxmrbA2S.js";import{g as ba}from"./index-DYclHsjD.js";import"./color-DXkOL5Tu.js";import"./el-card-Bdk9qx7q.js";import"./Dialog.vue_vue_type_style_index_0_lang-DH0TiLYN.js";import"./el-tree-select-DhIHMmfG.js";import"./constants-CuOBQ73z.js";const ka=Q({name:"SystemDept",__name:"index",setup(wa){const g=X(),{t:R}=Z(),v=o(!0),h=o(),r=$({pageNo:1,pageSize:100,name:void 0,status:void 0}),S=o(),b=o(!0),k=o(!0),V=o([]),m=async()=>{v.value=!0;try{const c=await _a(r);h.value=fa(c)}finally{v.value=!1}},D=()=>{k.value=!1,b.value=!b.value,aa(()=>{k.value=!0})},U=()=>{m()},P=()=>{r.pageNo=1,S.value.resetFields(),U()},N=o(),O=(c,t)=>{N.value.open(c,t)};return j(async()=>{await m(),V.value=await ba()}),(c,t)=>{const W=ea,w=la,Y=sa,q=ta,f=ra,d=oa,z=pa,T=ma,n=ua,B=ia,I=da,x=E("hasPermi"),J=na;return p(),A(F,null,[a(T,null,{default:e(()=>[a(z,{class:"-mb-15px",model:s(r),ref_key:"queryFormRef",ref:S,inline:!0,"label-width":"68px"},{default:e(()=>[a(w,{label:"\u90E8\u95E8\u540D\u79F0",prop:"name"},{default:e(()=>[a(W,{modelValue:s(r).name,"onUpdate:modelValue":t[0]||(t[0]=l=>s(r).name=l),placeholder:"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",clearable:"",class:"!w-240px"},null,8,["modelValue"])]),_:1}),a(w,{label:"\u90E8\u95E8\u72B6\u6001",prop:"status"},{default:e(()=>[a(q,{modelValue:s(r).status,"onUpdate:modelValue":t[1]||(t[1]=l=>s(r).status=l),placeholder:"\u8BF7\u9009\u62E9\u90E8\u95E8\u72B6\u6001",clearable:"",class:"!w-240px"},{default:e(()=>[(p(!0),A(F,null,G(s(H)(s(M).COMMON_STATUS),l=>(p(),i(Y,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(w,null,{default:e(()=>[a(d,{onClick:U},{default:e(()=>[a(f,{icon:"ep:search",class:"mr-5px"}),u(" \u641C\u7D22")]),_:1}),a(d,{onClick:P},{default:e(()=>[a(f,{icon:"ep:refresh",class:"mr-5px"}),u(" \u91CD\u7F6E")]),_:1}),y((p(),i(d,{type:"primary",plain:"",onClick:t[2]||(t[2]=l=>O("create"))},{default:e(()=>[a(f,{icon:"ep:plus",class:"mr-5px"}),u(" \u65B0\u589E ")]),_:1})),[[x,["system:dept:create"]]]),a(d,{type:"danger",plain:"",onClick:D},{default:e(()=>[a(f,{icon:"ep:sort",class:"mr-5px"}),u(" \u5C55\u5F00/\u6298\u53E0 ")]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),a(T,null,{default:e(()=>[s(k)?y((p(),i(I,{key:0,data:s(h),"row-key":"id","default-expand-all":s(b)},{default:e(()=>[a(n,{prop:"name",label:"\u90E8\u95E8\u540D\u79F0"}),a(n,{prop:"leader",label:"\u8D1F\u8D23\u4EBA"},{default:e(l=>{var _;return[u(K((_=s(V).find(C=>C.id===l.row.leaderUserId))==null?void 0:_.nickname),1)]}),_:1}),a(n,{prop:"sort",label:"\u6392\u5E8F"}),a(n,{prop:"status",label:"\u72B6\u6001"},{default:e(l=>[a(B,{type:s(M).COMMON_STATUS,value:l.row.status},null,8,["type","value"])]),_:1}),a(n,{label:"\u521B\u5EFA\u65F6\u95F4",align:"center",prop:"createTime",width:"180",formatter:s(ca)},null,8,["formatter"]),a(n,{label:"\u64CD\u4F5C",align:"center"},{default:e(l=>[y((p(),i(d,{link:"",type:"primary",onClick:_=>O("update",l.row.id)},{default:e(()=>[u(" \u4FEE\u6539 ")]),_:2},1032,["onClick"])),[[x,["system:dept:update"]]]),y((p(),i(d,{link:"",type:"danger",onClick:_=>(async C=>{try{await g.delConfirm(),await ya(C),g.success(R("common.delSuccess")),await m()}catch{}})(l.row.id)},{default:e(()=>[u(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[x,["system:dept:delete"]]])]),_:1})]),_:1},8,["data","default-expand-all"])),[[J,s(v)]]):L("",!0)]),_:1}),a(va,{ref_key:"formRef",ref:N,onSuccess:m},null,512)],64)}}});export{ka as default};