필요없는 코드 및 파일 제거
This commit is contained in:
@@ -51,6 +51,7 @@ const Page = () => {
|
||||
setCurPage(1)
|
||||
fetchData()
|
||||
}, [])
|
||||
// 파일 다운로드
|
||||
const isChckFile = () => {
|
||||
if (fileNm === '' || fileNm === undefined) {
|
||||
alert('파일을 선택해주세요')
|
||||
@@ -58,6 +59,7 @@ const Page = () => {
|
||||
}
|
||||
handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm)
|
||||
}
|
||||
// 선택 파일 삭제
|
||||
const isDeleteFile = async () => {
|
||||
if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) {
|
||||
alert('삭제할 파일을 선택해주세요')
|
||||
@@ -72,6 +74,7 @@ const Page = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 현황 등록
|
||||
const registFile = async (fileName: string, year: string, quater: string, cd: string, id: string) => {
|
||||
const data = await postData('v1/sbmrgPrevnt', {
|
||||
atflNm: fileName,
|
||||
@@ -103,7 +106,7 @@ const Page = () => {
|
||||
<Input
|
||||
className='w-[100px]'
|
||||
value={manageYear}
|
||||
onChange={(e) => setManageYear(e.target.value)}
|
||||
onChange={(e) => {setManageYear(e.target.value); console.log(e.target.value)}}
|
||||
/>
|
||||
<span>~</span>
|
||||
<Input
|
||||
@@ -142,7 +145,7 @@ const Page = () => {
|
||||
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile} >삭제</Button>
|
||||
</div>
|
||||
</div>
|
||||
(<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { 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() }}></UiTable>)
|
||||
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { 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() }}></UiTable>
|
||||
</ListDiv>
|
||||
<ListDiv className="mt-4">
|
||||
<OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} />
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import React from 'react'
|
||||
|
||||
const ExcelDown = () => {
|
||||
return (
|
||||
<div>excelDown</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ExcelDown
|
||||
@@ -9,7 +9,7 @@ import { tableHeadlistOldPp } from '..'
|
||||
import { handleDownload } from '@/components/lib/utils/fileDownload'
|
||||
import { searchData } from '@/components/lib/common/apiHelpers'
|
||||
import { formatDate } from '@/components/lib/utils/date'
|
||||
import { deleteData, getData, postData } from '@/components/lib/api'
|
||||
import { deleteData, postData } from '@/components/lib/api'
|
||||
const Page = () => {
|
||||
const [fromDate, setFromDate] = useState<Date>(()=>{const date = new Date(); date.setDate(date.getDate()-7); return date});
|
||||
const [toDate, setToDate] = useState<Date>(new Date());
|
||||
@@ -23,8 +23,11 @@ const Page = () => {
|
||||
const [tableData, setTableData] = useState<any>([{}])
|
||||
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,
|
||||
@@ -38,6 +41,8 @@ const Page = () => {
|
||||
setTableData(data)
|
||||
setTotalData(total)
|
||||
console.log(data, total)
|
||||
}catch (error) {
|
||||
console.error('Error fetching data:', error)}finally{setIsLoading(false)}
|
||||
}
|
||||
useEffect(() => {
|
||||
setCurPage(1)
|
||||
@@ -82,7 +87,7 @@ const Page = () => {
|
||||
if (data) {alert('파일이 등록되었습니다.');fetchData() }
|
||||
}
|
||||
return (
|
||||
<ContentLayout title='노후 하수관로 정비사업'>
|
||||
<ContentLayout title='노후 하수관로 정비사업' isLoading={isLoading}>
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<div className='flex items-center gap-4'>
|
||||
|
||||
Reference in New Issue
Block a user