diff --git a/src/views/kpi/set/authority/index.vue b/src/views/kpi/set/authority/index.vue index 157ea8f..4ea14ca 100644 --- a/src/views/kpi/set/authority/index.vue +++ b/src/views/kpi/set/authority/index.vue @@ -111,6 +111,17 @@ + + +
企业负责人
@@ -194,20 +205,24 @@ - 绩效考核 +
@@ -260,9 +275,9 @@ - +
@@ -377,7 +392,7 @@ export default { popupSubMngEdit: false, // 子管理员 false 添加 true 编辑 menuCheckAllData: [2, 21, 23], menuMngCheckAll: [15, 16], // 考核管理全选 - menuIdOrNameData: { '全部权限': 1, '考核管理': 2, '发起考核': 15, '开始评分': 16, '考评组': 21, '绩效报表': 23 }, + // menuIdOrNameData: { '全部权限': 1, '考核管理': 2, '发起考核': 15, '开始评分': 16, '考评组': 21, '绩效报表': 23 }, mainData: { masterFirst: { headerUrl: '', @@ -389,6 +404,8 @@ export default { boss: []// 老板 }, popupFromSub: { + id: '', // 权限id + featuresCheck: true, subPersonData: null, // 选中要添加的子管理员 shwoDepartData: { title: '', @@ -403,6 +420,12 @@ export default { menuMngCheck: [], // 考核管理 groupRadio: '0', // 考评组选择 0 全部考评组 1 特定考评组 assessmentList: [] // 选中的考评组 + }, + rqInfoParameter: { + currPage: 1, + pageSize: 10, + totalCount: 1, + totalPage: 1 } } }, @@ -415,11 +438,13 @@ export default { if (!newVal) { this.popupSubMngEdit = false this.popupFromSub = { + id: '', // 权限id subPersonData: null, // 选中要添加的子管理员 shwoDepartData: { title: '', list: [] }, // 指定部门 + featuresCheck: true, featuresChckList: ['0', '1'], // 功能模块 showChoosePerformance: true, // 绩效考核 radioScope: 0, // 管理范围 @@ -535,6 +560,11 @@ export default { this.popupFromSub.menuMngCheck = this.menuMngCheckAll this.showPopupAddSub = true }, + handleCurrentChange (val) { + // 页面切换 + this.rqInfoParameter.currPage = val + this.handleGetSetPageInfo() + }, handleChildEdit (row) { this.popupSubMngEdit = true this.showPopupAddSub = true @@ -544,16 +574,45 @@ export default { if (res.code !== 200) { return } + this.showPopupAddSub = true const data = res.data + this.popupFromSub.id = row.id this.popupFromSub.subPersonData = { title: row.name, value: row.staffId } this.popupFromSub.radioScope = data.departmentId // 管理范围 this.popupFromSub.shwoDepartData.list = data.departmentInfos // 指定部门 this.popupFromSub.evaluationGroupId = data.evaluationGroupId // 考评组 this.popupFromSub.assessmentList = data.departmentInfos - data.selectStaffMenuInfos.map((item, index) => { - return this.menuIdOrNameData.value() + this.popupFromSub.menuCheckAllState = false // 全选中状态 + console.log('selectStaffMenuInfos====', data.selectStaffMenuInfos) + let selectStaffMenuInfos = data.selectStaffMenuInfos ? data.selectStaffMenuInfos : [] + selectStaffMenuInfos.forEach(item => { + switch (item) { + case 1: + this.popupFromSub.menuCheckAllState = true + break + case 2: + case 21: + case 23: + console.log('item ======', item) + if (this.popupFromSub.menuCheckData.indexOf(item) < 0) { + this.popupFromSub.menuCheckData.push(item) + } + break + case 15: + case 16: + if (this.popupFromSub.menuMngCheck.indexOf(item) < 0) { + this.popupFromSub.menuMngCheck.push(item) + } + break + default: + break + } }) - console.log('权限详情---', res) + if (this.popupFromSub.menuCheckData.indexOf(2) < 0) { + this.popupFromSub.menuMngCheck = [] + } + console.log('编辑====', this.popupFromSub) + // console.log('权限详情---', res) }) }, handleChildDelete (row) { @@ -567,6 +626,7 @@ export default { message: '删除子管理成功', type: 'success' }) // 刷新页面信息 + this.rqInfoParameter.currPage = 1 this.handleGetSetPageInfo() } }) @@ -590,8 +650,14 @@ export default { }).join(',') // 菜单id let menuIdStr = '' + let menuCheckList = this.popupFromSub.menuCheckData.concat(this.popupFromSub.menuMngCheck) + if (this.popupFromSub.menuCheckAllState) { + // 添加权限 + menuCheckList.push('1') + } + menuIdStr = menuCheckList.join(',') let paraDic = { - id: '', + id: this.popupFromSub.id, staffId: this.popupFromSub.subPersonData.value, departmentId: this.popupFromSub.radioScope, // 管理范围 departmentInfoStr: departmentInfoStr, @@ -600,7 +666,13 @@ export default { selectStaffMenuInfoStr: menuIdStr, // 选中的菜单权限 departmentLevel: 'CHILD_PM' } - console.log('提交---============', paraDic) + apiSetPermissionsRoleChange(paraDic).then(res => { + if (res.code === 200) { + this.showPopupAddSub = false + // 管理员权限 修改成功 + this.handleGetSetPageInfo() + } + }) } // this.popupFromSub.subPersonData @@ -649,14 +721,17 @@ export default { this.popupFromSub.assessmentList.splice(this.popupFromSub.assessmentList.indexOf(item), 1) }, handleGetSetPageInfo () { - let paraDic = { - currPage: 1, - pageSize: 400 + let rqDic = { + currPage: this.rqInfoParameter.currPage, + pageSize: this.rqInfoParameter.pageSize } - apiSetPermissionsInfo(paraDic).then(res => { + apiSetPermissionsInfo(rqDic).then(res => { if (res.code !== 200) { return } + this.rqInfoParameter.currPage = res.currPage + this.rqInfoParameter.totalCount = res.totalCount + this.rqInfoParameter.totalPage = res.totalPage this.mainData.masterFirst = res.data.masterPM.length > 0 ? res.data.masterPM[0] : {} this.mainData.childPm = res.data.childPm this.mainData.boss = res.data.boss @@ -697,6 +772,10 @@ export default { width: 100%; justify-content: space-between; } + .el-pagination { + margin-top: 10px; + text-align: right; + } } &-ceo { align-content: start;