"use strict";(self["webpackChunkscui"]=self["webpackChunkscui"]||[]).push([[7465],{18847:function(e,t,n){n.r(t),n.d(t,{default:function(){return f}});var a=n(66252),l=n(3577),s=n(49963);const i={class:"custom-tree-node el-tree-node__label"},o={class:"label"},d={class:"do"};function u(e,t,n,u,r,m){const c=(0,a.up)("el-input"),p=(0,a.up)("el-header"),h=(0,a.up)("el-icon-plus"),f=(0,a.up)("el-icon"),g=(0,a.up)("el-tree"),v=(0,a.up)("el-main"),w=(0,a.up)("el-button"),$=(0,a.up)("el-footer"),k=(0,a.up)("el-container"),_=(0,a.up)("el-aside"),y=(0,a.up)("save"),C=(0,a.Q2)("loading");return(0,a.wg)(),(0,a.j4)(k,null,{default:(0,a.w5)((()=>[(0,a.wy)(((0,a.wg)(),(0,a.j4)(_,{width:"300px"},{default:(0,a.w5)((()=>[(0,a.Wm)(k,null,{default:(0,a.w5)((()=>[(0,a.Wm)(p,null,{default:(0,a.w5)((()=>[(0,a.Wm)(c,{placeholder:"输入关键字进行过滤",modelValue:r.menuFilterText,"onUpdate:modelValue":t[0]||(t[0]=e=>r.menuFilterText=e),clearable:""},null,8,["modelValue"])])),_:1}),(0,a.Wm)(v,{class:"nopadding"},{default:(0,a.w5)((()=>[(0,a.Wm)(g,{ref:"menu",class:"menu","node-key":"id",data:r.menuList,props:r.menuProps,draggable:"","highlight-current":"","expand-on-click-node":!1,"check-strictly":"","show-checkbox":"","filter-node-method":m.menuFilterNode,onNodeClick:m.menuClick,onNodeDrop:m.nodeDrop},{default:(0,a.w5)((({node:e,data:t})=>[(0,a._)("span",i,[(0,a._)("span",o,(0,l.toDisplayString)(e.label),1),(0,a._)("span",d,[(0,a.Wm)(f,{onClick:(0,s.iM)((n=>m.add(e,t)),["stop"])},{default:(0,a.w5)((()=>[(0,a.Wm)(h)])),_:2},1032,["onClick"])])])])),_:1},8,["data","props","filter-node-method","onNodeClick","onNodeDrop"])])),_:1}),(0,a.Wm)($,{style:{height:"51px"}},{default:(0,a.w5)((()=>[(0,a.Wm)(w,{type:"primary",size:"small",icon:"el-icon-plus",onClick:t[1]||(t[1]=e=>m.add())}),(0,a.Wm)(w,{type:"danger",size:"small",plain:"",icon:"el-icon-delete",onClick:m.delMenu},null,8,["onClick"])])),_:1})])),_:1})])),_:1})),[[C,r.menuloading]]),(0,a.Wm)(k,null,{default:(0,a.w5)((()=>[(0,a.Wm)(v,{class:"nopadding",style:{padding:"20px"},ref:"main"},{default:(0,a.w5)((()=>[(0,a.Wm)(y,{ref:"save",menu:r.menuList},null,8,["menu"])])),_:1},512)])),_:1})])),_:1})}var r=n(72350);let m=1;var c={name:"settingMenu",components:{save:r["default"]},data(){return{menuloading:!1,menuList:[],menuProps:{label:e=>e.meta.title},menuFilterText:""}},watch:{menuFilterText(e){this.$refs.menu.filter(e)}},mounted(){this.getMenu()},methods:{async getMenu(){this.menuloading=!0;var e=await this.$API.system.menu.list.get();this.menuloading=!1,this.menuList=e.data},menuClick(e,t){var n=1==t.level?void 0:t.parent.data.id;this.$refs.save.setData(e,n),this.$refs.main.$el.scrollTop=0},menuFilterNode(e,t){if(!e)return!0;var n=t.meta.title;return-1!==n.indexOf(e)},nodeDrop(e,t,n){this.$refs.save.setData({}),this.$message(`拖拽对象：${e.data.meta.title}, 释放对象：${t.data.meta.title}, 释放对象的位置：${n}`)},async add(e,t){var n="未命名"+m++,a={parentId:t?t.id:"",name:n,path:"",component:"",meta:{title:n,type:"menu"}};this.menuloading=!0;var l=await this.$API.demo.post.post(a);this.menuloading=!1,a.id=l.data,this.$refs.menu.append(a,e),this.$refs.menu.setCurrentKey(a.id);var s=e?e.data.id:"";this.$refs.save.setData(a,s)},async delMenu(){var e=this.$refs.menu.getCheckedNodes();if(0==e.length)return this.$message.warning("请选择需要删除的项"),!1;var t=await this.$confirm("确认删除已选择的菜单吗？","提示",{type:"warning",confirmButtonText:"删除",confirmButtonClass:"el-button--danger"}).catch((()=>{}));if("confirm"!=t)return!1;this.menuloading=!0;var n={ids:e.map((e=>e.id))},a=await this.$API.demo.post.post(n);this.menuloading=!1,200==a.code?e.forEach((e=>{var t=this.$refs.menu.getNode(e);t.isCurrent&&this.$refs.save.setData({}),this.$refs.menu.remove(e)})):this.$message.warning(a.message)}}},p=n(83744);const h=(0,p.Z)(c,[["render",u],["__scopeId","data-v-64614b21"]]);var f=h}}]);