统一流量单位为 m³/h,优化相关组件
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
Typography,
|
||||
Chip,
|
||||
IconButton,
|
||||
Tooltip,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
@@ -28,7 +29,7 @@ import VectorSource from "ol/source/Vector";
|
||||
import { Stroke, Style, Circle, Fill } from "ol/style";
|
||||
import { bbox, featureCollection } from "@turf/turf";
|
||||
import { BurstCandidate, BurstLocationResult } from "./types";
|
||||
import { DMA_FLOW_DISPLAY_UNIT } from "../DMALeakDetection/utils";
|
||||
import { FLOW_DISPLAY_UNIT } from "../DMALeakDetection/utils";
|
||||
|
||||
interface Props {
|
||||
result: BurstLocationResult | null;
|
||||
@@ -127,6 +128,14 @@ const LocationResults: React.FC<Props> = ({ result }) => {
|
||||
return base;
|
||||
}, [result]);
|
||||
|
||||
const allCandidatePipeIds = useMemo<string[]>(() => {
|
||||
const ids = candidatePipes.map((item) => item.pipe_id);
|
||||
if (result?.located_pipe) {
|
||||
ids.unshift(result.located_pipe);
|
||||
}
|
||||
return Array.from(new Set(ids.filter(Boolean)));
|
||||
}, [candidatePipes, result?.located_pipe]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!map) return;
|
||||
|
||||
@@ -263,7 +272,7 @@ const LocationResults: React.FC<Props> = ({ result }) => {
|
||||
/>
|
||||
<MetricCard
|
||||
label="估计漏损量"
|
||||
value={`${result.burst_leakage.toFixed(2)} ${DMA_FLOW_DISPLAY_UNIT}`}
|
||||
value={`${result.burst_leakage.toFixed(2)} ${FLOW_DISPLAY_UNIT}`}
|
||||
tone="orange"
|
||||
/>
|
||||
<MetricCard
|
||||
@@ -288,18 +297,32 @@ const LocationResults: React.FC<Props> = ({ result }) => {
|
||||
候选管段列表
|
||||
</Typography>
|
||||
</Box>
|
||||
<Chip
|
||||
size="small"
|
||||
label={`${candidatePipes.length} 条`}
|
||||
sx={{
|
||||
height: 22,
|
||||
backgroundColor: "rgba(37, 99, 235, 0.08)",
|
||||
color: "#2563eb",
|
||||
fontWeight: 600,
|
||||
fontSize: "0.75rem",
|
||||
border: "none",
|
||||
}}
|
||||
/>
|
||||
<Box className="flex items-center gap-1">
|
||||
<Chip
|
||||
size="small"
|
||||
label={`${candidatePipes.length} 条`}
|
||||
sx={{
|
||||
height: 22,
|
||||
backgroundColor: "rgba(37, 99, 235, 0.08)",
|
||||
color: "#2563eb",
|
||||
fontWeight: 600,
|
||||
fontSize: "0.75rem",
|
||||
border: "none",
|
||||
}}
|
||||
/>
|
||||
<Tooltip title="定位所有管段">
|
||||
<span>
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => locatePipes(allCandidatePipeIds)}
|
||||
disabled={allCandidatePipeIds.length === 0}
|
||||
className="text-blue-600 hover:bg-blue-50 disabled:text-gray-300"
|
||||
>
|
||||
<LocationOnIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
</Box>
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
|
||||
Reference in New Issue
Block a user