From 52c2e3dcc8e1d951d1171575c22ea188090d7212 Mon Sep 17 00:00:00 2001 From: liumangmang Date: Thu, 7 May 2026 21:06:57 +0800 Subject: [PATCH] feat: add ExceptionListTable and ExceptionListView components Phase 5 complete - extracted advanced list view from monolithic ExceptionPage into focused table and container components. Co-Authored-By: Claude Opus 4.6 --- .../exceptions/ExceptionListTable.jsx | 91 +++++++++++++++++ .../exceptions/ExceptionListView.jsx | 97 +++++++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 frontend/src/components/exceptions/ExceptionListTable.jsx create mode 100644 frontend/src/components/exceptions/ExceptionListView.jsx diff --git a/frontend/src/components/exceptions/ExceptionListTable.jsx b/frontend/src/components/exceptions/ExceptionListTable.jsx new file mode 100644 index 0000000..3aaa7b4 --- /dev/null +++ b/frontend/src/components/exceptions/ExceptionListTable.jsx @@ -0,0 +1,91 @@ +// frontend/src/components/exceptions/ExceptionListTable.jsx +export default function ExceptionListTable({ + items, selectedIds, onToggleSelect, onToggleAll, + isListLoading +}) { + if (isListLoading) { + return ( +
正在加载异常列表...
+ ); + } + + if (!items.length) { + return ( +
当前筛选条件下没有异常记录
+ ); + } + + return ( + + + + + + + + + + + + {items.map((item) => { + const checked = selectedIds.includes(item.exception_id); + const statusColor = { + open: 'border-amber-500/30 bg-amber-500/10 text-amber-200', + resolved: 'border-emerald-500/30 bg-emerald-500/10 text-emerald-200', + ignored: 'border-slate-500/30 bg-slate-500/10 text-slate-400' + }[item.exception_resolution_status] || ''; + const statusLabel = { + open: '开放', resolved: '已解决', ignored: '已忽略' + }[item.exception_resolution_status] || item.exception_resolution_status; + + const typeColor = { + missing_tags: 'border-amber-500/20 bg-amber-500/5 text-amber-300', + duplicates: 'border-slate-500/20 bg-slate-500/5 text-slate-300', + match_failed: 'border-rose-500/20 bg-rose-500/5 text-rose-300', + low_score: 'border-amber-500/20 bg-amber-500/5 text-amber-300', + convert_failed: 'border-rose-500/20 bg-rose-500/5 text-rose-300', + organize_failed: 'border-rose-500/20 bg-rose-500/5 text-rose-300' + }[item.exception_type] || ''; + + return ( + + + + + + + + ); + })} + +
+ 0} + onChange={(e) => onToggleAll(e.target.checked)} + disabled={!items.length} + /> + 异常文件分类状态原因
+ onToggleSelect(item.exception_id)} + /> + +
{item.display_title}
+
{item.filename}
+
+ + {item.type_label} + + + + {statusLabel} + + + {item.display_reason} +
+ ); +} diff --git a/frontend/src/components/exceptions/ExceptionListView.jsx b/frontend/src/components/exceptions/ExceptionListView.jsx new file mode 100644 index 0000000..583e739 --- /dev/null +++ b/frontend/src/components/exceptions/ExceptionListView.jsx @@ -0,0 +1,97 @@ +// frontend/src/components/exceptions/ExceptionListView.jsx +import { AlertTriangle, Music2 } from 'lucide-react'; +import { BULK_ACTIONS, actionButtonClass } from '../../utils/exceptions'; +import ExceptionStatsBar from './ExceptionStatsBar'; +import ExceptionTypeNav from './ExceptionTypeNav'; +import ExceptionListTable from './ExceptionListTable'; +import Pagination from '../Pagination'; + +export default function ExceptionListView({ + summary, summaryError, + items, total, isListLoading, listError, + selectedIds, onToggleSelect, onToggleAll, + activeFilter, onFilterChange, + resolutionFilter, onResolutionChange, + currentPage, onPageChange, + bulkState, onBulkAction, + onSwitchToWizard +}) { + const totalPages = Math.max(1, Math.ceil(total / 8)); + + return ( +
+
+
+
+
+

异常决策台

+

+ + 高级异常处理 +

+

+ 批量、重复文件、转码失败和入库失败在这里处理,保留完整筛选与决策台能力。 +

+ {summaryError ?

{summaryError}

: null} +
+
+ + +
+
+ +
+ { onFilterChange(id); onPageChange(1); }} + resolutionFilter={resolutionFilter} + onResolutionChange={(id) => { onResolutionChange(id); onPageChange(1); }} + summary={summary} + /> +
+ + {!bulkState.disabled && selectedIds.length > 0 && ( +
+ 已选 {selectedIds.length} 项 + {bulkState.actions.map((action) => ( + + ))} +
+ )} +
+ +
+ + {listError && ( +
+ {listError} +
+ )} +
+ +
+ +
+
+
+ ); +}