This commit is contained in:
zyy 2019-12-26 18:07:29 +08:00
commit 72ecdae535
13 changed files with 217 additions and 216 deletions

View File

@ -32,6 +32,7 @@ export default {
stationstandPosition: 'Station stand position:', stationstandPosition: 'Station stand position:',
signalLinkCode: 'Signal link', signalLinkCode: 'Signal link',
signalNamePosition: 'Signal name position:', signalNamePosition: 'Signal name position:',
signalNameRotated: 'Signal name rotated:',
signalGuidePosition: 'Signal guide:', signalGuidePosition: 'Signal guide:',
signalPosition: 'Signal position:', signalPosition: 'Signal position:',
signalButtonPosition: 'button:', signalButtonPosition: 'button:',

View File

@ -317,7 +317,6 @@ export default {
enterTheNewsTitle: 'Please enter news title', enterTheNewsTitle: 'Please enter news title',
enterTheNewsContent: 'Please enter news content', enterTheNewsContent: 'Please enter news content',
chooseNewsCanBeClosed: 'Please select the news can be closed', chooseNewsCanBeClosed: 'Please select the news can be closed',
theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent: 'The left end of the selected associated section is not adjacent!', theSelectedAssociatedSectionIsNotAdjacent: 'The selected associated section is not adjacent!',
theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent: 'The right end of the selected associated section is not adjacent!',
selectConcentrateStation:'Please select Concentrate Station' selectConcentrateStation:'Please select Concentrate Station'
}; };

View File

@ -297,6 +297,7 @@ export default {
signalNamePositionX: '信号机名字偏移量 x:', signalNamePositionX: '信号机名字偏移量 x:',
signalNamePositionY: '信号机名字偏移量 y:', signalNamePositionY: '信号机名字偏移量 y:',
signalNamePosition: '信号机名字偏移量:', signalNamePosition: '信号机名字偏移量:',
signalNameRotated: '信号机名字是否旋转:',
signalButtonShow: '是否显示按钮:', signalButtonShow: '是否显示按钮:',
signalButtonPositionX: '按钮x:', signalButtonPositionX: '按钮x:',
signalButtonPositionY: '按钮y:', signalButtonPositionY: '按钮y:',

View File

@ -319,7 +319,6 @@ export default {
enterTheNewsTitle: '请输入消息标题', enterTheNewsTitle: '请输入消息标题',
enterTheNewsContent: '请输入消息内容', enterTheNewsContent: '请输入消息内容',
chooseNewsCanBeClosed: '请选择消息是否可关闭', chooseNewsCanBeClosed: '请选择消息是否可关闭',
theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent: '所选择关联区段与该区段左侧不相邻!', theSelectedAssociatedSectionIsNotAdjacent: '所选择关联区段与该区段不相邻!',
theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent: '所选择关联区段与该区段右侧不相邻!',
selectConcentrateStation:'请选择设备集中站' selectConcentrateStation:'请选择设备集中站'
}; };

View File

