From 88838dda0be069d5bae6bb81e19ab4b8410e9f21 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Fri, 25 Jul 2025 15:46:34 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/dm/app/(popup-layout)/map/popup/page.tsx | 14 ++++++++++++++ apps/dm/app/store/map/index.tsx | 18 ++++++++++++++++-- apps/dm/app/store/map/type.tsx | 5 +++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/apps/dm/app/(popup-layout)/map/popup/page.tsx b/apps/dm/app/(popup-layout)/map/popup/page.tsx index 06ffdba87..908f2f09c 100644 --- a/apps/dm/app/(popup-layout)/map/popup/page.tsx +++ b/apps/dm/app/(popup-layout)/map/popup/page.tsx @@ -5,8 +5,22 @@ import { useEffect, useRef, useState, useCallback } from "react"; import { mapService } from "../service"; import GisApp from "@common/business_components/ui/map/lib/gis.core"; import { SearchBar } from "@/components/ui/map/searchBar/searchBar"; +import { useDmStore } from "@/app/store"; +// export type SubsInfo={ +// ruseUtztnFcltNm: string; // 재이용시설명 +// ruseUtztnFcltCd: string; // 재이용시설 코드 +// } const Map = () => { + + //수요처 저장하는 함수 setSubsInfo + //setSubsInfo(subsInfo:SubsInfo[]):void + const { map,setSubsInfo } = useDmStore( + (state) => state + ); + //저장된 수요처 리스트 + const { subsInfo } = map; + const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 const gisMaps = useRef(null); const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 diff --git a/apps/dm/app/store/map/index.tsx b/apps/dm/app/store/map/index.tsx index f40e169f2..888c8341a 100644 --- a/apps/dm/app/store/map/index.tsx +++ b/apps/dm/app/store/map/index.tsx @@ -1,6 +1,6 @@ import { getFetch } from "@/components/ui/api"; import { DEV_URL_FO } from "@/components/ui/config"; -import type { FacilityInfo } from "./type"; +import type { FacilityInfo, SubsInfo } from "./type"; const checkWrRegList = async () => { const wrRegList = await getFetch("wr", `/reuseFc/pubFc`); @@ -56,17 +56,20 @@ const getRuseFclt = async ( export type DmMapActions = { findRuseFclt(sggOrCity:string, searchTxt: string): void; + setSubsInfo(subsInfo:SubsInfo[]):void }; export type DmMapType = { map: { ruseFcltList: FacilityInfo[]; + subsInfo:SubsInfo[] }; }; export const dmMapState: DmMapType = { map: { ruseFcltList: [], + subsInfo:[] }, }; export type DmMapStore = DmMapType & DmMapActions; @@ -77,11 +80,22 @@ export const DmMapReducer = (set: any): DmMapActions => { const ruseFcltList = await getRuseFclt('1', sggOrCity,searchTxt); set((state: DmMapType) => ({ + ...state, map: { ...state.map, ruseFcltList :ruseFcltList.data }, })); - }, + },setSubsInfo: async (subsInfo: SubsInfo[]) => { + set((state: DmMapType) => ({ + ...state, + map: { + ...state.map, + subsInfo: subsInfo, + }, + })); + + } + }; }; diff --git a/apps/dm/app/store/map/type.tsx b/apps/dm/app/store/map/type.tsx index 4d6cea0ac..adcaf7f37 100644 --- a/apps/dm/app/store/map/type.tsx +++ b/apps/dm/app/store/map/type.tsx @@ -31,4 +31,9 @@ export type FacilityInfo= { tel: string; // 전화번호 rswtrYn: string; // 재이용수 여부 ("Y" 또는 "N") ruse: boolean; // 재이용 여부 (boolean) + } + + export type SubsInfo={ + ruseUtztnFcltNm: string; // 재이용시설명 + ruseUtztnFcltCd: string; // 재이용시설 코드 } \ No newline at end of file