From 3c37037558b9217af146f216160d696a1d37d655 Mon Sep 17 00:00:00 2001 From: lVAL Date: Fri, 15 Jan 2021 15:11:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=AD=94=E5=99=A8?= =?UTF-8?q?=E5=85=B3=E8=81=94=E4=BF=A1=E5=8F=B7=E6=9C=BA=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E7=BB=98=E5=9B=BE=E4=BF=A1=E5=8F=B7=E6=9C=BA=EF=BC=8C?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E6=BF=80=E6=B4=BB=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapoperate/responder/index.vue | 24 ++++++++++++++--- .../mapoperate/responder/responderBatch.vue | 4 +-- .../mapoperate/responder/responderCreate.vue | 6 ++--- .../mapoperate/responder/responderModel.vue | 26 ++++++++++++++++--- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/views/newMap/newMapdraft/mapoperate/responder/index.vue b/src/views/newMap/newMapdraft/mapoperate/responder/index.vue index 59bb5b0cc..40ba35cc3 100644 --- a/src/views/newMap/newMapdraft/mapoperate/responder/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/responder/index.vue @@ -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', ''); diff --git a/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue b/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue index 4fe749514..d96800041 100644 --- a/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue +++ b/src/views/newMap/newMapdraft/mapoperate/responder/responderBatch.vue @@ -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) { diff --git a/src/views/newMap/newMapdraft/mapoperate/responder/responderCreate.vue b/src/views/newMap/newMapdraft/mapoperate/responder/responderCreate.vue index 54529e002..90a2b7887 100644 --- a/src/views/newMap/newMapdraft/mapoperate/responder/responderCreate.vue +++ b/src/views/newMap/newMapdraft/mapoperate/responder/responderCreate.vue @@ -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); diff --git a/src/views/newMap/newMapdraft/mapoperate/responder/responderModel.vue b/src/views/newMap/newMapdraft/mapoperate/responder/responderModel.vue index 6569e7daf..bd5a0d20c 100644 --- a/src/views/newMap/newMapdraft/mapoperate/responder/responderModel.vue +++ b/src/views/newMap/newMapdraft/mapoperate/responder/responderModel.vue @@ -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); },