feat(platform): show archive gaps on vehicle detail

This commit is contained in:
lingniu
2026-07-04 10:00:35 +08:00
parent adff22ef74
commit 7925be676b
2 changed files with 26 additions and 6 deletions

View File

@@ -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: <Tag color={archiveCompleteness === '4/4' ? 'green' : 'orange'}>{archiveCompleteness}</Tag> },
{
key: '档案完整度',
value: (
<Space spacing={4} wrap>
<Tag color={archiveCompleteness === '4/4' ? 'green' : 'orange'}>{archiveCompleteness}</Tag>
{archiveMissingLabels.map((label) => (
<Tag key={label} color="orange">{label}</Tag>
))}
</Space>
)
},
{ key: '归并来源数', value: archiveSourceCount },
{ key: '在线', value: <StatusTag status={online ? 'ok' : 'offline'} /> },
{

View File

@@ -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();
});