From 2fe27a3c479a7160ccacd31b257e05dc4a6e08b5 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Thu, 4 Mar 2021 13:45:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E5=9B=BE=E7=BC=96=E8=BE=91=E9=97=AE=E9=A2=98=201=EF=BC=9A?= =?UTF-8?q?=E4=BA=A4=E8=B7=AF=E8=AE=BE=E7=BD=AE=20=EF=BC=8C=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E8=BD=A8<=E2=80=94=E2=80=94>=E6=8A=98=E8=BF=94?= =?UTF-8?q?=E8=BD=A8=20=20=20=20=E6=88=96=E8=80=85=20=20=20=E6=8A=98?= =?UTF-8?q?=E8=BF=94=E8=BD=A8=20<=E2=80=94=E2=80=94>=E6=8A=98=E8=BF=94?= =?UTF-8?q?=E8=BD=A8=202=EF=BC=9A=E9=AB=98=E4=BA=AE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/Section/ELines.js | 8 + src/jmapNew/shape/Section/index.js | 3 + .../editTool/routingoperate/routeConfig.vue | 138 ++++++++++-------- 3 files changed, 89 insertions(+), 60 deletions(-) diff --git a/src/jmapNew/shape/Section/ELines.js b/src/jmapNew/shape/Section/ELines.js index bb39f3138..fee68f66e 100644 --- a/src/jmapNew/shape/Section/ELines.js +++ b/src/jmapNew/shape/Section/ELines.js @@ -565,6 +565,14 @@ export default class ELines extends Group { } } + addHover(style) { + this.__zr && this.__zr.addHover(this.section, style); + } + + removeHover() { + this.__zr && this.__zr.removeHover(this.section); + } + recover() { } diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 3160c5937..ee7449daa 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -485,15 +485,18 @@ export default class Section extends Group { this.line.setOrignalCross(false); } } + drawBatchSelected(selected, type) { if (this.selectedType === type) { return; } + if (selected && type) { this.line && this.line.setStyle({ stroke: drawSectionStyle[type] }); } else { this.line && this.line.setStyle({ stroke: this.style.Section.line.spareColor }); } + this.selectedType = type; } diff --git a/src/views/planMonitor/editTool/routingoperate/routeConfig.vue b/src/views/planMonitor/editTool/routingoperate/routeConfig.vue index 7b01d6e01..2c676f77a 100644 --- a/src/views/planMonitor/editTool/routingoperate/routeConfig.vue +++ b/src/views/planMonitor/editTool/routingoperate/routeConfig.vue @@ -19,15 +19,11 @@ :value="item.code" /> - {{ $t('map.activate') }} - - - @@ -199,6 +186,8 @@ export default { stationCode: '', sectionCode: '', DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}], + oldStartSectionCode: '', + oldEndSectionCode: '', addModel: { name: '', mapId: '', @@ -230,7 +219,8 @@ export default { endSectionCode: [ { required: true, message: '请选择终到区段', trigger: 'change' } ] - } + }, + oldsection: [] }; }, computed: { @@ -238,17 +228,22 @@ export default { 'sectionList', 'stationList' ]), - filterSectionList() { + filterStartSectionList() { if (this.sectionList) { - // || elem.reentryTrack - return this.sectionList.filter(elem => { return elem.standTrack || elem.transferTrack; }); + return this.sectionList.filter(elem => { return elem.reentryTrack || elem.transferTrack; }); } else { return []; } }, + filterEndSectionList() { + if (this.sectionList) { + return this.sectionList.filter(elem => { return elem.reentryTrack; }); + } else { + return []; + } + }, filterStandSection() { if (this.sectionList) { - // || elem.reentryTrack return this.sectionList.filter(elem => { return elem.standTrack; }); } else { return []; @@ -339,7 +334,6 @@ export default { this.isSave = true; this.allowSelect = false; this.isStartSelected = false; - // this.addModel.withLoop = false; this.editShow = false; this.field = ''; } @@ -355,21 +349,21 @@ export default { this.judgeAllowSelected(); this.addEndSectionData(true); } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) { - // selected.reentryTrack || - if (selected.standTrack || selected.transferTrack) { + if (selected.code != this.addModel.endSectionCode && (selected.reentryTrack || selected.transferTrack)) { + this.popSection(this.addModel, 'startSectionCode'); if (selected.belongStation) { this.addModel.startStationCode = selected.belongStation; } this.addModel.startSectionCode = selected.code; this.judgeAllowSelected(); this.addStartSectionData(false); + this.oldStartSectionCode = selected.code; } else { - // (折返轨/转换轨/站台轨对应的区段) this.$message.error('请选择正确的起始区段'); } } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) { - // selected.reentryTrack || - if (selected.standTrack || selected.transferTrack) { + if (selected.code != this.addModel.startSectionCode && selected.reentryTrack) { + this.popSection(this.addModel, 'endSectionCode'); if (this.addModel.startSectionCode == selected.code) { this.$message.error('起始区段和终到区段不能相同'); return false; @@ -380,13 +374,13 @@ export default { this.addModel.endSectionCode = selected.code; this.judgeAllowSelected(); this.addEndSectionData(false); + this.oldEndSectionCode = selected.code; this.addModel.destinationCode = selected.destinationCode || ''; } else { this.$message.error('请选择正确的终到区段'); } } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) { - if (selected.standTrack) { - // || selected.reentryTrack || selected.transferTrack + if (selected.standTrack) { this.sectionCode = selected.code; } else { this.$message.error('请选择正确的区段'); @@ -402,26 +396,27 @@ export default { } }, changeSectionSelected(selectedList, flag) { + if (this.oldsection && this.oldsection.length > 0) { + this.oldsection.forEach((section)=>{ + section.instance.drawBatchSelected(section, ''); + }); + } + + this.oldsection = []; if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) { if (flag) { - if (this.oldsection && this.oldsection.length > 0) { - this.oldsection.forEach((section)=>{ - section.instance.drawBatchSelected(section, ''); - }); - this.oldsection = []; - } selectedList.forEach(each=>{ const section = this.$store.getters['map/getDeviceByCode'](each.sectionCode); const list = section.logicSectionCodeList; if (list && list.length > 0) { list.forEach(logicSectionCode=>{ const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode); - this.oldsection && this.oldsection.push(logicSection); - logicSection.instance.drawBatchSelected(section, 'routingSection'); + logicSection.instance.drawBatchSelected(logicSection, 'routingSection'); + this.oldsection && this.oldsection.push(logicSection); }); } else { - this.oldsection && this.oldsection.push(section); section.instance.drawBatchSelected(section, 'routingSection'); + this.oldsection && this.oldsection.push(section); } }); } else { @@ -440,41 +435,59 @@ export default { } } }, - changeStartStation() { + changeStartStation(code, code2) { this.judgeAllowSelected(); this.addStartSectionData(true); }, - changeStartSection(data) { - const section = this.$store.getters['map/getDeviceByCode'](data); - if (section && - section.belongStation) { - this.addModel.startStationCode = section.belongStation; - this.judgeAllowSelected(); - this.addStartSectionData(false); - } else { - this.addModel.parkSectionCodeList.shift(); + changeStartSection(code) { + if (code) { + if (this.addModel.endSectionCode != code) { + const section = this.$store.getters['map/getDeviceByCode'](code); + if (section && + section.belongStation) { + this.addModel.startStationCode = section.belongStation; + } + this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode'); + this.judgeAllowSelected(); + this.addStartSectionData(false); + this.oldStartSectionCode = code; + } else { + this.addModel.startSectionCode = this.oldStartSectionCode; + this.$message.error('请选择正确的起始区段'); + } + } else { + this.popSection({startSectionCode: this.oldStartSectionCode}, 'startSectionCode'); this.addModel.startStationCode = ''; this.addModel.startSectionCode = ''; + this.oldStartSectionCode = ''; } }, changeEndStation() { this.judgeAllowSelected(); this.addEndSectionData(true); }, - changeEndSection(data) { - if (data) { - const section = this.$store.getters['map/getDeviceByCode'](data); - if (section && - section.belongStation) { - this.addModel.endStationCode = section.belongStation; - } - this.addModel.destinationCode = section.destinationCode || ''; - this.judgeAllowSelected(); - this.addEndSectionData(false); + changeEndSection(code) { + if (code) { + if (this.addModel.startSectionCode != code) { + const section = this.$store.getters['map/getDeviceByCode'](code); + if (section && + section.belongStation) { + this.addModel.endStationCode = section.belongStation; + } + this.addModel.destinationCode = section.destinationCode || ''; + this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode'); + this.judgeAllowSelected(); + this.addEndSectionData(false); + this.oldEndSectionCode = code; + } else { + this.addModel.endSectionCode = this.oldEndSectionCode; + this.$message.error('请选择正确的终到区段'); + } } else { - this.addModel.parkSectionCodeList.pop(); + this.popSection({endSectionCode: this.oldEndSectionCode}, 'endSectionCode'); this.addModel.endStationCode = ''; this.addModel.endSectionCode = ''; + this.oldEndSectionCode = ''; } }, judgeAllowSelected() { @@ -497,7 +510,6 @@ export default { }, buildModel(code) { const model = Object.assign({}, this.addModel); - // if (model.withLoop) { model.withLoop = true; } else { model.withLoop = false; } model['mapId'] = this.$route.query.mapId; model['userId'] = this.$store.state.user.id; if (code) { model['code'] = code; } @@ -522,7 +534,6 @@ export default { }); }, save() { - // this.addModel; this.$refs.form.validate((valid) => { if (valid) { this.loading = true; @@ -654,6 +665,13 @@ export default { this.stationCode = ''; } }, + popSection(data, type) { + const list = this.addModel.parkSectionCodeList; + const index = list.findIndex(el => { return el.sectionCode == data[type]}); + if (index >= 0) { + this.deleteSection(list, index); + } + }, generateParkSection() { this.$refs.form.validate((valid) => { if (valid) {