From fb4395552b9c1768395576a565d3b85105be944d Mon Sep 17 00:00:00 2001 From: lan-yonghui Date: Wed, 15 Oct 2025 10:25:35 +0800 Subject: [PATCH] feat: Favorite files support directory redirection --- .../host/file-management/favorite/index.vue | 32 +++++++++- .../src/views/host/file-management/index.vue | 63 +++++++++++-------- 2 files changed, 65 insertions(+), 30 deletions(-) diff --git a/frontend/src/views/host/file-management/favorite/index.vue b/frontend/src/views/host/file-management/favorite/index.vue index 53be8d866946..0353e165d2cd 100644 --- a/frontend/src/views/host/file-management/favorite/index.vue +++ b/frontend/src/views/host/file-management/favorite/index.vue @@ -2,7 +2,17 @@ @@ -13,6 +23,7 @@ import { searchFavorite, removeFavorite } from '@/api/modules/files'; import i18n from '@/lang'; import { reactive, ref } from 'vue'; +import { File } from '@/api/interface/file'; const paginationConfig = reactive({ cacheSizeKey: 'favorite-page-size', @@ -26,13 +37,22 @@ const req = reactive({ }); const open = ref(false); const data = ref([]); -const em = defineEmits(['close']); +const em = defineEmits(['close', 'jump', 'toFavorite']); const handleClose = () => { open.value = false; em('close', false); }; +const toFavorite = (row: File.Favorite) => { + open.value = false; + em('toFavorite', row); +}; +const openDir = (url: string) => { + open.value = false; + em('jump', url); +}; + const acceptParams = () => { search(); }; @@ -55,12 +75,18 @@ const singleDel = async (id: number) => { }).then(async () => { try { await removeFavorite(id); - search(); + await search(); } catch (error) {} }); }; const buttons = [ + { + label: i18n.global.t('commons.button.open'), + click: (row: any) => { + openDir(row.path); + }, + }, { label: i18n.global.t('commons.button.delete'), click: (row: any) => { diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index dea2f9542116..88fa1b0645c4 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -1,5 +1,5 @@