统一时间时区请求

This commit is contained in:
2026-06-03 11:17:27 +08:00
parent 9761ade8d8
commit 888132a60f
@@ -623,7 +623,10 @@ const Timeline: React.FC<TimelineProps> = ({
// 提前提取日期和时间值,避免异步操作期间被时间轴拖动改变
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<TimelineProps> = ({
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<TimelineProps> = ({
},
);
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<TimelineProps> = ({
clearCacheAndRefetch(calculationDate, calculationTime);
setForceStyleAutoApplyVersion?.((prev) => prev + 1);
} else {
const errorMessage =
result?.detail || result?.message || "重新计算失败";
open?.({
type: "error",
message: "重新计算失败",
message: errorMessage,
});
}
} catch (error) {