index-B4FAxPOi.js 2.2 KB

1
  1. import{d as f,a as h,m as g,W as w,G as i,r as _,b as y,o as C,w as l,e as n,i as t,f as D,z as k,j as x,t as R,B as I,P as N}from"./index-DeVuvuhi.js";import{u as P,N as s,C as V}from"./index-BfNValCT.js";import{u as v,C as A}from"./index-BPbAW0q6.js";import"./index-Cx5q_pj_.js";import"./index-CIXl4eG1.js";const B={style:{display:"flex","justify-content":"flex-end",width:"100%"}},M=f({__name:"index",setup(F){const{t:a}=h();g();const{register:d,tableActions:p}=P({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(N,null,{default:l(()=>[n(t(V),{onRegister:t(d)},{titleRight:l(()=>[D("div",B,[k(n(b,{type:"primary",onClick:c},{default:l(()=>[x(R(t(a)("新增")),1)]),_:1},512),[[I,e.$perm(60)]])])]),_:1},8,["onRegister"]),n(t(A),{onRegister:t(u)},null,8,["onRegister"])]),_:1})}}});export{M as default};