From a2504f4c85c1ed4073073d781204e2e812bb39ee Mon Sep 17 00:00:00 2001 From: ljpark Date: Thu, 29 Jan 2026 18:07:08 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fo:exceldown=EC=8B=9C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=20=ED=95=B4=EC=A0=9C=204=EA=B0=9C=ED=99=94=EB=A9=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityPrecipitation/page.tsx | 32 +++++++------- .../pages/(with-layout)/processArea/page.tsx | 32 +++++++------- .../(with-layout)/processFacility/page.tsx | 32 +++++++------- apps/fo/app/pages/(with-layout)/rdi/page.tsx | 43 ++++++++++--------- .../src/shared/providers/prompt-provider.tsx | 1 + 5 files changed, 72 insertions(+), 68 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx index 0f29a28c4..14d16810d 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx @@ -196,22 +196,22 @@ export default function FacilityPrecipitation() { // 엑셀다운로드 const excelDownload = useCallback((searchReturn: ReturnType) => { - if (ref.current.partValue === 'A') { // 행정별 - if (!ref.current.sidoValue || ref.current.sidoValue === '0') { - alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'R') { // 유역별 - if (!ref.current.regionValue || ref.current.regionValue === '0') { - alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'G') { // 환경청별 - if (!ref.current.envPartValue || ref.current.envPartValue === '0') { - alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); - return; - } - } + // if (ref.current.partValue === 'A') { // 행정별 + // if (!ref.current.sidoValue || ref.current.sidoValue === '0') { + // alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'R') { // 유역별 + // if (!ref.current.regionValue || ref.current.regionValue === '0') { + // alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'G') { // 환경청별 + // if (!ref.current.envPartValue || ref.current.envPartValue === '0') { + // alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } searchFacilityPrecipitation(searchReturn, 1, 10000); }, [searchFacilityPrecipitation]); diff --git a/apps/fo/app/pages/(with-layout)/processArea/page.tsx b/apps/fo/app/pages/(with-layout)/processArea/page.tsx index e3b6fc3da..371a1262d 100644 --- a/apps/fo/app/pages/(with-layout)/processArea/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processArea/page.tsx @@ -137,22 +137,22 @@ export default function ProcessArea() { }, [excelList]); const excelDownload = useCallback(() => { - if (ref.current.partValue === 'A') { // 행정별 - if (!ref.current.sidoValue || ref.current.sidoValue === '0') { - alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'R') { // 유역별 - if (!ref.current.regionValue || ref.current.regionValue === '0') { - alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'G') { // 환경청별 - if (!ref.current.envPartValue || ref.current.envPartValue === '0') { - alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); - return; - } - } + // if (ref.current.partValue === 'A') { // 행정별 + // if (!ref.current.sidoValue || ref.current.sidoValue === '0') { + // alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'R') { // 유역별 + // if (!ref.current.regionValue || ref.current.regionValue === '0') { + // alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'G') { // 환경청별 + // if (!ref.current.envPartValue || ref.current.envPartValue === '0') { + // alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } searchProcessArea(ref.current, 1, 10000); }, [searchProcessArea]); diff --git a/apps/fo/app/pages/(with-layout)/processFacility/page.tsx b/apps/fo/app/pages/(with-layout)/processFacility/page.tsx index b239970e0..9a6535db1 100644 --- a/apps/fo/app/pages/(with-layout)/processFacility/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processFacility/page.tsx @@ -236,22 +236,22 @@ export default function ProcessFacilitySearch() { } const excelDownload = useCallback(() => { - if (ref.current.partValue === 'A') { // 행정별 - if (!ref.current.sidoValue || ref.current.sidoValue === '0') { - alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'R') { // 유역별 - if (!ref.current.regionValue || ref.current.regionValue === '0') { - alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'G') { // 환경청별 - if (!ref.current.envPartValue || ref.current.envPartValue === '0') { - alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); - return; - } - } + // if (ref.current.partValue === 'A') { // 행정별 + // if (!ref.current.sidoValue || ref.current.sidoValue === '0') { + // alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'R') { // 유역별 + // if (!ref.current.regionValue || ref.current.regionValue === '0') { + // alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'G') { // 환경청별 + // if (!ref.current.envPartValue || ref.current.envPartValue === '0') { + // alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } searchFcltyList(ref.current, 1, 10000); }, [searchFcltyList]); diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index d166e01a3..63df65e13 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -90,7 +90,8 @@ export default function Rdi() { // 조회기간 const [searchYear, setSearchYear] = useState(defaultSearchYear); // 엑셀 다운로드 트리거 - const [isInitExcelDownload, setIsInitExcelDownload] = useState(false); + const [isExcelDownClick, setIsExcelDownClick] = useState(false); + const [initTrigger, setInitTrigger] = useState(false); /** @@ -118,7 +119,7 @@ export default function Rdi() { } useEffect(() => { - if(!isInitExcelDownload) return ; + if(!isExcelDownClick) return ; if (excelList && excelList.length > 0) { downloadExcel({ data: excelList as unknown as JSON[], @@ -126,8 +127,10 @@ export default function Rdi() { sheetNameArray: ['RDII추정'], headerRange: 'A1:R1' }); + } else { + alert("조회된 결과가 없습니다."); } - }, [excelList, isInitExcelDownload]); + }, [excelList, isExcelDownClick]); /** * 콜백함수 @@ -180,25 +183,25 @@ export default function Rdi() { // 엑셀다운로드 const excelDownload = useCallback(() => { - if (ref.current.partValue === 'A') { // 행정별 - if (!ref.current.sidoValue || ref.current.sidoValue === '0') { - alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'R') { // 유역별 - if (!ref.current.regionValue || ref.current.regionValue === '0') { - alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); - return; - } - } else if (ref.current.partValue === 'G') { // 환경청별 - if (!ref.current.envPartValue || ref.current.envPartValue === '0') { - alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); - return; - } - } + // if (ref.current.partValue === 'A') { // 행정별 + // if (!ref.current.sidoValue || ref.current.sidoValue === '0') { + // alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'R') { // 유역별 + // if (!ref.current.regionValue || ref.current.regionValue === '0') { + // alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } else if (ref.current.partValue === 'G') { // 환경청별 + // if (!ref.current.envPartValue || ref.current.envPartValue === '0') { + // alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.'); + // return; + // } + // } searchRdi(ref.current, 1, 5000); - setIsInitExcelDownload(true); + setIsExcelDownClick(true); }, [searchRdi]); // 페이지 변경 diff --git a/apps/fo/src/shared/providers/prompt-provider.tsx b/apps/fo/src/shared/providers/prompt-provider.tsx index 10338c338..7724d0326 100644 --- a/apps/fo/src/shared/providers/prompt-provider.tsx +++ b/apps/fo/src/shared/providers/prompt-provider.tsx @@ -1,3 +1,4 @@ +"use client"; import { createContext, useState } from "react"; interface PromptContext { From 527b0c65672927d495c61d3e170f01800287fdcd Mon Sep 17 00:00:00 2001 From: dongsilove Date: Thu, 29 Jan 2026 20:56:43 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fo:=20exceldownload=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EA=B0=80=20=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityPrecipitation/page.tsx | 28 ++++++++----- .../(with-layout)/facilityWaterQlty/page.tsx | 40 +++++++++++-------- .../app/pages/(with-layout)/flowRate/page.tsx | 1 + .../pages/(with-layout)/planSewage/page.tsx | 32 +++++++++------ .../pages/(with-layout)/processArea/page.tsx | 29 +++++++++----- .../(with-layout)/processFacility/page.tsx | 18 +++++++-- apps/fo/app/pages/(with-layout)/rdi/page.tsx | 26 +++++++----- .../pages/(with-layout)/sewageOccur/page.tsx | 1 + .../(with-layout)/underWaterInput/page.tsx | 1 + 9 files changed, 116 insertions(+), 60 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx index 14d16810d..4df912186 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx @@ -96,7 +96,8 @@ export default function FacilityPrecipitation() { const [operationValue, setOperationValue] = useState("0"); // 조회기간 const [searchYear, setSearchYear] = useState(defaultSearchYear); - + // 엑셀다운로드 트리거 + const [isExcelDownClick, setIsExcelDownClick] = useState(false); /** * 페이지 함수 */ @@ -144,14 +145,22 @@ export default function FacilityPrecipitation() { }, [isInit, initializeCommonData, searchFacilityPrecipitationList, defaultSearchYear]); useEffect(() => { - if (excelList && excelList.length > 0) { - downloadExcel({ - data: excelList as unknown as JSON[], - fileName: '시설별 강수현황', - sheetNameArray: ['시설별 강수현황'], - headerRange: 'A1:N1' - }); - } + if (!isExcelDownClick) return; + + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcel({ + data: excelList as unknown as JSON[], + fileName: '시설별 강수현황', + sheetNameArray: ['시설별 강수현황'], + headerRange: 'A1:N1' + }); + } else { + alert("조회된 결과가 없습니다."); + } + setIsExcelDownClick(false); + }, 500); + return () => clearTimeout(timer); }, [excelList]); useEffect(() => { @@ -213,6 +222,7 @@ export default function FacilityPrecipitation() { // } // } searchFacilityPrecipitation(searchReturn, 1, 10000); + setIsExcelDownClick(true); }, [searchFacilityPrecipitation]); // 페이지 변경 diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx index 0f8427458..1df3be0cd 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx @@ -54,7 +54,8 @@ export default function ProcessFacilitySearch() { const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || []; const [initTrigger, setInitTrigger] = useState(false); - const [excelTrigger, setExcelTrigger] = useState(false); + // 엑셀다운로드 트리거 + const [isExcelDownClick, setIsExcelDownClick] = useState(false); // 그리드 관련 const [resetPage, setResetPage] = useState(false); const searchInputRef = useRef(null); @@ -152,21 +153,28 @@ export default function ProcessFacilitySearch() { }, [isInit, initializeCommonData, searchFacilityWaterQltyList, searchFcltyQltyList, initTrigger]); useEffect(() => { - if (!excelTrigger) return; + if (!isExcelDownClick) return; - if (excelList && excelList.length > 0) { - downloadExcelFormat( - { - data: excelList as unknown as JSON[], - fileName: '시설별 수질현황', - sheetNameArray: ['시설별 수질현황'], - headerRange: 'A1:T1', - decimalArray1: [10, 11, 12, 15, 16, 17], - decimalArray3: [13, 14, 18, 19] - } - ); - } - }, [excelList, excelTrigger]); + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcelFormat( + { + data: excelList as unknown as JSON[], + fileName: '시설별 수질현황', + sheetNameArray: ['시설별 수질현황'], + headerRange: 'A1:T1', + decimalArray1: [10, 11, 12, 15, 16, 17], + decimalArray3: [13, 14, 18, 19] + } + ); + } else { + alert("조회된 결과가 없습니다."); + } + setIsExcelDownClick(false); + }, 500); + + return () => clearTimeout(timer); + }, [excelList, isExcelDownClick]); const chkVal = useCallback((returntype: ReturnType) => { // setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]") @@ -192,7 +200,7 @@ export default function ProcessFacilitySearch() { } } - setExcelTrigger(true); + setIsExcelDownClick(true); searchFcltyQltyList(ref.current, 1, 10000); }, [searchFcltyQltyList]); diff --git a/apps/fo/app/pages/(with-layout)/flowRate/page.tsx b/apps/fo/app/pages/(with-layout)/flowRate/page.tsx index c80d46699..66b8c990d 100644 --- a/apps/fo/app/pages/(with-layout)/flowRate/page.tsx +++ b/apps/fo/app/pages/(with-layout)/flowRate/page.tsx @@ -160,6 +160,7 @@ export default function ProcessFacilitySearch() { } else { alert('조회된 결과가 없습니다.'); } + setIsExcelDownClick(false); }, 1000); // 약간의 지연을 두고 다운로드 실행 return () => clearTimeout(timer); }, [excelList, isExcelDownClick]); diff --git a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx index 41b541ce9..fca74757c 100644 --- a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx +++ b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx @@ -93,8 +93,9 @@ export default function PlanSewage() { const [searchYear, setSearchYear] = useState(defaultSearchYear); const [initTrigger, setInitTrigger] = useState(false); + // 엑셀다운로드 트리거 + const [isExcelDownClick, setIsExcelDownClick] = useState(false); - const [excelTrigger, setExcelTrigger] = useState(false); /** * 페이지 함수 */ @@ -119,17 +120,24 @@ export default function PlanSewage() { } useEffect(() => { - if (!excelTrigger) return; + if (!isExcelDownClick) return; - if (excelList && excelList.length > 0) { - downloadExcel({ - data: excelList as unknown as JSON[], - fileName: '계획하수량 산정지표 현황', - sheetNameArray: ['계획하수량 산정지표 현황'], - headerRange: 'A1:M1' - }); - } - }, [excelList, excelTrigger]); + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcel({ + data: excelList as unknown as JSON[], + fileName: '계획하수량 산정지표 현황', + sheetNameArray: ['계획하수량 산정지표 현황'], + headerRange: 'A1:M1' + }); + } else { + alert("조회된 결과가 없습니다."); + } + setIsExcelDownClick(false); + }, 500); + + return () => clearTimeout(timer); + }, [excelList, isExcelDownClick]); /** * 콜백함수 @@ -201,7 +209,7 @@ export default function PlanSewage() { } searchPlanSewage(searchReturn, 1, 10000); - setExcelTrigger(true); + setIsExcelDownClick(true); }, [searchPlanSewage]); // 페이지 변경 diff --git a/apps/fo/app/pages/(with-layout)/processArea/page.tsx b/apps/fo/app/pages/(with-layout)/processArea/page.tsx index 371a1262d..00ce67077 100644 --- a/apps/fo/app/pages/(with-layout)/processArea/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processArea/page.tsx @@ -70,6 +70,8 @@ export default function ProcessArea() { const [resetPage, setResetPage] = useState(false); const [searchYearValue, setSearchYearValue] = useState(defaultSearchYear); + + const [isExcelDownClick, setIsExcelDownClick] = useState(false); const ref = useRef({ partValue: '', @@ -126,15 +128,23 @@ export default function ProcessArea() { }, [isInit, initializeCommonData, searchProcessAreaList, defaultSearchYear]); useEffect(() => { - if (excelList && excelList.length > 0) { - downloadExcel({ - data: excelList as unknown as JSON[], - fileName: '처리구역정보', - sheetNameArray: ['처리구역정보'], - headerRange: 'A1:W1' - }); - } - }, [excelList]); + if(!isExcelDownClick) return; + + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcel({ + data: excelList as unknown as JSON[], + fileName: '처리구역정보', + sheetNameArray: ['처리구역정보'], + headerRange: 'A1:W1' + }); + } else { + alert('조회된 결과가 없습니다.'); + } + setIsExcelDownClick(false); + }, 500); // 약간의 지연을 두고 다운로드 실행 + return () => clearTimeout(timer); + }, [excelList, isExcelDownClick]); const excelDownload = useCallback(() => { // if (ref.current.partValue === 'A') { // 행정별 @@ -155,6 +165,7 @@ export default function ProcessArea() { // } searchProcessArea(ref.current, 1, 10000); + setIsExcelDownClick(true); }, [searchProcessArea]); const handlePageChange = useCallback((pageNo: number) => { diff --git a/apps/fo/app/pages/(with-layout)/processFacility/page.tsx b/apps/fo/app/pages/(with-layout)/processFacility/page.tsx index 9a6535db1..fdc70433e 100644 --- a/apps/fo/app/pages/(with-layout)/processFacility/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processFacility/page.tsx @@ -89,6 +89,7 @@ export default function ProcessFacilitySearch() { const [partValue, setPartValue] = useState("A"); // const [widthSize, setWidthSize] = useState("w-[120%]"); const [upHeadList, setUpheadList] = useState(upHeadList1); + const [isExcelDownClick, setIsExcelDownClick] = useState(false); /** * 모달 상태 변수 @@ -150,10 +151,18 @@ export default function ProcessFacilitySearch() { }, [partValue, upHeadList1, upHeadList2, upHeadList3]); useEffect(() => { - if (excelList && excelList.length > 0) { - downloadExcel({ data: excelList as unknown as JSON[], fileName: '처리시설 시설정보', sheetNameArray: ['처리시설 시설정보'], headerRange: 'A1:P1' }); - } - }, [excelList]); + if(!isExcelDownClick) return; + + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcel({ data: excelList as unknown as JSON[], fileName: '처리시설 시설정보', sheetNameArray: ['처리시설 시설정보'], headerRange: 'A1:P1' }); + } else { + alert('조회된 결과가 없습니다.'); + } + setIsExcelDownClick(false); + }, 500); // 약간의 지연을 두고 다운로드 실행 + return () => clearTimeout(timer); + }, [excelList, isExcelDownClick]); const searchFcltyList = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=10) => { let nameCd, partStr @@ -254,6 +263,7 @@ export default function ProcessFacilitySearch() { // } searchFcltyList(ref.current, 1, 10000); + setIsExcelDownClick(true); }, [searchFcltyList]); // 모달 닫기 diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index 63df65e13..03d4017bc 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -120,16 +120,22 @@ export default function Rdi() { useEffect(() => { if(!isExcelDownClick) return ; - if (excelList && excelList.length > 0) { - downloadExcel({ - data: excelList as unknown as JSON[], - fileName: 'RDII추정', - sheetNameArray: ['RDII추정'], - headerRange: 'A1:R1' - }); - } else { - alert("조회된 결과가 없습니다."); - } + + const timer = setTimeout(() => { + if (excelList && excelList.length > 0) { + downloadExcel({ + data: excelList as unknown as JSON[], + fileName: 'RDII추정', + sheetNameArray: ['RDII추정'], + headerRange: 'A1:R1' + }); + } else { + alert("조회된 결과가 없습니다."); + } + setIsExcelDownClick(false); + }, 500); // 약간의 지연을 두고 다운로드 실행 + + return () => clearTimeout(timer); }, [excelList, isExcelDownClick]); /** diff --git a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx index a7ff0df71..4d3578314 100644 --- a/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx +++ b/apps/fo/app/pages/(with-layout)/sewageOccur/page.tsx @@ -162,6 +162,7 @@ export default function PlanSewage() { } else { alert("조회된 결과가 없습니다."); } + setIsExcelDownClick(false); }, 500); // 약간의 지연을 두고 다운로드 실행 return () => clearTimeout(timer); diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx index 849689312..d03053520 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx @@ -167,6 +167,7 @@ export default function UnderWaterInput() { } else { alert("조회된 결과가 없습니다."); } + setIsExcelDownClick(false); }, 1000); // 약간의 지연을 두고 다운로드 실행 return () => clearTimeout(timer); }, [excelList, isExcelDownClick]); From 1aaa8fcd6b10b7411ae5365d91e0c3e6435b605a Mon Sep 17 00:00:00 2001 From: dongsilove Date: Thu, 29 Jan 2026 21:25:40 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fo:=20pagination=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/facilityWaterQlty/index.tsx | 26 ++++++++----- apps/fo/app/store/flowRate/index.tsx | 37 +++++++++++-------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 4a08b429a..1a3508597 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -466,16 +466,22 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions //--------- const waterQltyList: any[] = []; let recordCount = 0; - for (let idx = 0; idx < pageSize; idx += 100) { - const tmpPageNo = Math.floor(idx / 100) + 1; - const tmpPageSize = Math.min(100, pageSize - idx); - const result = await fetchFacilityWaterQltyList(tmpPageNo, tmpPageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); - if (result?.status === 200 && Array.isArray(result?.data)) { - waterQltyList.push(...result.data); - } - recordCount = result?.count || 0; - if (result?.count < tmpPageNo * tmpPageSize) { - break; // 더 이상 데이터가 없으면 중지 + if (pageSize < 5000) { + const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); + waterQltyList.push(...res.data); + recordCount = res.count; + } else { + for (let idx = 0; idx < pageSize; idx += 100) { + const tmpPageNo = Math.floor(idx / 100) + 1; + const tmpPageSize = Math.min(100, pageSize - idx); + const result = await fetchFacilityWaterQltyList(tmpPageNo, tmpPageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); + if (result?.status === 200 && Array.isArray(result?.data)) { + waterQltyList.push(...result.data); + } + recordCount = result?.count || 0; + if (result?.count < tmpPageNo * tmpPageSize) { + break; // 더 이상 데이터가 없으면 중지 + } } } //------- diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index 232755c1d..9bca32518 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -285,23 +285,30 @@ export const flowRateSearchReducer: (set: (fn: (state: FlowRateSearchType) => Fl //--------- const flowRateList: any[] = []; const results: any[] = []; - for (let idx = 0; idx < pageSize; idx += 100) { - const tmpPageNo = Math.floor(idx / 100) + 1; - const tmpPageSize = Math.min(100, pageSize - idx); - const result = await fetchFlowRateList( tmpPageNo, tmpPageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); - results.push(result); - if (result?.count < tmpPageNo * tmpPageSize) { - break; // 더 이상 데이터가 없으면 중지 - } - } - console.log(results); - // 결과를 합치기 - - for (const res of results) { - if (res?.status === 200 && Array.isArray(res?.data)) { - flowRateList.push(...res.data); + if (pageSize < 5000) { + const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); + flowRateList.push(...res.data); + results.push(res); + } else { + for (let idx = 0; idx < pageSize; idx += 100) { + const tmpPageNo = Math.floor(idx / 100) + 1; + const tmpPageSize = Math.min(100, pageSize - idx); + const result = await fetchFlowRateList( tmpPageNo, tmpPageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); + results.push(result); + if (result?.count < tmpPageNo * tmpPageSize) { + break; // 더 이상 데이터가 없으면 중지 + } + } + // console.log(results); + // 결과를 합치기 + + for (const res of results) { + if (res?.status === 200 && Array.isArray(res?.data)) { + flowRateList.push(...res.data); + } } } + //--------- const recordCount = results[0]?.count || 0; //-------