运行图代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-19 14:49:33 +08:00
parent 8acee05b38
commit 5e271d3320
2 changed files with 28 additions and 7 deletions

View File

@ -147,6 +147,8 @@ export default {
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].startSectionCode = elem.startSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].endSectionCode = elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].startStationCode = elem.startStationCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].endStationCode = elem.endStationCode;
} else {
// temp = name.split('-')[1];
// const data = ;
@ -273,11 +275,21 @@ export default {
// const runningRoute = Object.values(this.runningRoutingMap).find(route => route.value == this.formModel.runningRouting);
if (!this.formModel.runningRouting) {
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => route.runningRouting1 && route.runningRouting2
// && (outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
// inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode) ||
//! inboundRoute && !outboundRoute)
);
debugger;
let list = Object.values(this.runningRoutingMap).filter(route=>{ return route.runningRouting1 && route.runningRouting2; });
list = list.sort((a, b) => {
const startStationA = this.$store.getters['map/getDeviceByCode'](a.startStationCode);
const startStationB = this.$store.getters['map/getDeviceByCode'](b.startStationCode);
const endStationCodeA = this.$store.getters['map/getDeviceByCode'](a.endStationCode);
const endStationCodeB = this.$store.getters['map/getDeviceByCode'](b.endStationCode);
return startStationA.kmRange == startStationB.kmRange ? endStationCodeA.kmRange - endStationCodeB.kmRange : startStationA.kmRange - startStationB.kmRange;
});
this.runningRouteList = list;
// this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => route.runningRouting1 && route.runningRouting2
// && (outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
// inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode) ||
// ! inboundRoute && !outboundRoute)
// );
}
// this.outboundRouteList = this.covertRouting(this.routingList, route => {

View File

@ -143,6 +143,8 @@ export default {
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].label = elem.name;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].value = elem.startSectionCode + '-' + elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].startStationCode = elem.startStationCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].endStationCode = elem.endStationCode;
} else {
// temp = name.split('-')[1];
// const data = ;
@ -211,8 +213,15 @@ export default {
this.formModel.runningRouting2 = temp.runningRouting2;
},
covertRouting() {
const list = Object.values(this.runningRoutingMap);
return list.filter(route=>{ return route.runningRouting1 && route.runningRouting2; });
let list = Object.values(this.runningRoutingMap).filter(route=>{ return route.runningRouting1 && route.runningRouting2; });
list = list.sort((a, b) => {
const startStationA = this.$store.getters['map/getDeviceByCode'](a.startStationCode);
const startStationB = this.$store.getters['map/getDeviceByCode'](b.startStationCode);
const endStationCodeA = this.$store.getters['map/getDeviceByCode'](a.endStationCode);
const endStationCodeB = this.$store.getters['map/getDeviceByCode'](b.endStationCode);
return startStationA.kmRange == startStationB.kmRange ? endStationCodeA.kmRange - endStationCodeB.kmRange : startStationA.kmRange - startStationB.kmRange;
});
return list;
}
}
};