desc: 修改代码

This commit is contained in:
zyy 2019-11-12 13:36:21 +08:00
parent db1681b54e
commit 7018b4c308
21 changed files with 985 additions and 985 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,382 +6,404 @@ import Rect from 'zrender/src/graphic/shape/Rect';
/** 列车 */ /** 列车 */
export default class Train extends Group { export default class Train extends Group {
constructor(model, style) { constructor(model, style) {
super(); super();
this._code = model.code; this._code = model.code;
this._type = model._type; this._type = model._type;
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.model = model; this.model = model;
this.style = style; this.style = style;
this.z = 40; this.z = 40;
this.size = 0; this.size = 0;
this.section = null; this.section = null;
this.fontSize = style.Train.common.useSelfText?style.Train.common.nameFontSize || style.Train.common.trainTextFontSize:model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize; this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.nameFormat = style.Train.common.useSelfFormat?style.Train.trainBody.trainNameFormat:model.nameFormat || style.Train.trainBody.trainNameFormat; this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat;
if ( style.Train.trainBody.specialTrainType.length > 0) { if ( style.Train.trainBody.specialTrainType.length > 0) {
style.Train.trainBody.specialTrainType.some((item) =>{ style.Train.trainBody.specialTrainType.some((item) =>{
if (model.type === item.type) { if (model.type === item.type) {
this.nameFormat = item.nameFormat; this.nameFormat = item.nameFormat;
model.serviceNumber = item.serviceNumber?item.serviceNumber : model.serviceNumber; model.serviceNumber = item.serviceNumber ? item.serviceNumber : model.serviceNumber;
return true; return true;
} }
}); });
} }
this.create(); this.create();
this.setState(model); this.setState(model);
} }
_computed() { _computed() {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (model.trainWindowModel) { if (model.trainWindowModel) {
this.point = { this.point = {
x: model.trainWindowModel.point.x, x: model.trainWindowModel.point.x,
y: model.trainWindowModel.point.y y: model.trainWindowModel.point.y
}; };
switch (model.directionType) { switch (model.directionType) {
case '01': // 未知方向 case '01': // 未知方向
this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2); this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2);
break; break;
case '02': // 从左向右 case '02': // 从左向右
this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth; this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth;
break; break;
case '03': // 从右向左 case '03': // 从右向左
this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainHead.trainConntWidth * this.newScale; this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainHead.trainConntWidth * this.newScale;
break; break;
} }
} else { } else {
this.point = model.position; this.point = model.position;
this.traingle = null; this.traingle = null;
} }
} }
create() { create() {
this._computed(); this._computed();
this.isChangeTrainWidth(this.model, this.style); this.isChangeTrainWidth(this.model, this.style);
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (this.point) { if (this.point) {
this.trainB = new TrainBody({ this.trainB = new TrainBody({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: style, style: style,
point: this.point, point: this.point,
destinationStatus: model.destinationStatus, destinationStatus: model.destinationStatus,
serviceNumber: model.serviceNumber, serviceNumber: model.serviceNumber,
tripNumber: model.tripNumber, tripNumber: model.tripNumber,
targetCode: model.targetCode, targetCode: model.targetCode,
groupNumber: model.groupNumber, groupNumber: model.groupNumber,
directionType: model.directionType, directionType: model.directionType,
directionCode: model.directionCode, directionCode: model.directionCode,
sectionModel: model.sectionModel, sectionModel: model.sectionModel,
runControlStatus: model.runControlStatus, runControlStatus: model.runControlStatus,
runStatus: model.runStatus, runStatus: model.runStatus,
fontSize: this.fontSize, fontSize: this.fontSize,
nameFormat: this.nameFormat, nameFormat: this.nameFormat,
type: model.type, type: model.type,
speed: model.speed, speed: model.speed,
maLen: model.maLen, maLen: model.maLen,
model: model model: model
}); });
this.trainL = new TrainHead({ this.trainL = new TrainHead({
style: style, style: style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: this.point.x - style.Train.common.trainHeadDistance, x: this.point.x - style.Train.common.trainHeadDistance,
y: this.point.y y: this.point.y
}, },
drect: -1, drect: -1,
scale: this.newScale scale: this.newScale
}); });
this.trainR = new TrainHead({ this.trainR = new TrainHead({
style: style, style: style,
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance, x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance,
y: this.point.y y: this.point.y
}, },
drect: 1, drect: 1,
scale: this.newScale scale: this.newScale
}); });
this.add(this.trainB); this.add(this.trainB);
this.add(this.trainL); this.add(this.trainL);
this.add(this.trainR); this.add(this.trainR);
} }
if (style.Train.common.haveTrainBorder) { if (style.Train.common.haveTrainBorder) {
this.createTrainBorder(); this.createTrainBorder();
} }
} }
// 获取设备提示坐标 // 获取设备提示坐标
getShapeTipPoint() { getShapeTipPoint() {
} }
// 恢复颜色状态 // 恢复颜色状态
recover() { recover() {
this.trainB && this.trainB.setHShow(false); this.trainB && this.trainB.setHShow(false);
this.trainB && this.trainB.setSShow(false); this.trainB && this.trainB.setSShow(false);
this.trainB && this.trainB.setDShow(false); this.trainB && this.trainB.setDShow(false);
this.trainB && this.trainB.setAShow(false); this.trainB && this.trainB.setAShow(false);
this.trainL && this.trainL.setLineShow(false);
this.trainR && this.trainR.setLineShow(false);
this.trainL && this.trainL.setArrowShow(false);
this.trainR && this.trainR.setArrowShow(false);
}
// 设置服务号状态类型 this.trainL && this.trainL.setLineShow(false);
setServerNoType(type) { this.trainR && this.trainR.setLineShow(false);
if (this.style.Train.trainStatusStyle.serverNoType.length>0) { this.trainL && this.trainL.setArrowShow(false);
const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{ this.trainR && this.trainR.setArrowShow(false);
if (type === item.type) { }
this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
return true;
}
});
if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) {
this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor);
}
}
}
// 设置目的地状态 // 设置服务号状态类型
setDestinationStatus(status) { setServerNoType(type) {
if (this.style.Train.trainStatusStyle.destinationStatus.length>0) { if (this.style.Train.trainStatusStyle.serverNoType.length > 0) {
const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{ const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{
if (status === item.status) { if (type === item.type) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) { this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
case 'trainTarget': return true;
this.trainB && this.trainB.setTextTrainTargetColor(item.showColor); }
break; });
case 'trainServer': if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) {
this.trainB && this.trainB.setTextTrainServerColor(item.showColor); this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor);
break; }
case 'trainWindowBorder': }
this.trainB && this.trainB.setBodyBoxShape('stroke', item.showColor); }
break;
default:
this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
}
return true;
}
});
if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainServer':
this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainWindowBorder':
this.trainB && this.trainB.setBodyBoxShape('stroke', this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
default:
this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
}
}
}
}
// 设置运行方向状态类型 // 设置目的地状态
setDirectionType(type) { setDestinationStatus(status) {
if (this.style.Train.trainStatusStyle.directionType.length > 0) { if (this.style.Train.trainStatusStyle.destinationStatus.length > 0) {
this.style.Train.trainStatusStyle.directionType.some((item) => { const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{
if (type === item.type) { if (status === item.status) {
this.trainL && this.trainL.setLineShow(item.lineLShow); switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
this.trainL && this.trainL.setArrowShow(item.arrowLShow); case 'trainTarget':
this.trainR && this.trainR.setLineShow(item.lineRShow); this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
this.trainR && this.trainR.setArrowShow(item.arrowRShow); break;
return true; case 'trainServer':
} this.trainB && this.trainB.setTextTrainServerColor(item.showColor);
}); break;
} case 'trainWindowBorder':
} this.trainB && this.trainB.setBodyBoxShape('stroke', item.showColor);
// 设置列车停止方向类型 break;
setDirectionStopType(type) { default:
if (this.style.Train.trainStatusStyle.directionStopType.length > 0) { this.trainB && this.trainB.setTextTrainTargetColor(item.showColor);
this.style.Train.trainStatusStyle.directionStopType.some((item) => { }
if (type === item.type) { return true;
this.trainL && this.trainL.setLineShow(item.lineLShow); }
this.trainR && this.trainR.setLineShow(item.lineRShow); });
return true; if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) {
} switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
}); case 'trainTarget':
} this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
} break;
// 设置运行状态 case 'trainServer':
setRunStatus(status) { this.trainB && this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
switch (status) { break;
case '01': // 停止 case 'trainWindowBorder':
this.setDirectionStopType(this.model.directionType); // 设置运行方向状态类型 this.trainB && this.trainB.setBodyBoxShape('stroke', this.style.Train.trainStatusStyle.defaultDestinationColor);
break; break;
case '02': // 运行 default:
this.setDirectionType(this.model.directionType); // 设置运行方向状态类型 this.trainB && this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break; }
} }
}
}
} // 设置运行方向状态类型
// 设置运行模式 setDirectionType(type, flag) {
setRunMode(status) { if (this.style.Train.trainStatusStyle.directionType.length > 0) {
if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) { this.style.Train.trainStatusStyle.directionType.forEach((item) => {
this.style.Train.trainStatusStyle.runModeStatus.some((item) => { if (type === item.type) {
if (status === item.status) { let lineLShow = item.lineLShow;
this.trainL && this.trainL.setColor(item.trainLColor); let arrowLShow = item.arrowLShow;
this.trainR &&this.trainR.setColor(item.trainRColor); let lineRShow = item.lineRShow;
return true; let arrowRShow = item.arrowRShow;
} if (flag) {
}); lineLShow = !item.lineLShow;
} arrowLShow = !item.arrowLShow;
} lineRShow = !item.lineRShow;
// 设置运行控制状态类型 arrowRShow = !item.arrowRShow;
setRunControlStatus(status) { }
if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) { this.trainL && this.trainL.setLineShow(lineLShow);
this.style.Train.trainStatusStyle.runControlStatus.some((item) => { this.trainL && this.trainL.setArrowShow(arrowLShow);
if (status === item.status) { this.trainR && this.trainR.setLineShow(lineRShow);
this.trainB && this.trainB.setHShow(item.hShow); this.trainR && this.trainR.setArrowShow(arrowRShow);
this.trainB && this.trainB.setSShow(item.sShow); return true;
return true; }
} });
}); }
} }
} // 设置列车停止方向类型
// 设置车门状态类型 setDirectionStopType(type) {
setDoorStatus(status) { if (this.style.Train.trainStatusStyle.directionStopType.length > 0) {
if (this.style.Train.trainStatusStyle.doorStatus.length > 0) { this.style.Train.trainStatusStyle.directionStopType.forEach((item) => {
this.style.Train.trainStatusStyle.doorStatus.some((item) => { if (type === item.type) {
if (status === item.status) { this.trainL && this.trainL.setLineShow(item.lineLShow);
this.trainB && this.trainB.setDShow(item.dShow); this.trainR && this.trainR.setLineShow(item.lineRShow);
return true; return true;
} }
}); });
} }
} }
// 设置通信状态类型 // 设置运行状态
setCommunicationStatus() { setRunStatus(status, flag) {
if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) { switch (status) {
this.style.Train.trainStatusStyle.communicationStatus.some((item) => { case '01': // 停止
if (status === item.status) { this.setDirectionStopType(this.model.directionType); // 设置运行方向状态类型
this.trainB && this.trainB.setTrainColor(item.trainColor); break;
return true; case '02': // 运行
} this.setDirectionType(this.model.directionType, flag); // 设置运行方向状态类型
}); break;
} }
}
// 设置报警状态
setAlarmStatus(status) {
if (this.style.Train.trainStatusStyle.alarmStatus.length >0) {
this.style.Train.trainStatusStyle.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setAShow(item.aShow);
return true;
}
});
}
}
setTrainTypeStatus(type) {
if (this.style.Train.trainStatusStyle.trainTypeStatus) {
this.style.Train.trainStatusStyle.trainTypeStatus.some((item) => {
if ( type === item.type) {
item.serviceNumberColor && this.trainB && this.trainB.setTextTrainServerColor(item.serviceNumberColor);
item.trainNumberColor && this.trainB && this.trainB.setTextTrainNumberColor(item.trainNumberColor);
item.trainTargetColor && this.trainB && this.trainB.setTextTrainTargetColor(item.trainTargetColor);
item.groupNumberColor && this.trainB && this.trainB.setTextTrainTargetNumberColor(item.groupNumberColor);
}
});
}
}
// 设置状态
setState(model) {
this.model = model;
if (model) {
this.recover();
this.setServerNoType(model.serverNoType); // 设置服务号状态类型
this.setDestinationStatus(model.destinationStatus); // 设置目的地状态
this.setRunStatus(model.runStatus); // 设置运行状态
this.setRunMode(model.runMode); // 设置运行模式
this.setRunControlStatus(model.runControlStatus); // 设置运行控制状态类型
this.setDoorStatus(model.doorStatus); // 设置车门状态类型
this.setCommunicationStatus(model.communicationStatus); // 设置通信状态类型
this.setAlarmStatus(model.alarmStatus); // 设置报警状态
this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式
}
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if (!style.Train.trainBody.changeTrainWidth) { return; }
if (this.nameFormat) {
const arr = this.nameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
this.size += (style.Train.trainNumber.targetCodePrefix || '').length;
break;
}
case 'serviceNumber': {
this.size += (style.Train.trainServer.serviceNumberPrefix || '').length;
break;
}
case 'tripNumber': {
this.size += (style.Train.trainTarget.tripNumberPrefix || '').length;
break;
}
case 'groupNumber': {
this.size += (style.Train.trainTargetNumber.groupNumberPrefix || '').length;
break;
}
}
});
} else {
this.size = 9;
}
this.style.Train.common.trainWidth = this.size * this.fontSize * this.style.Train.common.aspectRatio + this.style.Train.common.trainWidthMoreText;
}
removeTrainDetail() {
this.trainB && this.trainB.removeTrainDetail();
}
getBoundingRect() { }
const list = [this.trainB, this.trainL, this.trainR]; // 设置运行模式
let rect = null; setRunMode(status) {
if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) {
this.style.Train.trainStatusStyle.runModeStatus.some((item) => {
if (status === item.status) {
this.trainL && this.trainL.setColor(item.trainLColor);
this.trainR && this.trainR.setColor(item.trainRColor);
return true;
}
});
}
}
// 设置运行控制状态类型
setRunControlStatus(status) {
if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) {
this.style.Train.trainStatusStyle.runControlStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setHShow(item.hShow);
this.trainB && this.trainB.setSShow(item.sShow);
return true;
}
});
}
}
// 设置车门状态类型
setDoorStatus(status) {
if (this.style.Train.trainStatusStyle.doorStatus.length > 0) {
this.style.Train.trainStatusStyle.doorStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setDShow(item.dShow);
return true;
}
});
}
}
// 设置通信状态类型
setCommunicationStatus() {
if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) {
this.style.Train.trainStatusStyle.communicationStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setTrainColor(item.trainColor);
return true;
}
});
}
}
// 设置报警状态
setAlarmStatus(status) {
if (this.style.Train.trainStatusStyle.alarmStatus.length > 0) {
this.style.Train.trainStatusStyle.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB && this.trainB.setAShow(item.aShow);
return true;
}
});
}
}
setTrainTypeStatus(type) {
if (this.style.Train.trainStatusStyle.trainTypeStatus) {
this.style.Train.trainStatusStyle.trainTypeStatus.some((item) => {
if ( type === item.type) {
item.serviceNumberColor && this.trainB && this.trainB.setTextTrainServerColor(item.serviceNumberColor);
item.trainNumberColor && this.trainB && this.trainB.setTextTrainNumberColor(item.trainNumberColor);
item.trainTargetColor && this.trainB && this.trainB.setTextTrainTargetColor(item.trainTargetColor);
item.groupNumberColor && this.trainB && this.trainB.setTextTrainTargetNumberColor(item.groupNumberColor);
}
});
}
}
// 设置状态
setState(model) {
this.model = model;
// let points = [];
const flag = false;
// if (this.model.sectionModel && this.model.sectionModel.points) {
// points = this.model.sectionModel.points;
// if (points.length) {
// const pointFlag = points[0].x - points[points.length - 1].x;
// if (pointFlag > 0) {
// flag = true; // 方向去反
// }
// }
// }
if (model) {
this.recover();
this.setServerNoType(model.serverNoType); // 设置服务号状态类型
this.setDestinationStatus(model.destinationStatus); // 设置目的地状态
this.setRunStatus(model.runStatus, flag); // 设置运行状态
this.setRunMode(model.runMode); // 设置运行模式
this.setRunControlStatus(model.runControlStatus); // 设置运行控制状态类型
this.setDoorStatus(model.doorStatus); // 设置车门状态类型
this.setCommunicationStatus(model.communicationStatus); // 设置通信状态类型
this.setAlarmStatus(model.alarmStatus); // 设置报警状态
this.setTrainTypeStatus(model.type); // 根据列车类型设置列车识别号样式
}
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if (!style.Train.trainBody.changeTrainWidth) { return; }
if (this.nameFormat) {
const arr = this.nameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
this.size += (style.Train.trainNumber.targetCodePrefix || '').length;
break;
}
case 'serviceNumber': {
this.size += (style.Train.trainServer.serviceNumberPrefix || '').length;
break;
}
case 'tripNumber': {
this.size += (style.Train.trainTarget.tripNumberPrefix || '').length;
break;
}
case 'groupNumber': {
this.size += (style.Train.trainTargetNumber.groupNumberPrefix || '').length;
break;
}
}
});
} else {
this.size = 9;
}
this.style.Train.common.trainWidth = this.size * this.fontSize * this.style.Train.common.aspectRatio + this.style.Train.common.trainWidthMoreText;
}
removeTrainDetail() {
this.trainB && this.trainB.removeTrainDetail();
}
list.forEach(elem => { getBoundingRect() {
if (elem) { const list = [this.trainB, this.trainL, this.trainR];
const tempRect = elem.getBoundingRect(); let rect = null;
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
if (rect) {
rect.union(tempRect);
} else {
rect = tempRect;
}
}
}
});
return rect || new BoundingRect(0, 0, 0, 0); list.forEach(elem => {
} if (elem) {
createTrainBorder() { const tempRect = elem.getBoundingRect();
const rect = Object.assign({}, this.getBoundingRect()); if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
rect.x -= this.style.Train.common.trainWidth / 2; if (rect) {
rect.y -= 5; rect.union(tempRect);
rect.width += this.style.Train.common.trainWidth; } else {
rect.height += 10; rect = tempRect;
}
}
}
});
this.trainBorder = new Rect({ return rect || new BoundingRect(0, 0, 0, 0);
zlevel: this.zlevel, }
z: this.z, createTrainBorder() {
silent: true, const rect = Object.assign({}, this.getBoundingRect());
shape: rect, rect.x -= this.style.Train.common.trainWidth / 2;
style: { rect.y -= 5;
lineDash: [3, 3], rect.width += this.style.Train.common.trainWidth;
stroke: this.style.borderColor, rect.height += 10;
fill: this.style.transparentColor
}
});
this.add(this.trainBorder); this.trainBorder = new Rect({
} zlevel: this.zlevel,
z: this.z,
silent: true,
shape: rect,
style: {
lineDash: [3, 3],
stroke: this.style.borderColor,
fill: this.style.transparentColor
}
});
this.add(this.trainBorder);
}
} }

