传输信号机 && 佛山进路预览调整

This commit is contained in:
fan 2021-01-19 11:09:53 +08:00
parent 19cede5338
commit 145259d3b5
6 changed files with 97 additions and 20 deletions

View File

@ -252,6 +252,10 @@ class SkinCode extends defaultStyle {
},
lowButton:{
display: false // 现地 信号机按钮
},
transmission: { // 传输信号机
fillColor: '#f00',
sideLength: 20
}
};

View File

@ -41,7 +41,11 @@ class Signal extends Group {
};
}
this.cbtcStatus = '';
this.create();
if (model.type === 'TRANSMISSION') {
this.createTransmission();
} else {
this.create();
}
this.createMouseEvent();
this.checkIsDrawMap();
this.transformRotation(this);
@ -314,7 +318,51 @@ class Signal extends Group {
this.lamps.forEach(lamp => { this.add(lamp); });
}
}
createTransmission() {
const model = this.model;
const style = this.style;
const drict = this.model.right ? 1 : -1; // 朝向 左:右
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
// 信号机名称
const sigNameX = model.position.x + model.positionPoint.x + drict * 0.433 * style.Signal.transmission.sideLength + model.namePosition.x;
const sigNameY = model.position.y + model.positionPoint.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.right ? 'left' : 'right';
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
});
if (style.Signal.transmission) {
const sigPostY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR);
this.transmission = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
[model.position.x + model.positionPoint.x, sigPostY + style.Signal.transmission.sideLength / 2],
[model.position.x + model.positionPoint.x, sigPostY - style.Signal.transmission.sideLength / 2],
[model.position.x + model.positionPoint.x + drict * 0.866 * style.Signal.transmission.sideLength, sigPostY]
]
},
style: {
fill: style.Signal.transmission.fillColor
}
});
this.add(this.transmission);
}
this.add(this.sigName);
}
createMouseEvent() {
if (this.style.Signal.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
@ -635,37 +683,37 @@ class Signal extends Group {
}
// 恢复状态
recover() {
this.lamps.forEach(item=> { item.show(); });
this.lamps && this.lamps.forEach(item=> { item.show(); });
this.sigName.setStyle({ textBorderWidth: 0 });
this.sigName.setColor(this.style.Signal.text.defaultColor);
this.remainTImeName.hide();
this.sigDelay.hide();
this.remainTImeName && this.remainTImeName.hide();
this.sigDelay && this.sigDelay.hide();
if (this.style.Signal.auto.autoTriggerType != 'text') {
this.setAutoClose();
this.sigAuto.animationRecover();
this.sigAuto && this.sigAuto.animationRecover();
}
this.sigRoute.hide();
this.sigRoute && this.sigRoute.hide();
this.sigBack && this.sigBack.hide();
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
this.sigPost && this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
if (this.style.Signal.lamp.guidName === 'singleRY') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
this.lamps && this.lamps[0] && this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
}
if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') {
this.lamps[1].hide();
this.lamps && this.lamps[1] && this.lamps[1].hide();
}
if (this.style.Signal.lamp.faultType == 'flash') {
this.lamps[0].faultHide();
this.lamps && this.lamps[0] && this.lamps[0].faultHide();
} else if (this.style.Signal.lamp.faultType == 'cross') {
this.lamps[0].setFault2Corss(false);
this.lamps && this.lamps[0] && this.lamps[0].setFault2Corss(false);
} else if (this.style.Signal.lamp.faultType == 'watch') {
const device = findDeviceByModelDepType(this.model, deviceType.LampFilament, 'stationCode');
if (device && device.instance) {
device.instance.setControlColor('#9F9C9C');
}
} else if (this.style.Signal.lamp.faultType == 'light') {
this.lamps[0].setAnimationEnd();
this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd();
}
this.insideTriangle && this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.strokeColor});
@ -675,12 +723,12 @@ class Signal extends Group {
this.ciConfirm && this.ciConfirm.hide();
this.sigBack && this.sigBack.hide();
this.sigBack && this.sigBack.stopAnimation(false);
this.lamps && this.lamps[0].setAnimationEnd();
this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd();
this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor);
}
setState(model) {
if (!this.isShowShape) return;
if (!this.isShowShape || this.model.type === 'TRANSMISSION') return;
const path = window.location.href;
this.recover();
@ -770,10 +818,14 @@ class Signal extends Group {
}
getBoundingRect() {
const rect = this.sigPost.getBoundingRect().clone();
if (this.insideTriangle) {
let rect = '';
if (this.model.type === 'TRANSMISSION') {
rect = this.transmission.getBoundingRect().clone();
} else if (this.insideTriangle) {
rect = this.sigPost.getBoundingRect().clone();
rect.union(this.insideTriangle.getBoundingRect().clone());
} else {
rect = this.sigPost.getBoundingRect().clone();
this.lamps.forEach(elem => {
rect.union(elem.getBoundingRect().clone());
});

View File

@ -151,7 +151,7 @@ export default {
{
name: this.$t('map.preview'),
handleClick: this.flankProtectionSwitchDetail,
showControl: (row) => { return row.routeFlankProtectionList.length > 0; }
showControl: (row) => { return row.routeFlankProtectionList && row.routeFlankProtectionList.length > 0; }
}
]
},

View File

@ -51,6 +51,7 @@
:placeholder="item.placeholder"
:disabled="item.disabled"
:clearable="item.clearable"
@change="((val)=>{deviceChange(val, item)})"
>
<el-option
v-for="option in item.options"

View File

@ -86,6 +86,7 @@ class Model {
this.noOverlap = false; // 是否无延续保护
this.routeEnd = false; // 是否进路终端
this.ignoreRouteEnd = []; // 不生成进路的信号机终端
this.linkSignal = ''; // 传输信号机 关联信号机
}
SwitchModel() {
this._type = 'Switch';

View File

@ -62,7 +62,8 @@ export default {
signalTypeList: [
{ code: 'PROTECTION', name: '防护信号机'},
{ code: 'BLOCKING', name: '阻挡信号机'},
{ code: 'PASSING', name: '通过信号机'}
{ code: 'PASSING', name: '通过信号机'},
{ code: 'TRANSMISSION', name: '传输信号机' }
],
field:'',
editModel: getModel('Signal'),
@ -94,6 +95,9 @@ export default {
}
return list;
},
isTransmissionSignal() {
return this.editModel.type !== 'TRANSMISSION';
},
form() {
return {
labelWidth: '150px',
@ -133,6 +137,7 @@ export default {
{ prop: 'guidePosition.x', firstLevel: 'guidePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'guidePosition.y', firstLevel: 'guidePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'linkSignal', label: '关联信号机:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, isHidden: this.isTransmissionSignal, deviceChange: this.changeLinkSignal, hover: this.hover, buttonType: 'linkSignal', buttonShowType: this.linkSignalShow },
{ prop: 'callOn', label: '是否引导信号:', type: 'checkbox'},
{ prop: 'turnBack', label: '是否自动折返始端:', type: 'checkbox', isHidden: this.editModel.virtual},
{ prop: 'ctc', label: '是否灭灯显示(CTC级)', type: 'checkbox'},
@ -188,12 +193,18 @@ export default {
],
'guidePosition.y': [
{ required: true, message: this.$t('rules.signalGuidePositionY'), trigger: 'blur' }
],
linkSignal: [
{ required: true, message: '请选择关联信号机!', trigger: 'change' }
]
};
},
signalSectionShow() {
return this.field == 'signalSection';
},
linkSignalShow() {
return this.field == 'linkSignal';
},
signalIgnoreRouteEnd() {
return this.field == 'signalIgnoreRouteEnd';
}
@ -231,8 +242,12 @@ export default {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
changeLinkSignal(code) {
const linkSignal = this.$store.getters['map/getDeviceByCode'](code);
if (linkSignal && linkSignal.name) { this.editModel.name = linkSignal.name; }
},
deviceSelect(selected) {
if (selected && selected._type == 'Signal' && (this.field != 'selectSingalCode' && this.field != 'signalCodesType' && this.field != 'signalIgnoreRouteEnd' && this.field != 'signalCodes')) {
if (selected && selected._type == 'Signal' && (this.field != 'selectSingalCode' && this.field != 'signalCodesType' && this.field != 'signalIgnoreRouteEnd' && this.field != 'signalCodes' && this.field != 'linkSignal')) {
this.handleInit();
this.editModel = getModel('Signal');
this.$refs.dataform && this.$refs.dataform.resetFields();
@ -275,6 +290,10 @@ export default {
// }
this.$refs.batchSetting.setData('signalCodes', selected.code);
this.activeName = 'three';
} else if (selected && selected._type == 'Signal' && this.field == 'linkSignal') {
this.editModel.linkSignal = selected.code;
this.editModel.name = selected.name;
this.activeName = 'first';
}
},
updateMapModel(data) {