From 2a11b8d69736a1b80530833a84a36923e6549943 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Thu, 26 Dec 2019 16:54:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E6=9C=BA=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E6=97=8B=E8=BD=AC=E6=A0=87=E8=AF=86=EF=BC=8C?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E5=85=B3=E8=81=94=E5=85=B3=E7=B3=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A0=A1=E9=AA=8C=EF=BC=8C=E8=BF=9B=E8=B7=AF=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0=E7=BC=96=E7=A0=81=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/en/map.js | 1 + src/i18n/langs/en/rules.js | 3 +- src/i18n/langs/zh/map.js | 1 + src/i18n/langs/zh/rules.js | 3 +- src/jmapNew/shape/Signal/ESigButton.js | 190 +++++++++--------- src/jmapNew/shape/Signal/ESigDelay.js | 92 ++++----- src/jmapNew/shape/Signal/ESigName.js | 88 ++++---- src/jmapNew/shape/Signal/index.js | 9 +- .../dataRelation/routeoperate/detail.vue | 5 + .../newMap/newMapdraft/mapoperate/section.vue | 36 ++-- .../newMapdraft/mapoperate/signal/create.vue | 1 + .../newMapdraft/mapoperate/signal/index.vue | 2 + vue.config.js | 2 +- 13 files changed, 217 insertions(+), 216 deletions(-) diff --git a/src/i18n/langs/en/map.js b/src/i18n/langs/en/map.js index e69c3ce35..4d24182bb 100644 --- a/src/i18n/langs/en/map.js +++ b/src/i18n/langs/en/map.js @@ -32,6 +32,7 @@ export default { stationstandPosition: 'Station stand position:', signalLinkCode: 'Signal link', signalNamePosition: 'Signal name position:', + signalNameRotated: 'Signal name rotated:', signalGuidePosition: 'Signal guide:', signalPosition: 'Signal position:', signalButtonPosition: 'button:', diff --git a/src/i18n/langs/en/rules.js b/src/i18n/langs/en/rules.js index 3d1167e94..86bf2de53 100644 --- a/src/i18n/langs/en/rules.js +++ b/src/i18n/langs/en/rules.js @@ -317,7 +317,6 @@ export default { enterTheNewsTitle: 'Please enter news title', enterTheNewsContent: 'Please enter news content', chooseNewsCanBeClosed: 'Please select the news can be closed', - theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent: 'The left end of the selected associated section is not adjacent!', - theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent: 'The right end of the selected associated section is not adjacent!', + theSelectedAssociatedSectionIsNotAdjacent: 'The selected associated section is not adjacent!', selectConcentrateStation:'Please select Concentrate Station' }; diff --git a/src/i18n/langs/zh/map.js b/src/i18n/langs/zh/map.js index d36b35407..9588c0ff5 100644 --- a/src/i18n/langs/zh/map.js +++ b/src/i18n/langs/zh/map.js @@ -297,6 +297,7 @@ export default { signalNamePositionX: '信号机名字偏移量 x:', signalNamePositionY: '信号机名字偏移量 y:', signalNamePosition: '信号机名字偏移量:', + signalNameRotated: '信号机名字是否旋转:', signalButtonShow: '是否显示按钮:', signalButtonPositionX: '按钮x:', signalButtonPositionY: '按钮y:', diff --git a/src/i18n/langs/zh/rules.js b/src/i18n/langs/zh/rules.js index 556d5dc37..9920ffb4d 100644 --- a/src/i18n/langs/zh/rules.js +++ b/src/i18n/langs/zh/rules.js @@ -319,7 +319,6 @@ export default { enterTheNewsTitle: '请输入消息标题', enterTheNewsContent: '请输入消息内容', chooseNewsCanBeClosed: '请选择消息是否可关闭', - theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent: '所选择关联区段与该区段左侧不相邻!', - theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent: '所选择关联区段与该区段右侧不相邻!', + theSelectedAssociatedSectionIsNotAdjacent: '所选择关联区段与该区段不相邻!', selectConcentrateStation:'请选择设备集中站' }; diff --git a/src/jmapNew/shape/Signal/ESigButton.js b/src/jmapNew/shape/Signal/ESigButton.js index 1d421edb1..6cac095e2 100644 --- a/src/jmapNew/shape/Signal/ESigButton.js +++ b/src/jmapNew/shape/Signal/ESigButton.js @@ -5,109 +5,109 @@ import Rect from 'zrender/src/graphic/shape/Rect'; import Group from 'zrender/src/container/Group'; class ESigButton extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } + constructor(model) { + super(); + this.model = model; + this.isNew = false; + } - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; - const padding = 1; - const r = style.Signal.lamp.radiusR * 0.8; + create() { + if (!this.isNew) { + const model = this.model; + const style = this.model.style; + const padding = 1; + const r = style.Signal.lamp.radiusR * 0.8; - this.isNew = true; - this.sigNormalButtom = new Rect({ - zlevel: model.zlevel, - z: model.z, - _subType: 'SignalButton', - _val: '1', - shape: { - x: model.x - style.Signal.lamp.radiusR, - y: model.y - r + r * model.posit, - width: style.Signal.lamp.radiusR * 2, - height: style.Signal.lamp.radiusR * 2 - }, - style: { - lineWidth: 0.2, - stroke: style.Signal.button.borderDashColor, - fill: style.Signal.button.buttonColor - } - }); + this.isNew = true; + this.sigNormalButtom = new Rect({ + zlevel: model.zlevel, + z: model.z, + _subType: 'SignalButton', + _val: '1', + shape: { + x: model.x - style.Signal.lamp.radiusR, + y: model.y - r + r * model.posit, + width: style.Signal.lamp.radiusR * 2, + height: style.Signal.lamp.radiusR * 2 + }, + style: { + lineWidth: 0.2, + stroke: style.Signal.button.borderDashColor, + fill: style.Signal.button.buttonColor + } + }); - this.sigNormalButtomDown = new Polyline({ - _subType: 'SignalButton', - _val: '1', - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { points: [ - [model.x - padding + r, this.sigNormalButtom.shape.y + padding], - [model.x + padding - r, this.sigNormalButtom.shape.y + padding], - [model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r] - ] }, - style: { - lineWidth: 0.8, - stroke: style.backgroundColor - } - }); + this.sigNormalButtomDown = new Polyline({ + _subType: 'SignalButton', + _val: '1', + zlevel: model.zlevel, + z: model.z, + silent: true, + shape: { points: [ + [model.x - padding + r, this.sigNormalButtom.shape.y + padding], + [model.x + padding - r, this.sigNormalButtom.shape.y + padding], + [model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r] + ] }, + style: { + lineWidth: 0.8, + stroke: style.backgroundColor + } + }); - this.sigReentryButton = new Circle({ - zlevel: model.zlevel, - z: model.z, - _subType: 'SignalButton', - _val: '2', // 折返按钮 - shape: { - cx: model.x, - cy: model.y - 5 / 2 * r * model.posit, - r: style.Signal.lamp.radiusR - }, - style: { - lineWidth: 0.2, - stroke: style.Signal.button.borderDashColor, - fill: style.Signal.button.buttonColor - } - }); + this.sigReentryButton = new Circle({ + zlevel: model.zlevel, + z: model.z, + _subType: 'SignalButton', + _val: '2', // 折返按钮 + shape: { + cx: model.x, + cy: model.y - 5 / 2 * r * model.posit, + r: style.Signal.lamp.radiusR + }, + style: { + lineWidth: 0.2, + stroke: style.Signal.button.borderDashColor, + fill: style.Signal.button.buttonColor + } + }); - this.sigReentryButtonDown = new Arc({ - _subType: 'SignalButton', - _val: '2', // 折返按钮 - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { - cx: this.sigReentryButton.shape.cx, - cy: this.sigReentryButton.shape.cy, - r: this.sigReentryButton.shape.r - padding, - startAngle: Math.PI * 8 / 5, - endAngle: Math.PI * 4 / 5, - clockwise: false - }, - style: { - lineWidth: 0.8, - stroke: style.backgroundColor - } - }); + this.sigReentryButtonDown = new Arc({ + _subType: 'SignalButton', + _val: '2', // 折返按钮 + zlevel: model.zlevel, + z: model.z, + silent: true, + shape: { + cx: this.sigReentryButton.shape.cx, + cy: this.sigReentryButton.shape.cy, + r: this.sigReentryButton.shape.r - padding, + startAngle: Math.PI * 8 / 5, + endAngle: Math.PI * 4 / 5, + clockwise: false + }, + style: { + lineWidth: 0.8, + stroke: style.backgroundColor + } + }); - this.add(this.sigNormalButtom); - this.add(this.sigReentryButton); - this.hide(); - } - } + this.add(this.sigNormalButtom); + this.add(this.sigReentryButton); + this.hide(); + } + } - hide() { - this.create(); - this.sigNormalButtom.hide(); - this.sigReentryButton.hide(); - } + hide() { + this.create(); + this.sigNormalButtom.hide(); + this.sigReentryButton.hide(); + } - show() { - this.create(); - this.sigNormalButtom.show(); - this.sigReentryButton.show(); - } + show() { + this.create(); + this.sigNormalButtom.show(); + this.sigReentryButton.show(); + } } export default ESigButton; diff --git a/src/jmapNew/shape/Signal/ESigDelay.js b/src/jmapNew/shape/Signal/ESigDelay.js index 00daeff35..c3fc7d49c 100644 --- a/src/jmapNew/shape/Signal/ESigDelay.js +++ b/src/jmapNew/shape/Signal/ESigDelay.js @@ -2,58 +2,58 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; class ESigDelay extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } + constructor(model) { + super(); + this.model = model; + this.isNew = false; + } - create() { - if (!this.isNew) { - const model = this.model; + create() { + if (!this.isNew) { + const model = this.model; - this.isNew = true; - this.name = new Text({ - _subType: model._subType, - 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, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - this.add(this.name); - } - } + this.isNew = true; + this.name = new Text({ + _subType: model._subType, + 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, + textFill: model.textFill, + textAlign: model.textAlign, + textPosition: model.textPosition || 'inside', + textVerticalAlign: model.textVerticalAlign || null + } + }); + this.add(this.name); + } + } - setStyle(model) { - this.create(); - this.name.setStyle(model); - } + setStyle(model) { + this.create(); + this.name.setStyle(model); + } - setColor(color) { - this.create(); - this.name.setStyle('textFill', color); - } + setColor(color) { + this.create(); + this.name.setStyle('textFill', color); + } - hide() { - this.create(); - this.name.hide(); - } + hide() { + this.create(); + this.name.hide(); + } - show() { - this.create(); - this.name.show(); - } + show() { + this.create(); + this.name.show(); + } } export default ESigDelay; diff --git a/src/jmapNew/shape/Signal/ESigName.js b/src/jmapNew/shape/Signal/ESigName.js index 07bf67f08..f2c961d86 100644 --- a/src/jmapNew/shape/Signal/ESigName.js +++ b/src/jmapNew/shape/Signal/ESigName.js @@ -2,55 +2,55 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; class ESigName extends Group { - constructor(model) { - super(); - this.model = model; - this.create(); - } + constructor(model) { + super(); + this.model = model; + this.create(); + } - create() { - const model = this.model; - this.name = new Text({ - _subType: 'SignalLamp', - _val: '3', - zlevel: model.zlevel, - z: model.z, - silent: model.silent, - style: { - textBorderColor: 'red', - textBorderWidth: 0, - x: model.x, - y: model.y, - fontWeight: model.fontWeight, - fontSize: model.fontSize, - fontFamily: model.fontFamily, - text: model.text, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - this.add(this.name); - } + create() { + const model = this.model; + this.name = new Text({ + _subType: 'SignalName', + _val: '3', + zlevel: model.zlevel, + z: model.z, + silent: model.silent, + style: { + textBorderColor: 'red', + textBorderWidth: 0, + x: model.x, + y: model.y, + fontWeight: model.fontWeight, + fontSize: model.fontSize, + fontFamily: model.fontFamily, + text: model.text, + textFill: model.textFill, + textAlign: model.textAlign, + textPosition: model.textPosition || 'inside', + textVerticalAlign: model.textVerticalAlign || null + } + }); + this.add(this.name); + } - setStyle(model) { - this.name.setStyle(model); - } + setStyle(model) { + this.name.setStyle(model); + } - setColor(color) { - this.name.setStyle('textFill', color); - } + setColor(color) { + this.name.setStyle('textFill', color); + } - // 隐藏 - hide() { - this.name.hide(); - } + // 隐藏 + hide() { + this.name.hide(); + } - // 显示 - show() { - this.name.show(); - } + // 显示 + show() { + this.name.show(); + } } export default ESigName; diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index 99145cef7..7579c955e 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -13,7 +13,6 @@ import EMouse from './EMouse'; import Group from 'zrender/src/container/Group'; import BoundingRect from 'zrender/src/core/BoundingRect'; import EHighlight from '../element/EHighlight'; -import {drawSectionStyle} from '../../config/defaultStyle'; class Signal extends Group { constructor(model, style) { @@ -175,9 +174,11 @@ class Signal extends Group { if (item instanceof Group) { this.transformRotation(item); } else if (item) { - item.origin = [this.model.position.x, this.model.position.y]; - item.rotation = -Math.PI / 180 * Number(this.model.rotate); - item.dirty(); + if (item._subType !== 'SignalName' || this.model.nameRotated) { + item.origin = [this.model.position.x, this.model.position.y]; + item.rotation = -Math.PI / 180 * Number(this.model.rotate); + item.dirty(); + } } }); } diff --git a/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue b/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue index 7da6d4b95..1dfe61b1c 100644 --- a/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue +++ b/src/views/newMap/newMapdraft/dataRelation/routeoperate/detail.vue @@ -97,6 +97,11 @@ export default { prop: 'name', width: 180 }, + { + title: '编码', + prop: 'code', + width: 150 + }, { title: this.$t('map.routeStationName'), prop: 'stationCode' diff --git a/src/views/newMap/newMapdraft/mapoperate/section.vue b/src/views/newMap/newMapdraft/mapoperate/section.vue index 1df171d91..0f2a3c96b 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section.vue @@ -446,22 +446,14 @@ export default { return form; }, rules() { - // var validateLeftSection = (rule, value, callback) => { - // const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null; - // if (leftSection && !(this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.editModel.points[0].x) || this.checkPointsCoincide(leftSection.points[leftSection.points.length - 1], this.oldPoint[0]) )) { - // callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); - // } else { - // callback(); - // } - // }; - // var validateRightSection = (rule, value, callback) => { - // const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null; - // if (rightSection && !(this.checkPointsCoincide(rightSection.points[0], this.editModel.points[this.editModel.points.length - 1]) || this.checkPointsCoincide(rightSection.points[0], this.oldPoint[this.oldPoint.length - 1]))) { - // callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); - // } else { - // callback(); - // } - // }; + var validateAssociatedSection = (rule, value, callback) => { + const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null; + if (rightSection && !(this.checkSectionPointsHasCoincide(rightSection.points, this.editModel.points) || this.checkSectionPointsHasCoincide(rightSection.points, this.oldPoint))) { + callback(new Error(this.$t('rules.theSelectedAssociatedSectionIsNotAdjacent'))); + } else { + callback(); + } + }; const rules = { code: [ { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } @@ -504,13 +496,13 @@ export default { ], relSwitchCode: [ { required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' } + ], + leftSectionCode: [ + { validator: validateAssociatedSection, trigger: 'change' } + ], + rightSectionCode: [ + { validator: validateAssociatedSection, trigger: 'change'} ] - // leftSectionCode: [ - // { validator: validateLeftSection, trigger: 'change' } - // ], - // rightSectionCode: [ - // { validator: validateRightSection, trigger: 'change'} - // ] }; return rules; }, diff --git a/src/views/newMap/newMapdraft/mapoperate/signal/create.vue b/src/views/newMap/newMapdraft/mapoperate/signal/create.vue index 27d4c2daf..aa5f82a6c 100644 --- a/src/views/newMap/newMapdraft/mapoperate/signal/create.vue +++ b/src/views/newMap/newMapdraft/mapoperate/signal/create.vue @@ -177,6 +177,7 @@ export default { positionType: this.addModel.positionType, right: this.addModel.right, // leftOrRight: this.addModel.leftOrRight, + nameRotated: false, nameShow: true, namePosition: { x: 0, y: 0 }, buttonShow: true, diff --git a/src/views/newMap/newMapdraft/mapoperate/signal/index.vue b/src/views/newMap/newMapdraft/mapoperate/signal/index.vue index 9676e83aa..254e1b205 100644 --- a/src/views/newMap/newMapdraft/mapoperate/signal/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/signal/index.vue @@ -90,6 +90,7 @@ export default { stationCode: '', sectionOffset: 0, rotate: 0, + nameRotated: false, sectionCode: '', guideShow: false, buttonShow: false, @@ -155,6 +156,7 @@ export default { { prop: 'right', label: this.$t('map.signalDirectionTypeX'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.SignalDirectionList }, { prop: 'positionType', label: this.$t('map.signalPositionType'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.SignalPositionTypeList }, { prop: 'rotate', label: this.$t('map.rotateAngle'), type: 'number', min: -180, max: 180, placeholder: this.$t('tip.angle') }, + { prop: 'nameRotated', label: this.$t('map.signalNameRotated'), type: 'checkbox' }, { prop: 'namePosition', label: this.$t('map.signalNamePosition'), type: 'coordinate', width: '140px', children: [ { prop: 'namePosition.x', firstLevel: 'namePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' }, { prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } diff --git a/vue.config.js b/vue.config.js index 1d513d9ff..1d4006755 100644 --- a/vue.config.js +++ b/vue.config.js @@ -33,7 +33,7 @@ module.exports = { productionSourceMap: false, devServer: { port: port, - open: true, + // open: true, overlay: { warnings: false, errors: true