feat(platform): add realtime service overview
This commit is contained in:
@@ -1701,6 +1701,71 @@ export function Realtime({
|
||||
});
|
||||
return protocols.length > 0 ? protocols.join(' / ') : '暂无来源证据';
|
||||
})();
|
||||
const realtimeServiceOverviewItems = [
|
||||
{
|
||||
label: '在线车辆',
|
||||
value: `${onlineCount.toLocaleString()} 在线`,
|
||||
detail: `${(rows.length - onlineCount).toLocaleString()} 辆离线,在线率 ${formatPercent(onlineRate)}`,
|
||||
color: onlineCount > 0 ? 'green' as const : 'orange' as const,
|
||||
onClick: () => applyFilters({ ...filters, online: 'online' })
|
||||
},
|
||||
{
|
||||
label: '有效定位',
|
||||
value: `${locatedCount.toLocaleString()} 辆`,
|
||||
detail: `${missingCoordinateCount.toLocaleString()} 辆无坐标,定位率 ${formatPercent(locatedRate)}`,
|
||||
color: locatedCount > 0 ? 'blue' as const : 'orange' as const,
|
||||
onClick: () => {
|
||||
window.location.hash = buildAppHash({ page: 'map', protocol: filters.protocol, filters });
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '需关注',
|
||||
value: `${mapAttentionRows.length.toLocaleString()} 辆`,
|
||||
detail: mapAttentionRows[0] ? `${mapAttentionRows[0].plate || mapAttentionRows[0].vin}:${realtimeIssueLabels(mapAttentionRows[0]).join(';')}` : '当前没有离线、超时或定位异常车辆',
|
||||
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
|
||||
onClick: () => applyFilters({ ...filters, serviceStatus: 'degraded' })
|
||||
},
|
||||
{
|
||||
label: '地图能力',
|
||||
displayLabel: '高德能力',
|
||||
value: amapConfigured ? '高德可用' : '坐标预览',
|
||||
detail: amapConfigured ? '高德 Web JS 与安全代理就绪' : '地图降级为坐标预览',
|
||||
color: amapConfigured ? 'green' as const : 'orange' as const,
|
||||
onClick: () => load(filters, pagination.currentPage, pagination.pageSize)
|
||||
}
|
||||
];
|
||||
const realtimeServiceActions = [
|
||||
{
|
||||
label: '打开地图',
|
||||
action: '地图态势',
|
||||
color: 'blue' as const,
|
||||
disabled: false,
|
||||
onClick: () => {
|
||||
window.location.hash = buildAppHash({ page: 'map', protocol: filters.protocol, filters });
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '轨迹复盘',
|
||||
action: '轨迹回放',
|
||||
color: selectedMapRow ? 'blue' as const : 'grey' as const,
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
|
||||
},
|
||||
{
|
||||
label: '导出清单',
|
||||
action: '导出CSV',
|
||||
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
|
||||
disabled: rows.length === 0,
|
||||
onClick: exportRealtime
|
||||
},
|
||||
{
|
||||
label: '告警通知',
|
||||
action: '关注车辆',
|
||||
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
|
||||
disabled: !onOpenQuality,
|
||||
onClick: () => onOpenQuality?.({ serviceStatus: 'degraded' })
|
||||
}
|
||||
];
|
||||
const realtimeCustomerCommandItems = [
|
||||
{
|
||||
label: '实时地图',
|
||||
@@ -2628,6 +2693,51 @@ export function Realtime({
|
||||
return (
|
||||
<div className="vp-page">
|
||||
<PageHeader title={title} description={description} />
|
||||
<section className="vp-realtime-service-overview" aria-label="实时车辆服务总览">
|
||||
<div className="vp-realtime-service-overview-copy">
|
||||
<Space wrap>
|
||||
<Tag color="blue">实时车辆服务总览</Tag>
|
||||
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '高德可用' : '坐标预览'}</Tag>
|
||||
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>{mapAttentionRows.length.toLocaleString()} 辆需关注</Tag>
|
||||
</Space>
|
||||
<Typography.Title heading={5} style={{ margin: 0 }}>
|
||||
客户先看车辆是否在线、地图是否可见、哪些车辆需要处置,再进入轨迹、统计、导出和告警。
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
当前范围:{filterSummary.length > 0 ? filterSummary.join(' / ') : '全部车辆'},来源证据:{realtimeSourceEvidenceText}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div className="vp-realtime-service-overview-metrics">
|
||||
{realtimeServiceOverviewItems.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
className="vp-realtime-service-overview-metric"
|
||||
onClick={item.onClick}
|
||||
aria-label={`实时车辆服务总览 ${item.label} ${item.value}`}
|
||||
>
|
||||
<Tag color={item.color}>{item.displayLabel ?? item.label}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
<span>{item.detail}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="vp-realtime-service-overview-actions">
|
||||
{realtimeServiceActions.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
className="vp-realtime-service-overview-action"
|
||||
disabled={item.disabled}
|
||||
onClick={item.onClick}
|
||||
aria-label={`实时服务动作 ${item.label} ${item.action}`}
|
||||
>
|
||||
<Tag color={item.color}>{item.label}</Tag>
|
||||
<span>{item.action}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="vp-realtime-command-center" aria-label="客户实时监控总控台">
|
||||
<div className="vp-realtime-command-center-copy">
|
||||
<Space wrap>
|
||||
|
||||
Reference in New Issue
Block a user