From ed4279d32188f4a37623f18fc89bd4310bb8013f Mon Sep 17 00:00:00 2001 From: swcho Date: Fri, 25 Jul 2025 18:31:09 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20SearchModal=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx index cd8b76af7..cc94a7251 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx +++ b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx @@ -167,6 +167,7 @@ const SearchModal: React.FC = ({ // 페이지 변경 시마다 데이터 fetch useEffect(() => { // showTable이 true일 때만 fetch (최초 렌더 방지) + setIsResetPage(false); if (showTable) fetchFilteredData(); }, [curPage]); @@ -488,7 +489,7 @@ const SearchModal: React.FC = ({ const handleSearch = () => { // setCurPage(1); // 페이지를 1로 초기화 // setDetailCurPage(1); // 페이지를 1로 초기화 - // setIsResetPage(true); // 페이지를 초기화 + // setIsResetPage(false); // 페이지를 초기화 // setIsResetDetailPage(true); // 디테일 페이지를 초기화 // setIsResetSelection(true); // 선택 초기화 // setIsResetDetailSelection(true); // 선택 초기화 @@ -701,7 +702,7 @@ const SearchModal: React.FC = ({ total={tableCount} cellClick={activeTab === 'report' ? handleReportCellClick : handleBasicCellClick} onPageChange={setCurPage} - resetPageNo={true} + resetPageNo={isResetPage} resetSelection={isResetSelection} /> From e8da4ac531db2a59de116de2546fed1d276221eb Mon Sep 17 00:00:00 2001 From: swcho Date: Fri, 25 Jul 2025 18:50:12 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=ED=95=98=EC=88=98=EA=B4=80=EB=A7=9D?= =?UTF-8?q?=EB=8F=84,=20I/I=20=EB=B6=84=EC=84=9D,=20=EC=9A=B4=EC=98=81?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/searchModal/searchModal.tsx | 4 +-- .../(with-base-layout)/ii/rdiiResult/page.tsx | 16 ++++++++-- .../app/(with-base-layout)/ii/result/page.tsx | 15 +++++++-- .../(with-base-layout)/oper/floodPre/page.tsx | 31 ++++++++++++++----- .../(with-base-layout)/oper/oldPp/page.tsx | 30 +++++++++++++----- 5 files changed, 72 insertions(+), 24 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx index cc94a7251..749edfb38 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx +++ b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx @@ -168,13 +168,13 @@ const SearchModal: React.FC = ({ useEffect(() => { // showTable이 true일 때만 fetch (최초 렌더 방지) setIsResetPage(false); + setIsResetDetailPage(true); if (showTable) fetchFilteredData(); }, [curPage]); // 페이지 변경 시마다 데이터 fetch useEffect(() => { - setIsResetSelection(true); - setIsResetDetailSelection(true); + setIsResetDetailSelection(false); // showTable이 true일 때만 fetch (최초 렌더 방지) if (showTable) { handleOperationPageNation(Number(detailBizId)); diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index fa06087bb..ebed464d0 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -84,6 +84,7 @@ const Result = () => { const [isLoadingResult, setIsLoadingResult] = useState(false); // 로딩 상태 const [selectedRowData, setSelectedRowData] = useState(null); const [resetSelection, setResetSelection] = useState(false); + const [isResetPage, setIsResetPage] = useState(false); const [curPage, setCurPage] = useState(1); // 현재 페이지 useEffect(() => { @@ -91,10 +92,18 @@ const Result = () => { handleSearchButtonClick(); }, []) + // 페이지 변경 시마다 데이터 fetch useEffect(() => { - // setCurPage(1); + setIsResetPage(false); handleSearchButtonClick(); - }, [curPage]) + }, [curPage]); + + // 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화 + const handleSearch: () => Promise = async () => { + setCurPage(1); // 페이지를 1로 초기화 + setIsResetPage(true); // 페이지를 초기화 + await handleSearchButtonClick(); + }; const handleSearchButtonClick = async () => { @@ -272,7 +281,7 @@ const Result = () => { return ( { }} // BaseLayout의 form 태그에 연결될 onSubmit @@ -310,6 +319,7 @@ const Result = () => { cellClick={handleCellClick} onPageChange={setCurPage} resetSelection={resetSelection} + resetPageNo={isResetPage} /> diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index d6084e95e..ad21e9cca 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -81,6 +81,7 @@ const Result = () => { const [isLoadingResult, setIsLoadingResult] = useState(false); // 로딩 상태 const [selectedRowData, setSelectedRowData] = useState(null); const [resetSelection, setResetSelection] = useState(false); + const [isResetPage, setIsResetPage] = useState(false); const [curPage, setCurPage] = useState(1); // 현재 페이지 useEffect(() => { @@ -90,9 +91,17 @@ const Result = () => { // 페이지 변경 시마다 데이터 fetch useEffect(() => { + setIsResetPage(false); handleSearchButtonClick(); }, [curPage]); + // 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화 + const handleSearch: () => Promise = async () => { + setCurPage(1); // 페이지를 1로 초기화 + setIsResetPage(true); // 페이지를 초기화 + await handleSearchButtonClick(); + }; + const handleSearchButtonClick = async () => { setIsLoadingResult(true); setResetSelection(true); @@ -253,7 +262,7 @@ const Result = () => { // 테이블 선택 상태 초기화 트리거 setResetSelection(true); - + // 검색 버튼 클릭 이벤트 트리거 await handleSearchButtonClick(); @@ -270,10 +279,9 @@ const Result = () => { }; - return ( { }} // BaseLayout의 form 태그에 연결될 onSubmit @@ -311,6 +319,7 @@ const Result = () => { cellClick={handleCellClick} onPageChange={setCurPage} resetSelection={resetSelection} + resetPageNo={isResetPage} /> diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 432a9de5a..4d1c0fbe8 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -27,6 +27,25 @@ const Page = () => { const [isLoading, setIsLoading] = useState(true) //로딩 상태 const [isModalOpen, setIsModalOpen] = useState(false) // 모달 상태 const [resetSelection, setResetSelection] = useState(false); // 선택 초기화 상태 + const [isResetPage, setIsResetPage] = useState(false); + + useEffect(() => { + setCurPage(1) + fetchData() + }, []) + + // 페이지 변경 시마다 데이터 fetch + useEffect(() => { + setIsResetPage(false); + fetchData(); + }, [curPage]); + + // 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화 + const handleSearch: () => Promise = async () => { + setCurPage(1); // 페이지를 1로 초기화 + setIsResetPage(true); // 페이지를 초기화 + await fetchData(); + }; // 조회 const fetchData = async () => { @@ -60,11 +79,6 @@ const Page = () => { } } - useEffect(() => { - setCurPage(1) - fetchData() - }, []) - // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -106,7 +120,7 @@ const Page = () => { if (data) { alert('파일이 등록되었습니다.'); setIsModalOpen(false); - fetchData(); + handleSearch(); } } @@ -160,7 +174,7 @@ const Page = () => {
- +
@@ -188,8 +202,9 @@ const Page = () => { setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} - onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + onPageChange={setCurPage} resetSelection={resetSelection} + resetPageNo={isResetPage} /> {/* 파일 업로드 모달 */} diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index af2e584f4..4f46aee91 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -25,6 +25,25 @@ const Page = () => { const [isLoading, setIsLoading] = useState(true) //로딩 상태 const [isModalOpen, setIsModalOpen] = useState(false) // 모달 상태 const [resetSelection, setResetSelection] = useState(false); // 선택 초기화 상태 + const [isResetPage, setIsResetPage] = useState(false); + + useEffect(() => { + setCurPage(1) + fetchData() + }, []) + + // 페이지 변경 시마다 데이터 fetch + useEffect(() => { + setIsResetPage(false); + fetchData(); + }, [curPage]); + + // 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화 + const handleSearch: () => Promise = async () => { + setCurPage(1); // 페이지를 1로 초기화 + setIsResetPage(true); // 페이지를 초기화 + await fetchData(); + }; // 데이터 조회 const fetchData = async () => { @@ -57,11 +76,6 @@ const Page = () => { } } - useEffect(() => { - setCurPage(1) - fetchData() - }, []) - // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -103,7 +117,7 @@ const Page = () => { if (data) { alert('파일이 등록되었습니다.'); setIsModalOpen(false); - fetchData(); + handleSearch(); } } @@ -155,7 +169,7 @@ const Page = () => {
- +
@@ -184,7 +198,7 @@ const Page = () => { setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn); } }} - onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + onPageChange={setCurPage} resetSelection={resetSelection} />