import{b as E,ah as f,J as T,o as w,c as R,p as t,q as a,P as d,x as u,n as s,aj as x,e$ as B,eD as N,eE as P,eF as V,f0 as I,S,l as v,k as q,j as F,m as j,D as A}from"./index.8d733f79.js";import J from"./addMenuDialog.f9d7b04a.js";import"./el-input-number.60463ef8.js";import"./index.28f6da25.js";const L={style:{height:"100%",display:"flex","flex-direction":"column"}},Q={__name:"pcMenu",setup(H,{expose:h}){const{t:y,locale:K}=E(),{proxy:p}=A(),m=f({total:0,tableData:[],columns:[{prop:"title",label:"menuName",width:200},{prop:"path",label:"url",formatter:e=>e.menuType==="C"?e.parentPath&&e.isBuiltin?`${e.parentPath}/${e.path}`:e.path:"-",width:300},{prop:"menuType",label:"type",formatter:e=>e.menuType==="M"?"\u83DC\u5355\u7EC4":e.menuType==="C"?"\u83DC\u5355":"-"},{prop:"parentTitle",label:"parentMenu"},{prop:"sort",label:"menuSort"},{prop:"hidden",label:"isVisible",formatter:e=>e.hidden?"\u4E0D\u663E\u793A":"\u663E\u793A"},{label:"action",type:"action",width:180,fixed:"right"}]}),i=f({title:""}),_=T.session.getJSON("userInfo").deployType==="cloud";async function r(){const e=await B(i);m.tableData=e.data,N().generateRoutes().then(n=>{n.forEach(l=>{P(l.path)||V.addRoute(l)})})}const b=()=>{i.title="",r()},g=()=>{p.$refs.addMenuDialogRef.showDialog()},D=e=>{p.$refs.addMenuDialogRef.showDialog(e)},$=e=>{p.$modal.confirm(y("confirmDelete")).then(()=>{I(e.id).then(n=>{S.success(n.msg),r()})}).catch(()=>{})};return h({getList:r}),(e,n)=>{const l=v,c=q,k=F,C=j;return w(),R("div",L,[t(C,{ref:"formRef",model:s(i),inline:!0,"label-width":"68px"},{default:a(()=>[t(c,null,{default:a(()=>[t(l,{type:"primary",onClick:g},{default:a(()=>[d(u(e.$t("addMenu")),1)]),_:1})]),_:1}),t(c,{label:e.$t("menuName")},{default:a(()=>[t(k,{modelValue:s(i).title,"onUpdate:modelValue":n[0]||(n[0]=o=>s(i).title=o),placeholder:e.$t("menuNameP"),maxlength:"10",style:{width:"236px"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(c,null,{default:a(()=>[t(l,{type:"primary",onClick:r},{default:a(()=>[d(u(e.$t("query")),1)]),_:1}),t(l,{onClick:b},{default:a(()=>[d(u(e.$t("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),t(s(x),{class:"f-h",rowKey:"id",columns:s(m).columns,tableData:s(m).tableData,pagination:!1,expandAll:!0},{action:a(({scope:o})=>[t(l,{link:"",type:"primary",onClick:M=>D(o.row),disabled:_&&o.row.isBuiltin},{default:a(()=>[d(u(e.$t("edit")),1)]),_:2},1032,["onClick","disabled"]),t(l,{link:"",type:"danger",onClick:M=>$(o.row),disabled:o.row.isBuiltin},{default:a(()=>[d(u(e.$t("delete")),1)]),_:2},1032,["onClick","disabled"])]),_:1},8,["columns","tableData"]),t(J,{ref:"addMenuDialogRef",onRefresh:r},null,512)])}}};export{Q as default};
