Files
vue-pure-admin/static/js/hook-DC9snLxc.js

2 lines
3.8 KiB
JavaScript

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