From 243dacc959bbaacf8fda171621141b0743d27129 Mon Sep 17 00:00:00 2001 From: junjie Date: Thu, 29 Jul 2021 16:31:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E9=9B=86):=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E5=AD=97=E6=AE=B5=E6=94=AF=E6=8C=81=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E8=BF=90=E7=AE=97=E7=AD=89=E6=93=8D=E4=BD=9C=EF=BC=88?= =?UTF-8?q?UI=E5=92=8CCRUD=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dataset/data/CalcFieldEdit.vue | 36 +++++++++++++++---- frontend/src/views/dataset/data/FieldEdit.vue | 1 - 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/dataset/data/CalcFieldEdit.vue b/frontend/src/views/dataset/data/CalcFieldEdit.vue index c5dd3d9cb8..63f3bdf3c3 100644 --- a/frontend/src/views/dataset/data/CalcFieldEdit.vue +++ b/frontend/src/views/dataset/data/CalcFieldEdit.vue @@ -217,12 +217,11 @@ export default { 'param': function() { this.initFunctions() }, - 'field': function() { - if (this.field.id) { - this.fieldForm = JSON.parse(JSON.stringify(this.field)) - } else { - this.fieldForm = JSON.parse(JSON.stringify(this.fieldForm)) - } + 'field': { + handler: function() { + this.initField() + }, + deep: true } }, mounted() { @@ -230,6 +229,7 @@ export default { this.$refs.myCm.codemirror.showHint() }) this.initFunctions() + this.initField() }, methods: { onCmReady(cm) { @@ -256,7 +256,16 @@ export default { }) }, + initField() { + if (this.field.id) { + this.fieldForm = JSON.parse(JSON.stringify(this.field)) + } else { + this.fieldForm = JSON.parse(JSON.stringify(this.fieldForm)) + } + }, + closeCalcField() { + this.resetField() this.$emit('onEditClose', {}) }, @@ -268,6 +277,21 @@ export default { post('/dataset/field/save', this.fieldForm).then(response => { this.closeCalcField() }) + }, + + resetField() { + this.fieldForm = { + id: null, + name: '', + groupType: 'd', + deType: 0, + originName: '', + tableId: this.param.id, + checked: 1, + columnIndex: this.tableFields.dimensionList.length + this.tableFields.quotaList.length, + size: 0, + extField: 2 + } } } } diff --git a/frontend/src/views/dataset/data/FieldEdit.vue b/frontend/src/views/dataset/data/FieldEdit.vue index 2aaf671cbc..cc1dfc47dd 100644 --- a/frontend/src/views/dataset/data/FieldEdit.vue +++ b/frontend/src/views/dataset/data/FieldEdit.vue @@ -247,7 +247,6 @@ :visible="editCalcField" :show-close="false" class="dialog-css" - :destroy-on-close="true" :title="currEditField.id?$t('dataset.edit_calc_field'):$t('dataset.add_calc_field')" append-to-body >