This commit is contained in:
fan 2021-01-15 17:53:05 +08:00
commit bacdca5e19
10 changed files with 117 additions and 47 deletions

View File

@ -144,8 +144,13 @@ class SkinCode extends defaultStyle {
display: false // 列车实时位置显示 display: false // 列车实时位置显示
}, },
cross:{ // 岔心 cross:{ // 岔心
speedOffset:{
x:0,
y:50
},
centerSquare:{ centerSquare:{
defaultColor:'#000' defaultColor:'#000',
blockColor:'#00F'
}, },
crossSection:{ crossSection:{
fillColor:'#ff0', fillColor:'#ff0',

View File

@ -141,9 +141,27 @@ export default class ELines extends Group {
} }
}); });
this.crossSpeedText = new Text({
zlevel: this.zlevel,
z: this.z + 8,
style: {
x: result.x + style.Section.cross.speedOffset.x,
y: result.y + style.Section.cross.speedOffset.y,
fontWeight: style.Section.cross.text.fontWeight,
fontSize: style.Section.cross.text.fontSize,
fontFamily: style.Section.cross.text.fontFamily || style.fontFamily,
text: '',
textFill:style.Section.cross.text.fontColor,
textAlign: style.Section.cross.text.textAlign,
textPosition: style.Section.cross.text.textPosition,
textVerticalAlign: style.Section.cross.text.textVerticalAlign
}
});
this.add(this.crossSection); this.add(this.crossSection);
this.add(this.centerSquare); this.add(this.centerSquare);
this.add(this.crossText); this.add(this.crossText);
this.add(this.crossSpeedText);
} }
createLine() { createLine() {
@ -359,6 +377,16 @@ export default class ELines extends Group {
this.crossSection && this.crossSection.setStyle({lineWidth:0, fill:this.model.style.Section.cross.crossSection.fillColor}); this.crossSection && this.crossSection.setStyle({lineWidth:0, fill:this.model.style.Section.cross.crossSection.fillColor});
} }
setCrossBlock() {
this.centerSquare && this.centerSquare.setStyle({fill:this.model.style.Section.cross.centerSquare.blockColor});
}
setCrossUnBlock() {
this.centerSquare && this.centerSquare.setStyle({fill:this.model.style.Section.cross.centerSquare.defaultColor});
}
setCrossSpeedUpperLimit(speedLimit) {
this.crossSpeedText && this.crossSpeedText.setStyle({text:speedLimit});
}
setZleve(lev) { setZleve(lev) {
this.section && this.section.attr('z', lev); this.section && this.section.attr('z', lev);
} }

View File

@ -129,8 +129,6 @@ class EMouse extends Group {
this.add(this.lineBorder); this.add(this.lineBorder);
this.lineBorder.hide(); this.lineBorder.hide();
} }
} else if (this.device.crossSection) {
debugger;
} }
} }

View File

