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/i18n/langs/en/error.js b/src/i18n/langs/en/error.js index c5cab6d66..280bc3515 100644 --- a/src/i18n/langs/en/error.js +++ b/src/i18n/langs/en/error.js @@ -105,5 +105,8 @@ export default { checkTheValidityFirst: 'Please check the validity first!', permissionAtLeast:'At least one of the number of permissions is more than 0', permissionTimeError:'End time must be more than start time', - getRealDeviceFailed: 'Failed to get real device failed' + getRealDeviceFailed: 'Failed to get real device failed', + mapDataError: 'Map data error', + runningChartDataError: 'Running chart data error', + runningChartIsNotLoaded: 'Running chart is not loaded' }; diff --git a/src/i18n/langs/zh/error.js b/src/i18n/langs/zh/error.js index 7ecd16deb..266f43af4 100644 --- a/src/i18n/langs/zh/error.js +++ b/src/i18n/langs/zh/error.js @@ -105,5 +105,8 @@ export default { checkTheValidityFirst: '请先进行有效性检查!', permissionAtLeast:'至少有一种权限的数量大于0', permissionTimeError:'结束时间必须大于开始时间', - getRealDeviceFailed: '获取真实设备失败!' + getRealDeviceFailed: '获取真实设备失败!', + mapDataError: '地图数据错误', + runningChartDataError: '运行图数据错误', + runningChartIsNotLoaded: '运行图未加载' }; 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..dd54dde7f 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,13 +162,23 @@ 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}`)); }); }).catch(error => { this.isDisable = false; - this.$messageBox(error.message + ',' + this.$t('display.demon.startSimulationFail')); + if (error.code == '5001') { + this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed')); + } else if (error.code == '5002') { + this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed')); + } else if (error.code == '5003') { + this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed')); + } }); }, end() { @@ -190,7 +204,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..ea9551efa 100644 --- a/src/views/newMap/displayNew/menuScript.vue +++ b/src/views/newMap/displayNew/menuScript.vue @@ -20,7 +20,7 @@