From eb2fca7621985ef0a02ceff0e057b8ef9254dfce Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 7 May 2025 18:21:27 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A4=91=EC=88=98=EB=8F=84=20=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=ED=98=84=ED=99=A9=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/page.tsx | 7 + .../fcltSttn/rainSttn/headList.tsx | 5 +- .../ruseFcltMng/fcltSttn/rainSttn/index.tsx | 36 +- .../ruseFcltMng/fcltSttn/rswtSttn/excel.tsx | 33 ++ .../fcltSttn/rswtSttn/headList.tsx | 400 ++++++++++++++++++ .../ruseFcltMng/fcltSttn/rswtSttn/index.tsx | 129 ++++++ apps/wr/app/store/store.tsx | 14 +- apps/wr/components/lib/func/commom.tsx | 125 +++--- 8 files changed, 684 insertions(+), 65 deletions(-) create mode 100644 apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx create mode 100644 apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/headList.tsx create mode 100644 apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index 9b2a51d7d..63c97952b 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -69,6 +69,13 @@ export default function Home() { +
+ +
diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx index c283194a1..354f98a1b 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx @@ -1,7 +1,8 @@ +import type { CommonTableProps } from "@/app/store/common/type/headder"; import { z } from "zod"; -export const rainSttnHeadListType = z.array( +export const sttnHeadListType = z.array( z.object({ id: z.string(), title: z.string(), @@ -10,7 +11,7 @@ export const rainSttnHeadListType = z.array( ); -export const rainSttHeadListExport: z.infer = [ +export const rainSttHeadListExport: z.infer = [ { id: "cityText", diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx index 3c9a507ac..c0f829e41 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx @@ -3,10 +3,10 @@ import { fetchType, getFetch } from "@/components/lib/api"; import { type customRainBdst, } from "../../fcltReg/rainReg"; -import { excelSttnParsing } from "./excel"; +import { excelRainSttnParsing } from "./excel"; import { rainSttHeadListExport, - rainSttnHeadListType, + sttnHeadListType, rainSttNodeListExport, } from "./headList"; import type { z } from "zod"; @@ -92,9 +92,10 @@ export type rainSttnState = { }; }; type rainSttnActions = { - rainSttnSearch: (page: string, total: string, con: string) => void; + rainSttnInit:(con:string) => void + rainSttnSearch: (page: number, total: string, con: string) => void; rainChSttnHead: ( - headList: z.infer, + headList: z.infer, ) => void; }; @@ -114,14 +115,35 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( set: any ) => { return { - rainSttnSearch: async (page: string, total: string, con: string) => { + rainSttnInit: async( con:string)=>{ + try{ + + const rainSttnRes = await getFetch( + fetchType.WR, + `/reuseFc/rainyInfoList/1/20/${con}` + ); + set((state: rainSttnState) => { + return { + ...state, + rainSttn: { + ...state.rainSttn, + rainSttnRes: rainSttnRes, + isInit: false, + }, + }; + }); + }catch(e){ + console.log(e) + } + }, + rainSttnSearch: async (page: number, total: string, con: string) => { try { const rainSttnRes = await getFetch( fetchType.WR, `/reuseFc/rainyInfoList/${page}/${total}/${con}` ); if (Number(total) > 9000) { - const rainExcel = excelSttnParsing(rainSttnRes); + const rainExcel = excelRainSttnParsing(rainSttnRes); set((state: rainSttnState) => { return { ...state, @@ -147,7 +169,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( } }, rainChSttnHead: async ( - headList: z.infer + headList: z.infer ) => { const changeNodeList= controlHeadView(headList,rainSttNodeList) diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx new file mode 100644 index 000000000..96edde5ca --- /dev/null +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx @@ -0,0 +1,33 @@ +import type { customRswtBdst } from "../../fcltReg/rswtReg"; + +export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => { + const excelExportData: string[][] = []; + + data.forEach((item) => { + excelExportData.push([ + String(item.cityText), + String(item.sggText), + item.bdstNm ?? "", + item.daddr ?? "", + String(item.bdstUsgText ?? ""), + String(item.frstArchPrmsnDt ?? ""), + String(item.archArea ?? ""), + String(item.chgBuilding.length>0 ? "Y" :"N"), + String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), + String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), + String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), + String(item.reuseBuilding?.[0]?.instlCst ?? ""), + item.reuseBuilding?.[0]?.rswtrObj?.orgwtKndCd ?? "", + String(item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct ?? ""), + String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctProcs ?? ""), + String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctUsgCd ?? ""), + String(item.reuseBuilding?.[0]?.instlCstSprtYn ?? ""), + String(item.reuseBuilding?.[0]?.instlCstSprtAmt ?? ""), + String(item.reuseBuilding?.[0]?.grntchBdstCertYn ?? ""), + String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""), + String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""), + String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "") + ]); + }); + return excelExportData; +}; \ No newline at end of file diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/headList.tsx new file mode 100644 index 000000000..2e901b000 --- /dev/null +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/headList.tsx @@ -0,0 +1,400 @@ +import type { z } from "zod"; +import type { sttnHeadListType } from "../rainSttn/headList"; +import type { CommonTableProps } from "@/app/store/common/type/headder"; + +export const rswtSttHeadListExport: z.infer = [ + { + id: "cityText", + title: "시도", + visible: true, + }, + { + id: "sggText", + title: "시군구", + visible: true, + }, + { + id: "bdstNm", + title: "건축물명", + visible: true, + }, + { + id: "daddr", + title: "주소", + visible: true, + }, + { + id: "bdsgUsgText", + title: "건축물용도", + visible: true, + }, + { + id: "frstArchPrmsnDt", + title: "최초건축허가일시", + visible: true, + }, + { + id: "archArea", + title: "건축면적", + visible: true, + }, + { + id: "wtrUsqty", + title: "물사용량", + visible: true, + }, + { + id: "chBuildingYn", + title: "중축・개축・재축여부", + visible: true, + }, + + { + id: "lawTrgtYn", + title: "법적의무대상여부", + visible: true, + }, + + { + id: "oblgTrgtWtrUsqty", + title: "의무대상물사용량 ", + visible: true, + }, + { + id: "instlCmptnDt", + title: "설치완료일시", + visible: true, + }, + { + id: "instlCst", + title: "설치비용", + visible: true, + }, + + { + id: "orgwtKndCd", + title: "원수종류", + visible: true, + }, + + { + id: "filtrTrtmfctCpct", + title: "처리시설용량", + visible: true, + }, + { + id: "filtrTrtmfctProcs", + title: "주요처리공정", + visible: true, + }, + { + id: "filtrTrtmfctUsgCd", + title: "이용용도", + visible: true, + }, + + { + id: "instlCstSprtYn", + title: "설치지원비용여부", + visible: true, + }, + { + id: "instlCstSprtAmt", + title: "설치지원비용", + visible: true, + }, + + { + id: "grntchBdstCertYn", + title: "녹색건축물인증여부", + visible: true, + }, + { + id: "grntchBdstCertYr", + title: "녹색건축물인증년도", + visible: true, + }, + { + id: "grntchBdstCertNo", + title: "녹색건축물인증번호", + visible: true, + }, + { + id: "grntchBdstCertGrd", + title: "녹색건축물인증등급", + visible: true, + }, +]; + +// id는 다확인해야함 +export const rswtSttNodeListExport: CommonTableProps[] = [ + { + id: "bdnstInfo", + title: "1.건축물정보", + visible: true, + row: 1, + rowSpan: 1, + colSpan: 12, + }, + { + id: "rswtFcltInfo", + title: "2.중수도시설정보", + visible: true, + row: 1, + rowSpan: 1, + colSpan: 5, + }, + { + id: "insenInfo", + title: "3.인센티브 정보", + visible: true, + row: 1, + rowSpan: 1, + colSpan: 6, + }, + { + id: "adminDiv", + title: "행정구역", + visible: true, + row: 2, + upName: "bdnstInfo", + rowSpan: 1, + colSpan: 2, + }, + + // 3번째줄 시작 + { + id: "cityText", + title: "시도", + visible: true, + upName: "adminDiv", + row: 3, + rowSpan: 1, + colSpan: 1, + }, + { + id: "sggText", + title: "시군구", + visible: true, + upName: "adminDiv", + row: 3, + rowSpan: 1, + colSpan: 1, + }, + + // 2번째 줄 + // 1번째 줄 건축물정보 아래의 행으로 만들 헤더 + { + id: "bdstNm", + title: "건축물명", + visible: true, + upName: "bdnstInfo", + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "daddr", + title: "주소", + visible: true, + upName: "bdnstInfo", + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "bdsgUsgText", + title: "건축물용도", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "frstArchPrmsnDt", + title: "최초건축허가일시", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "archArea", + title: "건축면적", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "wtrUsqty", + title: "물사용량", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "chBuildingYn", + title: "중축・개축・재축여부", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + + { + id: "lawTrgtYn", + title: "법적의무대상여부", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "oblgTrgtWtrUsqty", + title: "의무대상물사용량", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "instlCmptnDt", + title: "설치완료일시", + upName: "bdnstInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "instlCst", + title: "설치비용", + upName: "rswtFcltInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + + { + id: "orgwtKndCd", + title: "원수종류", + upName: "rswtFcltInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + + { + id: "filtrTrtmfctCpct", + title: "처리시설용량", + upName: "rswtFcltInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "filtrTrtmfctProcs", + title: "주요처리공정", + upName: "rswtFcltInfo", + visible: true, + row: 2, + rowSpan: 2, + colSpan: 1, + }, + + { + id: "filtrTrtmfctUsgCd", + title: "이용용도", + visible: true, + upName: "rswtFcltInfo", + row: 2, + rowSpan: 2, + colSpan: 1, + }, + { + id: "instlCstSprtYn", + title: "설치지원비용여부", + upName: "instlCstSprt", + visible: true, + row: 3, + rowSpan: 1, + colSpan: 1, + }, + { + id: "instlCstSprtAmt", + title: "설치지원비용", + upName: "instlCstSprt", + visible: true, + row: 3, + rowSpan: 1, + colSpan: 1, + }, + + { + id: "instlCstSprt", + title: "설치비지원", + upName: "insenInfo", + visible: true, + row: 2, + rowSpan: 1, + colSpan: 2, + }, + + { + id: "grntchBdstCertYn", + title: "녹색건축물인증여부", + upName: "grntchBdstCert", + visible: true, + row: 3, + rowSpan: 1, + colSpan: 1, + }, + { + id: "grntchBdstCertYr", + title: "녹색건축물인증년도", + upName: "grntchBdstCert", + visible: true, + row: 3, + rowSpan: 1, + colSpan: 1, + }, + { + id: "grntchBdstCertNo", + title: "녹색건축물인증번호", + upName: "grntchBdstCert", + visible: true, + row: 3, + rowSpan: 1, + colSpan: 1, + }, + { + id: "grntchBdstCertGrd", + title: "녹색건축물인증등급", + upName: "grntchBdstCert", + visible: true, + row: 3, + rowSpan: 1, + colSpan: 1, + }, + { + id: "grntchBdstCert", + title: "녹색건축물인증", + upName: "insenInfo", + visible: true, + row: 2, + rowSpan: 1, + colSpan: 4, + }, +]; diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx new file mode 100644 index 000000000..b48fc3eae --- /dev/null +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx @@ -0,0 +1,129 @@ +import type { CommonTableProps } from "@/app/store/common/type/headder"; +import type { customRswtBdst } from "../../fcltReg/rswtReg"; +import type { sttnHeadListType } from "../rainSttn/headList"; +import type { z } from "zod"; +import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList"; +import { controlHeadView } from "../rainSttn"; +import { fetchType, getFetch } from "@/components/lib/api"; +import { excelRainSttnParsing } from "../rainSttn/excel"; + + + +// 테이블 헤드 리스트 +const rswtSttNodeList = rswtSttNodeListExport; +const rswtSttHeadList = rswtSttHeadListExport; +const rswtSttnRes: customRswtBdst[] = []; + + + +export type rswtSttnState = { + rswtSttn: { + rswtSttnRes: customRswtBdst[]; + rswtSttHeadList: CommonTableProps[]; + rswtSttNodeList: CommonTableProps[]; + excelList: []; + isInit: boolean; + }; +}; + + + +type rswtSttnActions = { + rswtSttnInit:(con:string) => void; + rswtSttnSearch: (page: number, total: string, con: string) => void; + rswtChSttnHead: ( + headList: z.infer, + ) => void; +}; + +export type rswtSttnType = rswtSttnState & rswtSttnActions; + + + +export const rswtSttnStateExport: rswtSttnState = { + rswtSttn: { + rswtSttHeadList: rswtSttHeadList, + rswtSttNodeList: rswtSttNodeList, + rswtSttnRes: rswtSttnRes, + excelList: [], + isInit: false, + }, +}; + + + +export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( + set: any +) => { + return { + rswtSttnInit: async( con:string)=>{ + try{ + + const rswtSttnRes = await getFetch( + fetchType.WR, + `/reuseFc/waterreuseFc/1/20/${con}` + ); + set((state: rswtSttnState) => { + return { + ...state, + rswtSttn: { + ...state.rswtSttn, + rswtSttnRes: rswtSttnRes, + isInit: false, + }, + }; + }); + }catch(e){ + console.log(e) + } + }, + rswtSttnSearch: async (page: number, total: string, con: string) => { + try { + const rswtSttnRes = await getFetch( + fetchType.WR, + `/reuseFc/waterreuseFc/${page}/${total}/${con}` + ); + if (Number(total) > 9000) { + const rainExcel = excelRainSttnParsing(rswtSttnRes); + set((state: rswtSttnState) => { + return { + ...state, + rswtSttn: { + ...state.rswtSttn, + excelList: rainExcel, + }, + }; + }); + } else + set((state: rswtSttnState) => { + + return { + ...state, + rswtSttn: { + ...state.rswtSttn, + rswtSttnRes: rswtSttnRes, + isInit: false, + }, + }; + }); + } catch (erTxt) { + console.log("error", erTxt); + } + }, + rswtChSttnHead: async ( + headList: z.infer + ): Promise => { + + console.log('head ', headList) + const changeNodeList= controlHeadView(headList,rswtSttNodeList) + + return set((state: rswtSttnState) => ({ + rswtSttn: { + ...state.rswtSttn, + rswtSttHeadList: headList, + rswtSttNodeList: changeNodeList, + }, + })); + }, + }; +}; diff --git a/apps/wr/app/store/store.tsx b/apps/wr/app/store/store.tsx index 848ba0b03..ee124de68 100644 --- a/apps/wr/app/store/store.tsx +++ b/apps/wr/app/store/store.tsx @@ -34,6 +34,7 @@ import { type rswtFacType, } from "./ruseFcltMng/fcltReg/rswtReg"; import { rainSttnActionsExport, rainSttnStateExport, type rainSttnState, type rainSttnType } from "./ruseFcltMng/fcltSttn/rainSttn"; +import { rswtSttnActionsExport, rswtSttnStateExport, type rswtSttnState, type rswtSttnType } from "./ruseFcltMng/fcltSttn/rswtSttn"; export type WrStore = comCodeType& pubFacType & @@ -44,7 +45,8 @@ export type WrStore = comCodeType& bdstFulType& rainChkgdnType& rswtChkgdnType& - rainSttnType + rainSttnType& + rswtSttnType ; export const StoreZus = ( @@ -57,7 +59,9 @@ export const StoreZus = ( bdstState & rainChkgdnState& rswtChkgdnState& - rainSttnState + rainSttnState& + rswtSttnState + = { ...comCodeStateExport, ...pubFacStateExport, @@ -68,7 +72,8 @@ export const StoreZus = ( ...bdstStateExport, ...rainChkgdnStateExport, ...rswtChkgdnStateExport, - ...rainSttnStateExport + ...rainSttnStateExport, + ...rswtSttnStateExport } ) => { return createStore()((set) => { @@ -89,7 +94,8 @@ export const StoreZus = ( ...bdstActionsExport(set), ...rainChkgdnActionsExport(set), ...rswtChkgdnActionsExport(set), - ...rainSttnActionsExport(set) + ...rainSttnActionsExport(set), + ...rswtSttnActionsExport(set) }; }); }; diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index b7f9d9eed..a91750fce 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -1,70 +1,80 @@ -import type { comCodeState, } from "@/app/store/common/code"; -import { filePickedBlob, type SelectDataType } from "@common/business_components/ui"; - - - - +import type { comCodeState } from "@/app/store/common/code"; +import { + filePickedBlob, + type SelectDataType, + type ReturnType, +} from "@common/business_components/ui"; +import type { RefObject } from "react"; export const getCity = (val: string, sggCd: SelectDataType[]) => { - const data = sggCd - .filter((item) => String(item.val).substring(0, 2) === val) - .map((item) => ({ - val: item.val, - text: item.text // 한국어 텍스트 - })); - return data - - }; - + const data = sggCd + .filter((item) => String(item.val).substring(0, 2) === val) + .map((item) => ({ + val: item.val, + text: item.text, // 한국어 텍스트 + })); + return data; +}; // cd text 넣기 - export const tableData = ( data: any,code:comCodeState)=>{ - const chCode = code.code; - return data?.map((item: { sggCd: string; ctpvCd: string; reuseBuilding: { lawTrgtYn: any , bdstUsgCd:any}[]; }) => { +export const tableData = (data: any, code: comCodeState) => { + const chCode = code.code; + return data?.map( + (item: { + sggCd: string; + ctpvCd: string; + reuseBuilding: { lawTrgtYn: any; bdstUsgCd: any }[]; + }) => { let returnData = {}; const sggText = chCode.sggCd.find( - (cd) => cd.val === String(item.sggCd) + (cd) => cd.val === String(item.sggCd) )?.text; const cityText = chCode.cityCd.find( (cd) => cd.val === String(item.ctpvCd) )?.text; - console - .log(item?.reuseBuilding) - if (item?.reuseBuilding?.length >0) { - + if (item?.reuseBuilding?.length > 0) { const bdsgUsgText = chCode.bdstUsgCd.find( - (cd) =>Number(cd.val) === item?.reuseBuilding[0]?.bdstUsgCd - )?.text - const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn - console - .log(bdsgUsgText) + (cd) => Number(cd.val) === item?.reuseBuilding[0]?.bdstUsgCd + )?.text; + const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn; - returnData= { ...item, sggText: sggText??'없음', cityText: cityText??'없음' ,bdsgUsgText:bdsgUsgText ,lawTrgtYn:lawTrgtYn}; - }else{ - returnData= { ...item, sggText: sggText??'없음', cityText: cityText??'없음'}; + returnData = { + ...item, + sggText: sggText ?? "없음", + cityText: cityText ?? "없음", + bdsgUsgText: bdsgUsgText, + lawTrgtYn: lawTrgtYn, + }; + } else { + returnData = { + ...item, + sggText: sggText ?? "없음", + cityText: cityText ?? "없음", + }; } return returnData; - - }); - } - - - - export const excelDownload =(excelList: [][], fileNm:string ,sampleFile:string, headerRange='A1:V3') =>{ - if (excelList.length === 0) return; - fetch(`/${sampleFile}`, {}) - .then(async (response) => { - if (!response.ok) { - throw Error(response.statusText) - } - // 받은 파일 바인너리 처리 - const blobRet = await response.arrayBuffer() - // 버퍼에 있는 엑셀데이터 전달 후 json으로 변환 - await filePickedBlob(blobRet, excelList,fileNm, 4,headerRange) - }) -} + } + ); +}; +export const excelDownload = ( + excelList: [][], + fileNm: string, + sampleFile: string, + headerRange = "A1:V3" +) => { + if (excelList.length === 0) return; + fetch(`/${sampleFile}`, {}).then(async (response) => { + if (!response.ok) { + throw Error(response.statusText); + } + // 받은 파일 바인너리 처리 + const blobRet = await response.arrayBuffer(); + // 버퍼에 있는 엑셀데이터 전달 후 json으로 변환 + await filePickedBlob(blobRet, excelList, fileNm, 4, headerRange); + }); +}; // onchange 텍스트를 숫자로 and ,제거 export const handleCommaNumberChange = ( @@ -82,4 +92,15 @@ export const formatCommaNumber = ( ): string => { if (value === undefined || value === null || value === "") return ""; return Number(value).toLocaleString(); -}; \ No newline at end of file +}; + +export const getCityOrSgg = (ref: RefObject) => { + let con; + if (ref.current != null) + if (ref.current.sigunValue != "0") { + con = ref.current.sigunValue; + } else { + con = ref.current.sidoValue; + } + return con; +};