增加应答器关联信号机,以及绘图信号机,区段激活选择

This commit is contained in:
lVAL 2021-01-15 15:11:13 +08:00
parent 25e89c9b1c
commit 3c37037558
4 changed files with 49 additions and 11 deletions

View File

@ -8,6 +8,7 @@
:centralized-station-list="centralizedStationList"
:responder-list="responderList"
:section-list="filterSectionList"
:signalList="signalList"
v-on="$listeners"
@hover="hover"
@deviceChange="deviceChange"
@ -22,6 +23,7 @@
:centralized-station-list="centralizedStationList"
:responder-list="responderList"
:section-list="filterSectionList"
:signalList="signalList"
v-on="$listeners"
@hover="hover"
@deviceChange="deviceChange"
@ -36,6 +38,7 @@
:centralized-station-list="centralizedStationList"
:responder-list="responderList"
:section-list="filterSectionList"
:signalList="signalList"
v-on="$listeners"
@hover="hover"
@deviceChange="deviceChange"
@ -78,7 +81,8 @@ export default {
computed: {
...mapGetters('map', [
'stationList',
'sectionList',
'sectionList',
'signalList',
'responderList'
]),
filterSectionList() {
@ -113,18 +117,32 @@ export default {
if (selected && selected._type.toUpperCase() === 'Responder'.toUpperCase()) {
this.activeName = 'first';
this.$refs.respModel.setModel(selected);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelModelSectionCode'.toUpperCase()) {
if (['01', '03'].includes(selected.type)) {
this.$refs.respModel.setModelProp(selected, 'sectionCode');
this.activeName = 'first';
this.field = '';
this.$emit('deviceSelect', '');
} else {
this.$message.error('请选择物理区段');
}
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelSectionCode'.toUpperCase()) {
if (['01', '03'].includes(selected.type)) {
this.$refs.respCreate.setModel(selected);
this.$refs.respCreate.setModelProp(selected, 'sectionCode');
this.activeName = 'second';
this.field = '';
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() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'RelBatchSectionCode'.toUpperCase()) {
if (['01', '03'].includes(selected.type)) {
this.$refs.respBatch.setModel(selected);
this.$refs.respBatch.setModelProp(selected, 'code');
this.activeName = 'third';
this.field = '';
this.$emit('deviceSelect', '');

View File

@ -91,9 +91,9 @@ export default {
};
},
methods: {
setModel(selected) {
setModelProp(selected, prop) {
if (this.rowData) {
this.rowData.code = selected.code;
this.rowData[prop] = selected.code;
}
},
handleDelete(index, row) {

View File

@ -73,7 +73,7 @@ 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.isButtonType }
]
}
}
@ -85,8 +85,8 @@ export default {
hover(field) {
this.$emit('hover', field);
},
setModel(selected) {
this.addModel.sectionCode = selected.code;
setModelProp(selected, prop) {
this.addModel[prop] = selected.code;
},
create() {
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);

View File

@ -37,7 +37,11 @@ export default {
sectionList: {
type: Array,
required: true
},
},
signalList: {
type: Array,
required: true
},
responderList: {
type: Array,
required: true
@ -65,7 +69,8 @@ export default {
},
offset: 0,
sectionCode: '',
stationCode: ''
stationCode: '',
signalCode: ''
},
rules: {
code: [
@ -105,6 +110,12 @@ export default {
};
},
computed: {
isSectionButtonType() {
return this.field == 'RelModelSectionCode';
},
isSignalButtonType() {
return this.field == 'RelModelSignalCode';
},
form() {
const form = {
labelWidth: '130px',
@ -130,7 +141,10 @@ export default {
{ prop: 'textOffset.y', firstLevel: 'textOffset', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px', disabled: false }
] },
{ prop:'textRotate', label: '文字旋转', type: 'number' },
{ prop: 'sectionCode', label: '关联区段', type: 'select', optionLabel: 'code', optionValue: 'code', options: this.sectionList},
{ 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 }
]
},
@ -145,6 +159,12 @@ export default {
}
},
methods: {
hover(field) {
this.$emit('hover', field);
},
setModelProp(selected, prop) {
this.editModel[prop] = selected.code;
},
setModel(selected) {
this.editModel = deepAssign(this.editModel, selected);
},