From 7925be676b705c9f084c62eb91e378613ad7a11a Mon Sep 17 00:00:00 2001 From: lingniu Date: Sat, 4 Jul 2026 10:00:35 +0800 Subject: [PATCH] feat(platform): show archive gaps on vehicle detail --- .../apps/web/src/pages/VehicleDetail.tsx | 20 ++++++++++++++++++- .../apps/web/src/test/App.test.tsx | 12 ++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx b/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx index fdc384ea..6f84563e 100644 --- a/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx +++ b/vehicle-data-platform/apps/web/src/pages/VehicleDetail.tsx @@ -201,6 +201,14 @@ export function VehicleDetail({ const archiveOEM = resolution?.oem || summary?.oem || identity?.oem || ''; const archiveFields = [hasResolvedVIN && displayVIN !== '-', archivePlate, archivePhone, archiveOEM]; const archiveCompleteness = `${archiveFields.filter(Boolean).length}/${archiveFields.length}`; + const archiveMissingLabels = [ + { value: hasResolvedVIN && displayVIN !== '-' ? displayVIN : '', label: '缺VIN' }, + { value: archivePlate, label: '缺车牌' }, + { value: archivePhone, label: '缺手机号' }, + { value: archiveOEM, label: '缺OEM' } + ] + .filter((item) => !String(item.value ?? '').trim()) + .map((item) => item.label); const archiveSourceCount = Math.max(protocols.length, sourceCount); const formKey = `${query.keyword}-${query.protocol ?? ''}`; const switchSource = (nextProtocol = '') => { @@ -407,7 +415,17 @@ export function VehicleDetail({ { key: '车牌', value: archivePlate || '-' }, { key: '手机号', value: archivePhone || '-' }, { key: 'OEM', value: archiveOEM || '-' }, - { key: '档案完整度', value: {archiveCompleteness} }, + { + key: '档案完整度', + value: ( + + {archiveCompleteness} + {archiveMissingLabels.map((label) => ( + {label} + ))} + + ) + }, { key: '归并来源数', value: archiveSourceCount }, { key: '在线', value: }, { diff --git a/vehicle-data-platform/apps/web/src/test/App.test.tsx b/vehicle-data-platform/apps/web/src/test/App.test.tsx index b44e503a..54af4b7e 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -5458,8 +5458,8 @@ test('shows canonical vehicle archive on detail', async () => { resolved: true, vin: 'VIN-ARCHIVE-001', plate: '粤A档案1', - phone: '13307795425', - oem: 'G7s', + phone: '', + oem: '', protocols: ['GB32960', 'JT808', 'YUTONG_MQTT'], online: true, lastSeen: '2026-07-03T20:12:10+08:00' @@ -5467,8 +5467,8 @@ test('shows canonical vehicle archive on detail', async () => { realtimeSummary: { vin: 'VIN-ARCHIVE-001', plate: '粤A档案1', - phone: '13307795425', - oem: 'G7s', + phone: '', + oem: '', protocols: ['GB32960', 'JT808', 'YUTONG_MQTT'], sourceCount: 3, onlineSourceCount: 2, @@ -5513,7 +5513,9 @@ test('shows canonical vehicle archive on detail', async () => { expect(screen.getByText('车辆主键')).toBeInTheDocument(); expect(screen.getAllByText('VIN-ARCHIVE-001').length).toBeGreaterThan(0); expect(screen.getByText('档案完整度')).toBeInTheDocument(); - expect(screen.getByText('4/4')).toBeInTheDocument(); + expect(screen.getByText('2/4')).toBeInTheDocument(); + expect(screen.getByText('缺手机号')).toBeInTheDocument(); + expect(screen.getByText('缺OEM')).toBeInTheDocument(); expect(screen.getByText('归并来源数')).toBeInTheDocument(); expect(screen.getByText('3')).toBeInTheDocument(); });