import{g as Q}from"./index.es.d2375c1e.js";import{a as H,H as j}from"./elementPlus.4833989a.js";import{_ as L}from"./index.vue_vue_type_script_setup_true_name_svgIcon_lang.e9645613.js";import{l as q,m as A,a as G}from"./api.23bb9b70.js";import{P as x}from"./index.ad3efb29.js";import{d as J,r as _,w as K,ai as i,o as g,c as h,U as t,u as v,D as W,a as D,O as n,S as C,T as M,F as X,ah as Y,ae as Z}from"./vue.adf17aba.js";import{_ as ee}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const te={class:"menu-tree-com"},ae={class:"mtc-head"},ne={key:0,class:"text-center font-black font-normal"},oe={key:1,class:"text-center font-black text-red-700 font-normal"},le={class:"mtc-tags"},se=J({__name:"index",props:{treeData:{default:()=>[]}},emits:["treeClick","deleteDept","updateDept"],setup(ie,{expose:N,emit:T}){const b=Q(Y),V={children:"children",label:"name",icon:"icon",isLeaf:(a,e)=>!e.data.is_catalog},k=_(),m=T;let d=_(""),u=_(!1),l=_({}),w=_(null);K(d,a=>{k.value.filter(a)});const E=(a,e)=>a?Z(e).name.indexOf(a)!==-1:!0,B=(a,e)=>{a.level!==0&&q({parent:a.data.id}).then(c=>{e(c.data)})},S=(a,e)=>{l.value=a,w.value=e,m("treeClick",a)},y=a=>{if(a==="update"){if(!l.value.id){x("请选择菜单！");return}m("updateDept",a,l.value)}else m("updateDept",a)},$=()=>{if(!l.value.id){x("请选择菜单！");return}m("deleteDept",l.value.id,()=>{l.value={}})},z=async a=>{var s;if(!l.value.id){x("请选择菜单！");return}if(u.value)return;const e=((s=w.value)==null?void 0:s.parent.childNodes)||[],c=e.findIndex(f=>f.data.id===l.value.id),p=e.find(f=>f.data.id===l.value.id);if(a==="up"){if(c===0)return;e.splice(c-1,0,p),e.splice(c+1,1),u.value=!0,await A({menu_id:l.value.id}),u.value=!1}a==="down"&&(e.splice(c+2,0,p),e.splice(c,1),u.value=!0,await G({menu_id:l.value.id}),u.value=!1)};return N({treeRef:k}),(a,e)=>{const c=i("el-input"),p=i("Menu"),s=i("el-icon"),f=i("QuestionFilled"),r=i("el-tooltip"),F=i("Plus"),P=i("Edit"),R=i("Top"),U=i("Bottom"),I=i("Delete");return g(),h(X,null,[t(c,{modelValue:v(d),"onUpdate:modelValue":e[0]||(e[0]=o=>W(d)?d.value=o:d=o),"prefix-icon":v(H),placeholder:"请输入菜单名称"},null,8,["modelValue","prefix-icon"]),D("div",te,[D("div",ae,[t(s,{size:"16",color:"#606266",class:"mtc-head-icon"},{default:n(()=>[t(p)]),_:1}),C(" 菜单列表 "),t(r,{effect:"dark",placement:"right",content:"1.红色菜单代表状态禁用; 2.添加菜单，如果是目录，组件地址为空即可; 3.添加根节点菜单，父级ID为空即可; 4.支持拖拽菜单;"},{default:n(()=>[t(s,{size:"16",color:"var(--el-color-primary)",class:"mtc-tooltip"},{default:n(()=>[t(f)]),_:1})]),_:1})]),t(v(j),{ref_key:"treeRef",ref:k,data:a.treeData,props:V,"filter-node-method":E,load:B,lazy:"",indent:45,onNodeClick:S,"highlight-current":""},{default:n(({node:o,data:O})=>[t(v(b),{node:o,showLabelLine:!1,indent:32},{default:n(()=>[O.status?(g(),h("span",ne,[t(L,{name:o.data.icon,color:"var(--el-color-primary)"},null,8,["name"]),C("  "+M(o.label),1)])):(g(),h("span",oe,[t(L,{name:o.data.icon},null,8,["name"]),C(" "+M(o.label),1)]))]),_:2},1032,["node"])]),_:1},8,["data"]),D("div",le,[t(r,{effect:"dark",content:"新增"},{default:n(()=>[t(s,{size:"16",onClick:e[1]||(e[1]=o=>y("create")),class:"mtc-tags-icon"},{default:n(()=>[t(F)]),_:1})]),_:1}),t(r,{effect:"dark",content:"编辑"},{default:n(()=>[t(s,{size:"16",onClick:e[2]||(e[2]=o=>y("update")),class:"mtc-tags-icon"},{default:n(()=>[t(P)]),_:1})]),_:1}),t(r,{effect:"dark",content:"上移"},{default:n(()=>[t(s,{size:"16",onClick:e[3]||(e[3]=o=>z("up")),class:"mtc-tags-icon"},{default:n(()=>[t(R)]),_:1})]),_:1}),t(r,{effect:"dark",content:"下移"},{default:n(()=>[t(s,{size:"16",onClick:e[4]||(e[4]=o=>z("down")),class:"mtc-tags-icon"},{default:n(()=>[t(U)]),_:1})]),_:1}),t(r,{effect:"dark",content:"删除"},{default:n(()=>[t(s,{size:"16",onClick:e[5]||(e[5]=o=>$()),class:"mtc-tags-icon"},{default:n(()=>[t(I)]),_:1})]),_:1})])])],64)}}});const ve=ee(se,[["__scopeId","data-v-c809444a"]]);export{ve as default};
