feat(platform): add fleet command center

This commit is contained in:
lingniu
2026-07-05 21:34:45 +08:00
parent b892ffce81
commit a26fd71bfa
3 changed files with 183 additions and 0 deletions

View File

@@ -960,6 +960,57 @@ export function Vehicles({
onClick: () => onOpenQuality?.(serviceScopeFilters)
}
];
const totalVehicleCount = summary?.totalVehicles ?? pagination.total;
const onlineRate = totalVehicleCount > 0 ? `${(((summary?.onlineVehicles ?? 0) / totalVehicleCount) * 100).toFixed(1)}%` : '-';
const currentPageServiceableCount = rows.filter((row) => row.bindingStatus === 'bound' && row.sourceCount > 0).length;
const pendingVehicleCount = (summary?.noDataVehicles ?? 0) + (summary?.unboundVehicles ?? 0);
const fleetCommandItems = [
{
label: '在线率',
value: onlineRate,
detail: `${(summary?.onlineVehicles ?? 0).toLocaleString()} / ${totalVehicleCount.toLocaleString()} 辆在线,先进入地图看车辆分布。`,
action: '车辆地图',
color: (summary?.onlineVehicles ?? 0) > 0 ? 'green' as const : 'orange' as const,
disabled: !onOpenMap,
onClick: () => onOpenMap?.({ ...serviceScopeFilters, online: 'online' })
},
{
label: '可服务车辆',
value: `${currentPageServiceableCount.toLocaleString()}`,
detail: '当前页可归并到车辆服务的车辆,可直接查看实时状态和来源证据。',
action: '实时监控',
color: currentPageServiceableCount > 0 ? 'blue' as const : 'orange' as const,
disabled: !onOpenRealtime,
onClick: () => onOpenRealtime?.({ ...serviceScopeFilters, online: 'online' })
},
{
label: '待处理车辆',
value: `${pendingVehicleCount.toLocaleString()}`,
detail: '无来源或未绑定车辆优先进入告警闭环,避免客户查不到车。',
action: '告警通知',
color: pendingVehicleCount > 0 ? 'orange' as const : 'green' as const,
disabled: !onOpenQuality,
onClick: () => onOpenQuality?.(serviceScopeFilters)
},
{
label: '当前交付',
value: `${rows.length.toLocaleString()}`,
detail: '把当前筛选结果导出为车辆清单,再按时间窗交付轨迹和历史证据。',
action: '数据导出',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: exportVehicles
},
{
label: '轨迹复盘',
value: filters.keyword?.trim() ? '单车可回放' : '先选车辆',
detail: filters.keyword?.trim() ? '当前已进入单车范围,可直接复盘历史轨迹。' : '先锁定 VIN、车牌或手机号再进入轨迹回放。',
action: '轨迹回放',
color: filters.keyword?.trim() ? 'green' as const : 'grey' as const,
disabled: !onOpenHistory || !filters.keyword?.trim(),
onClick: () => onOpenHistory?.({ ...serviceScopeFilters, tab: 'location' })
}
];
useEffect(() => {
setFilters(initialFilters);
@@ -1068,6 +1119,36 @@ export function Vehicles({
return (
<div className="vp-page">
<PageHeader title="车辆服务" description="围绕车辆完成实时监控、地图查看、轨迹回放、统计查询和数据导出,协议来源只作为证据过滤条件" />
<section className="vp-fleet-command-center" aria-label="客户车队指挥台">
<div className="vp-fleet-command-copy">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={filters.keyword?.trim() ? 'green' : 'grey'}>{filters.keyword?.trim() ? '单车服务' : '车辆池'}</Tag>
<Tag color={pendingVehicleCount > 0 ? 'orange' : 'green'}>{pendingVehicleCount.toLocaleString()} </Tag>
</Space>
<strong>线</strong>
<span>
</span>
</div>
<div className="vp-fleet-command-grid">
{fleetCommandItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-fleet-command-item"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`客户车队指挥台 ${item.label} ${item.value} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
<em>{item.action}</em>
</button>
))}
</div>
</section>
<section className="vp-customer-vehicle-service-hub" aria-label="客户车辆服务台">
<div className="vp-customer-vehicle-service-summary">
<Space wrap>