fix(图表): 修复透视表列小计自定义汇总未定义导致图表渲染失败 (#15281)

This commit is contained in:
wisonic-s
2025-03-11 16:48:24 +08:00
committed by GitHub
parent a6882531e2
commit 5c5ba0cb0e
2 changed files with 6 additions and 6 deletions

View File

@@ -470,7 +470,7 @@ onMounted(() => {
<el-radio-group
:effect="themes"
v-model="state.tableTotalForm.row.reverseSubLayout"
:disabled="chart.xAxis.length < 2"
:disabled="chart.xAxis.length < 2 || state.basicStyleForm.tableLayoutMode === 'tree'"
@change="changeTableTotal('row')"
>
<el-radio :effect="themes" :label="true">{{ t('chart.total_pos_top') }}</el-radio>

View File

@@ -724,8 +724,8 @@ function customCalcFunc(query, data, status, chart, totalCfgMap, axisMap, custom
}
case 'CUSTOM': {
const val = getCustomCalcResult(query, axisMap, chart, status, customCalc || {})
if (val === '') {
return val
if (val === '' || val === undefined) {
return '-'
}
return parseFloat(val)
}
@@ -820,7 +820,7 @@ function getTreeCustomCalcResult(query, axisMap, status: TotalStatus, customCalc
if (status.isRowTotal && status.isColSubTotal) {
const { colSubInRowTotal } = customCalc
const colLevel = getSubLevel(query, col)
const { data } = colSubInRowTotal?.[colLevel]
const data = colSubInRowTotal?.[colLevel]?.data
const colPath = getTreePath(query, col)
let val
if (colPath.length && colSubInRowTotal) {
@@ -858,7 +858,7 @@ function getTreeCustomCalcResult(query, axisMap, status: TotalStatus, customCalc
}
return val
}
return NaN
return '-'
}
function getGridCustomCalcResult(query, axisMap, status: TotalStatus, customCalc) {
@@ -932,7 +932,7 @@ function getGridCustomCalcResult(query, axisMap, status: TotalStatus, customCalc
if (status.isRowTotal && status.isColSubTotal) {
const { colSubInRowTotal } = customCalc
const colLevel = getSubLevel(query, col)
const { data } = colSubInRowTotal?.[colLevel]
const data = colSubInRowTotal?.[colLevel]?.data
const colPath = getTreePath(query, col)
let val
if (colPath.length && colSubInRowTotal) {