엑셀다운로드 작업중

This commit is contained in:
leedj312
2025-04-27 10:09:21 +09:00
parent 8cfa5f9895
commit 752371e09f
6 changed files with 77 additions and 15 deletions
+5 -5
View File
@@ -5,13 +5,13 @@ import type { EnvPartSelectDataType, SelectDataType } from "@common/business_com
export const btnClass= "p-4 m-2 text-white rounded-sm text-lg font-medium "
export const yn :SelectDataType[]=[
const yn :SelectDataType[]=[
{val:'Y', text:'Y'},
{val:'N', text:'N'},
]
//공통 건축물 용도
export const bdstUsgCd: SelectDataType[] = [
const bdstUsgCd: SelectDataType[] = [
{ val: '1', text: "운동장" },
{ val: '2', text: "체육관" },
{ val: '3', text: "공공업무시설" },
@@ -30,7 +30,7 @@ export const bdstUsgCd: SelectDataType[] = [
{ val: '16', text: "기타" },
];
//빗물 집수면 종류 용도
export const rainFcltCd = [
const rainFcltCd = [
{ val: "1", text: "지붕" },
{ val: "2", text: "건물옥상" },
{ val: "3", text: "골프장 연못" },
@@ -43,7 +43,7 @@ export const rainFcltCd = [
{ val: "10", text: "확인불가" },
];
// 중수도 필수 원수종류
export const rswtBdstType: SelectDataType[] = [
const rswtBdstType: SelectDataType[] = [
{ text: "숙박업", val: "17" },
{ text: "목욕장업", val: "18" },
{ text: "공장", val: "19" },
@@ -83,7 +83,7 @@ const orgwtKndCd = [
{ text: "기타", val: "5" },
];
export const chBuCd = [
const chBuCd = [
{ val: "증축", text: "증축" },
{ val: "개축", text: "개축" },
{ val: "재축", text: "재축" },
@@ -288,7 +288,7 @@ export type rainChkgdnState = {
splHeadList: TableUpperProps[];
rswtDetailHeadList: TableUpperProps[];
isInit: boolean;
excelList:ExcelExportType[]
excelList:ExcelExportType[] | JSON[]
};
};
@@ -1,5 +1,5 @@
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg";
import { upHeadList, type chgBuilding, type TableUpperProps } from "../rainReg";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
@@ -1,7 +1,7 @@
import type { selectArray } from "@/app/store/common/code";
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
import type { SelectDataType } from "@common/business_components/ui";
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
@@ -138,7 +138,7 @@ export type rainFacState = {
rain: {
isInit: boolean;
upHeadList: TableUpperProps[];
selectYN: selectArray[];
selectYN: SelectDataType[];
rainRes: customRainBdst[];
// regRainForm:customRainBdst,
@@ -1,3 +1,5 @@
import type { customRainBdst } from "../../fcltReg/rainReg"
export type ExcelSttnRainType={
"1.건축물정보": {
"행정구역":{"시도": string, "시군구": string},
@@ -19,19 +21,19 @@ export type ExcelSttnRainType={
"여과처리시설유무": string,
"여과처리시설용량": string,
"여과처리시설처리공정": string,
}
},
"저류조용량": string,
},
"3.시설운영및 이용정보":{
"3.시설운영및 이용정보"?:{
"운영관리코드": string,
"연간빗물운영량": string
},
"4.인센티브 정보":{
"3.인센티브 정보":{
"설치비지원":{
"설치지원비용여부": string,
"설치지원비용": string,
},
"요금감면":{
"요금감면"?:{
"감면여부": string,
"감면근거": string,
"감면금액": string,
@@ -43,4 +45,52 @@ export type ExcelSttnRainType={
"녹색건축물인증등급": string,
}
}
}
const excelSttnParsing = (data: customRainBdst[]): ExcelSttnRainType[] => {
const excelExportData: ExcelSttnRainType[] = []
data.forEach((item) => {
excelExportData.push(
{
"1.건축물정보": {
"행정구역":{"시도": String(item.ctpvCd), "시군구": String(item.sggCd)},
"건축물명": item.bdstNm,
"주소": item.daddr,
"건축물용도코드": String(item.bdstInfoPk),
"최초건축허가일":String(item.frstArchPrmsnDt),
"건축면적": String(item.archArea),
"법적의무대상": String(item.reuseBuilding[0]?.lawTrgtYn??''),
"설치완료일시": String(item.reuseBuilding[0]?.instlCmptnDt??''),
},
"2.빗물이용시설정보":{
"설치비용": String(item.reuseBuilding[0]?.instlCst??''),
"집수면":{
"집수지점종류": item.reuseBuilding[0]?.rainyObj.pntfColKnd??'',
"집수지점면적": String(item.reuseBuilding[0]?.rainyObj.pntfColArea??''),
},
"여과등 처리시설":{
"여과처리시설유무": String(item.reuseBuilding[0]?.rainyObj.filtrTrtmfctYn??''),
"여과처리시설용량": String(item.reuseBuilding[0]?.rainyObj.filtrTrtmfctCpct??''),
"여과처리시설처리공정":String(item.reuseBuilding[0]?.rainyObj.filtrTrtmfctPrs??''),
},
"저류조용량": String(item.reuseBuilding[0]?.rainyObj.dtfcltCpct??''),
},
"3.인센티브 정보":{
"설치비지원":{
"설치지원비용여부": String(item.reuseBuilding[0]?.instlCstSprtYn ) ,
"설치지원비용": String(item.reuseBuilding[0]?.instlCstSprtAmt ),
},
"녹색건축물인증여부":{
"녹색건축물인증여부": String(item.reuseBuilding[0]?.grntchBdstCertYn) ,
"녹색건축물인증년도": String(item.reuseBuilding[0]?.grntchBdstCertYr),
"녹색건축물인증번호": String(item.reuseBuilding[0]?.grntchBdstCertNo),
"녹색건축물인증등급": String(item.reuseBuilding[0]?.grntchBdstCertGrd),
}
}
})
});
// excelItem = {} as ExcelSttnRainType
// excelItem["1.건축물정보"]["행정구역"]["시도"] = item.sidoNm
// excelItem["1.건축물정보"]["행정구역"]["시군구"] = item.sggNm
return excelExportData;
}
@@ -314,7 +314,7 @@ export type sttnState = {
};
};
type sttnActions = {
rainSttnInit: (page: string, total: string, con: string) => void;
rainSttnSearch: (page: string, total: string, con: string) => void;
chSttnHead: (checkList: string[], type: string) => void;
excelRainSttn:(data:JSON[] ) => void
};
@@ -335,12 +335,24 @@ export const sttnStateExport: sttnState = {
export const sttnActionsExport: (set: any) => sttnActions = (set: any) => {
return {
rainSttnInit: async (page: string, total: string, con: string) => {
rainSttnSearch: async (page: string, total: string, con: string) => {
try {
const rainRes = await getFetch(
fetchType.WR,
`/reuseFc/rainyInfoList/${page}/${total}/${con}`
);
if(Number(total) > 9000){
set((state: sttnState) => {
return {
...state,
sttnCommon: {
...state.sttnCommon,
excelList: rainRes,
},
};
});
}
else
set((state: sttnState) => {
return {
...state,