index.237c2ff0.js 9.4 KB

1
  1. 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,a)=>s in u?K(u,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[s]=a,k=(u,s)=>{for(var a in s||(s={}))E.call(s,a)&&I(u,a,s[a]);if(D)for(var a of D(s))j.call(s,a)&&I(u,a,s[a]);return u},F=(u,s)=>z(u,B(s));var h=(u,s,a)=>new Promise((c,t)=>{var p=r=>{try{d(a.next(r))}catch(y){t(y)}},m=r=>{try{d(a.throw(r))}catch(y){t(y)}},d=r=>r.done?c(r.value):Promise.resolve(r.value).then(p,m);d((a=a.apply(u,s)).next())});import{s as G,a as $,b as H,c as O,d as V}from"./api.4caafe9d.js";import{N as o}from"./FormItemGridItem.266fd41a.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.789dd106.js";import{N as q}from"./Cascader.85b68ac2.js";import{N as ae}from"./TreeSelect.037ea33e.js";import{S as te}from"./index.b24e8dc3.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:a,emit:c}){const t=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({},t)),r.success("\u6DFB\u52A0\u6210\u529F")):u.type==="edit"&&(yield $(F(k({},t),{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;t.appId=l.appId,t.parentId=l.parentId,t.type=Number(l.type),t.name=l.name,t.path=l.path,t.icon=l.icon,t.component=l.component,t.permission=l.permission,t.parentPermission=l.parentPermission,t.linkPath=l.linkPath,t.sort=l.sort,t.hidden=l.hidden}})),()=>e("div",{style:"background: #fff; padding-top: 12px"},[e(Q,{model:t,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:t.appId,"onUpdate:value":l=>t.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:t.parentId,"onUpdate:value":l=>t.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:t.type,"onUpdate:value":l=>t.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:t.name,"onUpdate:value":l=>t.name=l,placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",clearable:!0,maxlength:100},null)]}),t.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:t.path,"onUpdate:value":l=>t.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:t.icon,"onUpdate:value":l=>t.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:t.component,"onUpdate:value":l=>t.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:t.linkPath,"onUpdate:value":l=>t.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:t.parentPermission,"onUpdate:value":l=>t.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:t.permission,"onUpdate:value":l=>t.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:t.sort,"onUpdate:value":l=>t.sort=l,placeholder:"\u8BF7\u8F93\u5165\u83DC\u5355\u6392\u5E8F",clearable:!0},null)]}),t.type===0&&e(o,{label:"\u662F\u5426\u9690\u85CF",path:"hidden"},{default:()=>[e(M,{value:t.hidden,"onUpdate:value":l=>t.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(),a=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:()=>{a.visiableMenu=!0,a.menuType="edit",a.applyData=n}},{default:()=>[i("\u7F16\u8F91")]}),[[C("auth"),"sysMenu/update1674673366681837570"]]),N(e(g,{type:"primary",text:!0,size:"small",onClick:()=>t(n)},{default:()=>[i("\u5220\u9664")]}),[[C("auth"),"sysMenu/remove1674673513016909826"]])]})}}],t=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{a.loading=!0,a.expandedRowKeys=[];const{data:n}=yield H(F(k({},a.searchForm),{parentId:0,delFlag:!1}));a.loading=!1;const v=[];(n||[]).forEach(x=>{x.isLeaf=!x.children,v.push(x)}),a.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});a.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:a.searchForm,onSubmit:r,onSetModel:n=>a.searchForm=n},{default:()=>[e(P,{label:"\u5E94\u7528",path:"name"},{default:()=>[e(q,{value:a.searchForm.appId,"onUpdate:value":n=>a.searchForm.appId=n,options:a.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:()=>{a.menuType="add",a.applyData=[],a.visiableMenu=!0}},{default:()=>[i("\u6DFB\u52A0\u83DC\u5355")]}),[[C("auth"),"sysMenu/save1597877997041733633"]])]}),e(Z,{loading:a.loading,columns:c(),data:a.dataList,allowCheckingNotLoaded:!0,cascade:!1,virtualScroll:!0,maxHeight:400,expandedRowKeys:a.expandedRowKeys,onUpdateExpandedRowKeys:n=>{a.expandedRowKeys=n},rowKey:n=>n.id},null)]),e(ee,{show:a.visiableMenu,"onUpdate:show":n=>a.visiableMenu=n,preset:"dialog",showIcon:!1,title:a.menuType==="add"?"\u6DFB\u52A0\u83DC\u5355":"\u4FEE\u6539\u83DC\u5355",style:{width:"700px"}},{default:()=>[e(le,{type:a.menuType,data:a.applyData,menuList:a.dataList,applyList:a.applyList,onClose:()=>a.visiableMenu=!1,onGetList:p},null)]})])}});export{me as default};