统一流量单位为 m³/h,优化相关组件
This commit is contained in:
@@ -20,7 +20,7 @@ import { useNotification } from "@refinedev/core";
|
||||
import { api } from "@/lib/api";
|
||||
import { NETWORK_NAME, config } from "@config/config";
|
||||
import { LeakageResultDetail } from "./types";
|
||||
import { DMA_FLOW_DISPLAY_UNIT, toM3s } from "./utils";
|
||||
import { FLOW_DISPLAY_UNIT, toM3s } from "./utils";
|
||||
|
||||
interface Props {
|
||||
onResult: (result: LeakageResultDetail) => void;
|
||||
@@ -68,9 +68,9 @@ const AnalysisParameters: React.FC<Props> = ({ onResult }) => {
|
||||
scada_end: endTime.toISOString(),
|
||||
pop_size: popSize,
|
||||
max_gen: maxGen,
|
||||
q_sum: toM3s(qSum, DMA_FLOW_DISPLAY_UNIT),
|
||||
q_sum: toM3s(qSum, FLOW_DISPLAY_UNIT),
|
||||
q_sum_unit: "m3/s",
|
||||
output_flow_unit: DMA_FLOW_DISPLAY_UNIT,
|
||||
output_flow_unit: FLOW_DISPLAY_UNIT,
|
||||
},
|
||||
);
|
||||
onResult(response.data as LeakageResultDetail);
|
||||
@@ -172,7 +172,7 @@ const AnalysisParameters: React.FC<Props> = ({ onResult }) => {
|
||||
|
||||
<Box className="flex flex-col gap-2">
|
||||
<Typography variant="subtitle2" className="mb-1 font-medium">
|
||||
总漏损流量 ({DMA_FLOW_DISPLAY_UNIT})
|
||||
总漏损流量 ({FLOW_DISPLAY_UNIT})
|
||||
</Typography>
|
||||
<TextField
|
||||
type="number"
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from "@mui/material";
|
||||
import { FormatListBulleted } from "@mui/icons-material";
|
||||
import dayjs from "dayjs";
|
||||
import { DMA_FLOW_DISPLAY_UNIT, getAreaColor, toM3h } from "./utils";
|
||||
import { FLOW_DISPLAY_UNIT, getAreaColor, toM3h } from "./utils";
|
||||
import { LeakageResultDetail } from "./types";
|
||||
|
||||
interface Props {
|
||||
@@ -131,7 +131,7 @@ const RecognitionResults: React.FC<Props> = ({ result }) => {
|
||||
);
|
||||
const qSumM3h = toM3h(Number(val), unit);
|
||||
return Number.isFinite(qSumM3h)
|
||||
? `${qSumM3h.toFixed(3)} ${DMA_FLOW_DISPLAY_UNIT}`
|
||||
? `${qSumM3h.toFixed(3)} ${FLOW_DISPLAY_UNIT}`
|
||||
: "-";
|
||||
})()}
|
||||
</Typography>
|
||||
@@ -167,7 +167,7 @@ const RecognitionResults: React.FC<Props> = ({ result }) => {
|
||||
?.max_leakage;
|
||||
const maxLeakageM3h = toM3h(Number(maxL), "m3/s");
|
||||
return Number.isFinite(maxLeakageM3h)
|
||||
? `${maxLeakageM3h.toFixed(3)} ${DMA_FLOW_DISPLAY_UNIT}`
|
||||
? `${maxLeakageM3h.toFixed(3)} ${FLOW_DISPLAY_UNIT}`
|
||||
: "-";
|
||||
})()}
|
||||
</Typography>
|
||||
@@ -215,7 +215,7 @@ const RecognitionResults: React.FC<Props> = ({ result }) => {
|
||||
align="right"
|
||||
sx={{ fontWeight: 600, color: "#64748b", py: 1.5, pr: 3 }}
|
||||
>
|
||||
漏损量 ({DMA_FLOW_DISPLAY_UNIT})
|
||||
漏损量 ({FLOW_DISPLAY_UNIT})
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
|
||||
@@ -24,7 +24,7 @@ import { useNotification } from "@refinedev/core";
|
||||
import { api } from "@/lib/api";
|
||||
import { NETWORK_NAME, config } from "@config/config";
|
||||
import { LeakageResultDetail, LeakageSchemeRecord } from "./types";
|
||||
import { DMA_FLOW_DISPLAY_UNIT, toM3h } from "./utils";
|
||||
import { FLOW_DISPLAY_UNIT, toM3h } from "./utils";
|
||||
|
||||
interface Props {
|
||||
onViewResult: (result: LeakageResultDetail) => void;
|
||||
@@ -210,7 +210,7 @@ const SchemeQuery: React.FC<Props> = ({ onViewResult }) => {
|
||||
const value = Number((scheme.scheme_detail as any)?.result_summary?.max_leakage);
|
||||
const maxLeakageM3h = toM3h(value, "m3/s");
|
||||
return Number.isFinite(maxLeakageM3h)
|
||||
? `${maxLeakageM3h.toFixed(3)} ${DMA_FLOW_DISPLAY_UNIT}`
|
||||
? `${maxLeakageM3h.toFixed(3)} ${FLOW_DISPLAY_UNIT}`
|
||||
: "-";
|
||||
})()}
|
||||
</Typography>
|
||||
@@ -227,7 +227,7 @@ const SchemeQuery: React.FC<Props> = ({ onViewResult }) => {
|
||||
);
|
||||
const qSumM3h = toM3h(value, unit);
|
||||
return Number.isFinite(qSumM3h)
|
||||
? `${qSumM3h.toFixed(3)} ${DMA_FLOW_DISPLAY_UNIT}`
|
||||
? `${qSumM3h.toFixed(3)} ${FLOW_DISPLAY_UNIT}`
|
||||
: "-";
|
||||
})()}
|
||||
</Typography>
|
||||
|
||||
@@ -11,7 +11,7 @@ export const AREA_COLORS = [
|
||||
"#be123c",
|
||||
];
|
||||
|
||||
export const DMA_FLOW_DISPLAY_UNIT = "m³/h";
|
||||
export const FLOW_DISPLAY_UNIT = "m³/h";
|
||||
const M3H_FACTOR = 3600;
|
||||
|
||||
export const getAreaColor = (areaId: string | number | undefined) => {
|
||||
|
||||
Reference in New Issue
Block a user