feat(platform): add vehicle detail customer questions

This commit is contained in:
lingniu
2026-07-05 15:54:32 +08:00
parent 50f277738b
commit 12aef4461a
3 changed files with 124 additions and 0 deletions

View File

@@ -947,6 +947,56 @@ export function VehicleDetail({
onClick: () => onOpenQuality?.(qualityFiltersForCurrentVehicle())
}
];
const customerQuestionActions = [
{
question: '这辆车现在在哪里?',
answer: formatLocation(latest),
action: '实时监控',
color: online ? 'green' as const : 'orange' as const,
disabled: !hasResolvedVIN,
onClick: () => onOpenRealtime(resolvedVIN, activeProtocol)
},
{
question: '最近是否还在线?',
answer: lastSeen === '-' ? '暂无最后上报' : `最后上报 ${lastSeen}`,
action: '查看实时',
color: online ? 'green' as const : 'orange' as const,
disabled: !hasResolvedVIN,
onClick: () => onOpenRealtime(resolvedVIN, activeProtocol)
},
{
question: '能不能回放轨迹?',
answer: `${formatCompactNumber(overview?.historyCount ?? detail?.history?.total ?? 0)} 条轨迹证据`,
action: '轨迹回放',
color: evidenceLocatedSourceCount > 0 ? 'blue' as const : 'grey' as const,
disabled: !hasResolvedVIN,
onClick: () => onOpenHistory(resolvedVIN, activeProtocol)
},
{
question: '这辆车跑了多少?',
answer: `${formatCompactNumber(latest?.totalMileageKm, ' km')} / ${formatCompactNumber(overview?.mileageCount ?? detail?.mileage?.total ?? 0)} 条统计`,
action: '统计查询',
color: isFiniteNumber(latest?.totalMileageKm) ? 'green' as const : 'orange' as const,
disabled: !hasResolvedVIN,
onClick: () => onOpenMileage(resolvedVIN, activeProtocol)
},
{
question: '数据能导出吗?',
answer: `${formatCompactNumber(overview?.rawCount ?? detail?.raw?.total ?? 0)} 条历史数据`,
action: '历史导出',
color: (overview?.rawCount ?? detail?.raw?.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
disabled: !hasResolvedVIN,
onClick: () => onOpenRaw(resolvedVIN, activeProtocol)
},
{
question: '是否需要通知处理?',
answer: priorityQualityIssue ? `${qualityIssueLabel(priorityQualityIssue.issueType)} / ${priorityQualityIssue.lastSeen || '-'}` : '暂无待通知告警',
action: '告警通知',
color: qualityCount > 0 ? 'orange' as const : 'green' as const,
disabled: !onOpenQuality || (!hasResolvedVIN && qualityCount <= 0),
onClick: () => onOpenQuality?.(qualityFiltersForCurrentVehicle())
}
];
const copyCustomerServicePackage = () => {
if (!detail) {
Toast.warning('当前没有可复制的客户服务交付包');
@@ -1138,6 +1188,25 @@ export function VehicleDetail({
</div>
</Card>
<Card bordered title="客户常问" style={{ marginTop: 16 }}>
<div className="vp-vehicle-question-grid">
{customerQuestionActions.map((item) => (
<button
key={item.question}
type="button"
className="vp-vehicle-question-item"
disabled={item.disabled}
aria-label={`单车客户常问 ${item.question} ${item.action}`}
onClick={item.onClick}
>
<strong>{item.question}</strong>
<span>{item.answer}</span>
<Tag color={item.color}>{item.action}</Tag>
</button>
))}
</div>
</Card>
<Card
bordered
title={<Space><span></span><Button size="small" disabled={!detail} icon={<IconCopy />} onClick={copyUnifiedVehicleService}></Button></Space>}