代码调整

This commit is contained in:
dong 2022-09-15 14:23:58 +08:00
parent 63f4505ed9
commit e8c23acab7
3 changed files with 21 additions and 10 deletions

View File

@ -81,7 +81,7 @@ export default {
this.$refs.editDetails.backStep(); this.$refs.editDetails.backStep();
}, },
handleCondition(index, row, key) { handleCondition(index, row, key) {
this.$refs.editCondition.doShow(row[key], index, key); this.$refs.editCondition.doShow(row, index, key);
}, },
getMaterials() { getMaterials() {
getTrainingMaterials().then(res => { getTrainingMaterials().then(res => {

View File

@ -61,6 +61,7 @@ export default {
tabVisible: false, tabVisible: false,
dialogVisible: false, dialogVisible: false,
tableData: [], tableData: [],
roleDeviceCode: '', // code
activeIndexPath: '', activeIndexPath: '',
rowIndex: 0, rowIndex: 0,
conditionKey: '' conditionKey: ''
@ -106,15 +107,17 @@ export default {
} }
}); });
Object.values(this.mapStationDirectionData).forEach(item => { Object.values(this.mapStationDirectionData).forEach(item => {
let isAuto = true; if (!this.roleDeviceCode || this.roleDeviceCode == item.relativeStationCode) {
if (item.runModel == 'S') { let isAuto = true;
isAuto = false; 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 => { this.getRouteList.forEach(item => {
list.push({ list.push({
@ -256,7 +259,10 @@ export default {
this.$emit('backStep'); this.$emit('backStep');
this.doClose(); 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.dialogVisible = true;
this.tabVisible = true; this.tabVisible = true;
this.activeIndexPath = ''; this.activeIndexPath = '';

View File

@ -268,6 +268,11 @@ export default {
}, },
handleCondition(index, row, key) { handleCondition(index, row, key) {
console.log(key, '条件', index, row); 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.$emit('handleCondition', index, row, key);
this.doClose(); this.doClose();
}, },