"use strict";(self["webpackChunkhxmini"]=self["webpackChunkhxmini"]||[]).push([[1171,4131],{74640:function(e,t,a){a.r(t),a.d(t,{default:function(){return f}});var n=a(20641),l=a(72644),i=a(9322);const s={class:"tabs"},o={class:"custom-tree-node"},d={class:"label"},u={class:"do"};function r(e,t,a,r,m,c){const h=(0,n.g2)("el-input"),g=(0,n.g2)("el-header"),p=(0,n.g2)("el-tab-pane"),f=(0,n.g2)("el-tabs"),v=(0,n.g2)("el-button"),b=(0,n.g2)("el-tree"),k=(0,n.g2)("el-main"),F=(0,n.g2)("el-footer"),$=(0,n.g2)("el-container"),C=(0,n.g2)("el-aside"),N=(0,n.g2)("save"),y=(0,n.gN)("loading");return(0,n.uX)(),(0,n.Wv)($,null,{default:(0,n.k6)(()=>[(0,n.bo)(((0,n.uX)(),(0,n.Wv)(C,{width:"300px"},{default:(0,n.k6)(()=>[(0,n.bF)($,null,{default:(0,n.k6)(()=>[(0,n.bF)(g,null,{default:(0,n.k6)(()=>[(0,n.bF)(h,{placeholder:"输入关键字进行过滤",modelValue:m.menuFilterText,"onUpdate:modelValue":t[0]||(t[0]=e=>m.menuFilterText=e),clearable:""},null,8,["modelValue"])]),_:1}),(0,n.bF)(k,{class:"nopadding"},{default:(0,n.k6)(()=>[(0,n.Lk)("div",s,[(0,n.bF)(f,{modelValue:m.activeName,"onUpdate:modelValue":t[1]||(t[1]=e=>m.activeName=e),class:"demo-tabs",onTabChange:c.handleClick},{default:(0,n.k6)(()=>[(0,n.bF)(p,{label:"总管理",name:1}),(0,n.bF)(p,{label:"门店",name:2})]),_:1},8,["modelValue","onTabChange"])]),(0,n.bF)(b,{ref:"menu",class:"menu","node-key":"id",data:m.menuList,props:m.menuProps,draggable:"","highlight-current":"","expand-on-click-node":!1,"check-strictly":"","filter-node-method":c.menuFilterNode,onNodeClick:c.menuClick,onNodeDrop:c.nodeDrop},{default:(0,n.k6)(({node:e,data:t})=>[(0,n.Lk)("span",o,[(0,n.Lk)("span",d,(0,l.v_)(e.label),1),(0,n.Lk)("span",u,[(0,n.bF)(v,{icon:"el-icon-plus",size:"small",onClick:(0,i.D$)(a=>c.add(e,t),["stop"])},null,8,["onClick"])])])]),_:1},8,["data","props","filter-node-method","onNodeClick","onNodeDrop"])]),_:1}),(0,n.bF)(F,{style:{height:"51px"}},{default:(0,n.k6)(()=>[(0,n.bF)(v,{type:"primary",size:"small",icon:"el-icon-plus",onClick:t[2]||(t[2]=e=>c.add())}),(0,n.bF)(v,{type:"danger",size:"small",plain:"",icon:"el-icon-delete",onClick:c.delMenu},null,8,["onClick"])]),_:1})]),_:1})]),_:1})),[[y,m.menuloading]]),(0,n.bF)($,null,{default:(0,n.k6)(()=>[(0,n.bF)(k,{class:"nopadding",style:{padding:"20px"},ref:"main"},{default:(0,n.k6)(()=>[(0,n.bF)(N,{ref:"save",onSuccess:c.getMenu,type:m.activeName,menu:m.menuList},null,8,["onSuccess","type","menu"])]),_:1},512)]),_:1})]),_:1})}a(83725),a(35019),a(29838),a(51339);var m=a(24432);let c=1;var h={name:"settingMenu",components:{save:m["default"]},data(){return{activeName:1,menuloading:!1,menuList:[],menuProps:{label:e=>e.meta.title},menuFilterText:""}},watch:{menuFilterText(e){this.$refs.menu.filter(e)}},mounted(){this.getMenu()},methods:{handleClick(e){this.activeName=e,this.getMenu()},async getMenu(){this.menuloading=!0;var e=await this.$API.menu.list.get({form:this.activeName,type:2});this.menuloading=!1,1==e.code&&(this.menuList=e.data)},menuClick(e,t){var a=1==t.level?void 0:t.parent.data.id;this.$refs.save.setData(e,a),this.$refs.main.$el.scrollTop=0},menuFilterNode(e,t){if(!e)return!0;var a=t.meta.title;return-1!==a.indexOf(e)},nodeDrop(e,t,a){this.$refs.save.setData({}),this.$message(`拖拽对象：${e.data.meta.title}, 释放对象：${t.data.meta.title}, 释放对象的位置：${a}`)},async add(e,t){var a="未命名"+c++,n={pid:t?t.id:0,title:a,from:this.activeName,path:"",component:"",type:"menu"};this.menuloading=!0;var l=await this.$API.menu.save.post(n);this.menuloading=!1,1===l.code?this.getMenu():this.$message.warning(l.msg)},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 a={ids:e.map(e=>e.id)},n=await this.$API.demo.post.post(a);this.menuloading=!1,200==n.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(n.message)}}},g=a(66262);const p=(0,g.A)(h,[["render",r],["__scopeId","data-v-50973232"]]);var f=p}}]);