From 0207e54914967dbdc599f854f640613f2e0d8984 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 20 Dec 2019 15:44:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E8=B7=AF=E5=BB=B6=E7=BB=AD=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E5=8C=BA=E6=AE=B5=E9=80=89=E4=B8=AD=E7=BA=A2=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/defaultStyle.js | 4 ++++ src/jmapNew/shape/Section/index.js | 22 +++++++++++-------- .../dataRelation/routeoperate/protect.vue | 20 +++++++++++++++++ .../dataRelation/routeoperate/route.vue | 6 ++--- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/jmapNew/config/defaultStyle.js b/src/jmapNew/config/defaultStyle.js index d20fc5a23..f38fb4b52 100644 --- a/src/jmapNew/config/defaultStyle.js +++ b/src/jmapNew/config/defaultStyle.js @@ -122,3 +122,7 @@ export default class defaultStyle { }; } } +export const drawSectionStyle = { + routePhysicalSection: 'rgba(255,255,0,0.5)', + continueProtectSection: 'rgba(255,0,255,0.5)' +}; diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 8deec902a..267b0646b 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -10,6 +10,7 @@ import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路 import ELimitName from './ELimitName'; // 成都三号线 限速名称 import JTriangle from '../../utils/JTriangle'; import router from '@/router'; +import {drawSectionStyle} from '../../config/defaultStyle'; /** 区段*/ export default class Section extends Group { @@ -22,7 +23,7 @@ export default class Section extends Group { this.model = model; this.style = style; this.selected = false; // 绘图选中状态 - this.batchSelected = false; // 绘图批量选中状态 + this.selectedType = ''; // 绘图批量选中状态 this.create(); this.createMouseEvent(); this.setState(model); @@ -854,25 +855,28 @@ export default class Section extends Group { drawSelected(selected) { this.selected = selected; if (selected) { - !this.batchSelected && this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); + !this.selectedType && this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); } else { - !this.batchSelected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); + !this.selectedType && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); } } - drawBatchSelected(selected) { - this.batchSelected = selected; - if (selected) { - this.section && this.section.setStyle({stroke: 'rgba(255,255,0,0.6)'}); + drawBatchSelected(selected, type) { + if (this.selectedType === type) { + return; + } + if (selected && !this.selectedType) { + this.section && this.section.setStyle({stroke: drawSectionStyle[type]}); } else { this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); } + this.selectedType = type; } checkIsDrawMap() { const path = window.location.href; if (path.includes('/map/draw')) { - this.on('mouseout', () => { !this.batchSelected && !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); }); - this.on('mouseover', () => { !this.batchSelected && this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); }); + this.on('mouseout', () => { !this.selectedType && !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); }); + this.on('mouseover', () => { !this.selectedType && this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); }); } } diff --git a/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue b/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue index 3026e681b..ac3dc9dd3 100644 --- a/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue +++ b/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue @@ -212,6 +212,26 @@ export default { }); this.editShow = true; } + }, + 'addOverlapModel.routeOverlapSectionList': function (val, old) { + if (old && old.length) { + old.forEach((item) => { + const section = this.$store.getters['map/getDeviceByCode'](item); + section.instance.drawBatchSelected(false, ''); + }); + } + if (val && val.length) { + val.forEach((item) => { + const section = this.$store.getters['map/getDeviceByCode'](item); + if (section.logicSectionCodeList && section.logicSectionCodeList.length) { + section.logicSectionCodeList.forEach( (logicSectionCode) => { + this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(true, 'continueProtectSection'); + }); + } + section.instance.drawBatchSelected(true, 'continueProtectSection'); + }); + } + } }, mounted() { diff --git a/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue b/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue index 8d026314b..abbf5312c 100644 --- a/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue +++ b/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue @@ -349,7 +349,7 @@ export default { if (old && old.length) { old.forEach((item) => { const section = this.$store.getters['map/getDeviceByCode'](item); - section.instance.drawBatchSelected(false); + section.instance.drawBatchSelected(false, ''); }); } if (val && val.length) { @@ -360,10 +360,10 @@ export default { const section = this.$store.getters['map/getDeviceByCode'](item); if (section.logicSectionCodeList && section.logicSectionCodeList.length) { section.logicSectionCodeList.forEach( (logicSectionCode) => { - this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(true); + this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(true, 'routePhysicalSection'); }); } - section.instance.drawBatchSelected(true); + section.instance.drawBatchSelected(true, 'routePhysicalSection'); }); } }