Files
vue-pure-admin/static/js/hook-0o-l3QlN.js

2 lines
3.8 KiB
JavaScript

var L=(i,d,l)=>new Promise((c,u)=>{var g=a=>{try{f(l.next(a))}catch(s){u(s)}},T=a=>{try{f(l.throw(a))}catch(s){u(s)}},f=a=>a.done?c(a.value):Promise.resolve(a.value).then(g,T);f((l=l.apply(i,d)).next())});import{_ as U}from"./form.vue_vue_type_script_setup_true_lang-CCWsc7iE.js";import{r as W,a as b,m as Y,g as h,b0 as N,ac as p,f0 as Z,I as V,aj as E,K as H,X as w,ai as ee,F as ne,b as te,aD as ae}from"./index-B_cVej0C.js";import{f as ie}from"./system-DfIZYZP3.js";import{u as le}from"./hooks-C4kBTCXq.js";import"./index-BW-F7XKS.js";import"./index-DA1fIhPd.js";import"./index-CxsXdKf6.js";function se(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!ae(i)}function Te(){const i=W({title:""}),d=b(),l=b([]),c=b(!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"}},g=[{label:"菜单名称",prop:"title",align:"left",cellRenderer:({row:n})=>h(ne,null,[h("span",{class:"inline-block mr-1"},[H(le(n.icon),{style:{paddingTop:"1px"}})]),h("span",null,[p(n.title)])])},{label:"菜单类型",prop:"menuType",width:100,cellRenderer:({row:n,props:e})=>{let t;return h(te("el-tag"),{size:e.size,type:u(n.menuType),effect:"plain"},se(t=u(n.menuType,!0))?t:{default:()=>[t]})}},{label:"路由路径",prop:"path"},{label:"组件路径",prop:"component",formatter:({path:n,component:e})=>N(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 T(n){}function f(n){n&&(n.resetFields(),a())}function a(){return L(this,null,function*(){c.value=!0;const{code:n,data:e}=yield ie();if(n===0){let t=e;N(i.title)||(t=t.filter(m=>p(m.title).includes(i.title))),l.value=Z(t)}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=p(n[t].title),s(n[t].children),e.push(n[t]);return e}function K(n="新增",e){var t,m,r,v,y,I,k,M,R,S,D,F,O,P,_,j,o,x,$,z,C;E({title:`${n}菜单`,props:{formInline:{menuType:(t=e==null?void 0:e.menuType)!=null?t:0,higherMenuOptions:s(ee(l.value)),parentId:(m=e==null?void 0:e.parentId)!=null?m:0,title:(r=e==null?void 0:e.title)!=null?r:"",name:(v=e==null?void 0:e.name)!=null?v:"",path:(y=e==null?void 0:e.path)!=null?y:"",component:(I=e==null?void 0:e.component)!=null?I:"",rank:(k=e==null?void 0:e.rank)!=null?k:99,redirect:(M=e==null?void 0:e.redirect)!=null?M:"",icon:(R=e==null?void 0:e.icon)!=null?R:"",extraIcon:(S=e==null?void 0:e.extraIcon)!=null?S:"",enterTransition:(D=e==null?void 0:e.enterTransition)!=null?D:"",leaveTransition:(F=e==null?void 0:e.leaveTransition)!=null?F:"",activePath:(O=e==null?void 0:e.activePath)!=null?O:"",auths:(P=e==null?void 0:e.auths)!=null?P:"",frameSrc:(_=e==null?void 0:e.frameSrc)!=null?_:"",frameLoading:(j=e==null?void 0:e.frameLoading)!=null?j:!0,keepAlive:(o=e==null?void 0:e.keepAlive)!=null?o:!1,hiddenTag:(x=e==null?void 0:e.hiddenTag)!=null?x:!1,fixedTag:($=e==null?void 0:e.fixedTag)!=null?$:!1,showLink:(z=e==null?void 0:e.showLink)!=null?z:!0,showParent:(C=e==null?void 0:e.showParent)!=null?C:!1}},width:"45%",draggable:!0,fullscreen:w(),fullscreenIcon:!0,closeOnClickModal:!1,contentRenderer:()=>H(U,{ref:d,formInline:null}),beforeSure:(q,{options:B})=>{const G=d.value.getRef(),J=B.props.formInline;function A(){V(`${n}了菜单名称为${p(J.title)}的这条数据`,{type:"success"}),q(),a()}G.validate(Q=>{Q&&A()})}})}function X(n){V(`您删除了菜单名称为${p(n.title)}的这条数据`,{type:"success"}),a()}return Y(()=>{a()}),{form:i,loading:c,columns:g,dataList:l,onSearch:a,resetForm:f,openDialog:K,handleDelete:X,handleSelectionChange:T}}export{Te as useMenu};