调整绘图相关-(信号机调整,草稿地图列表接口调整)

This commit is contained in:
fan 2019-12-03 13:36:02 +08:00
parent 342bb86585
commit 5ca78f0ba7
24 changed files with 567 additions and 582 deletions

View File

@ -9,10 +9,11 @@ export function getMapTree() {
}
/** 草稿地图列表*/
export function listMap() {
export function listMap(params) {
return request({
url: '/api/mapBuild/list',
method: 'get'
method: 'get',
params: params
});
}

View File

@ -151,7 +151,6 @@ class SkinCode extends defaultStyle {
text: {
show: true, // 信号机名称显示
distance: 3, // 文字和灯杆的距离
isNoRotation: true, // 是否禁止旋转
isAlignCenter: false, // 信号字体对其方式
fontSize: 11, // 信号机名称字体大小
fontWeight: 'bold', // 信号机名称字体粗细

View File

@ -151,7 +151,6 @@ class SkinCode extends defaultStyle {
text: {
show: true, // 信号机名称显示
distance: 3, // 文字和灯杆的距离
isNoRotation: true, // 是否禁止旋转
isAlignCenter: false, // 信号字体对其方式
fontSize: 11, // 信号机名称字体大小
fontWeight: 'bold', // 信号机名称字体粗细

View File

@ -154,7 +154,6 @@ class SkinCode extends defaultStyle {
text: {
show: true, // 信号机名称显示
distance: 3, // 文字和灯杆的距离
isNoRotation: true, // 是否禁止旋转
isAlignCenter: false, // 信号字体对其方式
fontSize: 11, // 信号机名称字体大小
fontWeight: 'bold', // 信号机名称字体粗细

View File

@ -151,7 +151,6 @@ class SkinCode extends defaultStyle {
text: {
show: true, // 信号机名称显示
distance: 3, // 文字和灯杆的距离
isNoRotation: true, // 是否禁止旋转
isAlignCenter: false, // 信号字体对其方式
fontSize: 11, // 信号机名称字体大小
fontWeight: 'bold', // 信号机名称字体粗细

View File

@ -144,7 +144,6 @@ class SkinCode extends defaultStyle {
text: {
show: true, // 信号机名称显示
distance: 0, // 文字和灯杆的距离
isNoRotation: true, // 是否禁止旋转
isAlignCenter: true, // 信号字体对其方式
fontSize: 11, // 信号机名称字体大小
fontWeight: 'bold', // 信号机名称字体粗细

View File

@ -2,69 +2,69 @@ import Polyline from 'zrender/src/graphic/shape/Polyline';
import Group from 'zrender/src/container/Group';
class ESigPost extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
create() {
const model = this.model;
const style = this.model.style;
this.ver = new Polyline({
_subType: 'SignalLamp',
_val: '3',
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.x, model.y + style.Signal.lamp.radiusR * 1.2],
[model.x, model.y - style.Signal.lamp.radiusR * 1.2]
]
},
style: {
lineWidth: style.Signal.post.standardWidth,
stroke: style.Signal.post.standardColor
}
});
this.ver = new Polyline({
_subType: 'SignalLamp',
_val: '3',
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.x, model.y + style.Signal.lamp.radiusR * 1.2],
[model.x, model.y - style.Signal.lamp.radiusR * 1.2]
]
},
style: {
lineWidth: style.Signal.post.standardWidth,
stroke: style.Signal.post.standardColor
}
});
this.hor = new Polyline({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.x, model.y],
[model.x + model.drict * style.Signal.lamp.radiusR * 1.2, model.y]
]
},
style: {
lineWidth: style.Signal.post.standardWidth,
stroke: style.Signal.post.standardColor
}
});
this.hor = new Polyline({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.x, model.y],
[model.x + model.drict * style.Signal.lamp.radiusR * 1.2, model.y]
]
},
style: {
lineWidth: style.Signal.post.standardWidth,
stroke: style.Signal.post.standardColor
}
});
this.add(this.ver);
this.add(this.hor);
this.add(this.ver);
this.add(this.hor);
model.type === '01' ? this.hor.hide() : this.hor.show();
}
model.type === '01' ? this.hor.hide() : this.hor.show();
}
getLampPosition(type) {
const model = this.model;
const style = this.model.style;
if (type === '01') {
return {
x: model.x + model.drict * style.Signal.lamp.radiusR * 3 / 2,
y: model.y
};
} else {
return {
x: this.hor.shape.points[1][0] + model.drict * style.Signal.lamp.radiusR,
y: this.hor.shape.points[1][1]
};
}
}
getLampPosition(type) {
const model = this.model;
const style = this.model.style;
if (type === '01') {
return {
x: model.x + model.drict * style.Signal.lamp.radiusR * 3 / 2,
y: model.y
};
} else {
return {
x: this.hor.shape.points[1][0] + model.drict * style.Signal.lamp.radiusR,
y: this.hor.shape.points[1][1]
};
}
}
}
export default ESigPost;

