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