feat(platform): expose customer service scope actions

This commit is contained in:
lingniu
2026-07-06 04:30:47 +08:00
parent f068fc772d
commit 2aa7b394a6
4 changed files with 140 additions and 3 deletions

View File

@@ -321,6 +321,88 @@ test('dashboard gives a customer next best action directly on the first screen',
expect(within(nextActionRegion).getByRole('button', { name: '建议下一步 时间窗 按同一范围交付数据 复制复盘包' })).toBeInTheDocument();
});
test('dashboard exposes customer service scope delivery actions on the first screen', async () => {
window.history.replaceState(null, '', '/#/dashboard?keyword=VIN-SCOPE-001&protocol=JT808&dateFrom=2026-07-01&dateTo=2026-07-03');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/ops/health')) {
return {
ok: true,
json: async () => ({
data: {
linkHealth: [],
kafkaLag: 0,
activeConnections: 15,
redisOnlineKeys: 92,
tdengineWritable: true,
mysqlWritable: true,
runtime: { requestTimeoutMs: 5000, amapWebJsConfigured: true, amapSecurityProxyEnabled: true, amapSecurityCodeExposed: false }
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/dashboard/summary')) {
return {
ok: true,
json: async () => ({
data: {
onlineVehicles: 92,
activeToday: 120,
frameToday: 21000,
issueVehicles: 7,
kafkaLag: 0,
protocols: [],
serviceStatuses: [],
linkHealth: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/vehicle-service/summary')) {
return {
ok: true,
json: async () => ({
data: {
totalVehicles: 1033,
boundVehicles: 988,
onlineVehicles: 92,
singleSourceVehicles: 170,
multiSourceVehicles: 220,
noDataVehicles: 15,
identityRequiredVehicles: 9,
serviceStatuses: [],
protocols: [],
missingSources: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
return {
ok: true,
json: async () => ({
data: { items: [], total: 0, limit: 8, offset: 0 },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
});
render(<App />);
expect(await screen.findByRole('heading', { name: '客户车辆服务路径' })).toBeInTheDocument();
const scopeRegion = screen.getByLabelText('客户服务范围');
expect(within(scopeRegion).getByText('当前服务范围')).toBeInTheDocument();
expect(within(scopeRegion).getByText('VIN-SCOPE-001 / JT808 / 2026-07-01 至 2026-07-03')).toBeInTheDocument();
expect(within(scopeRegion).getByRole('button', { name: '客户服务范围 复制范围' })).toBeInTheDocument();
expect(within(scopeRegion).getByRole('button', { name: '客户服务范围 保存视图' })).toBeInTheDocument();
});
test('topbar frames customer work as a vehicle service delivery strip', () => {
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
ok: true,