From 5f132f395129a3ef79c1dbaaca0e9ce3e8ef3cac Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 6 Dec 2019 11:02:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=98=E5=9B=BE=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=B0=83=E6=95=B4=5F(=E5=8C=BA=E6=AE=B5=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=B0=83=E6=95=B4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/newMap/newMapdraft/mapoperate/section.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/views/newMap/newMapdraft/mapoperate/section.vue b/src/views/newMap/newMapdraft/mapoperate/section.vue index 73e17db32..ff3a1b4f2 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section.vue @@ -1043,6 +1043,16 @@ export default { type: 'warning' }).then(() => { models.push(deepAssign(selected, { _dispose: true })); + const delLeftSection = this.getSectionByCode(selected.leftSectionCode); + const delRightSection = this.getSectionByCode(selected.rightSectionCode); + if (delLeftSection) { + delLeftSection.rightSectionCode = ''; + models.push(delLeftSection); + } + if (delRightSection) { + delRightSection.leftSectionCode = ''; + models.push(delRightSection); + } _that.$emit('updateMapModel', models); _that.deviceSelect(); }).catch((error) => { From 4313a027edd662874bca77a93105021774b68353 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Fri, 6 Dec 2019 11:27:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=8C=BA=E6=AE=B5?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newMap/newMapdraft/mapoperate/section.vue | 165 ++------------- .../mapoperate/section/logicBlock.vue | 189 ++++++++++++++++++ 2 files changed, 201 insertions(+), 153 deletions(-) create mode 100644 src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue diff --git a/src/views/newMap/newMapdraft/mapoperate/section.vue b/src/views/newMap/newMapdraft/mapoperate/section.vue index 95c377522..72b405403 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section.vue @@ -175,38 +175,7 @@ - - - - - - {{ $t('map.aux') }}{{ scope.row.index }}{{ $t('map.sectionLine') }} - - - - - - - - - - {{ $t('map.empty') }} - - - - - - - - - - - - - - {{ $t('map.updateObj') }} - - + @@ -217,11 +186,13 @@ import { getUID } from '@/jmapNew/utils/Uid'; import JTriangle from '@/jmapNew/utils/JTriangle'; import ConfigList from './config/list'; import { deepAssign } from '@/utils/index'; +import LogicBlock from './section/logicBlock'; export default { name: 'SectionDraft', components: { - ConfigList + ConfigList, + LogicBlock }, props: { selected: { @@ -240,7 +211,6 @@ export default { TrainPositionTypeList: [], regionList: [], viewSelect: false, - isDelimiter:false, editModel: { code: '', name: '', @@ -285,7 +255,6 @@ export default { rightSectionCode: '', relevanceSectionList: [] }, - tableData: [], oldPoint: [], // 区段未修改前 坐标 addModel: { code: '', @@ -652,31 +621,13 @@ export default { this.regionList = this.$ConstSelect.RegionTypeList; }, methods: { - // 计算逻辑区段数量列表展示 - computedLogicSectionNumList(logicSectionNum) { - this.tableData = []; - this.logicSectionNums = [...logicSectionNum]; - var i; var num; var len = this.editModel.points.length; - if (len > 1 && this.editModel.type === '01') { - for (i = 0; i < len - 1; i++) { - num = 0; - if (Array.isArray(this.logicSectionNums) && this.logicSectionNums[i]) { - num = parseInt(this.logicSectionNums[i]); - } - this.tableData.push({ index: i + 1, num: num }); - } - - if (this.tableData.length <= 0) { - this.tableData.push({ index: i + 1, num: 0 }); - } - } - }, deviceChange(code) { this.$emit('setCenter', code); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); }, deviceSelect(selected) { + const obj = this; if (!this.fieldS) { // 判断是否激活选择站台 if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) { if (this.field === 'leftSection') { @@ -710,7 +661,9 @@ export default { this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz); this.addModel.splitOffset = this.addModel.splitOffsetMax / 2; - this.computedLogicSectionNumList(this.editModel.logicSectionNum); + + obj.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum); + if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) { this.addModel.code = selected.code; this.activeName = 'three'; @@ -760,104 +713,6 @@ export default { this.$emit('fieldSelect', this.field); } }, - handleDelete(index, row) { - row.num = 0; - }, - // 逻辑区段模型 - addLogicalSection(model, points, index, middleOffset) { - const data = { - _type: 'Section', - code: getUID('Section'), - name: String.fromCharCode(index + 'A'.charCodeAt()), - parentCode: model.code, - axleShow: false, - type: '02', - namePosition: { x: 0, y: 0 }, - isStandTrack: false, - standTrackName: model.standTrackName, - standTrackNamePosition: { - x: model.standTrackNamePosition.x, - y: model.standTrackNamePosition.y - }, - isReentryTrack: false, - reentryTrackName: model.reentryTrackName, - reentryTrackNamePosition: { - x: model.reentryTrackNamePosition.x, - y: model.reentryTrackNamePosition.y - }, - isTransferTrack: false, - transferTrackName: model.transferTrackName, - transferTrackNamePosition: { - x: model.transferTrackNamePosition.x, - y: model.transferTrackNamePosition.y - }, - isSegmentation: false, - segmentationPosition: { - x: model.segmentationPosition.x, - y: model.segmentationPosition.y - }, - logicSectionNameSort: model.logicSectionNameSort, - isSwitchSection: model.isSwitchSection, - relSwitchCode: model.relSwitchCode, - logicSectionNum: [], - logicSectionShow: model.logicSectionShow, - stationCode: model.stationCode, - offsetLeft: middleOffset * (index) + model.offsetLeft, - offsetRight: middleOffset * (index + 1) + model.offsetLeft, - sepTypeLeft: '00', - sepTypeRight: '00', - trainPosType: model.trainPosType, - points: points, - isCurve: false, - lengthFact: 0, - kmRangeRight: model.kmRangeRight, - kmRangeLeft: model.kmRangeLeft, - region: model.region, - relevanceSectionList: [] - }; - if (this.isDelimiter) { - data.sepTypeLeft = '01'; - data.sepTypeRight = '01'; - } - return data; - }, - // 创建逻辑区段 - createLogicalSections(num, beg, end, model, counts) { - const models = []; - const triangle = new JTriangle(beg, end); - const offset = Math.sqrt(triangle.abspowz) / num; - const middleOffset = parseFloat((model.offsetRight - model.offsetLeft) / num); - for (let i = 0; i < num; i++) { - const points = [ - { x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) }, - { x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) } - ]; - models.push(this.addLogicalSection(model, points, counts + i, middleOffset)); - } - return models; - }, - // 生成逻辑区段 - editSectionNum() { - let models = []; - let counts = 0; - const logicSectionNumList = []; - const sectionPoints = [...this.editModel.points]; // 获取区段点 - this.tableData.forEach((ele, index) => { - models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts)]; - logicSectionNumList.push(Number(ele.num)); - counts += parseInt(ele.num); - }); - this.sectionList.forEach(section => { // 删除之前的逻辑区段 - if (section.type === '02' && section.parentCode == this.editModel.code) { - models.push(deepAssign(section, {_dispose: true})); - } - }); - - this.editModel.logicSectionNum = [...logicSectionNumList]; - models.push(this.editModel); - this.activeName = 'first'; - this.$emit('updateMapModel', models); - }, addPoint(index) { const data = { x: 0, y: 0 }; this.editModel.points.splice(index + 1, 0, data); @@ -1031,6 +886,10 @@ export default { } return null; }, + updateMapModel(models) { + this.activeName = 'first'; + this.$emit('updateMapModel', models); + }, // 删除对象 deleteObj() { const models = []; diff --git a/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue b/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue new file mode 100644 index 000000000..fa9aadb4c --- /dev/null +++ b/src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue @@ -0,0 +1,189 @@ + + + + + + + + {{ $t('map.aux') }}{{ scope.row.index }}{{ $t('map.sectionLine') }} + + + + + + + + + + {{ $t('map.empty') }} + + + + + + + + + + + + + + {{ $t('map.updateObj') }} + + + + +