feat(platform): show archive gaps on vehicle detail
This commit is contained in:
@@ -201,6 +201,14 @@ export function VehicleDetail({
|
|||||||
const archiveOEM = resolution?.oem || summary?.oem || identity?.oem || '';
|
const archiveOEM = resolution?.oem || summary?.oem || identity?.oem || '';
|
||||||
const archiveFields = [hasResolvedVIN && displayVIN !== '-', archivePlate, archivePhone, archiveOEM];
|
const archiveFields = [hasResolvedVIN && displayVIN !== '-', archivePlate, archivePhone, archiveOEM];
|
||||||
const archiveCompleteness = `${archiveFields.filter(Boolean).length}/${archiveFields.length}`;
|
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 archiveSourceCount = Math.max(protocols.length, sourceCount);
|
||||||
const formKey = `${query.keyword}-${query.protocol ?? ''}`;
|
const formKey = `${query.keyword}-${query.protocol ?? ''}`;
|
||||||
const switchSource = (nextProtocol = '') => {
|
const switchSource = (nextProtocol = '') => {
|
||||||
@@ -407,7 +415,17 @@ export function VehicleDetail({
|
|||||||
{ key: '车牌', value: archivePlate || '-' },
|
{ key: '车牌', value: archivePlate || '-' },
|
||||||
{ key: '手机号', value: archivePhone || '-' },
|
{ key: '手机号', value: archivePhone || '-' },
|
||||||
{ key: 'OEM', value: archiveOEM || '-' },
|
{ 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: archiveSourceCount },
|
||||||
{ key: '在线', value: <StatusTag status={online ? 'ok' : 'offline'} /> },
|
{ key: '在线', value: <StatusTag status={online ? 'ok' : 'offline'} /> },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5458,8 +5458,8 @@ test('shows canonical vehicle archive on detail', async () => {
|
|||||||
resolved: true,
|
resolved: true,
|
||||||
vin: 'VIN-ARCHIVE-001',
|
vin: 'VIN-ARCHIVE-001',
|
||||||
plate: '粤A档案1',
|
plate: '粤A档案1',
|
||||||
phone: '13307795425',
|
phone: '',
|
||||||
oem: 'G7s',
|
oem: '',
|
||||||
protocols: ['GB32960', 'JT808', 'YUTONG_MQTT'],
|
protocols: ['GB32960', 'JT808', 'YUTONG_MQTT'],
|
||||||
online: true,
|
online: true,
|
||||||
lastSeen: '2026-07-03T20:12:10+08:00'
|
lastSeen: '2026-07-03T20:12:10+08:00'
|
||||||
@@ -5467,8 +5467,8 @@ test('shows canonical vehicle archive on detail', async () => {
|
|||||||
realtimeSummary: {
|
realtimeSummary: {
|
||||||
vin: 'VIN-ARCHIVE-001',
|
vin: 'VIN-ARCHIVE-001',
|
||||||
plate: '粤A档案1',
|
plate: '粤A档案1',
|
||||||
phone: '13307795425',
|
phone: '',
|
||||||
oem: 'G7s',
|
oem: '',
|
||||||
protocols: ['GB32960', 'JT808', 'YUTONG_MQTT'],
|
protocols: ['GB32960', 'JT808', 'YUTONG_MQTT'],
|
||||||
sourceCount: 3,
|
sourceCount: 3,
|
||||||
onlineSourceCount: 2,
|
onlineSourceCount: 2,
|
||||||
@@ -5513,7 +5513,9 @@ test('shows canonical vehicle archive on detail', async () => {
|
|||||||
expect(screen.getByText('车辆主键')).toBeInTheDocument();
|
expect(screen.getByText('车辆主键')).toBeInTheDocument();
|
||||||
expect(screen.getAllByText('VIN-ARCHIVE-001').length).toBeGreaterThan(0);
|
expect(screen.getAllByText('VIN-ARCHIVE-001').length).toBeGreaterThan(0);
|
||||||
expect(screen.getByText('档案完整度')).toBeInTheDocument();
|
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('归并来源数')).toBeInTheDocument();
|
||||||
expect(screen.getByText('3')).toBeInTheDocument();
|
expect(screen.getByText('3')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user