From fd0ffe8ee2f9bb34be615b71d31dab85a2816868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E6=99=8B=E9=A3=9E?= <378266566@qq.com> Date: Mon, 12 May 2025 16:48:48 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E7=94=A8=E6=88=B7=E6=89=8B=E5=86=8C?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/alert/exa/index.ts | 2 + src/api/infra/file/index.ts | 1 + src/views/file/file.data.ts | 86 ++++++++++++++++++++++++ src/views/file/index.vue | 130 ++++++++++++++++++++++++++++++++++++ 4 files changed, 219 insertions(+) create mode 100644 src/views/file/file.data.ts create mode 100644 src/views/file/index.vue diff --git a/src/api/alert/exa/index.ts b/src/api/alert/exa/index.ts index ba7fe5f..4660a8c 100644 --- a/src/api/alert/exa/index.ts +++ b/src/api/alert/exa/index.ts @@ -77,3 +77,5 @@ export function deletePoint(ItemName: string) { export function importTemplate() { return defHttp.get({ url: '/alert/exa/get-import-template', responseType: 'blob' }) } + + diff --git a/src/api/infra/file/index.ts b/src/api/infra/file/index.ts index fc071a6..195a93c 100644 --- a/src/api/infra/file/index.ts +++ b/src/api/infra/file/index.ts @@ -13,6 +13,7 @@ export interface FileVO { export interface FilePageReqVO extends PageParam { path?: string + name?: string type?: string createTime?: Date[] } diff --git a/src/views/file/file.data.ts b/src/views/file/file.data.ts new file mode 100644 index 0000000..43b43ec --- /dev/null +++ b/src/views/file/file.data.ts @@ -0,0 +1,86 @@ +import type { BasicColumn, FormSchema } from '@/components/Table' +import { useRender } from '@/components/Table' + +export const columns: BasicColumn[] = [ + { + title: '编号', + dataIndex: 'id', + width: 100, + }, + { + title: '文件名', + dataIndex: 'name', + width: 200, + }, + // { + // title: '文件 URL', + // dataIndex: 'url', + // width: 180, + // customRender: ({ text }) => { + // return useRender.renderImg(text) + // }, + // }, + // { + // title: '文件路径', + // dataIndex: 'path', + // width: 180, + // }, + { + title: '文件大小', + dataIndex: 'size', + width: 120, + customRender: ({ text }) => { + const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + const srcSize = Number.parseFloat(text) + const index = Math.floor(Math.log(srcSize) / Math.log(1024)) + const size = srcSize / 1024 ** index + return `${size.toFixed(2)} ${unitArr[index]}` + }, + }, + { + title: '文件类型', + dataIndex: 'type', + width: 100, + customRender: ({ text }) => { + return useRender.renderTag(text) + }, + }, + // { + // 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', + show: false, + colProps: { span: 8 }, + }, + { + label: '文件名', + field: 'name', + component: 'Input', + colProps: { span: 8 }, + }, + { + label: '创建时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 }, + }, +] diff --git a/src/views/file/index.vue b/src/views/file/index.vue new file mode 100644 index 0000000..6f0bb27 --- /dev/null +++ b/src/views/file/index.vue @@ -0,0 +1,130 @@ + + +