From 145259d3b5d410f5a2843dda3f50f61016bb5519 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Tue, 19 Jan 2021 11:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A0=E8=BE=93=E4=BF=A1=E5=8F=B7=E6=9C=BA?= =?UTF-8?q?=20&&=20=E4=BD=9B=E5=B1=B1=E8=BF=9B=E8=B7=AF=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/nanjing_02.js | 4 + src/jmapNew/shape/Signal/index.js | 86 +++++++++++++++---- .../dataRelation/routeoperate/detail.vue | 2 +- .../newMapdraft/mapoperate/config/list.vue | 1 + .../newMap/newMapdraft/mapoperate/models.js | 1 + .../newMapdraft/mapoperate/signal/index.vue | 23 ++++- 6 files changed, 97 insertions(+), 20 deletions(-) diff --git a/src/jmapNew/config/skinCode/nanjing_02.js b/src/jmapNew/config/skinCode/nanjing_02.js index ad780d94b..11ed972d2 100644 --- a/src/jmapNew/config/skinCode/nanjing_02.js +++ b/src/jmapNew/config/skinCode/nanjing_02.js @@ -252,6 +252,10 @@ class SkinCode extends defaultStyle { }, lowButton:{ display: false // 现地 信号机按钮 + }, + transmission: { // 传输信号机 + fillColor: '#f00', + sideLength: 20 } }; diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index 2953d1e7e..6c4a026b7 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -41,7 +41,11 @@ class Signal extends Group { }; } this.cbtcStatus = ''; - this.create(); + if (model.type === 'TRANSMISSION') { + this.createTransmission(); + } else { + this.create(); + } this.createMouseEvent(); this.checkIsDrawMap(); this.transformRotation(this); @@ -314,7 +318,51 @@ class Signal extends Group { this.lamps.forEach(lamp => { this.add(lamp); }); } } - + createTransmission() { + const model = this.model; + const style = this.style; + const drict = this.model.right ? 1 : -1; // 朝向 左:右 + const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下 + // 信号机名称 + const sigNameX = model.position.x + model.positionPoint.x + drict * 0.433 * style.Signal.transmission.sideLength + model.namePosition.x; + const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance); + const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.right ? 'left' : 'right'; + const textVerticalAlign = posit == 1 ? 'top' : 'bottom'; + this.sigName = new ESigName({ + zlevel: this.zlevel, + z: this.z, + silent: false, + style: style, + x: sigNameX, + y: sigNameY, + text: model.name, + fontWeight: style.Signal.text.fontWeight, + fontSize: style.Signal.text.fontSize, + fontFamily: style.fontFamily, + textFill: style.Signal.text.defaultColor, + textAlign: textAlign, + textVerticalAlign: textVerticalAlign + }); + if (style.Signal.transmission) { + const sigPostY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR); + this.transmission = new Polygon({ + zlevel: this.zlevel, + z: this.z, + shape: { + points: [ + [model.position.x + model.positionPoint.x, sigPostY + style.Signal.transmission.sideLength / 2], + [model.position.x + model.positionPoint.x, sigPostY - style.Signal.transmission.sideLength / 2], + [model.position.x + model.positionPoint.x + drict * 0.866 * style.Signal.transmission.sideLength, sigPostY] + ] + }, + style: { + fill: style.Signal.transmission.fillColor + } + }); + this.add(this.transmission); + } + this.add(this.sigName); + } createMouseEvent() { if (this.style.Signal.mouseOverStyle) { this.mouseEvent = new EMouse(this); @@ -635,37 +683,37 @@ class Signal extends Group { } // 恢复状态 recover() { - this.lamps.forEach(item=> { item.show(); }); + this.lamps && this.lamps.forEach(item=> { item.show(); }); this.sigName.setStyle({ textBorderWidth: 0 }); this.sigName.setColor(this.style.Signal.text.defaultColor); - this.remainTImeName.hide(); - this.sigDelay.hide(); + this.remainTImeName && this.remainTImeName.hide(); + this.sigDelay && this.sigDelay.hide(); if (this.style.Signal.auto.autoTriggerType != 'text') { this.setAutoClose(); - this.sigAuto.animationRecover(); + this.sigAuto && this.sigAuto.animationRecover(); } - this.sigRoute.hide(); + this.sigRoute && this.sigRoute.hide(); this.sigBack && this.sigBack.hide(); - this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 + this.sigPost && this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 if (this.style.Signal.lamp.guidName === 'singleRY') { - this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); + this.lamps && this.lamps[0] && this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); } if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') { - this.lamps[1].hide(); + this.lamps && this.lamps[1] && this.lamps[1].hide(); } if (this.style.Signal.lamp.faultType == 'flash') { - this.lamps[0].faultHide(); + this.lamps && this.lamps[0] && this.lamps[0].faultHide(); } else if (this.style.Signal.lamp.faultType == 'cross') { - this.lamps[0].setFault2Corss(false); + this.lamps && this.lamps[0] && this.lamps[0].setFault2Corss(false); } else if (this.style.Signal.lamp.faultType == 'watch') { const device = findDeviceByModelDepType(this.model, deviceType.LampFilament, 'stationCode'); if (device && device.instance) { device.instance.setControlColor('#9F9C9C'); } } else if (this.style.Signal.lamp.faultType == 'light') { - this.lamps[0].setAnimationEnd(); + this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd(); } this.insideTriangle && this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.strokeColor}); @@ -675,12 +723,12 @@ class Signal extends Group { this.ciConfirm && this.ciConfirm.hide(); this.sigBack && this.sigBack.hide(); this.sigBack && this.sigBack.stopAnimation(false); - this.lamps && this.lamps[0].setAnimationEnd(); + this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd(); this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor); } setState(model) { - if (!this.isShowShape) return; + if (!this.isShowShape || this.model.type === 'TRANSMISSION') return; const path = window.location.href; this.recover(); @@ -770,10 +818,14 @@ class Signal extends Group { } getBoundingRect() { - const rect = this.sigPost.getBoundingRect().clone(); - if (this.insideTriangle) { + let rect = ''; + if (this.model.type === 'TRANSMISSION') { + rect = this.transmission.getBoundingRect().clone(); + } else if (this.insideTriangle) { + rect = this.sigPost.getBoundingRect().clone(); rect.union(this.insideTriangle.getBoundingRect().clone()); } else { + rect = this.sigPost.getBoundingRect().clone(); this.lamps.forEach(elem => { rect.union(elem.getBoundingRect().clone()); }); diff --git a/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue b/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue index 5ab3d23fd..6cf630305 100644 --- a/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue +++ b/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue @@ -151,7 +151,7 @@ export default { { name: this.$t('map.preview'), handleClick: this.flankProtectionSwitchDetail, - showControl: (row) => { return row.routeFlankProtectionList.length > 0; } + showControl: (row) => { return row.routeFlankProtectionList && row.routeFlankProtectionList.length > 0; } } ] }, diff --git a/src/views/newMap/newMapdraft/mapoperate/config/list.vue b/src/views/newMap/newMapdraft/mapoperate/config/list.vue index 2b08ef1e9..fd52cf13e 100644 --- a/src/views/newMap/newMapdraft/mapoperate/config/list.vue +++ b/src/views/newMap/newMapdraft/mapoperate/config/list.vue @@ -51,6 +51,7 @@ :placeholder="item.placeholder" :disabled="item.disabled" :clearable="item.clearable" + @change="((val)=>{deviceChange(val, item)})" >