From d46812483f72a23bacfa646e11db077c3507c888 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 14 Mar 2023 21:08:00 +0800 Subject: [PATCH] =?UTF-8?q?file=20=E9=87=8D=E6=9E=84=E7=9A=84=20review=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/fileConfig/index.ts | 9 ++------- src/views/infra/file/form.vue | 5 +++-- src/views/infra/file/index.vue | 2 ++ src/views/infra/fileConfig/index.vue | 7 ++++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/api/infra/fileConfig/index.ts b/src/api/infra/fileConfig/index.ts index 2f096706..d6c00996 100644 --- a/src/api/infra/fileConfig/index.ts +++ b/src/api/infra/fileConfig/index.ts @@ -13,6 +13,7 @@ export interface FileClientConfig { accessSecret?: string domain: string } + export interface FileConfigVO { id: number name: string @@ -24,14 +25,8 @@ export interface FileConfigVO { createTime: Date } -export interface FileConfigPageReqVO extends PageParam { - name?: string - storage?: number - createTime?: Date[] -} - // 查询文件配置列表 -export const getFileConfigPage = (params: FileConfigPageReqVO) => { +export const getFileConfigPage = (params: PageParam) => { return request.get({ url: '/infra/file-config/page', params }) } diff --git a/src/views/infra/file/form.vue b/src/views/infra/file/form.vue index 8550d440..15ef02fd 100644 --- a/src/views/infra/file/form.vue +++ b/src/views/infra/file/form.vue @@ -59,14 +59,17 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成 const handleFileChange = (file) => { data.value.path = file.name } + /** 处理文件上传中 */ const handleFileUploadProgress = () => { formLoading.value = true // 禁止修改 } + /** 发起文件上传 */ const submitFileForm = () => { unref(uploadRef)?.submit() } + /** 文件上传成功处理 */ const handleFileSuccess = () => { // 清理 @@ -78,5 +81,3 @@ const handleFileSuccess = () => { emit('success') } - - diff --git a/src/views/infra/file/index.vue b/src/views/infra/file/index.vue index 0f63ea28..7c88ffb0 100644 --- a/src/views/infra/file/index.vue +++ b/src/views/infra/file/index.vue @@ -147,6 +147,7 @@ const handleDelete = async (id: number) => { } catch {} } +// TODO 写到 utils/index.ts 中 const sizeFormat = (row) => { const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] const srcSize = parseFloat(row.size) @@ -155,6 +156,7 @@ const sizeFormat = (row) => { const sizeStr = size.toFixed(2) //保留的小数位数 return sizeStr + ' ' + unitArr[index] } + /** 初始化 **/ onMounted(() => { getList() diff --git a/src/views/infra/fileConfig/index.vue b/src/views/infra/fileConfig/index.vue index 3b683e4e..4145d7a0 100644 --- a/src/views/infra/fileConfig/index.vue +++ b/src/views/infra/fileConfig/index.vue @@ -68,7 +68,7 @@ width="180" :formatter="dateFormatter" /> - +