添加爆管定位功能及相关组件

This commit is contained in:
JIANG
2026-03-07 10:50:07 +08:00
parent 9beba1cf6f
commit 5ed6740a24
11 changed files with 1247 additions and 14 deletions
@@ -78,7 +78,7 @@ const AnalysisParameters: React.FC<Props> = ({ onResult }) => {
key: "dma-leak-analysis",
type: "success",
message: "方案分析成功",
description: "DMA漏损识别完成,请在方案查询中查看结果。",
description: "DMA 漏损识别完成,请在方案查询中查看结果。",
});
} catch (error: any) {
open?.({
@@ -54,7 +54,7 @@ const DMALeakDetectionPanel: React.FC = () => {
const [loadedResult, setLoadedResult] = useState<LeakageResultDetail | null>(null);
const drawerWidth = 450;
const panelTitle = "DMA漏损识别";
const panelTitle = "DMA 漏损识别";
const activeAreas = loadedResult?.areas ?? [];
const legendColors = useMemo(
() => activeAreas.map((area) => getAreaColor(area.area_id)),
@@ -11,7 +11,7 @@ export const AREA_COLORS = [
"#be123c",
];
export const DMA_FLOW_DISPLAY_UNIT = "m3/h";
export const DMA_FLOW_DISPLAY_UNIT = "m³/h";
const M3H_FACTOR = 3600;
export const getAreaColor = (areaId: string | number | undefined) => {
@@ -23,16 +23,16 @@ export const getAreaColor = (areaId: string | number | undefined) => {
return AREA_COLORS[hash % AREA_COLORS.length];
};
export const toM3h = (value: number, sourceUnit: string = "m3/s") => {
export const toM3h = (value: number, sourceUnit: string = "m³/s") => {
if (!Number.isFinite(value)) return Number.NaN;
const normalizedUnit = sourceUnit.trim().toLowerCase();
if (normalizedUnit === "m3/h") return value;
if (normalizedUnit === "m³/h") return value;
return value * M3H_FACTOR;
};
export const toM3s = (value: number, sourceUnit: string = "m3/h") => {
export const toM3s = (value: number, sourceUnit: string = "m³/h") => {
if (!Number.isFinite(value)) return Number.NaN;
const normalizedUnit = sourceUnit.trim().toLowerCase();
if (normalizedUnit === "m3/s") return value;
if (normalizedUnit === "m³/s") return value;
return value / M3H_FACTOR;
};