调整区段修改逻辑
This commit is contained in:
parent
d592e381ab
commit
a57ae39ebf
@ -193,8 +193,8 @@ export default {
|
|||||||
{ prop: 'sepTypeLeft', label: this.$t('map.sepTypeLeft'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
|
{ prop: 'sepTypeLeft', label: this.$t('map.sepTypeLeft'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
|
||||||
{ prop: 'sepTypeRight', label: this.$t('map.sepTypeRight'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
|
{ prop: 'sepTypeRight', label: this.$t('map.sepTypeRight'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
|
||||||
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, addPoint: this.addPoint, delPoint: this.delPoint, lastDisabled: true },
|
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, addPoint: this.addPoint, delPoint: this.delPoint, lastDisabled: true },
|
||||||
{ prop: 'logicSectionStartOffset', label: this.$t('map.logicalSectionStartOffset'), type: 'number', min: 0, width: '150px', isHidden: !this.isStationCodeDisabled, disabled: true },
|
{ prop: 'logicSectionStartOffset', label: this.$t('map.logicalSectionStartOffset'), type: 'number', min: 0, width: '150px', isHidden: !this.isStationCodeDisabled, disabled: true }, // 逻辑区段起点偏移
|
||||||
{ prop: 'logicSectionEndOffset', label: this.$t('map.logicalSectionEndOffset'), type: 'number', min: 0, width: '150px', isHidden: !this.isStationCodeDisabled, disabled: true },
|
{ prop: 'logicSectionEndOffset', label: this.$t('map.logicalSectionEndOffset'), type: 'number', min: 0, width: '150px', isHidden: !this.isStationCodeDisabled, disabled: true }, // 逻辑区段终点偏移
|
||||||
{ prop: 'standTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isLogicSectionNameSort }, // 是否站台轨
|
{ prop: 'standTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isLogicSectionNameSort }, // 是否站台轨
|
||||||
|
|
||||||
{ prop: 'standTrackName', label: this.$t('map.standTrackName'), type: 'input', isHidden: !this.isstandTrackNameShow },
|
{ prop: 'standTrackName', label: this.$t('map.standTrackName'), type: 'input', isHidden: !this.isstandTrackNameShow },
|
||||||
@ -593,7 +593,7 @@ export default {
|
|||||||
return models;
|
return models;
|
||||||
},
|
},
|
||||||
handleOtherSectionChange(model) { // 处理该区段改变导致的相关区段的变化
|
handleOtherSectionChange(model) { // 处理该区段改变导致的相关区段的变化
|
||||||
const models = [];
|
let models = [];
|
||||||
const pointModel = [];
|
const pointModel = [];
|
||||||
const slope1 = (this.oldPoint[this.oldPoint.length - 1].y - this.oldPoint[0].y) / (this.oldPoint[this.oldPoint.length - 1].x - this.oldPoint[0].x);
|
const slope1 = (this.oldPoint[this.oldPoint.length - 1].y - this.oldPoint[0].y) / (this.oldPoint[this.oldPoint.length - 1].x - this.oldPoint[0].x);
|
||||||
this.sectionList.forEach(section => {
|
this.sectionList.forEach(section => {
|
||||||
@ -669,6 +669,41 @@ export default {
|
|||||||
models.push(item);
|
models.push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!model.parentCode) {
|
||||||
|
const arr = this.setLogicOffset(model);
|
||||||
|
models = [...models, ...arr];
|
||||||
|
} else {
|
||||||
|
const sectionModel = this.$store.getters['map/getDeviceByCode'](model.parentCode);
|
||||||
|
const arr = this.setLogicOffset(sectionModel);
|
||||||
|
models = [...models, ...arr];
|
||||||
|
}
|
||||||
|
|
||||||
|
return models;
|
||||||
|
},
|
||||||
|
setLogicOffset(section) { // 构建逻辑区段偏移量
|
||||||
|
const models = [];
|
||||||
|
// 正常情况下logicSectionCodeList下逻辑区段为从左向右
|
||||||
|
let startPoint = section.points[0].x + 's' + section.points[0].y;
|
||||||
|
let startOffset = 0;
|
||||||
|
const sectionMap = {};
|
||||||
|
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||||
|
section.logicSectionCodeList.forEach(sectionCode => {
|
||||||
|
const logicSection = this.$store.getters['map/getDeviceByCode'](sectionCode);
|
||||||
|
sectionMap[logicSection.points[0].x + 's' + logicSection.points[0].y] = logicSection;
|
||||||
|
});
|
||||||
|
while (sectionMap[startPoint]) {
|
||||||
|
const model = deepAssign({}, sectionMap[startPoint]);
|
||||||
|
if (!model.lengthFact) {
|
||||||
|
const length = section.lengthFact / section.logicSectionCodeList.length;
|
||||||
|
model.lengthFact = length.toFixed(3);
|
||||||
|
}
|
||||||
|
model.logicSectionStartOffset = startOffset;
|
||||||
|
model.logicSectionEndOffset = (model.lengthFact * 1000 + startOffset * 1000) / 1000;
|
||||||
|
models.push(model);
|
||||||
|
startOffset = (startOffset * 1000 + model.lengthFact * 1000) / 1000;
|
||||||
|
startPoint = model.points[model.points.length - 1].x + 's' + model.points[model.points.length - 1].y;
|
||||||
|
}
|
||||||
|
}
|
||||||
return models;
|
return models;
|
||||||
},
|
},
|
||||||
getSectionByCode(code) {
|
getSectionByCode(code) {
|
||||||
|
Loading…
Reference in New Issue
Block a user