엑셀 변환 TODO 작성 완료.

This commit is contained in:
truthwing
2025-04-25 14:43:42 +09:00
parent e78e3639fc
commit e15b922b2e
3 changed files with 62 additions and 9 deletions
@@ -19,7 +19,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { headMakeTriple } from "./TableHead";
export default function RainSttn() {
const { code, rain, init, sttnCommon, excelExportAction } = useWrStore((state) => state);
const { code, rain, init, sttnCommon, excelRainSttn } = useWrStore((state) => state);
const { rainRes } = rain;
const [isChHead, setIsChHead] = useState(false);
@@ -40,7 +40,6 @@ export default function RainSttn() {
if (code.sggCd.length > 0) {
const data = tableData(rainRes, { code });
// data 는 위 JSON 객체라고 가정
// TODO: 이게 뭐하는 작업이지?
const unVisibleHead = sttnCommon.rainSttHeadList.filter(
(item: TableTripleProps) => item.visible === false
);
@@ -57,10 +56,15 @@ export default function RainSttn() {
setBdstTable(chData);
}
}, [code, rainRes, sttnCommon.rainSttHeadList]);
useEffect(() => {
if(sttnCommon.excelList.length>0){
// TODO: API 호출후 받은 데이터로 엑셀 변환.
}
}, [sttnCommon.excelList]);
const excelClick = useCallback(() => {
excelExportAction(code.cityCd, code.sggCd);
},[code.cityCd, code.sggCd, excelExportAction]);
//TODO: 엑셀 버튼 클릭시 API 호출 후 데이터를 excelRainSttn호출하여 변환된 데이터 effect 이벤트 동작.excelRainSttn(code.cityCd, code.sggCd);
//FIXME: 현재 API 호출하는 함수 액션이 존재하지 않음.
},[code.cityCd, code.sggCd, excelRainSttn]);
return (
<>
<ContentsDiv>
@@ -0,0 +1,46 @@
export type ExcelSttnRainType={
"1.건축물정보": {
"행정구역":{"시도": string, "시군구": string},
"건축물명": string,
"주소": string,
"건축물용도코드": string,
"최초건축허가일": string,
"건축면적": string,
"법적의무대상": string,
"설치완료일시": string,
},
"2.빗물이용시설정보":{
"설치비용": string,
"집수면":{
"집수지점종류": string,
"집수지점면적": string,
},
"여과등 처리시설":{
"여과처리시설유무": string,
"여과처리시설용량": string,
"여과처리시설처리공정": string,
}
"저류조용량": string,
},
"3.시설운영및 이용정보":{
"운영관리코드": string,
"연간빗물운영량": string
},
"4.인센티브 정보":{
"설치비지원":{
"설치지원비용여부": string,
"설치지원비용": string,
},
"요금감면":{
"감면여부": string,
"감면근거": string,
"감면금액": string,
},
"녹색건축물인증여부":{
"녹색건축물인증여부": string,
"녹색건축물인증년도": string,
"녹색건축물인증번호": string,
"녹색건축물인증등급": string,
}
}
}
@@ -1,9 +1,9 @@
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import { type ExcelExportType } from "../../../prfmncReg/chkgdnReg/rainChkgdn/excel";
import {
type TableTripleProps,
type TableUpperProps
} from "../../fcltReg/rainReg";
import type { ExcelSttnRainType } from "./excel";
const pbnSttHeadNm: chHeadType[] = [
{ headNm: "catchment", text: "유역", length: 3 },
@@ -215,14 +215,14 @@ const rainSttHeadList: TableTripleProps[] = [
},
{
id: "pntfColKnd",
title: "접수지점종류",
title: "집수지점종류",
visible: true,
upName: ["rainFcltInfo", "pntfCol"],
upSequnce: [2, 1],
},
{
id: "pntfColArea",
title: "접수지점면적",
title: "집수지점면적",
visible: true,
upName: ["rainFcltInfo", "pntfCol"],
upSequnce: [3, 2],
@@ -342,7 +342,7 @@ export type sttnState = {
pbnSttHeadNm: chHeadType[];
rainSttHeadList: TableTripleProps[];
rainSttHeadNm: chHeadType[];
excelList:ExcelExportType[]
excelList:ExcelSttnRainType[]
};
};
type sttnActions = {
@@ -365,6 +365,9 @@ export const sttnStateExport: sttnState = {
export const sttnActionsExport: (set: any) => sttnActions = (set: any) => {
return {
pbnSttnInit: async (sggCd: string, searchTxt: string, flg: string) => {},
excelRainSttn: async (data: JSON[]) => {
//TODO: 엑셀 데이터 array 생성해서 return 필요. ExcelSttnRainType[]으로 생성해서 던져주면 됨.
},
chSttnHead: async (checkList: string[], type: string) => {
const headList =
type === "pbn"