diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/featureClickEventPopup.tsx index 24f9a3f8d..45fcfb0d4 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/featureClickEventPopup.tsx @@ -12,8 +12,9 @@ import RdiiChart from './chart/rdiiChart'; import { useInfilChartModalStore, useRdiiChartModalStore } from "./chartModalStore"; import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue'; import { codeMapper } from "../common/codeMapper"; -import { searchUpperPpls } from '@common/business_components/ui/map/Gis'; import LoadingOverlay from '@/components/ui/LoadingBar'; +// import GisApp from "@common/business_components/ui/map/lib/gis.core"; +import { searchUpperPpls } from "./smh"; const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { @@ -58,7 +59,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const getSelectedLayers = () => { let result = null; const layers = gisMap.getLayers().getArray(); // gisMap에서 모든 레이어 가져오기 - let featureLayer: { get: (key: string) => any }; // 피처가 속한 레이어를 찾기 위한 변수 + let featureLayer: any = null; // 피처가 속한 레이어를 찾기 위한 변수 layers.some((layer: any) => { const source = layer.getSource(); // if (source && featureData && featureData.fid) { @@ -121,7 +122,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setHeadlist2(untrtSwgRainCol2); setLayerSpecificNm(featureData.values_.manage_no); } - else result = featureLayer.get('lyrNm'); + else result = featureLayer ? featureLayer.get('lyrNm') : null; } else { // SearchModal 클릭 이벤트 @@ -384,6 +385,76 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, // 레이어명에 따라 상세페이지 렌더링 const ContentComponent = layerNm ? getLayerContentComponent(layerNm) : null; + // const searchUpperPpls = async (fcltMngNo: any) => { + // const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; + // const res = await fetch(`${BASE_URL}/v1/fcltmhl/upperPpls/${fcltMngNo}`, { + // method: "GET", + // }); + + // let data = null; + // if (res.ok) { + // try { + // // 응답이 비어있는지 확인 + // const contentLength = res.headers.get("content-length"); + // if (contentLength === "0") + // alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`); + + // // 응답 텍스트를 먼저 가져와서 빈 문자열인지 확인 + // const text = await res.text(); + // if (!text || text.trim() === "") + // alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`); + + // // JSON 파싱 시도 + // data = JSON.parse(text); + // } catch (error) { + // console.error("JSON parsing error:", error); + // alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`); + // } + // } + + // const select: any = GisApp.Module.select; + // // const gisMap = GisApp.Module.core?.map; + // let foundFeature: any = null; + + // data.forEach((item: any) => { + // const pplMngNo = item.ppl_mng_no.trim(); + + // gisMap + // .getLayers() + // .getArray() + // .filter((e: any) => e.get("lyrTyNm") == "tb_ms_swage_ppl") + // .forEach((layer: any) => { + // const source = layer.getSource?.(); + // if (source?.getFeatures) { + // const features = source.getFeatures(); + // for (const f of features) { + // if (f.values_.fclt_mng_no.trim() === pplMngNo) { + // foundFeature = f; + // break; + // } + // } + // } + // }); + + // if (foundFeature) select?.selectMultiFeature?.(foundFeature, true); + // }); + + // if (!foundFeature) alert(`해당 맨홀의 상류관로를 찾을 수 없습니다.`); + + // let geometry = foundFeature?.getGeometry(); + // if (geometry) { + // let extent = geometry.getExtent(); + + // gisMap.getView().fit(extent, { + // duration: 300, + // padding: [50, 50, 50, 50], + // maxZoom: 14, + // constrainResolution: true, + // nearest: true, + // }); + // } + // }; + return (
{label}
- {payload.map((item, index) => ( + {payload.filter(item => item.value != null && String(item.value) != 'NaN' && item.value != undefined).map((item, index) => (