var B=Object.defineProperty,j=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var C=(u,n,e)=>n in u?B(u,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[n]=e,y=(u,n)=>{for(var e in n||(n={}))F.call(n,e)&&C(u,e,n[e]);if(k)for(var e of k(n))I.call(n,e)&&C(u,e,n[e]);return u},w=(u,n)=>j(u,z(n));var b=(u,n,e)=>new Promise((_,v)=>{var c=i=>{try{f(e.next(i))}catch(l){v(l)}},a=i=>{try{f(e.throw(i))}catch(l){v(l)}},f=i=>i.done?_(i.value):Promise.resolve(i.value).then(c,a);f((e=e.apply(u,n)).next())});import{u as O}from"./useCurrentInstance-cd4729ef.js";import{l as R,e as h,s as q}from"./menu-manage-faee0c27.js";import{d as K,r as U,K as S,j as r,o as A,h as D,w as d,b as E,e as t,k as s}from"./index-90c78f99.js";const G={class:"flex justify-center"},Q=K({__name:"menu-drawer",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(u,{emit:n}){const e=u,{proxy:_}=O(),v=U([]),c=U(),a=U({path:void 0,title:void 0,name:void 0,menuType:void 0,component:void 0,icon:void 0,sort:void 0,activeMenu:void 0,id:void 0,pid:void 0,hidden:void 0,parentId:void 0}),f=i=>b(this,null,function*(){i&&(yield i.validate(l=>b(this,null,function*(){l&&(yield(e.data&&e.data.id&&!(e.data&&e.data.type)?h:q)(w(y({},a.value),{name:a.value.path&&a.value.path.replace("/","")})),_.$message.success(`${e.data&&e.data.id&&!(e.data&&e.data.type)?"编辑":"新增"}成功！`),n("close",!0),location.reload())})))});return S(()=>e.visible,i=>b(this,null,function*(){if(i){const l=yield R({pageNumber:1,pageSize:999});v.value=l.data,e&&e.data&&(a.value=w(y({},e.data),{children:void 0}),e.data&&e.data.type&&(a.value.pid=e&&e.data.id,a.value.id=void 0,a.value.type=void 0))}else a.value={}})),(i,l)=>{const m=r("el-input"),p=r("el-form-item"),V=r("el-radio"),x=r("el-radio-group"),g=r("el-input-number"),M=r("el-tree-select"),N=r("el-form"),T=r("el-button"),$=r("el-drawer");return A(),D($,{"model-value":u.visible,title:`${u.data&&u.data.type?"添加子":u.data&&u.data.id?"编辑":"添加"}菜单`,size:840,onClose:l[11]||(l[11]=o=>n("close"))},{footer:d(()=>[E("div",G,[t(T,{type:"primary",onClick:l[9]||(l[9]=o=>f(c.value))},{default:d(()=>[s("确定")]),_:1}),t(T,{onClick:l[10]||(l[10]=o=>n("close"))},{default:d(()=>[s("取消")]),_:1})])]),default:d(()=>[t(N,{ref_key:"formRef",ref:c,model:a.value,"label-width":"100px","label-suffix":":"},{default:d(()=>[t(p,{label:"菜单名称",prop:"title"},{default:d(()=>[t(m,{modelValue:a.value.title,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.title=o),placeholder:"请输入",maxlength:50},null,8,["modelValue"])]),_:1}),t(p,{label:"菜单类型",prop:"menuType"},{default:d(()=>[t(x,{modelValue:a.value.menuType,"onUpdate:modelValue":l[1]||(l[1]=o=>a.value.menuType=o)},{default:d(()=>[t(V,{label:"MENU"},{default:d(()=>[s("菜单")]),_:1}),t(V,{label:"BUTTON"},{default:d(()=>[s("按钮")]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(p,{label:"页面路径",prop:"path"},{default:d(()=>[t(m,{modelValue:a.value.path,"onUpdate:modelValue":l[2]||(l[2]=o=>a.value.path=o),placeholder:"请输入"},null,8,["modelValue"])]),_:1}),t(p,{label:"component",prop:"component"},{default:d(()=>[t(m,{modelValue:a.value.component,"onUpdate:modelValue":l[3]||(l[3]=o=>a.value.component=o),placeholder:"请输入"},null,8,["modelValue"])]),_:1}),t(p,{label:"图标"},{default:d(()=>[t(m,{modelValue:a.value.icon,"onUpdate:modelValue":l[4]||(l[4]=o=>a.value.icon=o),placeholder:"请输入"},null,8,["modelValue"])]),_:1}),t(p,{label:"activeMenu",prop:"activeMenu"},{default:d(()=>[t(m,{modelValue:a.value.activeMenu,"onUpdate:modelValue":l[5]||(l[5]=o=>a.value.activeMenu=o),placeholder:"请输入"},null,8,["modelValue"])]),_:1}),t(p,{label:"菜单排序",prop:"sort"},{default:d(()=>[t(g,{modelValue:a.value.sort,"onUpdate:modelValue":l[6]||(l[6]=o=>a.value.sort=o),min:1,placeholder:"请输入"},null,8,["modelValue"])]),_:1}),t(p,{label:"上级菜单",prop:"pid"},{default:d(()=>[t(M,{modelValue:a.value.pid,"onUpdate:modelValue":l[7]||(l[7]=o=>a.value.pid=o),data:v.value,props:{label:"title",value:"id"},"check-strictly":"","render-after-expand":!1,disabled:!!(e.data&&e.data.type),class:"w-full"},null,8,["modelValue","data","disabled"])]),_:1}),t(p,{label:"是否隐藏",prop:"hidden"},{default:d(()=>[t(x,{modelValue:a.value.hidden,"onUpdate:modelValue":l[8]||(l[8]=o=>a.value.hidden=o)},{default:d(()=>[t(V,{label:1},{default:d(()=>[s("是")]),_:1}),t(V,{label:2},{default:d(()=>[s("否")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}});export{Q as _};
