Files
frontend/apps/wr/app/store/stats/rainStat/excel.tsx
T
2026-04-20 17:20:12 +09:00

52 lines
1.6 KiB
TypeScript

import { codeToText } from "@/components/lib/func/common";
import type { RainStatProps } from ".";
const toUseTypeText = (val: string) =>
val
.split(",")
.map((code) => code.trim())
.filter(Boolean)
.map((code) => codeToText(code, "dmdUszCd") ?? code)
.join(", ");
export const excelRainStat = (
excelList: RainStatProps[]
): (string | number)[][] => {
const excelData: (string | number)[][] = [];
excelList.forEach((item) => {
excelData.push([
//시도
item.ctpvCd ?? "",
//시군구
item.sggCd ?? "",
//행정구역명
String(item.areaNm) ?? "",
//시설명
String(item.bdstNm) ?? "",
//건축물용도코드 (값 없음)
codeToText(String(item.bdstUsgCd ?? ""), "bdstUsgCd") ?? String(item.bdstUsgCd ?? ""),
//주소
String(item.daddr) ?? "",
//법적의무대상여부
String(item.lawTrgtYn) === "Y" ? "대상" : "미대상",
//설치완료일자
String(item.instlCmptnDt).substring(0, 10) ?? "",
//설치비용
item.instlCst ?? "",
//집수면종류
codeToText(String(item.pntfColKnd ?? ""), "rainFcltCd") ?? String(item.pntfColKnd ?? ""),
//여과등처리시설유무
String(item.filtrTrtmfctYn) ?? "",
//처리용량(저류조용량)
item.dtfcltCpct ?? "",
//연간사용량
item.wtrUsqty ?? "",
//이용용도코드
toUseTypeText(item.utztnUsgCd ?? ""),
//연간운영비
item.anlOperCst ?? "",
]);
});
return excelData;
};