Merge commit 'e15b922b2e1147750cb562da47ea9ae0169b8716' into iipbs/wr/form_fuction

This commit is contained in:
leedj312
2025-04-25 15:47:01 +09:00
3 changed files with 79 additions and 10 deletions
@@ -19,7 +19,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { headMakeTriple } from "./TableHead";
export default function RainSttn() {
const { code, init, sttnCommon, excelExportAction, rainSttnInit } =
const { code, sttnCommon, excelRainSttn,excelExportAction, rainSttnInit } =
useWrStore((state) => state);
const { rainRes } = sttnCommon;
@@ -49,6 +49,9 @@ export default function RainSttn() {
// data 는 위 JSON 객체라고 가정
// TODO: 이게 뭐하는 작업이지?
const unVisibleHead = sttnCommon.rainSttHeadList.filter(
(item: TableTripleProps) => item.visible === false
);
const chData = data
.map((item: any) => ({
...item,
@@ -59,12 +62,16 @@ export default function RainSttn() {
setBdstTable(chData);
}
}, [code, sttnCommon.rainRes]);
}, [code, rainRes, sttnCommon.rainSttHeadList]);
useEffect(() => {
if(sttnCommon.excelList.length>0){
// TODO: API 호출후 받은 데이터로 엑셀 변환.
}
}, [sttnCommon.excelList]);
const excelClick = useCallback(() => {
excelExportAction(code.cityCd, code.sggCd);
}, [ 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,10 +1,10 @@
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import { type ExcelExportType } from "../../../prfmncReg/chkgdnReg/rainChkgdn/excel";
import {
type customRainBdst,
type TableTripleProps,
type TableUpperProps,
} from "../../fcltReg/rainReg";
import type { ExcelSttnRainType } from "./excel";
import { fetchType, getFetch } from "@/components/lib/api";
const pbnSttHeadNm: chHeadType[] = [
@@ -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],
@@ -309,13 +309,14 @@ export type sttnState = {
pbnSttHeadNm: chHeadType[];
rainSttHeadList: TableTripleProps[];
rainSttHeadNm: chHeadType[];
excelList: ExcelExportType[];
excelList:ExcelSttnRainType[];
isInit:boolean
};
};
type sttnActions = {
rainSttnInit: (page: string, total: string, con: string) => void;
chSttnHead: (checkList: string[], type: string) => void;
excelRainSttn:(data:JSON[] ) => void
};
export type sttnType = sttnState & sttnActions;
@@ -354,6 +355,21 @@ export const sttnActionsExport: (set: any) => sttnActions = (set: any) => {
console.log("error", erTxt);
}
},
excelRainSttn: async (data: JSON[]) => {
//TODO: 엑셀 데이터 array 생성해서 return 필요. ExcelSttnRainType[]으로 생성해서 던져주면 됨.
set((state: sttnState) => {
return {
...state,
sttnCommon: {
...state.sttnCommon,
rainRes: rainRes,
isInit: false,
},
};
});
},
chSttnHead: async (checkList: string[], type: string) => {
const headList =
type === "pbn"