wr: store code 조회 위치 변경

This commit is contained in:
2026-06-04 15:56:28 +09:00
parent ba910d6bfe
commit 54d3a35b38
4 changed files with 39 additions and 15 deletions
@@ -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<any | null>(null);
@@ -73,6 +73,11 @@ const Map = () => {
};
}, []);
useEffect(() => {
if (code.isInit) return;
initCommonCodes();
}, [code.isInit, initCommonCodes]);
// 체크된 레이어 정보를 받는 핸들러
const handleCheckedLayersChange = (
checkedIds: string[],
+1 -1
View File
@@ -32,7 +32,7 @@ export const authStateExport: authState = {
export type authActions = {
getMenuAuthrts: (menuCd: number) => void;
getLaeSeCdCheck: () => Promise<void>;
getLaeSeCdCheck: () => Promise<void>; // 로그인 사용자 지역코드 laeSeCd를 조회 후 상태 update
getMyUUID: () => Promise<string |undefined>;
};
export const authActionsExport: (set: any, get: any) => authActions = (
+25 -6
View File
@@ -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<void>;
initCommonCodes: () => Promise<void>;
};
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,
},
}));
},
};
};
+7 -7
View File
@@ -336,13 +336,13 @@ export const StoreZus = (
}
) => {
return createStore<WrStore>()((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),