From 269cef76731a95e75438d85924e5d29d856dd589 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 17 Jan 2020 11:31:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/simulation.js | 16 ++++++++++++++++ src/utils/baseUrl.js | 4 ++-- src/views/newMap/displayNew/designIndex.vue | 4 ++-- src/views/newMap/displayNew/index.vue | 4 ++-- src/views/newMap/displayNew/menuDemon.vue | 14 +++++++++++--- src/views/newMap/displayNew/menuScript.vue | 14 +++++++++----- src/views/newMap/jointTrainingNew/menuDemon.vue | 12 ++++++++---- 7 files changed, 50 insertions(+), 18 deletions(-) diff --git a/src/api/simulation.js b/src/api/simulation.js index 71731e696..69240590c 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -461,6 +461,22 @@ export function getEveryDayRunPlanNew(group) { }); } +/** 新版地图按计划行车 */ +export function ranAsPlan(data, group) { + return request({ + url: `/simulation/${group}/ranAsPlan`, + method: 'post', + data: data + }); +} +/** 新版地图清理仿真 */ +export function clearSimulation(group) { + return request({ + url: `/simulation/${group}/clear`, + method: 'delete' + }); +} + /** 查询进路信息*/ export function querySignalStatus(group, params) { return request({ diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 1e9afea51..9c6445483 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -3,9 +3,9 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.joylink.club/jlcloud'; + // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 - // BASE_API = 'http://192.168.3.6:9000'; // 旭强 + BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.82:9000'; // 杜康 } else { diff --git a/src/views/newMap/displayNew/designIndex.vue b/src/views/newMap/displayNew/designIndex.vue index 0e2e051d2..75985789d 100644 --- a/src/views/newMap/displayNew/designIndex.vue +++ b/src/views/newMap/displayNew/designIndex.vue @@ -58,7 +58,7 @@ import AddQuest from './demon/addQuest'; import Scheduling from './demon/scheduling'; import { mapGetters } from 'vuex'; import { setGoodsTryUse } from '@/api/management/goods'; -import { runDiagramQuit, getSimulationInfo } from '@/api/simulation'; +import { clearSimulation, getSimulationInfo } from '@/api/simulation'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { checkLoginLine } from '@/api/login'; import { loadMapDataById } from '@/utils/loaddata'; @@ -426,7 +426,7 @@ export default { // 销毁仿真 async quit() { - await runDiagramQuit(this.group); + await clearSimulation(this.group); await this.$store.dispatch('training/over'); }, // 仿真错误时,被动退出时调用 diff --git a/src/views/newMap/displayNew/index.vue b/src/views/newMap/displayNew/index.vue index a630e6b7c..b1370331a 100644 --- a/src/views/newMap/displayNew/index.vue +++ b/src/views/newMap/displayNew/index.vue @@ -57,7 +57,7 @@ import Scheduling from './demon/scheduling'; import { mapGetters } from 'vuex'; import { getTrainingDetail, getTrainingStepsDetail } from '@/api/jmap/training'; import { setGoodsTryUse } from '@/api/management/goods'; -import { runDiagramQuit, loadScript, getSimulationInfoNew } from '@/api/simulation'; +import { clearSimulation, loadScript, getSimulationInfoNew } from '@/api/simulation'; import { OperateMode, TrainingMode } from '@/scripts/ConstDic'; import { checkLoginLine } from '@/api/login'; import { loadNewMapDataByGroup } from '@/utils/loaddata'; @@ -428,7 +428,7 @@ export default { // 销毁仿真 async quit() { - await runDiagramQuit(this.group); + await clearSimulation(this.group); await this.$store.dispatch('training/over'); }, // 仿真错误时,被动退出时调用 diff --git a/src/views/newMap/displayNew/menuDemon.vue b/src/views/newMap/displayNew/menuDemon.vue index 00414cc84..cbbc5f83c 100644 --- a/src/views/newMap/displayNew/menuDemon.vue +++ b/src/views/newMap/displayNew/menuDemon.vue @@ -32,10 +32,11 @@ import SetTime from './demon/setTime'; import { Notification } from 'element-ui'; import { getGoodsTryUse } from '@/api/management/goods'; -import { runDiagramStart, runDiagramOver, runDiagramGetTime } from '@/api/simulation'; +import { ranAsPlan, runDiagramOver, clearSimulation, runDiagramGetTime } from '@/api/simulation'; import { PermissionType } from '@/scripts/ConstDic'; import { getCountTime } from '@/utils/index'; import { runDiagramIsStart, runDiagramQuit, quitScript } from '@/api/simulation'; +import { mapGetters } from 'vuex'; // import { timeFormat } from '@/utils/date'; // import { getToken } from '@/utils/auth'; @@ -81,6 +82,9 @@ export default { }; }, computed: { + ...mapGetters('map', [ + 'trainList' + ]), isShowQuest() { return this.questId; }, @@ -158,7 +162,11 @@ export default { }, start(model) { this.isDisable = true; - runDiagramStart(model, this.group).then(res => { + const data = { + time: model.initTime, + loadNumber:this.trainList.length + }; + ranAsPlan(data, this.group).then(res => { this.$store.dispatch('training/simulationStart').then(() => { this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`)); }); @@ -190,7 +198,7 @@ export default { }); }, async back() { - await runDiagramQuit(this.group); + await clearSimulation(this.group); this.$store.dispatch('training/over').then(() => { history.go(-1); Notification.closeAll(); diff --git a/src/views/newMap/displayNew/menuScript.vue b/src/views/newMap/displayNew/menuScript.vue index d9aedd7de..f6aee84ed 100644 --- a/src/views/newMap/displayNew/menuScript.vue +++ b/src/views/newMap/displayNew/menuScript.vue @@ -20,7 +20,7 @@