feat(platform): add vehicle service runbook
This commit is contained in:
@@ -535,6 +535,74 @@ export function VehicleDetail({
|
||||
]
|
||||
}
|
||||
];
|
||||
const serviceRunbookSteps = [
|
||||
{
|
||||
title: '确认实时状态',
|
||||
evidence: evidenceSourceCount > 0 ? `${evidenceOnlineSourceCount}/${evidenceSourceCount} 来源在线,最后上报 ${lastSeen}` : '暂无来源在线证据',
|
||||
acceptance: '车辆在线状态、最新时间、有效坐标均可解释。',
|
||||
action: '打开实时',
|
||||
disabled: !hasResolvedVIN,
|
||||
onClick: () => onOpenRealtime(resolvedVIN, activeProtocol)
|
||||
},
|
||||
{
|
||||
title: '回放轨迹断点',
|
||||
evidence: evidenceLocatedSourceCount > 0 ? `${evidenceLocatedSourceCount} 个来源有位置,时间差 ${formatSeconds(evidenceTimeDeltaSeconds)}` : '暂无可回放位置',
|
||||
acceptance: '轨迹点、速度和总里程变化连续,异常点可定位到时间段。',
|
||||
action: '轨迹回放',
|
||||
disabled: !hasResolvedVIN,
|
||||
onClick: () => onOpenHistory(resolvedVIN, activeProtocol)
|
||||
},
|
||||
{
|
||||
title: '核对 RAW 字段',
|
||||
evidence: `${formatCompactNumber(overview?.rawCount ?? detail?.raw?.total ?? 0)} 帧,最新类型 ${latestRaw?.frameType || '-'}`,
|
||||
acceptance: '关键字段来自解析字段而不是页面二次推断。',
|
||||
action: 'RAW 证据',
|
||||
disabled: !hasResolvedVIN,
|
||||
onClick: () => onOpenRaw(resolvedVIN, activeProtocol)
|
||||
},
|
||||
{
|
||||
title: '处理告警闭环',
|
||||
evidence: priorityQualityIssue ? `${qualityIssueLabel(priorityQualityIssue.issueType)} / ${priorityQualityIssue.lastSeen || '-'}` : '暂无质量告警',
|
||||
acceptance: '断链、VIN 缺失、字段缺失等问题进入告警队列并有处置结论。',
|
||||
action: '告警队列',
|
||||
disabled: !onOpenQuality || (!hasResolvedVIN && qualityCount <= 0),
|
||||
onClick: () => onOpenQuality?.(qualityFiltersForCurrentVehicle())
|
||||
},
|
||||
{
|
||||
title: '复核统计口径',
|
||||
evidence: `${formatCompactNumber(overview?.mileageCount ?? detail?.mileage?.total ?? 0)} 条统计,来源里程差 ${formatCompactNumber(evidenceMileageDelta, ' km')}`,
|
||||
acceptance: '区间里程、每日里程和轨迹总里程证据可以互相解释。',
|
||||
action: '里程统计',
|
||||
disabled: !hasResolvedVIN,
|
||||
onClick: () => onOpenMileage(resolvedVIN, activeProtocol)
|
||||
}
|
||||
];
|
||||
const copyVehicleRunbook = () => {
|
||||
if (!detail) {
|
||||
Toast.warning('当前没有可复制的单车Runbook');
|
||||
return;
|
||||
}
|
||||
const vehicleName = [archivePlate, displayVIN].filter((item) => item && item !== '-').join(' / ') || displayLookupKey;
|
||||
const lines = [
|
||||
'【单车服务闭环Runbook】',
|
||||
`车辆:${vehicleName}`,
|
||||
`当前范围:${scopeText}`,
|
||||
`服务状态:${serviceStatus?.title ?? serviceConclusion.status}`,
|
||||
`一致性:${consistencyTitle}`,
|
||||
...serviceRunbookSteps.map((item, index) => [
|
||||
`${index + 1}. ${item.title}`,
|
||||
` 证据:${item.evidence}`,
|
||||
` 验收:${item.acceptance}`
|
||||
].join('\n')),
|
||||
`实时监控:${vehicleServiceURL(vehicleServiceHash('realtime'))}`,
|
||||
`轨迹回放:${vehicleServiceURL(vehicleServiceHash('history'))}`,
|
||||
`RAW证据:${vehicleServiceURL(vehicleServiceHash('history-query', { tab: 'raw', includeFields: 'true' }))}`,
|
||||
`告警事件:${vehicleServiceURL(buildAppHash({ page: 'alert-events', keyword: resolvedVIN, protocol: activeProtocol }))}`,
|
||||
`统计查询:${vehicleServiceURL(vehicleServiceHash('mileage'))}`,
|
||||
`车辆服务:${vehicleServiceURL(vehicleServiceHash('detail'))}`
|
||||
];
|
||||
copyText(lines.join('\n'), '单车Runbook');
|
||||
};
|
||||
const qualityTable = (
|
||||
<Table
|
||||
loading={loading}
|
||||
@@ -700,6 +768,35 @@ export function VehicleDetail({
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
bordered
|
||||
title={<Space><span>单车服务闭环Runbook</span><Button size="small" onClick={copyVehicleRunbook}>复制Runbook</Button></Space>}
|
||||
style={{ marginTop: 16 }}
|
||||
>
|
||||
<div className="vp-runbook-grid">
|
||||
{serviceRunbookSteps.map((item, index) => (
|
||||
<div key={item.title} className="vp-runbook-step">
|
||||
<div className="vp-runbook-index">{index + 1}</div>
|
||||
<div className="vp-runbook-body">
|
||||
<Typography.Title heading={6} style={{ margin: 0 }}>{item.title}</Typography.Title>
|
||||
<Typography.Text type="secondary">{item.evidence}</Typography.Text>
|
||||
<div className="vp-runbook-acceptance">{item.acceptance}</div>
|
||||
<Button
|
||||
size="small"
|
||||
theme="light"
|
||||
type="primary"
|
||||
disabled={item.disabled}
|
||||
aria-label={`单车Runbook ${item.title} ${item.action}`}
|
||||
onClick={item.onClick}
|
||||
>
|
||||
{item.action}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{overview || consistency ? (
|
||||
<Card bordered title="车辆服务证据链" style={{ marginTop: 16 }}>
|
||||
<div className="vp-evidence-grid">
|
||||
|
||||
Reference in New Issue
Block a user