From 15f94a7d1d45fb9411047532b49fa6156f98ab18 Mon Sep 17 00:00:00 2001 From: lVAL Date: Wed, 13 Jan 2021 17:45:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=BA=94=E7=AD=94?= =?UTF-8?q?=E5=99=A8=E5=88=9B=E5=BB=BA=20=E9=80=89=E6=8B=A9=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=8C=BA=E6=AE=B5=E7=B1=BB=E5=9E=8B=20=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E4=BC=98=E5=8C=96=E7=BB=98=E5=88=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/Responder/index.js | 51 +++++++------- .../mapoperate/responder/index.vue | 70 +++++++++++++++---- .../mapoperate/responder/responderBatch.vue | 15 ++-- .../mapoperate/responder/responderCreate.vue | 15 ++-- .../mapoperate/responder/responderModel.vue | 17 +++-- .../newMapdraft/mapoperate/responder/utils.js | 9 ++- 6 files changed, 115 insertions(+), 62 deletions(-) diff --git a/src/jmapNew/shape/Responder/index.js b/src/jmapNew/shape/Responder/index.js index 8f4d169d7..8ddcbdef7 100644 --- a/src/jmapNew/shape/Responder/index.js +++ b/src/jmapNew/shape/Responder/index.js @@ -9,9 +9,9 @@ import Polygon from 'zrender/src/graphic/shape/Polygon'; const defaultStyle = { block:{ stroke: '#fff', mapStyle: { - FB: { fill: '#fff' }, - VB: { fill: '#666' }, - IB: { fill: '#666' } + FB: { fill: '#fff', stroke: '#000' }, + VB: { fill: '#666', stroke: '#000' }, + IB: { fill: '#666', stroke: '#000' } } }, text:{ @@ -40,16 +40,19 @@ export default class Responder extends Group { create() { const model = this.model; const responderStyle = this.style.Responder || defaultStyle; - const blockX = model.position.x; - const blockY = model.position.y; + const distance = 12; + const offsetX = distance * Math.sin(model.rotate); + const offsetY = distance * Math.cos(model.rotate); const blockWidth = responderStyle.block.width || 5; const blockHeight = responderStyle.block.height || 12; - const blockStroke = responderStyle.block.stroke; const blockStyle = responderStyle.block.mapStyle[model.type] || { fill: '#fff'}; - const textX = model.position.x + model.textOffset.x; - const textY = model.position.y + model.textOffset.y; + const blockX = model.position.x - blockWidth / 2 - offsetX; + const blockY = model.position.y - blockHeight / 2 - offsetY; + const textX = blockX + model.textOffset.x; + const textY = blockY + model.textOffset.y; const textName = `${model.type}-${model.name}`; const textFill = responderStyle.text.textFill; + const origin = [model.position.x, model.position.y]; const deltaFill = responderStyle.delta.fill; const padding = 1.2; @@ -63,25 +66,10 @@ export default class Responder extends Group { height: blockHeight }, style: { - stroke: blockStroke, ...blockStyle } }); - this.text = new Text({ - zlevel: this.zlevel, - z: this.z + 1, - style: { - x: textX, - y: textY, - text: textName, - fontFamily: this.style.fontFamily, - fontSize: this.style.fontSize, - textFill: textFill, - textAlign: 'right' - } - }); - this.delta1 = new Polygon({ zlevel: this.zlevel, z: this.z + 1, @@ -112,8 +100,22 @@ export default class Responder extends Group { } }); + this.text = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + origin, + style: { + x: textX, + y: textY, + text: textName, + fontFamily: this.style.fontFamily, + fontSize: this.style.fontSize, + textFill: textFill, + textAlign: 'right' + } + }); + if (model.rotate) { - const origin = [blockX, blockY]; const rotation = -Math.PI / 180 * Number(model.rotate); [this.block, this.delta1, this.delta2].forEach(el => { this.transformRotation(el, origin, rotation); @@ -121,7 +123,6 @@ export default class Responder extends Group { } if (model.textRotate) { - const origin = [textX, textY]; const rotation = -Math.PI / 180 * Number(model.textRotate); this.transformRotation(this.text, origin, rotation); } diff --git a/src/views/newMap/newMapdraft/mapoperate/responder/index.vue b/src/views/newMap/newMapdraft/mapoperate/responder/index.vue index 585314879..f08fc7692 100644 --- a/src/views/newMap/newMapdraft/mapoperate/responder/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/responder/index.vue @@ -1,13 +1,46 @@ @@ -44,8 +77,13 @@ export default { }, computed: { ...mapGetters('map', [ - 'stationList' + 'stationList', + 'sectionList', + 'responderList' ]), + filterSectionList() { + return this.sectionList.filter(el => ['01', '03'].includes(el.type)); + }, responderTypeList() { return ConstConfig.ConstSelect.responderTypeList; } @@ -76,15 +114,23 @@ export default { this.activeName = 'first'; this.$refs.respModel.setModel(selected); } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelSectionCode'.toUpperCase()) { - this.$refs.respCreate.setModel(selected); - this.activeName = 'second'; - this.field = ''; - this.$emit('deviceSelect', ''); + if (['01', '03'].includes(selected.type)) { + this.$refs.respCreate.setModel(selected); + this.activeName = 'second'; + this.field = ''; + this.$emit('deviceSelect', ''); + } else { + this.$message.error('请选择物理区段'); + } } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSectionCode'.toUpperCase()) { - this.$refs.respBatch.setModel(selected); - this.activeName = 'third'; - this.field = ''; - this.$emit('deviceSelect', ''); + if (['01', '03'].includes(selected.type)) { + this.$refs.respBatch.setModel(selected); + this.activeName = 'third'; + this.field = ''; + this.$emit('deviceSelect', ''); + } else { + this.$message.error('请选择物理区段'); + } } else if (!selected) { this.$emit('deviceSelect', ''); } diff --git a/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue b/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue index 8edf1bc24..4fe749514 100644 --- a/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue +++ b/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue @@ -53,7 +53,6 @@