wr: 공통코드 조회 수정
This commit is contained in:
@@ -371,18 +371,80 @@ export const codeActionExport: (set: any, get:any) => comCodeActions = (set: any
|
||||
},
|
||||
initCommonCodes: async () => {
|
||||
if (get().code.isInit) return;
|
||||
const response = await fetch("/api/common-codes", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
await getSggCd(set);
|
||||
await getCityCd(set);
|
||||
await getRegionCd(set);
|
||||
await getMiddleRegionCd(set);
|
||||
await getUnitWaterShedCd(set);
|
||||
await getEnvPartCd(set);
|
||||
await getCommonUpCd(set);
|
||||
if (!response.ok) {
|
||||
throw new Error(`공통 코드 조회 실패: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
lwCds["rainFcltCd"] = data.rainFcltCd ?? lwCds["rainFcltCd"] ?? [];
|
||||
lwCds["bdstUsgCd"] = data.bdstUsgCd ?? lwCds["bdstUsgCd"] ?? [];
|
||||
lwCds["orgwtKndCd"] = data.orgwtKndCd ?? lwCds["orgwtKndCd"] ?? [];
|
||||
lwCds["pplQulity"] = data.pplQulity ?? lwCds["pplQulity"] ?? [];
|
||||
lwCds["pplLenght"] = data.pplLenght ?? lwCds["pplLenght"] ?? [];
|
||||
lwCds["dmdUszCd"] = data.dmdUszCd ?? lwCds["dmdUszCd"] ?? [];
|
||||
lwCds["sewageOutFclttUse"] =
|
||||
data.sewageOutFclttUse ?? lwCds["sewageOutFclttUse"] ?? [];
|
||||
lwCds["rainRswtMng"] = data.rainRswtMng ?? lwCds["rainRswtMng"] ?? [];
|
||||
lwCds["rainFcltFlowRate"] =
|
||||
data.rainFcltFlowRate ?? lwCds["rainFcltFlowRate"] ?? [];
|
||||
lwCds["ruseMngMtd"] = data.ruseMngMtd ?? lwCds["ruseMngMtd"] ?? [];
|
||||
lwCds["rusePrcsMthdCd"] =
|
||||
data.rusePrcsMthdCd ?? lwCds["rusePrcsMthdCd"] ?? [];
|
||||
lwCds["erctUswtrPrcsMeth"] =
|
||||
data.erctUswtrPrcsMeth ?? lwCds["erctUswtrPrcsMeth"] ?? [];
|
||||
lwCds["bdstGrntchClass"] =
|
||||
data.bdstGrntchClass ?? lwCds["bdstGrntchClass"] ?? [];
|
||||
lwCds["htdPowerMthdCd"] =
|
||||
data.htdPowerMthdCd ?? lwCds["htdPowerMthdCd"] ?? [];
|
||||
lwCds["htdUtztnUsgCd"] =
|
||||
data.htdUtztnUsgCd ?? lwCds["htdUtztnUsgCd"] ?? [];
|
||||
lwCds["rswtBdstType"] =
|
||||
data.rswtBdstType ?? lwCds["rswtBdstType"] ?? [];
|
||||
lwCds["bdstTotalUsgType"] =
|
||||
data.bdstTotalUsgType ?? lwCds["bdstTotalUsgType"] ?? [];
|
||||
|
||||
set((state) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
sggCd: data.sggCd ?? state.code.sggCd,
|
||||
cityCd: data.cityCd ?? state.code.cityCd,
|
||||
rvbsnCd: data.rvbsnCd ?? state.code.rvbsnCd,
|
||||
mdmbsnCd: data.mdmbsnCd ?? state.code.mdmbsnCd,
|
||||
lgbsnCd: data.lgbsnCd ?? state.code.lgbsnCd,
|
||||
lclgvrnmntCd: data.lclgvrnmntCd ?? state.code.lclgvrnmntCd,
|
||||
rainFcltCd: data.rainFcltCd ?? state.code.rainFcltCd,
|
||||
bdstUsgCd: data.bdstUsgCd ?? state.code.bdstUsgCd,
|
||||
orgwtKndCd: data.orgwtKndCd ?? state.code.orgwtKndCd,
|
||||
pplQulity: data.pplQulity ?? state.code.pplQulity,
|
||||
pplLenght: data.pplLenght ?? state.code.pplLenght,
|
||||
dmdUszCd: data.dmdUszCd ?? state.code.dmdUszCd,
|
||||
sewageOutFclttUse:
|
||||
data.sewageOutFclttUse ?? state.code.sewageOutFclttUse,
|
||||
rainRswtMng: data.rainRswtMng ?? state.code.rainRswtMng,
|
||||
rainFcltFlowRate:
|
||||
data.rainFcltFlowRate ?? state.code.rainFcltFlowRate,
|
||||
ruseMngMtd: data.ruseMngMtd ?? state.code.ruseMngMtd,
|
||||
rusePrcsMthdCd:
|
||||
data.rusePrcsMthdCd ?? state.code.rusePrcsMthdCd,
|
||||
erctUswtrPrcsMeth:
|
||||
data.erctUswtrPrcsMeth ?? state.code.erctUswtrPrcsMeth,
|
||||
bdstGrntchClass:
|
||||
data.bdstGrntchClass ?? state.code.bdstGrntchClass,
|
||||
htdPowerMthdCd:
|
||||
data.htdPowerMthdCd ?? state.code.htdPowerMthdCd,
|
||||
htdUtztnUsgCd:
|
||||
data.htdUtztnUsgCd ?? state.code.htdUtztnUsgCd,
|
||||
rswtBdstType: data.rswtBdstType ?? state.code.rswtBdstType,
|
||||
bdstTotalUsgType:
|
||||
data.bdstTotalUsgType ?? state.code.bdstTotalUsgType,
|
||||
isInit: true,
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user