1 line
3.8 KiB
JavaScript
1 line
3.8 KiB
JavaScript
|
"use strict";(self["webpackChunkx_php_admin"]=self["webpackChunkx_php_admin"]||[]).push([[974],{1097:function(e,t,n){n.r(t),n.d(t,{default:function(){return c}});var a=n(6252),s=n(3577);const i={class:"custom-tree-node"},l={class:"label"},d={key:0,class:"do"};function r(e,t,n,r,u,m){const o=(0,a.up)("el-input"),h=(0,a.up)("el-header"),p=(0,a.up)("el-icon"),c=(0,a.up)("el-tree"),g=(0,a.up)("el-main"),f=(0,a.up)("el-container"),w=(0,a.up)("el-aside"),v=(0,a.up)("save"),$=(0,a.Q2)("loading");return(0,a.wg)(),(0,a.j4)(f,null,{default:(0,a.w5)((()=>[(0,a.wy)(((0,a.wg)(),(0,a.j4)(w,{width:"300px"},{default:(0,a.w5)((()=>[(0,a.Wm)(f,null,{default:(0,a.w5)((()=>[(0,a.Wm)(h,null,{default:(0,a.w5)((()=>[(0,a.Wm)(o,{clearable:"",placeholder:"输入关键字进行过滤",modelValue:u.menuFilterText,"onUpdate:modelValue":t[0]||(t[0]=e=>u.menuFilterText=e)},null,8,["modelValue"])])),_:1}),(0,a.Wm)(g,{class:"nopadding"},{default:(0,a.w5)((()=>[(0,a.Wm)(c,{data:u.menuList,"expand-on-click-node":!1,"filter-node-method":m.menuFilterNode,props:u.menuProps,onNodeClick:m.menuClick,onNodeDrop:m.nodeDrop,"check-strictly":"",class:"menu",draggable:"","highlight-current":"","node-key":"id",ref:"menu","show-checkbox":!1},{default:(0,a.w5)((({node:e,data:t})=>[(0,a._)("span",i,[(0,a._)("span",l,[(0,a.Wm)(p,{style:{"margin-right":"2px"}},{default:(0,a.w5)((()=>[((0,a.wg)(),(0,a.j4)((0,a.LL)(t.meta.icon||"el-icon-menu")))])),_:2},1024),(0,a.Uk)(" "+(0,s.zw)(e.label),1)]),t.parentid?(0,a.kq)("",!0):((0,a.wg)(),(0,a.iD)("span",d))])])),_:1},8,["data","filter-node-method","props","onNodeClick","onNodeDrop"])])),_:1})])),_:1})])),_:1})),[[$,u.menuloading]]),(0,a.Wm)(f,null,{default:(0,a.w5)((()=>[(0,a.Wm)(g,{class:"nopadding",ref:"main",style:{padding:"20px"}},{default:(0,a.w5)((()=>[(0,a.Wm)(v,{menu:u.menuList,ref:"save"},null,8,["menu"])])),_:1},512)])),_:1})])),_:1})}n(7658);var u=n(8480);let m=1;var o={name:"systemmenu",components:{save:u["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.$http.get("menu");this.menuloading=!1,this.menuList=e.data},menuClick(e,t){var n=1==t.level?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)},getAllIds(e){let t=[];return e.forEach((e=>{let n={id:e.id};e.children&&(n.children=this.getAllIds(e.children)),t.push(n)})),t},async nodeDrop(e){let t=this.getAllIds(this.menuList);var n=await this.$http.post("menu/update",{id:e.data.id,ids:t});if(200!==n.code)return this.$message.warning(n.message),!1;this.$refs.save.setData({}),this.$message.success(n.message)},async add(e,t){var n="未命名"+m++,a={parentid:t?t.id:0,name:"",path:t?t.path+"/":"",component:"",meta:{title:n,type:"menu"}};this.menuloading=!0;var s=await this.$http.post("menu/submit",a);if(this.menuloading=!1,200!==s.code)return this.$message.warning(s.message),!1;a.id=s.data,this.$refs.menu.append(a,e),this.$refs.menu.setCurrentKey(a.id);var i=e?e.data.id:0;this.$refs.save.setData(a,i)},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.$http.post("menu/delete",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)}}},h=n(3744);const p=(0,h.Z)(o,[["render",r],["__scopeId","data-v-194ed0e8"]]);var c=p}}]);
|