feat(platform): link quality issues to mileage evidence

This commit is contained in:
lingniu
2026-07-04 11:57:55 +08:00
parent f305066eff
commit fb6d8c323a
3 changed files with 125 additions and 1 deletions

View File

@@ -264,12 +264,14 @@ async function copyQualityShareURL() {
export function Quality({
onOpenVehicle,
onOpenHistory,
onOpenMileage,
onHealthLoaded,
onFiltersChange,
initialFilters = {}
}: {
onOpenVehicle: (vin: string, protocol?: string) => void;
onOpenHistory?: (filters: Record<string, string>) => void;
onOpenMileage?: (filters: Record<string, string>) => void;
onHealthLoaded?: (health: OpsHealth) => void;
onFiltersChange?: (filters: Record<string, string>) => void;
initialFilters?: Record<string, string>;
@@ -363,6 +365,17 @@ export function Quality({
...(dateTo ? { dateTo } : {})
});
};
const openIssueMileage = (row: QualityIssueRow) => {
const lookup = qualityIssueVehicleLookup(row);
const dateFrom = issueEvidenceDate(row.lastSeen);
const dateTo = nextDate(dateFrom);
onOpenMileage?.({
keyword: lookup.key,
protocol: row.protocol,
...(dateFrom ? { dateFrom } : {}),
...(dateTo ? { dateTo } : {})
});
};
return (
<div className="vp-page">
@@ -606,6 +619,7 @@ export function Quality({
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.phone, '手机号')}></Button>
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.sourceEndpoint, '来源')}></Button>
<Button size="small" disabled={!lookup.key || !onOpenHistory} onClick={() => openIssueHistory(row)}></Button>
<Button size="small" disabled={!lookup.key || !onOpenMileage} onClick={() => openIssueMileage(row)}></Button>
<Button size="small" disabled={!lookup.key} onClick={() => onOpenVehicle(lookup.key, row.protocol)}>
{lookup.label}
</Button>