물재이용 공통코드 작업
This commit is contained in:
@@ -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)
|
||||
// };
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getFetch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
|
||||
import type {
|
||||
EnvPartSelectDataType,
|
||||
SelectDataType,
|
||||
@@ -7,14 +7,94 @@ import {
|
||||
bdstFilterYn,
|
||||
bdstIncenYn,
|
||||
chBuCd,
|
||||
lwCds,
|
||||
rswtPrscCdMthdCd,
|
||||
ruseBizMthdCd,
|
||||
ruseSeCd,
|
||||
yn,
|
||||
} from "./basicCode";
|
||||
export const btnClass = "p-4 m-2 text-white rounded-sm text-lg font-medium ";
|
||||
|
||||
const laeSecd = "41";
|
||||
export const lwCds: Record<string, SelectDataType[]> = {};
|
||||
|
||||
|
||||
|
||||
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 (set:any) => {
|
||||
|
||||
try {
|
||||
let lwCdCode :Record<string, SelectDataType[]> = {};
|
||||
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);
|
||||
|
||||
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 list = Array.isArray(lwCd) ? lwCd : lwCd.content ?? [];
|
||||
|
||||
lwCds[mapping] = list.map((it: any) => ({
|
||||
text: it.lwpoCdNm,
|
||||
val: it.lwpoCd,
|
||||
}));
|
||||
})
|
||||
);
|
||||
lwCdCode=lwCds
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
...state.code,
|
||||
rainFcltCd: lwCdCode['rainFcltCd']??[],
|
||||
bdstUsgCd: lwCdCode['bdstUsgCd']??[] ,
|
||||
orgwtKndCd: lwCdCode['orgwtKndCd']??[] ,
|
||||
pplQulity: lwCdCode['pplQulity']??[] ,
|
||||
pplLenght: lwCdCode['pplLenght']??[] ,
|
||||
dmdUszCd: lwCdCode['dmdUszCd']??[] ,
|
||||
ruseMngMtd: lwCdCode['ruseMngMtd']??[],
|
||||
rusePrcsMthdCd: lwCdCode['rusePrcsMthdCd']??[],
|
||||
erctUswtrPrcsMeth: lwCdCode['erctUswtrPrcsMeth']??[],
|
||||
bdstGrntchClass: lwCdCode['bdstGrntchClass']??[],
|
||||
htdPowerMthdCd: lwCdCode['htdPowerMthdCd']??[],
|
||||
htdUtztnUsgCd: lwCdCode['htdUtztnUsgCd']??[],
|
||||
rswtBdstType:lwCdCode['rswtBdstType']??[] ,
|
||||
},
|
||||
}));
|
||||
}catch(e){
|
||||
console.log('com code error ', e)
|
||||
}
|
||||
|
||||
};
|
||||
//물재이용 주소 코드: devU01TX0FVVEgyMDI1MDgyNTEwMzkwNDExNjEwNTM=
|
||||
export const buildingType = {
|
||||
RST: "RST",
|
||||
@@ -172,7 +252,7 @@ export type comCodeState = {
|
||||
bdstFilterYn: SelectDataType[];
|
||||
bdstIncenYn: SelectDataType[];
|
||||
bdstGrntchClass: SelectDataType[];
|
||||
rswtPrscCdMthdCd: SelectDataType[];
|
||||
// rswtPrscCdMthdCd: SelectDataType[];
|
||||
htdPowerMthdCd: SelectDataType[];
|
||||
htdUtztnUsgCd: SelectDataType[];
|
||||
rswtBdstType:SelectDataType[];
|
||||
@@ -202,13 +282,13 @@ export const comCodeStateExport: comCodeState = {
|
||||
buildingType: buildingType,
|
||||
ruseMngMtd: lwCds['ruseMngMtd']??[],
|
||||
ruseSeCd: ruseSeCd,
|
||||
ruseBizMthdCd: lwCds['ruseBizMthdCd']??[],
|
||||
ruseBizMthdCd: ruseBizMthdCd,
|
||||
rusePrcsMthdCd: lwCds['rusePrcsMthdCd']??[],
|
||||
erctUswtrPrcsMeth: lwCds['erctUswtrPrcsMeth']??[],
|
||||
bdstFilterYn: bdstFilterYn,
|
||||
bdstIncenYn: bdstIncenYn,
|
||||
bdstGrntchClass: lwCds['bdstGrntchClass']??[],
|
||||
rswtPrscCdMthdCd: rswtPrscCdMthdCd, // 공단연락오면 바꿔야함
|
||||
// rswtPrscCdMthdCd: rswtPrscCdMthdCd, // 공단연락오면 바꿔야함
|
||||
htdPowerMthdCd: lwCds['htdPowerMthdCd']??[],
|
||||
htdUtztnUsgCd: lwCds['htdUtztnUsgCd']??[],
|
||||
userSiSggCd: laeSecd,
|
||||
|
||||
Reference in New Issue
Block a user