import{d as h,u as f,r as g,V as w,D as i,e as _,i as y,o as C,w as l,h as n,p as t,g as D,x as k,k as x,t as R,z as V,P as I}from"./index-5k_MqT6o.js";import{u as N,N as s,C as P}from"./index-Cl9RbTBn.js";import{u as v,C as A}from"./index-BfmhdFfx.js";import"./index-BHx7dntQ.js";import"./index-CAzgmO3A.js";const F={style:{display:"flex","justify-content":"flex-end",width:"100%"}},j=h({__name:"index",setup(S){const{t:a}=f();g();const{register:d,tableActions:p}=N({title:"部门列表",api:i.departmentList,showSelection:!1,showIndex:!1,showAction:w(60,70,80),immediate:!0,columns:[{prop:"id",label:"部门ID",width:80,align:"center"},{prop:"name",label:"部门名称"},{prop:"parent_id",label:"上级部门ID",width:80,align:"center"},{prop:"weight",label:"权重",width:80,align:"center"},{prop:"status",label:"状态",tagEnums:s,align:"center",width:100},{prop:"remark",label:"备注"}],schema:[{label:"部门名称",prop:"name",type:"input"},{label:"状态",prop:"status",type:"select",options:s}],actionProps:{width:240,btnList:[{label:"新增下级",perm:60,click:e=>{o({title:a("新增下级")},()=>{r().setValues("parent_id",e.row.id)})}},{perm:70,label:"编辑",click:e=>{o({title:a("编辑")},()=>{r().setFormModel(e.row)})}},{perm:80,label:"删除",isPopConfirm:!0,type:"danger",popConfirmEmits:{confirm(e){return i.departmentDelete({id:e.row.id}).then(()=>{p.reload()}),!0}}}]}}),[u,{open:o,getFormActions:r}]=v({submit(e,m){i.departmentUpdate(e).then(()=>{r().reset(),m(),p.reload()})},formConfig:{schema:[{label:"id",prop:"id",type:"input",notShow:!0},{label:"上级部门ID",prop:"parent_id",type:"input"},{label:"部门名称",prop:"name",type:"input",required:!0},{label:"备注",prop:"remark",type:"input"},{label:"状态",prop:"status",type:"select",options:s,defaultValue:1},{label:"权重",prop:"weight",type:"input"}]}});function c(){o({title:a("新增")})}return(e,m)=>{const b=_("el-button");return C(),y(I,null,{default:l(()=>[n(t(P),{onRegister:t(d)},{titleRight:l(()=>[D("div",F,[k(n(b,{type:"primary",onClick:c},{default:l(()=>[x(R(t(a)("新增")),1)]),_:1},512),[[V,e.$perm(60)]])])]),_:1},8,["onRegister"]),n(t(A),{onRegister:t(u)},null,8,["onRegister"])]),_:1})}}});export{j as default};