@ -5,109 +5,109 @@ import Rect from 'zrender/src/graphic/shape/Rect';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
class ESigButton extends Group { class ESigButton extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false; this.isNew = false;
} }
create() { create() {
if (!this.isNew) { if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const padding = 1; const padding = 1;
const r = style.Signal.lamp.radiusR * 0.8; const r = style.Signal.lamp.radiusR * 0.8;
this.isNew = true; this.isNew = true;
this.sigNormalButtom = new Rect({ this.sigNormalButtom = new Rect({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
_subType: 'SignalButton', _subType: 'SignalButton',
_val: '1', _val: '1',
shape: { shape: {
x: model.x - style.Signal.lamp.radiusR, x: model.x - style.Signal.lamp.radiusR,
y: model.y - r + r * model.posit, y: model.y - r + r * model.posit,
width: style.Signal.lamp.radiusR * 2, width: style.Signal.lamp.radiusR * 2,
height: style.Signal.lamp.radiusR * 2 height: style.Signal.lamp.radiusR * 2
}, },
style: { style: {
lineWidth: 0.2, lineWidth: 0.2,
stroke: style.Signal.button.borderDashColor, stroke: style.Signal.button.borderDashColor,
fill: style.Signal.button.buttonColor fill: style.Signal.button.buttonColor
} }
}); });
this.sigNormalButtomDown = new Polyline({ this.sigNormalButtomDown = new Polyline({
_subType: 'SignalButton', _subType: 'SignalButton',
_val: '1', _val: '1',
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: true, silent: true,
shape: { points: [ 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], [model.x + padding - r, this.sigNormalButtom.shape.y + padding],
[model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r] [model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r]
] }, ] },
style: { style: {
lineWidth: 0.8, lineWidth: 0.8,
stroke: style.backgroundColor stroke: style.backgroundColor
} }
}); });
this.sigReentryButton = new Circle({ this.sigReentryButton = new Circle({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
_subType: 'SignalButton', _subType: 'SignalButton',
_val: '2', // 折返按钮 _val: '2', // 折返按钮
shape: { shape: {
cx: model.x, cx: model.x,
cy: model.y - 5 / 2 * r * model.posit, cy: model.y - 5 / 2 * r * model.posit,
r: style.Signal.lamp.radiusR r: style.Signal.lamp.radiusR
}, },
style: { style: {
lineWidth: 0.2, lineWidth: 0.2,
stroke: style.Signal.button.borderDashColor, stroke: style.Signal.button.borderDashColor,
fill: style.Signal.button.buttonColor fill: style.Signal.button.buttonColor
} }
}); });
this.sigReentryButtonDown = new Arc({ this.sigReentryButtonDown = new Arc({
_subType: 'SignalButton', _subType: 'SignalButton',
_val: '2', // 折返按钮 _val: '2', // 折返按钮
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: true, silent: true,
shape: { shape: {
cx: this.sigReentryButton.shape.cx, cx: this.sigReentryButton.shape.cx,
cy: this.sigReentryButton.shape.cy, cy: this.sigReentryButton.shape.cy,
r: this.sigReentryButton.shape.r - padding, r: this.sigReentryButton.shape.r - padding,
startAngle: Math.PI * 8 / 5, startAngle: Math.PI * 8 / 5,
endAngle: Math.PI * 4 / 5, endAngle: Math.PI * 4 / 5,
clockwise: false clockwise: false
}, },
style: { style: {
lineWidth: 0.8, lineWidth: 0.8,
stroke: style.backgroundColor stroke: style.backgroundColor
} }
}); });
this.add(this.sigNormalButtom); this.add(this.sigNormalButtom);
this.add(this.sigReentryButton); this.add(this.sigReentryButton);
this.hide(); this.hide();
} }
} }
hide() { hide() {
this.create(); this.create();
this.sigNormalButtom.hide(); this.sigNormalButtom.hide();
this.sigReentryButton.hide(); this.sigReentryButton.hide();
} }
show() { show() {
this.create(); this.create();
this.sigNormalButtom.show(); this.sigNormalButtom.show();
this.sigReentryButton.show(); this.sigReentryButton.show();
} }
} }
export default ESigButton; export default ESigButton;

View File

@ -2,58 +2,58 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
class ESigDelay extends Group { class ESigDelay extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false; this.isNew = false;
} }
create() { create() {
if (!this.isNew) { if (!this.isNew) {
const model = this.model; const model = this.model;
this.isNew = true; this.isNew = true;
this.name = new Text({ this.name = new Text({
_subType: model._subType, _subType: model._subType,
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: model.silent || false, silent: model.silent || false,
style: { style: {
x: model.x, x: model.x,
y: model.y, y: model.y,
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: model.fontFamily, fontFamily: model.fontFamily,
text: model.text, text: model.text,
textFill: model.textFill, textFill: model.textFill,
textAlign: model.textAlign, textAlign: model.textAlign,
textPosition: model.textPosition || 'inside', textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null textVerticalAlign: model.textVerticalAlign || null
} }
}); });
this.add(this.name); this.add(this.name);
} }
} }
setStyle(model) { setStyle(model) {
this.create(); this.create();
this.name.setStyle(model); this.name.setStyle(model);
} }
setColor(color) { setColor(color) {
this.create(); this.create();
this.name.setStyle('textFill', color); this.name.setStyle('textFill', color);
} }
hide() { hide() {
this.create(); this.create();
this.name.hide(); this.name.hide();
} }
show() { show() {
this.create(); this.create();
this.name.show(); this.name.show();
} }
} }
export default ESigDelay; export default ESigDelay;

View File

