道岔逻辑修改

This commit is contained in:
zyy 2019-12-03 15:21:52 +08:00
parent 7d262fc7c9
commit 8eb6aca36c
3 changed files with 20 additions and 5 deletions

View File

@ -65,9 +65,10 @@ function queryDeleteModels(state, device, dict) {
}
}
if (elem.type == '04') {
console.log(elem, dict[elem.code]);
if (dict[elem.code] && !dict[elem.code].relevanceSectionList.length) {
setDisPose(elem, dict);
} else if (!elem.relevanceSectionList.length) {
} else if (elem.relevanceSectionList && !elem.relevanceSectionList.length) {
setDisPose(elem, dict);
}
}

View File

@ -665,6 +665,7 @@ export default {
this.$refs.dataform.resetFields();
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
this.editModel.points = [];
console.log(selected);
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];

View File

@ -489,29 +489,42 @@ export default {
const sectionc = this.findSectionData(sectionLists, elem.sectionCCode);
const uid = getUID('Section');
elem['uid'] = uid;
sectiona.parentCode = uid;
sectionb.parentCode = uid;
sectionc.parentCode = uid;
elem['relevanceSectionList'] = 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[0].x == sectionb.points[sectionb.points.length - 1].x && sectionb1.points[0].y == sectionb.points[sectionb.points.length - 1].y) {
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectionList.push(elem);
sectiona.parentCode = uid;
sectionb.parentCode = uid;
sectionc.parentCode = uid;
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
sectionList.forEach((item, index) => {
if (item.code == ele.code) {
sectionList.splice(index, 1);
}
});
}
if (sectiona1.points[0].x == sectiona.points[sectiona.points.length - 1].x && sectiona1.points[0].y == sectiona.points[sectiona.points.length - 1].y) {
if (sectiona1.points[sectiona1.points.length - 1].x == sectiona.points[0].x && sectiona1.points[sectiona1.points.length - 1].y == sectiona.points[0].y) {
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectionList.push(elem);
sectiona.parentCode = uid;
sectionb.parentCode = uid;
sectionc.parentCode = uid;
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
sectionList.forEach((item, index) => {
if (item.code == elem.code) {
sectionList.splice(index, 1);
}
});
}
});