fix: 返回数据参数调整,显示文件大小

This commit is contained in:
TsMask
2025-06-16 18:40:34 +08:00
parent 951d48f470
commit 38c0e3d08d

View File

@@ -5,6 +5,7 @@ import { SizeType } from 'ant-design-vue/es/config-provider';
import { ColumnsType } from 'ant-design-vue/es/table'; import { ColumnsType } from 'ant-design-vue/es/table';
import { Modal, message } from 'ant-design-vue/es'; import { Modal, message } from 'ant-design-vue/es';
import { parseDateToStr } from '@/utils/date-utils'; import { parseDateToStr } from '@/utils/date-utils';
import { parseSizeFromFile } from '@/utils/parse-utils';
import { getNeFile, listNeFiles } from '@/api/tool/neFile'; import { getNeFile, listNeFiles } from '@/api/tool/neFile';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useNeInfoStore from '@/store/modules/neinfo'; import useNeInfoStore from '@/store/modules/neinfo';
@@ -79,16 +80,19 @@ let tableColumns: ColumnsType = [
dataIndex: 'size', dataIndex: 'size',
align: 'left', align: 'left',
width: 100, width: 100,
customRender(opt) {
return parseSizeFromFile(opt.value);
},
}, },
{ {
title: t('views.logManage.neFile.modifiedTime'), title: t('views.logManage.neFile.modifiedTime'),
dataIndex: 'modifiedTime', dataIndex: 'modifiedTime',
align: 'left', align: 'left',
width: 200,
customRender(opt) { customRender(opt) {
if (!opt.value) return ''; if (!opt.value) return '';
return parseDateToStr(opt.value * 1000); return parseDateToStr(opt.value * 1000);
}, },
width: 250,
}, },
{ {
title: t('views.logManage.neFile.fileName'), title: t('views.logManage.neFile.fileName'),
@@ -238,9 +242,10 @@ function fnGetList(pageNum?: number) {
} }
queryParams.path = nePathArr.value.join('/'); queryParams.path = nePathArr.value.join('/');
listNeFiles(toRaw(queryParams)).then(res => { listNeFiles(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { if (res.code === RESULT_CODE_SUCCESS) {
tablePagination.total = res.total; const { total, rows } = res.data;
tableState.data = res.rows; tablePagination.total = total;
tableState.data = rows;
if ( if (
tablePagination.total <= tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize && (queryParams.pageNum - 1) * tablePagination.pageSize &&