From f09b1aa17d092a646f6173360446ddaa6b50b1af Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Thu, 5 Nov 2020 17:32:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E8=AE=A1=E5=88=92=E8=A1=8C=E8=BD=A6?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newMap/displayNew/dispatherContest/index.vue | 13 +++---------- src/views/newMap/displayNew/index.vue | 9 ++------- src/views/newMap/displayNew/menuDemon.vue | 12 +++--------- src/views/newMap/jointTrainingNew/menuDemon.vue | 13 +++---------- 4 files changed, 11 insertions(+), 36 deletions(-) diff --git a/src/views/newMap/displayNew/dispatherContest/index.vue b/src/views/newMap/displayNew/dispatherContest/index.vue index 52f6b213f..83814e130 100644 --- a/src/views/newMap/displayNew/dispatherContest/index.vue +++ b/src/views/newMap/displayNew/dispatherContest/index.vue @@ -149,7 +149,6 @@ export default { }, data() { return { - isDisable: false, tryTime: 0, // 进入页面多少秒 timeNow: 0, // 进入页面 相对时间 time: null, // 定时器 @@ -198,6 +197,9 @@ export default { }, scriptModeList() { return ScriptMode; + }, + isDisable() { + return this.$store.state.training.started; } }, watch: { @@ -236,8 +238,6 @@ export default { const initTime = new Date(this.$store.state.training.initTime || null); const model = {initTime:this.formatTime(initTime)}; this.start(model); - } else { - this.isDisable = true; } } }, @@ -286,9 +286,6 @@ export default { const ss = prefixIntrger(initTime.getSeconds(), 2); return `${hh}:${mm}:${ss}`; }, - initPlannedDriving(isDisable) { - this.isDisable = isDisable; - }, loadInitData() { const data = { mapId: this.$route.query.mapId, @@ -334,7 +331,6 @@ export default { }); }, start(model) { // 开始仿真 - this.isDisable = true; const data = { time: model.initTime }; @@ -344,7 +340,6 @@ export default { ranAsPlan(data, this.group).then(res => { this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`)); }).catch(error => { - this.isDisable = false; if (error.code == '5001') { this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed')); } else if (error.code == '5002') { @@ -375,7 +370,6 @@ export default { this.$refs.demonMenu.hideScheduling(run); }, end() { - this.isDisable = false; exitRunPlan(this.group).then(() => { this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/setMapDefaultState').then(() => { @@ -385,7 +379,6 @@ export default { }); }); }).catch(() => { - this.isDisable = true; this.$messageBox(this.$t('display.demon.endSimulationFail')); }); }, diff --git a/src/views/newMap/displayNew/index.vue b/src/views/newMap/displayNew/index.vue index 4b46cb4f4..08283ca47 100644 --- a/src/views/newMap/displayNew/index.vue +++ b/src/views/newMap/displayNew/index.vue @@ -233,13 +233,8 @@ export default { this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`)); this.$store.dispatch('training/countTime'); this.planRunning = resp.data.planRunning; - - if (this.isDemon) { - this.$refs.menuDemon.initPlannedDriving(this.planRunning); // 是否正在按计划行车 - } else if (this.isScript) { - if (resp.data.planRunning) { - this.$store.commit('training/start'); - } + if (resp.data.planRunning) { + this.$store.commit('training/start'); } } else if (resp && resp.code == 200 && resp.data && resp.data.dataError) { this.dataError = true; diff --git a/src/views/newMap/displayNew/menuDemon.vue b/src/views/newMap/displayNew/menuDemon.vue index 57e8d5b9f..b48b9eccf 100644 --- a/src/views/newMap/displayNew/menuDemon.vue +++ b/src/views/newMap/displayNew/menuDemon.vue @@ -98,7 +98,6 @@ export default { }, data() { return { - isDisable: false, tryTime: 0, // 进入页面多少秒 timeNow: 0, // 进入页面 相对时间 time: null, // 定时器 @@ -140,6 +139,9 @@ export default { }, projectDevice() { return this.$route.query.projectDevice; + }, + isDisable() { + return this.$store.state.training.started; } }, watch: { @@ -210,9 +212,6 @@ export default { console.log(error); } }, - initPlannedDriving(isDisable) { - this.isDisable = isDisable; - }, loadInitData() { const data = { mapId: this.$route.query.mapId, @@ -239,7 +238,6 @@ export default { this.$refs.setTime.doShow(); }, start(model) { // 开始仿真 - this.isDisable = true; const data = { time: model.initTime }; @@ -249,7 +247,6 @@ export default { ranAsPlan(data, this.group).then(res => { this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`)); }).catch(error => { - this.isDisable = false; if (error.code == '5001') { this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed')); } else if (error.code == '5002') { @@ -280,7 +277,6 @@ export default { this.$refs.demonMenu.hideScheduling(run); }, end() { - this.isDisable = false; exitRunPlan(this.group).then(() => { this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/setMapDefaultState').then(() => { @@ -290,14 +286,12 @@ export default { }); }); }).catch(() => { - this.isDisable = true; this.$messageBox(this.$t('display.demon.endSimulationFail')); }); }, handleQuitQuest() { quitScriptNew(this.group).then(resp => { getSimulationInfoNew(this.group).then((res)=>{ - this.isDisable = false; EventBus.$emit('clearRunSeries'); this.quitQuest(); this.initLoadPage(); diff --git a/src/views/newMap/jointTrainingNew/menuDemon.vue b/src/views/newMap/jointTrainingNew/menuDemon.vue index 6d45b0a21..b7fe108be 100644 --- a/src/views/newMap/jointTrainingNew/menuDemon.vue +++ b/src/views/newMap/jointTrainingNew/menuDemon.vue @@ -109,7 +109,6 @@ export default { }, data() { return { - isDisable: false, backLoading: false, chatShow: true, jsStart: true, @@ -161,6 +160,9 @@ export default { isDeviceLogin() { const typeList = ['LW', 'CW']; return typeList.includes(this.$route.query.type); + }, + isDisable() { + return this.$store.state.training.started; } }, watch: { @@ -172,11 +174,6 @@ export default { }); } }, - '$store.state.training.started': function (val) { - if (val) { - this.isDisable = true; - } - }, '$store.state.socket.simulationOver':function(val) { if (val && this.project == 'refereeJsxt') { this.$router.go(-1); @@ -284,7 +281,6 @@ export default { }, // 开始仿真 start(model) { - this.isDisable = true; const data = { time: model.initTime }; @@ -294,7 +290,6 @@ export default { } this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`)); }).catch((error) => { - this.isDisable = false; if (error.code == '5001') { this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed')); } else if (error.code == '5002') { @@ -319,13 +314,11 @@ export default { }); }, end() { - this.isDisable = false; exitRunPlan(this.group).then(()=>{ this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/resetActiveTrainList', false); }).catch(() => { this.$store.dispatch('training/over').then(() => { - this.isDisable = true; this.$store.dispatch('map/resetActiveTrainList', false); this.$messageBox(this.$t('error.endSimulationFailed')); });