feat(platform): add online statistics summary

This commit is contained in:
lingniu
2026-07-04 16:57:11 +08:00
parent d7f1a9279f
commit 9ac2b90d12
8 changed files with 146 additions and 9 deletions

View File

@@ -4516,6 +4516,27 @@ test('opens same-day mileage statistics from quality issue row', async () => {
})
} as Response;
}
if (path.includes('/api/statistics/online-summary')) {
return {
ok: true,
json: async () => ({
data: {
vehicleCount: 4,
onlineVehicleCount: 3,
offlineVehicleCount: 1,
onlineRatePercent: 75,
redisOnlineKeys: 92,
protocolStats: [
{ protocol: 'JT808', online: 2, total: 3 },
{ protocol: 'GB32960', online: 1, total: 2 }
],
evidence: '由车辆服务覆盖汇总、实时来源状态和 Redis 在线 key 计算'
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
return {
ok: true,
json: async () => ({
@@ -6541,6 +6562,27 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
})
} as Response;
}
if (path.includes('/api/statistics/online-summary')) {
return {
ok: true,
json: async () => ({
data: {
vehicleCount: 4,
onlineVehicleCount: 3,
offlineVehicleCount: 1,
onlineRatePercent: 75,
redisOnlineKeys: 92,
protocolStats: [
{ protocol: 'JT808', online: 2, total: 3 },
{ protocol: 'GB32960', online: 1, total: 2 }
],
evidence: '由车辆服务覆盖汇总、实时来源状态和 Redis 在线 key 计算'
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
return {
ok: true,
json: async () => ({
@@ -6561,6 +6603,10 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
expect(screen.getByText('三类数据源最终汇总为一个车辆服务统计视图')).toBeInTheDocument();
expect(screen.getByText('当前统计证据')).toBeInTheDocument();
expect(screen.getByText('3 车 / 2 来源 / 3 条明细')).toBeInTheDocument();
expect(await screen.findByText('75%')).toBeInTheDocument();
expect(screen.getByText((content) => content.includes('离线 1 车'))).toBeInTheDocument();
expect(screen.getByText((content) => content.includes('Redis 在线 92 key'))).toBeInTheDocument();
expect(screen.getByText((content) => content.includes('由车辆服务覆盖汇总、实时来源状态和 Redis 在线 key 计算'))).toBeInTheDocument();
});
test('copies mileage statistics summary for operations reporting', async () => {