From e6cb218ccb2bdcc6d869b74bde689c81b8806316 Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 2 Dec 2024 15:07:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E9=80=8F?= =?UTF-8?q?=E8=A7=86=E8=A1=A8=E6=8E=92=E5=BA=8F=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#13127?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/panel/charts/table/table-pivot.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts index 108926b83c..6d55dd4c32 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/table/table-pivot.ts @@ -213,6 +213,21 @@ export class TablePivot extends S2ChartView { } sortParams.push(sort) } + //列维度为空,行排序按照指标列来排序,取第一个有排序设置的指标 + if (!columnFields?.length) { + const sortField = valueFields?.find(v => !['none', 'custom_sort'].includes(v.sort)) + if (sortField) { + const sort = { + sortFieldId: r[0], + sortMethod: sortField.sort.toUpperCase(), + sortByMeasure: TOTAL_VALUE, + query: { + [EXTRA_FIELD]: sortField.dataeaseName + } + } + sortParams.push(sort) + } + } // 自定义总计小计 const totals = [ tableTotal.row.calcTotals,