feat(platform): link quality issues to vehicle service
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user