From f30509a93ce1d4060c0f18875fced643d197f858 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 5 Aug 2022 11:06:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=A7=86=E5=9B=BE):=20=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E8=AE=A1=E7=AE=97=E5=AD=97=E6=AE=B5UI=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/view/ChartEdit.vue | 43 ++++++++++++++++--- .../src/views/chart/view/ChartFieldEdit.vue | 5 ++- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 24ee19851e..885a6758a1 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -125,7 +125,11 @@ - {{ $t('commons.copy') }}... + {{ $t('commons.copy') }} + + {{ $t('commons.edit') }} + {{ $t('commons.delete') }} + @@ -167,7 +171,11 @@ - {{ $t('commons.copy') }}... + {{ $t('commons.copy') }} + + {{ $t('commons.edit') }} + {{ $t('commons.delete') }} + @@ -345,7 +353,7 @@ $t('chart.drag_block_table_data_column') }} {{ $t('chart.drag_block_type_axis') }} {{ $t('chart.drag_block_value_axis') }} @@ -1418,7 +1426,6 @@ export default { bus.$on('plugins-calc-style', this.calcStyle) bus.$on('plugin-chart-click', this.chartClick) bus.$on('set-dynamic-area-code', this.setDynamicAreaCode) - }, initTableData(id, optType) { if (id != null) { @@ -1910,6 +1917,7 @@ export default { onSizeChange(val) { this.view.customAttr.size = val this.calcStyle() + this.calcData() }, onTextChange(val) { @@ -2667,6 +2675,12 @@ export default { this.currEditField.extField = 1 this.showChartCalcField() break + case 'edit': + this.showChartCalcField() + break + case 'delete': + this.deleteChartCalcField(param.item) + break } }, handleChartFieldEdit(item, type) { @@ -2683,6 +2697,23 @@ export default { this.editChartCalcField = false this.currEditField = {} this.initTableField(this.table.id) + }, + deleteChartCalcField(item) { + this.$confirm(this.$t('dataset.confirm_delete'), this.$t('chart.tips'), { + confirmButtonText: this.$t('dataset.confirm'), + cancelButtonText: this.$t('dataset.cancel'), + type: 'warning' + }).then(() => { + post('/chart/field/delete/' + item.id + '/' + this.panelInfo.id, null).then(response => { + this.$message({ + type: 'success', + message: this.$t('chart.delete_success'), + showClose: true + }) + this.initTableField(this.table.id) + }) + }).catch(() => { + }) } } } diff --git a/frontend/src/views/chart/view/ChartFieldEdit.vue b/frontend/src/views/chart/view/ChartFieldEdit.vue index 5b01884214..5724687d2a 100644 --- a/frontend/src/views/chart/view/ChartFieldEdit.vue +++ b/frontend/src/views/chart/view/ChartFieldEdit.vue @@ -165,7 +165,7 @@