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 // 列车实时位置显示
},
cross:{ // 岔心
speedOffset:{
x:0,
y:50
},
centerSquare:{
defaultColor:'#000'
defaultColor:'#000',
blockColor:'#00F'
},
crossSection:{
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.centerSquare);
this.add(this.crossText);
this.add(this.crossSpeedText);
}
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});
}
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) {
this.section && this.section.attr('z', lev);
}

View File

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

View File

@ -86,12 +86,14 @@ export default class Section extends Group {
/** 设置区段恢复默认状态*/
recover() {
if (this.line) {
this.line.setCrossUnBlock();
this.line.stopAnimation(true);
this.sectionBlock && this.sectionBlock.hide(); // 因此特殊区段
this.line.setStyle({
stroke: this.style.Section.line.spareColor,
lineWidth: this.style.Section.line.width
});
this.line.setCrossSpeedUpperLimit('');
}
this.name && this.name.recover();
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
});
}
if (this.style.Section.cross && this.model.type == '04') {
this.line.setCrossBlock();
}
if (this.style.Section.block && this.style.Section.block.blockGlint && this.line) {
this.line.animateStyle(true, [
{ time: 1000, styles: { stroke: this.style.backgroundColor } },
@ -246,13 +251,15 @@ export default class Section extends Group {
setSpeedUpperLimit(speedUpLimit) {
if (this.style.Section.line.speedLimitColor) { // 宁波三号线 独有
this.line.setStyle({stroke: this.style.Section.line.speedLimitColor});
} else if (this.style.Section.speedLimitName.nameAlone && this.model.type == '03') { // 南京2道岔区段只显示一个名称
const switchModel = Vue.prototype.$jlmap.mapDevice[this.model.relSwitchCode];
if (switchModel && switchModel.sectionACode == this._code) {
this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit);
}
} else {
} else if (this.style.Section.speedLimitName.nameAlone && this.model.type == '03') { // 南京2道岔区段只显示一个名称
const switchModel = Vue.prototype.$jlmap.mapDevice[this.model.relSwitchCode];
if (switchModel && switchModel.sectionACode == this._code) {
this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit);
}
} else if (this.style.Section.cross && this.model.type == '04') {
this.line.setCrossSpeedUpperLimit(speedUpLimit);
} else {
this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit);
}

View File

@ -125,7 +125,18 @@ export default {
this.$emit('deviceSelect', '');
} else {
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()) {
if (['01', '03'].includes(selected.type)) {
this.$refs.respCreate.setModelProp(selected, 'sectionCode');
@ -135,14 +146,13 @@ export default {
} else {
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';
} else if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSignalCode'.toUpperCase()) {
this.$refs.respBatch.setModelProp(selected, 'signalCode');
this.activeName = 'third';
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)) {
this.$refs.respBatch.setModelProp(selected, 'code');
this.$refs.respBatch.setModelProp(selected, 'sectionCode');
this.activeName = 'third';
this.field = '';
this.$emit('deviceSelect', '');

View File

@ -1,9 +1,9 @@
<template>
<el-form ref="make" label-width="140px" :model="addModel" size="mini" :rules="mergeRules">
<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">
<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
v-for="item in sectionList"
:key="item.code"
@ -11,7 +11,20 @@
:value="item.code"
/>
</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>
</el-table-column>
<el-table-column label="类型">
@ -74,7 +87,11 @@ export default {
sectionList: {
type: Array,
required: true
},
},
signalList: {
type: Array,
required: true
},
responderList: {
type: Array,
required: true
@ -99,26 +116,21 @@ export default {
handleDelete(index, row) {
this.addModel.modelList.splice(index, 1);
},
handleHover(row) {
if (this.field !== 'RelBatchSectionCode') {
this.$emit('hover', 'RelBatchSectionCode');
this.rowData = row;
} else if (this.rowData !== row) {
this.rowData = row;
} else {
this.$emit('hover', '');
}
handleHover(row, prop) {
this.rowData = row;
this.$emit('hover', prop);
},
handlePush(row) {
this.addModel.modelList.push({
code: '',
sectionCode: '',
signalCode: '',
type: '',
name: ''
});
},
doBatchCreate() {
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);
});
this.$emit('updateMapModel', models);

View File

@ -34,7 +34,11 @@ export default {
sectionList: {
type: Array,
required: true
},
},
signalList: {
type: Array,
required: true
},
responderList: {
type: Array,
required: true
@ -45,7 +49,8 @@ export default {
addModel: {
type: '',
name: '',
sectionCode: ''
sectionCode: '',
signalCode: ''
},
rules: {
name: [
@ -56,14 +61,20 @@ export default {
],
sectionCode: [
{ required: true, message: '请关联物理区段', trigger: 'blur' }
]
],
signalCode: [
{ required: true, message: '请关联信号机', trigger: 'blur' }
]
}
};
},
computed: {
isButtonType() {
isSectionButtonType() {
return this.field == 'RelSectionCode';
},
},
isSignalButtonType() {
return this.field == 'RelSignalCode';
},
createForm() {
const form = {
labelWidth: '110px',
@ -73,7 +84,8 @@ export default {
item: [
{ prop: 'name', label: '应答器名称', type: 'input' },
{ 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

@ -93,7 +93,10 @@ export default {
],
sectionCode: [
{ required: true, message: '请关联物理区段', trigger: 'blur' }
],
],
signalCode: [
{ required: true, message: '请关联信号机', trigger: 'blur' }
],
'position.x': [
{ required: true, message: '请输入应答器坐标x', trigger: 'blur' }
],
@ -143,9 +146,7 @@ export default {
{ 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: '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 }
]
},
map: {

View File

@ -12,8 +12,6 @@ export function buildModelBySection(section, model, list) {
return {
_type: 'Responder',
code: getUID('Responder', list),
type: model.type,
name: model.name,
rotate: rotate + 90,
textRotate: rotate + 90,
position: {
@ -24,8 +22,8 @@ export function buildModelBySection(section, model, list) {
x: 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) { //
debugger;
let lengthFact = copySection.logicSectionCodeList.filter(code => model.code != code).reduce((pre, code) => {
const length = this.$store.getters['map/getDeviceByCode'](code).lengthFact;
return pre + Number(length);