From 234a4780242be7077e313bd686b034e2aa0dd353 Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 22 Nov 2022 20:43:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E8=A1=8C=E6=B1=87=E6=80=BB=E6=94=AF=E6=8C=81=E6=8C=89?= =?UTF-8?q?=E5=90=88=E8=AE=A1=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/chart/table/table-info.js | 4 ++-- .../chart/components/shapeAttr/TotalCfg.vue | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/chart/chart/table/table-info.js b/frontend/src/views/chart/chart/table/table-info.js index 3d12c5cc62..63f044588f 100644 --- a/frontend/src/views/chart/chart/table/table-info.js +++ b/frontend/src/views/chart/chart/table/table-info.js @@ -424,7 +424,7 @@ export function baseTablePivot(s2, container, chart, action, tableData) { // 解析合计、小计排序 const sortParams = [] - if (totalCfg.row.totalSort && totalCfg.row.totalSort !== 'none' && c.length > 0 && totalCfg.row.showGrandTotals) { + if (totalCfg.row.totalSort && totalCfg.row.totalSort !== 'none' && c.length > 0 && totalCfg.row.showGrandTotals && v.indexOf(totalCfg.row.totalSortField) > -1) { const sort = { sortFieldId: c[0], sortMethod: totalCfg.row.totalSort.toUpperCase(), @@ -436,7 +436,7 @@ export function baseTablePivot(s2, container, chart, action, tableData) { sortParams.push(sort) } totalCfg.col.totalSort = false - if (totalCfg.col.totalSort && totalCfg.col.totalSort !== 'none' && r.length > 0 && totalCfg.col.showGrandTotals) { + if (totalCfg.col.totalSort && totalCfg.col.totalSort !== 'none' && r.length > 0 && totalCfg.col.showGrandTotals && v.indexOf(totalCfg.col.totalSortField) > -1) { const sort = { sortFieldId: r[0], sortMethod: totalCfg.col.totalSort.toUpperCase(), diff --git a/frontend/src/views/chart/components/shapeAttr/TotalCfg.vue b/frontend/src/views/chart/components/shapeAttr/TotalCfg.vue index 49ef97efe2..d7160abd24 100644 --- a/frontend/src/views/chart/components/shapeAttr/TotalCfg.vue +++ b/frontend/src/views/chart/components/shapeAttr/TotalCfg.vue @@ -422,12 +422,15 @@ export default { this.totalSortFields = JSON.parse(chart.yaxis) } if (this.totalSortFields.length > 0) { - if (this.totalForm.row.totalSortField === '') { + if (this.resetTotalSort(this.totalForm.row.totalSortField)) { this.totalForm.row.totalSortField = this.totalSortFields[0].dataeaseName } - if (this.totalForm.col.totalSortField === '') { + if (this.resetTotalSort(this.totalForm.col.totalSortField)) { this.totalForm.col.totalSortField = this.totalSortFields[0].dataeaseName } + } else { + this.totalForm.row.totalSortField = '' + this.totalForm.col.totalSortField = '' } } }, @@ -437,6 +440,16 @@ export default { }, showProperty(property) { return this.propertyInner.includes(property) + }, + resetTotalSort(field) { + if (field === '') { + return true + } + const sortFieldList = [] + this.totalSortFields.forEach(ele => { + sortFieldList.push(ele.dataeaseName) + }) + return sortFieldList.indexOf(field) === -1 } } }