forked from github/dataease
fix(视图-透视表): 透视表汇总排序错误
This commit is contained in:
parent
9bb04e99ba
commit
21ed2c84d1
@ -502,9 +502,7 @@ onMounted(() => {
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-show="
|
||||
false && chart.type === 'table-pivot' && state.tableTotalForm.col?.totalSort !== 'none'
|
||||
"
|
||||
v-show="chart.type === 'table-pivot' && state.tableTotalForm.col?.totalSort !== 'none'"
|
||||
:label="t('chart.total_sort_field')"
|
||||
class="form-item"
|
||||
>
|
||||
|
@ -307,30 +307,30 @@ function customCalcFunc(query, data, totalCfgMap) {
|
||||
switch (aggregation) {
|
||||
case 'SUM': {
|
||||
return data.reduce((p, n) => {
|
||||
return p + n[n[EXTRA_FIELD]]
|
||||
return p + n[query[EXTRA_FIELD]]
|
||||
}, 0)
|
||||
}
|
||||
case 'AVG': {
|
||||
const sum = data.reduce((p, n) => {
|
||||
return p + n[n[EXTRA_FIELD]]
|
||||
return p + n[query[EXTRA_FIELD]]
|
||||
}, 0)
|
||||
return sum / data.length
|
||||
}
|
||||
case 'MIN': {
|
||||
const result = minBy(data, n => {
|
||||
return n[n[EXTRA_FIELD]]
|
||||
return n[query[EXTRA_FIELD]]
|
||||
})
|
||||
return result[result[EXTRA_FIELD]]
|
||||
return result[query[EXTRA_FIELD]]
|
||||
}
|
||||
case 'MAX': {
|
||||
const result = maxBy(data, n => {
|
||||
return n[n[EXTRA_FIELD]]
|
||||
return n[query[EXTRA_FIELD]]
|
||||
})
|
||||
return result[result[EXTRA_FIELD]]
|
||||
return result[query[EXTRA_FIELD]]
|
||||
}
|
||||
default: {
|
||||
return data.reduce((p, n) => {
|
||||
return p + n[n[EXTRA_FIELD]]
|
||||
return p + n[query[EXTRA_FIELD]]
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user