feat(platform): show vehicle archive completeness
This commit is contained in:
@@ -34,6 +34,12 @@ function sourceEvidenceText(row: VehicleCoverageRow) {
|
|||||||
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
|
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vehicleArchiveCompleteness(row: VehicleCoverageRow) {
|
||||||
|
const fields = [row.vin, row.plate, row.phone, row.oem];
|
||||||
|
const completed = fields.filter((item) => Boolean(String(item ?? '').trim())).length;
|
||||||
|
return { completed, total: fields.length, label: `${completed}/${fields.length}` };
|
||||||
|
}
|
||||||
|
|
||||||
const coverageLabel: Record<string, string> = {
|
const coverageLabel: Record<string, string> = {
|
||||||
single: '单源',
|
single: '单源',
|
||||||
multi: '多源'
|
multi: '多源'
|
||||||
@@ -226,6 +232,14 @@ export function Vehicles({
|
|||||||
{ title: '车牌', dataIndex: 'plate', width: 120 },
|
{ title: '车牌', dataIndex: 'plate', width: 120 },
|
||||||
{ title: '手机号', dataIndex: 'phone', width: 130 },
|
{ title: '手机号', dataIndex: 'phone', width: 130 },
|
||||||
{ title: 'OEM', dataIndex: 'oem', width: 120 },
|
{ title: 'OEM', dataIndex: 'oem', width: 120 },
|
||||||
|
{
|
||||||
|
title: '档案完整度',
|
||||||
|
width: 120,
|
||||||
|
render: (_: unknown, row: VehicleCoverageRow) => {
|
||||||
|
const archive = vehicleArchiveCompleteness(row);
|
||||||
|
return <Tag color={archive.completed === archive.total ? 'green' : 'orange'}>{archive.label}</Tag>;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '车辆服务状态',
|
title: '车辆服务状态',
|
||||||
width: 130,
|
width: 130,
|
||||||
|
|||||||
@@ -660,6 +660,8 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
|
|||||||
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '确认平台转发 4' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '确认平台转发 4' })).toBeInTheDocument();
|
||||||
expect(screen.getByRole('button', { name: '补齐 YUTONG_MQTT 来源 181' })).toBeInTheDocument();
|
expect(screen.getByRole('button', { name: '补齐 YUTONG_MQTT 来源 181' })).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('档案完整度')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('4/4')).toBeInTheDocument();
|
||||||
expect(screen.getByText('VIN-MULTI-001')).toBeInTheDocument();
|
expect(screen.getByText('VIN-MULTI-001')).toBeInTheDocument();
|
||||||
expect(screen.getAllByText('来源证据').length).toBeGreaterThanOrEqual(1);
|
expect(screen.getAllByText('来源证据').length).toBeGreaterThanOrEqual(1);
|
||||||
expect(screen.getByText('GB32960 在线')).toBeInTheDocument();
|
expect(screen.getByText('GB32960 在线')).toBeInTheDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user