From 236572370ab7439f5863b7a7041ab432258683bd Mon Sep 17 00:00:00 2001 From: jsyang Date: Mon, 27 Oct 2025 20:52:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityWaterQlty/modal/page.tsx | 100 ++++++++++++------ apps/fo/app/pages/(with-layout)/rdi/page.tsx | 6 +- .../pages/(with-layout)/sewageOccur/page.tsx | 4 +- .../(with-layout)/underWaterInput/page.tsx | 8 +- apps/fo/app/store/facilityWaterQlty/index.tsx | 8 ++ apps/fo/app/store/rdi/index.tsx | 13 ++- apps/fo/app/store/sewageOccur/index.tsx | 7 +- apps/fo/app/store/underWaterInput/index.tsx | 5 +- 8 files changed, 96 insertions(+), 55 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx index e76778d89..c10fd50cf 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx @@ -9,7 +9,7 @@ import CommaToNumber from "@/app/components/common/CommaToNumber"; import { roundNumber } from "@/app/components/common/DataForm"; import UnderComment from "@/app/components/common/UnderComment"; import { useFoStore } from "@/app/store"; -import type { FacilityWaterQltyProps, modalExcelType } from "@/app/store/facilityWaterQlty"; +import type { FacilityWaterQltyProps, modalChoinginExcelType, modalExcelType } from "@/app/store/facilityWaterQlty"; import { downloadExcelFormat, UITab, UiTable } from "@common/business_components/ui"; import { Button, TabsContent } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; @@ -51,6 +51,8 @@ const tabList3 = [ ]; export default function WaterQualityModal({fcltyName='', facilityCd='', searchYear=new Date().getFullYear().toString()} : ModalProps) { + const [tabName, setTabName] = useState('tab_num1'); + // 그리드 관련 const {FacilityWaterQltyModal, searchFacilityWaterQltyListHist, @@ -68,6 +70,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe } = FacilityWaterQltyModal; const prevExcelListRef = useRef(null); + const prevChoinginExcelListRef = useRef(null); // 필터링 된 후 최대, 최소, 평균 값 계산 const setFilterAfterData = (filteredData: FacilityWaterQltyProps[]) => { @@ -351,43 +354,76 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe }, []); const excelDownload = () => { - const excelDownList: modalExcelType[] = []; - if(copyYearList.length > 0){ - copyYearList.forEach((item) => { - excelDownList.push({ - 날짜: item.msrDt, - "유입BOD(mg/L)": CommaToNumber(item.inflAssctBfrWqltBod), - "유입TOC(COD)(mg/L)": CommaToNumber(item.inflAssctBfrWqltToc), - "유입SS(mg/L)": CommaToNumber(item.inflAssctBfrWqltSs), - "유입TN(mg/L)": CommaToNumber(item.inflAssctBfrWqltTn), - "유입TP(mg/L)": CommaToNumber(item.inflAssctBfrWqltTp), - "유출BOD(mg/L)": CommaToNumber(item.efflWqltBod), - "유출TOC(COD)(mg/L)": CommaToNumber(item.efflWqltToc), - "유출SS(mg/L)": CommaToNumber(item.efflWqltSs), - "유출TN(mg/L)": CommaToNumber(item.efflWqltTn), - "유출TP(mg/L)": CommaToNumber(item.efflWqltTp), - "강우량(mm/일)": CommaToNumber(item.infoRnDay?item.infoRnDay.toString():"0.0"), + + if(tabName === 'tab_num1'){ + const excelDownList: modalExcelType[] = []; + if(copyYearList.length > 0){ + copyYearList.forEach((item) => { + excelDownList.push({ + 날짜: item.msrDt, + "유입BOD(mg/L)": CommaToNumber(item.inflAssctBfrWqltBod), + "유입TOC(COD)(mg/L)": CommaToNumber(item.inflAssctBfrWqltToc), + "유입SS(mg/L)": CommaToNumber(item.inflAssctBfrWqltSs), + "유입TN(mg/L)": CommaToNumber(item.inflAssctBfrWqltTn), + "유입TP(mg/L)": CommaToNumber(item.inflAssctBfrWqltTp), + "유출BOD(mg/L)": CommaToNumber(item.efflWqltBod), + "유출TOC(COD)(mg/L)": CommaToNumber(item.efflWqltToc), + "유출SS(mg/L)": CommaToNumber(item.efflWqltSs), + "유출TN(mg/L)": CommaToNumber(item.efflWqltTn), + "유출TP(mg/L)": CommaToNumber(item.efflWqltTp), + "강우량(mm/일)": CommaToNumber(item.infoRnDay?item.infoRnDay.toString():"0.0"), + }); }); - }); - } - if (excelDownList && excelDownList.length > 0) { - downloadExcelFormat( - { data: JSON.parse(JSON.stringify(excelDownList)) - , fileName: searchYear+'년 '+fcltyName + ' 수질현황' - , sheetNameArray: [fcltyName + ' 수질현황'] - , headerRange: 'A1:L1' - , decimalArray1: [1,2,3,6,7,8,11] - , decimalArray3: [4,5,9,10] + } + if (excelDownList && excelDownList.length > 0) { + downloadExcelFormat( + { data: JSON.parse(JSON.stringify(excelDownList)) + , fileName: searchYear+'년 '+fcltyName + ' 수질현황' + , sheetNameArray: [fcltyName + ' 수질현황'] + , headerRange: 'A1:L1' + , decimalArray1: [1,2,3,6,7,8,11] + , decimalArray3: [4,5,9,10] + }); + } else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) { + alert('다운받을 데이터가 없습니다.'); + } + prevExcelListRef.current = excelDownList; + }else{ + const excelDownList: modalChoinginExcelType[] = []; + if(chongInWaterQltyYearList.length > 0){ + chongInWaterQltyYearList.forEach((item) => { + excelDownList.push({ + 날짜: item.msrDt, + "유입BOD(mg/L)": CommaToNumber(item.tpInflWqltBod), + "유입TP(mg/L)": CommaToNumber(item.tpInflWqltTp), + "유출BOD(mg/L)": CommaToNumber(item.efflWqltBod), + "유출TP(mg/L)": CommaToNumber(item.efflWqltTn), + }); }); - } else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) { - alert('다운받을 데이터가 없습니다.'); + } + if (excelDownList && excelDownList.length > 0) { + downloadExcelFormat( + { data: JSON.parse(JSON.stringify(excelDownList)) + , fileName: searchYear+'년 '+fcltyName + ' 총인설비수질현황' + , sheetNameArray: [fcltyName + ' 총인설비수질현황'] + , headerRange: 'A1:E1' + , decimalArray1: [1,3] + , decimalArray3: [2,4] + }); + } else if (prevChoinginExcelListRef.current && prevChoinginExcelListRef.current.length > 0) { + alert('다운받을 데이터가 없습니다.'); + } + prevChoinginExcelListRef.current = excelDownList; } - prevExcelListRef.current = excelDownList; } + useEffect(() => { + setTabName("tab_num1"); + }, []); + return ( <> - + setTabName(value)}> @@ -555,7 +591,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe {/* 총인설비 수질현황 */} - + diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index 51670c38c..c2109ad6a 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -126,7 +126,7 @@ export default function Rdi() { data: excelList as unknown as JSON[], fileName: 'RDII추정', sheetNameArray: ['RDII추정'], - headerRange: 'A1:O1' + headerRange: 'A1:R1' }); } }, [excelList, isInitExcelDownload]); @@ -167,9 +167,9 @@ export default function Rdi() { // 엑셀다운로드 const excelDownload = useCallback(() => { - searchRdi(ref.current, 1, rdiCount); + searchRdi(ref.current, 1, 5000); setIsInitExcelDownload(true); - }, [searchRdi, rdiCount]); + }, [searchRdi]); // 페이지 변경 const handlePageChange = useCallback((page: number) => { diff --git a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx index 24b03ccc9..e7bae003f 100644 --- a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx +++ b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx @@ -196,9 +196,9 @@ export default function PlanSewage() { // 엑셀다운로드 const excelDownload = useCallback(() => { - searchFacilityPrecipitation(ref.current, 1, sewageOccurCount); + searchFacilityPrecipitation(ref.current, 1, 5000); setIsInitExcelDownload(true); - }, [searchFacilityPrecipitation, sewageOccurCount]); + }, [searchFacilityPrecipitation]); // 페이지 변경 const handlePageChange = useCallback((page: number) => { diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx index ede01fadd..442c9467f 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx @@ -151,7 +151,7 @@ export default function UnderWaterInput() { data: excelList as unknown as JSON[], fileName: '지하수유입량 추정', sheetNameArray: ['지하수유입량 추정'], - headerRange: 'A1:V1' + headerRange: 'A1:O1' }); } }, 1000); // 약간의 지연을 두고 다운로드 실행 @@ -181,7 +181,7 @@ export default function UnderWaterInput() { } if (partStr.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) { searchUnderWaterList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); - } else { + } else { searchUnderWaterList(pageNo, pageCnt, searchYear); } }, [fcltCpct, operationValue, fcltyName, searchUnderWaterList, searchYear]); @@ -194,9 +194,9 @@ export default function UnderWaterInput() { // 엑셀다운로드 const excelDownload = useCallback(() => { - searchFacilityPrecipitation(ref.current, 1, underWaterCount); + searchFacilityPrecipitation(ref.current, 1, 5000); setIsMount(true); - }, [searchFacilityPrecipitation, underWaterCount]); + }, [searchFacilityPrecipitation]); // 페이지 변경 const handlePageChange = useCallback((page: number) => { diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index d0ddc6090..86da34144 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -118,6 +118,14 @@ export type modalExcelType = { "강우량(mm/일)": number | ''; } +export type modalChoinginExcelType = { + 날짜: string; + "유입BOD(mg/L)": number | ''; + "유입TP(mg/L)": number | ''; + "유출BOD(mg/L)": number | ''; + "유출TP(mg/L)": number | ''; +} + /**==================================== * Store - data ====================================*/ diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index cf0716c5f..6a6d9a1ef 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -260,7 +260,6 @@ export type RdiStore = RdiType & RdiActions; export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunction) => { return { resetExcelList: () => { - console.log('reset!!!!!'); set((state: RdiType) => ({ ...state, Rdi: { @@ -280,7 +279,7 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio })); const res = await fetchRdiList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); - if(pageSize>=res.count){ + if(pageSize>=5000){ set((state: RdiType) => ({ ...state, Rdi: { @@ -414,11 +413,11 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio item.summerMinBodValue = roundNumber(rtnSummerBod,1); item.inflAmnt = roundNumber(rtnSummerBodInfl.toString(), 0); - item.winterAvgBodLowRainfall = roundNumber(rtnWinterInflBod, 1); - item.rdiiValue = roundNumber(rtnRdiValue, 0); + item.winterAvgBodLowRainfall = rtnWinterInflBod?roundNumber(rtnWinterInflBod, 1):0; + item.rdiiValue = rtnRdiValue?roundNumber(rtnRdiValue, 0):0; item.infoRnDay = roundNumber(rtnRdiRain, 0); item.chungchunFlow = roundNumber(chungchunFlow, 0); - item.rainCalInflAmnt = roundNumber(Number(item.chungchunFlow.toString().replaceAll(',','')) + Number(item.rdiiValue.toString().replaceAll(',','')), 0); + item.rainCalInflAmnt = roundNumber(Number(item.chungchunFlow.toString().replaceAll(',','')) + Number(item.rdiiValue.toString().replaceAll(',','')), 0) || 0; item.properYn = Number(item.rainCalInflAmnt.toString().replaceAll(',','')) > Number(item.fctCpc.toString().replaceAll(',','')) ? '초과유입' : '적정'; } @@ -427,7 +426,7 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio dataFormSetting(item); }) - if(pageSize>=res.count){ + if(pageSize>=5000){ rtnData.forEach((item: RdiProps) => { excelDownList.push({ 시설코드: item.bscFctCd, @@ -453,7 +452,7 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio } set((state: RdiType) => ({ ...state, - Rdi: pageSizeSewageOccurActions=(set: any) => { return { searchSewageOccurList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const facilityInitData = await fetchFacilityListInit(pageNo, pageSize, part, nameCd, fcltCpct, operationValue, fcltyNm); - if(pageSize < facilityInitData.count){ + if(pageSize < 5000){ set((state: SewageOccurType) => ({ ...state, SewageOccur: { ...state.SewageOccur, - sewageOccurList : facilityInitData.data, + sewageOccurList : [], sewageOccurCount : facilityInitData.count, excelList : [], isLoading: true @@ -254,7 +254,6 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { } const fcltylist = facilityInitData.data; - const fcltyCount = facilityInitData.count; const calData = await processInBatches(fcltylist, 20, async (item: SewageOccurProps, index: number) => { const bscFctCd = item.bscFctCd; @@ -298,7 +297,7 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { return {...item, index:index}; }); - if(pageSize >= fcltyCount){ + if(pageSize >= 5000){ const excelDownList: ExcelType[] = []; calData.forEach((item: SewageOccurProps) => { excelDownList.push({ diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index dd4f7f6b0..0624886e9 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -291,7 +291,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy searchUnderWaterList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const facilityInitData = await fetchFacilityListInit(pageNo, pageSize, part, nameCd, fcltCpct, operationValue, fcltyNm); - if(pageSize < facilityInitData.count){ + if(pageSize < 5000){ set((state: UnderWaterType) => ({ ...state, UnderWater: { @@ -313,7 +313,6 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy } const fcltylist = facilityInitData.data; - const fcltyCount = facilityInitData.count; const calData = await processInBatches(fcltylist, 20, async (item: any, index: number) => { const bscFctCd = item.bscFctCd; @@ -369,7 +368,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy return {...item, index:index}; }); - if(pageSize>= fcltyCount){ + if(pageSize>= 5000){ const excelDownList: ExcelType[] = []; calData.forEach((item : any) => { dataFormSetting(item)