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
|
|
|
|
2020-10-26 11:07:49 +08:00
|
|
|
export async function getMapListByProject() {
|
2019-11-08 16:22:05 +08:00
|
|
|
const project = getSessionStorage('project');
|
|
|
|
let mapList = [];
|
2020-12-04 18:44:33 +08:00
|
|
|
if (project.endsWith('xty') || project.endsWith('gzb') || project.endsWith('heb')) {
|
2019-11-08 16:22:05 +08:00
|
|
|
mapList = await getMapListByProjectCode(ProjectCode[project]);
|
|
|
|
} else {
|
2020-10-26 11:07:49 +08:00
|
|
|
mapList = await listPublishMap({ 'drawWay': true });
|
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
|
|
|
}
|