Compare commits

..
Author SHA1 Message Date
Your Name 4c66dacdb0 원복 2025-07-31 14:31:59 +09:00
Your Name 8a2bbfe220 원앤올 API URL 재수정 2025-07-31 13:52:52 +09:00
Your Name 5712bcedaa 원앤올 DB바라보게 수정 2025-07-31 13:38:27 +09:00
Your Name df18a79528 물사용량 오류 및 null 관련오류 수정 2025-07-30 16:00:22 +09:00
Your Name 3bd22d83b7 계획정보 API 호출 공통화 및 수정 2025-07-30 11:23:16 +09:00
Your Name 0abc7eaaac 배수설비 정비현황 조회삭제 2025-07-30 09:49:26 +09:00
Your Name c713b55480 물사용량은 계획정보 없어도 대시보드에 추출되도록 수정 2025-07-30 09:34:54 +09:00
Your Name eafe131df1 계획정보 못불러 올 경우 progressbar 없어지게 수정 2025-07-29 18:11:39 +09:00
mind-one003 e1fc6f210f 삼항연산자 수정 2025-07-29 01:43:54 -04:00
Your Name 1bec6a3787 결함수정, 날짜2024초기화, 총인설비 tp 키값수정정 2025-07-29 14:29:37 +09:00
Your Name a2b2d94581 gis.layer merge 2025-07-28 11:21:16 +09:00
Your Name 1083be517d Merge branch 'iipbs/common/main' into iipbs/fo/dev 2025-07-28 11:13:09 +09:00
Your Name dad8b9925e monthpicker enableMonth string[] 파라미터 추가
(선택가능한 월 배열 추가하면됨 ex.['4월', '5월'])
2025-07-28 11:12:27 +09:00
Your Name aeb4f5f8ca 지하수유입량 하절기는 6,7,8월 / 동절기는 1월 2월만 선택가능하도록 파라미터 추가 2025-07-28 11:07:54 +09:00
swcho 07c7947da1 fix: gis.layer.js 하수펌프장 CQL 필터 적용 안되는 에러 수정 2025-07-28 10:51:37 +09:00
swcho 35e1203168 fix: monthPicker.tsx 현재 월에 hover 효과가 지속되는 코드 주석 처리 2025-07-28 10:34:35 +09:00
Your Name dfabee3e08 초기화 돌아가는 문제해결, 대시보드 calData 수정, 처리구역정보 null 오류 수정 2025-07-27 23:50:24 +09:00
Your Name be5ffb60f6 결함수정 - 강우영향일 계산 수정, 2025-07-27 18:40:35 +09:00
Your Name befb3f1c84 빌드에러 수정 2025-07-27 14:56:32 +09:00
Your Name 87ee8c827d Merge branch 'iipbs/common/main' into iipbs/fo/dev 2025-07-27 14:44:17 +09:00
Your Name bd7debbe3e 오수발생량 추정, 지하수유입량 추정 년월 중 년 disabled 2025-07-27 14:42:30 +09:00
Your Name 1850ab2aa8 대시보드 물사용량평균 수정, 초기화오류 수정, 수질 변수 다시수정 2025-07-27 14:34:32 +09:00
Your Name c976b5d6ee 빌드에러 수정, 대시보드 물사용량 추출완료, 초기화 전체 2023년 2025-07-26 22:55:23 +09:00
Your Name ad7a633bc9 빌드에러 수정 안쓰는변수제거거 2025-07-26 20:59:20 +09:00
Your Name b91298f3d9 강우영향일 관련 문구 추가 2025-07-26 20:57:52 +09:00
Your Name 1207754092 강우영향일 기준 강우일 운영현황 나오도록 수정 2025-07-26 20:45:09 +09:00
Your Name 2fc4f9512f 결함수정중 2025-07-26 19:57:09 +09:00
Your Name 55de8cc31e 결함문제 해결 진행중 2025-07-26 19:24:32 +09:00
mind-one002 f18eaa8f01 메인 머지 이슈로 수정. 2025-07-26 16:46:59 +09:00
mind-one002 04bc7d3a3a Merge commit '0ad7d6a2c4c8d7585d6a5b053444dd6c2b35b710' into iipbs/fo/dev 2025-07-26 16:43:28 +09:00
104 changed files with 2419 additions and 2189 deletions
+4 -3
View File
@@ -1,8 +1,7 @@
NEXT_PUBLIC_SITE_ID = DM NEXT_PUBLIC_SITE_ID = DM
NEXT_PUBLIC_PORT = 3000 NEXT_PUBLIC_PORT = 3000
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000 NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
@@ -10,7 +9,9 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 # NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
+3 -5
View File
@@ -6,16 +6,14 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_PORT = 11035 NEXT_PUBLIC_PORT = 11035
#NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035 #NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000/ NEXT_PUBLIC_PROXY_HOST = http://localhost:3000/
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1 #NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
+1 -1
View File
@@ -11,7 +11,7 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization
NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_REUSE_API_URL=http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
@@ -74,7 +74,7 @@ export type FormData = z.infer<typeof sdmInfoFormSchema>;
function SdmInfoInsertContent() { function SdmInfoInsertContent() {
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const {insertSdmInfoData, Sdm ,setSubsInfo} = useDmStore((state) => state); const {map, insertSdmInfoData, Sdm } = useDmStore((state) => state);
const { successLogin } = Sdm; const { successLogin } = Sdm;
const [ismoneyDisabled, setIsmoneyDisabled] = useState(false); const [ismoneyDisabled, setIsmoneyDisabled] = useState(false);
const formSchema = sdmInfoFormSchema; const formSchema = sdmInfoFormSchema;
@@ -127,9 +127,7 @@ function SdmInfoInsertContent() {
if (local) { if (local) {
setIsLogin(true); setIsLogin(true);
} }
setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만) }, []);
}, [setSubsInfo]);
const form = useForm<FormData>({ const form = useForm<FormData>({
resolver: zodResolver(formSchema), resolver: zodResolver(formSchema),
@@ -137,27 +135,12 @@ function SdmInfoInsertContent() {
mode: "onChange", mode: "onChange",
}); });
const subsInfo = useDmStore((state) => state.map.subsInfo);
useEffect(()=>{ useEffect(()=>{
//map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함 if(map.subsInfo.length>0){
if(subsInfo.length>0){ form.setValue('candidateTitle', map.subsInfo)
form.setValue('candidateTitle', subsInfo)
} }
},[subsInfo, form]) },[map.subsInfo, form])
//후보지 팝업 값 셋팅
useEffect(() => {
const handleMessage = (event: MessageEvent) => {
if (event.data?.type === 'SET_SUBS_INFO') {
setSubsInfo(event.data.payload); // zustand로 값 설정
}
};
window.addEventListener('message', handleMessage);
return () => window.removeEventListener('message', handleMessage);
}, [setSubsInfo]);
// 로그인 성공 시 모달 닫기 및 폼 업데이트 // 로그인 성공 시 모달 닫기 및 폼 업데이트
useEffect(() => { useEffect(() => {
@@ -171,7 +154,6 @@ useEffect(() => {
setFacilityName(userData.dmdCoNm); setFacilityName(userData.dmdCoNm);
form.setValue('sdmNm', userData.dmdCoNm); form.setValue('sdmNm', userData.dmdCoNm);
} }
} catch (error) { } catch (error) {
console.error('Error parsing user data:', error); console.error('Error parsing user data:', error);
} }
@@ -47,7 +47,6 @@ export default function MyForm() {
dmdInfoSn: '', dmdInfoSn: '',
dmdInfoFk: '', dmdInfoFk: '',
status: '', status: '',
splyCndtList: []
}; };
formDataRef.current = convertedData; formDataRef.current = convertedData;
insertSdmData(convertedData).catch(error => { insertSdmData(convertedData).catch(error => {
@@ -53,16 +53,14 @@ export default function WrAboutPage() {
}, observerOptions); }, observerOptions);
// 각 카드 요소를 관찰 // 각 카드 요소를 관찰
const cardsSnapshot = [...cardRefs.current]; cardRefs.current.forEach((card) => {
cardsSnapshot.forEach((card) => {
if (card) { if (card) {
observer.observe(card); observer.observe(card);
} }
}); });
return () => { return () => {
cardsSnapshot.forEach((card) => { cardRefs.current.forEach((card) => {
if (card) { if (card) {
observer.unobserve(card); observer.unobserve(card);
} }
@@ -193,16 +193,16 @@ const WrStatusPage: React.FC = () => {
}; };
const tableData: TableData[] = [ const tableData: TableData[] = [
{ region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123(492)' }, { region: '전국', sewage: '717(1,137,538)', rainwater: '3544(13,945)', reclaimed: '1018(222,476)', thermal: '123' },
{ region: '서울특별시', sewage: '4(114,908)', rainwater: '816(430)', reclaimed: '371(341)', thermal: '0' }, { region: '서울특별시', sewage: '4(114,908)', rainwater: '816(430)', reclaimed: '371(341)', thermal: '0' },
{ region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1(18)' }, { region: '부산광역시', sewage: '13(146,197)', rainwater: '68(335)', reclaimed: '20(512)', thermal: '1' },
{ region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2(12)' }, { region: '대구광역시', sewage: '9(102,380)', rainwater: '294(133)', reclaimed: '14(44)', thermal: '2' },
{ region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15(32)' }, { region: '인천광역시', sewage: '17(57,691)', rainwater: '165(642)', reclaimed: '35(7,859)', thermal: '15' },
{ region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15(6)' }, { region: '광주광역시', sewage: '3(28,738)', rainwater: '74(23)', reclaimed: '15(450)', thermal: '15' },
{ region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20(100)' }, { region: '대전광역시', sewage: '2(11,966)', rainwater: '52(2)', reclaimed: '11(492)', thermal: '20' },
{ region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30(130)' }, { region: '울산광역시', sewage: '8(36,076)', rainwater: '111(39)', reclaimed: '19(28,904)', thermal: '30' },
{ region: '세종특별자치시', sewage: '9(2,555)', rainwater: '65(16)', reclaimed: '0(0)', thermal: '0' }, { region: '세종특별자치시', sewage: '9(2,555)', rainwater: '65(16)', reclaimed: '0(0)', thermal: '0' },
{ region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40(143)' }, { region: '경기도', sewage: '176(313,298)', rainwater: '1009(4,735)', reclaimed: '252(77,096)', thermal: '40' },
{ region: '강원특별자치도', sewage: '69(19,677)', rainwater: '69(4)', reclaimed: '22(447)', thermal: '0' }, { region: '강원특별자치도', sewage: '69(19,677)', rainwater: '69(4)', reclaimed: '22(447)', thermal: '0' },
{ region: '충청북도', sewage: '38(15,607)', rainwater: '17(91)', reclaimed: '91(2,211)', thermal: '0' }, { region: '충청북도', sewage: '38(15,607)', rainwater: '17(91)', reclaimed: '91(2,211)', thermal: '0' },
{ region: '충청남도', sewage: '67(41,368)', rainwater: '54(77)', reclaimed: '188(50,434)', thermal: '0' }, { region: '충청남도', sewage: '67(41,368)', rainwater: '54(77)', reclaimed: '188(50,434)', thermal: '0' },
@@ -493,10 +493,10 @@ const WrStatusPage: React.FC = () => {
<tr> <tr>
<th className="text-[12px] font-semibold px-4 py-2">번호</th> <th className="text-[12px] font-semibold px-4 py-2">번호</th>
<th className="text-[12px] font-semibold px-4 py-2">시도</th> <th className="text-[12px] font-semibold px-4 py-2">시도</th>
<th className="text-[12px] font-semibold px-4 py-2">하수(이용량,천𝓂³/년)</th> <th className="text-[12px] font-semibold px-4 py-2">하수(이용량,천m³/년)</th>
<th className="text-[12px] font-semibold px-4 py-2">빗물(이용량,천𝓂³/년)</th> <th className="text-[12px] font-semibold px-4 py-2">빗물(이용량,천m³/년)</th>
<th className="text-[12px] font-semibold px-4 py-2">중수도(이용량,천𝓂³/년)</th> <th className="text-[12px] font-semibold px-4 py-2">중수도(이용량,천m³/년)</th>
<th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천𝓂³/년)</th> <th className="text-[12px] font-semibold px-4 py-2">온배수(이용량,천m³/년)</th>
</tr> </tr>
</thead> </thead>
<tbody className="divide-y"> <tbody className="divide-y">
+81 -181
View File
@@ -1,46 +1,42 @@
"use client"; "use client";
import Gis from "@common/business_components/ui/map/Gis"; import Gis from "@common/business_components/ui/map/Gis";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState, useCallback } from "react";
import { mapService } from "../service"; import { mapService } from "../service";
import GisApp from "@common/business_components/ui/map/lib/gis.core"; import GisApp from "@common/business_components/ui/map/lib/gis.core";
import { SearchBar } from "@/components/ui/map/searchBar/searchBar"; import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
import SelectedFcltList from "./selectedFcltList"; import { useDmStore } from "@/app/store";
import type { SubsInfo } from "@/app/store/map/type";
// export type SubsInfo={
// ruseUtztnFcltNm: string; // 재이용시설명
// ruseUtztnFcltCd: string; // 재이용시설 코드
// }
const Map = () => { const Map = () => {
//수요처 저장하는 함수 setSubsInfo
//setSubsInfo(subsInfo:SubsInfo[]):void
const { map,setSubsInfo } = useDmStore(
(state) => state
);
//저장된 수요처 리스트
const { subsInfo } = map;
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
const gisMaps = useRef<any | null>(null); const gisMaps = useRef<any | null>(null);
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태 const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터 const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
const [selectDataPk, setSelectDataPk] = useState<Record<string, any>>({}); const [checkedLayers, setCheckedLayers] = useState<string[]>([]);
const [selectedFclts, setSelectedFclts] = useState<any[]>([]); const [checkedLayersData, setCheckedLayersData] = useState<any[]>([]);
const [selectDataPk, setSelectDataPk] = useState<string>("");
const [subs, setSubs] = useState<object[]>([]);
//적용 버튼 클릭 이벤트 //적용 버튼 클릭 이벤트
const onApply = () => { const onApply = () => {
if (selectedFclts.length > 3) { //setSubs([{'41110PB001R1':'수원제1,2 재이용1'},{'41110PB001R2':'수원제1,2 재이용2'}]);
alert("재이용시설 후보지는 최대 3개까지만 선택할 수 있습니다."); console.log(subs)
return;
}
const subsInfoList: SubsInfo[] = selectedFclts.map((fclt) => ({
ruseUtztnFcltNm: fclt.ruseUtztnFcltNm,
ruseUtztnFcltCd: fclt.pbnstRuseFcltId,
}));
window.opener.postMessage(
{
type: "SET_SUBS_INFO",
payload: subsInfoList, // 또는 필요한 데이터
},
"*"
);
window.close();
}; };
//트리 레이어 데이터 조회
const fetchData = async () => { const fetchData = async () => {
try { try {
const response = await mapService.getLyrStngs(); const response = await mapService.getLyrStngs();
@@ -50,167 +46,76 @@ const Map = () => {
} }
}; };
//하수처리시설코드로 재이용시설 목록 조회 // 팝업 닫기 핸들러를 useCallback으로 메모이제이션
const reuseData = async (ruseFcltPk: any) => { const handlePopupClose = useCallback(() => {
try { setIsOpen(false);
const response = await mapService.getPbnstRuseFclts(ruseFcltPk); setFeatureData(null);
const data = response.data || []; }, []);
setSelectedFclts((prev) => {
const newItems = data.filter(
(item: any) =>
item &&
Object.keys(item).length > 0 &&
!prev.some((f) => f.pbnstRuseFcltId === item.pbnstRuseFcltId)
);
console.log(newItems)
return [...prev, ...newItems];
});
} catch (error) {
console.error("데이터 불러오기 실패:", error);
}
};
// 컴포넌트 마운트 시 1회 실행 // 컴포넌트 마운트 시 1회 실행
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
}, []); }, []);
// 레이어 생성 후 초기화 처리 useEffect(() => {
const onCheckedLayersChange = () => { console.log("Selected Data Pk: ", selectDataPk);
//수요처 ID }, [selectDataPk]);
const urlParams = new URLSearchParams(window.location.search);
const dmdInfoId = urlParams.get("dmdInfoId");
//수요처 위치로 화면 이동 // 체크된 레이어 정보를 받는 핸들러
const maps = gisMaps.current; const handleCheckedLayersChange = (
const layer = GisApp.Module.layer as any; checkedIds: string[],
const layerNm = "tb_wr_ruse_fclt_dmd_co"; checkedNodesData: any[]
const featureId = `${layerNm}.${dmdInfoId}`; ) => {
let foundFeature: any = null; setCheckedLayers(checkedIds);
setCheckedLayersData(checkedNodesData);
maps
.getLayers()
.getArray()
.forEach((layer: any) => {
if (layer.get("lyrTyNm") == layerNm) {
const source = layer.getSource?.();
if (source?.getFeatureById) {
const feature = source.getFeatureById(String(featureId).trim());
if (feature) {
foundFeature = feature;
return;
}
}
}
});
if (foundFeature) {
const geometry = foundFeature.getGeometry();
if (geometry) {
const extent = geometry.getExtent();
if (geometry.getType() === "Point") {
maps.getView().setCenter(geometry.getCoordinates());
maps.getView().setZoom(11);
} else {
maps.getView().fit(extent, {
duration: 300,
padding: [30, 30, 30, 30],
maxZoom: 16,
});
}
}
layer.highLightFeature(
[foundFeature],
{
id: GisApp.hlLayerId,
zIndex: 10,
opacity: 1,
selectable: true,
},
{ width: 30 }
);
}
const formatNumber = (val: any) => {
const num = Number(val);
return isNaN(num) ? "-" : num.toLocaleString();
};
// 재이용시설 오버레이
maps
.getLayers()
.getArray()
.forEach((layer: any) => {
if (layer.get("lyrTyNm") === "tb_wr_bdst_ruse_fclt") {
const source = layer.getSource?.();
if (source?.getFeatures) {
const features = source.getFeatures();
features.forEach((feature: any) => {
// 필요한 고유 ID 또는 속성 가져오기 (예: ftrIdn 또는 feature.getId())
const featureId =
feature.getId() || feature.get("ftrIdn") || Math.random();
// HTML 또는 React 오버레이 컴포넌트 구성
const overlayContent = `
<div class="rounded-md border border-gray-300 bg-white shadow-md text-sm w-[120px]">
<!-- 헤더 -->
<div class="bg-cyan-700 text-white px-3 py-2 text-[11px] font-semibold text-center rounded-t-md">
${feature.get("swtrmt_fclt_nm") || "-"}
</div>
<!-- 테이블 -->
<table class="w-full text-sm text-gray-800 border-t border-gray-200">
<tbody>
<tr class="border-b border-gray-200">
<th class="bg-gray-100 text-gray-600 font-semibold text-[10px] text-left">용량(m³/일)</th>
<td class="text-right text-[10px] font-bold">${formatNumber(feature.get("fclt_cpct"))}</td>
</tr>
</tbody>
</table>
</div>
`;
feature.set("html", overlayContent);
feature.set("overLayId", `overLay.${featureId}`);
});
}
}
});
}; };
// 검색해서 재이용시설 선택하면 해당 시설로 화면 이동 처리 // SearchModal, GisContent 등에서 호출
useEffect(() => { const onFeatureSelect = (data: any) => {
if (!selectDataPk || Object.keys(selectDataPk).length === 0) return; const map = gisMaps.current;
const maps = gisMaps.current; if (!map) {
console.warn("지도가 초기화되지 않았습니다.");
return;
}
// 항상 같은 select 객체 사용
const select = GisApp.Module.select as any;
if (!select) return;
// 1. 기존 선택 초기화
select.resetSelectedFeature();
// 2. data가 OpenLayers Feature 인스턴스인지 확인
let foundFeature: any = null; let foundFeature: any = null;
const layerNm = "tb_wr_bdst_ruse_fclt"; if (
const featureId = `${layerNm}.${selectDataPk.bscFctCd}`; data &&
maps typeof data.getGeometry === "function" &&
.getLayers() typeof data.setStyle === "function"
.getArray() ) {
.forEach((layer: any) => { // 이미 Feature 인스턴스라면 그대로 사용
if (layer.get("lyrTyNm") == layerNm) { foundFeature = data;
} else {
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
const featureId = data.fid || data.ftrIdn || data.id;
map
.getLayers()
.getArray()
.forEach((layer: any) => {
const source = layer.getSource?.(); const source = layer.getSource?.();
if (source?.getFeatureById) { if (source?.getFeatureById) {
const feature = source.getFeatureById(String(featureId).trim()); const feature = source.getFeatureById(String(featureId).trim());
if (feature) { if (feature) foundFeature = feature;
foundFeature = feature;
return;
}
} }
} });
}); }
// 3. 피처 선택
if (foundFeature) { if (foundFeature) {
const geometry = foundFeature.getGeometry(); const geometry = foundFeature.getGeometry();
if (geometry) { if (geometry) {
const extent = geometry.getExtent(); const extent = geometry.getExtent();
maps.getView().fit(extent, { map.getView().fit(extent, {
duration: 300, duration: 300,
padding: [50, 50, 50, 50], padding: [50, 50, 50, 50],
maxZoom: 16, maxZoom: 16,
@@ -218,23 +123,21 @@ const Map = () => {
nearest: true, nearest: true,
}); });
} }
select.selectFeature(foundFeature, true);
} else { } else {
console.warn("OpenLayers Feature를 찾을 수 없습니다:", selectDataPk); console.warn("OpenLayers Feature를 찾을 수 없습니다:", data);
} }
}, [selectDataPk]);
// 재이용시설 클릭 시 선택 시설목록에 추가 setFeatureData(data);
const onFeatureSelect = (data: any) => { setIsOpen(true);
// 처리시설코드 setIsSearchModalOpen(false);
const swtrmtFcltCd = data.get("swtrmt_fclt_cd");
reuseData(swtrmtFcltCd);
}; };
return ( return (
<> <>
<SearchBar <SearchBar
setHasuPk={(hasuPk: any) => { setHasuPk={(hasuPk: string) => {
if (hasuPk) { if (hasuPk !== "") {
setSelectDataPk(hasuPk); setSelectDataPk(hasuPk);
} }
}} }}
@@ -247,7 +150,7 @@ const Map = () => {
gisMaps={gisMaps} gisMaps={gisMaps}
isMiniMap={false} isMiniMap={false}
searchView={undefined} searchView={undefined}
detailView={undefined} detailView={null}
onFeatureSelect={onFeatureSelect} onFeatureSelect={onFeatureSelect}
setIsOpen={setIsOpen} setIsOpen={setIsOpen}
setFeatureData={setFeatureData} setFeatureData={setFeatureData}
@@ -255,14 +158,11 @@ const Map = () => {
setIsSearchModalOpen={setIsSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen}
isOpen={isOpen} isOpen={isOpen}
isSearchModalOpen={isSearchModalOpen} isSearchModalOpen={isSearchModalOpen}
onCheckedLayersChange={onCheckedLayersChange} onCheckedLayersChange={handleCheckedLayersChange}
imgVisble={false} imgVisble={false}
setData={setSubs}
/> />
</div> </div>
<SelectedFcltList
data={selectedFclts}
onRemove={(updatedList) => setSelectedFclts(updatedList)}
/>
</> </>
); );
}; };
@@ -0,0 +1,147 @@
"use client";
import Gis from "@common/business_components/ui/map/Gis";
import { useEffect, useRef, useState, useCallback } from "react";
import { mapService } from "../service";
import GisApp from "@common/business_components/ui/map/lib/gis.core";
import { SearchBar } from "@/components/ui/map/searchBar/searchBar";
const Map = () => {
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
const gisMaps = useRef<any | null>(null);
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태
const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터
const [checkedLayers, setCheckedLayers] = useState<string[]>([]);
const [checkedLayersData, setCheckedLayersData] = useState<any[]>([]);
const [selectDataPk, setSelectDataPk] = useState<string>("");
const fetchData = async () => {
try {
const response = await mapService.getLyrStngs();
setTreeData(response); // API 응답 저장
} catch (error) {
console.error("데이터 불러오기 실패:", error);
}
};
// 팝업 닫기 핸들러를 useCallback으로 메모이제이션
const handlePopupClose = useCallback(() => {
setIsOpen(false);
setFeatureData(null);
}, []);
// 컴포넌트 마운트 시 1회 실행
useEffect(() => {
fetchData();
}, []);
useEffect(() => {
console.log("Selected Data Pk: ", selectDataPk);
}, [selectDataPk]);
// 체크된 레이어 정보를 받는 핸들러
const handleCheckedLayersChange = (
checkedIds: string[],
checkedNodesData: any[]
) => {
setCheckedLayers(checkedIds);
setCheckedLayersData(checkedNodesData);
};
// SearchModal, GisContent 등에서 호출
const onFeatureSelect = (data: any) => {
const map = gisMaps.current;
if (!map) {
console.warn("지도가 초기화되지 않았습니다.");
return;
}
// 항상 같은 select 객체 사용
const select = GisApp.Module.select as any;
if (!select) return;
// 1. 기존 선택 초기화
select.resetSelectedFeature();
// 2. data가 OpenLayers Feature 인스턴스인지 확인
let foundFeature: any = null;
if (
data &&
typeof data.getGeometry === "function" &&
typeof data.setStyle === "function"
) {
// 이미 Feature 인스턴스라면 그대로 사용
foundFeature = data;
} else {
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
const featureId = data.fid || data.ftrIdn || data.id;
map
.getLayers()
.getArray()
.forEach((layer: any) => {
const source = layer.getSource?.();
if (source?.getFeatureById) {
const feature = source.getFeatureById(String(featureId).trim());
if (feature) foundFeature = feature;
}
});
}
// 3. 피처 선택
if (foundFeature) {
const geometry = foundFeature.getGeometry();
if (geometry) {
const extent = geometry.getExtent();
map.getView().fit(extent, {
duration: 300,
padding: [50, 50, 50, 50],
maxZoom: 16,
constrainResolution: true,
nearest: true,
});
}
select.selectFeature(foundFeature, true);
} else {
console.warn("OpenLayers Feature를 찾을 수 없습니다:", data);
}
setFeatureData(data);
setIsOpen(true);
setIsSearchModalOpen(false);
};
return (
<>
<SearchBar
setHasuPk={(hasuPk: string) => {
if (hasuPk !== "") {
setSelectDataPk(hasuPk);
}
}}
/>
<div className="bg-container">
<Gis
treeData={treeData}
isSearch={false}
gisMaps={gisMaps}
isMiniMap={false}
searchView={undefined}
detailView={null}
onFeatureSelect={onFeatureSelect}
setIsOpen={setIsOpen}
setFeatureData={setFeatureData}
featureData={featureData}
setIsSearchModalOpen={setIsSearchModalOpen}
isOpen={isOpen}
isSearchModalOpen={isSearchModalOpen}
onCheckedLayersChange={handleCheckedLayersChange}
imgVisble={false}
/>
</div>
</>
);
};
export default Map;
@@ -1,81 +0,0 @@
import React from "react";
type FcltItem = {
pbnstRuseFcltId: string;
ruseUtztnFcltNm: string;
splyExtraCpct?: number;
ruseCpct?: number;
[key: string]: any;
};
export default function SelectedFcltList({
data = [],
onRemove,
}: {
data: FcltItem[];
onRemove: (updatedList: FcltItem[]) => void;
}) {
const handleDelete = (code: string) => {
const updatedList = data.filter((item) => item.pbnstRuseFcltId !== code);
onRemove(updatedList);
};
const TableContent = (
<>
<thead className="bg-gray-100 text-gray-700 text-[13px]">
<tr>
<th className="px-3 py-2 text-left border-b">시설명</th>
<th className="px-3 py-2 text-right border-b">
하수처리량
<br />
(㎥/일)
</th>
<th className="px-3 py-2 text-right border-b">
재이용량
<br />
(㎥/일)
</th>
<th className="px-3 py-2 border-b">삭제</th>
</tr>
</thead>
<tbody>
{data.map((item) => (
<tr key={item.pbnstRuseFcltId} className="border-b last:border-none">
<td className="px-3 py-2 text-[12px]">{item.ruseUtztnFcltNm}</td>
<td className="px-3 py-2 text-right text-[12px]">
{Number(item.splyExtraCpct || 0).toLocaleString()}
</td>
<td className="px-3 py-2 text-right text-[12px]">
{Number(item.ruseCpct || 0).toLocaleString()}
</td>
<td className="px-3 py-2 text-center">
<button
onClick={() => handleDelete(item.pbnstRuseFcltId)}
className="text-red-500 hover:text-red-700 text-sm font-bold"
aria-label="삭제"
title="삭제"
>
✕
</button>
</td>
</tr>
))}
</tbody>
</>
);
if (data.length === 0) return null;
return (
<div className="fixed right-40 top-[8rem] w-[40rem] max-h-[130rem] overflow-auto bg-white shadow-lg rounded p-4 border border-gray-300 z-50">
<h3 className="bg-cyan-700 text-white text-xl font-bold mb-2 p-2">
선택된 시설
</h3>
<div className="overflow-x-auto">
<table className="w-full text-sm text-gray-800 border border-gray-200">
{TableContent}
</table>
</div>
</div>
);
}
@@ -0,0 +1,94 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import { createPortal } from 'react-dom';
// 현재 문서의 스타일(CSS)을 새 창으로 복사하는 함수
const copyStyles = (sourceDoc: Document, targetDoc: Document) => {
Array.from(sourceDoc.styleSheets).forEach(styleSheet => {
try {
if (styleSheet.cssRules) { // <style> 태그로 주입된 CSS
const newStyleEl = sourceDoc.createElement('style');
Array.from(styleSheet.cssRules).forEach(cssRule => {
newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText));
});
targetDoc.head.appendChild(newStyleEl);
} else if (styleSheet.href) { // <link> 태그로 연결된 CSS 파일
const newLinkEl = sourceDoc.createElement('link');
newLinkEl.rel = 'stylesheet';
newLinkEl.href = styleSheet.href;
targetDoc.head.appendChild(newLinkEl);
}
} catch (e) {
console.warn('스타일시트를 복사할 수 없습니다:', e);
}
});
};
interface NewWindowPortalProps {
children: React.ReactNode;
onClose: () => void;
title?: string;
width?: number;
height?: number;
resizable?: string;
scrollbars?: string;
}
const NewWindowPortal: React.FC<NewWindowPortalProps> = ({ children, onClose, title = "" , width = 900, height = 800, resizable = "yes", scrollbars= "yes" }) => {
const [container, setContainer] = useState<HTMLElement | null>(null);
const newWindowRef = useRef<Window | null>(null);
const onCloseRef = useRef(onClose);
// onClose 함수를 ref로 저장하여 의존성 문제 해결
useEffect(() => {
onCloseRef.current = onClose;
}, [onClose]);
const handleUnload = useCallback(() => {
onCloseRef.current();
}, []);
useEffect(() => {
// 이미 창이 열려있으면 새로 열지 않음
if (newWindowRef.current && !newWindowRef.current.closed) return;
// 1. 새 창을 열고 참조를 저장합니다.
const popupOptions = `width=${width},height=${height},resizable=${resizable},scrollbars=${scrollbars}`;
newWindowRef.current = window.open('', title, popupOptions);
if (newWindowRef.current) {
newWindowRef.current.document.title = title;
// 2. React 컴포넌트를 마운트할 컨테이너 div를 생성하여 새 창의 body에 추가합니다.
const div = newWindowRef.current.document.createElement('div');
newWindowRef.current.document.body.appendChild(div);
setContainer(div);
// 3. 메인 창의 스타일을 새 창으로 복사합니다. (매우 중요)
copyStyles(document, newWindowRef.current.document);
// 4. 사용자가 창을 닫을 때 부모에게 알리기 위한 이벤트 리스너를 설정합니다.
// const handleUnload = () => {
// onClose();
// };
newWindowRef.current.addEventListener('unload', handleUnload);
// 5. 컴포넌트가 사라질 때 창을 닫는 클린업 함수를 반환합니다.
return () => {
if (newWindowRef.current) {
newWindowRef.current.removeEventListener('unload', handleUnload);
if (!newWindowRef.current.closed) {
newWindowRef.current.close();
}
}
};
} else {
alert('팝업이 차단되었습니다. 팝업 차단을 해제하고 다시 시도해주세요.');
onCloseRef.current();
}
}, []);
// `createPortal`을 사용해 children을 새 창의 container div에 렌더링합니다.
return container ? createPortal(children, container) : null;
};
export default NewWindowPortal;
@@ -3,7 +3,6 @@
* 관망도 API * 관망도 API
*/ */
const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map` const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map`
const REUSE_API_URL = `${process.env.NEXT_PUBLIC_REUSE_API_URL}`
export type LyrStngProps = { export type LyrStngProps = {
lyr_sn: string lyr_sn: string
@@ -42,20 +41,6 @@ export const mapService = {
throw new Error(`HTTP error! status: ${response.status}`); throw new Error(`HTTP error! status: ${response.status}`);
} }
return response.json();
},
getPbnstRuseFclts: async (ruseFcltPk:any) => {
const response = await fetch(`${REUSE_API_URL}/reuseFc/pubFc/${ruseFcltPk}`, {
method: 'GET',
headers: {
'Accept': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json(); return response.json();
} }
} }
+2 -1
View File
@@ -1,8 +1,9 @@
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
import path from "path";
const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
const SERVER_API_URL = process.env.NEXT_PUBLIC_DM_SERVER_API_URL || ""; const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL || "";
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || ""; const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
+1
View File
@@ -16,6 +16,7 @@ const getRuseFclt = async (
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/5/A/${sggOrCity ? sggOrCity : "0"}/0/1/SW`; let url = `/prcsFclt/ruseInfo/${page ? page : 1}/5/A/${sggOrCity ? sggOrCity : "0"}/0/1/SW`;
console.log(" checkWrRegListRes ", checkWrRegListRes);
const ruseList = checkWrRegListRes.data.filter((item: string) => item !== ""); const ruseList = checkWrRegListRes.data.filter((item: string) => item !== "");
if (searchTxt) { if (searchTxt) {
@@ -1,76 +1,53 @@
import React, { useCallback, useEffect, useRef, useState } from "react"; import React, { useCallback, useEffect, useRef, useState } from "react";
type SearchType = { type SearchType = {
bscFctNm: string; searchNm: string;
bscFctCd: string; searchPk: string;
}; };
type thisProps = { type thisProps = {
label: string | undefined; label: string | undefined;
initValue: string | undefined; initValue: string | undefined;
setValue: (searchNm?: string) => void; setValue: (searchNm?: string) => void;
setRtnData: (rtnData: any) => void; setRtnData: (rtnData: any) => void;
searchList?: SearchType[]; searchList?: any[];
}; };
export default function SearchInputText({ export default function SearchInputText({
label = undefined, label = undefined,
initValue = undefined, initValue = undefined,
setValue = () => {}, setValue = () => {},
setRtnData = () => {}, setRtnData = () => {},
searchList = [], searchList = undefined,
}: thisProps) { }: thisProps) {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [textValue, setTextValue] = useState(initValue || ""); const [textValue, setTextValue] = useState(initValue || "");
const [highlightIndex, setHighlightIndex] = useState<number>(-1);
const wrapperRef = useRef<HTMLDivElement>(null); const wrapperRef = useRef<HTMLDivElement>(null);
const handleInputChange = useCallback( const handleInputChange = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => { (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value; const value = e.target.value;
setTextValue(value); setTextValue(value);
setValue(value); setValue(value);
setHighlightIndex(-1); if (value && value!=='') {
setIsOpen(value !== ""); setIsOpen(true);
} else {
setIsOpen(false);
}
}, },
[setValue] [setValue]
); );
const handleSuggestionClick = useCallback( const handleSuggestionClick = useCallback(
(searchNm: string) => { (searchNm: string) => {
// Do not update textValue to keep input unchanged on suggestion click
setValue(searchNm); setValue(searchNm);
setTextValue(searchNm);
setIsOpen(false); setIsOpen(false);
setRtnData(searchList?.find((item) => item.bscFctNm === searchNm) || {}); setRtnData(searchList?.find((item) => item.searchNm === searchNm) || {});
}, },
[searchList, setRtnData, setValue] [searchList, setRtnData, setValue]
); );
const handleKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLInputElement>) => {
if (!isOpen || searchList.length === 0) return;
if (e.key === "ArrowDown") {
e.preventDefault();
setHighlightIndex((prev) => (prev + 1) % searchList.length);
} else if (e.key === "ArrowUp") {
e.preventDefault();
setHighlightIndex((prev) =>
prev <= 0 ? searchList.length - 1 : prev - 1
);
} else if (e.key === "Enter") {
e.preventDefault();
if (searchList.length === 1 && searchList[0]) {
handleSuggestionClick(searchList[0].bscFctNm);
} else if (highlightIndex >= 0 && highlightIndex < searchList.length && searchList[highlightIndex]) {
handleSuggestionClick(searchList[highlightIndex].bscFctNm);
}
}
},
[highlightIndex, isOpen, searchList, handleSuggestionClick]
);
useEffect(() => { useEffect(() => {
const handleClickOutside = (event: MouseEvent) => { const handleClickOutside = (event: MouseEvent) => {
if ( if (
@@ -91,39 +68,31 @@ export default function SearchInputText({
<div ref={wrapperRef} className="relative"> <div ref={wrapperRef} className="relative">
<input <input
type="text" type="text"
value={textValue || ""} value={textValue ||''}
onChange={handleInputChange} onChange={handleInputChange}
onKeyDown={handleKeyDown} /* onFocus={() => setIsOpen(true)} */
className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder={`${label}을(를) 입력하세요`} placeholder={`${label}을(를) 입력하세요`}
onClick={() => {
setTextValue("");
setValue("");
setIsOpen(false);
}}
/> />
{isOpen && ( {isOpen && (
<div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg"> <div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg">
<div className="max-h-72"> <div className="max-h-72">
{searchList.length > 0 ? ( {searchList && searchList.length > 0 ? (
searchList.map((item, index) => ( searchList.map((item: SearchType, index: number) => (
<div <div
key={index} key={index}
className={`w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl ${ className="w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl hover:bg-gray-100"
highlightIndex === index onClick={() => handleSuggestionClick(item.searchNm)}
? "bg-blue-100"
: "hover:bg-gray-100"
}`}
onClick={() => handleSuggestionClick(item.bscFctNm)}
role="button" role="button"
tabIndex={0} tabIndex={0}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") { if (e.key === "Enter" || e.key === " ") {
handleSuggestionClick(item.bscFctNm); handleSuggestionClick(item.searchNm);
} }
}} }}
> >
<span className="float-left">{item.bscFctNm}</span> {item.searchPk?.substring(0, 10)}&nbsp;
<span className="float-right">{item.searchNm}</span>
</div> </div>
)) ))
) : ( ) : (
@@ -3,6 +3,7 @@ import { useDmStore } from "@/app/store";
import { import {
SearchDiv, SearchDiv,
SearchFormLeft, SearchFormLeft,
SearchFormRight,
SelectBox, SelectBox,
type SelectDataType, type SelectDataType,
} from "@common/business_components/ui"; } from "@common/business_components/ui";
@@ -12,9 +13,9 @@ import SearchInputText from "../SearchInputText/SearchInputText";
export function SearchBar({ export function SearchBar({
setHasuPk, setHasuPk,
onApply, onApply
}: { }: {
setHasuPk: (hasuPk: any) => void; setHasuPk: (hasuPk: string) => void;
onApply: () => void; onApply: () => void;
}) { }) {
const { map, Common, initializeCommonData, findRuseFclt } = useDmStore( const { map, Common, initializeCommonData, findRuseFclt } = useDmStore(
@@ -25,7 +26,6 @@ export function SearchBar({
const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([ const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([
{ text: "전체", val: "0" }, { text: "전체", val: "0" },
]); ]);
useEffect(() => { useEffect(() => {
initializeCommonData(); initializeCommonData();
}, [initializeCommonData]); }, [initializeCommonData]);
@@ -62,9 +62,9 @@ export function SearchBar({
[initializeSigunData] [initializeSigunData]
); );
// useEffect(() => { useEffect(() => {
// console.log("map.ruseFcltList ", map.ruseFcltList); console.log("map.ruseFcltList ", map.ruseFcltList);
// }, [map.ruseFcltList]); }, [map.ruseFcltList]);
return ( return (
<> <>
@@ -112,7 +112,7 @@ export function SearchBar({
} }
}} }}
setRtnData={(rtnData: any) => { setRtnData={(rtnData: any) => {
setHasuPk(rtnData); setHasuPk(rtnData.bscFctCd || "");
}} }}
searchList={map.ruseFcltList || []} searchList={map.ruseFcltList || []}
/> />
@@ -130,9 +130,7 @@ export function SearchBar({
color="sky" color="sky"
className="mt-2" className="mt-2"
size={"sm"} size={"sm"}
onClick={() => { onClick={() => {onApply();}}
onApply();
}}
> >
적용 적용
</Button> </Button>
@@ -23,11 +23,11 @@ export function AccessibleFormField<T extends FieldValues>({
<FormUi label={labelText}> <FormUi label={labelText}>
<div> <div>
{inputComponent} {inputComponent}
{/* {error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => ( {error?.message && Array.from(new Set(error.message.split('\n'))).map((msg, idx) => (
<p key={idx} className="text-red-500 text-sm mt-1" role="alert"> <p key={idx} className="text-red-500 text-sm mt-1" role="alert">
{msg} {msg}
</p> </p>
))} */} ))}
</div> </div>
</FormUi> </FormUi>
); );
@@ -15,9 +15,11 @@ import { Button } from "@common/components/ui";
import { useSearchParams } from "next/navigation"; import { useSearchParams } from "next/navigation";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { AccessibleFormField } from "./AccessibleFormField"; import { AccessibleFormField } from "./AccessibleFormField";
import type { ControllerRenderProps, UseFormReturn, FieldError } from "react-hook-form"; import type { ControllerRenderProps, UseFormReturn } from "react-hook-form";
import SearchInputText from "../common/searhDemandInput/component"; import SearchInputText from "../common/searhDemandInput/component";
import type { DemandCompType } from "@/app/store/sdmMng"; import type { DemandCompType } from "@/app/store/sdmMng";
import NewWindowPortal from "@/app/(popup-layout)/map/popup/windowPotal";
import Map from "@/app/(popup-layout)/map/popup/sdmInfoMap";
export interface SdmInfoRegFormProps { export interface SdmInfoRegFormProps {
form: UseFormReturn<FormData>; form: UseFormReturn<FormData>;
@@ -45,6 +47,7 @@ export function SdmInfoRegForm({
const [isSimilarCase, setIsSimilarCase] = useState(false); const [isSimilarCase, setIsSimilarCase] = useState(false);
const [key, setKey] = useState(0); const [key, setKey] = useState(0);
// 후보지 팝업 오픈 상태 // 후보지 팝업 오픈 상태
const [isCandidatePopup, setIsCandidatePopup] = useState(false);
//모달 조회에 필요한 데이터 //모달 조회에 필요한 데이터
const [sply, setSply] = useState<number>(0); const [sply, setSply] = useState<number>(0);
@@ -55,9 +58,11 @@ export function SdmInfoRegForm({
initializeCommonData(); initializeCommonData();
}, [initializeCommonData]); }, [initializeCommonData]);
useEffect(() => {
console.log("candidateTitle ", form.getValues("candidateTitle"));
}, [form.getValues("candidateTitle")]); useEffect(() =>{
console.log('candidateTitle ', form.getValues("candidateTitle"))
},[form.getValues("candidateTitle") ])
useEffect(() => { useEffect(() => {
if (useTypesData && useTypesData.length > 0) { if (useTypesData && useTypesData.length > 0) {
setTimeout(() => { setTimeout(() => {
@@ -82,20 +87,17 @@ export function SdmInfoRegForm({
} }
}, [searchParams, form]); }, [searchParams, form]);
const handleCandidateClose = useCallback(
() => setIsCandidatePopup(false),
[]
);
const searchCandidate = (e: React.MouseEvent) => { const searchCandidate = (e: React.MouseEvent) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const dmdInfoId = JSON.parse( //setIsCandidatePopup(true);
sessionStorage.getItem("user") || "{}" const popupOptions = `width=1920,height=1080,resizable='y',scrollbars='y'`;
)?.dmdInfoId?.toString(); window.open("/map/popup", "candidatePopup", popupOptions);
const url = `/map/popup?dmdInfoId=${encodeURIComponent(dmdInfoId)}`;
const width = window.screen.availWidth;
const height = window.screen.availHeight;
const left = 0;
const top = 0;
const popupOptions = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`;
window.open(url, "candidatePopup", popupOptions);
}; };
const searchSimilarCase = (e: React.MouseEvent) => { const searchSimilarCase = (e: React.MouseEvent) => {
@@ -217,24 +219,32 @@ export function SdmInfoRegForm({
formIndex: 0, formIndex: 0,
required: true, required: true,
component: (field) => ( component: (field) => (
<FormUi <AccessibleFormField
onCheckboxChange={handleCheckboxChange} field={field}
isDisabled={isBznmTotNoDisabled} label="희망단가(원/㎥)"
> required={true}
<Input error={form.formState.errors.money}
placeholder="희망단가(원/㎥)을 입력하세요" inputComponent={
type="text" <FormUi
className="!text-xl text-gray-600" onCheckboxChange={handleCheckboxChange}
value={field.value as string} isDisabled={isBznmTotNoDisabled}
onChange={(e) => { >
field.onChange(e); <Input
setMoney(Number(e.target.value)); placeholder="희망단가(원/㎥)을 입력하세요"
}} type="text"
onBlur={field.onBlur} className="!text-xl text-gray-600"
name={field.name} value={field.value as string}
ref={field.ref} onChange={(e) => {
/> field.onChange(e);
</FormUi> setMoney(Number(e.target.value));
}}
onBlur={field.onBlur}
name={field.name}
ref={field.ref}
/>
</FormUi>
}
/>
), ),
}, },
{ {
@@ -474,18 +484,16 @@ export function SdmInfoRegForm({
</Button> </Button>
</div> </div>
<div className="flex justify-center gap-10 mt-5"> <div className="flex justify-center gap-10 mt-5">
{(form.getValues("candidateTitle") || []).map( {(form.getValues("candidateTitle") || []).map((candidate: any, index: number) => (
(candidate: any, index: number) => ( <Input
<Input key={index}
key={index} placeholder={`후보지${index + 1}`}
placeholder={`후보지${index + 1}`} type="text"
type="text" className="!text-xl w-[130px] text-gray-600"
className="!text-xl w-[130px] text-gray-600" value={candidate.ruseUtztnFcltNm}
value={candidate.ruseUtztnFcltNm} readOnly
readOnly />
/> ))}
)
)}
</div> </div>
</div> </div>
), ),
@@ -521,11 +529,7 @@ export function SdmInfoRegForm({
field={field} field={field}
label={label} label={label}
required={required} required={required}
error={ error={form.formState.errors[name]}
typeof form.formState.errors[name]?.message === 'string'
? (form.formState.errors[name] as FieldError)
: undefined
}
inputComponent={component(field)} inputComponent={component(field)}
/> />
) )
@@ -551,11 +555,7 @@ export function SdmInfoRegForm({
field={field} field={field}
label={label} label={label}
required={required} required={required}
error={ error={form.formState.errors[name]}
typeof form.formState.errors[name]?.message === 'string'
? (form.formState.errors[name] as FieldError)
: undefined
}
inputComponent={component?.(field)} inputComponent={component?.(field)}
/> />
)} )}
@@ -580,11 +580,7 @@ export function SdmInfoRegForm({
field={field} field={field}
label={label} label={label}
required={required} required={required}
error={ error={form.formState.errors[name]}
typeof form.formState.errors[name]?.message === 'string'
? (form.formState.errors[name] as FieldError)
: undefined
}
inputComponent={component?.(field)} inputComponent={component?.(field)}
/> />
)} )}
@@ -604,6 +600,7 @@ export function SdmInfoRegForm({
noFooterYn="Y" noFooterYn="Y"
/> />
)} )}
</> </>
); );
} }
@@ -16,6 +16,7 @@ export class LoginApiService implements LoginService {
public async login(payload: ILogin): Promise<void> { public async login(payload: ILogin): Promise<void> {
try { try {
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, { const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
+1 -1
View File
@@ -1,7 +1,7 @@
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "DM"; export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "DM";
export const PORT = process.env.NEXT_PUBLIC_PORT || "3000"; export const PORT = process.env.NEXT_PUBLIC_PORT || "3000";
export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
export const SERVER_API_DM_URL = process.env.NEXT_PUBLIC_DM_SERVER_API_URL ||'http://con.mind-one.co.kr:11035/api/v1'; export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL ||'http://con.mind-one.co.kr:11035/api/v1';
export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1'; export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1';
export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL||' http://con.mind-one.co.kr:11080/api/v1'; export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL||' http://con.mind-one.co.kr:11080/api/v1';
export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000'; export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000';
+1
View File
@@ -2,6 +2,7 @@ NEXT_PUBLIC_SITE_ID = FO
NEXT_PUBLIC_PORT = 11300 NEXT_PUBLIC_PORT = 11300
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
+1
View File
@@ -2,6 +2,7 @@ NEXT_PUBLIC_SITE_ID = FO
NEXT_PUBLIC_PORT = 3000 NEXT_PUBLIC_PORT = 3000
NEXT_PUBLIC_PROXY_HOST = http://localhost:3000 NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
+1
View File
@@ -15,6 +15,7 @@ NEXT_PUBLIC_SITE_ID = FO
NEXT_PUBLIC_PORT = 11300 NEXT_PUBLIC_PORT = 11300
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
@@ -97,10 +97,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()); const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay; const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay;
if(flowPanel === '1') { if(flowPanel === '2'){
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay>0 && infoRnDay < 3;
} else if(flowPanel === '2'){
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 3 && infoRnDay < 10; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 3 && infoRnDay < 10;
} else if(flowPanel === '3'){ } else if(flowPanel === '3'){
@@ -122,8 +119,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60;
} else { } else {
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (rainEffectDay ===1);
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (infoRnDay>0 || rainEffectDay ===1);
} }
}); });
} else if(tabName.includes("_chuncheon")) { } else if(tabName.includes("_chuncheon")) {
@@ -132,8 +128,8 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
const itemDateOnly = new Date(itemDate.getFullYear(), itemDate.getMonth(), itemDate.getDate()); const itemDateOnly = new Date(itemDate.getFullYear(), itemDate.getMonth(), itemDate.getDate());
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()); const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay==0; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && rainEffectDay==0;
}); });
} else { } else {
filteredData = searchList.filter((item) => { filteredData = searchList.filter((item) => {
@@ -144,7 +140,6 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
return itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly; return itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly;
}); });
} }
setCopySearchList(filteredData); setCopySearchList(filteredData);
setStandSearchList(filteredData); setStandSearchList(filteredData);
}, [searchList, searchYear, tabName, flowPanel]); }, [searchList, searchYear, tabName, flowPanel]);
@@ -15,7 +15,6 @@ export default function DrainageEquipment({searchYear = '', fcltyList = []}: Dra
const { const {
Common, Common,
DrainageEquipment, DrainageEquipment,
searchDrainageEquipment,
} = useFoStore((state) => state); } = useFoStore((state) => state);
const { const {
@@ -35,11 +34,10 @@ export default function DrainageEquipment({searchYear = '', fcltyList = []}: Dra
useEffect(() => { useEffect(() => {
if (!isInit && tableData[0]?.bscFctCd && (tableData[0].bscFctCd !== prevFacilityCode || !hasSearched)) { if (!isInit && tableData[0]?.bscFctCd && (tableData[0].bscFctCd !== prevFacilityCode || !hasSearched)) {
searchDrainageEquipment(searchYear, tableData[0].bscFctCd, false);
setHasSearched(true); setHasSearched(true);
setPrevFacilityCode(tableData[0].bscFctCd); setPrevFacilityCode(tableData[0].bscFctCd);
} }
}, [fcltyList, isInit, searchDrainageEquipment, searchYear, tableData, hasSearched, prevFacilityCode]); }, [fcltyList, isInit, searchYear, tableData, hasSearched, prevFacilityCode]);
// 연도가 바뀌면 hasSearched를 false로 리셋 // 연도가 바뀌면 hasSearched를 false로 리셋
useEffect(() => { useEffect(() => {
@@ -5,6 +5,7 @@ import { ContentsDiv, UiModal, UiTable } from "@common/business_components";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import DashBoardChartModal from "./modal/page"; import DashBoardChartModal from "./modal/page";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export type facilityInfoProps = { export type facilityInfoProps = {
searchYear?: string; searchYear?: string;
@@ -56,7 +57,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
PlanFclty, PlanFclty,
OperationStatus, OperationStatus,
searchOperationStatus, searchOperationStatus,
searchPlanInfo searchPlanInfo,
} = useFoStore((state) => state); } = useFoStore((state) => state);
const [modalItem, setModalItem] = useState<{item: string, period: string, title: string, waterQlty: string} | null>(null); const [modalItem, setModalItem] = useState<{item: string, period: string, title: string, waterQlty: string} | null>(null);
@@ -77,13 +78,18 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
const { const {
upHeadListPlanFclty, upHeadListPlanFclty,
planFcltyList, planFcltyList,
planYearList planYearList,
waterUsage1,
waterUsage2,
waterUsage3,
isLoadingPlanFclty
} = PlanFclty; } = PlanFclty;
// 그리드 관련 // 그리드 관련
const { const {
upHeadListOperationStatus, upHeadListOperationStatus,
operationalStatusList operationalStatusList,
isLoadingOperationStatus
} = OperationStatus; } = OperationStatus;
const closeModal = () => { const closeModal = () => {
@@ -147,20 +153,27 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
searchPlanInfo(searchYear, fcltyList[0].bscFctCd); searchPlanInfo(searchYear, fcltyList[0].bscFctCd);
setHasSearched(true); setHasSearched(true);
setPrevFacilityCode(fcltyList[0].bscFctCd); setPrevFacilityCode(fcltyList[0].bscFctCd);
}
}, [isInit, searchOperationStatus, searchYear, fcltyList, hasSearched, prevFacilityCode, searchPlanInfo]);
// waterUsage 값들이 로드된 후에 테이블 데이터 업데이트
useEffect(() => {
if (waterUsage1 !== '' && waterUsage2 !== '' && waterUsage3 !== '') {
planFcltyList.forEach((el: { [key: string]: string | number | boolean }, index) => { planFcltyList.forEach((el: { [key: string]: string | number | boolean }, index) => {
if (index === 6) { if (index === 6) {
el['item'] = (Number(searchYear)-2).toString(); el['item'] = (Number(searchYear)-2).toString();
el['provisionalApproval'] = Number(fcltyList[0]?.fcltyCpc)* 0.6; el['provisionalApproval'] = waterUsage3;
} else if (index === 7) { } else if (index === 7) {
el['item'] = (Number(searchYear)-1).toString(); el['item'] = (Number(searchYear)-1).toString();
el['provisionalApproval'] = Number(fcltyList[0]?.fcltyCpc)* 0.6; el['provisionalApproval'] = waterUsage2;
} else if (index === 8) { } else if (index === 8) {
el['item'] = (Number(searchYear)-0).toString(); el['item'] = (Number(searchYear)-0).toString();
el['provisionalApproval'] = Number(fcltyList[0]?.fcltyCpc)* 0.6; el['provisionalApproval'] = waterUsage1;
} }
}); });
console.log('planFcltyList :', planFcltyList);
} }
}, [isInit, searchOperationStatus, searchYear, fcltyList, hasSearched, prevFacilityCode, searchPlanInfo, planFcltyList]); }, [waterUsage1, waterUsage2, waterUsage3, searchYear, planFcltyList]);
// 연도가 바뀌면 hasSearched를 false로 리셋 // 연도가 바뀌면 hasSearched를 false로 리셋
useEffect(() => { useEffect(() => {
setHasSearched(false); setHasSearched(false);
@@ -190,6 +203,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
<> <>
<UiTable headName={""} tableData={mappedTableData} headlist={upHeadListFclty} pageSize={0} total={0} cellClick={ undefined } onPageChange={() => { } } /> <UiTable headName={""} tableData={mappedTableData} headlist={upHeadListFclty} pageSize={0} total={0} cellClick={ undefined } onPageChange={() => { } } />
<ContentsDiv> <ContentsDiv>
<LoadingOverlay isLoading={isLoadingPlanFclty} />
<div className="grid grid-cols-12 gap-1"> <div className="grid grid-cols-12 gap-1">
<div className="col-span-5"> <div className="col-span-5">
<Table variant="secondary"> <Table variant="secondary">
@@ -211,8 +225,8 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
:(index < 5 || index > 5)&& (index!= 4) && (head.id ==='provisionalApproval'||head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') :(index < 5 || index > 5)&& (index!= 4) && (head.id ==='provisionalApproval'||head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour')
?<TableCell className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell> ?<TableCell className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>
:(head.id === "provisionalApproval" && index === 4) :(head.id === "provisionalApproval" && index === 4)
?<TableCell colSpan={6} className="text-right border border-[var(--border)] text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{(Number(fcltyList[0]?.fcltyCpc)* 0.6).toLocaleString('en-US', { minimumFractionDigits: 1, maximumFractionDigits: 1 })} </TableCell> ?<TableCell colSpan={6} className="text-right border border-[var(--border)] text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{Math.round((Number(waterUsage1)+Number(waterUsage2)+Number(waterUsage3))/3 * 100)/100}</TableCell>
:((head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') && index === 4) :((head.id ==='now'||head.id ==='stepOne'||head.id ==='stepTwo'||head.id ==='stepThree'||head.id ==='stepFour') )
?null ?null
:(head.id === 'item' && index != 5)? :(head.id === 'item' && index != 5)?
<TableCell className="text-center text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell> <TableCell className="text-center text-[rgb(100,119,132)]" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>
@@ -225,39 +239,40 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
</div> </div>
<div className="col-span-7 h-[600px] overflow-x-auto"> <div className="col-span-7 h-[600px] overflow-x-auto">
<div className="w-[200%]"> <div className="w-[200%]">
<Table variant="secondary"> <LoadingOverlay isLoading={isLoadingOperationStatus} />
<TableHeader> <Table variant="secondary">
{upChangeHeadListOperationStatus} <TableHeader>
</TableHeader> {upChangeHeadListOperationStatus}
<TableBody> </TableHeader>
{operationalStatusList.map((el: { [key: string]: string | number | boolean },index) => ( <TableBody>
<TableRow key={index+"row"} > {operationalStatusList.map((el: { [key: string]: string | number | boolean },index) => (
{upHeadListOperationStatus.map((head) => ( <TableRow key={index+"row"} >
(head.id === 'flowRate' && index === 0)?<TableCell rowSpan={5} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: {upHeadListOperationStatus.map((head) => (
(head.id === 'flowRate' && index === 5)?<TableCell rowSpan={6} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: (head.id === 'flowRate' && index === 0)?<TableCell rowSpan={5} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'flowRate' && index === 11)?<TableCell rowSpan={2} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: (head.id === 'flowRate' && index === 5)?<TableCell rowSpan={6} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: (head.id === 'flowRate' && index === 11)?<TableCell rowSpan={2} className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: (head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdi'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: (head.id === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdi'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>: (head.id === 'rdi'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdiRain'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el['rdiRain']}</TableCell>: (head.id === 'rdi'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
(head.id === 'rdiRain'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>: (head.id === 'rdiRain'&&index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el['rdiRain']}</TableCell>:
(head.id === 'waterQlty')?<TableCell className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>: (head.id === 'rdiRain'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}></TableCell>:
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: (head.id === 'waterQlty')?<TableCell className="text-center" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=5 && index<=10))?<TableCell className="bg-green-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=5 && index<=10))?<TableCell className="bg-green-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=0 && index<=4))?<TableCell className="bg-yellow-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'yearAvg' || head.id === 'yearMax' || head.id === 'yearMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-50 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'year', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=5 && index<=10))?<TableCell className="bg-green-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=0 && index<=4))?<TableCell className="bg-yellow-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=11 && index<=12))?<TableCell className="bg-blue-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=5 && index<=10))?<TableCell className="bg-green-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'summerAll' || head.id === 'summerThree' || head.id === 'summerRain') && (index>=11 && index<=12))?<TableCell className="bg-blue-100 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'summer', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=5 && index<=10))?<TableCell className="bg-green-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=0 && index<=4))?<TableCell className="bg-yellow-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('flowRate', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>: ((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=5 && index<=10))?<TableCell className="bg-green-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('waterQlty', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
null ((head.id === 'winterAll' || head.id === 'winterSunnyAvg' || head.id === 'winterSunnyMax' || head.id === 'winterSunnyMin') && (index>=11 && index<=12))?<TableCell className="bg-blue-200 text-right cursor-pointer" style={{ whiteSpace: 'pre-line' }} key={head.id+index} onClick={()=>{fncLoadModal('chongin', 'winter', el['waterQlty'] as string);}}>{el[head.id]}</TableCell>:
))} null
</TableRow> ))}
))} </TableRow>
</TableBody> ))}
</Table> </TableBody>
</Table>
</div> </div>
</div> </div>
</div> </div>
@@ -5,6 +5,7 @@ import { CHART_FORM, type ChartConfig, ContentsDiv, MainChart } from "@common/bu
import { Card, CardContent } from "@common/business_components/ui/chart/lib/card"; import { Card, CardContent } from "@common/business_components/ui/chart/lib/card";
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
type facilityInfoProps = { type facilityInfoProps = {
searchYear?: string; searchYear?: string;
@@ -44,6 +45,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
chart_inflTn, chart_inflTn,
chart_efflTn, chart_efflTn,
chart_inflBod, chart_inflBod,
isLoadingMainGraph,
} = MainGraph; } = MainGraph;
/** /**
@@ -179,6 +181,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili
return ( return (
<> <>
<ContentsDiv> <ContentsDiv>
<LoadingOverlay isLoading={isLoadingMainGraph} />
<ListDiv className="h-[300px]"> <ListDiv className="h-[300px]">
<Card className="h-full"> <Card className="h-full">
<CardContent className="h-full"> <CardContent className="h-full">
+5 -3
View File
@@ -57,8 +57,7 @@ export default function DashBoard() {
/******************선택된 데이터******************/ /******************선택된 데이터******************/
// 연도 // 연도
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0'); const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0');
const [searchYear, setSearchYear] = useState<string>('2023');
// 시설명 // 시설명
const [fcltyList, setFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({ const [fcltyList, setFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({
bscFctCd: '26260PB001R', bscFctCd: '26260PB001R',
@@ -280,8 +279,11 @@ export default function DashBoard() {
trtFrfNm: '표준활성슬러지법, MLE, MBR', trtFrfNm: '표준활성슬러지법, MLE, MBR',
efflWqltStndrdNm: '500톤 이상(Ⅳ지역)' efflWqltStndrdNm: '500톤 이상(Ⅳ지역)'
}); });
setSearchYear('2023'); setSearchYear(selectSearchYear[0]?.val || '0');
searchFcltyList.bscFctNm = '수영'; searchFcltyList.bscFctNm = '수영';
setSidoValue('0');
setSigunValue('0');
} }
const searchVal = () => { const searchVal = () => {
@@ -45,6 +45,7 @@ export default function RainManageTab({searchYear = '', fcltyList = []}: facilit
}, [searchYear]); }, [searchYear]);
return ( return (
<div>
<UiTable <UiTable
headName="" headName=""
tableData={rainManageList} tableData={rainManageList}
@@ -55,5 +56,7 @@ export default function RainManageTab({searchYear = '', fcltyList = []}: facilit
onPageChange={() => {}} onPageChange={() => {}}
> >
</UiTable> </UiTable>
<span className="text-2xl font-bold text-gray-500">☞ 일수에 강우영향일 포함됨</span>
</div>
) )
} }
@@ -5,6 +5,7 @@ import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, Selec
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import PrecipitationModal from "./modal/page"; import PrecipitationModal from "./modal/page";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function FacilityPrecipitation() { export default function FacilityPrecipitation() {
const {Common const {Common
@@ -39,7 +40,8 @@ export default function FacilityPrecipitation() {
upHeadList3, upHeadList3,
excelList, excelList,
facilityPrecipitation, facilityPrecipitation,
facilityPrecipitationCount facilityPrecipitationCount,
isLoading,
} = FacilityPrecipitation; } = FacilityPrecipitation;
const { const {
@@ -81,8 +83,7 @@ export default function FacilityPrecipitation() {
// 시설상태 // 시설상태
const [operationValue, setOperationValue] = useState<string>("0"); const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간 // 조회기간
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
/** /**
* 페이지 함수 * 페이지 함수
@@ -126,9 +127,9 @@ export default function FacilityPrecipitation() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchFacilityPrecipitationList(1, 10, searchYear || "0"); searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchFacilityPrecipitationList, searchYear]); }, [isInit, initializeCommonData, searchFacilityPrecipitationList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -227,6 +228,7 @@ export default function FacilityPrecipitation() {
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 강수현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 강수현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
@@ -66,11 +66,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let maxefflWqltToc = 0; let maxefflWqltToc = 0;
let maxEfflWqltSs = 0; let maxEfflWqltSs = 0;
let maxInflAssctAftWqltBod = 0; let maxinflAssctBfrWqltBod = 0;
let maxInflAssctAftWqltTn = 0; let maxinflAssctBfrWqltTn = 0;
let maxInflAssctBfrWqltTp = 0; let maxInflAssctBfrWqltTp = 0;
let maxInflAssctAftWqltToc = 0; let maxinflAssctBfrWqltToc = 0;
let maxInflAssctAftWqltSs = 0; let maxinflAssctBfrWqltSs = 0;
let maxTpInflWqltBod = 0; let maxTpInflWqltBod = 0;
let maxTpInflWqltTp = 0; let maxTpInflWqltTp = 0;
@@ -83,11 +83,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let minefflWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltToc) : 0; let minefflWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltToc) : 0;
let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0; let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0;
let minInflAssctAftWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltBod) : 0; let mininflAssctBfrWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltBod) : 0;
let minInflAssctAftWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltTn) : 0; let mininflAssctBfrWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTn) : 0;
let minInflAssctBfrWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTp) : 0; let minInflAssctBfrWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTp) : 0;
let minInflAssctAftWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltToc) : 0; let mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0;
let minInflAssctAftWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctAftWqltSs) : 0; let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0;
let minTpInflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltBod) : 0; let minTpInflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltBod) : 0;
let minTpInflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltTp) : 0; let minTpInflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltTp) : 0;
@@ -100,11 +100,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let avgefflWqltToc = 0; let avgefflWqltToc = 0;
let avgEfflWqltSs = 0; let avgEfflWqltSs = 0;
let avgInflAssctAftWqltBod = 0; let avginflAssctBfrWqltBod = 0;
let avgInflAssctAftWqltTn = 0; let avginflAssctBfrWqltTn = 0;
let avgInflAssctBfrWqltTp = 0; let avgInflAssctBfrWqltTp = 0;
let avgInflAssctAftWqltToc = 0; let avginflAssctBfrWqltToc = 0;
let avgInflAssctAftWqltSs = 0; let avginflAssctBfrWqltSs = 0;
let avgTpInflWqltBod = 0; let avgTpInflWqltBod = 0;
let avgTpInflWqltTp = 0; let avgTpInflWqltTp = 0;
@@ -118,11 +118,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
const efflWqltToc = parseNumber(item.efflWqltToc); const efflWqltToc = parseNumber(item.efflWqltToc);
const efflWqltSs = parseNumber(item.efflWqltSs); const efflWqltSs = parseNumber(item.efflWqltSs);
const inflAssctAftWqltBod = parseNumber(item.inflAssctAftWqltBod); const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod);
const inflAssctAftWqltTn = parseNumber(item.inflAssctAftWqltTn); const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn);
const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp); const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp);
const inflAssctAftWqltToc = parseNumber(item.inflAssctAftWqltToc); const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc);
const inflAssctAftWqltSs = parseNumber(item.inflAssctAftWqltSs); const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs);
const tpInflWqltBod = parseNumber(item.tpInflWqltBod); const tpInflWqltBod = parseNumber(item.tpInflWqltBod);
@@ -136,11 +136,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc); maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc);
maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs); maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs);
maxInflAssctAftWqltBod = Math.max(maxInflAssctAftWqltBod, inflAssctAftWqltBod); maxinflAssctBfrWqltBod = Math.max(maxinflAssctBfrWqltBod, inflAssctBfrWqltBod);
maxInflAssctAftWqltTn = Math.max(maxInflAssctAftWqltTn, inflAssctAftWqltTn); maxinflAssctBfrWqltTn = Math.max(maxinflAssctBfrWqltTn, inflAssctBfrWqltTn);
maxInflAssctBfrWqltTp = Math.max(maxInflAssctBfrWqltTp, inflAssctBfrWqltTp); maxInflAssctBfrWqltTp = Math.max(maxInflAssctBfrWqltTp, inflAssctBfrWqltTp);
maxInflAssctAftWqltToc = Math.max(maxInflAssctAftWqltToc, inflAssctAftWqltToc); maxinflAssctBfrWqltToc = Math.max(maxinflAssctBfrWqltToc, inflAssctBfrWqltToc);
maxInflAssctAftWqltSs = Math.max(maxInflAssctAftWqltSs, inflAssctAftWqltSs); maxinflAssctBfrWqltSs = Math.max(maxinflAssctBfrWqltSs, inflAssctBfrWqltSs);
maxTpInflWqltBod = Math.max(maxTpInflWqltBod, tpInflWqltBod); maxTpInflWqltBod = Math.max(maxTpInflWqltBod, tpInflWqltBod);
maxTpInflWqltTp = Math.max(maxTpInflWqltTp, tpInflWqltTp); maxTpInflWqltTp = Math.max(maxTpInflWqltTp, tpInflWqltTp);
@@ -153,11 +153,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
minefflWqltToc = Math.min(minefflWqltToc, efflWqltToc); minefflWqltToc = Math.min(minefflWqltToc, efflWqltToc);
minEfflWqltSs = Math.min(minEfflWqltSs, efflWqltSs); minEfflWqltSs = Math.min(minEfflWqltSs, efflWqltSs);
minInflAssctAftWqltBod = Math.min(minInflAssctAftWqltBod, inflAssctAftWqltBod); mininflAssctBfrWqltBod = Math.min(mininflAssctBfrWqltBod, inflAssctBfrWqltBod);
minInflAssctAftWqltTn = Math.min(minInflAssctAftWqltTn, inflAssctAftWqltTn); mininflAssctBfrWqltTn = Math.min(mininflAssctBfrWqltTn, inflAssctBfrWqltTn);
minInflAssctBfrWqltTp = Math.min(minInflAssctBfrWqltTp, inflAssctBfrWqltTp); minInflAssctBfrWqltTp = Math.min(minInflAssctBfrWqltTp, inflAssctBfrWqltTp);
minInflAssctAftWqltToc = Math.min(minInflAssctAftWqltToc, inflAssctAftWqltToc); mininflAssctBfrWqltToc = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltToc);
minInflAssctAftWqltSs = Math.min(minInflAssctAftWqltSs, inflAssctAftWqltSs); mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs);
minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod); minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod);
minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp); minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp);
@@ -170,11 +170,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
avgefflWqltToc += efflWqltToc; avgefflWqltToc += efflWqltToc;
avgEfflWqltSs += efflWqltSs; avgEfflWqltSs += efflWqltSs;
avgInflAssctAftWqltBod += inflAssctAftWqltBod; avginflAssctBfrWqltBod += inflAssctBfrWqltBod;
avgInflAssctAftWqltTn += inflAssctAftWqltTn; avginflAssctBfrWqltTn += inflAssctBfrWqltTn;
avgInflAssctBfrWqltTp += inflAssctBfrWqltTp; avgInflAssctBfrWqltTp += inflAssctBfrWqltTp;
avgInflAssctAftWqltToc += inflAssctAftWqltToc; avginflAssctBfrWqltToc += inflAssctBfrWqltToc;
avgInflAssctAftWqltSs += inflAssctAftWqltSs; avginflAssctBfrWqltSs += inflAssctBfrWqltSs;
avgTpInflWqltBod += tpInflWqltBod; avgTpInflWqltBod += tpInflWqltBod;
avgTpInflWqltTp += tpInflWqltTp; avgTpInflWqltTp += tpInflWqltTp;
@@ -190,11 +190,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
efflWqltSs: filteredData.length==0?'0.0':(Math.round(avgEfflWqltSs / 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), 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), efflWqltTp: filteredData.length==0?'0.000':(Math.round(avgEfflWqltTp / filteredData.length * 1000) / 1000).toFixed(3),
inflAssctAftWqltBod: filteredData.length==0?'0.0':(Math.round(avgInflAssctAftWqltBod / filteredData.length * 10) / 10).toFixed(1), inflAssctBfrWqltBod: filteredData.length==0?'0.0':(Math.round(avginflAssctBfrWqltBod / filteredData.length * 10) / 10).toFixed(1),
inflAssctAftWqltTn: filteredData.length==0?'0.000':(Math.round(avgInflAssctAftWqltTn / filteredData.length * 1000) / 1000).toFixed(3), inflAssctBfrWqltTn: filteredData.length==0?'0.000':(Math.round(avginflAssctBfrWqltTn / filteredData.length * 1000) / 1000).toFixed(3),
inflAssctBfrWqltTp: filteredData.length==0?'0.000':(Math.round(avgInflAssctBfrWqltTp / filteredData.length * 1000) / 1000).toFixed(3), inflAssctBfrWqltTp: filteredData.length==0?'0.000':(Math.round(avgInflAssctBfrWqltTp / filteredData.length * 1000) / 1000).toFixed(3),
inflAssctAftWqltToc: filteredData.length==0?'0.0':(Math.round(avgInflAssctAftWqltToc / filteredData.length * 10) / 10).toFixed(1), inflAssctBfrWqltToc: filteredData.length==0?'0.0':(Math.round(avginflAssctBfrWqltToc / filteredData.length * 10) / 10).toFixed(1),
inflAssctAftWqltSs: filteredData.length==0?'0.0':(Math.round(avgInflAssctAftWqltSs / filteredData.length * 10) / 10).toFixed(1), inflAssctBfrWqltSs: filteredData.length==0?'0.0':(Math.round(avginflAssctBfrWqltSs / filteredData.length * 10) / 10).toFixed(1),
bscFctCd: "", bscFctCd: "",
bscFctNm: "", bscFctNm: "",
lclgvrnmntNm: "", lclgvrnmntNm: "",
@@ -213,11 +213,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
efflWqltSs : Math.round(maxEfflWqltSs * 10) / 10?(Math.round(maxEfflWqltSs * 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', 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', efflWqltTp : Math.round(maxEfflWqltTp * 1000) / 1000?(Math.round(maxEfflWqltTp * 1000) / 1000).toFixed(3):'0.000',
inflAssctAftWqltBod : Math.round(maxInflAssctAftWqltBod * 10) / 10?(Math.round(maxInflAssctAftWqltBod * 10) / 10).toFixed(1):'0.0', inflAssctBfrWqltBod : Math.round(maxinflAssctBfrWqltBod * 10) / 10?(Math.round(maxinflAssctBfrWqltBod * 10) / 10).toFixed(1):'0.0',
inflAssctAftWqltTn : Math.round(maxInflAssctAftWqltTn * 1000) / 1000?(Math.round(maxInflAssctAftWqltTn * 1000) / 1000).toFixed(3):'0.000', inflAssctBfrWqltTn : Math.round(maxinflAssctBfrWqltTn * 1000) / 1000?(Math.round(maxinflAssctBfrWqltTn * 1000) / 1000).toFixed(3):'0.000',
inflAssctBfrWqltTp : Math.round(maxInflAssctBfrWqltTp * 1000) / 1000?(Math.round(maxInflAssctBfrWqltTp * 1000) / 1000).toFixed(3):'0.000', inflAssctBfrWqltTp : Math.round(maxInflAssctBfrWqltTp * 1000) / 1000?(Math.round(maxInflAssctBfrWqltTp * 1000) / 1000).toFixed(3):'0.000',
inflAssctAftWqltToc : Math.round(maxInflAssctAftWqltToc * 10) / 10?(Math.round(maxInflAssctAftWqltToc * 10) / 10).toFixed(1):'0.0', inflAssctBfrWqltToc : Math.round(maxinflAssctBfrWqltToc * 10) / 10?(Math.round(maxinflAssctBfrWqltToc * 10) / 10).toFixed(1):'0.0',
inflAssctAftWqltSs : Math.round(maxInflAssctAftWqltSs * 10) / 10?(Math.round(maxInflAssctAftWqltSs * 10) / 10).toFixed(1):'0.0', inflAssctBfrWqltSs : Math.round(maxinflAssctBfrWqltSs * 10) / 10?(Math.round(maxinflAssctBfrWqltSs * 10) / 10).toFixed(1):'0.0',
bscFctCd: "", bscFctCd: "",
bscFctNm: "", bscFctNm: "",
lclgvrnmntNm: "", lclgvrnmntNm: "",
@@ -236,11 +236,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
efflWqltSs : Math.round(minEfflWqltSs * 10) / 10?(Math.round(minEfflWqltSs * 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', 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', efflWqltTp : Math.round(minEfflWqltTp * 1000) / 1000?(Math.round(minEfflWqltTp * 1000) / 1000).toFixed(3) : '0.000',
inflAssctAftWqltBod : Math.round(minInflAssctAftWqltBod * 10) / 10?(Math.round(minInflAssctAftWqltBod * 10) / 10).toFixed(1) : '0.0', inflAssctBfrWqltBod : Math.round(mininflAssctBfrWqltBod * 10) / 10?(Math.round(mininflAssctBfrWqltBod * 10) / 10).toFixed(1) : '0.0',
inflAssctAftWqltTn : Math.round(minInflAssctAftWqltTn * 1000) / 1000?(Math.round(minInflAssctAftWqltTn * 1000) / 1000).toFixed(3) : '0.000', inflAssctBfrWqltTn : Math.round(mininflAssctBfrWqltTn * 1000) / 1000?(Math.round(mininflAssctBfrWqltTn * 1000) / 1000).toFixed(3) : '0.000',
inflAssctBfrWqltTp : Math.round(minInflAssctBfrWqltTp * 1000) / 1000?(Math.round(minInflAssctBfrWqltTp * 1000) / 1000).toFixed(3) : '0.000', inflAssctBfrWqltTp : Math.round(minInflAssctBfrWqltTp * 1000) / 1000?(Math.round(minInflAssctBfrWqltTp * 1000) / 1000).toFixed(3) : '0.000',
inflAssctAftWqltToc : Math.round(minInflAssctAftWqltToc * 10) / 10?(Math.round(minInflAssctAftWqltToc * 10) / 10).toFixed(1) : '0.0', inflAssctBfrWqltToc : Math.round(mininflAssctBfrWqltToc * 10) / 10?(Math.round(mininflAssctBfrWqltToc * 10) / 10).toFixed(1) : '0.0',
inflAssctAftWqltSs : Math.round(minInflAssctAftWqltSs * 10) / 10?(Math.round(minInflAssctAftWqltSs * 10) / 10).toFixed(1) : '0.0', inflAssctBfrWqltSs : Math.round(mininflAssctBfrWqltSs * 10) / 10?(Math.round(mininflAssctBfrWqltSs * 10) / 10).toFixed(1) : '0.0',
bscFctCd: "", bscFctCd: "",
bscFctNm: "", bscFctNm: "",
lclgvrnmntNm: "", lclgvrnmntNm: "",
@@ -293,10 +293,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
copyYearList.forEach((item) => { copyYearList.forEach((item) => {
excelDownList.push({ excelDownList.push({
날짜: item.msrDt, 날짜: item.msrDt,
"유입BOD(mg/L)": item.inflAssctAftWqltBod, "유입BOD(mg/L)": item.inflAssctBfrWqltBod,
"유입TOC(COD)(mg/L)": item.inflAssctAftWqltToc, "유입TOC(COD)(mg/L)": item.inflAssctBfrWqltToc,
"유입SS(mg/L)": item.inflAssctAftWqltSs, "유입SS(mg/L)": item.inflAssctBfrWqltSs,
"유입TN(mg/L)": item.inflAssctAftWqltTn, "유입TN(mg/L)": item.inflAssctBfrWqltTn,
"유입TP(mg/L)": item.inflAssctBfrWqltTp, "유입TP(mg/L)": item.inflAssctBfrWqltTp,
"유출BOD(mg/L)": item.efflWqltBod, "유출BOD(mg/L)": item.efflWqltBod,
"유출TOC(COD)(mg/L)": item.efflWqltToc, "유출TOC(COD)(mg/L)": item.efflWqltToc,
+6 -4
View File
@@ -7,6 +7,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import WaterQualityModal from "./modal/page"; import WaterQualityModal from "./modal/page";
import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty"; import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function ProcessFacilitySearch() { export default function ProcessFacilitySearch() {
const { Common const { Common
@@ -36,7 +37,8 @@ export default function ProcessFacilitySearch() {
upHeadList3, upHeadList3,
facilityWaterQltyList, facilityWaterQltyList,
facilityWaterQltyCount, facilityWaterQltyCount,
excelList excelList,
isLoading,
} = FacilityWaterQltyMain; } = FacilityWaterQltyMain;
const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || []; const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || [];
@@ -48,8 +50,7 @@ export default function ProcessFacilitySearch() {
const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1); const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1);
const [fcltyName, setFcltyName] = useState<string>(""); const [fcltyName, setFcltyName] = useState<string>("");
const [operationValue, setOperationValue] = useState<string>("0"); const [operationValue, setOperationValue] = useState<string>("0");
//const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYearValue, setSearchYearValue] = useState<string>("2023");
const [fcltCpct, setFcltCpct] = useState<string>("0"); const [fcltCpct, setFcltCpct] = useState<string>("0");
// 모달 상태 추가 // 모달 상태 추가
@@ -133,7 +134,7 @@ export default function ProcessFacilitySearch() {
initializeCommonData(); initializeCommonData();
searchFacilityWaterQltyList(1, 10, selectSearchYear[0]?.val || "0"); searchFacilityWaterQltyList(1, 10, selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchFacilityWaterQltyList, selectSearchYear]); }, [isInit, initializeCommonData, searchFacilityWaterQltyList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -187,6 +188,7 @@ export default function ProcessFacilitySearch() {
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 수질현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total<10?facilityWaterQltyList.length:total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 수질현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total<10?facilityWaterQltyList.length:total} resetPageNo={resetPage} onPageChange={handlePageChange} />
@@ -52,7 +52,6 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
return Number(value.replace(/,/g, '')); return Number(value.replace(/,/g, ''));
}; };
console.log('filteredData : ', filteredData);
let maxtotInflAmnt = 0; let maxtotInflAmnt = 0;
let maxinflAmnt = 0; let maxinflAmnt = 0;
let maxsumFlow = 0; let maxsumFlow = 0;
+8 -7
View File
@@ -6,6 +6,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import FlowRateModal from "./modal/page"; import FlowRateModal from "./modal/page";
import type { ExcelType } from "@/app/store/flowRate"; import type { ExcelType } from "@/app/store/flowRate";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function ProcessFacilitySearch() { export default function ProcessFacilitySearch() {
const {Common const {Common
@@ -42,15 +43,15 @@ export default function ProcessFacilitySearch() {
upHeadList3, upHeadList3,
flowRateList, flowRateList,
flowRateCount, flowRateCount,
excelList excelList,
isLoading,
} = FlowRateList; } = FlowRateList;
// 입력값 상태 관리 // 입력값 상태 관리
const [fcltCpct, setFcltCpct] = useState<string>("0"); const [fcltCpct, setFcltCpct] = useState<string>("0");
const [fcltyName, setFcltyName] = useState<string>(""); const [fcltyName, setFcltyName] = useState<string>("");
const [operationValue, setOperationValue] = useState<string>("0"); const [operationValue, setOperationValue] = useState<string>("0");
//const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYearValue, setSearchYearValue] = useState<string>("2023");
const [widthSize, setWidthSize] = useState<string>("w-[120%]"); const [widthSize, setWidthSize] = useState<string>("w-[120%]");
const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1); const [upheadList, setUpheadList] = useState<TableUpperProps[]>(upHeadList1);
const [resetPage, setResetPage] = useState<boolean>(false); const [resetPage, setResetPage] = useState<boolean>(false);
@@ -89,9 +90,9 @@ export default function ProcessFacilitySearch() {
setWidthSize("w-[120%]"); setWidthSize("w-[120%]");
setUpheadList(upHeadList1) setUpheadList(upHeadList1)
// 상태값 설정 // 상태값 설정
setSearchYearValue(selectSearchYear[0]?.val || "0");
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
setSearchYearValue(selectSearchYear[0]?.val || "0");
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -126,11 +127,10 @@ export default function ProcessFacilitySearch() {
// 시도 데이터 초기화 // 시도 데이터 초기화
useEffect(() => { useEffect(() => {
if(!isInit) { if(!isInit) {
console.log('searchYearValue', searchYearValue, isInit);
initializeCommonData(); initializeCommonData();
searchFlowRateList(1, 10, searchYearValue || "0"); searchFlowRateList(1, 10, selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchFlowRateList, searchYearValue]); }, [isInit, initializeCommonData, searchFlowRateList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -189,6 +189,7 @@ export default function ProcessFacilitySearch() {
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 유량현황"} tableData={flowRateList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 유량현황"} tableData={flowRateList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
+8 -5
View File
@@ -4,6 +4,7 @@ import type { TableUpperProps } from "@/app/store/common";
import { downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components"; import { downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function PlanSewage() { export default function PlanSewage() {
const {Common const {Common
@@ -37,7 +38,8 @@ export default function PlanSewage() {
upHeadList3, upHeadList3,
planSewageList, planSewageList,
planSewageCount, planSewageCount,
excelList excelList,
isLoading,
} = PlanSewage; } = PlanSewage;
const ref = useRef<ReturnType>({ const ref = useRef<ReturnType>({
@@ -70,8 +72,7 @@ export default function PlanSewage() {
// 시설상태 // 시설상태
const [operationValue, setOperationValue] = useState<string>("0"); const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간 // 조회기간
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
/** /**
* 페이지 함수 * 페이지 함수
@@ -92,6 +93,7 @@ export default function PlanSewage() {
input.value = ""; input.value = "";
} }
} }
searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
} }
/** /**
@@ -100,9 +102,9 @@ export default function PlanSewage() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchPlanSewageList(1, 10, searchYear, ref.current.partValue); searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue);
} }
}, [isInit, initializeCommonData, searchYear, searchPlanSewageList]); }, [isInit, initializeCommonData, searchPlanSewageList]);
useEffect(() => { useEffect(() => {
console.log('excelList' , excelList); console.log('excelList' , excelList);
@@ -187,6 +189,7 @@ export default function PlanSewage() {
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false}/> ref={ref} isAdmin={false}/>
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={ undefined } headName={"계획하수량 산정지표 현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={ undefined } headName={"계획하수량 산정지표 현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
+7 -4
View File
@@ -4,6 +4,7 @@ import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SelectBox, Title,
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import ProcessFacilityInfoModal from "./modal/page"; import ProcessFacilityInfoModal from "./modal/page";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function ProcessArea() { export default function ProcessArea() {
const {Common, const {Common,
@@ -39,7 +40,8 @@ export default function ProcessArea() {
upHeadList1, upHeadList1,
processAreaList, processAreaList,
processAreaCount, processAreaCount,
excelList excelList,
isLoading,
} = ProcessArea; } = ProcessArea;
const mainList: Record<string, unknown>[] = processAreaList || []; const mainList: Record<string, unknown>[] = processAreaList || [];
@@ -84,7 +86,7 @@ export default function ProcessArea() {
} }
} }
setSearchYearValue(selectSearchYear[0]?.val || "0"); setSearchYearValue(selectSearchYear[0]?.val || "0");
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val); searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0");
} }
// 셀 클릭 시 모달 표시 // 셀 클릭 시 모달 표시
@@ -104,9 +106,9 @@ export default function ProcessArea() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val); searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchProcessAreaList, selectSearchYear]); }, [isInit, initializeCommonData, searchProcessAreaList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -152,6 +154,7 @@ export default function ProcessArea() {
isAdmin={true} isAdmin={true}
/> />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className="w-[180%]"> <div className="w-[180%]">
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList} headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList} headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
+4 -1
View File
@@ -5,6 +5,7 @@ import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, Selec
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import ProcessFacilityInfoModal from "./modal/page"; import ProcessFacilityInfoModal from "./modal/page";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function ProcessFacilitySearch() { export default function ProcessFacilitySearch() {
const {Common const {Common
@@ -63,7 +64,8 @@ export default function ProcessFacilitySearch() {
upHeadList1, upHeadList1,
upHeadList2, upHeadList2,
upHeadList3, upHeadList3,
excelList excelList,
isLoading,
} = ProcessFacilityList; } = ProcessFacilityList;
const processFacilityList = ProcessFacilityList?.processFacilityList || []; const processFacilityList = ProcessFacilityList?.processFacilityList || [];
@@ -262,6 +264,7 @@ export default function ProcessFacilitySearch() {
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable <UiTable
+8 -2
View File
@@ -4,6 +4,7 @@ import type { TableUpperProps } from "@/app/store/common";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function Rdi() { export default function Rdi() {
const {Common const {Common
@@ -38,6 +39,7 @@ export default function Rdi() {
rdiList, rdiList,
rdiCount, rdiCount,
excelList, excelList,
isLoading,
} = Rdi; } = Rdi;
const ref = useRef<ReturnType>({ const ref = useRef<ReturnType>({
@@ -70,6 +72,10 @@ export default function Rdi() {
// 조회기간 // 조회기간
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
useEffect(() => {
console.log(isLoading);
}, [isLoading]);
/** /**
* 페이지 함수 * 페이지 함수
*/ */
@@ -91,7 +97,6 @@ export default function Rdi() {
} }
} }
searchRdiList(1, 10, selectSearchYear[0]?.val || "0"); searchRdiList(1, 10, selectSearchYear[0]?.val || "0");
} }
/** /**
@@ -102,7 +107,7 @@ export default function Rdi() {
initializeCommonData(); initializeCommonData();
searchRdiList(1, 10, selectSearchYear[0]?.val || "0"); searchRdiList(1, 10, selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchRdiList, selectSearchYear]); }, [isInit, initializeCommonData, searchRdiList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -187,6 +192,7 @@ export default function Rdi() {
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={ undefined } headName={"RDII추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={ undefined } headName={"RDII추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
@@ -30,6 +30,11 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
setDetailList(gridListSewageOccurDetail); setDetailList(gridListSewageOccurDetail);
}, [gridListSewageOccurDetail]); }, [gridListSewageOccurDetail]);
useEffect(() => {
searchSewageOccurDetailList(props.facilityCd, validSearchYear, startYearMonth, endYearMonth);
}, [startYearMonth, endYearMonth]);
return ( return (
<> <>
<ListDiv className="!h-[80px] !mt-10"> <ListDiv className="!h-[80px] !mt-10">
@@ -57,6 +62,7 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={1900} startYear={1900}
yearReadOnly={true}
/>~ />~
<DateMonthPicker <DateMonthPicker
field={{ field={{
@@ -74,6 +80,7 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={1900} startYear={1900}
yearReadOnly={true}
/> />
</TableCell> </TableCell>
</TableRow> </TableRow>
+8 -5
View File
@@ -6,6 +6,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import SewageOccurModal from "./modal/page"; import SewageOccurModal from "./modal/page";
import type { SewageOccurProps } from "@/app/store/sewageOccur"; import type { SewageOccurProps } from "@/app/store/sewageOccur";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function PlanSewage() { export default function PlanSewage() {
const {Common const {Common
@@ -46,7 +47,8 @@ export default function PlanSewage() {
upHeadList3, upHeadList3,
sewageOccurList, sewageOccurList,
sewageOccurCount, sewageOccurCount,
excelList excelList,
isLoading,
} = SewageOccur; } = SewageOccur;
const ref = useRef<ReturnType>({ const ref = useRef<ReturnType>({
@@ -84,8 +86,7 @@ export default function PlanSewage() {
// 시설상태 // 시설상태
const [operationValue, setOperationValue] = useState<string>("0"); const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간 // 조회기간
// const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
/** /**
* 페이지 함수 * 페이지 함수
@@ -106,6 +107,7 @@ export default function PlanSewage() {
input.value = ""; input.value = "";
} }
} }
searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0");
} }
// 모달 닫기 // 모달 닫기
@@ -128,9 +130,9 @@ export default function PlanSewage() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchSewageOccurList(1, 10, searchYear || "0"); searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchSewageOccurList, searchYear]); }, [isInit, initializeCommonData, searchSewageOccurList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -217,6 +219,7 @@ export default function PlanSewage() {
isAdmin={false} isAdmin={false}
/> />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"오수발생량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"오수발생량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
@@ -116,7 +116,6 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
} }
}, [searchYear, tabTerm]); }, [searchYear, tabTerm]);
useEffect(()=>{ useEffect(()=>{
console.log(fcltyName, searchYear);
unserWaterModal(fcltyName, searchYear); unserWaterModal(fcltyName, searchYear);
}, []) }, [])
useEffect(() => { useEffect(() => {
@@ -164,6 +163,7 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={Number(searchYear)} // 시작 연도 설정 startYear={Number(searchYear)} // 시작 연도 설정
yearReadOnly={true}
/> />
<h3 className="justify-center px-5">~</h3> <h3 className="justify-center px-5">~</h3>
<DateMonthPicker <DateMonthPicker
@@ -175,6 +175,7 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={Number(searchYear)} // 시작 연도 설정 startYear={Number(searchYear)} // 시작 연도 설정
yearReadOnly={true}
/> />
</div> </div>
</TableCell> </TableCell>
@@ -227,6 +228,8 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={Number(searchYear)} // 시작 연도 설정 startYear={Number(searchYear)} // 시작 연도 설정
yearReadOnly={true}
enableMonth={['6월', '7월', '8월']}
/> />
<h3 className="justify-center px-5">~</h3> <h3 className="justify-center px-5">~</h3>
<DateMonthPicker <DateMonthPicker
@@ -238,6 +241,8 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={Number(searchYear)} // 시작 연도 설정 startYear={Number(searchYear)} // 시작 연도 설정
yearReadOnly={true}
enableMonth={['6월', '7월', '8월']}
/> />
</div> </div>
</TableCell> </TableCell>
@@ -281,6 +286,8 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={Number(searchYear)} // 시작 연도 설정 startYear={Number(searchYear)} // 시작 연도 설정
yearReadOnly={true}
enableMonth={['1월', '2월']}
/> />
<h3 className="justify-center px-5">~</h3> <h3 className="justify-center px-5">~</h3>
<DateMonthPicker <DateMonthPicker
@@ -292,6 +299,8 @@ export default function UnderWaterInputModal({fcltyName='', searchYear=new Date(
}} }}
selectClass="ml-5 w-[100px]" selectClass="ml-5 w-[100px]"
startYear={Number(searchYear)} // 시작 연도 설정 startYear={Number(searchYear)} // 시작 연도 설정
yearReadOnly={true}
enableMonth={['1월', '2월']}
/> />
</div> </div>
</TableCell> </TableCell>
+5 -3
View File
@@ -6,6 +6,7 @@ import ListDiv from "@common/business_components/ui/list_div";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import UnderWaterInputModal from "./modal/page"; import UnderWaterInputModal from "./modal/page";
import type { UnderWaterProps } from "@/app/store/underWaterInput/types"; import type { UnderWaterProps } from "@/app/store/underWaterInput/types";
import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function UnderWaterInput() { export default function UnderWaterInput() {
const {Common const {Common
@@ -46,6 +47,7 @@ export default function UnderWaterInput() {
underWaterList, underWaterList,
underWaterCount, underWaterCount,
excelList, excelList,
isLoading,
} = UnderWater; } = UnderWater;
const ref = useRef<ReturnType>({ const ref = useRef<ReturnType>({
@@ -82,8 +84,7 @@ export default function UnderWaterInput() {
// 시설상태 // 시설상태
const [operationValue, setOperationValue] = useState<string>("0"); const [operationValue, setOperationValue] = useState<string>("0");
// 조회기간 // 조회기간
//const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || "0");
const [searchYear, setSearchYear] = useState<string>("2023");
/** /**
* 페이지 함수 * 페이지 함수
@@ -128,7 +129,7 @@ export default function UnderWaterInput() {
initializeCommonData(); initializeCommonData();
searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0"); searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0");
} }
}, [isInit, initializeCommonData, searchUnderWaterList, selectSearchYear]); }, [isInit, initializeCommonData, searchUnderWaterList]);
useEffect(() => { useEffect(() => {
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
@@ -215,6 +216,7 @@ export default function UnderWaterInput() {
isAdmin={false} isAdmin={false}
/> />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll"> <div className="h-full w-full overflow-x-scroll">
<div className={widthSize}> <div className={widthSize}>
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
+23 -1
View File
@@ -2,7 +2,7 @@
* 보편적으로 쓰는 store 공간 * 보편적으로 쓰는 store 공간
====================================**/ ====================================**/
import { getFetch } from "@/app/components/api"; import { getFetch, getFetchAreaList } from "@/app/components/api";
/** /**
* STORE - TYPE * STORE - TYPE
@@ -205,6 +205,28 @@ const selectMiddleRegionData: SelectDataType[] = [
* STORE - API * STORE - API
*/ */
// 처리시설 계획정보 호출 (알에스원)
export const planInfoUrl = 'https://apigateway.apps.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy';
export const fetchPlanInfo = async (targetYear : string | undefined, ctpvNm : string | undefined, sggNm : string | undefined, fcltyCd : string | undefined) => {
try {
const baseUrl = planInfoUrl;
const queryParams = new URLSearchParams();
if (ctpvNm && ctpvNm !== '전체') queryParams.append('ctpvNm', ctpvNm);
if (sggNm && sggNm !== '전체') queryParams.append('sggNm', sggNm);
if (targetYear) queryParams.append('targetYear',targetYear);
if (fcltyCd) queryParams.append('swtrmtFcltCd', fcltyCd);
const queryString = queryParams.toString();
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
const res = await getFetchAreaList(url);
return res;
} catch (error) {
console.error('처리시설 계획정보를 가져오는데 실패했습니다:', error);
return [];
}
}
// 시도 API 호출 함수 추가 // 시도 API 호출 함수 추가
const fetchSidoData = async (): Promise<SelectDataType[]> => { const fetchSidoData = async (): Promise<SelectDataType[]> => {
try { try {
+392 -283
View File
@@ -2,9 +2,11 @@
* Store - 타입 * Store - 타입
*/ */
import { getFetch, getFetchAreaList } from "@/app/components/api"; import { getFetch } from "@/app/components/api";
import DataForm from "@/app/components/common/DataForm"; import DataForm from "@/app/components/common/DataForm";
import { fetchPlanInfo } from "../common";
import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty";
import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput";
// selectBox // selectBox
export type SelectDataType = { export type SelectDataType = {
@@ -111,13 +113,13 @@ export interface RainManageListProps {
sggNm?: string, sggNm?: string,
addr?: string, addr?: string,
fctCpc?: number, fctCpc?: number,
inflAssctAftWqltBod: number | '', inflAssctBfrWqltBod: number | '',
inflAssctAftWqltToc: number | '', inflAssctBfrWqltToc: number | '',
inflAssctAftWqltSs: number | '', inflAssctBfrWqltSs: number | '',
inflAssctAftWqltTn: number | '', inflAssctBfrWqltTn: number | '',
inflAssctAftWqltTp: number | '', inflAssctBfrWqltTp: number | '',
efflWqltBod: number | '', efflWqltBod: number | '',
efflWqltCod: number | '', efflWqltToc: number | '',
efflWqltSs: number | '', efflWqltSs: number | '',
efflWqltTn: number | '', efflWqltTn: number | '',
efflWqltTp: number | '', efflWqltTp: number | '',
@@ -143,6 +145,7 @@ export interface RainManageListProps {
dsInflWqltTn: number | '', dsInflWqltTn: number | '',
dsInflWqltTp: number | '', dsInflWqltTp: number | '',
extnsSeqno?: number | '', extnsSeqno?: number | '',
rainEffectDay?: number | '',
} }
export interface RainManageExcelType { export interface RainManageExcelType {
@@ -364,14 +367,14 @@ const upHeadListRainManage : TableUpperProps[] = [
{ id: "dsInflWqltTn", title: "T-N", row:1 }, { id: "dsInflWqltTn", title: "T-N", row:1 },
{ id: "dsInflWqltTp", title: "T-P", row:1 }, { id: "dsInflWqltTp", title: "T-P", row:1 },
{ id: "C", title: "유입수질(㎎/L)", row:0, colSpan:5 }, { id: "C", title: "유입수질(㎎/L)", row:0, colSpan:5 },
{ id: "inflAssctAftWqltBod", title: "BOD", row:1 }, { id: "inflAssctBfrWqltBod", title: "BOD", row:1 },
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)", row:1 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)", row:1 },
{ id: "inflAssctAftWqltSs", title: "SS", row:1 }, { id: "inflAssctBfrWqltSs", title: "SS", row:1 },
{ id: "inflAssctAftWqltTn", title: "T-N", row:1 }, { id: "inflAssctBfrWqltTn", title: "T-N", row:1 },
{ id: "inflAssctAftWqltTp", title: "T-P", row:1 }, { id: "inflAssctBfrWqltTp", title: "T-P", row:1 },
{ id: "D", title: "방류수질(㎎/L)", row:0, colSpan:5 }, { id: "D", title: "방류수질(㎎/L)", row:0, colSpan:5 },
{ id: "efflWqltBod", title: "BOD", row:1 }, { id: "efflWqltBod", title: "BOD", row:1 },
{ id: "efflWqltCod", title: "TOC\n(COD)", row:1 }, { id: "efflWqltToc", title: "TOC\n(COD)", row:1 },
{ id: "efflWqltSs", title: "SS", row:1 }, { id: "efflWqltSs", title: "SS", row:1 },
{ id: "efflWqltTn", title: "T-N", row:1 }, { id: "efflWqltTn", title: "T-N", row:1 },
{ id: "efflWqltTp", title: "T-P", row:1 }, { id: "efflWqltTp", title: "T-P", row:1 },
@@ -687,20 +690,20 @@ const drainageEquipmentList : DrainageEquipmentListProps[] = [
* Store - api (데이터 호출) * Store - api (데이터 호출)
====================================*/ ====================================*/
/* 시설정보 및 운영현황 - 계획 */ /* 시설정보 및 운영현황 - 계획 */
const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : string | undefined) => { const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : string | undefined, set : (fn: (state: DashBoardType) => DashBoardType) => void) => {
try { try {
targetYear = targetYear ? targetYear : "2023"; const res = await fetchPlanInfo(undefined, undefined, undefined, fcltyCd);
const baseUrl = 'https://apigateway.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy'; return res;
const queryParams = new URLSearchParams();
if (fcltyCd) queryParams.append('swtrmtFcltCd', fcltyCd);
//if (targetYear) queryParams.append('targetYear',targetYear);
const queryString = queryParams.toString();
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
const res = await getFetchAreaList(url);
return res
} catch (error) { } catch (error) {
console.error('시설계획정보를 가져오는데 실패했습니다:', error); console.error('시설계획정보를 가져오는데 실패했습니다:', error);
set((state) => ({
...state,
PlanFclty : {
...state.PlanFclty,
isLoadingPlanFclty : false,
isLoadingOperationStatus : false
}
}));
return {data: [], count: 0}; return {data: [], count: 0};
} }
}; };
@@ -729,20 +732,6 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde
} }
} }
// 배수설비 정비현황
const fetchDrainageEquipment = async (searchYear: string|undefined, fcltyCd: string|undefined) => {
try{
/* const url = '/fclt/qlty/hist/' + (searchYear?searchYear:'2024') + '/' + (fcltyCd?fcltyCd:'11680PB001R');
const res = await getFetch('fo', url);
return { data: res.data, count: res.count } */
console.log(searchYear, fcltyCd);
return { data : drainageEquipmentList, count : drainageEquipmentList.length }
} catch (error) {
console.error('배수설비 정비현황 데이터를 가져오는데 실패했습니다:', error);
return { data: [], count: 0 };
}
}
/**==================================== /**====================================
* Store - action * Store - action
====================================*/ ====================================*/
@@ -756,8 +745,6 @@ export type DashBoardActions = {
searchMainGraph(searchYear: string, fcltyCd: string): Promise<void>; searchMainGraph(searchYear: string, fcltyCd: string): Promise<void>;
/**강우일 운영현황 */ /**강우일 운영현황 */
searchRainManage(searchYear: string, fcltyCd: string, isExcel: boolean): Promise<void>; searchRainManage(searchYear: string, fcltyCd: string, isExcel: boolean): Promise<void>;
/**배수설비 정비현황 */
searchDrainageEquipment(searchYear: string, fcltyCd: string, isExcel: boolean): Promise<void>;
} }
export type DashBoardType = { export type DashBoardType = {
@@ -777,12 +764,17 @@ export type DashBoardType = {
planYearList : string[]; planYearList : string[];
upHeadListPlanFclty : TableUpperProps[]; upHeadListPlanFclty : TableUpperProps[];
planFcltyList : planFcltyListProps[]; planFcltyList : planFcltyListProps[];
waterUsage1 : number | '',
waterUsage2 : number | '',
waterUsage3 : number | '',
isLoadingPlanFclty : boolean;
}, },
OperationStatus : { OperationStatus : {
isInit : boolean; isInit : boolean;
upHeadListOperationStatus : TableUpperProps[]; upHeadListOperationStatus : TableUpperProps[];
operationalStatusList : OperationalStatusListProps[]; operationalStatusList : OperationalStatusListProps[];
isLoadingOperationStatus : boolean;
} }
MainGraph : { MainGraph : {
@@ -796,6 +788,7 @@ export type DashBoardType = {
chart_efflTn : lineChartDataProps[]; chart_efflTn : lineChartDataProps[];
chart_inflBod : lineChartDataProps[]; chart_inflBod : lineChartDataProps[];
chart_efflBod : lineChartDataProps[]; chart_efflBod : lineChartDataProps[];
isLoadingMainGraph : boolean;
}, },
RainManage : { RainManage : {
@@ -803,6 +796,7 @@ export type DashBoardType = {
upHeadListRainManage : TableUpperProps[]; upHeadListRainManage : TableUpperProps[];
rainManageList : RainManageListProps[]; rainManageList : RainManageListProps[];
excelList : RainManageExcelType[]; excelList : RainManageExcelType[];
isLoadingRainManage : boolean;
}, },
DrainageEquipment : { DrainageEquipment : {
@@ -831,13 +825,18 @@ export const dashBoardInitState:DashBoardType = {
isInit : true, isInit : true,
planYearList : planYearList, planYearList : planYearList,
upHeadListPlanFclty : upHeadListPlanFclty, upHeadListPlanFclty : upHeadListPlanFclty,
planFcltyList : planFcltyList planFcltyList : planFcltyList,
waterUsage1 : 0,
waterUsage2 : 0,
waterUsage3 : 0,
isLoadingPlanFclty : false,
}, },
OperationStatus : { OperationStatus : {
isInit : false, isInit : false,
upHeadListOperationStatus : upHeadListOperationStatus, upHeadListOperationStatus : upHeadListOperationStatus,
operationalStatusList : operationalStatusList operationalStatusList : operationalStatusList,
isLoadingOperationStatus : false,
}, },
MainGraph : { MainGraph : {
@@ -850,14 +849,16 @@ export const dashBoardInitState:DashBoardType = {
chart_inflTn : chart_inflTn, chart_inflTn : chart_inflTn,
chart_efflTn : chart_efflTn, chart_efflTn : chart_efflTn,
chart_inflBod : chart_inflBod, chart_inflBod : chart_inflBod,
chart_efflBod : chart_efflBod chart_efflBod : chart_efflBod,
isLoadingMainGraph : false,
}, },
RainManage : { RainManage : {
isInit : false, isInit : false,
upHeadListRainManage : upHeadListRainManage, upHeadListRainManage : upHeadListRainManage,
rainManageList : rainManageList, rainManageList : rainManageList,
excelList : [] excelList : [],
isLoadingRainManage : false,
}, },
DrainageEquipment : { DrainageEquipment : {
@@ -926,18 +927,106 @@ const changeValue=(operationalStatus, data, keyTxt = 'INFL_AMNT')=>{
const calcValue = (operationalStatus, data, keyTxt='INFL_ASSCT_BFR_WQLT_TP') => { const calcValue = (operationalStatus, data, keyTxt='INFL_ASSCT_BFR_WQLT_TP') => {
// 연간 // 연간
operationalStatus.yearAvg = data.yearData ? Number(Math.round(data.yearData['AVG_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.yearAvg = data.yearData && data.yearData['AVG_'+keyTxt] ? Number(Math.round(data.yearData['AVG_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
operationalStatus.yearMax = data.yearData ? Number(Math.round(data.yearData.MAX_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.yearMax = data.yearData && data.yearData['MAX_'+keyTxt] ? Number(Math.round(data.yearData['MAX_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
operationalStatus.yearMin = data.yearData ? Number(Math.round(data.yearData.MIN_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.yearMin = data.yearData && data.yearData['MIN_'+keyTxt] ? Number(Math.round(data.yearData['MIN_'+keyTxt] * 1000) / 1000).toFixed(3).toString() : '';
// 여름 // 여름
operationalStatus.summerAll = data.summer ? Number(Math.round(data.summer.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.summerAll = data.summer && data.summer['AVG_'+keyTxt] ? Number(Math.round(data.summer['AVG_'+keyTxt] * 0.8 * 1000) / 1000).toFixed(3).toString() : '';
operationalStatus.summerThree = data.summerRainy ? Number(Math.round(data.summerRainy.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.summerThree = data.summerRainy && data.summerRainy['AVG_'+keyTxt] ? Number(Math.round(data.summerRainy['AVG_'+keyTxt] * 0.82 * 1000) / 1000).toFixed(3).toString() : '';
operationalStatus.summerRain = data.summerSunny ? Number(Math.round(data.summerSunny.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.summerRain = data.summerSunny && data.summerSunny['AVG_'+keyTxt] ? Number(Math.round(data.summerSunny['AVG_'+keyTxt] * 0.74 * 1000) / 1000).toFixed(3).toString() : '';
// 겨울 // 겨울
operationalStatus.winterAll = data.winter ? Number(Math.round(data.winter.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.winterAll = data.winter && data.winter['AVG_'+keyTxt] ? Number(Math.round(data.winter['AVG_'+keyTxt] * 1.16*1000) / 1000).toFixed(3).toString() : '';
operationalStatus.winterSunnyMin = data.winterSunny ? Number(Math.round(data.winterSunny.MIN_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.winterSunnyMin = data.winterSunny && data.winterSunny['MIN_'+keyTxt] ? Number(Math.round(data.winterSunny['MIN_'+keyTxt] * 1.2 * 1000) / 1000).toFixed(3).toString() : '';
operationalStatus.winterSunnyAvg = data.winterSunny ? Number(Math.round(data.winterSunny.AVG_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.winterSunnyAvg = data.winterSunny && data.winterSunny['AVG_'+keyTxt] ? Number(Math.round(data.winterSunny['AVG_'+keyTxt] * 1.25 *1000) / 1000).toFixed(3).toString() : '';
operationalStatus.winterSunnyMax = data.winterSunny ? Number(Math.round(data.winterSunny.MAX_INFL_ASSCT_BFR_WQLT_TP * 1000) / 1000).toFixed(3).toString() : ''; operationalStatus.winterSunnyMax = data.winterSunny && data.winterSunny['MAX_'+keyTxt] ? Number(Math.round(data.winterSunny['MAX_'+keyTxt] * 1.3 *1000) / 1000).toFixed(3).toString() : '';
}
type RtnFlowType = {
inflAmnt: string | number;
infoRnDay: string | number;
bscFctCd: string;
msrDt: string;
}
type RtnFlowResponse = {
data: RtnFlowType[];
count: number;
}
const searchWaterUsage = async (searchYear: string, fcltyCd: string) => {
const waterUsage = [0, 0, 0];
for (let i = 0; i < 3; i++) {
try {
const res = await getFetch('fo', '/fclt/flow/' + fcltyCd + '/' + (Number(searchYear)-i)) as RtnFlowResponse;
let totWaterUsage = 0;
if (res && res.data && Array.isArray(res.data)) {
res.data.forEach((item: RtnFlowType) => {
totWaterUsage += Number(item.inflAmnt);
});
if (res.count > 0) {
const avg = totWaterUsage / res.count;
waterUsage[i] = parseFloat((avg * 0.65).toFixed(2));
}
}
} catch (error) {
console.error(`Error fetching water usage for year ${Number(searchYear)-i}:`, error);
waterUsage[i] = 0;
}
}
return waterUsage;
}
// 강우영향일 계산 및 강우량 덮어씌우기
export const calRainEffectDayRainManage = (data: RainManageListProps[]) => {
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
for(let idx = 0; idx < data.length; idx++) {
const item = data[idx];
if(item){
if(item.infoRnDay && Number(item.infoRnDay) >= 3) {
item.rainEffectDay = 1;
} else {
item.rainEffectDay = 0;
}
}
}
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
for(let idx = 0; idx < data.length; idx++) {
if(data[idx]) {
// 하루 전이 강우영향일(3 이상)인 경우
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) {
data[idx]!.rainEffectDay = 1;
}
// 이틀 전이 강우영향일(3 이상)인 경우
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) {
data[idx]!.rainEffectDay = 1;
}
}
}
for(let idx = 0; idx < data.length; idx++) {
if(data[idx] && data[idx]?.rainEffectDay === 1) {
if(idx > 1){
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) {
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
}
}
if(idx > 2){
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) {
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
}
}
}
}
let rtnData : RainManageListProps[] = [];
rtnData = data.filter((item: RainManageListProps) => item.rainEffectDay === 1);
return rtnData;
} }
export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) => void)=>DashBoardActions=(set: (fn: (state: DashBoardType) => DashBoardType) => void) => { export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) => void)=>DashBoardActions=(set: (fn: (state: DashBoardType) => DashBoardType) => void) => {
@@ -954,7 +1043,28 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
/** 시설정보 및 운영현황 - 계획정보 */ /** 시설정보 및 운영현황 - 계획정보 */
searchPlanInfo : async (targetYear: string, fcltyCd: string) => { searchPlanInfo : async (targetYear: string, fcltyCd: string) => {
const res = await fetchFacilityPlan(targetYear, fcltyCd); set((state: DashBoardType) => ({
...state,
PlanFclty: {
...state.PlanFclty,
isLoadingPlanFclty: true,
},
}));
let waterUsage = [0, 0, 0];
waterUsage = await searchWaterUsage(targetYear, fcltyCd);
set((state: DashBoardType) => ({
...state,
PlanFclty : {
...state.PlanFclty,
waterUsage1 : waterUsage[0] || 0,
waterUsage2 : waterUsage[1] || 0,
waterUsage3 : waterUsage[2] || 0,
},
}));
const res = await fetchFacilityPlan(targetYear, fcltyCd, set);
let minDiff=9999999; let minDiff=9999999;
let minIndex; let minIndex;
res.forEach((el:any, idx) => { res.forEach((el:any, idx) => {
@@ -1004,21 +1114,31 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
// 임시시 // 임시시
dataFormSettingPlan(el); dataFormSettingPlan(el);
console.log('planFcltyList', planFcltyList);
console.log('rtnPlanData', rtnPlanData);
set((state: DashBoardType) => ({
...state,
PlanFclty: {
...state.PlanFclty,
planFcltyList: planFcltyList,
isLoadingPlanFclty: false,
},
}));
}); });
set((state: DashBoardType) => ({
...state,
PlanFclty : {
...state.PlanFclty,
planFcltyList : planFcltyList
}
}));
}, },
/** 시설정보 및 운영현황 - 운영실태 */ /** 시설정보 및 운영현황 - 운영실태 */
searchOperationStatus: async (isExcel: boolean, searchYear: string, fcltyCd: string) => { searchOperationStatus: async (isExcel: boolean, searchYear: string, fcltyCd: string) => {
set((state: DashBoardType) => ({
...state,
OperationStatus: {
...state.OperationStatus,
isLoadingOperationStatus: true,
},
}));
const res = await fetchOperationStatus(searchYear, fcltyCd); const res = await fetchOperationStatus(searchYear, fcltyCd);
const data = res.data; const data = res.data;
if(data && operationalStatusList){ if(data && operationalStatusList){
// 유량 - 유입 // 유량 - 유입
if (operationalStatusList?.[0]) { if (operationalStatusList?.[0]) {
@@ -1050,10 +1170,56 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
operationalStatusList[0].winterSunnyMin = data.winterSunny === null ? '' : (data.winterSunny.MIN_INFL_AMNT ? data.winterSunny.MIN_INFL_AMNT : 0) + (data.winterSunny.MIN_SUM_FLOW ? data.winterSunny.MIN_SUM_FLOW : 0) + (data.winterSunny.MIN_TP_INFL_WQLT_TP ? data.winterSunny.MIN_TP_INFL_WQLT_TP : 0); operationalStatusList[0].winterSunnyMin = data.winterSunny === null ? '' : (data.winterSunny.MIN_INFL_AMNT ? data.winterSunny.MIN_INFL_AMNT : 0) + (data.winterSunny.MIN_SUM_FLOW ? data.winterSunny.MIN_SUM_FLOW : 0) + (data.winterSunny.MIN_TP_INFL_WQLT_TP ? data.winterSunny.MIN_TP_INFL_WQLT_TP : 0);
operationalStatusList[0].winterSunnyAvg = data.winterSunny === null ? '' : (data.winterSunny.AVG_INFL_AMNT ? data.winterSunny.AVG_INFL_AMNT : 0) + (data.winterSunny.AVG_SUM_FLOW ? data.winterSunny.AVG_SUM_FLOW : 0) + (data.winterSunny.AVG_TP_INFL_WQLT_TP ? data.winterSunny.AVG_TP_INFL_WQLT_TP : 0); operationalStatusList[0].winterSunnyAvg = data.winterSunny === null ? '' : (data.winterSunny.AVG_INFL_AMNT ? data.winterSunny.AVG_INFL_AMNT : 0) + (data.winterSunny.AVG_SUM_FLOW ? data.winterSunny.AVG_SUM_FLOW : 0) + (data.winterSunny.AVG_TP_INFL_WQLT_TP ? data.winterSunny.AVG_TP_INFL_WQLT_TP : 0);
operationalStatusList[0].winterSunnyMax = data.winterSunny === null ? '' : (data.winterSunny.MAX_INFL_AMNT ? data.winterSunny.MAX_INFL_AMNT : 0) + (data.winterSunny.MAX_SUM_FLOW ? data.winterSunny.MAX_SUM_FLOW : 0) + (data.winterSunny.MAX_TP_INFL_WQLT_TP ? data.winterSunny.MAX_TP_INFL_WQLT_TP : 0); operationalStatusList[0].winterSunnyMax = data.winterSunny === null ? '' : (data.winterSunny.MAX_INFL_AMNT ? data.winterSunny.MAX_INFL_AMNT : 0) + (data.winterSunny.MAX_SUM_FLOW ? data.winterSunny.MAX_SUM_FLOW : 0) + (data.winterSunny.MAX_TP_INFL_WQLT_TP ? data.winterSunny.MAX_TP_INFL_WQLT_TP : 0);
// 지하수
operationalStatusList[0].groundWaterAvg = data.yearData.AVG_INFL_AMNT === null ? '' : Number(data.yearData.AVG_INFL_AMNT) - (Number(data.yearData.AVG_INFL_AMNT)*0.65*0.8); // 연계처리수,지하수유입량
operationalStatusList[0].groundWaterSummer = data.summer.AVG_INFL_AMNT === null ? '' : Number(data.summer.AVG_INFL_AMNT) - (Number(data.summer.AVG_INFL_AMNT)*0.65*0.8); const bscFctCd = fcltyCd;
operationalStatusList[0].groundWaterWinter = data.winter.AVG_INFL_AMNT === null ? '' : Number(data.winter.AVG_INFL_AMNT) - (Number(data.winter.AVG_INFL_AMNT)*0.65*0.8); const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse;
const calData = calRainEffectDay(res2.data, 'SUNNY');
let chungcunSumFlow = 0;
let sumSummerChungcunDay = 0;
let sumSummerChungcunFlow = 0;
let sumWinterChungcunDay = 0;
let sumWinterChungcunFlow = 0;
/* let yearSumFlow = 0;
let summerSumFlow = 0;
let winterSumFlow = 0; */
calData.forEach((flowItem: FlowDataItem) => {
chungcunSumFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
//yearSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){
sumSummerChungcunDay += 1;
sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
//summerSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
}else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){
sumWinterChungcunDay += 1;
sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
// winterSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
}
});
// 연계처리수
/* const avgYearSumFlow = yearSumFlow / calData.length;
const avgSummerSumFlow = summerSumFlow / calData.length;
const avgWinterSumFlow = winterSumFlow / calData.length; */
// 지하수유입량
const usage = chungcunSumFlow / calData.length;
const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay;
const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay;
operationalStatusList[0].groundWaterAvg = Math.round((usage-(usage*0.65*0.8)) * 100) / 100;
operationalStatusList[0].groundWaterSummer = Math.round((summerUsage-(summerUsage*0.65*0.8)) * 100) / 100;
operationalStatusList[0].groundWaterWinter = Math.round((winterUsage-(winterUsage*0.65*0.8)) * 100) / 100;
//operationalStatusList[0].groundWaterAvg = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8);
//operationalStatusList[0].groundWaterSummer = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8);
//operationalStatusList[0].groundWaterWinter = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8);
// 오염물질 // 오염물질
// RDII 추정 = 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD)) // RDII 추정 = 하절기(6~8월) 중 최저 유입 BOD일때 유입유량 x ((동절기 청천시 유입BOD - 하절기(6~8월) 중 최저 유입BOD) / (동절기 청천시 유입BOD))
@@ -1063,16 +1229,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
const summerLowRain = data.summerBod&&data.summerBod.INFO_RN_DAY&&data.summerBod.INFO_RN_DAY!='null'?Number(data.summerBod.INFO_RN_DAY):0; const summerLowRain = data.summerBod&&data.summerBod.INFO_RN_DAY&&data.summerBod.INFO_RN_DAY!='null'?Number(data.summerBod.INFO_RN_DAY):0;
operationalStatusList[0].rdi = winterAvgBod===0?0:summerLowFlow * ((winterAvgBod - summerLowBod) / winterAvgBod); operationalStatusList[0].rdi = winterAvgBod===0?0:summerLowFlow * ((winterAvgBod - summerLowBod) / winterAvgBod);
operationalStatusList[0].rdiRain = summerLowRain; operationalStatusList[0].rdiRain = summerLowRain;
dataFormSetting(operationalStatusList[0]);
} }
if(operationalStatusList[0] && operationalStatusList[7]){ if(operationalStatusList[0] && operationalStatusList[7]){
console.log(Number(operationalStatusList[0].groundWaterAvg)+' '+Number(data.yearData.AVG_INFL_AMNT)); operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : data.yearData && data.yearData.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterAvg) / (data.yearData && data.yearData.AVG_INFL_AMNT ? Number(data.yearData.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%';
console.log(Number(operationalStatusList[0].groundWaterSummer)+' '+Number(data.summer.AVG_INFL_AMNT)); operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : data.summer && data.summer.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterSummer) / (data.summer && data.summer.AVG_INFL_AMNT ? Number(data.summer.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%';
console.log(Number(operationalStatusList[0].groundWaterWinter)+' '+Number(data.winter.AVG_INFL_AMNT)); operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : data.winter && data.winter.AVG_INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].groundWaterWinter) / (data.winter && data.winter.AVG_INFL_AMNT ? Number(data.winter.AVG_INFL_AMNT) : 0) * 100) * 10) / 10+'%';
operationalStatusList[7].groundWaterAvg = Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT) * 100; operationalStatusList[7].rdi = operationalStatusList[0].rdi === null ? '' : data.summerBod && data.summerBod.INFL_AMNT === 0 ? '' : Math.round((Number(operationalStatusList[0].rdi) / (data.summerBod&&data.summerBod.INFL_AMNT&&data.summerBod.INFL_AMNT!='null'?Number(data.summerBod.INFL_AMNT):0) * 100) * 10) / 10+'%';
operationalStatusList[7].groundWaterSummer = Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT) * 100;
operationalStatusList[7].groundWaterWinter = Number(operationalStatusList[0].groundWaterWinter) / Number(data.winter.AVG_INFL_AMNT) * 100;
/* operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : Number(Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT)) * 100; /* operationalStatusList[7].groundWaterAvg = operationalStatusList[0].groundWaterAvg === null ? '' : Number(Number(operationalStatusList[0].groundWaterAvg) / Number(data.yearData.AVG_INFL_AMNT)) * 100;
operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : Number(Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT)) * 100; operationalStatusList[7].groundWaterSummer = operationalStatusList[0].groundWaterSummer === null ? '' : Number(Number(operationalStatusList[0].groundWaterSummer) / Number(data.summer.AVG_INFL_AMNT)) * 100;
operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : Number(Number(operationalStatusList[0].groundWaterWinter) / Number(data.winter.AVG_INFL_AMNT)) * 100;*/ operationalStatusList[7].groundWaterWinter = operationalStatusList[0].groundWaterWinter === null ? '' : Number(Number(operationalStatusList[0].groundWaterWinter) / Number(data.winter.AVG_INFL_AMNT)) * 100;*/
@@ -1080,7 +1243,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
} }
for(let i=1; i<operationalStatusList.length; i++){ for(let i=1; i<operationalStatusList.length; i++){
const txtArray = ['1', 'INFL_AMNT', 'SUM_FLOW', 'RETURN_AMNT', 'EFFL_AMNT', 'INFL_ASSCT_BFR_WQLT_BOD', 'EFFL_WQLT_BOD', 'INFL_ASSCT_BFR_WQLT_TN', 'EFFL_WQLT_TN', 'INFL_ASSCT_BFR_WQLT_TP', 'EFFL_WQLT_TP', 'INFL_ASSCT_BFR_WQLT_TP', 'EFFL_WQLT_TP']; const txtArray = ['1', 'INFL_AMNT', 'SUM_FLOW', 'RETURN_AMNT', 'EFFL_AMNT', 'INFL_ASSCT_BFR_WQLT_BOD', 'EFFL_WQLT_BOD', 'INFL_ASSCT_BFR_WQLT_TN', 'EFFL_WQLT_TN', 'INFL_ASSCT_BFR_WQLT_TP', 'EFFL_WQLT_TP', 'TP_INFL_WQLT_TP', 'EFFL_WQLT_TP'];
if(operationalStatusList[i]){ if(operationalStatusList[i]){
if(i < 7){ if(i < 7){
changeValue(operationalStatusList[i], data, txtArray[i]); changeValue(operationalStatusList[i], data, txtArray[i]);
@@ -1106,8 +1269,8 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
시군구: item.sggNm, 시군구: item.sggNm,
주소: item.addr, 주소: item.addr,
용량: item.fctCpc, 용량: item.fctCpc,
유입BOD: item.inflAssctAftWqltBod, 유입BOD: item.inflAssctBfrWqltBod,
유입TN: item.inflAssctAftWqltTn, 유입TN: item.inflAssctBfrWqltTn,
유입TP: item.inflAssctBfrWqltTp, 유입TP: item.inflAssctBfrWqltTp,
유출BOD: item.efflWqltBod, 유출BOD: item.efflWqltBod,
유출TN: item.efflWqltTn, 유출TN: item.efflWqltTn,
@@ -1127,12 +1290,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
OperationStatus: { OperationStatus: {
...state.OperationStatus, ...state.OperationStatus,
operationalStatusList: operationalStatusList, operationalStatusList: operationalStatusList,
operationalStatusCount: res.count operationalStatusCount: res.count,
} isLoadingOperationStatus : false,
},
})) }))
}, },
searchMainGraph: async (searchYear: string, fcltyCd: string) => { searchMainGraph: async (searchYear: string, fcltyCd: string) => {
set((state: DashBoardType) => ({
...state,
MainGraph: {
...state.MainGraph,
isLoadingMainGraph: true,
},
}));
const res = await fetchMainGraph(searchYear, fcltyCd); const res = await fetchMainGraph(searchYear, fcltyCd);
if(res == null || res.data == null || res.data.length === 0) { if(res == null || res.data == null || res.data.length === 0) {
set((state: DashBoardType) => ({ set((state: DashBoardType) => ({
@@ -1148,6 +1319,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
chart_efflTn: [], chart_efflTn: [],
chart_inflBod: [], chart_inflBod: [],
chart_efflBod: [], chart_efflBod: [],
isLoadingMainGraph : false,
} }
})); }));
return; return;
@@ -1163,7 +1335,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
const chart_bodRain = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ const chart_bodRain = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8), label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
barVal0: item.infoRnDay ?? 0, barVal0: item.infoRnDay ?? 0,
lineVal0: item.inflAssctAftWqltBod ?? 0, lineVal0: item.inflAssctBfrWqltBod ?? 0,
})); }));
const chart_inflTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ const chart_inflTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
@@ -1183,7 +1355,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
const chart_inflTn = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ const chart_inflTn = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8), label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
val : item.inflAssctAftWqltTn ?? 0 val : item.inflAssctBfrWqltTn ?? 0
})); }));
const chart_efflTn = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ const chart_efflTn = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
@@ -1193,7 +1365,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
const chart_inflBod = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ const chart_inflBod = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8), label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8),
val : item.inflAssctAftWqltBod ?? 0 val : item.inflAssctBfrWqltBod ?? 0
})); }));
const chart_efflBod = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ const chart_efflBod = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({
@@ -1213,12 +1385,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
chart_inflTn: chart_inflTn, chart_inflTn: chart_inflTn,
chart_efflTn: chart_efflTn, chart_efflTn: chart_efflTn,
chart_inflBod: chart_inflBod, chart_inflBod: chart_inflBod,
chart_efflBod: chart_efflBod chart_efflBod: chart_efflBod,
} isLoadingMainGraph : false,
},
})) }))
}, },
searchRainManage: async (searchYear: string, fcltyCd: string, isExcel : boolean) => { searchRainManage: async (searchYear: string, fcltyCd: string, isExcel : boolean) => {
set((state: DashBoardType) => ({
...state,
RainManage: {
...state.RainManage,
isLoadingRainManage: true,
},
}));
const res = await fetchMainGraph(searchYear, fcltyCd); const res = await fetchMainGraph(searchYear, fcltyCd);
if(res == null || res.data.wqltObjs == null || res.data.wqltObjs.length === 0) { if(res == null || res.data.wqltObjs == null || res.data.wqltObjs.length === 0) {
set((state: DashBoardType) => ({ set((state: DashBoardType) => ({
@@ -1226,6 +1406,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
RainManage: { RainManage: {
...state.RainManage, ...state.RainManage,
rainManageList: [], rainManageList: [],
isLoadingRainManage : false,
} }
})); }));
return; return;
@@ -1243,75 +1424,51 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
const dsInflWqltSs: number[] = [0, 0, 0, 0, 0, 0, 0, 0]; const dsInflWqltSs: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltTn: number[] = [0, 0, 0, 0, 0, 0, 0, 0]; const dsInflWqltTn: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const dsInflWqltTp: number[] = [0, 0, 0, 0, 0, 0, 0, 0]; const dsInflWqltTp: number[] = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltBod = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltToc = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltToc = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltSs = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTn = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const inflAssctAftWqltTp = [0, 0, 0, 0, 0, 0, 0, 0]; const inflAssctBfrWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltBodCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltBod = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltBod = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltCodCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltTocCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltCod = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltToc = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltSsCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltSs = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltSs = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltTnCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTn = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltTn = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltTpCnt = [0, 0, 0, 0, 0, 0, 0, 0];
const efflWqltTp = [0, 0, 0, 0, 0, 0, 0, 0]; const efflWqltTp = [0, 0, 0, 0, 0, 0, 0, 0];
// Process the data and create rain management list
res.data.wqltObjs.forEach((item: RainManageListProps) => {
// 강우일 // 청천시 중 강우영향일인 날짜는 이전의 강우량을 대입해 리스트 수정
/*if(Number(item.infoRnDay) < 3){
rainDate[1] = Number(rainDate[1] || 0) + 1; const rainEffectList = calRainEffectDayRainManage(res.data.wqltObjs);
inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1; // Process the data and create rain management list
inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0); rainEffectList.forEach((item: RainManageListProps) => {
fcltyCpct[1] = 0;
inflAssctAftWqltBodCnt[1] = Number(inflAssctAftWqltBodCnt[1] || 0) + 1;
inflAssctAftWqltBod[1] = Number(inflAssctAftWqltBod[1] || 0) + Number(item.inflAssctAftWqltBod || 0);
inflAssctAftWqltTocCnt[1] = Number(inflAssctAftWqltTocCnt[1] || 0) + 1;
inflAssctAftWqltToc[1] = Number(inflAssctAftWqltToc[1] || 0) + Number(item.inflAssctAftWqltToc || 0);
inflAssctAftWqltSsCnt[1] = Number(inflAssctAftWqltSsCnt[1] || 0) + 1;
inflAssctAftWqltSs[1] = Number(inflAssctAftWqltSs[1] || 0) + Number(item.inflAssctAftWqltSs || 0);
inflAssctAftWqltTnCnt[1] = Number(inflAssctAftWqltTnCnt[1] || 0) + 1;
inflAssctAftWqltTn[1] = Number(inflAssctAftWqltTn[1] || 0) + Number(item.inflAssctAftWqltTn || 0);
inflAssctAftWqltTpCnt[1] = Number(inflAssctAftWqltTpCnt[1] || 0) + 1;
inflAssctAftWqltTp[1] = Number(inflAssctAftWqltTp[1] || 0) + Number(item.inflAssctAftWqltTp || 0);
efflWqltBodCnt[1] = Number(efflWqltBodCnt[1] || 0) + 1;
efflWqltBod[1] = Number(efflWqltBod[1] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[1] = Number(efflWqltCodCnt[1] || 0) + 1;
efflWqltCod[1] = Number(efflWqltCod[1] || 0) + Number(item.efflWqltCod || 0);
efflWqltSsCnt[1] = Number(efflWqltSsCnt[1] || 0) + 1;
efflWqltSs[1] = Number(efflWqltSs[1] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[1] = Number(efflWqltTnCnt[1] || 0) + 1;
efflWqltTn[1] = Number(efflWqltTn[1] || 0) + Number(item.efflWqltTn || 0);
efflWqltTpCnt[1] = Number(efflWqltTpCnt[1] || 0) + 1;
efflWqltTp[1] = Number(efflWqltTp[1] || 0) + Number(item.efflWqltTp || 0);
}*/
if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){ if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){
rainDate[1] = Number(rainDate[1] || 0) + 1; rainDate[1] = Number(rainDate[1] || 0) + 1;
inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1; inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1;
inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0); inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[1] = 0; fcltyCpct[1] = 0;
inflAssctAftWqltBodCnt[1] = Number(inflAssctAftWqltBodCnt[1] || 0) + 1; inflAssctBfrWqltBodCnt[1] = Number(inflAssctBfrWqltBodCnt[1] || 0) + 1;
inflAssctAftWqltBod[1] = Number(inflAssctAftWqltBod[1] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[1] = Number(inflAssctBfrWqltBod[1] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[1] = Number(inflAssctAftWqltTocCnt[1] || 0) + 1; inflAssctBfrWqltTocCnt[1] = Number(inflAssctBfrWqltTocCnt[1] || 0) + 1;
inflAssctAftWqltToc[1] = Number(inflAssctAftWqltToc[1] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[1] = Number(inflAssctBfrWqltToc[1] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[1] = Number(inflAssctAftWqltSsCnt[1] || 0) + 1; inflAssctBfrWqltSsCnt[1] = Number(inflAssctBfrWqltSsCnt[1] || 0) + 1;
inflAssctAftWqltSs[1] = Number(inflAssctAftWqltSs[1] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[1] = Number(inflAssctBfrWqltSs[1] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[1] = Number(inflAssctAftWqltTnCnt[1] || 0) + 1; inflAssctBfrWqltTnCnt[1] = Number(inflAssctBfrWqltTnCnt[1] || 0) + 1;
inflAssctAftWqltTn[1] = Number(inflAssctAftWqltTn[1] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[1] = Number(inflAssctBfrWqltTn[1] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[1] = Number(inflAssctAftWqltTpCnt[1] || 0) + 1; inflAssctBfrWqltTpCnt[1] = Number(inflAssctBfrWqltTpCnt[1] || 0) + 1;
inflAssctAftWqltTp[1] = Number(inflAssctAftWqltTp[1] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[1] = Number(inflAssctBfrWqltTp[1] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[1] = Number(efflWqltBodCnt[1] || 0) + 1; efflWqltBodCnt[1] = Number(efflWqltBodCnt[1] || 0) + 1;
efflWqltBod[1] = Number(efflWqltBod[1] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[1] = Number(efflWqltBod[1] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[1] = Number(efflWqltCodCnt[1] || 0) + 1; efflWqltTocCnt[1] = Number(efflWqltTocCnt[1] || 0) + 1;
efflWqltCod[1] = Number(efflWqltCod[1] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[1] = Number(efflWqltToc[1] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[1] = Number(efflWqltSsCnt[1] || 0) + 1; efflWqltSsCnt[1] = Number(efflWqltSsCnt[1] || 0) + 1;
efflWqltSs[1] = Number(efflWqltSs[1] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[1] = Number(efflWqltSs[1] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[1] = Number(efflWqltTnCnt[1] || 0) + 1; efflWqltTnCnt[1] = Number(efflWqltTnCnt[1] || 0) + 1;
@@ -1323,20 +1480,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmtCnt[2] = Number(inflAmtCnt[2] || 0) + 1; inflAmtCnt[2] = Number(inflAmtCnt[2] || 0) + 1;
inflAmnt[2] = Number(inflAmnt[2] || 0) + Number(item.inflAmnt || 0); inflAmnt[2] = Number(inflAmnt[2] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[2] = 0; fcltyCpct[2] = 0;
inflAssctAftWqltBodCnt[2] = Number(inflAssctAftWqltBodCnt[2] || 0) + 1; inflAssctBfrWqltBodCnt[2] = Number(inflAssctBfrWqltBodCnt[2] || 0) + 1;
inflAssctAftWqltBod[2] = Number(inflAssctAftWqltBod[2] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[2] = Number(inflAssctBfrWqltBod[2] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[2] = Number(inflAssctAftWqltTocCnt[2] || 0) + 1; inflAssctBfrWqltTocCnt[2] = Number(inflAssctBfrWqltTocCnt[2] || 0) + 1;
inflAssctAftWqltToc[2] = Number(inflAssctAftWqltToc[2] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[2] = Number(inflAssctBfrWqltToc[2] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[2] = Number(inflAssctAftWqltSsCnt[2] || 0) + 1; inflAssctBfrWqltSsCnt[2] = Number(inflAssctBfrWqltSsCnt[2] || 0) + 1;
inflAssctAftWqltSs[2] = Number(inflAssctAftWqltSs[2] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[2] = Number(inflAssctBfrWqltSs[2] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[2] = Number(inflAssctAftWqltTnCnt[2] || 0) + 1; inflAssctBfrWqltTnCnt[2] = Number(inflAssctBfrWqltTnCnt[2] || 0) + 1;
inflAssctAftWqltTn[2] = Number(inflAssctAftWqltTn[2] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[2] = Number(inflAssctBfrWqltTn[2] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[2] = Number(inflAssctAftWqltTpCnt[2] || 0) + 1; inflAssctBfrWqltTpCnt[2] = Number(inflAssctBfrWqltTpCnt[2] || 0) + 1;
inflAssctAftWqltTp[2] = Number(inflAssctAftWqltTp[2] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[2] = Number(inflAssctBfrWqltTp[2] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[2] = Number(efflWqltBodCnt[2] || 0) + 1; efflWqltBodCnt[2] = Number(efflWqltBodCnt[2] || 0) + 1;
efflWqltBod[2] = Number(efflWqltBod[2] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[2] = Number(efflWqltBod[2] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[2] = Number(efflWqltCodCnt[2] || 0) + 1; efflWqltTocCnt[2] = Number(efflWqltTocCnt[2] || 0) + 1;
efflWqltCod[2] = Number(efflWqltCod[2] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[2] = Number(efflWqltToc[2] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[2] = Number(efflWqltSsCnt[2] || 0) + 1; efflWqltSsCnt[2] = Number(efflWqltSsCnt[2] || 0) + 1;
efflWqltSs[2] = Number(efflWqltSs[2] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[2] = Number(efflWqltSs[2] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[2] = Number(efflWqltTnCnt[2] || 0) + 1; efflWqltTnCnt[2] = Number(efflWqltTnCnt[2] || 0) + 1;
@@ -1348,20 +1505,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmtCnt[3] = Number(inflAmtCnt[3] || 0) + 1; inflAmtCnt[3] = Number(inflAmtCnt[3] || 0) + 1;
inflAmnt[3] = Number(inflAmnt[3] || 0) + Number(item.inflAmnt || 0); inflAmnt[3] = Number(inflAmnt[3] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[3] = 0; fcltyCpct[3] = 0;
inflAssctAftWqltBodCnt[3] = Number(inflAssctAftWqltBodCnt[3] || 0) + 1; inflAssctBfrWqltBodCnt[3] = Number(inflAssctBfrWqltBodCnt[3] || 0) + 1;
inflAssctAftWqltBod[3] = Number(inflAssctAftWqltBod[3] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[3] = Number(inflAssctBfrWqltBod[3] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[3] = Number(inflAssctAftWqltTocCnt[3] || 0) + 1; inflAssctBfrWqltTocCnt[3] = Number(inflAssctBfrWqltTocCnt[3] || 0) + 1;
inflAssctAftWqltToc[3] = Number(inflAssctAftWqltToc[3] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[3] = Number(inflAssctBfrWqltToc[3] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[3] = Number(inflAssctAftWqltSsCnt[3] || 0) + 1; inflAssctBfrWqltSsCnt[3] = Number(inflAssctBfrWqltSsCnt[3] || 0) + 1;
inflAssctAftWqltSs[3] = Number(inflAssctAftWqltSs[3] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[3] = Number(inflAssctBfrWqltSs[3] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[3] = Number(inflAssctAftWqltTnCnt[3] || 0) + 1; inflAssctBfrWqltTnCnt[3] = Number(inflAssctBfrWqltTnCnt[3] || 0) + 1;
inflAssctAftWqltTn[3] = Number(inflAssctAftWqltTn[3] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[3] = Number(inflAssctBfrWqltTn[3] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[3] = Number(inflAssctAftWqltTpCnt[3] || 0) + 1; inflAssctBfrWqltTpCnt[3] = Number(inflAssctBfrWqltTpCnt[3] || 0) + 1;
inflAssctAftWqltTp[3] = Number(inflAssctAftWqltTp[3] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[3] = Number(inflAssctBfrWqltTp[3] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[3] = Number(efflWqltBodCnt[3] || 0) + 1; efflWqltBodCnt[3] = Number(efflWqltBodCnt[3] || 0) + 1;
efflWqltBod[3] = Number(efflWqltBod[3] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[3] = Number(efflWqltBod[3] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[3] = Number(efflWqltCodCnt[3] || 0) + 1; efflWqltTocCnt[3] = Number(efflWqltTocCnt[3] || 0) + 1;
efflWqltCod[3] = Number(efflWqltCod[3] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[3] = Number(efflWqltToc[3] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[3] = Number(efflWqltSsCnt[3] || 0) + 1; efflWqltSsCnt[3] = Number(efflWqltSsCnt[3] || 0) + 1;
efflWqltSs[3] = Number(efflWqltSs[3] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[3] = Number(efflWqltSs[3] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[3] = Number(efflWqltTnCnt[3] || 0) + 1; efflWqltTnCnt[3] = Number(efflWqltTnCnt[3] || 0) + 1;
@@ -1373,20 +1530,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmtCnt[4] = Number(inflAmtCnt[4] || 0) + 1; inflAmtCnt[4] = Number(inflAmtCnt[4] || 0) + 1;
inflAmnt[4] = Number(inflAmnt[4] || 0) + Number(item.inflAmnt || 0); inflAmnt[4] = Number(inflAmnt[4] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[4] = item.inflAmnt&&Number(item.inflAmnt) !== 0 ? Number(Math.round(Number(item.inflAmnt) / Number(item.fctCpc) * 10) / 10) : 0; fcltyCpct[4] = item.inflAmnt&&Number(item.inflAmnt) !== 0 ? Number(Math.round(Number(item.inflAmnt) / Number(item.fctCpc) * 10) / 10) : 0;
inflAssctAftWqltBodCnt[4] = Number(inflAssctAftWqltBodCnt[4] || 0) + 1; inflAssctBfrWqltBodCnt[4] = Number(inflAssctBfrWqltBodCnt[4] || 0) + 1;
inflAssctAftWqltBod[4] = Number(inflAssctAftWqltBod[4] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[4] = Number(inflAssctBfrWqltBod[4] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[4] = Number(inflAssctAftWqltTocCnt[4] || 0) + 1; inflAssctBfrWqltTocCnt[4] = Number(inflAssctBfrWqltTocCnt[4] || 0) + 1;
inflAssctAftWqltToc[4] = Number(inflAssctAftWqltToc[4] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[4] = Number(inflAssctBfrWqltToc[4] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[4] = Number(inflAssctAftWqltSsCnt[4] || 0) + 1; inflAssctBfrWqltSsCnt[4] = Number(inflAssctBfrWqltSsCnt[4] || 0) + 1;
inflAssctAftWqltSs[4] = Number(inflAssctAftWqltSs[4] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[4] = Number(inflAssctBfrWqltSs[4] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[4] = Number(inflAssctAftWqltTnCnt[4] || 0) + 1; inflAssctBfrWqltTnCnt[4] = Number(inflAssctBfrWqltTnCnt[4] || 0) + 1;
inflAssctAftWqltTn[4] = Number(inflAssctAftWqltTn[5] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[4] = Number(inflAssctBfrWqltTn[5] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[4] = Number(inflAssctAftWqltTpCnt[4] || 0) + 1; inflAssctBfrWqltTpCnt[4] = Number(inflAssctBfrWqltTpCnt[4] || 0) + 1;
inflAssctAftWqltTp[4] = Number(inflAssctAftWqltTp[4] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[4] = Number(inflAssctBfrWqltTp[4] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[4] = Number(efflWqltBodCnt[4] || 0) + 1; efflWqltBodCnt[4] = Number(efflWqltBodCnt[4] || 0) + 1;
efflWqltBod[4] = Number(efflWqltBod[4] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[4] = Number(efflWqltBod[4] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[4] = Number(efflWqltCodCnt[4] || 0) + 1; efflWqltTocCnt[4] = Number(efflWqltTocCnt[4] || 0) + 1;
efflWqltCod[4] = Number(efflWqltCod[4] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[4] = Number(efflWqltToc[4] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[4] = Number(efflWqltSsCnt[4] || 0) + 1; efflWqltSsCnt[4] = Number(efflWqltSsCnt[4] || 0) + 1;
efflWqltSs[4] = Number(efflWqltSs[4] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[4] = Number(efflWqltSs[4] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[4] = Number(efflWqltTnCnt[5] || 0) + 1; efflWqltTnCnt[4] = Number(efflWqltTnCnt[5] || 0) + 1;
@@ -1398,20 +1555,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmtCnt[5] = Number(inflAmtCnt[5] || 0) + 1; inflAmtCnt[5] = Number(inflAmtCnt[5] || 0) + 1;
inflAmnt[5] = Number(inflAmnt[5] || 0) + Number(item.inflAmnt || 0); inflAmnt[5] = Number(inflAmnt[5] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[5] = 0; fcltyCpct[5] = 0;
inflAssctAftWqltBodCnt[5] = Number(inflAssctAftWqltBodCnt[5] || 0) + 1; inflAssctBfrWqltBodCnt[5] = Number(inflAssctBfrWqltBodCnt[5] || 0) + 1;
inflAssctAftWqltBod[5] = Number(inflAssctAftWqltBod[5] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[5] = Number(inflAssctBfrWqltBod[5] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[5] = Number(inflAssctAftWqltTocCnt[5] || 0) + 1; inflAssctBfrWqltTocCnt[5] = Number(inflAssctBfrWqltTocCnt[5] || 0) + 1;
inflAssctAftWqltToc[5] = Number(inflAssctAftWqltToc[5] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[5] = Number(inflAssctBfrWqltToc[5] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[5] = Number(inflAssctAftWqltSsCnt[5] || 0) + 1; inflAssctBfrWqltSsCnt[5] = Number(inflAssctBfrWqltSsCnt[5] || 0) + 1;
inflAssctAftWqltSs[5] = Number(inflAssctAftWqltSs[5] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[5] = Number(inflAssctBfrWqltSs[5] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[5] = Number(inflAssctAftWqltTnCnt[5] || 0) + 1; inflAssctBfrWqltTnCnt[5] = Number(inflAssctBfrWqltTnCnt[5] || 0) + 1;
inflAssctAftWqltTn[5] = Number(inflAssctAftWqltTn[5] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[5] = Number(inflAssctBfrWqltTn[5] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[5] = Number(inflAssctAftWqltTpCnt[5] || 0) + 1; inflAssctBfrWqltTpCnt[5] = Number(inflAssctBfrWqltTpCnt[5] || 0) + 1;
inflAssctAftWqltTp[5] = Number(inflAssctAftWqltTp[5] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[5] = Number(inflAssctBfrWqltTp[5] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[5] = Number(efflWqltBodCnt[5] || 0) + 1; efflWqltBodCnt[5] = Number(efflWqltBodCnt[5] || 0) + 1;
efflWqltBod[5] = Number(efflWqltBod[5] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[5] = Number(efflWqltBod[5] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[5] = Number(efflWqltCodCnt[5] || 0) + 1; efflWqltTocCnt[5] = Number(efflWqltTocCnt[5] || 0) + 1;
efflWqltCod[5] = Number(efflWqltCod[5] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[5] = Number(efflWqltToc[5] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[5] = Number(efflWqltSsCnt[5] || 0) + 1; efflWqltSsCnt[5] = Number(efflWqltSsCnt[5] || 0) + 1;
efflWqltSs[5] = Number(efflWqltSs[5] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[5] = Number(efflWqltSs[5] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[5] = Number(efflWqltTnCnt[5] || 0) + 1; efflWqltTnCnt[5] = Number(efflWqltTnCnt[5] || 0) + 1;
@@ -1423,20 +1580,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmtCnt[6] = Number(inflAmtCnt[6] || 0) + 1; inflAmtCnt[6] = Number(inflAmtCnt[6] || 0) + 1;
inflAmnt[6] = Number(inflAmnt[6] || 0) + Number(item.inflAmnt || 0); inflAmnt[6] = Number(inflAmnt[6] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[6] = 0; fcltyCpct[6] = 0;
inflAssctAftWqltBodCnt[6] = Number(inflAssctAftWqltBodCnt[6] || 0) + 1; inflAssctBfrWqltBodCnt[6] = Number(inflAssctBfrWqltBodCnt[6] || 0) + 1;
inflAssctAftWqltBod[6] = Number(inflAssctAftWqltBod[6] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[6] = Number(inflAssctBfrWqltBod[6] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[6] = Number(inflAssctAftWqltTocCnt[6] || 0) + 1; inflAssctBfrWqltTocCnt[6] = Number(inflAssctBfrWqltTocCnt[6] || 0) + 1;
inflAssctAftWqltToc[6] = Number(inflAssctAftWqltToc[6] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[6] = Number(inflAssctBfrWqltToc[6] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[6] = Number(inflAssctAftWqltSsCnt[6] || 0) + 1; inflAssctBfrWqltSsCnt[6] = Number(inflAssctBfrWqltSsCnt[6] || 0) + 1;
inflAssctAftWqltSs[6] = Number(inflAssctAftWqltSs[6] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[6] = Number(inflAssctBfrWqltSs[6] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[6] = Number(inflAssctAftWqltTnCnt[6] || 0) + 1; inflAssctBfrWqltTnCnt[6] = Number(inflAssctBfrWqltTnCnt[6] || 0) + 1;
inflAssctAftWqltTn[6] = Number(inflAssctAftWqltTn[6] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[6] = Number(inflAssctBfrWqltTn[6] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[6] = Number(inflAssctAftWqltTpCnt[6] || 0) + 1; inflAssctBfrWqltTpCnt[6] = Number(inflAssctBfrWqltTpCnt[6] || 0) + 1;
inflAssctAftWqltTp[6] = Number(inflAssctAftWqltTp[6] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[6] = Number(inflAssctBfrWqltTp[6] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[6] = Number(efflWqltBodCnt[6] || 0) + 1; efflWqltBodCnt[6] = Number(efflWqltBodCnt[6] || 0) + 1;
efflWqltBod[6] = Number(efflWqltBod[6] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[6] = Number(efflWqltBod[6] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[6] = Number(efflWqltCodCnt[6] || 0) + 1; efflWqltTocCnt[6] = Number(efflWqltTocCnt[6] || 0) + 1;
efflWqltCod[6] = Number(efflWqltCod[6] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[6] = Number(efflWqltToc[6] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[6] = Number(efflWqltSsCnt[6] || 0) + 1; efflWqltSsCnt[6] = Number(efflWqltSsCnt[6] || 0) + 1;
efflWqltSs[6] = Number(efflWqltSs[6] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[6] = Number(efflWqltSs[6] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[6] = Number(efflWqltTnCnt[6] || 0) + 1; efflWqltTnCnt[6] = Number(efflWqltTnCnt[6] || 0) + 1;
@@ -1448,20 +1605,20 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmtCnt[7] = Number(inflAmtCnt[7] || 0) + 1; inflAmtCnt[7] = Number(inflAmtCnt[7] || 0) + 1;
inflAmnt[7] = Number(inflAmnt[7] || 0) + Number(item.inflAmnt || 0); inflAmnt[7] = Number(inflAmnt[7] || 0) + Number(item.inflAmnt || 0);
fcltyCpct[7] = 0; fcltyCpct[7] = 0;
inflAssctAftWqltBodCnt[7] = Number(inflAssctAftWqltBodCnt[7] || 0) + 1; inflAssctBfrWqltBodCnt[7] = Number(inflAssctBfrWqltBodCnt[7] || 0) + 1;
inflAssctAftWqltBod[7] = Number(inflAssctAftWqltBod[7] || 0) + Number(item.inflAssctAftWqltBod || 0); inflAssctBfrWqltBod[7] = Number(inflAssctBfrWqltBod[7] || 0) + Number(item.inflAssctBfrWqltBod || 0);
inflAssctAftWqltTocCnt[7] = Number(inflAssctAftWqltTocCnt[7] || 0) + 1; inflAssctBfrWqltTocCnt[7] = Number(inflAssctBfrWqltTocCnt[7] || 0) + 1;
inflAssctAftWqltToc[7] = Number(inflAssctAftWqltToc[7] || 0) + Number(item.inflAssctAftWqltToc || 0); inflAssctBfrWqltToc[7] = Number(inflAssctBfrWqltToc[7] || 0) + Number(item.inflAssctBfrWqltToc || 0);
inflAssctAftWqltSsCnt[7] = Number(inflAssctAftWqltSsCnt[7] || 0) + 1; inflAssctBfrWqltSsCnt[7] = Number(inflAssctBfrWqltSsCnt[7] || 0) + 1;
inflAssctAftWqltSs[7] = Number(inflAssctAftWqltSs[7] || 0) + Number(item.inflAssctAftWqltSs || 0); inflAssctBfrWqltSs[7] = Number(inflAssctBfrWqltSs[7] || 0) + Number(item.inflAssctBfrWqltSs || 0);
inflAssctAftWqltTnCnt[7] = Number(inflAssctAftWqltTnCnt[7] || 0) + 1; inflAssctBfrWqltTnCnt[7] = Number(inflAssctBfrWqltTnCnt[7] || 0) + 1;
inflAssctAftWqltTn[7] = Number(inflAssctAftWqltTn[7] || 0) + Number(item.inflAssctAftWqltTn || 0); inflAssctBfrWqltTn[7] = Number(inflAssctBfrWqltTn[7] || 0) + Number(item.inflAssctBfrWqltTn || 0);
inflAssctAftWqltTpCnt[7] = Number(inflAssctAftWqltTpCnt[7] || 0) + 1; inflAssctBfrWqltTpCnt[7] = Number(inflAssctBfrWqltTpCnt[7] || 0) + 1;
inflAssctAftWqltTp[7] = Number(inflAssctAftWqltTp[7] || 0) + Number(item.inflAssctAftWqltTp || 0); inflAssctBfrWqltTp[7] = Number(inflAssctBfrWqltTp[7] || 0) + Number(item.inflAssctBfrWqltTp || 0);
efflWqltBodCnt[7] = Number(efflWqltBodCnt[7] || 0) + 1; efflWqltBodCnt[7] = Number(efflWqltBodCnt[7] || 0) + 1;
efflWqltBod[7] = Number(efflWqltBod[7] || 0) + Number(item.efflWqltBod || 0); efflWqltBod[7] = Number(efflWqltBod[7] || 0) + Number(item.efflWqltBod || 0);
efflWqltCodCnt[7] = Number(efflWqltCodCnt[7] || 0) + 1; efflWqltTocCnt[7] = Number(efflWqltTocCnt[7] || 0) + 1;
efflWqltCod[7] = Number(efflWqltCod[7] || 0) + Number(item.efflWqltCod || 0); efflWqltToc[7] = Number(efflWqltToc[7] || 0) + Number(item.efflWqltToc || 0);
efflWqltSsCnt[7] = Number(efflWqltSsCnt[7] || 0) + 1; efflWqltSsCnt[7] = Number(efflWqltSsCnt[7] || 0) + 1;
efflWqltSs[7] = Number(efflWqltSs[7] || 0) + Number(item.efflWqltSs || 0); efflWqltSs[7] = Number(efflWqltSs[7] || 0) + Number(item.efflWqltSs || 0);
efflWqltTnCnt[7] = Number(efflWqltTnCnt[7] || 0) + 1; efflWqltTnCnt[7] = Number(efflWqltTnCnt[7] || 0) + 1;
@@ -1539,13 +1696,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
for(let idx=0; idx<inflAmnt.length; idx++){ for(let idx=0; idx<inflAmnt.length; idx++){
inflAmnt[idx] = calculateAverage(Number(inflAmnt[idx]), Number(inflAmtCnt[idx])); inflAmnt[idx] = calculateAverage(Number(inflAmnt[idx]), Number(inflAmtCnt[idx]));
inflAssctAftWqltBod[idx] = calculateAverage(Number(inflAssctAftWqltBod[idx]), Number(inflAssctAftWqltBodCnt[idx])); inflAssctBfrWqltBod[idx] = calculateAverage(Number(inflAssctBfrWqltBod[idx]), Number(inflAssctBfrWqltBodCnt[idx]));
inflAssctAftWqltToc[idx] = calculateAverage(Number(inflAssctAftWqltToc[idx]), Number(inflAssctAftWqltTocCnt[idx])); inflAssctBfrWqltToc[idx] = calculateAverage(Number(inflAssctBfrWqltToc[idx]), Number(inflAssctBfrWqltTocCnt[idx]));
inflAssctAftWqltSs[idx] = calculateAverage(Number(inflAssctAftWqltSs[idx]), Number(inflAssctAftWqltSsCnt[idx])); inflAssctBfrWqltSs[idx] = calculateAverage(Number(inflAssctBfrWqltSs[idx]), Number(inflAssctBfrWqltSsCnt[idx]));
inflAssctAftWqltTn[idx] = calculateAverage(Number(inflAssctAftWqltTn[idx]), Number(inflAssctAftWqltTnCnt[idx])); inflAssctBfrWqltTn[idx] = calculateAverage(Number(inflAssctBfrWqltTn[idx]), Number(inflAssctBfrWqltTnCnt[idx]));
inflAssctAftWqltTp[idx] = calculateAverage(Number(inflAssctAftWqltTp[idx]), Number(inflAssctAftWqltTpCnt[idx])); inflAssctBfrWqltTp[idx] = calculateAverage(Number(inflAssctBfrWqltTp[idx]), Number(inflAssctBfrWqltTpCnt[idx]));
efflWqltBod[idx] = calculateAverage(Number(efflWqltBod[idx]), Number(efflWqltBodCnt[idx])); efflWqltBod[idx] = calculateAverage(Number(efflWqltBod[idx]), Number(efflWqltBodCnt[idx]));
efflWqltCod[idx] = calculateAverage(Number(efflWqltCod[idx]), Number(efflWqltCodCnt[idx])); efflWqltToc[idx] = calculateAverage(Number(efflWqltToc[idx]), Number(efflWqltTocCnt[idx]));
efflWqltSs[idx] = calculateAverage(Number(efflWqltSs[idx]), Number(efflWqltSsCnt[idx])); efflWqltSs[idx] = calculateAverage(Number(efflWqltSs[idx]), Number(efflWqltSsCnt[idx]));
efflWqltTn[idx] = calculateAverage(Number(efflWqltTn[idx]), Number(efflWqltTnCnt[idx])); efflWqltTn[idx] = calculateAverage(Number(efflWqltTn[idx]), Number(efflWqltTnCnt[idx]));
efflWqltTp[idx] = calculateAverage(Number(efflWqltTp[idx]), Number(efflWqltTpCnt[idx])); efflWqltTp[idx] = calculateAverage(Number(efflWqltTp[idx]), Number(efflWqltTpCnt[idx]));
@@ -1558,13 +1715,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
inflAmnt[0] = calculateAverage(calculateTotal(inflAmnt), dataIsCount); inflAmnt[0] = calculateAverage(calculateTotal(inflAmnt), dataIsCount);
fcltyCpct[0] = calculateTotal(fcltyCpct); fcltyCpct[0] = calculateTotal(fcltyCpct);
inflAssctAftWqltBod[0] = Number((calculateTotal(inflAssctAftWqltBod)/7).toFixed(1)); inflAssctBfrWqltBod[0] = Number((calculateTotal(inflAssctBfrWqltBod)/7).toFixed(1));
inflAssctAftWqltToc[0] = Number((calculateTotal(inflAssctAftWqltToc)/7).toFixed(1)); inflAssctBfrWqltToc[0] = Number((calculateTotal(inflAssctBfrWqltToc)/7).toFixed(1));
inflAssctAftWqltSs[0] = Number((calculateTotal(inflAssctAftWqltSs)/7).toFixed(1)); inflAssctBfrWqltSs[0] = Number((calculateTotal(inflAssctBfrWqltSs)/7).toFixed(1));
inflAssctAftWqltTn[0] = Number((calculateTotal(inflAssctAftWqltTn)/7).toFixed(3)); inflAssctBfrWqltTn[0] = Number((calculateTotal(inflAssctBfrWqltTn)/7).toFixed(3));
inflAssctAftWqltTp[0] = Number((calculateTotal(inflAssctAftWqltTp)/7).toFixed(3)); inflAssctBfrWqltTp[0] = Number((calculateTotal(inflAssctBfrWqltTp)/7).toFixed(3));
efflWqltBod[0] = Number((calculateTotal(efflWqltBod)/7).toFixed(1)); efflWqltBod[0] = Number((calculateTotal(efflWqltBod)/7).toFixed(1));
efflWqltCod[0] = Number((calculateTotal(efflWqltCod)/7).toFixed(1)); efflWqltToc[0] = Number((calculateTotal(efflWqltToc)/7).toFixed(1));
efflWqltSs[0] = Number((calculateTotal(efflWqltSs as number[])/7).toFixed(1)); efflWqltSs[0] = Number((calculateTotal(efflWqltSs as number[])/7).toFixed(1));
efflWqltTn[0] = Number((calculateTotal(efflWqltTn as number[])/7).toFixed(3)); efflWqltTn[0] = Number((calculateTotal(efflWqltTn as number[])/7).toFixed(3));
efflWqltTp[0] = Number((calculateTotal(efflWqltTp as number[])/7).toFixed(3)); efflWqltTp[0] = Number((calculateTotal(efflWqltTp as number[])/7).toFixed(3));
@@ -1581,13 +1738,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
dsInflWqltSs: dsInflWqltSs[index] ? Number(dsInflWqltSs[index].toFixed(1)) : '', dsInflWqltSs: dsInflWqltSs[index] ? Number(dsInflWqltSs[index].toFixed(1)) : '',
dsInflWqltTn: dsInflWqltTn[index] ? dsInflWqltTn[index].toFixed(3) : '', dsInflWqltTn: dsInflWqltTn[index] ? dsInflWqltTn[index].toFixed(3) : '',
dsInflWqltTp: dsInflWqltTp[index] ? dsInflWqltTp[index].toFixed(3) : '', dsInflWqltTp: dsInflWqltTp[index] ? dsInflWqltTp[index].toFixed(3) : '',
inflAssctAftWqltBod: inflAssctAftWqltBod[index] ? Number(inflAssctAftWqltBod[index].toFixed(1)) : '', inflAssctBfrWqltBod: inflAssctBfrWqltBod[index] ? Number(inflAssctBfrWqltBod[index].toFixed(1)) : '',
inflAssctAftWqltToc: inflAssctAftWqltToc[index] ? Number(inflAssctAftWqltToc[index].toFixed(1)) : '', inflAssctBfrWqltToc: inflAssctBfrWqltToc[index] ? Number(inflAssctBfrWqltToc[index].toFixed(1)) : '',
inflAssctAftWqltSs: inflAssctAftWqltSs[index] ? Number(inflAssctAftWqltSs[index].toFixed(1)) : '', inflAssctBfrWqltSs: inflAssctBfrWqltSs[index] ? Number(inflAssctBfrWqltSs[index].toFixed(1)) : '',
inflAssctAftWqltTn: inflAssctAftWqltTn[index] ? inflAssctAftWqltTn[index].toFixed(3) : '', inflAssctBfrWqltTn: inflAssctBfrWqltTn[index] ? inflAssctBfrWqltTn[index].toFixed(3) : '',
inflAssctAftWqltTp: inflAssctAftWqltTp[index] ? inflAssctAftWqltTp[index].toFixed(3) : '', inflAssctBfrWqltTp: inflAssctBfrWqltTp[index] ? inflAssctBfrWqltTp[index].toFixed(3) : '',
efflWqltBod: efflWqltBod[index] ? Number(efflWqltBod[index].toFixed(1)) : '', efflWqltBod: efflWqltBod[index] ? Number(efflWqltBod[index].toFixed(1)) : '',
efflWqltCod: efflWqltCod[index] ? Number(efflWqltCod[index].toFixed(1)) : '', efflWqltToc: efflWqltToc[index] ? Number(efflWqltToc[index].toFixed(1)) : '',
efflWqltSs: efflWqltSs[index] ? Number(efflWqltSs[index].toFixed(1)) : '', efflWqltSs: efflWqltSs[index] ? Number(efflWqltSs[index].toFixed(1)) : '',
efflWqltTn: efflWqltTn[index] ? efflWqltTn[index].toFixed(3) : '', efflWqltTn: efflWqltTn[index] ? efflWqltTn[index].toFixed(3) : '',
efflWqltTp: efflWqltTp[index] ? efflWqltTp[index].toFixed(3) : '' efflWqltTp: efflWqltTp[index] ? efflWqltTp[index].toFixed(3) : ''
@@ -1607,13 +1764,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
설계유입수질SS: item.dsInflWqltSs ? Number(Number(item.dsInflWqltSs).toFixed(1)) : '', 설계유입수질SS: item.dsInflWqltSs ? Number(Number(item.dsInflWqltSs).toFixed(1)) : '',
설계유입수질TN: item.dsInflWqltTn ? Number(item.dsInflWqltTn).toFixed(3) : '', 설계유입수질TN: item.dsInflWqltTn ? Number(item.dsInflWqltTn).toFixed(3) : '',
설계유입수질TP: item.dsInflWqltTp ? Number(item.dsInflWqltTp).toFixed(3) : '', 설계유입수질TP: item.dsInflWqltTp ? Number(item.dsInflWqltTp).toFixed(3) : '',
유입수질BOD: item.inflAssctAftWqltBod ? Number(Number(item.inflAssctAftWqltBod).toFixed(1)) : '', 유입수질BOD: item.inflAssctBfrWqltBod ? Number(Number(item.inflAssctBfrWqltBod).toFixed(1)) : '',
유입수질TOC: item.inflAssctAftWqltToc ? Number(Number(item.inflAssctAftWqltToc).toFixed(1)) : '', 유입수질TOC: item.inflAssctBfrWqltToc ? Number(Number(item.inflAssctBfrWqltToc).toFixed(1)) : '',
유입수질SS: item.inflAssctAftWqltSs ? Number(Number(item.inflAssctAftWqltSs).toFixed(1)) : '', 유입수질SS: item.inflAssctBfrWqltSs ? Number(Number(item.inflAssctBfrWqltSs).toFixed(1)) : '',
유입수질TN: item.inflAssctAftWqltTn ? Number(item.inflAssctAftWqltTn).toFixed(3) : '', 유입수질TN: item.inflAssctBfrWqltTn ? Number(item.inflAssctBfrWqltTn).toFixed(3) : '',
유입수질TP: item.inflAssctAftWqltTp ? Number(item.inflAssctAftWqltTp).toFixed(3) : '', 유입수질TP: item.inflAssctBfrWqltTp ? Number(item.inflAssctBfrWqltTp).toFixed(3) : '',
방류수질BOD: item.efflWqltBod ? Number(Number(item.efflWqltBod).toFixed(1)) : '', 방류수질BOD: item.efflWqltBod ? Number(Number(item.efflWqltBod).toFixed(1)) : '',
방류수질TOC: item.efflWqltCod ? Number(Number(item.efflWqltCod).toFixed(1)) : '', 방류수질TOC: item.efflWqltToc ? Number(Number(item.efflWqltToc).toFixed(1)) : '',
방류수질SS: item.efflWqltSs ? Number(Number(item.efflWqltSs).toFixed(1)) : '', 방류수질SS: item.efflWqltSs ? Number(Number(item.efflWqltSs).toFixed(1)) : '',
방류수질TN: item.efflWqltTn ? Number(item.efflWqltTn).toFixed(3) : '', 방류수질TN: item.efflWqltTn ? Number(item.efflWqltTn).toFixed(3) : '',
방류수질TP: item.efflWqltTp ? Number(item.efflWqltTp).toFixed(3) : '', 방류수질TP: item.efflWqltTp ? Number(item.efflWqltTp).toFixed(3) : '',
@@ -1627,61 +1784,13 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
...state.RainManage, ...state.RainManage,
rainManageList: filteredData as RainManageListProps[], rainManageList: filteredData as RainManageListProps[],
excelList: excelList, excelList: excelList,
isLoadingRainManage : false,
} : { } : {
...state.RainManage, ...state.RainManage,
rainManageList: filteredData as RainManageListProps[], rainManageList: filteredData as RainManageListProps[],
isLoadingRainManage : false,
} }
})); }));
}, },
searchDrainageEquipment: async (searchYear: string, fcltyCd: string, isExcel : boolean) => {
await fetchDrainageEquipment(searchYear, fcltyCd);
/* if(res == null || res.data.wqltObjs == null || res.data.wqltObjs.length === 0) {
set((state: DashBoardType) => ({
...state.RainManage,
rainManageList: [],
}));
return;
} */
/* if(isExcel){
res.data.wqltObjs.forEach((item) => {
excelList.push({
강우량: item.rainItem,
강우조건비율: item.rainRate || 0,
일수: item.rainDay || 0,
유입유량: item.inflAmnt || 0,
시설용량대비: item.fctCpc || 0,
설계유입수질BOD: item.dsInflWqltBod || 0,
설계유입수질TOC: item.dsInflWqltCod || 0,
설계유입수질SS: item.dsInflWqltSs || 0,
설계유입수질TN: item.dsInflWqltTn || 0,
설계유입수질TP: item.dsInflWqltTp || 0,
유입수질BOD: item.inflAssctAftWqltBod || 0,
유입수질COD: item.inflAssctAftWqltToc || 0,
유입수질SS: item.inflAssctAftWqltSs || 0,
유입수질TN: item.inflAssctAftWqltTn || 0,
유입수질TP: item.inflAssctAftWqltTp || 0,
방류수질BOD: item.efflWqltBod || 0,
방류수질COD: item.efflWqltCod || 0,
방류수질SS: item.efflWqltSs || 0,
방류수질TN: item.efflWqltTn || 0,
방류수질TP: item.efflWqltTp || 0,
});
});
} */
set((state: DashBoardType) => ({
...state,
DrainageEquipment: isExcel ? {
...state.DrainageEquipment,
drainageEquipmentList: drainageEquipmentList,
drainageEquipmentExcelList: [],
} : {
...state.DrainageEquipment,
drainageEquipmentList: drainageEquipmentList,
}
}));
}
} }
} }
@@ -217,6 +217,7 @@ export type FacilityPrecipitationType = {
facilityPrecipitation: FacilityPrecipitationProps[]; facilityPrecipitation: FacilityPrecipitationProps[];
excelList: ExcelType[]; excelList: ExcelType[];
facilityPrecipitationCount: number; facilityPrecipitationCount: number;
isLoading: boolean;
}, },
PrecipitationDetail : { PrecipitationDetail : {
@@ -239,7 +240,8 @@ export const facilityPrecipitationInitState: FacilityPrecipitationType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
facilityPrecipitation : facilityPrecipitation, facilityPrecipitation : facilityPrecipitation,
excelList : [], excelList : [],
facilityPrecipitationCount : 0 facilityPrecipitationCount : 0,
isLoading : true,
}, },
PrecipitationDetail : { PrecipitationDetail : {
@@ -254,6 +256,14 @@ export type FacilityPrecipitationStore = FacilityPrecipitationType & FacilityPre
export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitationType) => FacilityPrecipitationType) => void)=>FacilityPrecipitationActions=(set: (fn: (state: FacilityPrecipitationType) => FacilityPrecipitationType) => void) => { export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitationType) => FacilityPrecipitationType) => void)=>FacilityPrecipitationActions=(set: (fn: (state: FacilityPrecipitationType) => FacilityPrecipitationType) => void) => {
return { return {
searchFacilityPrecipitationList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchFacilityPrecipitationList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: FacilityPrecipitationType) => ({
...state,
FacilityPrecipitation: {
...state.FacilityPrecipitation,
isLoading: true,
},
}));
const res = await fetchFacilityPrecipitationList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchFacilityPrecipitationList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data; const data = res.data;
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
@@ -293,13 +303,15 @@ export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitatio
...state.FacilityPrecipitation, ...state.FacilityPrecipitation,
facilityPrecipitation: res.data, facilityPrecipitation: res.data,
facilityPrecipitationCount: res.count, facilityPrecipitationCount: res.count,
isLoading : false,
}:{ }:{
...state.FacilityPrecipitation, ...state.FacilityPrecipitation,
excelList: excelDownList, excelList: excelDownList,
isLoading : false,
}, },
PrecipitationDetail:{ PrecipitationDetail:{
...state.PrecipitationDetail, ...state.PrecipitationDetail,
gridListPrecipitationDetail: res.detailData gridListPrecipitationDetail: res.detailData,
} }
})) }))
} }
+103 -81
View File
@@ -21,12 +21,16 @@ export interface FacilityWaterQltyProps {
sggNm: string, sggNm: string,
addr: string, addr: string,
fctCpc: number, fctCpc: number,
inflAssctBfrWqltBod: string | '',
inflAssctAftWqltBod: string | '', inflAssctAftWqltBod: string | '',
inflAssctBfrWqltToc: string | '',
inflAssctAftWqltToc: string | '', inflAssctAftWqltToc: string | '',
inflAssctBfrWqltSs: string | '',
inflAssctAftWqltSs: string | '', inflAssctAftWqltSs: string | '',
inflAssctBfrWqltTn: string | '',
inflAssctAftWqltTn: string | '', inflAssctAftWqltTn: string | '',
inflAssctAftWqltTp: string | '',
inflAssctBfrWqltTp: string | '', inflAssctBfrWqltTp: string | '',
inflAssctAftWqltTp: string | '',
efflWqltBod: string | '', efflWqltBod: string | '',
efflWqltToc: string | '', efflWqltToc: string | '',
efflWqltSs: string | '', efflWqltSs: string | '',
@@ -127,11 +131,11 @@ const upHeadList1: TableUpperProps[] = [
{ id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0 }, { id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0 },
{ id: "A", title: "유입", colSpan: 5, row: 0 }, { id: "A", title: "유입", colSpan: 5, row: 0 },
{ id: "B", title: "방류", colSpan: 5, row: 0 }, { id: "B", title: "방류", colSpan: 5, row: 0 },
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1 }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1 },
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1 },
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1 },
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1 }, { id: "inflAssctBfrWqltTn", 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: "inflAssctBfrWqltTp", 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: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1 },
{ id: "efflWqltToc", 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: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1 },
@@ -151,11 +155,11 @@ const upHeadList2: TableUpperProps[] = [
{ id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2 },
{ id: "A", title: "유입", colSpan: 5, row: 0 }, { id: "A", title: "유입", colSpan: 5, row: 0 },
{ id: "B", title: "방류", colSpan: 5, row: 0 }, { id: "B", title: "방류", colSpan: 5, row: 0 },
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 },
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 }, { id: "inflAssctBfrWqltTn", 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: "inflAssctBfrWqltTp", 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: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 },
{ id: "efflWqltToc", 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: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
@@ -179,11 +183,11 @@ const upHeadList3: TableUpperProps[] = [
{ id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2 },
{ id: "A", title: "유입", colSpan: 5, row: 0 }, { id: "A", title: "유입", colSpan: 5, row: 0 },
{ id: "B", title: "방류", colSpan: 5, row: 0 }, { id: "B", title: "방류", colSpan: 5, row: 0 },
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1 },
{ id: "inflAssctAftWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 },
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1 },
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1 }, { id: "inflAssctBfrWqltTn", 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: "inflAssctBfrWqltTp", 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: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1 },
{ id: "efflWqltToc", 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: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1 },
@@ -197,10 +201,10 @@ const upHeadList3: TableUpperProps[] = [
// 처리시설 수질현황 헤더(모달-연간) // 처리시설 수질현황 헤더(모달-연간)
const upHeadListModalYear: TableUpperProps[] = [ const upHeadListModalYear: TableUpperProps[] = [
{ id: "msrDt", title: "날짜" }, { id: "msrDt", title: "날짜" },
{ id: "inflAssctAftWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe1", upSequnce: 1, align: "right" }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe1", upSequnce: 1, align: "right" },
{ id: "inflAssctAftWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" }, { id: "inflAssctBfrWqltToc", title: "TOC(COD)\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" },
{ id: "inflAssctAftWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe1", upSequnce: 3, align: "right" },
{ id: "inflAssctAftWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe1", upSequnce: 2, align: "right" }, { id: "inflAssctBfrWqltTn", 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: "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: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe2", upSequnce: 1, align: "right" },
{ id: "efflWqltToc", 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" },
@@ -288,6 +292,7 @@ export type FacilityWaterQltyType = {
upHeadList1: TableUpperProps[]; upHeadList1: TableUpperProps[];
upHeadList2: TableUpperProps[]; upHeadList2: TableUpperProps[];
upHeadList3: TableUpperProps[]; upHeadList3: TableUpperProps[];
isLoading: boolean;
}, },
FacilityWaterQltyModal: { FacilityWaterQltyModal: {
@@ -311,6 +316,7 @@ export const facilityWaterQltyInitState: FacilityWaterQltyType = {
facilityWaterQltyCount: 0, facilityWaterQltyCount: 0,
facilityWaterQltyList: [], facilityWaterQltyList: [],
excelList: [], excelList: [],
isLoading: true,
isInit: false, isInit: false,
mainLabelArray: mainLabelArray, mainLabelArray: mainLabelArray,
upHeadList1: upHeadList1, upHeadList1: upHeadList1,
@@ -361,8 +367,8 @@ export type FacilityWaterQltyActions = {
* @returns : 없음 * @returns : 없음
* @description : 시설수질리스트 타입의 데이터를 표현 방식으로 바꿔주는 함수 * @description : 시설수질리스트 타입의 데이터를 표현 방식으로 바꿔주는 함수
* - msrDt : YYYY-MM-DD 형식으로 변환 * - msrDt : YYYY-MM-DD 형식으로 변환
* - inflAssctAftWqltBod : 소수점 1자리까지 표현 * - inflAssctBfrWqltBod : 소수점 1자리까지 표현
* - inflAssctAftWqltTn : 소수점 1자리까지 표현 * - inflAssctBfrWqltTn : 소수점 1자리까지 표현
* - inflAssctBfrWqltTp : 소수점 1자리까지 표현 * - inflAssctBfrWqltTp : 소수점 1자리까지 표현
* - efflWqltBod : 소수점 2자리까지 표현 * - efflWqltBod : 소수점 2자리까지 표현
* - efflWqltTn : 소수점 2자리까지 표현 * - efflWqltTn : 소수점 2자리까지 표현
@@ -391,41 +397,48 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
* @param fcltyNm : 시설명 * @param fcltyNm : 시설명
*/ */
searchFacilityWaterQltyList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchFacilityWaterQltyList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: FacilityWaterQltyType) => ({
...state,
FacilityWaterQltyMain: {
...state.FacilityWaterQltyMain,
isLoading: true,
},
}));
const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
const rtnData = res.data.map(item => { const rtnData = res.data.map(item => {
dataFormSetting(item) dataFormSetting(item)
if(item.inflAssctAftWqltTn) { if(item.inflAssctBfrWqltTn) {
item.inflAssctAftWqltTn = Number(Math.round(Number(item.inflAssctAftWqltTn) * 1000)/1000).toFixed(3); item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000)/1000).toFixed(3);
} }
if(item.efflWqltTn){ if(item.efflWqltTn){
item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3); item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3);
} }
if(item.inflAssctAftWqltTp){ if(item.inflAssctBfrWqltTp){
item.inflAssctAftWqltTp = Number(Math.round(Number(item.inflAssctAftWqltTp) * 1000)/1000).toFixed(3); item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000)/1000).toFixed(3);
} }
if(item.efflWqltTp){ if(item.efflWqltTp){
item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3); item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3);
} }
if(item.inflAssctAftWqltToc){ if(item.inflAssctBfrWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
} }
if(item.efflWqltToc){ if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
} }
if(item.inflAssctAftWqltBod){ if(item.inflAssctBfrWqltBod){
item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1); item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10)/10).toFixed(1);
} }
if(item.efflWqltBod){ if(item.efflWqltBod){
item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1); item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1);
} }
if(item.inflAssctAftWqltSs){ if(item.inflAssctBfrWqltSs){
item.inflAssctAftWqltSs = Number(Math.round(Number(item.inflAssctAftWqltSs) * 10)/10).toFixed(1); item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10)/10).toFixed(1);
} }
if(item.efflWqltSs){ if(item.efflWqltSs){
item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1); item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1);
} }
if(item.inflAssctAftWqltToc){ if(item.inflAssctBfrWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
} }
if(item.efflWqltToc){ if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
@@ -450,11 +463,11 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
시설이름: item.bscFctNm, 시설이름: item.bscFctNm,
주소: item.addr, 주소: item.addr,
용량: item.fctCpc, 용량: item.fctCpc,
유입BOD: item.inflAssctAftWqltBod, 유입BOD: item.inflAssctBfrWqltBod,
유입TOC: item.inflAssctAftWqltToc, 유입TOC: item.inflAssctBfrWqltToc,
유입SS: item.inflAssctAftWqltSs, 유입SS: item.inflAssctBfrWqltSs,
유입TN: item.inflAssctAftWqltTn, 유입TN: item.inflAssctBfrWqltTn,
유입TP: item.inflAssctAftWqltTp, 유입TP: item.inflAssctBfrWqltTp,
유출BOD: item.efflWqltBod, 유출BOD: item.efflWqltBod,
유출TOC: item.efflWqltToc, 유출TOC: item.efflWqltToc,
유출SS: item.efflWqltSs, 유출SS: item.efflWqltSs,
@@ -476,10 +489,12 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
...state.FacilityWaterQltyMain, ...state.FacilityWaterQltyMain,
facilityWaterQltyList: rtnData, facilityWaterQltyList: rtnData,
facilityWaterQltyCount: res.count, facilityWaterQltyCount: res.count,
isLoading : false,
}:{ }:{
...state.FacilityWaterQltyMain, ...state.FacilityWaterQltyMain,
excelList: excelDownList, excelList: excelDownList,
} isLoading : false,
},
})) }))
}, },
@@ -556,47 +571,54 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
return; return;
} }
const tmpData:FacilityWaterQltyProps[] = [];
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용 // facilityPrecipitation의 rainEffectDay 계산 로직을 적용
for(let idx = 0; idx < res.data.wqltObjs.length; idx++) {
const item = res.data.wqltObjs[idx];
if (!item) continue;
const rainDay = Number(item.infoRnDay) >= 3 ? 1 : 0; const data = res.data.wqltObjs;
let rainEffectDay = 0; // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
for(let idx = 0; idx < data.length; idx++) {
if(idx < res.data.wqltObjs.length - 2) { const item = data[idx];
if(rainDay == 1) { if(item){
rainEffectDay = 1; if(item.infoRnDay && Number(item.infoRnDay) > 3) {
item.rainEffectDay = 1;
} else { } else {
if(idx >= 2) { item.rainEffectDay = 0;
const prevItem1 = res.data.wqltObjs[idx-1];
const prevItem2 = res.data.wqltObjs[idx-2];
if((prevItem1 && Number(prevItem1.infoRnDay) >= 3) || (prevItem2 && Number(prevItem2.infoRnDay) >= 3)) {
rainEffectDay = 1;
}
}
} }
} else if(idx < res.data.wqltObjs.length - 1) {
const nextItem = res.data.wqltObjs[idx+1];
if(rainDay == 1 || (nextItem && Number(nextItem.infoRnDay) >= 3)) {
rainEffectDay = 1;
}
} else {
rainEffectDay = rainDay;
} }
tmpData.push({
...item,
rainEffectDay: rainEffectDay,
} as FacilityWaterQltyProps);
} }
const rtnData = tmpData.map((item: FacilityWaterQltyProps) => { // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
for(let idx = 0; idx < data.length; idx++) {
if(data[idx]) {
// 하루 전이 강우영향일(3 이상)인 경우
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) {
data[idx]!.rainEffectDay = 1;
}
// 이틀 전이 강우영향일(3 이상)인 경우
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) {
data[idx]!.rainEffectDay = 1;
}
}
}
for(let idx = 0; idx < data.length; idx++) {
if(data[idx] && data[idx]?.rainEffectDay === 1) {
if(idx > 1){
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) > 3) {
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
}
}
if(idx > 2){
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) > 3) {
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
}
}
}
}
const rtnData = data.map((item: FacilityWaterQltyProps) => {
dataFormSetting(item) dataFormSetting(item)
if(item.inflAssctAftWqltTn) { if(item.inflAssctBfrWqltTn) {
item.inflAssctAftWqltTn = Number(Math.round(Number(item.inflAssctAftWqltTn) * 1000)/1000).toFixed(3); item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000)/1000).toFixed(3);
} }
if(item.efflWqltTn){ if(item.efflWqltTn){
item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3); item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3);
@@ -607,26 +629,26 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
if(item.efflWqltTp){ if(item.efflWqltTp){
item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3); item.efflWqltTp = Number(Math.round(Number(item.efflWqltTp) * 1000)/1000).toFixed(3);
} }
if(item.inflAssctAftWqltToc){ if(item.inflAssctBfrWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
} }
if(item.efflWqltToc){ if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
} }
if(item.inflAssctAftWqltBod){ if(item.inflAssctBfrWqltBod){
item.inflAssctAftWqltBod = Number(Math.round(Number(item.inflAssctAftWqltBod) * 10)/10).toFixed(1); item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 10)/10).toFixed(1);
} }
if(item.efflWqltBod){ if(item.efflWqltBod){
item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1); item.efflWqltBod = Number(Math.round(Number(item.efflWqltBod) * 10)/10).toFixed(1);
} }
if(item.inflAssctAftWqltSs){ if(item.inflAssctBfrWqltSs){
item.inflAssctAftWqltSs = Number(Math.round(Number(item.inflAssctAftWqltSs) * 10)/10).toFixed(1); item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 10)/10).toFixed(1);
} }
if(item.efflWqltSs){ if(item.efflWqltSs){
item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1); item.efflWqltSs = Number(Math.round(Number(item.efflWqltSs) * 10)/10).toFixed(1);
} }
if(item.inflAssctAftWqltToc){ if(item.inflAssctBfrWqltToc){
item.inflAssctAftWqltToc = Number(Math.round(Number(item.inflAssctAftWqltToc) * 10)/10).toFixed(1); item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 10)/10).toFixed(1);
} }
if(item.efflWqltToc){ if(item.efflWqltToc){
item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1); item.efflWqltToc = Number(Math.round(Number(item.efflWqltToc) * 10)/10).toFixed(1);
+48 -35
View File
@@ -170,7 +170,6 @@ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: s
try { try {
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
console.log(url);
return { data: res.data, count: res.count } return { data: res.data, count: res.count }
} catch (error) { } catch (error) {
console.error('시설정보 유량현황 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 유량현황 데이터를 가져오는데 실패했습니다:', error);
@@ -220,6 +219,7 @@ export type FlowRateSearchType = {
flowRateList:flowRateListProps[]; flowRateList:flowRateListProps[];
flowRateCount: number; flowRateCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean;
}, },
FlowRateModal : { FlowRateModal : {
@@ -253,7 +253,8 @@ export const flowRateSearchInitState:FlowRateSearchType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
flowRateList : flowRateList, flowRateList : flowRateList,
flowRateCount : 0, flowRateCount : 0,
excelList: [] excelList: [],
isLoading: true,
}, },
FlowRateModal : { FlowRateModal : {
isInit : false, isInit : false,
@@ -265,6 +266,13 @@ export const flowRateSearchInitState:FlowRateSearchType = {
export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => FlowRateSearchType) => void)=>FlowRateSearchActions=(set: (fn: (state: FlowRateSearchType) => FlowRateSearchType) => void) => { export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => FlowRateSearchType) => void)=>FlowRateSearchActions=(set: (fn: (state: FlowRateSearchType) => FlowRateSearchType) => void) => {
return { return {
searchFlowRateList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchFlowRateList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: FlowRateSearchType) => ({
...state,
FlowRateList: {
...state.FlowRateList,
isLoading: true,
},
}));
const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data; const data = res.data;
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
@@ -303,54 +311,59 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
...state.FlowRateList, ...state.FlowRateList,
flowRateList: rtnData, flowRateList: rtnData,
flowRateCount: res.count, flowRateCount: res.count,
isLoading : false,
}:{ }:{
...state.FlowRateList, ...state.FlowRateList,
excelList: excelDownList, excelList: excelDownList,
} isLoading : false,
},
})) }))
}, },
searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => { searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => {
const res = await fetchFlowRateModalList(bscFctCd, searchYear); const res = await fetchFlowRateModalList(bscFctCd, searchYear);
const data = res.data; const data = res.data;
const tmpData:FlowRateModalProps[] = []; // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
data.forEach((item: FlowRateModalProps) => {
if(item.infoRnDay && item.infoRnDay.toString().trim() === 'x') {
item.infoRnDay = '';
}
});
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용
for(let idx = 0; idx < data.length; idx++) { for(let idx = 0; idx < data.length; idx++) {
const item = data[idx]; const item = data[idx];
const rainDay = Number(item.infoRnDay) >= 3 ? 1 : 0; if(item){
let rainEffectDay = 0; if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) {
item.rainEffectDay = 1;
if(idx < data.length - 2) {
if(rainDay == 1) {
rainEffectDay = 1;
} else { } else {
if(idx >= 2) { item.rainEffectDay = 0;
if(Number(data[idx-1].infoRnDay) >= 3 || Number(data[idx-2].infoRnDay) >= 3) {
rainEffectDay = 1;
}
}
} }
} else if(idx < data.length - 1) {
if(rainDay == 1 || Number(data[idx+1].infoRnDay) >= 3) {
rainEffectDay = 1;
}
} else {
rainEffectDay = rainDay;
} }
tmpData.push({
...item,
rainEffectDay: rainEffectDay,
});
} }
const rtnData = tmpData.map((item: FlowRateModalProps) => { // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
for(let idx = 0; idx < data.length; idx++) {
if(data[idx]) {
// 하루 전이 강우영향일(3 이상)인 경우
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.rainEffectDay = 1;
}
// 이틀 전이 강우영향일(3 이상)인 경우
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.rainEffectDay = 1;
}
}
}
for(let idx = 0; idx < data.length; idx++) {
if(data[idx] && data[idx]?.rainEffectDay === 1) {
if(idx > 1){
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
}
}
if(idx > 2){
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
}
}
}
}
const rtnData = data.map((item: FlowRateModalProps) => {
item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0) item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0)
dataFormSetting(item); dataFormSetting(item);
return item; return item;
+36 -4
View File
@@ -1,6 +1,7 @@
import DataForm from "@/app/components/common/DataForm"; import DataForm from "@/app/components/common/DataForm";
import type { TableUpperProps } from "../dashboard"; import type { TableUpperProps } from "../dashboard";
import { getFetch } from "@/app/components/api"; import { getFetch } from "@/app/components/api";
import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput";
export type { TableUpperProps }; export type { TableUpperProps };
/**==================================== /**====================================
* Store - 타입 * Store - 타입
@@ -145,6 +146,7 @@ export type PlanSewageType = {
planSewageList: PlanSewageProps[]; planSewageList: PlanSewageProps[];
planSewageCount: number; planSewageCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean;
}, },
} }
@@ -161,7 +163,8 @@ export const planSewageInitState: PlanSewageType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
planSewageList : planSewageList, planSewageList : planSewageList,
planSewageCount : 0, planSewageCount : 0,
excelList : [] excelList : [],
isLoading : true,
}, },
} }
@@ -170,16 +173,43 @@ 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 { return {
searchPlanSewageList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchPlanSewageList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: PlanSewageType) => ({
...state,
PlanSewage: {
...state.PlanSewage,
isLoading: true,
},
}));
const res = await fetchPlanSewageList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchPlanSewageList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
console.log('res' , res.data); 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 = calRainEffectDay(res2.data, 'SUNNY');
let sumInflAmntSunny = 0;
let avgInflAmntSunny = 0;
calData.forEach((flowItem:FlowDataItem) => {
sumInflAmntSunny += Number(flowItem.inflAmnt);
})
avgInflAmntSunny = sumInflAmntSunny / calData.length;
item.avgInflAmntSunny = avgInflAmntSunny;
if(item.bscFctCd === '11200PB001R'){
console.log('avgInflAmntSunny : ',item.avgInflAmntSunny);
console.log('calData : ',calData);
}
return item;
}));
/** /**
* 결과데이터 계산 * 결과데이터 계산
* (1) 여유용량 = 시설용량 - 건기시 평균유량 * (1) 여유용량 = 시설용량 - 건기시 평균유량
* (2) 변동부하율 = 건기시 일최대 유량/일평균유량(기준 최근 3개년) * (2) 변동부하율 = 건기시 일최대 유량/일평균유량(기준 최근 3개년)
* (3) 분류식화율 = 분류식지역 면적(㎢)/처리구역 면적합계(㎢) ×100 * (3) 분류식화율 = 분류식지역 면적(㎢)/처리구역 면적합계(㎢) ×100
*/ */
const resultData = res.data.map((item:PlanSewageProps) => { const resultData = processedData.map((item:PlanSewageProps) => {
console.log('item.fctCpc : ',item.fctCpc);
console.log('item.avgInflAmntSunny : ',item.avgInflAmntSunny);
item.spareCapacity = Number(item.fctCpc) - Number(item.avgInflAmntSunny); item.spareCapacity = Number(item.fctCpc) - Number(item.avgInflAmntSunny);
item.variableLoadPercent = item.maxInflAmntSunny && item.maxInflAmntSunny!==0 ? Number(item.maxInflAmntSunny) / Number(item.avgInflAmntSunny) : 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; item.classifiedSewerPercent = item.sprtProcZoneAr && item.sprtProcZoneAr!==0 ? Number(item.sprtProcZoneAr) / Number(item.procZoneSm) * 100 : 0;
@@ -216,10 +246,12 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy
...state.PlanSewage, ...state.PlanSewage,
planSewageList: resultData, planSewageList: resultData,
planSewageCount: res.count, planSewageCount: res.count,
isLoading : false,
}:{ }:{
...state.PlanSewage, ...state.PlanSewage,
excelList: excelDownList, excelList: excelDownList,
} isLoading : false,
},
})) }))
} }
} }
+66 -45
View File
@@ -1,6 +1,7 @@
import { getFetchAreaList, postFetch } from "@/app/components/api"; import { postFetch } from "@/app/components/api";
import type { TableUpperProps } from "../dashboard";
import DataForm from "@/app/components/common/DataForm"; import DataForm from "@/app/components/common/DataForm";
import { fetchPlanInfo } from "../common";
import type { TableUpperProps } from "../dashboard";
export type { TableUpperProps }; export type { TableUpperProps };
/**==================================== /**====================================
* Store - 타입 * Store - 타입
@@ -227,25 +228,14 @@ const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => {
}; };
// 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) // 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우)
const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined ): Promise<{data:ProcessAreaProps[], count:number}> => { const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined, set : (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{data:ProcessAreaProps[], count:number}> => {
try { try {
targetYear = targetYear ? targetYear : "2024"; const res = await fetchPlanInfo(targetYear, ctpvNm, sggNm, undefined);
const baseUrl = 'https://apigateway.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy';
const queryParams = new URLSearchParams();
if (ctpvNm && ctpvNm !== '전체') queryParams.append('ctpvNm', ctpvNm);
if (sggNm && sggNm !== '전체') queryParams.append('sggNm', sggNm);
if (targetYear) queryParams.append('targetYear',targetYear);
const queryString = queryParams.toString();
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
const res = await getFetchAreaList(url);
if(res && res.length > 0){ if(res && res.length > 0){
const enrichedData = await Promise.all( const enrichedData = await Promise.all(
res.map(async (item: ProcessAreaProps) => { res.map(async (item: ProcessAreaProps) => {
upHeadList1.forEach((head:TableUpperProps) => { upHeadList1.forEach((head:TableUpperProps) => {
if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { /* if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
head.title = '현재\n(' + item.yr + '년)'; head.title = '현재\n(' + item.yr + '년)';
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
head.title = '1단계\n(' + item.yrDc1 + '년)'; head.title = '1단계\n(' + item.yrDc1 + '년)';
@@ -257,6 +247,19 @@ const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm :
head.title = '4단계\n(' + item.yrDc4 + '년)'; head.title = '4단계\n(' + item.yrDc4 + '년)';
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
head.title = '기승인\n4단계(' + item.yrDt4 + '년)'; head.title = '기승인\n4단계(' + item.yrDt4 + '년)';
} */
if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
head.title = '현재';
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
head.title = '1단계';
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
head.title = '2단계';
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
head.title = '3단계';
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
head.title = '4단계';
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
head.title = '기승인\n4단계';
} }
}); });
const res = await fetchFacilityDetailInfo(item.swtrmtFcltCd); const res = await fetchFacilityDetailInfo(item.swtrmtFcltCd);
@@ -280,6 +283,13 @@ const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm :
} }
} catch (error) { } catch (error) {
console.error('시설계획정보를 가져오는데 실패했습니다:', error); console.error('시설계획정보를 가져오는데 실패했습니다:', error);
set((state) => ({
...state,
ProcessArea : {
...state.ProcessArea,
isLoading : false
}
}));
return {data: [], count: 0}; return {data: [], count: 0};
} }
}; };
@@ -304,6 +314,7 @@ export type ProcessAreaType = {
processAreaList: ProcessAreaProps[]; processAreaList: ProcessAreaProps[];
processAreaCount: number; processAreaCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean;
}, },
ProcessAreaDetail : { ProcessAreaDetail : {
@@ -328,7 +339,8 @@ export const processAreaInitState: ProcessAreaType = {
upHeadList1 : upHeadList1, upHeadList1 : upHeadList1,
processAreaList : processAreaList, processAreaList : processAreaList,
processAreaCount : 0, processAreaCount : 0,
excelList : [] excelList : [],
isLoading : true,
}, },
ProcessAreaDetail : { ProcessAreaDetail : {
@@ -355,7 +367,14 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
* @param pageSize : 페이지 크기 * @param pageSize : 페이지 크기
*/ */
searchProcessAreaList: async ( pageNo:number, pageSize:number, ctpvNm?:string, sggNm?:string, targetYear?:string) => { searchProcessAreaList: async ( pageNo:number, pageSize:number, ctpvNm?:string, sggNm?:string, targetYear?:string) => {
const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear); set((state: ProcessAreaType) => ({
...state,
ProcessArea: {
...state.ProcessArea,
isLoading: true,
},
}));
const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set);
res.data.forEach((item:ProcessAreaProps) => { res.data.forEach((item:ProcessAreaProps) => {
DataForm({ type: 'float1', column: 'fctCpc', item:item as unknown as Record<string, unknown>}); DataForm({ type: 'float1', column: 'fctCpc', item:item as unknown as Record<string, unknown>});
}) })
@@ -400,9 +419,11 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
...state.ProcessArea, ...state.ProcessArea,
processAreaList: res.data, processAreaList: res.data,
processAreaCount: res.count, processAreaCount: res.count,
isLoading : false,
}:{ }:{
...state.ProcessArea, ...state.ProcessArea,
excelList: excelDownList, excelList: excelDownList,
isLoading : false,
}, },
})) }))
}, },
@@ -411,51 +432,51 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
set((state: ProcessAreaType) => { set((state: ProcessAreaType) => {
const rtnData = state.ProcessArea.processAreaList.find((item: ProcessAreaProps) => item.swtrmtFcltCd === swtrmtFcltCd); const rtnData = state.ProcessArea.processAreaList.find((item: ProcessAreaProps) => item.swtrmtFcltCd === swtrmtFcltCd);
if (rtnData) { if (rtnData) {
upHeadListFcltyImproveInfo.forEach((head:TableUpperProps) => { upHeadListFcltyImproveInfo.forEach((head:TableUpperProps) => {
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
head.title = '현재\n(' + rtnData.yr + '년)'; head.title = rtnData.yr? '현재\n(' + rtnData.yr + '년)':head.title = '현재';
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
head.title = '1단계\n(' + rtnData.yrDc1 + '년)'; head.title = rtnData.yrDc1? '1단계\n(' + rtnData.yrDc1 + '년)':head.title = '1단계';
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
head.title = '2단계\n(' + rtnData.yrDc2 + '년)'; head.title = rtnData.yrDc2? '2단계\n(' + rtnData.yrDc2 + '년)':head.title = '2단계';
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
head.title = '3단계\n(' + rtnData.yrDc3 + '년)'; head.title = rtnData.yrDc3? '3단계\n(' + rtnData.yrDc3 + '년)':head.title = '3단계';
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
head.title = '4단계\n(' + rtnData.yrDc4 + '년)'; head.title = rtnData.yrDc4? '4단계\n(' + rtnData.yrDc4 + '년)':head.title = '4단계';
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
head.title = '기승인\n4단계(' + rtnData.yrDt4 + '년)'; head.title = rtnData.yrDt4? '기승인\n4단계(' + rtnData.yrDt4 + '년)':head.title = '기승인\n4단계';
} }
}); });
upHeadListProcessAreaPlan.forEach((head:TableUpperProps) => { upHeadListProcessAreaPlan.forEach((head:TableUpperProps) => {
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
head.title = '현재\n(' + rtnData.yr + '년)'; head.title = rtnData.yr? '현재\n(' + rtnData.yr + '년)':head.title = '현재';
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
head.title = '1단계\n(' + rtnData.yrDc1 + '년)'; head.title = rtnData.yrDc1?'1단계\n(' + rtnData.yrDc1 + '년)':head.title = '1단계';
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
head.title = '2단계\n(' + rtnData.yrDc2 + '년)'; head.title = rtnData.yrDc2?'2단계\n(' + rtnData.yrDc2 + '년)':head.title = '2단계';
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
head.title = '3단계\n(' + rtnData.yrDc3 + '년)'; head.title = rtnData.yrDc3? '3단계\n(' + rtnData.yrDc3 + '년)':head.title = '3단계';
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
head.title = '4단계\n(' + rtnData.yrDc4 + '년)'; head.title = rtnData.yrDc4?'4단계\n(' + rtnData.yrDc4 + '년)':head.title = '4단계';
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
head.title = '기승인\n4단계(' + rtnData.yrDt4 + '년)'; head.title = rtnData.yrDt4?'기승인\n4단계(' + rtnData.yrDt4 + '년)':head.title = '기승인\n4단계';
} }
}); });
upHeadListProcessPopulation.forEach((head:TableUpperProps) => { upHeadListProcessPopulation.forEach((head:TableUpperProps) => {
if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { if(head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
head.title = '현재\n(' + rtnData.yr + '년)'; head.title = rtnData.yr?'현재\n(' + rtnData.yr + '년)':head.title = '현재';
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
head.title = '1단계\n(' + rtnData.yrDc1 + '년)'; head.title = rtnData.yrDc1?'1단계\n(' + rtnData.yrDc1 + '년)':head.title = '1단계';
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
head.title = '2단계\n(' + rtnData.yrDc2 + '년)'; head.title = rtnData.yrDc2?'2단계\n(' + rtnData.yrDc2 + '년)':head.title = '2단계';
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
head.title = '3단계\n(' + rtnData.yrDc3 + '년)'; head.title = rtnData.yrDc3?'3단계\n(' + rtnData.yrDc3 + '년)':head.title = '3단계';
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
head.title = '4단계\n(' + rtnData.yrDc4 + '년)'; head.title = rtnData.yrDc4?'4단계\n(' + rtnData.yrDc4 + '년)':head.title = '4단계';
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
head.title = '기승인\n4단계(' + rtnData.yrDt4 + '년)'; head.title = rtnData.yrDt4?'기승인\n4단계(' + rtnData.yrDt4 + '년)':head.title = '기승인\n4단계';
} }
}); });
+20 -1
View File
@@ -517,6 +517,7 @@ export type ProcessFacilityType = {
processFacilityList:facilityListProps[]; processFacilityList:facilityListProps[];
processFacilityCount:number; processFacilityCount:number;
excelList : ExcelType[]; excelList : ExcelType[];
isLoading: boolean;
}, },
ProcessFacilityDetail : { ProcessFacilityDetail : {
@@ -551,7 +552,8 @@ export const processFacilityInitState:ProcessFacilityType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
processFacilityList : processFacilityList, processFacilityList : processFacilityList,
processFacilityCount:1, processFacilityCount:1,
excelList : [] excelList : [],
isLoading : true,
}, },
ProcessFacilityDetail : { ProcessFacilityDetail : {
@@ -588,6 +590,13 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
* @param pageSize : 페이지 크기 * @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: {
...state.ProcessFacilityList,
isLoading: true,
},
}));
const res = await fetchFacilityList(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName); const res = await fetchFacilityList(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName);
res.data.forEach((item:facilityListProps) => { res.data.forEach((item:facilityListProps) => {
DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record<string, unknown>}); DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record<string, unknown>});
@@ -635,9 +644,11 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
...state.ProcessFacilityList, ...state.ProcessFacilityList,
processFacilityList: res.data, processFacilityList: res.data,
processFacilityCount: res.count, processFacilityCount: res.count,
isLoading: false,
}:{ }:{
...state.ProcessFacilityList, ...state.ProcessFacilityList,
excelList: excelDownList, excelList: excelDownList,
isLoading: false,
}, },
})) }))
}, },
@@ -648,6 +659,13 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
* @param pageSize : 페이지 크기 * @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: {
...state.ProcessFacilityList,
isLoading: true,
},
}));
const res = await fetchFacilityListSearching(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName); const res = await fetchFacilityListSearching(pageNo, pageSize, partValue, nameCd, fcltCpct, oprtngSttsCd, facilityPartValue, facilityName);
/* res.data.forEach((item:facilityListProps) => { /* res.data.forEach((item:facilityListProps) => {
DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record<string, unknown>}); DataForm({ type: 'date', column: 'cmplDt', item:item as unknown as Record<string, unknown>});
@@ -665,6 +683,7 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio
...state.ProcessFacilityList, ...state.ProcessFacilityList,
processFacilityList: res.data, processFacilityList: res.data,
processFacilityCount: res.count, processFacilityCount: res.count,
isLoading: false,
}, },
})) }))
}, },
+14 -2
View File
@@ -183,6 +183,7 @@ export type RdiType = {
rdiList: RdiProps[]; // Changed from facilityAreaProps to ProcessAreaProps rdiList: RdiProps[]; // Changed from facilityAreaProps to ProcessAreaProps
rdiCount: number; rdiCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean;
}, },
} }
@@ -199,7 +200,8 @@ export const rdiInitState: RdiType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
rdiList : rdiList, rdiList : rdiList,
rdiCount : 2, rdiCount : 2,
excelList : [] excelList : [],
isLoading : true,
} }
} }
@@ -220,6 +222,14 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
console.log("tableActionsExport"); console.log("tableActionsExport");
return { return {
searchRdiList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchRdiList: async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: RdiType) => ({
...state,
Rdi: {
...state.Rdi,
isLoading: true,
},
}));
const res = await fetchRdiList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchRdiList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data; const data = res.data;
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
@@ -264,10 +274,12 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
...state.Rdi, ...state.Rdi,
rdiList: rtnData, rdiList: rtnData,
rdiCount: res.count, rdiCount: res.count,
isLoading : false,
}:{ }:{
...state.Rdi, ...state.Rdi,
excelList: excelDownList, excelList: excelDownList,
} isLoading : false,
},
})) }))
}, },
} }
+87 -12
View File
@@ -126,7 +126,6 @@ const tempSewageOccurList:modalTableType[] = []
const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
// 20250701임시시 // 20250701임시시
console.log("searchYear", searchYear);
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
@@ -145,7 +144,7 @@ const fetchSewageOccurList = async (pageNo: number, pageSize: number, searchYear
====================================*/ ====================================*/
export type SewageOccurActions = { export type SewageOccurActions = {
searchSewageOccurList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void; searchSewageOccurList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void;
searchSewageOccurDetailList: (bscFctCd: string, searchYear: string) => void; searchSewageOccurDetailList: (bscFctCd: string, searchYear: string, startYearMonth?: string, endYearMonth?: string) => void;
} }
export type SewageOccurType = { export type SewageOccurType = {
@@ -162,6 +161,7 @@ export type SewageOccurType = {
sewageOccurList: SewageOccurProps[]; // Changed from facilityAreaProps to ProcessAreaProps sewageOccurList: SewageOccurProps[]; // Changed from facilityAreaProps to ProcessAreaProps
sewageOccurCount: number; sewageOccurCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean;
}, },
SewageOccurDetail : { SewageOccurDetail : {
@@ -184,7 +184,8 @@ export const sewageOccurInitState: SewageOccurType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
sewageOccurList : sewageOccurList, sewageOccurList : sewageOccurList,
sewageOccurCount : 2, sewageOccurCount : 2,
excelList : [] excelList : [],
isLoading : true,
}, },
SewageOccurDetail : { SewageOccurDetail : {
@@ -197,14 +198,15 @@ export const sewageOccurInitState: SewageOccurType = {
export type SewageOccurStore = SewageOccurType & SewageOccurActions; export type SewageOccurStore = SewageOccurType & SewageOccurActions;
// Add type definitions for API responses // Add type definitions for API responses
type FlowDataItem = { export type FlowDataItem = {
inflAmnt: string | number; inflAmnt: string | number;
infoRnDay: string | number; infoRnDay: string | number;
bscFctCd: string; bscFctCd: string;
msrDt: string; msrDt: string;
rainEffectDay?: number;
} }
type FlowResponse = { export type FlowResponse = {
data: FlowDataItem[]; data: FlowDataItem[];
count: number; count: number;
} }
@@ -212,9 +214,15 @@ type FlowResponse = {
export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
return { return {
searchSewageOccurList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchSewageOccurList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: SewageOccurType) => ({
...state,
SewageOccur: {
...state.SewageOccur,
isLoading: true,
},
}));
const res = await fetchSewageOccurList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchSewageOccurList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data; const data = res.data;
// Promise.all을 사용하여 모든 비동기 작업이 완료될 때까지 기다림 // Promise.all을 사용하여 모든 비동기 작업이 완료될 때까지 기다림
const calData = await Promise.all(data.map(async (item: SewageOccurProps) => { const calData = await Promise.all(data.map(async (item: SewageOccurProps) => {
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
@@ -222,18 +230,68 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.swageChangePercent = 80; item.swageChangePercent = 80;
const bscFctCd = item.bscFctCd; const bscFctCd = item.bscFctCd;
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as FlowResponse; const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as FlowResponse;
let sumChungcunDay = 0; let sumChungcunDay = 0;
let chungcunSumFlow = 0; let chungcunSumFlow = 0;
let totWaterUsage = 0; let totWaterUsage = 0;
if(bscFctCd === '11200PB001R'){
console.log('res2.data : ',res2.data);
}
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
for(let idx = 0; idx < res2.data.length; idx++) {
const item = res2.data[idx];
if(item){
if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) {
item.rainEffectDay = 1;
} else {
item.rainEffectDay = 0;
}
}
}
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
for(let idx = 0; idx < res2.data.length; idx++) {
if(res2.data[idx]) {
// 하루 전이 강우영향일(3 이상)인 경우
if(idx > 0 && res2.data[idx-1]?.infoRnDay && Number(res2.data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
res2.data[idx]!.rainEffectDay = 1;
}
// 이틀 전이 강우영향일(3 이상)인 경우
if(idx > 1 && res2.data[idx-2]?.infoRnDay && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
res2.data[idx]!.rainEffectDay = 1;
}
}
}
for(let idx = 0; idx < res2.data.length; idx++) {
if(res2.data[idx] && res2.data[idx]?.rainEffectDay === 1) {
if(idx > 1){
if(res2.data[idx-1]?.infoRnDay && Number(res2.data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
res2.data[idx]!.infoRnDay = res2.data[idx-1]!.infoRnDay;
}
}
if(idx > 2){
if(res2.data[idx-2]?.infoRnDay && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
res2.data[idx]!.infoRnDay = res2.data[idx-2]!.infoRnDay;
}
}
}
}
if(bscFctCd === '11200PB001R'){
console.log('calData : ',res2.data);
}
res2.data.forEach((item: FlowDataItem) => { res2.data.forEach((item: FlowDataItem) => {
if(Number(item.infoRnDay) ===0){
if(Number(item.rainEffectDay) === 0){
chungcunSumFlow += Number(item.inflAmnt); chungcunSumFlow += Number(item.inflAmnt);
sumChungcunDay += 1; sumChungcunDay += 1;
} }
totWaterUsage += Number(item.inflAmnt); totWaterUsage += Number(item.inflAmnt);
}); });
const avg = totWaterUsage /res2.count; const avg = totWaterUsage /res2.count;
@@ -250,17 +308,34 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
...state.SewageOccur, ...state.SewageOccur,
sewageOccurList: calData, sewageOccurList: calData,
sewageOccurCount: res.count, sewageOccurCount: res.count,
isLoading : false,
}:{ }:{
...state.SewageOccur, ...state.SewageOccur,
excelList: [], excelList: [],
} isLoading : false,
},
})) }))
}, },
searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string) => { searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string, startYearMonth?: string, endYearMonth?: string) => {
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear); const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
const monthData: SewageOccurDetailProps[] = []; const monthData: SewageOccurDetailProps[] = [];
let tot = 0, cnt= 0 let tot = 0, cnt= 0;
console.log('startYearMonth : ', startYearMonth, 'endYearMonth : ', endYearMonth);
if(startYearMonth) {
res.data = res.data.filter((item: FlowDataItem) => {
const month = item.msrDt?.substring(0, 6);
return month >= startYearMonth;
});
}
if(endYearMonth) {
res.data = res.data.filter((item: FlowDataItem) => {
const month = item.msrDt?.substring(0, 6);
return month <= endYearMonth;
});
}
res.data.forEach((item: FlowDataItem) => { res.data.forEach((item: FlowDataItem) => {
const month = item.msrDt?.substring(4, 6); const month = item.msrDt?.substring(4, 6);
const monthIdx = month ? Number(month) - 1 : -1; const monthIdx = month ? Number(month) - 1 : -1;
@@ -284,7 +359,7 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => {
monthData.forEach((item, index) => { monthData.forEach((item, index) => {
item.usege = item.sum/item.cnt *0.65 item.usege = item.sum/item.cnt *0.65
tableData.push({ tableData.push({
msrDt: item.yr+'-'+(index+1>10?String(index+1):'0'+(index+1)), msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)),
waterUsage: Math.round(item.usege*100) /100, waterUsage: Math.round(item.usege*100) /100,
swageChangePercent: (Math.round((item.usege/item.usege*0.8) * 100) / 100) * 100, swageChangePercent: (Math.round((item.usege/item.usege*0.8) * 100) / 100) * 100,
estimationSewage: Math.round(item.usege*0.8 * 100) / 100 estimationSewage: Math.round(item.usege*0.8 * 100) / 100
+1 -1
View File
@@ -59,7 +59,7 @@ export const StoreZus =
} }
) => { ) => {
return createStore<FoStore>()((set) => { return createStore<FoStore>()((set) => {
LoginApi.login({userId: "admin1gmail", password: "test1234!"}) LoginApi.login({userId: "CLEANWATER", password: "gktneh12!@"})
return { return {
...initState, ...initState,
...CommonReducer(set), ...CommonReducer(set),
+113 -29
View File
@@ -2,8 +2,15 @@ import DataForm from "@/app/components/common/DataForm";
import type { TableUpperProps } from "../dashboard"; import type { TableUpperProps } from "../dashboard";
import { getFetch } from "@/app/components/api"; import { getFetch } from "@/app/components/api";
import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps } from "./types"; import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps } from "./types";
import type { SewageOccurDetailProps } from "../sewageOccur";
export type { TableUpperProps }; export type { TableUpperProps };
// SewageOccurDetailProps 타입을 여기에 정의
export type SewageOccurDetailProps = {
cnt : number,
sum : number,
yr:string,
usege:number
}
/**==================================== /**====================================
* Store - 타입 * Store - 타입
====================================*/ ====================================*/
@@ -75,7 +82,7 @@ const upHeadList3:TableUpperProps[] = [
// 모달 // 모달
const upHeadListUnderWaterDetail:TableUpperProps[] = [ const upHeadListUnderWaterDetail:TableUpperProps[] = [
{ id: "msrDt", title: "날짜" }, { id: "msrDt", title: "날짜" },
{ id: "realSewageInput", title: "실제 하수유입량\n(m³/일)" }, { id: "realSewageInput", title: "청천시 실제 하수유입량\n(m³/일)" },
{ id: "sewageOccur", title: "오수발생량\n(m³/일)" }, { id: "sewageOccur", title: "오수발생량\n(m³/일)" },
{ id: "underWaterInput", title: "지하수 유입량\n(m³/일)" }, { id: "underWaterInput", title: "지하수 유입량\n(m³/일)" },
]; ];
@@ -162,13 +169,15 @@ const underWaterDetailList:UnderWaterInputModalProps[] = [
====================================*/ ====================================*/
// API response types // API response types
interface FlowDataItem { export interface FlowDataItem {
inflAmnt: number; inflAmnt: number | string;
infoRnDay: number; infoRnDay: number;
msrDt: string; msrDt: string;
rainEffectDay? : number;
sumFlow? : number | string | '';
} }
interface ApiResponse { export interface ApiResponse {
data: FlowDataItem[]; data: FlowDataItem[];
count: number; count: number;
} }
@@ -209,6 +218,7 @@ export type UnderWaterType = {
underWaterList: UnderWaterProps[]; // Changed from facilityAreaProps to ProcessAreaProps underWaterList: UnderWaterProps[]; // Changed from facilityAreaProps to ProcessAreaProps
underWaterCount: number; underWaterCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean;
}, },
UnderWaterDetail : { UnderWaterDetail : {
@@ -231,7 +241,8 @@ export const underWaterInitState: UnderWaterType = {
upHeadList3 : upHeadList3, upHeadList3 : upHeadList3,
underWaterList : underWaterList, underWaterList : underWaterList,
underWaterCount : 4, underWaterCount : 4,
excelList : [] excelList : [],
isLoading : true,
}, },
UnderWaterDetail : { UnderWaterDetail : {
@@ -250,9 +261,70 @@ const dataFormSetting=(item : UnderWaterProps)=> {
export type UnderWaterStore = UnderWaterType & UnderWaterActions; export type UnderWaterStore = UnderWaterType & UnderWaterActions;
export const calRainEffectDay = (data: FlowDataItem[], weather: string) => {
// 강우영향일 계산 (강우량이 3 이상이면 무조건 강우영향일)
for(let idx = 0; idx < data.length; idx++) {
const item = data[idx];
if(item){
if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) {
item.rainEffectDay = 1;
} else {
item.rainEffectDay = 0;
}
}
}
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정
for(let idx = 0; idx < data.length; idx++) {
if(data[idx]) {
// 하루 전이 강우영향일(3 이상)인 경우
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.rainEffectDay = 1;
}
// 이틀 전이 강우영향일(3 이상)인 경우
if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.rainEffectDay = 1;
}
}
}
for(let idx = 0; idx < data.length; idx++) {
if(data[idx] && data[idx]?.rainEffectDay === 1) {
if(idx > 1){
if(data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.infoRnDay = data[idx-1]!.infoRnDay;
}
}
if(idx > 2){
if(data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.infoRnDay = data[idx-2]!.infoRnDay;
}
}
}
}
let rtnData : FlowDataItem[] = [];
if (weather === 'ALL') {
rtnData = data;
} else if (weather === 'SUNNY') {
rtnData = data.filter((item: FlowDataItem) => item.rainEffectDay === 0);
} else {
rtnData = data.filter((item: FlowDataItem) => item.rainEffectDay === 1);
}
return rtnData;
}
export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterType) => void)=>UnderWaterActions=(set: (fn: (state: UnderWaterType) => UnderWaterType) => void) => { export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterType) => void)=>UnderWaterActions=(set: (fn: (state: UnderWaterType) => UnderWaterType) => void) => {
return { return {
searchUnderWaterList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { searchUnderWaterList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
set((state: UnderWaterType) => ({
...state,
UnderWater: {
...state.UnderWater,
isLoading: true,
},
}));
const res = await fetchUnderWaterList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm); const res = await fetchUnderWaterList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data; const data = res.data;
const calData = await Promise.all(data.map(async (item: UnderWaterProps) => { const calData = await Promise.all(data.map(async (item: UnderWaterProps) => {
@@ -262,8 +334,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
const bscFctCd = item.bscFctCd; const bscFctCd = item.bscFctCd;
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse; const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse;
const calData = calRainEffectDay(res2.data, 'SUNNY');
let sumChungcunDay = 0;
let chungcunSumFlow = 0; let chungcunSumFlow = 0;
let sumSummerChungcunDay = 0; let sumSummerChungcunDay = 0;
@@ -272,24 +343,25 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
let sumWinterChungcunDay = 0; let sumWinterChungcunDay = 0;
let sumWinterChungcunFlow = 0; let sumWinterChungcunFlow = 0;
res2.data.forEach((flowItem: FlowDataItem) => { calData.forEach((flowItem: FlowDataItem) => {
// 청천시 chungcunSumFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
if(Number(flowItem.infoRnDay) ===0){
sumChungcunDay += 1;
chungcunSumFlow += Number(flowItem.inflAmnt);
if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){ if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){
sumSummerChungcunDay += 1; sumSummerChungcunDay += 1;
sumSummerChungcunFlow += Number(flowItem.inflAmnt); sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
}else if(flowItem.msrDt.includes('01') || flowItem.msrDt.includes('02')){ }else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){
sumWinterChungcunDay += 1; sumWinterChungcunDay += 1;
sumWinterChungcunFlow += Number(flowItem.inflAmnt); sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
}
} }
}); });
item.underWaterInputYear = Number(chungcunSumFlow==0?0:Math.round((chungcunSumFlow / sumChungcunDay) * 10) / 10) - Number(item.fctCpc * 0.6 * 0.8);
item.underWaterInputSummer = Number(sumSummerChungcunFlow==0?0:Math.round((sumSummerChungcunFlow / sumSummerChungcunDay) * 10) / 10) - Number(item.fctCpc * 0.6 * 0.8); const usage = chungcunSumFlow / calData.length;
item.underWaterInputWinter = Number(sumWinterChungcunFlow==0?0:Math.round((sumWinterChungcunFlow / sumWinterChungcunDay) * 10) / 10) - Number(item.fctCpc * 0.6 * 0.8); const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay;
const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay;
item.underWaterInputYear = Math.round((usage-(usage*0.65*0.8)) * 100) / 100;
item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*0.8)) * 100) / 100;
item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*0.8)) * 100) / 100;
return item; return item;
})); }));
@@ -332,17 +404,30 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
...state.UnderWater, ...state.UnderWater,
underWaterList: calData, underWaterList: calData,
underWaterCount: res.count, underWaterCount: res.count,
isLoading : false,
}:{ }:{
...state.UnderWater, ...state.UnderWater,
excelList: excelDownList, isLoading : false,
} excelList: excelDownList
},
})) }))
}, },
unserWaterModal:async (bscFctCd, searchYear)=>{ unserWaterModal:async (bscFctCd, searchYear)=>{
console.log('searchYear : ', searchYear);
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear); const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
const monthData: SewageOccurDetailProps[] = []; const monthData: SewageOccurDetailProps[] = [];
let tot = 0, cnt= 0
res.data.forEach((item: FlowDataItem) => { const calData = calRainEffectDay(res.data, 'SUNNY');
let tot = 0, cnt= 0;
let tmpTot = 0;
calData.forEach((item: FlowDataItem) => {
tmpTot += Number(item.inflAmnt);
})
console.log('tmpTot : ', tmpTot/calData.length);
calData.forEach((item: FlowDataItem) => {
const month = item.msrDt?.substring(4, 6); const month = item.msrDt?.substring(4, 6);
const monthIdx = month ? Number(month) - 1 : -1; const monthIdx = month ? Number(month) - 1 : -1;
if (monthIdx >= 0) { if (monthIdx >= 0) {
@@ -364,7 +449,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
monthData.forEach((item, index) => { monthData.forEach((item, index) => {
item.usege = item.sum/item.cnt item.usege = item.sum/item.cnt
tableData.push({ tableData.push({
msrDt: item.yr+'-'+(index+1>10?String(index+1):'0'+(index+1)), msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)),
realSewageInput:Math.round(item.usege*100) /100, realSewageInput:Math.round(item.usege*100) /100,
sewageOccur:Math.round(item.usege*0.65*0.8 * 100) / 100, sewageOccur:Math.round(item.usege*0.65*0.8 * 100) / 100,
underWaterInput:Math.round((item.usege-(item.usege*0.65*0.8)) * 100) / 100, underWaterInput:Math.round((item.usege-(item.usege*0.65*0.8)) * 100) / 100,
@@ -379,7 +464,6 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
}); });
avgWaterUsage = tot/cnt avgWaterUsage = tot/cnt
const newData= [ const newData= [
{ {
msrDt: '평균', msrDt: '평균',
@@ -17,6 +17,8 @@ export class LoginApiService implements LoginService {
public async login(payload: ILogin): Promise<void> { public async login(payload: ILogin): Promise<void> {
try { try {
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
console.log(payload.userId+' '+payload.password)
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, { const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
@@ -107,7 +107,7 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
console.log('repairArr', repairArr); console.log('repairArr', repairArr);
}; };
fetchAll(); fetchAll();
}, [featureData]); }, []);
// 폼 데이터가 변경될 때 호출될 핸들러 // 폼 데이터가 변경될 때 호출될 핸들러
const handleFormDataChange = (newFormData: any) => { const handleFormDataChange = (newFormData: any) => {
@@ -162,7 +162,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
<span className="text-2xl text-red-600 font-bold">● 침입수량 산정결과</span> <span className="text-2xl text-red-600 font-bold">● 침입수량 산정결과</span>
<div className="flex items-center mt-2"> <div className="flex items-center mt-2">
<span className="ml-5 text-black text-xl">침입수량 : </span> <span className="ml-5 text-black text-xl">침입수량 : </span>
<span className="w-[45px] inline-block text-right text-black text-xl font-bold">{inftwtQty}</span> <span className="w-[35px] inline-block text-right text-black text-xl font-bold">{inftwtQty}</span>
<span className="ml-2 text-black text-xl">m³/d</span> <span className="ml-2 text-black text-xl">m³/d</span>
</div> </div>
</div> </div>
@@ -170,7 +170,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
{/* 차트 */} {/* 차트 */}
<div className="h-[90%] bg-white text-3xl"> <div className="h-[90%] bg-white text-3xl">
<MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'침입수량 그래프'} <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'침입수량 그래프'}
yFieldText2="" yFieldText="유량(m³/h)"/> yFieldText2="시간" yFieldText="유량(m³/h)"/>
</div> </div>
</div> </div>
{popupOpen && ( {popupOpen && (
@@ -161,17 +161,17 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => {
<span className="text-2xl text-red-600 font-bold">● 강우유입수량 분석결과</span> <span className="text-2xl text-red-600 font-bold">● 강우유입수량 분석결과</span>
<div className="flex items-center mt-2"> <div className="flex items-center mt-2">
<span className="w-[95px] inline-block text-right text-black text-xl">평균RDII : </span> <span className="w-[95px] inline-block text-right text-black text-xl">평균RDII : </span>
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {rdiiQty}</span> <span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {rdiiQty}</span>
<span className="ml-2 text-black"> m³/d</span> <span className="ml-2 text-black"> m³/d</span>
</div> </div>
<div className="flex items-center mt-2"> <div className="flex items-center mt-2">
<span className="w-[95px] inline-block text-right text-black text-xl">적용강우량 : </span> <span className="w-[95px] inline-block text-right text-black text-xl">적용강우량 : </span>
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {rainTotal}</span> <span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {rainTotal}</span>
<span className="ml-2 text-black"> mm</span> <span className="ml-2 text-black"> mm</span>
</div> </div>
<div className="flex items-center mt-2"> <div className="flex items-center mt-2">
<span className="w-[95px] inline-block text-right text-black text-xl">강우량대비RDII : </span> <span className="w-[95px] inline-block text-right text-black text-xl">강우량대비RDII : </span>
<span className="w-[45px] inline-block text-right text-black text-xl font-bold"> {totalVolume}</span> <span className="w-[30px] inline-block text-right text-black text-xl font-bold"> {totalVolume}</span>
<span className="ml-2 text-black"> m³/mm</span> <span className="ml-2 text-black"> m³/mm</span>
</div> </div>
</div> </div>
@@ -2,8 +2,8 @@ import { VerticalTable } from '@/components/ui/verticalTable';
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
// 빗물펌프 자체 입력 정보 // 빗물펌프 자체 입력 정보
const exclnInputColumn = [ const exclnInputColumn = [
{ id: "swtrmtZoneCd", title: "배수구역", type: "input" }, { id: "swtrmtZoneCd", title: "처리구역", type: "input" },
{ id: "mltvDtdvNm", title: "배수분구", type: "input" }, { id: "mltvDtdvNm", title: "처리분구", type: "input" },
{ id: "dsgnFrqnc", title: "설계빈도(년)", type: "input" }, { id: "dsgnFrqnc", title: "설계빈도(년)", type: "input" },
] ]
// 오수펌프 자체 입력 정보 // 오수펌프 자체 입력 정보
@@ -31,14 +31,6 @@ const isYear = (value: string): boolean => {
return /^[0-9]{4}년$/.test(value); return /^[0-9]{4}년$/.test(value);
}; };
export const reportGubuns = [{val: '0', text: '전체'}, {val: '1', text: '보고서'}
, {val: '2', text: '요약보고서'} , {val: '3', text: '부록'}, {val: '4', text: '기타'}];
/**
* Flatten a hierarchical folder structure into a flat array.
* @param data - The hierarchical folder data to flatten.
* @returns An array of flattened folders with their paths and levels.
*/
export function flattenFolders(data: Folder[]): FlattenedFolder[] { export function flattenFolders(data: Folder[]): FlattenedFolder[] {
const result: FlattenedFolder[] = []; const result: FlattenedFolder[] = [];
const exceptNodeNm = ["부분","통합","전체"]; const exceptNodeNm = ["부분","통합","전체"];
@@ -80,10 +72,15 @@ export function flattenFolders(data: Folder[]): FlattenedFolder[] {
} }
data.forEach((root) => traverse(root, {}, 0)); data.forEach((root) => traverse(root, {}, 0));
console.log(result.slice(0, 10));
return result; return result;
} }
export const getDcTree = async (clsfSystmNm:string) => { export const getDcTree = async (clsfSystmNm:string) => {
//const cityName = encodeURIComponent(clsfSystmNm);
const queryString = 'clsfSystmNm='+clsfSystmNm;
console.log("getDcTree queryString:", queryString);
//const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`);
const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm); const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm);
return result; return result;
}; };
@@ -113,8 +110,13 @@ export const addFileName = async (data:FlattenedFolder[]) => {
data.map(async (item) => { data.map(async (item) => {
const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn)); const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn));
const f = filenameArr[0]; const f = filenameArr[0];
//console.log("clsfSystmSn:", item.clsfSystmSn, "f:", f);
const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:f?.filePath}; const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:f?.filePath};
// if (f !== undefined && f.fileSn !== "") {
// const fprcs = await getDcFileprcs(f?.fileSn);
// if (fprcs.length>0)
// result.filePath = fprcs[0].filePath;
// }
return result; return result;
}) })
); );
@@ -122,6 +124,7 @@ export const addFileName = async (data:FlattenedFolder[]) => {
} }
export const getDcFileprcs = async (fileSn:string) => { export const getDcFileprcs = async (fileSn:string) => {
const queryString = 'fileSn='+fileSn; const queryString = 'fileSn='+fileSn;
console.log("getDcTree queryString:", queryString);
const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`); const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`);
return result; return result;
}; };
@@ -148,6 +151,9 @@ export const fileDownload = (data:Blob, fileName:string) => { // Blob데이터
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
} }
export const getFileDownload = async (fileSn:string, fileName:string, filePath:string) => { export const getFileDownload = async (fileSn:string, fileName:string, filePath:string) => {
//const fileprcsData = await getDcFileprcs(fileSn); // filePath 조회
//if (fileprcsData?.length === 0 ) { alert("filePath 조회 오류"); }
//if (fileprcsData[0].filePath === "") alert("filePath 정보 없으므로 다운로드 불가");
if (filePath === "") alert("filePath 정보 없으므로 다운로드 불가:filesn"+ fileSn); if (filePath === "") alert("filePath 정보 없으므로 다운로드 불가:filesn"+ fileSn);
const blobData = await getDcFileDownload(filePath); // 실제 다운로드 API const blobData = await getDcFileDownload(filePath); // 실제 다운로드 API
fileDownload(blobData, fileName); fileDownload(blobData, fileName);
@@ -159,13 +165,12 @@ export const getCityCd = async (): Promise<SelectDataType[]> => {
if (!response.ok) throw new Error(`시도 데이터 오류: ${response.status}`); if (!response.ok) throw new Error(`시도 데이터 오류: ${response.status}`);
const res = await response.json(); const res = await response.json();
const city = res.data; const city = res.data;
let citys:SelectDataType[] = city.map((item: {adstDstrCd:string, sido:string}) => ({ const cityCd = city.map((item: any) => ({
val: item.adstDstrCd, val: item.adstDstrCd,
text: item.sido, text: item.sido,
})); }));
citys = citys.sort((a:SelectDataType, b:SelectDataType) => a.text.localeCompare(b.text)); cityCd.unshift({ val: '0', text: '전체' });
citys.unshift({ val: '0', text: '전체' }); return cityCd;
return citys;
} catch (error) { } catch (error) {
console.error('시도 데이터를 가져오는데 실패했습니다:', error); console.error('시도 데이터를 가져오는데 실패했습니다:', error);
return [{ val: '0', text: '전체', sido: '0' }]; return [{ val: '0', text: '전체', sido: '0' }];
@@ -181,9 +186,9 @@ export const useSggCd = () => {
if (result) { if (result) {
setData(result); setData(result);
} }
console.log("useSggCd호출");
}; };
fetch(); fetch();
console.log("useSggCd호출");
}, []); }, []);
return data; return data;
}; };
@@ -195,7 +200,7 @@ export const getSggCd = async (): Promise<SelectDataType[]> => {
if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`); if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`);
const res = await response.json(); const res = await response.json();
const sgg = res.data; const sgg = res.data;
const sggCd = sgg.map((item: {adstDstrCd:string, sido:string, gugun:string}) => ({ const sggCd = sgg.map((item: any) => ({
val: item.adstDstrCd, val: item.adstDstrCd,
sido: item.sido, sido: item.sido,
text: item.gugun, text: item.gugun,
@@ -217,9 +222,9 @@ export const useCityCd = () => {
if (result) { if (result) {
setData(result); setData(result);
} }
console.log("useCityCd호출");
}; };
fetch(); fetch();
console.log("useCityCd호출");
}, []); }, []);
return data; return data;
}; };
+17 -17
View File
@@ -41,7 +41,7 @@ const Map = () => {
const fetchData = async () => { const fetchData = async () => {
try { try {
const data = await getData("v1/map/lyrStngs/SN_NETWORK"); const data = await getData('v1/map/lyrStngs/SN_NETWORK');
setTreeData(data); setTreeData(data);
} catch (error) { } catch (error) {
console.error("데이터 불러오기 실패:", error); console.error("데이터 불러오기 실패:", error);
@@ -115,22 +115,22 @@ const Map = () => {
}; };
return ( return (
<div className="bg-container"> <div className="bg-container">
<Gis <Gis
treeData={treeData} treeData={treeData}
isSearch={true} isSearch={true}
gisMaps={gisMaps} gisMaps={gisMaps}
isMiniMap={false} isMiniMap={false}
searchView={SearchModal} searchView={SearchModal}
detailView={FeatureClickEventPopup} detailView={FeatureClickEventPopup}
onFeatureSelect={onFeatureSelect} onFeatureSelect={onFeatureSelect}
setIsOpen={setIsOpen} setIsOpen={setIsOpen}
setFeatureData={setFeatureData} setFeatureData={setFeatureData}
featureData={featureData} featureData={featureData}
setIsSearchModalOpen={setIsSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen}
isOpen={isOpen} isOpen={isOpen}
isSearchModalOpen={isSearchModalOpen} isSearchModalOpen={isSearchModalOpen}
onCheckedLayersChange={undefined} onCheckedLayersChange={undefined}
/> />
</div> </div>
); );
}; };
@@ -78,7 +78,7 @@ const BasicTab: React.FC<BasicTabProps> = ({
setVar2, setVar2,
}) => { }) => {
return ( return (
<div className="relative border rounded-lg p-6 w-full h-[10vh]"> <div className="relative border rounded-lg p-6 mt-4 w-full h-[10vh]">
{/* 구분 */} {/* 구분 */}
<div className="mb-3 flex items-center justify-between gap-4"> <div className="mb-3 flex items-center justify-between gap-4">
<div className="flex items-center"> <div className="flex items-center">
@@ -39,7 +39,6 @@ export const BIZ_TY_CD_SELECT_ARRAY = BIZ_TY_CD.map(item => ({
})); }));
// 운영정보 - 사업 현황 // 운영정보 - 사업 현황
export const operationTableHeadlist = [ export const operationTableHeadlist = [
{ id: 'rowNumber', title: '일련번호' },
{ id: "bizNm", title: "사업명" }, { id: "bizNm", title: "사업명" },
{ id: "flfmtBgngYmd", title: "수행시작일자" }, { id: "flfmtBgngYmd", title: "수행시작일자" },
{ id: "flfmtEndYmd", title: "수행종료일자" }, { id: "flfmtEndYmd", title: "수행종료일자" },
@@ -49,7 +48,6 @@ export const operationTableHeadlist = [
]; ];
// 운영정보 - 보수 및 갱신 결과표 // 운영정보 - 보수 및 갱신 결과표
export const operationMaintenanceTableHeadlist = [ export const operationMaintenanceTableHeadlist = [
{ id: 'rowNumber', title: '일련번호' },
{ id: "fcltMngNo", title: "관리번호" }, { id: "fcltMngNo", title: "관리번호" },
{ id: "usgCd", title: "용도" }, { id: "usgCd", title: "용도" },
{ id: "mqltCd", title: "재질" }, { id: "mqltCd", title: "재질" },
@@ -60,7 +58,6 @@ export const operationMaintenanceTableHeadlist = [
]; ];
// 운영정보 - 청소 및 준설 결과표 // 운영정보 - 청소 및 준설 결과표
export const operationCleaningTableHeadlist = [ export const operationCleaningTableHeadlist = [
{ id: 'rowNumber', title: '일련번호' },
{ id: "fcltMngNo", title: "관리번호" }, { id: "fcltMngNo", title: "관리번호" },
{ id: "usgCd", title: "용도" }, { id: "usgCd", title: "용도" },
{ id: "mqltCd", title: "재질" }, { id: "mqltCd", title: "재질" },
@@ -70,7 +67,6 @@ export const operationCleaningTableHeadlist = [
]; ];
// 운영정보 - 점검 및 진단 결과표 // 운영정보 - 점검 및 진단 결과표
export const operationInspectionTableHeadlist = [ export const operationInspectionTableHeadlist = [
{ id: 'rowNumber', title: '일련번호' },
{ id: "fcltMngNo", title: "관리번호" }, { id: "fcltMngNo", title: "관리번호" },
{ id: "usgCd", title: "용도" }, { id: "usgCd", title: "용도" },
{ id: "mqltCd", title: "재질" }, { id: "mqltCd", title: "재질" },
@@ -113,7 +109,7 @@ const OperationTab: React.FC<OperationTabProps> = ({
setYearFilter, setYearFilter,
}) => { }) => {
return ( return (
<div className="relative flex flex-col border rounded-lg p-6 w-full h-[10vh]"> <div className="relative flex flex-col border rounded-lg p-6 mt-4 w-full h-[10vh]">
<div className="flex items-center mb-3"> <div className="flex items-center mb-3">
<SelectBox <SelectBox
className="w-80 mr-8" className="w-80 mr-8"
@@ -1,15 +1,14 @@
'use client';
import React, { useEffect, useState } from 'react';
import { Button } from '@common/components';
import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox';
import { SelectBox, UiTable } from '@common/business_components/ui'; import { SelectBox } from '@common/business_components/ui';
import LoadingOverlay from '@/components/ui/LoadingBar'; import { Button, Input } from '@common/components';
import React from 'react';
import { addFileName, flattenFolders, getFileDownload, useCityCd, useDcTree, useSggCd, reportGubuns } from './searchModalReportApi'; //import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
import { type SelectDataType } from '../commonStore'; import { type SelectDataType } from '../commonStore';
import { useCityCd, useSggCd } from '../components/searchModalReportApi';
// import { useBizByFcltStore } from "../../../store/StoreProvider";
// 하수도정비 기본계획 보고서 // // 하수도정비 기본계획 보고서
export const reportTableHeadlist = [ export const reportTableHeadlist = [
{ id: "no", title: "NO" }, { id: "no", title: "NO" },
{ id: "sido", title: "시도" }, { id: "sido", title: "시도" },
@@ -24,180 +23,79 @@ export const reportTableHeadlist = [
interface BasicTabProps { interface BasicTabProps {
open?: boolean; open?: boolean;
gubun: string;
sidos: SelectDataType[];
ctpvCd: string | number;
sigungu: string;
filteredSiguns: SelectDataType[];
yearFilter: { start: string; end: string; };
handleSearch: () => void;
handleCtpvCdChange: (val: string | number) => void;
// onOpenChange?: (open: boolean) => void;
// onFeatureSelect?: (row: any) => void;
// setTableData?: (data: any[]) => void;
// setTableCount?: (count: number) => void;
setYearFilter: (filter: { start: string; end: string }) => void;
setGubun: (gubun: string) => void;
setSigungu: (sigungu: string) => void;
} }
const ReportTab: React.FC<BasicTabProps> = ({ open }) => { const ReportTab: React.FC<BasicTabProps> = ({
open,
const [isLoading, setIsLoading] = useState(false); gubun,
const [isResetPage, setIsResetPage] = useState<boolean>(false); sidos,
const [isResetSelection, setIsResetSelection] = useState<boolean>(false); ctpvCd,
const [showTable, setShowTable] = useState(false); sigungu,
const [tableData, setTableData] = useState<any[]>([]); filteredSiguns = [{ val: '0', text: '전체', sido: '0' }],
const [tableCount, setTableCount] = useState(0); yearFilter,
const [curPage, setCurPage] = useState(1); handleSearch,
const [yearFilter, setYearFilter] = useState({ start: "", end: "" }); handleCtpvCdChange,
const [ctpvCd, setCtpvCd] = useState('0'); // 하수정비기본계획 report // onOpenChange,
const [sigungu, setSigungu] = useState('0'); // 하수정비기본계획 report // onFeatureSelect,
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]); // setTableData,
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report // setTableCount,
const [reportGubun, setReportGubun] = useState("0"); // 하수정비기본계획 report setYearFilter,
setGubun,
setSigungu,
// 하수정비기본계획 report }) => {
const sidos = useCityCd();
const siguns = useSggCd();
const reportOriginData = useDcTree(""); //:Folder[]
const dynamicHeadlist: { id: string, title: string }[] = reportTableHeadlist;
useEffect(() => {
// filterParams 초기화
setCtpvCd('0');
setSigungu('0');
setReportGubun('0');
setYearFilter({ start: "", end: "" });
setShowTable(false);
setTableData([]);
setTableCount(0);
setCurPage(1); // 페이지를 1로 초기화
setIsResetPage(true); // 페이지를 초기화
setIsResetSelection(true); // 선택 초기화
}, [open]);
// 페이지 변경 시마다 데이터 fetch
useEffect(() => {
// showTable이 true일 때만 fetch (최초 렌더 방지)
setIsResetPage(false);
setIsResetSelection(true); // 선택 초기화
if (showTable) fetchFilteredData();
}, [curPage]);
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
const sidoOption = sidos.find((n) => n.val === val);
setCtpvCd(String(val));
if (val !== '0') {
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
setFilteredSiguns(filterSiguns);
}
setSigungu("0");
setGubun("");
setYearFilter({ start: "", end: "", });
}
// 조회 버튼 클릭 시 1페이지로 이동 및 데이터 초기화
const handleSearch = () => {
setCurPage(1); // 페이지를 1로 초기화
fetchFilteredData();
setIsResetPage(true); // 페이지를 초기화
setIsResetSelection(false); // 선택 초기화
setShowTable(true);
};
// 하수도정비기본계획 테이블 cellClick 핸들러
const handleReportCellClick = (index: number | undefined ) => {
console.log(index);
if (typeof index === "number" && tableData[index]) {
const reportData = tableData[index];
const fileName = reportData.fileName;
const filePath = reportData.filePath;
if (reportData.fileSn !== "") {
getFileDownload(reportData.fileSn, fileName, filePath);
}
}
};
// 검색 API 호출 함수
const fetchFilteredData = async () => {
setIsLoading(true); // 로딩 시작
setIsResetSelection(true); // 선택 초기화
try {
//const reportOriginData = await getDcTree('경기도');
const reportData = flattenFolders(reportOriginData);
let filterReportData = reportData;
if (ctpvCd !== "0") { // 시도검색
const sidoOption = sidos.find((n) => n.val === ctpvCd);
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
}
if (sigungu !== "0") { // 시군구검색
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
}
if (reportGubun !== "0") { // 보고서구분검색
const reportGubunOption = reportGubuns.find((n) => n.val === reportGubun);
filterReportData = filterReportData.filter(item => item.reportGubun === reportGubunOption?.text);
}
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
if (yearFilter.start == "" && yearFilter.end != "")
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
if (yearFilter.start != "" && yearFilter.end != "") {
filterReportData = filterReportData.filter(item => {
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
});
}
if (gubun !== "") { // 구분검색
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
}
console.log('report count:', filterReportData.length);
setTableCount(filterReportData.length || 0);
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
//const fileList = await getDcFile("CLS20250530000041");
addFileName(filterReportData).then(data => {
filterReportData = data;
setTableData(filterReportData || []);
});
setTableData(filterReportData || []);
setShowTable(true);
} catch (err) {
console.error('API ERROR:', err);
setTableData([]);
} finally {
setIsLoading(false); // 로딩 종료
}
};
return ( return (
<> <div className="relative flex flex-col border rounded-lg p-6 mt-4 w-full h-[10vh]">
<div className="relative flex flex-col border rounded-lg p-6 w-full h-[10vh]">
<div className="flex items-center mb-3"> <div className="flex items-center mb-3">
<SelectBox className="w-[150px] mr-8" <SelectBox
className="w-[150px] mr-8"
selectClass="rounded-lg bg-white" selectClass="rounded-lg bg-white"
label="시도" selectArray={sidos} label="시도"
value={ctpvCd} onSelectValue={handleCtpvCdChange} selectArray={sidos}
value={ctpvCd}
onSelectValue={handleCtpvCdChange}
selectContentClass="z-[101]" selectContentClass="z-[101]"
/> />
<SelectBox className="w-48" <SelectBox
className="w-48"
selectClass="w-48 rounded-lg bg-white truncate" selectClass="w-48 rounded-lg bg-white truncate"
label="시군구" selectArray={filteredSiguns} label="시군구"
value={sigungu} onSelectValue={val => setSigungu(String(val))} selectArray={filteredSiguns}
value={sigungu}
onSelectValue={val => setSigungu(String(val))}
selectContentClass="z-[101]" selectContentClass="z-[101]"
/> />
</div> </div>
<div className="flex items-center mb-6"> <div className="flex items-center mb-6">
{/* <label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label> <label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label>
<Input <Input
className='!text-xl w-[100px] placeholder:text-center mr-8' className='!text-xl w-[100px] placeholder:text-center mr-8'
placeholder="입력" placeholder="입력"
value={gubun} value={gubun}
onChange={(e) => { setGubun(e.target.value); }} onChange={(e) => { setGubun(e.target.value); }}
/> */}
<SelectBox className="w-[150px] mr-8"
selectClass="rounded-lg bg-white"
label="보고서구분" selectArray={[...reportGubuns]}
value={reportGubun} onSelectValue={val => setReportGubun(String(val))}
selectContentClass="z-[101]" labelClass='whitespace-nowrap text-xl text-gray-600 pr-2'
/> />
{/* 승인년도 필터 */} <YearRangeSelectBox
<YearRangeSelectBox start={yearFilter.start} end={yearFilter.end} start={yearFilter.start}
end={yearFilter.end}
onChange={range => setYearFilter({ ...yearFilter, start: range.start, end: range.end })} onChange={range => setYearFilter({ ...yearFilter, start: range.start, end: range.end })}
startLabel="승인년도" endLabel="" startLabel="승인년도"
endLabel=""
/> />
{/* 조회 버튼 */} {/* 조회 버튼 */}
<div className="flex-1 flex justify-end"> <div className="flex-1 flex justify-end">
@@ -205,28 +103,6 @@ const ReportTab: React.FC<BasicTabProps> = ({ open }) => {
</div> </div>
</div> </div>
</div> </div>
<div className="h-[79vh] w-full overflow-hidden rounded-lg border">
{/* 테이블2 영역 (가로/세로 스크롤 가능) */}
<div className="flex-1 px-2 pb-2">
<LoadingOverlay isLoading={isLoading} />
<UiTable
headName={(() => {
return (<>조회 결과 ({tableCount.toLocaleString('ko-KR')})건</>);
})()
}
tableData={tableData}
headlist={dynamicHeadlist}
pageSize={10}
total={tableCount}
cellClick={handleReportCellClick}
onPageChange={setCurPage}
resetPageNo={isResetPage}
resetSelection={isResetSelection}
/>
</div>
</div>
</>
); );
}; };
@@ -3,8 +3,11 @@ import { UiModal, UITab, UiTable } from '@common/business_components/ui';
import axios from 'axios'; import axios from 'axios';
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import { ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2 } from '../components/common/table'; import { ExclnSewagePumpCol2, MsSwageMhlCol2, MsSwagePplCol2, stofcbrCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2 } from '../components/common/table';
//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
import { type SelectDataType } from '../commonStore'; import { type SelectDataType } from '../commonStore';
import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES } from '../components/common/table'; import { MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES } from '../components/common/table';
import { addFileName, flattenFolders, getFileDownload, useCityCd, useDcTree, useSggCd } from '../components/searchModalReportApi';
// import { useBizByFcltStore } from "../../../store/StoreProvider";
import { getData } from "@/components/lib/api"; import { getData } from "@/components/lib/api";
import BasicTab, { BASIC_TYPES } from './basicTab'; import BasicTab, { BASIC_TYPES } from './basicTab';
import OperationTab, { BIZ_TY_CD, operationCleaningTableHeadlist, operationInspectionTableHeadlist, operationMaintenanceTableHeadlist, operationTableHeadlist, WORK_TYPES } from './operationTab'; import OperationTab, { BIZ_TY_CD, operationCleaningTableHeadlist, operationInspectionTableHeadlist, operationMaintenanceTableHeadlist, operationTableHeadlist, WORK_TYPES } from './operationTab';
@@ -65,10 +68,9 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [detailBizId, setDetailBizId] = useState(0); const [detailBizId, setDetailBizId] = useState(0);
const [city, setCity] = useState(0); const [city, setCity] = useState(0);
const [sgg, setSgg] = useState(0); const [sgg, setSgg] = useState(0);
const [ctpvCd, setCtpvCd] = useState('0'); // 하수정비기본계획 report const [ctpvCd, setCtpvCd] = useState('0');
const [sigungu, setSigungu] = useState('0'); // 하수정비기본계획 report const [sigungu, setSigungu] = useState('0');
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
const [reportGubun, setReportGubun] = useState("0"); // 하수정비기본계획 report
const [start1, setStart1] = useState(""); const [start1, setStart1] = useState("");
const [start2, setStart2] = useState(""); const [start2, setStart2] = useState("");
const [end1, setEnd1] = useState(""); const [end1, setEnd1] = useState("");
@@ -81,6 +83,9 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [yearFilter, setYearFilter] = useState({ start: "", end: "" }); const [yearFilter, setYearFilter] = useState({ start: "", end: "" });
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]); const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
const sidos = useCityCd();
const siguns = useSggCd();
const reportOriginData = useDcTree(""); //:Folder[]
// 오늘 날짜 구하기 // 오늘 날짜 구하기
const today = new Date(); const today = new Date();
@@ -100,6 +105,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
return []; return [];
} }
if (activeTab === 'operation') return operationTableHeadlist; if (activeTab === 'operation') return operationTableHeadlist;
if (activeTab === 'report') return reportTableHeadlist;
return []; return [];
}, [activeTab, basicType, workType]); }, [activeTab, basicType, workType]);
@@ -128,6 +134,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
setVar4(""); setVar4("");
setCity(0); setCity(0);
setSgg(0); setSgg(0);
setCtpvCd('0');
setSigungu('0');
setYearFilter({ setYearFilter({
start: "", start: "",
end: "", end: "",
@@ -227,7 +235,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
} else if (activeTab === 'operation') { } else if (activeTab === 'operation') {
const RequestDTO: Record<string, string> = { const RequestDTO: Record<string, string> = {
page: `${curPage - 1}`, page: `${curPage - 1}`,
size: '5', size: '4',
}; };
if (var1) RequestDTO.bizNm = var1; if (var1) RequestDTO.bizNm = var1;
if (var2 != '0' && var2) RequestDTO.bizTyCd = var2; if (var2 != '0' && var2) RequestDTO.bizTyCd = var2;
@@ -257,13 +265,12 @@ const SearchModal: React.FC<SearchModalProps> = ({
console.log('필터링된 API 결과(개수):', res.totalElements); console.log('필터링된 API 결과(개수):', res.totalElements);
console.log('필터링된 API 결과(데이터):', res.content); console.log('필터링된 API 결과(데이터):', res.content);
const mappedContent = (res.content || []).map((item: any, index: number) => { const mappedContent = (res.content || []).map((item: any) => {
console.log("item:", item); console.log("item:", item);
const formattedItem = formatDisplayData(item); const formattedItem = formatDisplayData(item);
const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTyCd); const matched = BIZ_TY_CD.find(code => code.lwpoCd === item.bizTyCd);
return { return {
...formattedItem, ...formattedItem,
rowNumber: (curPage - 1) * 4 + index + 1, // 1부터 시작하는 일련번호 추가
bizTyCd: matched ? matched.lwpoCdNm : item.bizTyCd, bizTyCd: matched ? matched.lwpoCdNm : item.bizTyCd,
}; };
}); });
@@ -273,6 +280,40 @@ const SearchModal: React.FC<SearchModalProps> = ({
setDetailTableData([]); setDetailTableData([]);
setDetailTableCount(0); setDetailTableCount(0);
} else if (activeTab === 'report') {
//const reportOriginData = await getDcTree('경기도');
const reportData = flattenFolders(reportOriginData);
let filterReportData = reportData;
if (ctpvCd !== "0") { // 시도검색
const sidoOption = sidos.find((n) => n.val === ctpvCd);
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
}
if (sigungu !== "0") { // 시군구검색
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
}
if (yearFilter.start != "" && yearFilter.end == "") //승인년도검색
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" : null);
if (yearFilter.start == "" && yearFilter.end != "")
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.end + "년" : null);
if (yearFilter.start != "" && yearFilter.end != "") {
filterReportData = filterReportData.filter(item => {
return (item.approvalYear) ? item.approvalYear >= yearFilter.start + "년" && item.approvalYear <= yearFilter.end + "년" : null;
});
}
if (gubun !== "") { // 구분검색
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
}
console.log('report count:', filterReportData.length);
setTableCount(filterReportData.length || 0);
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
//const fileList = await getDcFile("CLS20250530000041");
addFileName(filterReportData).then(data => {
filterReportData = data;
setTableData(filterReportData || []);
});
setTableData(filterReportData || []);
} }
setShowTable(true); setShowTable(true);
@@ -480,22 +521,19 @@ const SearchModal: React.FC<SearchModalProps> = ({
try { try {
const RequestDTO: Record<string, string> = { const RequestDTO: Record<string, string> = {
page: `${detailCurPage - 1}`, page: `${detailCurPage - 1}`,
size: '5', size: '4',
bizId: tableData[index % 5].bizId, bizId: tableData[index % 4].bizId,
}; };
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`); const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
console.log('운영정보 cellClick 데이터:', res); console.log('운영정보 cellClick 데이터:', res);
console.log('운영정보 length:', res.data.length); console.log('운영정보 length:', res.data.length);
const mappedData = (res.data || []).map((item: any, detailIndex: number) => { const mappedData = (res.data || []).map((item: any) => {
const formattedItem = formatDisplayData(item);
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim()); const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim());
const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim()); const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim());
return { return {
...formattedItem, ...item,
rowNumber: (detailCurPage - 1) * 4 + detailIndex + 1,
usgCd: usgCdObj ? usgCdObj.text : item.usgCd, usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd, mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
}; };
@@ -519,19 +557,18 @@ const SearchModal: React.FC<SearchModalProps> = ({
try { try {
const RequestDTO: Record<string, string> = { const RequestDTO: Record<string, string> = {
page: `${detailCurPage - 1}`, page: `${detailCurPage - 1}`,
size: '5', size: '4',
bizId: String(detailBizId), bizId: String(detailBizId),
}; };
const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`); const res = await getData(`v1/bizInfo/fclts?${new URLSearchParams(RequestDTO).toString()}`);
console.log('운영정보 페이지네이션 데이터:', res);
console.log('운영정보 페이지네이션 length:', res.data.length);
const mappedData = (res.data || []).map((item: any, detailIndex: number) => { const mappedData = (res.data || []).map((item: any) => {
const formattedItem = formatDisplayData(item);
const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim()); const usgCdObj = MS_SWAGE_PPL_USE_CODES.find(code => code.val === item.usgCd.trim());
const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim()); const mqltCdObj = MS_SWAGE_PPL_CODES.find(code => code.val === item.mqltCd.trim());
return { return {
...formattedItem, ...item,
rowNumber: (detailCurPage - 1) * 4 + detailIndex + 1,
usgCd: usgCdObj ? usgCdObj.text : item.usgCd, usgCd: usgCdObj ? usgCdObj.text : item.usgCd,
mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd, mqltCd: mqltCdObj ? mqltCdObj.text : item.mqltCd,
}; };
@@ -546,7 +583,31 @@ const SearchModal: React.FC<SearchModalProps> = ({
} }
} }
}; };
// 하수도정비기본계획 테이블 cellClick 핸들러
const handleReportCellClick = (index: number | undefined, headId?: String) => {
console.log(index);
if (typeof index === "number" && tableData[index]) {
const reportData = tableData[index];
const fileName = reportData.fileName;
const filePath = reportData.filePath;
if (reportData.fileSn !== "") {
getFileDownload(reportData.fileSn, fileName, filePath);
}
}
};
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
const sidoOption = sidos.find((n) => n.val === val);
setCtpvCd(String(val));
if (val !== '0') {
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
setFilteredSiguns(filterSiguns);
}
setSigungu("0");
setGubun("");
setYearFilter({ start: "", end: "", });
}
const renderBody = () => ( const renderBody = () => (
<> <>
@@ -559,7 +620,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
}))} }))}
onValueChange={(value: string) => setActiveTab(value)} onValueChange={(value: string) => setActiveTab(value)}
> >
</UITab>
{/* 각각의 탭 영역 */} {/* 각각의 탭 영역 */}
{/* 기본정보 탭 */} {/* 기본정보 탭 */}
{activeTab === 'basic' && ( {activeTab === 'basic' && (
@@ -607,15 +667,26 @@ const SearchModal: React.FC<SearchModalProps> = ({
{activeTab === 'report' && ( {activeTab === 'report' && (
<ReportTab <ReportTab
open={open} open={open}
gubun={gubun}
sidos={sidos}
ctpvCd={ctpvCd}
sigungu={sigungu}
filteredSiguns={filteredSiguns}
yearFilter={yearFilter}
handleSearch={handleSearch}
handleCtpvCdChange={handleCtpvCdChange}
setYearFilter={setYearFilter}
setGubun={setGubun}
setSigungu={setSigungu}
/> />
)} )}
{/* </UITab2> */} {/* </UITab2> */}
</UITab>
{/* 📋 결과 리스트 */} {/* 📋 결과 리스트 */}
{/* 기본정보 탭, 하수도정비기본계획보고서 탭 */} {/* 기본정보 탭, 하수도정비기본계획보고서 탭 */}
{(activeTab === 'basic' ) && ( {(activeTab === 'basic' || activeTab === 'report') && (
<div className="h-[79vh] w-full overflow-hidden rounded-lg border"> <div className="h-[80vh] w-full overflow-hidden rounded-lg border">
{/* 테이블2 영역 (가로/세로 스크롤 가능) */} {/* 테이블2 영역 (가로/세로 스크롤 가능) */}
<div className="flex-1 px-2 pb-2"> <div className="flex-1 px-2 pb-2">
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
@@ -629,7 +700,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
headlist={dynamicHeadlist} headlist={dynamicHeadlist}
pageSize={10} pageSize={10}
total={tableCount} total={tableCount}
cellClick={handleBasicCellClick} cellClick={activeTab === 'report' ? handleReportCellClick : handleBasicCellClick}
onPageChange={setCurPage} onPageChange={setCurPage}
resetPageNo={isResetPage} resetPageNo={isResetPage}
resetSelection={isResetSelection} resetSelection={isResetSelection}
@@ -640,7 +711,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
{/* 운영정보 탭 */} {/* 운영정보 탭 */}
{activeTab === 'operation' && ( {activeTab === 'operation' && (
<> <>
<div className="h-[39vh] w-full overflow-hidden rounded-lg border"> <div className="h-[35vh] w-full overflow-hidden rounded-lg border">
<div className="flex-1 px-2 pb-2"> <div className="flex-1 px-2 pb-2">
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
<UiTable <UiTable
@@ -652,7 +723,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
} }
tableData={tableData} tableData={tableData}
headlist={dynamicHeadlist} headlist={dynamicHeadlist}
pageSize={5} pageSize={4}
total={tableCount} total={tableCount}
cellClick={handleOperationCellClick} cellClick={handleOperationCellClick}
onPageChange={setCurPage} onPageChange={setCurPage}
@@ -662,7 +733,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
</div> </div>
</div> </div>
<div className="h-[39vh] w-full overflow-hidden rounded-lg border"> <div className="h-[35vh] w-full overflow-hidden rounded-lg border">
<div className="flex-1 px-2 pb-2"> <div className="flex-1 px-2 pb-2">
<LoadingOverlay isLoading={isDetailLoading} /> <LoadingOverlay isLoading={isDetailLoading} />
<UiTable <UiTable
@@ -674,7 +745,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
} }
tableData={detailTableData} tableData={detailTableData}
headlist={dynamicHeadlist2} headlist={dynamicHeadlist2}
pageSize={5} pageSize={4}
total={detailTableCount} total={detailTableCount}
cellClick={undefined} cellClick={undefined}
onPageChange={setDetailCurPage} onPageChange={setDetailCurPage}
@@ -30,13 +30,6 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
setYearFilter, setYearFilter,
handleSearch, handleSearch,
}) => { }) => {
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
handleSearch();
}
};
return ( return (
<div className="mb-3"> <div className="mb-3">
<div className="mb-2 flex items-center"> <div className="mb-2 flex items-center">
@@ -77,7 +70,6 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setStart1(val); setStart1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -89,7 +81,6 @@ const SwageMhl: React.FC<SwageMhlProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd1(val); setEnd1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 조회 버튼 */} {/* 조회 버튼 */}
<div className="flex-1 flex justify-end"> <div className="flex-1 flex justify-end">
@@ -31,13 +31,6 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
setYearFilter, setYearFilter,
handleSearch, handleSearch,
}) => { }) => {
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
handleSearch();
}
};
return ( return (
<div className="mb-3"> <div className="mb-3">
<div className="flex items-center mb-2"> <div className="flex items-center mb-2">
@@ -60,7 +53,6 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setStart1(val); setStart1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -72,7 +64,6 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd1(val); setEnd1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 양수능력 - 우수맨홀 */} {/* 양수능력 - 우수맨홀 */}
<Label className="mr-2 w-auto text-xl text-gray-600"> <Label className="mr-2 w-auto text-xl text-gray-600">
@@ -87,7 +78,6 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setStart2(val); setStart2(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -99,7 +89,6 @@ const SwagePmstn: React.FC<SwagePmstnProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd2(val); setEnd2(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 조회 버튼 */} {/* 조회 버튼 */}
<div className="flex-1 flex justify-end"> <div className="flex-1 flex justify-end">
@@ -33,13 +33,6 @@ const SwagePpl: React.FC<SwagePplProps> = ({
setYearFilter, setYearFilter,
handleSearch, handleSearch,
}) => { }) => {
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
handleSearch();
}
};
return ( return (
<div className="mb-6"> <div className="mb-6">
<div className="mb-2 flex items-center"> <div className="mb-2 flex items-center">
@@ -92,7 +85,6 @@ const SwagePpl: React.FC<SwagePplProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setVar1(val); setVar1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -104,7 +96,6 @@ const SwagePpl: React.FC<SwagePplProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd1(val); setEnd1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 연장 */} {/* 연장 */}
<Label className="mr-2 w-auto text-xl text-gray-600">연장(m)</Label> <Label className="mr-2 w-auto text-xl text-gray-600">연장(m)</Label>
@@ -117,7 +108,6 @@ const SwagePpl: React.FC<SwagePplProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setStart1(val); setStart1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -129,7 +119,6 @@ const SwagePpl: React.FC<SwagePplProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd1(val); setEnd1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 조회 버튼 */} {/* 조회 버튼 */}
<div className="flex-1 flex justify-end"> <div className="flex-1 flex justify-end">
@@ -35,13 +35,6 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
setYearFilter, setYearFilter,
handleSearch, handleSearch,
}) => { }) => {
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
handleSearch();
}
};
return ( return (
<div className="mb-3"> <div className="mb-3">
{/* 가동개시일자 */} {/* 가동개시일자 */}
@@ -71,7 +64,6 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setStart1(val); setStart1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -83,7 +75,6 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd1(val); setEnd1(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 처리구역 면적 */} {/* 처리구역 면적 */}
<Label className="mr-2 w-auto text-xl text-gray-600">처리구역 면적(m²)</Label> <Label className="mr-2 w-auto text-xl text-gray-600">처리구역 면적(m²)</Label>
@@ -96,7 +87,6 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setStart2(val); setStart2(val);
}} }}
onKeyDown={handleEnterKey}
/> />
<span className="mx-2 text-xl font-semibold">~</span> <span className="mx-2 text-xl font-semibold">~</span>
<Input <Input
@@ -108,7 +98,6 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
const val = e.target.value.replace(/[^0-9]/g, ""); const val = e.target.value.replace(/[^0-9]/g, "");
setEnd2(val); setEnd2(val);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 하수처리시설명 */} {/* 하수처리시설명 */}
<Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label> <Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label>
@@ -119,7 +108,6 @@ const SwagePrcsFclt: React.FC<SwagePrcsFcltProps> = ({
onChange={(e) => { onChange={(e) => {
setVar1(e.target.value); setVar1(e.target.value);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 조회 버튼 */} {/* 조회 버튼 */}
<div className="flex-1 flex justify-end"> <div className="flex-1 flex justify-end">
@@ -27,13 +27,6 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
setSgg, setSgg,
handleSearch, handleSearch,
}) => { }) => {
const handleEnterKey = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter') {
handleSearch();
}
};
return ( return (
<div className="mb-3"> <div className="mb-3">
<div className="mb-2 flex items-center"> <div className="mb-2 flex items-center">
@@ -54,7 +47,6 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
onChange={(e) => { onChange={(e) => {
setVar1(e.target.value); setVar1(e.target.value);
}} }}
onKeyDown={handleEnterKey}
/> />
<Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label> <Label className="mr-2 w-auto text-xl text-gray-600">하수처리시설명</Label>
<Input <Input
@@ -64,7 +56,6 @@ const swagePrcsZone: React.FC<swagePrcsZoneProps> = ({
onChange={(e) => { onChange={(e) => {
setVar2(e.target.value); setVar2(e.target.value);
}} }}
onKeyDown={handleEnterKey}
/> />
{/* 조회 버튼 */} {/* 조회 버튼 */}
<div className="flex-1 flex justify-end"> <div className="flex-1 flex justify-end">
@@ -307,8 +307,8 @@ const Result = () => {
onDeleteFile={handleFileDelete} onDeleteFile={handleFileDelete}
selectedRowData={selectedRowData} selectedRowData={selectedRowData}
> >
{[<div key='table1' className="h-[58vh] flex flex-col border rounded-lg bg-white shadow-md"> {[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md">
{/* <div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div> */} <div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div>
<div className="flex-grow overflow-auto"> <div className="flex-grow overflow-auto">
<UiTable <UiTable
headName='' headName=''
@@ -307,8 +307,8 @@ const Result = () => {
onDeleteFile={handleFileDelete} onDeleteFile={handleFileDelete}
selectedRowData={selectedRowData} selectedRowData={selectedRowData}
> >
{[<div key='table1' className="h-[58vh] flex flex-col border rounded-lg bg-white shadow-md"> {[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md">
{/* <div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div> */} <div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div>
<div className="flex-grow overflow-auto"> <div className="flex-grow overflow-auto">
<UiTable <UiTable
headName='' headName=''
+1
View File
@@ -87,6 +87,7 @@ export const deleteData = async (url: string, data?: object): Promise<any> => {
// RSONE DC API 호출 // RSONE DC API 호출
export const getDcData = async (url: string, data?: object): Promise<any> => { export const getDcData = async (url: string, data?: object): Promise<any> => {
console.log(url);
const res = await fetch('/dc-service' + url, { const res = await fetch('/dc-service' + url, {
method: "GET", method: "GET",
}); });
+2 -2
View File
@@ -7,8 +7,8 @@ import { useRouter } from "next/navigation";
export default function Home() { export default function Home() {
const router = useRouter(); const router = useRouter();
const userId = "CLEANWATER"; const userId = "admin1gmail";
const password = "gktneh12!@"; const password = "test1234!";
const checkToken = getCookie(AUTH_USER_ID); const checkToken = getCookie(AUTH_USER_ID);
useEffect(() => { useEffect(() => {
+2 -2
View File
@@ -13,8 +13,8 @@
NEXT_PUBLIC_SITE_ID = WR NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 11301 NEXT_PUBLIC_PORT = 11301
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 # NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
+2 -3
View File
@@ -1,8 +1,7 @@
NEXT_PUBLIC_SITE_ID = WR NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 3001 NEXT_PUBLIC_PORT = 3001
NEXT_PUBLIC_PROXY_HOST = http://localhost:3001 NEXT_PUBLIC_PROXY_HOST = http://localhost:3001
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_SERVER_API_URL=http://dev.onasys.co.kr:8000
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
@@ -14,7 +13,7 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 # NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
+32 -32
View File
@@ -1,39 +1,39 @@
NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 3000
NEXT_PUBLIC_PROXY_HOST = http://wr.hasuon.or.kr
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/operation-service/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
NEXT_PUBLIC_CLAIM_NAME = Authorization
NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
# NEXT_PUBLIC_SITE_ID = WR # NEXT_PUBLIC_SITE_ID = WR
# NEXT_PUBLIC_PORT = 11301 # NEXT_PUBLIC_PORT = 3000
# NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301 # NEXT_PUBLIC_PROXY_HOST = http://wr.hasuon.or.kr
# # NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 # NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/api/v1
# NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 # NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/operation-service/api/v1
# NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 # NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000
# NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
# NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload # NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
# NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver # NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver
# NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver # NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
# NEXT_PUBLIC_CLAIM_NAME = Authorization # NEXT_PUBLIC_CLAIM_NAME = Authorization
# NEXT_PUBLIC_AUTH_USER_ID = token-id # NEXT_PUBLIC_AUTH_USER_ID = token-id
# NEXT_PUBLIC_ACCESS_TOKEN = access-token # NEXT_PUBLIC_ACCESS_TOKEN = access-token
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token # NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
# NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API # NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000/sewerage-service/api
NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 11301
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
NEXT_PUBLIC_CLAIM_NAME = Authorization
NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
+30 -36
View File
@@ -36,10 +36,7 @@ const Map = () => {
}, []); }, []);
// 체크된 레이어 정보를 받는 핸들러 // 체크된 레이어 정보를 받는 핸들러
const handleCheckedLayersChange = ( const handleCheckedLayersChange = (checkedIds: string[], checkedNodesData: any[]) => {
checkedIds: string[],
checkedNodesData: any[]
) => {
setCheckedLayers(checkedIds); setCheckedLayers(checkedIds);
setCheckedLayersData(checkedNodesData); setCheckedLayersData(checkedNodesData);
}; };
@@ -61,41 +58,28 @@ const Map = () => {
// 2. data가 OpenLayers Feature 인스턴스인지 확인 // 2. data가 OpenLayers Feature 인스턴스인지 확인
let foundFeature: any = null; let foundFeature: any = null;
console.log(data) if (
//console.log(data.getId()) data &&
let featureId = data.fid; typeof data.getGeometry === "function" &&
const layerName = data.layerNm; typeof data.setStyle === "function"
if (layerName === "재이용시설") {
// 재이용시설
featureId = `${layerName}.${data.searchPk}`;
} else if ( //빗물이용시설, 중수도시설
layerName === "빗물이용시설" ||
layerName == "tb_wr_rswtr_fclt"
) { ) {
featureId = `${layerName}.${data.bdstInfoSn}`; // 이미 Feature 인스턴스라면 그대로 사용
} else if (layerName === "tb_il_swage_prcs_fclt") { //하수처리시설 foundFeature = data;
featureId = `${layerName}.${data.bscFctCd}`;
} else if (layerName === "tb_wr_htdfl_fclt") { //온배수시설
featureId = `${layerName}.${data.bdstRuseFcltSn}`;
} else if (layerName == "tb_wr_ruse_fclt_dmd_co") { //수요처
featureId = `${layerName}.${data.dmdInfoId.replaceAll("-", "")}`;
} else { } else {
console.warn("해당 레이어에 대한 featureId 매핑 없음", layerName); // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
featureId = `${layerName}.${data.fid || data.id || data.ftrIdn}`; const featureId = data.fid || data.ftrIdn || data.id;
map
.getLayers()
.getArray()
.forEach((layer: any) => {
const source = layer.getSource?.();
if (source?.getFeatureById) {
const feature = source.getFeatureById(String(featureId).trim());
if (feature) foundFeature = feature;
}
});
} }
map
.getLayers()
.getArray()
.forEach((layer: any) => {
const source = layer.getSource?.();
if (source?.getFeatureById) {
const feature = source.getFeatureById(String(featureId).trim());
if (feature) foundFeature = feature;
}
});
// 3. 피처 선택 // 3. 피처 선택
if (foundFeature) { if (foundFeature) {
const geometry = foundFeature.getGeometry(); const geometry = foundFeature.getGeometry();
@@ -139,7 +123,17 @@ const Map = () => {
gisMaps={gisMaps} gisMaps={gisMaps}
isMiniMap={false} isMiniMap={false}
searchView={undefined} searchView={undefined}
detailView={(props: any) => ( // searchView={(props: any) => (
// <MapSearchBar
// searchType="공급처 후보지 조회"
// showApplyButton={false}
// checkedLayers={checkedLayers}
// checkedLayersData={checkedLayersData}
// {...props}
// />
// )
// }
detailView={(props: any) =>(
<NewWindowPopup <NewWindowPopup
onClose={handlePopupClose} // 메모이제이션된 함수 사용 onClose={handlePopupClose} // 메모이제이션된 함수 사용
checkedLayers={checkedLayers} checkedLayers={checkedLayers}
+5 -8
View File
@@ -116,7 +116,6 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
const [mngList, setMngList] = useState<DemandCompType[]>(coSttnRes || []); const [mngList, setMngList] = useState<DemandCompType[]>(coSttnRes || []);
///////////////////////////////////////////// 피쳐데이터 선택 시 각 시설별 데이터 처리 /////////////////////////////////////////////// ///////////////////////////////////////////// 피쳐데이터 선택 시 각 시설별 데이터 처리 ///////////////////////////////////////////////
const getSelectedLayers = () => { const getSelectedLayers = () => {
console.log(1)
let result = null; let result = null;
const layers = gisMap ? gisMap.getLayers().getArray().filter((l: any) => l.getVisible()) : []; // gisMap이 null인지 확인 후 레이어 가져오기 const layers = gisMap ? gisMap.getLayers().getArray().filter((l: any) => l.getVisible()) : []; // gisMap이 null인지 확인 후 레이어 가져오기
let featureLayer: { get: (key: string) => any } = { get: () => null }; let featureLayer: { get: (key: string) => any } = { get: () => null };
@@ -128,7 +127,6 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
} }
}); });
result = featureLayer.get('lyrNm'); result = featureLayer.get('lyrNm');
console.log(result)
return result; return result;
}; };
@@ -158,15 +156,15 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
} }
}; };
const detainSttn = async (featureCd: string, layerNm: string) => { const detainSttn = async (featureCd: string, layerNm: string) => {
if (layerNm == '빗물이용시설') { //빗물이용시설 if (layerNm == '빗물이용시설') {
const res = await getFetch(fetchType.WR, `/reuseFc/rainyInfoList/1/20/0/${featureCd}`) const res = await getFetch(fetchType.WR, `/reuseFc/rainyInfoList/1/20/0/${featureCd}`)
setRainList(res) setRainList(res)
} }
else if (layerNm == '중수도시설') { //중수도 시설 else if (layerNm == '중수도시설') {
const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`) const res = await getFetch(fetchType.WR, `/reuseFc/waterreuseFc/1/20/0/${featureCd}`)
setRswtrList(res) setRswtrList(res)
} }
else if(layerNm =='수요처'){ //수요처 else if(layerNm =='수요처'){
const res = await getFetch(fetchType.WR, `/reuseFc/request/1/20/0/${featureCd}`) const res = await getFetch(fetchType.WR, `/reuseFc/request/1/20/0/${featureCd}`)
setMngList(res) setMngList(res)
} }
@@ -194,7 +192,6 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
},[mngList]) },[mngList])
const layerId = getSelectedLayers(); const layerId = getSelectedLayers();
console.log(layerId)
if (featureData && typeof featureData.getProperties === "function") { if (featureData && typeof featureData.getProperties === "function") {
const selectedVal = featureData.getProperties(); const selectedVal = featureData.getProperties();
let featureCd = layerId == '하수재이용시설' ? selectedVal?.swtrmt_fclt_cd : layerId == '빗물이용시설' || layerId == '중수도시설' || layerId == '온배수시설' || layerId == '수요처' ? selectedVal?.bdst_nm : layerId == '하수처리시설' ? selectedVal?.swtrmt_fclt_nm : null; let featureCd = layerId == '하수재이용시설' ? selectedVal?.swtrmt_fclt_cd : layerId == '빗물이용시설' || layerId == '중수도시설' || layerId == '온배수시설' || layerId == '수요처' ? selectedVal?.bdst_nm : layerId == '하수처리시설' ? selectedVal?.swtrmt_fclt_nm : null;
@@ -510,7 +507,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
//하수처리시설 //하수처리시설
const isPrcsFclt = layerId == '하수처리시설' const isPrcsFclt = layerId == '하수처리시설'
// 재이용시설 // 재이용시설
const isPbnst = layerId == '재이용시설'; const isPbnst = layerId == '하수재이용시설';
// 빗물이용시설 // 빗물이용시설
const isRain = layerId == '빗물이용시설'; const isRain = layerId == '빗물이용시설';
// 중수도시설 // 중수도시설
@@ -518,7 +515,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({
// 온배수시설 // 온배수시설
const isHtdfl = layerId == '온배수시설'; const isHtdfl = layerId == '온배수시설';
// 수요처관리 // 수요처관리
const isReuseMng = layerId == '수요처관리'; const isReuseMng = layerId == '수요처';
if (isPrcsFclt) { if (isPrcsFclt) {
if (viewMode == 'list') { if (viewMode == 'list') {
return ( return (
+57 -25
View File
@@ -617,31 +617,63 @@ export default function CoMatRvw() {
<div className="col-span-12 w-full"> <div className="col-span-12 w-full">
<h1 className={formH1Class}>공급처 후보지</h1> <h1 className={formH1Class}>공급처 후보지</h1>
</div> </div>
{[0, 1, 2].map((idx) => ( <div className="col-span-4 mt-4">
<div key={idx} className="col-span-4 mt-4"> <FormField
<FormField control={form.control}
control={form.control} name={`demandMatching.splyCndtList.${0}`}
name={`splyCndtList.${idx}`} render={({ field }) => (
render={({ field }) => ( <FormUi label="후보지1">
<FormUi label={`후보지${idx + 1}`}> <Input
<Input placeholder=""
placeholder="" type="text"
type="text" onChange={(e) => {
onChange={(e) => { field.onChange(String(e.target.value));
const newValue = { }}
...(field.value || {}), value={field.value ?? ""}
ruseUtztnFcltNm: e.target.value, readOnly
}; />
field.onChange(newValue); </FormUi>
}} )}
value={field.value?.ruseUtztnFcltNm ?? ""} />
readOnly </div>
/> <div className="col-span-4 mt-4">
</FormUi> <FormField
)} control={form.control}
/> name={`demandMatching.splyCndtList.${1}`}
</div> render={({ field }) => (
))} <FormUi label="후보지2">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name={`demandMatching.splyCndtList.${2}`}
render={({ field }) => (
<FormUi label="후보지3">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
readOnly
/>
</FormUi>
)}
/>
</div>
</div> </div>
</Form> </Form>
<ConCostForm <ConCostForm
@@ -71,7 +71,7 @@ export default function PublicReuseFaciltyInsert() {
// defaultValues: { items: pbnstRegArrayZod.parse([]) }, // defaultValues: { items: pbnstRegArrayZod.parse([]) },
mode: "onChange", mode: "onChange",
}); });
// const { isDirty } = form.formState; const { isDirty } = form.formState;
const { const {
fields: items, fields: items,
@@ -90,10 +90,10 @@ export default function PublicReuseFaciltyInsert() {
}, [pbnst.isInit, pubHasuInit]); }, [pbnst.isInit, pubHasuInit]);
const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => {
// if (!isDirty) { if (!isDirty) {
// toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시 toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시
// return; return;
// } }
const data = writeRgtrAndMdfr(valuse.items); const data = writeRgtrAndMdfr(valuse.items);
let bizs = [] as fcBizType[]; let bizs = [] as fcBizType[];
data.forEach((fclt) => { data.forEach((fclt) => {
@@ -1,7 +1,6 @@
"use client"; "use client";
import { useWrStore } from "@/app/store"; import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code"; import { btnClass } from "@/app/store/common/code";
import { prfRegPageSize } from "@/app/store/prfmncReg/pbnstPrfmncReg";
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type"; import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type";
import { excelDownload, yearOptions } from "@/components/lib/func/commom"; import { excelDownload, yearOptions } from "@/components/lib/func/commom";
@@ -34,8 +33,6 @@ export default function PbnstSttn() {
} = useWrStore((state) => state); } = useWrStore((state) => state);
const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn; const { pbnstSttnRes, fclts, pbnstSttnResCount } = pbnstSttn;
const [isReset, setIsReset] = useState(false);
const ref = useRef<ReturnType>({} as ReturnType); const ref = useRef<ReturnType>({} as ReturnType);
const [searchYear, setSearchYear] = useState<string>( const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear()) String(new Date().getFullYear())
@@ -70,24 +67,6 @@ export default function PbnstSttn() {
}, },
[getPbnStnDetail, pbnstSttnRes] [getPbnStnDetail, pbnstSttnRes]
); );
useEffect(() => {
if (!pbnstSttn.isInit) {
getFlcts();
}
}, [pbnstSttn.isInit]);
useEffect(() => {
pbnSttnInit("1", "15", ref.current, searchYear, fclts);
}, [fclts]);
useEffect(() => {
if (pbnstSttnRes && pbnstSttnRes.length > 0) {
setBdstTable(pbnstSttnRes);
} else {
setBdstTable([]);
}
}, [pbnstSttnRes]);
useEffect(() => { useEffect(() => {
if (pbnstSttn.excelList.length >= 0) { if (pbnstSttn.excelList.length >= 0) {
@@ -100,7 +79,22 @@ export default function PbnstSttn() {
); );
} }
}, [pbnstSttn.excelList]); }, [pbnstSttn.excelList]);
useEffect(() => {
if (!pbnstSttn.isInit) {
getFlcts();
}
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
useEffect(() => {
if (pbnstSttnRes && pbnstSttnRes.length > 0) {
setBdstTable(pbnstSttnRes);
} else {
setBdstTable([]);
}
}, [pbnstSttnRes]);
useEffect(() => {
pbnSttnInit("1", "15", ref.current, searchYear, pbnstSttn.fclts);
}, [fclts]);
useEffect(() => { useEffect(() => {
if (pbnstSttn.pbnstDetail.pbnstRuseFcltId) if (pbnstSttn.pbnstDetail.pbnstRuseFcltId)
@@ -123,7 +117,6 @@ export default function PbnstSttn() {
selectUnitWaterShedData={code.lgbsnCd} selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd} selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd} selectEnvPartData={code.lclgvrnmntCd}
buttonOrder={["query", "init", "excel"]}
rightClassName="ml-auto mr-6 flex items-center space-x-1" rightClassName="ml-auto mr-6 flex items-center space-x-1"
leftClassName="flex gap-5 w-9/12 m-4" leftClassName="flex gap-5 w-9/12 m-4"
leftSelectClassName="w-1/4" leftSelectClassName="w-1/4"
@@ -162,11 +155,16 @@ export default function PbnstSttn() {
/> />
</div> </div>
} }
queryClick={ ()=> { queryClick={function (returnType: ReturnType): void {
// pbnSearch(returnType); pbnstSttnSearch(
false,
//setTableIndex(0) "1",
setIsReset(true); "15",
returnType,
pbnRuseNm,
searchYear,
fclts
);
}} }}
excelClick={excelClick} excelClick={excelClick}
initClick={function (): void { initClick={function (): void {
@@ -194,16 +192,13 @@ export default function PbnstSttn() {
pbnstSttnSearch( pbnstSttnSearch(
false, false,
String(page), String(page),
String(prfRegPageSize), String(15),
ref.current, ref.current,
pbnRuseNm, pbnRuseNm,
searchYear, searchYear,
fclts fclts
); );
setIsReset(false);
}} }}
resetPageNo={isReset}
> >
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} /> <HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
</UiTable> </UiTable>
@@ -38,12 +38,11 @@ import { useTranslation } from "react-i18next";
import { headMakeprfmnc } from "../chkgdnReg/TableHead"; import { headMakeprfmnc } from "../chkgdnReg/TableHead";
export default function PrfmncPrfmncReg() { export default function PrfmncPrfmncReg() {
const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch,getPrfFmcRes } = useWrStore( const { auth, prfmnc, prfmncHasuInit, prfmnRegData, prfmncHasuNmSearch } = useWrStore(
(state) => state (state) => state
); );
const { prfPbnFclts, pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc; const { pbnstPrfmncHeadList, monthHeadList, prfmncRes, prfmncResCount } = prfmnc;
const { regAuthrtYn, mdfcnAuthrtYn } = auth; const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const [isReset, setIsReset] = useState(false);
const [bdstTable, setbdstTable] = useState<FcPrfType[]>(); const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
const [searchTxt, setSearchTxt] = useState<string>(); const [searchTxt, setSearchTxt] = useState<string>();
const [isExcelOpen, setIsExcelOPen] = useState<{ const [isExcelOpen, setIsExcelOPen] = useState<{
@@ -52,6 +51,7 @@ export default function PrfmncPrfmncReg() {
}>({ isModal: false, data: {} as FcPrfType }); }>({ isModal: false, data: {} as FcPrfType });
const [inputData, setInputData] = useState<any[]>(); const [inputData, setInputData] = useState<any[]>();
const [pbnstRuseFcltId, setpbnstRuseFcltId] = useState<string>(); const [pbnstRuseFcltId, setpbnstRuseFcltId] = useState<string>();
const [pageNation, setPageNation] = useState<number>(1);
const [cellNum, setCellNum] = useState<number>(1); const [cellNum, setCellNum] = useState<number>(1);
const [searchYear, setSearchYear] = useState<string>( const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear()) String(new Date().getFullYear())
@@ -65,6 +65,20 @@ export default function PrfmncPrfmncReg() {
"A1:O1" "A1:O1"
); );
}, [prfmnc.excelList]); }, [prfmnc.excelList]);
/*
const onSave = useCallback(
async() => {
if (pbnstRuseFcltId) {
await prfmnRegData(pageNation,'41',
excelToPbnPrfData(
inputData as unknown as JSON[],
searchYear,
pbnstRuseFcltId
) as unknown as PrfType
);
// cellClick(cellNum)
}
}, [inputData, searchYear, pbnstRuseFcltId, pageNation,cellNum]);*/
const { t } = useTranslation('base'); const { t } = useTranslation('base');
const onSave = useCallback(() => { const onSave = useCallback(() => {
@@ -72,20 +86,19 @@ export default function PrfmncPrfmncReg() {
if (!pbnstRuseFcltId) return; if (!pbnstRuseFcltId) return;
prfmnRegData( prfmnRegData(
1, pageNation,
'41', '41',
excelToPbnPrfData( excelToPbnPrfData(
inputData as unknown as JSON[], inputData as unknown as JSON[],
searchYear, searchYear,
pbnstRuseFcltId pbnstRuseFcltId
) as unknown as PrfType ) as unknown as PrfType
, searchYear, , searchYear
prfPbnFclts
); );
}; };
confirmToast(t('isUpdateMsg'), handleConfirm); confirmToast(t('isUpdateMsg'), handleConfirm);
}, [inputData, searchYear, pbnstRuseFcltId, cellNum,prfPbnFclts]); }, [inputData, searchYear, pbnstRuseFcltId, pageNation, cellNum]);
const cellClick = useCallback( const cellClick = useCallback(
(index: number | undefined) => { (index: number | undefined) => {
@@ -181,15 +194,10 @@ export default function PrfmncPrfmncReg() {
useEffect(() => { useEffect(() => {
if (!prfmnc.isInit) { if (!prfmnc.isInit) {
getPrfFmcRes() const year = new Date().getFullYear()
prfmncHasuInit(1, '41', String(year));
} }
}, [prfmnc.isInit, getPrfFmcRes]); }, [prfmnc.isInit, prfmncHasuInit]);
useEffect(() =>{
const year = new Date().getFullYear()
prfmncHasuInit(1, '41',String(year) ,prfPbnFclts);
},[prfPbnFclts])
useEffect(() => { useEffect(() => {
@@ -246,8 +254,14 @@ export default function PrfmncPrfmncReg() {
<div className="flex flex-row space-x-2"> <div className="flex flex-row space-x-2">
<Button size={"sm"} onClick={() => { <Button size={"sm"} onClick={() => {
if (searchTxt && searchTxt?.length > 0) {
prfmncHasuNmSearch(1, '41', searchYear, searchTxt)
setPageNation(1)
} else {
prfmncHasuInit(1, '41', searchYear)
setPageNation(1)
}
setIsReset(true)
}}> }}>
조회 조회
</Button> </Button>
@@ -300,15 +314,10 @@ export default function PrfmncPrfmncReg() {
setCellNum(index ?? 0); setCellNum(index ?? 0);
}} }}
onPageChange={ onPageChange={
(page:number) => { (page) => {
if (searchTxt && searchTxt?.length > 0) { prfmncHasuInit(page, '41', searchYear);
prfmncHasuNmSearch(page, '41', searchYear, searchTxt,prfPbnFclts) setPageNation(page)
} else {
prfmncHasuInit(page, '41', searchYear,prfPbnFclts)
}
setIsReset(false);
}} }}
resetPageNo={isReset}
/> />
</ScrollArea> </ScrollArea>
</ListDiv> </ListDiv>
@@ -341,10 +350,9 @@ export default function PrfmncPrfmncReg() {
setIsExcelOPen({ ...isExcelOpen, isModal: open }) setIsExcelOPen({ ...isExcelOpen, isModal: open })
}} }}
setModalExcelData={async (excelData) => { setModalExcelData={async (excelData) => {
await prfmnRegData(1, '41', await prfmnRegData(pageNation, '41',
excelData, excelData,
searchYear searchYear
,prfPbnFclts
); );
// 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다. // 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다.
} }
@@ -6,7 +6,8 @@ import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType,
import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel"; import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel";
import { excelDownload, yearOptions } from "@/components/lib/func/commom"; import { excelDownload, yearOptions } from "@/components/lib/func/commom";
import { InputTableBody } from "@/components/lib/func/TableData"; import { InputTableBody } from "@/components/lib/func/TableData";
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components"; import SearchInputText from "@/components/ui/searchInput/searchInput";
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { Label, Table, TableBody, TableHeader } from "@common/components/ui"; import { Label, Table, TableBody, TableHeader } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
@@ -21,12 +22,12 @@ export default function PbnstPrfmncSttn() {
pbnstPrfmncSttn, pbnstPrfmncSttn,
// pbnstPrfmncInit, // pbnstPrfmncInit,
pbnstPrfmncSearch, pbnstPrfmncSearch,
getFlctsSttn,
prfmnc, prfmnc,
pbnstSttn,
pbnNmSearch pbnNmSearch
} = useWrStore((state) => state); } = useWrStore((state) => state);
const { monthHeadList } = prfmnc const { monthHeadList } = prfmnc
const { pbnstPrfHeadList, prfmncResCount, prfmncRes, rawData, selectYearList, fclts } = pbnstPrfmncSttn; const { pbnstPrfHeadList, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn;
// const [isChHead, setIsChHead] = useState(false); // const [isChHead, setIsChHead] = useState(false);
const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear())); const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear()));
const [toDate, setToDate] = useState<string>(String(new Date().getFullYear())); const [toDate, setToDate] = useState<string>(String(new Date().getFullYear()));
@@ -38,9 +39,6 @@ export default function PbnstPrfmncSttn() {
const { t } = useTranslation('base'); const { t } = useTranslation('base');
const searchYear = String(new Date().getFullYear()); const searchYear = String(new Date().getFullYear());
const [excelData, setExcelData] = useState<any[]>([]); const [excelData, setExcelData] = useState<any[]>([]);
const [pageNation, setPageNation] = useState(1);
const [resetPage, isResetPage] = useState(false);
const excelClick = useCallback(() => { const excelClick = useCallback(() => {
if (!excelData || excelData.length === 0) { if (!excelData || excelData.length === 0) {
toast.error(t('excelDownErrMsg')); toast.error(t('excelDownErrMsg'));
@@ -100,12 +98,11 @@ export default function PbnstPrfmncSttn() {
})); }));
const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" }; const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" };
const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" }; const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" };
const prfFilter = prfList?.filter((e) =>
e.ym.slice(0, 4) === year const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year)
)
if (prfList && prfFilter.length > 0) { if (prfList && prfFilter.length > 0) {
prfFilter.forEach((prfItem) => { prfList?.forEach((prfItem) => {
const month = Number(prfItem?.ym?.slice(4)); // "MM" const month = Number(prfItem?.ym?.slice(4)); // "MM"
const monthKey = `${month}월`; const monthKey = `${month}월`;
@@ -150,9 +147,8 @@ export default function PbnstPrfmncSttn() {
} }
const tableData = [...inUsageData, ...outUsageData, usageTotalObj]; const tableData = [...inUsageData, ...outUsageData, usageTotalObj];
setPrfData(tableData); setPrfData(tableData);
setExcelData(excelPrfmncSttnParsing(tableData ?? [])) setExcelData(excelPrfmncSttnParsing(prfData ?? []))
} else { } else {
setExcelData(excelPrfmncSttnParsing([]))
setPrfData([]); setPrfData([]);
} }
} }
@@ -213,10 +209,9 @@ export default function PbnstPrfmncSttn() {
rawData.forEach((item) => { rawData.forEach((item) => {
// 실적 테이블 데이터 // 실적 테이블 데이터
if (chartId) { if (chartId) {
if (item.prfList.find((e) => e.ym.slice(0, 4) === year) && item.prfList?.[0]?.pbnstRuseFcltId === chartId) { if (item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltId === chartId) {
prfTableData(item.prfList, year); prfTableData(item.prfList, year);
} }
item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltId === chartId).forEach((element) => { item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltId === chartId).forEach((element) => {
// 누적 // 누적
wshwtr += element.wshwtr; wshwtr += element.wshwtr;
@@ -440,6 +435,7 @@ export default function PbnstPrfmncSttn() {
} }
}, [inLineData]); }, [inLineData]);
useEffect(() => { useEffect(() => {
if (outLineData?.chartData1) { if (outLineData?.chartData1) {
const newChartConfig = { const newChartConfig = {
@@ -493,28 +489,22 @@ export default function PbnstPrfmncSttn() {
sigunText: "" sigunText: ""
} }
tableHeadMaker(Number(searchYear), Number(searchYear)); tableHeadMaker(Number(searchYear), Number(searchYear));
getFlctsSttn(); pbnstPrfmncSearch(returnType, "", searchYear, searchYear)
pbnstPrfmncSearch(1, returnType, "", searchYear, searchYear, fclts)
}, []); }, []);
useEffect(() => { useEffect(() => {
pbnstPrfmncSearch(pageNation, ref.current, pbnRuseNm, fromDate, toDate, pbnstPrfmncSttn.fclts); setbdstTable(prfmncRes.map((e, idx) => {
isResetPage(false)
}, [fclts, pageNation]);
useEffect(() => {
const tableData = prfmncRes.map((e, idx) => {
return ({ return ({
...e, ...e,
number: String(idx + 1) number: String(idx + 1)
}) })
}) }))
setbdstTable(tableData)
if (prfmncRes?.[0]?.pbnstRuseFcltId) setChartId(prfmncRes[0].pbnstRuseFcltId) if (prfmncRes?.[0]?.pbnstRuseFcltId) setChartId(prfmncRes[0].pbnstRuseFcltId)
}, [prfmncRes]); }, [prfmncRes]);
useEffect(() => { useEffect(() => {
if (pbnRuseNm.length > 1) if (pbnRuseNm.length > 1)
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear, []); pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear, []);
@@ -525,6 +515,7 @@ export default function PbnstPrfmncSttn() {
setChartId(prfmncRes[index].pbnstRuseFcltId) setChartId(prfmncRes[index].pbnstRuseFcltId)
} }
} }
return ( return (
<> <>
<ContentsDiv> <ContentsDiv>
@@ -542,7 +533,6 @@ export default function PbnstPrfmncSttn() {
rightClassName="ml-auto mr-6 flex items-center space-x-1" rightClassName="ml-auto mr-6 flex items-center space-x-1"
leftClassName="flex gap-5 w-9/12 m-4" leftClassName="flex gap-5 w-9/12 m-4"
leftSelectClassName="w-1/6" leftSelectClassName="w-1/6"
buttonOrder={["query", "init", "excel"]}
leftChildren={<div className="col-span-5"> leftChildren={<div className="col-span-5">
<div className="flex flex-row"> <div className="flex flex-row">
{/* <div className="flex flex-row items-center"> */} {/* <div className="flex flex-row items-center"> */}
@@ -558,7 +548,7 @@ export default function PbnstPrfmncSttn() {
selectArray={yearOptions} selectArray={yearOptions}
value={fromDate} value={fromDate}
onSelectValue={(val: string | number) => setFromDate(String(val))} /> onSelectValue={(val: string | number) => setFromDate(String(val))} />
<span> ~</span> <span> ~</span>
<SelectBox <SelectBox
// className="w-full h-full text-2xl mx-4" // className="w-full h-full text-2xl mx-4"
className="flex-none w-32 h-full text-2xl mr-4" className="flex-none w-32 h-full text-2xl mr-4"
@@ -567,16 +557,18 @@ export default function PbnstPrfmncSttn() {
selectArray={yearOptions} selectArray={yearOptions}
value={toDate} value={toDate}
onSelectValue={(val: string | number) => setToDate(String(val))} /> onSelectValue={(val: string | number) => setToDate(String(val))} />
<Label className="w-28 mt-2 text-xl">
{"시설명"}
</Label>
<SearchInput
className={" h-full text-2xl"}
label={""}
textValue={pbnRuseNm || ""}
setText={setPbnRuseNm}
/>
</div> </div>
<SearchInputText
label={"하수처리시설"}
initValue={pbnRuseNm ?? ""}
setValue={(searchNm?: string) => {
setPbnRuseNm(searchNm || "");
}}
setRtnData={/*function (rtnData: any[]): void {setbdstTable(rtnData);}*/
() => { }
}
searchList={pbnstSttn.pbnstSearchData || []}
></SearchInputText>
{/* <SelectBox {/* <SelectBox
className="h-full text-2xl" className="h-full text-2xl"
label="재이용시설명" label="재이용시설명"
@@ -587,7 +579,7 @@ export default function PbnstPrfmncSttn() {
</div> </div>
</div>} </div>}
queryClick={function (returnType: ReturnType): void { queryClick={function (returnType: ReturnType): void {
pbnstPrfmncSearch(1, returnType, pbnRuseNm ?? "", fromDate, toDate, fclts); pbnstPrfmncSearch(returnType, pbnRuseNm ?? "", fromDate, toDate);
if (fromDate && toDate) { if (fromDate && toDate) {
const fromNum = Number(fromDate); const fromNum = Number(fromDate);
const toNum = Number(toDate); const toNum = Number(toDate);
@@ -602,14 +594,9 @@ export default function PbnstPrfmncSttn() {
} }
} }
} }
isResetPage(true)
}} }}
excelClick={excelClick} excelClick={excelClick}
initClick={function (): void { initClick={function (): void { }}
setPbnRuseNm("");
setFromDate(String(new Date().getFullYear()));
setToDate(String(new Date().getFullYear()))
}}
btnClass={btnClass} btnClass={btnClass}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
</div> </div>
@@ -621,14 +608,13 @@ export default function PbnstPrfmncSttn() {
headName={undefined} headName={undefined}
tableData={bdstTable || []} tableData={bdstTable || []}
headlist={pbnstPrfHeadList} headlist={pbnstPrfHeadList}
pageSize={5} pageSize={20}
total={prfmncResCount} total={10000}
cellClick={(index: number | undefined, headId: string) => { cellClick={(index: number | undefined, headId: string) => {
cellClick(index ?? undefined, headId); cellClick(index ?? undefined, headId);
}} }}
onPageChange={setPageNation} onPageChange={() => { }}
index={0} index={0}
resetPageNo={resetPage}
/> />
<hr /> <hr />
@@ -645,62 +631,54 @@ export default function PbnstPrfmncSttn() {
<div className="flex"> <div className="flex">
<div className="w-1/3"> <div className="w-1/3">
{chartData.find((e) => e.val > 0) ? <MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
:
<div className="flex items-center justify-center text-2xl">
조회된 장내·외 용수 총 실적(m³) 데이터가 없습니다.
</div>}
</div> </div>
<div className="w-1/3"> <div className="w-1/3">
{dnInUsage.find((e) => e.val > 0) ? <MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
:
<div className="flex items-center justify-center text-2xl">
조회된 장내용수 실적(m³) 데이터가 없습니다.
</div>}
</div> </div>
<div className="w-1/3"> <div className="w-1/3">
{dnOutUsage.find((e) => e.val > 0) ? <MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
:
<div className="flex items-center justify-center text-2xl">
조회된 장외용수 실적(m³) 데이터가 없습니다.
</div>}
</div> </div>
</div> </div>
<h1 className="">장내·외 월별 하수재이용실적 현황</h1> <h1 className="">장내·외 월별 하수재이용실적 현황</h1>
<div className="flex"> <div className="flex">
<div className="w-1/3"> <div className="w-1/3">
{barData.length > 0 ? <MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
:
<div className="flex items-center justify-center text-2xl">
조회된 월별 장내·외 용수 총 실적(m³) 데이터가 없습니다.
</div>}
</div> </div>
<div className="w-1/3"> <div className="w-1/3">
{inLineData && Object.values(inLineData).every(arr => Array.isArray(arr) && arr.length === 0) ? <MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
<div className="flex items-center justify-center text-2xl">
조회된 월별 장내 용수 실적(m³) 데이터가 없습니다.
</div>
:
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
}
</div> </div>
<div className="w-1/3"> <div className="w-1/3">
{outLineData && Object.values(outLineData).every(arr => Array.isArray(arr) && arr.length === 0) ? <MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
<div className="flex items-center justify-center text-2xl"> </div>
조회된 월별 장외 용수 총 실적(m³) 데이터가 없습니다.
</div>
:
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
}</div>
</div> </div>
<h1 className="">하수재이용실적 현황 (단위: m³)</h1> <h1 className="">하수재이용실적 현황 (단위: m³)</h1>
{/* <ListDiv className="col-span-8 pr-6 "> */}
{/* <ScrollArea className="h-[60vh]"> */}
{/* <div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m³) 등록결과"}
</h3>
</div> */}
{/* <UiTable
headName={undefined}
tableData={prfData || []}
headlist={monthHeadList}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={()=>{}}>
</UiTable> */}
<ListDiv className="col-span-8 pr-6 "> <ListDiv className="col-span-8 pr-6 ">
<ScrollArea className={prfData && prfData.length > 0 ? "h-[60vh]" : ""}> <ScrollArea className={prfData && prfData.length > 0 ? "h-[60vh]" : ""}>
{/* <div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수재이용실적 현황 (단위: m³)"}
</h3>
</div> */}
<Table variant="secondary"> <Table variant="secondary">
<TableHeader className="font-bold"> <TableHeader className="font-bold">
{headMakeprfmnc(monthHeadList, [])} {headMakeprfmnc(monthHeadList, [])}
@@ -712,7 +690,10 @@ export default function PbnstPrfmncSttn() {
</Table> </Table>
</ScrollArea> </ScrollArea>
</ListDiv> </ListDiv>
{/* </ScrollArea> */}
</ListDiv> </ListDiv>
{/* </ListDiv> */}
</div> </div>
</div> </div>
</ContentsDiv> </ContentsDiv>
@@ -94,12 +94,6 @@ export const DmdCoReqSchema = z.object({
demandMatching: DemandMatchingSchema.nullish(), demandMatching: DemandMatchingSchema.nullish(),
demandCst: DemandCstSchema.nullish(), demandCst: DemandCstSchema.nullish(),
ruseUtztnFcltNm: z.string().nullish(), ruseUtztnFcltNm: z.string().nullish(),
splyCndtList: z.array(
z.object({
ruseUtztnFcltNm: z.string(),
ruseUtztnFcltCd: z.string(),
}).nullish()
).nullish(),
totalConstCost: z.number().nullish(), totalConstCost: z.number().nullish(),
}); });
@@ -153,10 +147,3 @@ export type rateFeeType = {
stdCost: number; stdCost: number;
rt: number; rt: number;
}; };
// 공급 후보자 타입 정의
export type SupplyCandidate = {
ruseUtztnFcltNm: string;
ruseUtztnFcltCd: string;
};
@@ -52,6 +52,8 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
`/reuseFc/request/${pageNo}/${pageCnt}/${con}` `/reuseFc/request/${pageNo}/${pageCnt}/${con}`
); );
console.log('coSttnRes ', coSttnRes)
set((state: coSttnState) => { set((state: coSttnState) => {
return { return {
...state, ...state,
@@ -6,7 +6,6 @@ import {
isInvalidNumber, isInvalidNumber,
parseRawValue, parseRawValue,
} from "@/components/lib/func/excelFunc"; } from "@/components/lib/func/excelFunc";
import toast from "react-hot-toast";
export const useTypes = [ export const useTypes = [
"조경용수", "조경용수",
"청소화장실용수", "청소화장실용수",
@@ -17,18 +16,6 @@ export const useTypes = [
"기타", "기타",
]; ];
export const chkMngType =[
'위탁',
'자체'
]
export const chkSpwtPositnType = [
'유량계',
'수위계',
'펌프적산전력계',
'기타'
]
export type Buildingtype = { export type Buildingtype = {
bdstInfoSn: number; bdstInfoSn: number;
ctpvCd: 1; ctpvCd: 1;
@@ -156,56 +143,43 @@ export const excelToRainChkData = (excelData: any, year: string) => {
}) })
.filter((el: any) => el !== undefined); .filter((el: any) => el !== undefined);
console.log("rainChkgdData", rainChkgdData);
if (rainChkgdData.length > 0) { if (rainChkgdData.length > 0) {
rainChkgdData.forEach((rain: any) => { rainChkgdData.forEach((rain: any) => {
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `; const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) { if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
issues.push( issues.push(
defaultMessage + `점검일: 날짜 형식 아님 입력값 : (${rain.chckYmd})` defaultMessage + `점검일: 날짜 형식 아님 (${rain.chckYmd})`
); );
} }
if (rain.anlOperCst.length > 2 && isInvalidNumber(rain.anlOperCst)) { if (rain.anlOperCst.length > 2 && isInvalidNumber(rain.anlOperCst)) {
issues.push( issues.push(
defaultMessage + defaultMessage +
` 연간운영비(원/년): 숫자 형식 아님 /입력값:${rain.anlOperCst}` ` 연간운영비(원/년): 숫자 형식 아님 (${rain.anlOperCst})`
); );
} }
if (rain.oilqMeasMthd.length > 1 && !chkMngType.includes(rain.oilqMeasMthd)) {
issues.push(
defaultMessage + `유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}`
);
}
if (rain.spwtPositn.length > 1 && !chkSpwtPositnType.includes(rain.spwtPositn)) {
issues.push(
defaultMessage + `측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rain.spwtPositn}`
);
}
rain.rainyDetails?.forEach((key) => { rain.rainyDetails?.forEach((key) => {
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) { if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
issues.push(defaultMessage + `PH: 숫자 형식 아님 /입력값:${key.ph}`); issues.push(defaultMessage + `PH: 숫자 형식 아님 (${key.ph})`);
} }
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) { if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
issues.push(defaultMessage + `탁도: 숫자 형식 아님 /입력값:${key.trbt}`); issues.push(defaultMessage + `탁도: 숫자 형식 아님 (${key.trbt})`);
} }
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) { if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
issues.push( issues.push(
defaultMessage + `총대장균군수: 숫자 형식 아님 /입력값:${key.grssClfg}` defaultMessage + `총대장균군수: 숫자 형식 아님 (${key.grssClfg})`
); );
} }
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) { if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
issues.push( issues.push(
defaultMessage + defaultMessage +
`과태료부과금액(천원): 숫자 형식 아님 /입력값:${key.levyAmt}` `과태료부과금액(천원): 숫자 형식 아님 (${key.levyAmt})`
); );
} }
if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) { if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) {
issues.push( issues.push(
defaultMessage + defaultMessage +
`과태료 부과일(위반일): 날짜 형식 아님 /입력값:${key.vltnDt}` `과태료 부과일(위반일): 날짜 형식 아님 (${key.vltnDt})`
); );
} }
}); });
@@ -214,19 +188,17 @@ console.log("rainChkgdData", rainChkgdData);
if (isInvalidNumber(guide.splyUswtrUtztnQnt)) { if (isInvalidNumber(guide.splyUswtrUtztnQnt)) {
issues.push( issues.push(
defaultMessage + defaultMessage +
`대체_${mm}: 숫자 형식 아님 /입력값:${guide.splyUswtrUtztnQnt}` `대체_${mm}: 숫자 형식 아님 (${guide.splyUswtrUtztnQnt})`
); );
} }
if (isInvalidNumber(guide.ruseFcltUtztnQnt)) { if (isInvalidNumber(guide.ruseFcltUtztnQnt)) {
issues.push( issues.push(
defaultMessage + defaultMessage +
`빗물_${mm}: 숫자 형식 아님 /입력값:${guide.ruseFcltUtztnQnt}` `빗물_${mm}: 숫자 형식 아님 (${guide.ruseFcltUtztnQnt})`
); );
} }
}); });
}); });
}else{
toast.error("데이터가 없습니다. 점검 데이터를 확인해주세요.");
} }
if (issues.length > 0) { if (issues.length > 0) {
@@ -1,10 +1,5 @@
import type { SelectDataType } from "@common/business_components/ui"; import type { SelectDataType } from "@common/business_components/ui";
import { import { useTypes, type Buildingtype } from "../rainChkgdn/excel";
chkMngType,
chkSpwtPositnType,
useTypes,
type Buildingtype,
} from "../rainChkgdn/excel";
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { rswtChkZodType } from "."; import type { rswtChkZodType } from ".";
import { import {
@@ -176,14 +171,14 @@ export const excelToRswtGuideData = (
.filter((el: any) => el !== undefined); .filter((el: any) => el !== undefined);
if (rswtChkgdData.length > 0) { if (rswtChkgdData.length > 0) {
rswtExcelDataCheck(rswtChkgdData, issues); rswtExcelDataCheck(rswtChkgdData,issues)
} }
if (issues.length > 0) { if (issues.length > 0) {
return { data: [], issues }; return { data: [], issues };
} }
return { data: rswtChkgdData, issues: [] }; return { data:rswtChkgdData, issues: [] };
}; };
export const excelToRswtPolution = (excelData: any, issues: string[]) => { export const excelToRswtPolution = (excelData: any, issues: string[]) => {
@@ -253,25 +248,25 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => {
}) })
.filter((el: any) => el !== undefined); .filter((el: any) => el !== undefined);
if (rswtChkgdData.length > 0) { if (rswtChkgdData.length > 0) {
rswtExcelDataCheck(rswtChkgdData, issues); rswtExcelDataCheck(rswtChkgdData,issues)
} }
if (issues.length > 0) { if (issues.length > 0) {
return { data: [], issues }; return { data: [], issues };
} }
return { data: rswtChkgdData, issues: [] }; return { data:rswtChkgdData, issues: [] };
}; };
const rswtExcelDataCheck = (
rswtChkgdData: rswtChkZodType[], const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
issues: string[]
) => {
rswtChkgdData.forEach((rswt: any) => { rswtChkgdData.forEach((rswt: any) => {
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `; const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) { if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`); issues.push(
defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`
);
} }
if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) { if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) {
issues.push( issues.push(
@@ -284,25 +279,6 @@ const rswtExcelDataCheck = (
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})` defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
); );
} }
if (
rswt.oilqMeasMthd.length > 1 &&
!chkMngType.includes(rswt.oilqMeasMthd)
) {
issues.push(
defaultMessage +
`유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rswt.oilqMeasMthd}`
);
}
if (
rswt.spwtPositn.length > 1 &&
!chkSpwtPositnType.includes(rswt.spwtPositn)
) {
issues.push(
defaultMessage +
`측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}`
);
}
if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) { if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) {
rswt.rswtrPollutions.forEach((pol) => { rswt.rswtrPollutions.forEach((pol) => {
if (isInvalidNumber(pol.grssClfgUswtr)) { if (isInvalidNumber(pol.grssClfgUswtr)) {
@@ -325,7 +301,8 @@ const rswtExcelDataCheck = (
} }
if (isInvalidNumber(pol.bod)) { if (isInvalidNumber(pol.bod)) {
issues.push( issues.push(
defaultMessage + `${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})` defaultMessage +
`${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
); );
} }
if (isInvalidNumber(pol.smll)) { if (isInvalidNumber(pol.smll)) {
@@ -342,7 +319,8 @@ const rswtExcelDataCheck = (
} }
if (isInvalidNumber(pol.tph)) { if (isInvalidNumber(pol.tph)) {
issues.push( issues.push(
defaultMessage + `${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})` defaultMessage +
`${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})`
); );
} }
if (isInvalidNumber(pol.tn)) { if (isInvalidNumber(pol.tn)) {
@@ -380,5 +358,7 @@ const rswtExcelDataCheck = (
} }
}); });
} }
}); })
};
}
@@ -7,17 +7,16 @@ import toast from "react-hot-toast";
const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport; const pbnstPrfmncHeadList = pbnstPrfmncHeadListExport;
const monthHeadList = monthHeadListExport; const monthHeadList = monthHeadListExport;
export const prfRegPageSize = 10;
export type pbnstPrfmncState = { export type pbnstPrfmncState = {
prfmnc: { prfmnc: {
isInit: boolean; isInit: boolean;
pbnstPrfmncHeadList: TableUpperProps[]; pbnstPrfmncHeadList: TableUpperProps[];
monthHeadList: TableUpperProps[]; monthHeadList: TableUpperProps[];
prfmncRes: FcPrfType[]; prfmncRes: FcPrfType[];
prfmncResCount: number; prfmncResCount:number;
excelList: number[]; excelList: number[];
pageKey: number; pageKey:number
prfPbnFclts: string[];
}; };
}; };
@@ -27,126 +26,68 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = {
pbnstPrfmncHeadList: pbnstPrfmncHeadList, pbnstPrfmncHeadList: pbnstPrfmncHeadList,
monthHeadList: monthHeadList, monthHeadList: monthHeadList,
prfmncRes: [], prfmncRes: [],
prfPbnFclts: [], prfmncResCount:1,
prfmncResCount: 1,
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
pageKey: 1, pageKey:1
}, },
}; };
export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions; export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions;
type pbnstPrfmncActions = { type pbnstPrfmncActions = {
prfmncHasuInit: ( prfmncHasuInit: (page: number, sggOrCity: string ,year:string) => void;
page: number, prfmncHasuNmSearch: (page: number, sggOrCity: string , txt:string ,year:string) => void;
sggOrCity: string, prfmnRegData: (page:number,sggOrCity:string, data: PrfType,year:string) => void;
year: string,
prfPbnFclts: string[]
) => void;
prfmncHasuNmSearch: (
page: number,
sggOrCity: string,
year: string,
searchTxt: string,
prfPbnFclts: string[]
) => void;
prfmnRegData: (
page: number,
sggOrCity: string,
data: PrfType,
year: string,
prfPbnFclts: string[]
) => void;
getPrfFmcRes: () => void;
}; };
const hasuListFetch = async ( const checkWrRegList = async (year:string) => {
page: number, const url =`/reuseFc/pubDetailList`
sggOrCity: string, if(year&& year.length>0){
year: string, // url+=`/${year}`
prfPbnFclts: string[],
searchTxt?: string
) => {
let filteredFclt = prfPbnFclts;
if (sggOrCity !== "0") {
filteredFclt = prfPbnFclts?.filter((fclt: string) => {
return sggOrCity.length == 2
? fclt.slice(0, 2) === sggOrCity
: fclt.slice(0, 5) === sggOrCity;
});
} }
const wrRegList = await getFetch("wr", url);
let url = `/prcsFclt/ruseInfo/1/${filteredFclt.length + 1}/A/${sggOrCity}/0/1/SW`; return wrRegList;
if (searchTxt && searchTxt?.length > 0) { };
url += `/${searchTxt}`; const hasuListFetch = async (page: number, sggOrCity: string , year:string,searchNm?:string ) => {
} const checkWrRegListRes = await checkWrRegList(year);
const rainRes = await postFectch(url, filteredFclt, fetchType.COMMON); const rainRes = await postFectch(
`/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
const checkRuseFcltList = checkWrRegListRes?.fcltCds,
searchTxt && searchTxt?.length > 0 fetchType.COMMON
? rainRes.data.map((item) => item.bscFctCd)
: filteredFclt;
const pubRuseList = await postFectch(
`/reuseFc/pubDetailList/${year}/${sggOrCity}/${page}/${prfRegPageSize}`,
checkRuseFcltList,
fetchType.WR
); );
const rusePrfList = pubRuseList.data let findData = rainRes.data.map((item: pubHasuType) => {
.map((item: FcPrfType) => { const data = checkWrRegListRes?.fcPrfList.find(
const findData = rainRes.data?.find( (fclt: FcPrfType) =>
(fclt: pubHasuType) => fclt.pbnstRuseFcltId.substring(0, 11) === item?.bscFctCd
item.pbnstRuseFcltId.substring(0, 11) === fclt?.bscFctCd );
); if(data !==undefined){
if (findData !== undefined) { return( {
return {
sido: findData.sido,
gugun: findData.gugun,
bscFctNm: findData.bscFctNm,
bscFctCd: findData.bscFctCd,
ruseUtztnFcltNm: item.ruseUtztnFcltNm,
pbnstRuseFcltId: item.pbnstRuseFcltId,
prfList: item.prfList,
};
}
})
.filter(Boolean); // undefined 값을 제거합니다.
return { data: rusePrfList, count: pubRuseList.count }; sido: item.sido,
gugun: item.gugun,
bscFctNm: item.bscFctNm,
bscFctCd: item.bscFctCd,
ruseUtztnFcltNm: data.ruseUtztnFcltNm,
pbnstRuseFcltId: data.pbnstRuseFcltId,
prfList: data.prfList,
});
}
}).filter(Boolean); // undefined 값을 제거합니다.
if(searchNm){
findData= findData.filter((ruse:any) => ruse.ruseUtztnFcltNm.includes(searchNm))
}
return {data:findData, count:findData.length};
}; };
export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
set: any set: any
) => { ) => {
return { return {
getPrfFmcRes: async () => { prfmncHasuInit: async (page: number, sggOrCity: string,year:string) => {
try { try {
const pbnPrfRes = await getFetch(fetchType.WR, "/reuseFc/pubFc"); const prfmncRes = await hasuListFetch(page, sggOrCity, year);
console.log("pbnPrfRes ", pbnPrfRes);
set((state: pbnstPrfmncState) => ({
...state,
prfmnc: {
...state.prfmnc,
prfPbnFclts: pbnPrfRes,
},
}));
} catch (error) {
console.log(error);
}
},
prfmncHasuInit: async (
page: number,
sggOrCity: string,
year: string,
prfPbnFclts: string[]
) => {
try {
console.log("prfPbnFclts ", prfPbnFclts);
const prfmncRes = await hasuListFetch(
page,
sggOrCity,
year,
prfPbnFclts
);
return set((state: pbnstPrfmncState) => ({ return set((state: pbnstPrfmncState) => ({
...state, ...state,
prfmnc: { prfmnc: {
@@ -160,21 +101,9 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
console.log(errorHasu); console.log(errorHasu);
} }
}, },
prfmncHasuNmSearch: async ( prfmncHasuNmSearch: async (page: number, sggOrCity: string,fcltNm:string ,year:string)=> {
page: number,
sggOrCity: string,
year: string,
searchTxt: string,
prfPbnFclts: string[]
) => {
try { try {
const prfmncRes = await hasuListFetch( const prfmncRes = await hasuListFetch(page, sggOrCity,fcltNm ,year);
page,
sggOrCity,
year,
prfPbnFclts,
searchTxt
);
return set((state: pbnstPrfmncState) => ({ return set((state: pbnstPrfmncState) => ({
...state, ...state,
prfmnc: { prfmnc: {
@@ -188,13 +117,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
console.log(errorHasu); console.log(errorHasu);
} }
}, },
prfmnRegData: async ( prfmnRegData: async (page:number,sggOrCity:string,data: PrfType,year:string) => {
page: number,
sggOrCity: string,
data: PrfType,
year: string,
prfPbnFclts: string[]
) => {
try { try {
const ressponse = await postFectch( const ressponse = await postFectch(
"/reuseFc/pubFcPrf", "/reuseFc/pubFcPrf",
@@ -202,14 +125,11 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
fetchType.WR fetchType.WR
); );
if (ressponse.status === 200) { if (ressponse.status === 200) {
toast.success("하수재이용 시설 실적 등록이 완료되었습니다."); toast.success("하수재이용 시설 실적 등록이 완료되었습니다.");
const prfmncRes = await hasuListFetch( const prfmncRes = await hasuListFetch(page, sggOrCity,year) ;
page,
sggOrCity,
year,
prfPbnFclts
);
return set((state: pbnstPrfmncState) => ({ return set((state: pbnstPrfmncState) => ({
...state, ...state,
@@ -218,9 +138,10 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (
prfmncRes: prfmncRes.data, prfmncRes: prfmncRes.data,
prfmncResCount: prfmncRes.count, prfmncResCount: prfmncRes.count,
isInit: false, isInit: false,
pageKey: state.prfmnc.pageKey + 1, pageKey: state.prfmnc.pageKey + 1
}, },
})); }));
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
@@ -4,13 +4,11 @@ import { monthSttnHeadListExport, pbnstPrfmncSttnHeadListExport, pbnstYearHeadLi
import type { FcPrfType, PrfType } from "../../prfmncReg/pbnstPrfmncReg/type"; import type { FcPrfType, PrfType } from "../../prfmncReg/pbnstPrfmncReg/type";
import type { pubHasuType, selectLabel } from "../../ruseFcltMng/fcltReg/pbnstReg/type"; import type { pubHasuType, selectLabel } from "../../ruseFcltMng/fcltReg/pbnstReg/type";
import type { ReturnType } from "@common/business_components"; import type { ReturnType } from "@common/business_components";
import type { WaterReuseFacility } from "../../ruseFcltMng/fcltSttn/pbnstSttn/type";
type pbnstPrfmncSttnActions = { type pbnstPrfmncSttnActions = {
tableHeadMaker: (startYear: number, endYear: number) => void; tableHeadMaker: (startYear: number, endYear: number) => void;
// pbnstPrfmncInit: (page: string, sggOrCity: string) => void; pbnstPrfmncInit: (page: string, sggOrCity: string) => void;
pbnstPrfmncSearch: (page: number, returnType: ReturnType, fcltNm: string, fromDate: string, toDate: string, fclts: string[]) => void; pbnstPrfmncSearch: (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => void;
getFlctsSttn: () => void;
} }
const pbnstPrfmncRes: PrfType[] = []; const pbnstPrfmncRes: PrfType[] = [];
@@ -24,9 +22,7 @@ export type pbnstPrfmncSttnState = {
isInit: boolean; isInit: boolean;
rawData: any[]; rawData: any[];
selectYearList: selectLabel[] selectYearList: selectLabel[]
monthSttnHeadList: TableUpperProps[]; monthSttnHeadList:TableUpperProps[];
fclts: string[];
prfmncResCount: number;
} }
} }
@@ -40,104 +36,41 @@ export const pbnstPrfmncSttnExport: pbnstPrfmncSttnState = {
isInit: false, isInit: false,
rawData: [], rawData: [],
selectYearList: [], selectYearList: [],
monthSttnHeadList: monthSttnHeadListExport, monthSttnHeadList:monthSttnHeadListExport
fclts: [],
prfmncResCount: 1,
} }
} }
const hasuListFetch = async ( const checkWrRegList = async () => {
page: number, const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`);
returnType: ReturnType, return wrRegList;
searchNm: string | undefined, };
fromDate: string, const hasuListFetch = async (page: string, sggOrCity: string) => {
toDate: string, const checkWrRegListRes = await checkWrRegList();
flcts: string[] const rainRes = await postFectch(
) => { `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`,
let url = ''; checkWrRegListRes?.fcltCds,
let filteredFclt = flcts; fetchType.COMMON
const filterData = returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
if (filterData !== '0')
filteredFclt = flcts.filter((fclt: string) => {
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
})
if (returnType.partValue === "A") {
url += `${returnType.partValue}/${
// returnType.sidoValue ? returnType.sidoValue : returnType.sigunValue
returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue
}/0/1/SW`
if (filterData !== '0')
filteredFclt = flcts.filter((fclt: string) => {
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
})
} else if (returnType.partValue === "R") {
url += `${returnType.partValue}/${returnType.regionValue
? returnType.regionValue
: returnType.unitWaterShedValue
? returnType.unitWaterShedValue
: returnType.middleRegionValue
}/0/1/SW`
} else if (returnType.partValue === 'G') {
url += `${returnType.envPartValue}/${returnType.sigunValue !== '0' ? returnType.sigunValue : returnType.sidoValue}/0/1/SW`
if (filterData !== '0')
filteredFclt = flcts.filter((fclt: string) => {
return filterData.length == 2 ? fclt.slice(0, 2) === filterData : fclt.slice(0, 5) === filterData
})
} else {
url += `A/0/0/1/SW`
}
if (searchNm && searchNm?.length > 0) {
url += "/" + searchNm
}
const pbnList = await postFectch(`/prcsFclt/ruseInfo/1/${filteredFclt.length}/` + url, filteredFclt, fetchType.COMMON);
const checkRuseFcltList = searchNm && searchNm?.length > 0 ? pbnList.data.map((item) => item.bscFctCd) : filteredFclt
const getRuseList = await postFectch(
`/reuseFc/pubDetailPrfList/${fromDate}/${toDate}/${filterData}/${page}/5`,
checkRuseFcltList,
fetchType.WR
); );
const checkWrRegListRes = getRuseList.data; const data = checkWrRegListRes.fcPrfList.map((item: FcPrfType) => {
const findData = rainRes.data.find(
const data: WaterReuseFacility[] = checkWrRegListRes.map( (fclt: pubHasuType) =>
(item: FcPrfType) => { fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11)
if (!item.prfList || item.prfList.length === 0) { );
return null; return {
} sido: findData?.sido,
const findData = pbnList.data.find( gugun: findData?.gugun,
(fclt: pubHasuType) => bscFctNm: findData?.bscFctNm,
fclt.bscFctCd === item.pbnstRuseFcltId.substring(0, 11) ruseUtztnFcltNm: item.ruseUtztnFcltNm,
); pbnstRuseFcltId: item.pbnstRuseFcltId,
if (findData) { };
return { });
sido: findData?.sido || '-', return data;
gugun: findData?.gugun || '-',
bscFctNm: findData?.bscFctNm || '-',
ruseUtztnFcltNm: item?.ruseUtztnFcltNm || '-',
pbnstRuseFcltId: item?.pbnstRuseFcltId || '-',
bscFctCd: findData?.bscFctCd || '-',
prfList: item.prfList,
}
}
}
).filter(Boolean);
return {data: data, count: getRuseList.count};
} }
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = ( export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
set: any set: any
) => { ) => {
return { return {
getFlctsSttn: async () => {
const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc')
return set((state: pbnstPrfmncSttnState) => ({
pbnstPrfmncSttn: {
...state.pbnstPrfmncSttn,
fclts: fclts
},
}));
},
tableHeadMaker: (startYear: number, endYear: number) => { tableHeadMaker: (startYear: number, endYear: number) => {
let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport]; let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport];
const selectList = [] as unknown as selectLabel[] const selectList = [] as unknown as selectLabel[]
@@ -146,7 +79,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
if (yearHead) { if (yearHead) {
yearHead.forEach((item: { id?: string; }) => { yearHead.forEach((item: { id?: string; }) => {
if (item.id) { if (item.id) {
if (item.id === "year") { item.id = ""; return; } if(item.id === "year") {item.id = ""; return;}
item.id = i + item.id; item.id = i + item.id;
} }
}) })
@@ -167,132 +100,117 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
}; };
}); });
}, },
// pbnstPrfmncInit: async (page: string, sggOrCity: string) => { pbnstPrfmncInit: async (page: string, sggOrCity: string) => {
// try {
// const prfmncRes = await hasuListFetch(page, sggOrCity);
// return set((state: pbnstPrfmncSttnState) => ({
// ...state,
// pbnstPrfmncSttn: {
// ...state.pbnstPrfmncSttn,
// prfmncRes: prfmncRes,
// isInit: true,
// },
// }));
// } catch (e) {
// console.log(e)
// }
// },
pbnstPrfmncSearch: async (page: number, returnType: ReturnType, fcltNm: string, fromDate: string, toDate: string, fclts: string[]) => {
try { try {
const prfmncRes = await hasuListFetch( const prfmncRes = await hasuListFetch(page, sggOrCity);
page,
returnType,
fcltNm,
fromDate,
toDate,
fclts);
let inUsageSum = 0;
let outUsageSum = 0;
let year = "";
const yearsData = [] as any
prfmncRes.data.forEach((item: any) => {
if (!item.prfList || item.prfList.length === 0) {
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
yearVal[`${year}inUsage`] = 0;
yearVal[`${year}outUsage`] = 0;
yearVal[`${year}total`] = 0;
yearsData.push(yearVal);
}
item.prfList?.forEach((acc: any) => {
year = acc.ym?.substring(0, 4) ?? "";
inUsageSum =
(acc.wshwtr ?? 0) + //조경용수
(acc.coolUswtr ?? 0) + //냉각수
(acc.cleanUswtr ?? 0) + //청소수
(acc.drwtUswtr ?? 0) + //식수대
(acc.dltnUswtr ?? 0) + //희석용수
(acc.ithlRswtr ?? 0) + //중수도
(acc.ithlEtcUswtr ?? 0) //기타
outUsageSum =
(acc.cleanToilUswtr ?? 0) + //청소화장실용수
(acc.resn ?? 0) + //세척살수용도
(acc.lndwtr ?? 0) + //조경용수
(acc.hydUswtr ?? 0) + //친수용수
(acc.ugwtChr ?? 0) + //지하수충전
(acc.farmUswtr ?? 0) + //농업용수
(acc.rvrKeepUswtr ?? 0) + //하천등유지용수
(acc.indstUswtr ?? 0); //공업용수
const yearData = yearsData.find(
(yearItem) =>
yearItem.year === year &&
yearItem.pbnstRuseFcltId == acc.pbnstRuseFcltId
);
if (yearData) {
yearData[`${year}inUsage`] += inUsageSum;
yearData[`${year}outUsage`] += outUsageSum;
yearData[`${year}total`] += (inUsageSum + outUsageSum);
} else {
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: acc.pbnstRuseFcltId, ruseUtztnFcltNm: item.ruseUtztnFcltNm ?? "" };
yearVal[`${year}inUsage`] = inUsageSum;
yearVal[`${year}outUsage`] = outUsageSum;
yearVal[`${year}total`] = inUsageSum + outUsageSum;
yearsData.push(yearVal);
}
});
});
// 연도 필터링
const from = Number(fromDate);
const to = Number(toDate);
// 연도별 실적을 시설별로 병합
const mergedMap: { [key: string]: any } = {};
yearsData.forEach((acc) => {
const facilityId = acc.pbnstRuseFcltId;
const year = acc.year;
// 연도 필터 범위 안에만 포함
if (!year || Number(year) < from || Number(year) > to) return;
if (!mergedMap[facilityId]) {
mergedMap[facilityId] = {
pbnstRuseFcltId: facilityId,
ruseUtztnFcltNm: acc.ruseUtztnFcltNm,
};
}
// 해당 연도 데이터 추가
mergedMap[facilityId][`${year}inUsage`] = acc[`${year}inUsage`] ?? 0;
mergedMap[facilityId][`${year}outUsage`] = acc[`${year}outUsage`] ?? 0;
mergedMap[facilityId][`${year}total`] = acc[`${year}total`] ?? 0;
});
// prfmncRes 정보 merge
const resData = Object.values(mergedMap).map((item: any) => {
const match = prfmncRes.data.find((res) => res.pbnstRuseFcltId === item.pbnstRuseFcltId);
return match ? { ...item, ...match } : item;
});
return set((state: pbnstPrfmncSttnState) => ({ return set((state: pbnstPrfmncSttnState) => ({
...state, ...state,
pbnstPrfmncSttn: { pbnstPrfmncSttn: {
...state.pbnstPrfmncSttn, ...state.pbnstPrfmncSttn,
// prfmncRes: prfmncRes, prfmncRes: prfmncRes,
prfmncResCount: prfmncRes.count, isInit: true,
isInit: false,
prfmncRes: resData,
rawData: prfmncRes.data
}, },
})); }));
} catch (errorHasu) { } catch (e) {
console.log(errorHasu); console.log(e)
} }
}, },
pbnstPrfmncSearch: async (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => {
let searchUrl = "";
if (returnType.sigunValue !== "0") {
if (swtrmtFcltNm !== "") {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW${'/' + swtrmtFcltNm}`;
} else {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW`;
}
} else {
if (swtrmtFcltNm !== "") {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW${'/' + swtrmtFcltNm}`;
} else {
searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sidoValue}/0/1/SW`;
}
}
const pbnstRes = await getFetch(
fetchType.COMMON,
searchUrl
);
const bscFctCdList = pbnstRes.map((item: any) => {
return item.bscFctCd;
})
const res = await postFectch(
`/reuseFc/pubDetailList/${fromDate}/${toDate}`,
bscFctCdList,
`wr`,
)
let inUsageSum = 0;
let outUsageSum = 0;
let year = "";
const yearsData = [] as any
res.data.forEach((item : any) => {
if (item.prfList.length === 0) {
const year: string = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출.
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: item.pbnstRuseFcltId ?? "", ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
yearVal[`${year}inUsage`] = 0;
yearVal[`${year}outUsage`] = 0;
yearVal[`${year}total`] = 0;
yearsData.push(yearVal);
}
item.prfList.forEach((acc) => {
year = acc.ym?.substring(0, 4) ?? "";
inUsageSum =
(acc.wshwtr ?? 0) + //조경용수
(acc.coolUswtr ?? 0) + //냉각수
(acc.cleanUswtr ?? 0) + //청소수
(acc.drwtUswtr ?? 0) + //식수대
(acc.dltnUswtr ?? 0) + //희석용수
(acc.ithlRswtr ?? 0) + //중수도
(acc.ithlEtcUswtr ?? 0) //기타
outUsageSum =
(acc.cleanToilUswtr ?? 0) + //청소화장실용수
(acc.resn ?? 0)+ //세척살수용도
(acc.lndwtr ?? 0) + //조경용수
(acc.hydUswtr ?? 0) + //친수용수
(acc.ugwtChr ?? 0) + //지하수충전
(acc.farmUswtr ?? 0) + //농업용수
(acc.rvrKeepUswtr ?? 0) + //하천등유지용수
(acc.indstUswtr ?? 0); //공업용수
const yearData = yearsData.find(
(yearItem) =>
yearItem.year === year &&
yearItem.pbnstRuseFcltId == acc.pbnstRuseFcltId
);
if (yearData) {
yearData[`${year}inUsage`] += inUsageSum;
yearData[`${year}outUsage`] += outUsageSum;
yearData[`${year}total`] += (inUsageSum + outUsageSum);
} else {
const yearVal: { [key: string]: any } = { year: year, pbnstRuseFcltId: acc.pbnstRuseFcltId, ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" };
yearVal[`${year}inUsage`] = inUsageSum;
yearVal[`${year}outUsage`] = outUsageSum;
yearVal[`${year}total`] = inUsageSum + outUsageSum;
yearsData.push(yearVal);
}
});
});
const resData: any[] = []
pbnstRes.forEach((acc) => {
const data = yearsData.find((item) => item.pbnstRuseFcltId.substring(0, 11) === acc.bscFctCd)
if (data) {
resData.push({ ...acc, ...data })
}
})
return set((state: pbnstPrfmncSttnState) => ({
...state,
pbnstPrfmncSttn: {
...state.pbnstPrfmncSttn,
prfmncRes: resData,
rawData: res.data
},
}));
}
} }
} }
@@ -95,59 +95,43 @@ const hasuListFetch = async (
year: string, year: string,
flcts: string[] flcts: string[]
) => { ) => {
let url = ``; let url = `/prcsFclt/ruseInfo/`;
let filteredFclt = flcts;
const filterData = reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
if(filterData !== '0')
filteredFclt= flcts.filter((fclt: string) => {
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
})
if (reurnValue.partValue === "A") { if (reurnValue.partValue === "A") {
url += `${reurnValue.partValue}/${ url += `${page}/${total}/${reurnValue.partValue}/${
// reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue // reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
}/0/1/SW` }/0/1/SW`
if(filterData !== '0')
filteredFclt= flcts.filter((fclt: string) => {
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
})
} else if (reurnValue.partValue === "R") { } else if (reurnValue.partValue === "R") {
url += `${reurnValue.partValue}/${reurnValue.regionValue url += `${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue
? reurnValue.regionValue ? reurnValue.regionValue
: reurnValue.unitWaterShedValue : reurnValue.unitWaterShedValue
? reurnValue.unitWaterShedValue ? reurnValue.unitWaterShedValue
: reurnValue.middleRegionValue : reurnValue.middleRegionValue
}/0/1/SW` }/0/1/SW`
} else if (reurnValue.partValue === 'G') { } else if (reurnValue.partValue === 'G') {
url += `${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
if(filterData !== '0')
filteredFclt= flcts.filter((fclt: string) => { url += `${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue}/0/1/SW`
return filterData.length==2 ?fclt.slice(0, 2) === filterData:fclt.slice(0, 5) === filterData
})
} else { } else {
url += `A/0/0/1/SW` url += `1/2/A/0/0/1/SW`
} }
if (searchNm && searchNm?.length > 0) { if (searchNm && searchNm?.length > 0) {
url += "/" + searchNm url += "/" + searchNm
} }
const pbnList = await postFectch( `/prcsFclt/ruseInfo/1/${filteredFclt.length}/`+url, filteredFclt, fetchType.COMMON); const pbnList = await postFectch(url, flcts, fetchType.COMMON);
const checkRuseFcltList = searchNm && searchNm?.length > 0?pbnList.data.map((item)=> item.bscFctCd ):filteredFclt
const getRuseList = await postFectch( const getRuseList = await postFectch(
`/reuseFc/pubDetailList/${year}/${filterData}/${page}/${total}`, `/reuseFc/pubDetailList/${year}`,
checkRuseFcltList, flcts,
fetchType.WR fetchType.WR
); );
const checkWrRegListRes = getRuseList.data; const checkWrRegListRes = getRuseList.data;
const data: WaterReuseFacility[] = checkWrRegListRes.map( const data: WaterReuseFacility[] = checkWrRegListRes.map(
(item: FcPrfType) => { (item: FcPrfType) => {
const findData = pbnList.data.find( const findData = pbnList.data.find(
@@ -156,6 +140,7 @@ const hasuListFetch = async (
); );
if (findData) { if (findData) {
const usage = item.prfList.reduce( const usage = item.prfList.reduce(
(acc, cur) => { (acc, cur) => {
acc.inUsage += acc.inUsage +=
@@ -212,11 +197,7 @@ const hasuListFetch = async (
} }
).filter(Boolean); ).filter(Boolean);
return data;
return {data:data, count:getRuseList.count};
}; };
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
@@ -225,7 +206,6 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
return { return {
getFlcts: async () => { getFlcts: async () => {
const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc') const fclts = await getFetch(fetchType.WR, '/reuseFc/pubFc')
return set((state: pbnstSttnState) => ({ return set((state: pbnstSttnState) => ({
pbnstSttn: { pbnstSttn: {
...state.pbnstSttn, ...state.pbnstSttn,
@@ -257,6 +237,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
) => { ) => {
try { try {
const pbnstSttnRes = await hasuListFetch( const pbnstSttnRes = await hasuListFetch(
page, page,
total, total,
@@ -268,7 +249,7 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
// if (Number(total) > 9000) { // if (Number(total) > 9000) {
if (isExcel) { if (isExcel) {
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes.data); const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
set((state: pbnstSttnState) => { set((state: pbnstSttnState) => {
return { return {
...state, ...state,
@@ -285,8 +266,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
...state, ...state,
pbnstSttn: { pbnstSttn: {
...state.pbnstSttn, ...state.pbnstSttn,
pbnstSttnRes: pbnstSttnRes.data, pbnstSttnRes: pbnstSttnRes,
pbnstSttnResCount: pbnstSttnRes.count pbnstSttnResCount: pbnstSttnRes.length
// isInit: false, // isInit: false,
}, },
}; };
@@ -312,15 +293,13 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
year, year,
fclts fclts
); );
set((state: pbnstSttnState) => { set((state: pbnstSttnState) => {
return { return {
...state, ...state,
pbnstSttn: { pbnstSttn: {
...state.pbnstSttn, ...state.pbnstSttn,
pbnstSttnRes: pbnstSttnRes.data, pbnstSttnRes: pbnstSttnRes,
pbnstSttnResCount: pbnstSttnRes.count, pbnstSttnResCount: pbnstSttnRes.length,
isInit: false, isInit: false,
pbnstDetail: {} as customPbnst pbnstDetail: {} as customPbnst
}, },
@@ -384,8 +363,8 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
...state, ...state,
pbnstSttn: { pbnstSttn: {
...state.pbnstSttn, ...state.pbnstSttn,
pbnstSearchData: pbnstSttnRes.data, pbnstSearchData: pbnstSttnRes,
pbnstSttnResCount: pbnstSttnRes.count, pbnstSttnResCount: pbnstSttnRes.length,
}, },
}; };
}); });
+2 -2
View File
@@ -3,7 +3,7 @@ import {
SERVER_API_CS_TUS_URL, SERVER_API_CS_TUS_URL,
SERVER_API_CS_URL, SERVER_API_CS_URL,
SERVER_API_FO_URL, SERVER_API_FO_URL,
SERVER_API_WR_URL, SERVER_API_URL,
} from "@/src/shared/config"; } from "@/src/shared/config";
//const DEV_PORT = "11080"; //const DEV_PORT = "11080";
@@ -17,7 +17,7 @@ import {
//export const CS_TUS_UPLOAD= "/attach-service/api/v1/tus/upload"; //export const CS_TUS_UPLOAD= "/attach-service/api/v1/tus/upload";
export const LOCAL_URL_WR = PROXY_HOST + `/api/v1`; export const LOCAL_URL_WR = PROXY_HOST + `/api/v1`;
export const DEV_URL_WR = SERVER_API_WR_URL; export const DEV_URL_WR = SERVER_API_URL;
export const DEV_URL_FO = SERVER_API_FO_URL; export const DEV_URL_FO = SERVER_API_FO_URL;
export const LOCAL_URL = PROXY_HOST; export const LOCAL_URL = PROXY_HOST;
export const CS_URL = SERVER_API_CS_URL; export const CS_URL = SERVER_API_CS_URL;
@@ -156,10 +156,6 @@ export default function ConCostForm({
toast.error("공사비 계산 진행 후 저장을 눌러주새요"); toast.error("공사비 계산 진행 후 저장을 눌러주새요");
return; return;
} }
const splycd = form.getValues("splyCndtList")
const pk = splycd&&splycd[0]?.ruseUtztnFcltCd?splycd[0]?.ruseUtztnFcltCd:'11000SW001R1'
if (type === "mat") { if (type === "mat") {
if (value.demandCst) { if (value.demandCst) {
const data: DedMatUpdateType = { const data: DedMatUpdateType = {
@@ -182,9 +178,8 @@ export default function ConCostForm({
size="sm" size="sm"
onClick={() => { onClick={() => {
toast.dismiss(t.id); toast.dismiss(t.id);
coMatRvwUpdate( coMatRvwUpdate(
pk, "11000SW001R1",
form.getValues("dmdInfoId"), form.getValues("dmdInfoId"),
data data
); );
@@ -199,15 +194,12 @@ export default function ConCostForm({
</span> </span>
)); ));
} else { } else {
coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoId"), data);
coMatRvwUpdate(pk, form.getValues("dmdInfoId"), data);
} }
} }
} else if (type === "hist") { } else if (type === "hist") {
delete value.totalConstCost; delete value.totalConstCost;
delete value.ruseUtztnFcltNm; delete value.ruseUtztnFcltNm;
console.log("onSubmit data ", pk);
ruseRvwCalUpdate(value); ruseRvwCalUpdate(value);
} }
}; };
@@ -488,6 +488,16 @@ export function PbnstBuseForm({
/> />
</div> </div>
{/* <MngRegFormDetail
formList={ruseWaterQulityList}
h1Title={`하수처리수 재이용시설 보증수질 `}
subTitle="※재처리시설이 있는 경우만 작성"
form={form}
moClass="grid grid-cols-12 gap-4"
sonClass="col-span-4"
indexMng={indexMng}
indexBiz={indexBiz}
/> */}
<div> <div>
<BuseWaterQulity <BuseWaterQulity
@@ -48,10 +48,10 @@ export default function CoDetailModal({
return ( return (
<div> <div>
<ScrollArea className="h-[85vh] mx-8"> <ScrollArea className="h-[85vh]">
<Form {...form}> <Form {...form}>
<form onSubmit={form.handleSubmit(onFormSubmit)}> <form onSubmit={form.handleSubmit(onFormSubmit)}>
<div className="grid grid-cols-12 items-center card-header"> <div className="grid grid-cols-12 flex items-center card-header">
<h1 className="text-2xl font-medium text-label col-span-10"> <h1 className="text-2xl font-medium text-label col-span-10">
잠재수요처 상세정보 잠재수요처 상세정보
</h1> </h1>
@@ -17,6 +17,7 @@ export class LoginApiService implements LoginService {
public async login(payload: ILogin): Promise<void> { public async login(payload: ILogin): Promise<void> {
try { try {
console.log(' ENDPOINT.USER_SERVICE.LOGIN ', ENDPOINT.USER_SERVICE.LOGIN)
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, { const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
+1 -1
View File
@@ -1,7 +1,7 @@
export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "WR"; export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "WR";
export const PORT = process.env.NEXT_PUBLIC_PORT || "3001"; export const PORT = process.env.NEXT_PUBLIC_PORT || "3001";
export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`;
export const SERVER_API_WR_URL = process.env.NEXT_PUBLIC_WR_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1'; export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL ||'http://con.mind-one.co.kr:11080/api/v1';
export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1'; export const SERVER_API_FO_URL = process.env.NEXT_PUBLIC_FO_SERVER_API_URL||' http://con.mind-one.co.kr:11082/api/v1';
export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000'; export const SERVER_API_CS_URL = process.env.NEXT_PUBLIC_CS_SERVER_API_URL||'http://dev.onasys.co.kr:8000';
export const SERVER_API_CS_TUS_URL = process.env.NEXT_PUBLIC_CS_TUS_UPLOAD ||'/attach-service/api/v1/tus/upload' export const SERVER_API_CS_TUS_URL = process.env.NEXT_PUBLIC_CS_TUS_UPLOAD ||'/attach-service/api/v1/tus/upload'
@@ -19,6 +19,7 @@ type MonthPickerProps = {
readOnly?: boolean; readOnly?: boolean;
startYear?: number; // 시작 연도 props 추가 startYear?: number; // 시작 연도 props 추가
yearReadOnly?: boolean; yearReadOnly?: boolean;
enableMonth?: string[];
}; };
// yyyyMM → Date 객체 // yyyyMM → Date 객체
@@ -41,6 +42,7 @@ export const DateMonthPicker = ({
readOnly = false, readOnly = false,
startYear, startYear,
yearReadOnly = false, yearReadOnly = false,
enableMonth,
}: MonthPickerProps) => { }: MonthPickerProps) => {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@@ -81,6 +83,7 @@ export const DateMonthPicker = ({
onMonthChange={handleSelect} onMonthChange={handleSelect}
startYear={startYear} startYear={startYear}
yearReadOnly={yearReadOnly} yearReadOnly={yearReadOnly}
enableMonth={enableMonth}
/> />
</PopoverContent> </PopoverContent>
</Popover> </Popover>
@@ -30,9 +30,10 @@ export type MonthPickerProps = {
) => void; ) => void;
startYear?: number; startYear?: number;
yearReadOnly?: boolean; yearReadOnly?: boolean;
enableMonth?: string[];
}; };
export function MonthPicker({ currentMonth, onMonthChange, startYear, yearReadOnly }: MonthPickerProps) { export function MonthPicker({ currentMonth, onMonthChange, startYear, yearReadOnly, enableMonth }: MonthPickerProps) {
const today = startOfToday(); const today = startOfToday();
const currentYear = today.getFullYear(); const currentYear = today.getFullYear();
@@ -61,9 +62,9 @@ const selectedYear = parseInt(yearFromProp);
"inline-flex h-9 w-16 items-center justify-center rounded-md p-0 text-sm font-normal ring-offset-white transition-colors hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-selected:opacity-100 dark:ring-offset-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:focus-visible:ring-slate-800", "inline-flex h-9 w-16 items-center justify-center rounded-md p-0 text-sm font-normal ring-offset-white transition-colors hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-selected:opacity-100 dark:ring-offset-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:focus-visible:ring-slate-800",
isEqual(month, currentMonth) && isEqual(month, currentMonth) &&
"bg-slate-900 text-slate-50 hover:bg-slate-900 hover:text-slate-50 focus:bg-slate-900 focus:text-slate-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50 dark:hover:text-slate-900 dark:focus:bg-slate-50 dark:focus:text-slate-900", "bg-slate-900 text-slate-50 hover:bg-slate-900 hover:text-slate-50 focus:bg-slate-900 focus:text-slate-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50 dark:hover:text-slate-900 dark:focus:bg-slate-50 dark:focus:text-slate-900",
!isEqual(month, currentMonth) && // !isEqual(month, currentMonth) &&
isEqual(month, getStartOfCurrentMonth()) && // isEqual(month, getStartOfCurrentMonth()) &&
"bg-slate-100 text-slate-900 dark:bg-slate-800 dark:text-slate-50" // "bg-slate-100 text-slate-900 dark:bg-slate-800 dark:text-slate-50"
); );
return ( return (
@@ -113,7 +114,7 @@ const selectedYear = parseInt(yearFromProp);
<button <button
name="month" name="month"
className={getMonthButtonClass(month)} className={getMonthButtonClass(month)}
disabled={isFuture(month)} disabled={isFuture(month) || (enableMonth && !enableMonth?.includes(format(month, 'MMM', { locale: ko })))}
role="gridcell" role="gridcell"
tabIndex={-1} tabIndex={-1}
type="button" type="button"
@@ -1,5 +1,6 @@
import { Search } from 'lucide-react'; import { Search } from 'lucide-react';
import OlMap from 'ol/Map'; import OlMap from 'ol/Map';
import Overlay from 'ol/Overlay';
import View from 'ol/View'; import View from 'ol/View';
import { defaults as defaultControls, OverviewMap } from 'ol/control'; import { defaults as defaultControls, OverviewMap } from 'ol/control';
import { defaults } from 'ol/interaction'; import { defaults } from 'ol/interaction';
@@ -7,12 +8,15 @@ import * as olProj from 'ol/proj';
import { register } from 'ol/proj/proj4'; import { register } from 'ol/proj/proj4';
import proj4 from 'proj4'; import proj4 from 'proj4';
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { createRoot } from 'react-dom/client';
import GisLonLat from './GisLonLat';
import GisMapToggle from './GisMapToggle'; import GisMapToggle from './GisMapToggle';
import GisSelect from './GisSelect'; import GisSelect from './GisSelect';
import GisToolBar from './GisToolBar'; import GisToolBar from './GisToolBar';
import GisTree from './GisTree'; import GisTree from './GisTree';
import './lib/css/gis.common.css'; import './lib/css/gis.common.css';
import GisApp from './lib/gis.core'; import GisApp from './lib/gis.core';
// import FacilityInfoPopup from './FacilityInfoPopup';
export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null });
export const useGisContext = () => useContext(GisContext); export const useGisContext = () => useContext(GisContext);
@@ -83,8 +87,9 @@ export const searchUpperPpls = async (fcltMngNo) => {
} }
}; };
function Gis({ function Gis({
isOpen, //우측 상세 레이어 팝업 isOpen,
gisMaps, gisMaps,
isSearchModalOpen, isSearchModalOpen,
treeData = [], treeData = [],
@@ -98,7 +103,7 @@ function Gis({
detailView: DetailView, detailView: DetailView,
onFeatureSelect, onFeatureSelect,
setIsSearchModalOpen, setIsSearchModalOpen,
onCheckedLayersChange, onCheckedLayersChange
}) { }) {
const mapRef = useRef(); const mapRef = useRef();
const [mapObject, setMapObject] = useState({}); const [mapObject, setMapObject] = useState({});
@@ -127,7 +132,90 @@ function Gis({
// Feature Click Event // Feature Click Event
const handleFeatureSelect = useCallback((data) => { const handleFeatureSelect = useCallback((data) => {
console.log(data); gisMap = mapInstanceRef.current;
if (!gisMap) {
console.warn('지도가 초기화되지 않았습니다.');
return;
}
// 항상 같은 select 객체 사용
const select = GisApp.Module.select;
if (!select) return;
// 1. 기존 선택 초기화
select.resetSelectedFeature();
// 2. data가 OpenLayers Feature 인스턴스인지 확인
let foundFeature = null;
if (data && typeof data.getGeometry === 'function' && typeof data.setStyle === 'function') {
// 이미 Feature 인스턴스라면 그대로 사용
foundFeature = data;
} else {
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
let featureId = data.fid;
const layerName = layerNmRef.current
if (layerName === '하수재이용시설') {
featureId = data.searchPk;
} else if (layerName === '빗물이용시설' || layerName == '중수도시설') {
featureId = data.bdstInfoSn;
} else if (layerName === '하수처리시설') {
featureId = data.bscFctCd;
} else if (layerName === '온배수시설') {
featureId = data.bdstRuseFcltSn;
} else if(layerName == '수요처'){
featureId = data.dmdInfoId.replaceAll('-','')
}
else {
console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm);
featureId = data.fid || data.id || data.ftrIdn;
}
// gisMap.getLayers().getArray().forEach(layer => {
// const source = layer.getSource?.();
// if (source?.getFeatureById) {
// const feature = source.getFeatureById(String(featureId).trim());
// if (feature) foundFeature = feature;
// }
// });
// const [layerType, id] = String(featureId).split('.');
gisMap.getLayers().getArray().forEach(layer => {
const source = layer.getSource?.();
if (source?.getFeatures) {
const allFeatures = source.getFeatures();
for (const f of allFeatures) {
const id = String(f.getId());
// console.log('id', id, featureId)
if (id && id.split('.')[1] === String(featureId)) {
foundFeature = f;
break;
}
}
}
});
}
// 3. 피처 선택
if (foundFeature) {
let geometry = foundFeature.getGeometry();
if (geometry) {
let extent = geometry.getExtent();
gisMap.getView().fit(extent, {
duration: 300,
padding: [50, 50, 50, 50],
maxZoom: 16,
constrainResolution: true,
nearest: true,
});
}
select.selectFeature(foundFeature, true);
} else {
console.warn('OpenLayers Feature를 찾을 수 없습니다:', data);
}
setFeatureData(data);
setIsOpen(true);
setIsSearchModalOpen(false);
onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출 onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출
}, [mapInstanceRef]); }, [mapInstanceRef]);
@@ -194,7 +282,6 @@ function Gis({
gisCore.changeBaseLayer('base'); gisCore.changeBaseLayer('base');
setMapObject({ map: map }); setMapObject({ map: map });
mapInstanceRef.current = map; // 생성 완료 플래그 설정 mapInstanceRef.current = map; // 생성 완료 플래그 설정
}, []); }, []);
// treeData 변경 시 레이어 코드 생성 // treeData 변경 시 레이어 코드 생성
@@ -211,7 +298,7 @@ function Gis({
//setTreeData(data); //setTreeData(data);
// 편집 가능한 레이어 목록 생성 // 편집 가능한 레이어 목록 생성
//const layerItems = getLayerItems(layerCode); const layerItems = getLayerItems(layerCode);
//setEditLayerItems(prev => [...layerItems]) //setEditLayerItems(prev => [...layerItems])
}, [treeData]); }, [treeData]);
@@ -360,7 +447,7 @@ function Gis({
setCheckedLayers(checkedIds); setCheckedLayers(checkedIds);
setCheckedLayersData(checkedNodesData); setCheckedLayersData(checkedNodesData);
onCheckedLayersChange?.(checkedIds, checkedNodesData); onCheckedLayersChange?.(checkedIds, checkedNodesData);
}, 1000); }, 0);
}, [onCheckedLayersChange]); }, [onCheckedLayersChange]);
return ( return (
@@ -372,10 +459,9 @@ function Gis({
visible={tabVisible} visible={tabVisible}
setVisible={setTabVisible} setVisible={setTabVisible}
onCheckedChange={handleCheckedLayersChange} onCheckedChange={handleCheckedLayersChange}
onLayerIconClick={(layerNm) => { onLayerIconClick={(nodeNm) => {
console.log(layerNm) layerNmRef.current = nodeNm
layerNmRef.current = layerNm setLayerNm(nodeNm); setIsOpen(true); const dummyFeature = {
setLayerNm(layerNm); setIsOpen(true); const dummyFeature = {
getProperties: () => ({}), // 최소 구조 getProperties: () => ({}), // 최소 구조
}; };
onFeatureSelect(dummyFeature); onFeatureSelect(dummyFeature);

Some files were not shown because too many files have changed in this diff Show More