diff --git a/src/views/newMap/jointTrainingNew/index.vue b/src/views/newMap/jointTrainingNew/index.vue index 3874bd574..0c9bf13b1 100644 --- a/src/views/newMap/jointTrainingNew/index.vue +++ b/src/views/newMap/jointTrainingNew/index.vue @@ -233,6 +233,12 @@ export default { this.cancelBigScreenMode(); } }, + '$store.state.map.mapDataLoadedCount':function(val) { + const roleList = ['STATION_SUPERVISOR', 'STATION_ASSISTANT']; + if (roleList.includes(this.$store.state.training.roles)) { + this.stationRoleShow(this.showStation); + } + }, '$store.state.map.mapViewLoadedCount': function () { // 地图视图加载完成标识 this.mapViewLoadedOver = true; this.showSelectStation && this.setShowStation(this.showStation); @@ -420,7 +426,6 @@ export default { // 仿真系统 async initLoadDemonData() { if (this.lineCode) { - // 01 现地 02 行调 '' 观众 let resp = {data: {}}; resp = await this.getUserRole(); if (resp && resp.code == 200) { @@ -434,11 +439,45 @@ export default { handleDialogShow(type) { this.$refs[type].doShow(); }, + stationRoleShow(deviceCode) { + const pictureLineCodeList = ['16']; + if (this.lineCode === '14') { + const list = []; + const mapDevice = this.$store.state.map.mapDevice; + this.$jlmap.setMap(this.$store.state.map.map, this.$store.state.map.mapDevice, {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}); + for (const key in mapDevice) { + list.push(mapDevice[key]); + } + this.$jlmap.updateShowMode(list, '02'); + } + if (pictureLineCodeList.includes(this.lineCode) && this.$store.state.map.map && this.$store.state.map.map.pictureList) { + const picture = this.$store.state.map.map.pictureList.find(picture => picture.stationCode === deviceCode && picture.type === 'chainStation'); + if (picture) { + const mapDevice = this.$store.state.map.mapDevice; + const list = []; + const deviceList = []; + for (const key in mapDevice) { + list.push(mapDevice[key]); + deviceList.push(key); + } + this.$jlmap.updateShowStation(list, ''); + this.$store.dispatch('map/setPictureDeviceMap', picture.deviceMap); + this.$jlmap.updatePicture(deviceList); + this.$jlmap.updateTransform(picture.scaling, picture.origin); + this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationMap[deviceCode]); + } else { + this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]); + this.mapViewLoadedOver && this.switchStationMode(deviceCode); + } + } else { + this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]); + this.mapViewLoadedOver && this.switchStationMode(deviceCode); + } + }, // 设置prdType和role setSimulationPrdType(deviceCode) { // Dispatcher 行调 STATION_SUPERVISOR 车站 Audience 观众 Driver 司机 MAINTAINER 通号 this.showStation = ''; - const pictureLineCodeList = ['16']; let tempData; let dataZoom; switch (this.userRole) { @@ -459,38 +498,7 @@ export default { this.$refs.menuSchema.chiShowStation = deviceCode; this.showStation = deviceCode; // this.changePrdType('01'); - if (this.lineCode === '14') { - const list = []; - const mapDevice = this.$store.state.map.mapDevice; - this.$jlmap.setMap(this.$store.state.map.map, this.$store.state.map.mapDevice, {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}); - for (const key in mapDevice) { - list.push(mapDevice[key]); - } - this.$jlmap.updateShowMode(list, '02'); - } - if (pictureLineCodeList.includes(this.lineCode) && this.$store.state.map.map && this.$store.state.map.map.pictureList) { - const picture = this.$store.state.map.map.pictureList.find(picture => picture.stationCode === deviceCode && picture.type === 'chainStation'); - if (picture) { - const mapDevice = this.$store.state.map.mapDevice; - const list = []; - const deviceList = []; - for (const key in mapDevice) { - list.push(mapDevice[key]); - deviceList.push(key); - } - this.$jlmap.updateShowStation(list, ''); - this.$store.dispatch('map/setPictureDeviceMap', picture.deviceMap); - this.$jlmap.updatePicture(deviceList); - this.$jlmap.updateTransform(picture.scaling, picture.origin); - this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationMap[deviceCode]); - } else { - this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]); - this.mapViewLoadedOver && this.switchStationMode(deviceCode); - } - } else { - this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]); - this.mapViewLoadedOver && this.switchStationMode(deviceCode); - } + this.stationRoleShow(deviceCode); this.jl3dmaintainershow = false; this.drivingShow = false; break; @@ -500,17 +508,7 @@ export default { this.$store.dispatch('training/setRoles', 'STATION_ASSISTANT'); this.$refs.menuSchema.chiShowStation = deviceCode; this.showStation = deviceCode; - if (this.lineCode === '14') { - const list = []; - const mapDevice = this.$store.state.map.mapDevice; - this.$jlmap.setMap(this.$store.state.map.map, this.$store.state.map.mapDevice, {routeDate: this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}); - for (const key in mapDevice) { - list.push(mapDevice[key]); - } - this.$jlmap.updateShowMode(list, '02'); - } - this.$jlmap.amendDevice([...this.sectionList, ...this.signalList, ...this.trainWindowList]); - this.mapViewLoadedOver && this.switchStationMode(deviceCode); + this.stationRoleShow(deviceCode); this.jl3dmaintainershow = false; this.drivingShow = false; break;