This commit is contained in:
fan 2020-04-07 14:41:38 +08:00
commit 87ddad535b
4 changed files with 38 additions and 24 deletions

View File

@ -26,6 +26,12 @@ class Signal extends Group {
this.zlevel = model.zlevel;
this.isShowShape = true;
this.z = 7;
if (!model.positionPoint) {
model.positionPoint = {
x: 0,
y: 0
};
}
this.create();
this.createMouseEvent();
this.transformRotation(this);
@ -34,6 +40,7 @@ class Signal extends Group {
}
this.setState(model);
this.checkIsDrawMap();
}
create() {
@ -49,8 +56,8 @@ class Signal extends Group {
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)
x: model.position.x + model.positionPoint.x,
y: model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR)
});
// 信号灯
@ -67,16 +74,16 @@ class Signal extends Group {
drict: drict,
x: endPoint.x + i * drict * style.Signal.lamp.radiusR * 2.3,
y: endPoint.y,
originX: model.position.x,
originY: model.position.y
originX: model.position.x + model.positionPoint.x,
originY: model.position.y + model.positionPoint.y
});
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 sigNameX = model.position.x + model.positionPoint.x - drict * (style.Signal.post.standardWidth) + 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({
@ -178,8 +185,8 @@ class Signal extends Group {
drict: drict,
x: endPoint.x,
y: endPoint.y,
originX: model.position.x,
originY: model.position.y
originX: model.position.x + model.positionPoint.x,
originY: model.position.y + model.positionPoint.y
});
this.add(this.virtualSignal); // 虚拟信号机 (哈尔滨线路)
} else {
@ -204,7 +211,7 @@ class Signal extends Group {
this.transformRotation(item);
} else if (item) {
if (item._subType !== 'SignalName' || this.model.nameRotated) {
item.origin = [this.model.position.x, this.model.position.y];
item.origin = [this.model.position.x + this.model.positionPoint.x, this.model.position.y + this.model.positionPoint.y];
item.rotation = -Math.PI / 180 * Number(this.model.rotate);
item.dirty();
}

View File

@ -128,8 +128,7 @@ router.beforeEach((to, from, next) => {
}
} else {
// 继电器使用
console.log(to);
// console.log(to);
// 未登录情况下
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入

View File

@ -181,6 +181,7 @@ export default {
nameRotated: false,
nameShow: true,
namePosition: { x: 0, y: 0 },
positionPoint: { x: 0, y: 0 },
buttonShow: true,
useType: '01',
potLampType: '01',

View File

@ -96,6 +96,7 @@ export default {
guideShow: false,
buttonShow: false,
position: { x: 0, y: 0 },
positionPoint: { x: 0, y: 0 },
buttonPosition: { x: 0, y: 0 },
guidePosition: { x: 0, y: 0 }
},
@ -148,9 +149,9 @@ export default {
item: [
{ prop: 'code', label: this.$t('map.signalCodeColon'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.signalNameColon'), type: 'input' },
{ prop: 'position', label: this.$t('map.signalPosition'), type: 'coordinate', width: '140px', children: [
{ 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: 'positionPoint', label: '信号机偏移坐标:', type: 'coordinate', width: '140px', children: [
{ prop: 'positionPoint.x', firstLevel: 'positionPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'positionPoint.y', firstLevel: 'positionPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ 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 },
@ -203,10 +204,10 @@ export default {
sectionOffset: [
{ required: true, message: this.$t('rules.pleaseEnterSignalOffset'), trigger: 'blur' }
],
'position.x': [
'positionPoint.x': [
{ required: true, message: this.$t('rules.pleaseEnterSignalPositionX'), trigger: 'blur' }
],
'position.y': [
'positionPoint.y': [
{ required: true, message: this.$t('rules.pleaseEnterSignalPositionY'), trigger: 'blur' }
],
'buttonPosition.x': [
@ -255,10 +256,15 @@ export default {
},
deviceSelect(selected) {
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) {
console.log(selected, selected.positionPoint, 'selected');
this.$refs.dataform.resetFields();
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.editModel.rotate = selected.rotate || 0; //
if (!selected.positionPoint) {
this.editModel.positionPoint.x = 0;
this.editModel.positionPoint.y = 0;
}
this.editModel.right = Boolean(selected.right);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSingalCode'.toUpperCase()) {
if (selected.type == '01' || selected.type === '03') {
@ -311,18 +317,19 @@ export default {
const models = [];
this.questionList = [];
this.signalList.forEach(item => {
const signalModel = deepAssign({}, item);
const section = this.findSection(signalModel);
const signalModel = deepAssign({}, item); //
const section = this.findSection(signalModel); // model
if (section.code && item.sectionCode != section.code) {
signalModel.sectionCode = section.code;
signalModel.sectionCode = section.code; //
}
if (!section.code) {
this.questionList.push(`${item.name}(${item.code}) 信号机位置可能不正确,请手动调试归属区段及偏移量.`);
}
signalModel.sectionOffset = this.addModel.number;
if (signalModel.right) {
if (section.lengthFact) {
signalModel.sectionOffset = Math.abs(Number(section.lengthFact) - this.addModel.number);
} else { //
signalModel.sectionOffset = this.addModel.number;
if (signalModel.right) {
if (section.lengthFact) {
signalModel.sectionOffset = Math.abs(Number(section.lengthFact) - this.addModel.number);
}
}
}
models.push(signalModel);