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:',
signalLinkCode: 'Signal link',
signalNamePosition: 'Signal name position:',
signalNameRotated: 'Signal name rotated:',
signalGuidePosition: 'Signal guide:',
signalPosition: 'Signal position:',
signalButtonPosition: 'button:',

View File

@ -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'
};

View File

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

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();
}
}
});
}

View File

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

View File

@ -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;
},

View File

@ -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,

View File

@ -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' }

View File

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