var K=Object.defineProperty,z=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var I=(u,s,t)=>s in u?K(u,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[s]=t,k=(u,s)=>{for(var t in s||(s={}))E.call(s,t)&&I(u,t,s[t]);if(D)for(var t of D(s))j.call(s,t)&&I(u,t,s[t]);return u},F=(u,s)=>z(u,B(s));var h=(u,s,t)=>new Promise((c,a)=>{var p=r=>{try{d(t.next(r))}catch(y){a(y)}},m=r=>{try{d(t.throw(r))}catch(y){a(y)}},d=r=>r.done?c(r.value):Promise.resolve(r.value).then(p,m);d((t=t.apply(u,s)).next())});import{s as G,a as $,b as H,c as O,d as V}from"./api.bac88ad3.js";import{N as o}from"./FormItemGridItem.f2c14276.js";import{d as U,a as T,r as L,u as R,B as A,i as e,q as Q,ac as J,a8 as M,a9 as b,a7 as w,k as i,_ as f,aj as W,db as X,p as g,ai as Y,l as P,H as N,cg as Z,aa as ee,ch as _,bC as C}from"./index.17aa86ea.js";import{N as q}from"./Cascader.0eaac8f1.js";import{N as ae}from"./TreeSelect.7f920075.js";import{S as te}from"./index.43f1d419.js";import{f as S}from"./urlUtils.fecf42a6.js";import"./searchs.b637f0d6.js";const le=U({name:"city-operation",props:{type:{type:String,default:"add"},menuList:{type:Array,default:()=>[]},applyList:{type:Array,default:()=>[]},data:{type:Object,default:()=>{}}},emits:["close","getList"],setup(u,{slots:s,attrs:t,emit:c}){const a=T({appId:"1000001",parentId:null,type:0,name:null,path:null,icon:null,component:null,permission:null,parentPermission:null,linkPath:null,sort:0,hidden:0}),p=L([{id:"0",name:"\u6839\u7ED3\u70B9",isLeaf:!0},...u.menuList]),m=L(!1),d=L(),r=R(),y=()=>h(this,null,function*(){d.value.validate(l=>h(this,null,function*(){if(l)return!1;try{m.value=!0,u.type==="add"?(yield G(k({},a)),r.success("\u6DFB\u52A0\u6210\u529F")):u.type==="edit"&&(yield $(F(k({},a),{id:u.data.id})),r.success("\u4FEE\u6539\u6210\u529F")),c("close"),c("getList")}catch(n){}m.value=!1}))});return A(()=>h(this,null,function*(){if(u.type==="edit"){const l=u.data;a.appId=l.appId,a.parentId=l.parentId,a.type=Number(l.type),a.name=l.name,a.path=l.path,a.icon=l.icon,a.component=l.component,a.permission=l.permission,a.parentPermission=l.parentPermission,a.linkPath=l.linkPath,a.sort=l.sort,a.hidden=l.hidden}})),()=>e("div",{style:"background: #fff; padding-top: 12px"},[e(Q,{model:a,ref:d,"label-placement":"left","label-width":"100"},{default:()=>[e(J,{cols:2},{default:()=>[e(o,{label:"\u5E94\u7528\u5206\u7C7B",path:"appId",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u5E94\u7528\u5206\u7C7B"}]},{default:()=>[e(q,{value:a.appId,"onUpdate:value":l=>a.appId=l,options:u.applyList,showPath:!0,allowCheckingNotLoaded:!1,checkStrategy:"child",valueField:"id",labelField:"appName",childrenField:"bizApps",placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528\u5206\u7C7B",expandTrigger:"hover",clearable:!0},null)]}),e(o,{label:"\u4E0A\u7EA7\u83DC\u5355",path:"parentId",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u83DC\u5355"}]},{default:()=>[e(ae,{value:a.parentId,"onUpdate:value":l=>a.parentId=l,placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u83DC\u5355",checkStrategy:"parent",options:p.value,showPath:!1,keyField:"id",labelField:"name",virtualScroll:!0},null)]}),e(o,{label:"\u83DC\u5355\u7C7B\u578B",path:"type"},{default:()=>[e(M,{value:a.type,"onUpdate:value":l=>a.type=l},{default:()=>[e(b,null,{default:()=>[e(w,{value:0},{default:()=>[i("\u83DC\u5355")]}),e(w,{value:1},{default:()=>[i("\u6309\u94AE")]})]})]})]}),e(o,{label:"\u83DC\u5355\u540D\u79F0",path:"name",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",trigger:["blur","input"]}]},{default:()=>[e(f,{value:a.name,"onUpdate:value":l=>a.name=l,placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",clearable:!0,maxlength:100},null)]}),a.type===0&&e(W,null,[e(o,{label:"\u8DEF\u7531\u8DEF\u5F84",path:"path",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u8DEF\u7531\u8DEF\u5F84",trigger:["blur","input"]}]},{default:()=>[e(f,{value:a.path,"onUpdate:value":l=>a.path=l,placeholder:"\u8BF7\u8F93\u5165\u8DEF\u7531\u8DEF\u5F84",clearable:!0,maxlength:100},null)]}),e(o,{label:"\u83DC\u5355\u56FE\u6807",path:"icon"},{default:()=>[e(f,{value:a.icon,"onUpdate:value":l=>a.icon=l,placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u56FE\u6807",clearable:!0,maxlength:100},null)]}),e(o,{label:"\u7EC4\u4EF6\u540D\u79F0",path:"component",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC4\u4EF6\u540D\u79F0",trigger:["blur","input"]}]},{default:()=>[e(f,{value:a.component,"onUpdate:value":l=>a.component=l,placeholder:"\u8BF7\u8F93\u5165\u7EC4\u4EF6\u540D\u79F0",clearable:!0,maxlength:100},null)]}),e(o,{label:"\u94FE\u63A5\u5730\u5740",path:"linkPath"},{default:()=>[e(f,{value:a.linkPath,"onUpdate:value":l=>a.linkPath=l,placeholder:"\u5916\u94FE/\u5185\u5D4C\u65F6\u94FE\u63A5\u5730\u5740\uFF08http://www.colexiu.com\uFF09",clearable:!0,maxlength:100},null)]}),e(o,{label:"\u9AD8\u4EAE\u8DEF\u5F84",path:"parentPermission"},{default:()=>[e(f,{value:a.parentPermission,"onUpdate:value":l=>a.parentPermission=l,placeholder:"\u5B50\u9875\u9762\u9AD8\u4EAE\u8DEF\u5F84",clearable:!0,maxlength:100},null)]})]),e(o,{label:"\u6743\u9650\u6807\u8BC6",path:"permission",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6",trigger:["blur","input"]}]},{default:()=>[e(f,{value:a.permission,"onUpdate:value":l=>a.permission=l,placeholder:"\u8BF7\u8F93\u5165\u6743\u9650\u6807\u8BC6",clearable:!0,maxlength:100},null)]}),e(o,{label:"\u83DC\u5355\u6392\u5E8F",path:"sort"},{default:()=>[e(X,{value:a.sort,"onUpdate:value":l=>a.sort=l,placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u6392\u5E8F",clearable:!0},null)]}),a.type===0&&e(o,{label:"\u662F\u5426\u9690\u85CF",path:"hidden"},{default:()=>[e(M,{value:a.hidden,"onUpdate:value":l=>a.hidden=l},{default:()=>[e(b,null,{default:()=>[e(w,{value:1},{default:()=>[i("\u662F")]}),e(w,{value:0},{default:()=>[i("\u5426")]})]})]})]})]})]}),e(b,{justify:"end"},{default:()=>[e(g,{type:"default",onClick:()=>c("close")},{default:()=>[i("\u53D6\u6D88")]}),e(g,{type:"primary",onClick:()=>y(),loading:m.value},{default:()=>[i("\u4FDD\u5B58")]})]})])}}),me=U({name:"menu-manage",setup(){const u=Y(),s=R(),t=T({loading:!1,applyList:[],dataList:[],visiableMenu:!1,menuType:"add",applyData:{},expandedRowKeys:[],searchForm:{appId:null}}),c=()=>[{title:"\u83DC\u5355\u540D\u79F0",key:"name",width:330,render(n){return`${n.name} - ${n.id}`}},{title:"\u5E94\u7528\u540D\u79F0",key:"appName"},{title:"\u7EC4\u4EF6\u540D",key:"component"},{title:"\u8DEF\u7531\u8DEF\u5F84",key:"path"},{title:"\u6743\u9650\u6807\u8BC6",key:"permission"},{title:"\u6392\u5E8F",key:"sort"},{title:"\u7C7B\u578B",key:"type",render(n){return n.type==="0"?e(_,{type:"primary"},{default:()=>[i("\u83DC\u5355")]}):e(_,{type:"default"},{default:()=>[i("\u6309\u94AE")]})}},{title:"\u64CD\u4F5C",key:"operation",render(n){return e(b,null,{default:()=>[N(e(g,{type:"primary",text:!0,size:"small",onClick:()=>{t.visiableMenu=!0,t.menuType="edit",t.applyData=n}},{default:()=>[i("\u7F16\u8F91")]}),[[C("auth"),"sysMenu/update1674673366681837570"]]),N(e(g,{type:"primary",text:!0,size:"small",onClick:()=>a(n)},{default:()=>[i("\u5220\u9664")]}),[[C("auth"),"sysMenu/remove1674673513016909826"]])]})}}],a=n=>{u.warning({title:"\u8B66\u544A",content:`\u5220\u9664"${n.name}"\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>h(this,null,function*(){try{yield V({id:n.id}),p(),s.success("\u5220\u9664\u6210\u529F")}catch(v){}})})},p=()=>h(this,null,function*(){try{t.loading=!0;const{data:n}=yield H(F(k({},t.searchForm),{parentId:0,delFlag:!1}));t.loading=!1;const v=[];(n||[]).forEach(x=>{x.isLeaf=!x.children,v.push(x)}),t.dataList=S(v)}catch(n){}}),m=(n=0)=>h(this,null,function*(){try{const{data:v}=yield O({page:1,rows:999,leafQuery:!0,parentId:n});t.applyList=S(v.rows||[],"bizApps")}catch(v){}}),d=L(),r=()=>{p()},y=()=>{var n;(n=d.value)==null||n.submit()},l=()=>{var n;(n=d.value)==null||n.reset()};return A(()=>{p(),m()}),()=>e("div",{class:"system-menu-container"},[e(te,{ref:d,model:t.searchForm,onSubmit:r,onSetModel:n=>t.searchForm=n},{default:()=>[e(P,{label:"\u5E94\u7528",path:"name"},{default:()=>[e(q,{value:t.searchForm.appId,"onUpdate:value":n=>t.searchForm.appId=n,options:t.applyList,showPath:!0,allowCheckingNotLoaded:!1,checkStrategy:"child",valueField:"id",labelField:"appName",childrenField:"bizApps",placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528",expandTrigger:"hover",clearable:!0},null)]}),e(P,null,{default:()=>[e(b,null,{default:()=>[e(g,{type:"primary",onClick:y},{default:()=>[i("\u641C\u7D22")]}),e(g,{type:"default",onClick:l},{default:()=>[i("\u91CD\u7F6E")]})]})]})]}),e("div",{class:["section-container"]},[e(b,{style:{paddingBottom:"12px"},justify:"space-between"},{default:()=>[N(e(g,{type:"primary",onClick:()=>{t.menuType="add",t.applyData=[],t.visiableMenu=!0}},{default:()=>[i("\u6DFB\u52A0\u83DC\u5355")]}),[[C("auth"),"sysMenu/save1597877997041733633"]])]}),e(Z,{loading:t.loading,columns:c(),data:t.dataList,allowCheckingNotLoaded:!0,cascade:!1,virtualScroll:!0,maxHeight:400,expandedRowKeys:t.expandedRowKeys,onUpdateExpandedRowKeys:n=>{t.expandedRowKeys=n},rowKey:n=>n.id},null)]),e(ee,{show:t.visiableMenu,"onUpdate:show":n=>t.visiableMenu=n,preset:"dialog",showIcon:!1,title:t.menuType==="add"?"\u6DFB\u52A0\u83DC\u5355":"\u4FEE\u6539\u83DC\u5355",style:{width:"700px"}},{default:()=>[e(le,{type:t.menuType,data:t.applyData,menuList:t.dataList,applyList:t.applyList,onClose:()=>t.visiableMenu=!1,onGetList:p},null)]})])}});export{me as default};