rt-sim-training-client/src/utils/mapList.js
2020-12-22 18:16:06 +08:00

33 lines
1.2 KiB
JavaScript

import { getSessionStorage } from '@/utils/auth';
// listPublishMap
import { getMapListByProjectCode, getPublishMapListOnline } from '@/api/jmap/map';
import { ProjectCode } from '@/scripts/ProjectConfig';
export async function getMapListByProject() {
const project = getSessionStorage('project');
let mapList = [];
if (project.endsWith('xty') || project.endsWith('gzb') || project.endsWith('heb')) {
mapList = await getMapListByProjectCode(ProjectCode[project]);
} else {
// mapList = await listPublishMap({ 'drawWay': true });
mapList = await getPublishMapListOnline();
}
return mapList;
}
export function getAutoReentryBySignalCode(signalCode, routeList, autoReentryList) { // 根据折返进路的始端信号机去找
const route = [];
const autoReentry = [];
routeList.forEach(item => {
if (item.startSignalCode === signalCode && item.turnBack) {
route.push(item.code);
}
});
autoReentryList.forEach(item => {
if (route.includes(item.turnBackRouteCode) || route.includes(item.turnBackRoute2Code)) {
autoReentry.push(item);
}
});
return autoReentry;
}