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

33 lines
1.1 KiB
JavaScript

import { getSessionStorage } from '@/utils/auth';
import { listPublishMap, getMapListByProjectCode } 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')) {
mapList = await getMapListByProjectCode(ProjectCode[project]);
} else {
mapList = await listPublishMap({ 'drawWay': true });
}
return mapList;
}
export function getAutoReentryBySignalCode(signalCode, routeList, autoReentryList) { // 根据折返进路的始端信号机去找
const route = [];
const autoReentry = [];
routeList.forEach(item => {
if (item.startSignalCode === signalCode && item.turnBack) {
route.push(item);
}
});
autoReentryList.forEach(item => {
route.forEach(it => {
if (item.turnBackRouteCode === it.code || item.turnBackRoute2Code === it.code) {
autoReentry.push(item);
}
});
});
return autoReentry;
}