1import{A as b,At as l,C as c,Ct as E,E as S,L as T,M as C,Q as F,Y as N,Yt as D,_n as h,_t as R,at as L,et as v,it as O,k as j,mn as A,vt as z,zt as a}from"./vue.runtime.esm-bundler-BXOQDxND.js";import{s as x}from"./useUserStore-akqeyJtm.js";import{t as B}from"./useTrans-CkcD2w_Z.js";import{t as V}from"./getOnlyWorkAreaHeight-C-FsfmTC.js";import{t as P}from"./useMessage-DxvKLuVl.js";import{i as U,r as Y,t as H}from"./menu-B-OBkvdw.js";import{t as Q}from"./menu-tree-Dj1vNn8u.js";import{t as W}from"./menu-form-N5WRcBpY.js";T();E(),D();var $={class:"relative w-full overflow-hidden b-r-1 b-r-gray-2 b-r-solid pr-5 lg:w-4/12 dark-b-r-dark-3"},q={class:"relative mt-3 h-[calc(100%-250px)] w-full overflow-x-hidden overflow-y-auto pr-5 lg:mt-0 lg:h-full"},G={class:"sticky top-0 z-2 flex items-center justify-between b-b-1 b-b-gray-1 b-b-solid bg-white pb-3 text-base dark-b-b-dark-4 dark-bg-dark-8"},I=C({name:"permission:menu",__name:"index",setup(J){const m=l([]),k=l([]),s=l(null),i=l(),g=l(),y=l({id:void 0,parent_id:void 0,name:"",path:"",meta:{title:"æ°å¢é¡¶çº§èå",type:"M",componentSuffix:".vue",componentPath:"modules/",breadcrumbEnable:!0,copyright:!0,useDefaultLayout:!0,hidden:!1,affix:!1,cache:!0,activeName:"",auth:[],role:[],user:[]},component:"",sort:0,status:1,btnPermission:[]}),f=l(!1),u=B().globalTrans,d=P();async function _(){const{data:e}=await Y();m.value=e,m.value.map(r=>p(r.id))}function p(e,r=!0){const n=g.value.treeRef.elTree;if(n){const t=n.store._getAllNodes()?.find(o=>e===o.data.id);t&&(t.expanded=r)}}N(async()=>{await _()}),v("newMenu",y),v("menuList",m),v("defaultExpandNodes",k),v("setNodeExpand",p);function w(){s.value=Object.assign(y.value,{}),s.value.meta.title="",i.value?.setData?.(s.value),i.value?.menuForm?.getElFormRef().resetFields()}function M(){const{model:e}=i.value,{getElFormRef:r}=i.value.menuForm,n=r();f.value=!0,n.validate().then(()=>{e.parent_id||(e.parent_id=0),e.dataType&&e.dataType==="add"?H(e).then(async t=>{t.code===x.SUCCESS?d.success(u("crud.createSuccess")):d.error(t.message),await _(),w(),p(e.parent_id)}):s.value!==null&&e.dataType==="edit"&&e.id?U(e.id,e).then(async t=>{t.code===x.SUCCESS?d.success(u("crud.updateSuccess")):d.error(t.message),await _(),p(e.id)}):d.alertError(u("baseMenuManage.addError")),f.value=!1}).catch(t=>{Object.keys(t)?.[0]&&n.scrollToField(Object.keys(t)?.[0]),f.value=!1})}return(e,r)=>{const n=O("el-button"),t=L("loading");return z((F(),S("div",{class:"mine-card menu-container h-full gap-x-4.5 lg:flex",style:A({height:`${a(V)()+12}px`})},[c("div",$,[b(Q,{ref_key:"menuTreeRef",ref:g,data:a(m),onMenuSelect:r[0]||(r[0]=o=>{o?.meta?.type==="M"&&o?.meta?.useDefaultLayout===void 0&&(o.meta.useDefaultLayout=!0),s.value=o,a(i)?.setData?.(o)})},null,8,["data"])]),c("div",q,[c("div",G,[c("span",null,h(a(s)?a(s).meta?.i18n?a(u)(a(s).meta?.i18n):a(s).meta?.title:a(u)("baseMenuManage.addTopMenu")),1),c("div",null,[b(n,{type:"primary",onClick:M},{default:R(()=>[j(h(a(u)("crud.save")),1)]),_:1})])]),b(W,{ref_key:"menuFormRef",ref:i},null,512)])],4)),[[t,a(f)]])}}}),ne=I;export{ne as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.