From 4b958aacb27b4c28089ee7eb648b231f6a94029a Mon Sep 17 00:00:00 2001 From: xiaosi <2652281683@qq.com> Date: Fri, 4 Sep 2026 10:53:46 +0800 Subject: [PATCH] fix: map route list cards from waypointCount only List API never returns waypoints[]; drop the dead array branch and read waypointCount directly. --- src/views/TasksView/TasksView.vue | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/views/TasksView/TasksView.vue b/src/views/TasksView/TasksView.vue index d9f81a9..992dd67 100644 --- a/src/views/TasksView/TasksView.vue +++ b/src/views/TasksView/TasksView.vue @@ -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 { - id: String(r.id), - name: r.name, - waypoints, - distance, - collectedAt: fmtTime(r.createdAt), - mapClass: i % 2 === 0 ? 'route-a' : 'route-c', - } - }) + routes.value = (routePage?.records || []).map((r, i) => ({ + id: String(r.id), + name: r.name, + // 列表只返回 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) {