forked from github/dataease
feat(视图): 透视表行汇总支持按合计排序
This commit is contained in:
parent
e9af2b2ebb
commit
234a478024
@ -424,7 +424,7 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
|
|||||||
|
|
||||||
// 解析合计、小计排序
|
// 解析合计、小计排序
|
||||||
const sortParams = []
|
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 = {
|
const sort = {
|
||||||
sortFieldId: c[0],
|
sortFieldId: c[0],
|
||||||
sortMethod: totalCfg.row.totalSort.toUpperCase(),
|
sortMethod: totalCfg.row.totalSort.toUpperCase(),
|
||||||
@ -436,7 +436,7 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
|
|||||||
sortParams.push(sort)
|
sortParams.push(sort)
|
||||||
}
|
}
|
||||||
totalCfg.col.totalSort = false
|
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 = {
|
const sort = {
|
||||||
sortFieldId: r[0],
|
sortFieldId: r[0],
|
||||||
sortMethod: totalCfg.col.totalSort.toUpperCase(),
|
sortMethod: totalCfg.col.totalSort.toUpperCase(),
|
||||||
|
@ -422,12 +422,15 @@ export default {
|
|||||||
this.totalSortFields = JSON.parse(chart.yaxis)
|
this.totalSortFields = JSON.parse(chart.yaxis)
|
||||||
}
|
}
|
||||||
if (this.totalSortFields.length > 0) {
|
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
|
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
|
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) {
|
showProperty(property) {
|
||||||
return this.propertyInner.includes(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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user