From af6c5cc4468ff3b4c22f8278f5cbb2051fffb2a4 Mon Sep 17 00:00:00 2001 From: xingyuv Date: Wed, 22 Mar 2023 17:40:56 +0800 Subject: [PATCH] feat: file --- src/api/infra/{fileList => file}/index.ts | 0 src/views/infra/file/file.data.ts | 77 +++++++++++++++++++++++ src/views/infra/file/index.vue | 66 ++++++++++++++++++- 3 files changed, 142 insertions(+), 1 deletion(-) rename src/api/infra/{fileList => file}/index.ts (100%) create mode 100644 src/views/infra/file/file.data.ts diff --git a/src/api/infra/fileList/index.ts b/src/api/infra/file/index.ts similarity index 100% rename from src/api/infra/fileList/index.ts rename to src/api/infra/file/index.ts diff --git a/src/views/infra/file/file.data.ts b/src/views/infra/file/file.data.ts new file mode 100644 index 00000000..f07fed67 --- /dev/null +++ b/src/views/infra/file/file.data.ts @@ -0,0 +1,77 @@ +import { BasicColumn, FormSchema, useRender } from '@/components/Table' + +export const columns: BasicColumn[] = [ + { + title: '日志编号', + dataIndex: 'id', + width: 100 + }, + { + title: '文件名', + dataIndex: 'module', + width: 200 + }, + { + title: '文件路径', + dataIndex: 'path', + width: 250 + }, + { + title: '文件 URL', + dataIndex: 'url', + width: 300 + }, + { + title: '文件路径', + dataIndex: 'path', + width: 180 + }, + { + title: '文件大小', + dataIndex: 'size', + width: 180, + customRender: ({ text }) => { + const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + const srcSize = parseFloat(text) + const index = Math.floor(Math.log(srcSize) / Math.log(1024)) + const size = srcSize / Math.pow(1024, index) + return size.toFixed(2) + ' ' + unitArr[index] + } + }, + { + title: '文件类型', + dataIndex: 'type', + width: 180 + }, + { + title: '文件内容', + dataIndex: 'content', + width: 180, + customRender: ({ text }) => { + return useRender.renderImg(text) + } + }, + { + title: '上传时间', + dataIndex: 'createTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '文件路径', + field: 'path', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '创建时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 } + } +] diff --git a/src/views/infra/file/index.vue b/src/views/infra/file/index.vue index 3b64cfc4..d2a0f7eb 100644 --- a/src/views/infra/file/index.vue +++ b/src/views/infra/file/index.vue @@ -1,3 +1,67 @@ +