This commit is contained in:
fan 2019-12-02 16:21:40 +08:00
commit 97af268212
7 changed files with 224 additions and 191 deletions

View File

@ -263,7 +263,7 @@ class SkinCode extends defaultStyle {
fontColor: '#ffffff', // 字体颜色
fontWeight: 'normal', // 字体粗细
textAlign: 'middle', // 字体水平对齐
textVerticalAlign: 'top' // 字体垂直对齐
textVerticalAlign: 'top', // 字体垂直对齐
},
lamp: {
count: 4, // 控制模式的个数

View File

@ -259,7 +259,13 @@ class SkinCode extends defaultStyle {
fontColor: '#ffffff', // 控制模式字体颜色
fontWeight: 'normal', // 控制模式字体粗细
textAlign: 'middle', // 控制模式水平对齐
textVerticalAlign: 'top' // 控制模式垂直对齐
textVerticalAlign: 'top', // 控制模式垂直对齐
centerControlText: '中控', // 中控文字内容
substationControlText: '站控', // 站控文字内容
emergencyControlText:'紧急站控', // 紧急站控文字内容
interconnectedControlText:'连锁控' // 连锁控文字内容
// stationCenterControlText: '站中控', // 站中控文字内容
// generalAlarmControlText: '总报警' // 总报警文字内容
},
lamp: {
count: 3, // 控制模式灯个数

View File

@ -263,7 +263,13 @@ class SkinCode extends defaultStyle {
fontColor: '#ffffff', // 字体颜色
fontWeight: 'normal', // 字体粗细
textAlign: 'middle', // 字体水平对齐
textVerticalAlign: 'top' // 字体垂直对齐
textVerticalAlign: 'top', // 字体垂直对齐
centerControlText: '中控', // 中控文字内容
substationControlText: '站控', // 站控文字内容
emergencyControlText:'紧急站控', // 紧急站控文字内容
interconnectedControlText:'连锁控' // 连锁控文字内容
// stationCenterControlText: '站中控', // 站中控文字内容
// generalAlarmControlText: '总报警' // 总报警文字内容
},
lamp: {
count: 4, // 控制模式的个数

View File

@ -260,7 +260,13 @@ class SkinCode extends defaultStyle {
fontColor: '#ffffff', // 字体颜色
fontWeight: 'normal', // 字体粗细
textAlign: 'middle', // 字体水平对齐
textVerticalAlign: 'top' // 字体垂直对齐
textVerticalAlign: 'top', // 字体垂直对齐
centerControlText: '中控', // 中控文字内容
substationControlText: '站控', // 站控文字内容
emergencyControlText:'紧急站控', // 紧急站控文字内容
interconnectedControlText:'连锁控' // 连锁控文字内容
// stationCenterControlText: '站中控', // 站中控文字内容
// generalAlarmControlText: '总报警' // 总报警文字内容
},
lamp: {
count: 4, // 控制模式的个数

View File

@ -242,7 +242,13 @@ class SkinCode extends defaultStyle {
fontColor: '#ffffff', // 字体颜色
fontWeight: 'normal', // 字体粗细
textAlign: 'middle', // 字体水平对齐
textVerticalAlign: 'top' // 字体垂直对齐
textVerticalAlign: 'top', // 字体垂直对齐
centerControlText: '中控', // 中控文字内容
substationControlText: '站控', // 站控文字内容
emergencyControlText:'紧急站控', // 紧急站控文字内容
interconnectedControlText:'连锁控' // 连锁控文字内容
// stationCenterControlText: '站中控', // 站中控文字内容
// generalAlarmControlText: '总报警' // 总报警文字内容
},
lamp: {
count: 2, // 控制模式灯个数

View File

@ -9,158 +9,163 @@ import EMouse from './EMouse';
/** 控制模式*/
export default class StationControl extends Group {
constructor(model, style) {
super();
this.selected = false;
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.z = 1;
this.model = model;
this.style = style;
this.create();
this.createMouseEvent();
this.setState(model);
}
constructor(model, style) {
super();
this.selected = false;
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.z = 1;
this.model = model;
this.style = style;
this.create();
this.createMouseEvent();
this.setState(model);
}
create() {
const model = this.model;
// 紧急站控
if (this.style.StationControl.lamp.emergencyControlShow) {
this.emergencyControl = new ESingleControl({
_subType: 'emergency',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: model.jjzkContent,
pop: false
});
this.add(this.emergencyControl);
}
// 中控按钮
if (this.style.StationControl.lamp.centerControlShow) {
this.centerControl = new ESingleControl({
_subType: 'center',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: model.zokContent,
pop: false
});
this.add(this.centerControl);
}
// 站控按钮
if (this.style.StationControl.lamp.substationControlShow) {
this.substationControl = new ESingleControl({
_subType: 'substation',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: model.zakContent,
pop: false
});
this.add(this.substationControl);
}
// 联锁控
if (this.style.StationControl.lamp.interconnectedControlShow) {
this.interconnectedControl = new ESingleControl({
_subType: 'interconnected',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: model.lskContent || '联锁控',
pop: false
});
this.add(this.interconnectedControl);
}
// 箭头
if (this.style.StationControl.arrow.show) {
const point = arrow(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8);
this.arrowsControl = new EArrow({
zlevel: this.zlevel,
z: this.z,
style: this.style,
count: this.count,
drict: 1,
point: point,
x: model.position.x + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y,
fill: this.style.StationControl.lamp.grayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
});
this.add(this.arrowsControl);
}
}
create() {
debugger;
const model = this.model;
// 紧急站控
if (this.style.StationControl.lamp.emergencyControlShow) {
this.emergencyControl = new ESingleControl({
_subType: 'emergency',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x - this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: this.style.StationControl.text.emergencyControlText,
// model.jjzkContent,
pop: false
});
this.add(this.emergencyControl);
}
// 中控按钮
if (this.style.StationControl.lamp.centerControlShow) {
this.centerControl = new ESingleControl({
_subType: 'center',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x - this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: this.style.StationControl.text.centerControlText,
// model.zokContent,
pop: false
});
this.add(this.centerControl);
}
// 站控按钮
if (this.style.StationControl.lamp.substationControlShow) {
this.substationControl = new ESingleControl({
_subType: 'substation',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x + this.style.StationControl.lamp.distance / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: this.style.StationControl.text.substationControlText,
// model.zakContent
pop: false
});
this.add(this.substationControl);
}
// 联锁控
if (this.style.StationControl.lamp.interconnectedControlShow) {
this.interconnectedControl = new ESingleControl({
_subType: 'interconnected',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
// context: model.lskContent || '联锁控',
context:this.style.StationControl.text.interconnectedControlText || '联锁控',
pop: false
});
this.add(this.interconnectedControl);
}
// 箭头
if (this.style.StationControl.arrow.show) {
const point = arrow(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8);
this.arrowsControl = new EArrow({
zlevel: this.zlevel,
z: this.z,
style: this.style,
count: this.count,
drict: 1,
point: point,
x: model.position.x + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.radiusR / 2 + this.style.StationControl.lamp.offset.y,
fill: this.style.StationControl.lamp.grayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
});
this.add(this.arrowsControl);
}
}
// 设置状态
setState(model) {
switch (model.status) {
case '00': // 无状态
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
break;
case '01': // 中控
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor);
break;
case '02': // 站控
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
break;
case '03': // 紧急站控
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
break;
}
}
// 设置状态
setState(model) {
switch (model.status) {
case '00': // 无状态
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
break;
case '01': // 中控
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.greenColor);
break;
case '02': // 站控
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.yellowColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
break;
case '03': // 紧急站控
this.emergencyControl && this.emergencyControl.setColor(this.style.StationControl.lamp.redColor);
this.substationControl && this.substationControl.setColor(this.style.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.StationControl.lamp.grayColor);
break;
}
}
/** 按钮是否按下*/
isPop(e) {
for (var i = 0; i < this.childCount(); i++) {
var rect = this.childAt(i).getBoundingRect();
if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) {
return true;
}
}
}
createMouseEvent() {
if (this.style.ZcControl.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); });
}
}
getShapeTipPoint() {
if (this.stationControl) {
var distance = 2;
var rect = this.stationControl.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
}
/** 按钮是否按下*/
isPop(e) {
for (var i = 0; i < this.childCount(); i++) {
var rect = this.childAt(i).getBoundingRect();
if (rect.contain(e.offsetX, e.offsetY) && this.childAt(i).pop) {
return true;
}
}
}
createMouseEvent() {
if (this.style.ZcControl.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); });
}
}
getShapeTipPoint() {
if (this.stationControl) {
var distance = 2;
var rect = this.stationControl.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
}
}

