물재이용 공통코드 작업

This commit is contained in:
leedj312
2025-09-15 15:36:56 +09:00
parent 92f12c2104
commit ad6e4484b7
23 changed files with 537 additions and 452 deletions
+56 -57
View File
@@ -1,10 +1,9 @@
import { fetchType, getFetchWithCount } from "@/components/lib/api";
import type { SelectDataType } from "@common/business_components";
export const numSize = 12;
export const txtSize = 20;
export const lwCds: Record<string, SelectDataType[]> = {};
//export const lwCds: Record<string, SelectDataType[]> = {};
export const yn: SelectDataType[] = [
{ val: "Y", text: "Y" },
{ val: "N", text: "N" },
@@ -54,14 +53,14 @@ export const ruseSeCd: SelectDataType[] = [
{ val: "개량", text: "개량" },
];
// export const ruseBizMthdCd: SelectDataType[] = [
// { val: "재정", text: "재정" },
// { val: "민간투자", text: "민간투자" },
// { val: "자체", text: "자체" },
// ];
export const ruseBizMthdCd: SelectDataType[] = [
{ val: "재정", text: "재정" },
{ val: "민간투자", text: "민간투자" },
{ val: "자체", text: "자체" },
];
// 공통 건축물 용도
export const bdstUsgCd: SelectDataType[] =lwCds?.bdstUsgCd?.concat(lwCds?.rswtBdstType??[])??[]
//export const bdstUsgCd: SelectDataType[] =lwCds?.bdstUsgCd?.concat(lwCds?.rswtBdstType??[])??[]
// [
// { val: "-1", text: "확인불가" },
@@ -112,7 +111,7 @@ export const bdstUsgCd: SelectDataType[] =lwCds?.bdstUsgCd?.concat(lwCds?.rswtBd
// { val: "45", text: "기타" },
// ];
export const rswtBdstType: SelectDataType[] = lwCds?.rswtBdstType??[]
// export const rswtBdstType: SelectDataType[] = lwCds?.rswtBdstType??[]
//[
// { val: "17", text: "숙박업" },
// { val: "18", text: "목욕장업" },
@@ -221,7 +220,7 @@ export const chBuCd = [
// ];
//물리화학적처리(스크린, 응집, 침전)/생물학적처리(활성슬러지법 등)/소독(염소, UV 등)/기타
export const rswtPrscCdMthdCd = lwCds['rswtPrscCdMthdCd']??[]
//export const rswtPrscCdMthdCd = lwCds['rswtPrscCdMthdCd']??[]
// {
// val: "물리화학적처리(스크린,응집,침전)",
// text: "물리화학적처리(스크린,응집,침전)",
@@ -389,55 +388,55 @@ export const sewageOutFclttUse = [
text: "공업용수",
},
];
const codeMApping = {
WR001: "bdstUsgCd",
WR002: "rswtBdstType",
WR003: "rainFcltCd",
WR004: "bdstGrntchClass",
WR005: "rswtPrscCdMthdCd", // 아직 디 못바꿈
WR006: "orgwtKndCd", //작업 완ㅛ
WR007: "ruseMngMtd", // 작업완료
WR008: "rusePrcsMthdCd", //w작업완료
WR009: "erctUswtrPrcsMeth",//w작업완료
WR010: "ruseFcltSpot",// inout은 yn 만 사용해야 함으로 해당 코드는 사용안함.
WR011: "pplQulity",
WR012: "pplLenght",
WR013: "bdstFilterYn", // 사용 불가 yn만 사용해야함으로 해당코드 사용 안함
WR014: "rainRswtMng", // 지도점검 등록 시변경
WR015: "rainFcltFlowRate", //지도점검 등록 시변경
WR016: "dmdUszCd", // 지도점검 등록 시변경
WR017: "sewageInFcltUse", //하수재이용 장내
WR018: "sewageOutFclttUse", // 하수재이용 장외
WR019: "htdPowerMthdCd",
WR020: "htdUtztnUsgCd",
};
export const getCommonUpCd = async () => {
const upCd = await getFetchWithCount(
fetchType.LOCAL,
"/cms-service/api/v1/up-codes?keyword=&upCd=&cdSe=&useYn=Y&siteId=WR&page=0&size=100&sort=string"
);
// const codeMApping = {
// WR001: "bdstUsgCd",
// WR002: "rswtBdstType",
// WR003: "rainFcltCd",
// WR004: "bdstGrntchClass",
// WR005: "rswtPrscCdMthdCd", // 아직 디 못바꿈
// WR006: "orgwtKndCd", //작업 완ㅛ
// WR007: "ruseMngMtd", // 작업완료
// WR008: "rusePrcsMthdCd", //w작업완료
// WR009: "erctUswtrPrcsMeth",//w작업완료
// WR010: "ruseFcltSpot",// inout은 yn 만 사용해야 함으로 해당 코드는 사용안함.
// WR011: "pplQulity",
// WR012: "pplLenght",
// WR013: "bdstFilterYn", // 사용 불가 yn만 사용해야함으로 해당코드 사용 안함
// WR014: "rainRswtMng", // 지도점검 등록 시변경
// WR015: "rainFcltFlowRate", //지도점검 등록 시변경
// WR016: "dmdUszCd", // 지도점검 등록 시변경
// WR017: "sewageInFcltUse", //하수재이용 장내
// WR018: "sewageOutFclttUse", // 하수재이용 장외
// WR019: "htdPowerMthdCd",
// WR020: "htdUtztnUsgCd",
// };
// export const getCommonUpCd = async () => {
// const upCd = await getFetchWithCount(
// fetchType.LOCAL,
// "/cms-service/api/v1/up-codes?keyword=&upCd=&cdSe=&useYn=Y&siteId=WR&page=0&size=100&sort=string"
// );
const upWrCode: string[] = upCd.content
.filter((item: any) => item.upCd.slice(0, 2) === "WR")
.map((cd: any) => cd.upCd);
// const upWrCode: string[] = upCd.content
// .filter((item: any) => item.upCd.slice(0, 2) === "WR")
// .map((cd: any) => cd.upCd);
await Promise.all(
upWrCode.map(async (cd) => {
const mapping = codeMApping[cd as keyof typeof codeMApping];
if (!mapping) return;
// await Promise.all(
// upWrCode.map(async (cd) => {
// const mapping = codeMApping[cd as keyof typeof codeMApping];
// if (!mapping) return;
const lwCd = await getFetchWithCount(
fetchType.LOCAL,
`/cms-service/api/v1/lwpo-cds/up-cd/${cd}`
);
// const lwCd = await getFetchWithCount(
// fetchType.LOCAL,
// `/cms-service/api/v1/lwpo-cds/up-cd/${cd}`
// );
const list = Array.isArray(lwCd) ? lwCd : lwCd.content ?? [];
// const list = Array.isArray(lwCd) ? lwCd : lwCd.content ?? [];
lwCds[mapping] = list.map((it: any) => ({
text: it.lwpoCdNm,
val: it.lwpoCd,
}));
})
);
};
// lwCds[mapping] = list.map((it: any) => ({
// text: it.lwpoCdNm,
// val: it.lwpoCd,
// }));
// })
// );
// console.log('lwCds ', lwCds)
// };