feat(platform): link quality issues to vehicle service

This commit is contained in:
lingniu
2026-07-03 23:39:35 +08:00
parent 532b0d9aec
commit fd60d2644e
2 changed files with 15 additions and 3 deletions

View File

@@ -71,7 +71,7 @@ export default function App() {
detail: <VehicleDetail vin={activeVin} onOpenHistory={openHistoryForVehicle} onOpenMileage={openMileageForVehicle} />,
history: <History initialVin={analysisVin} onOpenVehicle={openVehicle} />,
mileage: <Mileage initialVin={analysisVin} onOpenVehicle={openVehicle} />,
quality: <Quality onHealthLoaded={(health) => setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length)} />
quality: <Quality onOpenVehicle={openVehicle} onHealthLoaded={(health) => setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length)} />
};
return (

View File

@@ -49,7 +49,18 @@ async function copyText(value: string, label: string) {
}
}
export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealth) => void }) {
function canOpenVehicle(vin?: string) {
const value = vin?.trim();
return Boolean(value && value !== 'unknown');
}
export function Quality({
onOpenVehicle,
onHealthLoaded
}: {
onOpenVehicle: (vin: string) => void;
onHealthLoaded?: (health: OpsHealth) => void;
}) {
const [issues, setIssues] = useState<QualityIssueRow[]>([]);
const [summary, setSummary] = useState<QualitySummary>(emptySummary);
const [health, setHealth] = useState<OpsHealth | null>(null);
@@ -170,11 +181,12 @@ export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealt
{ title: '说明', dataIndex: 'detail' },
{
title: '操作',
width: 140,
width: 250,
render: (_: unknown, row: QualityIssueRow) => (
<Space spacing={4}>
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.phone, '手机号')}></Button>
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.sourceEndpoint, '来源')}></Button>
<Button size="small" disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}></Button>
</Space>
)
}