Merge remote-tracking branch 'origin/iipbs/sn/dev' into iipbs/sn/ii
iipbs_sn / build (push) Has been cancelled
iipbs_sn / build (push) Has been cancelled
This commit is contained in:
@@ -9,7 +9,7 @@ import { searchData } from '@/components/lib/common/apiHelpers'
|
|||||||
import { tableHeadlist } from '..'
|
import { tableHeadlist } from '..'
|
||||||
import { handleDownload } from '@/components/lib/utils/fileDownload'
|
import { handleDownload } from '@/components/lib/utils/fileDownload'
|
||||||
import { formatDate } from '@/components/lib/utils/date'
|
import { formatDate } from '@/components/lib/utils/date'
|
||||||
import { postData } from '@/components/lib/api'
|
import { deleteData, getData, postData } from '@/components/lib/api'
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const [fromDate, setFromDate] = useState(new Date())
|
const [fromDate, setFromDate] = useState(new Date())
|
||||||
@@ -21,25 +21,49 @@ const Page = () => {
|
|||||||
const [fileNm, setFileNm] = useState('')
|
const [fileNm, setFileNm] = useState('')
|
||||||
const [atflId, setAtflId] = useState('')
|
const [atflId, setAtflId] = useState('')
|
||||||
const [atflCd, setAtflCd] = useState('')
|
const [atflCd, setAtflCd] = useState('')
|
||||||
|
const [sbmrgPrevntBizSn, setSbmrgPrevntBizSn] = useState('')
|
||||||
const [tableData, setTableData] = useState<any>([{}])
|
const [tableData, setTableData] = useState<any>([{}])
|
||||||
|
const [curPage, setCurPage] = useState(1)
|
||||||
|
const fetchData = async () => {
|
||||||
|
const data = await searchData('v1/sbmrgPrevnt', {
|
||||||
|
fromRegDt: formatDate(fromDate),
|
||||||
|
fromMngYr: manageYear,
|
||||||
|
toMngYr: mngQu,
|
||||||
|
toRegDt: formatDate(toDate),
|
||||||
|
atflNm: pjNm,
|
||||||
|
rgtrNm: usr,
|
||||||
|
page: curPage - 1,
|
||||||
|
size: '10'
|
||||||
|
})
|
||||||
|
setTableData(data)
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
setCurPage(1)
|
||||||
const data = await searchData('v1/sbmrgPrevnt', {
|
|
||||||
fromRegDt: formatDate(new Date()),
|
|
||||||
toRegDt: formatDate(new Date()),
|
|
||||||
page: '0',
|
|
||||||
size: '10'
|
|
||||||
})
|
|
||||||
setTableData(data)
|
|
||||||
}
|
|
||||||
fetchData()
|
fetchData()
|
||||||
}, [])
|
}, [])
|
||||||
const isChckFile = () => {
|
const isChckFile = () => {
|
||||||
if (fileNm === '' || fileNm === undefined) {
|
if (fileNm === '' || fileNm === undefined) {
|
||||||
alert('파일을 선택해주세요')
|
alert('파일을 선택해주세요')
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm)
|
handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm)
|
||||||
}
|
}
|
||||||
|
const isDeleteFile = async () => {
|
||||||
|
if (fileNm === '' || fileNm === undefined) {
|
||||||
|
alert('삭제할 파일을 선택해주세요')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const data = await getData(`/attach-service/api/v1/atfl/attachments/${atflId}`)
|
||||||
|
if (data) {
|
||||||
|
const delData = await deleteData(`v1/sbmrgPrevnt/${sbmrgPrevntBizSn}`)
|
||||||
|
if (delData) {
|
||||||
|
alert('삭제되었습니다.')
|
||||||
|
fetchData()
|
||||||
|
} else {
|
||||||
|
alert('삭제에 실패했습니다.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => {
|
const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => {
|
||||||
const data = await postData('v1/sbmrgPrevnt', {
|
const data = await postData('v1/sbmrgPrevnt', {
|
||||||
atflNm: fileNm,
|
atflNm: fileNm,
|
||||||
@@ -98,7 +122,7 @@ const Page = () => {
|
|||||||
</div>
|
</div>
|
||||||
</SearchFormLeft>
|
</SearchFormLeft>
|
||||||
<SearchFormRight>
|
<SearchFormRight>
|
||||||
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={() => { const data = searchData('v1/sbmrgPrevnt', { fromRegDt: formatDate(fromDate), fromMngYr: manageYear, toMngYr: mngQu, toRegDt: formatDate(toDate), atflNm: pjNm, rgtrNm: usr, page: '0', size: '10' }); setTableData(data)}} >조회</Button>
|
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={async () => await fetchData() } >조회</Button>
|
||||||
</SearchFormRight>
|
</SearchFormRight>
|
||||||
</SearchDiv>
|
</SearchDiv>
|
||||||
<ListDiv className="mt-4">
|
<ListDiv className="mt-4">
|
||||||
@@ -106,15 +130,13 @@ const Page = () => {
|
|||||||
<h3 className="text-2xl font-medium">사업정보 등록현황</h3>
|
<h3 className="text-2xl font-medium">사업정보 등록현황</h3>
|
||||||
<div>
|
<div>
|
||||||
<Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile} >파일 다운로드</Button>
|
<Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile} >파일 다운로드</Button>
|
||||||
<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={() => { }} >삭제</Button>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={10} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.fileNm ?? ""; setFileNm(fileName) } }} onPageChange={function (page: number): void {
|
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={10} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.fileNm ?? ""; setFileNm(fileName); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn) } }} onPageChange={async (page:number)=>{setCurPage(page); await fetchData()}}></UiTable>
|
||||||
throw new Error('Function not implemented.')
|
|
||||||
}}></UiTable>
|
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
<ListDiv className="mt-4">
|
<ListDiv className="mt-4">
|
||||||
<FileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => {await registFile(file, year,quater, cd,id) }} />
|
<FileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} />
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
</ContentLayout>
|
</ContentLayout>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const tableHeadlist = [
|
export const tableHeadlist = [
|
||||||
{ id: 'no', title: 'NO' },
|
{ id: 'sbmrgPrevntBizSn', title: '일련번호' },
|
||||||
{ id: 'fileNm', title: '파일명' },
|
{ id: 'fileNm', title: '파일명' },
|
||||||
{ id: 'mngYr', title: '년도' },
|
{ id: 'mngYr', title: '년도' },
|
||||||
{ id: 'mngQu', title: '분기' },
|
{ id: 'mngQu', title: '분기' },
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { tableHeadlist } from '..'
|
|||||||
import { handleDownload } from '@/components/lib/utils/fileDownload'
|
import { handleDownload } from '@/components/lib/utils/fileDownload'
|
||||||
import { searchData } from '@/components/lib/common/apiHelpers'
|
import { searchData } from '@/components/lib/common/apiHelpers'
|
||||||
import { formatDate } from '@/components/lib/utils/date'
|
import { formatDate } from '@/components/lib/utils/date'
|
||||||
import { postData } from '@/components/lib/api'
|
import { deleteData, getData, postData } from '@/components/lib/api'
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const [fromDate, setFromDate] = useState<Date>(new Date());
|
const [fromDate, setFromDate] = useState<Date>(new Date());
|
||||||
const [toDate, setToDate] = useState<Date>(new Date());
|
const [toDate, setToDate] = useState<Date>(new Date());
|
||||||
@@ -20,36 +20,63 @@ const Page = () => {
|
|||||||
const [fileNm, setFileNm] = useState('')
|
const [fileNm, setFileNm] = useState('')
|
||||||
const [atflId, setAtflId] = useState('')
|
const [atflId, setAtflId] = useState('')
|
||||||
const [atflCd, setAtflCd] = useState('')
|
const [atflCd, setAtflCd] = useState('')
|
||||||
|
const [sbmrgPrevntBizSn, setSbmrgPrevntBizSn] = useState('')
|
||||||
const [tableData, setTableData] = useState<any>([{}])
|
const [tableData, setTableData] = useState<any>([{}])
|
||||||
useEffect(() => {
|
const [curPage, setCurPage] = useState(1)
|
||||||
const fetchData = async () => {
|
// 데이터 조회
|
||||||
const data = await searchData('v1/dcrpPpl', {
|
const fetchData = async () => {
|
||||||
fromRegDt: formatDate(new Date()),
|
const data = await searchData('v1/dcrpPpl', {
|
||||||
toRegDt: formatDate(new Date()),
|
fromRegDt: formatDate(fromDate),
|
||||||
page: '0',
|
fromMngYr: manageYear,
|
||||||
size: '10'
|
toMngYr: mngQu,
|
||||||
})
|
toRegDt: formatDate(toDate),
|
||||||
setTableData(data)
|
atflNm: pjNm,
|
||||||
}
|
rgtrNm: usr,
|
||||||
fetchData()
|
page: curPage - 1,
|
||||||
}, [])
|
size: '10'
|
||||||
|
})
|
||||||
|
setTableData(data)
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
setCurPage(1)
|
||||||
|
fetchData()
|
||||||
|
}, [])
|
||||||
|
// 파일 다운로드
|
||||||
const isChckFile = () => {
|
const isChckFile = () => {
|
||||||
if (fileNm === '' || fileNm === undefined) {
|
if (fileNm === '' || fileNm === undefined) {
|
||||||
alert('파일을 선택해주세요')
|
alert('파일을 선택해주세요')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
handleDownload(`/sn/attach-service/api/v1/download/${atflId}}`, fileNm)
|
handleDownload(`/attach-service/api/v1/download/${atflId}}`, fileNm)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const registFile = async (fileNm:string, year: string, quater: string,cd: string, id: string) => {
|
// 파일 삭제
|
||||||
const data = await postData('v1/dcrpPpl', {
|
const isDeleteFile = async () => {
|
||||||
atflNm: fileNm,
|
if (fileNm === '' || fileNm === undefined) {
|
||||||
mngYr: year,
|
alert('삭제할 파일을 선택해주세요')
|
||||||
mngQu: quater,
|
return false
|
||||||
atflCd: cd,
|
}
|
||||||
atflId: id
|
const data = await getData(`/attach-service/api/v1/atfl/attachments/${atflId}`)
|
||||||
})
|
if (data) {
|
||||||
if (data.ok) { setAtflId(data.atflId); setAtflCd(data.atflCd) }
|
const delData = await deleteData(`v1/sbmrgPrevnt/${sbmrgPrevntBizSn}`)
|
||||||
|
if (delData) {
|
||||||
|
alert('삭제되었습니다.')
|
||||||
|
fetchData()
|
||||||
|
} else {
|
||||||
|
alert('삭제에 실패했습니다.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 파일 등록
|
||||||
|
const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => {
|
||||||
|
const data = await postData('v1/dcrpPpl', {
|
||||||
|
atflNm: fileNm,
|
||||||
|
mngYr: year,
|
||||||
|
mngQu: quater,
|
||||||
|
atflCd: cd,
|
||||||
|
atflId: id
|
||||||
|
})
|
||||||
|
if (data.ok) { setAtflId(data.atflId); setAtflCd(data.atflCd) }
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<ContentLayout title='노후 하수관로 정비사업'>
|
<ContentLayout title='노후 하수관로 정비사업'>
|
||||||
@@ -99,7 +126,7 @@ const Page = () => {
|
|||||||
</div>
|
</div>
|
||||||
</SearchFormLeft>
|
</SearchFormLeft>
|
||||||
<SearchFormRight>
|
<SearchFormRight>
|
||||||
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 mr-2" size="sm" onClick={() => { const data = searchData('v1/dcrpPpl', { fromRegDt: formatDate(fromDate), fromMngYr: manageYear, toMngYr: mngQu, toRegDt: formatDate(toDate), atflNm: pjNm, rgtrNm: usr, page: '0', size: '10' }); setTableData(data) }}>조회</Button>
|
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 mr-2" size="sm" onClick={async () => {await fetchData()}}>조회</Button>
|
||||||
</SearchFormRight>
|
</SearchFormRight>
|
||||||
</SearchDiv>
|
</SearchDiv>
|
||||||
<ListDiv className="mt-4">
|
<ListDiv className="mt-4">
|
||||||
@@ -107,15 +134,13 @@ const Page = () => {
|
|||||||
<h3 className="text-2xl font-medium">사업정보 등록현황</h3>
|
<h3 className="text-2xl font-medium">사업정보 등록현황</h3>
|
||||||
<div>
|
<div>
|
||||||
<Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile}>파일 다운로드</Button>
|
<Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile}>파일 다운로드</Button>
|
||||||
<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" >삭제</Button>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={20} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.fileNm ?? ""; setFileNm(fileName) } }} onPageChange={function (page: number): void {
|
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={20} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.fileNm ?? ""; setFileNm(fileName); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn) } }} onPageChange={async (page:number)=>{setCurPage(page); await fetchData()}}></UiTable>
|
||||||
throw new Error('Function not implemented.')
|
|
||||||
}}></UiTable>
|
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
<ListDiv className="mt-4">
|
<ListDiv className="mt-4">
|
||||||
<FileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => {await registFile(file, year,quater, cd,id)}} />
|
<FileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} />
|
||||||
</ListDiv>
|
</ListDiv>
|
||||||
</ContentLayout>
|
</ContentLayout>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user