From 103c30631322f96e43f1c00dda7f7216e67174ef Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 21 Oct 2020 15:16:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=9B=BE=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editTool/menus/editPlanningTrain.vue | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/views/planMonitor/editTool/menus/editPlanningTrain.vue b/src/views/planMonitor/editTool/menus/editPlanningTrain.vue index b6d1ce0d4..4e8ef4bfb 100644 --- a/src/views/planMonitor/editTool/menus/editPlanningTrain.vue +++ b/src/views/planMonitor/editTool/menus/editPlanningTrain.vue @@ -123,9 +123,36 @@ export default { startSectionCode:resp.data.startSectionCode, arriveConfigList: [] // parkSectionCodeList - // sectionCode: "T393" - // stationCode: "Station96090" }; + const newstationTimeList = []; + let current = {}; + trainInfo.stationTimeList.forEach((stationTime, index)=>{ + if (index % 2 == 0) { + current = {}; + current.stationCode = stationTime.stationCode; + current.arriveTime = stationTime.secondTime; + } else { + current.departureTime = stationTime.secondTime; + newstationTimeList.push(current); + } + }); + newstationTimeList.forEach((newstationTime, index)=>{ + const newModel = { + sectionCode:resp.data.parkSectionCodeList[index].sectionCode, + stationCode:newstationTime.stationCode, + speedLevel:'默认', + arriveTime: formatTime(newstationTime.arriveTime), + departureTime: formatTime(newstationTime.departureTime), + stopTime:newstationTime.departureTime - newstationTime.arriveTime + }; + if (index < newstationTimeList.length - 1) { + newModel.speedLevelTime = newstationTimeList[index + 1].arriveTime - newstationTime.departureTime; + } + taskObj.arriveConfigList.push(newModel); + }); + // arriveTime: "" + // departureTime: "07:00:00" + // speedLevel: "默认(等级三)" this.model.tripConfigList.push(taskObj); }); @@ -231,9 +258,9 @@ export default { } }, handleCommit() { - this.doClose(); if (this.isNew) { if (this.model.tripConfigList.length > 0) { + this.doClose(); addPlanService(this.model).then(() => { this.$emit('refresh'); // this.$emit('dispatchOperate', { @@ -248,6 +275,7 @@ export default { } } else { if (this.model.tripConfigList.length > 0) { + this.doClose(); updatePlanService(this.$route.query.planId, this.model.serviceNumber, this.model).then(() => { this.$emit('refresh'); // this.$emit('dispatchOperate', {