feat(platform): add history customer question flow

This commit is contained in:
lingniu
2026-07-05 16:00:29 +08:00
parent 12aef4461a
commit 0f6b47e97e
3 changed files with 150 additions and 0 deletions

View File

@@ -1044,6 +1044,44 @@ export function History({
onClick: () => copyScheduledHistoryReportPlan()
}
];
const customerHistoryQuestions = [
{
question: '这辆车这段时间在哪里?',
answer: validLocations.length > 0 ? `${validLocations.length.toLocaleString()} 个有效轨迹点` : '先查询位置历史',
evidence: `${filters.dateFrom || '-'}${filters.dateTo || '-'}`,
action: '轨迹回放',
color: validLocations.length > 0 ? 'green' as const : 'orange' as const,
disabled: false,
onClick: () => openQueryTab('location')
},
{
question: '这段时间跑了多少公里?',
answer: formatNumber(mileageDelta, ' km'),
evidence: `最高速度 ${formatNumber(maxSpeed, ' km/h')}`,
action: '统计查询',
color: isFiniteNumber(mileageDelta) ? 'green' as const : 'grey' as const,
disabled: !onOpenMileage,
onClick: () => onOpenMileage?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, ...(filters.dateFrom ? { dateFrom: filters.dateFrom } : {}), ...(filters.dateTo ? { dateTo: filters.dateTo } : {}) })
},
{
question: '为什么定位或里程不连续?',
answer: anomalyTotal > 0 ? `${anomalyTotal.toLocaleString()} 项需复核` : '当前页无明显异常',
evidence: `断点 ${trajectoryAnomalies.gapCount.toLocaleString()} / 里程回退 ${trajectoryAnomalies.mileageRollbackCount.toLocaleString()} / 超速 ${trajectoryAnomalies.overspeedCount.toLocaleString()}`,
action: '复核证据',
color: anomalyTotal > 0 ? 'orange' as const : 'green' as const,
disabled: false,
onClick: () => copyTrajectoryDecision()
},
{
question: '明细能导出给客户吗?',
answer: deliveryState,
evidence: `位置 ${locations.total.toLocaleString()} / 明细 ${(rawFrames.total ?? 0).toLocaleString()} / 字段 ${rawFieldRows.length.toLocaleString()}`,
action: '导出交付包',
color: deliveryStateColor,
disabled: false,
onClick: () => copyDeliveryPackage()
}
];
const clearRangeFilters = () => {
applyFilters(currentVehicleKeyword ? { keyword: currentVehicleKeyword } : {});
};
@@ -1456,6 +1494,40 @@ export function History({
</div>
</Card>
) : null}
{mode === 'query' ? (
<Card bordered title="客户历史问题" style={{ marginTop: 16 }}>
<div className="vp-history-question-board">
<div className="vp-history-question-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={deliveryStateColor}>{deliveryState}</Tag>
<Tag color={currentVehicleKeyword ? 'green' : 'orange'}>{currentVehicleKeyword ? '单车范围' : '全部车辆'}</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>线</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-history-question-grid">
{customerHistoryQuestions.map((item) => (
<button
key={item.question}
type="button"
className="vp-history-question-item"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`客户历史问题 ${item.question} ${item.action}`}
>
<Tag color={item.color}>{item.question}</Tag>
<strong>{item.answer}</strong>
<span>{item.evidence}</span>
<em>{item.action}</em>
</button>
))}
</div>
</div>
</Card>
) : null}
<Card bordered className="vp-trip-workbench" bodyStyle={{ padding: 0 }}>
<div className="vp-trip-workbench-map">
<div className="vp-trip-workbench-copy">