From c971cf32f83765025ae22f5b4ea7a6160c06470d Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 4 Dec 2019 15:49:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/newMap/newMapdraft/mapoperate/station.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/newMap/newMapdraft/mapoperate/station.vue b/src/views/newMap/newMapdraft/mapoperate/station.vue index 9c2b25fd0..6276ab213 100644 --- a/src/views/newMap/newMapdraft/mapoperate/station.vue +++ b/src/views/newMap/newMapdraft/mapoperate/station.vue @@ -44,7 +44,7 @@
- 111 +
@@ -143,6 +143,14 @@ export default { addModel: { sectionCode: '' }, + controlModel:{ + code: '', + name: '', + position: { + x: 0, + y: 0 + }, + }, pullBackModel: { code: '', position: { x: 0, y: 0 } @@ -198,7 +206,7 @@ export default { { prop: 'chargeStationCodeList', label: this.$t('map.chargeStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.chargeStation, isHidden: !this.isZcCode, deviceChange:this.changeChargeStation}, { prop: 'runPlanName', label: this.$t('map.stationRunPlanName'), type: 'input' }, { prop: 'isCreateControlMode', label: '是否创建控制模式', type: 'checkbox' }, - { prop: 'isCreateCounter', label: '是否创建计数器', type: 'checkbox' }, + // { prop: 'isCreateCounter', label: '是否创建计数器', type: 'checkbox' }, { prop: 'isCreateDelayedUnlock', label: '是否创建延迟解锁', type: 'checkbox' }, { prop: 'isCreateTurnBack', label: '是否创建按图折返', type: 'checkbox' } ] From 22bc27293fe926fa5b34b01fe5515a2991df475b Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Wed, 4 Dec 2019 18:39:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/defaultStyle.js | 172 +++++----- src/jmapNew/config/skinCode/bejing_01.js | 19 +- src/jmapNew/config/skinCode/chengdu_03.js | 31 +- src/jmapNew/config/skinCode/chengdu_04.js | 19 +- src/jmapNew/config/skinCode/fuzhou_01.js | 11 +- src/jmapNew/constant/deviceType.js | 1 - src/jmapNew/shape/ButtonControl/index.js | 67 ---- src/jmapNew/shape/Station/EturnBack.js | 26 -- src/jmapNew/shape/Station/index.js | 62 ++-- src/jmapNew/shape/element/EControl.js | 190 +++++------ src/jmapNew/shape/factory.js | 2 - src/jmapNew/utils/parser.js | 5 - src/views/mapsystem/plugin/src/poptip.vue | 162 ++++----- src/views/mapsystem/plugin/trainingtip.vue | 318 +++++++++--------- .../newMap/newMapdraft/mapoperate/station.vue | 115 +------ 15 files changed, 526 insertions(+), 674 deletions(-) delete mode 100644 src/jmapNew/shape/ButtonControl/index.js delete mode 100644 src/jmapNew/shape/Station/EturnBack.js diff --git a/src/jmapNew/config/defaultStyle.js b/src/jmapNew/config/defaultStyle.js index f2dc9428e..d20fc5a23 100644 --- a/src/jmapNew/config/defaultStyle.js +++ b/src/jmapNew/config/defaultStyle.js @@ -1,124 +1,124 @@ export default class defaultStyle { - constructor() { - /** 透明填充 颜色*/ - this.transparentColor = 'rgba(0,0,0,0)'; + constructor() { + /** 透明填充 颜色*/ + this.transparentColor = 'rgba(0,0,0,0)'; - /** 默认背景 颜色*/ - this.backgroundColor = '#000000'; + /** 默认背景 颜色*/ + this.backgroundColor = '#000000'; - /** 默认提示背景 颜色*/ - this.tipBackgroundColor = 'yellow'; + /** 默认提示背景 颜色*/ + this.tipBackgroundColor = 'yellow'; - /** 默认边线 颜色*/ - this.sidelineColor = '#FFFFFF'; + /** 默认边线 颜色*/ + this.sidelineColor = '#FFFFFF'; - /** 默认字体 大小*/ - this.textFontSize = 10; + /** 默认字体 大小*/ + this.textFontSize = 10; - /** 默认字体 族类*/ - this.fontFamily = '宋体'; + /** 默认字体 族类*/ + this.fontFamily = '宋体'; - /** 默认字体颜色*/ - this.textFontColor = '#C0C0C0'; + /** 默认字体颜色*/ + this.textFontColor = '#C0C0C0'; - /** 默认提示字体大小*/ - this.arrowFontSize = 10; + /** 默认提示字体大小*/ + this.arrowFontSize = 10; - /** 列车长度*/ - this.trainWidth = 40; + /** 列车长度*/ + this.trainWidth = 40; - /** 列车高度*/ - this.trainHeight = 20; + /** 列车高度*/ + this.trainHeight = 20; - /** 列车字号*/ - this.trainTextFontSize = 12; + /** 列车字号*/ + this.trainTextFontSize = 12; - /** 列车HDSA字号*/ - this.trainHSDATextFontSize = 9; + /** 列车HDSA字号*/ + this.trainHSDATextFontSize = 9; - /** 列车信号的半径*/ - this.trainConflictR = 3; + /** 列车信号的半径*/ + this.trainConflictR = 3; - /** 列车信号距离车的距离*/ - this.trainConflictDistance = 5; + /** 列车信号距离车的距离*/ + this.trainConflictDistance = 5; - /** 列车车头比车身高出的长度;上下相比车体伸出去的边框*/ - this.trainMoreLength = 0; + /** 列车车头比车身高出的长度;上下相比车体伸出去的边框*/ + this.trainMoreLength = 0; - /** 列车和车头之间的间距*/ - this.trainHeadDistance = 4; + /** 列车和车头之间的间距*/ + this.trainHeadDistance = 4; - /** 列车竖杠的宽度*/ - this.trainConntWidth = 3; + /** 列车竖杠的宽度*/ + this.trainConntWidth = 3; - /** 列车竖杠和方向之间的间隔*/ - this.trainPadding = 4; + /** 列车竖杠和方向之间的间隔*/ + this.trainPadding = 4; - /** 列车方向的宽度*/ - this.trainArrowWidth = 6; + /** 列车方向的宽度*/ + this.trainArrowWidth = 6; - /** 列车和区段之间的距离*/ - this.trainDistance = 30; + /** 列车和区段之间的距离*/ + this.trainDistance = 30; - /** 列车边线颜色*/ - this.trainSidelineColor = '#C0C0C0'; + /** 列车边线颜色*/ + this.trainSidelineColor = '#C0C0C0'; - /** 列车背景*/ - this.trainBackground = '#000000'; + /** 列车背景*/ + this.trainBackground = '#000000'; - /** 列车 灰色*/ - this.trainGrayColor = '#C0C0C0'; + /** 列车 灰色*/ + this.trainGrayColor = '#C0C0C0'; - /** 列车 白色*/ - this.trainWitheColor = '#FFFFFF'; + /** 列车 白色*/ + this.trainWitheColor = '#FFFFFF'; - /** 列车 棕色*/ - this.trainBrownColor = '#A0522D'; + /** 列车 棕色*/ + this.trainBrownColor = '#A0522D'; - /** 列车 黄色*/ - this.trainYellowColor = '#FFFF00'; + /** 列车 黄色*/ + this.trainYellowColor = '#FFFF00'; - /** 列车 棕灰色 */ - this.trainBrown1Color = '#725A64'; + /** 列车 棕灰色 */ + this.trainBrown1Color = '#725A64'; - /** 列车 绿色*/ - this.trainGreenColor = '#00FF00'; + /** 列车 绿色*/ + this.trainGreenColor = '#00FF00'; - /** 列车 蓝色*/ - this.trainBlueColor = '#3265FF'; + /** 列车 蓝色*/ + this.trainBlueColor = '#3265FF'; - /** 列车 红色*/ - this.trainRedColor = '#FF0000'; + /** 列车 红色*/ + this.trainRedColor = '#FF0000'; - /** 列车 橘色*/ - this.trainOrangeColor = 'orange'; + /** 列车 橘色*/ + this.trainOrangeColor = 'orange'; - /** 列车 紫色*/ - this.trainPurpleColor = 'purple'; + /** 列车 紫色*/ + this.trainPurpleColor = 'purple'; - /** 列车 粉色*/ - this.trainPinkColor = 'pink'; + /** 列车 粉色*/ + this.trainPinkColor = 'pink'; - /** 车次窗高度*/ - this.trainWindowWidth = 40; + /** 车次窗高度*/ + this.trainWindowWidth = 40; - /** 车次窗高度*/ - this.trainWindowHeight = 15; + /** 车次窗高度*/ + this.trainWindowHeight = 15; - /** 列车文字颜色*/ - this.trainTextColor = '#ffffff'; + /** 列车文字颜色*/ + this.trainTextColor = '#ffffff'; - /** 灯包围框样式 */ - this.arcBorderStyle = { - lineDash: [3, 3], - stroke: '#FFFFFF', - fill: 'rgba(0,0,0,0)' - }; - /** 字体包围框样式 */ - this.textBorderStyle={ - lineDash: [3, 3], - stroke: '#FFFFFF', - fill: '#00FFFF' - }; - } + /** 灯包围框样式 */ + this.arcBorderStyle = { + lineDash: [3, 3], + stroke: '#FFFFFF', + fill: 'rgba(0,0,0,0)' + }; + /** 字体包围框样式 */ + this.textBorderStyle = { + lineDash: [3, 3], + stroke: '#FFFFFF', + fill: '#00FFFF' + }; + } } diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index ff767c7a9..38471b6e2 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -270,10 +270,10 @@ class SkinCode extends defaultStyle { fontWeight: 'normal', // 控制模式字体粗细 textAlign: 'middle', // 控制模式水平对齐 textVerticalAlign: 'top', // 控制模式垂直对齐 - centerControlText: '中控', // 中控文字内容 - substationControlText: '站控', // 站控文字内容 - emergencyControlText:'紧急站控', // 紧急站控文字内容 - interconnectedControlText:'连锁控' // 连锁控文字内容 + centerControlText: '中控', // 中控文字内容 + substationControlText: '站控', // 站控文字内容 + emergencyControlText:'紧急站控', // 紧急站控文字内容 + interconnectedControlText:'连锁控' // 连锁控文字内容 // stationCenterControlText: '站中控', // 站中控文字内容 // generalAlarmControlText: '总报警' // 总报警文字内容 }, @@ -326,7 +326,16 @@ class SkinCode extends defaultStyle { // }, kmPostShow: true, // 公里标显示 kilometerPosition: 'down', // 公里标位置 - fontWeight: 'bold' // 文字错细 + fontWeight: 'bold', // 文字错细 + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 控制灯大小 + controlColor: '#FFFF00' // 控制灯颜色 + } }; this[deviceType.Switch] = { diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 1feb95dd4..858dfb588 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -274,10 +274,10 @@ class SkinCode extends defaultStyle { fontWeight: 'normal', // 字体粗细 textAlign: 'middle', // 字体水平对齐 textVerticalAlign: 'top', // 字体垂直对齐 - centerControlText: '中控', // 中控文字内容 - substationControlText: '站控', // 站控文字内容 - emergencyControlText:'紧急站控', // 紧急站控文字内容 - interconnectedControlText:'连锁控' // 连锁控文字内容 + centerControlText: '中控', // 中控文字内容 + substationControlText: '站控', // 站控文字内容 + emergencyControlText:'紧急站控', // 紧急站控文字内容 + interconnectedControlText:'连锁控' // 连锁控文字内容 // stationCenterControlText: '站中控', // 站中控文字内容 // generalAlarmControlText: '总报警' // 总报警文字内容 }, @@ -321,7 +321,16 @@ class SkinCode extends defaultStyle { // show: true // 公里标名称显示 // }, kmPostShow: false, // 公里标显示 - kilometerPosition: 'up' // 公里标朝向 + kilometerPosition: 'up', // 公里标朝向 + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 控制灯大小 + controlColor: '#FFFF00' // 控制灯颜色 + } }; this[deviceType.Switch] = { @@ -391,18 +400,6 @@ class SkinCode extends defaultStyle { } }; - this[deviceType.ButtonControl] = { - text: { - fontSize: 11, // 字体大小 - fontWeight: 'normal', // 字体粗细 - distance: 5 // 灯跟文字距离 - }, - lamp: { - radiusR: 6, // 控制灯大小 - controlColor: '#FFFF00' // 控制灯颜色 - } - }; - this[deviceType.Line] = { lineColor: '#FFFFFF' // 线条颜色 }; diff --git a/src/jmapNew/config/skinCode/chengdu_04.js b/src/jmapNew/config/skinCode/chengdu_04.js index ac2ea1ca6..91b119cb4 100644 --- a/src/jmapNew/config/skinCode/chengdu_04.js +++ b/src/jmapNew/config/skinCode/chengdu_04.js @@ -271,10 +271,10 @@ class SkinCode extends defaultStyle { fontWeight: 'normal', // 字体粗细 textAlign: 'middle', // 字体水平对齐 textVerticalAlign: 'top', // 字体垂直对齐 - centerControlText: '中控', // 中控文字内容 - substationControlText: '站控', // 站控文字内容 - emergencyControlText:'紧急站控', // 紧急站控文字内容 - interconnectedControlText:'连锁控' // 连锁控文字内容 + centerControlText: '中控', // 中控文字内容 + substationControlText: '站控', // 站控文字内容 + emergencyControlText:'紧急站控', // 紧急站控文字内容 + interconnectedControlText:'连锁控' // 连锁控文字内容 // stationCenterControlText: '站中控', // 站中控文字内容 // generalAlarmControlText: '总报警' // 总报警文字内容 }, @@ -318,7 +318,16 @@ class SkinCode extends defaultStyle { // show: true // 公里标名称显示 // }, kmPostShow: false, // 公里标显示 - kilometerPosition: 'up' // 公里标朝向 + kilometerPosition: 'up', // 公里标朝向 + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 控制灯大小 + controlColor: '#FFFF00' // 控制灯颜色 + } }; this[deviceType.Switch] = { diff --git a/src/jmapNew/config/skinCode/fuzhou_01.js b/src/jmapNew/config/skinCode/fuzhou_01.js index 7ffc022ec..fcc1d1953 100644 --- a/src/jmapNew/config/skinCode/fuzhou_01.js +++ b/src/jmapNew/config/skinCode/fuzhou_01.js @@ -308,7 +308,16 @@ class SkinCode extends defaultStyle { // show: true // 公里标名称显示 // }, kmPostShow: true, // 公里标显示 - kilometerPosition: 'up' // 公里标朝向 + kilometerPosition: 'up', // 公里标朝向 + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 控制灯大小 + controlColor: '#FFFF00' // 控制灯颜色 + } }; this[deviceType.Switch] = { diff --git a/src/jmapNew/constant/deviceType.js b/src/jmapNew/constant/deviceType.js index 9ecbe5129..080cd22f3 100644 --- a/src/jmapNew/constant/deviceType.js +++ b/src/jmapNew/constant/deviceType.js @@ -11,7 +11,6 @@ const deviceType = { StationStand: 'StationStand', StationControl: 'StationControl', StationCounter: 'StationCounter', - ButtonControl: 'ButtonControl', StationDelayUnlock: 'StationDelayUnlock', Train: 'Train', TrainWindow: 'TrainWindow', diff --git a/src/jmapNew/shape/ButtonControl/index.js b/src/jmapNew/shape/ButtonControl/index.js deleted file mode 100644 index 29e2887d4..000000000 --- a/src/jmapNew/shape/ButtonControl/index.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -* lC区域控制模式 -*/ -import Group from 'zrender/src/container/Group'; -import EControl from '../element/EControl'; - -export default class ButtonControl extends Group { - constructor(model, style) { - super(); - this.z = 20; - this._code = model.code; - this._type = model._type; - this.zlevel = 10; - this.model = model; - this.style = style; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - this.control = new EControl({ - zlevel: this.zlevel, - z: this.z, - arc: { - shape: { - cx: model.position.x, - cy: model.position.y, - r: this.style.ButtonControl.lamp.radiusR - }, - lineWidth: 0, - fill: this.style.ButtonControl.lamp.controlColor - }, - text: { - position: [0, 0], - x: model.position.x, - y: model.position.y + this.style.ButtonControl.lamp.radiusR + this.style.ButtonControl.text.distance, - fontWeight: this.style.ButtonControl.text.fontWeight, - fontSize: this.style.ButtonControl.text.fontSize, - fontFamily: this.style.fontFamily, - text: model.text || '按图折返', - textFill: '#fff', - textAlign: 'middle', - textVerticalAlign: 'top' - }, - style: this.style - }); - - this.add(this.control); - } - - // 设置状态 - setState(model) { - } - - getShapeTipPoint() { - if (this.control) { - var distance = 2; - var rect = this.control.getBoundingRect(); - return { - x: rect.x + rect.width / 2, - y: rect.y - distance - }; - } - return null; - } -} diff --git a/src/jmapNew/shape/Station/EturnBack.js b/src/jmapNew/shape/Station/EturnBack.js deleted file mode 100644 index 9fcec07bb..000000000 --- a/src/jmapNew/shape/Station/EturnBack.js +++ /dev/null @@ -1,26 +0,0 @@ -// import Group from 'zrender/src/container/Group'; -import Text from 'zrender/src/graphic/Text'; - -/** 名称元素*/ -export default function ETextName(model) { - const TextName = new Text({ - _subType: 'Text', - zlevel: model.zlevel, - z: model.z, - silent: model.silent || false, - style: { - x: model.x, - y: model.y, - fontWeight: model.fontWeight, - fontSize: model.fontSize, - fontFamily: model.fontFamily, - text: model.text, - textStrokeWidth: model.textStrokeWidth, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - return TextName; -} diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index 1a175b2cd..e3536c1f6 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -3,8 +3,8 @@ */ import Group from 'zrender/src/container/Group'; import ETextName from '../element/ETextName'; -import EHighlight from '../element/EHighlight'; // 名称文字 (共有) -import EturnBack from './EturnBack'; +// import EHighlight from '../element/EHighlight'; // 名称文字 (共有) +import EControl from '../element/EControl'; export default class Station extends Group { constructor(model, style) { @@ -16,9 +16,9 @@ export default class Station extends Group { this.model = model; this.style = style; this.create(); - this.createPullBack(); // 创建按图折返 + // this.createTurnBack(); // 创建按图折返 this.setState(model); - this.checkIsDrawMap(); + // this.checkIsDrawMap(); } create() { @@ -67,23 +67,35 @@ export default class Station extends Group { } } } - createPullBack() { + createTurnBack() { // 创建按图折返 const model = this.model; const style = this.style; if (model.visible && model.isCreateTurnBack) { - this.turnBack = new EturnBack({ + this.turnBack = new EControl({ zlevel: this.zlevel, z: this.z, - position: [0, 0], - x: model.position.x, - y: model.position.y, - fontWeight: model.fontWeight, - fontSize: model.kmPostFont || 18, - fontFamily: style.fontFamily, - text: model.kmPost, - textAlign: 'middle', - textVerticalAlign: 'top', - textFill: model.kmPostFontColor + arc: { + shape: { + cx: model.pullBackModel.position.x, + cy: model.pullBackModel.position.y, + r: style.Station.lamp.radiusR + }, + lineWidth: 0, + fill: style.Station.lamp.controlColor + }, + text: { + position: [0, 0], + x: model.pullBackModel.position.x, + y: model.pullBackModel.position.y + style.Station.lamp.radiusR + style.Station.text.distance, + fontWeight: style.Station.text.fontWeight, + fontSize: style.Station.text.fontSize, + fontFamily: style.fontFamily, + text: '按图折返', + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + }, + style: this.style }); this.add(this.turnBack); } @@ -100,13 +112,13 @@ export default class Station extends Group { this.highlight && this.highlight.drawSelected(selected); } - checkIsDrawMap() { - const path = window.location.href; - if (path.includes('/map/draw')) { - this.highlight = new EHighlight(this); - this.add(this.highlight); - this.on('mouseout', () => { this.highlight.mouseout(); }); - this.on('mouseover', () => { this.highlight.mouseover(); }); - } - } + // checkIsDrawMap() { + // const path = window.location.href; + // if (path.includes('/map/draw')) { + // this.highlight = new EHighlight(this); + // this.add(this.highlight); + // this.on('mouseout', () => { this.highlight.mouseout(); }); + // this.on('mouseover', () => { this.highlight.mouseover(); }); + // } + // } } diff --git a/src/jmapNew/shape/element/EControl.js b/src/jmapNew/shape/element/EControl.js index 650411dff..46e1d4334 100644 --- a/src/jmapNew/shape/element/EControl.js +++ b/src/jmapNew/shape/element/EControl.js @@ -6,101 +6,101 @@ import Rect from 'zrender/src/graphic/shape/Rect'; /** lc zc limit 单灯元素*/ export default class EControl extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this.style = model.style; - this.textStyle = model.text; - this.arcStyle = model.arc; - this.create(); - } + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.z; + this.style = model.style; + this.textStyle = model.text; + this.arcStyle = model.arc; + this.create(); + } - create() { - this.control = new Arc({ - _subType: 'Control', - zlevel: this.zlevel, - z: this.z, - shape: this.arcStyle.shape, - style: { - lineWidth: this.arcStyle.lineWidth, - fill: this.arcStyle.fill - }, - onmouseover: this.arcStyle.mouseover, - onmouseout: this.arcStyle.mouseout - }); + create() { + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: this.arcStyle.shape, + style: { + lineWidth: this.arcStyle.lineWidth, + fill: this.arcStyle.fill + }, + onmouseover: this.arcStyle.mouseover, + onmouseout: this.arcStyle.mouseout + }); - this.text = new Text({ - _subType: 'Text', - zlevel: this.zlevel, - z: this.z, - position: this.textStyle.position, - style: { - x: this.textStyle.x, - y: this.textStyle.y, - fontWeight: this.textStyle.fontWeight, - fontSize: this.textStyle.fontSize, - fontFamily: this.textStyle.fontFamily, - text: this.textStyle.text, - textFill: this.textStyle.textFill, - textAlign: this.textStyle.textAlign, - textVerticalAlign: this.textStyle.textVerticalAlign - }, - onmouseover: this.textStyle.mouseover, - onmouseout: this.textStyle.mouseout - }); - const arcRect = this.getArcBoundingRect(); - const textRect = this.getTextBoundingRect(); - this.arcBorder = new Rect({ - zlevel: this.zlevel, - z: this.z, - silent: true, - shape: arcRect, - style: { - lineDash: this.style.arcBorderStyle.lineDash, - stroke: this.style.arcBorderStyle.stroke, - fill: this.style.arcBorderStyle.fill - } - }); - this.textBorder = new Rect({ - zlevel: this.zlevel, - z: this.z-1, - silent: true, - shape: textRect, - style: { - lineDash: this.style.textBorderStyle.lineDash, - stroke: this.style.textBorderStyle.stroke, - fill: this.style.textBorderStyle.fill - } - }); - this.add(this.control); - this.add(this.text); - this.add(this.textBorder); - this.add(this.arcBorder); - this.textBorder.hide(); - this.arcBorder.hide(); - } - setTextBorder(flag) { - flag?this.textBorder.show():this.textBorder.hide(); - } - setArcBorder(flag) { - flag?this.arcBorder.show():this.arcBorder.hide(); - } - getTextBoundingRect() { - return createBoundingRect(this.text); - } - getArcBoundingRect() { - return createBoundingRect(this.control); - } - setControlColor(color) { - if (color) { - this.control.setStyle('fill', color); - } - } - setTextColor(color) { - if (color) { - this.text.setStyle('textFill', color); - } - } + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: this.textStyle.position, + style: { + x: this.textStyle.x, + y: this.textStyle.y, + fontWeight: this.textStyle.fontWeight, + fontSize: this.textStyle.fontSize, + fontFamily: this.textStyle.fontFamily, + text: this.textStyle.text, + textFill: this.textStyle.textFill, + textAlign: this.textStyle.textAlign, + textVerticalAlign: this.textStyle.textVerticalAlign + }, + onmouseover: this.textStyle.mouseover, + onmouseout: this.textStyle.mouseout + }); + const arcRect = this.getArcBoundingRect(); + const textRect = this.getTextBoundingRect(); + this.arcBorder = new Rect({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: arcRect, + style: { + lineDash: this.style.arcBorderStyle.lineDash, + stroke: this.style.arcBorderStyle.stroke, + fill: this.style.arcBorderStyle.fill + } + }); + this.textBorder = new Rect({ + zlevel: this.zlevel, + z: this.z - 1, + silent: true, + shape: textRect, + style: { + lineDash: this.style.textBorderStyle.lineDash, + stroke: this.style.textBorderStyle.stroke, + fill: this.style.textBorderStyle.fill + } + }); + this.add(this.control); + this.add(this.text); + this.add(this.textBorder); + this.add(this.arcBorder); + this.textBorder.hide(); + this.arcBorder.hide(); + } + setTextBorder(flag) { + flag ? this.textBorder.show() : this.textBorder.hide(); + } + setArcBorder(flag) { + flag ? this.arcBorder.show() : this.arcBorder.hide(); + } + getTextBoundingRect() { + return createBoundingRect(this.text); + } + getArcBoundingRect() { + return createBoundingRect(this.control); + } + setControlColor(color) { + if (color) { + this.control.setStyle('fill', color); + } + } + setTextColor(color) { + if (color) { + this.text.setStyle('textFill', color); + } + } } diff --git a/src/jmapNew/shape/factory.js b/src/jmapNew/shape/factory.js index a19e73986..7388af681 100644 --- a/src/jmapNew/shape/factory.js +++ b/src/jmapNew/shape/factory.js @@ -9,7 +9,6 @@ import LcControl from './LcControl/index.js'; import LimitControl from './LimitControl/index.js'; import Switch from './Switch/index.js'; import ZcControl from './ZcControl/index.js'; -import ButtonControl from './ButtonControl/index.js'; import StationCounter from './StationCounter/index.js'; import StationDelayUnlock from './StationDelayUnlock/index.js'; import StationStand from './StationStand/index.js'; @@ -31,7 +30,6 @@ mapShape[deviceType.LcControl] = LcControl; mapShape[deviceType.LimitControl] = LimitControl; mapShape[deviceType.Switch] = Switch; mapShape[deviceType.ZcControl] = ZcControl; -mapShape[deviceType.ButtonControl] = ButtonControl; mapShape[deviceType.StationCounter] = StationCounter; mapShape[deviceType.StationDelayUnlock] = StationDelayUnlock; mapShape[deviceType.StationStand] = StationStand; diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index b90528d1c..6916fe725 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -87,10 +87,6 @@ export function parser(data, skinCode) { mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert); }, this); - zrUtil.each(data.buttonList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert); - }, this); - zrUtil.each(data.lcList || [], elem => { mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert); }, this); @@ -198,7 +194,6 @@ export function updateMapData(state, model) { case deviceType.ZcControl: updateForList(model, state, 'zcControlList'); break; case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break; case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break; - case deviceType.ButtonControl: updateForList(model, state, 'buttonList'); break; case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break; case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break; case deviceType.Train: updateForList(model, state, 'trainList'); break; diff --git a/src/views/mapsystem/plugin/src/poptip.vue b/src/views/mapsystem/plugin/src/poptip.vue index 56808d623..0e0ee61ff 100644 --- a/src/views/mapsystem/plugin/src/poptip.vue +++ b/src/views/mapsystem/plugin/src/poptip.vue @@ -10,90 +10,90 @@ diff --git a/src/views/mapsystem/plugin/trainingtip.vue b/src/views/mapsystem/plugin/trainingtip.vue index 9bc078a5a..a1235af78 100644 --- a/src/views/mapsystem/plugin/trainingtip.vue +++ b/src/views/mapsystem/plugin/trainingtip.vue @@ -11,171 +11,171 @@ import { getDeviceTypeByDic, getDomIdByOperation } from '@/scripts/ConstDic'; import { getDomOffset } from '@/utils/index'; export default { - name: 'TrainingTips', - components: { PopTip }, - data() { - return { - tipShow: false, - popShow: false, - position: { - x: 0, - y: 0 - }, - tip: '' - }; - }, - computed: { - ...mapGetters([ - 'canvasWidth', - 'canvasHeight' - ]) - }, - watch: { - '$store.state.training.tipEvent': function (val) { - this.tipInit(); - } - }, - methods: { - tipInit() { - this.$nextTick(() => { - this.$store.dispatch('training/isTeachMode').then(() => { - this.tipShow = true; - const offset = this.$store.state.config.canvasOffset; - if (this.$store.state.training.started) { - const order = this.$store.state.training.order; - const steps = this.$store.state.training.steps; - if (order > -1 && order < steps.length) { - const step = steps[order]; - const distance = 5; - this.tip = step.tip; - /** 如果mbm或者bar的处理*/ - if (step.type === 'mbm' || step.type === 'bar') { - const position = this.getOtherTipPoint(step); - if (position) { - this.position = position; - this.position.y -= distance; - this.popTipShow(); - } - } else if (step.code) { - /** 默认是shape类型,如果找不到坐标,则可以认为是存在code的dailog*/ - const position = this.getShapeTipPoint(step); - if (position) { - this.position = { - x: position.x + offset.x, - y: position.y + offset.y - distance - }; - this.popTipShow(); - } else { - const position = this.getOtherTipPoint(step); - if (position) { - this.position = position; - this.position.y -= distance; - this.popTipShow(); - } - } - } else { - /** 不存在code字段的dialog处理*/ - const position = this.getOtherTipPoint(step); - if (position) { - this.position = position; - this.position.y -= distance; - this.popTipShow(); - } else { - this.popTipHide(); - } - } - } else { - this.tipShow = false; - } - } else { - this.tipShow = false; - } - }).catch(() => { - this.tipShow = false; - }); - }); - }, - popTipShow() { - this.popShow = true; - }, - popTipHide() { - this.popShow = false; - }, - // 获取地图设备提示位置 - getShapeTipPoint(step) { - var position = null; - const type = getDeviceTypeByDic(step.type); - if (type) { - position = this.$jlmap.getShapeTipPoint({ - code: step.code, - val: step.val - }); + name: 'TrainingTips', + components: { PopTip }, + data() { + return { + tipShow: false, + popShow: false, + position: { + x: 0, + y: 0 + }, + tip: '' + }; + }, + computed: { + ...mapGetters([ + 'canvasWidth', + 'canvasHeight' + ]) + }, + watch: { + '$store.state.training.tipEvent': function (val) { + this.tipInit(); + } + }, + methods: { + tipInit() { + this.$nextTick(() => { + this.$store.dispatch('training/isTeachMode').then(() => { + this.tipShow = true; + const offset = this.$store.state.config.canvasOffset; + if (this.$store.state.training.started) { + const order = this.$store.state.training.order; + const steps = this.$store.state.training.steps; + if (order > -1 && order < steps.length) { + const step = steps[order]; + const distance = 5; + this.tip = step.tip; + /** 如果mbm或者bar的处理*/ + if (step.type === 'mbm' || step.type === 'bar') { + const position = this.getOtherTipPoint(step); + if (position) { + this.position = position; + this.position.y -= distance; + this.popTipShow(); + } + } else if (step.code) { + /** 默认是shape类型,如果找不到坐标,则可以认为是存在code的dailog*/ + const position = this.getShapeTipPoint(step); + if (position) { + this.position = { + x: position.x + offset.x, + y: position.y + offset.y - distance + }; + this.popTipShow(); + } else { + const position = this.getOtherTipPoint(step); + if (position) { + this.position = position; + this.position.y -= distance; + this.popTipShow(); + } + } + } else { + /** 不存在code字段的dialog处理*/ + const position = this.getOtherTipPoint(step); + if (position) { + this.position = position; + this.position.y -= distance; + this.popTipShow(); + } else { + this.popTipHide(); + } + } + } else { + this.tipShow = false; + } + } else { + this.tipShow = false; + } + }).catch(() => { + this.tipShow = false; + }); + }); + }, + popTipShow() { + this.popShow = true; + }, + popTipHide() { + this.popShow = false; + }, + // 获取地图设备提示位置 + getShapeTipPoint(step) { + var position = null; + const type = getDeviceTypeByDic(step.type); + if (type) { + position = this.$jlmap.getShapeTipPoint({ + code: step.code, + val: step.val + }); - if (position) { - if (position.x < 0) { - position.x = 0; - } - if (position.x > this.canvasWidth) { - position.x = this.canvasWidth; - } - if (position.y < 0) { - position.y = 0; - } - if (position.y > this.canvasHeight) { - position.y = this.canvasHeight; - } - } - } - return position; - }, - // 获取地图菜单按钮和对话框按钮提示显示位置 - getOtherTipPoint(step) { - const domId = getDomIdByOperation(step.operation); - const btnDom = document.getElementById(domId); - if (btnDom) { - const offset = getDomOffset(btnDom, true); - if (offset.x == 0 && offset.y == 0) { - return null; - } + if (position) { + if (position.x < 0) { + position.x = 0; + } + if (position.x > this.canvasWidth) { + position.x = this.canvasWidth; + } + if (position.y < 0) { + position.y = 0; + } + if (position.y > this.canvasHeight) { + position.y = this.canvasHeight; + } + } + } + return position; + }, + // 获取地图菜单按钮和对话框按钮提示显示位置 + getOtherTipPoint(step) { + const domId = getDomIdByOperation(step.operation); + const btnDom = document.getElementById(domId); + if (btnDom) { + const offset = getDomOffset(btnDom, true); + if (offset.x == 0 && offset.y == 0) { + return null; + } - let align = 'bottom'; - if (this.tipAlignIsTop(step, domId)) { - align = 'top'; - } + let align = 'bottom'; + if (this.tipAlignIsTop(step, domId)) { + align = 'top'; + } - return { - align: align, - x: offset.x + btnDom.clientWidth / 2, - y: offset.y - }; - } - return null; - }, - tipAlignIsTop(step, domId) { - // 如果是tip框则箭头朝上 - if (step.type.toUpperCase() === 'bar'.toUpperCase()) { - return true; - } + return { + align: align, + x: offset.x + btnDom.clientWidth / 2, + y: offset.y + }; + } + return null; + }, + tipAlignIsTop(step, domId) { + // 如果是tip框则箭头朝上 + if (step.type.toUpperCase() === 'bar'.toUpperCase()) { + return true; + } - if (/{TOP}/.test(domId)) { - return false; - } + if (/{TOP}/.test(domId)) { + return false; + } - if (/{BOTTOM}/.test(domId)) { - return true; - } + if (/{BOTTOM}/.test(domId)) { + return true; + } - // 如果domId中不含以下关键字,则箭头朝上 - const keyList = ['choose', 'select']; - for (var key in keyList) { - if (domId.toUpperCase().indexOf(keyList[key].toUpperCase()) !== -1) { - return false; - } - } + // 如果domId中不含以下关键字,则箭头朝上 + const keyList = ['choose', 'select']; + for (var key in keyList) { + if (domId.toUpperCase().indexOf(keyList[key].toUpperCase()) !== -1) { + return false; + } + } - // 其他情况默认朝下 - return true; - } - } + // 其他情况默认朝下 + return true; + } + } }; diff --git a/src/views/newMap/newMapdraft/mapoperate/station.vue b/src/views/newMap/newMapdraft/mapoperate/station.vue index 9c2b25fd0..967595d51 100644 --- a/src/views/newMap/newMapdraft/mapoperate/station.vue +++ b/src/views/newMap/newMapdraft/mapoperate/station.vue @@ -41,54 +41,6 @@
- -
- - 111 - -
-
- - {{ $t('map.create') }} - -
-
- -
- - 222 - -
-
- - {{ $t('map.create') }} - -
-
- -
- - 333 - -
-
- - {{ $t('map.create') }} - -
-
- -
- - - -
-
- - {{ $t('map.updateObj') }} - -
-
@@ -136,17 +88,15 @@ export default { position: { x: 0, y: 0 }, controlled:false, isCreateControlMode:false, - isCreateCounter:false, - isCreateDelayedUnlock:false, - isCreateTurnBack:false + // isCreateCounter:false, + // isCreateDelayedUnlock:false, + isCreateTurnBack:false, + turnBackList: [], // 按图折返坐标 + controlModePoint: { x: 0, y: 0 } // 控制模式坐标 }, addModel: { sectionCode: '' }, - pullBackModel: { - code: '', - position: { x: 0, y: 0 } - }, skins: [], mergeRules: { sectionCode: [ @@ -186,7 +136,9 @@ export default { { prop: 'kmRange', label: this.$t('map.stationKmRange'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }, { prop: 'kmPost', label: this.$t('map.stationKmPost'), type: 'input' }, { prop: 'kmPostFont', label: this.$t('map.stationKmPostFont'), type: 'font', placeholder: this.$t('tip.kilometerFont') }, - { prop: 'kmPostFontColor', label: this.$t('map.stationKmPostFontColor'), type: 'color' } + { prop: 'kmPostFontColor', label: this.$t('map.stationKmPostFontColor'), type: 'color' }, + { prop: 'isCreateControlMode', label: '控制模式:', type: 'checkbox' }, + { prop: 'isCreateTurnBack', label: '按图折返:', type: 'checkbox' } ] }, map: { @@ -196,11 +148,7 @@ export default { { prop: 'centralized', label: this.$t('map.centralized'), type: 'checkbox', disabled:this.editModel.controlled, change:true, deviceChange:this.changeCentralized }, { prop: 'zcCode', label: this.$t('map.zcCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList, isHidden: !this.isZcCode }, { prop: 'chargeStationCodeList', label: this.$t('map.chargeStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.chargeStation, isHidden: !this.isZcCode, deviceChange:this.changeChargeStation}, - { prop: 'runPlanName', label: this.$t('map.stationRunPlanName'), type: 'input' }, - { prop: 'isCreateControlMode', label: '是否创建控制模式', type: 'checkbox' }, - { prop: 'isCreateCounter', label: '是否创建计数器', type: 'checkbox' }, - { prop: 'isCreateDelayedUnlock', label: '是否创建延迟解锁', type: 'checkbox' }, - { prop: 'isCreateTurnBack', label: '是否创建按图折返', type: 'checkbox' } + { prop: 'runPlanName', label: this.$t('map.stationRunPlanName'), type: 'input' } ] } } @@ -228,41 +176,6 @@ export default { ] }; }, - pullBackForm() { - return { - labelWidth: '120px', - items: { - code: { - name: '', - item: [] - }, - draw: { - name: this.$t('map.drawData'), - item: [ - { prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.buttonList, disabled: true }, - { prop: 'position', label: '坐标偏移量:', type: 'coordinate', width: '110px', children: [ - { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px'}, - { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } - ] } - ] - }, - map: { - name: this.$t('map.mapData'), - item: [] - } - } - }; - }, - pullBackRules() { - return { - 'position.x': [ - { required: true, message: this.$t('rules.pleaseEnterXCoordinate'), trigger: 'blur' } - ], - 'position.y': [ - { required: true, message: this.$t('rules.pleaseEnterYCoordinate'), trigger: 'blur' } - ] - }; - }, PhysicalSectionList() { let list = []; if (this.sectionList && this.sectionList.length) { @@ -418,6 +331,13 @@ export default { this.$refs['dataform'].validate((valid) => { if (valid) { const data = Object.assign({_type: 'Station'}, this.editModel); + if (data.isCreateTurnBack && !data.pullBackModel.code) { + data.pullBackModel.position = { + x: data.position.x + 100, + y: data.position.y + 50 + }; + data.pullBackModel.code = getUID('turnBackCode'); + } this.$emit('updateMapModel', data); } }); @@ -438,9 +358,6 @@ export default { _that.$message.info(this.$t('tip.cancelledDelete')); }); } - }, - editPullBack() { - console.log(111); } } };