feat(platform): open quality governance from vehicle detail
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user