View File

@ -134,7 +134,7 @@ export const userSimulation = '013'; // 仿真系统
export const userScreen = '014'; // 大屏系统 export const userScreen = '014'; // 大屏系统
export const userPlan = '015'; // 计划系统 export const userPlan = '015'; // 计划系统
export const userDesign = '016'; // 设计系统 export const userDesign = '016'; // 设计系统
const isDev = process.env.NODE_ENV === 'development'; // const isDev = process.env.NODE_ENV === 'development';
export const UrlConfig = { export const UrlConfig = {
display: '/display', display: '/display',

View File

@ -251,14 +251,7 @@ export default {
}, },
// //
onContextMenu(em) { onContextMenu(em) {
const path = window.location.href; this.$emit('onMenu', em);
let mouseWheelFlag = false;
if (path.includes('design/userlist/map/draw')) {
mouseWheelFlag = true;
}
if (!mouseWheelFlag) { //
this.$emit('onMenu', em);
}
}, },
// //
mapViewLoaded(loading) { mapViewLoaded(loading) {

View File

@ -8,7 +8,7 @@
<el-button size="small" :disabled="!recoverStepData.length" @click="recover">恢复</el-button> <el-button size="small" :disabled="!recoverStepData.length" @click="recover">恢复</el-button>
</el-button-group> </el-button-group>
</div> </div>
<jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" /> <jlmap-visual ref="jlmapVisual" @onSelect="clickEvent" @onMenu="onContextmenu" />
</div> </div>
<div class="map-draft"> <div class="map-draft">
<div v-show="viewDraft === 'draft'" class="box"> <div v-show="viewDraft === 'draft'" class="box">
@ -49,7 +49,7 @@
</template> </template>
<script> <script>
import { saveMap, getMapDetail, verifyMap, postBuildMapImport } from '@/api/jmap/mapdraft'; import { saveMap, getMapDetail, verifyMap, postBuildMapImport } from '@/api/jmap/mapdraft';
import { ViewMode, TrainingMode } from '@/scripts/ConstDic'; import { ViewMode, TrainingMode, getDeviceMenuByDeviceType } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import JlmapVisual from '@/views/jlmap/index'; import JlmapVisual from '@/views/jlmap/index';
import MapOperate from './mapoperate/index'; import MapOperate from './mapoperate/index';
@ -59,7 +59,6 @@ import { mapGetters } from 'vuex';
import ConfigMap from './configMap'; import ConfigMap from './configMap';
import DataRelation from './dataRelation/index'; import DataRelation from './dataRelation/index';
// import { deepAssign } from '@/utils/index';
export default { export default {
name: 'MapView', name: 'MapView',
@ -204,16 +203,16 @@ export default {
this.selected = device || null; this.selected = device || null;
this.selected && this.handleSelectControlPage(device); this.selected && this.handleSelectControlPage(device);
}, },
// onContextmenu(em) { onContextmenu(em) {
// this.point = { this.point = {
// x: em.clientX, x: em.clientX,
// y: em.clientY y: em.clientY
// }; };
// if (!em.deviceType) { if (!em.deviceType) {
// var menu = getDeviceMenuByDeviceType('Cancel'); var menu = getDeviceMenuByDeviceType('Cancel');
// this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu }); this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
// } }
// }, },
saveMapEvent() { saveMapEvent() {
if (this.$refs.jlmapVisual) { if (this.$refs.jlmapVisual) {
const map = this.$store.state.map.map; const map = this.$store.state.map.map;

View File

@ -231,7 +231,6 @@ export default {
cancelButtonText: this.$t('map.cancel'), cancelButtonText: this.$t('map.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -241,7 +241,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -233,7 +233,6 @@ export default {
cancelButtonText: this.$t('map.cancel'), cancelButtonText: this.$t('map.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -215,7 +215,6 @@ export default {
cancelButtonText: this.$t('map.cancel'), cancelButtonText: this.$t('map.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -322,9 +322,6 @@ export default {
updateMapModel(obj) { updateMapModel(obj) {
this.$emit('updateMapModel', obj); this.$emit('updateMapModel', obj);
}, },
// delMapModel(obj) {
// this.$emit('delMapModel', obj);
// },
setCenter(code) { setCenter(code) {
this.$emit('setCenter', code); this.$emit('setCenter', code);
} }

View File

@ -211,7 +211,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -202,7 +202,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -244,7 +244,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -423,7 +423,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -232,7 +232,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', _that.selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -286,7 +286,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -327,7 +327,6 @@ export default {
// / // /
handleDelete(selected) { handleDelete(selected) {
const models = []; const models = [];
// const remove = [];
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
if (elem.type == '03' && elem.relSwitchCode == selected.code) { if (elem.type == '03' && elem.relSwitchCode == selected.code) {
models.push(deepAssign({ _type: 'Section', code: elem.code }, { _dispose: true })); models.push(deepAssign({ _type: 'Section', code: elem.code }, { _dispose: true }));
@ -339,8 +338,6 @@ export default {
} }
}); });
models.push(deepAssign(selected, { _dispose: true })); models.push(deepAssign(selected, { _dispose: true }));
// this.$emit('delMapModel', selected);
// this.$emit('delMapModel', remove);
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
}, },
findLinkData(code) { findLinkData(code) {
@ -389,7 +386,6 @@ export default {
}, },
// //
removeSwitchSection() { removeSwitchSection() {
// const remove = [];
const models = []; const models = [];
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
@ -403,7 +399,6 @@ export default {
models.push(elem); models.push(elem);
} }
}); });
// this.$emit('delMapModel', remove);
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
}, },

View File

@ -222,7 +222,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -161,7 +161,7 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$emit('delMapModel', train); this.$emit('updateMapModel', {...train, _dispose: true});
this.deviceSelect(); this.deviceSelect();
}).catch(() => { }).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete')); this.$message.info(this.$t('tip.cancelledDelete'));
@ -177,7 +177,10 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$emit('delMapModel', this.trainList); this.trainList.forEach(item => {
item['_dispose'] = true;
});
this.$emit('updateMapModel', this.trainList);
this.deviceSelect(); this.deviceSelect();
}).catch(() => { }).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete')); this.$message.info(this.$t('tip.cancelledDelete'));

View File

@ -16,7 +16,6 @@
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three"> <el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three">
<div style="height: 100%"> <div style="height: 100%">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<!-- style="display: flex;justify-content: center;" -->
<div style="text-align:center;"> <div style="text-align:center;">
<el-button type="danger" size="big" @click="removeTrainWindow">{{ $t('map.deleteTrainWindow') }}</el-button> <el-button type="danger" size="big" @click="removeTrainWindow">{{ $t('map.deleteTrainWindow') }}</el-button>
<el-button type="primary" size="big" style="margin-top:10px" @click="createTrainWindow">{{ $t('map.createTrainWindow') }}</el-button> <el-button type="primary" size="big" style="margin-top:10px" @click="createTrainWindow">{{ $t('map.createTrainWindow') }}</el-button>
@ -59,7 +58,8 @@ export default {
}, },
width: 0, width: 0,
height: 0, height: 0,
sectionCode: '' sectionCode: '',
isReversal: false
}, },
rules: { rules: {
code: [ code: [
@ -119,7 +119,8 @@ export default {
map: { map: {
name: this.$t('map.mapData'), name: this.$t('map.mapData'),
item: [ item: [
{ prop: 'sectionCode', label: this.$t('map.trainWindowSectionCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.filterSectionList } { prop: 'sectionCode', label: this.$t('map.trainWindowSectionCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.filterSectionList },
{ prop: 'isReversal', label: '车头翻转', type: 'checkbox' }
] ]
} }
} }
@ -155,7 +156,8 @@ export default {
_type: 'TrainWindow', _type: 'TrainWindow',
code: getUID('TrainWindow'), code: getUID('TrainWindow'),
trainWindowShow: true, trainWindowShow: true,
point: {} point: {},
isReversal: false
}; };
if (opts) { if (opts) {
@ -221,10 +223,11 @@ export default {
this.trainWindowList.forEach(elem => { this.trainWindowList.forEach(elem => {
remove.push({ remove.push({
_type: 'TrainWindow', _type: 'TrainWindow',
code: elem.code code: elem.code,
_dispose: true
}); });
}); });
this.$emit('delMapModel', remove); this.$emit('updateMapModel', remove);
} }
}).catch(() => { }).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete')); this.$message.info(this.$t('tip.cancelledDelete'));
@ -240,10 +243,11 @@ export default {
this.trainWindowList.forEach(elem => { this.trainWindowList.forEach(elem => {
remove.push({ remove.push({
_type: 'TrainWindow', _type: 'TrainWindow',
code: elem.code code: elem.code,
_dispose: true
}); });
}); });
this.$emit('delMapModel', remove); this.$emit('updateMapModel', remove);
} }
if (collection && collection.length) { if (collection && collection.length) {
@ -284,7 +288,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {

View File

@ -209,7 +209,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'), cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// _that.$emit('delMapModel', selected);
_that.$emit('updateMapModel', {...selected, _dispose: true}); _that.$emit('updateMapModel', {...selected, _dispose: true});
_that.deviceSelect(); _that.deviceSelect();
}).catch(() => { }).catch(() => {