diff --git a/apps/wr/app/(map-layout)/map/mainMap/page.tsx b/apps/wr/app/(map-layout)/map/mainMap/page.tsx index 13798ff4f..10421b48b 100644 --- a/apps/wr/app/(map-layout)/map/mainMap/page.tsx +++ b/apps/wr/app/(map-layout)/map/mainMap/page.tsx @@ -22,7 +22,7 @@ import WrOverLay from "@/components/ui/map/wrOverLay/wrOverLay"; const Map = () => { const { code, comMap, rainMapDetile, rswtMapDetile, getRuseMaplListReturn - , pbnMapDetaile, ldrmntMapDetile, htdfMapDetile, coSttnMapDetail } = useWrStore((state) => state); + , pbnMapDetaile, ldrmntMapDetile, htdfMapDetile, coSttnMapDetail, initCommonCodes } = useWrStore((state) => state); const { isFeatured } = comMap; const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 const gisMaps = useRef(null); @@ -73,6 +73,11 @@ const Map = () => { }; }, []); + useEffect(() => { + if (code.isInit) return; + initCommonCodes(); + }, [code.isInit, initCommonCodes]); + // 체크된 레이어 정보를 받는 핸들러 const handleCheckedLayersChange = ( checkedIds: string[], diff --git a/apps/wr/app/store/common/auth/index.tsx b/apps/wr/app/store/common/auth/index.tsx index feca57c80..6e9396e6e 100644 --- a/apps/wr/app/store/common/auth/index.tsx +++ b/apps/wr/app/store/common/auth/index.tsx @@ -32,7 +32,7 @@ export const authStateExport: authState = { export type authActions = { getMenuAuthrts: (menuCd: number) => void; - getLaeSeCdCheck: () => Promise; + getLaeSeCdCheck: () => Promise; // 로그인 사용자 지역코드 laeSeCd를 조회 후 상태 update getMyUUID: () => Promise; }; export const authActionsExport: (set: any, get: any) => authActions = ( diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index adcff57f2..4f7896de0 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -21,12 +21,12 @@ const codeMApping = { WR002: "rswtBdstType", WR003: "rainFcltCd", WR004: "bdstGrntchClass", - WR005: "rswtPrscCdMthdCd", // 아직 디 못바꿈 - WR006: "orgwtKndCd", //작업 완ㅛ - WR007: "ruseMngMtd", // 작업완료 - WR008: "rusePrcsMthdCd", //w작업완료 - WR009: "erctUswtrPrcsMeth", //w작업완료 - WR010: "ruseFcltSpot", // inout은 yn 만 사용해야 함으로 해당 코드는 사용안함. + WR005: "rswtPrscCdMthdCd", + WR006: "orgwtKndCd", + WR007: "ruseMngMtd", + WR008: "rusePrcsMthdCd", + WR009: "erctUswtrPrcsMeth", + WR010: "ruseFcltSpot", WR011: "pplQulity", WR012: "pplLenght", WR013: "bdstFilterYn", // 사용 불가 yn만 사용해야함으로 해당코드 사용 안함 @@ -312,6 +312,7 @@ export type comCodeActions = { returnCodeText: (val: string, codeName: string) => string; returnTextCode: (text: string, codeName: string) => string; getCommonCodesByKeys: (keys: string[]) => Promise; + initCommonCodes: () => Promise; }; export const codeActionExport: (set: any, get:any) => comCodeActions = (set: any, get:any) => { @@ -368,5 +369,23 @@ export const codeActionExport: (set: any, get:any) => comCodeActions = (set: any const found = codeList.find((item) => item.text === text); return found ? found.val : text; }, + initCommonCodes: async () => { + if (get().code.isInit) return; + + await getSggCd(set); + await getCityCd(set); + await getRegionCd(set); + await getMiddleRegionCd(set); + await getUnitWaterShedCd(set); + await getEnvPartCd(set); + await getCommonUpCd(set); + + set((state) => ({ + code: { + ...state.code, + isInit: true, + }, + })); + }, }; }; diff --git a/apps/wr/app/store/store.tsx b/apps/wr/app/store/store.tsx index fbb3434d9..3024d1cb1 100644 --- a/apps/wr/app/store/store.tsx +++ b/apps/wr/app/store/store.tsx @@ -336,13 +336,13 @@ export const StoreZus = ( } ) => { return createStore()((set ,get) => { - getSggCd(set); - getCityCd(set); - getRegionCd(set); - getMiddleRegionCd(set); - getUnitWaterShedCd(set); - getEnvPartCd(set); - getCommonUpCd(set) + // getSggCd(set); + // getCityCd(set); + // getRegionCd(set); + // getMiddleRegionCd(set); + // getUnitWaterShedCd(set); + // getEnvPartCd(set); + // getCommonUpCd(set); return { ...initState, ...comFcltSearchAction(set),