수요처 저장 함수 추가

This commit is contained in:
leedj312
2025-07-25 15:46:34 +09:00
parent f2881f3a3a
commit 88838dda0b
3 changed files with 35 additions and 2 deletions
@@ -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<any | null>(null);
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
+16 -2
View File
@@ -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,
},
}));
}
};
};
+5
View File
@@ -31,4 +31,9 @@ export type FacilityInfo= {
tel: string; // 전화번호
rswtrYn: string; // 재이용수 여부 ("Y" 또는 "N")
ruse: boolean; // 재이용 여부 (boolean)
}
export type SubsInfo={
ruseUtztnFcltNm: string; // 재이용시설명
ruseUtztnFcltCd: string; // 재이용시설 코드
}