@ -86,12 +86,14 @@ export default class Section extends Group {
/** 设置区段恢复默认状态*/ /** 设置区段恢复默认状态*/
recover() { recover() {
if (this.line) { if (this.line) {
this.line.setCrossUnBlock();
this.line.stopAnimation(true); this.line.stopAnimation(true);
this.sectionBlock && this.sectionBlock.hide(); // 因此特殊区段 this.sectionBlock && this.sectionBlock.hide(); // 因此特殊区段
this.line.setStyle({ this.line.setStyle({
stroke: this.style.Section.line.spareColor, stroke: this.style.Section.line.spareColor,
lineWidth: this.style.Section.line.width lineWidth: this.style.Section.line.width
}); });
this.line.setCrossSpeedUpperLimit('');
} }
this.name && this.name.recover(); this.name && this.name.recover();
this.speedLimit && this.speedLimit.hide(); this.speedLimit && this.speedLimit.hide();
@ -180,6 +182,9 @@ export default class Section extends Group {
lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth
}); });
} }
if (this.style.Section.cross && this.model.type == '04') {
this.line.setCrossBlock();
}
if (this.style.Section.block && this.style.Section.block.blockGlint && this.line) { if (this.style.Section.block && this.style.Section.block.blockGlint && this.line) {
this.line.animateStyle(true, [ this.line.animateStyle(true, [
{ time: 1000, styles: { stroke: this.style.backgroundColor } }, { time: 1000, styles: { stroke: this.style.backgroundColor } },
@ -252,6 +257,8 @@ export default class Section extends Group {
this.speedLimit && this.speedLimit.show(); this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit); this.speedLimitName && this.speedLimitName.show(speedUpLimit);
} }
} else if (this.style.Section.cross && this.model.type == '04') {
this.line.setCrossSpeedUpperLimit(speedUpLimit);
} else { } else {
this.speedLimit && this.speedLimit.show(); this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit); this.speedLimitName && this.speedLimitName.show(speedUpLimit);

View File

@ -126,6 +126,17 @@ export default {
} else { } else {
this.$message.error('请选择物理区段'); this.$message.error('请选择物理区段');
} }
} else if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'RelModelSignalCode'.toUpperCase()) {
this.$refs.respModel.setModelProp(selected, 'signalCode');
this.activeName = 'first';
this.field = '';
this.$emit('deviceSelect', '');
} else if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'RelSignalCode'.toUpperCase()) {
this.$refs.respCreate.setModelProp(selected, 'signalCode');
this.activeName = 'second';
this.field = '';
this.$emit('deviceSelect', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelSectionCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelSectionCode'.toUpperCase()) {
if (['01', '03'].includes(selected.type)) { if (['01', '03'].includes(selected.type)) {
this.$refs.respCreate.setModelProp(selected, 'sectionCode'); this.$refs.respCreate.setModelProp(selected, 'sectionCode');
@ -135,14 +146,13 @@ export default {
} else { } else {
this.$message.error('请选择物理区段'); this.$message.error('请选择物理区段');
} }
} else if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'RelModelSignalCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSignalCode'.toUpperCase()) {
this.$refs.respModel.setModelProp(selected, 'signalCode'); this.$refs.respBatch.setModelProp(selected, 'signalCode');
this.activeName = 'first'; this.activeName = 'third';
this.field = ''; this.field = '';
this.$emit('deviceSelect', '');
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSectionCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSectionCode'.toUpperCase()) {
if (['01', '03'].includes(selected.type)) { if (['01', '03'].includes(selected.type)) {
this.$refs.respBatch.setModelProp(selected, 'code'); this.$refs.respBatch.setModelProp(selected, 'sectionCode');
this.activeName = 'third'; this.activeName = 'third';
this.field = ''; this.field = '';
this.$emit('deviceSelect', ''); this.$emit('deviceSelect', '');

View File

@ -1,9 +1,9 @@
<template> <template>
<el-form ref="make" label-width="140px" :model="addModel" size="mini" :rules="mergeRules"> <el-form ref="make" label-width="140px" :model="addModel" size="mini" :rules="mergeRules">
<el-table :data="addModel.modelList" style="width: 100%"> <el-table :data="addModel.modelList" style="width: 100%">
<el-table-column label="区段" prop="code" width="200"> <el-table-column label="区段" prop="sectionCode">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.code" filterable size="mini" style="width:120px;" placeholder="请选择"> <el-select v-model="scope.row.sectionCode" filterable size="mini" style="width:120px;" placeholder="请选择">
<el-option <el-option
v-for="item in sectionList" v-for="item in sectionList"
:key="item.code" :key="item.code"
@ -11,7 +11,20 @@
:value="item.code" :value="item.code"
/> />
</el-select> </el-select>
<el-button size="mini" :type="field === 'RelBatchSectionCode'&&rowData === scope.row?'danger':'primary'" @click="handleHover(scope.row)">激活</el-button> <el-button size="mini" :type="field === 'RelBatchSectionCode'&&rowData === scope.row?'danger':'primary'" @click="handleHover(scope.row, 'RelBatchSectionCode')">激活</el-button>
</template>
</el-table-column>
<el-table-column label="信号机" prop="signalCode">
<template slot-scope="scope">
<el-select v-model="scope.row.signalCode" filterable size="mini" style="width:120px;" placeholder="请选择">
<el-option
v-for="item in signalList"
:key="item.code"
:label="item.name + '(' + item.code +')'"
:value="item.code"
/>
</el-select>
<el-button size="mini" :type="field === 'RelBatchSignalCode'&&rowData === scope.row?'danger':'primary'" @click="handleHover(scope.row, 'RelBatchSignalCode')">激活</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="类型"> <el-table-column label="类型">
@ -75,6 +88,10 @@ export default {
type: Array, type: Array,
required: true required: true
}, },
signalList: {
type: Array,
required: true
},
responderList: { responderList: {
type: Array, type: Array,
required: true required: true
@ -99,26 +116,21 @@ export default {
handleDelete(index, row) { handleDelete(index, row) {
this.addModel.modelList.splice(index, 1); this.addModel.modelList.splice(index, 1);
}, },
handleHover(row) { handleHover(row, prop) {
if (this.field !== 'RelBatchSectionCode') {
this.$emit('hover', 'RelBatchSectionCode');
this.rowData = row; this.rowData = row;
} else if (this.rowData !== row) { this.$emit('hover', prop);
this.rowData = row;
} else {
this.$emit('hover', '');
}
}, },
handlePush(row) { handlePush(row) {
this.addModel.modelList.push({ this.addModel.modelList.push({
code: '', sectionCode: '',
signalCode: '',
type: '', type: '',
name: '' name: ''
}); });
}, },
doBatchCreate() { doBatchCreate() {
const models = this.addModel.modelList.map(el => { const models = this.addModel.modelList.map(el => {
const section = this.$store.getters['map/getDeviceByCode'](el.code); const section = this.$store.getters['map/getDeviceByCode'](el.sectionCode);
return utils.buildModelBySection(section, el, this.responderList); return utils.buildModelBySection(section, el, this.responderList);
}); });
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);

View File

@ -33,6 +33,10 @@ export default {
}, },
sectionList: { sectionList: {
type: Array, type: Array,
required: true
},
signalList: {
type: Array,
required: true required: true
}, },
responderList: { responderList: {
@ -45,7 +49,8 @@ export default {
addModel: { addModel: {
type: '', type: '',
name: '', name: '',
sectionCode: '' sectionCode: '',
signalCode: ''
}, },
rules: { rules: {
name: [ name: [
@ -56,14 +61,20 @@ export default {
], ],
sectionCode: [ sectionCode: [
{ required: true, message: '请关联物理区段', trigger: 'blur' } { required: true, message: '请关联物理区段', trigger: 'blur' }
],
signalCode: [
{ required: true, message: '请关联信号机', trigger: 'blur' }
] ]
} }
}; };
}, },
computed: { computed: {
isButtonType() { isSectionButtonType() {
return this.field == 'RelSectionCode'; return this.field == 'RelSectionCode';
}, },
isSignalButtonType() {
return this.field == 'RelSignalCode';
},
createForm() { createForm() {
const form = { const form = {
labelWidth: '110px', labelWidth: '110px',
@ -73,7 +84,8 @@ export default {
item: [ item: [
{ prop: 'name', label: '应答器名称', type: 'input' }, { prop: 'name', label: '应答器名称', type: 'input' },
{ prop: 'type', label: `应答器类型`, type: 'select', optionLabel: 'name', optionValue: 'value', options: this.responderTypeList }, { prop: 'type', label: `应答器类型`, type: 'select', optionLabel: 'name', optionValue: 'value', options: this.responderTypeList },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.sectionList, buttonType: 'RelSectionCode', hover: this.hover, buttonShowType: this.isButtonType } { prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.sectionList, buttonType: 'RelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
{ prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.signalList, buttonType: 'RelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType },
] ]
} }
} }

View File

@ -94,6 +94,9 @@ export default {
sectionCode: [ sectionCode: [
{ required: true, message: '请关联物理区段', trigger: 'blur' } { required: true, message: '请关联物理区段', trigger: 'blur' }
], ],
signalCode: [
{ required: true, message: '请关联信号机', trigger: 'blur' }
],
'position.x': [ 'position.x': [
{ required: true, message: '请输入应答器坐标x', trigger: 'blur' } { required: true, message: '请输入应答器坐标x', trigger: 'blur' }
], ],
@ -143,8 +146,6 @@ export default {
{ prop:'textRotate', label: '文字旋转', type: 'number' }, { prop:'textRotate', label: '文字旋转', type: 'number' },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.sectionList, buttonType: 'RelModelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType }, { prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.sectionList, buttonType: 'RelModelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
{ prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.signalList, buttonType: 'RelModelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType }, { prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.signalList, buttonType: 'RelModelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType },
// { prop: 'sectionCode', label: '', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.sectionList},
// { prop: 'signalCode', label: '', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.signalList},
{ prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList } { prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
] ]
}, },

View File

@ -12,8 +12,6 @@ export function buildModelBySection(section, model, list) {
return { return {
_type: 'Responder', _type: 'Responder',
code: getUID('Responder', list), code: getUID('Responder', list),
type: model.type,
name: model.name,
rotate: rotate + 90, rotate: rotate + 90,
textRotate: rotate + 90, textRotate: rotate + 90,
position: { position: {
@ -24,8 +22,8 @@ export function buildModelBySection(section, model, list) {
x: 0, x: 0,
y: 0 y: 0
}, },
sectionCode: section.code, stationCode: section.stationCode,
stationCode: section.stationCode ...model
}; };
} }
} }

View File

@ -624,7 +624,6 @@ export default {
} }
if (model.parentCode == copySection.code) { // if (model.parentCode == copySection.code) { //
debugger;
let lengthFact = copySection.logicSectionCodeList.filter(code => model.code != code).reduce((pre, code) => { let lengthFact = copySection.logicSectionCodeList.filter(code => model.code != code).reduce((pre, code) => {
const length = this.$store.getters['map/getDeviceByCode'](code).lengthFact; const length = this.$store.getters['map/getDeviceByCode'](code).lengthFact;
return pre + Number(length); return pre + Number(length);