2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
webpackJsonp([14],{Deyj:function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=l("mvHQ"),a=l.n(o),i={data:function(){return{loading:!1,detailForm:{},editForm:{},queryInfo:{roleName:"",pageNum:1,pageSize:10},addForm:{roleId:"",roleName:"",comments:""},currUserRoleId:"",currMenuNameList:[],currRoleList:[],allRoleList:[],roleList:[],currpage:1,total:0,addDialogVisible:!1,editDialogVisible:!1,detailDialogVisible:!1,addFormRules:{roleId:[{required:!0,message:"请输入角色等级",trigger:"blur"},{validator:function(e,t,l){return t?parseInt(t)?t>9999||t<=0?l(new Error("请输入1 ~ 9999之间的整数")):l():l(new Error("请输入1 ~ 9999之间的整数")):l(new Error("请输入角色等级"))},trigger:"blur"}],roleName:[{required:!0,message:"请输入角色名称",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],comments:[{required:!1,message:"请输入密码",trigger:"blur"},{min:0,max:250,message:"长度在 0 到 250 个字符",trigger:"blur"}]}}},mounted:function(){this.getAllRoleInfo()},beforeCreate:function(){},created:function(){this.currUserRoleId=JSON.parse(localStorage.getItem("userInfo")).authorityId,this.getRoleList()},methods:{getAllRoleInfo:function(){var e=this;this.$api.menu.queryAllMenuIdAndMenuName().then(function(t){e.allRoleList=t.data.data}).catch(function(){})},selectRoleList:function(){this.queryInfo.pageNum=1,this.total=0,this.getRoleList()},getRoleList:function(){var e=this;this.loading=!0,this.$api.role.queryAllRoleInfo(a()(this.queryInfo)).then(function(t){e.loading=!1,e.roleList=t.data.data,e.total=t.data.count,e.queryInfo.pageNum=1}).catch(function(){e.loading=!1})},handleSizeChange:function(e){this.queryInfo.pageSize=e,this.getRoleList()},handleCurrentChange:function(e){this.queryInfo.pageNum=e,this.getRoleList()},addDialogClose:function(){this.$refs.addFormRef.resetFields()},addRole:function(){var e=this;this.$refs.addFormRef.validate(function(t){t&&e.$api.role.addRole(a()(e.addForm)).then(function(t){e.$notify({message:t.data.msg,type:"success"}),e.addDialogVisible=!1,e.getRoleList()}).catch(function(){e.loading=!1})})},closeEditDialogVisible:function(){this.$refs.editFormRef.resetFields(),this.editDialogVisible=!1,this.currRoleList=[],this.currMenuNameList=[]},showEditDialog:function(e){var t=this;this.editDialogVisible=!0,this.$api.role.queryRoleById(e.id).then(function(e){t.loading=!1,t.editForm=e.data.data,t.setCurrRoleListAndMenuList(e.data.data.menuId,e.data.data.menuName)}).catch(function(){t.loading=!1})},editRole:function(){var e=this;this.$refs.editFormRef.validate(function(t){if(t){e.loading=!0;for(var l="",o="",i=0;i<e.currMenuNameList.length;i++){o=e.currMenuNameList[i]+","+o;for(var r=0;r<e.allRoleList.length;r++)e.allRoleList[r].menuName==e.currMenuNameList[i]&&(l=e.allRoleList[r].menuId+","+l)}var s=/,$/gi;e.editForm.menuName=o.replace(s,""),e.editForm.menuId=l.replace(s,""),e.$api.role.editRole(a()(e.editForm)).then(function(t){e.$notify({message:t.data.msg,type:"success"}),e.loading=!1,e.editDialogVisible=!1}).catch(function(){e.loading=!1})}})},closeDetailDialogVisible:function(){this.detailDialogVisible=!1,this.currRoleList=[],this.currMenuNameList=[]},showDetailDialog:function(e){var t=this;this.loading=!0,this.detailDialogVisible=!0,this.$api.role.queryRoleById(e.id).then(function(e){t.loading=!1,t.detailForm=e.data.data,t.setCurrRoleListAndMenuList(e.data.data.menuId,e.data.data.menuName)}).catch(function(){t.loading=!1})},delRole:function(e){var t=this;this.$confirm("确定删除该角色吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){t.$api.role.deleteRoleById(e.id).then(function(e){t.$notify({message:e.data.msg,type:"success"}),t.getRoleList()}).catch(function(){})}).catch(function(){})},setCurrRoleListAndMenuList:function(e,t){var l=e.split(","),o=t.split(",");this.currMenuNameList=o;for(var a=l.length,i=0;i<a;i++){var r={};r.id=i+"",r.menuId=l[i],r.menuName=o[i],this.currRoleList.push(r)}}}},r={render:function(){var e=this,t=e.$createElement,l=e._
|
||
|
//# sourceMappingURL=14.f7c3ce42cf4fcc86b0e9.js.map
|