fix:table排序

This commit is contained in:
zhongzm
2024-11-28 20:09:19 +08:00
parent 154569304c
commit b8b66fe610

View File

@@ -811,6 +811,22 @@ const statsColumns: TableColumnType<KPIStats>[] = [
key: 'title',
width: '50%',
},
{
title: t('views.perfManage.kpiOverView.totalValue'),
dataIndex: 'total',
key: 'total',
width: '12%',
sorter: (a: KPIStats, b: KPIStats) => a.total - b.total,
sortDirections: ['ascend', 'descend'],
},
{
title: t('views.perfManage.kpiOverView.avgValue'),
dataIndex: 'avg',
key: 'avg',
width: '12%',
sorter: (a: KPIStats, b: KPIStats) => a.avg - b.avg,
sortDirections: ['ascend', 'descend'],
},
{
title: t('views.perfManage.kpiOverView.maxValue'),
dataIndex: 'max',
@@ -824,25 +840,9 @@ const statsColumns: TableColumnType<KPIStats>[] = [
dataIndex: 'min',
key: 'min',
width: '12%',
sorter: (a: KPIStats, b: KPIStats) => a.min - b.min, // 添加排序函数
sorter: (a: KPIStats, b: KPIStats) => a.min - b.min,
sortDirections: ['ascend', 'descend'],
},
{
title: t('views.perfManage.kpiOverView.avgValue'), // 需要在语言包中添加对应的翻译
dataIndex: 'avg',
key: 'avg',
width: '12%',
sorter: (a: KPIStats, b: KPIStats) => a.avg - b.avg,
sortDirections: ['ascend', 'descend'],
},
{
title: t('views.perfManage.kpiOverView.totalValue'),
dataIndex: 'total',
key: 'total',
width: '12%',
sorter: (a: KPIStats, b: KPIStats) => a.total - b.total,
sortDirections: ['ascend', 'descend'],
}
];
// 将 selectedRow 改为 selectedRows 数组