From 888132a60f1b0d65d64673a752293aa5b3962302 Mon Sep 17 00:00:00 2001 From: Huarch Date: Wed, 3 Jun 2026 11:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=97=B6=E9=97=B4=E6=97=B6?= =?UTF-8?q?=E5=8C=BA=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/olmap/core/Controls/Timeline.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/olmap/core/Controls/Timeline.tsx b/src/components/olmap/core/Controls/Timeline.tsx index 41b1c3f..dcf48de 100644 --- a/src/components/olmap/core/Controls/Timeline.tsx +++ b/src/components/olmap/core/Controls/Timeline.tsx @@ -623,7 +623,10 @@ const Timeline: React.FC = ({ // 提前提取日期和时间值,避免异步操作期间被时间轴拖动改变 const calculationDate = selectedDate; const calculationTime = currentTime; - const calculationDateStr = calculationDate.toISOString().split("T")[0]; + const calculationDateTime = currentTimeToDate( + calculationDate, + calculationTime + ); setIsCalculating(true); // 显示处理中的通知 @@ -635,8 +638,7 @@ const Timeline: React.FC = ({ try { const body = { name: NETWORK_NAME, - simulation_date: calculationDateStr, // YYYY-MM-DD - start_time: `${formatTime(calculationTime)}:00`, // HH:MM:00 + start_time: dayjs(calculationDateTime).format("YYYY-MM-DDTHH:mm:ssZ"), duration: calculatedInterval, }; @@ -651,7 +653,9 @@ const Timeline: React.FC = ({ }, ); - if (response.ok) { + const result = await response.json().catch(() => null); + + if (response.ok && result?.status === "success") { open?.({ type: "success", message: "重新计算成功", @@ -660,9 +664,11 @@ const Timeline: React.FC = ({ clearCacheAndRefetch(calculationDate, calculationTime); setForceStyleAutoApplyVersion?.((prev) => prev + 1); } else { + const errorMessage = + result?.detail || result?.message || "重新计算失败"; open?.({ type: "error", - message: "重新计算失败", + message: errorMessage, }); } } catch (error) {