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