diff --git a/apps/fo/app/store/planSewage/index.tsx b/apps/fo/app/store/planSewage/index.tsx index 44ab12440..742f9d3a8 100644 --- a/apps/fo/app/store/planSewage/index.tsx +++ b/apps/fo/app/store/planSewage/index.tsx @@ -1,37 +1,33 @@ -import DataForm from "@/app/components/common/DataForm"; +import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import { getFetch } from "@/app/components/api"; import { type ApiResponse, type FlowDataItem } from "../underWaterInput"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import { roundUp } from "../common"; export type { TableUpperProps }; -/**==================================== - * Store - 타입 - ====================================*/ - /** - * (1) 메인페이지 + * 처리시설 연간 운영현황 > 계획하수량 산정지표 현황 */ // 시설별 강수현황 type PlanSewageProps = { - bscFctCd : string, - sido : string, - gugun : string, - bscFctNm : string, - daddr : string, - fctCpc : number, - spareCapacity : number, - variableLoadPercent : number, - classifiedSewerPercent : number, - rgnNm : string, - rvbsn : string, - lgbsn : string, - mdmbsn : string, - sprtProcZoneAr : number, - procZoneSm : number, - avgInflAmnt : number, - avgInflAmntSunny : number, - maxInflAmntSunny : number, + bscFctCd: string, + sido: string, + gugun: string, + bscFctNm: string, + daddr: string, + fctCpc: number, + spareCapacity: number, + variableLoadPercent: number, + classifiedSewerPercent: number, + rgnNm: string, + rvbsn: string, + lgbsn: string, + mdmbsn: string, + sprtProcZoneAr: number, + procZoneSm: number, + avgInflAmnt: number, + avgInflAmntSunny: number, + maxInflAmntSunny: number, } /**==================================== @@ -40,90 +36,128 @@ type PlanSewageProps = { /** * (1) 메인페이지 - */ + */ // 검색단 -const LabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별']; +const LabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별']; // 리스트 헤더 -const upHeadList1:TableUpperProps[] = [ - { id: "A", title: "행정구역", upSequnce:1, row:0, colSpan:2 }, - { id: "sido", title: "시도", upName:"upChangeRe", upSequnce:1, row:1, widthPercent: 10 }, - { id: "gugun", title: "시군구", upName:"upChangeRe",upSequnce:2, row:1, widthPercent: 10 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 10 }, - { id: "daddr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, +const upHeadList1: TableUpperProps[] = [ + { id: "A", title: "행정구역", upSequnce: 1, row: 0, colSpan: 2 }, + { id: "sido", title: "시도", upName: "upChangeRe", upSequnce: 1, row: 1, widthPercent: 10 }, + { id: "gugun", title: "시군구", upName: "upChangeRe", upSequnce: 2, row: 1, widthPercent: 10 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 }, + { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "spareCapacity", title: "여유용량(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "variableLoadPercent", title: "변동부하율(%)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "classifiedSewerPercent", title: "분류식화율(%)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, ]; -const upHeadList2:TableUpperProps[] = [ - { id: "A", title: "유역", upName:"upChangeRe", upSequnce:1, row:0, colSpan:3 }, - { id: "rvbsn", title: "권역", upName:"upChangeRe", upSequnce:1, row:1, widthPercent: 8 }, - { id: "lgbsn", title: "단위유역", upName:"upChangeRe", upSequnce:2, row:1, widthPercent: 8}, - { id: "mdmbsn", title: "중권역", upName:"upChangeRe", upSequnce:3, row:1, widthPercent: 8}, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 10 }, - { id: "daddr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, +const upHeadList2: TableUpperProps[] = [ + { id: "A", title: "유역", upName: "upChangeRe", upSequnce: 1, row: 0, colSpan: 3 }, + { id: "rvbsn", title: "권역", upName: "upChangeRe", upSequnce: 1, row: 1, widthPercent: 8 }, + { id: "lgbsn", title: "단위유역", upName: "upChangeRe", upSequnce: 2, row: 1, widthPercent: 8 }, + { id: "mdmbsn", title: "중권역", upName: "upChangeRe", upSequnce: 3, row: 1, widthPercent: 8 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 }, + { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "spareCapacity", title: "여유용량(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "variableLoadPercent", title: "변동부하율(%)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "classifiedSewerPercent", title: "분류식화율(%)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, ]; -const upHeadList3:TableUpperProps[] = [ - { id: "A", title: "유역", upName:"upChangeRe", upSequnce:1, row:0, colSpan:3 }, - { id: "rvbsn", title: "권역", upName:"upChangeRe1", upSequnce:1, row:1, widthPercent: 5 }, - { id: "lgbsn", title: "단위유역", upName:"upChangeRe1", upSequnce:2, row:1, widthPercent: 5 }, - { id: "mdmbsn", title: "중권역", upName:"upChangeRe1", upSequnce:3, row:1, widthPercent: 5}, - { id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 8 }, - { id: "B", title: "행정구역", upName:"upChangeRe", upSequnce:1, row:0, colSpan:2 }, - { id: "sido", title: "시도", upName:"upChangeRe2", upSequnce:1, row:1, widthPercent: 5 }, - { id: "gugun", title: "시군구", upName:"upChangeRe2",upSequnce:2, row:1, widthPercent: 5 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 10 }, - { id: "daddr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, - { id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right', widthPercent: 8 }, +const upHeadList3: TableUpperProps[] = [ + { id: "A", title: "유역", upName: "upChangeRe", upSequnce: 1, row: 0, colSpan: 3 }, + { id: "rvbsn", title: "권역", upName: "upChangeRe1", upSequnce: 1, row: 1, widthPercent: 5 }, + { id: "lgbsn", title: "단위유역", upName: "upChangeRe1", upSequnce: 2, row: 1, widthPercent: 5 }, + { id: "mdmbsn", title: "중권역", upName: "upChangeRe1", upSequnce: 3, row: 1, widthPercent: 5 }, + { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "B", title: "행정구역", upName: "upChangeRe", upSequnce: 1, row: 0, colSpan: 2 }, + { id: "sido", title: "시도", upName: "upChangeRe2", upSequnce: 1, row: 1, widthPercent: 5 }, + { id: "gugun", title: "시군구", upName: "upChangeRe2", upSequnce: 2, row: 1, widthPercent: 5 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 }, + { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "spareCapacity", title: "여유용량(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "variableLoadPercent", title: "변동부하율(%)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, + { id: "classifiedSewerPercent", title: "분류식화율(%)", row: 0, rowSpan: 2, align: 'right', widthPercent: 8 }, ]; -const planSewageList:PlanSewageProps[] = [ +const planSewageList: PlanSewageProps[] = [ ] /**==================================== * Store - api ====================================*/ - const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { - const tailStr = partCd ? '/'+ partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') +'/0'+ (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; + +/** +* 계획시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) +* @param pageNo : 페이지 번호 +* @param pageSize : 페이지 크기 +* @param searchYear : 검색년도 +* @param partCd : 구분코드 +* @param nameCd : 행정코드(시도명, 시군구명, 단위유역) +* @param fcltCpct : 시설용량 +* @param oprtngSttsCd : 운영 상태 코드 +* @param facilityName : 시설명 +*/ +const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { + const tailStr = partCd ? '/' + partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') + '/0' + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/prcsFclt/info/plan/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; const res = await getFetch('fo', url); return { data: res.data, count: res.count } - } +} + +// 시설들 유량 정보 조회 +export const fetchFlow = async (searchYear: string | undefined, fcltCdList: string[]): Promise => { + try { + const params = new URLSearchParams(); + fcltCdList.forEach(cd => params.append('fcltCds', cd)); + const res = await getFetch('fo', '/fclt/flow/' + searchYear + '?' + params.toString()); + return res; + } catch (error) { + console.error('시설정보 유량 데이터를 가져오는데 실패했습니다:', error); + return null; + } +}; /**==================================== * Store - expaort ====================================*/ +interface FlowDataItem { + inflAmnt: number | string; + infoRnDay: number; + msrDt: string; + rainEffectDay?: number; + sumFlow?: number | string | ''; +} + +interface ApiResponse { + data: FlowDataItem[]; + count: number; +} + export type ExcelType = { 시설코드: string; - 권역:string|'', - 단위유역:string|'', - 중권역:string|'', - 환경청:string|'', + 권역: string | '', + 단위유역: string | '', + 중권역: string | '', + 환경청: string | '', 시도: string; 시군구: string; 시설이름: string; 주소: string; "시설용량(m³/일)": number; "여유용량(m³/일)": number; - "변동부하율(%)" : number; - "분류식화율(%)" : number; + "변동부하율(%)": number; + "분류식화율(%)": number; } -const dataFormSetting=(item : PlanSewageProps)=> { +const dataFormSetting = (item: PlanSewageProps) => { DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record }); - DataForm({ type: 'float0', column: 'spareCapacity', item: item as unknown as Record}); - DataForm({ type: 'float2', column: 'variableLoadPercent', item: item as unknown as Record}); - DataForm({ type: 'float1', column: 'classifiedSewerPercent', item: item as unknown as Record}); + DataForm({ type: 'float0', column: 'spareCapacity', item: item as unknown as Record }); + DataForm({ type: 'float2', column: 'variableLoadPercent', item: item as unknown as Record }); + DataForm({ type: 'float1', column: 'classifiedSewerPercent', item: item as unknown as Record }); }; export type PlanSewageActions = { @@ -133,10 +167,10 @@ export type PlanSewageActions = { export type PlanSewageType = { PlanSewageSearch: { isInit: boolean; - labelArray:string[]; + labelArray: string[]; }, - PlanSewage : { + PlanSewage: { isInit: boolean; upHeadList1: TableUpperProps[]; upHeadList2: TableUpperProps[]; @@ -154,21 +188,21 @@ export const planSewageInitState: PlanSewageType = { labelArray: LabelArray, }, - PlanSewage : { - isInit : false, - upHeadList1 : upHeadList1, - upHeadList2 : upHeadList2, - upHeadList3 : upHeadList3, - planSewageList : planSewageList, - planSewageCount : 0, - excelList : [], - isLoading : true, + PlanSewage: { + isInit: false, + upHeadList1: upHeadList1, + upHeadList2: upHeadList2, + upHeadList3: upHeadList3, + planSewageList: planSewageList, + planSewageCount: 0, + excelList: [], + isLoading: true, }, } export type PlanSewageStore = PlanSewageType & PlanSewageActions; -export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageType) => void)=>PlanSewageActions=(set: (fn: (state: PlanSewageType) => PlanSewageType) => void) => { +export const planSewageReducer: (set: (fn: (state: PlanSewageType) => PlanSewageType) => void) => PlanSewageActions = (set: (fn: (state: PlanSewageType) => PlanSewageType) => void) => { return { searchPlanSewageList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { set((state: PlanSewageType) => ({ @@ -179,48 +213,110 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy }, })); 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 => { + fcltCdList.push(item.bscFctCd); + planSewageList.push({ + bscFctCd: item.bscFctCd, + sido: item.sido, + gugun: item.gugun, + bscFctNm: item.bscFctNm, + daddr: item.daddr, + fctCpc: parseFloat(item.fctCpc.toString().replace(/,/g, '')), + spareCapacity: 0, + variableLoadPercent: 0, + classifiedSewerPercent: 0, + rgnNm: item.rgnNm, //환경청 + rvbsn: item.rvbsn, //단위유역 + lgbsn: item.lgbsn, //권역 + mdmbsn: item.mdmbsn, //중권역 + sprtProcZoneAr: item.sprtProcZoneAr, // 분류식지역 면적(㎢) + procZoneSm: item.procZoneSm, // 처리구역 면적합계(㎢) + avgInflAmnt: 0, + avgInflAmntSunny: 0, + maxInflAmntSunny: 0, + }); + }); + const excelDownList: ExcelType[] = []; const data = res.data - const processedData = await Promise.all(data.map(async (item:PlanSewageProps) => { - const res2 = await getFetch('fo', '/fclt/flow/' + item.bscFctCd + '/' + searchYear) as ApiResponse; - const calData = CalcRainEffect(res2.data, 'SUNNY'); + const detailRes: any = await fetchFlow(searchYear, fcltCdList); + for (const item of planSewageList) { + const detailList = detailRes?.data[item.bscFctCd]; + + let avgInflAmnt = 0; let sumInflAmntSunny = 0; let avgInflAmntSunny = 0; let maxInflAmntSunny = 0; - calData.forEach((flowItem:FlowDataItem) => { - sumInflAmntSunny += Number(flowItem.inflAmnt); + let cntSunny = 0; + let rainEffectDay = 0; + detailList?.forEach(item2 => { - if(Number(flowItem.inflAmnt) > maxInflAmntSunny){ - maxInflAmntSunny = Number(flowItem.inflAmnt); + if (item2.infoRnDay == null || item2.infoRnDay == 'x') item2.infoRnDay = 0; + if (item2.infoRnDay >= 3) { // 강우량이 3이상이면 그 후 2일이 강후영향일임. + rainEffectDay = 2; + } else { + rainEffectDay--; } - }); + if (rainEffectDay < 0) { //청천시 + sumInflAmntSunny += Number(item2.inflAmnt); + cntSunny++; - avgInflAmntSunny = sumInflAmntSunny / calData.length; + if (Number(item2.inflAmnt) > maxInflAmntSunny) { + maxInflAmntSunny = Number(item2.inflAmnt); + } + } + avgInflAmnt += Number(item2.inflAmnt); + }); + avgInflAmntSunny = sumInflAmntSunny / cntSunny; + item.avgInflAmnt = roundUp(avgInflAmnt, 0); item.avgInflAmntSunny = roundUp(avgInflAmntSunny, 0); item.maxInflAmntSunny = roundUp(maxInflAmntSunny, 0); - return item; - })); - + } + + // const processedData = await Promise.all(data.map(async (item: PlanSewageProps) => { + // const res2 = await getFetch('fo', '/fclt/flow/' + item.bscFctCd + '/' + searchYear) as ApiResponse; + // const calData = CalcRainEffect(res2.data, 'SUNNY'); + + // let sumInflAmntSunny = 0; // 청천시 유입량 합계 + // let avgInflAmntSunny = 0; // 청천시 유입량 평균 + // let maxInflAmntSunny = 0; // 청천시 유입량 최대값 + // calData.forEach((flowItem: FlowDataItem) => { + // sumInflAmntSunny += Number(flowItem.inflAmnt); + + // if (Number(flowItem.inflAmnt) > maxInflAmntSunny) { + // maxInflAmntSunny = Number(flowItem.inflAmnt); + // } + // }); + + // avgInflAmntSunny = sumInflAmntSunny / calData.length; + // item.avgInflAmntSunny = roundUp(avgInflAmntSunny, 0); + // item.maxInflAmntSunny = roundUp(maxInflAmntSunny, 0); + // return item; + // })); + /** * 결과데이터 계산 * (1) 여유용량 = 시설용량 - 건기시 평균유량 * (2) 변동부하율 = 건기시 일최대 유량/일평균유량(기준 최근 3개년) * (3) 분류식화율 = 분류식지역 면적(㎢)/처리구역 면적합계(㎢) ×100 */ - const resultData = processedData.map((item:PlanSewageProps) => { + const resultData = planSewageList.map((item: PlanSewageProps) => { item.spareCapacity = Number(item.fctCpc) - Number(item.avgInflAmntSunny); - item.variableLoadPercent = item.maxInflAmntSunny && item.maxInflAmntSunny!==0 ? Number(item.maxInflAmntSunny) / Number(item.avgInflAmntSunny) : 0; - item.classifiedSewerPercent = item.sprtProcZoneAr && item.sprtProcZoneAr!==0 ? Number(item.sprtProcZoneAr) / Number(item.procZoneSm) * 100 : 0; + item.variableLoadPercent = item.maxInflAmntSunny && item.maxInflAmntSunny !== 0 ? Number(item.maxInflAmntSunny) / Number(item.avgInflAmntSunny) : 0; + item.classifiedSewerPercent = item.sprtProcZoneAr && item.sprtProcZoneAr !== 0 ? Number(item.sprtProcZoneAr) / Number(item.procZoneSm) * 100 : 0; // 분류식화율 return item; }); - resultData.forEach((item:PlanSewageProps) => { + resultData.forEach((item: PlanSewageProps) => { dataFormSetting(item) }) - if(pageSize>5000){ - resultData.forEach((item:PlanSewageProps) => { + if (pageSize > 5000) { + resultData.forEach((item: PlanSewageProps) => { excelDownList.push({ 시설코드: item.bscFctCd, 권역: item.lgbsn, @@ -238,18 +334,18 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy }) }) } - - set((state:PlanSewageType) => ({ + + set((state: PlanSewageType) => ({ ...state, - PlanSewage: pageSize<5000?{ + PlanSewage: pageSize < 5000 ? { ...state.PlanSewage, planSewageList: resultData, planSewageCount: res.count, - isLoading : false, - }:{ + isLoading: false, + } : { ...state.PlanSewage, excelList: excelDownList, - isLoading : false, + isLoading: false, }, })) } diff --git a/apps/fo/app/store/processFacility/index.tsx b/apps/fo/app/store/processFacility/index.tsx index f4184865d..8fa38e5bc 100644 --- a/apps/fo/app/store/processFacility/index.tsx +++ b/apps/fo/app/store/processFacility/index.tsx @@ -2,152 +2,147 @@ import { getFetch } from "@/app/components/api"; import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; export type { TableUpperProps }; - -/**==================================== - * Store - 타입 - ====================================*/ - /** - * (1) 메인페이지 + * 처리시설 현황 > 처리시설 시설정보 */ // 처리시설 리스트 export type facilityListProps = { - bscFctCd : string, - bscFctNm : string, - bscFctClsNm : string, - sido : string, - gugun : string, - daddr : string, - fctCpc : number | string | '', - plInflWqltBod : number | string | '', - dsInflWqltBod : number | string | '', - trtFrfNm : string, - rnDt : string, - cmplDt : string, - trstOprEtpNm : string, - rvbsn : string, - mdmbsn : string, - lgbsn : string, - rgnNm : string, - mnstr : string, - efflWtrrgn : string, - efflWqltStndrdNm : string + bscFctCd: string, + bscFctNm: string, + bscFctClsNm: string, + sido: string, + gugun: string, + daddr: string, + fctCpc: number | string | '', + plInflWqltBod: number | string | '', + dsInflWqltBod: number | string | '', + trtFrfNm: string, + rnDt: string, + cmplDt: string, + trstOprEtpNm: string, + rvbsn: string, + mdmbsn: string, + lgbsn: string, + rgnNm: string, + mnstr: string, + efflWtrrgn: string, + efflWqltStndrdNm: string } export interface ExcelType { - 시설코드: string, - 권역:string|'', - 단위유역:string|'', - 중권역:string|'', - 환경청:string|'', - 시도: string, - 시군구: string, - 시설이름: string, - 주소: string, - "시설용량(m³/일)": number | '', - "계획유입수질(mg/L)": number | '', - "설계유입수질(mg/L)": number | '', - 공법: string, - 가동개시일: string, - 준공일: string, - 관리대행업자: string, + 시설코드: string, + 권역: string | '', + 단위유역: string | '', + 중권역: string | '', + 환경청: string | '', + 시도: string, + 시군구: string, + 시설이름: string, + 주소: string, + "시설용량(m³/일)": number | '', + "계획유입수질(mg/L)": number | '', + "설계유입수질(mg/L)": number | '', + 공법: string, + 가동개시일: string, + 준공일: string, + 관리대행업자: string, } // (2) 처리시설 팝업 // 시설 기본정보 export type BasicInfoProps = { - bscFctNm : string, - fctCpc : number | '', - sido : string, - gugun : string, - startDay : string, - addr : string, - cmplDt : string, - trtFrfNm : string, - trstOprEtpNm : string, + bscFctNm: string, + fctCpc: number | '', + sido: string, + gugun: string, + startDay: string, + addr: string, + cmplDt: string, + trtFrfNm: string, + trstOprEtpNm: string, } // 시설 계획정보 export type PlanInfoProps = { - plInflWqltBod? : string, - plInflWqltToc? : string, - plInflWqltCod? : string, - plInflWqltSs? : string, - plInflWqltTn? : string, - plInflWqltTp? : string, - dsInflWqltBod? : string, - dsInflWqltToc? : string, - dsInflWqltCod? : string, - dsInflWqltSs? : string, - dsInflWqltTn? : string, - dsInflWqltTp? : string, - sitArea? : string | number, - trtDstrArea? : string | number, - swrTrtPopl? : string | number + plInflWqltBod?: string, + plInflWqltToc?: string, + plInflWqltCod?: string, + plInflWqltSs?: string, + plInflWqltTn?: string, + plInflWqltTp?: string, + dsInflWqltBod?: string, + dsInflWqltToc?: string, + dsInflWqltCod?: string, + dsInflWqltSs?: string, + dsInflWqltTn?: string, + dsInflWqltTp?: string, + sitArea?: string | number, + trtDstrArea?: string | number, + swrTrtPopl?: string | number } // 시설 계획정보 export type LegalWaterQltyProps = { - totClfgrpcnt : number, - bod : number, - cod : number, - ss : number, - tn : number, - tp : number + totClfgrpcnt: number, + bod: number, + cod: number, + ss: number, + tn: number, + tp: number } // 시설 수역 및 구역정보 export type fcltyAreaInfoProps = { - rvbsn : string, - efflWtrrgn : string, - lgbsn : string, - efflWqltStndrdNm : string, - rgnNm : string, + rvbsn: string, + efflWtrrgn: string, + lgbsn: string, + efflWqltStndrdNm: string, + rgnNm: string, } // 시설 이력관리 export type fcltyHistInfoProps = { - extnsSeqno : string, - extnsNm : string, - bzStrtYrMnth : string, - bzEdYrMnth : string, - eqpPrmsDt : string, - cmplDt : string, - trlrnCmplDt : string, - rnDt : string, - sitArea : number, - trtDstrArea : number, - swrTrtPopl : number, - fctCpc : number | '' + extnsSeqno: string, + extnsNm: string, + bzStrtYrMnth: string, + bzEdYrMnth: string, + eqpPrmsDt: string, + cmplDt: string, + trlrnCmplDt: string, + rnDt: string, + sitArea: number, + trtDstrArea: number, + swrTrtPopl: number, + fctCpc: number | '' } // 시설 수질정보 export type fcltyWaterQltyInfoProps = { - extnsSeqno : string, - plInflWqltBod : string, - plInflWqltToc : string, - plInflWqltCod : string, - plInflWqltSs : string, - plInflWqltTn : string, - plInflWqltTp : string, - dsInflWqltBod : string, - dsInflWqltToc : string, - dsInflWqltCod : string, - dsInflWqltSs : string, - dsInflWqltTn : string, - dsInflWqltTp : string, - plEfflWqltBod : string, - plEfflWqltToc : string, - plEfflWqltCod : string, - plEfflWqltSs : string, - plEfflWqltTn : string, - plEfflWqltTp : string, - bod : number, - cod : number, - ss : number, - tn : number, - tp : number, - totClfgrpcnt : number, + extnsSeqno: string, + plInflWqltBod: string, + plInflWqltToc: string, + plInflWqltCod: string, + plInflWqltSs: string, + plInflWqltTn: string, + plInflWqltTp: string, + dsInflWqltBod: string, + dsInflWqltToc: string, + dsInflWqltCod: string, + dsInflWqltSs: string, + dsInflWqltTn: string, + dsInflWqltTp: string, + plEfflWqltBod: string, + plEfflWqltToc: string, + plEfflWqltCod: string, + plEfflWqltSs: string, + plEfflWqltTn: string, + plEfflWqltTp: string, + bod: number, + cod: number, + ss: number, + tn: number, + tp: number, + totClfgrpcnt: number, } /**==================================== @@ -156,48 +151,48 @@ export type fcltyWaterQltyInfoProps = { /** * (1) 메인페이지 - */ + */ // 검색단 -const ProcessFacilityLabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '시설상태', '시설구분', '권역', '단위유역', '중권역', '환경청별']; +const ProcessFacilityLabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '시설상태', '시설구분', '권역', '단위유역', '중권역', '환경청별']; // 리스트 헤더 -const upHeadList1:TableUpperProps[] = [ +const upHeadList1: TableUpperProps[] = [ { id: "A", title: "행정명", colSpan: 2, row: 0, widthPercent: 10 }, - { id: "sido", title: "시도", upName:"upChangeRe", row: 1, upSequnce:1, widthPercent: 5 }, - { id: "gugun", title: "시군구", upName:"upChangeRe", row: 1, upSequnce:2, widthPercent: 5 }, + { id: "sido", title: "시도", upName: "upChangeRe", row: 1, upSequnce: 1, widthPercent: 5 }, + { id: "gugun", title: "시군구", upName: "upChangeRe", row: 1, upSequnce: 2, widthPercent: 5 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, { id: "fctCpc", title: "시설용량\n(m³/일)", row: 0, align: 'right', rowSpan: 2, widthPercent: 5 }, - { id: "plInflWqltBod", title: "계획유입수질\n(mg/L)", row: 0, align:"right", rowSpan: 2, widthPercent: 5 }, - { id: "dsInflWqltBod", title: "설계유입수질\n(mg/L)", row: 0, align:"right", rowSpan: 2, widthPercent: 5 }, + { id: "plInflWqltBod", title: "계획유입수질\n(mg/L)", row: 0, align: "right", rowSpan: 2, widthPercent: 5 }, + { id: "dsInflWqltBod", title: "설계유입수질\n(mg/L)", row: 0, align: "right", rowSpan: 2, widthPercent: 5 }, { id: "trtFrfNm", title: '공법', row: 0, rowSpan: 2 }, { id: "rnDt", title: '가동개시일', row: 0, rowSpan: 2, widthPercent: 5 }, { id: "cmplDt", title: '준공일', row: 0, rowSpan: 2, widthPercent: 5 }, - { id: "trstOprEtpNm", title: '관리대행업자', row: 0, rowSpan: 2 , widthPercent: 14} + { id: "trstOprEtpNm", title: '관리대행업자', row: 0, rowSpan: 2, widthPercent: 14 } ]; // 처리시설 리스트 (유역) -const upHeadList2:TableUpperProps[] = [ +const upHeadList2: TableUpperProps[] = [ { id: "A", title: "유역", colSpan: 3, row: 0, widthPercent: 15 }, { id: "rvbsn", title: "권역", row: 1, widthPercent: 5 }, { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 5 }, { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 5 }, - { id: "bscFctNm", title: "시설명", rowSpan: 2,row: 0, widthPercent: 8 }, - { id: "daddr", title: "주소", rowSpan: 2,row: 0 }, - { id: "fctCpc", title: "시설용량\n(m³/일)", rowSpan: 2,row: 0, widthPercent: 5, align: 'right'}, - { id: "plInflWqltBod", title: "계획유입수질\n(mg/L)", rowSpan: 2,row: 0, widthPercent: 6, align:'right'}, - { id: "dsInflWqltBod", title: "설계유입수질\n(mg/L)", rowSpan: 2,row: 0, widthPercent: 6, align:'right'}, - { id: "trtFrfNm", title: '공법', rowSpan: 2,row: 0 }, - { id: "rnDt", title: '가동개시일', rowSpan: 2,row: 0, widthPercent: 5 }, - { id: "cmplDt", title: '준공일', rowSpan: 2,row: 0, widthPercent: 5 }, - { id: "trstOprEtpNm", title: '관리대행업자', rowSpan: 2,row: 0, widthPercent: 14 } + { id: "bscFctNm", title: "시설명", rowSpan: 2, row: 0, widthPercent: 8 }, + { id: "daddr", title: "주소", rowSpan: 2, row: 0 }, + { id: "fctCpc", title: "시설용량\n(m³/일)", rowSpan: 2, row: 0, widthPercent: 5, align: 'right' }, + { id: "plInflWqltBod", title: "계획유입수질\n(mg/L)", rowSpan: 2, row: 0, widthPercent: 6, align: 'right' }, + { id: "dsInflWqltBod", title: "설계유입수질\n(mg/L)", rowSpan: 2, row: 0, widthPercent: 6, align: 'right' }, + { id: "trtFrfNm", title: '공법', rowSpan: 2, row: 0 }, + { id: "rnDt", title: '가동개시일', rowSpan: 2, row: 0, widthPercent: 5 }, + { id: "cmplDt", title: '준공일', rowSpan: 2, row: 0, widthPercent: 5 }, + { id: "trstOprEtpNm", title: '관리대행업자', rowSpan: 2, row: 0, widthPercent: 14 } ]; // 처리시설 리스트 (환경청청) -const upHeadList3:TableUpperProps[] = [ +const upHeadList3: TableUpperProps[] = [ { id: "A", title: "유역", colSpan: 3, row: 0, widthPercent: 12 }, { id: "rvbsn", title: "권역", row: 1, widthPercent: 4 }, - { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 4}, + { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 4 }, { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 4 }, { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 6 }, { id: "B", title: "행정명", colSpan: 2, row: 0, widthPercent: 8 }, @@ -206,178 +201,178 @@ const upHeadList3:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, { id: "fctCpc", title: "시설용량\n(m³/일)", row: 0, rowSpan: 2, align: 'right', widthPercent: 5 }, - { id: "plInflWqltBod", title: "계획유입수질\n(mg/L)", row: 0, rowSpan: 2, align:'right', widthPercent: 5 }, - { id: "dsInflWqltBod", title: "설계유입수질\n(mg/L)", row: 0, rowSpan: 2, align:'right', widthPercent: 5 }, + { id: "plInflWqltBod", title: "계획유입수질\n(mg/L)", row: 0, rowSpan: 2, align: 'right', widthPercent: 5 }, + { id: "dsInflWqltBod", title: "설계유입수질\n(mg/L)", row: 0, rowSpan: 2, align: 'right', widthPercent: 5 }, { id: "trtFrfNm", title: '공법', row: 0, rowSpan: 2 }, { id: "rnDt", title: '가동개시일', row: 0, rowSpan: 2, widthPercent: 5 }, { id: "cmplDt", title: '준공일', row: 0, rowSpan: 2, widthPercent: 5 }, { id: "trstOprEtpNm", title: '관리대행업자', row: 0, rowSpan: 2, widthPercent: 14 } ]; -const processFacilityList:facilityListProps[] = [ +const processFacilityList: facilityListProps[] = [ ] /** * 처리시설 상세팝업 - */ + */ // 시설 기본정보 (헤더) -const upHeadListBasicInfo:TableUpperProps[] = [ +const upHeadListBasicInfo: TableUpperProps[] = [ { id: "bscFctNm", title: "시설명" }, - { id: "fctCpc", title: "시설용량n(m³/일)", align: 'right'}, - { id: "sido", title: "시도"}, - { id: "gugun", title: "시군구"}, - { id: "rnDt", title: "가동개시일"}, - { id: "daddr", title: "주소"}, - { id: "cmplDt", title: "준공일"}, - { id: "trtFrfNm", title: "공법"}, - { id: "trstOprEtpNm", title: "관리대행업자"}, + { id: "fctCpc", title: "시설용량n(m³/일)", align: 'right' }, + { id: "sido", title: "시도" }, + { id: "gugun", title: "시군구" }, + { id: "rnDt", title: "가동개시일" }, + { id: "daddr", title: "주소" }, + { id: "cmplDt", title: "준공일" }, + { id: "trtFrfNm", title: "공법" }, + { id: "trstOprEtpNm", title: "관리대행업자" }, ]; // 시설 기본정보 (리스트) -const gridListBasicInfo:BasicInfoProps[] = [ +const gridListBasicInfo: BasicInfoProps[] = [ { - bscFctNm : "난지", - fctCpc : 860000, - sido : "서울특별시", - gugun : "", - startDay : "1987-06-30", - addr : "경기도 고양시 덕양구 대덕로 426 (현천동)", - cmplDt : "2013-04-30", - trtFrfNm : "MLE, A2O", - trstOprEtpNm : "자체", + bscFctNm: "난지", + fctCpc: 860000, + sido: "서울특별시", + gugun: "", + startDay: "1987-06-30", + addr: "경기도 고양시 덕양구 대덕로 426 (현천동)", + cmplDt: "2013-04-30", + trtFrfNm: "MLE, A2O", + trstOprEtpNm: "자체", } ]; // 시설 법적방류수질 (헤더) -const upHeadListLegalWaterQlty:TableUpperProps[] = [ - { id: "bod", title: "BOD(mg/L)", align: 'right'}, - { id: "cod", title: "TOC(COD)(mg/L)", align: 'right'}, - { id: "ss", title: "SS(mg/L)", align: 'right'}, - { id: "tn", title: "T-N(mg/L)", align: 'right'}, - { id: "tp", title: "T-P(mg/L) ", align: 'right'}, - { id: "totClfgrpcnt", title: "대장균군(개/100ml)"}, +const upHeadListLegalWaterQlty: TableUpperProps[] = [ + { id: "bod", title: "BOD(mg/L)", align: 'right' }, + { id: "cod", title: "TOC(COD)(mg/L)", align: 'right' }, + { id: "ss", title: "SS(mg/L)", align: 'right' }, + { id: "tn", title: "T-N(mg/L)", align: 'right' }, + { id: "tp", title: "T-P(mg/L) ", align: 'right' }, + { id: "totClfgrpcnt", title: "대장균군(개/100ml)" }, ] // 시설 법적방류수질 (리스트) -let gridListLegalWaterQlty:LegalWaterQltyProps[] = [ +let gridListLegalWaterQlty: LegalWaterQltyProps[] = [ ] // 시설 계획정보 (헤더) -const upHeadListPlanInfo:TableUpperProps[] = [ - { id: "plInflWqltBod", title: "BOD", upName:"upChangeRe1", upSequnce:1, align: 'right' }, - { id: "plInflWqltToc", title: "TOC", upName:"upChangeRe1", upSequnce:2, align: 'right' }, - { id: "plInflWqltCod", title: "COD", upName:"upChangeRe1", upSequnce:3, align: 'right' }, - { id: "plInflWqltSs", title: "SS", upName:"upChangeRe1", upSequnce:4, align: 'right' }, - { id: "plInflWqltTn", title: "T-N", upName:"upChangeRe1", upSequnce:5, align: 'right' }, - { id: "plInflWqltTp", title: "T-P", upName:"upChangeRe1", upSequnce:6, align: 'right' }, - { id: "dsInflWqltBod", title: "BOD", upName:"upChangeRe2", upSequnce:1, align: 'right' }, - { id: "dsInflWqltToc", title: "TOC", upName:"upChangeRe2", upSequnce:2, align: 'right' }, - { id: "dsInflWqltCod", title: "COD", upName:"upChangeRe2", upSequnce:3, align: 'right' }, - { id: "dsInflWqltSs", title: "SS", upName:"upChangeRe2", upSequnce:4, align: 'right' }, - { id: "dsInflWqltTn", title: "T-N", upName:"upChangeRe2", upSequnce:5, align: 'right' }, - { id: "dsInflWqltTp", title: "T-P", upName:"upChangeRe2", upSequnce:6, align: 'right' }, - { id: "sitArea", title: "부지면적\n(m²)", align: 'right'}, - { id: "trtDstrArea", title: "처리구역면적\n(ha)", align: 'right'}, - { id: "swrTrtPopl", title: "하수처리인구\n(인)", align: 'right'}, +const upHeadListPlanInfo: TableUpperProps[] = [ + { id: "plInflWqltBod", title: "BOD", upName: "upChangeRe1", upSequnce: 1, align: 'right' }, + { id: "plInflWqltToc", title: "TOC", upName: "upChangeRe1", upSequnce: 2, align: 'right' }, + { id: "plInflWqltCod", title: "COD", upName: "upChangeRe1", upSequnce: 3, align: 'right' }, + { id: "plInflWqltSs", title: "SS", upName: "upChangeRe1", upSequnce: 4, align: 'right' }, + { id: "plInflWqltTn", title: "T-N", upName: "upChangeRe1", upSequnce: 5, align: 'right' }, + { id: "plInflWqltTp", title: "T-P", upName: "upChangeRe1", upSequnce: 6, align: 'right' }, + { id: "dsInflWqltBod", title: "BOD", upName: "upChangeRe2", upSequnce: 1, align: 'right' }, + { id: "dsInflWqltToc", title: "TOC", upName: "upChangeRe2", upSequnce: 2, align: 'right' }, + { id: "dsInflWqltCod", title: "COD", upName: "upChangeRe2", upSequnce: 3, align: 'right' }, + { id: "dsInflWqltSs", title: "SS", upName: "upChangeRe2", upSequnce: 4, align: 'right' }, + { id: "dsInflWqltTn", title: "T-N", upName: "upChangeRe2", upSequnce: 5, align: 'right' }, + { id: "dsInflWqltTp", title: "T-P", upName: "upChangeRe2", upSequnce: 6, align: 'right' }, + { id: "sitArea", title: "부지면적\n(m²)", align: 'right' }, + { id: "trtDstrArea", title: "처리구역면적\n(ha)", align: 'right' }, + { id: "swrTrtPopl", title: "하수처리인구\n(인)", align: 'right' }, ]; // 시설 계획정보 (리스트) -const gridListPlanInfo:PlanInfoProps[] = [ +const gridListPlanInfo: PlanInfoProps[] = [ { - plInflWqltBod : "179.0", - plInflWqltToc : "90.0", - plInflWqltCod : "0.0", - plInflWqltSs : "132.0", - plInflWqltTn : "38.000", - plInflWqltTp : "4.300", - dsInflWqltBod : "178.0", - dsInflWqltToc : "91.0", - dsInflWqltCod : "0.0", - dsInflWqltSs : "131.0", - dsInflWqltTn : "40.200", - dsInflWqltTp : "4.500", - sitArea : "928,574", - trtDstrArea : "7,994.0", - swrTrtPopl : "1,573,277", + plInflWqltBod: "179.0", + plInflWqltToc: "90.0", + plInflWqltCod: "0.0", + plInflWqltSs: "132.0", + plInflWqltTn: "38.000", + plInflWqltTp: "4.300", + dsInflWqltBod: "178.0", + dsInflWqltToc: "91.0", + dsInflWqltCod: "0.0", + dsInflWqltSs: "131.0", + dsInflWqltTn: "40.200", + dsInflWqltTp: "4.500", + sitArea: "928,574", + trtDstrArea: "7,994.0", + swrTrtPopl: "1,573,277", } ]; // 시설 수역 및 구역정보 (헤더) -const upHeadListFcltyAreaInfo:TableUpperProps[] = [ +const upHeadListFcltyAreaInfo: TableUpperProps[] = [ { id: "rvbsn", title: "하천명" }, - { id: "efflWtrrgn", title: "방류수역"}, - { id: "lgbsn", title: "단위유역"}, - { id: "efflWqltStndrdNm", title: "지역구분"}, - { id: "rgnNm", title: "관할 유역(지방) 환경청"} + { id: "efflWtrrgn", title: "방류수역" }, + { id: "lgbsn", title: "단위유역" }, + { id: "efflWqltStndrdNm", title: "지역구분" }, + { id: "rgnNm", title: "관할 유역(지방) 환경청" } ]; // 시설 수역 및 구역정보 (리스트) -const gridListFcltyAreaInfo:fcltyAreaInfoProps[] = [ +const gridListFcltyAreaInfo: fcltyAreaInfoProps[] = [ { - rvbsn : "한강", - efflWtrrgn : "한강수계", - lgbsn : "한강본류", - efflWqltStndrdNm : "500톤 이상\n(Ⅲ지역)", - rgnNm : "한강유역환경청" + rvbsn: "한강", + efflWtrrgn: "한강수계", + lgbsn: "한강본류", + efflWqltStndrdNm: "500톤 이상\n(Ⅲ지역)", + rgnNm: "한강유역환경청" } ]; // 시설 이력관리 (헤더) -const upHeadListFcltyHistInfo:TableUpperProps[] = [ +const upHeadListFcltyHistInfo: TableUpperProps[] = [ { id: "extnsSeqno", title: "차수", align: 'center' }, - { id: "extnsNm", title: "구분"}, - { id: "bzStrtYrMnth", title: "사업기간", upName:"upChangeRe1", upSequnce:1}, - { id: "bzEdYrMnth", title: "사업기간", upName:"upChangeRe1", upSequnce:2}, - { id: "eqpPrmsDt", title: "설치인가일"}, - { id: "cmplDt", title: "준공일"}, - { id: "trlrnCmplDt", title: "시운전완료일"}, - { id: "rnDt", title: "가동개시일"}, + { id: "extnsNm", title: "구분" }, + { id: "bzStrtYrMnth", title: "사업기간", upName: "upChangeRe1", upSequnce: 1 }, + { id: "bzEdYrMnth", title: "사업기간", upName: "upChangeRe1", upSequnce: 2 }, + { id: "eqpPrmsDt", title: "설치인가일" }, + { id: "cmplDt", title: "준공일" }, + { id: "trlrnCmplDt", title: "시운전완료일" }, + { id: "rnDt", title: "가동개시일" }, { id: "fctCpc", title: "시설용량(m³/일)", align: 'right' }, ]; // 시설 이력관리 (리스트) -const gridListFcltyHistInfo:fcltyHistInfoProps[] = [ +const gridListFcltyHistInfo: fcltyHistInfoProps[] = [ { - extnsSeqno : "최초", - extnsNm : "최초", - bzStrtYrMnth : "1984.12.01", - bzEdYrMnth : "1987.06.01", - eqpPrmsDt : "1985.09.13", - cmplDt : "1987.06.30", - trlrnCmplDt : "1987.06.30", - rnDt : "1987.06.30", - sitArea : 0, - trtDstrArea : 0, - swrTrtPopl : 0, - fctCpc : 860000 + extnsSeqno: "최초", + extnsNm: "최초", + bzStrtYrMnth: "1984.12.01", + bzEdYrMnth: "1987.06.01", + eqpPrmsDt: "1985.09.13", + cmplDt: "1987.06.30", + trlrnCmplDt: "1987.06.30", + rnDt: "1987.06.30", + sitArea: 0, + trtDstrArea: 0, + swrTrtPopl: 0, + fctCpc: 860000 } ]; // 시설 수질정보 (헤더) -const upHeadListFcltyWaterQltyInfo:TableUpperProps[] = [ +const upHeadListFcltyWaterQltyInfo: TableUpperProps[] = [ { id: "extnsSeqno", title: "차수" }, - { id: "plInflWqltBod", title: "BOD", upName:"upChangeRe1", upSequnce:1, align: 'right' }, - { id: "plInflWqltToc", title: "TOC", upName:"upChangeRe1", upSequnce:2, align: 'right' }, - { id: "plInflWqltCod", title: "COD", upName:"upChangeRe1", upSequnce:3, align: 'right' }, - { id: "plInflWqltSs", title: "SS", upName:"upChangeRe1", upSequnce:4, align: 'right' }, - { id: "plInflWqltTn", title: "T-N", upName:"upChangeRe1", upSequnce:5, align: 'right' }, - { id: "plInflWqltTp", title: "T-P", upName:"upChangeRe1", upSequnce:6, align: 'right' }, - { id: "dsInflWqltBod", title: "BOD", upName:"upChangeRe2", upSequnce:1, align: 'right' }, - { id: "dsInflWqltToc", title: "TOC", upName:"upChangeRe2", upSequnce:2, align: 'right' }, - { id: "dsInflWqltCod", title: "COD", upName:"upChangeRe2", upSequnce:3, align: 'right' }, - { id: "dsInflWqltSs", title: "SS", upName:"upChangeRe2", upSequnce:4, align: 'right' }, - { id: "dsInflWqltTn", title: "T-N", upName:"upChangeRe2", upSequnce:5, align: 'right' }, - { id: "dsInflWqltTp", title: "T-P", upName:"upChangeRe2", upSequnce:6, align: 'right' }, - { id: "plEfflWqltBod", title: "BOD", upName:"upChangeRe3", upSequnce:1, align: 'right' }, - { id: "plEfflWqltToc", title: "TOC", upName:"upChangeRe3", upSequnce:2, align: 'right' }, - { id: "plEfflWqltCod", title: "COD", upName:"upChangeRe3", upSequnce:3, align: 'right' }, - { id: "plEfflWqltSs", title: "SS", upName:"upChangeRe3", upSequnce:4, align: 'right' }, - { id: "plEfflWqltTn", title: "T-N", upName:"upChangeRe3", upSequnce:5, align: 'right' }, - { id: "plEfflWqltTp", title: "T-P", upName:"upChangeRe3", upSequnce:6, align: 'right' }, + { id: "plInflWqltBod", title: "BOD", upName: "upChangeRe1", upSequnce: 1, align: 'right' }, + { id: "plInflWqltToc", title: "TOC", upName: "upChangeRe1", upSequnce: 2, align: 'right' }, + { id: "plInflWqltCod", title: "COD", upName: "upChangeRe1", upSequnce: 3, align: 'right' }, + { id: "plInflWqltSs", title: "SS", upName: "upChangeRe1", upSequnce: 4, align: 'right' }, + { id: "plInflWqltTn", title: "T-N", upName: "upChangeRe1", upSequnce: 5, align: 'right' }, + { id: "plInflWqltTp", title: "T-P", upName: "upChangeRe1", upSequnce: 6, align: 'right' }, + { id: "dsInflWqltBod", title: "BOD", upName: "upChangeRe2", upSequnce: 1, align: 'right' }, + { id: "dsInflWqltToc", title: "TOC", upName: "upChangeRe2", upSequnce: 2, align: 'right' }, + { id: "dsInflWqltCod", title: "COD", upName: "upChangeRe2", upSequnce: 3, align: 'right' }, + { id: "dsInflWqltSs", title: "SS", upName: "upChangeRe2", upSequnce: 4, align: 'right' }, + { id: "dsInflWqltTn", title: "T-N", upName: "upChangeRe2", upSequnce: 5, align: 'right' }, + { id: "dsInflWqltTp", title: "T-P", upName: "upChangeRe2", upSequnce: 6, align: 'right' }, + { id: "plEfflWqltBod", title: "BOD", upName: "upChangeRe3", upSequnce: 1, align: 'right' }, + { id: "plEfflWqltToc", title: "TOC", upName: "upChangeRe3", upSequnce: 2, align: 'right' }, + { id: "plEfflWqltCod", title: "COD", upName: "upChangeRe3", upSequnce: 3, align: 'right' }, + { id: "plEfflWqltSs", title: "SS", upName: "upChangeRe3", upSequnce: 4, align: 'right' }, + { id: "plEfflWqltTn", title: "T-N", upName: "upChangeRe3", upSequnce: 5, align: 'right' }, + { id: "plEfflWqltTp", title: "T-P", upName: "upChangeRe3", upSequnce: 6, align: 'right' }, ]; // 시설 수질정보 (리스트) -const gridListFcltyWaterQltyInfo:fcltyWaterQltyInfoProps[] = [ +const gridListFcltyWaterQltyInfo: fcltyWaterQltyInfoProps[] = [ { extnsSeqno: "최초", plInflWqltBod: "111.0", @@ -411,11 +406,20 @@ const gridListFcltyWaterQltyInfo:fcltyWaterQltyInfoProps[] = [ * Store - api (데이터 호출) ====================================*/ -// 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) -export const fetchFacilityListInit = async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string ): Promise<{data:facilityListProps[], count:number}> => { +/** + * 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) + * @param pageNo : 페이지 번호 + * @param pageSize : 페이지 크기 + * @param partValue : 구분값(행정명, 대유역, 환경청) + * @param nameCd : 행정코드(시도명, 시군구명, 단위유역) + * @param fcltCpct : 시설용량 + * @param oprtngSttsCd : 운영 상태 코드 + * @param facilityName : 시설명 + */ +export const fetchFacilityListInit = async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string): Promise<{ data: facilityListProps[], count: number }> => { try { - const tailStr = partValue ? '/'+ (partValue==='G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; - const url = '/prcsFclt/info/'+pageNo+'/'+pageSize+tailStr; + const tailStr = partValue ? '/' + (partValue === 'G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; + const url = '/prcsFclt/info/' + pageNo + '/' + pageSize + tailStr; const res = await getFetch('fo', url); res.data.forEach((item: Record) => { item.daddr = item.addr ? item.addr : ''; @@ -427,42 +431,42 @@ export const fetchFacilityListInit = async (pageNo:number, pageSize:number, part return res; } catch (error) { console.error('시설정보 데이터를 가져오는데 실패했습니다:', error); - return {data: [], count: 0}; + return { data: [], count: 0 }; } }; -const fetchFacilityList = async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string ): Promise<{data:facilityListProps[], count:number}> => { +const fetchFacilityList = async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string): Promise<{ data: facilityListProps[], count: number }> => { try { - const tailStr = partValue ? '/'+ (partValue==='G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; - const url = '/prcsFclt/info/history/'+pageNo+'/'+pageSize+tailStr; + const tailStr = partValue ? '/' + (partValue === 'G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; + const url = '/prcsFclt/info/history/' + pageNo + '/' + pageSize + tailStr; //const res = await getFetch('fo', '/prcsFclt/info/'+pageNo+'/'+pageSize+tailUrl); const res = await getFetch('fo', url); return res; } catch (error) { console.error('시설정보 데이터를 가져오는데 실패했습니다:', error); - return {data: [], count: 0}; + return { data: [], count: 0 }; } }; // 시설정보 리스트 데이터 호출 (대시보드용) -const fetchFacilityListSearching = async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string ): Promise<{data:facilityListProps[], count:number}> => { +const fetchFacilityListSearching = async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string): Promise<{ data: facilityListProps[], count: number }> => { try { - const tailStr = partValue ? '/'+ (partValue==='G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; - const url = '/prcsFclt/searching/'+pageNo+'/'+pageSize+tailStr; + const tailStr = partValue ? '/' + (partValue === 'G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; + const url = '/prcsFclt/searching/' + pageNo + '/' + pageSize + tailStr; //const res = await getFetch('fo', '/prcsFclt/info/'+pageNo+'/'+pageSize+tailUrl); const res = await getFetch('fo', url); return res; } catch (error) { console.error('시설정보 데이터를 가져오는데 실패했습니다:', error); - return {data: [], count: 0}; + return { data: [], count: 0 }; } }; // 모달 // 시설정보 이력정보 데이터 호출 -const fetchFacilityHistInfo = async (facilityCd:string ): Promise => { +const fetchFacilityHistInfo = async (facilityCd: string): Promise => { try { - const res = await getFetch('fo', '/prcsFclt/hist/'+facilityCd); + const res = await getFetch('fo', '/prcsFclt/hist/' + facilityCd); const data = res.data; DataForm({ type: 'date', column: 'trlrnCmplDt', item: data as unknown as Record }); DataForm({ type: 'date', column: 'eqpPrmsDt', item: data as unknown as Record }); @@ -471,7 +475,7 @@ const fetchFacilityHistInfo = async (facilityCd:string ): Promise }); DataForm({ type: 'number', column: 'trtDstrArea', item: data as unknown as Record }); DataForm({ type: 'number', column: 'swrTrtPopl', item: data as unknown as Record }); - return data; + return data; } catch (error) { console.error('시설정보 이력정보 데이터를 가져오는데 실패했습니다:', error); return []; @@ -479,9 +483,9 @@ const fetchFacilityHistInfo = async (facilityCd:string ): Promise => { +export const fetchFacilityWaterQltyInfo = async (facilityCd: string): Promise => { try { - const res = await getFetch('fo', '/prcsFclt/info/history/'+facilityCd); + const res = await getFetch('fo', '/prcsFclt/info/history/' + facilityCd); const data = res.data; return data; } catch (error) { @@ -504,97 +508,97 @@ export type ProcessFacilityActions = { * @param oprtngSttsCd : 운영 상태 코드 * @param facilityName : 시설명 */ - searchProcessFacility : (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string) => void; + searchProcessFacility: (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string) => void; /** * 시설정보 이력정보 데이터 호출 * @param facilityCd : 시설코드 */ - searchProcessFacilityHist : (facilityCd:string) => void; + searchProcessFacilityHist: (facilityCd: string) => void; /** * 시설정보 수질정보 데이터 호출 * @param facilityCd : 시설코드 */ - searchProcessFacilityWaterQlty : (facilityCd:string) => void; + searchProcessFacilityWaterQlty: (facilityCd: string) => void; /** * 시설정보 리스트 데이터 호출 (대시보드용) * @param pageNo : 페이지 번호 * @param pageSize : 페이지 크기 */ - searchProcessFacilitySearching : (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string) => void; + searchProcessFacilitySearching: (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string) => void; } export type ProcessFacilityType = { ProcessFacility: { isInit: boolean; - processFacilityLabelArray:string[]; + processFacilityLabelArray: string[]; }, - ProcessFacilityList : { + ProcessFacilityList: { isInit: boolean; - upHeadList1:TableUpperProps[]; - upHeadList2:TableUpperProps[]; - upHeadList3:TableUpperProps[]; - processFacilityList:facilityListProps[]; - processFacilityCount:number; - excelList : ExcelType[]; + upHeadList1: TableUpperProps[]; + upHeadList2: TableUpperProps[]; + upHeadList3: TableUpperProps[]; + processFacilityList: facilityListProps[]; + processFacilityCount: number; + excelList: ExcelType[]; isLoading: boolean; }, - ProcessFacilityDetail : { - isInit : boolean; - upHeadListBasicInfo : TableUpperProps[]; - gridListBasicInfo : BasicInfoProps[]; - upHeadListPlanInfo : TableUpperProps[]; - gridListPlanInfo : PlanInfoProps[]; - upHeadListFcltyAreaInfo : TableUpperProps[]; - gridListFcltyAreaInfo : fcltyAreaInfoProps[]; - - upHeadListFcltyHistInfo : TableUpperProps[]; - gridListFcltyHistInfo : fcltyHistInfoProps[]; - upHeadListFcltyWaterQltyInfo : TableUpperProps[]; - gridListFcltyWaterQltyInfo : fcltyWaterQltyInfoProps[]; + ProcessFacilityDetail: { + isInit: boolean; + upHeadListBasicInfo: TableUpperProps[]; + gridListBasicInfo: BasicInfoProps[]; + upHeadListPlanInfo: TableUpperProps[]; + gridListPlanInfo: PlanInfoProps[]; + upHeadListFcltyAreaInfo: TableUpperProps[]; + gridListFcltyAreaInfo: fcltyAreaInfoProps[]; - upHeadListLegalWaterQlty : TableUpperProps[]; - gridListLegalWaterQlty : LegalWaterQltyProps[]; + upHeadListFcltyHistInfo: TableUpperProps[]; + gridListFcltyHistInfo: fcltyHistInfoProps[]; + upHeadListFcltyWaterQltyInfo: TableUpperProps[]; + gridListFcltyWaterQltyInfo: fcltyWaterQltyInfoProps[]; + + upHeadListLegalWaterQlty: TableUpperProps[]; + gridListLegalWaterQlty: LegalWaterQltyProps[]; }, } -export const processFacilityInitState:ProcessFacilityType = { +export const processFacilityInitState: ProcessFacilityType = { ProcessFacility: { isInit: false, processFacilityLabelArray: ProcessFacilityLabelArray, }, - ProcessFacilityList : { - isInit : false, - upHeadList1 : upHeadList1, - upHeadList2 : upHeadList2, - upHeadList3 : upHeadList3, - processFacilityList : processFacilityList, - processFacilityCount:1, - excelList : [], - isLoading : true, + ProcessFacilityList: { + isInit: false, + upHeadList1: upHeadList1, + upHeadList2: upHeadList2, + upHeadList3: upHeadList3, + processFacilityList: processFacilityList, + processFacilityCount: 1, + excelList: [], + isLoading: true, }, - ProcessFacilityDetail : { - isInit : false, - upHeadListBasicInfo : upHeadListBasicInfo, - gridListBasicInfo : gridListBasicInfo, - upHeadListPlanInfo : upHeadListPlanInfo, - gridListPlanInfo : gridListPlanInfo, - upHeadListFcltyAreaInfo : upHeadListFcltyAreaInfo, - gridListFcltyAreaInfo : gridListFcltyAreaInfo, + ProcessFacilityDetail: { + isInit: false, + upHeadListBasicInfo: upHeadListBasicInfo, + gridListBasicInfo: gridListBasicInfo, + upHeadListPlanInfo: upHeadListPlanInfo, + gridListPlanInfo: gridListPlanInfo, + upHeadListFcltyAreaInfo: upHeadListFcltyAreaInfo, + gridListFcltyAreaInfo: gridListFcltyAreaInfo, - upHeadListFcltyHistInfo : upHeadListFcltyHistInfo, - gridListFcltyHistInfo : gridListFcltyHistInfo, - upHeadListFcltyWaterQltyInfo : upHeadListFcltyWaterQltyInfo, - gridListFcltyWaterQltyInfo : gridListFcltyWaterQltyInfo, + upHeadListFcltyHistInfo: upHeadListFcltyHistInfo, + gridListFcltyHistInfo: gridListFcltyHistInfo, + upHeadListFcltyWaterQltyInfo: upHeadListFcltyWaterQltyInfo, + gridListFcltyWaterQltyInfo: gridListFcltyWaterQltyInfo, - upHeadListLegalWaterQlty : upHeadListLegalWaterQlty, - gridListLegalWaterQlty : gridListLegalWaterQlty, + upHeadListLegalWaterQlty: upHeadListLegalWaterQlty, + gridListLegalWaterQlty: gridListLegalWaterQlty, } } @@ -603,8 +607,8 @@ type SetStateFunction = (state: ProcessFacilityType | ((state: ProcessFacilityTy export type ProcessFacilityStore = ProcessFacilityType & ProcessFacilityActions; -export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActions=(set: SetStateFunction) => { - return{ +export const processFacilityReducer: (set: SetStateFunction) => ProcessFacilityActions = (set: SetStateFunction) => { + return { // 메인페이지 /** @@ -612,7 +616,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio * @param pageNo : 페이지 번호 * @param pageSize : 페이지 크기 */ - searchProcessFacility: async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string) => { + searchProcessFacility: async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string) => { set((state: ProcessFacilityType) => ({ ...state, ProcessFacilityList: { @@ -621,12 +625,12 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio }, })); const res = await fetchFacilityList(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName); - res.data.forEach((item:facilityListProps) => { - DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record}); - DataForm({ type: 'date', column: 'rnDt', item:item as unknown as Record}); - DataForm({ type: 'float0', column: 'fctCpc', item:item as unknown as Record}); + res.data.forEach((item: facilityListProps) => { + DataForm({ type: 'date', column: 'cmplDt', item: item as unknown as Record }); + DataForm({ type: 'date', column: 'rnDt', item: item as unknown as Record }); + DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record }); }) - + res.data.forEach(item => { item.plInflWqltBod = item.plInflWqltBod ? Number(item.plInflWqltBod).toFixed(1) : ''; item.dsInflWqltBod = item.dsInflWqltBod ? Number(item.dsInflWqltBod).toFixed(1) : ''; @@ -634,7 +638,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio const excelDownList: ExcelType[] = []; - if(pageSize>5000){ + if (pageSize > 5000) { res.data.forEach(item => { excelDownList.push({ 시설코드: item.bscFctCd, @@ -646,7 +650,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio 시군구: item.gugun, 시설이름: item.bscFctNm, 주소: item.daddr, - "시설용량(m³/일)": item.fctCpc ? Number(item.fctCpc.toString().replaceAll(',','')) : '', + "시설용량(m³/일)": item.fctCpc ? Number(item.fctCpc.toString().replaceAll(',', '')) : '', "계획유입수질(mg/L)": item.plInflWqltBod ? Number(item.plInflWqltBod) : '', "설계유입수질(mg/L)": item.dsInflWqltBod ? Number(item.dsInflWqltBod) : '', 공법: item.trtFrfNm, @@ -656,27 +660,27 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio }) }) } - set((state:ProcessFacilityType) => ({ - ...state, - ProcessFacilityList: pageSize<5000?{ - ...state.ProcessFacilityList, - processFacilityList: res.data, - processFacilityCount: res.count, - isLoading: false, - }:{ - ...state.ProcessFacilityList, - excelList: excelDownList, - isLoading: false, - }, + set((state: ProcessFacilityType) => ({ + ...state, + ProcessFacilityList: pageSize < 5000 ? { + ...state.ProcessFacilityList, + processFacilityList: res.data, + processFacilityCount: res.count, + isLoading: false, + } : { + ...state.ProcessFacilityList, + excelList: excelDownList, + isLoading: false, + }, })) }, - + /** * 시설정보 리스트 데이터 호출 * @param pageNo : 페이지 번호 * @param pageSize : 페이지 크기 */ - searchProcessFacilitySearching: async (pageNo:number, pageSize:number, partValue?:string, nameCd?:string, fcltCpct?:string, oprtngSttsCd?:string, facilityPartValue?:string, facilityName?:string) => { + searchProcessFacilitySearching: async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string) => { set((state: ProcessFacilityType) => ({ ...state, ProcessFacilityList: { @@ -694,24 +698,24 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio item.plInflWqltBod = item.plInflWqltBod ? Number(item.plInflWqltBod).toFixed(1) : ''; item.dsInflWqltBod = item.dsInflWqltBod ? Number(item.dsInflWqltBod).toFixed(1) : ''; }) */ - set((state:ProcessFacilityType) => ({ - ...state, - ProcessFacilityList: { - ...state.ProcessFacilityList, - processFacilityList: res.data, - processFacilityCount: res.count, - isLoading: false, - }, + set((state: ProcessFacilityType) => ({ + ...state, + ProcessFacilityList: { + ...state.ProcessFacilityList, + processFacilityList: res.data, + processFacilityCount: res.count, + isLoading: false, + }, })) }, - + // 모달 이력정보 /** * 시설정보 이력정보 데이터 호출 * @param facilityCd : 시설코드 */ - searchProcessFacilityHist: async (facilityCd:string) => { + searchProcessFacilityHist: async (facilityCd: string) => { const promiseSet = await Promise.all([fetchFacilityHistInfo(facilityCd)]); const [facilityHistInfo] = promiseSet; // extnsSeqno를 기준으로 오름차순 정렬 @@ -727,7 +731,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio }); sortedHistInfo.forEach(item => { - if(item.extnsSeqno == '0'){ + if (item.extnsSeqno == '0') { item.extnsSeqno = '최초'; item.extnsNm = '신설'; } @@ -735,10 +739,10 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio // yyyy-MM-dd로 변환 sortedHistInfo.forEach(item => { - item.eqpPrmsDt = item.eqpPrmsDt ? item.eqpPrmsDt.substring(0,4) + '-' + item.eqpPrmsDt.substring(4,6) + '-' + item.eqpPrmsDt.substring(6,8) : ''; - item.trlrnCmplDt = item.trlrnCmplDt ? item.trlrnCmplDt.substring(0,4) + '-' + item.trlrnCmplDt.substring(4,6) + '-' + item.trlrnCmplDt.substring(6,8) : ''; - item.cmplDt = item.cmplDt ? item.cmplDt.substring(0,4) + '-' + item.cmplDt.substring(4,6) + '-' + item.cmplDt.substring(6,8) : ''; - item.rnDt = item.rnDt ? item.rnDt.substring(0,4) + '-' + item.rnDt.substring(4,6) + '-' + item.rnDt.substring(6,8) : ''; + item.eqpPrmsDt = item.eqpPrmsDt ? item.eqpPrmsDt.substring(0, 4) + '-' + item.eqpPrmsDt.substring(4, 6) + '-' + item.eqpPrmsDt.substring(6, 8) : ''; + item.trlrnCmplDt = item.trlrnCmplDt ? item.trlrnCmplDt.substring(0, 4) + '-' + item.trlrnCmplDt.substring(4, 6) + '-' + item.trlrnCmplDt.substring(6, 8) : ''; + item.cmplDt = item.cmplDt ? item.cmplDt.substring(0, 4) + '-' + item.cmplDt.substring(4, 6) + '-' + item.cmplDt.substring(6, 8) : ''; + item.rnDt = item.rnDt ? item.rnDt.substring(0, 4) + '-' + item.rnDt.substring(4, 6) + '-' + item.rnDt.substring(6, 8) : ''; }); // 마지막 이력 데이터의 값을 gridListPlanInfo에 업데이트 @@ -779,7 +783,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio * 시설정보 수질정보 데이터 호출 * @param facilityCd : 시설코드 */ - searchProcessFacilityWaterQlty: async (facilityCd:string) => { + searchProcessFacilityWaterQlty: async (facilityCd: string) => { const promiseSet = await Promise.all([fetchFacilityWaterQltyInfo(facilityCd)]); const [facilityWaterQltyInfo] = promiseSet; // extnsSeqno를 기준으로 오름차순 정렬 @@ -795,7 +799,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio }); sortedWaterQltyInfo.forEach(item => { - if(item.extnsSeqno == '0'){ + if (item.extnsSeqno == '0') { item.extnsSeqno = '최초'; } }); @@ -814,7 +818,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio DataForm({ type: 'float1', column: 'dsInflWqltSs', item: item as unknown as Record }); DataForm({ type: 'float3', column: 'dsInflWqltTn', item: item as unknown as Record }); DataForm({ type: 'float3', column: 'dsInflWqltTp', item: item as unknown as Record }); - + DataForm({ type: 'float1', column: 'plEfflWqltBod', item: item as unknown as Record }); DataForm({ type: 'float1', column: 'plEfflWqltToc', item: item as unknown as Record }); DataForm({ type: 'float1', column: 'plEfflWqltCod', item: item as unknown as Record }); @@ -829,10 +833,10 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio gridListLegalWaterQlty.push({ bod: facilityWaterQltyInfo[0]?.bod ?? 0, cod: Number(facilityWaterQltyInfo[0]?.cod ?? 0), - ss: Number(facilityWaterQltyInfo[0]?.ss ?? 0), + ss: Number(facilityWaterQltyInfo[0]?.ss ?? 0), tn: Number(facilityWaterQltyInfo[0]?.tn ?? 0), tp: Number(facilityWaterQltyInfo[0]?.tp ?? 0), - totClfgrpcnt : Number(facilityWaterQltyInfo[0]?.totClfgrpcnt ?? 0), + totClfgrpcnt: Number(facilityWaterQltyInfo[0]?.totClfgrpcnt ?? 0), }); gridListLegalWaterQlty.forEach(item => { @@ -851,7 +855,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio ProcessFacilityDetail: { ...state.ProcessFacilityDetail, gridListFcltyWaterQltyInfo: sortedWaterQltyInfo, - gridListLegalWaterQlty: gridListLegalWaterQlty, + gridListLegalWaterQlty: gridListLegalWaterQlty, gridListPlanInfo: [{ ...state.ProcessFacilityDetail.gridListPlanInfo[0], dsInflWqltBod: lastWaterQltyInfo?.dsInflWqltBod === 'NULL' || lastWaterQltyInfo?.dsInflWqltBod === undefined ? '' : lastWaterQltyInfo.dsInflWqltBod, @@ -875,7 +879,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio ProcessFacilityDetail: { ...state.ProcessFacilityDetail, gridListFcltyWaterQltyInfo: sortedWaterQltyInfo, - gridListLegalWaterQlty: gridListLegalWaterQlty, + gridListLegalWaterQlty: gridListLegalWaterQlty, gridListPlanInfo: [{ ...state.ProcessFacilityDetail.gridListPlanInfo[0], dsInflWqltBod: '', diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index 69d2a4f50..e9857af71 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -5,58 +5,55 @@ import { OSU_PERCENT } from "../common"; import type { TableUpperProps } from "../dashboard"; import { fetchFacilityListInit } from "../processFacility"; export type { TableUpperProps }; -/**==================================== - * Store - 타입 - ====================================*/ /** - * (1) 메인페이지 + * 운영실태 >오수발생량 추정 */ // 시설별 강수현황 export type SewageOccurProps = { - bscFctCd : string, - sidoNm : string, - sggNm : string, - lclgvrnmntNm : string, - bscFctNm : string, - daddr : string, - fctCpc : number, - waterUsage : number, - swageChangePercent : number, - estimationSewage : number, - sewageInputYear : number, - sewageInputChungchun : number, - rgnNm : string, - rvbsn : string, - lgbsn : string, - mdmbsn : string, - msrDt : string, + bscFctCd: string, + sidoNm: string, + sggNm: string, + lclgvrnmntNm: string, + bscFctNm: string, + daddr: string, + fctCpc: number, + waterUsage: number, + swageChangePercent: number, + estimationSewage: number, + sewageInputYear: number, + sewageInputChungchun: number, + rgnNm: string, + rvbsn: string, + lgbsn: string, + mdmbsn: string, + msrDt: string, } -export type modalTableType = { msrDt: string,waterUsage: number,swageChangePercent: number,estimationSewage: number}; +export type modalTableType = { msrDt: string, waterUsage: number, swageChangePercent: number, estimationSewage: number }; export type SewageOccurDetailProps = { -cnt : number, - sum : number, - yr:string, - usage:number, // 일평균 유입량 - cntWtrUsg : number, // 물사용량 일자수 - sumWtrUsg : number, // 물사용량 합 - avgWtrUsg:number, // 일평균 물사용량 - monWtrUsg:number, // 월 물사용량 + cnt: number, + sum: number, + yr: string, + usage: number, // 일평균 유입량 + cntWtrUsg: number, // 물사용량 일자수 + sumWtrUsg: number, // 물사용량 합 + avgWtrUsg: number, // 일평균 물사용량 + monWtrUsg: number, // 월 물사용량 } export type WtrUsgYmProps = { - bscFctCd : string, // 처리구역시설코드 - levyYm : string, // 부과년월 - wtrUsg : number, // 월별 물사용량(m³/월) + bscFctCd: string, // 처리구역시설코드 + levyYm: string, // 부과년월 + wtrUsg: number, // 월별 물사용량(m³/월) } // 검색단 -const LabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별']; +const LabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별']; export interface ExcelType { 시설코드: string, - 권역:string|'', - 단위유역:string|'', - 중권역:string|'', - 환경청:string|'', + 권역: string | '', + 단위유역: string | '', + 중권역: string | '', + 환경청: string | '', 시도: string, 시군구: string, 시설명: string, @@ -70,64 +67,64 @@ export interface ExcelType { } // 리스트 헤더 -const upHeadList1:TableUpperProps[] = [ - { id: "A", title: "행정구역", row:0, colSpan:2 }, - { id: "sidoNm", title: "시도", row:1, widthPercent: 8 }, - { id: "sggNm", title: "시군구", row:1, widthPercent: 8 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, - { id: "daddr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "waterUsage", title: "물사용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "swageChangePercent", title: "오수전환율\n(%)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "estimationSewage", title: "오수발생량 추정\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "sewageInputYear", title: "연간 하수유입량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "sewageInputChungchun", title: "청천시 하수유입량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, +const upHeadList1: TableUpperProps[] = [ + { id: "A", title: "행정구역", row: 0, colSpan: 2 }, + { id: "sidoNm", title: "시도", row: 1, widthPercent: 8 }, + { id: "sggNm", title: "시군구", row: 1, widthPercent: 8 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "waterUsage", title: "물사용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "swageChangePercent", title: "오수전환율\n(%)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "estimationSewage", title: "오수발생량 추정\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "sewageInputYear", title: "연간 하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "sewageInputChungchun", title: "청천시 하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, ]; -const upHeadList2:TableUpperProps[] = [ - { id: "A", title: "유역", row:0, colSpan:3 }, - { id: "rvbsn", title: "권역", row:1, widthPercent: 6 }, - { id: "lgbsn", title: "단위유역", row:1, widthPercent: 6 }, - { id: "mdmbsn", title: "중권역", row:1, widthPercent: 6 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, - { id: "daddr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "waterUsage", title: "물사용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "swageChangePercent", title: "오수전환율", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "estimationSewage", title: "오수발생량 추정\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "sewageInputYear", title: "연간 하수유입량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, - { id: "sewageInputChungchun", title: "청천시 하수유입량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, +const upHeadList2: TableUpperProps[] = [ + { id: "A", title: "유역", row: 0, colSpan: 3 }, + { id: "rvbsn", title: "권역", row: 1, widthPercent: 6 }, + { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 6 }, + { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 6 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "waterUsage", title: "물사용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "swageChangePercent", title: "오수전환율", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "estimationSewage", title: "오수발생량 추정\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "sewageInputYear", title: "연간 하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "sewageInputChungchun", title: "청천시 하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 }, ]; -const upHeadList3:TableUpperProps[] = [ - { id: "A", title: "유역", row:0, colSpan:3 }, - { id: "rvbsn", title: "권역", row:1, widthPercent: 5 }, - { id: "lgbsn", title: "단위유역", row:1, widthPercent: 5 }, - { id: "mdmbsn", title: "중권역", row:1, widthPercent: 5 }, - { id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 8 }, - { id: "B", title: "행정구역", row:0, colSpan:2 }, - { id: "sidoNm", title: "시도", row:1, widthPercent: 6 }, - { id: "sggNm", title: "시군구", row:1, widthPercent: 6 }, - { id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, - { id: "daddr", title: "주소", row:0, rowSpan:2 }, - { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 6 }, - { id: "waterUsage", title: "물사용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 6 }, - { id: "swageChangePercent", title: "오수전환율", align:"right", row:0, rowSpan:2, widthPercent: 6 }, - { id: "estimationSewage", title: "오수발생량 추정\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 6 }, - { id: "sewageInputYear", title: "연간 하수유입량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 6 }, - { id: "sewageInputChungchun", title: "청천시 하수유입량\n(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 6 }, +const upHeadList3: TableUpperProps[] = [ + { id: "A", title: "유역", row: 0, colSpan: 3 }, + { id: "rvbsn", title: "권역", row: 1, widthPercent: 5 }, + { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 5 }, + { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 5 }, + { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "B", title: "행정구역", row: 0, colSpan: 2 }, + { id: "sidoNm", title: "시도", row: 1, widthPercent: 6 }, + { id: "sggNm", title: "시군구", row: 1, widthPercent: 6 }, + { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 }, + { id: "daddr", title: "주소", row: 0, rowSpan: 2 }, + { id: "fctCpc", title: "시설용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 6 }, + { id: "waterUsage", title: "물사용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 6 }, + { id: "swageChangePercent", title: "오수전환율", align: "right", row: 0, rowSpan: 2, widthPercent: 6 }, + { id: "estimationSewage", title: "오수발생량 추정\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 6 }, + { id: "sewageInputYear", title: "연간 하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 6 }, + { id: "sewageInputChungchun", title: "청천시 하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 6 }, ]; -const upHeadListSewageOccurDetail:TableUpperProps[] = [ +const upHeadListSewageOccurDetail: TableUpperProps[] = [ { id: "msrDt", title: "년월" }, - { id: "waterUsage", title: "물사용량(m³/일)", align:"right" }, - { id: "swageChangePercent", title: "오수전환율(%)", align:"right" }, - { id: "estimationSewage", title: "오수발생량 추정(m³/일)", row:0, rowSpan:2, align:"right" }, + { id: "waterUsage", title: "물사용량(m³/일)", align: "right" }, + { id: "swageChangePercent", title: "오수전환율(%)", align: "right" }, + { id: "estimationSewage", title: "오수발생량 추정(m³/일)", row: 0, rowSpan: 2, align: "right" }, ]; -const sewageOccurList:SewageOccurProps[] = [] +const sewageOccurList: SewageOccurProps[] = [] -const tempSewageOccurList:modalTableType[] = [] +const tempSewageOccurList: modalTableType[] = [] /** * yyyymm 형태의 문자열을 받아 해당 월의 일수를 반환 @@ -135,20 +132,20 @@ const tempSewageOccurList:modalTableType[] = [] * @returns {number} 해당 월의 일수 (예: 28, 29, 30, 31) */ function getDaysInMonth(yyyymm) { - if (typeof yyyymm !== 'string' || yyyymm.length !== 6) { - throw new Error("입력은 'yyyymm' 형식의 문자열이어야 합니다. 예: '202502'"); - } + if (typeof yyyymm !== 'string' || yyyymm.length !== 6) { + throw new Error("입력은 'yyyymm' 형식의 문자열이어야 합니다. 예: '202502'"); + } - const year = parseInt(yyyymm.slice(0, 4), 10); // "2025" -> 2025 - const month = parseInt(yyyymm.slice(4, 6), 10); // "02" -> 2 + const year = parseInt(yyyymm.slice(0, 4), 10); // "2025" -> 2025 + const month = parseInt(yyyymm.slice(4, 6), 10); // "02" -> 2 - if (isNaN(year) || isNaN(month) || month < 1 || month > 12) { - throw new Error("유효한 년/월이 아닙니다."); - } + if (isNaN(year) || isNaN(month) || month < 1 || month > 12) { + throw new Error("유효한 년/월이 아닙니다."); + } - // Date(year, month, 0) -> 전달의 마지막 날 - // month에 '다음달'을 넣고, 일(day)에 0을 주면 해당 월의 마지막 날짜가 됨 - return new Date(year, month, 0).getDate(); + // Date(year, month, 0) -> 전달의 마지막 날 + // month에 '다음달'을 넣고, 일(day)에 0을 주면 해당 월의 마지막 날짜가 됨 + return new Date(year, month, 0).getDate(); } /**==================================== * Store - API @@ -174,9 +171,9 @@ function getDaysInMonth(yyyymm) { // } // 시설들 유량 정보 조회 -export const fetchSweageOccurListFlow = async (searchYear: string|undefined, fcltCdList: string[]): Promise => { +export const fetchSweageOccurListFlow = async (searchYear: string | undefined, fcltCdList: string[]): Promise => { try { - const res = await postFetch('fo', '/fclt/flow/'+searchYear, fcltCdList); + const res = await postFetch('fo', '/fclt/flow/' + searchYear, fcltCdList); return res; } catch (error) { console.error('시설정보 오수발생량 상세 데이터를 가져오는데 실패했습니다:', error); @@ -184,9 +181,9 @@ export const fetchSweageOccurListFlow = async (searchYear: string|undefined, fcl } }; // 시설별 물사용량 정보 조회 -export const fetchWtrUsgYmList = async (searchYear: string|undefined, fcltCdList: string[]): Promise => { +export const fetchWtrUsgYmList = async (searchYear: string | undefined, fcltCdList: string[]): Promise => { try { - const res = await postFetch('fo', '/fclt/flow/wtrUsgYm/'+searchYear, fcltCdList); + const res = await postFetch('fo', '/fclt/flow/wtrUsgYm/' + searchYear, fcltCdList); return res; } catch (error) { console.error('시설들 월별 물사용량 데이터를 가져오는데 실패했습니다:', error); @@ -205,10 +202,10 @@ export type SewageOccurActions = { export type SewageOccurType = { SewageOccurSearch: { isInit: boolean; - labelArray:string[]; + labelArray: string[]; }, - SewageOccur : { + SewageOccur: { isInit: boolean; upHeadList1: TableUpperProps[]; upHeadList2: TableUpperProps[]; @@ -219,7 +216,7 @@ export type SewageOccurType = { isLoading: boolean; }, - SewageOccurDetail : { + SewageOccurDetail: { isInit: boolean; upHeadListSewageOccurDetail: TableUpperProps[]; gridListSewageOccurDetail: modalTableType[]; @@ -232,18 +229,18 @@ export const sewageOccurInitState: SewageOccurType = { labelArray: LabelArray, }, - SewageOccur : { - isInit : false, - upHeadList1 : upHeadList1, - upHeadList2 : upHeadList2, - upHeadList3 : upHeadList3, - sewageOccurList : sewageOccurList, - sewageOccurCount : 2, - excelList : [], - isLoading : true, + SewageOccur: { + isInit: false, + upHeadList1: upHeadList1, + upHeadList2: upHeadList2, + upHeadList3: upHeadList3, + sewageOccurList: sewageOccurList, + sewageOccurCount: 2, + excelList: [], + isLoading: true, }, - SewageOccurDetail : { + SewageOccurDetail: { isInit: false, upHeadListSewageOccurDetail: upHeadListSewageOccurDetail, gridListSewageOccurDetail: tempSewageOccurList, @@ -277,69 +274,69 @@ export type FlowResponse = { count: number; } -export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { +export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) => { return { searchSewageOccurList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const facilityInitData = await fetchFacilityListInit(pageNo, pageSize, part, nameCd, fcltCpct, operationValue, fcltyNm); - if(pageSize < 5000){ + if (pageSize < 5000) { set((state: SewageOccurType) => ({ ...state, SewageOccur: { ...state.SewageOccur, - sewageOccurList : [], - sewageOccurCount : facilityInitData.count, - excelList : [], + sewageOccurList: [], + sewageOccurCount: facilityInitData.count, + excelList: [], isLoading: true }, })); - }else{ + } else { set((state: SewageOccurType) => ({ ...state, SewageOccur: { ...state.SewageOccur, - excelList : [], + excelList: [], isLoading: true }, })); } - + const fcltylist = facilityInitData.data; // 시설목록 - const fcltCdList : string[] = []; // 시설코드목록 - const sewageOccurPropsList : SewageOccurProps[] = []; // 오수발생량시설목록 + const fcltCdList: string[] = []; // 시설코드목록 + const sewageOccurPropsList: SewageOccurProps[] = []; // 오수발생량시설목록 fcltylist.forEach(item => { fcltCdList.push(item.bscFctCd); sewageOccurPropsList.push({ - bscFctCd : item.bscFctCd, - sidoNm : item.sido, - sggNm : item.gugun, - lclgvrnmntNm : '', - bscFctNm : item.bscFctNm, - daddr : item.daddr, - fctCpc : parseFloat(item.fctCpc.toString().replace(/,/g, '')), - waterUsage : 0, - swageChangePercent : 0, - estimationSewage : 0, - sewageInputYear : 0, - sewageInputChungchun : 0, - rgnNm : item.rgnNm, - rvbsn : item.rvbsn, - lgbsn : item.lgbsn, - mdmbsn : item.mdmbsn, - msrDt : '', + bscFctCd: item.bscFctCd, + sidoNm: item.sido, + sggNm: item.gugun, + lclgvrnmntNm: '', + bscFctNm: item.bscFctNm, + daddr: item.daddr, + fctCpc: parseFloat(item.fctCpc.toString().replace(/,/g, '')), + waterUsage: 0, + swageChangePercent: 0, + estimationSewage: 0, + sewageInputYear: 0, + sewageInputChungchun: 0, + rgnNm: item.rgnNm, + rvbsn: item.rvbsn, + lgbsn: item.lgbsn, + mdmbsn: item.mdmbsn, + msrDt: '', }); }); - - const soccurDetailRes : any = await fetchSweageOccurListFlow(searchYear, fcltCdList); - const wtrUsgYmRes : any = await fetchWtrUsgYmList(searchYear, fcltCdList); + + const soccurDetailRes: any = await fetchSweageOccurListFlow(searchYear, fcltCdList); + const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList); // const wtrUsgMap : Record = {}; // wtrUsgRes.data.forEach(fclt => { // wtrUsgMap[fclt.bscFctCd] = fclt.wtrUsg; // }); for (const item of sewageOccurPropsList) { - + const detailList = soccurDetailRes?.data[item.bscFctCd]; const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd]; - + item.swageChangePercent = 90; let sumChungcunDay = 0; // 청천일수 let chungcunSumFlow = 0;// 청천시 하수유입량 @@ -348,18 +345,18 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { detailList?.forEach(item2 => { if (item2.infoRnDay == null || item2.infoRnDay == 'x') item2.infoRnDay = 0; - if(item2.infoRnDay >= 3) { + if (item2.infoRnDay >= 3) { rainEffectDay = 2; - }else{ + } else { rainEffectDay--; } - if(rainEffectDay<0){ //청천시 + if (rainEffectDay < 0) { //청천시 chungcunSumFlow += item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;//Number(item2.inflAmnt); sumChungcunDay += 1; } totWaterUsage += Number(item2.inflAmnt); }); - + let wtrUsgYearTotal = 0; // 연간 물사용량 let wtrUsgYearDays = 0; // 연간 물사용 일수 wtrUsgYmList?.forEach(item3 => { @@ -372,13 +369,13 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { const count = detailList ? detailList.length : 0; const avg = count == 0 ? 0 : totWaterUsage / count; // 일평균 유입량 item.waterUsage = parseFloat((avg * 0.65).toFixed(2)); // 물사용량 = 일평균 유입량 * 65% - if(wtrUsgYearTotal > 0 && wtrUsgYearDays > 0) { - item.waterUsage = wtrUsgYearDays>0? wtrUsgYearTotal / wtrUsgYearDays: 0; // 일평균 물사용량 - } + if (wtrUsgYearTotal > 0 && wtrUsgYearDays > 0) { + item.waterUsage = wtrUsgYearDays > 0 ? wtrUsgYearTotal / wtrUsgYearDays : 0; // 일평균 물사용량 + } item.sewageInputYear = parseFloat(avg.toFixed(2)); // 연간 하수유입량(m³/일) - item.sewageInputChungchun = parseFloat((chungcunSumFlow===0?0:(chungcunSumFlow / sumChungcunDay)).toFixed(2)); // 청천시 하수유입량 + item.sewageInputChungchun = parseFloat((chungcunSumFlow === 0 ? 0 : (chungcunSumFlow / sumChungcunDay)).toFixed(2)); // 청천시 하수유입량 item.estimationSewage = parseFloat((item.waterUsage * OSU_PERCENT).toFixed(2)); // 오수발생량 추정(m³/일) - if ( item.bscFctCd === '11200PB001R' ) { + if (item.bscFctCd === '11200PB001R') { console.log('chungcunSumFlow:', chungcunSumFlow); console.log('sumChungcunDay:', sumChungcunDay); } @@ -388,7 +385,7 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { ); } - if(pageSize >= 5000){ + if (pageSize >= 5000) { const excelDownList: ExcelType[] = []; sewageOccurPropsList.forEach((item: SewageOccurProps) => { excelDownList.push({ @@ -414,16 +411,16 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { SewageOccur: { ...state.SewageOccur, excelList: excelDownList, - isLoading : false, + isLoading: false, }, })); - }else{ + } else { set((state: SewageOccurType) => ({ ...state, SewageOccur: { ...state.SewageOccur, - sewageOccurList : sewageOccurPropsList, - sewageOccurCount : facilityInitData.count, + sewageOccurList: sewageOccurPropsList, + sewageOccurCount: facilityInitData.count, isLoading: false, excelList: [], }, @@ -516,12 +513,12 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string, startYm?: string, endYm?: string) => { const fcltCdList = [bscFctCd]; - const wtrUsgRes : any = await fetchWtrUsgYmList(searchYear, fcltCdList); + const wtrUsgRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList); const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear); const monthData: SewageOccurDetailProps[] = []; - let tot = 0, cnt= 0; + let tot = 0, cnt = 0; - if(startYm) { + if (startYm) { res.data = res.data.filter((item: FlowDataItem) => { const month = item.msrDt?.substring(0, 6); return month >= startYm; @@ -533,7 +530,7 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { }); } } - if(endYm) { + if (endYm) { res.data = res.data.filter((item: FlowDataItem) => { const month = item.msrDt?.substring(0, 6); return month <= endYm; @@ -555,8 +552,10 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { monthData[monthIdx].sum += Number(item.inflAmnt); monthData[monthIdx].cnt++; } else { - monthData[monthIdx] = {cnt:1, sum:Number(item.inflAmnt), yr:item.msrDt.substring(0,4) - , usage:0, cntWtrUsg:0, sumWtrUsg:0, avgWtrUsg:0, monWtrUsg:0}; + monthData[monthIdx] = { + cnt: 1, sum: Number(item.inflAmnt), yr: item.msrDt.substring(0, 4) + , usage: 0, cntWtrUsg: 0, sumWtrUsg: 0, avgWtrUsg: 0, monWtrUsg: 0 + }; } } tot += Number(item.inflAmnt) @@ -574,29 +573,29 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { if (typeof monthData[monthIdx] === 'object') { monthData[monthIdx].sumWtrUsg += Number(item.wtrUsg); monthData[monthIdx].cntWtrUsg += getDaysInMonth(item.levyYm); - } + } } totWtrUsg += Number(item.wtrUsg); cntWtrUsg += getDaysInMonth(item.levyYm); }); } - - const tableData:modalTableType[] = [] + + const tableData: modalTableType[] = [] let maxWaterUsage = 0; let minWaterUsage = 9999999999; let avgWaterUsage = 0; monthData.forEach((item, index) => { - item.avgWtrUsg = item.sum/item.cnt *0.65; // 일평균 물사용량 = 일평균유입수 * 0.65 + item.avgWtrUsg = item.sum / item.cnt * 0.65; // 일평균 물사용량 = 일평균유입수 * 0.65 if (item.sumWtrUsg > 0 && item.cntWtrUsg > 0) item.avgWtrUsg = item.sumWtrUsg / item.cntWtrUsg; tableData.push({ - msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)), - waterUsage: Math.round(item.avgWtrUsg*1) /1, - swageChangePercent: OSU_PERCENT*100,//(Math.round((item.usage/item.usage*OSU_PERCENT) * 100) / 100) * 100, - estimationSewage: Math.round(item.avgWtrUsg*OSU_PERCENT * 1) / 1 + msrDt: item.yr + '-' + (index + 1 >= 10 ? String(index + 1) : '0' + (index + 1)), + waterUsage: Math.round(item.avgWtrUsg * 1) / 1, + swageChangePercent: OSU_PERCENT * 100,//(Math.round((item.usage/item.usage*OSU_PERCENT) * 100) / 100) * 100, + estimationSewage: Math.round(item.avgWtrUsg * OSU_PERCENT * 1) / 1 }) if (item.avgWtrUsg > maxWaterUsage) { - maxWaterUsage = item.avgWtrUsg; + maxWaterUsage = item.avgWtrUsg; } if (item.avgWtrUsg < minWaterUsage) { @@ -604,29 +603,29 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { } }); - avgWaterUsage = tot/cnt*0.65 + avgWaterUsage = tot / cnt * 0.65 if (totWtrUsg > 0 && cntWtrUsg > 0) avgWaterUsage = totWtrUsg / cntWtrUsg; - const newData= [ - { - msrDt: '평균', - waterUsage: roundNumber(Math.round(avgWaterUsage*1) /1,0), - swageChangePercent: OSU_PERCENT*100, - estimationSewage: roundNumber(Math.round(avgWaterUsage*OSU_PERCENT*1) /1,0), - }, - { - msrDt: '최대', - waterUsage: roundNumber(Math.round(maxWaterUsage*100) /100,0), - swageChangePercent: OSU_PERCENT*100, - estimationSewage: roundNumber(Math.round(maxWaterUsage*OSU_PERCENT*1) /1, 0), - }, - { - msrDt: '최소', - waterUsage: roundNumber(Math.round(minWaterUsage*100) /100,0), - swageChangePercent: OSU_PERCENT*100, - estimationSewage: roundNumber(Math.round(minWaterUsage*OSU_PERCENT*1) /1,0), - }, - ...tableData + const newData = [ + { + msrDt: '평균', + waterUsage: roundNumber(Math.round(avgWaterUsage * 1) / 1, 0), + swageChangePercent: OSU_PERCENT * 100, + estimationSewage: roundNumber(Math.round(avgWaterUsage * OSU_PERCENT * 1) / 1, 0), + }, + { + msrDt: '최대', + waterUsage: roundNumber(Math.round(maxWaterUsage * 100) / 100, 0), + swageChangePercent: OSU_PERCENT * 100, + estimationSewage: roundNumber(Math.round(maxWaterUsage * OSU_PERCENT * 1) / 1, 0), + }, + { + msrDt: '최소', + waterUsage: roundNumber(Math.round(minWaterUsage * 100) / 100, 0), + swageChangePercent: OSU_PERCENT * 100, + estimationSewage: roundNumber(Math.round(minWaterUsage * OSU_PERCENT * 1) / 1, 0), + }, + ...tableData ] set((state: SewageOccurType) => ({