webpackJsonp([44],{"+8aB":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("woOf"),l=n.n(r),o=n("MTGp"),i=n("TIfe"),s={data:function(){return{form:{title:"",menu_string:[]},rules:{title:[{required:!0,message:"请输入角色名称",trigger:"blur"}],menu_string:[{required:!0,message:"请选择角色权限"}]},isAll:!1,powerVal:{children:"child",label:"title"},powers:i.c}},created:function(){var e=this;this.$route.query.id&&Object(o.e)({role_id:this.$route.query.id}).then(function(t){var n=t.data.result;e.form={title:n.title,menu_string:n.menu_string},e.form.menu_string.length>0&&e.$refs.tree.setCheckedKeys(e.form.menu_string)})},methods:{checkAll:function(){if(this.isAll){var e=[];i.c.forEach(function(t){e.push({code:t.code,label:""})}),this.$refs.tree.setCheckedNodes(e)}else this.$refs.tree.setCheckedKeys([])},onSubmit:function(){var e=this,t=this,n=this.$route.query.id;function r(e){if(console.log(e),301e3!=e.data.code)return t.$message("添加失败!");t.$message({type:"success",message:"添加成功!"}),t.$router.replace("/systemManage/roleManage"),n==t.$store.state.user.roles.id.toString()&&location.reload()}this.form.menu_string=this.$refs.tree.getCheckedKeys(),this.$refs.form.validate(function(t){if(!t)return console.log("error submit!!"),!1;e.$route.query.id?Object(o.d)(l()({},{role_id:e.$route.query.id},e.form)).then(r):Object(o.a)(e.form).then(r)})}}},a={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"container"},[n("el-form",{ref:"form",attrs:{autoComplete:"on",model:e.form,rules:e.rules,"label-width":"120px"}},[n("el-form-item",{attrs:{label:"角色名",prop:"title"}},[n("el-input",{attrs:{maxlength:10},model:{value:e.form.title,callback:function(t){e.$set(e.form,"title",t)},expression:"form.title"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"角色权限",prop:"menu_string"}},[n("el-tree",{ref:"tree",attrs:{data:e.powers,"node-key":"code","show-checkbox":"","default-expand-all":"",props:e.powerVal}})],1),e._v(" "),n("div",{staticStyle:{"text-align":"center"}},[n("el-checkbox",{staticStyle:{padding:"0 20px"},on:{change:e.checkAll},model:{value:e.isAll,callback:function(t){e.isAll=t},expression:"isAll"}},[e._v("全选")]),e._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:e.onSubmit}},[e._v("确定")])],1)],1)],1)},staticRenderFns:[]};var c=n("VU/8")(s,a,!1,function(e){n("+yQw")},null,null);t.default=c.exports},"+yQw":function(e,t,n){var r=n("nKL1");"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n("rjj0")("9af29a76",r,!0)},nKL1:function(e,t,n){(e.exports=n("FZ+f")(!1)).push([e.i,"\n.el-tree-node__expand-icon.is-leaf {\n  display: none;\n}\n.el-tree .expanded {\n  display: none;\n}\n.el-tree .el-tree-node__content {\n  height: 36px;\n  padding-right: 20px;\n}\n.el-tree .el-checkbox {\n  padding-left: 10px;\n}\n.el-tree > div > .el-tree-node__content {\n  background-color: #f5f7fa;\n}\n.el-tree > div > .el-tree-node__content .expanded {\n    display: block;\n}\n.el-tree > div > .el-tree-node__content + .el-tree-node__children {\n    padding-left: 20px;\n}\n",""])}});