站台屏蔽门调整

This commit is contained in:
fan 2019-12-13 14:19:38 +08:00
parent 083e70dc02
commit fc3ab4cc21
6 changed files with 44 additions and 93 deletions

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import ESafeDoor from './ESafeDoor'; import ESafeDoor from './ESafeDoor';
import EHighlight from '../element/EHighlight';
export default class Line2 extends Group { export default class Line2 extends Group {
constructor(model, style) { constructor(model, style) {
@ -12,6 +13,7 @@ export default class Line2 extends Group {
this.style = style; this.style = style;
this.create(); this.create();
this.setState(model); this.setState(model);
this.checkIsDrawMap();
} }
create() { create() {
@ -34,4 +36,17 @@ export default class Line2 extends Group {
setState(model) { setState(model) {
} }
drawSelected(selected) {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
} }

View File

@ -853,7 +853,7 @@ export default class Section extends Group {
drawSelected(selected) { drawSelected(selected) {
this.selected = selected; this.selected = selected;
if (selected) { if (selected) {
this.section && this.section.setStyle({stroke: 'rgba(204,255,255,0.8)'}); this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'});
} else { } else {
this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor });
} }

View File

@ -21,7 +21,7 @@ export default class EMouse extends Group {
z: this.device.z + 1, z: this.device.z + 1,
shape: stationTextRect, shape: stationTextRect,
style: { style: {
fill: 'rgba(204,255,255,0.5)' fill: 'rgba(0,255,255,0.6)'
} }
}); });

View File

@ -1,6 +1,5 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class EHighlight extends Group { class EHighlight extends Group {
constructor(device) { constructor(device) {
@ -11,13 +10,17 @@ class EHighlight extends Group {
} }
create() { create() {
if (this.device) { if (this.device) {
let fill = 'rgba(0,255,255,0.6)';
if (this.device._type === 'Psd') {
fill = 'rgba(255,0,0,0.6)';
}
const rect = this.device.getBoundingRect(); const rect = this.device.getBoundingRect();
this.lineBorder = new Rect({ this.lineBorder = new Rect({
zlevel: this.device.zlevel, zlevel: this.device.zlevel,
z: this.device.z + 1, z: this.device.z + 1,
shape: rect, shape: rect,
style: { style: {
fill: 'rgba(204,255,255,0.5)' fill: fill
} }
}); });
this.add(this.lineBorder); this.add(this.lineBorder);
@ -33,6 +36,7 @@ class EHighlight extends Group {
!this.selected && this.lineBorder && this.lineBorder.hide(); !this.selected && this.lineBorder && this.lineBorder.hide();
} }
drawSelected(selected) { drawSelected(selected) {
console.log(selected, this.lineBorder, this.device);
if (selected && this.lineBorder) { if (selected && this.lineBorder) {
this.lineBorder && this.lineBorder.show(); this.lineBorder && this.lineBorder.show();
this.selected = true; this.selected = true;

View File

@ -172,6 +172,9 @@ export default {
this.enabledTab = data.name; this.enabledTab = data.name;
}, },
setSelected(selected) { setSelected(selected) {
// if (selected._type === 'Psd' || selected._type === '') {
//
// }
switch (this.enabledTab) { switch (this.enabledTab) {
case 'protect': case 'protect':
this.$refs.protectOperate.setSelected(selected); this.$refs.protectOperate.setSelected(selected);

View File

@ -60,10 +60,6 @@ export default {
{ code: true, name: '右向'}, { code: true, name: '右向'},
{ code: false, name: '左向'} { code: false, name: '左向'}
], ],
isSmallStandList: [
{ code: false, name: '否'},
{ code: true, name: '是'}
],
editModel: { editModel: {
code: '', code: '',
name: '', name: '',
@ -75,9 +71,9 @@ export default {
stationCode: '', // stationCode: '', //
position: { x: 0, y: 0 }, position: { x: 0, y: 0 },
visible: true, // visible: true, //
isRight: null, isRight: true,
standTrackCode: '', standTrackCode: '',
isSmallStand: false small: false
// direction: '' // // direction: '' //
}, },
field: '', field: '',
@ -87,13 +83,12 @@ export default {
pointY: 0, // y pointY: 0, // y
width: 60, width: 60,
height: 20, height: 20,
doorType: '01', //
standTrackCode: '', // standTrackCode: '', //
standTrackUpCode: '', // standTrackUpCode: '', //
standTrackDownCode: '', // standTrackDownCode: '', //
stationstandDirection: '02', // stationstandDirection: '02', //
isRight: null, isRight: true,
isSmallStand: false small: false
} }
}; };
}, },
@ -124,9 +119,9 @@ export default {
{ prop: 'visible', label: this.$t('map.stationVisible'), type: 'checkbox' }, { prop: 'visible', label: this.$t('map.stationVisible'), type: 'checkbox' },
{ prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS, isHidden: !this.doorTypeOne }, { prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'editSectionSelectCode', buttonShowType: this.isButtonTypeES },
{ prop: 'isRight', label: '行驶方向', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList }, { prop: 'isRight', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'isSmallStand', label: '小型站台', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isSmallStandList } { prop: 'small', label: '是否小型站台:', type: 'checkbox' }
] ]
}, },
map: { map: {
@ -165,12 +160,6 @@ export default {
], ],
standTrackCode: [ standTrackCode: [
{ required: true, message: '请选择关联站台轨', trigger: 'change' } { required: true, message: '请选择关联站台轨', trigger: 'change' }
],
isRight: [
{ required: true, message: '请选择行驶方向', trigger: 'change'}
],
isSmallStand: [
{ required: true, message: '请选择是否为小型站台', trigger: 'change'}
] ]
}; };
// //
@ -193,20 +182,14 @@ export default {
{ prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'width', label: this.$t('map.stationstandWidth'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS, isHidden: !this.doorTypeOne }, { prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS, isHidden: !this.doorTypeOne },
{ prop: 'isRight', label: '行驶方向', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList }, { prop: 'isRight', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'isSmallStand', label: '小型站台', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isSmallStandList } { prop: 'small', label: '是否小型站台:', type: 'checkbox' }
] ]
}, },
door: { door: {
name: '屏蔽门数据', name: '屏蔽门数据',
item: [ item: [
{ prop: 'doorType', label: '屏蔽门类型:', type: 'radio', radioList: [ { prop: 'stationstandDirection', label: '屏蔽门朝向:', type: 'radio', radioList: this.DoorLocationTypeList }
{value: '01', label: '单侧屏蔽门' },
{value: '02', label: '双侧屏蔽门' }
] },
{ prop: 'stationstandDirection', label: '屏蔽门朝向:', type: 'radio', radioList: this.DoorLocationTypeList, isHidden: !this.doorTypeOne },
{ prop: 'standTrackUpCode', label: '上行站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectUpCode', buttonShowType: this.isButtonTypeU, isHidden: !this.doorTypeTwo },
{ prop: 'standTrackDownCode', label: '下行站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectDownCode', buttonShowType: this.isButtonTypeD, isHidden: !this.doorTypeTwo }
] ]
} }
} }
@ -228,18 +211,6 @@ export default {
], ],
standTrackCode: [ standTrackCode: [
{ required: true, message: '请选择关联站台轨', trigger: 'change' } { required: true, message: '请选择关联站台轨', trigger: 'change' }
],
standTrackUpCode: [
{ required: true, message: '请选择站台轨', trigger: 'change' }
],
standTrackDownCode: [
{ required: true, message: '请选择站台轨', trigger: 'change' }
],
isRight: [
{ required: true, message: '请选择行驶方向', trigger: 'change'}
],
isSmallStand: [
{ required: true, message: '请选择是否为小型站台', trigger: 'change'}
] ]
}; };
}, },
@ -249,17 +220,8 @@ export default {
isButtonTypeS() { isButtonTypeS() {
return this.field == 'sectionSelectCode'; return this.field == 'sectionSelectCode';
}, },
isButtonTypeU() { isButtonTypeES() {
return this.field == 'sectionSelectUpCode'; return this.field === 'editSectionSelectCode';
},
isButtonTypeD() {
return this.field == 'sectionSelectDownCode';
},
doorTypeOne() {
return this.addModel.doorType == '01';
},
doorTypeTwo() {
return this.addModel.doorType == '02';
}, },
PhysicalSectionList() { PhysicalSectionList() {
let list = []; let list = [];
@ -322,14 +284,9 @@ export default {
this.activeName = 'second'; this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.$emit('standStationCode', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectUpCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'editSectionSelectCode'.toUpperCase()) {
this.addModel.standTrackUpCode = selected.code; this.editModel.standTrackCode = selected.code;
this.activeName = 'second'; this.activeName = 'first';
this.field = '';
this.$emit('standStationCode', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectDownCode'.toUpperCase()) {
this.addModel.standTrackDownCode = selected.code;
this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.$emit('standStationCode', '');
} }
@ -354,7 +311,7 @@ export default {
}, },
standTrackCode: this.addModel.standTrackCode, standTrackCode: this.addModel.standTrackCode,
isRight: this.addModel.isRight, isRight: this.addModel.isRight,
isSmallStand: this.addModel.isSmallStand small: this.addModel.small
}; };
this.stationList.forEach(elem => { this.stationList.forEach(elem => {
if (elem.code == this.addModel.stationCode) { if (elem.code == this.addModel.stationCode) {
@ -363,7 +320,7 @@ export default {
} }
}); });
models.push(model); models.push(model);
if (this.addModel.doorType == '01' && !this.addModel.isSmallStand) { if (!this.addModel.small) {
const uid = getUID('Psd', this.psdList); const uid = getUID('Psd', this.psdList);
const param = { const param = {
_type: 'Psd', _type: 'Psd',
@ -381,36 +338,8 @@ export default {
param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space; param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space;
} }
models.push(param); models.push(param);
} else if (this.addModel.doorType == '02' && !this.addModel.isSmallStand) {
const arr = [];
for (let index = 0; index < 2; index++) {
const uid = getUID('Psd', [...this.psdList, ...arr]);
const param = {
_type: 'Psd',
code: uid,
name: `Psd${[...this.psdList, ...arr].length + 1}`,
width: this.addModel.width,
height: 3,
standCode: Standuid, // code
standTrackCode: '', //
position: {
x: models[0].position.x,
y: this.addModel.pointY
}
};
if (index == 0) {
param.standTrackCode = this.addModel.standTrackUpCode;
param.position.y = this.addModel.pointY - (this.addModel.height / 2) - space;
} else {
param.standTrackCode = this.addModel.standTrackDownCode;
param.position.y = this.addModel.pointY + (this.addModel.height / 2) + space;
}
arr.push(param);
}
arr.forEach(item => {
models.push(item);
});
} }
console.log(models, '===========');
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
}); });