添加区段关联关系

This commit is contained in:
fan 2019-11-29 18:32:34 +08:00
parent 103e8c9c49
commit 0afb9666fc

View File

@ -382,7 +382,9 @@ export default {
{ prop: 'namePosition.x', firstLevel: 'namePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList, disabled: true },
{ prop: 'leftSection', label: '左关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.PhysicalSectionList},
{ prop: 'rightSection', label: '右关联区段', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.PhysicalSectionList},
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList},
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isSwitchSectionShow }, // 1
@ -500,6 +502,12 @@ export default {
],
trainPosType: [
{ required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
],
leftSection: [
{ required: this.editModel.type === '01', message: '请选择左关联区段', trigger: 'change' }
],
rightSection: [
{ required: this.editModel.type === '01', message: '请选择右关联区段', trigger: 'change'}
]
};
return rules;
@ -960,6 +968,18 @@ export default {
};
models.push(model);
}
models.forEach((elem, index) => {
if (index === 0) {
elem.leftSection = selected.leftSection;
elem.rightSection = models[index + 1].code;
} else if (index === models.length) {
elem.leftSection = models[index - 1].code;
elem.rightSection = selected.rightSection;
} else {
elem.leftSection = models[index - 1].code;
elem.rightSection = models[index + 1].code;
}
});
models.push(deepAssign(selected, { _dispose: true }));
this.$emit('updateMapModel', models); //
}
@ -1000,7 +1020,6 @@ export default {
parentCode: '',
name: uid,
type: '01',
linkCode: lsection.linkCode,
isStandTrack: false,
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
@ -1039,6 +1058,8 @@ export default {
model.logicSectionNameSort = lsection.logicSectionNameSort;
model.namePosition = { x: 0, y: 0 };
model.lengthFact = Number(lsection.lengthFact) + Number(rsection.lengthFact);
model.leftSection = lsection.leftSection;
model.rightSection = rsection.rightSection;
models.push(model);
this.$emit('updateMapModel', models);
}
@ -1059,6 +1080,8 @@ export default {
model.logicSectionNameSort = rsection.logicSectionNameSort;
model.namePosition = { x: 0, y: 0 };
model.lengthFact = Number(lsection.lengthFact) + Number(rsection.lengthFact);
model.leftSection = rsection.leftSection;
model.rightSection = lsection.rightSection;
models.push(model);
this.$emit('updateMapModel', models);
}