lepu-test-platform-web/dist/static/js/14.f7c3ce42cf4fcc86b0e9.js

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._self._c||t;return l("div",{staticClass:"role-box"},[l("el-form",{staticClass:"item-form-inline",attrs:{inline:!0}},[l("el-form-item",{attrs:{label:"角色名称"}},[l("el-input",{staticClass:"input-with-select",attrs:{placeholder:"请输入角色名称",clearable:""},model:{value:e.queryInfo.roleName,callback:function(t){e.$set(e.queryInfo,"roleName",t)},expression:"queryInfo.roleName"}})],1),e._v(" "),l("el-form-item",[l("el-button",{attrs:{type:"primary"},on:{click:e.selectRoleList}},[e._v("查询")])],1)],1),e._v(" "),l("el-row",{staticClass:"add_button"},[l("el-col",{attrs:{span:2}},[l("el-button",{attrs:{type:"primary"},on:{click:function(t){e.addDialogVisible=!0}}},[e._v("添加")])],1)],1),e._v(" "),l("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.roleList.slice((e.currpage-1)*e.queryInfo.pageSize,e.currpage*e.queryInfo.pageSize),border:"",fit:!0}},[l("el-table-column",{attrs:{label:"序号",type:"index",align:"center",width:"80"}}),e._v(" "),e._e(),e._v(" "),l("el-table-column",{attrs:{label:"角色名称",prop:"roleName"}}),e._v(" "),l("el-table-column",{attrs:{label:"备注",prop:"comments","show-overflow-tooltip":""}}),e._v(" "),l("el-table-column",{attrs:{label:"操作",fixed:"right",width:"150"},scopedSlots:e._u([{key:"default",fn:function(t){return[parseInt(t.row.roleId)>=parseInt(e.currUserRoleId)?l("el-button",{attrs:{type:"text",size:"small"},on:{click:function(l){return e.showDetailDialog(t.row)}}},[e._v("查看")]):e._e(),e._v(" "),parseInt(t.row.roleId)>=parseInt(e.currUserRoleId)?l("el-button",{attrs:{type:"text",size:"small"},on:{click:function(l){return e.showEditDialog(t.row)}}},[e._v("编辑")]):e._e(),e._v(" "),parseInt(t.row.roleId)>=parseInt(e.currUserRoleId)?l("el-button",{attrs:{type:"text",size:"small"},on:{click:function(l){return e.delRole(t.row)}}},[e._v("删除")]):e._e()]}}])})],1),e._v(" "),l("el-pagination",{attrs:{"current-page":e.currpage,"page-sizes":[5,10,20,30],"page-size":e.queryInfo.pageSize,layout:"prev, pager, next, sizes, total, jumper",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),e._v(" "),l("el-dialog",{attrs:{title:"添加",visible:e.addDialogVisible,"close-on-click-modal":!1,width:"50%"},on:{"update:visible":function(t){e.addDialogVisible=t},close:e.addDialogClose}},[l("el-form",{ref:"addFormRef",attrs:{model:e.addForm,rules:e.addFormRules,"label-width":"100px"}},[l("el-form-item",{attrs:{label:"角色等级",prop:"roleId"}},[l("el-input",{attrs:{placeholder:"请输入角色等级"},model:{value:e.addForm.roleId,callback:function(t){e.$set(e.addForm,"roleId",t)},expression:"addForm.roleId"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[l("el-input",{attrs:{placeholder:"请输入角色名称"},model:{value:e.addForm.roleName,callback:function(t){e.$set(e.addForm,"roleName",t)},expression:"addForm.roleName"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"备注",prop:"comments"}},[l("el-input",{attrs:{placeholder:"请输入备注信息",type:"textarea"},model:{value:e.addForm.comments,callback:function(t){e.$set(e.addForm,"comments",t)},expression:"addForm.comments"}})],1)],1),e._v(" "),l("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[l("el-button",{on:{click:function(t){e.addDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),l("el-button",{attrs:{type:"primary"},on:{click:e.addRole}},[e._v("确 定")])],1)],1),e._v(" "),l("el-dialog",{attrs:{title:"修改",visible:e.editDialogVisible,"close-on-click-modal":!1,width:"50%"},on:{"update:visible":function(t){e.editDialogVisible=t},close:e.closeEditDialogVisible}},[l("el-form",{ref:"editFormRef",attrs:{model:e.editForm,rules:e.addFormRules,"label-width":"100px"}},[l("el-form-item",{attrs:{label:"角色等级",prop:"roleId"}},[l("el-input",{attrs:{placeholder:"请输入角色等级",disabled:""},model:{value:e.editForm.roleId,callback:function(t){e.$set(e.editForm,"roleId",t)},expression:"editForm.roleId"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[l("el-input",{attrs:{placeholder:"请输入角色名称"},model:{value:e.editForm.roleName,callback:function(t){e.$set(e.editForm,"roleName",t)},expression:"editForm.roleName"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"所属角色",prop:""}},[[l("el-checkbox-group",{model:{value:e.currMenuNameList,callback:function(t){e.currMenuNameList=t},expression:"currMenuNameList"}},e._l(e.allRoleList,function(e){return l("el-checkbox",{key:e.menuId,attrs:{label:e.menuName,value:e.menuId}})}),1)]],2),e._v(" "),l("el-form-item",{attrs:{label:"备注",prop:"comments"}},[l("el-input",{attrs:{placeholder:"请输入备注信息",type:"textarea"},model:{value:e.editForm.comments,callback:function(t){e.$set(e.editForm,"comments",t)},expression:"editForm.comments"}})],1)],1),e._v(" "),l("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[l("el-button",{on:{click:e.closeEditDialogVisible}},[e._v("取 消")]),e._v(" "),l("el-button",{attrs:{type:"primary"},on:{click:e.editRole}},[e._v("确 定")])],1)],1),e._v(" "),l("el-dialog",{attrs:{title:"查看",visible:e.detailDialogVisible,"close-on-click-modal":!1,width:"50%"},on:{"update:visible":function(t){e.detailDialogVisible=t},close:e.closeDetailDialogVisible}},[l("el-form",{attrs:{model:e.detailForm,"label-width":"100px"}},[l("el-form-item",{attrs:{label:"角色等级",prop:"roleName"}},[l("el-input",{attrs:{disabled:""},model:{value:e.detailForm.roleId,callback:function(t){e.$set(e.detailForm,"roleId",t)},expression:"detailForm.roleId"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[l("el-input",{attrs:{disabled:""},model:{value:e.detailForm.roleName,callback:function(t){e.$set(e.detailForm,"roleName",t)},expression:"detailForm.roleName"}})],1),e._v(" "),l("el-form-item",{attrs:{label:"所属角色",prop:""}},[[l("el-checkbox-group",{model:{value:e.currMenuNameList,callback:function(t){e.currMenuNameList=t},expression:"currMenuNameList"}},e._l(e.currRoleList,function(e){return l("el-checkbox",{key:e.id,attrs:{label:e.menuName,value:e.menuId}})}),1)]],2),e._v(" "),l("el-form-item",{attrs:{label:"备注",prop:"comments"}},[l("el-input",{attrs:{type:"textarea",disabled:""},model:{value:e.detailForm.comments,callback:function(t){e.$set(e.detailForm,"comments",t)},expression:"detailForm.comments"}})],1)],1),e._v(" "),l("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[l("el-button",{on:{click:e.closeDetailDialogVisible}},[e._v("取 消")])],1)],1)],1)},staticRenderFns:[]};var s=l("VU/8")(i,r,!1,function(e){l("JOJa")},"data-v-c781d4ca",null);t.default=s.exports},JOJa:function(e,t){}});
//# sourceMappingURL=14.f7c3ce42cf4fcc86b0e9.js.map