feat(platform): align map workflows with statistics query

This commit is contained in:
lingniu
2026-07-05 15:06:50 +08:00
parent 2824982b60
commit dab46d2595
2 changed files with 18 additions and 18 deletions

View File

@@ -422,7 +422,7 @@ function realtimeDutyHandoffText({
` 车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: row.vin, protocol }))}`,
` 实时监控:${appURL(buildAppHash({ page: 'realtime', keyword: row.vin, protocol }))}`,
` 轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: row.vin, protocol }))}`,
` 里程统计:${appURL(buildAppHash({ page: 'mileage', keyword: row.vin, protocol }))}`,
` 统计查询${appURL(buildAppHash({ page: 'mileage', keyword: row.vin, protocol }))}`,
` 历史查询:${protocol ? rawFrameAPIURL(row, protocol) : '-'}`
);
});
@@ -507,7 +507,7 @@ function mapCustomerPackageText({
`实时地图:${appURL(buildAppHash({ page: 'map', protocol: filters.protocol, filters }))}`,
selectedVIN ? `车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: selectedVIN, protocol: selectedProtocol }))}` : '',
selectedVIN ? `轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: selectedVIN, protocol: selectedProtocol }))}` : '',
selectedVIN ? `里程统计:${appURL(buildAppHash({ page: 'mileage', keyword: selectedVIN, protocol: selectedProtocol }))}` : '',
selectedVIN ? `统计查询${appURL(buildAppHash({ page: 'mileage', keyword: selectedVIN, protocol: selectedProtocol }))}` : '',
selectedVIN ? `历史数据:${appURL(buildAppHash({ page: 'history-query', keyword: selectedVIN, protocol: selectedProtocol, filters: { tab: 'raw', includeFields: 'true' } }))}` : '',
selectedVIN ? `告警通知:${appURL(buildAppHash({ page: 'alert-events', keyword: selectedVIN, protocol: selectedProtocol }))}` : ''
].filter(Boolean).join('\n');
@@ -776,7 +776,7 @@ export function Realtime({
`实时状态:${timeWindowRow ? `${vehicleServiceStatus(timeWindowRow).label} / ${dataFreshness(timeWindowRow).detail}` : '未选车辆'}`,
`轨迹回放:${timeWindowReady ? window.location.origin + window.location.pathname + buildAppHash({ page: 'history', keyword: timeWindowKeyword, protocol: timeWindowProtocol, filters: timeWindowFilters() }) : '-'}`,
`历史数据:${timeWindowReady ? window.location.origin + window.location.pathname + buildAppHash({ page: 'history-query', keyword: timeWindowKeyword, protocol: timeWindowProtocol, filters: timeWindowFilters({ tab: 'raw', includeFields: 'true' }) }) : '-'}`,
`里程统计:${timeWindowReady ? window.location.origin + window.location.pathname + buildAppHash({ page: 'mileage', keyword: timeWindowKeyword, protocol: timeWindowProtocol, filters: timeWindowFilters() }) : '-'}`,
`统计查询${timeWindowReady ? window.location.origin + window.location.pathname + buildAppHash({ page: 'mileage', keyword: timeWindowKeyword, protocol: timeWindowProtocol, filters: timeWindowFilters() }) : '-'}`,
`告警通知:${timeWindowReady ? window.location.origin + window.location.pathname + buildAppHash({ page: 'alert-events', keyword: timeWindowKeyword, protocol: timeWindowProtocol, filters: timeWindowFilters() }) : '-'}`
].join('\n'), '客户时间窗监控包');
const timeWindowWorkItems = [
@@ -799,10 +799,10 @@ export function Realtime({
onClick: openTimeWindowRaw
},
{
title: '里程统计',
title: '统计查询',
value: timeWindowRow?.totalMileageKm != null ? `${timeWindowRow.totalMileageKm} km` : '待核对',
detail: '核对区间里程、日里程和总里程差值。',
action: '核对里程',
action: '查看统计',
color: 'orange' as const,
disabled: !timeWindowReady,
onClick: openTimeWindowMileage
@@ -992,10 +992,10 @@ export function Realtime({
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
},
{
title: '里程核对',
title: '统计查询',
value: selectedMapRow?.totalMileageKm != null ? `${selectedMapRow.totalMileageKm} km` : '无里程',
detail: '进入单车里程统计,核对日里程和区间差值。',
action: '查看里程',
detail: '进入单车统计查询,核对日里程和区间差值。',
action: '统计查询',
color: selectedMapRow?.totalMileageKm != null ? 'blue' as const : 'orange' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => {
@@ -1138,7 +1138,7 @@ export function Realtime({
{
label: '选车复盘',
value: selectedVehicleLabel,
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label}${dataFreshness(selectedMapRow).detail}` : '从地图或车辆列表选择一辆车后进入轨迹、里程和历史查询。',
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label}${dataFreshness(selectedMapRow).detail}` : '从地图或车辆列表选择一辆车后进入轨迹、统计查询和历史查询。',
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const,
action: '轨迹回放',
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
@@ -1237,7 +1237,7 @@ export function Realtime({
step: '04',
title: '单车复盘',
value: selectedMapRow?.plate || selectedMapRow?.vin || '未选车',
detail: selectedMapRow ? '围绕选中车辆回放轨迹、核对里程和告警。' : '先在地图或表格中选择一辆可查询车辆。',
detail: selectedMapRow ? '围绕选中车辆回放轨迹、统计查询和告警。' : '先在地图或表格中选择一辆可查询车辆。',
action: '轨迹回放',
color: selectedMapRow ? 'blue' as const : 'grey' as const,
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol),
@@ -1270,7 +1270,7 @@ export function Realtime({
level: selectedMapRow ? '单车' : '选车',
title: selectedMapRow ? '复盘选中车辆' : '先选择一辆车',
value: selectedMapRow?.plate || selectedMapRow?.vin || '等待选车',
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label}${dataFreshness(selectedMapRow).detail}` : '从地图或实时列表选择车辆后,进入轨迹、里程、历史和告警。',
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label}${dataFreshness(selectedMapRow).detail}` : '从地图或实时列表选择车辆后,进入轨迹、统计查询、历史和告警。',
action: selectedMapRow ? '轨迹回放' : '查看车辆',
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'blue' as const,
disabled: selectedMapRow ? !canOpenVehicle(selectedMapRow.vin) : false,
@@ -1488,7 +1488,7 @@ export function Realtime({
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>{selectedVehicleLabel}</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-map-selected-service-actions">
@@ -1565,7 +1565,7 @@ export function Realtime({
</Space>
<Typography.Text strong>{selectedVehicleLabel}</Typography.Text>
<Typography.Text type="secondary">
线
线
</Typography.Text>
<Space wrap>
<Button size="small" theme="solid" type="primary" icon={<IconCopy />} onClick={copyMapCustomerPackage}></Button>

View File

@@ -9404,7 +9404,7 @@ test('shows realtime freshness status for recently updated and stale vehicles',
expect(screen.getByRole('button', { name: '地图监控任务 轨迹复盘 轨迹回放' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图监控任务 查询导出 导出当前页' })).toBeInTheDocument();
expect(screen.getByText('客户地图监控包')).toBeInTheDocument();
expect(screen.getByText('面向客户看图时,先确认车辆范围、在线态势、定位态势和选中车辆,再进入轨迹、里程、历史数据或告警通知。')).toBeInTheDocument();
expect(screen.getByText('面向客户看图时,先确认车辆范围、在线态势、定位态势和选中车辆,再进入轨迹、统计查询、历史数据或告警通知。')).toBeInTheDocument();
expect(screen.getByText('车辆范围')).toBeInTheDocument();
expect(screen.getByText('在线态势')).toBeInTheDocument();
expect(screen.getByText('定位态势')).toBeInTheDocument();
@@ -9413,17 +9413,17 @@ test('shows realtime freshness status for recently updated and stale vehicles',
expect(screen.getAllByText('粤A新鲜1').length).toBeGreaterThanOrEqual(1);
expect(screen.getByRole('button', { name: '地图车辆作业 车辆服务 车辆档案' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图车辆作业 轨迹复盘 打开轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图车辆作业 里程核对 查看里程' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图车辆作业 统计查询 统计查询' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图车辆作业 告警处置 查看告警' })).toBeInTheDocument();
expect(screen.getAllByText('关注车辆').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('选中车辆').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('车辆列表')).toBeInTheDocument();
expect(screen.getAllByText('1 辆更新超时').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('选中车辆服务')).toBeInTheDocument();
expect(screen.getByText('客户在地图上选中车辆后,直接进入车辆档案、轨迹回放、里程核对、数据导出和告警处置。')).toBeInTheDocument();
expect(screen.getByText('客户在地图上选中车辆后,直接进入车辆档案、轨迹回放、统计查询、数据导出和告警处置。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图选中车辆 车辆服务 车辆档案' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图选中车辆 轨迹复盘 打开轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图选中车辆 里程核对 查看里程' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图选中车辆 统计查询 统计查询' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图选中车辆 数据导出 历史导出' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /复制地图监控包/ }));
await waitFor(() => {
@@ -9711,7 +9711,7 @@ test('copies realtime operations summary from realtime page', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆覆盖GB32960在线 1/1实时 1/1JT808在线 1/2实时 2/2YUTONG_MQTT在线 0/1实时 1/1'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('实时入口http://localhost:3000/#/realtime?protocol=JT808&online=online'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务http://localhost:3000/#/detail?keyword=VIN-RT-SUMMARY-003&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('里程统计http://localhost:3000/#/mileage?keyword=VIN-RT-SUMMARY-003&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计查询http://localhost:3000/#/mileage?keyword=VIN-RT-SUMMARY-003&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史查询http://localhost:3000/api/history/raw-frames?protocol=JT808&vin=VIN-RT-SUMMARY-003&limit=20&includeFields=true'));
fireEvent.click(screen.getByRole('button', { name: '实时筛选 需要关注 2' }));
expect(window.location.hash).toBe('#/realtime?protocol=JT808&serviceStatus=degraded&online=online');