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 @@