diff --git a/src/views/newMap/displayNew/lesson/index.vue b/src/views/newMap/displayNew/lesson/index.vue index d823efbde..4c3790fa7 100644 --- a/src/views/newMap/displayNew/lesson/index.vue +++ b/src/views/newMap/displayNew/lesson/index.vue @@ -139,6 +139,11 @@ export default { this.$jlmap.updateShowStation(list, userInfo.deviceCode); } }, + '$store.state.socket.simulationRoleList':function(list) { + if (list && list.length) { + this.checkRoleChange(list); + } + }, async $route() { loadTrainingInSimulation(this.group, this.$route.query.trainingId).then(resp => { this.setTrainingData(resp); @@ -331,6 +336,19 @@ export default { } }); window.open(routeData.href, '_blank'); + }, + 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); + } + }); } } };