빗물/중수도/온배수 시설현황 엑셀 다운로드 시도명으로 수정 완료

This commit is contained in:
jyha00
2025-06-23 14:24:13 +09:00
parent 58fcd99941
commit 8ac291dda6
9 changed files with 73 additions and 89 deletions
@@ -71,7 +71,7 @@ export default function HtdflSttn() {
if (htdflSttn.excelList.length > 0) {
if (htdflSttn.excelList.length === 0) return;
const excelData = await tableData(htdflSttn.excelList, { code });
const htdflExcel = excelHtdflSttnParsing(excelData);
const htdflExcel = excelHtdflSttnParsing(excelData, code.cityCd, code.sggCd);
excelDownload(
htdflExcel as [[]],
"온배수시설 현황",
@@ -91,7 +91,6 @@ export default function HtdflSttn() {
useEffect(() => {
if (htdflSttnRes.length > 0 && code.cityCd.length > 0) {
console.log("htdflSttnRes", htdflSttnRes);
const data = tableData(htdflSttnRes, { code });
const chData = data
.map((item: any) => ({
@@ -95,7 +95,7 @@ export default function RainSttn() {
}, [code, rainSttnRes, rainSttn.rainSttHeadList]);
useEffect(() => {
if (codeData != null) rainSttnSearch(pageNation, "20", codeData);
if (codeData != null) rainSttnSearch(pageNation, "20", codeData, code.cityCd, code.sggCd);
}, [pageNation]);
useEffect(() => {
@@ -111,8 +111,8 @@ export default function RainSttn() {
}, [rainSttn.excelList]);
const excelClick = useCallback(() => {
if (codeData) rainSttnSearch(1, "10000", codeData);
}, [rainSttnSearch, codeData]);
if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd);
}, [rainSttnSearch, codeData, code.cityCd, code.sggCd]);
return (
<>
@@ -146,7 +146,7 @@ export default function RainSttn() {
} else {
con = returnType.sidoValue;
}
rainSttnSearch(1, "20", con);
rainSttnSearch(1, "20", con, code.cityCd, code.sggCd);
}}
excelClick={excelClick}
initClick={function (): void { }}
@@ -42,7 +42,6 @@ export default function RswtSttn() {
const codeCityOrSgg = getCityOrSgg(ref);
const cellClick = (index: number | undefined, headId: string) => {
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
@@ -57,7 +56,6 @@ export default function RswtSttn() {
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
}
}
}
useEffect(() => {
@@ -100,13 +98,13 @@ export default function RswtSttn() {
const excelClick = useCallback(
(returnType: ReturnType) => {
if (codeCityOrSgg)
rswtSttnSearch(1, "10000", codeCityOrSgg);
rswtSttnSearch(1, "10000", codeCityOrSgg, code.cityCd, code.sggCd);
},
[rswtSttnSearch, codeCityOrSgg]
[rswtSttnSearch, code.cityCd, code.sggCd, codeCityOrSgg]
);
useEffect(() => {
if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg);
if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg, code.cityCd, code.sggCd);
}, [pageNation]);
return (
@@ -122,27 +120,24 @@ export default function RswtSttn() {
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<Button
className={btnClass}
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>
}
rightChildren={<Button
className={btnClass}
onClick={() => {
setIsChHead(true);
} }
>
조회항목설정
</Button>}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
if (codeCityOrSgg)
rswtSttnSearch(1, "20", codeCityOrSgg);
}}
rswtSttnSearch(1, "20", codeCityOrSgg, code.cityCd, code.sggCd);
} }
excelClick={excelClick}
initClick={function (): void { }}
initClick={function (): void { } }
btnClass={btnClass}
ref={ref}
/>
ref={ref} isAdmin={false} />
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
@@ -1,30 +1,34 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { customHtdflBdst } from "../../fcltReg/htdflReg";
export const excelHtdflSttnParsing = (data: customHtdflBdst[]): string[][] => {
export const excelHtdflSttnParsing = (
data: customHtdflBdst[],
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
): string[][] => {
const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
String(item.cityText??""),
String(item.sggText??""),
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
String(item.frstArchPrmsnDt ?? ""),
String(item.reuseBuilding?.[0]?.htdflObj.etgtType ?? ""),
String(item.reuseBuilding?.[0]?.htdflObj.fclCpct ?? ""), // fix: added missing parenthesis
String(item.reuseBuilding?.[0]?.htdflObj.plwtYn ? "Y" :"N"), // fix: added missing parenthesis
String(item.reuseBuilding?.[0]?.htdflObj.plwtYn ? "Y" : "N"), // fix: added missing parenthesis
String(item.reuseBuilding?.[0]?.htdflObj.orgwtWtritSpt ?? ""), // fix: added missing parenthesis
String(item.reuseBuilding?.[0]?.htdflObj.wtritEntrcTp ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj.orgwtOcrnProcs ?? ""), // fix: removed as it doesn't exist in the provided context
String( item.reuseBuilding?.[0]?.htdflObj?.amtgnr ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.amtgnr ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.prcsProcsYn ?? ""), // fix: removed as it doesn't exist in the provided context
String( '컬럼확인'), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.prcsFcltCpct ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.fmYn ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.utztnCpct ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.utztnUsg ?? ""), // fix: removed as it doesn't exist in the provided context
String(item.reuseBuilding?.[0]?.htdflObj?.emsnExitTp ?? ""), // fix: removed as it doesn't exist in the provided context
]);
});
return excelExportData;
]);
});
return excelExportData;
};
@@ -70,13 +70,6 @@ export const htdflSttHeadListExport: z.infer<typeof sttnHeadListType> = [
title: "처리공정여부",
visible: true,
},
{
id: "prcsProcstest",
title: "처리공정여부??",
visible: true,
},
{
id: "prcsFcltCpct",
title: "처리시설용량(m³)",
@@ -259,36 +252,15 @@ export const htdflSttNodeListExport: CommonTableProps[] = [
rowSpan: 2,
colSpan: 1,
},
{
id: "prcsProcs",
title: "처리공정",
upName: "htdflMngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 2,
},
{
id: "prcsProcsYn",
title: "처리공정여부",
upName: "prcsProcs",
visible: true,
row: 3,
rowSpan: 1,
row: 2,
rowSpan: 2,
colSpan: 1,
},
{
id: "prcsProcstest",
title: "처리공정여부??",
upName: "prcsProcs",
visible: true,
row: 3,
rowSpan: 1,
colSpan: 1,
},
{
id: "prcsFcltCpct",
title: "처리시설용량(m³)",
@@ -1,18 +1,23 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { customRainBdst } from "../../fcltReg/rainReg";
export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => {
export const excelRainSttnParsing = (
data: customRainBdst[],
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
): string[][] => {
const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
String(item.ctpvCd),
String(item.sggCd),
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
String(item.bdstInfoPk ?? ""),
String(item.frstArchPrmsnDt ?? ""),
String(item.archArea ?? ""),
String(item.chgBuilding.length>0 ? "Y" :"N"),
String(item.chgBuilding.length > 0 ? "Y" : "N"),
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""),
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""),
String(item.reuseBuilding?.[0]?.instlCst ?? ""),
@@ -28,8 +33,8 @@ export const excelRainSttnParsing = (data: customRainBdst[]): string[][] => {
String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""),
String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""),
String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "")
]);
});
return excelExportData;
]);
});
return excelExportData;
};
@@ -13,6 +13,7 @@ import {
} from "./headList";
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/header";
import type { SelectDataType } from "@common/business_components/ui";
// 테이블 헤드 리스트
const rainSttHeadList = rainSttHeadListExport;
@@ -101,7 +102,7 @@ export type rainSttnState = {
};
type rainSttnActions = {
rainSttnInit:(con:string) => void
rainSttnSearch: (page: number, total: string, con: string) => void;
rainSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], sggCode: SelectDataType[]) => void;
rainChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -148,14 +149,16 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
console.log(e)
}
},
rainSttnSearch: async (page: number, total: string, con: string) => {
rainSttnSearch: async (page: number, total: string, con: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
try {
const rainSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/rainyInfoList/${page}/${total}/${con}`
);
if (Number(total) > 9000) {
const rainExcel = excelRainSttnParsing(rainSttnRes);
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
set((state: rainSttnState) => {
return {
...state,
@@ -1,19 +1,25 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { customRswtBdst } from "../../fcltReg/rswtReg";
import { useWrStore } from "@/app/store";
export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => {
export const excelRSwtSttnParsing = (
data: customRswtBdst[],
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
): string[][] => {
const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
String(item.ctpvCd),
String(item.sggCd),
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
String(item.bdstUsgText ?? ""),
String(item.frstArchPrmsnDt ?? ""),
String(item.archArea ?? ""),
String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
String(item.chgBuilding.length>0 ? "Y" :"N"), //중축・개축・재축여부
String(item.chgBuilding.length > 0 ? "Y" : "N"), //중축・개축・재축여부
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), //법적의무대상여부
String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), //의무대상물사용량
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시
@@ -28,7 +34,7 @@ export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => {
String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""),
String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""),
String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "")
]);
});
return excelExportData;
]);
});
return excelExportData;
};
@@ -6,6 +6,7 @@ import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
import { excelRSwtSttnParsing } from "./excel";
import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList";
import type { SelectDataType } from "@common/business_components/ui";
@@ -26,11 +27,10 @@ export type rswtSttnState = {
};
};
type rswtSttnActions = {
rswtSttnInit: (con: string) => void;
rswtSttnSearch: (page: number, total: string, con: string) => void;
rswtSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rswtChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -38,8 +38,6 @@ type rswtSttnActions = {
export type rswtSttnType = rswtSttnState & rswtSttnActions;
export const rswtSttnStateExport: rswtSttnState = {
rswtSttn: {
rswtSttHeadList: rswtSttHeadList,
@@ -77,14 +75,16 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
console.log(e)
}
},
rswtSttnSearch: async (page: number, total: string, con: string) => {
rswtSttnSearch: async (page: number, total: string, con: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
try {
const rswtSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/waterreuseFc/${page}/${total}/${con}`
);
if (Number(total) > 9000) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes);
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
set((state: rswtSttnState) => {
return {
...state,