From cd08b5dad816a0dcaade4877f6b2092cad16ecd7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 24 Jul 2025 21:58:50 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=EC=B9=98=20=EC=A7=84=ED=96=89?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/pages/dashboard/facilityInfo/page.tsx | 14 +-- apps/fo/app/pages/dashboard/page.tsx | 2 +- .../app/pages/facilityPrecipitation/page.tsx | 3 +- .../pages/facilityWaterQlty/modal/page.tsx | 30 +++-- apps/fo/app/pages/facilityWaterQlty/page.tsx | 2 +- apps/fo/app/pages/flowRate/modal/page.tsx | 114 +++++++++--------- apps/fo/app/pages/flowRate/page.tsx | 5 +- apps/fo/app/pages/planSewage/page.tsx | 8 +- apps/fo/app/pages/sewageOccur/modal/page.tsx | 9 +- apps/fo/app/pages/sewageOccur/page.tsx | 14 ++- apps/fo/app/pages/underWaterInput/page.tsx | 3 +- apps/fo/app/store/common/index.tsx | 11 -- apps/fo/app/store/dashboard/index.tsx | 1 + apps/fo/app/store/facilityWaterQlty/index.tsx | 28 ++--- apps/fo/app/store/sewageOccur/index.tsx | 92 +++++++------- apps/fo/app/store/store.tsx | 26 ++-- 16 files changed, 192 insertions(+), 170 deletions(-) diff --git a/apps/fo/app/pages/dashboard/facilityInfo/page.tsx b/apps/fo/app/pages/dashboard/facilityInfo/page.tsx index 7a88755ce..ddda9c9c0 100644 --- a/apps/fo/app/pages/dashboard/facilityInfo/page.tsx +++ b/apps/fo/app/pages/dashboard/facilityInfo/page.tsx @@ -30,20 +30,20 @@ const headMakeColSpanPlanFclty = (upHeadList: TableUpperProps[], planYearList: s const headMakeColSpanOperationStatus = (upHeadList: TableUpperProps[], searchYear: string) => { return ( <> - {searchYear+'년도 운영실태'} + {searchYear+'년도 운영실태'} { upHeadList.map((head: TableUpperProps) => (head.upName === 'upChangeRe1'&&head.upSequnce===1?{head.title}: - !head.upSequnce?{head.title}: + !head.upSequnce?{head.title}: head.upName === 'upChangeRe2'&&head.upSequnce===1?{'연간 운영실태'}: head.upName === 'upChangeRe3'&&head.upSequnce===1?{'하절기 운영실태\n(6~8월)'}: head.upName === 'upChangeRe4'&&head.upSequnce===1?{'동절기 운영실태\n(1~2월)'}: - head.upName === 'upChangeRe5'&&head.upSequnce===1?{'지하수유입량'}:null))} + head.upName === 'upChangeRe5'&&head.upSequnce===1?{'지하수 유입량 추정'}:null))} {upHeadList.map((head: TableUpperProps) => - (head.upName === 'upChangeRe2'||head.upName === 'upChangeRe3'||head.upName === 'upChangeRe4'||head.upName === 'upChangeRe5' ?{head.title}:null))} + (head.upName === 'upChangeRe2'||head.upName === 'upChangeRe3'||head.upName === 'upChangeRe4'||head.upName === 'upChangeRe5'?{head.title}:null))} ) } @@ -238,10 +238,10 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}: (head.id === 'flowRate' && index === 11)?{el[head.id]}: (head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?{el[head.id]}: (head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 7)?{el[head.id]}: - (head.id === 'rdi'&&index === 0)?{el[head.id]}: - (head.id === 'rdi'&&index === 2)?{'RDII추정시\n일강수량(mm)'}: - (head.id === 'rdi'&&index === 5)?{el['rdiRain']}: + (head.id === 'rdi'&&index === 0)?{el[head.id]}: (head.id === 'rdi'&&index === 7)?: + (head.id === 'rdiRain'&&index === 0)?{el['rdiRain']}: + (head.id === 'rdiRain'&&index === 7)?: (head.id === 'waterQlty')?{el[head.id]}: ((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=0 && index<=4))?{fncLoadModal('flowRate', 'year', el['waterQlty'] as string);}}>{el[head.id]}: ((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=5 && index<=10))?{fncLoadModal('waterQlty', 'year', el['waterQlty'] as string);}}>{el[head.id]}: diff --git a/apps/fo/app/pages/dashboard/page.tsx b/apps/fo/app/pages/dashboard/page.tsx index 97b45fd06..3b6f18351 100644 --- a/apps/fo/app/pages/dashboard/page.tsx +++ b/apps/fo/app/pages/dashboard/page.tsx @@ -14,7 +14,7 @@ const tabList = [ { value: 'facilityInfo', label: '시설정보 및 운영현황' }, { value: 'mainGraph', label: '주요그래프' }, { value: 'rainManage', label: '강우일 운영현황' }, - { value: 'drainageEquipment', label: '배수설비 정비현황' } + //{ value: 'drainageEquipment', label: '배수설비 정비현황' } ]; export default function DashBoard() { diff --git a/apps/fo/app/pages/facilityPrecipitation/page.tsx b/apps/fo/app/pages/facilityPrecipitation/page.tsx index c9403fd14..5b9cde969 100644 --- a/apps/fo/app/pages/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/facilityPrecipitation/page.tsx @@ -81,7 +81,8 @@ export default function FacilityPrecipitation() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + //const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState("2023"); /** * 페이지 함수 diff --git a/apps/fo/app/pages/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/facilityWaterQlty/modal/page.tsx index feec1bf22..0cfb42998 100644 --- a/apps/fo/app/pages/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/facilityWaterQlty/modal/page.tsx @@ -63,7 +63,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let maxEfflWqltBod = 0; let maxEfflWqltTn = 0; let maxEfflWqltTp = 0; - let maxefflWqltCod = 0; + let maxefflWqltToc = 0; let maxEfflWqltSs = 0; let maxInflAssctAftWqltBod = 0; @@ -80,7 +80,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0; let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0; let minEfflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTp) : 0; - let minefflWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltCod) : 0; + let minefflWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltToc) : 0; let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0; let minInflAssctAftWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltBod) : 0; @@ -97,7 +97,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let avgEfflWqltBod = 0; let avgEfflWqltTn = 0; let avgEfflWqltTp = 0; - let avgefflWqltCod = 0; + let avgefflWqltToc = 0; let avgEfflWqltSs = 0; let avgInflAssctAftWqltBod = 0; @@ -115,7 +115,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe const efflWqltBod = parseNumber(item.efflWqltBod); const efflWqltTn = parseNumber(item.efflWqltTn); const efflWqltTp = parseNumber(item.efflWqltTp); - const efflWqltCod = parseNumber(item.efflWqltCod); + const efflWqltToc = parseNumber(item.efflWqltToc); const efflWqltSs = parseNumber(item.efflWqltSs); const inflAssctAftWqltBod = parseNumber(item.inflAssctAftWqltBod); @@ -133,7 +133,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe maxEfflWqltBod = Math.max(maxEfflWqltBod, efflWqltBod); maxEfflWqltTn = Math.max(maxEfflWqltTn, efflWqltTn); maxEfflWqltTp = Math.max(maxEfflWqltTp, efflWqltTp); - maxefflWqltCod = Math.max(maxefflWqltCod, efflWqltCod); + maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc); maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs); maxInflAssctAftWqltBod = Math.max(maxInflAssctAftWqltBod, inflAssctAftWqltBod); @@ -150,7 +150,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe minEfflWqltBod = Math.min(minEfflWqltBod, efflWqltBod); minEfflWqltTn = Math.min(minEfflWqltTn, efflWqltTn); minEfflWqltTp = Math.min(minEfflWqltTp, efflWqltTp); - minefflWqltCod = Math.min(minefflWqltCod, efflWqltCod); + minefflWqltToc = Math.min(minefflWqltToc, efflWqltToc); minEfflWqltSs = Math.min(minEfflWqltSs, efflWqltSs); minInflAssctAftWqltBod = Math.min(minInflAssctAftWqltBod, inflAssctAftWqltBod); @@ -167,7 +167,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe avgEfflWqltBod += efflWqltBod; avgEfflWqltTn += efflWqltTn; avgEfflWqltTp += efflWqltTp; - avgefflWqltCod += efflWqltCod; + avgefflWqltToc += efflWqltToc; avgEfflWqltSs += efflWqltSs; avgInflAssctAftWqltBod += inflAssctAftWqltBod; @@ -186,7 +186,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe { msrDt: '평균', efflWqltBod: filteredData.length==0?'0.0':(Math.round(avgEfflWqltBod / filteredData.length * 10) / 10).toFixed(1), - efflWqltCod: filteredData.length==0?'0.0':(Math.round(avgefflWqltCod / filteredData.length * 10) / 10).toFixed(1), + efflWqltToc: filteredData.length==0?'0.0':(Math.round(avgefflWqltToc / filteredData.length * 10) / 10).toFixed(1), efflWqltSs: filteredData.length==0?'0.0':(Math.round(avgEfflWqltSs / filteredData.length * 10) / 10).toFixed(1), efflWqltTn: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTn / filteredData.length * 1000) / 1000).toFixed(3), efflWqltTp: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTp / filteredData.length * 1000) / 1000).toFixed(3), @@ -209,7 +209,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe { msrDt : '최대', efflWqltBod : Math.round(maxEfflWqltBod * 10) / 10?(Math.round(maxEfflWqltBod * 10) / 10).toFixed(1):'0.0', - efflWqltCod : Math.round(maxefflWqltCod * 10) / 10?(Math.round(maxefflWqltCod * 10) / 10).toFixed(1):'0.0', + efflWqltToc : Math.round(maxefflWqltToc * 10) / 10?(Math.round(maxefflWqltToc * 10) / 10).toFixed(1):'0.0', efflWqltSs : Math.round(maxEfflWqltSs * 10) / 10?(Math.round(maxEfflWqltSs * 10) / 10).toFixed(1):'0.0', efflWqltTn : Math.round(maxEfflWqltTn * 1000) / 1000?(Math.round(maxEfflWqltTn * 1000) / 1000).toFixed(3):'0.000', efflWqltTp : Math.round(maxEfflWqltTp * 1000) / 1000?(Math.round(maxEfflWqltTp * 1000) / 1000).toFixed(3):'0.000', @@ -232,7 +232,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe { msrDt : '최소', efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?(Math.round(minEfflWqltBod?minEfflWqltBod:0 * 10) / 10).toFixed(1) : '0.0', - efflWqltCod : Math.round(minefflWqltCod * 10) / 10?(Math.round(minefflWqltCod?minefflWqltCod:0 * 10) / 10).toFixed(1) : '0.0', + efflWqltToc : Math.round(minefflWqltToc * 10) / 10?(Math.round(minefflWqltToc?minefflWqltToc:0 * 10) / 10).toFixed(1) : '0.0', efflWqltSs : Math.round(minEfflWqltSs * 10) / 10?(Math.round(minEfflWqltSs * 10) / 10).toFixed(1) : '0.0', efflWqltTn : Math.round(minEfflWqltTn * 1000) / 1000?(Math.round(minEfflWqltTn * 1000) / 1000).toFixed(3) : '0.000', efflWqltTp : Math.round(minEfflWqltTp * 1000) / 1000?(Math.round(minEfflWqltTp * 1000) / 1000).toFixed(3) : '0.000', @@ -299,7 +299,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe "유입TN(mg/L)": item.inflAssctAftWqltTn, "유입TP(mg/L)": item.inflAssctBfrWqltTp, "유출BOD(mg/L)": item.efflWqltBod, - "유출TOC(COD)(mg/L)": item.efflWqltCod, + "유출TOC(COD)(mg/L)": item.efflWqltToc, "유출SS(mg/L)": item.efflWqltSs, "유출TN(mg/L)": item.efflWqltTn, "유출TP(mg/L)": item.efflWqltTp, @@ -351,7 +351,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe

수질 TMS

-

({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})

+ {/*

({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})

*/}
+
+ ☞ 청천시 : 강우량이 3mm미만의 날 +
@@ -476,6 +479,9 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe +
+ ☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날 +
diff --git a/apps/fo/app/pages/facilityWaterQlty/page.tsx b/apps/fo/app/pages/facilityWaterQlty/page.tsx index 2c728f679..6a9ad4f69 100644 --- a/apps/fo/app/pages/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/facilityWaterQlty/page.tsx @@ -196,7 +196,7 @@ export default function ProcessFacilitySearch() { {selectedRow !== null && ( } - bodyClass="sm:max-w-[90vw] w-[1200px] h-[920px]" + bodyClass="sm:max-w-[90vw] w-[1300px] h-[920px]" open={selectedRow !== null} onOpenChange={(open) => !open && closeModal()} noHeaderYn="Y" diff --git a/apps/fo/app/pages/flowRate/modal/page.tsx b/apps/fo/app/pages/flowRate/modal/page.tsx index fb7852560..33b255b6c 100644 --- a/apps/fo/app/pages/flowRate/modal/page.tsx +++ b/apps/fo/app/pages/flowRate/modal/page.tsx @@ -195,20 +195,18 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st ref={ref} queryClick={filterData} /> -
-
- {}} - className="h-[370px]" - boldArray={[0,1,2]} - /> -
+
+ {}} + className="h-[370px]" + boldArray={[0,1,2]} + />
@@ -221,20 +219,18 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st ref={ref} queryClick={filterData} /> -
-
- {}} - className="h-[370px]" - boldArray={[0,1,2]} - /> -
+
+ {}} + className="h-[370px]" + boldArray={[0,1,2]} + />
@@ -247,20 +243,18 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st ref={ref} queryClick={filterData} /> -
-
- {}} - className="h-[370px]" - boldArray={[0,1,2]} - /> -
+
+ {}} + className="h-[370px]" + boldArray={[0,1,2]} + />
@@ -273,20 +267,21 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st ref={ref} queryClick={filterData} /> -
-
- {}} - className="h-[370px]" - boldArray={[0,1,2]} - /> -
+
+ {}} + className="h-[370px]" + boldArray={[0,1,2]} + /> +
+
+ ☞ 청천시 : 강우량이 3mm미만의 날
@@ -299,10 +294,11 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st ref={ref} queryClick={filterData} /> -
-
+
{}} className="h-[370px]" boldArray={[0,1,2]}/> -
+
+
+ ☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날
diff --git a/apps/fo/app/pages/flowRate/page.tsx b/apps/fo/app/pages/flowRate/page.tsx index 3910944cf..8e258b5a2 100644 --- a/apps/fo/app/pages/flowRate/page.tsx +++ b/apps/fo/app/pages/flowRate/page.tsx @@ -49,7 +49,8 @@ export default function ProcessFacilitySearch() { const [fcltCpct, setFcltCpct] = useState("0"); const [fcltyName, setFcltyName] = useState(""); const [operationValue, setOperationValue] = useState("0"); - const [searchYearValue, setSearchYearValue] = useState(selectSearchYear[0]?.val || "0"); + //const [searchYearValue, setSearchYearValue] = useState(selectSearchYear[0]?.val || "0"); + const [searchYearValue, setSearchYearValue] = useState("2023"); const [widthSize, setWidthSize] = useState("w-[120%]"); const [upheadList, setUpheadList] = useState(upHeadList1); const [resetPage, setResetPage] = useState(false); @@ -197,7 +198,7 @@ export default function ProcessFacilitySearch() { {selectedRow !== null && ( } - bodyClass="sm:max-w-[90vw] w-[1050px] h-[700px]" + bodyClass="sm:max-w-[90vw] w-[1250px] h-[780px]" open={selectedRow !== null} onOpenChange={(open: boolean) => !open && closeModal()} /> diff --git a/apps/fo/app/pages/planSewage/page.tsx b/apps/fo/app/pages/planSewage/page.tsx index 8d7de5d80..c9324c246 100644 --- a/apps/fo/app/pages/planSewage/page.tsx +++ b/apps/fo/app/pages/planSewage/page.tsx @@ -70,7 +70,8 @@ export default function PlanSewage() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + //const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState("2023"); /** * 페이지 함수 @@ -190,6 +191,11 @@ export default function PlanSewage() {
+
+ ☞ 여유용량 = 하수처리시설 시설용량 – 건기시 유입유량(평균)​
+ ☞ 변동부하율 = 건기시 일최대 유량/일평균​유량(기준 최근 3개년)​
+ ☞ 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) ×100
+
diff --git a/apps/fo/app/pages/sewageOccur/modal/page.tsx b/apps/fo/app/pages/sewageOccur/modal/page.tsx index e8a90651e..824871432 100644 --- a/apps/fo/app/pages/sewageOccur/modal/page.tsx +++ b/apps/fo/app/pages/sewageOccur/modal/page.tsx @@ -8,7 +8,7 @@ import { useEffect, useState } from "react"; export default function SewageOccurModal(props: { fcltyName: string; facilityCd : string; searchYear : string}) { // 그리드 관련 - const {SewageOccurDetail} = useFoStore((state) => state); + const {SewageOccurDetail, searchSewageOccurDetailList} = useFoStore((state) => state); // searchYear 유효성 검사 및 기본값 설정 const validSearchYear = props.searchYear && /^\d{4}$/.test(props.searchYear) ? props.searchYear : new Date().getFullYear().toString(); @@ -22,8 +22,8 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd } = SewageOccurDetail; useEffect(() => { - setDetailList(gridListSewageOccurDetail); - }, [gridListSewageOccurDetail]); + searchSewageOccurDetailList(props.facilityCd, validSearchYear); + }, [searchSewageOccurDetailList, props.facilityCd, validSearchYear]); useEffect(() => { const filteredList = gridListSewageOccurDetail.filter(item => item.msrDt.replace(/-/g, '') >= startYearMonth && item.msrDt.replace(/-/g, '') <= endYearMonth); @@ -70,6 +70,9 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd }); avgWaterUsage = totalWaterUsage?totalWaterUsage / filteredList.length:0; + console.log("totalWaterUsage", totalWaterUsage); + console.log("filteredList.length", filteredList.length); + console.log("avgWaterUsage", avgWaterUsage); avgSwageChangePercent = totalSwageChangePercent?totalSwageChangePercent / filteredList.length:0; avgEstimationSewage = totalEstimationSewage?totalEstimationSewage / filteredList.length:0; diff --git a/apps/fo/app/pages/sewageOccur/page.tsx b/apps/fo/app/pages/sewageOccur/page.tsx index a137d9ebe..af59c633e 100644 --- a/apps/fo/app/pages/sewageOccur/page.tsx +++ b/apps/fo/app/pages/sewageOccur/page.tsx @@ -13,12 +13,14 @@ export default function PlanSewage() { ,SewageOccurSearch ,initializeCommonData ,searchSewageOccurList + ,calculateModalDataForAllFacilities } = useFoStore((state) => state) || { Common: { isInit: false, selectUpdownData: [], selectOperationData: [], selectSidoData: [], selectSigunData: [], selectRegionData: [], selectUnitWaterShedData: [], selectMiddleRegionData: [], selectEnvPartData: [], selectSearchYear: [{ val: "0" }], btnClass: "" }, SewageOccur: { sewageOccurList: [], sewageOccurCount: 0, excelList: [], upHeadList1: [], upHeadList2: [], upHeadList3: [] }, SewageOccurSearch: { labelArray: [] }, initializeCommonData: () => {}, - searchSewageOccurList: () => {} + searchSewageOccurList: () => {}, + calculateModalDataForAllFacilities: async () => [] }; const { @@ -66,6 +68,7 @@ export default function PlanSewage() { const [selectedRow, setSelectedRow] = useState(null); const [fcltyNm, setFcltyNm] = useState(""); const [fcltyCd, setFcltyCd] = useState(""); + const [isCalculating, setIsCalculating] = useState(false); // 그리드 관련 const searchInputRef = useRef(null); @@ -83,7 +86,8 @@ export default function PlanSewage() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + // const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState("2023"); /** * 페이지 함수 @@ -224,7 +228,11 @@ export default function PlanSewage() { {selectedRow !== null && ( } + body={} bodyClass="sm:max-w-[90vw] w-[1000px] h-[770px]" open={selectedRow !== null} onOpenChange={(open) => !open && closeModal()} diff --git a/apps/fo/app/pages/underWaterInput/page.tsx b/apps/fo/app/pages/underWaterInput/page.tsx index 1e821734b..93a6f0863 100644 --- a/apps/fo/app/pages/underWaterInput/page.tsx +++ b/apps/fo/app/pages/underWaterInput/page.tsx @@ -82,7 +82,8 @@ export default function UnderWaterInput() { // 시설상태 const [operationValue, setOperationValue] = useState("0"); // 조회기간 - const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + //const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || "0"); + const [searchYear, setSearchYear] = useState("2023"); /** * 페이지 함수 diff --git a/apps/fo/app/store/common/index.tsx b/apps/fo/app/store/common/index.tsx index 997e7fee7..3e15e2162 100644 --- a/apps/fo/app/store/common/index.tsx +++ b/apps/fo/app/store/common/index.tsx @@ -3,8 +3,6 @@ ====================================**/ import { getFetch } from "@/app/components/api"; -import { LoginApi } from "@/src/entities/auth"; -import type { ILogin } from "@/src/entities/auth/model/login-interface"; /** * STORE - TYPE @@ -413,15 +411,6 @@ export const CommonReducer:(set:(fn: (state: CommonType) => CommonType) => void) // 시도 변경 이벤트 initializeCommonData: async () => { - const payLoad : ILogin = { - userId: "admin1gmail", - password: "test1234!" - }; - - console.log(payLoad.userId) - console.log(payLoad.password) - - LoginApi.login(payLoad); const promiseSet = await Promise.all([fetchSidoData(), fetchSigunData(), fetchRegionData(), fetchUnitWaterShedData(), fetchMiddleRegionData(), fetchEnvPartData()]); const [sidoData, sggData, regionData, unitData, midData, envData] = promiseSet; set((state: CommonType) => ({ diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index d69e48b9d..b12c24d39 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -347,6 +347,7 @@ const upHeadListOperationStatus : TableUpperProps[] = [ { id: "groundWaterSummer", title: "하절기\n평균", upName:"upChangeRe5", upSequnce:2 }, { id: "groundWaterWinter", title: "동절기\n평균", upName:"upChangeRe5", upSequnce:3 }, { id: "rdi", title: "RDII 추정" }, + { id: "rdiRain", title: "RDII 추정시\n일강수량(mm)" }, ] const upHeadListRainManage : TableUpperProps[] = [ diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 57ac2e50a..2e8d1cfd6 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -28,7 +28,7 @@ export interface FacilityWaterQltyProps { inflAssctAftWqltTp: string | '', inflAssctBfrWqltTp: string | '', efflWqltBod: string | '', - efflWqltCod: string | '', + efflWqltToc: string | '', efflWqltSs: string | '', efflWqltTn: string | '', efflWqltTp: string | '', @@ -133,7 +133,7 @@ const upHeadList1: TableUpperProps[] = [ { id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1 }, { id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1 }, - { id: "efflWqltCod", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1 }, + { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1 }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1 }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 4, align: "right", row: 1 }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1 }, @@ -157,7 +157,7 @@ const upHeadList2: TableUpperProps[] = [ { id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 }, { id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 }, - { id: "efflWqltCod", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 }, + { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 }, @@ -185,7 +185,7 @@ const upHeadList3: TableUpperProps[] = [ { id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 }, { id: "inflAssctAftWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 }, - { id: "efflWqltCod", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 }, + { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1 }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 }, @@ -203,7 +203,7 @@ const upHeadListModalYear: TableUpperProps[] = [ { id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" }, { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe2", upSequnce: 1, align: "right" }, - { id: "efflWqltCod", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" }, + { id: "efflWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" }, @@ -409,8 +409,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType if(item.inflAssctAftWqltToc){ item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); } - if(item.efflWqltCod){ - item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1); + if(item.efflWqltToc){ + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); } if(item.inflAssctAftWqltBod){ item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1); @@ -427,8 +427,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType if(item.inflAssctAftWqltToc){ item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); } - if(item.efflWqltCod){ - item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1); + if(item.efflWqltToc){ + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); } return item; }); @@ -456,7 +456,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType 유입TN: item.inflAssctAftWqltTn, 유입TP: item.inflAssctAftWqltTp, 유출BOD: item.efflWqltBod, - 유출TOC: item.efflWqltCod, + 유출TOC: item.efflWqltToc, 유출SS: item.efflWqltSs, 유출TN: item.efflWqltTn, 유출TP: item.efflWqltTp, @@ -610,8 +610,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType if(item.inflAssctAftWqltToc){ item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); } - if(item.efflWqltCod){ - item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1); + if(item.efflWqltToc){ + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); } if(item.inflAssctAftWqltBod){ item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1); @@ -628,8 +628,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType if(item.inflAssctAftWqltToc){ item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); } - if(item.efflWqltCod){ - item.efflWqltCod = Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1); + if(item.efflWqltToc){ + item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); } if(item.tpInflWqltBod){ diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index 93de7ca94..a97494726 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -37,6 +37,13 @@ export type SewageOccurDetailProps = { estimationSewage : number, } +type RawSewageData = { + msrDt: string; + inflAmnt: string; + // 기타 다른 필드 생략 +}; + + /**==================================== * Store - data ====================================*/ @@ -120,7 +127,7 @@ const upHeadList3:TableUpperProps[] = [ const upHeadListSewageOccurDetail:TableUpperProps[] = [ { id: "msrDt", title: "년월" }, { id: "waterUsage", title: "물사용량(m³/일)" }, - { id: "swageChangePercent", title: "오수전환율" }, + { id: "swageChangePercent", title: "오수전환율(%)" }, { id: "estimationSewage", title: "오수발생량 추정(m³/일)", row:0, rowSpan:2 }, ]; @@ -299,11 +306,19 @@ const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear return { data: res.data, count: res.count } */ } +const fetchSewageOccurDetailList = async (bscFctCd: string, searchYear: string) => { + const url = '/fclt/flow/' + bscFctCd + '/' + searchYear; + const res = await getFetch('fo', url); + return { data: res.data, count: res.count } +} + /**==================================== * Store - expaort ====================================*/ export type SewageOccurActions = { searchSewageOccurList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void; + searchSewageOccurDetailList: (bscFctCd: string, searchYear: string) => void; + calculateModalDataForAllFacilities: (facilityList: SewageOccurProps[], searchYear: string) => Promise; } export type SewageOccurType = { @@ -388,7 +403,7 @@ export const sewageOccurReducer:(set:SetStateFunction)=>SewageOccurActions=(set: item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); - item.waterUsage = item.fctCpc * 0.6; + item.waterUsage = 0; item.swageChangePercent = 80; item.estimationSewage = item.waterUsage * (item.swageChangePercent/100); @@ -399,55 +414,22 @@ export const sewageOccurReducer:(set:SetStateFunction)=>SewageOccurActions=(set: let sumChungcunDay = 0; let chungcunSumFlow = 0; - + let totWaterUsage = 0; res2.data.forEach((item: FlowDataItem) => { if(Number(item.infoRnDay) ===0){ chungcunSumFlow += Number(item.inflAmnt); sumChungcunDay += 1; - }else{ - console.log(item.bscFctCd +' day : ' +' '+item.msrDt); } + totWaterUsage += Number(item.inflAmnt); }); - + let avg = totWaterUsage /res2.count; + console.log("avg ", avg); + item.waterUsage = avg * 0.65; item.sewageInputYear = sumFlow/res2.count; item.sewageInputChungchun = chungcunSumFlow===0?0:(chungcunSumFlow / sumChungcunDay); return item; })); - - console.log('calData : ', calData); - - const excelDownList: ExcelType[] = []; - if(pageSize>5000){ - calData.forEach(item => { - dataFormSetting(item) - item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); - /* item.ctpvNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; - item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; */ - excelDownList.push({ - 시설코드: item.bscFctCd, - 권역: item.rvbsn, - 단위유역: item.lgbsn, - 중권역: item.mdmbsn, - 환경청: item.rgnNm, - 시도: item.sidoNm, - 시군구: item.sggNm, - 시설명: item.bscFctNm, - 주소: item.daddr, - 시설용량: item.fctCpc, - 물사용량: item.waterUsage, - 오수전환율: item.swageChangePercent, - 오수발생량추정: item.estimationSewage, - 연간하수유입량: item.sewageInputYear, - 청천시하수유입량: item.sewageInputChungchun, - }); - }); - }else{ - calData.forEach((item: SewageOccurProps) => { - dataFormSetting(item) - /* item.sidoNmNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; - item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; */ - }); - } + // 조회 데이터 설정 set((state: SewageOccurType) => ({ ...state, SewageOccur: pageSize<5000?{ @@ -456,7 +438,33 @@ export const sewageOccurReducer:(set:SetStateFunction)=>SewageOccurActions=(set: sewageOccurCount: res.count, }:{ ...state.SewageOccur, - excelList: excelDownList, + excelList: [], + } + })) + }, + + searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string) => { + const res = await fetchSewageOccurDetailList(bscFctCd, searchYear); + console.log('resData ', res.data); + let monthData: number[] = []; + + res.data.forEach((item: FlowDataItem) => { + let month = item.msrDt?.substring(5, 7); + const monthIdx = month ? Number(month) - 1 : -1; + if (monthIdx >= 0) { + if (typeof monthData[monthIdx] === 'number') { + monthData[monthIdx] += Number(item.inflAmnt); + } else { + monthData[monthIdx] = Number(item.inflAmnt); + } + } + }) + + set((state: SewageOccurType) => ({ + ...state, + SewageOccurDetail: { + ...state.SewageOccurDetail, + gridListSewageOccurDetail: processedData, } })) }, diff --git a/apps/fo/app/store/store.tsx b/apps/fo/app/store/store.tsx index f17801d1f..cba4b9976 100644 --- a/apps/fo/app/store/store.tsx +++ b/apps/fo/app/store/store.tsx @@ -1,13 +1,19 @@ +import { LoginApi } from '@/src/entities/auth/api/login-service'; import { createStore } from 'zustand/vanilla'; import { CommonReducer, commonState, type CommonStore, type CommonType } from './common'; -import { dashBoardReducer, dashBoardInitState, type DashBoardStore, type DashBoardType } from './dashboard'; +import { dashBoardInitState, dashBoardReducer, type DashBoardStore, type DashBoardType } from './dashboard'; import { facilityPrecipitationInitState, facilityPrecipitationReducer, type FacilityPrecipitationStore, type FacilityPrecipitationType } from './facilityPrecipitation'; -import { planSewageInitState, planSewageReducer, type PlanSewageStore, type PlanSewageType } from './planSewage'; +import { + facilityWaterQltyInitState, + facilityWaterQltyReducer, + type FacilityWaterQltyStore, type FacilityWaterQltyType +} from './facilityWaterQlty'; import { flowRateSearchInitState, flowRateSearchReducer, type FlowRateSearchStore, type FlowRateSearchType } from './flowRate'; +import { planSewageInitState, planSewageReducer, type PlanSewageStore, type PlanSewageType } from './planSewage'; import { processAreaInitState, processAreaReducer, @@ -18,11 +24,12 @@ import { processFacilityReducer, type ProcessFacilityStore, type ProcessFacilityType } from './processFacility'; +import { tableActionsExport, tableStateExport, type tableState, type tableType } from './publicReuseFaciltyInsert/index'; import { - facilityWaterQltyInitState, - facilityWaterQltyReducer, - type FacilityWaterQltyStore, type FacilityWaterQltyType -} from './facilityWaterQlty'; + rdiInitState, + rdiReducer, + type RdiStore, type RdiType +} from './rdi'; import { sewageOccurInitState, sewageOccurReducer, @@ -33,12 +40,6 @@ import { underWaterReducer, type UnderWaterStore, type UnderWaterType } from './underWaterInput'; -import { - rdiInitState, - rdiReducer, - type RdiStore, type RdiType -} from './rdi'; -import { tableActionsExport, tableStateExport, type tableState, type tableType } from './publicReuseFaciltyInsert/index'; export type FoStore = CommonStore & tableType & DashBoardStore & ProcessFacilityStore & ProcessAreaStore & FlowRateSearchStore & FacilityPrecipitationStore & FacilityWaterQltyStore & PlanSewageStore & SewageOccurStore & UnderWaterStore & RdiStore; export type FoState = CommonType & tableState & ProcessFacilityType & ProcessAreaType & FacilityPrecipitationType & FlowRateSearchType & DashBoardType & FacilityWaterQltyType & PlanSewageType & SewageOccurType & UnderWaterType & RdiType; @@ -58,6 +59,7 @@ export const StoreZus = } ) => { return createStore()((set) => { + LoginApi.login({userId: "tuser10003", password: "test1234!"}) return { ...initState, ...CommonReducer(set),