调整区段修改逻辑

This commit is contained in:
zyy 2020-06-03 13:18:52 +08:00
parent d592e381ab
commit a57ae39ebf

View File

@ -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) {