feat:添加表格排序功能
This commit is contained in:
@@ -13,7 +13,7 @@ import dayjs from 'dayjs';
|
||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||
import { generateColorRGBA } from '@/utils/generate-utils';
|
||||
import { LineOutlined } from '@ant-design/icons-vue';
|
||||
|
||||
import { TableColumnType } from 'ant-design-vue';
|
||||
const { t, currentLocale } = useI18n();
|
||||
//定义KPI接口
|
||||
interface KPIBase{
|
||||
@@ -352,8 +352,6 @@ const updateChart = () => {
|
||||
observer.observe(container);
|
||||
}
|
||||
};
|
||||
//chart可能为null判断
|
||||
|
||||
|
||||
//钩子函数
|
||||
onMounted(async () => {
|
||||
@@ -513,7 +511,7 @@ const kpiStats = computed((): KPIStats[] => {
|
||||
});
|
||||
|
||||
// 添加表格列定义
|
||||
const statsColumns = [
|
||||
const statsColumns: TableColumnType<KPIStats>[] = [
|
||||
{
|
||||
title: '',
|
||||
key: 'icon',
|
||||
@@ -539,12 +537,16 @@ const statsColumns = [
|
||||
dataIndex: 'max',
|
||||
key: 'max',
|
||||
width: '17%',
|
||||
sorter: (a: KPIStats, b: KPIStats) => a.max - b.max, // 添加排序函数
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
{
|
||||
title: t('views.perfManage.kpiOverView.minValue'),
|
||||
dataIndex: 'min',
|
||||
key: 'min',
|
||||
width: '17%',
|
||||
sorter: (a: KPIStats, b: KPIStats) => a.min - b.min, // 添加排序函数
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user