Files
ln-bi/src/modules/energy/hydrogen-bi-v2/daily-detail-format.ts
T
kfluousandHiFox Agent 6c91a6694a
ci/woodpecker/push/woodpecker Pipeline was successful
fix(energy): deliver prototype-aligned hydrogen board and acceptance fixes
Co-authored-by: HiFox Agent <agents-noreply@hifox.com>
2026-09-03 22:27:23 +08:00

16 lines
694 B
TypeScript

import type { H2BiDailyResponse } from "./types";
export function formatDailyChange(value: unknown): string {
if (typeof value !== "number" || !Number.isFinite(value)) return "环比 —";
return `环比 ${value > 0 ? "+" : ""}${value.toFixed(2)}%`;
}
/** Export the entire selected range, independently of which branches were opened. */
export function dailySummaryRows(daily: H2BiDailyResponse): Array<Array<string | number>> {
return [
["日期", "加氢站数", "加氢量(Kg)", "成本(元)"],
["区间合计", daily.kpis.stationCount, daily.kpis.totalKg, daily.kpis.totalCost],
...daily.days.map(day => [day.date, day.stationCount ?? "—", day.kg, day.cost]),
];
}