From a7342d6ef2c64771a817d3b3bff23f9da0bdff7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:30:46 +0800 Subject: [PATCH] fix: More button operations rename using drawer processing parameters (#10933) #10591 --- .../src/views/host/file-management/index.vue | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 7e1f9cd49..f79ab9905 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -468,7 +468,7 @@ @cell-mouse-enter="showFavorite" @cell-mouse-leave="hideFavorite" :heightDiff="heightDiff" - :right-buttons="buttons" + :right-buttons="rightButtons" > { } catch (error) {} }; -const openRename = (item: File.File) => { +const openRename = (item: File.File, source: String) => { fileRename.path = req.path; fileRename.oldName = item.name; - fileRename.newName = item.name; - isEdit.value = true; - nextTick(() => { - getCurrentRename().focus(); - }); - hideRightMenu(); + if (source === 'right') { + fileRename.newName = item.name; + isEdit.value = true; + nextTick(() => { + getCurrentRename().focus(); + }); + hideRightMenu(); + } else { + renameRef.value.acceptParams(fileRename); + } }; const onRenameBlur = (e: FocusEvent, row: File.File) => { @@ -1549,7 +1553,7 @@ const openWithVSCode = (row: File.File) => { dialogVscodeOpenRef.value.acceptParams({ path: row.path + (row.isDir ? '' : ':1:1') }); }; -const buttons = [ +const beforeButtons = [ { label: i18n.global.t('commons.button.open'), click: open, @@ -1597,10 +1601,8 @@ const buttons = [ openBatchRole([row]); }, }, - { - label: i18n.global.t('file.rename'), - click: openRename, - }, +]; +const afterButtons = [ { label: i18n.global.t('commons.button.delete'), disabled: (row: File.File) => { @@ -1643,6 +1645,25 @@ const buttons = [ }, ]; +const rightBtnRename = [ + { + label: i18n.global.t('file.rename'), + click: (row: File.File) => { + openRename(row, 'right'); + }, + }, +]; +const moreBtnRename = [ + { + label: i18n.global.t('file.rename'), + click: (row: File.File) => { + openRename(row, 'more'); + }, + }, +]; + +const rightButtons = [...beforeButtons, ...rightBtnRename, ...afterButtons]; +const tableMoreButtons = [...beforeButtons, ...moreBtnRename, ...afterButtons]; const openConvert = (item: File.File) => { if (!ffmpegExist.value) { ElMessageBox.confirm(i18n.global.t('cronjob.library.noSuchApp', ['FFmpeg']), i18n.global.t('file.convert'), {