import{d as D,u as S,r as b,V as T,D as g,X as h,e as w,i as n,o as u,w as t,h as i,p as l,k as o,t as s,g as I,x as P,z as F,q as $,P as A}from"./index-5k_MqT6o.js";import{u as B,C as N}from"./index-Cl9RbTBn.js";import{u as z,C as L}from"./index-BHx7dntQ.js";import"./index-CAzgmO3A.js";const U={style:{display:"flex","justify-content":"flex-end",width:"100%"}},K=D({__name:"index",setup(j){const{t:e}=S(),d=b(),m=b(e("编辑")),r=b(!1),{register:k,tableActions:_}=B({title:"菜单",api:g.menuList,showSelection:!1,showIndex:!1,showAction:T(30,40,50),immediate:!0,columns:[{prop:"id",label:"ID",width:100},{prop:"parent_id",label:"父级ID",width:60},{prop:"type",label:"菜单类型",slot:!0,width:100,align:"center"},{prop:"name",label:"菜单名称",formatter(a){return e(a.name)}},{prop:"sort",label:"排序",width:80},{prop:"perms",label:"权限",width:100},{prop:"params",label:"参数",width:100},{prop:"paths",label:"路径"},{prop:"status",label:"状态",slot:!0,width:100,align:"center"}],schema:[],actionProps:{width:240,btnList:[{perm:30,label:"新增下级",click:a=>{m.value=e("新增下级"),r.value=!0,h(()=>{d.value.manualRegister(),v({parent_id:a.row.id})})}},{perm:40,label:"编辑",click:a=>{m.value=e("编辑"),r.value=!0,h(()=>{d.value.manualRegister(),v({...a.row})})}},{perm:50,label:"删除",isPopConfirm:!0,type:"danger",popConfirmEmits:{confirm(a){return g.menuDelete({id:a.row.id}).then(()=>{_.reload()}),!0}}}]}}),[V,{getValues:C,setFormModel:v,setValues:E,setSchema:M}]=z({colSpan:24,schema:[{label:"ID",prop:"id",type:"input",required:!0,props:{disabled:!0},notShow:!0},{label:"父级ID",prop:"parent_id",type:"input",required:!1},{label:"菜单名称",prop:"name",type:"input",required:!0},{label:"菜单类型",prop:"type",type:"radio-group",required:!0,props:{disabled:!1},options:[{label:e("菜单"),value:1},{label:e("按钮"),value:2}],defaultValue:2},{label:"路径",prop:"paths",type:"input",required:!1},{label:"权限",prop:"perms",type:"input",required:!0,defaultValue:"admin",props:{disabled:!1}},{prop:"params",label:"参数",type:"input",required:!1},{label:"排序",prop:"sort",type:"input",required:!0,props:{type:"number"},defaultValue:0},{prop:"status",label:"状态",type:"switch",props:{activeValue:1,inactiveValue:0,activeText:e("正常"),inactiveText:e("停用"),inlinePrompt:!0,size:"large"},defaultValue:1}],elFormStyle:{}});function R(){m.value=e("新增"),r.value=!0,h(()=>{d.value.manualRegister()})}function q(){g.menuUpdate({...C()}).then(a=>{r.value=!1,_.reload()})}return(a,f)=>{const y=w("el-button"),c=w("el-tag"),x=w("el-dialog");return u(),n(A,null,{default:t(()=>[i(l(N),{onRegister:l(k),"row-key":"id"},{titleRight:t(()=>[I("div",U,[P(i(y,{type:"primary",onClick:R},{default:t(()=>[o(s(l(e)("新增")),1)]),_:1},512),[[F,a.$perm(30)]])])]),type:t(p=>[p.row.type===2?(u(),n(c,{key:0,type:"primary"},{default:t(()=>[o(s(l(e)("按钮")),1)]),_:1})):(u(),n(c,{key:1,type:"success"},{default:t(()=>[o(s(l(e)("菜单")),1)]),_:1}))]),status:t(p=>[p.row.type===0?(u(),n(c,{key:0,type:"danger"},{default:t(()=>[o(s(l(e)("停用")),1)]),_:1})):(u(),n(c,{key:1,type:"success"},{default:t(()=>[o(s(l(e)("正常")),1)]),_:1}))]),_:1},8,["onRegister"]),i(x,{title:l(m),width:"500",modelValue:l(r),"onUpdate:modelValue":f[1]||(f[1]=p=>$(r)?r.value=p:null),draggable:""},{footer:t(()=>[i(y,{onClick:f[0]||(f[0]=p=>r.value=!1)},{default:t(()=>[o(s(a.$t("取消")),1)]),_:1}),i(y,{onClick:q,type:"primary"},{default:t(()=>[o(s(a.$t("确定")),1)]),_:1})]),default:t(()=>[i(l(L),{ref_key:"formRef",ref:d,onRegister:l(V)},null,8,["onRegister"])]),_:1},8,["title","modelValue"])]),_:1})}}});export{K as default};