View File

@ -14,503 +14,502 @@ import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect';
class Signal extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.model = model;
this.style = style;
this.count = parseInt(model.lampPositionType);
this.lamps = new Array(this.count);
this.zlevel = model.zlevel;
this.z = 7;
this.create();
this.createMouseEvent();
this.transformRotation(this);
this.setState(model);
}
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.model = model;
this.style = style;
this.count = parseInt(model.lampPositionType);
this.lamps = new Array(this.count);
this.zlevel = model.zlevel;
this.z = 7;
this.create();
this.createMouseEvent();
this.transformRotation(this);
this.setState(model);
}
create() {
const model = this.model;
const style = this.style;
const drict = this.model.directionShowType == '01' ? -1 : 1; // 朝向 左:右
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
create() {
const model = this.model;
const style = this.style;
const drict = this.model.directionShowType == '01' ? -1 : 1; // 朝向 左:右
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
// 信号机高柱矮柱
this.sigPost = new ESigPost({
zlevel: this.zlevel,
z: this.z,
style: style,
drict: drict,
type: model.lampPostType,
x: model.position.x,
y: model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR)
});
// 信号机高柱矮柱
this.sigPost = new ESigPost({
zlevel: this.zlevel,
z: this.z,
style: style,
drict: drict,
type: model.lampPostType,
x: model.position.x,
y: model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR)
});
// 信号灯
const endPoint = this.sigPost.getLampPosition(model.lampPostType);
this.lamps = [];
for (let i = 0; i < this.count; i++) {
const lamp = new ESigLamp({
zlevel: this.zlevel,
z: this.z,
style: style,
drict: drict,
x: endPoint.x + i * drict * style.Signal.lamp.radiusR * 2,
y: endPoint.y,
originX: model.position.x,
originY: model.position.y
});
// 信号灯
const endPoint = this.sigPost.getLampPosition(model.lampPostType);
this.lamps = [];
for (let i = 0; i < this.count; i++) {
const lamp = new ESigLamp({
zlevel: this.zlevel,
z: this.z,
style: style,
drict: drict,
x: endPoint.x + i * drict * style.Signal.lamp.radiusR * 2,
y: endPoint.y,
originX: model.position.x,
originY: model.position.y
});
this.lamps.push(lamp);
}
this.lamps.push(lamp);
}
// 信号机名称
const sigNameX = model.position.x - drict * (style.Signal.post.standardWidth) + model.namePosition.x;
const sigNameY = model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const textAlign = style.Signal.text.isAlignCenter ? 'middle': this.model.directionShowType == '01'? 'right': 'left';
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
this.sigName = new ESigName({
zlevel: this.zlevel,
z: this.z,
silent: false,
isNoRotation: style.Signal.text.isNoRotation,
style: style,
x: sigNameX,
y: sigNameY,
text: model.name,
fontWeight: style.Signal.text.fontWeight,
fontSize: style.Signal.text.fontSize,
fontFamily: style.fontFamily,
textFill: style.Signal.text.defaultColor,
textAlign: textAlign,
textVerticalAlign: textVerticalAlign
});
// 信号机名称
const sigNameX = model.position.x - drict * (style.Signal.post.standardWidth) + model.namePosition.x;
const sigNameY = model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.directionShowType == '01' ? 'right' : 'left';
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
this.sigName = new ESigName({
zlevel: this.zlevel,
z: this.z,
silent: false,
style: style,
x: sigNameX,
y: sigNameY,
text: model.name,
fontWeight: style.Signal.text.fontWeight,
fontSize: style.Signal.text.fontSize,
fontFamily: style.fontFamily,
textFill: style.Signal.text.defaultColor,
textAlign: textAlign,
textVerticalAlign: textVerticalAlign
});
// 自动进路
const sigRouteH = style.Signal.route.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigRouteX = endPoint.x + (style.Signal.route.offset.x + sigRouteH) * drict;
const sigRouteY = endPoint.y + (style.Signal.route.offset.y);
this.sigRoute = new ESigRoute({
zlevel: this.zlevel,
z: this.z,
style: style,
x: sigRouteX,
y: sigRouteY,
drict: drict
});
// 自动进路
const sigRouteH = style.Signal.route.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigRouteX = endPoint.x + (style.Signal.route.offset.x + sigRouteH) * drict;
const sigRouteY = endPoint.y + (style.Signal.route.offset.y);
this.sigRoute = new ESigRoute({
zlevel: this.zlevel,
z: this.z,
style: style,
x: sigRouteX,
y: sigRouteY,
drict: drict
});
// 自动通过
const sigAutoH = style.Signal.auto.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigAutoX = endPoint.x + (style.Signal.auto.offset.x + sigAutoH) * drict;
const sigAutoY = endPoint.y + (style.Signal.auto.offset.y);
this.sigAuto = new ESigAuto({
zlevel: this.zlevel,
z: this.z,
style: style,
count: this.count,
drict: drict,
x: sigAutoX,
y: sigAutoY,
width: style.Signal.auto.width,
fill: style.Signal.auto.autoRoute,
lineWidth: 0.6,
stroke: style.sidelineColor
});
// 自动通过
const sigAutoH = style.Signal.auto.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigAutoX = endPoint.x + (style.Signal.auto.offset.x + sigAutoH) * drict;
const sigAutoY = endPoint.y + (style.Signal.auto.offset.y);
this.sigAuto = new ESigAuto({
zlevel: this.zlevel,
z: this.z,
style: style,
count: this.count,
drict: drict,
x: sigAutoX,
y: sigAutoY,
width: style.Signal.auto.width,
fill: style.Signal.auto.autoRoute,
lineWidth: 0.6,
stroke: style.sidelineColor
});
// 延迟解锁
const sigDelayH = style.Signal.delay.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigDelayX = endPoint.x + (style.Signal.delay.offset.x + sigDelayH) * drict;
const sigDelayY = endPoint.y - (style.Signal.delay.offset.y) * posit;
this.sigDelay = new ESigDelay({
zlevel: this.zlevel,
z: this.z,
style: style,
x: sigDelayX,
y: sigDelayY,
fontWeight: style.Signal.delay.fontWeight,
fontSize: style.Signal.delay.fontSize,
fontFamily: style.fontFamily,
text: this.model.delayCount || '0',
textFill: style.Signal.delay.fontColor,
textAlign: drict > 0 ? 'right' : 'left',
textVerticalAlign: 'middle'
});
// 延迟解锁
const sigDelayH = style.Signal.delay.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigDelayX = endPoint.x + (style.Signal.delay.offset.x + sigDelayH) * drict;
const sigDelayY = endPoint.y - (style.Signal.delay.offset.y) * posit;
this.sigDelay = new ESigDelay({
zlevel: this.zlevel,
z: this.z,
style: style,
x: sigDelayX,
y: sigDelayY,
fontWeight: style.Signal.delay.fontWeight,
fontSize: style.Signal.delay.fontSize,
fontFamily: style.fontFamily,
text: this.model.delayCount || '0',
textFill: style.Signal.delay.fontColor,
textAlign: drict > 0 ? 'right' : 'left',
textVerticalAlign: 'middle'
});
// 信号灯按钮
this.sigButton = new ESigButton({
zlevel: this.zlevel,
z: this.z,
style: style,
posit: posit,
show: model.buttonShow,
x: model.buttonPosition.x,
y: model.buttonPosition.y - posit * (style.Signal.button.distance + style.Signal.lamp.radiusR * 2)
});
// 信号灯按钮
this.sigButton = new ESigButton({
zlevel: this.zlevel,
z: this.z,
style: style,
posit: posit,
show: model.buttonShow,
x: model.buttonPosition.x,
y: model.buttonPosition.y - posit * (style.Signal.button.distance + style.Signal.lamp.radiusR * 2)
});
this.add(this.sigPost);
this.lamps.forEach(lamp => { this.add(lamp); });
this.style.Signal.text.show ? this.add(this.sigName) : null;
this.add(this.sigAuto);
this.add(this.sigRoute);
this.add(this.sigDelay);
// this.add(this.sigButton);
}
this.add(this.sigPost);
this.lamps.forEach(lamp => { this.add(lamp); });
this.style.Signal.text.show ? this.add(this.sigName) : null;
this.add(this.sigAuto);
this.add(this.sigRoute);
this.add(this.sigDelay);
// this.add(this.sigButton);
}
createMouseEvent() {
if (this.style.Signal.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
createMouseEvent() {
if (this.style.Signal.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
// 整体旋转信号灯
transformRotation(device) {
if (this.model.rotate) {
device.eachChild(item => {
if (item instanceof Group) {
this.transformRotation(item);
} else if (item && item.model && item.model.isNoRotation) {
item.origin = [this.model.position.x, this.model.position.y];
item.rotation = -Math.PI / 180 * Number(this.model.rotate);
item.dirty();
}
});
}
}
// 整体旋转信号灯
transformRotation(device) {
if (this.model.rotate) {
device.eachChild(item => {
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();
}
});
}
}
// 关闭
close() {
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 2 && this.model.lightType == '02') { // 双灯 逻辑点灯
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 1 && this.model.lightType == '01') { // 单灯 物理点灯
if (this.lamps[0]) {
this.lamps[0].setStop(false);
if (this.model.useType == '05') {
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
}
} else if (this.count == 1 && this.model.lightType == '02') { // 单灯 逻辑点灯
if (this.lamps[0]) {
this.lamps[0].setStop(true);
if (this.model.useType == '05') {
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
}
} else if (this.count == 1) {
if (this.lamps[0]) {
if (this.model.useType == '05') {
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
}
}
}
// 关闭
close() {
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 2 && this.model.lightType == '02') { // 双灯 逻辑点灯
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 1 && this.model.lightType == '01') { // 单灯 物理点灯
if (this.lamps[0]) {
this.lamps[0].setStop(false);
if (this.model.useType == '05') {
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
}
} else if (this.count == 1 && this.model.lightType == '02') { // 单灯 逻辑点灯
if (this.lamps[0]) {
this.lamps[0].setStop(true);
if (this.model.useType == '05') {
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
}
} else if (this.count == 1) {
if (this.lamps[0]) {
if (this.model.useType == '05') {
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
}
}
}
/* count 1单灯 2双灯 lightType 01物理点灯 02逻辑点灯*/
openPositive() {
if (this.count == 2 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 2 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 1 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
} else if (this.count == 1 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
}
}
/* count 1单灯 2双灯 lightType 01物理点灯 02逻辑点灯*/
openLateral() {
if (this.count == 2 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.backgroundColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
} else if (this.count == 2 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.backgroundColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
} else if (this.count == 1 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
// 出站信号机/阻隔信号机
if (['02', '06'].includes(this.model.useType)) {
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
}
}
} else if (this.count == 1 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
}
}
// 列车进路
trainRoute() {
if (this.count == 1) {
/** 单灯 列兼调信号*/
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
}
}
/* count 1单灯 2双灯 lightType 01物理点灯 02逻辑点灯*/
openPositive() {
if (this.count == 2 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 2 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.backgroundColor);
}
} else if (this.count == 1 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
} else if (this.count == 1 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
}
}
/* count 1单灯 2双灯 lightType 01物理点灯 02逻辑点灯*/
openLateral() {
if (this.count == 2 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.backgroundColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
} else if (this.count == 2 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.backgroundColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
} else if (this.count == 1 && this.model.lightType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
// 出站信号机/阻隔信号机
if (['02', '06'].includes(this.model.useType)) {
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
} else {
this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
}
}
} else if (this.count == 1 && this.model.lightType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
}
}
}
// 列车进路
trainRoute() {
if (this.count == 1) {
/** 单灯 列兼调信号*/
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
}
}
// 调车进路
shuntRoute() {
if (this.count == 1) {
/** 单灯 列兼调信号*/
/** 单灯 阻挡兼调车信号*/
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
}
}
// 调车进路
shuntRoute() {
if (this.count == 1) {
/** 单灯 列兼调信号*/
/** 单灯 阻挡兼调车信号*/
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
}
}
// 引导
guid() {
if (this.count == 2 && this.model.lightType == '01' && this.style.Signal.lamp.guidName != 'chengdu_03') { // 双灯 物理点灯 允许引导信号
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
} else if (this.count == 1 && this.model.lightType == '01' && this.style.Signal.lamp.guidName == 'chengdu_03') {
this.lamps[0].setStop(false);
this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 });
}
}
// 引导
guid() {
if (this.count == 2 && this.model.lightType == '01' && this.style.Signal.lamp.guidName != 'chengdu_03') { // 双灯 物理点灯 允许引导信号
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
} else if (this.count == 1 && this.model.lightType == '01' && this.style.Signal.lamp.guidName == 'chengdu_03') {
this.lamps[0].setStop(false);
this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 });
}
}
// 封锁
block() {
if (this.count == 1) {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
// this.siglamp.setNameBorder(1)
}
this.sigName.setColor(this.style.Signal.text.blockColor);
if (this.style.Signal.text.nameBorderShow) {
this.sigName.setStyle({textBorderWidth: 1});
this.sigName.setColor('#fff');
}
}
// 封锁
block() {
if (this.count == 1) {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
// this.siglamp.setNameBorder(1)
}
this.sigName.setColor(this.style.Signal.text.blockColor);
if (this.style.Signal.text.nameBorderShow) {
this.sigName.setStyle({textBorderWidth: 1});
this.sigName.setColor('#fff');
}
}
// 功能封锁
functionBlock() {
if (this.count == 1) {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
// this.siglamp.setRectBlockByIndex(1, true);
}
}
// 功能封锁
functionBlock() {
if (this.count == 1) {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
// this.siglamp.setRectBlockByIndex(1, true);
}
}
// 信号保护区段监视状态显示
signalCheck() {
if (this.count == 1) {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
this.sigName.setColor(this.style.Signal.text.checkColor);
}
}
// 信号保护区段监视状态显示
signalCheck() {
if (this.count == 1) {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
this.sigName.setColor(this.style.Signal.text.checkColor);
}
}
// 故障
fault() {
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.Signal.lamp.blueColor);
}
}
}
// 故障
fault() {
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.Signal.lamp.blueColor);
}
}
}
// 物理点灯
logicalLight() {
this.lamps.forEach(lamp => { lamp.setStop(false); });
}
// 物理点灯
logicalLight() {
this.lamps.forEach(lamp => { lamp.setStop(false); });
}
// 逻辑点灯
physicsLight() {
this.lamps.forEach(lamp => { lamp.setStop(true); });
}
// 逻辑点灯
physicsLight() {
this.lamps.forEach(lamp => { lamp.setStop(true); });
}
// 设置自动进路模式状态类型
setAutoRouteOpen() {
this.sigAuto.setColor(this.style.Signal.auto.autoRoute);
if (this.model.linkageAutoRouteShow) {
this.sigAuto.show();
} else {
this.sigAuto.hide();
}
}
// 设置自动进路模式状态类型
setAutoRouteOpen() {
this.sigAuto.setColor(this.style.Signal.auto.autoRoute);
if (this.model.linkageAutoRouteShow) {
this.sigAuto.show();
} else {
this.sigAuto.hide();
}
}
// 信号机进路自动触发模式状态类型
setAutoTriggerOpen() {
this.sigAuto.setColor(this.style.Signal.auto.autoTrigger);
if (this.model.atsAutoTriggerShow) {
this.sigAuto.show();
} else {
this.sigAuto.hide();
}
}
// 信号机进路自动触发模式状态类型
setAutoTriggerOpen() {
this.sigAuto.setColor(this.style.Signal.auto.autoTrigger);
if (this.model.atsAutoTriggerShow) {
this.sigAuto.show();
} else {
this.sigAuto.hide();
}
}
// 设置自动信号模式状态类型
setAutoSignalOpen() {
this.sigRoute.show();
}
// 设置自动信号模式状态类型
setAutoSignalOpen() {
this.sigRoute.show();
}
// 隐藏自动信号和自动进路
setAutoClose() {
this.sigAuto.hide();
this.sigAuto.setColor(this.style.backgroundColor);
this.sigRoute.hide();
}
// 隐藏自动信号和自动进路
setAutoClose() {
this.sigAuto.hide();
this.sigAuto.setColor(this.style.backgroundColor);
this.sigRoute.hide();
}
// 自动信号和自动进路开始动画
setAutoFlicker() {
this.sigAuto.arrowsAnimation();
}
// 自动信号和自动进路开始动画
setAutoFlicker() {
this.sigAuto.arrowsAnimation();
}
// 设置延时解锁
setDelayUnlock() {
this.sigDelay.show();
}
// 设置延时解锁
setDelayUnlock() {
this.sigDelay.show();
}
// 恢复状态
recover() {
this.sigName.setStyle({textBorderWidth: 0});
this.sigAuto.hide();
this.sigRoute.hide();
this.sigDelay.hide();
this.sigAuto.animationRecover();
this.sigName.setColor(this.style.Signal.text.defaultColor);
if (this.style.Signal.lamp.guidName == 'chengdu_03') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
}
}
// 恢复状态
recover() {
this.sigName.setStyle({textBorderWidth: 0});
this.sigAuto.hide();
this.sigRoute.hide();
this.sigDelay.hide();
this.sigAuto.animationRecover();
this.sigName.setColor(this.style.Signal.text.defaultColor);
if (this.style.Signal.lamp.guidName == 'chengdu_03') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
}
}
setState(model) {
this.recover();
/** 设置状态 (点灯类型)*/
switch (model.status) {
case '01': this.close(); break; // 关闭
case '02': this.openPositive(); break; // 开放正向
case '03': this.openLateral(); break; // 开放侧向
case '04': this.guid(); break; // 引导
case '05': this.block(); break; // 封锁
case '06': this.fault(); break; // 故障
case '07': this.block(); break; // 功能封锁
case '08': this.signalCheck(); break; // 信号保护区段检测
}
setState(model) {
this.recover();
/** 设置状态 (点灯类型)*/
switch (model.status) {
case '01': this.close(); break; // 关闭
case '02': this.openPositive(); break; // 开放正向
case '03': this.openLateral(); break; // 开放侧向
case '04': this.guid(); break; // 引导
case '05': this.block(); break; // 封锁
case '06': this.fault(); break; // 故障
case '07': this.block(); break; // 功能封锁
case '08': this.signalCheck(); break; // 信号保护区段检测
}
/** 进路性质类型*/
switch (model.natureType) {
case '01': this.trainRoute(); break; // 列车进路
case '02': this.shuntRoute(); break; // 调车进路
}
/** 进路性质类型*/
switch (model.natureType) {
case '01': this.trainRoute(); break; // 列车进路
case '02': this.shuntRoute(); break; // 调车进路
}
/** 设置点灯类型*/
switch (model.lightType) {
case '01': this.logicalLight(); break; // 设置逻辑点灯
case '02': this.physicsLight(); break; // 设置物理点灯
}
/** 设置点灯类型*/
switch (model.lightType) {
case '01': this.logicalLight(); break; // 设置逻辑点灯
case '02': this.physicsLight(); break; // 设置物理点灯
}
/** 设置自动类型*/
switch (model.autoType) {
case '01': this.setAutoClose(); break; // 隐藏 隐藏自动信号和自动进路
case '02': this.setAutoSignalOpen(); break; // 显示 设置自动信号模式状态类型
case '03': this.setAutoRouteOpen(); break; // 显示 设置自动进路模式状态类型
case '04': this.setAutoTriggerOpen(); break; // 显示 信号机进路自动触发模式状态类型
}
/** 设置自动类型*/
switch (model.autoType) {
case '01': this.setAutoClose(); break; // 隐藏 隐藏自动信号和自动进路
case '02': this.setAutoSignalOpen(); break; // 显示 设置自动信号模式状态类型
case '03': this.setAutoRouteOpen(); break; // 显示 设置自动进路模式状态类型
case '04': this.setAutoTriggerOpen(); break; // 显示 信号机进路自动触发模式状态类型
}
/** 延时解锁*/
switch (model.delayType) {
case '01': break; // 未延时解锁
case '02': this.setDelayUnlock(); break; // 人工闭塞延时解锁
case '03': this.setDelayUnlock(); break; // 自动闭塞延时解锁
}
/** 延时解锁*/
switch (model.delayType) {
case '01': break; // 未延时解锁
case '02': this.setDelayUnlock(); break; // 人工闭塞延时解锁
case '03': this.setDelayUnlock(); break; // 自动闭塞延时解锁
}
/** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/
if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) {
this.setAutoFlicker();
}
}
/** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/
if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) {
this.setAutoFlicker();
}
}
getBoundingRect() {
const rect = this.sigPost.getBoundingRect();
this.lamps.forEach(elem => {
rect.union(elem.getBoundingRect());
});
return rect;
}
getBoundingRect() {
const rect = this.sigPost.getBoundingRect();
this.lamps.forEach(elem => {
rect.union(elem.getBoundingRect());
});
return rect;
}
getShapeTipPoint(opts) {
var rect = new BoundingRect(0, 0, 0, 0);
var drict = this.model.directionShowType == '01' ? -1 : 1; // 朝向 左:右
var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下
if (opts.val == '1' || opts.val == '2') {
rect = this.sigButton.getBoundingRect();
} else {
rect = this.sigPost.getBoundingRect();
}
getShapeTipPoint(opts) {
var rect = new BoundingRect(0, 0, 0, 0);
var drict = this.model.directionShowType == '01' ? -1 : 1; // 朝向 左:右
var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下
if (opts.val == '1' || opts.val == '2') {
rect = this.sigButton.getBoundingRect();
} else {
rect = this.sigPost.getBoundingRect();
}
return {
x: rect.x + drict * this.style.Signal.post.standardWidth,
y: rect.y - offsetY
};
}
return {
x: rect.x + drict * this.style.Signal.post.standardWidth,
y: rect.y - offsetY
};
}
}
export default Signal;

View File

@ -99,7 +99,7 @@ export default {
this.loading = true;
this.treeData = this.treeList = [];
try {
const res = await listMap();
const res = await listMap({ drawWay:'0'});
res.data && res.data.forEach(elem=>{
elem.type = 'map';
elem.children = [

View File

@ -143,7 +143,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'0'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -152,7 +152,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'0'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -162,7 +162,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'0'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -245,7 +245,7 @@ export default {
}
},
acquireMapList() {
listMap().then(response => {
listMap({ drawWay:'0'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -175,7 +175,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'0'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -127,7 +127,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'0'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -87,7 +87,7 @@ export default {
this.loading = true;
this.treeData = this.treeList = [];
try {
const res = await listMap();
const res = await listMap({ drawWay:'1'});
res.data && res.data.forEach(elem=>{
elem.type = 'map';
elem.children = [

View File

@ -143,7 +143,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'1'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -152,7 +152,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'1'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -162,7 +162,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'1'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -245,7 +245,7 @@ export default {
}
},
acquireMapList() {
listMap().then(response => {
listMap({ drawWay:'1'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -175,7 +175,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({drawWay: '1'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -127,7 +127,7 @@ export default {
},
acquireMapList() {
//
listMap().then(response => {
listMap({ drawWay:'1'}).then(response => {
this.mapList = response.data;
});
},

View File

@ -97,7 +97,7 @@
<template v-if="checkFieldType(item, 'radio')">
<el-form-item v-if="!item.isHidden" :key="item.prop" :label="item.label" :prop="item.prop" :required="item.required">
<el-radio-group v-model="formModel[item.prop]" :disabled="item.disabled">
<el-radio v-for="(opts, indexs) in item.radioList" :key="indexs" :border="item.border" :label="opts.value">{{ opts.label }}</el-radio>
<el-radio v-for="(opts, indexs) in item.radioList" :key="indexs" :border="item.border" :label="opts[item.optionValue]||opts.value">{{ opts[item.optionLabel]||opts.label }}</el-radio>
</el-radio-group>
</el-form-item>
</template>

View File

@ -32,45 +32,46 @@
@click="hover('selectSingalCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="信号机名称:" prop="name">
<el-input v-model="addModel.name" style="width: 178px;" />
</el-form-item>
<el-form-item :label="$t('map.leftOrRight')" prop="leftOrRight">
<el-select v-model="addModel.leftOrRight" filterable>
<el-option
<el-radio-group v-model="addModel.leftOrRight">
<el-radio
v-for="item in SignalLeftOrRightList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('map.directionType')" prop="directionType">
<el-select v-model="addModel.directionType" filterable>
<el-option
v-for="item in SignalDirectionTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
:label="item.value"
border
size="mini"
>
{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.signalDirectionTypeX')" prop="directionShowType">
<el-select v-model="addModel.directionShowType" filterable>
<el-option
<el-radio-group v-model="addModel.directionShowType">
<el-radio
v-for="item in SignalDirectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
:label="item.code"
border
size="mini"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.positionType')" prop="positionType">
<el-select v-model="addModel.positionType" filterable>
<el-option
<el-radio-group v-model="addModel.positionType">
<el-radio
v-for="item in SignalPositionTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
:label="item.code"
border
size="mini"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.equipmentStation')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
@ -125,7 +126,6 @@ export default {
SignalPotLampTypeList: [],
SignalLampPostTypeList: [],
SignalLampPositionTypeList: [],
SignalDirectionTypeList: [],
SignalPositionTypeList: [],
SignalUseTypeList: [],
failTypes: [
@ -141,7 +141,6 @@ export default {
lampPositionType: '',
potLampType: '01',
directionShowType: '',
directionType: '',
positionType: '',
namePosition: { x: 0, y: 0 },
useType: '',
@ -158,7 +157,7 @@ export default {
field: '',
addModel: {
sectionCode: '',
directionType: '01',
name: '',
directionShowType: '01',
leftOrRight: '0',
positionType: '01',
@ -168,9 +167,6 @@ export default {
sectionCode: [
{ required: true, message: this.$t('rules.selectPhysicalExtentName'), trigger: 'change' }
],
directionType: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.directionType'), trigger: 'change' }
],
directionShowType: [
{ required: true, message: this.$t('map.pleaseSelect') + '' + this.$t('map.directionType'), trigger: 'change' }
],
@ -228,10 +224,10 @@ export default {
{ 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' }
] },
{ prop: 'lampPostType', label: this.$t('map.lampPostType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalLampPostTypeList },
{ prop: 'lampPostType', label: this.$t('map.lampPostType'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.SignalLampPostTypeList },
{ prop: 'lampPositionType', label: this.$t('map.lampPositionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalLampPositionTypeList },
{ prop: 'directionShowType', label: this.$t('map.signalDirectionTypeX'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalDirectionList },
{ prop: 'positionType', label: this.$t('map.signalPositionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPositionTypeList },
{ prop: 'directionShowType', 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: -90, max: 90, placeholder: this.$t('tip.angle') },
{ 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' },
@ -253,7 +249,6 @@ export default {
name: this.$t('map.mapData'),
item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList },
{ prop: 'directionType', label: this.$t('map.signalDirectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalDirectionTypeList },
{ prop: 'uniqueName', label: this.$t('map.signalUniqueName'), type: 'input' },
{ prop: 'useType', label: this.$t('map.signalUseType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalUseTypeList },
{ prop: 'potLampType', label: this.$t('map.potLampType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPotLampTypeList },
@ -320,10 +315,6 @@ export default {
this.SignalLampPositionTypeList = list;
});
this.$Dictionary.signalDirectionType().then(list => {
this.SignalDirectionTypeList = list;
});
this.$Dictionary.signalPositionType().then(list => {
this.SignalPositionTypeList = list;
});
@ -369,7 +360,6 @@ export default {
uniqueName: uid,
sectionCode: this.addModel.sectionCode,
positionType: this.addModel.positionType,
directionType: this.addModel.directionType,
directionShowType: this.addModel.directionShowType,
nameShow: true,
namePosition: { x: 0, y: 0 },
@ -383,7 +373,7 @@ export default {
};
this.sectionList.forEach(elem => {
if (elem.code === this.addModel.sectionCode) {
model.name = 'Signal_' + elem.name.replace('Section_', '');
model.name = this.addModel.name || 'Signal_' + elem.name.replace('Section_', '');
model.linkCode = elem.code;
if (this.addModel.leftOrRight === '0') {
const beg = elem.points[0];