运行图代码调整
This commit is contained in:
parent
14f54eeb85
commit
8fd587ac13
@ -95,6 +95,63 @@ export default {
|
||||
formatName(code) {
|
||||
return formatName(code);
|
||||
},
|
||||
getEachTripNumber(editData, tripNumberList, index) {
|
||||
const tripNumber = tripNumberList[index];
|
||||
const trainInfo = editData.trainMap[tripNumber];
|
||||
const lastIndex = trainInfo.stationTimeList.length - 1;
|
||||
const model = {
|
||||
planId: this.$route.query.planId,
|
||||
SDTNumber: `${this.model.serviceNumber}${tripNumber}`
|
||||
};
|
||||
getRoutingBySDTNumber(model).then(resp => {
|
||||
const taskObj = {
|
||||
tripNumber: tripNumber,
|
||||
startStationCode: resp.data.startStationCode,
|
||||
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
|
||||
endStationCode: resp.data.endStationCode,
|
||||
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime + 7200),
|
||||
routingCode : resp.data.code,
|
||||
endSectionCode:resp.data.endSectionCode,
|
||||
startSectionCode:resp.data.startSectionCode,
|
||||
arriveConfigList: []
|
||||
// parkSectionCodeList
|
||||
};
|
||||
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 + 7200),
|
||||
departureTime: formatTime(newstationTime.departureTime + 7200),
|
||||
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);
|
||||
index++;
|
||||
if (index <= tripNumberList.length - 1) {
|
||||
this.getEachTripNumber(editData, tripNumberList, index);
|
||||
}
|
||||
});
|
||||
},
|
||||
loadInitData(params) {
|
||||
this.isNew = params.isNew;
|
||||
this.model.planId = this.$route.query.planId;
|
||||
@ -104,59 +161,9 @@ export default {
|
||||
const editData = this.$store.state.runPlan.editData[params.serviceNumber];
|
||||
if (editData) {
|
||||
const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; });
|
||||
tripNumberList.forEach(tripNumber => {
|
||||
const trainInfo = editData.trainMap[tripNumber];
|
||||
const lastIndex = trainInfo.stationTimeList.length - 1;
|
||||
const model = {
|
||||
planId: this.$route.query.planId,
|
||||
SDTNumber: `${this.model.serviceNumber}${tripNumber}`
|
||||
};
|
||||
getRoutingBySDTNumber(model).then(resp => {
|
||||
const taskObj = {
|
||||
tripNumber: tripNumber,
|
||||
startStationCode: resp.data.startStationCode,
|
||||
startTime: formatTime(trainInfo.stationTimeList[0].secondTime + 7200),
|
||||
endStationCode: resp.data.endStationCode,
|
||||
endTime: formatTime(trainInfo.stationTimeList[lastIndex].secondTime + 7200),
|
||||
routingCode : resp.data.code,
|
||||
endSectionCode:resp.data.endSectionCode,
|
||||
startSectionCode:resp.data.startSectionCode,
|
||||
arriveConfigList: []
|
||||
// parkSectionCodeList
|
||||
};
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
if (tripNumberList.length > 0) {
|
||||
this.getEachTripNumber(editData, tripNumberList, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -379,11 +379,12 @@ export default {
|
||||
}
|
||||
},
|
||||
loadInitData(params) {
|
||||
debugger;
|
||||
const lineCode = this.$route.query.lineCode;
|
||||
const mapId = this.$route.query.mapId;
|
||||
this.isPlan = params.isPlan;
|
||||
this.tripNumber = params.serviceNumber;
|
||||
this.serviceNumber = params.tripNumber;
|
||||
this.tripNumber = params.tripNumber;
|
||||
this.serviceNumber = params.serviceNumber;
|
||||
this.planId = this.$route.query.planId;
|
||||
this.PlanConvert = this.$theme.loadPlanConvert(lineCode);
|
||||
|
||||
@ -403,12 +404,6 @@ export default {
|
||||
});
|
||||
}
|
||||
// this.routingList
|
||||
// const editData = this.$store.state.runPlan.editData[this.editModel.serviceNumber];
|
||||
// if (editData) {
|
||||
// const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; });
|
||||
// const trainInfo = editData.trainMap[tripNumberList[0]];
|
||||
// this.editModel.startTime = formatTime(trainInfo.stationTimeList[0].secondTime + this.PlanConvert.TranslationTime);
|
||||
// }
|
||||
if (params.rowData && params.rowData.arriveConfigList.length > 0) {
|
||||
this.editModel.arriveConfigList = params.rowData.arriveConfigList;
|
||||
this.editModel.routingCode = params.rowData.routingCode;
|
||||
@ -418,6 +413,7 @@ export default {
|
||||
this.editModel.endTime = params.rowData.endTime;
|
||||
this.editModel.endSectionCode = params.rowData.endSectionCode;
|
||||
this.editModel.startSectionCode = params.rowData.startSectionCode;
|
||||
this.routingList = [];
|
||||
this.routingList.push({
|
||||
code:params.rowData.routingCode,
|
||||
startStationCode:params.rowData.startStationCode,
|
||||
@ -430,7 +426,7 @@ export default {
|
||||
} else {
|
||||
const model = {
|
||||
planId: this.$route.query.planId || this.loadRunPlanId,
|
||||
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}`
|
||||
SDTNumber: `${this.serviceNumber}${this.tripNumber}`
|
||||
};
|
||||
this.editModel.routingList = [];
|
||||
getRoutingBySDTNumber(model).then(resp => { // 根据车次号查询交路
|
||||
@ -440,8 +436,16 @@ export default {
|
||||
// const data = editData.trainMap[this.editModel.tripNumber].stationTimeList;
|
||||
// this.editModel.defaultSpeedLevel
|
||||
this.editModel.routingCode = routingObj.code;
|
||||
|
||||
// const editData = this.$store.state.runPlan.editData[this.editModel.serviceNumber];
|
||||
// if (editData) {
|
||||
// const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; });
|
||||
// const trainInfo = editData.trainMap[tripNumberList[0]];
|
||||
// this.editModel.startTime = formatTime(trainInfo.stationTimeList[0].secondTime + this.PlanConvert.TranslationTime);
|
||||
// }
|
||||
|
||||
// this.editModel.routingList[]
|
||||
this.editModel.routingList.push(routingObj);
|
||||
// this.editModel.routingList.push(routingObj);
|
||||
this.computedDetailList();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user