fix(burst): show actual pipe diameters

This commit is contained in:
2026-07-17 10:01:06 +08:00
parent fddb0ceb34
commit d8ee2e1f0c
3 changed files with 136 additions and 1 deletions
@@ -0,0 +1,27 @@
export type PipeDiameterMap = Record<string, number | null | undefined>;
export const getPipeDiameterDisplay = (
pipeIds: string[] | undefined,
diameters: PipeDiameterMap | undefined,
loading = false,
): string => {
if (loading) {
return "查询中...";
}
if (!pipeIds?.length) {
return "N/A";
}
const values = pipeIds.map((pipeId) => {
const diameter = diameters?.[pipeId];
const displayValue =
typeof diameter === "number" && Number.isFinite(diameter)
? `${diameter} mm`
: "N/A";
return pipeIds.length === 1 ? displayValue : `${pipeId}: ${displayValue}`;
});
return values.join("");
};