diff --git a/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue b/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue index b299edde4..a43ee3a7b 100644 --- a/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue +++ b/src/views/newMap/newMapdraft/dataRelation/routeoperate/protect.vue @@ -215,28 +215,10 @@ export default { }, 'addOverlapModel.routeOverlapSectionList': function (val, old) { if (old && old.length) { - old.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(false, ''); - }); - } else { - section.instance.drawBatchSelected(false, ''); - } - }); + this.changeSectionSelected(old, false, 'continueProtectSection' ); } 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'); - }); - } else { - section.instance.drawBatchSelected(true, 'continueProtectSection'); - } - }); + this.changeSectionSelected(val, true, 'continueProtectSection' ); } } @@ -392,6 +374,21 @@ export default { }; this.overlapCode = ''; this.overlapType = ''; + }, + changeSectionSelected(list, flag, type) { + list && list.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(flag, flag ? type : ''); + }); + } else { + section.instance.drawBatchSelected(flag, flag ? type : ''); + } + }); + }, + routeSectionListFocus(flag) { + this.changeSectionSelected(this.addOverlapModel.routeOverlapSectionList, flag, 'continueProtectSection'); } } }; diff --git a/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue b/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue index 689a20459..aa1417e62 100644 --- a/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue +++ b/src/views/newMap/newMapdraft/dataRelation/routeoperate/route.vue @@ -347,31 +347,13 @@ export default { }, 'addModel.routeSectionList': function(val, old) { if (old && old.length) { - old.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(false, ''); - }); - } else { - section.instance.drawBatchSelected(false, ''); - } - }); + this.changeSectionSelected(old, false, 'routePhysicalSection'); } if (val && val.length) { if (!this.addModel.code) { this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1]; } - 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, 'routePhysicalSection'); - }); - } else { - section.instance.drawBatchSelected(true, 'routePhysicalSection'); - } - }); + this.changeSectionSelected(val, true, 'routePhysicalSection'); } } }, @@ -496,9 +478,19 @@ export default { }); }, routeSectionListFocus(flag) { - this.addModel.routeSectionList.forEach((item) => { + this.changeSectionSelected(this.addModel.routeSectionList, flag, 'routePhysicalSection'); + this.$refs['protect'].routeSectionListFocus(flag); + }, + changeSectionSelected(list, flag, type) { + list && list.forEach((item) => { const section = this.$store.getters['map/getDeviceByCode'](item); - section.instance.drawBatchSelected(flag); + if (section.logicSectionCodeList && section.logicSectionCodeList.length) { + section.logicSectionCodeList.forEach( (logicSectionCode) => { + this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(flag, flag ? type : ''); + }); + } else { + section.instance.drawBatchSelected(flag, flag ? type : ''); + } }); }, setSelected(selected) { diff --git a/src/views/newMap/newMapdraft/mapoperate/section.vue b/src/views/newMap/newMapdraft/mapoperate/section.vue index 750899510..fb7c3ecf3 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section.vue @@ -41,7 +41,7 @@ - + - + { return elem.type === '01' || elem.type === '03'; }); + } + return list; + }, switchSectionList() { let list = []; if (this.sectionList && this.sectionList.length) { @@ -1080,7 +1087,7 @@ export default { const models = []; let rsection = null; let lsection = null; - this.PhysicalSectionList.forEach(section => { + this.switchAndPhySicalSectionList.forEach(section => { if (section.code === this.mergeModel.lsectioncode) { lsection = section; } @@ -1187,13 +1194,6 @@ export default { this.$emit('updateMapModel', models); } } - - this.PhysicalSectionList.forEach(lsection => { - if (lsection.code === this.mergeModel.lsectioncode) { - this.PhysicalSectionList.forEach(rsection => { - }); - } - }); } } });