feat(platform): add vehicle quality evidence actions
This commit is contained in:
@@ -10038,6 +10038,120 @@ test('shows actionable vehicle service recommendations on detail', async () => {
|
||||
expect(window.location.hash).toBe('#/vehicles?serviceStatus=degraded&missingProtocol=YUTONG_MQTT');
|
||||
});
|
||||
|
||||
test('opens single vehicle quality evidence from vehicle detail', async () => {
|
||||
window.history.replaceState(null, '', '/#/detail?keyword=VIN-DETAIL-QUALITY&protocol=JT808');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/vehicle-service')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
vin: 'VIN-DETAIL-QUALITY',
|
||||
lookupKey: 'VIN-DETAIL-QUALITY',
|
||||
lookupResolved: true,
|
||||
resolution: {
|
||||
lookupKey: 'VIN-DETAIL-QUALITY',
|
||||
resolved: true,
|
||||
vin: 'VIN-DETAIL-QUALITY',
|
||||
plate: '粤A详情告警',
|
||||
phone: '13307795425',
|
||||
oem: 'G7s',
|
||||
protocols: ['JT808'],
|
||||
online: true,
|
||||
lastSeen: '2026-07-03T20:12:10+08:00'
|
||||
},
|
||||
realtimeSummary: {
|
||||
vin: 'VIN-DETAIL-QUALITY',
|
||||
plate: '粤A详情告警',
|
||||
phone: '13307795425',
|
||||
oem: 'G7s',
|
||||
protocols: ['JT808'],
|
||||
sourceCount: 1,
|
||||
onlineSourceCount: 1,
|
||||
online: true,
|
||||
primaryProtocol: 'JT808',
|
||||
longitude: 113.2,
|
||||
latitude: 23.1,
|
||||
speedKmh: 32,
|
||||
socPercent: 0,
|
||||
totalMileageKm: 1000.5,
|
||||
lastSeen: '2026-07-03T20:12:10+08:00'
|
||||
},
|
||||
serviceOverview: {
|
||||
vin: 'VIN-DETAIL-QUALITY',
|
||||
plate: '粤A详情告警',
|
||||
phone: '13307795425',
|
||||
oem: 'G7s',
|
||||
protocols: ['JT808'],
|
||||
primaryProtocol: 'JT808',
|
||||
coverageStatus: 'online',
|
||||
sourceCount: 1,
|
||||
onlineSourceCount: 1,
|
||||
lastSeen: '2026-07-03T20:12:10+08:00',
|
||||
realtimeCount: 1,
|
||||
historyCount: 8,
|
||||
rawCount: 16,
|
||||
mileageCount: 2,
|
||||
qualityIssueCount: 1
|
||||
},
|
||||
sources: ['JT808'],
|
||||
sourceStatus: [
|
||||
{ protocol: 'JT808', online: true, lastSeen: '2026-07-03T20:12:10+08:00', hasRealtime: true, hasHistory: true, hasRaw: true, hasMileage: true }
|
||||
],
|
||||
realtime: [],
|
||||
history: { items: [], total: 8, limit: 20, offset: 0 },
|
||||
raw: { items: [], total: 16, limit: 10, offset: 0 },
|
||||
mileage: { items: [], total: 2, limit: 20, offset: 0 },
|
||||
quality: {
|
||||
items: [
|
||||
{
|
||||
vin: 'VIN-DETAIL-QUALITY',
|
||||
plate: '粤A详情告警',
|
||||
phone: '13307795425',
|
||||
protocol: 'JT808',
|
||||
issueType: 'VIN_MISSING',
|
||||
severity: 'error',
|
||||
lastSeen: '2026-07-03 20:12:10',
|
||||
detail: '详情页质量问题需要处理',
|
||||
sourceEndpoint: '115.231.168.135:43625'
|
||||
}
|
||||
],
|
||||
total: 1,
|
||||
limit: 20,
|
||||
offset: 0
|
||||
}
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: path.includes('/api/ops/health')
|
||||
? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } }
|
||||
: { items: [], total: 0, limit: 10, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('单车处置建议')).toBeInTheDocument();
|
||||
expect(screen.getByText('VIN 缺失')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('详情页质量问题需要处理').length).toBeGreaterThan(0);
|
||||
expect(screen.getAllByText('粤A详情告警 / VIN-DETAIL-QUALITY').length).toBeGreaterThan(0);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '单车告警轨迹证据' }));
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/history?keyword=VIN-DETAIL-QUALITY&protocol=JT808&dateFrom=2026-07-03&dateTo=2026-07-04');
|
||||
});
|
||||
});
|
||||
|
||||
test('shows canonical vehicle archive on detail', async () => {
|
||||
window.history.replaceState(null, '', '/#/detail?keyword=VIN-ARCHIVE-001');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
|
||||
Reference in New Issue
Block a user