물재이용 공통코드 작업 수정 사항 추가

This commit is contained in:
leedj312
2025-09-15 15:38:25 +09:00
parent ad6e4484b7
commit e6be168d0d
14 changed files with 65 additions and 88 deletions
@@ -92,7 +92,7 @@ export default function RainSttn() {
useEffect(() => {
if (!rainSttn.isInit) {
rainSttnInit(false, 1, rainSttnSize, "0", fcltNm, code.cityCd, code.sggCd);
rainSttnInit(false, 1, rainSttnSize, "0", fcltNm, code as unknown as Record<string, SelectDataType[]>);
}
}, [rainSttn.isInit, rainSttnInit]);
@@ -146,8 +146,7 @@ export default function RainSttn() {
rainSttnSize,
String(getConValue()),
fcltNm,
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
isResetPage(false);
}, [pageNation]);
@@ -177,8 +176,7 @@ export default function RainSttn() {
rainSttnResCount,
String(getConValue()),
fcltNm,
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
}, [
rainSttnSearch,
@@ -237,8 +235,7 @@ export default function RainSttn() {
rainSttnSize,
String(getConValue()),
fcltNm,
code.cityCd,
code.sggCd
code as unknown as Record<string, SelectDataType[]>
);
isResetPage(true);
}}
@@ -34,6 +34,7 @@ export default function RswtSttn() {
const { code, rswtSttn, rswtSttnSearch, rswtSttnInit } = useWrStore(
(state) => state
);
const [pageNation, setPageNation] = useState(1);
const { rswtSttnRes, rswtSttnResCount } = rswtSttn;
@@ -83,8 +84,8 @@ export default function RswtSttn() {
};
useEffect(() => {
if (!rswtSttn.isInit) {
rswtSttnInit(false, 1, rswtSttnSize, "0", fcltNm, code.cityCd, code.sggCd);
if (!rswtSttn.isInit&&code) {
rswtSttnInit(false, 1, rswtSttnSize, code.userSiSggCd, fcltNm, code as unknown as Record<string, SelectDataType[]>);
}
}, [rswtSttn.isInit, rswtSttnInit]);
@@ -93,6 +94,8 @@ export default function RswtSttn() {
const chData = data
.map((item: customRswtBdst) => {
const isOrgwtKndCd = item.reuseBuilding[0]?.rswtrObj.orgwtKndCd
return {
...item,
...item.reuseBuilding[0],
@@ -101,7 +104,7 @@ export default function RswtSttn() {
chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N',
instlCst: item.reuseBuilding[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCst,
instlCstSprtAmt: item.reuseBuilding[0]?.instlCstSprtAmt === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCstSprtAmt,
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가'
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가',
}
})
.filter(
@@ -131,11 +134,11 @@ export default function RswtSttn() {
const excelClick = useCallback(() => {
isDownloadTriggered.current = true;
rswtSttnSearch(true, 1, rswtSttnResCount, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
rswtSttnSearch(true, 1, rswtSttnResCount, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, fcltNm, rswtSttnResCount]);
useEffect(() => {
rswtSttnSearch(false, pageNation, rswtSttnSize, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
rswtSttnSearch(false, pageNation, rswtSttnSize, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
isResetPage(false)
}, [pageNation]);
@@ -186,7 +189,7 @@ export default function RswtSttn() {
<Button
size={"sm"}
onClick={() => {
rswtSttnSearch(false, 1, rswtSttnSize, String(getConValue()), fcltNm, code.cityCd, code.sggCd);
rswtSttnSearch(false, 1, rswtSttnSize, String(getConValue()), fcltNm, code as unknown as Record<string, SelectDataType[]>);
isResetPage(true)
}}
>
+15 -14
View File
@@ -6,38 +6,39 @@ 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";
const i18n = i18next.createInstance();
i18n.init({
lng: "ko",
fallbackLng: "ko",
resources: {
ko: {
base: koBase,
},
},
});
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
i18next.init({
lng: "ko",
fallbackLng: "ko",
resources: {
ko: {
base: koBase,
},
},
});
useEffect(() => {
// 렌더 중이 아니라 클라이언트에서만 실행 + 에러 캐치
void LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" })
.finally(()=>{
getCommonUpCd()
} )
// getCommonUpCd()
} )
.catch((e) => {
console.error("Auto login failed:", e);
});
}, []);
return (
<html lang="en">
<html lang="ko">
<body>
<I18nextProvider i18n={i18next}>
<I18nextProvider i18n={i18n}>
<StoreProvider>
{children}
</StoreProvider>
+8 -6
View File
@@ -64,11 +64,10 @@ export const getCommonUpCd = async (set:any) => {
);
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,
}));
})
);
lwCdCode=lwCds
@@ -76,7 +75,7 @@ export const getCommonUpCd = async (set:any) => {
code: {
...state.code,
rainFcltCd: lwCdCode['rainFcltCd']??[],
bdstUsgCd: lwCdCode['bdstUsgCd']??[] ,
bdstUsgCd: lwCdCode['bdstUsgCd']??[],
orgwtKndCd: lwCdCode['orgwtKndCd']??[] ,
pplQulity: lwCdCode['pplQulity']??[] ,
pplLenght: lwCdCode['pplLenght']??[] ,
@@ -88,6 +87,7 @@ export const getCommonUpCd = async (set:any) => {
htdPowerMthdCd: lwCdCode['htdPowerMthdCd']??[],
htdUtztnUsgCd: lwCdCode['htdUtztnUsgCd']??[],
rswtBdstType:lwCdCode['rswtBdstType']??[] ,
bdstTotalUsgType:lwCdCode['bdstUsgCd']?.concat(lwCdCode['rswtBdstType'] || [])??[]
},
}));
}catch(e){
@@ -256,6 +256,7 @@ export type comCodeState = {
htdPowerMthdCd: SelectDataType[];
htdUtztnUsgCd: SelectDataType[];
rswtBdstType:SelectDataType[];
bdstTotalUsgType:SelectDataType[]
userSiSggCd: string;
};
};
@@ -293,6 +294,7 @@ export const comCodeStateExport: comCodeState = {
htdUtztnUsgCd: lwCds['htdUtztnUsgCd']??[],
userSiSggCd: laeSecd,
rswtBdstType:lwCds['rswtBdstType']??[] ,
bdstTotalUsgType:lwCds['bdstTotalUsgType']??[]
},
};
+3 -6
View File
@@ -23,9 +23,7 @@ export type rainMapState = {
type rainMapActions = {
rainMapInit: (page: number, total: number, cityOrSgg:string) => void;
rainMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rainMapSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,code:Record<string , SelectDataType[]>) => void;
rainMapDetile:(featureCd:string) => Promise<customRainBdst | undefined>;
};
@@ -72,8 +70,7 @@ export const rainMapActionsExport: (set: any) => rainMapActions = (
}
},
rainMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
code :Record<string, SelectDataType[]>) => {
try {
const rainMapRes = await getFetchWithCount(
fetchType.WR,
@@ -84,7 +81,7 @@ export const rainMapActionsExport: (set: any) => rainMapActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainMapExcelList = excelRainSttnParsing(rainMapRes, sidoCode, sggCode);
const rainMapExcelList = excelRainSttnParsing(rainMapRes, code);
set((state: rainMapState) => {
return {
+3 -7
View File
@@ -23,9 +23,7 @@ export type rswtMapState = {
type rswtMapActions = {
rswtMapInit: (page: number, total: number, cityOrSgg: string) => void;
rswtMapSearch: (
isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
isExcel: boolean, page: number, total: string, con: string, txt: string, code:Record<string, SelectDataType[]>
) => void;
rswtMapDetile: (featureCd: string) => Promise<customRswtBdst | undefined>;
};
@@ -72,9 +70,7 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
console.log(e);
}
},
rswtMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
rswtMapSearch: async (isExcel: boolean, page: number, total: string, con: string, txt: string,code:Record<string, SelectDataType[]>
) => {
try {
const rswtMapRes = await getFetchWithCount(
@@ -86,7 +82,7 @@ export const rswtMapActionsExport: (set: any) => rswtMapActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtMapExcelList = excelRSwtSttnParsing(rswtMapRes, sidoCode, sggCode);
const rswtMapExcelList = excelRSwtSttnParsing(rswtMapRes, code);
set((state: rswtMapState) => {
return {
...state,
@@ -11,15 +11,11 @@ import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "
export const rswtRegSize =15;
const rswtrObjSchema = z.object({
bdstRuseFcltSn: z.number().nullish(),
//wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }),
//oblgTrgtWtrUsqty: z.number().nullish().default(0),
orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }),
filtrTrtmfctCpct: z.number().nullish(),
filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }),
filtrTrtmfctUsgCd: z.string().default("").nullish(),
rswtrUsqty: z.number().default(0),
//altUswtrUtztnYn: z.enum(["Y", "N"]).nullish(), //안쓰는값
// altUswtrKndCd: z.string().default("").nullish(), //안쓰는값
altUswtrUtztnQnt: z.number().default(0), //안쓰는값
altUswtrIdntyMthdCd: z.string().default("").nullish(), //안쓰는값
rgtr: z.string().nullish().default(null),
@@ -1,22 +1,18 @@
import type { SelectDataType } from "@common/business_components/ui";
import type { customRainBdst } from "../../fcltReg/rainReg";
import { lwCds } from "@/app/store/common/code";
//TODO: 공통코드시 삭제되니 수정 해야됨
export const excelRainSttnParsing = (
excel: { data: customRainBdst[] },
sidoCode: SelectDataType[],
sggCode: SelectDataType[]
code: Record<string, SelectDataType[]>
): string[][] => {
const excelExportData: string[][] = [];
excel.data.forEach((item) => {
console.log("item", item)
excelExportData.push([
sidoCode.find((sido) => sido.val === item.ctpvCd?.toString())?.text ?? "",
sggCode.find((sgg) => sgg.val === item.sggCd?.toString())?.text ?? "",
code?.cityCd?.find((sido) => sido.val === item.ctpvCd?.toString())?.text ?? "",
code?.sggCd?.find((sgg) => sgg.val === item.sggCd?.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
lwCds?.bdstUsgCd?.find((cd) => cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
code?.bdstUsgCd?.find((cd) => cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
String(item.frstArchPrmsnDt ?? ""),
String(item.archArea.split('.')[0] === '-1' ? '확인불가' : item.archArea.split('.')[0]),
String(item.chgBuilding.length > 0 ? "Y" : "N"),
@@ -126,7 +126,7 @@ export const rainSttHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "녹색건축물인증등급",
visible: true,
},
@@ -405,7 +405,7 @@ export const rainSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "인증등급",
upName: "grntchBdstCert",
visible: true,
@@ -102,12 +102,8 @@ export type rainSttnState = {
};
};
type rainSttnActions = {
rainSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void
rainSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rainSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string, SelectDataType[]> ) => void
rainSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string, SelectDataType[]>) => void;
rainChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -134,9 +130,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
set: any
) => {
return {
rainSttnInit: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rainSttnInit: async (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string, SelectDataType[]>) => {
try {
const rainSttnRes = await getFetchWithCount(
@@ -148,7 +142,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
const rainExcel = excelRainSttnParsing(rainSttnRes, code);
set((state: rainSttnState) => {
return {
...state,
@@ -174,9 +168,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
console.log(e)
}
},
rainSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rainSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string, SelectDataType[]>) => {
try {
const rainSttnRes = await getFetchWithCount(
fetchType.WR,
@@ -187,7 +179,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode);
const rainExcel = excelRainSttnParsing(rainSttnRes,code);
set((state: rainSttnState) => {
return {
...state,
@@ -6,11 +6,12 @@ export const excelRSwtSttnParsing = (
excel: { data: customRswtBdst[] },
code: Record<string,SelectDataType[]>
): string[][] => {
const excelExportData: string[][] = [];
excel.data.forEach((item) => {
excelExportData.push([
code.sidoCode?.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
code.sggCode?.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
code.cityCd?.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
code.sggCd?.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
item.bdstNm ?? "",
item.daddr ?? "",
code?.bdstUsgCd?.find((cd)=> cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도
@@ -119,7 +119,7 @@ export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
visible: true,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "녹색건축물인증등급",
visible: true,
},
@@ -379,7 +379,7 @@ export const rswtSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "grntchBdstCertGrd",
id: "grntchBdstCertGrdText",
title: "인증등급",
upName: "grntchBdstCert",
visible: true,
@@ -30,11 +30,8 @@ export type rswtSttnState = {
};
type rswtSttnActions = {
rswtSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string,
code: Record<string,SelectDataType[]>) => void;
rswtSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => void;
rswtSttnInit: (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string,SelectDataType[]>) => void;
rswtSttnSearch: (isExcel: boolean, page: number, total: number, con: string, txt: string, code: Record<string,SelectDataType[]>) => void;
rswtChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
@@ -97,9 +94,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
console.log(e)
}
},
rswtSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,
sidoCode: SelectDataType[],
sggCode: SelectDataType[]) => {
rswtSttnSearch: async (isExcel: boolean, page: number, total: number, con: string, txt: string,code: Record<string,SelectDataType[]>) => {
try {
const rswtSttnRes = await getFetchWithCount(
fetchType.WR,
@@ -110,7 +105,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
(txt ? `/${txt}` : "")
);
if (isExcel) {
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, code);
set((state: rswtSttnState) => {
return {
...state,
+2 -1
View File
@@ -3,6 +3,7 @@ import {
codeActionExport,
comCodeStateExport,
getCityCd,
getCommonUpCd,
getEnvPartCd,
getMiddleRegionCd,
getRegionCd,
@@ -341,7 +342,7 @@ export const StoreZus = (
getMiddleRegionCd(set);
getUnitWaterShedCd(set);
getEnvPartCd(set);
getCommonUpCd(set)
return {
...initState,
...comFcltSearchAction(set),