feat(platform): sharpen customer vehicle cockpit

This commit is contained in:
lingniu
2026-07-05 13:20:55 +08:00
parent c0cc7fc54f
commit 9a16daae00
3 changed files with 327 additions and 3 deletions

View File

@@ -1319,11 +1319,146 @@ export function Dashboard({
];
copyText(lines.join('\n'), '客户服务说明');
};
const customerCockpitMetrics = [
{
label: '车辆总数',
value: formatCount(serviceSummary?.totalVehicles),
detail: '以 VIN 聚合车牌、手机号、OEM 和来源证据',
color: 'blue' as const,
onClick: () => onOpenVehicles({})
},
{
label: '在线车辆',
value: formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles),
detail: vehicleServiceOnlineText(serviceSummary, summary),
color: 'green' as const,
onClick: () => onOpenMap({ online: 'online' })
},
{
label: '有效定位',
value: commandLocatedCount.toLocaleString(),
detail: '用于实时地图、轨迹回放和客户位置问询',
color: commandLocatedCount > 0 ? 'green' as const : 'orange' as const,
onClick: () => onOpenRealtime({ online: 'online' })
},
{
label: '告警车辆',
value: formatCount(summary?.issueVehicles),
detail: highPriorityIssue ? `${qualityIssueLabel(highPriorityIssue.issueType)} / ${priorityIssueVehicleLabel(highPriorityIssue)}` : '暂无高优先级告警',
color: (summary?.issueVehicles ?? 0) > 0 ? 'orange' as const : 'green' as const,
onClick: () => onOpenQuality()
}
];
const customerCockpitWorkflows = [
{
title: '实时看车',
description: '打开地图确认车辆在哪里、是否在线、最后上报是否新鲜。',
action: '实时地图',
evidence: `${commandLocatedCount.toLocaleString()} 辆有定位`,
onClick: () => onOpenMap({ online: 'online' })
},
{
title: '轨迹复盘',
description: '用同一辆车和同一时间窗回放位置、速度、里程断点。',
action: '轨迹回放',
evidence: `${formatCount(summary?.activeToday)} 今日活跃`,
onClick: openTimeMonitorHistory
},
{
title: '里程核对',
description: '按车辆口径核对区间里程、日统计和异常来源。',
action: '里程统计',
evidence: `${formatCount(serviceSummary?.totalVehicles)} 辆可统计`,
onClick: openTimeMonitorMileage
},
{
title: '数据交付',
description: '按车辆、时间和字段导出位置历史、原始记录和解析字段。',
action: '历史导出',
evidence: `${formatCount(summary?.frameToday)} 今日数据`,
onClick: openTimeMonitorRaw
},
{
title: '告警通知',
description: '将断链、离线、定位异常和字段缺失变成可通知事件。',
action: '告警事件',
evidence: `${formatCount(summary?.issueVehicles)} 告警车辆`,
onClick: () => onOpenQuality()
}
];
const customerTrustSignals = [
{
label: '数据来源',
value: `${formatCount(serviceSummary?.multiSourceVehicles)} 多源 / ${formatCount(serviceSummary?.singleSourceVehicles)} 单源`,
detail: '来源只作为可信度证据,不作为客户主导航。'
},
{
label: '地图能力',
value: amapConfigured ? '高德地图可用' : '坐标预览',
detail: amapConfigured ? '支持实时看车和轨迹底图。' : '地图配置缺失时仍可查看坐标证据。'
},
{
label: '时间窗',
value: dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo),
detail: '同一时间范围贯穿轨迹、里程、历史和告警。'
}
];
return (
<div className="vp-page">
<PageHeader title="车辆服务工作台" description="面向客户的车辆地图、实时监控、轨迹回放、里程统计、自定义时间监控、历史查询、告警通知和数据导出" />
<Spin spinning={loading}>
<Card bordered className="vp-customer-cockpit" bodyStyle={{ padding: 0 }}>
<div className="vp-customer-cockpit-main">
<div className="vp-customer-cockpit-copy">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color="green"></Tag>
<Tag color={(summary?.issueVehicles ?? 0) > 0 ? 'orange' : 'green'}>{formatCount(summary?.issueVehicles)} </Tag>
</Space>
<Typography.Title heading={3} style={{ margin: 0 }}></Typography.Title>
<Typography.Text type="secondary">
32960808 MQTT 线
</Typography.Text>
<Space wrap>
<Button theme="solid" type="primary" onClick={() => onOpenMap({ online: 'online' })}></Button>
<Button theme="light" type="primary" onClick={openTimeMonitorHistory}></Button>
<Button theme="light" type="primary" onClick={openTimeMonitorRaw}></Button>
<Button theme="light" onClick={copyCustomerServiceGuide}></Button>
</Space>
</div>
<div className="vp-customer-cockpit-metrics">
{customerCockpitMetrics.map((item) => (
<button key={item.label} type="button" className="vp-customer-cockpit-metric" onClick={item.onClick} aria-label={`客户车辆监控 ${item.label} ${item.value}`}>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
</button>
))}
</div>
</div>
<div className="vp-customer-cockpit-rail">
<div className="vp-customer-cockpit-workflows">
{customerCockpitWorkflows.map((item) => (
<button key={item.title} type="button" className="vp-customer-cockpit-workflow" onClick={item.onClick} aria-label={`客户车辆工作流 ${item.title} ${item.action}`}>
<span>{item.title}</span>
<strong>{item.action}</strong>
<small>{item.description}</small>
<em>{item.evidence}</em>
</button>
))}
</div>
<div className="vp-customer-cockpit-trust">
{customerTrustSignals.map((item) => (
<div key={item.label} className="vp-customer-cockpit-trust-item">
<span>{item.label}</span>
<strong>{item.value}</strong>
<small>{item.detail}</small>
</div>
))}
</div>
</div>
</Card>
<Card bordered className="vp-customer-hero" bodyStyle={{ padding: 0 }}>
<div className="vp-customer-hero-map">
<div className="vp-customer-hero-copy">