|
|
|
@ -502,28 +502,16 @@ async function load() { |
|
|
|
return toExecutionRecord(r, taskNames.get(r.taskId), '', video ? { id: String(video.id), status: video.status } : null) |
|
|
|
}) |
|
|
|
|
|
|
|
routes.value = (routePage?.records || []).map((r, i) => { |
|
|
|
// 列表接口返回 waypointCount,不含 waypoints[];详情才有完整航点 |
|
|
|
const count = Number(r.waypointCount ?? r.waypoint_count) |
|
|
|
const fromList = Array.isArray(r.waypoints) ? r.waypoints.length : NaN |
|
|
|
const waypoints = Number.isFinite(fromList) |
|
|
|
? fromList |
|
|
|
: (Number.isFinite(count) ? count : 0) |
|
|
|
const distance = Array.isArray(r.waypoints) && r.waypoints.length |
|
|
|
? `${routeDistance(r.waypoints.map((p) => ({ |
|
|
|
longitude: Number(p.longitude), |
|
|
|
latitude: Number(p.latitude), |
|
|
|
}))).toFixed(1)} km` |
|
|
|
: (r.distance || '--') |
|
|
|
return { |
|
|
|
routes.value = (routePage?.records || []).map((r, i) => ({ |
|
|
|
id: String(r.id), |
|
|
|
name: r.name, |
|
|
|
waypoints, |
|
|
|
distance, |
|
|
|
// 列表只返回 waypointCount,不含 waypoints[] |
|
|
|
waypoints: Number(r.waypointCount) || 0, |
|
|
|
// 列表无航点坐标,距离只能详情后算;卡片暂显 -- |
|
|
|
distance: '--', |
|
|
|
collectedAt: fmtTime(r.createdAt), |
|
|
|
mapClass: i % 2 === 0 ? 'route-a' : 'route-c', |
|
|
|
} |
|
|
|
}) |
|
|
|
})) |
|
|
|
const hasActiveExecution = (execPage?.records || []).some((r) => ['pending', 'running'].includes(r.status)) |
|
|
|
if (hasActiveExecution && !refreshTimer) refreshTimer = window.setInterval(load, 5000) |
|
|
|
if (!hasActiveExecution && refreshTimer) { |
|
|
|
|