feat(platform): open quality governance from vehicle detail

This commit is contained in:
lingniu
2026-07-04 08:07:47 +08:00
parent 5fa7858662
commit 7a3f007340
3 changed files with 98 additions and 3 deletions

View File

@@ -73,6 +73,7 @@ export function VehicleDetail({
onOpenRaw,
onOpenMileage,
onOpenVehicles,
onOpenQuality,
onQueryChange
}: {
vin: string;
@@ -82,6 +83,7 @@ export function VehicleDetail({
onOpenRaw: (vin: string, protocol?: string) => void;
onOpenMileage: (vin: string, protocol?: string) => void;
onOpenVehicles?: (filters?: Record<string, string>) => void;
onOpenQuality?: (filters?: Record<string, string>) => void;
onQueryChange?: (keyword: string, protocol?: string) => void;
}) {
const [query, setQuery] = useState<VehicleQuery>({ keyword: vin, protocol });
@@ -193,6 +195,25 @@ export function VehicleDetail({
onQueryChange?.(nextQuery.keyword, nextQuery.protocol);
load(nextQuery);
};
const qualityFiltersForCurrentVehicle = () => ({
keyword: resolvedVIN,
...(activeProtocol ? { protocol: activeProtocol } : {})
});
const qualityIssueAction = (count: number) => {
if (count <= 0) {
return <Tag color="green"></Tag>;
}
return (
<Button
size="small"
theme="light"
type="warning"
onClick={() => onOpenQuality?.(qualityFiltersForCurrentVehicle())}
>
{count}
</Button>
);
};
const qualityTable = (
<Table
loading={loading}
@@ -267,7 +288,7 @@ export function VehicleDetail({
{ key: '最后上报', value: overview.lastSeen || '-' },
{ key: '数据规模', value: `历史 ${overview.historyCount} / RAW ${overview.rawCount} / 里程 ${overview.mileageCount}` },
{ key: '实时来源', value: overview.realtimeCount },
{ key: '质量问题', value: <Tag color={overview.qualityIssueCount > 0 ? 'orange' : 'green'}>{overview.qualityIssueCount}</Tag> }
{ key: '质量问题', value: qualityIssueAction(overview.qualityIssueCount) }
]}
/>
</Card>