【【哈尔滨一号线】点击车站名无法切换车站】&&切换实训是因角色变化导致定位丢失问题处理
This commit is contained in:
parent
9c9ac662c8
commit
19c6087141
@ -86,6 +86,7 @@ import AlarmTableHmi from './menuDialog/alarmTableHmi';
|
||||
import AlarmTableLow from './menuDialog/alarmTableLow';
|
||||
import TrainControl from './dialog/trainControl';
|
||||
import LogDetail from './menuDialog/logDetail';
|
||||
import { assignUsersPlayRoles } from '@/api/jointSimulation';
|
||||
|
||||
export default {
|
||||
name: 'MenuBar',
|
||||
@ -190,10 +191,8 @@ export default {
|
||||
this.stationCode = code;
|
||||
}
|
||||
},
|
||||
'$store.state.socket.simulationRoleList':function(list) {
|
||||
if (list && list.length) {
|
||||
this.checkRoleChange(list);
|
||||
}
|
||||
'$store.state.training.roleDeviceCode': function(val) {
|
||||
this.stationCode = this.centralizedMap[val];
|
||||
},
|
||||
'$store.state.socket.simulationAlarmInfo': function(val) {
|
||||
(val || []).forEach(item => {
|
||||
@ -247,10 +246,6 @@ export default {
|
||||
mounted() {
|
||||
this.version = this.$store.state.map.version;
|
||||
this.initMenu();
|
||||
/* 由于修改角色现行是先取消人员仿真角色后赋予,故menuBar会在仿真角色取消时销毁,在赋予特定角色是挂载,故此处处理 */
|
||||
if (this.$store.state.socket.simulationRoleList && this.$store.state.socket.simulationRoleList.length) {
|
||||
this.checkRoleChange(this.$store.state.socket.simulationRoleList);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAlarm(val) {
|
||||
@ -281,17 +276,21 @@ export default {
|
||||
});
|
||||
this.colsNum = 24 / this.centralizedStationList1.length;
|
||||
if (centralizedStationList.length) {
|
||||
if (this.$store.state.map.showCentralizedStationCode) {
|
||||
this.stationCode = this.$store.state.map.showCentralizedStationCode;
|
||||
if (this.$store.state.training.roleDeviceCode) {
|
||||
this.stationCode = this.centralizedMap[this.$store.state.training.roleDeviceCode];
|
||||
} else {
|
||||
this.stationCode = centralizedStationList[0].code;
|
||||
}
|
||||
}
|
||||
},
|
||||
switchShowStation(stationCode) {
|
||||
this.stationCode = stationCode;
|
||||
this.$store.dispatch('map/setShowCentralizedStationNum');
|
||||
this.$store.dispatch('map/setShowCentralizedStationCode', stationCode);
|
||||
const member = this.$store.state.training.memberList.find(member => member.type === 'STATION_SUPERVISOR' && member.deviceCode === stationCode);
|
||||
const data = [{userId: this.userId, memberId:member.id}];
|
||||
assignUsersPlayRoles(data, this.$route.query.group).then(() => {
|
||||
console.log('切换角色!');
|
||||
}).catch(e => {
|
||||
this.$message.error('切换车站失败!');
|
||||
});
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
@ -333,13 +332,6 @@ export default {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
checkRoleChange(list) {
|
||||
list.forEach(item => {
|
||||
if (item.messageType === 'PLAY_CHANGE' && item.userId == this.userId && item.type === 'STATION_SUPERVISOR') {
|
||||
this.switchShowStation(this.centralizedMap[item.deviceCode]);
|
||||
}
|
||||
});
|
||||
},
|
||||
showLowAlarm(level) {
|
||||
this.$refs.alarmTableLow.doShow(level);
|
||||
},
|
||||
|
@ -369,6 +369,9 @@ export default {
|
||||
if (!val) {
|
||||
this.doClose();
|
||||
}
|
||||
},
|
||||
'$store.state.training.roleDeviceCode': function (val) {
|
||||
this.handleBasicMenu();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -631,11 +634,12 @@ export default {
|
||||
this.centralizedStationList[index] = basic;
|
||||
});
|
||||
this.tempData = [];
|
||||
const station = this.$store.getters['map/getDeviceByCode'](this.$store.state.map.showCentralizedStationCode);
|
||||
const station = this.$store.getters['map/getDeviceByCode'](this.$store.state.training.roleDeviceCode);
|
||||
this.tempData.push(station);
|
||||
const code = station ? station.stationCode : '';
|
||||
this.param = {
|
||||
stationCode: this.$store.state.map.showCentralizedStationCode,
|
||||
stationCodes: [this.$store.state.map.showCentralizedStationCode]
|
||||
stationCode: code,
|
||||
stationCodes: [code]
|
||||
};
|
||||
},
|
||||
handleStationMenu() {
|
||||
@ -688,7 +692,7 @@ export default {
|
||||
this.param.routeCodeList = routeCodeList;
|
||||
}
|
||||
if (this.cmdType == CMD.Station.CMD_STATION_SET_CI_AUTO_TRIGGER || this.cmdType == CMD.Station.CMD_STATION_CANCEL_CI_AUTO_TRIGGER) {
|
||||
this.param = { stationCode: this.selectedObj.code || this.$store.state.map.showCentralizedStationCode };
|
||||
this.param = { stationCode: this.selectedObj.code || this.$store.state.training.roleDeviceCode };
|
||||
}
|
||||
if (this.cmdType == CMD.Section.CMD_SECTION_SET_LIMIT_SPEED || this.cmdType == CMD.Switch.CMD_SWITCH_SET_LIMIT_SPEED) {
|
||||
this.param.speedLimitValue = this.speedLimitValue;
|
||||
|
@ -148,6 +148,11 @@ export default {
|
||||
this.$store.dispatch('training/setMapDefaultState');
|
||||
this.isFirst = false;
|
||||
}
|
||||
const trainingDetail = this.$store.state.trainingNew.trainingDetail;
|
||||
if (trainingDetail && trainingDetail.mapLocationJson) { // 客户端切换后如有实训重新定位
|
||||
const mapLocation = JSON.parse(trainingDetail.mapLocationJson);
|
||||
this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y});
|
||||
}
|
||||
},
|
||||
'$store.state.socket.memberChangeCount': function () { // 仿真成员变更
|
||||
this.initMemberUserInfo();
|
||||
|
@ -186,6 +186,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await loadPublishTraining(this.group, training.id, {mode: ''});
|
||||
const detailResp = await getPublishTrainingDetail(training.id);
|
||||
this.training = detailResp.data;
|
||||
if (detailResp.data.mapLocationJson) {
|
||||
@ -193,9 +194,9 @@ export default {
|
||||
this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y});
|
||||
}
|
||||
this.$store.dispatch('trainingNew/setTrainingDetail', detailResp.data);
|
||||
await loadPublishTraining(this.group, training.id, {mode: ''});
|
||||
this.$message.success('加载实训成功!');
|
||||
} catch (e) {
|
||||
console.error(e, '-----------');
|
||||
this.$message.error('加载实训失败!');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user