Merge pull request #13720 from dataease/pr@dev-v2@refactor_pivot_sort

refactor(图表): 透视表排序逻辑优化 #13127
This commit is contained in:
wisonic-s
2024-12-02 15:10:17 +08:00
committed by GitHub

View File

@@ -213,6 +213,21 @@ export class TablePivot extends S2ChartView<PivotSheet> {
}
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,