diff --git a/apps/fo/app/store/planSewage/index.tsx b/apps/fo/app/store/planSewage/index.tsx index 29a919977..2fd9b531c 100644 --- a/apps/fo/app/store/planSewage/index.tsx +++ b/apps/fo/app/store/planSewage/index.tsx @@ -108,6 +108,17 @@ const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: return { data: res.data, count: res.count } } +// 분류식화율 구하기 위한 api 호출 +const fetchPlanZoneList = async (searchYear: string, fcltCdList: string[]) => { + try { + const res = await postFetch('fo', '/prcsFclt/info/planZone/' + searchYear, fcltCdList); + return res; + } catch (error) { + console.error('시설정보 오수발생량 상세 데이터를 가져오는데 실패했습니다:', error); + return null; + } +} + // 시설들 유량 정보 조회 // export const fetchFlow = async (searchYear: string | undefined, fcltCdList: string[]): Promise => { // try { @@ -210,6 +221,7 @@ export const planSewageReducer: (set: (fn: (state: PlanSewageType) => PlanSewage })); const res = await fetchPlanSewageList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); const fcltylist = res.data; // 시설목록 + const fcltCdList: string[] = []; // 시설코드목록 const planSewageList: PlanSewageProps[] = []; // 오수발생량시설목록 fcltylist.forEach(item => { @@ -228,8 +240,8 @@ export const planSewageReducer: (set: (fn: (state: PlanSewageType) => PlanSewage rvbsn: item.rvbsn, //단위유역 lgbsn: item.lgbsn, //권역 mdmbsn: item.mdmbsn, //중권역 - sprtProcZoneAr: item.sprtProcZoneAr, // 분류식지역 면적(㎢) - procZoneSm: item.procZoneSm, // 처리구역 면적합계(㎢) + sprtProcZoneAr: 0, // 분류식지역 면적(㎢) + procZoneSm: 0, // 처리구역 면적합계(㎢) avgInflAmnt: 0, avgInflAmntSunny: 0, maxInflAmntSunny: 0, @@ -239,6 +251,16 @@ export const planSewageReducer: (set: (fn: (state: PlanSewageType) => PlanSewage const excelDownList: ExcelType[] = []; // const data = res.data + const planZoneRes: any = await fetchPlanZoneList(searchYear, fcltCdList); + const planZoneList = planZoneRes?.data; + planZoneList?.forEach(item => { + const planSewageItem = planSewageList.find(item2 => item2.bscFctCd == item.bscFctCd); + if (planSewageItem) { + planSewageItem.sprtProcZoneAr = item.sprtProcZoneAr; + planSewageItem.procZoneSm = item.procZoneSm; + } + }); + const detailRes: any = await fetchFlow(searchYear, fcltCdList); for (const item of planSewageList) { const detailList = detailRes?.data[item.bscFctCd];