@ -2,55 +2,55 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
class ESigName extends Group { class ESigName extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.create(); this.create();
} }
create() { create() {
const model = this.model; const model = this.model;
this.name = new Text({ this.name = new Text({
_subType: 'SignalLamp', _subType: 'SignalName',
_val: '3', _val: '3',
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
silent: model.silent, silent: model.silent,
style: { style: {
textBorderColor: 'red', textBorderColor: 'red',
textBorderWidth: 0, textBorderWidth: 0,
x: model.x, x: model.x,
y: model.y, y: model.y,
fontWeight: model.fontWeight, fontWeight: model.fontWeight,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: model.fontFamily, fontFamily: model.fontFamily,
text: model.text, text: model.text,
textFill: model.textFill, textFill: model.textFill,
textAlign: model.textAlign, textAlign: model.textAlign,
textPosition: model.textPosition || 'inside', textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null textVerticalAlign: model.textVerticalAlign || null
} }
}); });
this.add(this.name); this.add(this.name);
} }
setStyle(model) { setStyle(model) {
this.name.setStyle(model); this.name.setStyle(model);
} }
setColor(color) { setColor(color) {
this.name.setStyle('textFill', color); this.name.setStyle('textFill', color);
} }
// 隐藏 // 隐藏
hide() { hide() {
this.name.hide(); this.name.hide();
} }
// 显示 // 显示
show() { show() {
this.name.show(); this.name.show();
} }
} }
export default ESigName; export default ESigName;

View File

@ -13,7 +13,6 @@ import EMouse from './EMouse';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
import EHighlight from '../element/EHighlight'; import EHighlight from '../element/EHighlight';
import {drawSectionStyle} from '../../config/defaultStyle';
class Signal extends Group { class Signal extends Group {
constructor(model, style) { constructor(model, style) {
@ -175,9 +174,11 @@ class Signal extends Group {
if (item instanceof Group) { if (item instanceof Group) {
this.transformRotation(item); this.transformRotation(item);
} else if (item) { } else if (item) {
item.origin = [this.model.position.x, this.model.position.y]; if (item._subType !== 'SignalName' || this.model.nameRotated) {
item.rotation = -Math.PI / 180 * Number(this.model.rotate); item.origin = [this.model.position.x, this.model.position.y];
item.dirty(); item.rotation = -Math.PI / 180 * Number(this.model.rotate);
item.dirty();
}
} }
}); });
} }

View File

@ -97,6 +97,11 @@ export default {
prop: 'name', prop: 'name',
width: 180 width: 180
}, },
{
title: '编码',
prop: 'code',
width: 150
},
{ {
title: this.$t('map.routeStationName'), title: this.$t('map.routeStationName'),
prop: 'stationCode' prop: 'stationCode'

View File

@ -446,22 +446,14 @@ export default {
return form; return form;
}, },
rules() { rules() {
// var validateLeftSection = (rule, value, callback) => { var validateAssociatedSection = (rule, value, callback) => {
// const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : null; const rightSection = 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]) )) { if (rightSection && !(this.checkSectionPointsHasCoincide(rightSection.points, this.editModel.points) || this.checkSectionPointsHasCoincide(rightSection.points, this.oldPoint))) {
// callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); callback(new Error(this.$t('rules.theSelectedAssociatedSectionIsNotAdjacent')));
// } else { } else {
// callback(); 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();
// }
// };
const rules = { const rules = {
code: [ code: [
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
@ -504,13 +496,13 @@ export default {
], ],
relSwitchCode: [ relSwitchCode: [
{ required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' } { 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; return rules;
}, },

View File

@ -177,6 +177,7 @@ export default {
positionType: this.addModel.positionType, positionType: this.addModel.positionType,
right: this.addModel.right, right: this.addModel.right,
// leftOrRight: this.addModel.leftOrRight, // leftOrRight: this.addModel.leftOrRight,
nameRotated: false,
nameShow: true, nameShow: true,
namePosition: { x: 0, y: 0 }, namePosition: { x: 0, y: 0 },
buttonShow: true, buttonShow: true,

View File

@ -90,6 +90,7 @@ export default {
stationCode: '', stationCode: '',
sectionOffset: 0, sectionOffset: 0,
rotate: 0, rotate: 0,
nameRotated: false,
sectionCode: '', sectionCode: '',
guideShow: false, guideShow: false,
buttonShow: 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: '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: '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: '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', 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.x', firstLevel: 'namePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } { prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }

View File

@ -33,7 +33,7 @@ module.exports = {
productionSourceMap: false, productionSourceMap: false,
devServer: { devServer: {
port: port, port: port,
open: true, // open: true,
overlay: { overlay: {
warnings: false, warnings: false,
errors: true errors: true