fix(map): convert actual demand display units

This commit is contained in:
2026-07-17 10:13:50 +08:00
parent d8ee2e1f0c
commit d986e563a6
4 changed files with 54 additions and 12 deletions
+3 -4
View File
@@ -24,7 +24,7 @@ import { TextLayer } from "@deck.gl/layers";
import { TripsLayer } from "@deck.gl/geo-layers";
import { CollisionFilterExtension } from "@deck.gl/extensions";
import { ContourLayer } from "deck.gl";
import { toM3h } from "@utils/units";
import { isLpsFlowProperty, toM3h } from "@utils/units";
import { usePathname } from "next/navigation";
import {
cleanupTransientMapResources,
@@ -204,8 +204,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
return junctionData.map((j) => {
const record = nodeMap.get(j.id);
let val = record ? record.value : undefined;
// 在这合并时将实际需水量从 LPS 转换为大写表示
if (val !== undefined && junctionText === "actualdemand") {
if (val !== undefined && isLpsFlowProperty(junctionText)) {
val = toM3h(val, "lps");
}
return record ? { ...j, [junctionText]: val } : j;
@@ -236,7 +235,7 @@ const MapComponent: React.FC<MapComponentProps> = ({ children }) => {
return junctionData.map((j) => {
const record = nodeMap.get(j.id);
let val = record ? record.value : undefined;
if (val !== undefined && junctionText === "actualdemand") {
if (val !== undefined && isLpsFlowProperty(junctionText)) {
val = toM3h(val, "lps");
}
return record ? { ...j, [junctionText]: val } : j;