Files
Migu2.0/frontends/apps/simple-platform-vue/src/api/vehicleOps.ts
T
zhaowei.huangandCursor 62943e6c42 feat(vehicle-hub): 新增车辆运维页(健康监控 / 维护操作 / 批量管理)
- 新增 fleetHealth / vehicleOps API、useVehicleHub 组合式与 VehicleHealthCard 卡片
- 新增 /admin/config/vehicle-hub 与 /monitor/vehicle-hub 双端路由及侧栏菜单
- car 类型补充 rawId/onboardUrl/lstatus 及 FleetHealthRow/VehicleCardModel
- 后端 PageCatalog 注册「车辆运维」页,原「车辆维护」更名为「车辆维护策略」

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 00:16:16 +08:00

31 lines
783 B
TypeScript

import { reflectionApi } from './reflection'
export type VehicleMaintenanceMode = 'online' | 'offline' | 'repair' | 'blown'
const METHOD_MAP: Record<VehicleMaintenanceMode, string> = {
online: 'OnlineCar',
offline: 'OfflineCar',
repair: 'Repair',
blown: 'Blown'
}
export async function setVehicleMaintenance(
carId: number,
mode: VehicleMaintenanceMode
): Promise<boolean> {
const method = METHOD_MAP[mode]
if (!method) return false
try {
await reflectionApi.execute('car', carId, method)
return true
} catch {
return false
}
}
export function openOnboardWeb(url?: string | null, ip?: string | null): void {
const target = url ?? (ip ? `http://${ip}:8081` : null)
if (!target) return
window.open(target, '_blank', 'noopener,noreferrer')
}