From d71f031f29e0d5e7ced352212663ddf91fd64497 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Fri, 26 May 2023 12:07:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE-=E8=A1=A8=E6=A0=BC):=20?= =?UTF-8?q?AntV=E6=98=8E=E7=BB=86=E8=A1=A8=EF=BC=8C=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E6=94=AF=E6=8C=81=E7=A9=BA=E5=80=BC=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.tapd.cn/55578866/prong/stories/view/1155578866001011957 --- .../src/views/chart/chart/table/table-info.js | 10 +++-- .../chart/components/senior/FunctionCfg.vue | 37 +++++++++++-------- frontend/src/views/chart/view/ChartEdit.vue | 4 ++ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/frontend/src/views/chart/chart/table/table-info.js b/frontend/src/views/chart/chart/table/table-info.js index f128be1d5c..4f262bf81e 100644 --- a/frontend/src/views/chart/chart/table/table-info.js +++ b/frontend/src/views/chart/chart/table/table-info.js @@ -127,14 +127,15 @@ export function baseTableInfo(s2, container, chart, action, tableData, pageInfo) }) }) } - + // 空值处理 + const newData = handleTableEmptyStrategy(tableData, chart) // data config const s2DataConfig = { fields: { columns: columns }, meta: meta, - data: tableData + data: newData } const customAttr = JSON.parse(chart.customAttr) @@ -494,7 +495,8 @@ export function baseTablePivot(s2, container, chart, action, headerAction, table } sortParams.push(sort) } - + // 空值处理 + const newData = handleTableEmptyStrategy(tableData, chart) // data config const s2DataConfig = { fields: { @@ -503,7 +505,7 @@ export function baseTablePivot(s2, container, chart, action, headerAction, table values: v }, meta: meta, - data: tableData, + data: newData, sortParams: sortParams } diff --git a/frontend/src/views/chart/components/senior/FunctionCfg.vue b/frontend/src/views/chart/components/senior/FunctionCfg.vue index 3fb9067d0e..632fac468b 100644 --- a/frontend/src/views/chart/components/senior/FunctionCfg.vue +++ b/frontend/src/views/chart/components/senior/FunctionCfg.vue @@ -132,21 +132,21 @@ export default { }, computed: { showSlider() { - return this.chart.type !== 'bidirectional-bar' && !equalsAny(this.chart.type, 'map') + return this.chart.type !== 'bidirectional-bar' && + !equalsAny(this.chart.type, 'map') && + !includesAny(this.chart.type, 'table') }, showEmptyStrategy() { return (this.chart.render === 'antv' && - (includesAny(this.chart.type, 'line', 'bar', 'area') || - equalsAny(this.chart.type, 'table-normal'))) || + includesAny(this.chart.type, 'line', 'bar', 'area', 'table')) || (this.chart.render === 'echarts' && equalsAny(this.chart.type, 'map')) }, showIgnoreOption() { - return !equalsAny(this.chart.type, 'map') + return !equalsAny(this.chart.type, 'map', 'table-pivot', 'table-info') }, showEmptyDataFieldCtrl() { return this.showEmptyStrategy && - this.functionForm.emptyDataStrategy !== 'breakLine' && - equalsAny(this.chart.type, 'table-normal') + this.functionForm.emptyDataStrategy !== 'breakLine' } }, watch: { @@ -180,20 +180,27 @@ export default { initFieldCtrl() { if (this.showEmptyDataFieldCtrl) { this.fieldOptions = [] - let yAxis = [] - if (Object.prototype.toString.call(this.chart.xaxis) === '[object Array]') { - yAxis = this.chart.yaxis - } else { - yAxis = JSON.parse(this.chart.yaxis) + let axis + if (equalsAny(this.chart.type, 'table-normal', 'table-pivot')) { + axis = this.chart.yaxis } - if (this.chart.type === 'table-normal') { - yAxis.forEach(item => { + if (this.chart.type === 'table-info') { + axis = this.chart.xaxis + } + let axisArr = [] + if (Object.prototype.toString.call(axis) === '[object Array]') { + axisArr = axisArr.concat(axis) + } else { + axisArr = axisArr.concat(JSON.parse(axis)) + } + axisArr.forEach(item => { + if (item.groupType === 'q') { this.fieldOptions.push({ label: item.name, value: item.dataeaseName }) - }) - } + } + }) } }, changeFunctionCfg() { diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 85578967d1..4a7626ee4d 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -3363,6 +3363,10 @@ export default { this.view.senior.functionCfg.emptyDataStrategy = 'ignoreData' } else if (type.includes('line')) { this.view.customAttr.label.position = 'top' + } else if (equalsAny(type, 'table-info', 'table-pivot')) { + if (this.view?.senior?.functionCfg?.emptyDataStrategy === 'ignoreData') { + this.view.senior.functionCfg.emptyDataStrategy = 'breakLine' + } } // reset custom colors this.view.customAttr.color.seriesColors = []