2
0

fix:话单管理界面添加排序

This commit is contained in:
zhongzm
2025-02-12 15:25:28 +08:00
parent 72343da432
commit 02255d5be3

View File

@@ -38,7 +38,6 @@ const doGetCdrInfo = async (params: SearchModel) => {
console.log('API Response:', response); console.log('API Response:', response);
const rows = response.data?.rows || []; const rows = response.data?.rows || [];
const total = response.data?.total || 0; const total = response.data?.total || 0;
console.log('Processed data:', { rows, total });
return { return {
data: { data: {
rows, rows,
@@ -102,6 +101,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP
title: t('page.cdr.up'), title: t('page.cdr.up'),
align: 'center', align: 'center',
width: 120, width: 120,
sorter: (a, b) => a.trafficUp - b.trafficUp,
customRender: ({ text }) => { customRender: ({ text }) => {
const { value, unit } = formatStorage(text); const { value, unit } = formatStorage(text);
return `${value.toFixed(2)} ${unit}`; return `${value.toFixed(2)} ${unit}`;
@@ -113,6 +113,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP
title: t('page.cdr.down'), title: t('page.cdr.down'),
align: 'center', align: 'center',
width: 120, width: 120,
sorter: (a, b) => a.trafficDown - b.trafficDown,
customRender: ({ text }) => { customRender: ({ text }) => {
const { value, unit } = formatStorage(text); const { value, unit } = formatStorage(text);
return `${value.toFixed(2)} ${unit}`; return `${value.toFixed(2)} ${unit}`;
@@ -146,10 +147,21 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP
title: t('page.cdr.duration'), title: t('page.cdr.duration'),
align: 'center', align: 'center',
width: 120, width: 120,
sorter: (a, b) => a.duration - b.duration,
customRender: ({ text }) => formatDuration(text) customRender: ({ text }) => formatDuration(text)
}, },
] ]
}); });
const handleTableChange = (
pagination: any,
filters: any,
sorter: any
) => {
searchParams.pageNum = pagination.current;
searchParams.pageSize = pagination.pageSize;
getData();
};
</script> </script>
<template> <template>
@@ -191,11 +203,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP
}" }"
:scroll="scrollConfig" :scroll="scrollConfig"
class="h-full" class="h-full"
@change="(pagination) => { @change="handleTableChange"
searchParams.pageNum = pagination.current;
searchParams.pageSize = pagination.pageSize;
getData();
}"
/> />
</ACard> </ACard>
</div> </div>