diff --git a/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue b/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue index 4bf75606e..dab8dcd91 100644 --- a/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue +++ b/src/views/newMap/displayNew/scriptDisplay/scriptRecord/index.vue @@ -121,6 +121,9 @@ export default { }, isDisable() { return this.$store.state.training.started; + }, + userId() { + return this.$store.state.user ? this.$store.state.user.id : ''; } }, watch: { @@ -165,9 +168,14 @@ export default { '$store.state.scriptRecord.userRole':function (val) { this.userRole = val; }, - '$store.state.training.roleDeviceCode':function (val) { - if (val) { - this.setShowStation(val); + // '$store.state.training.roleDeviceCode':function (val) { + // if (val) { + // this.setShowStation(val); + // } + // }, + '$store.state.socket.simulationRoleList':function(list) { + if (list && list.length) { // 人员变化监控 + this.checkRoleChange(list); } } @@ -210,6 +218,22 @@ export default { changeShowMap() { this.$emit('changeShowMap', false); }, + + checkRoleChange(data) { + data.forEach(item => { + if ((item.messageType === 'PLAY_CHANGE' || item.messageType === 'ONLINE' ) && item.userId == this.userId && item.type == 'STATION_SUPERVISOR') { + // this.userRole = item.type || 'AUDIENCE'; + this.$store.dispatch('training/setRoleDeviceCode', item.deviceCode); + this.deviceCode = item.deviceCode; + this.setShowStation(item.deviceCode); + // this.setSimulationPrdType(this.centralizedStationMap[item.deviceCode]); + this.$nextTick(() => { + if (item.deviceCode && this.$store.state.training.prdType !== '09') { this.setCenter(item.deviceCode); } + }); + } + }); + }, + setShowStation(stationCode) { const showStation = this.centralizedStationMap[stationCode]; const list = [];