You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
9.1 KiB
2 lines
9.1 KiB
|
2 years ago
|
import{d as re,r as v,ag as B,ar as k,X as se,aY as de,o as s,b as ie,g as K,a as t,w as e,f as l,ah as ue,j as r,a7 as w,c as d,t as pe,N as m,s as L,b7 as me,b8 as _e,b9 as ce,ba as fe,bb as ye,E as T,bc as be,O as ge,bd as he,ai as Ve,aj as ve,G as ke,aT as we,aZ as Te,aU as Ce,ao as Ue,aW as Ee,b6 as Ne,b4 as Ie,aS as Oe,H as Me,aM as Ae}from"./index-b0696d90.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as Be}from"./delete-a6250ce4.js";import{_ as Le}from"./edit-b02c4768.js";import{_ as xe}from"./plus-15786e11.js";import{_ as Fe}from"./refresh-2973caed.js";import{_ as Ge}from"./search-b60582af.js";import{S as De}from"./index-43a073f3.js";import{I as Se}from"./index-59b6228c.js";import"./caret-bottom-3addd466.js";var c=(g=>(g.CATALOG="CATALOG",g.MENU="MENU",g.BUTTON="BUTTON",g.EXTLINK="EXTLINK",g))(c||{});const qe={class:"app-container"},Ke={class:"search"},Re={class:"dialog-footer"},ol=re({name:"cmenu",inheritAttrs:!1,__name:"index",setup(g){const x=v(B),C=v(B),O=v(!1),y=k({visible:!1}),U=k({}),F=v([]),G=v([]),o=k({parentId:0,visible:1,sort:1,type:c.MENU,outside:1}),R=k({parentId:[{required:!0,message:"请选择顶级菜单",trigger:"blur"}],name:[{required:!0,message:"请输入菜单名称",trigger:"blur"}],type:[{required:!0,message:"请选择菜单类型",trigger:"blur"}],path:[{required:!0,message:"请输入路由路径",trigger:"blur"}],component:[{required:!0,message:"请输入组件完整路径",trigger:"blur"}]}),X=v(),E=k({type:"",path:""});function b(){O.value=!0,_e(U).then(({data:p})=>{F.value=p}).then(()=>{O.value=!1})}function $(){x.value.resetFields(),b()}function j(p){X.value=p.id}function M(p,n){ce().then(({data:i})=>{G.value=[{value:0,label:"顶级菜单",children:i}]}).then(()=>{y.visible=!0,n?(y.title="编辑菜单",fe({id:n.toString()}).then(({data:i})=>{Object.assign(o,i),E.type=i.type,E.path=i.path??""})):(y.title="新增菜单",o.parentId=p)})}function z(){o.type!==E.type?o.path="":o.path=E.path}function P(){C.value.validate(p=>{p&&(o.id?ye(o).then(()=>{T.success("修改成功"),N(),b()}):be(o).then(()=>{T.success("新增成功"),N(),b()}))})}function Q(p){if(!p)return T.warning("请勾选删除项"),!1;ge.confirm("确认删除已选中的数据项?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{he({id:p.toString()}).then(()=>{T.success("删除成功"),b()})}).catch(()=>T.info("已取消删除"))}function N(){y.visible=!1,H()}function H(){C.value.resetFields(),C.value.clearValidate(),o.id=void 0,o.parentId=0,o.visible=1,o.sort=1}return se(()=>{b()}),(p,n)=>{const i=Ve,u=ve,W=Ge,f=ke,Y=Fe,D=B,S=xe,h=we,V=Te,Z=Le,J=Be,ee=Ce,le=Ue,te=Ee,_=Ne,A=Ie,oe=Oe,ae=Me,I=de("hasPerm"),ne=Ae;return s(),ie("div",qe,[K("div",Ke,[t(D,{ref_key:"queryFormRef",ref:x,model:l(U),inline:!0},{default:e(()=>[t(u,{label:"关键字",prop:"keywords"},{default:e(()=>[t(i,{modelValue:l(U).keywords,"onUpdate:modelValue":n[0]||(n[0]=a=>l(U).keywords=a),placeholder:"菜单名称",clearable:"",onKeyup:ue(b,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(u,null,{default:e(()=>[t(f,{type:"primary",onClick:b},{icon:e(()=>[t(W)]),default:e(()=>[r("搜索")]),_:1}),t(f,{onClick:$},{icon:e(()=>[t(Y)]),default:e(()=>[r(" 重置")]),_:1})]),_:1})]),_:1},8,["model"])]),t(le,{shadow:"never"},{header:e(()=>[w((s(),d(f,{type:"success",onClick:n[1]||(n[1]=a=>M(0))},{icon:e(()=>[t(S)]),default:e(()=>[r(" 新增")]),_:1})),[[I,["121646328009732096"]]])]),default:e(()=>[w((s(),d(ee,{data:l(F),"highlight-current-row":"","tree-props":{children:"children",hasChildren:"hasChildren"},"row-key":"id",border:"",onRowClick:j},{default:e(()=>[t(h,{label:"菜单名称","min-width":"200"},{default:e(a=>[t(De,{"icon-class":a.row.type===l(c).BUTTON?"button":a.row.icon},null,8,["icon-class"]),r(" "+pe(a.row.name),1)]),_:1}),t(h,{label:"菜单类型",align:"center",width:"100"},{default:e(a=>[a.row.class===l(c).CATALOG?(s(),d(V,{key:0,type:"warning"},{default:e(()=>[r("目录"
|