From 0ecea0aabc85e830b15c7a333b0c3efab41c9199 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 14 Dec 2020 17:18:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=BB=98=E5=88=B6=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newMap/newMapdraft/mapoperate/arrow.vue | 7 ++- .../mapoperate/outFrameControl.vue | 35 +++-------- .../newMapdraft/mapoperate/splitStation.vue | 61 ++++++------------- 3 files changed, 30 insertions(+), 73 deletions(-) diff --git a/src/views/newMap/newMapdraft/mapoperate/arrow.vue b/src/views/newMap/newMapdraft/mapoperate/arrow.vue index cec99f3cd..b1c13f801 100644 --- a/src/views/newMap/newMapdraft/mapoperate/arrow.vue +++ b/src/views/newMap/newMapdraft/mapoperate/arrow.vue @@ -107,12 +107,13 @@ export default { this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); }, deviceSelect(selected) { - // this.$refs.dataform && this.$refs.dataform.resetFields(); - // this.editModel = getModel('Arrow'); this.$refs.createForm && this.$refs.createForm.resetFields(); if (selected && selected._type.toUpperCase() === 'Arrow'.toUpperCase()) { this.activeName = 'first'; - this.editModel = deepAssign(this.editModel, selected); + this.$nextTick(()=>{ + this.$refs.dataform && this.$refs.dataform.resetFields(); + this.editModel = deepAssign(this.editModel, selected); + }); } }, clear() { diff --git a/src/views/newMap/newMapdraft/mapoperate/outFrameControl.vue b/src/views/newMap/newMapdraft/mapoperate/outFrameControl.vue index fd0f6739c..739e1cc88 100644 --- a/src/views/newMap/newMapdraft/mapoperate/outFrameControl.vue +++ b/src/views/newMap/newMapdraft/mapoperate/outFrameControl.vue @@ -14,7 +14,7 @@ 0; } @@ -150,11 +130,14 @@ export default { this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); }, deviceSelect(selected) { - this.$refs.form && this.$refs.form.resetFields(); - this.$refs.make && this.$refs.make.resetFields(); + + this.$refs.createForm && this.$refs.createForm.resetFields(); if (selected && selected._type.toUpperCase() === 'OutFrame'.toUpperCase()) { this.activeName = 'first'; - this.editModel = deepAssign(this.editModel, selected); + this.$nextTick(()=>{ + this.$refs.dataform && this.$refs.dataform.resetFields(); + this.editModel = deepAssign(this.editModel, selected); + }); } }, clearDeviceSelect() { diff --git a/src/views/newMap/newMapdraft/mapoperate/splitStation.vue b/src/views/newMap/newMapdraft/mapoperate/splitStation.vue index 661fd2bc7..64fdc5e4a 100644 --- a/src/views/newMap/newMapdraft/mapoperate/splitStation.vue +++ b/src/views/newMap/newMapdraft/mapoperate/splitStation.vue @@ -14,8 +14,8 @@ @@ -56,16 +56,6 @@ export default { x: 0, y: 0 } - }, - addModel: { - code: '', - type: 'SplitStation', - rightStationName: '', - leftStationName: '', - position: { - x: 0, - y: 0 - } } }; }, @@ -82,9 +72,9 @@ export default { item: [] }, draw: { - name: this.$t('map.drawData'), + name: this.activeName == 'first' ? this.$t('map.drawData') : '', item: [ - { prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.splitStationList}, + { prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.splitStationList, isHidden:this.activeName == 'second'}, { prop: 'rightStationName', label: this.$t('map.rightCentralStationName'), type: 'input'}, { prop: 'leftStationName', label: this.$t('map.leftCentralStationName'), type: 'input'}, { prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', children: [ @@ -97,25 +87,6 @@ export default { }; return form; }, - formMake() { - const form = { - labelWidth: '150px', - items:{ - all:{ - name:'', - item: [ - { prop: 'rightStationName', label: this.$t('map.rightCentralStationName'), type: 'input'}, - { prop: 'leftStationName', label: this.$t('map.leftCentralStationName'), type: 'input'}, - { prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', 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' } - ] } - ] - } - } - }; - return form; - }, createRules: function () { return { rightStationName: [ @@ -135,12 +106,14 @@ export default { }, methods: { deviceSelect(selected) { - this.$refs.dataform && this.$refs.dataform.resetFields(); - this.$refs.make && this.$refs.make.resetFields(); + this.$refs.createForm && this.$refs.createForm.resetFields(); if (selected && selected._type === 'SplitStation') { this.activeName = 'first'; - this.editModel = deepAssign(this.editModel, selected); - this.editModel.type = selected._type; + this.$nextTick(()=>{ + this.$refs.dataform && this.$refs.dataform.resetFields(); + this.editModel = deepAssign(this.editModel, selected); + this.editModel.type = selected._type; + }); } }, clearDeviceSelect() { @@ -148,17 +121,17 @@ export default { }, // 创建对象 create() { - const uid = getUID(this.addModel.type, this.splitStationList); // 根据类型写 uid 前缀命名 + const uid = getUID(this.editModel.type, this.splitStationList); // 根据类型写 uid 前缀命名 const models = []; const model = { - _type: this.addModel.type, - type: this.addModel.type, + _type: this.editModel.type, + type: this.editModel.type, code: uid, - rightStationName: this.addModel.rightStationName, - leftStationName: this.addModel.leftStationName, + rightStationName: this.editModel.rightStationName, + leftStationName: this.editModel.leftStationName, position: { - x: this.addModel.position.x, - y: this.addModel.position.y + x: this.editModel.position.x, + y: this.editModel.position.y } }; models.push(model);