运行图代码调整

This commit is contained in:
joylink_cuiweidong 2020-10-21 15:16:30 +08:00
parent cc196d9696
commit 103c306313

View File

@ -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', {