From 2b971cdf12a8cf5e79809d20363b138313b8c804 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Mon, 9 Mar 2020 14:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=8C=89=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E8=A1=8C=E8=BD=A6=E7=8A=B6=E6=80=81and=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/Station/index.js | 51 +++++++++---------- src/jmapNew/shape/StationStand/index.js | 2 +- src/store/modules/socket.js | 2 +- src/utils/stomp.js | 2 +- src/views/newMap/displayNew/index.vue | 10 ++++ src/views/newMap/displayNew/menuDemon.vue | 13 ++--- src/views/newMap/displayNew/menuScript.vue | 13 ++--- .../mapoperate/automaticControl.vue | 6 +-- 8 files changed, 47 insertions(+), 52 deletions(-) diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index b9f7ce994..fba42a0e9 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -20,14 +20,10 @@ export default class Station extends Group { this.z = 40; this.model = model; this.style = style; - + this.create(); this.createTurnBack(); // 创建按图折返 const path = window.location.href; - if (!path.includes('/map/draw')) { - this.createGuideTotalLock(); // 创建引导总锁 - } - this.prdType = ''; if (path.includes('?')) { const arr = window.location.href.split('?')[1].split('&'); arr.forEach(elem => { @@ -36,6 +32,9 @@ export default class Station extends Group { } }); } + if ((!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) && model.guideTotalLockPoint) { + this.createGuideTotalLock(); // 创建引导总锁 + } this.createControlMode(); this.setState(model); this.checkIsDrawMap(); @@ -121,7 +120,7 @@ export default class Station extends Group { createGuideTotalLock() { // 创建引导总锁 const model = this.model; const style = this.style; - if (model.guideTotalLock || (!this.prdType && style.Station.functionButtonShow.indexOf(this.prdType) !== -1 && model.guideTotalLockPoint)) { + if (model.guideTotalLock) { this.guideLamp = new EControl({ zlevel: this.zlevel, z: this.z, @@ -316,26 +315,26 @@ export default class Station extends Group { // 设置状态 setState(model) { switch (model.controlMode) { - case '': // 无状态 - this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); - this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); - this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); - break; - case 'Center': // 中控 - this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); - this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); - this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor); - break; - case 'Local': // 站控 - this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); - this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor); - this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); - break; - case 'Emergency': // 紧急站控 - this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor); - this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); - this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); - break; + case '': // 无状态 + this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); + this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); + this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); + break; + case 'Center': // 中控 + this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); + this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); + this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor); + break; + case 'Local': // 站控 + this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); + this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor); + this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); + break; + case 'Emergency': // 紧急站控 + this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor); + this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); + this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); + break; } } diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index 2b220547c..d49aaadce 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -35,7 +35,7 @@ class StationStand extends Group { } this.create(); this.createMouseEvent(); - if (!this.prdType || (this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1 && model.guideTotalLockPoint)) { + if (!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) { this.createFunctionButton(); } this.setVisible(model.visible); diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 8649dab82..7fbc857b4 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -2,7 +2,7 @@ import store from '@/store'; import { Notification } from 'element-ui'; function handle(state, data) { - console.log(data, 'socket订阅'); + // console.log(data, 'socket订阅'); const msg = data.body; const path = window.location.href; switch (data.type) { diff --git a/src/utils/stomp.js b/src/utils/stomp.js index 5928fd34e..87ff7f943 100644 --- a/src/utils/stomp.js +++ b/src/utils/stomp.js @@ -22,7 +22,7 @@ export function creatSubscribe(topic, header) { function callback(Response) { if (store) { var data = JSON.parse(Response.body); - // console.log(data); + // console.log(Response.body); store.dispatch('socket/setStomp', data); } else { callback(Response); diff --git a/src/views/newMap/displayNew/index.vue b/src/views/newMap/displayNew/index.vue index 13beb5cbb..428e2919f 100644 --- a/src/views/newMap/displayNew/index.vue +++ b/src/views/newMap/displayNew/index.vue @@ -322,6 +322,16 @@ export default { this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); this.questId = Number(resp.data.questId) || 0; this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(resp.data.systemTime)}`)); + if (resp.data.planRunning) { + this.$store.dispatch('training/simulationStart'); + } else { + this.$store.dispatch('training/over'); + } + if (this.isDemon) { + this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning); + } else if (this.isScript) { + this.$refs.menuScript.initPlannedDriving(resp.data.planRunning); + } } }, // 加载地图数据 diff --git a/src/views/newMap/displayNew/menuDemon.vue b/src/views/newMap/displayNew/menuDemon.vue index 02eb77f64..948e2c5e0 100644 --- a/src/views/newMap/displayNew/menuDemon.vue +++ b/src/views/newMap/displayNew/menuDemon.vue @@ -113,21 +113,14 @@ export default { if (this.try != '0') { this.loadInitData(); } - - const resp = '';// await runDiagramIsStart(this.group); - if (resp && resp.data) { - this.isDisable = true; - this.$store.dispatch('training/simulationStart'); - } else { - this.isDisable = false; - this.$store.dispatch('training/over'); - } - this.change3dname(); } catch (error) { console.log(error); } }, + initPlannedDriving(isDisable) { + this.isDisable = isDisable; + }, loadInitData() { const data = { mapId: this.$route.query.mapId, diff --git a/src/views/newMap/displayNew/menuScript.vue b/src/views/newMap/displayNew/menuScript.vue index 9ee7c62c3..64ff914e1 100644 --- a/src/views/newMap/displayNew/menuScript.vue +++ b/src/views/newMap/displayNew/menuScript.vue @@ -21,7 +21,6 @@ import SetTime from './demon/setTime'; import { Notification } from 'element-ui'; import { ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation'; -import { runDiagramIsStart } from '@/api/simulation'; import { timeFormat } from '@/utils/date'; import { EventBus } from '@/scripts/event-bus'; @@ -76,20 +75,14 @@ export default { methods: { async initLoadPage() { try { - const resp = '';// await runDiagramIsStart(this.group); - if (resp && resp.data) { - this.isDisable = true; - this.$store.dispatch('training/simulationStart'); - } else { - this.isDisable = false; - this.$store.dispatch('training/over'); - } - await this.loadSystemTime(); } catch (error) { console.log(error); } }, + initPlannedDriving(isDisable) { + this.isDisable = isDisable; + }, selectBeginTime() { this.$refs.setTime.doShow(); }, diff --git a/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue b/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue index 33968a55c..aa89ea47d 100644 --- a/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue +++ b/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue @@ -115,7 +115,7 @@ export default { { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' }, { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' } ] }, - { prop:'cycleCode', label: '自动折返进路code:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, + { prop:'cycleCode', label: '自动折返进路code:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.autoList }, ] } } @@ -126,14 +126,14 @@ export default { const form = { labelWidth: '150px', items: [ - { prop:'cycleCode', label: '自动折返进路:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, + { prop:'cycleCode', label: '自动折返进路:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.autoList }, { prop: 'name', label: '自动折返名称:', type: 'input' }, { prop: 'subtitleName', label: '副标题名称:', type: 'input' }, { prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [ { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } ] }, - + ] }; return form;