diff --git a/src/renderer/src/components/ExtractorOperationHistoryModal.tsx b/src/renderer/src/components/ExtractorOperationHistoryModal.tsx index 2cec417..af11ace 100644 --- a/src/renderer/src/components/ExtractorOperationHistoryModal.tsx +++ b/src/renderer/src/components/ExtractorOperationHistoryModal.tsx @@ -3,10 +3,16 @@ * * Displays extraction operation history with batch statistics and details. * Admin users see all users' records, regular users see only their own. + * + * Migrated to use shadcn/ui components */ import React, { useState, useEffect, useCallback } from 'react' import { Modal } from './ui/Modal' +import { Button } from './ui/Button' +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from './ui/shadcn/table' +import { ScrollArea } from './ui/shadcn/scroll-area' +import { cn } from '@renderer/lib/utils' import { RefreshCw, Trash2, @@ -31,10 +37,10 @@ interface ExtractorOperationHistoryModalProps { } const statusStyles: Record = { - success: 'bg-green-100 text-green-700', - partial: 'bg-amber-100 text-amber-700', - failed: 'bg-red-100 text-red-700', - pending: 'bg-gray-100 text-gray-700' + success: 'bg-green-100 text-green-700 dark:bg-green-900/20 dark:text-green-400', + partial: 'bg-amber-100 text-amber-700 dark:bg-amber-900/20 dark:text-amber-400', + failed: 'bg-red-100 text-red-700 dark:bg-red-900/20 dark:text-red-400', + pending: 'bg-muted text-muted-foreground' } const statusLabels: Record = { @@ -45,10 +51,10 @@ const statusLabels: Record = { } const statusIcons: Record = { - success: , - partial: , - failed: , - pending: + success: , + partial: , + failed: , + pending: } const formatDateTime = (dateStr: string) => { @@ -195,44 +201,45 @@ export const ExtractorOperationHistoryModal: React.FC
{/* Toolbar */} -
+
- + {isAdmin ? ( - 管理员模式:显示所有用户记录 + 管理员模式:显示所有用户记录 ) : ( 仅显示您的操作记录 )} {batches.length > 0 && ( - 共 {batches.length} 条批次 + 共 {batches.length} 条批次 )}
- +
{/* Error message */} {error && ( -
+
{error}
)} {/* Batch list */} -
+ {loading && batches.length === 0 ? ( -
加载中...
+
加载中...
) : batches.length === 0 ? ( -
暂无操作记录
+
暂无操作记录
) : ( -
+
{batches.map((batch) => { const isExpanded = expandedBatches.has(batch.batchId) const details = batchDetails.get(batch.batchId) || [] @@ -241,60 +248,65 @@ export const ExtractorOperationHistoryModal: React.FC {/* Batch summary */}
toggleBatchExpansion(batch.batchId)} >
- +
-
操作时间
-
+
操作时间
+
{formatDateTime(batch.operationTime)}
-
操作用户
-
{batch.username}
+
操作用户
+
{batch.username}
-
状态
+
状态
{statusIcons[batch.status] || statusIcons.pending} {statusLabels[batch.status] || batch.status}
-
订单数
-
{batch.totalOrders}
+
订单数
+
{batch.totalOrders}
-
记录数
-
{batch.totalRecords}
+
记录数
+
{batch.totalRecords}
-
成功/失败
-
- {batch.successCount} +
成功/失败
+
+ {batch.successCount} {batch.failedCount > 0 && ( <> {' / '} - {batch.failedCount} + {batch.failedCount} )}
@@ -302,8 +314,9 @@ export const ExtractorOperationHistoryModal: React.FC
- +
{/* Batch details */} {isExpanded && details.length > 0 && ( -
+
- - - -
+ + + +
总排号 - +
- -
- - - - - - + + 状态 + 记录数 + 错误信息 + + + {details.map((detail) => ( - - - - - - - + + ))} - -
+ +
订单号 - +
-
- 状态 - - 记录数 - - 错误信息 -
+ + {detail.productionId || '-'} - + + {detail.orderNumber} - + + {statusIcons[detail.status]} {statusLabels[detail.status] || detail.status} - + + {detail.recordCount ?? '-'} - + + {detail.errorMessage || '-'} -
+ +
)} @@ -404,16 +414,16 @@ export const ExtractorOperationHistoryModal: React.FC )} -
+ {/* Footer */} -
- +
diff --git a/src/renderer/src/components/LoginDialog.tsx b/src/renderer/src/components/LoginDialog.tsx index 7ce74d6..bf14cb2 100644 --- a/src/renderer/src/components/LoginDialog.tsx +++ b/src/renderer/src/components/LoginDialog.tsx @@ -5,10 +5,15 @@ * - Modal dialog for username/password input * - Display computer name * - Enter key to submit + * + * Migrated to use shadcn/ui components */ import React, { useState, useRef } from 'react' import { Modal } from './ui/Modal' +import { Button } from './ui/Button' +import { Input } from './ui/shadcn/input' +import { Label } from './ui/shadcn/label' interface LoginDialogProps { isOpen: boolean @@ -84,7 +89,7 @@ export const LoginDialog: React.FC = ({