619.ab439be1.js 15 KB

12
  1. "use strict";(self["webpackChunkchouhua02"]=self["webpackChunkchouhua02"]||[]).push([[619],{13619:function(e,t,l){l.r(t),l.d(t,{default:function(){return f}});var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"userManage-Page"},[t("div",{staticClass:"userRight-area"},[t("div",{staticClass:"userRight-table"},[t("div",{staticClass:"userOperate-area"},[t("div",{staticClass:"filterSearch-area"},[t("div",{staticClass:"roleName-area"},[t("span",[e._v("角色名称")]),t("el-input",{attrs:{size:"small",placeholder:"请输入角色名称"},model:{value:e.userInputSearchValue.roleName,callback:function(t){e.$set(e.userInputSearchValue,"roleName",t)},expression:"userInputSearchValue.roleName"}})],1),t("div",{staticClass:"authorityName-area"},[t("span",[e._v("权限名称")]),t("el-input",{attrs:{size:"small",placeholder:"请输入权限名称"},model:{value:e.userInputSearchValue.roleKey,callback:function(t){e.$set(e.userInputSearchValue,"roleKey",t)},expression:"userInputSearchValue.roleKey"}})],1),t("div",{staticClass:"date-area"},[t("span",[e._v("创建时间")]),t("el-date-picker",{attrs:{type:"daterange","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期",size:"small"},model:{value:e.userInputSearchValue.date,callback:function(t){e.$set(e.userInputSearchValue,"date",t)},expression:"userInputSearchValue.date"}})],1),t("div",{staticClass:"searchReset-bnt"},[t("el-button",{staticClass:"self-button",attrs:{type:"primary",size:"mini",icon:"el-icon-search"},on:{click:e.talbeSearchFilter}},[e._v("查询 ")]),t("el-button",{staticClass:"self-button",attrs:{type:"primary",size:"mini",icon:"el-icon-refresh"},on:{click:e.reseatTableFilterValue}},[e._v("重置 ")])],1)]),t("div",{staticClass:"andUpload-area"},[t("el-button",{staticClass:"self-button",attrs:{type:"primary",size:"mini",icon:"el-icon-plus"},on:{click:e.addRoleDialog}},[e._v("新增 ")])],1)]),t("div",{staticClass:"roleList-table"},[t("el-table",{ref:"singleTable",staticStyle:{width:"100%"},attrs:{data:e.tableData,"header-cell-style":{fontFamily:"SourceHanSansCN-Regular",color:"#fff",backgroundColor:"#0F4C81",fontSize:"15px"},"header-align":"center","highlight-current-row":"",border:"","row-style":e.rowClass,"max-height":633},on:{"selection-change":e.handleSelectionChange}},[t("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),t("el-table-column",{attrs:{prop:"roleId",label:"角色编号",width:"210",align:"center"}}),t("el-table-column",{attrs:{prop:"roleName",label:"角色名称",width:"210",align:"center"}}),t("el-table-column",{attrs:{prop:"roleKey",label:"权限名称",width:"210",align:"center"}}),t("el-table-column",{attrs:{prop:"createTime",label:"创建时间",width:"210",align:"center"}}),t("el-table-column",{attrs:{label:"操作",align:"center"},scopedSlots:e._u([{key:"default",fn:function(l){return[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.handleEdit(l.$index,l.row)}}},[e._v("修改")]),t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.handleDelete(l.$index,l.row)}}},[e._v("删除")])]}}])})],1)],1),t("div",{staticClass:"table-pagination"},[t("el-pagination",{attrs:{background:"","prev-text":"上一页","next-text":"下一页","current-page":e.currentPage,"page-size":e.pageSize,layout:"total, prev, pager, next, jumper",total:e.totalItem},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)])]),t("el-dialog",{attrs:{title:"添加角色",visible:e.addRoleDialogFormVisible},on:{"update:visible":function(t){e.addRoleDialogFormVisible=t}}},[t("el-form",{ref:"roleRuleForm",staticClass:"demo-ruleForm",attrs:{model:e.roleForm,rules:e.rules,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[t("el-input",{model:{value:e.roleForm.roleName,callback:function(t){e.$set(e.roleForm,"roleName",t)},expression:"roleForm.roleName"}})],1),t("el-form-item",{attrs:{label:"权限名称",prop:"roleKey"}},[t("el-input",{model:{value:e.roleForm.roleKey,callback:function(t){e.$set(e.roleForm,"roleKey",t)},expression:"roleForm.roleKey"}})],1),t("el-form-item",{attrs:{label:"状态"}},[t("el-radio-group",{model:{value:e.roleForm.status,callback:function(t){e.$set(e.roleForm,"status",t)},expression:"roleForm.status"}},[t("el-radio",{attrs:{label:"0"}},[e._v("正常")]),t("el-radio",{attrs:{label:"1"}},[e._v("停用")])],1)],1),t("el-form-item",{attrs:{label:"菜单权限"}},[t("myTree",{attrs:{selfTreeData:e.menuAuthorityDropdownList,selfTreeProps:e.elTreeDefaultProps,nodeKeyid:"id",originalCheckedKeys:[]},on:{getSelectedKeys:e.getSelectedKeysAddRole}})],1)],1),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.submitForm("roleRuleForm")}}},[e._v("新增角色")]),t("el-button",{on:{click:function(t){return e.resetForm("roleRuleForm")}}},[e._v("重置")])],1)],1),t("el-dialog",{staticClass:"upload-excel-dialog",attrs:{title:"角色导入",visible:e.uploadExcelDialogVisible},on:{"update:visible":function(t){e.uploadExcelDialogVisible=t}}},[t("el-upload",{staticClass:"upload-style",attrs:{drag:"",action:"#",multiple:""}},[t("i",{staticClass:"el-icon-upload"}),t("div",{staticClass:"el-upload__text"},[e._v("将文件拖到此处,或"),t("em",[e._v("点击上传")])]),t("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v("仅允许导入xls或xlsx格式文件")])]),t("div",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.uploadExcelDialogVisible=!1}}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary"},on:{click:function(t){e.uploadExcelDialogVisible=!1}}},[e._v("确 定")])],1)],1),t("el-dialog",{attrs:{title:"修改角色信息",visible:e.editRoleDialogFormVisible},on:{"update:visible":function(t){e.editRoleDialogFormVisible=t}}},[t("el-form",{ref:"ruleForm",staticClass:"demo-ruleForm",attrs:{model:e.editrowForm,rules:e.rules,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"角色名称",prop:"roleName"}},[t("el-input",{attrs:{disabled:""},model:{value:e.editrowForm.roleName,callback:function(t){e.$set(e.editrowForm,"roleName",t)},expression:"editrowForm.roleName"}})],1),t("el-form-item",{attrs:{label:"权限名称",prop:"roleKey"}},[t("el-input",{attrs:{disabled:""},model:{value:e.editrowForm.roleKey,callback:function(t){e.$set(e.editrowForm,"roleKey",t)},expression:"editrowForm.roleKey"}})],1),t("el-form-item",{attrs:{label:"状态"}},[t("el-radio-group",{model:{value:e.editrowForm.status,callback:function(t){e.$set(e.editrowForm,"status",t)},expression:"editrowForm.status"}},[t("el-radio",{attrs:{label:"0"}},[e._v("正常")]),t("el-radio",{attrs:{label:"1"}},[e._v("停用")])],1)],1),t("el-form-item",{attrs:{label:"菜单权限"}},[t("myTree",{attrs:{selfTreeData:e.menuAuthorityDropdownList,selfTreeProps:e.elTreeDefaultProps,nodeKeyid:"id",originalCheckedKeys:e.slectedMenuAuthorityEditRole},on:{getSelectedKeys:e.getSelectedKeysEditRole}})],1)],1),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.editDialogCancel}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.editDialogConfirm}},[e._v("确 定")])],1)],1)],1)},o=[],a=l(33186),r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"myElTree"},[t("el-checkbox",{attrs:{indeterminate:e.foldIndeterminate},on:{change:e.selfTreeFold},model:{value:e.foldOrNotStatus,callback:function(t){e.foldOrNotStatus=t},expression:"foldOrNotStatus"}},[e._v("展开/折叠")]),t("el-checkbox",{attrs:{indeterminate:e.checkIndeterminate},on:{change:e.selfTreeCheckall},model:{value:e.checkAllStatus,callback:function(t){e.checkAllStatus=t},expression:"checkAllStatus"}},[e._v("全选/全不选")]),e.selftreeRefresh?t("el-tree",{ref:"selftree",attrs:{data:e.selfTreeData,props:e.selfTreeProps,"show-checkbox":"","expand-on-click-node":!1,"node-key":e.nodeKeyid,"default-expand-all":e.foldDefault,"default-checked-keys":e.checkedKeys},on:{check:e.selfTreeNodeClick,"node-collapse":e.selfNodeCollapse,"node-expand":e.selfNodeExpand,"node-click":e.handleClick}}):e._e()],1)},i=[],n={name:"myTree",props:["selfTreeData","selfTreeProps","nodeKeyid","originalCheckedKeys"],data(){return{foldOrNotStatus:!1,foldKeys:[],foldIndeterminate:!1,checkAllStatus:!1,checkIndeterminate:!0,treeRootKeys:[],selftreeRefresh:!0,checkedKeys:[],foldDefault:!1,foldornot:!1,tempkeys:[],allKeys:[]}},mounted(){this.getTreeRootKeys()},computed:{},watch:{},methods:{handleClick(){console.log("#####33")},changeFoldCheckBoxStatus(){setTimeout((()=>{const e=this.$refs.selftree.store.nodesMap;let t=[];for(let o in e){const l=e[o];l.isLeaf||t.push(l.expanded)}const l=t.every((e=>0==e)),s=t.every((e=>1==e));s?(this.foldIndeterminate=!1,this.foldOrNotStatus=!0):l?(this.foldIndeterminate=!1,this.foldOrNotStatus=!1):this.foldIndeterminate=!0}),100)},selfNodeExpand(){this.changeFoldCheckBoxStatus()},selfNodeCollapse(){this.changeFoldCheckBoxStatus()},emitSelectedKeys(){const e=this.$refs.selftree.getCheckedKeys();this.$emit("getSelectedKeys",e)},selfTreeNodeClick(){console.log("@@@@"),this.emitSelectedKeys();const e=this.$refs.selftree.getCheckedKeys();this.checkAllStatus=e.toString()==this.allKeys.toString(),this.checkIndeterminate=e.length>0&&e.length<this.allKeys.length},getTreeRootKeys(){const e=this.selfTreeData.length,t=this.$refs.selftree.getCheckedKeys();for(let s=0;s<e;s++)this.treeRootKeys.push(this.selfTreeData[s][this.nodeKeyid]);this.$refs.selftree.setCheckedKeys(this.treeRootKeys),this.allKeys=this.$refs.selftree.getCheckedKeys(),this.checkedKeys=this.originalCheckedKeys,this.$refs.selftree.setCheckedKeys(t);const l=this.ArrayHandleIncludes(this.treeRootKeys,this.checkedKeys);0===this.checkedKeys.length?this.checkIndeterminate=!1:l?(this.checkIndeterminate=!1,this.checkAllStatus=!0):this.checkIndeterminate=!0},ArrayHandleIncludes(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.every((e=>t.includes(e)))},selfTreeFold(e){this.selftreeRefresh=!1,this.foldOrNotStatus=e,this.foldIndeterminate=!1,this.foldDefault=e,this.$nextTick((()=>{this.selftreeRefresh=!0}))},selfTreeCheckall(e){e?(this.$refs.selftree.setCheckedKeys(this.treeRootKeys),this.checkIndeterminate=!1):(this.$refs.selftree.setCheckedKeys([]),this.checkIndeterminate=!1)}}},c=n,d=l(1001),u=(0,d.Z)(c,r,i,!1,null,"999ad5f8",null),h=u.exports,m={name:"roleManage",components:{myTree:h},data(){return{isIndeterminate:!0,checkAll:!1,userInputSearchValue:{roleName:"",roleKey:"",date:""},tableData:[],addRoleDialogFormVisible:!1,uploadExcelDialogVisible:!1,editRoleDialogFormVisible:!1,selectRow:[],selectData:[],menuAuthorityfoldOrNot:!1,menuAuthorityDropdownList:null,elTreeDefaultProps:{children:"children",label:"label"},refreshTreeAddFold:!0,refreshTreeAddCheck:!0,menuAuthorityClickedKeys:[],slectedMenuAuthorityEditRole:[],roleForm:{roleNumber:null,roleName:"",authorityName:"",clickedAuthorityids:[],status:"0",updateTime:(new Date).toLocaleDateString(),remark:"",menu:[]},editrowForm:{roleId:null,roleName:"",roleKey:"",createTime:"",clickedAuthorityids:[]},rules:{roleName:[{required:!0,message:"角色名称不能为空",trigger:"blur"}],authorityName:[{required:!0,message:"权限名称不能为空",trigger:"blur"}]},currentPage:1,pageSize:11,totalItem:20}},watch:{selectData(e){this.selectRow=[],e.length>0&&e.forEach((e=>{this.selectRow.push(this.tableData.indexOf(e))}))}},mounted(){this.getRoleListFromBackendToTable(1,11),this.getMenuTreeselect()},methods:{getroleAuthority(e){(0,a.p_)(e).then((e=>{console.log(e)}))},handleSelectionChange(e){this.selectData=e},rowClass({row:e,rowIndex:t}){if(this.selectRow.includes(t))return{"background-color":"rgba(185, 221, 249, 0.75)"}},getMenuTreeselect(){(0,a.Bx)().then((e=>{this.menuAuthorityDropdownList=e.data}))},getSelectedKeysAddRole(e){console.log("添加角色所选权限数组",e),this.roleForm.clickedAuthorityids=e},getSelectedKeysEditRole(e){console.log("添加角色所选权限数组",e),this.editrowForm.clickedAuthorityids=e},getRoleListFromBackendToTable(e,t){let l={pageNum:e,pageSize:t};(0,a.JV)(l).then((e=>{200===e.code&&(this.tableData=e.rows,this.totalItem=e.total)}))},talbeSearchFilter(){let e="",t="";Array.isArray(this.userInputSearchValue.date)&&(e=this.userInputSearchValue.date[0],t=this.userInputSearchValue.date[1]);let l={pageNum:1,pageSize:this.pageSize,roleName:this.userInputSearchValue.roleName,roleKey:this.userInputSearchValue.roleKey,"params[beginTime]":e,"params[endTime]":t};(0,a.JV)(l).then((e=>{200===e.code&&(this.tableData=e.rows,this.currentPage=1,this.totalItem=e.total)}))},reseatTableFilterValue(){this.userInputSearchValue.roleName="",this.userInputSearchValue.authorityName="",this.userInputSearchValue.date="",this.getRoleListFromBackendToTable(1,this.pageSize)},submitForm(e){this.$refs[e].validate((e=>{if(!e)return this.$message({showClose:!0,message:"角色信息填写错误!",type:"error"}),!1;{let e={roleName:this.roleForm.roleName,roleKey:this.roleForm.roleKey,status:this.roleForm.status,menuIds:this.roleForm.clickedAuthorityids};(0,a.bl)(e).then((e=>{200===e.code?(console.log(e),this.$message({showClose:!0,message:"成功添加一个角色",type:"success"}),this.getRoleListFromBackendToTable(this.currentPage,this.pageSize),this.addRoleDialogFormVisible=!1):this.$message({showClose:!0,message:e.msg,type:"warning"})}))}}))},resetForm(e){this.$refs[e].resetFields()},addRoleDialog(){this.addRoleDialogFormVisible=!0,this.ruleForm={}},uploadExcel(){this.uploadExcelDialogVisible=!0},handleDelete(e,t){console.log("删除index,row:",e,t),this.$confirm("确定删除该角色?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{(0,a.iy)(t.roleId).then((e=>{console.log("删除成功返回信息:",e),this.getRoleListFromBackendToTable(this.currentPage,this.pageSize),this.$message({showClose:!0,type:"success",message:"删除成功!"})}))})).catch((()=>{this.$message({showClose:!0,type:"info",message:"已取消删除"})}))},handleEdit(e,t){console.log("Edit index, row:",e,t),this.editrowForm=t;let l=this;this.$nextTick((()=>{(0,a.I)(t.roleId).then((e=>{200===e.code&&(l.slectedMenuAuthorityEditRole=e.menuIds,l.editRoleDialogFormVisible=!0)}))}))},editDialogCancel(){this.editRoleDialogFormVisible=!1},editDialogConfirm(){this.editrowForm.clickedAuthorityids||(this.editrowForm.clickedAuthorityids=this.slectedMenuAuthorityEditRole);let e={roleId:this.editrowForm.roleId,roleName:this.editrowForm.roleName,roleKey:this.editrowForm.roleKey,status:this.editrowForm.status,menuIds:this.editrowForm.clickedAuthorityids};(0,a.xP)(e).then((e=>{console.log("修改角色返回信息:",e),this.$message({showClose:!0,message:"修改成功",type:"success"})})),this.editRoleDialogFormVisible=!1},handleSizeChange(e){console.log(`每页 ${e} 条`)},handleCurrentChange(e){this.currentPage=e;let t={pageNum:this.currentPage,pageSize:this.pageSize};(0,a.JV)(t).then((e=>{this.tableData=e.rows,this.totalItem=e.total}))}}},p=m,g=(0,d.Z)(p,s,o,!1,null,"4a3609e5",null),f=g.exports}}]);
  2. //# sourceMappingURL=619.ab439be1.js.map