vue-pure-admin/static/js/hook-BEbFnjMe.js

2 lines
3.7 KiB
JavaScript

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