diff --git a/packages/frontend/src/components/FileManager.vue b/packages/frontend/src/components/FileManager.vue index 04d22bb..7cb80fd 100644 --- a/packages/frontend/src/components/FileManager.vue +++ b/packages/frontend/src/components/FileManager.vue @@ -315,6 +315,13 @@ const handleItemClick = (event: MouseEvent, item: FileListItem, forceMultiSelect originalHandleItemClick(event, item); }; +// +++ 计算属性:获取选中的完整文件对象列表 +++ +const computedSelectedFullItems = computed((): FileListItem[] => { + if (!selectedItems.value || selectedItems.value.size === 0) { + return []; + } + return filteredFileList.value.filter(item => selectedItems.value.has(item.filename)); +}); // --- 操作模态框辅助函数 --- const openActionModal = ( @@ -1619,6 +1626,7 @@ const handleOpenEditorClick = () => { :position="contextMenuPosition" :items="contextMenuItems" :active-context-item="contextTargetItem" + :selected-file-items="computedSelectedFullItems" :current-directory-path="currentSftpManager?.currentPath?.value ?? '/'" @close-request="hideContextMenu" /> diff --git a/packages/frontend/src/components/FileManagerContextMenu.vue b/packages/frontend/src/components/FileManagerContextMenu.vue index f5cd97b..791fc07 100644 --- a/packages/frontend/src/components/FileManagerContextMenu.vue +++ b/packages/frontend/src/components/FileManagerContextMenu.vue @@ -24,6 +24,10 @@ const props = defineProps({ type: Object as PropType, default: null, }, + selectedFileItems: { // Items currently selected in the file manager + type: Array as PropType, + default: () => [], + }, currentDirectoryPath: { // Current path of the file manager type: String, required: true, @@ -118,33 +122,46 @@ const handleItemClick = (item: ContextMenuItem) => { }; const handleSendToClick = () => { - if (props.activeContextItem) { + const itemsToSend: { name: string; path: string; type: 'file' | 'directory' }[] = []; + + // 优先使用多选的项目 + if (props.selectedFileItems && props.selectedFileItems.length > 0) { + props.selectedFileItems.forEach(item => { + const type = item.attrs.isDirectory ? 'directory' : 'file'; + let fullPath = props.currentDirectoryPath; + if (!fullPath.endsWith('/')) { + fullPath += '/'; + } + fullPath += item.filename; + fullPath = fullPath.replace(/(?