调整道岔生成逻辑

This commit is contained in:
zyy 2020-09-11 10:28:55 +08:00
parent 9ca3612715
commit e5687c13dd
2 changed files with 39 additions and 43 deletions

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -170,14 +170,12 @@ export default {
if (!this.checkAddListA(oneSection, section.code)) { //
const sectionModel = deepAssign({}, section);
sectionModel.rightSectionCode = '';
sectionModel.parentCode = '';
sectionModel.sepTypeRight = '00'; //
sectionModel.type = '03';
const list = this.findSectionA(sectionModel.points[sectionModel.points.length - 1].x, sectionModel.points[sectionModel.points.length - 1].y);
list.forEach(elem => {
const sectionModel = deepAssign({}, elem);
sectionModel.leftSectionCode = '';
sectionModel.parentCode = '';
sectionModel.sepTypeLeft = '00';
sectionModel.type = '03';
changeSectionList.push(sectionModel);
@ -191,14 +189,12 @@ export default {
if (!this.checkAddListB(oneSectionStar, section.code)) { //
const sectionModel = deepAssign({}, section);
sectionModel.leftSectionCode = '';
sectionModel.parentCode = '';
sectionModel.sepTypeLeft = '00';
sectionModel.type = '03';
const list = this.findSectionB(sectionModel.points[0].x, sectionModel.points[0].y);
list.forEach(elem => {
const sectionModel = deepAssign({}, elem);
sectionModel.rightSectionCode = '';
sectionModel.parentCode = '';
sectionModel.sepTypeRight = '00'; //
sectionModel.type = '03';
changeSectionList.push(sectionModel);
@ -249,45 +245,45 @@ export default {
const sectionb = this.findSectionData(sectionLists, elem.sectionBCode);
const sectiona = this.findSectionData(sectionLists, elem.sectionACode);
const sectionc = this.findSectionData(sectionLists, elem.sectionCCode);
const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
if (!parentSectionModel) { //
if (switchSectionList.indexOf(elem.code) == -1) {
let uid;
if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]);
elem['uid'] = uid;
}
addSectionList.push({ code: elem.uid });
sectiona.parentCode = elem['uid'];
sectionb.parentCode = elem['uid'];
sectionc.parentCode = elem['uid'];
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem);
switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode);
const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode);
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
ele['uid'] = uid;
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
switchSectionList.push(ele.code);
sectionList.forEach((item, index) => {
if (item.code == ele.code) {
sectionList.splice(index, 1);
}
});
}
});
// const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
// if (!parentSectionModel) { //
if (switchSectionList.indexOf(elem.code) == -1) {
let uid;
if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]);
elem['uid'] = uid;
}
} else {
parentSectionModel.relevanceSectionList.push(elem.sectionACode);
parentSectionModel.relevanceSectionList.push(elem.sectionBCode);
parentSectionModel.relevanceSectionList.push(elem.sectionCCode);
models.push(parentSectionModel);
addSectionList.push({ code: elem.uid });
sectiona.parentCode = elem['uid'];
sectionb.parentCode = elem['uid'];
sectionc.parentCode = elem['uid'];
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem);
switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode);
const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode);
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
ele['uid'] = uid;
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
switchSectionList.push(ele.code);
sectionList.forEach((item, index) => {
if (item.code == ele.code) {
sectionList.splice(index, 1);
}
});
}
});
}
// } else {
// parentSectionModel.relevanceSectionList.push(elem.sectionACode);
// parentSectionModel.relevanceSectionList.push(elem.sectionBCode);
// parentSectionModel.relevanceSectionList.push(elem.sectionCCode);
// models.push(parentSectionModel);
// }
sectiona.relSwitchCode = elem.code;
sectionb.relSwitchCode = elem.code;
sectionc.relSwitchCode = elem.code;