webpackJsonp([72],{Upoe:function(e,t){},XX5T:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-form",{ref:"form",staticStyle:{"max-width":"500px"},attrs:{model:e.formData,rules:e.rules,"label-width":"80px","label-position":"right",size:"small"}},[a("el-form-item",{attrs:{prop:"name",label:"名称"}},[a("el-input",{model:{value:e.formData.name,callback:function(t){e.$set(e.formData,"name",t)},expression:"formData.name"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"enname",label:"英文名"}},[a("el-input",{model:{value:e.formData.enname,callback:function(t){e.$set(e.formData,"enname",t)},expression:"formData.enname"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"roleType",label:"类型"}},[a("el-input",{model:{value:e.formData.roleType,callback:function(t){e.$set(e.formData,"roleType",t)},expression:"formData.roleType"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"remarks",label:"备注"}},[a("el-input",{model:{value:e.formData.remarks,callback:function(t){e.$set(e.formData,"remarks",t)},expression:"formData.remarks"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"menuIds",label:"菜单权限"}},[a("el-tree",{ref:"menuTree",attrs:{data:e.menus,"highlight-current":!0,"expand-on-click-node":!1,props:e.treeProps,"node-key":"id",label:"name","show-checkbox":"","default-expand-all":""}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"permission",label:"数据权限"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{multiple:"",placeholder:"请选择"},model:{value:e.formData.permission,callback:function(t){e.$set(e.formData,"permission",t)},expression:"formData.permission"}},e._l(e.permissions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dataruleName,value:e.permission}})}))],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{loading:e.$store.state.fetchingData,type:"primary"},on:{click:e.onSave}},[e._v("保存")]),e._v(" "),a("el-button",{on:{click:function(t){e.$router.go(-1)}}},[e._v("取消")])],1)],1)],1)},staticRenderFns:[]};var r=a("VU/8")({created:function(){var e=this;this.$route.query.id&&this.$http.get({url:"/sysRole/getOne",data:{id:this.$route.query.id}}).then(function(t){t.success&&(t.data.permission=t.data.permission?t.data.permission.split(","):[],t.data.menuIds&&e.$refs.menuTree.setCheckedKeys(t.data.menuIds.split(",")),e.formData=t.data)}),this.getMenus(),this.getPermissions()},data:function(){return{saving:!1,formData:{},rules:{name:[{required:!0,message:"请填写名称",trigger:"blur"}],enname:[{required:!0,message:"请填写英文名",trigger:"blur"}]},treeProps:{label:"name"},menus:[],permissions:[]}},methods:{getMenus:function(){var e=this;this.$http.get({url:"/sysMenu/menuTree"}).then(function(t){t.success&&(e.menus=t.data)})},getPermissions:function(){var e=this;this.$http.get({url:"/sysDatarule/all"}).then(function(t){t.success&&(e.permissions=t.data)})},onSave:function(){var e=this;this.$refs.form.validate(function(t){if(!t)return!1;e.submit()})},submit:function(){var e=this;this.formData.menuIds=this.$refs.menuTree.getCheckedKeys(!1).join(),this.$http.post({url:this.formData.id?"/sysRole/update":"/sysRole/save",data:this.formData}).then(function(t){t.success?(e.$message.success("成功"),e.$router.go(-1)):e.$message.warning("失败")})}}},s,!1,function(e){a("Upoe")},"data-v-5a6dbfcb",null);t.default=r.exports}});