You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.5KB

  1. import{a as M,e as k,s as $}from"./menuManage.2cbe36bd.js";import{d as S,r as _,L as B,c as p,e as O,I as j,i as o,h as a,j as s,k as D,x as I}from"./index.20c8d60f.js";const F=S({name:"menuDialog"}),q=Object.assign(F,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(m,{emit:x}){const{proxy:V}=I(),r=m,f=x,c=_([]),v=_(),l=_({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,isShowTag:void 0}),y=async i=>{!i||await i.validate(async e=>{var n,d;if(e){const u=l.value&&l.value.pid?b(l.value.pid,h(c.value)):l.value.path;r.data&&r.data.id?(await k({...l.value,pid:l.value.pid||void 0,sort:l.value.sort*1,topMenu:u,name:((n=l.value.path)==null?void 0:n.replace("/",""))||""}),V.$message.success("\u7F16\u8F91\u6210\u529F\uFF01")):(await $({...l.value,name:((d=l.value.path)==null?void 0:d.replace("/",""))||"",pid:l.value.pid||void 0,sort:l.value.sort*1,topMenu:u,id:void 0}),V.$message.success("\u65B0\u589E\u6210\u529F\uFF01")),f("close",!0)}})},b=(i,e)=>{var d;const n=(d=e.find(u=>u.id===i))==null?void 0:d.pid;if(n===void 0)return e.find(u=>u.id===i).path;b(n,e)},h=i=>{const e=[];return i.forEach(n=>{const d=JSON.parse(JSON.stringify(n));d.children&&delete d.children,e.push(d),n.children&&n.children.length&&e.push(...h(n.children))}),e};return B(()=>r.visible,async i=>{if(i){const e=await M();c.value=e.data,r.data&&r.data.id&&(l.value={...r.data,pid:r.data.pid===void 0?void 0:r.data.pid,children:void 0,isSelect:void 0})}else v.value.resetFields()}),(i,e)=>{const n=p("el-input"),d=p("el-form-item"),u=p("el-radio"),g=p("el-radio-group"),T=p("el-input-number"),N=p("el-tree-select"),C=p("el-form"),w=p("el-button"),U=p("el-dialog");return O(),j(U,{"model-value":m.visible,title:`${m.data&&m.data.id?"\u7F16\u8F91":"\u65B0\u589E"}\u83DC\u5355`,width:"600px","destroy-on-close":"",onClose:e[12]||(e[12]=t=>f("close"))},{footer:o(()=>[a(w,{type:"primary",onClick:e[10]||(e[10]=t=>y(v.value))},{default:o(()=>[s(" \u63D0\u4EA4 ")]),_:1}),a(w,{onClick:e[11]||(e[11]=t=>f("close"))},{default:o(()=>[s(" \u5173\u95ED ")]),_:1})]),default:o(()=>[a(C,{ref_key:"formRef",ref:v,model:l.value,"label-width":"100px","label-suffix":":"},{default:o(()=>[a(d,{label:"\u83DC\u5355\u540D\u79F0",prop:"title"},{default:o(()=>[a(n,{modelValue:l.value.title,"onUpdate:modelValue":e[0]||(e[0]=t=>l.value.title=t),placeholder:"\u8BF7\u8F93\u5165",maxlength:50},null,8,["modelValue"])]),_:1}),a(d,{label:"\u83DC\u5355\u7C7B\u578B",prop:"menuType"},{default:o(()=>[a(g,{modelValue:l.value.menuType,"onUpdate:modelValue":e[1]||(e[1]=t=>l.value.menuType=t)},{default:o(()=>[a(u,{label:"MENU"},{default:o(()=>[s("\u83DC\u5355")]),_:1}),a(u,{label:"BUTTON"},{default:o(()=>[s("\u6309\u94AE")]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(d,{label:"\u9875\u9762\u8DEF\u5F84",prop:"path"},{default:o(()=>[a(n,{modelValue:l.value.path,"onUpdate:modelValue":e[2]||(e[2]=t=>l.value.path=t),placeholder:"\u8BF7\u8F93\u5165",maxlength:100},null,8,["modelValue"])]),_:1}),a(d,{label:"component",prop:"component"},{default:o(()=>[a(n,{modelValue:l.value.component,"onUpdate:modelValue":e[3]||(e[3]=t=>l.value.component=t),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u56FE\u6807",prop:"icon"},{default:o(()=>[a(n,{modelValue:l.value.icon,"onUpdate:modelValue":e[4]||(e[4]=t=>l.value.icon=t),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),a(d,{label:"activeMenu",prop:"activeMenu"},{default:o(()=>[a(n,{modelValue:l.value.activeMenu,"onUpdate:modelValue":e[5]||(e[5]=t=>l.value.activeMenu=t),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u83DC\u5355\u6392\u5E8F",prop:"sort"},{default:o(()=>[a(T,{modelValue:l.value.sort,"onUpdate:modelValue":e[6]||(e[6]=t=>l.value.sort=t),placeholder:"\u8BF7\u8F93\u5165",min:1},null,8,["modelValue"])]),_:1}),a(d,{label:"\u4E0A\u7EA7\u83DC\u5355",prop:"pid"},{default:o(()=>[a(N,{modelValue:l.value.pid,"onUpdate:modelValue":e[7]||(e[7]=t=>l.value.pid=t),data:c.value,props:{label:"title",value:"id"},"check-strictly":"","render-after-expand":!1,class:"w-full"},null,8,["modelValue","data"])]),_:1}),a(d,{label:"\u662F\u5426\u9690\u85CF",prop:"hidden"},{default:o(()=>[a(g,{modelValue:l.value.hidden,"onUpdate:modelValue":e[8]||(e[8]=t=>l.value.hidden=t)},{default:o(()=>[a(u,{label:1},{default:o(()=>[s("\u662F")]),_:1}),a(u,{label:2},{default:o(()=>[s("\u5426")]),_:1})]),_:1},8,["modelValue"])]),_:1}),D("",!0)]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}});export{q as default};