diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 2e0fd6965..e8240aa5b 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -164,8 +164,38 @@ export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // console.error(error); } }; - +export const selectPplInftwtQty = async(inftwtAnlsSn:number, pplMngNo:string) => { // 침입수량 + try { + if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { + console.warn("inftwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/inftwtAnlsRslt/pplinftwtQty/${inftwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectPplInftwtQty", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; //---------- +export const selectPplRdiiQty = async(rainInfwtAnlsSn:number, pplMngNo:string) => { // rdii값 + try { + if ((rainInfwtAnlsSn === undefined || rainInfwtAnlsSn === 0) || !pplMngNo) { + console.warn("rainInfwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/rdiiAnlsRslt/pplRdiiQty/${rainInfwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectPplInftwtQty", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; + export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number }[] => { const options = anlsArr.map(anls => ({ text: anls.anlsInfo, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 8700f0eb3..97b0309e2 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -5,8 +5,7 @@ import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; import type { TInftwtAnls, TOilqData } from './aplcnYms'; -import { useAplcnYms, getOptionsInftwtAnlsInfo, selectInftwtAnls } from './aplcnYms'; -import { getChartDataInftwtAnlsRslt, selectInftwtAnlsRslt, selectOilq, getChartDataOilq } from './aplcnYms'; +import * as fn from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, @@ -30,7 +29,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo { label: "2", val: 35 }, { label: "3", val: 55 },], }); - const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 + const aplcnYms = fn.useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 pplMngNo = "L"+pplMngNo; // "L13101003"; console.log("pplMngNo", pplMngNo); const openPopup = () => { @@ -46,8 +45,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const chartForm = CHART_FORM.LINE; const chartConfig = { - chartData1: { label: '침입수예측유량', color: "red", }, - chartData2: { label: '실측유량', color: "orange", } + chartData1: { label: '순오수량(m³/h)', color: "red", }, + chartData2: { label: '실측하수량(m³/h)', color: "orange", } } as ChartConfig; useEffect(() => { @@ -73,10 +72,10 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo return; } - selectInftwtAnls(aplcnYm) + fn.selectInftwtAnls(aplcnYm) .then((data) => { setInftwtAnlss(data ?? []); - setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data)); + setInftwtAnlsInfos(fn.getOptionsInftwtAnlsInfo(data)); setInftwtAnls(null); // 오수전환율 이후 초기화 setInftwtAnlsSn(0); // 초기화 }) @@ -100,15 +99,15 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const closePopup = () => { // 팝업 닫기 - selectInftwtAnlsRslt(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수분석 결과 조회 - const rsltData = getChartDataInftwtAnlsRslt(data ?? []); + fn.selectInftwtAnlsRslt(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수분석 결과 조회 + const rsltData = fn.getChartDataInftwtAnlsRslt(data ?? []); setChartData(prev => ({ ...prev, chartData1: rsltData // 침입수분석결과 })); }); - selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 - const rsltData = getChartDataOilq(data ?? []); + fn.selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 + const rsltData = fn.getChartDataOilq(data ?? []); setChartData(prev => ({ ...prev, chartData2: rsltData // 유량