feat(platform): surface archive gap actions

This commit is contained in:
lingniu
2026-07-04 09:53:08 +08:00
parent b5a72ce0ec
commit 4791a1fd9c
2 changed files with 16 additions and 4 deletions

View File

@@ -190,6 +190,15 @@ export function Dashboard({ onOpenVehicle, onOpenQuality, onOpenVehicles }: { on
detail: '车辆缺少车牌、手机号或 OEM 等基础档案,影响后续运营查询和治理。'
});
}
for (const field of serviceSummary?.archiveMissingFields ?? []) {
if (field.count <= 0) continue;
items.push({
label: `补齐${field.title}`,
count: field.count,
filters: { archiveMissing: field.field },
detail: `${field.title}会影响车辆档案检索、绑定确认和运营侧筛选。`
});
}
for (const source of serviceSummary?.missingSources ?? []) {
if (source.count <= 0) continue;
items.push({

View File

@@ -101,7 +101,8 @@ test('dashboard renders vehicle service summary metrics', async () => {
{ protocol: 'JT808', online: 157, total: 388 },
{ protocol: 'YUTONG_MQTT', online: 0, total: 0 }
],
missingSources: [{ protocol: 'YUTONG_MQTT', count: 1033 }]
missingSources: [{ protocol: 'YUTONG_MQTT', count: 1033 }],
archiveMissingFields: [{ field: 'phone', title: '缺手机号', count: 353 }]
},
traceId: 'trace-test',
timestamp: 1783094400000
@@ -258,7 +259,8 @@ test('dashboard shows vehicle service action queue', async () => {
archiveIncompleteVehicles: 366,
serviceStatuses: [],
protocols: [],
missingSources: [{ protocol: 'YUTONG_MQTT', count: 983 }]
missingSources: [{ protocol: 'YUTONG_MQTT', count: 983 }],
archiveMissingFields: [{ field: 'phone', title: '缺手机号', count: 353 }]
},
traceId: 'trace-test',
timestamp: 1783094400000
@@ -281,11 +283,12 @@ test('dashboard shows vehicle service action queue', async () => {
expect(screen.getByRole('button', { name: '确认平台转发 461' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '维护身份绑定 9' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '完善车辆档案 366' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '补齐缺手机号 353' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '补齐 YUTONG_MQTT 来源 983' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '完善车辆档案 366' }));
fireEvent.click(screen.getByRole('button', { name: '补齐缺手机号 353' }));
await waitFor(() => {
expect(window.location.hash).toBe('#/vehicles?archiveStatus=incomplete');
expect(window.location.hash).toBe('#/vehicles?archiveMissing=phone');
});
});