From d004f8e9f890656cb4308d767576a8d945000c15 Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Wed, 1 Apr 2026 10:00:31 +0800 Subject: [PATCH] feat(history): add one-click copy for production IDs and order numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add copy buttons in table headers for "总排号" and "订单号" columns - Copy all non-empty values as newline-separated text - Show toast notification with copied data count - Handle clipboard errors gracefully Co-Authored-By: Claude Opus 4.6 --- .../ExtractorOperationHistoryModal.tsx | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/ExtractorOperationHistoryModal.tsx b/src/renderer/src/components/ExtractorOperationHistoryModal.tsx index fd3bf9e..2cec417 100644 --- a/src/renderer/src/components/ExtractorOperationHistoryModal.tsx +++ b/src/renderer/src/components/ExtractorOperationHistoryModal.tsx @@ -14,13 +14,15 @@ import { ChevronRight, CheckCircle, XCircle, - Clock + Clock, + Copy } from 'lucide-react' import type { UserInfo } from './UserSelectionDialog' import type { BatchStats, OperationHistoryRecord } from '../../../main/types/operation-history.types' +import { showSuccess, showError, showWarning } from '../stores/useAppStore' interface ExtractorOperationHistoryModalProps { isOpen: boolean @@ -167,6 +169,26 @@ export const ExtractorOperationHistoryModal: React.FC { + const details = batchDetails.get(batchId) || [] + const values = details + .map((d) => (field === 'productionId' ? d.productionId : d.orderNumber)) + .filter(Boolean) // 移除空值 + .join('\n') // 使用换行符分隔 + + if (!values) { + showWarning('没有可复制的数据') + return + } + + try { + await navigator.clipboard.writeText(values) + showSuccess(`已复制 ${values.split('\n').length} 条数据`) + } catch { + showError('复制失败,请手动复制') + } + } + if (!isOpen) return null return ( @@ -301,10 +323,38 @@ export const ExtractorOperationHistoryModal: React.FC - 总排号 +
+ 总排号 + +
- 订单号 +
+ 订单号 + +
状态