rt-sim-training-client/src/utils/mapList.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-11-08 16:22:05 +08:00
import { getSessionStorage } from '@/utils/auth';
import { listPublishMap, getMapListByProjectCode } from '@/api/jmap/map';
2020-05-10 21:42:27 +08:00
import { ProjectCode } from '@/scripts/ProjectConfig';
2019-11-08 16:22:05 +08:00
export async function getMapListByProject(drawWay) {
2019-11-08 16:22:05 +08:00
const project = getSessionStorage('project');
let mapList = [];
if (project.endsWith('xty') || project.endsWith('gzb')) {
2019-11-08 16:22:05 +08:00
mapList = await getMapListByProjectCode(ProjectCode[project]);
} else {
2020-05-10 21:42:27 +08:00
mapList = await listPublishMap({ 'drawWay': drawWay });
2019-11-08 16:22:05 +08:00
}
return mapList;
}
2020-03-16 17:16:59 +08:00
export function getAutoReentryBySignalCode(signalCode, routeList, autoReentryList) { // 根据折返进路的始端信号机去找
2020-03-20 15:00:31 +08:00
const route = [];
const autoReentry = [];
2020-03-16 17:16:59 +08:00
routeList.forEach(item => {
2020-03-16 17:54:30 +08:00
if (item.startSignalCode === signalCode && item.turnBack) {
2020-03-20 15:00:31 +08:00
route.push(item);
2020-03-16 17:54:30 +08:00
}
});
autoReentryList.forEach(item => {
2020-03-20 15:00:31 +08:00
route.forEach(it => {
if (item.turnBackRouteCode === it.code || item.turnBackRoute2Code === it.code) {
autoReentry.push(item);
}
});
2020-03-16 17:16:59 +08:00
});
2020-03-16 17:54:30 +08:00
return autoReentry;
2020-03-16 17:16:59 +08:00
}