webpackJsonp([31],{EFea:function(e,t){},aTXs:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=o("CCn6"),a={data:function(){return{nowPage:1,total:0,menuList:[],plist:[],dialog:{title:"新增菜单",show:!1,rules:{name:[{required:!0,message:"请填写菜单名称",trigger:"change"}],cover:[{required:!0,message:"请填写菜单code",trigger:"change"}]},form:{id:"",name:"",cover:"",pid:0,type:2}}}},created:function(){this.getList()},methods:{getList:function(){var e=this;Object(i._24)().then(function(t){t&&(e.menuList=[],e.plist=[],t.forEach(function(t){e.menuList.push(t),e.plist.push(t),t.children&&t.children.forEach(function(t){e.menuList.push(t)})}))})},edit:function(e){this.dialog.show=!0,this.dialog.form.id=e.id,this.dialog.title="编辑菜单",this.dialog.form.name=e.name,this.dialog.form.cover=e.cover,this.dialog.form.pid=e.pid},add:function(){this.dialog.show=!0,this.dialog.form.id="",this.dialog.title="新增菜单",this.dialog.form.name="",this.dialog.form.pid=0,this.dialog.form.cover=""},del:function(e){var t=this;this.$confirm("此操作将删除该菜单?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){Object(i.C)(e.id).then(function(e){t.$message({type:"success",message:"删除成功!"}),t.getList()})})},sub:function(){var e=this;this.$refs.form.validate(function(t){if(t){var o=e.dialog;if(o.form.id){var a={name:o.form.name,cover:o.form.cover,pid:o.form.pid};Object(i._59)(o.form.id,a).then(function(){e.$message({type:"success",message:"修改成功!"}),o.show=!1,e.getList()})}else{var l={name:o.form.name,cover:o.form.cover,pid:o.form.pid};Object(i._51)(l).then(function(){e.$message({type:"success",message:"添加成功!"}),o.show=!1,e.getList()})}}})}}},l={render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"menu"},[o("div",{staticClass:"head clear-both"},[e.$store.state.readonly?e._e():o("el-button",{staticStyle:{float:"right"},attrs:{plain:"",type:"success"},on:{click:e.add}},[e._v("新增菜单")])],1),e._v(" "),o("el-table",{staticStyle:{width:"100%"},attrs:{data:e.menuList}},[o("el-table-column",{attrs:{prop:"name",label:"菜单名称"}}),e._v(" "),o("el-table-column",{attrs:{prop:"cover",label:"菜单Code"}}),e._v(" "),e.$store.state.readonly?e._e():o("el-table-column",{attrs:{label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("el-button",{attrs:{size:"mini",plain:"",type:"primary"},on:{click:function(o){e.edit(t.row)}}},[e._v("\n          编辑\n        ")]),e._v(" "),e.$store.state.deletePermission?o("el-button",{attrs:{size:"mini",type:"danger",plain:""},on:{click:function(o){e.del(t.row)}}},[e._v("\n          删除\n        ")]):e._e()]}}])})],1),e._v(" "),o("el-dialog",{attrs:{title:e.dialog.title,center:"","append-to-body":"",visible:e.dialog.show,width:"30%"},on:{"update:visible":function(t){e.$set(e.dialog,"show",t)}}},[o("el-form",{ref:"form",attrs:{rules:e.dialog.rules,model:e.dialog.form,"label-width":"100px"}},[o("el-form-item",{attrs:{label:"菜单名称",prop:"name"}},[o("el-input",{model:{value:e.dialog.form.name,callback:function(t){e.$set(e.dialog.form,"name",t)},expression:"dialog.form.name"}})],1),e._v(" "),o("el-form-item",{attrs:{label:"菜单Code",prop:"cover"}},[o("el-input",{model:{value:e.dialog.form.cover,callback:function(t){e.$set(e.dialog.form,"cover",t)},expression:"dialog.form.cover"}})],1),e._v(" "),o("el-form-item",{attrs:{label:"上级菜单",prop:"cover"}},[o("el-select",{attrs:{placeholder:"请选择"},model:{value:e.dialog.form.pid,callback:function(t){e.$set(e.dialog.form,"pid",t)},expression:"dialog.form.pid"}},[o("el-option",{attrs:{label:"无",value:0}}),e._v(" "),e._l(e.plist,function(e){return o("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})],2)],1)],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(t){e.dialog.show=!1}}},[e._v("取 消")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:e.sub}},[e._v("确 定")])],1)],1)],1)},staticRenderFns:[]};var s=o("VU/8")(a,l,!1,function(e){o("EFea")},"data-v-40740e0e",null);t.default=s.exports}});