View File

@ -8,7 +8,7 @@
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<!-- <el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button> -->
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
@ -68,13 +68,13 @@ export default {
x: 0,
y: 0
},
stationCode: '',
zokContent: '',
zakContent: '',
jjzkContent: '',
zbjkContent: '',
zzkContent: '',
lskContent: ''
stationCode: ''
// zokContent: '',
// zakContent: '',
// jjzkContent: '',
// zbjkContent: '',
// zzkContent: '',
// lskContent: ''
},
addModel: {
stationCode: ''
@ -104,21 +104,21 @@ export default {
name: this.$t('map.drawData'),
item: [
{ prop: 'code', label: this.$t('map.stationControlCode'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.stationControlList, change: true, deviceChange: this.deviceChange },
{ prop: 'zokContent', label: this.$t('map.zokContent'), type: 'input' },
{ prop: 'zakContent', label: this.$t('map.zakContent'), type: 'input' },
{ prop: 'jjzkContent', label: this.$t('map.jjzkContent'), type: 'input' },
{ prop: 'zzkContent', label: this.$t('map.zzkContent'), type: 'input' },
{ prop: 'lskContent', label: `${this.$t('map.interconnected')}:`, type: 'input' },
// { prop: 'zokContent', label: this.$t('map.zokContent'), type: 'input' },
// { prop: 'zakContent', label: this.$t('map.zakContent'), type: 'input' },
// { prop: 'jjzkContent', label: this.$t('map.jjzkContent'), type: 'input' },
// { prop: 'zzkContent', label: this.$t('map.zzkContent'), type: 'input' },
// { prop: 'lskContent', label: `${this.$t('map.interconnected')}:`, type: 'input' },
{ prop: 'position', label: this.$t('map.stationControlPosition'), type: 'coordinate', width: '150px', 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: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px', change:true, deviceChange:this.updateView },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', change:true, deviceChange:this.updateView }
] }
]
},
map: {
name: this.$t('map.mapData'),
item: [
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }
{ prop: 'stationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange:this.updateView}
]
}
}
@ -133,18 +133,18 @@ export default {
stationCode: [
{ required: true, message: this.$t('rules.stationControlStationCode'), trigger: 'change' }
],
zokContent: [
{ required: true, message: this.$t('rules.stationControlZokContent'), trigger: 'blur' }
],
zakContent: [
{ required: true, message: this.$t('rules.stationControlZakContent'), trigger: 'blur' }
],
jjzkContent: [
{ required: true, message: this.$t('rules.stationControlJjzkContent'), trigger: 'blur' }
],
zzkContent: [
{ required: true, message: this.$t('rules.stationControlZzkContent'), trigger: 'blur' }
],
// zokContent: [
// { required: true, message: this.$t('rules.stationControlZokContent'), trigger: 'blur' }
// ],
// zakContent: [
// { required: true, message: this.$t('rules.stationControlZakContent'), trigger: 'blur' }
// ],
// jjzkContent: [
// { required: true, message: this.$t('rules.stationControlJjzkContent'), trigger: 'blur' }
// ],
// zzkContent: [
// { required: true, message: this.$t('rules.stationControlZzkContent'), trigger: 'blur' }
// ],
'position.x': [
{ required: true, message: this.$t('rules.stationControlPositionX'), trigger: 'blur' }
],
@ -172,6 +172,10 @@ export default {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
this.edit();
},
updateView() {
this.edit();
},
deviceSelect(selected) {
this.$refs.dataform.resetFields();
@ -190,13 +194,13 @@ export default {
const uid = getUID('StationControl');
const model = {
_type: 'StationControl',
code: uid,
zokContent: '中控',
zbjkContent: '总报警',
zakContent: '站控',
jjzkContent: '紧急站控',
zzkContent: '站中控按钮',
lskContent: '连锁控'
code: uid
// zokContent: '',
// zbjkContent: '',
// zakContent: '',
// jjzkContent: '',
// zzkContent: '',
// lskContent: ''
};
this.stationList.forEach(elem => {
if (elem.code === this.addModel.stationCode) {