공통코드 작업 완료/ 지도점검 등록/현황 페이지 수정

This commit is contained in:
leedj312
2025-09-12 17:29:34 +09:00
parent 344e77eafa
commit 92f12c2104
15 changed files with 576 additions and 293 deletions
+4
View File
@@ -6,6 +6,7 @@ import koBase from "../public/locales/ko/message.json";
import { StoreProvider } from "./store";
import { LoginApi } from "@/src/entities/auth";
import { useEffect } from "react";
import { getCommonUpCd } from "./store/common/code/basicCode";
export default function RootLayout({
children,
@@ -25,6 +26,9 @@ export default function RootLayout({
useEffect(() => {
// 렌더 중이 아니라 클라이언트에서만 실행 + 에러 캐치
void LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" })
.finally(()=>{
getCommonUpCd()
} )
.catch((e) => {
console.error("Auto login failed:", e);
});
+377 -188
View File
@@ -1,8 +1,10 @@
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 yn: SelectDataType[] = [
{ val: "Y", text: "Y" },
{ val: "N", text: "N" },
@@ -14,29 +16,35 @@ export const bdstFilterYn: SelectDataType[] = [
{ val: "F", text: "미가동" },
];
// 최우수(그린1)/우수(그린2), 우량(그린3), 일반(그린4), 확인불가 체크
export const bdstGrntchClass: SelectDataType[] = [
{ val: "최우수(그린1)", text: "최우수(그린1)" },
{ val: "우수(그린2)", text: "우수(그린2)" },
{ val: "우량(그린3)", text: "우량(그린3)" },
{ val: "일반(그린4)", text: "일반(그린4)" },
{ val: "확인불가", text: "확인불가" },
];
//export const bdstGrntchClass: SelectDataType[] = lwCds['bdstGrntchClass']??[]
// [
// { val: "최우수(그린1)", text: "최우수(그린1)" },
// { val: "우수(그린2)", text: "우수(그린2)" },
// { val: "우량(그린3)", text: "우량(그린3)" },
// { val: "일반(그린4)", text: "일반(그린4)" },
// { val: "확인불가", text: "확인불가" },
// ];
export const bdstIncenYn: SelectDataType[] = [
{ val: "Y", text: "Y" },
{ val: "N", text: "N" },
{ val: "D", text: "확인불가" },
];
//처리장연계/자체+연계/자체처리
export const erctUswtrPrcsMeth: SelectDataType[] = [
{ val: "처리장연계", text: "처리장연계" },
{ val: "자체+연계", text: "자체+연계" },
{ val: "자체처리", text: "자체처리" },
];
//export const erctUswtrPrcsMeth: SelectDataType[] = lwCds['erctUswtrPrcsMeth']??[]
export const rusePrcsMthdCd: SelectDataType[] = [
{ val: "물리학적처리", text: "물리학적처리" },
{ val: "생물학적처리", text: "생물학적처리" },
];
// [
// { val: "처리장연계", text: "처리장연계" },
// { val: "자체+연계", text: "자체+연계" },
// { val: "자체처리", text: "자체처리" },
// ];
// export const rusePrcsMthdCd: SelectDataType[] = lwCds['rusePrcsMthdCd']??[]
// [
// { val: "물리학적처리", text: "물리학적처리" },
// { val: "생물학적처리", text: "생물학적처리" },
// ];
export const ruseSeCd: SelectDataType[] = [
{ val: "신규", text: "신규" },
@@ -46,101 +54,107 @@ 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[] = [
{ val: "-1", text: "확인불가" },
{ val: "1", text: "운동장" },
{ val: "2", text: "체육관" },
{ val: "3", text: "공공업무시설" },
{ val: "4", text: "공공기관의청사" },
{ val: "5", text: "아파트" },
{ val: "6", text: "연립주택" },
{ val: "7", text: "다세대주택" },
{ val: "8", text: "기숙사" },
{ val: "9", text: "초등학교" },
{ val: "10", text: "중학교" },
{ val: "11", text: "고등학교" },
{ val: "12", text: "전문대학" },
{ val: "13", text: "대학및대학교" },
{ val: "14", text: "골프장" },
{ val: "15", text: "대규모점포" },
{ val: "16", text: "기타" },
{ val: "17", text: "숙박업" },
{ val: "18", text: "목욕장업" },
{ val: "19", text: "공장" },
{ val: "20", text: "발전시설" },
{ val: "21", text: "관광단지개발사업" },
{ val: "22", text: "도시개발사업" },
{ val: "23", text: "산업단지개발사업" },
{ val: "24", text: "택지개발사업" },
{ val: "25", text: "대규모점포(대형마트)" },
{ val: "26", text: "대규모점포(전문점)" },
{ val: "27", text: "대규모점포(백화점)" },
{ val: "28", text: "대규모점포(쇼핑센터)" },
{ val: "29", text: "대규모점포(복합쇼핑몰)" },
{ val: "30", text: "물류시설" },
{ val: "31", text: "운수시설(여객자동차터미널)" },
{ val: "32", text: "운수시설(철도시설)" },
{ val: "33", text: "운수시설(공항시설)" },
{ val: "34", text: "운수시설(항만시설)" },
{ val: "35", text: "업무시설(공공업무시설)" },
{ val: "36", text: "업무시설(금융업소)" },
{ val: "37", text: "업무시설(사무소)" },
{ val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
{ val: "39", text: "업무시설(출판사)" },
{ val: "40", text: "업무시설(신문사)" },
{ val: "41", text: "업무시설(오피스텔)" },
{ val: "42", text: "교정시설" },
{ val: "43", text: "방송국" },
{ val: "44", text: "전신전화국" },
{ val: "45", text: "기타" },
];
export const bdstUsgCd: SelectDataType[] =lwCds?.bdstUsgCd?.concat(lwCds?.rswtBdstType??[])??[]
export const rswtBdstType: SelectDataType[] = [
{ val: "17", text: "숙박업" },
{ val: "18", text: "목욕장업" },
{ val: "19", text: "공장" },
{ val: "20", text: "발전시설" },
{ val: "21", text: "관광단지개발사업" },
{ val: "22", text: "도시개발사업" },
{ val: "23", text: "산업단지개발사업" },
{ val: "24", text: "택지개발사업" },
{ val: "25", text: "대규모점포(대형마트)" },
{ val: "26", text: "대규모점포(전문점)" },
{ val: "27", text: "대규모점포(백화점)" },
{ val: "28", text: "대규모점포(쇼핑센터)" },
{ val: "29", text: "대규모점포(복합쇼핑몰)" },
{ val: "30", text: "물류시설" },
{ val: "31", text: "운수시설(여객자동차터미널)" },
{ val: "32", text: "운수시설(철도시설)" },
{ val: "33", text: "운수시설(공항시설)" },
{ val: "34", text: "운수시설(항만시설)" },
{ val: "35", text: "업무시설(공공업무시설)" },
{ val: "36", text: "업무시설(금융업소)" },
{ val: "37", text: "업무시설(사무소)" },
{ val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
{ val: "39", text: "업무시설(출판사)" },
{ val: "40", text: "업무시설(신문사)" },
{ val: "41", text: "업무시설(오피스텔)" },
{ val: "42", text: "교정시설" },
{ val: "43", text: "방송국" },
{ val: "44", text: "전신전화국" },
{ val: "45", text: "기타" },
];
// [
// { val: "-1", text: "확인불가" },
// { val: "1", text: "운동장" },
// { val: "2", text: "체육관" },
// { val: "3", text: "공공업무시설" },
// { val: "4", text: "공공기관의청사" },
// { val: "5", text: "아파트" },
// { val: "6", text: "연립주택" },
// { val: "7", text: "다세대주택" },
// { val: "8", text: "기숙사" },
// { val: "9", text: "초등학교" },
// { val: "10", text: "중학교" },
// { val: "11", text: "고등학교" },
// { val: "12", text: "전문대학" },
// { val: "13", text: "대학및대학교" },
// { val: "14", text: "골프장" },
// { val: "15", text: "대규모점포" },
// { val: "16", text: "기타" },
// { val: "17", text: "숙박업" },
// { val: "18", text: "목욕장업" },
// { val: "19", text: "공장" },
// { val: "20", text: "발전시설" },
// { val: "21", text: "관광단지개발사업" },
// { val: "22", text: "도시개발사업" },
// { val: "23", text: "산업단지개발사업" },
// { val: "24", text: "택지개발사업" },
// { val: "25", text: "대규모점포(대형마트)" },
// { val: "26", text: "대규모점포(전문점)" },
// { val: "27", text: "대규모점포(백화점)" },
// { val: "28", text: "대규모점포(쇼핑센터)" },
// { val: "29", text: "대규모점포(복합쇼핑몰)" },
// { val: "30", text: "물류시설" },
// { val: "31", text: "운수시설(여객자동차터미널)" },
// { val: "32", text: "운수시설(철도시설)" },
// { val: "33", text: "운수시설(공항시설)" },
// { val: "34", text: "운수시설(항만시설)" },
// { val: "35", text: "업무시설(공공업무시설)" },
// { val: "36", text: "업무시설(금융업소)" },
// { val: "37", text: "업무시설(사무소)" },
// { val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
// { val: "39", text: "업무시설(출판사)" },
// { val: "40", text: "업무시설(신문사)" },
// { val: "41", text: "업무시설(오피스텔)" },
// { val: "42", text: "교정시설" },
// { val: "43", text: "방송국" },
// { val: "44", text: "전신전화국" },
// { val: "45", text: "기타" },
// ];
export const orgwtKndCd = [
{ text: "오수(변기 오수 제외)", val: "01" },
{ text: "오수", val: "02" },
{ text: "폐수", val: "03" },
{ text: "오수 및 폐수", val: "04" },
{ text: "기타", val: "05" },
];
export const rswtBdstType: SelectDataType[] = lwCds?.rswtBdstType??[]
//[
// { val: "17", text: "숙박업" },
// { val: "18", text: "목욕장업" },
// { val: "19", text: "공장" },
// { val: "20", text: "발전시설" },
// { val: "21", text: "관광단지개발사업" },
// { val: "22", text: "도시개발사업" },
// { val: "23", text: "산업단지개발사업" },
// { val: "24", text: "택지개발사업" },
// { val: "25", text: "대규모점포(대형마트)" },
// { val: "26", text: "대규모점포(전문점)" },
// { val: "27", text: "대규모점포(백화점)" },
// { val: "28", text: "대규모점포(쇼핑센터)" },
// { val: "29", text: "대규모점포(복합쇼핑몰)" },
// { val: "30", text: "물류시설" },
// { val: "31", text: "운수시설(여객자동차터미널)" },
// { val: "32", text: "운수시설(철도시설)" },
// { val: "33", text: "운수시설(공항시설)" },
// { val: "34", text: "운수시설(항만시설)" },
// { val: "35", text: "업무시설(공공업무시설)" },
// { val: "36", text: "업무시설(금융업소)" },
// { val: "37", text: "업무시설(사무소)" },
// { val: "38", text: "업무시설(결혼상담소 등 소개업소)" },
// { val: "39", text: "업무시설(출판사)" },
// { val: "40", text: "업무시설(신문사)" },
// { val: "41", text: "업무시설(오피스텔)" },
// { val: "42", text: "교정시설" },
// { val: "43", text: "방송국" },
// { val: "44", text: "전신전화국" },
// { val: "45", text: "기타" },
// ];
//export const orgwtKndCd =lwCds['orgwtKndCd']??[]
// [
// { text: "오수(변기 오수 제외)", val: "01" },
// { text: "오수", val: "02" },
// { text: "폐수", val: "03" },
// { text: "오수 및 폐수", val: "04" },
// { text: "기타", val: "05" },
// ];
export const chBuCd = [
{ val: "증축", text: "증축" },
@@ -148,94 +162,101 @@ export const chBuCd = [
{ val: "재축", text: "재축" },
];
export const dmdUszCd = [
{ val: "조경용수", text: "조경용수" },
{ val: "청소화장실용수", text: "청소화장실용수" },
{ val: "농업용수", text: "농업용수" },
{ val: "공업용수", text: "공업용수" },
{ val: "친수용수", text: "친수용수" },
{ val: "기타", text: "기타" },
];
// export const dmdUszCd = [
// { val: "조경용수", text: "조경용수" },
// { val: "청소화장실용수", text: "청소화장실용수" },
// { val: "농업용수", text: "농업용수" },
// { val: "공업용수", text: "공업용수" },
// { val: "친수용수", text: "친수용수" },
// { val: "기타", text: "기타" },
// ];
export const ruseMngMtd = [
{ val: "자체운영", text: "자체운영" },
{ val: "공기업", text: "공기업" },
{ val: "민간(대행)", text: "민간(대행)" },
];
export const pplQulity = [
{ val: "도복장강관", text: "도복장강관" },
{ val: "PE관", text: "PE관" },
{ val: "스테인레스관", text: "스테인레스관" },
{ val: "덕타일주철관", text: "덕타일주철관" },
{ val: "유리섬유복합관", text: "유리섬유복합관" },
{ val: "기타", text: "기타" },
];
export const pplLenght = [
{ val: "D100", text: "D100" },
{ val: "D200", text: "D200" },
{ val: "D250", text: "D250" },
{ val: "D300", text: "D300" },
{ val: "D350", text: "D350" },
{ val: "D400", text: "D400" },
{ val: "D450", text: "D450" },
{ val: "D500", text: "D500" },
{ val: "D700", text: "D700" },
{ val: "D900", text: "D900" },
{ val: "D1000​", text: "D1000​" },
];
export const rainFcltCd = [
{ val: "10", text: "확인불가" },
{ val: "01", text: "지붕" },
{ val: "02", text: "건물옥상" },
{ val: "03", text: "골프장 연못" },
{ val: "04", text: "운동장 바닥" },
{ val: "05", text: "운동장 지붕" },
{ val: "06", text: "주차장" },
{ val: "07", text: "태양광패널" },
{ val: "08", text: "연못" },
{ val: "09", text: "기타" },
];
// export const ruseMngMtd = lwCds['ruseMngMtd']
// [
// { val: "자체운영", text: "자체운영" },
// { val: "공기업", text: "공기업" },
// { val: "민간(대행)", text: "민간(대행)" },
// ];
// export const pplQulity =
// [
// { val: "도복장강관", text: "도복장강관" },
// { val: "PE관", text: "PE관" },
// { val: "스테인레스관", text: "스테인레스관" },
// { val: "덕타일주철관", text: "덕타일주철관" },
// { val: "유리섬유복합관", text: "유리섬유복합관" },
// { val: "기타", text: "기타" },
// ];
// export const pplLenght = [
// { val: "D100", text: "D100" },
// { val: "D200", text: "D200" },
// { val: "D250", text: "D250" },
// { val: "D300", text: "D300" },
// { val: "D350", text: "D350" },
// { val: "D400", text: "D400" },
// { val: "D450", text: "D450" },
// { val: "D500", text: "D500" },
// { val: "D700", text: "D700" },
// { val: "D900", text: "D900" },
// { val: "D1000​", text: "D1000​" },
// ];
// export const rainFcltCd = lwCds?.rainFcltCd??[]
// [
// { val: "10", text: "확인불가" },
// { val: "01", text: "지붕" },
// { val: "02", text: "건물옥상" },
// { val: "03", text: "골프장 연못" },
// { val: "04", text: "운동장 바닥" },
// { val: "05", text: "운동장 지붕" },
// { val: "06", text: "주차장" },
// { val: "07", text: "태양광패널" },
// { val: "08", text: "연못" },
// { val: "09", text: "기타" },
// ];
//물리화학적처리(스크린, 응집, 침전)/생물학적처리(활성슬러지법 등)/소독(염소, UV 등)/기타
export const rswtPrscCdMthdCd = [
{
val: "물리화학적처리(스크린,응집,침전)",
text: "물리화학적처리(스크린,응집,침전)",
},
{
val: "생물학적처리(활성슬러지법 등)",
text: "생물학적처리(활성슬러지법 등)",
},
{ val: "소독(염소, UV 등)", text: "소독(염소, UV 등)" },
{ val: "기타", text: "기타" },
{ val: "확인불가", text: "확인불가" },
];
export const rswtPrscCdMthdCd = lwCds['rswtPrscCdMthdCd']??[]
// {
// val: "물리화학적처리(스크린,응집,침전)",
// text: "물리화학적처리(스크린,응집,침전)",
// },
// {
// val: "생물학적처리(활성슬러지법 등)",
// text: "생물학적처리(활성슬러지법 등)",
// },
// { val: "소독(염소, UV 등)", text: "소독(염소, UV 등)" },
// { val: "기타", text: "기타" },
// { val: "확인불가", text: "확인불가" },
// ];
export const htdPowerMthdCd= [
{
val: "해당없음",
text: "해당없음",
},
{
val: "석탄화력발전",
text: "석탄화력발전",
},
{
val: "화력발전",
text: "화력발전",
},
{
val: "수력발전",
text: "수력발전",
},
{
val: "태양관발전",
text: "태양관발전",
},
];
// export const htdPowerMthdCd = [
// {
// val: "해당없음",
// text: "해당없음",
// },
// {
// val: "석탄화력발전",
// text: "석탄화력발전",
// },
// {
// val: "화력발전",
// text: "화력발전",
// },
// {
// val: "수력발전",
// text: "수력발전",
// },
// {
// val: "태양관발전",
// text: "태양관발전",
// },
// ];
//(공업용수/양식장/농업용수)
export const htdUtztnUsgCd = [
@@ -252,3 +273,171 @@ export const htdUtztnUsgCd= [
text: "농업용수",
},
];
export const ruseFcltSpot = []
//(공업용수/양식장/농업용수)
export const rainRswtMng = [
{
val: "위탁",
text: "01",
},
{
val: "자체",
text: "02",
},
];
export const rainFcltFlowRate = [
{
val: "01",
text: "유량계",
},
{
val: "02",
text: "수위계",
},
{
val: "03",
text: "펌프적산전력계",
},
{
val: "04",
text: "기타",
},
];
export const rainRswtUse = [
{
val: "01",
text: "유량계",
},
{
val: "02",
text: "수위계",
},
{
val: "03",
text: "펌프적산전력계",
},
{
val: "04",
text: "기타",
},
];
export const sewageInFcltUse = [
{
val: "01",
text: "세척수",
},
{
val: "02",
text: "냉각수",
},
{
val: "03",
text: "청소수",
},
{
val: "04",
text: "삭수대",
},
{
val: "05",
text: "희석용수",
},
{
val: "06",
text: "중수도",
},
{
val: "07",
text: "기타",
},
];
export const sewageOutFclttUse = [
{
val: "01",
text: "청소화장실용수",
},
{
val: "02",
text: "세척살수용수",
},
{
val: "03",
text: "조경용수",
},
{
val: "04",
text: "친수용수",
},
{
val: "05",
text: "지하수충전",
},
{
val: "06",
text: "농업용수",
},
{
val: "07",
text: "하천등유지용수",
},
{
val: "08",
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 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,
}));
})
);
};
+29 -28
View File
@@ -5,22 +5,10 @@ import type {
} from "@common/business_components/ui";
import {
bdstFilterYn,
bdstGrntchClass,
bdstIncenYn,
bdstUsgCd,
chBuCd,
dmdUszCd,
erctUswtrPrcsMeth,
htdPowerMthdCd,
htdUtztnUsgCd,
orgwtKndCd,
pplLenght,
pplQulity,
rainFcltCd,
lwCds,
rswtPrscCdMthdCd,
ruseBizMthdCd,
ruseMngMtd,
rusePrcsMthdCd,
ruseSeCd,
yn,
} from "./basicCode";
@@ -151,6 +139,9 @@ export const getEnvPartCd = async (set: any) => {
}
};
export type comCodeState = {
code: {
isInit: boolean;
@@ -184,6 +175,7 @@ export type comCodeState = {
rswtPrscCdMthdCd: SelectDataType[];
htdPowerMthdCd: SelectDataType[];
htdUtztnUsgCd: SelectDataType[];
rswtBdstType:SelectDataType[];
userSiSggCd: string;
};
};
@@ -193,44 +185,45 @@ export type comCodeType = comCodeState & comCodeActions;
export const comCodeStateExport: comCodeState = {
code: {
isInit: false,
rainFcltCd: rainFcltCd,
bdstUsgCd: bdstUsgCd,
rainFcltCd: lwCds['rainFcltCd']??[],
bdstUsgCd: lwCds['bdstUsgCd']??[] ,
chBuCd: chBuCd,
orgwtKndCd: orgwtKndCd,
orgwtKndCd: lwCds['orgwtKndCd']??[] ,
cityCd: [],
sggCd: [],
rvbsnCd: [],
mdmbsnCd: [],
lgbsnCd: [],
lclgvrnmntCd: [],
pplQulity: pplQulity,
pplLenght: pplLenght,
pplQulity: lwCds['pplQulity']??[] ,
pplLenght: lwCds['pplLenght']??[] ,
yn: yn,
dmdUszCd: dmdUszCd,
dmdUszCd: lwCds['dmdUszCd']??[] ,
buildingType: buildingType,
ruseMngMtd: ruseMngMtd,
ruseMngMtd: lwCds['ruseMngMtd']??[],
ruseSeCd: ruseSeCd,
ruseBizMthdCd: ruseBizMthdCd,
rusePrcsMthdCd: rusePrcsMthdCd,
erctUswtrPrcsMeth: erctUswtrPrcsMeth,
ruseBizMthdCd: lwCds['ruseBizMthdCd']??[],
rusePrcsMthdCd: lwCds['rusePrcsMthdCd']??[],
erctUswtrPrcsMeth: lwCds['erctUswtrPrcsMeth']??[],
bdstFilterYn: bdstFilterYn,
bdstIncenYn: bdstIncenYn,
bdstGrntchClass: bdstGrntchClass,
rswtPrscCdMthdCd: rswtPrscCdMthdCd,
htdPowerMthdCd: htdPowerMthdCd,
htdUtztnUsgCd: htdUtztnUsgCd,
bdstGrntchClass: lwCds['bdstGrntchClass']??[],
rswtPrscCdMthdCd: rswtPrscCdMthdCd, // 공단연락오면 바꿔야함
htdPowerMthdCd: lwCds['htdPowerMthdCd']??[],
htdUtztnUsgCd: lwCds['htdUtztnUsgCd']??[],
userSiSggCd: laeSecd,
rswtBdstType:lwCds['rswtBdstType']??[] ,
},
};
export type comCodeActions = {
returnCodeText: (val: string, codeName: string) => string;
returnTextCode: (text: string, codeName: string) => string;
};
export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
return {
returnCodeText: (val: string, codeName: string) => {
console.log('val', val, 'codeName', codeName);
return set((state: comCodeState) => {
const codeList = state.code[codeName] || [];
const found = codeList.find((item) => item.val === val);
@@ -238,5 +231,13 @@ export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
}
);
},
returnTextCode: (text: string, codeName: string) => {
return set((state: comCodeState) => {
const codeList = state.code[codeName] || [];
const found = codeList.find((item) => item.text === text);
return found ? found.val : text;
}
);
},
};
};
+31
View File
@@ -0,0 +1,31 @@
export type LwCdType= {
lwpoCd: string,
upCd: string,
lwpoCdNm:string,
lwpoCdExpln:string,
unit: string,
prntLwpoCd: string,
useYn: string,
sortSeq: number,
regDt: Date,
rgtr: string,
mdfcnDt: Date,
mdfr: string
}
export type UPCdType= {
upCd: string,
upCdNm: string,
upCdExpln: string,
cdSe: string,
useYn: string,
delYn: string,
siteId: string,
regDt:Date,
rgtr: string
mdfcnDt: Date,
mdfr: string
}
@@ -7,6 +7,7 @@ import {
parseRawValue,
} from "@/components/lib/func/excelFunc";
import toast from "react-hot-toast";
import { codeToText, textToCode } from "@/components/lib/func/commom";
export const useTypes = [
"조경용수",
"청소화장실용수",
@@ -17,17 +18,13 @@ export const useTypes = [
"기타",
];
export const chkMngType =[
'위탁',
'자체'
]
export const chkSpwtPositnType = [
'유량계',
'수위계',
'펌프적산전력계',
'기타'
]
export const chkMngType = { "01": "위탁", "02": "자체" };
export const rainFcltFlowRateType = {
"01": "유량계",
"02": "수위계",
"03": "펌프적산전력계",
"04": "기타",
};
export type Buildingtype = {
bdstInfoSn: number;
@@ -118,7 +115,7 @@ export const excelToRainChkData = (excelData: any, year: string) => {
const ruseData = parseRawValue(item[`빗물_${month}월`]);
if (month.length < 2) month = "0" + month;
return {
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd") ?? undefined,
ym: year + month,
chckYmd: checkYmd,
splyUswtrUtztnQnt: splyData,
@@ -133,14 +130,14 @@ export const excelToRainChkData = (excelData: any, year: string) => {
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
rgtr: TEST_UUID,
operMngCd: item["운영관리형태"] ?? "",
operMngCd: textToCode(item["운영관리형태"], "rainRswtMng") ??item["운영관리형태"],
anlOperCst: parseRawValue(item["연간운영비(원/년)"]),
oilqMeasMthd: item["유량측정방법"] ?? "",
oilqMeasMthd: textToCode( item["유량측정방법"],"rainFcltFlowRate",)??item["유량측정방법"],
guideDetails: makeGuidDetail,
rainyDetails: [
{
ph: item["PH"],
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
trbt: parseRawValue(item["탁도"]),
grssClfg: parseRawValue(item["총대장균군수"]),
etc: item["기타"] || "", // 필드 누락 방지
@@ -156,10 +153,10 @@ export const excelToRainChkData = (excelData: any, year: string) => {
})
.filter((el: any) => el !== undefined);
console.log("rainChkgdData", rainChkgdData);
console.log('rainChkgdData ', rainChkgdData)
if (rainChkgdData.length > 0) {
rainChkgdData.forEach((rain: any) => {
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${codeToText(rain.guideDetails[0]?.utztnUsgCd, "dmdUszCd") ??rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
issues.push(
@@ -173,15 +170,20 @@ console.log("rainChkgdData", rainChkgdData);
);
}
if (rain.operMngCd.length > 1 && !chkMngType.includes(rain.operMngCd)) {
if (rain.operMngCd.length > 1 && !chkMngType[rain.operMngCd]) {
issues.push(
defaultMessage + `운영관리 형태: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
defaultMessage +
`운영관리 형태: 위탁 혹은 자체 만 허용) /입력값:${rain.operMngCd}`
);
}
if (rain.oilqMeasMthd.length > 1 && !chkSpwtPositnType.includes(rain.oilqMeasMthd)) {
if (
rain.oilqMeasMthd.length > 1 &&
!rainFcltFlowRateType[rain.oilqMeasMthd]
) {
issues.push(
defaultMessage + `유량측정방법: 유량계, 수위계, 펌프적산전력계, 기타) /입력값:${rain.oilqMeasMthd}`
defaultMessage +
`유량측정방법: 유량계, 수위계, 펌프적산전력계, 기타) /입력값:${rain.oilqMeasMthd}`
);
}
@@ -190,11 +192,14 @@ console.log("rainChkgdData", rainChkgdData);
issues.push(defaultMessage + `PH: 숫자 형식 아님 /입력값:${key.ph}`);
}
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
issues.push(defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`);
issues.push(
defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`
);
}
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
issues.push(
defaultMessage + `총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}`
defaultMessage +
`총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}`
);
}
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
@@ -87,6 +87,7 @@ export type chHeadType = {
export type splRuseWaterType = {
utztnUsgCd: string;
utztnUsgCdText: string;
splTotal: number;
spl01: number;
spl02: number;
@@ -141,12 +142,12 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
{ id: "cityText", title: "시도", mergeCell: true },
{ id: "sggText", title: "시군구", mergeCell: true },
{ id: "bdstNm", title: "시설명", mergeCell: true },
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
{ id: "operMngCdText", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthdText", title: "유량측정방법", mergeCell: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "totalSplyUswtrUtztnQnt", title: "연간대체수이용량(m³)" },
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
{
@@ -201,7 +202,7 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
];
export const ruseHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "ruseTotal", title: "계", upName: "ruseWater", upSequnce: 1 },
{ id: "ruse01", title: "1월", upName: "ruseWater", upSequnce: 2 , edit: true },
{ id: "ruse02", title: "2월", upName: "ruseWater", upSequnce: 3 , edit: true },
@@ -218,7 +219,7 @@ export const ruseHeadListExport: TableUpperProps[] = [
];
export const splHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splTotal", title: "계", upName: "splWater", upSequnce: 1},
{ id: "spl01", title: "1월", upName: "splWater", upSequnce: 2, edit: true },
{ id: "spl02", title: "2월", upName: "splWater", upSequnce: 3, edit: true },
@@ -11,6 +11,7 @@ import {
useTypes,
type Buildingtype
} from "../rainChkgdn/excel";
import { codeToText, textToCode } from "@/components/lib/func/commom";
export const rswtMakeExcelSample = (
buildings: Buildingtype[],
@@ -158,12 +159,12 @@ export const excelToRswtGuideData = (
if (checkYmd.length > 7) {
return {
bdstRuseFcltSn: Number(item["NO"]),
operMngCd: item["운영관리형태"],
operMngCd: textToCode(item["운영관리형태"], "rainRswtMng") ??item["운영관리형태"],
anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]),
prcsCpct: parseRawValue(item[`처리용량(m³)`]),
spwtPositn: item["채수지점"],
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
guideDetails: makeGuidDetail,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
@@ -226,7 +227,7 @@ export const excelToRswtPolution = (excelData: any) => {
return {
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
operMngCd: item["운영관리형태"],
anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]),
prcsCpct: parseRawValue(item["처리용량(m³)"]),
@@ -236,7 +237,7 @@ export const excelToRswtPolution = (excelData: any) => {
mdfr: TEST_UUID,
rswtrDetails: [
{
utztnUsgCd: item["이용용도"],
utztnUsgCd: textToCode(item["이용용도"], "dmdUszCd")??item["이용용도"],
vltnDt: vltnDt,
vltnMttr: item["위반사항"],
levyAmt: Number(item["과태료 부과금액(천원)"]) ?? 0,
@@ -248,13 +249,6 @@ export const excelToRswtPolution = (excelData: any) => {
}
})
.filter((el: any) => el !== undefined);
// if (rswtChkgdData.length > 0) {
// rswtExcelDataCheck(rswtChkgdData, issues);
// }
// if (issues.length > 0) {
// return { data: [], issues };
// }
return rswtChkgdData
};
@@ -265,7 +259,7 @@ export const rswtExcelDataCheck = (
) => {
rswtChkgdData.forEach((rswt: any) => {
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${codeToText(rswt.utztnUsgCd ,"dmdUszCd")??rswt.utztnUsgCd}] 항목에서 `;
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`);
@@ -284,7 +278,7 @@ export const rswtExcelDataCheck = (
}
// if (
// rswt.spwtPositn.length > 1 &&
// !chkSpwtPositnType.includes(rswt.spwtPositn)
// !rainFcltFlowRateType[rswt.spwtPositn]
// ) {
// issues.push(
// defaultMessage +
@@ -53,6 +53,7 @@ const buildingZod = z.object({
});
export const rswtrPolutionsZode = z.object({
utztnUsgCdText:z.string().nullish(),
chkgdnDtlFk: z.string().nullish(),
utztnUsgCd: z.string().nullish(),
node: z.string().nullish(),
@@ -143,7 +144,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
{ id: "prcsCpct", title: "처리용량(m³)" ,mergeCell: true},
{ id: "spwtPositn", title: "채수지점" ,mergeCell: true},
{ id: "chckYmd", title: "점검일" ,mergeCell: true},
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)" ,type: "number"},
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)",type: "number"},
@@ -197,7 +198,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
export const rswtDetailHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{
id: "grssClfgUswtr",
@@ -5,12 +5,12 @@ export const rainChkgdnHeadSttnExport: TableUpperProps[] = [
{ id: "cityText", title: "시도", mergeCell: true },
{ id: "sggText", title: "시군구", mergeCell: true },
{ id: "bdstNm", title: "시설명", mergeCell: true },
{ id: "operMngCd", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthd", title: "유량측정방법", mergeCell: true },
{ id: "operMngCdText", title: "운영관리형태", mergeCell: true },
{ id: "oilqMeasMthdText", title: "유량측정방법", mergeCell: true },
{ id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true },
{ id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "totalSplyUswtrUtztnQnt", title: "연간대체수이용량(m³)" },
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
{
@@ -59,7 +59,7 @@ export const rainChkgdnHeadSttnExport: TableUpperProps[] = [
];
export const ruseSttnHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "ruseTotal", title: "계", upName: "ruseWater", upSequnce: 1 },
{ id: "ruse01", title: "1월", upName: "ruseWater", upSequnce: 2 },
{ id: "ruse02", title: "2월", upName: "ruseWater", upSequnce: 3 },
@@ -76,7 +76,7 @@ export const ruseSttnHeadListExport: TableUpperProps[] = [
];
export const splSttnHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splTotal", title: "계", upName: "splWater", upSequnce: 1 },
{ id: "spl01", title: "1월", upName: "splWater", upSequnce: 2 },
{ id: "spl02", title: "2월", upName: "splWater", upSequnce: 3 },
@@ -108,7 +108,7 @@ export const splSttnHeadListExport: TableUpperProps[] = [
];
export const rswtDetailHeadListExport: TableUpperProps[] = [
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{
id: "grssClfgUswtr",
@@ -10,7 +10,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
{ id: "prcsCpct", title: "처리용량(m³)", mergeCell: true },
{ id: "spwtPositn", title: "채수지점", mergeCell: true },
{ id: "chckYmd", title: "점검일", mergeCell: true },
{ id: "utztnUsgCd", title: "이용용도" },
{ id: "utztnUsgCdText", title: "이용용도" },
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)", type: "number" },
{ id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)", type: "number" },
+1
View File
@@ -341,6 +341,7 @@ export const StoreZus = (
getMiddleRegionCd(set);
getUnitWaterShedCd(set);
getEnvPartCd(set);
return {
...initState,
...comFcltSearchAction(set),
+4 -3
View File
@@ -10,6 +10,7 @@ import {
} from "@common/components/ui";
import moment from "moment";
import {
codeToText,
formatCommaNumber,
formatYyyymmdd,
handleCommaNumberChange
@@ -73,23 +74,23 @@ export const rswtChkTableData = (chkData: rswtChkZodType[]) => {
let flatRswtChk = {};
const findGuide = root.guideDetails.find(
(guide) => guide.utztnUsgCd === detail.utztnUsgCd
);
)
const findPoluttion = root.rswtrPollutions.find(
(polution) => polution.utztnUsgCd === detail.utztnUsgCd
);
const operMngCd = root?.reuseBuilding.operMngCd;
flatRswtChk = {
...root,
...detail,
...findGuide,
...findPoluttion,
...flatRswtChk,
operMngCd: operMngCd,
utztnUsgCdText: codeToText(detail.utztnUsgCd, 'dmdUszCd'),
};
makeRswtData.push(flatRswtChk);
});
});
}
return makeRswtData;
};
+20
View File
@@ -1,4 +1,5 @@
import type { comCodeState } from "@/app/store/common/code";
import { lwCds } from "@/app/store/common/code/basicCode";
import {
filePickedBlob,
filePickedBlobArray,
@@ -297,3 +298,22 @@ export const formatArchArea =(value: string, digits: number=0 ) => {
// 다시 천 단위 콤마 찍어서 반환
return Number(rounded).toLocaleString();
}
export const codeToText = ( val:string, codeName:string ) =>{
if(val===''|| val===undefined){
return ''
}
return lwCds[codeName]?.find((cd) => cd.val ===val)?.text
}
export const textToCode = (text:string, codeName:string) =>{
if(text===''|| text===undefined){
return ''
}
return lwCds[codeName]?.find((cd) => cd.text ===text)?.val
}
@@ -2,13 +2,24 @@ import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList";
import { codeToText } from "@/components/lib/func/commom";
import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable";
import { ScrollArea, Title } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import React, { useEffect, useState } from "react";
import type { z } from "zod";
export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type: string; obj: any, setIsModal: (open: boolean) => void, readonly: boolean }) {
export default function ChkgdModal({
type,
obj,
setIsModal,
readonly,
}: {
type: string;
obj: any;
setIsModal: (open: boolean) => void;
readonly: boolean;
}) {
const {
rainChkgdn,
rswtChkgdn,
@@ -58,14 +69,14 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
setHeadList({
splHeadList: rainChkSttn.splHeadList,
ruseHeadList: rainChkSttn.ruseHeadList,
rswtDetailHeadList: type === "RNB" ? [] : rswtChkSttn.rswtDetailSttnHeadList,
rswtDetailHeadList:
type === "RNB" ? [] : rswtChkSttn.rswtDetailSttnHeadList,
});
} else {
setHeadList({
splHeadList: rainChkgdn.splHeadList,
ruseHeadList: rainChkgdn.ruseHeadList,
rswtDetailHeadList:
type === "RNB" ? [] : rswtChkgdn.rswtDetailHeadList,
rswtDetailHeadList: type === "RNB" ? [] : rswtChkgdn.rswtDetailHeadList,
});
}
}, [
@@ -73,12 +84,13 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
rainChkgdn.splHeadList,
rainChkSttn.splHeadList,
rswtChkgdn.rswtDetailHeadList,
rswtChkSttn.rswtDetailSttnHeadList
rswtChkSttn.rswtDetailSttnHeadList,
]);
useEffect(() => {
const result = obj.guideDetails?.reduce((acc: any, cur: any) => {
const code = cur.utztnUsgCd;
const codeText = codeToText(cur.utztnUsgCd, "dmdUszCd");
const month = cur.ym?.slice(4); // "MM"
const ruseMonthKey = `ruse${month}`;
const splMonthKey = `spl${month}`;
@@ -91,7 +103,12 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
(it: { utztnUsgCd: string }) => it?.utztnUsgCd === code
);
if (!target) {
target = { utztnUsgCd: code, ruseTotal: 0, splTotal: 0 };
target = {
utztnUsgCdText: codeText,
utztnUsgCd: code,
ruseTotal: 0,
splTotal: 0,
};
acc.push(target);
}
// 월별 값 누적
@@ -106,12 +123,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
if (result) {
// '기타' 항목을 배열의 맨 뒤로 정렬합니다.
result.sort((a: splRuseWaterType, b: splRuseWaterType) => {
if (a.utztnUsgCd === "기타") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "기타") return -1; // b를 a 뒤로 보냅니다.
if (a.utztnUsgCd === "07") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "07") return -1; // b를 a 뒤로 보냅니다.
return 0; // 순서를 유지합니다.
});
}
setGuidData(result as splRuseWaterType[]);
if (obj.rswtrPollutions) {
@@ -124,6 +140,10 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
obj.rswtrPollutions.forEach(
(item: z.infer<typeof rswtrPolutionsZode>) => {
const nodeKey = String(item.node);
item["utztnUsgCdText"] = codeToText(
item.utztnUsgCd ?? "",
"dmdUszCd"
);
resultPolution[nodeKey]?.push(item);
}
);
@@ -132,8 +152,8 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
Object.entries(resultPolution).forEach(([nodeKey, items]) => {
const onlyData = items as z.infer<typeof rswtrPolutionsZode>[];
if (onlyData.length === 0) return;
const total = initStats();
onlyData.forEach((item) => {
total.grssClfgUswtr += item.grssClfgUswtr;
total.combResdch += item.combResdch;
@@ -148,7 +168,7 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
});
const average = {
utztnUsgCd: "평균",
utztnUsgCdText: "평균",
edit: false,
grssClfgUswtr: (total.grssClfgUswtr / onlyData.length).toFixed(1),
combResdch: (total.combResdch / onlyData.length).toFixed(1),
@@ -168,8 +188,8 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
// '기타' 항목을 배열의 맨 뒤로 정렬합니다.
resultPolution[nodeKey].sort((a: any, b: any) => {
if (a.utztnUsgCd === "기타") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "기타") return -1; // b를 a 뒤로 보냅니다.
if (a.utztnUsgCd === "07") return 1; // a를 b 뒤로 보냅니다.
if (b.utztnUsgCd === "07") return -1; // b를 a 뒤로 보냅니다.
return 0; // 순서를 유지합니다.
});
@@ -213,16 +233,15 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
});
obj.guideDetails = realGuideDetail;
if (type === "RNB") {
rainChkGuidUpdate(obj);
setIsModal(false)
setIsModal(false);
} else {
const polution = Object.values(upPolutionData)
.flat()
.filter((item) => item.utztnUsgCd !== "평균");
obj.rswtrPollutions = polution;
rwstPolAndGuideUpdate([obj]);
setIsModal(false)
setIsModal(false);
}
};
@@ -247,7 +266,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
}
></Title>
{!rainChkSttn.isSttn ? (
<Button className="mt-8 mr-7" onClick={allDataUpdate} disabled={!readonly}>
<Button
className="mt-8 mr-7"
onClick={allDataUpdate}
disabled={!readonly}
>
저장
</Button>
) : (
@@ -256,7 +279,8 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
</div>
<h3 className="text-2xl font-bold text-gray-900 mt-2 ml-6">
{type === "RNB"
? `시설명 : (${obj.bdstNm})` : `시설명 : (${obj.building.bdstNm})`}
? `시설명 : (${obj.bdstNm})`
: `시설명 : (${obj.building.bdstNm})`}
</h3>
</div>
@@ -269,7 +293,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
<GuideDetailsTable
chgRes={guidData || []}
headList={headList.splHeadList}
upheadList={type === "RNB" ? rainChkgdn.rainSplHeadNm : rswtChkgdn.rswtSplHeadNm}
upheadList={
type === "RNB"
? rainChkgdn.rainSplHeadNm
: rswtChkgdn.rswtSplHeadNm
}
type={""}
setChGuidData={(data) => {
setChGuidData(data);
@@ -284,7 +312,11 @@ export default function ChkgdModal({ type, obj, setIsModal, readonly }: { type:
<GuideDetailsTable
chgRes={guidData || []}
headList={headList.ruseHeadList}
upheadList={type === "RNB" ? rainChkgdn.rainRuseHeadNm : rswtChkgdn.rswtRuseHeadNm}
upheadList={
type === "RNB"
? rainChkgdn.rainRuseHeadNm
: rswtChkgdn.rswtRuseHeadNm
}
type={""}
setChGuidData={(data) => {
setChGuidData(data);
@@ -4,7 +4,7 @@ import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common/type/header";
import { rainPageSize, type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import { tableData } from "@/components/lib/func/commom";
import { codeToText, tableData } from "@/components/lib/func/commom";
import {
chRowspanTable,
rainChkTableData
@@ -89,15 +89,18 @@ export default function RainChkgdTable({
}
)
})
return {
...item,
...bud[0],
utztnUsgCdText: codeToText(item.guideDetails[0].utztnUsgCd, 'dmdUszCd'),
oilqMeasMthdText:codeToText(item.oilqMeasMthd, 'rainFcltFlowRate'),
operMngCdText:codeToText(item.operMngCd.trim(), 'rainRswtMng'),
rainyDetails:rainyDetails,
rowspan: item.rainyDetails?.length,
};
});
console.log('rainChg ', rainChg)
setMakeTableData(rainChkTableData(rainChg));
} else {
setMakeTableData([]);