diff --git a/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx b/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx index ce846df6..0a157949 100644 --- a/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx +++ b/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx @@ -3308,13 +3308,13 @@ export default function OaBoardClient({ dashboard, loadErrorMessage, sampleProgressItems = [], - currentSampleStageCount = 0, + currentSampleStageOpeningCodes = [], currentUserName = '', }: { dashboard: OaBoardDashboardDTO loadErrorMessage?: string | null sampleProgressItems?: SampleProgressDTO[] - currentSampleStageCount?: number + currentSampleStageOpeningCodes?: string[] currentUserName?: string }) { const { items: allItems, stageGraph, dailyReport, monthlyReport } = dashboard @@ -4475,7 +4475,7 @@ export default function OaBoardClient({ ) : activeTab === 'brand-planning' ? ( ) : activeTab === 'sample-progress' ? ( - + ) : activeTab === 'timeout-analysis' ? ( ) diff --git a/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx b/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx index c15aac25..9efd4218 100644 --- a/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx +++ b/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx @@ -17,10 +17,10 @@ const inputDate = (value: string | Date) => { return Number.isNaN(date.getTime()) ? '' : date.toISOString().slice(0, 10) } -export default function SampleProgressClient({ initialItems, currentUserName, currentSampleStageCount = 0, embedded = false }: { initialItems: SampleProgressDTO[]; currentUserName: string; currentSampleStageCount?: number; embedded?: boolean }) { +export default function SampleProgressClient({ initialItems, currentUserName, currentSampleStageOpeningCodes = [], embedded = false }: { initialItems: SampleProgressDTO[]; currentUserName: string; currentSampleStageOpeningCodes?: string[]; embedded?: boolean }) { const [items, setItems] = useState(initialItems) const [keyword, setKeyword] = useState('') - const [status, setStatus] = useState('ACTIVE') + const [status, setStatus] = useState('CURRENT_STAGE') const [page, setPage] = useState(1) const [editing, setEditing] = useState(null) const [saving, setSaving] = useState(false) @@ -29,15 +29,17 @@ export default function SampleProgressClient({ initialItems, currentUserName, cu const [previewImage, setPreviewImage] = useState(null) const canEdit = (item: SampleProgressDTO) => canEditSampleProgress(currentUserName, item) + const currentStageCodes = useMemo(() => new Set(currentSampleStageOpeningCodes.map((code) => code.trim().toUpperCase())), [currentSampleStageOpeningCodes]) + const currentStageItems = useMemo(() => items.filter((item) => currentStageCodes.has(item.openingCode.trim().toUpperCase())), [currentStageCodes, items]) const filtered = useMemo(() => items.filter((item) => { const haystack = [item.openingCode, item.brand, item.supplier, item.designer, item.purchaseOwner, item.color, item.material].join(' ').toLowerCase() - const statusMatches = status === 'ALL' || (status === 'ACTIVE' ? !hiddenTerminalStatuses.has(item.status) : item.status === status) + const statusMatches = status === 'ALL' || (status === 'CURRENT_STAGE' ? currentStageCodes.has(item.openingCode.trim().toUpperCase()) : item.status === status) return (!keyword || haystack.includes(keyword.toLowerCase())) && statusMatches - }), [items, keyword, status]) + }), [currentStageCodes, items, keyword, status]) const totalPages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE)) const rows = filtered.slice((Math.min(page, totalPages) - 1) * PAGE_SIZE, Math.min(page, totalPages) * PAGE_SIZE) - const overdueCount = items.filter(isOverdue).length - const statusCounts = SAMPLE_PROGRESS_STATUSES.map((value) => ({ value, count: items.filter((item) => item.status === value).length })) + const overdueCount = currentStageItems.filter(isOverdue).length + const statusCounts = SAMPLE_PROGRESS_STATUSES.map((value) => ({ value, count: currentStageItems.filter((item) => item.status === value).length })) async function remove(item: SampleProgressDTO) { if (!window.confirm(`确认删除 ${item.openingCode} 的打样记录?`)) return @@ -53,12 +55,13 @@ export default function SampleProgressClient({ initialItems, currentUserName, cu -
- } label="当前打样节点" value={`${currentSampleStageCount} 款`} tone="plain" /> +
+ } label="当前打样节点" value={`${currentStageItems.length} 款`} tone="plain" /> } label="交期已超期" value={`${overdueCount} 款`} tone={overdueCount ? 'danger' : 'plain'} /> + } label="OA 台账匹配" value={`${currentStageItems.length} / ${currentStageCodes.size}`} tone={currentStageItems.length === currentStageCodes.size ? 'success' : 'danger'} />
-
+
{statusCounts.map(({ value, count }) => (