diff --git a/apps/sn/app/components/lib/common/fileDownload.ts b/apps/sn/app/components/lib/common/fileDownload.ts new file mode 100644 index 000000000..8c760b1cc --- /dev/null +++ b/apps/sn/app/components/lib/common/fileDownload.ts @@ -0,0 +1,27 @@ +const handleDownload = async (api:string, fileNm:string) => { + try { + const response = await fetch(api, { + method: 'GET', + }); + + if (!response.ok) { + throw new Error('파일 다운로드 실패'); + } + + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + + // 다운로드를 트리거할 가짜 태그 생성 + const link = document.createElement('a'); + link.href = url; + link.download = fileNm; // 원하는 파일명 지정 + document.body.appendChild(link); + link.click(); + + // 메모리 해제 + link.remove(); + window.URL.revokeObjectURL(url); + } catch (error) { + console.error('다운로드 중 오류 발생:', error); + } +}; \ No newline at end of file diff --git a/apps/sn/app/ii/irsetting/page.tsx b/apps/sn/app/ii/irsetting/page.tsx index fbfbe0c76..34b1d2f00 100644 --- a/apps/sn/app/ii/irsetting/page.tsx +++ b/apps/sn/app/ii/irsetting/page.tsx @@ -13,7 +13,8 @@ const formSchema = z.object({ suyeonga: z.number(), inputdate: z.coerce.date(), rtkSource: z.string(), - suyeongaPlace: z.string() + suyeongaPlace: z.string(), + pattern : z.string() }) const region: { text: string, val: number }[] = [{ text: '양평', val: 1 }, { text: '강남', val: 2 }, { text: 'test', val: 3 }] const IrSetting = () => { @@ -25,22 +26,13 @@ const IrSetting = () => { suyeonga: 0, inputdate: new Date(), rtkSource: "", - suyeongaPlace: "" + suyeongaPlace: "", + pattern: "" } }) const [selectedDate, setSelectedDate] = useState(new Date()) return ( { }} graphBtn={false}> -
- - - - -
- -
-
-
@@ -48,6 +40,9 @@ const IrSetting = () => {
+
+ +
{ if (date) setSelectedDate(date) }} mode={"single"} /> @@ -56,6 +51,13 @@ const IrSetting = () => {
+
+ +
+ +
+
+
) } diff --git a/apps/sn/app/oper/floodPre/page.tsx b/apps/sn/app/oper/floodPre/page.tsx index 66dfdc28f..f741cbe79 100644 --- a/apps/sn/app/oper/floodPre/page.tsx +++ b/apps/sn/app/oper/floodPre/page.tsx @@ -1,12 +1,11 @@ 'use client' -import { SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, Title, UiTable } from '@common/business_components/ui' +import { SearchDiv, SearchFormLeft, SearchFormRight, UiTable } from '@common/business_components/ui' import { Button, DatePicker, Input, Label } from '@common/components/ui' import React, { useState } from 'react' import FileUploadForm from '../../components/ui/fileUploadForm' import ListDiv from '@common/business_components/ui/list_div' import ContentLayout from '@/components/ui/contentLayout' import { tableData } from '../oldPp/page' -import { getData } from '@/components/lib/api' import { searchData } from '@/components/lib/common/apiHelpers' import { tableHeadlist } from '..' const formatDate = (date: Date): string => { @@ -22,35 +21,7 @@ const Page = () => { const [usr, setUsr] = useState('') const [pjNm, setpjNm] = useState('') // TODO: 초기값 세팅필요 - const handleDownload = async () => { - try { - const response = await fetch('/sn/attach-service/api/v1/download/6066b08c-2a55-438c-b8ff-2aed9739a0c6', { - method: 'GET', - }); - - if (!response.ok) { - throw new Error('파일 다운로드 실패'); - } - - const blob = await response.blob(); - const url = window.URL.createObjectURL(blob); - - // 다운로드를 트리거할 가짜
태그 생성 - const link = document.createElement('a'); - link.href = url; - link.download = 'test.jpg'; // 원하는 파일명 지정 - document.body.appendChild(link); - link.click(); - - // 메모리 해제 - link.remove(); - window.URL.revokeObjectURL(url); - } catch (error) { - console.error('다운로드 중 오류 발생:', error); - } - }; - - + return ( @@ -107,10 +78,10 @@ const Page = () => {

사업정보 등록현황

- +
- { }} onPageChange={function (page: number): void { + {console.log(index, headId) }} onPageChange={function (page: number): void { throw new Error('Function not implemented.') }}> diff --git a/apps/sn/app/oper/oldPp/page.tsx b/apps/sn/app/oper/oldPp/page.tsx index 1976afded..c7184a0fd 100644 --- a/apps/sn/app/oper/oldPp/page.tsx +++ b/apps/sn/app/oper/oldPp/page.tsx @@ -8,7 +8,7 @@ import ContentLayout from '@/components/ui/contentLayout' import { tableHeadlist } from '..' // TODO: 임시 id -export const tableData = [] +export const tableData = [{'no':'1', 'fileNm':'2023년 노후하수관로 정비사업', 'mngYr':'2023', 'mngQu':'1', 'registDt':'2023-10-01', 'registUsr':'홍길동'},] const Page = () => { const [fromDate, setFromDate] = useState(new Date()); const [toDate, setToDate] = useState(new Date());