mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
var x=(i,m,l)=>new Promise((c,u)=>{var h=a=>{try{p(l.next(a))}catch(s){u(s)}},g=a=>{try{p(l.throw(a))}catch(s){u(s)}},p=a=>a.done?c(a.value):Promise.resolve(a.value).then(h,g);p((l=l.apply(i,m)).next())});import{_ as U}from"./form.vue_vue_type_script_setup_true_lang-lqkAOL4F.js";import{r as W,a as r,m as X,i as d,N as z,af as f,F as Y,e as Z,d1 as A,g3 as E,ak as w,aj as ee,a2 as ne,L as V,aD as te}from"./index-CiUe5cVr.js";import{f as ae}from"./system-BY5IEomC.js";import{u as ie}from"./hooks-D2yv24x9.js";import"./index-PUcCfbZs.js";import"./index-CAi2xJzd.js";import"./index-CI87LFQY.js";function le(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!te(i)}function ge(){const i=W({title:""}),m=r(),l=r([]),c=r(!0),u=(n,e=!1)=>{switch(n){case 0:return e?"菜单":"primary";case 1:return e?"iframe":"warning";case 2:return e?"外链":"danger";case 3:return e?"按钮":"info"}},h=[{label:"菜单名称",prop:"title",align:"left",cellRenderer:({row:n})=>d(Y,null,[d("span",{class:"inline-block mr-1"},[z(ie(n.icon),{style:{paddingTop:"1px"}})]),d("span",null,[f(n.title)])])},{label:"菜单类型",prop:"menuType",width:100,cellRenderer:({row:n,props:e})=>{let t;return d(Z("el-tag"),{size:e.size,type:u(n.menuType),effect:"plain"},le(t=u(n.menuType,!0))?t:{default:()=>[t]})}},{label:"路由路径",prop:"path"},{label:"组件路径",prop:"component",formatter:({path:n,component:e})=>A(e)?n:e},{label:"权限标识",prop:"auths"},{label:"排序",prop:"rank",width:100},{label:"隐藏",prop:"showLink",formatter:({showLink:n})=>n?"否":"是",width:100},{label:"操作",fixed:"right",width:210,slot:"operation"}];function g(n){}function p(n){n&&(n.resetFields(),a())}function a(){return x(this,null,function*(){c.value=!0;const{data:n}=yield ae();let e=n;A(i.title)||(e=e.filter(t=>f(t.title).includes(i.title))),l.value=E(e),setTimeout(()=>{c.value=!1},500)})}function s(n){if(!n||!n.length)return;const e=[];for(let t=0;t<n.length;t++)n[t].title=f(n[t].title),s(n[t].children),e.push(n[t]);return e}function H(n="新增",e){var t,T,v,b,y,k,I,o,M,R,S,D,j,F,O,_,P,$,C,L;w({title:`${n}菜单`,props:{formInline:{menuType:(t=e==null?void 0:e.menuType)!=null?t:0,higherMenuOptions:s(ee(l.value)),parentId:(T=e==null?void 0:e.parentId)!=null?T:0,title:(v=e==null?void 0:e.title)!=null?v:"",name:(b=e==null?void 0:e.name)!=null?b:"",path:(y=e==null?void 0:e.path)!=null?y:"",component:(k=e==null?void 0:e.component)!=null?k:"",rank:(I=e==null?void 0:e.rank)!=null?I:99,redirect:(o=e==null?void 0:e.redirect)!=null?o:"",icon:(M=e==null?void 0:e.icon)!=null?M:"",extraIcon:(R=e==null?void 0:e.extraIcon)!=null?R:"",enterTransition:(S=e==null?void 0:e.enterTransition)!=null?S:"",leaveTransition:(D=e==null?void 0:e.leaveTransition)!=null?D:"",activePath:(j=e==null?void 0:e.activePath)!=null?j:"",auths:(F=e==null?void 0:e.auths)!=null?F:"",frameSrc:(O=e==null?void 0:e.frameSrc)!=null?O:"",frameLoading:(_=e==null?void 0:e.frameLoading)!=null?_:!0,keepAlive:(P=e==null?void 0:e.keepAlive)!=null?P:!1,hiddenTag:($=e==null?void 0:e.hiddenTag)!=null?$:!1,showLink:(C=e==null?void 0:e.showLink)!=null?C:!0,showParent:(L=e==null?void 0:e.showParent)!=null?L:!1}},width:"45%",draggable:!0,fullscreen:ne(),fullscreenIcon:!0,closeOnClickModal:!1,contentRenderer:()=>z(U,{ref:m}),beforeSure:(B,{options:G})=>{const J=m.value.getRef(),K=G.props.formInline;function N(){V(`您${n}了菜单名称为${f(K.title)}的这条数据`,{type:"success"}),B(),a()}J.validate(Q=>{Q&&N()})}})}function q(n){V(`您删除了菜单名称为${f(n.title)}的这条数据`,{type:"success"}),a()}return X(()=>{a()}),{form:i,loading:c,columns:h,dataList:l,onSearch:a,resetForm:p,openDialog:H,handleDelete:q,handleSelectionChange:g}}export{ge as useMenu};
|