代码调整

This commit is contained in:
joylink_cuiweidong 2022-09-13 17:04:08 +08:00
parent 289f02ac0f
commit 96411d34b7

View File

@ -85,6 +85,23 @@ export default {
this.$store.dispatch('training/setStopCountTime'); this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/setTrainingStart', false); this.$store.dispatch('training/setTrainingStart', false);
EventBus.$emit('viewLoading', false); EventBus.$emit('viewLoading', false);
},
'$store.state.socket.simulationRoleList':function(list) {
if (list && list.length) {
this.checkRoleChange(list);
}
},
'$store.state.training.simulationUserList': function(val) {
const userInfo = this.$store.state.training.simulationUserList.find(user => user.userId == this.$store.state.user.id );
if (userInfo.type === 'STATION_SUPERVISOR') {
this.$store.dispatch('map/setShowCentralizedStationCode', userInfo.deviceCode);
const mapDevice = this.$store.state.map.mapDevice;
const list = [];
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, userInfo.deviceCode);
}
} }
}, },
// mounted() { // mounted() {
@ -207,6 +224,19 @@ export default {
if (!isSuccess) { if (!isSuccess) {
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
} }
},
checkRoleChange(list) {
list.forEach(item => {
if (item.messageType === 'PLAY_CHANGE' && item.userId == this.$store.state.user.id && item.type === 'STATION_SUPERVISOR') {
this.$store.dispatch('map/setShowCentralizedStationCode', item.deviceCode);
const mapDevice = this.$store.state.map.mapDevice;
const list = [];
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, item.deviceCode);
}
});
} }
} }
}; };