From a57ae39ebfdeca91592e6ba8c76bfd120183421f Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Wed, 3 Jun 2020 13:18:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8C=BA=E6=AE=B5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newMapdraft/mapoperate/section/index.vue | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/views/newMap/newMapdraft/mapoperate/section/index.vue b/src/views/newMap/newMapdraft/mapoperate/section/index.vue index 521682cf3..4a4915bb9 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/index.vue @@ -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: '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: '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: '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: 'standTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isLogicSectionNameSort }, // 是否站台轨 { prop: 'standTrackName', label: this.$t('map.standTrackName'), type: 'input', isHidden: !this.isstandTrackNameShow }, @@ -593,7 +593,7 @@ export default { return models; }, handleOtherSectionChange(model) { // 处理该区段改变导致的相关区段的变化 - const models = []; + let models = []; 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); this.sectionList.forEach(section => { @@ -669,6 +669,41 @@ export default { 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; }, getSectionByCode(code) {