统一时间时区请求
This commit is contained in:
@@ -623,7 +623,10 @@ const Timeline: React.FC<TimelineProps> = ({
|
|||||||
// 提前提取日期和时间值,避免异步操作期间被时间轴拖动改变
|
// 提前提取日期和时间值,避免异步操作期间被时间轴拖动改变
|
||||||
const calculationDate = selectedDate;
|
const calculationDate = selectedDate;
|
||||||
const calculationTime = currentTime;
|
const calculationTime = currentTime;
|
||||||
const calculationDateStr = calculationDate.toISOString().split("T")[0];
|
const calculationDateTime = currentTimeToDate(
|
||||||
|
calculationDate,
|
||||||
|
calculationTime
|
||||||
|
);
|
||||||
|
|
||||||
setIsCalculating(true);
|
setIsCalculating(true);
|
||||||
// 显示处理中的通知
|
// 显示处理中的通知
|
||||||
@@ -635,8 +638,7 @@ const Timeline: React.FC<TimelineProps> = ({
|
|||||||
try {
|
try {
|
||||||
const body = {
|
const body = {
|
||||||
name: NETWORK_NAME,
|
name: NETWORK_NAME,
|
||||||
simulation_date: calculationDateStr, // YYYY-MM-DD
|
start_time: dayjs(calculationDateTime).format("YYYY-MM-DDTHH:mm:ssZ"),
|
||||||
start_time: `${formatTime(calculationTime)}:00`, // HH:MM:00
|
|
||||||
duration: calculatedInterval,
|
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?.({
|
open?.({
|
||||||
type: "success",
|
type: "success",
|
||||||
message: "重新计算成功",
|
message: "重新计算成功",
|
||||||
@@ -660,9 +664,11 @@ const Timeline: React.FC<TimelineProps> = ({
|
|||||||
clearCacheAndRefetch(calculationDate, calculationTime);
|
clearCacheAndRefetch(calculationDate, calculationTime);
|
||||||
setForceStyleAutoApplyVersion?.((prev) => prev + 1);
|
setForceStyleAutoApplyVersion?.((prev) => prev + 1);
|
||||||
} else {
|
} else {
|
||||||
|
const errorMessage =
|
||||||
|
result?.detail || result?.message || "重新计算失败";
|
||||||
open?.({
|
open?.({
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "重新计算失败",
|
message: errorMessage,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user