From e8c23acab777e194836693b5db62fabde61c1d02 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Thu, 15 Sep 2022 14:23:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/trainingManage/demonMenu.vue | 2 +- src/views/trainingManage/editCondition.vue | 24 ++++++++++++++-------- src/views/trainingManage/editDetails.vue | 5 +++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/views/trainingManage/demonMenu.vue b/src/views/trainingManage/demonMenu.vue index 05bfdc10e..064f38031 100644 --- a/src/views/trainingManage/demonMenu.vue +++ b/src/views/trainingManage/demonMenu.vue @@ -81,7 +81,7 @@ export default { this.$refs.editDetails.backStep(); }, handleCondition(index, row, key) { - this.$refs.editCondition.doShow(row[key], index, key); + this.$refs.editCondition.doShow(row, index, key); }, getMaterials() { getTrainingMaterials().then(res => { diff --git a/src/views/trainingManage/editCondition.vue b/src/views/trainingManage/editCondition.vue index 949342964..db9128d6f 100644 --- a/src/views/trainingManage/editCondition.vue +++ b/src/views/trainingManage/editCondition.vue @@ -61,6 +61,7 @@ export default { tabVisible: false, dialogVisible: false, tableData: [], + roleDeviceCode: '', // 角色对应站点code activeIndexPath: '', rowIndex: 0, conditionKey: '' @@ -106,15 +107,17 @@ export default { } }); Object.values(this.mapStationDirectionData).forEach(item => { - let isAuto = true; - if (item.runModel == 'S') { - isAuto = false; + if (!this.roleDeviceCode || this.roleDeviceCode == item.relativeStationCode) { + let isAuto = true; + if (item.runModel == 'S') { + isAuto = false; + } + list.push({ + code: item.code, + name: `${item.name}_${item.labelEnum}(${isAuto ? '自动闭塞' : '半自动闭塞'})`, + _type: `${isAuto ? 'StationDirectionAuto' : 'StationDirectionSemi'}` + }); } - list.push({ - code: item.code, - name: `${item.name}_${item.labelEnum}(${isAuto ? '自动闭塞' : '半自动闭塞'})`, - _type: `${isAuto ? 'StationDirectionAuto' : 'StationDirectionSemi'}` - }); }); this.getRouteList.forEach(item => { list.push({ @@ -256,7 +259,10 @@ export default { this.$emit('backStep'); this.doClose(); }, - doShow(data, rowIndex, conditionKey) { + doShow(row, rowIndex, conditionKey) { + const data = row[conditionKey]; + const member = this.$store.state.training.memberData[row.memberId]; + this.roleDeviceCode = member.deviceCode || ''; this.dialogVisible = true; this.tabVisible = true; this.activeIndexPath = ''; diff --git a/src/views/trainingManage/editDetails.vue b/src/views/trainingManage/editDetails.vue index f58f0fb42..3cdf48a4d 100644 --- a/src/views/trainingManage/editDetails.vue +++ b/src/views/trainingManage/editDetails.vue @@ -268,6 +268,11 @@ export default { }, handleCondition(index, row, key) { console.log(key, '条件', index, row); + const member = this.$store.state.training.memberData[row.memberId]; + if (!member.userId) { + assignUsersPlayRoles([{ userId: this.$store.state.user.id, memberId: member.id}], this.$route.query.group).then(resp => { + }).catch(() => { this.$message.error('调整角色失败!'); }); + } this.$emit('handleCondition', index, row, key); this.doClose(); },