运行图代码调整

This commit is contained in:
joylink_cuiweidong 2020-10-21 17:19:47 +08:00
parent 14f54eeb85
commit 8fd587ac13
2 changed files with 74 additions and 63 deletions

View File

@ -95,6 +95,63 @@ export default {
formatName(code) { formatName(code) {
return 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) { loadInitData(params) {
this.isNew = params.isNew; this.isNew = params.isNew;
this.model.planId = this.$route.query.planId; this.model.planId = this.$route.query.planId;
@ -104,59 +161,9 @@ export default {
const editData = this.$store.state.runPlan.editData[params.serviceNumber]; const editData = this.$store.state.runPlan.editData[params.serviceNumber];
if (editData) { if (editData) {
const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; }); const tripNumberList = Object.keys(editData.trainMap).sort((a, b) => { return editData.trainMap[a].oldIndex - editData.trainMap[b].oldIndex; });
tripNumberList.forEach(tripNumber => { if (tripNumberList.length > 0) {
const trainInfo = editData.trainMap[tripNumber]; this.getEachTripNumber(editData, tripNumberList, 0);
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);
});
});
} }
} }
}, },

View File

@ -379,11 +379,12 @@ export default {
} }
}, },
loadInitData(params) { loadInitData(params) {
debugger;
const lineCode = this.$route.query.lineCode; const lineCode = this.$route.query.lineCode;
const mapId = this.$route.query.mapId; const mapId = this.$route.query.mapId;
this.isPlan = params.isPlan; this.isPlan = params.isPlan;
this.tripNumber = params.serviceNumber; this.tripNumber = params.tripNumber;
this.serviceNumber = params.tripNumber; this.serviceNumber = params.serviceNumber;
this.planId = this.$route.query.planId; this.planId = this.$route.query.planId;
this.PlanConvert = this.$theme.loadPlanConvert(lineCode); this.PlanConvert = this.$theme.loadPlanConvert(lineCode);
@ -403,12 +404,6 @@ export default {
}); });
} }
// this.routingList // 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) { if (params.rowData && params.rowData.arriveConfigList.length > 0) {
this.editModel.arriveConfigList = params.rowData.arriveConfigList; this.editModel.arriveConfigList = params.rowData.arriveConfigList;
this.editModel.routingCode = params.rowData.routingCode; this.editModel.routingCode = params.rowData.routingCode;
@ -418,6 +413,7 @@ export default {
this.editModel.endTime = params.rowData.endTime; this.editModel.endTime = params.rowData.endTime;
this.editModel.endSectionCode = params.rowData.endSectionCode; this.editModel.endSectionCode = params.rowData.endSectionCode;
this.editModel.startSectionCode = params.rowData.startSectionCode; this.editModel.startSectionCode = params.rowData.startSectionCode;
this.routingList = [];
this.routingList.push({ this.routingList.push({
code:params.rowData.routingCode, code:params.rowData.routingCode,
startStationCode:params.rowData.startStationCode, startStationCode:params.rowData.startStationCode,
@ -430,7 +426,7 @@ export default {
} else { } else {
const model = { const model = {
planId: this.$route.query.planId || this.loadRunPlanId, planId: this.$route.query.planId || this.loadRunPlanId,
SDTNumber: `${this.editModel.serviceNumber}${this.editModel.tripNumber}` SDTNumber: `${this.serviceNumber}${this.tripNumber}`
}; };
this.editModel.routingList = []; this.editModel.routingList = [];
getRoutingBySDTNumber(model).then(resp => { // getRoutingBySDTNumber(model).then(resp => { //
@ -440,8 +436,16 @@ export default {
// const data = editData.trainMap[this.editModel.tripNumber].stationTimeList; // const data = editData.trainMap[this.editModel.tripNumber].stationTimeList;
// this.editModel.defaultSpeedLevel // this.editModel.defaultSpeedLevel
this.editModel.routingCode = routingObj.code; 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[]
this.editModel.routingList.push(routingObj); // this.editModel.routingList.push(routingObj);
this.computedDetailList(); this.computedDetailList();
}); });
} }