webpackJsonp([58],{"2OCm":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r("0xDb"),s={data:function(){return{visible:!1,menuList:[],menuListTreeProps:{label:"name",children:"children"},role:{},deptList:[],deptListTreeProps:{label:"name",children:"children"},dataForm:{id:0,roleName:"",remark:""},dataRule:{roleName:[{required:!0,message:this.$t("name")+this.$t("notEmpty"),trigger:"blur"}]},tempKey:-666666}},methods:{init:function(e){var t=this;this.dataForm.id=e||0,this.$http({url:this.$http.adornUrl("/sys/menu/list"),method:"get",params:this.$http.adornParams()}).then(function(e){var r=e.data;t.menuList=Object(a.f)(r,"menuId")}).then(function(){t.visible=!0,t.$nextTick(function(){t.$refs.dataForm.resetFields(),t.$refs.menuListTree.setCheckedKeys([]),t.$http({url:t.$http.adornUrl("/sys/dept/list"),method:"get",params:t.$http.adornParams()}).then(function(e){var r=e.data;t.deptList=Object(a.f)(r,"deptId")}).then(function(){t.visible=!0,t.$nextTick(function(){t.$refs.dataForm.resetFields(),t.$refs.deptListTree.setCheckedKeys([]),t.dataForm.id&&t.$http({url:t.$http.adornUrl("/sys/role/info/"+t.dataForm.id),method:"get",params:t.$http.adornParams()}).then(function(e){var r=e.data;if(r&&0===r.code){t.dataForm.roleName=r.role.roleName,t.dataForm.remark=r.role.remark;var a=r.role.menuIdList.indexOf(t.tempKey);-1!==a&&r.role.menuIdList.splice(a,r.role.menuIdList.length-a),t.$refs.menuListTree.setCheckedKeys(r.role.menuIdList);var s=r.role.deptIdList.indexOf(t.tempKey);-1!==s&&r.role.deptIdList.splice(s,r.role.deptIdList.length-s),t.$refs.deptListTree.setCheckedKeys(r.role.deptIdList)}})})})})})},dataFormSubmit:function(){var e=this;this.$refs.dataForm.validate(function(t){t&&e.$http({url:e.$http.adornUrl("/sys/role/"+(e.dataForm.id?"update":"save")),method:"post",data:e.$http.adornData({roleId:e.dataForm.id||void 0,roleName:e.dataForm.roleName,remark:e.dataForm.remark,menuIdList:[].concat(e.$refs.menuListTree.getCheckedKeys(),[e.tempKey],e.$refs.menuListTree.getHalfCheckedKeys()),deptIdList:[].concat(e.$refs.deptListTree.getCheckedKeys(),[e.tempKey],e.$refs.deptListTree.getHalfCheckedKeys())})}).then(function(t){var r=t.data;r&&0===r.code?e.$message({message:e.$t("message.success"),type:"success",duration:1500,onClose:function(){e.visible=!1,e.$emit("refreshDataList")}}):e.$message.error(r.msg)})})}}},o={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-dialog",{attrs:{title:e.dataForm.id?e.$t("edit"):e.$t("add"),"close-on-click-modal":!1,visible:e.visible},on:{"update:visible":function(t){e.visible=t}}},[r("el-form",{ref:"dataForm",attrs:{model:e.dataForm,rules:e.dataRule,"label-width":"80px"},nativeOn:{keyup:function(t){if(!("button"in t)&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;e.dataFormSubmit()}}},[r("el-form-item",{attrs:{label:e.$t("name"),prop:"roleName"}},[r("el-input",{attrs:{placeholder:e.$t("name")},model:{value:e.dataForm.roleName,callback:function(t){e.$set(e.dataForm,"roleName",t)},expression:"dataForm.roleName"}})],1),e._v(" "),r("el-form-item",{attrs:{label:e.$t("remark"),prop:"remark"}},[r("el-input",{attrs:{placeholder:e.$t("remark")},model:{value:e.dataForm.remark,callback:function(t){e.$set(e.dataForm,"remark",t)},expression:"dataForm.remark"}})],1),e._v(" "),r("el-form-item",{attrs:{size:"mini",label:e.$t("dataPermission")}},[r("el-tree",{ref:"deptListTree",attrs:{data:e.deptList,props:e.deptListTreeProps,"node-key":"deptId","default-expand-all":!0,"show-checkbox":""}})],1),e._v(" "),r("el-form-item",{attrs:{size:"mini",label:e.$t("operationAuthority")}},[r("el-tree",{ref:"menuListTree",attrs:{data:e.menuList,props:e.menuListTreeProps,"node-key":"menuId","default-expand-all":!0,"show-checkbox":""}})],1)],1),e._v(" "),r("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:function(t){e.visible=!1}}},[e._v(e._s(e.$t("message.cancel")))]),e._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dataFormSubmit()}}},[e._v(e._s(e.$t("message.confirm")))])],1)],1)},staticRenderFns:[]},i=r("VU/8")(s,o,!1,null,null,null);t.default=i.exports}});