54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { codeToText } from "@/components/lib/func/common";
|
|
import type { RswtStatProps } from ".";
|
|
|
|
const toUseTypeText = (val: string) =>
|
|
val
|
|
.split(",")
|
|
.map((code) => code.trim())
|
|
.filter(Boolean)
|
|
.map((code) => codeToText(code, "dmdUszCd") ?? code)
|
|
.join(", ");
|
|
|
|
export const excelRswtStat = (
|
|
excelList: RswtStatProps[]
|
|
): (string | number)[][] => {
|
|
const excelData: (string | number)[][] = [];
|
|
excelList.forEach((item) => {
|
|
excelData.push([
|
|
//시도
|
|
String(item.ctpvCd) ?? "",
|
|
//시군구
|
|
String(item.sggCd) ?? "",
|
|
//행정구역명
|
|
String(item.areaNm) ?? "",
|
|
//건축물명
|
|
String(item.bdstNm) ?? "",
|
|
//건축물용도코드
|
|
codeToText(String(item.bdstUsgCd ?? ""), "rswtBdstType") ?? String(item.bdstUsgCd ?? ""),
|
|
//주소
|
|
String(item.daddr) ?? "",
|
|
//법적의무대상여부
|
|
String(item.lawTrgtYn) === "Y" ? "대상" : "미대상",
|
|
//설치완료일자
|
|
item.instlCmptnDt ? String(item.instlCmptnDt).substring(0, 10) : "",
|
|
//가동개시일(빈칸)
|
|
"",
|
|
//처리용량
|
|
item.filtrTrtmfctCpct ?? "",
|
|
//물사용량
|
|
// item.wtrUsqty ?? "",
|
|
//중수도+대체수이용량
|
|
item.rswtAltSum ?? "",
|
|
//중수도이용량
|
|
item.rswtrUsqty ?? "",
|
|
//대체수이용량
|
|
item.altUswtrUtztnQnt ?? "",
|
|
//중수도용도
|
|
toUseTypeText(String(item.utztnUsgCd ?? "")),
|
|
//연간운영비
|
|
item.anlOperCst ?? "",
|
|
]);
|
|
});
|
|
return excelData;
|
|
};
|