feat(platform): add customer mileage query board

This commit is contained in:
lingniu
2026-07-05 04:46:46 +08:00
parent bb6f577141
commit b5f98bb6d8
3 changed files with 187 additions and 0 deletions

View File

@@ -843,6 +843,61 @@ export function Mileage({
action: () => onOpenVehicle(currentVehicleKeyword, currentProtocol)
}
];
const mileageCustomerQuerySteps = [
{
step: '01',
title: '选择范围',
value: currentVehicleKeyword || '全部车辆',
detail: `时间范围 ${mileageRangeText},来源 ${currentProtocol || '全部来源'}`,
action: '调整筛选',
color: currentVehicleKeyword ? 'green' as const : 'blue' as const,
disabled: false,
onClick: () => {
const input = document.querySelector<HTMLInputElement>('input[name="keyword"]');
input?.focus();
}
},
{
step: '02',
title: '区间里程',
value: `${formatKm(summary.totalMileageKm)} km`,
detail: `${summary.vehicleCount.toLocaleString()} 辆车,${summary.recordCount.toLocaleString()} 条日里程记录。`,
action: '复制摘要',
color: 'blue' as const,
disabled: false,
onClick: () => copyStatisticsSummary()
},
{
step: '03',
title: '发布判断',
value: publishAuditConclusion,
detail: `闭合 ${closureStatus},覆盖 ${formatPercent(pageCoverageRate)}`,
action: '发布审计',
color: publishAuditColor,
disabled: false,
onClick: () => copyPublishAudit()
},
{
step: '04',
title: '复核证据',
value: anomalyRows.length > 0 ? `${anomalyRows.length.toLocaleString()} 异常` : '轨迹/RAW',
detail: anomalyRows.length > 0 ? '异常日优先回看轨迹和原始记录。' : '可从同一时间窗进入轨迹和RAW证据。',
action: '轨迹复核',
color: anomalyRows.length > 0 ? 'orange' as const : 'green' as const,
disabled: !currentVehicleKeyword || !onOpenHistory,
onClick: () => onOpenHistory?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, dateFrom: filters.dateFrom ?? '', dateTo: filters.dateTo ?? '' })
},
{
step: '05',
title: '数据交付',
value: `${rows.length.toLocaleString()} 当前页`,
detail: '导出明细并附带统计口径支撑BI、客户复盘和运营日报。',
action: '导出明细',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: () => exportMileage()
}
];
const loadSummary = (values: Record<string, string> = filters) => {
setSummaryLoading(true);
@@ -1145,6 +1200,43 @@ export function Mileage({
<Tag color={currentProtocol ? 'blue' : 'green'}>{currentProtocol || '全部来源'}</Tag>
<Typography.Text type="tertiary"></Typography.Text>
</div>
<Card bordered className="vp-mileage-customer-query-board" bodyStyle={{ padding: 0 }}>
<div className="vp-mileage-customer-query-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={mileageDeliveryColor}>{mileageDeliveryState}</Tag>
<Tag color={closureStatusColor}>{closureStatus}</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}></Typography.Title>
<Typography.Text type="secondary">
RAW
</Typography.Text>
<Space wrap>
<Button size="small" theme="solid" type="primary" onClick={copyStatisticsSummary}></Button>
<Button size="small" theme="light" type="primary" onClick={copyMileageDecision}></Button>
<Button size="small" disabled={!currentVehicleKeyword || !onOpenHistory} onClick={() => onOpenHistory?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, dateFrom: filters.dateFrom ?? '', dateTo: filters.dateTo ?? '' })}></Button>
<Button size="small" disabled={rows.length === 0} onClick={exportMileage}></Button>
</Space>
</div>
<div className="vp-mileage-customer-query-steps">
{mileageCustomerQuerySteps.map((item) => (
<button
key={item.step}
type="button"
className="vp-mileage-customer-query-step"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`客户统计查询 ${item.title} ${item.action}`}
>
<span>{item.step}</span>
<Tag color={item.color}>{item.title}</Tag>
<strong>{item.value}</strong>
<small>{item.detail}</small>
<em>{item.action}</em>
</button>
))}
</div>
</Card>
<Card bordered title="车辆统计服务总览" style={{ marginTop: 16 }}>
<div className="vp-table-toolbar">
<Space wrap>