feat(platform): resolve vehicle identity before navigation

This commit is contained in:
lingniu
2026-07-04 01:06:24 +08:00
parent 3e76210d7d
commit 703a7b112f
9 changed files with 189 additions and 8 deletions

View File

@@ -37,13 +37,22 @@ export default function App() {
return () => window.clearInterval(timer);
}, [refreshOpsHealth]);
const openVehicle = (vin: string) => {
const nextVin = vin.trim();
if (!nextVin) {
const openVehicle = async (keyword: string) => {
const lookupKey = keyword.trim();
if (!lookupKey) {
return;
}
setActiveVin(nextVin);
setActivePage('detail');
try {
const resolved = await api.vehicleResolve(new URLSearchParams({ keyword: lookupKey }));
const nextKey = resolved.resolved && resolved.vin ? resolved.vin : lookupKey;
setActiveVin(nextKey);
setActivePage('detail');
if (!resolved.resolved) {
Toast.warning('未匹配到车辆身份,已打开问题排查视图');
}
} catch (error) {
Toast.error(error instanceof Error ? error.message : '车辆查询失败');
}
};
const openHistoryForVehicle = (vin: string) => {