From 3510548b7ba9d23f96f214c513abe5f88fa0e3b2 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Thu, 5 Mar 2020 14:33:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=9B=86=E4=B8=AD=E7=AB=99?= =?UTF-8?q?=E6=8C=87=E7=A4=BA=E7=81=AF=E7=8A=B6=E6=80=81=EF=BC=8C=E7=BB=98?= =?UTF-8?q?=E5=9B=BE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/ningbo_01.js | 8 +- src/jmapNew/shape/Automactic/index.js | 1 - src/jmapNew/shape/Station/ESingleControl.js | 14 +++- src/jmapNew/shape/Station/index.js | 15 +++- src/jmapNew/shape/StationControl/index.js | 78 +++++++++++-------- .../ningbo_01/menus/dialog/stationControl.vue | 5 +- .../ningbo_01/menus/menuStationControl.vue | 2 - 7 files changed, 79 insertions(+), 44 deletions(-) diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index d149841c1..2cdf784ab 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -321,7 +321,7 @@ class SkinCode extends defaultStyle { }, StationControl: { text: { - distance: 2, // 灯和文字之间的距离 + distance: 12, // 灯和文字之间的距离 fontSize: 12, // 字体大小 fontFormat: 'consolas', // 字体格式 fontColor: '#ffffff', // 字体颜色 @@ -339,7 +339,7 @@ class SkinCode extends defaultStyle { lamp: { count: 4, // 控制模式的个数 offset: { x: 20, y: 0 }, // 偏移量 - radiusR: 4, // 控制模式灯的半径 + radiusR: 5, // 控制模式灯的半径 distance: 46, // 控制模式之间灯之间的距离 grayColor: '#C0C0C0', // 控制模式灰色 greenColor: 'green', // 控制模式绿色 @@ -349,7 +349,9 @@ class SkinCode extends defaultStyle { centerControlShow: true, // 中控显示 substationControlShow: true, // 站控按钮显示 interconnectedControlShow: false, // 联锁控显示 - centerControlButtonShow: true // 中控显示 + centerControlButtonShow: true, // 中控显示 + stroke: '#FFFFFF', // 框的颜色 + fill: 'rgba(0,0,0,0)', // 填充色 }, arrow: { show: false // 控制模式箭头显隐 diff --git a/src/jmapNew/shape/Automactic/index.js b/src/jmapNew/shape/Automactic/index.js index 3e747688d..03a10015e 100644 --- a/src/jmapNew/shape/Automactic/index.js +++ b/src/jmapNew/shape/Automactic/index.js @@ -4,7 +4,6 @@ import Group from 'zrender/src/container/Group'; import Arc from 'zrender/src/graphic/shape/Arc'; import Text from 'zrender/src/graphic/Text'; -import { createBoundingRect } from '../../utils/parser'; import Rect from 'zrender/src/graphic/shape/Rect'; import EMouse from './EMouse'; diff --git a/src/jmapNew/shape/Station/ESingleControl.js b/src/jmapNew/shape/Station/ESingleControl.js index 2f1f8e2c0..1206cb4a3 100644 --- a/src/jmapNew/shape/Station/ESingleControl.js +++ b/src/jmapNew/shape/Station/ESingleControl.js @@ -36,7 +36,7 @@ export default class ESingleControl extends Group { r: model.style.Station.StationControl.lamp.radiusR }, style: { - lineWidth: 0.5, + lineWidth: 0, fill: model.style.Station.StationControl.lamp.grayColor, stroke: model.style.Station.StationControl.lamp.grayColor } @@ -70,4 +70,16 @@ export default class ESingleControl extends Group { this.control.setStyle('fill', color); } } + + getArcBoundingRect() { + const rect = this.control.getBoundingRect().clone(); + const scale = this.control.scale[0]; + const offsetX = this.control.position[0]; + const offsetY = this.control.position[1]; + rect.x = rect.x * scale + offsetX - 2; + rect.y = rect.y * scale + offsetY - 2; + rect.width = rect.width * scale + 4; + rect.height = rect.height * scale + 4; + return rect; + } } diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index da5e0862f..ddb210d21 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -8,6 +8,7 @@ import EMouse from './EMouse'; import ESingleControl from './ESingleControl'; import EArrow from './EArrow'; import { arrow } from '../utils/ShapePoints'; +import Rect from 'zrender/src/graphic/shape/Rect'; import BoundingRect from 'zrender/src/core/BoundingRect'; export default class Station extends Group { @@ -208,7 +209,6 @@ export default class Station extends Group { x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x, y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y }, - // context: model.lskContent || '联锁控', context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控', pop: false }); @@ -247,6 +247,19 @@ export default class Station extends Group { pop: false }); this.add(this.centerControlButton); + const arcRect = this.centerControlButton.getArcBoundingRect(); + this.arcBorder = new Rect({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: arcRect, + style: { + lineDash: null, + stroke: this.style.Station.StationControl.lamp.stroke, + fill: this.style.Station.StationControl.lamp.fill + } + }); + this.add(this.arcBorder); } } diff --git a/src/jmapNew/shape/StationControl/index.js b/src/jmapNew/shape/StationControl/index.js index b3c32b3fd..087037322 100644 --- a/src/jmapNew/shape/StationControl/index.js +++ b/src/jmapNew/shape/StationControl/index.js @@ -26,75 +26,75 @@ export default class StationControl extends Group { create() { const model = this.model; // 紧急站控 - if (this.style.StationControl.lamp.emergencyControlShow) { + if (this.style.Station.StationControl.lamp.emergencyControlShow) { this.emergencyControl = new ESingleControl({ _subType: 'emergency', style: this.style, zlevel: this.zlevel, z: this.z, point: { - x: model.position.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y + x: model.position.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x, + y: model.position.y + this.style.Station.StationControl.lamp.offset.y }, - context: this.style.StationControl.text.emergencyControlText, + context: this.style.Station.StationControl.text.emergencyControlText, // model.jjzkContent, pop: false }); this.add(this.emergencyControl); } // 中控按钮 - if (this.style.StationControl.lamp.centerControlShow) { + if (this.style.Station.StationControl.lamp.centerControlShow) { this.centerControl = new ESingleControl({ _subType: 'center', style: this.style, zlevel: this.zlevel, z: this.z, point: { - x: model.position.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y + x: model.position.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x, + y: model.position.y + this.style.Station.StationControl.lamp.offset.y }, - context: this.style.StationControl.text.centerControlText, + context: this.style.Station.StationControl.text.centerControlText, // model.zokContent, pop: false }); this.add(this.centerControl); } // 站控按钮 - if (this.style.StationControl.lamp.substationControlShow) { + if (this.style.Station.StationControl.lamp.substationControlShow) { this.substationControl = new ESingleControl({ _subType: 'substation', style: this.style, zlevel: this.zlevel, z: this.z, point: { - x: model.position.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y + x: model.position.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.lamp.offset.x, + y: model.position.y + this.style.Station.StationControl.lamp.offset.y }, - context: this.style.StationControl.text.substationControlText, + context: this.style.Station.StationControl.text.substationControlText, // model.zakContent pop: false }); this.add(this.substationControl); } // 联锁控 - if (this.style.StationControl.lamp.interconnectedControlShow) { + if (this.style.Station.StationControl.lamp.interconnectedControlShow) { this.interconnectedControl = new ESingleControl({ _subType: 'interconnected', style: this.style, zlevel: this.zlevel, z: this.z, point: { - x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.offset.y + x: model.position.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x, + y: model.position.y + this.style.Station.StationControl.lamp.offset.y }, - context: this.style.StationControl.text.interconnectedControlText || '联锁控', + context: this.style.Station.StationControl.text.interconnectedControlText || '联锁控', pop: false }); this.add(this.interconnectedControl); } // 箭头 - if (this.style.StationControl.arrow.show) { - const point = arrow(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8); + if (this.style.Station.StationControl.arrow.show) { + const point = arrow(this.model.position.x, this.model.position.y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8); this.arrowsControl = new EArrow({ zlevel: this.zlevel, z: this.z, @@ -102,9 +102,9 @@ export default class StationControl extends Group { count: this.count, drict: 1, point: point, - x: model.position.x + this.style.StationControl.lamp.offset.x, - y: model.position.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y, - fill: this.style.StationControl.lamp.grayColor, + x: model.position.x + this.style.Station.StationControl.lamp.offset.x, + y: model.position.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y, + fill: this.style.Station.StationControl.lamp.grayColor, lineWidth: 1, stroke: this.style.sidelineColor }); @@ -116,28 +116,40 @@ export default class StationControl extends Group { setState(model) { // switch (model.status) { // case '00': // 无状态 - // this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); - // this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); - // this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); + // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); + // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); + // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); // break; // case '01': // 中控 - // this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); - // this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); - // this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor); + // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); + // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); + // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor); // break; // case '02': // 站控 - // this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor); - // this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor); - // this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); + // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); + // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor); + // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); // break; // case '03': // 紧急站控 - // this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor); - // this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor); - // this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor); + // this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor); + // this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); + // this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); // break; // } } + getArcBoundingRect(view) { + const rect = view.getBoundingRect().clone(); + const scale = view.scale[0]; + const offsetX = view.position[0]; + const offsetY = view.position[1]; + rect.x = rect.x * scale + offsetX - 2; + rect.y = rect.y * scale + offsetY - 2; + rect.width = rect.width * scale + 4; + rect.height = rect.height * scale + 4; + return rect; + } + /** 按钮是否按下*/ isPop(e) { for (var i = 0; i < this.childCount(); i++) { diff --git a/src/jmapNew/theme/ningbo_01/menus/dialog/stationControl.vue b/src/jmapNew/theme/ningbo_01/menus/dialog/stationControl.vue index 3b466a561..b4ce94a54 100644 --- a/src/jmapNew/theme/ningbo_01/menus/dialog/stationControl.vue +++ b/src/jmapNew/theme/ningbo_01/menus/dialog/stationControl.vue @@ -221,7 +221,6 @@ export default { operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL; operate.operation = OperationEvent.StationControl.requestStationControl.menu.operation; } - console.log(operate); this.loading = true; this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { @@ -229,10 +228,10 @@ export default { if (valid) { this.doClose(); } - }).catch(() => { + }).catch((error) => { this.loading = false; this.doClose(); - this.$refs.noticeInfo.doShow(operate); + this.$refs.noticeInfo.doShow(operate, error.message); }); } }, diff --git a/src/jmapNew/theme/ningbo_01/menus/menuStationControl.vue b/src/jmapNew/theme/ningbo_01/menus/menuStationControl.vue index 14d9f99c2..e139e138f 100644 --- a/src/jmapNew/theme/ningbo_01/menus/menuStationControl.vue +++ b/src/jmapNew/theme/ningbo_01/menus/menuStationControl.vue @@ -116,7 +116,6 @@ export default { start: true, code: this.selected.code, operation: OperationEvent.StationControl.requestCentralControl.menu.operation, - // cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL, param: { stationControlCode: this.selected.code } @@ -133,7 +132,6 @@ export default { start: true, code: this.selected.code, operation: OperationEvent.StationControl.requestStationControl.menu.operation, - // cmdType: CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_STATION_CONTROL, param: { stationControlCode: this.selected.code }