From 7e2c2ba647a963c4d60aaeb68bcebf9566a84cfb Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sun, 16 Nov 2025 20:47:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(system/file):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=96=87=E4=BB=B6=E5=9B=9E=E6=94=B6=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/file.ts | 21 ++ src/apis/system/type.ts | 2 + src/views/system/config/storage/AddModal.vue | 25 +++ .../system/config/storage/StorageLocal.vue | 2 + .../system/config/storage/StorageOss.vue | 2 + .../config/storage/components/CardAdd.vue | 10 +- .../config/storage/components/CardBlock.vue | 4 +- .../file/main/FileMain/RecycleBinModal.vue | 195 ++++++++++++++++++ src/views/system/file/main/FileMain/index.vue | 31 ++- 9 files changed, 279 insertions(+), 13 deletions(-) create mode 100644 src/views/system/file/main/FileMain/RecycleBinModal.vue diff --git a/src/apis/system/file.ts b/src/apis/system/file.ts index 3f174a5..56d7012 100644 --- a/src/apis/system/file.ts +++ b/src/apis/system/file.ts @@ -4,6 +4,7 @@ import http from '@/utils/http' export type * from './type' const BASE_URL = '/system/file' +const RECYCLE_URL = `${BASE_URL}/recycle` /** @desc 上传文件 */ export function uploadFile(data: FormData) { @@ -44,3 +45,23 @@ export function createDir(parentPath: string, name: string) { export function calcDirSize(id: string) { return http.get(`${BASE_URL}/dir/${id}/size`) } + +/** @desc 查询回收站文件列表 */ +export function listRecycleFiles(query: T.FilePageQuery) { + return http.get>(`${RECYCLE_URL}`, query) +} + +/** @desc 还原回收站文件 */ +export function restoreRecycleFile(id: string) { + return http.put(`${RECYCLE_URL}/restore/${id}`) +} + +/** @desc 删除回收站文件 */ +export function deleteRecycleFile(id: string) { + return http.del(`${RECYCLE_URL}/${id}`) +} + +/** @desc 清空回收站 */ +export function cleanRecycleBin() { + return http.del(`${RECYCLE_URL}/clean`) +} diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index 507ab08..3c0f665 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -269,6 +269,8 @@ export interface StorageResp { endpoint: string bucketName: string domain: string + recycleBinEnabled: boolean + recycleBinPath: string description: string isDefault: boolean sort: number diff --git a/src/views/system/config/storage/AddModal.vue b/src/views/system/config/storage/AddModal.vue index 3c3cb69..1cf97ab 100644 --- a/src/views/system/config/storage/AddModal.vue +++ b/src/views/system/config/storage/AddModal.vue @@ -44,6 +44,8 @@ const { storage_type_enum } = useDict('storage_type_enum') const [form, resetForm] = useResetReactive({ type: 2, + recycleBinEnabled: true, + recycleBinPath: '.RECYCLE.BIN/', isDefault: false, sort: 999, status: 2, @@ -127,6 +129,29 @@ const columns: ColumnItem[] = reactive([ required: true, show: () => form.type === 1, }, + { + label: '启用回收站', + field: 'recycleBinEnabled', + type: 'switch', + span: 24, + props: { + type: 'round', + checkedValue: true, + uncheckedValue: false, + checkedText: '启用', + uncheckedText: '禁用', + }, + disabled: () => isUpdate.value, + }, + { + label: '回收站路径', + field: 'recycleBinPath', + type: 'input', + span: 24, + required: true, + show: () => form.recycleBinEnabled, + disabled: () => isUpdate.value, + }, { label: '排序', field: 'sort', diff --git a/src/views/system/config/storage/StorageLocal.vue b/src/views/system/config/storage/StorageLocal.vue index c255f1b..cdd3690 100644 --- a/src/views/system/config/storage/StorageLocal.vue +++ b/src/views/system/config/storage/StorageLocal.vue @@ -39,6 +39,8 @@ {{ item.bucketName }} {{ item.domain }} + {{ item.recycleBinEnabled ? '启用' : '禁用' }} + {{ item.recycleBinPath }} diff --git a/src/views/system/config/storage/StorageOss.vue b/src/views/system/config/storage/StorageOss.vue index de5ec88..b900d53 100644 --- a/src/views/system/config/storage/StorageOss.vue +++ b/src/views/system/config/storage/StorageOss.vue @@ -41,6 +41,8 @@ {{ item.endpoint }} {{ item.bucketName }} {{ item.domain }} + {{ item.recycleBinEnabled ? '启用' : '禁用' }} + {{ item.recycleBinPath }} diff --git a/src/views/system/config/storage/components/CardAdd.vue b/src/views/system/config/storage/components/CardAdd.vue index 8105a5e..6ae135b 100644 --- a/src/views/system/config/storage/components/CardAdd.vue +++ b/src/views/system/config/storage/components/CardAdd.vue @@ -59,7 +59,7 @@ const onAdd = () => { } .content { - height: 48px; + height: 80px; } } @@ -78,15 +78,15 @@ const onAdd = () => { } :deep(.arco-card-body) { - padding-top: 45px; - padding-bottom: 63px; + padding-top: 55px; + padding-bottom: 53px; } } .card-large { :deep(.arco-card-body) { - padding-top: 65px; - padding-bottom: 73px; + padding-top: 75px; + padding-bottom: 63px; } } diff --git a/src/views/system/config/storage/components/CardBlock.vue b/src/views/system/config/storage/components/CardBlock.vue index 66a4c7c..33ad43b 100644 --- a/src/views/system/config/storage/components/CardBlock.vue +++ b/src/views/system/config/storage/components/CardBlock.vue @@ -250,11 +250,11 @@ const onUpdate = (record: StorageResp) => { } .content { - height: 48px; + height: 80px; } .content-large { - height: 78px; + height: 110px; } .extra { diff --git a/src/views/system/file/main/FileMain/RecycleBinModal.vue b/src/views/system/file/main/FileMain/RecycleBinModal.vue new file mode 100644 index 0000000..808cfc3 --- /dev/null +++ b/src/views/system/file/main/FileMain/RecycleBinModal.vue @@ -0,0 +1,195 @@ + + + + + diff --git a/src/views/system/file/main/FileMain/index.vue b/src/views/system/file/main/FileMain/index.vue index 52249cd..fa6bdc8 100644 --- a/src/views/system/file/main/FileMain/index.vue +++ b/src/views/system/file/main/FileMain/index.vue @@ -31,6 +31,14 @@ 分片上传 + + + + + 新建文件夹 + @@ -63,18 +71,19 @@ - - - - + + + + + @@ -114,6 +123,9 @@ + + + @@ -128,6 +140,7 @@ import { previewFileVideoModal, } from '../../components/index' import FileGrid from './FileGrid.vue' +import RecycleBinModal from './RecycleBinModal.vue' import useFileManage from './useFileManage' import { useTable } from '@/hooks' import { type FileItem, type FileQuery, createDir, deleteFile, listFile, uploadFile } from '@/apis/system/file' @@ -344,6 +357,12 @@ const handleBreadcrumbClick = (item) => { search() } +// 回收站 +const RecycleBinModalRef = ref>() +const onRecycleBin = () => { + RecycleBinModalRef.value?.onOpen() +} + onMounted(() => { search() })