diff --git a/apps/wr/app/(map-layout)/map/mainMap/page.tsx b/apps/wr/app/(map-layout)/map/mainMap/page.tsx index a2b104d76..70deb7d42 100644 --- a/apps/wr/app/(map-layout)/map/mainMap/page.tsx +++ b/apps/wr/app/(map-layout)/map/mainMap/page.tsx @@ -143,7 +143,7 @@ const Map = () => { } select.selectFeature(foundFeature, true); } else { - toast.error('위치정보를 찾을수 없습니다') + // toast.error('위치정보를 찾을수 없습니다') console.warn("OpenLayers Feature를 찾을 수 없습니다:"); console.log("foundFeature :", foundFeature ); console.warn("featureId : ", featureId); diff --git a/apps/wr/app/store/map/htdflMap/index.tsx b/apps/wr/app/store/map/htdflMap/index.tsx index 03289a06d..a8b9eb7c1 100644 --- a/apps/wr/app/store/map/htdflMap/index.tsx +++ b/apps/wr/app/store/map/htdflMap/index.tsx @@ -2,12 +2,15 @@ import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api"; import type { CommonTableProps } from "../../common/type/header"; import type { customHtdflBdst } from "../../ruseFcltMng/fcltReg/htdflReg"; import { htdflSttHeadListExport, htdflSttNodeListExport } from "../../ruseFcltMng/fcltSttn/htdflSttn/headList"; +import type { SelectDataType } from "@common/business_components/ui"; +import { excelHtdflSttnParsing } from "../../ruseFcltMng/fcltSttn/htdflSttn/excel"; export const htdfMapSize = 15; export type htdfMapState = { htdfMap: { htdfMapRes: customHtdflBdst[]; htdfMapCount: number; + htdflMapExcelList:[] isInit: boolean; htdfSttHeadList: CommonTableProps[]; htdfSttNodeList: CommonTableProps[]; @@ -16,7 +19,9 @@ export type htdfMapState = { type htdfMapActions = { htdfMapInit: (page: number, total: number, cityOrSgg: string) => void; - htdfMapSearch: (page: number, total: number, cityOrSgg:string, searchTxt?:string) =>void + htdfMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; htdfMapDetile:(featureCd:string) => Promise; }; @@ -27,6 +32,7 @@ export const htdfMapStateExport: htdfMapState = { htdfMap: { isInit: false, htdfMapRes: [], + htdflMapExcelList:[], htdfMapCount: 1, htdfSttHeadList: htdflSttHeadListExport, htdfSttNodeList: htdflSttNodeListExport, @@ -62,32 +68,44 @@ export const htdfMapActionsExport: (set: any) => htdfMapActions = ( console.log(e); } }, - htdfMapSearch: async ( - page: number, - total: number, - cityOrSgg: string, - searchTxt?: string + htdfMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[] ) => { try { const htdfMapRes = await getFetchWithCount( fetchType.WR, `/drain/facilityList` + - (page ? `/${page}` : "/1") + - (total ? `/${total}` : "/20") + - (cityOrSgg ? `/${cityOrSgg}` : "/0") + - (searchTxt ? `/${searchTxt}` : "") + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); + if (isExcel) { + const htdflMapExcelList = excelHtdflSttnParsing(htdfMapRes, sidoCode, sggCode); - set((state: htdfMapState) => { - return { - ...state, - htdfMap: { - ...state.htdfMap, - htdfMapRes: htdfMapRes.data, - htdfMapCount: htdfMapRes.count, - }, - }; - }); + set((state: htdfMapState) => { + return { + ...state, + htdfMap: { + ...state.htdfMap, + htdflMapExcelList: htdflMapExcelList + }, + }; + }); + }else{ + + set((state: htdfMapState) => { + return { + ...state, + htdfMap: { + ...state.htdfMap, + htdfMapRes: htdfMapRes.data, + htdfMapCount: htdfMapRes.count, + }, + }; + }); + } } catch (e) { console.log(e); } diff --git a/apps/wr/app/store/map/rainMap/index.tsx b/apps/wr/app/store/map/rainMap/index.tsx index a8d8ecb04..f80c27cc7 100644 --- a/apps/wr/app/store/map/rainMap/index.tsx +++ b/apps/wr/app/store/map/rainMap/index.tsx @@ -5,12 +5,15 @@ import { rainSttNodeListExport, } from "../../ruseFcltMng/fcltSttn/rainSttn/headList"; import type { customRainBdst } from "../../ruseFcltMng/fcltReg/rainReg"; +import type { SelectDataType } from "@common/business_components/ui"; +import { excelRainSttnParsing } from "../../ruseFcltMng/fcltSttn/rainSttn/excel"; export const rainMapSize = 15 export type rainMapState = { rainMap: { rainMapRes: customRainBdst[]; + rainMapExcelList: []; rainMapCount: number; isInit: boolean; rainSttHeadList: CommonTableProps[]; @@ -20,7 +23,9 @@ export type rainMapState = { type rainMapActions = { rainMapInit: (page: number, total: number, cityOrSgg:string) => void; - rainMapSearch: (page: number, total: number, cityOrSgg:string, searchTxt?:string) =>void + rainMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; rainMapDetile:(featureCd:string) => Promise; }; @@ -30,6 +35,7 @@ export const rainMapStateExport: rainMapState = { rainMap: { isInit: false, rainMapRes: [], + rainMapExcelList:[], rainMapCount: 1, rainSttHeadList: rainSttHeadListExport, rainSttNodeList: rainSttNodeListExport, @@ -65,17 +71,31 @@ export const rainMapActionsExport: (set: any) => rainMapActions = ( console.log(e); } }, - rainMapSearch: async (page: number, total: number, cityOrSgg:string, searchTxt?:string) => { + rainMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { const rainMapRes = await getFetchWithCount( fetchType.WR, `/reuseFc/rainyInfoList` + - (page ? `/${page}` : "/1") + - (total ? `/${total}` : "/20") + - (cityOrSgg ? `/${cityOrSgg}` : "/0") + - (searchTxt ? `/${searchTxt}` : "") + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); - + if (isExcel) { + const rainMapExcelList = excelRainSttnParsing(rainMapRes, sidoCode, sggCode); + + set((state: rainMapState) => { + return { + ...state, + rainMap: { + ...state.rainMap, + rainMapExcelList: rainMapExcelList, + }, + }; + }); + }else{ set((state: rainMapState) => { return { ...state, @@ -86,6 +106,8 @@ export const rainMapActionsExport: (set: any) => rainMapActions = ( }, }; }); + + } } catch (e) { console.log(e); } diff --git a/apps/wr/app/store/map/rswtMap/index.tsx b/apps/wr/app/store/map/rswtMap/index.tsx index e788bedc1..4acc0e321 100644 --- a/apps/wr/app/store/map/rswtMap/index.tsx +++ b/apps/wr/app/store/map/rswtMap/index.tsx @@ -5,12 +5,15 @@ import { rswtSttHeadListExport, rswtSttNodeListExport, } from "../../ruseFcltMng/fcltSttn/rswtSttn/headList"; +import type { SelectDataType } from "@common/business_components/ui"; +import { excelRSwtSttnParsing } from "../../ruseFcltMng/fcltSttn/rswtSttn/excel"; export const rswtMapSize = 15; export type rswtMapState = { rswtMap: { rswtMapRes: customRswtBdst[]; rswtMapCount: number; + rswtMapExcelList:[] isInit: boolean; rswtSttHeadList: CommonTableProps[]; rswtSttNodeList: CommonTableProps[]; @@ -20,10 +23,9 @@ export type rswtMapState = { type rswtMapActions = { rswtMapInit: (page: number, total: number, cityOrSgg: string) => void; rswtMapSearch: ( - page: number, - total: number, - cityOrSgg: string, - searchTxt?: string + isExcel: boolean, page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[] ) => void; rswtMapDetile: (featureCd: string) => Promise; }; @@ -34,6 +36,7 @@ export const rswtMapStateExport: rswtMapState = { rswtMap: { isInit: false, rswtMapRes: [], + rswtMapExcelList:[], rswtMapCount: 1, rswtSttHeadList: rswtSttHeadListExport, rswtSttNodeList: rswtSttNodeListExport, @@ -69,32 +72,43 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = ( console.log(e); } }, - rswtMapSearch: async ( - page: number, - total: number, - cityOrSgg: string, - searchTxt?: string + rswtMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[] ) => { try { const rswtMapRes = await getFetchWithCount( fetchType.WR, `/reuseFc/waterreuseFc` + - (page ? `/${page}` : "/1") + - (total ? `/${total}` : "/20") + - (cityOrSgg ? `/${cityOrSgg}` : "/0") + - (searchTxt ? `/${searchTxt}` : "") + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); + if (isExcel) { + const rswtMapExcelList = excelRSwtSttnParsing(rswtMapRes, sidoCode, sggCode); + set((state: rswtMapState) => { + return { + ...state, + rswtMap: { + ...state.rswtMap, + rswtMapExcelList:rswtMapExcelList + }, + }; + }); + }else{ - set((state: rswtMapState) => { - return { - ...state, - rswtMap: { - ...state.rswtMap, - rswtMapRes: rswtMapRes.data, - rswtMapCount: rswtMapRes.count, - }, - }; - }); + set((state: rswtMapState) => { + return { + ...state, + rswtMap: { + ...state.rswtMap, + rswtMapRes: rswtMapRes.data, + rswtMapCount: rswtMapRes.count, + }, + }; + }); + } } catch (e) { console.log(e); } diff --git a/apps/wr/app/store/map/ruseMap/index.tsx b/apps/wr/app/store/map/ruseMap/index.tsx index 6333846b4..cd11bcbd1 100644 --- a/apps/wr/app/store/map/ruseMap/index.tsx +++ b/apps/wr/app/store/map/ruseMap/index.tsx @@ -8,6 +8,7 @@ import { import type { ReturnType } from "@common/business_components/ui"; import { hasuListFetch } from "../../ruseFcltMng/fcltSttn/pbnstSttn"; import type { customPbnst } from "../../ruseFcltMng/fcltReg/pbnstReg/type"; +import { excelPbnstSttnParsing } from "../../ruseFcltMng/fcltSttn/pbnstSttn/excel"; export const ruseMapSize = 15; export type ruseMapState = { @@ -16,6 +17,7 @@ export type ruseMapState = { ruseMapCount: number; isInit: boolean; fclts: string[]; + ruseExcelList:[]; ruseDetailList: customPbnst[]; ruseMapHeadList: CommonTableProps[]; ruseMapNodeList: CommonTableProps[]; @@ -29,7 +31,16 @@ type ruseMapActions = { total: number, reurnValue: ReturnType, year: string, - fclts: string[] + fclts: string[], + isExcel:boolean + ) => void; + ruseMapSearch: ( + page: number, + total: number, + reurnValue: ReturnType, + year: string, + fclts: string[], + fcltNm:string ) => void; ruseMapDetail: (ruseFcltId: string) => Promise; getRuseMaplList: (bscFctCd: string) => void; @@ -45,6 +56,7 @@ export const ruseMapStateExport: ruseMapState = { ruseDetailList: [], fclts: [], ruseMapCount: 1, + ruseExcelList:[], ruseMapHeadList: pbnSttHeadListExport, ruseMapNodeList: pbnstSttNodeListExport, }, @@ -69,7 +81,8 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( total: number, reurnValue: ReturnType, year: string, - fclts: string[] + fclts: string[], + isExcel:boolean ) => { try { const ruseMapRes = await hasuListFetch( @@ -80,7 +93,7 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( year, fclts ); - + if(!isExcel){ set((state: ruseMapState) => { return { ...state, @@ -92,6 +105,19 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( }, }; }); + }else{ + const ruseMapExcel = excelPbnstSttnParsing(ruseMapRes.data); + + set((state: ruseMapState) => { + return { + ...state, + ruseMap: { + ...state.ruseMap, + ruseExcelList: ruseMapExcel, + }, + }; + }); + } } catch (e) { console.log(e); } @@ -148,5 +174,38 @@ export const ruseMapActionsExport: (set: any) => ruseMapActions = ( throw errorHasu; // 호출부에서 catch 가능하도록 } }, + ruseMapSearch: async ( + page: number, + total: number, + reurnValue: ReturnType, + year: string, + fclts: string[], + fcltNm:string + ) => { + try { + const ruseMapRes = await hasuListFetch( + String(page), + String(total), + reurnValue, + fcltNm, + year, + fclts, + ); + + set((state: ruseMapState) => { + return { + ...state, + ruseMap: { + ...state.ruseMap, + ruseMapRes: ruseMapRes.data, + ruseMapCount: ruseMapRes.count, + isInit: false, + }, + }; + }); + } catch (e) { + console.log(e); + } + }, }; }; diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx index bb0c18d6a..cd320cd06 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx @@ -61,49 +61,49 @@ export const reUseCaseNames: nameMap = { "사업비 정산_국고비율(백만원)": "clclnEcqrRt" } -interface PbnstSttnItem { - rvbsn: string; - lgbsn: number; - mdmbsn?: string; - rgnNm?: string; - sido?: number; - gugun?: number; - bscFctNm?: string; - efflWqltStndrdNm?: string; - fctCpc?: number; - tel?: string; - ruseUtztnFcltNm?: string; - fcltCpct?: number; - splyExtraCpct?: number; - ruseCpct?: number; - usageTotal?: number; - inUsage?: number; - outUsage?: number; -} +// interface PbnstSttnItem { +// rvbsn: string; +// lgbsn: number; +// mdmbsn?: string; +// rgnNm?: string; +// sido?: number; +// gugun?: number; +// bscFctNm?: string; +// efflWqltStndrdNm?: string; +// fctCpc?: number; +// tel?: string; +// ruseUtztnFcltNm?: string; +// fcltCpct?: number; +// splyExtraCpct?: number; +// ruseCpct?: number; +// usageTotal?: number; +// inUsage?: number; +// outUsage?: number; +// } -export const excelPbnstSttnParsing = (data: PbnstSttnItem[]): string[][] => { - const excelExportData: string[][] = []; +// export const excelPbnstSttnParsing = (data: PbnstSttnItem[]): string[][] => { +// const excelExportData: string[][] = []; - data.forEach((item) => { - excelExportData.push([ - item.rvbsn, - String(item.lgbsn), - item.mdmbsn ?? "", - item.rgnNm ?? "", - String(item.sido ?? ""), - String(item.gugun ?? ""), - String(item.bscFctNm ?? ""), - String(item.efflWqltStndrdNm ?? ""), - String(item.fctCpc ?? ""), - String(item.tel ?? ""), - String(item.ruseUtztnFcltNm ?? ""), - String(item.fcltCpct ?? ""), - String(item.splyExtraCpct ?? ""), - String(item.ruseCpct ?? ""), - String(item.usageTotal ?? ""), - String(item.inUsage ?? ""), - String(item.outUsage ?? ""), - ]) - }) - return excelExportData; -}; \ No newline at end of file +// data.forEach((item) => { +// excelExportData.push([ +// item.rvbsn, +// String(item.lgbsn), +// item.mdmbsn ?? "", +// item.rgnNm ?? "", +// String(item.sido ?? ""), +// String(item.gugun ?? ""), +// String(item.bscFctNm ?? ""), +// String(item.efflWqltStndrdNm ?? ""), +// String(item.fctCpc ?? ""), +// String(item.tel ?? ""), +// String(item.ruseUtztnFcltNm ?? ""), +// String(item.fcltCpct ?? ""), +// String(item.splyExtraCpct ?? ""), +// String(item.ruseCpct ?? ""), +// String(item.usageTotal ?? ""), +// String(item.inUsage ?? ""), +// String(item.outUsage ?? ""), +// ]) +// }) +// return excelExportData; +// }; \ No newline at end of file diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx index b57e0edde..65f02e26b 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/excel.tsx @@ -22,13 +22,13 @@ export const excelRainSttnParsing = ( String(item.chgBuilding.length > 0 ? "Y" : "N"), String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), - String(item.reuseBuilding?.[0]?.instlCst ?? ""), + String(item.reuseBuilding?.[0]?.instlCst === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.instlCst) ?? ""), item.reuseBuilding?.[0]?.rainyObj?.pntfColKnd ?? "", - String(item.reuseBuilding?.[0]?.rainyObj?.pntfColArea ?? ""), + String(item.reuseBuilding?.[0]?.rainyObj?.pntfColArea === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.rainyObj?.pntfColArea) ?? ""), String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctYn ?? ""), - String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctCpct ?? ""), + String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctCpct === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctCpct) ?? ""), String(item.reuseBuilding?.[0]?.rainyObj?.filtrTrtmfctPrs ?? ""), - String(item.reuseBuilding?.[0]?.rainyObj?.dtfcltCpct ?? ""), + String(item.reuseBuilding?.[0]?.rainyObj?.dtfcltCpct === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.rainyObj?.dtfcltCpct) ?? ""), String(item.reuseBuilding?.[0]?.instlCstSprtYn ?? ""), String(item.reuseBuilding?.[0]?.instlCstSprtAmt === -1 ? "확인불가" : String(item.reuseBuilding?.[0]?.instlCstSprtAmt) ?? ""), String(item.reuseBuilding?.[0]?.grntchBdstCertYn ?? ""), diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx index 803dc2d83..b3d3835c2 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx @@ -25,7 +25,7 @@ export const excelRSwtSttnParsing = ( String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시 String(item.reuseBuilding?.[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding?.[0]?.instlCst ?? ""), //설치비용 item.reuseBuilding?.[0]?.rswtrObj?.orgwtKndCd ?? "", //원수종류 - String(item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct ?? ""), //처리시설용량 + String(item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct === -1 ? "확인불가" : item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct ?? ""), //처리시설용량 String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctProcs ?? ""), //주요처리공정 String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctUsgCd ?? ""), //이용용도 String(item.reuseBuilding?.[0]?.instlCstSprtYn ?? ""), //설치지원비용여부 diff --git a/apps/wr/components/lib/func/mapUtil.ts b/apps/wr/components/lib/func/mapUtil.ts index 155bd5c07..a23b48484 100644 --- a/apps/wr/components/lib/func/mapUtil.ts +++ b/apps/wr/components/lib/func/mapUtil.ts @@ -133,7 +133,9 @@ export function featurePopUpOpen(layerNm:string,featureCd:string,popupDetailRef) const height = String(layerNm) === "tb_wr_bdst_ruse_fclt" ? Math.floor(window.innerHeight - 100) - : Math.floor(window.innerHeight - 450); // 150px 여백 확보; // calc(100% - 70px) + : String(layerNm) === "tb_wr_ruse_fclt_dmd_co" + ?Math.floor(window.innerHeight - 430) + : Math.floor(window.innerHeight - 300); // 150px 여백 확보; // calc(100% - 70px) const left = (window.screen.availWidth - width) / 2; const top = (window.screen.availHeight - height) / 2; const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes `; diff --git a/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx b/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx index 05589e38a..dd280a53f 100644 --- a/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx @@ -1,7 +1,12 @@ import { useWrStore } from "@/app/store"; +import { htdfMapSize } from "@/app/store/map/htdflMap"; import { rainMapSize } from "@/app/store/map/rainMap"; import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; -import { getCity, tableData } from "@/components/lib/func/commom"; +import { + excelDownload, + getCity, + tableData, +} from "@/components/lib/func/commom"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { ContentsDiv, @@ -17,15 +22,26 @@ import { import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; +import toast from "react-hot-toast"; +import { useTranslation } from "react-i18next"; export function HtdflFacility({ rtnFeature, }: { rtnFeature: (feature: any) => void; }) { - const { code, htdfMap, htdfMapInit,htdfMapSearch } = useWrStore((state) => state); - const { htdfMapCount, htdfMapRes, htdfSttHeadList, htdfSttNodeList } = - htdfMap; + const { code, htdfMap, htdfMapInit, htdfMapSearch } = useWrStore( + (state) => state + ); + const { t } = useTranslation("base"); + + const { + htdfMapCount, + htdflMapExcelList, + htdfMapRes, + htdfSttHeadList, + htdfSttNodeList, + } = htdfMap; const [htdflTable, setHtdflTable] = useState(); const [isReset, setIsReset] = useState(false); const [selectSgg, setSelectSgg] = useState(); @@ -86,6 +102,19 @@ export function HtdflFacility({ setHtdflTable(chData); }, [code, htdfMapRes]); + useEffect(() => { + if (htdflMapExcelList.length > 0) { + excelDownload( + htdflMapExcelList, + "온배수시설 현황", + "sample_htdflSttn.xlsx", + "A1:R3" + ); + } else { + toast.error(t("excelDownErrMsg")); + } + }, [htdflMapExcelList]); + return ( <> @@ -115,17 +144,50 @@ export function HtdflFacility({ /> { setSearchTxt(e); }} - /> + />{" "} + +
- + */}
-
+
0) { - htdfMapSearch( - page, - rainMapSize, - String(con), - seartchTxt ?? "" - ); - } else { - htdfMapSearch(page, rainMapSize, String(con)); - } + htdfMapSearch( + false, + page, + String(htdfMapSize), + String(con), + seartchTxt||'', + code.cityCd, + code.sggCd + ); setIsReset(false); } }} diff --git a/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx index e1a917e8f..a19744320 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx @@ -1,7 +1,7 @@ import { useWrStore } from "@/app/store"; import { rainMapSize } from "@/app/store/map/rainMap"; import type { customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { getCity, tableData } from "@/components/lib/func/commom"; +import { excelDownload, getCity, tableData } from "@/components/lib/func/commom"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { ContentsDiv, @@ -17,6 +17,8 @@ import { import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; +import toast from "react-hot-toast"; +import { useTranslation } from "react-i18next"; export function RainFacility({ rtnFeature, @@ -26,7 +28,7 @@ export function RainFacility({ const { code, rainMap, rainMapInit, rainMapSearch } = useWrStore( (state) => state ); - const { rainMapRes, rainMapCount, rainSttHeadList, rainSttNodeList } = + const { rainMapRes, rainMapExcelList,rainMapCount, rainSttHeadList, rainSttNodeList } = rainMap; const [rainTable, setRainTable] = useState(); const [isReset, setIsReset] = useState(false); @@ -35,6 +37,7 @@ export function RainFacility({ sgg: "", city: "", }); + const { t } = useTranslation('base'); const [seartchTxt, setSearchTxt] = useState(); @@ -116,7 +119,18 @@ export function RainFacility({ .filter((item: any) => item.rainyObj !== undefined); setRainTable(chData); }, [code, rainMapRes]); - + useEffect(() => { + if (rainMapExcelList.length > 0) { + excelDownload( + rainMapExcelList, + "빗물재이용시설 현황", + "sample_rainSttn.xlsx", + "A1:W3" + ); + } else { + toast.error(t("excelDownErrMsg")); + } + }, [rainMapExcelList]); return ( <> @@ -146,17 +160,50 @@ export function RainFacility({ /> { setSearchTxt(e); }} /> + +
- + */}
@@ -187,16 +243,16 @@ export function RainFacility({ ? objSearch.sgg : objSearch.city; if (con) { - if (seartchTxt && seartchTxt?.length > 0) { - rainMapSearch( - page, - rainMapSize, - String(con), - seartchTxt ?? "" - ); - } else { - rainMapSearch(page, rainMapSize, String(con)); - } + rainMapSearch( + false, + page, + String(rainMapSize), + String(con), + seartchTxt ?? "", + code.cityCd, + code.sggCd + ); + setIsReset(false); } }} diff --git a/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx b/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx index 18a2b2c1d..c6bb80468 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx @@ -1,57 +1,71 @@ import { useWrStore } from "@/app/store"; import { rainMapSize } from "@/app/store/map/rainMap"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; -import { getCity, tableData } from "@/components/lib/func/commom"; +import { excelDownload, getCity, tableData } from "@/components/lib/func/commom"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; -import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui"; +import { + ContentsDiv, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, + Title, + UiTable, + type SelectDataType, +} from "@common/business_components/ui"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; +import toast from "react-hot-toast"; +import { useTranslation } from "react-i18next"; export function RswtFacility({ rtnFeature, }: { rtnFeature: (feature: any) => void; }) { - const { code, rswtMap, rswtMapInit,rswtMapSearch } = useWrStore((state) => state); - const { rswtMapRes, rswtMapCount, rswtSttHeadList, rswtSttNodeList } = + const { code, rswtMap, rswtMapInit, rswtMapSearch } = useWrStore( + (state) => state + ); + const { rswtMapRes, rswtMapExcelList, rswtMapCount, rswtSttHeadList, rswtSttNodeList } = rswtMap; const [rswtrTable, setRswtrTable] = useState(); const [isReset, setIsReset] = useState(false); - const [selectSgg, setSelectSgg] = useState(); - const [objSearch, setObjSearch] = useState({ - sgg: "", - city: "", - }); - - const [seartchTxt, setSearchTxt] = useState(); - - const getSelCity = useCallback( - (val: string | number) => { - const cityValue = String(val); - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: "0" }); - }, - [code.sggCd] - ); - - const getSgg = useCallback((val: string | number) => { - setObjSearch((prev) => ({ ...prev, sgg: String(val) })); - }, []); - - useEffect(() => { - // code.cityCd 데이터가 로드되었고, 아직 시/도 선택이 안된 초기 상태일 때 실행 - if (code.cityCd && code.cityCd.length > 0 && !objSearch.city) { - const firstCityVal = code.cityCd[0]?.val; - if (firstCityVal) { - // 첫 번째 시/도 값으로 상태를 초기화합니다. - getSelCity(firstCityVal); - } + const [objSearch, setObjSearch] = useState({ + sgg: "", + city: "", + }); + const { t } = useTranslation('base'); + + const [seartchTxt, setSearchTxt] = useState(); + + const getSelCity = useCallback( + (val: string | number) => { + const cityValue = String(val); + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + setObjSearch({ city: cityValue, sgg: "0" }); + }, + [code.sggCd] + ); + + const getSgg = useCallback((val: string | number) => { + setObjSearch((prev) => ({ ...prev, sgg: String(val) })); + }, []); + + useEffect(() => { + // code.cityCd 데이터가 로드되었고, 아직 시/도 선택이 안된 초기 상태일 때 실행 + if (code.cityCd && code.cityCd.length > 0 && !objSearch.city) { + const firstCityVal = code.cityCd[0]?.val; + if (firstCityVal) { + // 첫 번째 시/도 값으로 상태를 초기화합니다. + getSelCity(firstCityVal); } - }, [code.cityCd, objSearch.city, getSelCity]); + } + }, [code.cityCd, objSearch.city, getSelCity]); const rswtCellClick = (index: number | undefined, headId: string) => { if ( headId !== "chBuildingYn" && @@ -100,6 +114,19 @@ export function RswtFacility({ ); setRswtrTable(chData); }, [code, rswtMapRes]); + + useEffect(() => { + if (rswtMapExcelList.length > 0) { + excelDownload( + rswtMapExcelList, + "중수도시설 현황", + "sample_rswtSttn.xlsx", + "A1:W3", + ); + } else { + toast.error(t('excelDownErrMsg')); + } + }, [rswtMapExcelList]); return ( <> @@ -129,18 +156,14 @@ export function RswtFacility({ /> { setSearchTxt(e); }} /> -
- - -
+ +
+ + +
+ {/* */}
@@ -166,22 +226,23 @@ export function RswtFacility({ }} onPageChange={(page) => { const con = - objSearch.sgg && objSearch.sgg !== "0" - ? objSearch.sgg - : objSearch.city; - if (con) { - if (seartchTxt && seartchTxt?.length > 0) { + objSearch.sgg && objSearch.sgg !== "0" + ? objSearch.sgg + : objSearch.city; + if (con) { rswtMapSearch( + false, page, - rainMapSize, + String(rainMapSize), String(con), - seartchTxt ?? "" + seartchTxt ?? "", + code.cityCd, + code.sggCd ); - } else { - rswtMapSearch(page, rainMapSize, String(con)); + + setIsReset(false); } - setIsReset(false); - }}} + }} resetPageNo={isReset} > diff --git a/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx index 4fd9c684f..f171cdf6b 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx @@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { ruseMapSize } from "@/app/store/map/ruseMap"; import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type"; -import { yearOptions } from "@/components/lib/func/commom"; +import { excelDownload, yearOptions } from "@/components/lib/func/commom"; import { ContentsDiv, SearchBaseForm, @@ -14,17 +14,20 @@ import { } from "@common/business_components/ui"; import { Label } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; +import toast from "react-hot-toast"; +import { useTranslation } from "react-i18next"; export function RuseFacility({ rtnFeature, }: { rtnFeature: (feature: any) => void; }) { - const { code, ruseMap, ruseMapInit, getMapFlcts } = useWrStore( + const { code, ruseMap, ruseMapInit, getMapFlcts,ruseMapSearch } = useWrStore( (state) => state ); + const { t } = useTranslation("base"); - const { ruseMapCount, fclts, ruseMapRes,ruseMapHeadList } = ruseMap; + const { ruseMapCount, ruseExcelList,fclts, ruseMapRes,ruseMapHeadList } = ruseMap; const [ruseTable, setRuseTable] = useState(); const [isReset, setIsReset] = useState(false); @@ -48,9 +51,26 @@ export function RuseFacility({ } }, [ruseMap.isInit]); useEffect(() => { - ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts); + ruseMapInit(1,ruseMapSize, ref.current, searchYear, fclts,false); }, [fclts]); + + useEffect(()=>{ + if(ruseExcelList&&ruseExcelList.length>0){ + if (ruseExcelList.length > 0) { + excelDownload( + ruseExcelList, + "하수재이용시설 현황", + "sample_pbnstSttn.xlsx", + "A1:U2", + 3 + ); + } else { + toast.error(t('excelDownErrMsg')); + } + } + + },[ruseExcelList]) useEffect(() => { if (ruseMapRes && ruseMapRes.length > 0) { setRuseTable(ruseMapRes); @@ -113,7 +133,7 @@ export function RuseFacility({ ref={ref} isAdmin={false} excelClick={function (returnType: ReturnType): void { - console.log("pbnstSttnSearch ", returnType); + ruseMapInit(1,100000 , returnType, searchYear, fclts,true); }} />
@@ -127,7 +147,12 @@ export function RuseFacility({ headName={""} cellClick={ruseCellClick} onPageChange={(page) => { - ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts); + if(pbnRuseNm&&pbnRuseNm.length>0){ + ruseMapSearch(page,ruseMapSize , ref.current, searchYear, fclts,pbnRuseNm) + }else{ + ruseMapInit(page,ruseMapSize , ref.current, searchYear, fclts,false); + } + setIsReset(false); }} resetPageNo={isReset}