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 6ae0b3609..3578ff967 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -27,16 +27,16 @@ const Page = () => { const [curPage, setCurPage] = useState(1) //현재 페이지 const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + + // 조회 const fetchData = async () => { setIsLoading(true) - searchCmmnCd('SITEKNDCD') + // searchCmmnCd('SITEKNDCD') try { const { data, total } = await searchData('v1/sbmrgPrevnt', { fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, toRegDt: formatDate(toDate), - atflNm: pjNm, + sbmrgPrevntBizNm: pjNm, rgtrNm: usr, page: curPage - 1, size: '10' @@ -45,12 +45,18 @@ const Page = () => { setTotalData(total) } catch (error) { console.error('Error fetching data:', error) } - finally { setIsLoading(false); } + finally { + setFileNm(''); + setAtflId(''); + setSbmrgPrevntBizSn(''); + setIsLoading(false); + } } useEffect(() => { setCurPage(1) fetchData() }, []) + // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -59,6 +65,7 @@ const Page = () => { } handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) } + // 선택 파일 삭제 const isDeleteFile = async () => { if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) { @@ -96,11 +103,19 @@ const Page = () => { { if (date) setFromDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + /> ~ { if (date) setToDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + />
@@ -132,7 +147,23 @@ const Page = () => {
- { if (index != null) { const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}> + { + if (index != null) { + const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; + const id = tableData[index]?.atflId ?? ''; + setFileNm(fileName); + setAtflId(id); + setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); + } + }} + onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + /> { await registFile(file, year, quater, cd, id) }} /> 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 307452e2d..c4bac35b7 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -25,14 +25,13 @@ const Page = () => { const [curPage, setCurPage] = useState(1) const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + // 데이터 조회 const fetchData = async () => { setIsLoading(true) try { const { data, total } = await searchData('v1/dcrpPpl', { fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, toRegDt: formatDate(toDate), dcrpPplMtncBizNm: pjNm, rgtrNm: usr, @@ -44,12 +43,18 @@ const Page = () => { console.log(data, total) } catch (error) { console.error('Error fetching data:', error) - } finally { setIsLoading(false) } + } finally { + setFileNm(''); + setAtflId(''); + setDcrpPplMtncBizSn(''); + setIsLoading(false) + } } useEffect(() => { setCurPage(1) fetchData() }, []) + // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -59,6 +64,7 @@ const Page = () => { handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) return true } + // 파일 삭제 const isDeleteFile = async () => { if (dcrpPplMtncBizSn === '' || dcrpPplMtncBizSn === undefined) { @@ -76,6 +82,7 @@ const Page = () => { } } } + // 파일 등록 const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => { const data = await postData('v1/dcrpPpl', { @@ -88,6 +95,8 @@ const Page = () => { }) if (data) { alert('파일이 등록되었습니다.'); fetchData() } } + + return ( <> @@ -98,11 +107,17 @@ const Page = () => { { if (date) setFromDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} /> ~ { if (date) setToDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} />
{
- { if (index != null) { const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn) } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}> + { + if (index != null) { + const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; + const id = tableData[index]?.atflId ?? ''; + setFileNm(fileName); + setAtflId(id); + setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn); + } + }} + onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + />
{ await registFile(file, year, quater, cd, id) }} />