import{d as X,bk as Z,V as J,r as s,a4 as Q,aw as Y,c as M,o as h,w as n,j as t,U as ee,M as ne,W as te,i as f,k as se,l as e,ds as ae,N as oe,dA as le,h as ce,aB as ie,cB as ue,H as re,B as _e,p as v,A as o,h3 as de,eG as pe,D as me,df as fe,G as ve,S as ge,X as ye,cZ as he}from"./index-9PRMimni.js";import{_ as xe}from"./CreateDrawer.vue_vue_type_script_setup_true_lang-t9fiaZLa.js";import{_ as ke,d as we,g as be,a as Ce}from"./MenuForm.vue_vue_type_style_index_0_sctep_true_lang-MC3Dk96F.js";import"./BasicSelect-C_uwzMkE.js";import"./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";import"./dictionary-BRse4lkf.js";import"./index-DkvzUEqh.js";import"./index-kKnqLkWM.js";import"./FormItemGridItem-CDUF0EA0.js";import"./RadioButton-oqN0Zkh5.js";const Me={class:"flex items-center"},Be={class:"flex items-center"},De={class:"w-full menu"},Le={class:"py-3 menu-list"},Ne={key:0,class:"flex items-center justify-center py-4"},Ee=X({__name:"index",setup(Re){const A=he(),K=Z(),{t:r}=J(),B=s(),_=s([]),T=s(K.getLocale==="en"?"menuNameEn":"menuName"),D=s("id"),i=s([]),g=s(!0),x=s(!1),d=s(!1),l=s(""),y=s(""),L=s(""),k=s(),w=s(),b=Q(()=>+w.value?.menuType==1?"菜单":"按钮");function F(){we(w.value.id).then(()=>{A.success("删除成功"),d.value=!1,l.value="",k.value.handleReset(),C()})}function I(){L.value="添加菜单";const{openDrawer:a}=B.value;a()}async function O(a,u){if(a.length){const p=u?.[0];l.value=p.label,x.value=!0;const c=await be(a[0]),m=Array.isArray(c)?c[0]:c;w.value=m,k.value.setData(m),d.value=!0,x.value=!1}else d.value=!1,l.value=""}function P(){i.value.length?i.value=[]:i.value=e(_).map(a=>a[D.value])}async function C(){g.value=!0;try{_.value=await Ce(),g.value=!1}catch{g.value=!1}}async function N(){C(),l.value="",d.value=!1}function V(a){i.value=a}return Y(async()=>{await C()}),(a,u)=>{const p=oe,c=_e,m=re,E=se,R=ie,U=ue,S=te,z=ne,$=ve,W=ge,j=fe,G=ee,H=ye;return h(),M(H,null,{default:n(()=>[t(G,{cols:"1 s:1 m:1 l:4 xl:4 2xl:4",responsive:"screen","x-gap":12},{default:n(()=>[t(z,{span:"1"},{default:n(()=>[t(S,{segmented:{content:"hard"},bordered:!1,size:"small"},{header:n(()=>[t(m,null,{default:n(()=>[t(c,{type:"primary","icon-placement":"left",onClick:I},{icon:n(()=>[f("div",Me,[t(p,{size:"14"},{default:n(()=>[t(e(de))]),_:1})])]),default:n(()=>[v(o(e(r)("system.menu.addMenu"))+" ",1)]),_:1}),t(c,{type:"primary",ghost:"","icon-placement":"left",onClick:P},{icon:n(()=>[f("div",Be,[t(p,{size:"14"},{default:n(()=>[t(e(pe))]),_:1})])]),default:n(()=>[v(o(e(r)("system.menu.all"))+" "+o(e(i).length?e(r)("system.menu.retract"):e(r)("system.menu.expand"))+" ",1)]),_:1})]),_:1})]),default:n(()=>[f("div",De,[t(E,{value:e(y),"onUpdate:value":u[0]||(u[0]=q=>ae(y)?y.value=q:null),placeholder:e(r)("system.menu.namePla")},{suffix:n(()=>[t(p,{size:"18",class:"cursor-pointer"},{default:n(()=>[t(e(le))]),_:1})]),_:1},8,["value","placeholder"]),f("div",Le,[e(g)?(h(),ce("div",Ne,[t(R,{size:"medium"})])):(h(),M(U,{key:1,"block-line":"",cascade:"","virtual-scroll":!0,pattern:e(y),data:e(_),expandedKeys:e(i),"label-field":e(T),"key-field":e(D),"children-field":"childButtons",style:{"max-height":"650px",overflow:"hidden"},"onUpdate:selectedKeys":O,"onUpdate:expandedKeys":V},null,8,["pattern","data","expandedKeys","label-field","key-field"]))])])]),_:1})]),_:1}),t(z,{span:"3"},{default:n(()=>[t(S,{segmented:{content:"hard"},bordered:!1,size:"small"},{header:n(()=>[t(m,null,{default:n(()=>[f("span",null,"编辑"+o(e(b))+o(e(l)?`：${e(l)}`:""),1),t($,{vertical:""}),t(W,{depth:"3",class:"text-sm"},{default:n(()=>u[1]||(u[1]=[v(" 从左侧列表选择一项后，进行编辑 ")])),_:1})]),_:1})]),"header-extra":n(()=>[e(d)?(h(),M(j,{key:0,onPositiveClick:F},{trigger:n(()=>[t(c,{quaternary:"",type:"primary"},{default:n(()=>[v("删除"+o(e(b)),1)]),_:1})]),default:n(()=>[v(" 确定要删除 "+o(e(l))+" "+o(e(b))+"吗？ ",1)]),_:1})):me("",!0)]),default:n(()=>[t(R,{show:e(x)},{default:n(()=>[t(ke,{ref_key:"menuFormRef",ref:k,permissionList:e(_),isShowSubmit:"",class:"w-2/4 ml-10",onChange:N},null,8,["permissionList"])]),_:1},8,["show"])]),_:1})]),_:1})]),_:1}),t(xe,{ref_key:"createDrawerRef",ref:B,title:e(L),permissionList:e(_),onChange:N},null,8,["title","permissionList"])]),_:1})}}});export{Ee as default};
