Compare commits

..
Author SHA1 Message Date
rsone001 ba2ccf6f97 feat: 입력 > 02. 하수관로 시설별 설치 현황관리 버튼 추가
- tab 6. 시설별 현황 관리 탭에서만 필요한 버튼
2026-02-19 10:21:26 +09:00
chanii8 0149f489a7 Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-19 09:34:30 +09:00
chanii8 b644281348 [st] feat: 검증 항목 상세 다이얼로그 작업 2026-02-13 14:57:20 +09:00
chanii8 1572711749 [common/components] feat: Header 컴포넌트 중앙 네비게이션 ScrollArea 적용 2026-02-13 14:16:18 +09:00
chanii8 93d4cb57e6 Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-12 17:00:45 +09:00
chanii8 a256379633 [st] feat: 검증 항목 관리 페이지 작업 2026-02-12 16:54:07 +09:00
rsone001 2873d1b0b9 st: fix & refactor: TabDataGrid에서 텝 전환시 컬럼 포맷 및 footer 사라지는 오류 수정, 통계 검토 - 하수 관로 검색 로직 추가 2026-02-12 16:40:03 +09:00
rsone001 12bed29eb9 fix: any type수정중 2026-02-12 13:42:17 +09:00
rsone001 6817d34bc3 Merge remote-tracking branch 'origin/feature/review-skeleton-sein' into iipbs/st/dev 2026-02-12 11:20:26 +09:00
rsone001 efbef8283b feat: 02.하수관로 tab2 시설별 시설현황 컬럼 매칭 2026-02-12 11:10:46 +09:00
rsone001 af7c2a4f6f Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-12 10:50:13 +09:00
rsone001 60c515a654 st: fix & refactor: 하수도 보급률 입력 조회 response 수정 및 TadaGrid 컴포넌트 Tab state 부모 컴포넌트에서 prop로 전달하도록 수정, grid 데이터를 가져오기 위한 ref prop 수정(TabDataGrid.tsx는 아직 미구현) 2026-02-12 10:50:07 +09:00
chanii8 78e3e8e20e [st] design: 디자인 수정 2026-02-12 10:22:35 +09:00
chanii8 3b23113955 [st] chore: 검증 항목 관리 테이블 컬럼 수정 2026-02-11 15:45:51 +09:00
chanii8 fbe355f6cf [st] feat: DataGrid 컴포넌트에 행 클릭 이벤트 설정 2026-02-11 15:45:38 +09:00
chanii8 c439d3e58a [st] feat: 검증 항목 관리 레이아웃 작업 2026-02-11 15:42:01 +09:00
chanii8 057175b65c [st] rename: 파일명 변경 2026-02-11 15:41:49 +09:00
chanii8 794fdc482f Merge branch 'feature/review-skeleton-sein' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-11 15:40:06 +09:00
dongsilove 28d7a1bd29 Merge branch 'iipbs/sn/dev' 2026-02-10 23:08:10 +09:00
dongsilove 8d5546abd5 fo: 처리구역 exceldown 수정 2026-02-10 22:55:58 +09:00
dongsilove e264159323 fo: 수질현황 팝업 exceldown 수정 2026-02-10 22:41:56 +09:00
dongsilove 7650ec30e8 fo: dashboard 수정 2026-02-10 20:30:41 +09:00
mind-one005 c8912357b2 fo: exceldowntl , 추가 - 표로보기 2026-02-10 18:02:47 +09:00
rsone001 e79590b70d refactor: service 통합,인터페이스 네이밍 수정 2026-02-10 17:15:41 +09:00
rsone001 6904144ef8 refactor: 로딩기능 ,시도 선택, response 응답수정 2026-02-10 17:14:46 +09:00
rsone001 be2dcdc6f0 feat: 02.하수관로 tab1지역별 시설현황 조회 기능 추가 2026-02-10 17:08:05 +09:00
rsone001 636af7b14d refactor: 구분컬럼 변경rgnNm-> displayYear 2026-02-10 17:04:52 +09:00
mind-one005 a7d7ffb767 wr: chRowspanTable 수정 2026-02-10 13:49:48 +09:00
mind-one005 e376fc7373 Merge branch 'iipbs/sn/dev' 2026-02-10 10:48:50 +09:00
rsone001 0f7e8c1de3 feat: 02 하수관로 tab1 지역별 시설현황 조회 기능 추가
footer 추가 구현 필요
2026-02-10 10:16:56 +09:00
mind-one005 c581698591 fo: 공법 추가 2026-02-10 10:13:32 +09:00
dongsilove aacf652dac fo: 처리시설 팝업 수정 2026-02-09 23:14:23 +09:00
dongsilove 3787f824df fo: exceldown시 , 추가 2026-02-09 22:38:10 +09:00
dongsilove 8d481aab09 fo: 처리시설 시설정보 2026-02-09 21:40:02 +09:00
mind-one005 21dd8f47a1 wr: 지도점검결과 등록 화면 운영관리코드명으로 보이도록 2026-02-09 18:18:11 +09:00
rsone001 0b14d1c0b5 Merge remote-tracking branch 'origin/iipbs/st/dev' into feature/review-skeleton-sein 2026-02-09 16:19:09 +09:00
rsone001 226c61eee9 st: fix: setFields 호출 직후 행 데이터 적용하도록 수정 2026-02-09 10:49:28 +09:00
rsone001 8d1af396ec Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-09 10:11:30 +09:00
rsone001 89df17aaeb st: fix: excel import & export 시 데이터 필드명을 맞추기위한 로직 수정 2026-02-09 10:11:23 +09:00
rsone001 e762720a01 feat: 00.통계입력현황 데이터 매핑 기능 및 api연동 2026-02-06 12:32:18 +09:00
chanii8 3b8fd2129b Merge branch 'iipbs/cs/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend 2026-02-06 11:27:40 +09:00
chanii8 8565331e68 [cs] feat: 다이얼로그 닫힐 때 폼 및 쿼리 로직 초기화 2026-02-06 11:26:40 +09:00
rsone001 d0faa58f3c Merge remote-tracking branch 'origin/iipbs/st/dev' into feature/review-skeleton-sein 2026-02-05 15:26:13 +09:00
rsone001 064898333c feat: 00.통계입력현황 컬럼매칭 수정중 2026-02-05 15:24:37 +09:00
chanii8 94f8e53184 Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-05 15:15:14 +09:00
chanii8 d08df3ff35 [st] feat: 검증 이력 그리드 목데이터 작업 2026-02-05 15:14:54 +09:00
rsone001 4b0b08761c st: 검토 메뉴 grid footer 수정 및 누락 부분 추가 2026-02-05 14:47:47 +09:00
mind-one005 610d3d1c38 Merge branch 'iipbs/sn/dev' 2026-02-05 13:19:47 +09:00
rsone001 56d47ca1d0 Merge remote-tracking branch 'origin/feature/review-skeleton-sein' into iipbs/st/dev 2026-02-05 11:06:20 +09:00
rsone001 0e90277e90 st: fix: 입력-하수도보급률 컬럼 정보 수정 2026-02-05 11:04:25 +09:00
rsone001 18413509fc Merge remote-tracking branch 'origin/iipbs/st/dev' into feature/review-skeleton-sein 2026-02-05 10:50:15 +09:00
rsone001 cfddd6c0ae commit 2026-02-05 10:44:48 +09:00
rsone001 d861cfa811 feat: 01.하수도 보급률 컬럼 매칭 및 footer 수정중 2026-02-05 10:44:23 +09:00
chanii8 f88d42493c Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2026-02-05 10:02:39 +09:00
jcchoi 0459bcd4fd Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend 2026-02-04 19:42:57 +09:00
rsone001 eca74c1f2e st: refactor: 연도 & 전년도 데이터 가져오기 & 그리드 내 데이터 editable 판별 로직 수정 2026-02-04 17:54:02 +09:00
rsone001 42d6010efa st: refactor: 시도 및 검색연도 로직 수정
feat: 하수도보급률 전년도 데이터 가져오기 기능 추가 및 데이터 조회 시 입력 기한에 맞춰 그리드 셀 수정 or 수정 불가 로직 추가
2026-02-04 15:21:38 +09:00
mind-one005 206cd10844 sn: 하수관망도 팝업-기본정보 항목 추가 2026-02-04 13:50:45 +09:00
rsone001 ded46a7b6d Merge remote-tracking branch 'origin/iipbs/st/dev' into feature/review-skeleton-sein 2026-02-04 13:23:40 +09:00
chanii8 7227b98961 [cs] feat: 대시보드 페이지 일정 패널 작업 2026-02-04 09:34:50 +09:00
rsone001 6f07aca860 st: refactor: 시군구 검색 시 bsnmCd도 가져오도록 수정 2026-02-03 18:01:16 +09:00
chanii8 912e335b27 [cs] feat: 대시보드 페이지 실시간 알림 패널 작업 2026-02-03 17:48:15 +09:00
chanii8 b9cb8959ee [st] feat: 통계 검증 규칙 관리 화면 레이아웃 작업 2026-02-03 17:13:38 +09:00
rsone001 4ee12d127d st: refactor: cell 색상 속성 수정 2026-02-03 17:06:11 +09:00
rsone001 830cbf97d1 st: refactor: 구분 별 footer 평균 값 계산 함수 추가 2026-02-03 16:46:06 +09:00
rsone001 d32d73a681 Merge remote-tracking branch 'origin/iipbs/st/dev' into feature/review-skeleton-sein 2026-02-03 15:33:56 +09:00
rsone001 9eb40c46e5 st: fix: cell style 속성 추가, grid 데이터 변환 공통함수 추가 2026-02-03 15:29:45 +09:00
chanii8 8a160dc97c [cs] feat: 게시판 통계 페이지 데이터 바인딩 작업 2026-02-03 10:47:23 +09:00
mind-one005 ddb3693358 fo: 모래시계 수정 2026-02-02 18:14:45 +09:00
rsone001 1884f3733d Merge branch 'iipbs/st/dev' into feature/review-skeleton-sein 2026-02-02 17:33:59 +09:00
rsone001 15dd319b21 st: fix: 그리드 셀 편집 시 계산 로직 추가, 구분 별 footer 계산 로직 추가, footer 평균 계산 함수 추가, 각종 오류 수정 2026-02-02 16:49:10 +09:00
mind-one005 2947fb1524 Merge remote-tracking branch 'origin/iipbs/sn/dev' 2026-02-02 11:21:29 +09:00
mind-one005 2582bdd08c Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend 2026-02-02 11:19:59 +09:00
dongsilove 85615a826e fo: exceldown 로직 변경 2026-01-31 16:05:21 +09:00
dongsilove 2e24da3c83 Merge branch 'iipbs/sn/dev' 2026-01-30 21:38:13 +09:00
mind-one005 c6cfedb28b fo: 유량현황 팝업 강우시 강우일 음영표시 2026-01-30 18:14:30 +09:00
mind-one005 164fc1388e fo: 강우시 강우일의 강우량에 음영 2026-01-30 16:22:51 +09:00
mind-one005 39fb1d974a fo: excel 조회 결과 2026-01-30 10:39:41 +09:00
mind-one005 88eb32f4fc Merge branch 'iipbs/sn/dev' 2026-01-30 09:05:51 +09:00
dongsilove 1aaa8fcd6b fo: pagination 수정 2026-01-29 21:25:40 +09:00
dongsilove 527b0c6567 fo: exceldownload 데이터가 없는 경우 처리 2026-01-29 20:56:43 +09:00
mind-one005 a2504f4c85 fo:exceldown시 조건 해제 4개화면 2026-01-29 18:07:08 +09:00
rsone001 68c5548252 st: refactor:
- 컴포넌트 전체적으로 정리
- 그리드 컴포넌트 sort 기능 및 foooter 기능 수정
- menu active 기능 수정
2026-01-29 10:23:05 +09:00
mind-one005 ee9e309413 Merge branch 'iipbs/sn/dev' 2026-01-29 09:27:26 +09:00
mind-one005 5faced2928 fo: default 년도 설정 2026-01-29 09:12:00 +09:00
mind-one005 4356ec8a34 fo: 년도 초기화 및 exceldown시 조회데이터 없는 경우 처리 3본 2026-01-28 18:05:48 +09:00
mind-one005 a61fda8b58 fo: exceldown시 조건 나머지 적용 2026-01-26 16:13:33 +09:00
mind-one005 cf61a8956b fo: exceldown시 조건 2026-01-26 12:57:00 +09:00
dongsilove 9fc6be1256 Merge branch 'iipbs/sn/dev' 2026-01-22 22:03:33 +09:00
dongsilove 30b98de0a1 fo: planSewage 수정 2026-01-22 21:57:42 +09:00
dongsilove da1107566c fo: 수질현황, 계획하수량 2026-01-22 21:47:50 +09:00
mind-one005 974d15962c fo: exceldownload 4본 수정 2026-01-22 11:26:43 +09:00
dongsilove bd5c2f07d3 fo: 오수발생량 수정중 2026-01-21 22:15:02 +09:00
jcchoi 2469a84068 대시보드 게시글 링크 수정정 2026-01-21 17:52:22 +09:00
jcchoi 80598a5b6a Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend 2026-01-21 16:28:08 +09:00
mind-one005 b4a905d2ed Merge branch 'iipbs/sn/dev' 2026-01-21 10:35:28 +09:00
jcchoi 599e8a95c7 logout 수정정 2026-01-20 15:00:08 +09:00
mind-one005 3eb8861d06 dm: 물재이용현황 시도 수정 2026-01-19 18:11:56 +09:00
mind-one005 122e10f851 wr: 재원협의 문구 2026-01-19 16:38:26 +09:00
mind-one005 e464d298ad wr: 36 계통도 평면도 외 2026-01-19 13:24:29 +09:00
dongsilove 44580f5156 fo:수질현황 총인설비tab 2026-01-18 21:21:19 +09:00
dongsilove 69d73ae3fb Merge branch 'main' into iipbs/sn/dev 2026-01-16 20:16:24 +09:00
mind-one005 943d858c5a cm: 우편번호 떼어내기 2026-01-16 17:37:49 +09:00
rsone001 9881653bae fix: 12. 하수 밒 분뇨 관련 사업 컬럼매핑오류(한글화) 수정 2026-01-16 13:22:34 +09:00
mind-one005 2fe73c7480 Merge branch 'iipbs/sn/dev' 2026-01-16 13:08:27 +09:00
rsone001 af636453e0 Merge remote-tracking branch 'origin/feature/review-skeleton-sein' into iipbs/st/dev 2026-01-16 13:05:58 +09:00
rsone001 51d8eb50aa feat : 01. 하수도 보급률
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:54:49 +09:00
rsone001 e94782f56a st: feat: 멀티 footer, footer 병합 작업중 2026-01-16 11:54:36 +09:00
rsone001 8552957fb5 feat : 13. 하수도 서비스 수준
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:52:23 +09:00
rsone001 35a44ff7aa feat : 10. 물 재이용
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:48:58 +09:00
rsone001 93d090b23f feat : 00. 통계 입력 현황
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:48:24 +09:00
rsone001 66930f2e93 feat : 09. 하수도 재정
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:47:13 +09:00
rsone001 0240e1fc7a feat : 04. 하수저류 시설 및 빗물 펌프장
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:46:55 +09:00
rsone001 011104b548 feat : 02. 하수관로
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:46:37 +09:00
rsone001 c077c0507c feat : 03. 하수관로 유지 관리
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:46:04 +09:00
rsone001 042f839e41 feat : 11. 하수 및 분뇨 찌꺼기(슬러지) 처리
valueType,numberFormat 추가,컬럼명 변경
2026-01-16 11:44:58 +09:00
rsone001 292c17d682 feat : 12. 하수 및 분뇨 관련 산업valueType,numberFormat 추가,컬럼명 변경 2026-01-16 11:44:24 +09:00
rsone001 e875700105 feat : 05.펌프장valueType,numberFormat 추가,컬럼명 변경 2026-01-16 11:43:51 +09:00
rsone001 c036ce41c9 feat : 06.공공하수처리시설valueType,numberFormat 추가,컬럼명 변경 2026-01-16 11:43:07 +09:00
rsone001 b4f3c0108e feat : 08.개인하수처리시설valueType,numberFormat 추가,컬럼명 변경 2026-01-16 11:42:10 +09:00
rsone001 2a6fa899e3 feat : 07.분뇨처리시섪valueType,numberFormat 추가,컬럼명 변경 2026-01-16 11:41:27 +09:00
dongsilove 3716e8c7b2 dm: 로그아웃처리 2026-01-15 21:14:49 +09:00
mind-one005 4e27466f00 dm: GATEWAY_URL 추가 2026-01-15 15:51:08 +09:00
mind-one005 21b043cbae dm: 유사사례 사업명 ***처리 2026-01-14 17:51:48 +09:00
mind-one005 7588ee4e6a dm: 유사사례 팝업 조정 2026-01-14 17:05:26 +09:00
dongsilove c57f05cc3e sn: showModal 수정 2026-01-13 22:53:35 +09:00
rsone001 8252561050 st: refactor: grid 변경 내용 @rsone/components 모듈에 반영, 모든 컴포넌트에서 @rsone/components의 grid 컴포넌트를 import 하도록 수정, 검토 관련 컴포넌트 코드 정렬 및 불필요 공백 제거 2026-01-13 15:58:19 +09:00
rsone001 20cbd7ebcd Merge remote-tracking branch 'origin/feature/management-skeleton-eunsun' into iipbs/st/dev 2026-01-13 11:46:57 +09:00
rsone001 71e412d030 st: feat:
- compact grid(1/2 넓이) & split grid(1/2 넓이 2개) 컴포넌트 추가
- 시설별 설치 현황 관리 버튼 추가
- 통계입력현황(검토) 컴포넌트 & 컬럼 파일 오타 수정
2026-01-13 11:46:28 +09:00
rsone001 bb1cbb9ac0 refactor: 각 tab의 컬럼 파일명 단축 및 오타 수정
- 가독성 개선을 위해 파일명 단축
- Treatment -> Treat
- Facility -> Fac
- Construction -> Const
- Approval -> Appr
- Utilization -> Util
- Designation -> Desig
- Settlement -> Settle
- StatsInputSatus 오타 변경 -> StatsInputStatus
2026-01-13 11:43:20 +09:00
rsone001 7af1ef94cb feat: 하수도 통계 입력에 '해당사항 없음' 버튼 추가
- 04. 하수저류시설 및 빗물펌프장
- 05. 펌프장
- 06. 공공하수처리시설 (운영 데이터 업데이트 버튼도 추가)
- 07. 분뇨처리시설
- 10. 물 재이용
- 11. 하수 및 분뇨찌꺼기(슬러지)처리
- 13. 하수도 서비스 수준
- 추후 조건에 따라서 버튼 보여지고 안보여지고 제어예정
2026-01-13 10:47:36 +09:00
dongsilove 8f26c1482e fo: 총인설비 수질현황 기간별 exceldownload 2026-01-12 22:40:58 +09:00
rsone001 a3797c7ae1 refactor: 하수도 통계 입력 > 10 ~ 13 컬럼 속성에 valueType, dataForma 추가
- 숫자면 valueType, dataFormat 추가
- 버튼 정렬 맞춤 <div> 추가
- 항목 추가, 항목 제외 버튼 추가 : 10, 11, 12
- 05. 펌프장 컬럼명 중복 해결
- 10. 물 재이용, 11. 하수 및 분뇨찌꺼기(슬러지)처리, 12. 하수 및 분뇨관련산업, 13. 하수도 서비스 수준
2026-01-12 17:56:58 +09:00
rsone001 2cfcddc365 st: refactor: 해당사항 없음 버튼 css 수정 2026-01-12 17:01:07 +09:00
rsone001 7fa390ccb1 Merge remote-tracking branch 'origin/feature/management-skeleton-eunsun' into iipbs/st/dev 2026-01-12 16:00:14 +09:00
rsone001 5e7eae3e9e 하수도 통계 관리 > 05 ~ 09 컬럼 속성에 valueType, dataFormat 추가
- 숫자면 valueType 추가
- 입력값과 합계값의 소수점 불일치는 입력값 기준으로 수정
- 버튼 정렬 맞춤 <div> 추가
- 항목 추가, 항목 제외 버튼 추가 : 05, 07
- 운영데이터 가져오기 버튼 아래로 이동 : 06
- 05. 펌프장, 06. 공공하수처리시설, 07. 분뇨처리시설, 08. 개인하수처리시설, 09. 하수도재정 추가 완료
2026-01-12 15:54:08 +09:00
rsone001 b83a55d1af Merge remote-tracking branch 'origin/feature/management-skeleton-eunsun' into iipbs/st/dev 2026-01-12 15:27:15 +09:00
rsone001 2eddbacc7f st: feat: 신규 버튼 컴포넌트 추가, 50:50 비율 그리드 추가 작업중 2026-01-12 15:26:33 +09:00
dongsilove fe216499ec fo: 주석 2026-01-12 13:43:26 +09:00
rsone001 1b64bccc55 refactor: 하수도 통계 관리 > 00 ~ 04 컬럼 속성에 valueType, dataFormat 추가
- 숫자면 valueType 전부 추가
- 입력값과 합계값의 소수점 불일치는 입력값 기준으로 수정
- 00. 통계 입력 현황 - 작성율만 숫자
- 01. 하수도 보급율, 02. 하수관로, 03. 하수관로 유지관리, 04. 하수저류시설 및 빗물펌프 추가 완료
2026-01-12 13:26:43 +09:00
dongsilove 36294fef80 fo: 처리구역 2026-01-12 10:28:36 +09:00
dongsilove 1eb4435c2f Merge branch 'iipbs/sn/dev' 2026-01-12 09:46:55 +09:00
dongsilove 94fa8eb721 fo: 유량현황 강우시 평균 단수 처리 2026-01-10 20:43:46 +09:00
dongsilove ac8c58d2a9 fo: dashboard 강우일운영현황 2026-01-10 15:33:36 +09:00
mind-one005 54c958e8fa fo: excel 컬럼 순서 fix 2026-01-09 18:10:19 +09:00
rsone001 57151eae76 Merge remote-tracking branch 'origin/feature/management-skeleton-eunsun' into iipbs/st/dev 2026-01-09 17:25:55 +09:00
rsone001 9729b42837 st: refactor: - 버튼 컴포넌트 추가 2026-01-09 17:25:16 +09:00
rsone001 fd106f3729 refactor: 컬럼 정의 파일명 변경 Mng -> Inp
- management -> input으로 변경됨에 따라 MngColumn.ts -> InpColumn.ts 로 모두 변경
2026-01-09 17:20:53 +09:00
rsone001 4da4f5cd62 feat: 13. 하수도서비스 수준 화면 구현
- 각 tab별로 columns, columnLayout 분리
- tab 1. 민원 (ComplaintInpColumn.ts)
- tab 2. 주민친화시설 (ResidentFriendlyFacilityInpColumn.ts)
- 하수도서비스 수준 Component 완성
2026-01-09 16:38:38 +09:00
mind-one005 58c8f118d3 fo: dashboard 강우일운영현황 2026-01-09 16:34:52 +09:00
mind-one005 a6514cab64 fo: dashboard 강우일 운영현황 tab 2026-01-09 16:26:10 +09:00
rsone001 c73a01d27d feat: 12. 하수 및 분뇨관련 산업 화면 구현
- 각 tab별로 column, columsLayout 분리
- tab 1. 공공기관 하수분야 (PublicInstitutionSewerIndustryInpColumn.ts)
- tab 2. 공공기관 분뇨분야 (PublicInstitutionExcretaIndustryInpColumn.ts)
- tab 3. 분뇨수집 · 운반업 (ExcretaRelatedIndustryInpColumn.ts)
- tab 4. 개인하수처리관련업 (PrivateSewageTreatmentRelatedIndustryInpColumn.ts)
- 하수 및 분뇨관련산업 컴포넌트 완성
2026-01-09 15:51:15 +09:00
rsone001 eae2c15aaf feat: 11. 하수 및 분뇨찌꺼기(슬러지)처리 화면 구현
- tab 1. 찌꺼기(슬러지)처리 시설현황 columns, columnLayout 완성 (SlurgeProcessingFacStatusInpColumn.ts)
- tab 1 컬럼에서 DB 테이블과 mapping되지 않는 컬렴들은 임의로 생성
- tab 2. 소화조 운영현황 columns, columnLayout 완성 (DigestorOperatingStatusInpColumn.ts)
- tab 3. 하수찌꺼기 처리시설 운영현황 columns, columnLayout 완성 (SewageSlurgeProcessingFacStatusInpColumn.ts)
- tab 4. 분뇨찌꺼기(슬러지) 처리현황 columns, columnLayout 완성 (ExcretaSlurgeProcessingStatusInpColumn.ts)
- 하수 및 분뇨찌꺼기(슬러지)처리 컴포넌트 완성
2026-01-09 14:42:03 +09:00
mind-one005 f279f49865 fo: build 오류 수정 2026-01-09 13:38:39 +09:00
rsone001 ece49f0ae2 st: refactor: 경로 오류 수정 2026-01-09 13:30:28 +09:00
rsone001 810bedb414 Merge branch 'iipbs/st/dev' of https://onasys.co.kr:3000/ONAANDALL/frontend into feature/management-skeleton-eunsun 2026-01-09 13:26:05 +09:00
rsone001 5492ea70ed st: refactor:
- 통계 입력 디렉토리 & 파일명 변경
management -> input & Mng -> Inp
- @rsone/component 모듈 수정
pnpm build --filter @rsone/components 후 st 프로젝트 install 필요
2026-01-09 13:21:55 +09:00
mind-one005 39de22045b fo: build 2026-01-09 13:21:38 +09:00
rsone001 f61e952d28 feat: 11. 하수 및 분뇨찌꺼기(슬러지) 화면 구현 중
- 각 tab을 위한 columns, columnLayout 파일 생성
- tab 1. 찌꺼기(슬러지)처리 시설현황 구현 중
2026-01-09 13:20:55 +09:00
mind-one005 b960a03361 fo: 사용하지 않는 변수 정리 2026-01-09 13:19:34 +09:00
mind-one005 e5a750e8b9 fo: eslint 수정 2026-01-09 13:06:41 +09:00
rsone001 b5709ab2e2 Merge remote-tracking branch 'origin/feature/management-skeleton-eunsun' into iipbs/st/dev 2026-01-09 10:21:42 +09:00
rsone001 d9d5b49057 st: refactor:
- Real Grid 컴포넌트 @rsone/components 로 모듈화
- 컴포넌트 동적 import 경로 수정(engName -> urlPath)
2026-01-09 10:21:00 +09:00
dongsilove 6a5c7c301f fo: dashboard 지하수유입량 수정 2026-01-08 22:24:32 +09:00
mind-one005 295247845c fo: 지하수유입량 최대, 최소 수정 2026-01-08 17:58:38 +09:00
rsone001 1c7be567f4 feat: 10. 물 재이용 화면 구현
- tab 2. 중수도 현황 columns, columnLayout 완성 (RecycledWaterStatusMngColumn.ts)
- tab 3. 빗물이용시설현황 columns, columnLayout 완성 (RainfallUtilizationFacilityStatusMngColumn.ts)
- tab 4. 하·폐수처리수 재이용시설 설계시공업 등록현황 columns, columnLayout 완성 (TreatmentWaterReuseDesignConstructionStatusMngColumn.ts)
- tab 5. 하·폐수처리수 재이용사업 인가현황 columns, columnLayout 완성 (TreatmentWaterReuseBussinessApprovalStatusMngColumn.ts)
- 물 재이용 컴포넌트 완성 tab list 추가
2026-01-08 17:11:14 +09:00
rsone001 c4ca48be62 refactor: 네이밍, footer, search form 수정
- 구군 -> 시군구 로 변경
- footer 합계 추가 (05. 펌프장, 06. 공공하수처리시설, 07. 분뇨처리시설)
- search form 시설명 누락 추가 (04. 하수저류시설 및 빗물펌프장, 05. 펌프장, 06. 공공하수처리시설, 07. 분뇨처리시설)
2026-01-08 15:38:07 +09:00
mind-one005 5b76d02e0b fo: 강수현황 excel문제 해결 2026-01-08 13:57:29 +09:00
dongsilove 9b1342b203 fo: 처리구역정보 2026-01-07 21:46:16 +09:00
rsone001 a4147a4c67 Merge remote-tracking branch 'origin/feature/management-screen-eunsun' into iipbs/st/dev 2026-01-07 11:32:30 +09:00
rsone001 0b8ace2f0d feat: 10. 물 재이용 화면 구현 중
- 각 tab을 위한 columns,comlumLayout 파일 생성
- tab 1. 공공하수처리 재이용 정의 완성 (PublicSewageTreatmentWaterReuseMngColumn.ts)
2026-01-07 11:28:36 +09:00
rsone001 185bda696a Merge remote-tracking branch 'origin/feature/management-screen-eunsun' into iipbs/st/dev 2026-01-07 11:17:04 +09:00
rsone001 2e03b79031 Merge remote-tracking branch 'origin/yangsein' into iipbs/st/dev 2026-01-07 11:16:00 +09:00
dongsilove b57858c5ef fo: 총인시설여부 수정 2026-01-07 11:15:43 +09:00
rsone001 cbded3e605 st: refactor: 그리드 prop isExcelExport(엑셀 내보내기 버튼 유무)추가, mergeRule, sortdisable 추가
컬럼 속성에 mergeRule: true시 해당 컬럼 같은 값인 cell merge
sortdisable: true시 해당 컬럼의 정렬 기능 비활성화
2026-01-07 11:07:56 +09:00
mind-one005 c01de13bae Merge branch 'iipbs/sn/dev' 2026-01-06 16:12:23 +09:00
mind-one005 a0ad12af49 fo: api /dashboard/mngInfo 2026-01-06 16:08:36 +09:00
rsone001 81306a7b82 refactor: 09. 하수도 재정 tab 구조 분리 & footer 적용
- tab별 컬럼 정의 파일 분리 (SewerageFinanceSettlementMngColumn, SewerageChargeMngColumn, SewerageUsageFeeMngColumn, CauserBurdenMngColumn)
- 각각의 컬럼 정의 파일에 footer 설정 적용 (정수, 소수점 1자리)
- editable 속성 추가
- tab 3: 하수도 사용료 컬럼 구조 수정
2026-01-06 15:25:13 +09:00
rsone001 c6d66c54b5 refactor: 08. 개인하수처리시설 tab 구조 분리 & footer 적용
- tab별 컬럼 정의 파일 분리 (SewageTreatmentFacilityStatusMngColumn, SepticTankStatusMngColumn, PrivateSewageDesignationStatusMngColumn)
- 각각의 컬럼 정의 파일에 footer 설정 적용 (정수, 소수점 1자리)
- editable 속성 추가
2026-01-06 11:13:20 +09:00
rsone001 69a0dd47ff [fix] 00. 통계입력현황 탭grid->단일 grid로 변경 2026-01-06 11:01:09 +09:00
rsone001 1ad61e0fa5 [fix]05.펌프장 탭grid->단일 grid로 변경 2026-01-06 11:00:41 +09:00
rsone001 4b895ac5d4 [fix]06.공공하수처리시설 탭grid->단일 grid로 변경 2026-01-06 11:00:09 +09:00
rsone001 f86301a771 [fix]07.분뇨처리시설 탭grid->단일 grid로 변경 2026-01-06 10:59:21 +09:00
jcchoi 7a231c541a Merge branch 'main' of https://www.onasys.co.kr:3000/ONAANDALL/frontend 2026-01-06 09:46:31 +09:00
jcchoi 2a66772bfa 쿠키 삭제 도메인 처리 2026-01-06 09:46:27 +09:00
rsone001 f7c691ef9f refactor: 화면정의서 작성용 코드 추가
- 화면 정의서 화면용 버튼 추가
2026-01-06 00:12:29 +09:00
rsone001 2bf04dd288 refactor: 07. 분뇨처리시설 컬럼 파일로 분리 & footer 적용
- ExcretaTreatmentFacilityMngColumn.ts 파일 생성
- 기존 ExcretaTreatmentFacilityMng.tsx 컴포넌트 내 컬럼 정의 별도 파일로 분리
-  footer 설정 적용 (소수점 3자리, 소수점 1자리, 정수)
- editable 속성 추가
2026-01-05 17:19:57 +09:00
rsone001 96aecb9847 Merge remote-tracking branch 'origin/feature/management-screen-eunsun' into iipbs/st/dev 2026-01-05 17:17:11 +09:00
rsone001 e0b631ec25 st: refactor: button style 수정 2026-01-05 17:09:42 +09:00
rsone001 55bf8df00d refactor: 06. 공공하수처리시설 컬럼 파일로 분리 & footer 적용
- PublicSewageFacilityMngColumn.ts 파일 새로 생성
- 기존 PublicSewageFacilityMng.tsx 내 컬럼 정의 별도 파일로 분리
- footer 설정 적용 (소수점 3자리, 소수점 1자리, 정수)
- editable 속성 추가 (수정 가능 컬럼 10개)
2026-01-05 16:02:11 +09:00
mind-one005 69c068e823 fo: dashboard 주석2 2026-01-05 15:55:45 +09:00
rsone001 591f47a3ff refactor: 00. 통계입력현황 컬럼 파일로 분리
- StatsInputSatusMngColumn.ts 파일 생성 후 컬럼 정보 정의
- StatsInputSatusMng.tsx 컴포넌트 수정 (컬럼 정보 파일 import)
2026-01-05 15:07:00 +09:00
rsone001 c281f688b5 refactor: 컬럼 정의 네이밍 컨벤션 적용 (-MngColumn)
- 통계입력관리 관련 컬럼 정의 파일 네이밍 통일 '-MngColumn'형식으로 표준화
- export 변수명을 파일명과 일치하도록 수정
- 참조하는 파일들의 import 경로 수정
2026-01-05 14:44:48 +09:00
rsone001 97e448c5c8 refactor: 05. 펌프장 컬럼 파일로 분리 & footer 적용
-  PumpingStationMngColumn.ts 파일 새로 생성
- 기존 PumpingStation.tsx 내 컬럼 정의 별도 파일로 분리
- footer 설정 적용 (소수점 3자리, 소수점 1자리, 정수)
- editable 속성 추가 (시도, 시군구, 우수량, 총양수량 = false)
2026-01-05 13:18:45 +09:00
rsone001 8de5317d28 st: refactor: 그리드 merge rule 로직 변경 / 컬럼 sort 여부 추가 2026-01-05 10:04:20 +09:00
dongsilove 955c969fc5 fo:주석 추가 2026-01-05 06:50:18 +09:00
dongsilove ac3acbb0f4 fo: dashboard 수정 2026-01-04 20:45:08 +09:00
dongsilove 897ce3eb24 wr: 주석 추가 2026-01-03 15:52:41 +09:00
dongsilove 94b640d566 dm: experimental 추가 2026-01-03 14:50:26 +09:00
dongsilove bd8d850a78 dm: 연녹색 스킨 및 메뉴 2026-01-02 23:17:59 +09:00
mind-one005 43af9042c8 fix fo 2026-01-02 18:21:12 +09:00
mind-one005 e283c91394 Merge branch 'iipbs/sn/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/sn/dev 2026-01-02 18:04:23 +09:00
mind-one005 63543a016e fo: dashboard 물사용량 수정 2026-01-02 18:04:19 +09:00
swcho f96ae66385 fix: 개발 서버 에러 수정 테스트 롤백 2026-01-02 17:49:36 +09:00
swcho 8f531a245f fix: 개발서버 env 파일 확인 2026-01-02 17:41:52 +09:00
swcho ea738d687b fix: router.push -> window.location.href로 변경 2026-01-02 16:11:00 +09:00
swcho 8cc5a0a737 fix: base_url 수정 2026-01-02 15:58:35 +09:00
swcho d4b32ffad0 fix: 서브도메인 포트 수정 2026-01-02 15:39:28 +09:00
swcho 911e97791d Merge branch 'iipbs/sn/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/sn/dev 2026-01-02 15:18:08 +09:00
swcho e0e1bb5b1a fix: 개발 서버 에러 수정 테스트2 2026-01-02 15:18:06 +09:00
mind-one005 61aa2ff1e1 Merge branch 'main' into iipbs/sn/dev 2026-01-02 15:00:36 +09:00
rsone001 54e60d83a0 [refactor] 불필요한 주석 제거 2026-01-02 14:29:58 +09:00
rsone001 25e41a356b [feat]01.통계입력현황 단일탭 column 폴더 분리 2026-01-02 14:10:33 +09:00
swcho 745a7d06ea fix: 개발 서버 에러 수정 테스트 2026-01-02 13:55:02 +09:00
rsone001 7abae34531 [feat] 01.하수도 보급율 단일탭 column 폴더분리 2026-01-02 13:53:01 +09:00
rsone001 877a548c6f [feat]05. 펌프장 단일 탭 column폴더 분리 2026-01-02 13:41:10 +09:00
rsone001 28f841adc8 [feat] 06.공공 하수처리시설 단일 탭 column 분리 2026-01-02 13:10:16 +09:00
rsone001 69820d8e4c [feat] 07.분뇨처리시설 단일 탭 column 폴더로 분리 2026-01-02 11:26:27 +09:00
rsone001 36146c3fc4 [feat] map 처리로 columns editable 옵션 추가 및 코드 정리 2026-01-02 11:18:36 +09:00
rsone001 8318888f6d refactor: 04.하수저류시설 및 빗물펌프 tab 구조 분리 & footer 적용
- tab별 컬럼 정의 파일 분리 (SewageReservoirColumn, RainfallPumpStationColumn)
- 저장 로직에서 필요한 컬럼은 hidden 컬럼으로 변경, footer 적용
2025-12-31 14:57:51 +09:00
rsone001 7e9f294ae8 merge origin/feature/management-screen-eunsun into iipbs/st/dev 2025-12-31 13:29:44 +09:00
rsone001 7d51674516 refactor: 03. 하수관로 유지관리 tab 구조 분리 & footer 적용
- 기존 tab 구조를 RepairStatus(개보수), PipeDredgingStatus(관로준설) 파일로 분리
- 각 파일에 footer 속성, editable 속성 추가
2025-12-31 13:21:59 +09:00
rsone001 3830273119 Merge remote-tracking branch 'origin/feature/management-screen-eunsun' into iipbs/st/dev 2025-12-31 13:18:03 +09:00
rsone001 d065fe669b st: refactor:
- data state 선언 위치 변경
- 데이터 필드 타입 및 format 설정 로직 추가
2025-12-31 13:17:32 +09:00
rsone001 9fcd719382 refactor: 02. 하수관로 화면 구조 수정 & footer 적용
- tab 별 grid 컬럼 정의 파일 분리 (지역별 시설현황, 시설별 설치현황, 관종별 현황, 관경별 현황, 맨홀 현황, 시설별현황관리)
- tab 5. 맨홀 현황 새로 생성
- 각 tab에 footer 속성 추가
2025-12-31 11:27:34 +09:00
rsone001 55b3752f49 Merge remote-tracking branch 'origin/feature/management-screen-eunsun' into iipbs/st/dev
refactor: DataGrid 컴포넌트를 사용하는 부모 컴포넌트에서 rowData state를 직접 생성 후 자식 컴포넌트로 내려주는 방식으로 수정, TabDataGrid는 동일 방식으로 수정할 예정
2025-12-30 17:59:06 +09:00
rsone001 32ad548de2 st: refactor: DataGrid 설정 수정 중 2025-12-30 17:55:05 +09:00
rsone001 074d82a3bd refactor: 02. 하수관로 tab 구조 개선 & grid footer 설정 수정
- 개별 컬럼 정의 파일들을 리스트로 묶어 TabDataGrid에 직접 전달하는 방식으로 변경
- footerSummary.ts에 포맷별(정수/소수점) 설정 객체 추가 및 export
- SeweragePenetrationRateMngColumn.ts 파일에 footer 적용
2025-12-30 17:41:17 +09:00
rsone001 90c977300c refactor: 01. 하수도 보급률 컬럼 분리, Grid 속성 적용
- SeweragePenetrationRateMng.tsx 에 포함되어있던 컬럼 정의를 SeweragePenetrationRateMngColumn.ts 파일로 분리
- Footer 합계 함수 적용 (소수점, 정수 적용)
- 컬럼별 수정가능 여부(editable) 설정
2025-12-30 14:06:29 +09:00
rsone001 01ef993601 feat: 하수도 통계 관리 화면 구현
- 09. 하수도 재정 화면 구현
2025-12-30 11:25:42 +09:00
rsone001 a542cdd87d st: refactor: 헤더 컬럼 폴더 구조 정리 2025-12-29 16:23:50 +09:00
rsone001 f57fd44db9 Merge remote-tracking branch 'origin/eunsun' into iipbs/st/dev 2025-12-29 16:11:02 +09:00
rsone001 ce44289ff1 feat: 하수 통계 관리 화면 구현2
- 07. 분뇨처리시설
- 08. 개인하수처리시설
- 09. 하수도 재정 (구현 중 tab1까지 완료)
2025-12-29 15:58:25 +09:00
rsone001 52e94bc943 fix: 컬럼 로직 변경 전 commit 2025-12-29 15:03:22 +09:00
rsone001 7876fea738 Merge remote-tracking branch 'origin/eunsun' into iipbs/st/dev 2025-12-29 15:02:33 +09:00
rsone001 ef2e0ccfea Merge remote-tracking branch 'origin/yangsein' into iipbs/st/dev 2025-12-29 15:02:04 +09:00
rsone001 086478b41e fix: 메뉴별 컬럼 1차 셋팅 2025-12-29 14:58:47 +09:00
rsone001 66560d661e [feat] 물재이용 탭4개 추가 2025-12-29 14:14:32 +09:00
rsone001 c6f13b35a1 Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev 2025-12-29 11:49:14 +09:00
rsone001 2009c54a00 fix: footer(합계) 작업 중 2025-12-29 11:49:07 +09:00
rsone001 822081b318 Merge branch 'main' into eunsun 2025-12-29 11:13:45 +09:00
yangsein 2080927302 [feat]물재이용 탭 1개 추가 2025-12-29 11:08:55 +09:00
rsone001 f0272e1f82 feat: 하수 통계 관리 화면 구현
- 02. 하수관로
- 03. 하수관로 유지관리
- 04. 하수저류시설
- 05. 펌프장
- 06. 공공하수처리시설
2025-12-29 10:59:43 +09:00
yangsein b59ab18fa6 [feat] 하수 및 분뇨 찌꺼기(슬러지) 처리 tab4개 추가 2025-12-29 10:52:43 +09:00
yangsein 8006a9ef09 [feat]하수및분뇨관리사업 탭 4개 추가 2025-12-26 13:52:43 +09:00
yangsein 97435b7113 [feat]하수도 서비스 수준 탭2개 추가 2025-12-26 13:39:44 +09:00
yangsein 6cee09b72e [feat]하수도 재정 탭 4개 추가 2025-12-26 13:28:14 +09:00
yangsein 35ae83034c [feat]개인 하수처리시설 탭 3개 추가 2025-12-26 12:03:11 +09:00
yangsein deaf1b53ee [feat]하수 저류시설 및 빗물 펌프장 2025-12-26 11:41:36 +09:00
yangsein cda8044183 [feat]하수관리 유지관리 탭 2개 추가 2025-12-26 11:17:27 +09:00
yangsein 47f41faee3 [feat]02.하수관로 탭 4개 추가 2025-12-26 10:47:39 +09:00
yangsein 3d7fc84a2e [feat]분뇨처리시설 화면 추가 2025-12-23 17:51:24 +09:00
yangsein 68f8a7be38 [feat]하수관로 화면 컬럼 추가 2025-12-23 15:07:43 +09:00
yangsein 4d537a7bbc Merge branch 'iipbs/st/dev' of https://onasys.co.kr:3000/ONAANDALL/frontend into yangsein 2025-12-23 14:13:50 +09:00
yangsein 6c6aaebdc8 [feat]통계 입력현황,하수도 보급율,펌프장,공공하수처리시설 2025-12-23 14:09:14 +09:00
rsone001 ba4062f826 feat: 그리드 텝 형식 컴포넌트 신규 생성
TabDataGrid.tsx(탭 형석 그리드) & SewagePipeColumn.ts(컬럼정보)
예시 화면 - 하수도 통계관리/하수관로
2025-12-23 12:05:03 +09:00
rsone001 019415f124 feat: 버튼 컴포넌트 추가 2025-12-22 13:27:43 +09:00
305 changed files with 25307 additions and 4284 deletions
+1
View File
@@ -25,3 +25,4 @@ apps/fo/.next/**/*
pnpm-lock.yaml pnpm-lock.yaml
settings.json settings.json
.npmrc .npmrc
.cursor
-1
View File
@@ -15,4 +15,3 @@ export async function POST() {
cookieStore.delete(CLAIM_NAME); cookieStore.delete(CLAIM_NAME);
return NextResponse.json({ message: "Logged out" }, { status: 200 }); return NextResponse.json({ message: "Logged out" }, { status: 200 });
} }
@@ -1,4 +1,4 @@
import { AUTH_USER_ID, CLAIM_NAME } from "@/shared/config"; import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME, REFRESH_TOKEN } from "@/shared/config";
import { getCookie, setCookie, removeCookie } from "@/shared/lib"; import { getCookie, setCookie, removeCookie } from "@/shared/lib";
export class TokenManager { export class TokenManager {
@@ -76,6 +76,8 @@ export class TokenManager {
this.removeToken(CLAIM_NAME); this.removeToken(CLAIM_NAME);
this.removeToken(AUTH_USER_ID); this.removeToken(AUTH_USER_ID);
this.removeToken(REFRESH_TOKEN);
this.removeToken(ACCESS_TOKEN);
} }
} }
+10 -4
View File
@@ -3,7 +3,7 @@
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { getCoreRowModel } from "@tanstack/react-table"; import { getCoreRowModel } from "@tanstack/react-table";
import { PostApi, type MyPost } from "@/entities/post"; import { PostApi, type MyPost, type NoticePost } from "@/entities/post";
import { ENDPOINT } from "@/shared/config"; import { ENDPOINT } from "@/shared/config";
import { useDataTable } from "@/shared/lib"; import { useDataTable } from "@/shared/lib";
import { import {
@@ -23,15 +23,21 @@ const MyPostList: React.FC = () => {
}), }),
}); });
const handleMyPostRowClick = (row: MyPost) => {
router.push(`/cms/${row.bbsTypeCd.toLowerCase()}/${row.bbsId}/${row.pstNo}`);
};
const { tableComponent: myPostTableComponent } = useDataTable({ const { tableComponent: myPostTableComponent } = useDataTable({
query: myPostQuery, query: myPostQuery,
tableOptions: { tableOptions: {
columns: myPostTableColumns, columns: myPostTableColumns,
getCoreRowModel: getCoreRowModel(), getCoreRowModel: getCoreRowModel(),
}, },
dataTableOptions: { dataTableOptions: {
variant: "line", variant: "line",
onRowClick: handleMyPostRowClick
}, },
}); });
return ( return (
@@ -26,7 +26,7 @@ const NoticeList: React.FC = () => {
}); });
const handleNoticePostRowClick = (row: NoticePost) => { const handleNoticePostRowClick = (row: NoticePost) => {
router.push(`/bbs/bbsnotice/${row.bbsId}/${row.pstNo}`); router.push(`/cms/${row.bbsTypeCd.toLowerCase()}/${row.bbsId}/${row.pstNo}`);
}; };
const handleMoreClick = () => { const handleMoreClick = () => {
@@ -40,12 +40,12 @@ const NoticeList: React.FC = () => {
const { tableComponent: noticePostTableComponent } = useDataTable({ const { tableComponent: noticePostTableComponent } = useDataTable({
query: noticePostQuery, query: noticePostQuery,
tableOptions: { tableOptions: {
columns: noticePostTableColumns, columns: noticePostTableColumns,
getCoreRowModel: getCoreRowModel(), getCoreRowModel: getCoreRowModel(),
}, },
dataTableOptions: { dataTableOptions: {
variant: "line", variant: "line",
onRowClick: handleNoticePostRowClick, onRowClick: handleNoticePostRowClick,
}, },
}); });
+7 -2
View File
@@ -60,13 +60,18 @@ async function handler(
[AUTH_USER_ID]: userId, [AUTH_USER_ID]: userId,
}); });
const forwardedHost = request.headers.get("x-forwarded-host");
const host = request.headers.get("host");
const actualHost = forwardedHost || host || new URL(request.url).hostname.toString();
// 운영 환경에서 domain 설정
const domain = actualHost.includes("hasuon.or.kr") ? ".hasuon.or.kr" : actualHost;
if (refreshToken) { if (refreshToken) {
cookieStore.set(REFRESH_TOKEN, refreshToken, { cookieStore.set(REFRESH_TOKEN, refreshToken, {
httpOnly: true, httpOnly: true,
sameSite: "lax", sameSite: "strict",
// domain: domain, domain: domain,
path: "/", path: "/",
}); });
} }
+831
View File
@@ -0,0 +1,831 @@
# 표준단어정의서
AI 이해용으로 정리된 표준단어명, 영문약어명, 영문명 목록입니다.
| 표준단어명 | 표준단어 영문약어명 | 표준단어 영문명 |
|-----------|-------------------|----------------|
| BOD | BOD | Biochemical Oxygen Demand |
| C/N비 | CNR | Carbon-Nitrogen Ratio |
| COD | COD | Chemical Oxygen Demand |
| F/M비 | FMR | Food-Microorganism Ratio |
| GISD | GISDATA | Geographic Information System Data |
| HTML | HTML | Hypertext Markup Language |
| ID | ID | Id |
| IP | IP | Internet Protocol |
| KEY | KEY | Key |
| ND | ND | Not Detected |
| NON | NON | Non |
| NTU | NTU | Nephelometry Turbidity Unit |
| OPT | OPT | Opt |
| PAC | PAC | Polyaluminium Chloride |
| PH | PH | Hydrogen Exponent |
| PKI | PKI | Public Key Infrastructure |
| POOL | POOL | Pool |
| SS | SS | Suspended Solids (Ss) |
| TCE | TCE | Trichloroethane |
| TM | TM | Transverse Mercator |
| T-N | TN | Total Nitrogen |
| TOC | TOC | Total Organic Carbon |
| T-P | TP | Total Phosphorus |
| URL | URL | Uniform Resource Locator |
| 가구 | HSHD | Household |
| 가능 | PSBL | Possible |
| 가동 | OPR | Operation |
| 가산 | ADTN | Addition |
| 가성소다 | NAOH | Caustic Soda(Nach) |
| 가축분뇨 | ANMA | Animal Manure |
| 값 | VAL | Value |
| 강도 | IN | Intensity |
| 강우 | RAIN | Rain |
| 개방 | OPN | Opening |
| 개별 | INDIV | Individual |
| 개보수비 | RPAFEE | Repair Fee |
| 개설 | ESTBL | Establishment |
| 개시 | STRT | Start |
| 개정 | RVSN | Revision |
| 개조 | REMDEL | Remodeling |
| 개체 | INDVD | Individual |
| 개체군 | POPU | Population |
| 개폐 | RORGN | Reorganization |
| 갱신 | UPDT | Update |
| 건물 | BLDG | Building |
| 건설 | CONC | Construction |
| 건수 | NOCS | The Number Of Cases |
| 건조 | DRY | Dry |
| 검사 | INSP | Inspection |
| 검사서 | EXRPT | Examination Report |
| 검정 | RCGN | Recognition |
| 검증 | VRFC | Verification |
| 검출 | DETECT | Detection |
| 검토 | RVW | Review |
| 격자 | LATTC | Lattice |
| 결과 | RSLT | Result |
| 결의 | DCIS | Decision |
| 결정 | DCSN | Decision |
| 경계 | BNDRY | Boundary |
| 경과 | PROC | Process |
| 경도 | LOT | Longitude |
| 경보 | ALARM | Alarm |
| 경사판 | ICNTPT | Inclination plate |
| 계 | SUM | Summation |
| 계량기 | MRNR | Measuring Instrument |
| 계량기분리 | METRSPRT | Meter Separation |
| 계면 | SGLV | Sludge Level |
| 계산식 | FMUL | Formula |
| 계약 | CTRT | Contract |
| 계약기간 | CNTRPD | Contract Period |
| 계절 | SEASON | Season |
| 계획 | PLAN | Plan |
| 고도처리 | AWTR | Advanced Water Treatment |
| 고시 | ANCMNT | Announcement |
| 고액분리 | SLSPRT | Solid-Liquid Separation |
| 고형물체류시간 | SRT | Solid Retention Time |
| 공간데이터 | SPCEDATA | Space Data |
| 공공 | PUBLIC | Public |
| 공급 | SPLY | Supply |
| 공기 | AIR | Air |
| 공기여과 | ARFT | Air Filter |
| 공문 | ODOC | Official Documnet |
| 공법 | MSRC | Method Of Construction |
| 공사 | CSTRN | Construction |
| 공사비 | CONSTEXPN | Construction Expenses |
| 공업지역 | MNFTR_ARA | Manufacturing Area |
| 공용면적 | CMAR | Common Area |
| 공통 | CMMN | Commonness |
| 관 | PP | Pipe |
| 관계 | REL | Relation |
| 관련 | RLTN | Relation |
| 관로 | PPLINE | Pipe Line |
| 관리 | MNG | Management |
| 관리기관 | MGC | Management Agency |
| 관리자 | MNGR | Manager |
| 관찰 | WTCH | Watch |
| 관측 | OBSR | Observation |
| 관측소 | OBSRVT | Observatory |
| 교반기 | AGITOR | Agirator |
| 교정 | CRRC | Correction |
| 구간 | SCTN | Section |
| 구동 | DRIVE | Drive |
| 구분 | SE | Section |
| 구성 | CMPSG | Composing |
| 구역 | ZONE | Zone |
| 구조 | STRCT | Structure |
| 권역 | DSTR | District |
| 권한 | AUTH | Authority |
| 규격 | STNDRD | Standard |
| 규모 | SCAL | Scale |
| 규제 | REGL | Regulation |
| 균등 | EQLTY | Equality |
| 금액 | AMT | Amount |
| 급수 | WSP | Water Supply |
| 기간 | WHL | While |
| 기관 | INST | Institution |
| 기록 | RECD | Recording |
| 기록부 | REGI | Register |
| 기밀 | SCRET | Secret |
| 기법 | TECQU | Techniques |
| 기본 | BSIC | Basics |
| 기본정보 | BASINF | Bassinfo |
| 기본키 | PK | Primary Key |
| 기상 | WETHER | Weather |
| 기안 | DRFTG | Drafting |
| 기재 | WRIT | Write |
| 기점 | CDPNT | Cardinal Point |
| 기존 | LGCY | Legacy |
| 기준 | CRTR | Criteria |
| 기타 | ETC | Etc |
| 기한 | TERM | Term |
| 기후 | CLMT | Climate |
| 긴급 | EMRG | Emergency |
| 날개벽 | WW | Wing Wall |
| 날씨 | WETHR | Weather |
| 날짜 | DATE | DATE |
| 남조류 | BLAL | Blue-Green Algae |
| 납 | PB | Plumbum |
| 내려받기 | DWLD | Download |
| 내부반송 | ITNRCC | Internal Recycl |
| 내용 | CN | Content |
| 내용연수 | SVLF | Service Life |
| 냄새 | SMELL | Smell |
| 년 | YY | Year |
| 년간 | FAYR | For A Year |
| 노즐 | NZL | Nozzle |
| 노출 | EXPSR | Exposure |
| 농도 | DNSTY | Density |
| 농축 | TKN | Thickened |
| 누적 | ACML | Accumulate |
| 누출 | LKG | Leakage |
| 눈 | SNW | Snow |
| 단가 | UNPRC | Unit Price |
| 단기 | SRTPD | Short Period |
| 단순 | SIMPL | Simplicity |
| 단위 | UNIT | Unit |
| 대구역 | LZONE | Large Zone |
| 대분류 | LCLAS | Large Classification |
| 대장 | REGSTR | Register |
| 대장균 | COLI | Coliform, Fecal Coliform |
| 대장균군 | COLIB | Coliform Bacteria |
| 대지면적 | SIAR | Site Area |
| 대체 | RPLC | Replace |
| 덮개 | COVR | Cover |
| 데이타 | DAT | Data |
| 도구 | UNT | Unit |
| 도래 | ADVNT | Advent |
| 도로 | ROAD | Road |
| 도로명 | RN | Road Name |
| 도시 | CTY | City |
| 도엽 | MAPDMC | Map Demarcation |
| 도표 | CHART | Chart |
| 독성 | TOXCTY | Toxicity |
| 동의 | AGRE | Agreement |
| 동절기 | WSESN | The Winter Season |
| 등급 | GRD | Grade |
| 등기 | RG | Registered |
| 등록 | REG | Registration |
| 디바이스 | DVICE | Device |
| 디코딩 | DCD | Decoding |
| 레이어 | LYR | Layer |
| 로그인 | LGN | Login |
| 로우 | ROW | Row |
| 마감 | DDLN | Deadline |
| 마이크로필터 | MCRFT | Micro Filter |
| 막 | MBRN | Membrane |
| 만족도 | STFDG | Satisfaction Degree |
| 맑음 | CLAR | Clear |
| 매각 | SAL | Sale |
| 맨홀 | MH | Manhole |
| 맵 | MAP | Map |
| 메인 | MAIN | Main |
| 메일 | EMAIL | Email |
| 메탄올 | MTN | Methanol(CH3OH) |
| 명 | NM | Name |
| 모니터링 | MTRG | Monitoring |
| 모델 | MODL | Model |
| 모델링 | MODLNG | Modeling |
| 모래 | SAND | Sand |
| 목 | MOK | Mok |
| 무산소 | ANX | Anoxic |
| 무산소조 | ANX_TANK | Anoxic Tank |
| 무인센서 | MNLSENSR | Manless Sensor |
| 문서 | DCMT | Document |
| 물 | WTR | Water |
| 미급수 | NONWTRSPL | Non Water Supply |
| 미생물 | BLGC | Biological |
| 미세먼지 | PM | Particulate Matter |
| 미세목 | MCRB | Micro Bar |
| 민간위탁 | ETSVN | Entrustment To Civilian |
| 민감 | SST | Sensitive |
| 민원 | CVLCPT | Civil Complaint |
| 바이러스 | VIRS | Virus |
| 반기 | HT | Half Term |
| 반류수 | SIDSWT | Side Stream Water |
| 반송 | SNDBK | Send Back |
| 반송수 | RCCWT | Recycled Water |
| 반송슬러지 | RTNSLG | Return Sludge |
| 반영 | RFLT | Reflection |
| 반응조 | RETNK | Reactant Tank |
| 반출 | EXPRT | Export |
| 반토 | ALUM | Alumina |
| 반환 | GVBK | Giving Back |
| 받이 | INL | Inlet |
| 발생 | OCRN | Occurrence |
| 발전 | PWGNRT | Power Generation |
| 발주기관 | ORNT | Order Institution |
| 방류 | DCWTR | Discharge Water Stock Etc |
| 방류구 | DSCHG | Discharge |
| 방류수 | EFLEC | Effluence |
| 방문 | VST | Visit |
| 방문자 | VSTR | Visitor |
| 방법 | MTHD | Method |
| 방사 | RLSE | Release |
| 배관 | PLINE | Pipeline |
| 배분 | DSTRB | Distirbution |
| 배설물 | EXCRTN | Excretion |
| 배수 | DRNG | Drainage |
| 배수구역 | DRANGZN | Drainage Zone |
| 배출 | EXHST | Exhaust |
| 배출가스 | EMGA | Emission Gases |
| 배출구 | VENT | Vent |
| 배출시설 | DHGP | Discharge Equipment |
| 배출시험 | EXHTST | Exhaust Test |
| 배출자 | DCHGR | Discharge Person |
| 밸브 | VALVE | Valve |
| 번호 | NO | Number |
| 법 | LAW | Law |
| 법적 | LGL | Legal |
| 법정 | STTY | Statutory |
| 법정동 | STDG | Statutory Dong(Administrative District) |
| 법정리 | STLI | Statutory Li(Administrative District) |
| 변경 | CHG | Change |
| 변동 | FLCTN | Fluctuation |
| 변속기 | TRMIS | Transmission |
| 보고 | RPT | Report |
| 보고서 | RPOT | Report |
| 보관 | STORG | Storage |
| 보수 | MEND | Mend |
| 보유 | HOLD | Hold |
| 보정 | RVSION | Revision |
| 보조 | ASSISC | Assistance |
| 보조금 | SBSIDY | Subsidy |
| 복개 | COVE | Cover |
| 복토 | CWTH | Covering With Soil |
| 본류 | MI_RV | Main River |
| 본번 | MNO | Main Number |
| 부검 | ATPSY | Autopsy |
| 부과 | LEVY | Levy |
| 부과금 | LVYAMT | Levy Amount |
| 부기 | BUKIP | Bookkeeping |
| 부담금 | ALOTM | Allotment |
| 부번 | SNO | Sub Number |
| 부산물 | BYPRD | By-Product |
| 부서 | DEPT | Department |
| 부숙화 | DECPZ | Decomposed ~Ize |
| 부적합 | IMPPRTY | Impropriety |
| 부착 | ASN | Adhesion |
| 부품 | CMPNT | Components |
| 부하량 | LOADQTY | Load Quantity |
| 분과 | DIVSN | Division |
| 분뇨 | ENSO | Excreta, Night Soil |
| 분류 | CL | Classification |
| 분류군 | TAXON | Taxon |
| 분리막 | SPRTMBR | Separation Membrane |
| 분배 | DTRBT | Distribution |
| 분배조 | DTRBT_TANK | Distribution Tank |
| 분야 | RLM | Realm |
| 분원성 | FECL | Fecal |
| 분원성대장균군 | FCOLI | Fecal Coliform |
| 분원성연쇄상구균 | FCSTRCCI | Fecal Streptococci |
| 분할 | PRTIN | Partition |
| 비밀번호 | PSWD | Password |
| 비상 | EMGNY | Emergency |
| 비정상 | ABNRM | Abnormality |
| 사양 | SPECS | Specification |
| 사업비 | WCT | Working Cost |
| 사업장 | BPLC | Business Place |
| 사여과지 | SAND_ FILTR | Sand Filter |
| 사용 | USE | Use |
| 사용가능 | USABLE | Usable |
| 사용권 | RIOUS | Right Of Using |
| 사용량 | USG | USAGE |
| 사용자 | USER | User |
| 사위 | FDG | Four Directions Girth |
| 사유 | RESN | Reason |
| 사이클 | CYCLE | Cycle |
| 사이트 | SITE | Site |
| 사진 | PHOT | Photograph |
| 사항 | MATTR | Matter |
| 사후 | AFTFAT | After Fact |
| 삭제 | DEL | Deletion |
| 산기관 | DFS | Diffuser |
| 산업 | INDUST | Industrial |
| 산화환원전위 | ORP | Oxidation Reduction Potential |
| 살모넬라 | SLMN | Salmonella |
| 삼원촉매장치 | TWCTLC | Three Way Catalytic Converter |
| 상세 | DTL | Details |
| 상세주소 | DADDR | Detailed Address |
| 상수 | WT | Water |
| 상업지역 | CMCL_ARA | Commercial Area |
| 상태 | STUS | Status |
| 상품 | GDS | Goods |
| 상향류 | UFW | Upflow |
| 상호 | CONM | Company Name |
| 색도 | CRMTY | Chromaticity |
| 생략 | OMS | Omission |
| 생물 | LVB | Living Being |
| 생물반응조 | BIRAT | Bioreactor |
| 생물서식처 | ORGNHBT | Organism Habitat |
| 생물종 | BISP | Biological Species |
| 생성 | CRT | Creation |
| 생슬러지 | RSLG | Raw Sludge |
| 생태 | ECLGY | Ecology |
| 생태독성 | ECTOX | ecotoxicity |
| 서류 | PAPE | Papers |
| 서명 | SIGN | Signing |
| 서버 | SRVR | Server |
| 서비스 | SRVC | Service |
| 설계 | DESGN | Design |
| 설계용량 | DESGN_CPCT | Design Capacity |
| 설립 | FNDN | Foundation |
| 설정 | STNG | Setting |
| 설치 | INSTL | Installation |
| 성격 | CHTR | Character |
| 성공 | SCS | Success |
| 성능 | PRFMNC | Performance |
| 성능검사 | EFTST | Efficiency Test |
| 성적서 | SCRRP | Score Report |
| 세균 | BCLS | Bacillus |
| 세목 | FB | Fine bar |
| 세부 | DETAIL | Detail |
| 세정 | WS | Washing |
| 세정제 | CNML | Cleaning Material |
| 소 | SML | Small |
| 소독 | DSNF | Disinfection |
| 소독제 | DSINF | Disinfectant |
| 소분류 | SCLAS | Small Classification |
| 소수점 | DCPT | Decimal Point |
| 소요 | REQ | Required |
| 소유 | OWN | Own |
| 소유역 | SBASIN | Sub Basin |
| 소재지 | PLAC | Place Of Location |
| 소포 | ATFM | Antifoaming |
| 소포수 | FBW | Foam Breaking Water |
| 소포제 | ANAG | Antifoaming Agent |
| 송부 | SENDNG | Sending |
| 송신 | SNDM | Send Message |
| 송풍기 | BLW | Blower |
| 수 | CNT | Count |
| 수거 | TKAWY | Take Away |
| 수계 | WWBH | Watershed, Water Basin, Hydrosphere |
| 수동 | HOPR | Hand Operation |
| 수리학적 체류시간 | HRT | Hydraulic Retention Time |
| 수문 | Gate | Gate |
| 수산화나트륨 | SOHY | Sodium Hydroxide |
| 수소이온 | HION | Hydrogen Ion |
| 수신 | RCPTN | Reception |
| 수용가 | RCPTR | Receptor |
| 수위 | WAL | Water Level |
| 수정 | MDFCN | Modification |
| 수정자 | MDFR | Modifier |
| 수제 | SPRDIKE | Superdike |
| 수조 | Tank | Tank |
| 수질 | QTWT | Quality Of Water |
| 수질개선 | WTRQLIMP | Water Quality Improvement |
| 수질기준 | WQST | Water Quality Standards |
| 수질배출정보 | WTDI | Water Discharge Information |
| 수집 | CLCT | Collection |
| 순환 | CCL | Cycling |
| 쉬겔라 | SHIGLA | Shigella |
| 스컴 | SCM | Scum |
| 스크린 | SCR | Screen |
| 슬러지 | SLG | Sludge |
| 슬러지 밀도지수 | SDI | sludge density index |
| 슬러지 용량 지표 | SVI | Sludge Volume Index |
| 습지 | WTLN | Wetland |
| 승인 | APRV | Approval |
| 승인권 | APPRVRGT | Right Of Approval |
| 시각 | TIME | Time |
| 시간 | HR | Hour |
| 시군구 | SGG | Si/Gun/Gu |
| 시나리오 | SCEN | Scenario |
| 시도 | CTPV | Cities And Provinces |
| 시료 | SMPL | Sample |
| 시설 | FCLT | Facility |
| 시설면적 | FCAR | Facility Area |
| 시설물 | FCLTS | Facilities |
| 시스템 | SYS | System |
| 시안 | CYN | Cyaan |
| 시운전 | TSTRN | Test Run |
| 시작 | BGNG | Beginning |
| 시점 | PTM | Point Time |
| 시행 | ENFC | Enforcement |
| 시험 | TEST | Test |
| 신고 | DCLR | Declaration |
| 신고자 | DCL | Declarer |
| 신규 | NEW | New |
| 신기술 | NTCH | New Technology |
| 신뢰 | CNFDNC | Confidence |
| 신뢰성 | CRDIBLTY | Credibility |
| 실시 | OPRT | Operation |
| 실적 | ACRS | Actual Result |
| 실행 | EXCN | Execution |
| 심사 | SRNG | Screening |
| 심의 | DLBR | Deliberation |
| 아황산환원혐기성포자형성균 | SFSRA | Spore Forming Sulfite Reducing Anaerobes |
| 안정화 | STBLZT | Stabilization |
| 암롤박스(컨테이너) | ARTCT | Arm roll type container |
| 암모니아성질소 | NHN | Ammonia Nitrogen |
| 압력 | PRESSR | Pressure |
| 압송 | PUMPNG | Pumping |
| 압축 | CMPRS | Compress |
| 액비 | LQFERTLZ | Liquid Fertilizer |
| 액상 | LIQD | Liquid |
| 약 | GENTLE | Gentle |
| 약품 | CMC | Chemical |
| 약품비 | MEDFEE | Medicine Fee |
| 약품사용 | USMD | Use Medicines |
| 업로드 | UPLD | Upload |
| 업무 | DTY | Duty |
| 없음 | NOT | Nothing |
| 에너지 | ENR | Energy |
| 에틸벤젠 | ETBNZN | Ethylbenzene |
| 여과 | FILTR | Filteration |
| 여과수 | FTWT | Filtered Water |
| 여과재 | FTMTRL | Filter Material |
| 여과형 | FILTRFOM | Filter Form |
| 여부 | YN | Yes or No |
| 여시니아균 | YERSNA | Yersinia |
| 역률 | PWRER_FCT | Power Factor |
| 역세척 | BWS | Back Wash |
| 연결 | CONN | Connection |
| 연계 | LINK | Link |
| 연도 | YR | Year |
| 연락 | CNTC | Contact |
| 연령 | AGE | Age |
| 연료화 | FUELZ | Fuelize |
| 연월 | YM | Year and Month |
| 염소 | CLRN | Chlorine |
| 염소소독 | CHDI | Chlorine Disinfection |
| 염소이온 | CLION | Chlorine Ion |
| 염화제이철 | IRCLD | Iron(III) Chloride |
| 예보 | FRCST | Forecast |
| 예비 | PRPT | Preparation |
| 예산 | BGT | Budget |
| 예상 | EXPCT | Expectation |
| 예약 | RSVT | Reservation |
| 예외 | EXCPT | Exception |
| 예정 | PRNG | Prearrangement |
| 예찰 | PRDICT | Prediction |
| 오류 | ERR | Error |
| 오수받이 | HUS_INL | House Inlet |
| 오염물질 | CNTMN | Contaminant |
| 오염원 | POLUSRC | Pollution Source |
| 오존 | OZN | Ozone |
| 오프로드 | OFFRD | Off Road |
| 옥살산 | OXACID | Oxalic Acid |
| 와류 | VORTEX | Vortex |
| 와류형 | VORTXFOM | Vortex From |
| 완결 | COMPLT | Completion |
| 완료 | CMPTN | Completion |
| 완전 | PRFECT | Perfection |
| 요건 | REQSIT | Requisite |
| 요막액 | ALLNTFLD | Allantoic Fluid |
| 요청 | DMND | Demand |
| 용량 | CPCT | Capacity |
| 용역 | SERVC | Service |
| 용존산소 | DO | Dissolved Oxygen |
| 용해 | DSLV | Dissolving |
| 우량 | EXLT | Excellent |
| 우수 | ST | Storm |
| 우수받이 | STRT_INL | Street Inlet |
| 우수토구 | STM_OVFL_MUT | Storm Overflow Mouth |
| 우회 | BP | BY PASS |
| 운반 | CNVY | Conveyance |
| 운영 | OPER | Operation |
| 운영비 | OPEXP | Operation Expense |
| 운행 | OPRAT | Operation |
| 원격 | RMRT | Rmrt |
| 원격감시체계 | TMS | Tele Monitoring System |
| 원료 | MTRAL | Material |
| 원수 | ORGWT | Origin'S Water |
| 원인자 | ORGPR | The Origin Person |
| 월 | MM | Month |
| 위도 | LAT | Latitude |
| 위반 | CNTR | Contravene |
| 위촉 | ENTRST | Entrusting |
| 위치 | LOC | Location |
| 위탁 | CNSG | Consign |
| 위탁자 | CONSGNR | Consignor |
| 유기인 | ORGP | Organic Phosphorus |
| 유량 | FLUX | Flux |
| 유량조정조 | EQLZT__TANK | Equalization Tank |
| 유입 | INFlOW | Inflow |
| 유입수 | INFWTR | Influent Water |
| 유주 | SWARMG | Swarming |
| 유지 | MNTNC | Maintenance |
| 유지용수공급 | MWRS | Maintenance Water Requirement Supply |
| 유체 | FLUID | Fluid |
| 유출 | EFFLUX | Efflux |
| 유충 | LAVL | Larval |
| 유형 | TY | Type |
| 유효 | VLD | Validity |
| 음용 | DKPS | For Drinking Purpose |
| 읍면동 | EMD | Eup/Myun/Dong |
| 응답 | RSPNS | Response |
| 응집제 | COAG | Cohesive Agents |
| 이관 | TRNSF | Transfer |
| 이동 | MVMN | Movement |
| 이력 | HST | History |
| 이메일 | EML | Email |
| 이상 | ABOVE | Above |
| 이송 | TRSF | Transfer |
| 이의 | OBJC | Objection |
| 이차 | SCDR | Secondary |
| 이차침전지 | SCDR_SDMT_TANK | Secondary Sedimaentation |
| 이행 | MIG | Migratation |
| 인건비 | PEXP | Personnel Expenses{Expenditure] |
| 인계 | HNDVR | Handover |
| 인계서 | HDOVDC | Handover Document |
| 인구 | POPL | Population |
| 인산 | PHACID | Phosphoric Acid |
| 인산염인 | POP | phosphate |
| 인양기 | LFT | Lifter |
| 인원수 | NOPE | The Number of Persons |
| 인증 | CERT | Certification |
| 인처리 | PPRCS | Phosphorus Process |
| 인허가 | APVL | Approval |
| 일 | DY | Day |
| 일련번호 | SN | Serial Number |
| 일반 | GNRL | General |
| 일별 | DALY | Daily |
| 일시 | DT | Date and Time |
| 일자 | YMD | YEAR Month Day |
| 일지 | DIARY | Diary |
| 일차 | PRM | Primary |
| 일차침전지 | PST_SDMT_TANK | Primary Sedimentation Tank |
| 일평균 | DYRG | Day Average |
| 임시 | TMPR | Temporary |
| 임의 | RNDM | Random |
| 입고 | WRHS | Warehousing |
| 입력 | INPT | Input |
| 잉여 | SPS | Surplus |
| 잉여슬러지 | EC_SLG | Excess Sludge |
| 자 | MAN | Man |
| 자갈 | GRAVEL | Gravel |
| 자료 | DATA | Data |
| 자리 | DIGIT | Digit |
| 자립화 | SLFRLI | Self Reliance |
| 자연형 | NATRLFOM | Natural Form |
| 자외선 | URLI | Ultraviolet Rays, Light |
| 자재 | MTRIL | Material |
| 자체 | ITSL | Itself |
| 작성 | WRT | Writing |
| 작업 | JOB | Job |
| 잠금 | LOCK | Lock |
| 장기 | LNGTR | Long Term |
| 장소 | PLCE | Place |
| 장착 | MNTNG | Mounting |
| 재 | RE | Re |
| 재이용 | REUSE | Reuse |
| 재이용수 | | Reuse Water |
| 재활용 | RUSE | Reuse |
| 저감 | REDUC | Reduction |
| 저류조 | DTT_TANK | Detention Tank |
| 저온 | LOWTMP | Low Temperature |
| 저장 | STRG | Storage |
| 저장소 | STORGE | Storage |
| 적발 | DSCL | Disclose |
| 적산 | ADD | Addition |
| 적용 | APLCN | Application |
| 적합 | STBLT | Suitability |
| 전기 | ELCTY | Electricity |
| 전기료 | ELFEE | Electricity Fee |
| 전력 | PWRER | Power |
| 전문 | SPCY | Specially |
| 전산 | CMPUTT | Computation |
| 전송 | TRSM | Transmission |
| 전압 | VLTGE | Voltage |
| 전용 | EXUSE | Exclusive Use |
| 전원 | SELCT | Source Of Electricity |
| 전처리 | PRETR | Pretreatment |
| 점검 | CHCK | Check |
| 접속 | CNTN | Connection |
| 정밀 | PRCIS | Precision |
| 정보 | INFO | Information |
| 정산 | CLCLN | Calculation |
| 정상 | NRMLT | Normality |
| 정수장 | WPPW | Water Purification Plant, Waterworks |
| 정제 | REFINE | Refining |
| 정지 | STP | Stop |
| 제거 | RMV | Removal |
| 제수변 | SL_VALVE | Sluice Valve |
| 제작 | MNFCT | Manufacture |
| 제조사 | MKR | Maker |
| 제출 | SBMSN | Submission |
| 제한 | LIMT | Limitation |
| 조류 | ALG | Algae |
| 조목 | CSB | Coarse Bar |
| 조사 | EXMN | Examination |
| 조성 | MAKE | Make |
| 조정 | EQLT | Equalization |
| 조치 | ACTN | Action |
| 조회 | INQ | Inquiry |
| 존재 | EXST | Existence |
| 종결 | TRMN | Termination |
| 종균제 | MICBA | Microbial Agent |
| 종료 | END | End |
| 종류 | KND | Kind |
| 종목 | IEM | Item |
| 종별 | ASORT | Assortment |
| 종사자 | ENFSN | Enfilade Person |
| 종점 | TMNL | Terminal |
| 좌표 | COOR | Coordinate |
| 주간 | WIK | Week |
| 주변 | CFR | Circumference |
| 주소 | ADDR | Address |
| 주입 | IJTN | Injection |
| 주파수 | FQNC | Frequency |
| 준공 | CMCN | Completion Of Construction |
| 중권역 | MDSTRC | Medium District |
| 중복 | DPCN | Duplication |
| 중분류 | MLSFC | Middle Classification |
| 중온 | MESPH | Mesophilic |
| 중첩 | RETRTN | Reiteration |
| 중화설비 | NUTEQP | Neutralization Equipment |
| 중화제 | CNTAG | Counteragent |
| 증가 | INCRS | Increase |
| 지도점검표사본 | CITBMR | Copy of Instruction Checklist |
| 지방자치단체 | LGOV | Local Governments |
| 지번 | LOTNO | Lot Number |
| 지상 | GRND | Ground |
| 지역 | ARA | Area |
| 지질 | NTRFS | Nature Of Soil |
| 지질도 | GEOMAP | Geological Map |
| 지하 | UDGD | Underground |
| 지하수 | GROU | Groundwater |
| 지형 | TPGRPH | Topography |
| 진공 | VCM | Vacuum |
| 진단 | DGNSS | Diagnosis |
| 진동 | VIBRAT | Vibration |
| 진행 | PRGRE | Progress |
| 질산 | NIACID | Nitric Acid. |
| 질산성질소 | NO3N | Nitrate Nitrogen |
| 집계 | TOT | Total |
| 집계구 | SUMDST | Summation District |
| 집행 | IMPL | Implementation |
| 찌꺼기 | LEES | Lees |
| 차아염소산 | NAOCL | Hypochlorous Acid |
| 차집 | ITCT | Intercepting |
| 착공 | BGNCST | Begin Construction |
| 채수 | SAMWT | Sampling Of Water |
| 채수기 | WTRSMPLR | Water Sampler |
| 채수병 | WTRBOTL | Water Bottle |
| 처리 | PRCS | Process |
| 처리비 | PSSFEE | Process Fee |
| 처리수 | TRT_WT | Treated Water |
| 처리수조 | TRT_WT_TANK | Treated Water Tank |
| 처리시설 | TRTMTFCLT | Treatment Facility |
| 처리자 | PRCR | Processor |
| 처분 | DSPS | Disposition |
| 철염 | FESLT | Ferric Salt |
| 첨부 | ATCH | Attachment |
| 첨부파일 | ATFI | Attachment File |
| 초과 | EXCS | Excess |
| 초기화 | INITL | Initialization |
| 촉매 | CTLY | Catalyst |
| 총계 | TSM | Summation |
| 총대장균군 | TCOLFGRP | Total Coliform Group |
| 총량 | TQT | Total Quantity |
| 총면적 | GFA | Gross Floor Area |
| 총사업비 | TPCO | Total Project Cost |
| 총인구 | TPOPLTN | Total Population |
| 총인처리시설 | TPFCT | Total Phosphorus facility |
| 최근 | RCNT | Recent |
| 최대값 | MAXV | Maximum Value |
| 최소값 | MINV | Minimum Value |
| 최적 | BMTB | Being The Most Suitable |
| 최종 | LAST | Last |
| 최초 | FRST | First |
| 추출 | EXTR | Extraction |
| 추출정보 | EXTRINFO | Extraction Information |
| 축 | AXS | Axis |
| 출력 | OTPT | Output |
| 출발 | LVE | Leave |
| 충전기 | CHRGR | Charger |
| 취득 | ACQS | Acquisition |
| 취소 | RTRCN | Retraction |
| 측정 | MSUR | Measurement |
| 측정기 | MSRR | Measurement Instrument |
| 측정소 | MSRSTN | Measurement Station |
| 침사지 | GTCB | Grit Chamber |
| 침전 | SDMT | Sediment |
| 침전지 | SDMT_TANK | sedimentation tank |
| 컨베이어 | CVY | Conveyor |
| 컬럼 | COL | Column |
| 코드 | CD | Code |
| 크기 | SZ | Size |
| 크실렌 | XYLEN | Xylene |
| 탄화 | CARB | Carbonization |
| 탈거 | CRYOFF | Carry Off |
| 탈리액 | SPNT | Supernatant |
| 탈수 | DWTR | Dewatering |
| 탈수기 | DEHYM | Dehydration Machine |
| 탈질 | DNTFCT | Denitrificatio |
| 탈취 | DODRZ | Deodorization |
| 탈취기 | DEODRZ | Deodorizer |
| 탈취제 | DEODR | Deodorant |
| 탈황제 | DSLFA | Desulfurizing Agent |
| 터널형 | YUNLTP | Tunnel Type |
| 테이블 | TBL | Table |
| 토구 | OTFL | Outfall |
| 토지 | LAD | Land |
| 토지면적 | LDAR | Land Area |
| 통계 | STATS | Statistics |
| 통보 | NTFCTN | Notification |
| 통신 | COMM | Communication |
| 통지 | AVTSMT | Avertissement |
| 통합 | UNTY | Unity |
| 특성 | CHRT | Character |
| 특수 | SPECL | Special |
| 특정유해물질 | SHCH | Specified Hazardous Chemicals |
| 파일 | FILE | File |
| 판정 | JGMT | Judgement |
| 펌프 | PUMP | Pump |
| 펌프장 | PUMP_STT | Pump Station |
| 페놀 | PHNL | Phenol |
| 평가 | EVL | Evaluation |
| 폐기 | DSCD | Discard |
| 폐기물 | WSTE | Waste |
| 폐쇄 | CLSG | Closing |
| 폐수 | WAWA | Waste Water |
| 폐수처리 | WSWT | Wastewater Treatment |
| 폐열 | WASTHET | Waste Heat |
| 포기 | ARTN | Aeration |
| 포트 | PORT | Port |
| 폭기조 | ARTN_TANK | Aeration Tank |
| 폴리머 | PLYMR | Polymer |
| 폴리철 | FRRCSU | Ferric Sulfate |
| 표고 | AL | Altitude |
| 표기 | MARK | Mark |
| 표시 | INDCT | Indication |
| 표준 | STD | Standard |
| 표출 | EPRSS | Expression |
| 플래그 | FLAG | Flag |
| 필드 | FILD | Field |
| 필수 | ESNTL | Essential |
| 필증 | CERFIN | Certificate Of Finishing |
| 필터 | FLTER | Filter |
| 하수 | SWGE | Sewage |
| 하수도 | DRNGSYS | Drainage System |
| 하수미처리 | SEWGUNTTM | Un Sewage Treatment |
| 하수처리 | SEWGTRTM | Sewage Treatment |
| 하수처리수 | STWTR | Sewage Treatment Water |
| 하위 | LOWR | Lower |
| 하향류 | DWFW | Downflow |
| 할인 | DSCNT | Discount |
| 함수율 | MISTR_CTNT | Moisture content |
| 합계 | SMM | Summation |
| 해당 | RLVT | Relevant |
| 해석 | INTRPRTT | Interpretation |
| 해양투기 | OCDU | Ocean Dumping |
| 행망 | ADMNW | Administration Network |
| 행정 | ADMN | Administration |
| 행정구역 | ADMI | Administrative District |
| 행정동 | DONG | Dong (Administrative District) |
| 허가 | PRMSN | Permission |
| 허용 | PERM | Permission |
| 현상 | PHNMN | Phenomenon |
| 혐기 | AARB | Anaerobic |
| 혐기조 | AARB_TANK | Anaerobic tank |
| 협잡물 | CCMT | Concomitant |
| 형태 | SHAP | Shape |
| 호기 | ARB | Aerobic |
| 호기조 | ARB_TANK | Aerobic Tank |
| 호소수 | LMSHWT | Lake And Marsh Water |
| 호수 | LKE | Lake |
| 호안 | RVTMNT | Revetment |
| 호이스트 | HIST | Hoist |
| 혼합 | CMPN | Compound |
| 혼합액현탁고형물 | MLSS | Mixed liquor suspended solids |
| 혼화지 | MXG_TNAK | Mixing tank |
| 홈페이지 | HMPG | Homepage |
| 홍수 | FLOOD | Flood |
| 확인 | IDNTY | Identify |
| 확인서 | CNFRMN | Confirmation |
| 확인자 | IDFR | Identifier |
| 확장자 | EXTN | Extension |
| 확정 | CFMTN | Confirmation |
| 환경 | ENVR | Environment |
| 환경기초시설 | ENINF | Environmental Infrastructure |
| 환원 | RSTORE | Restoration |
| 활성탄 | AC | Activated Carbon |
| 활성화 | PRMT | Promote/Facilitate |
| 활용 | PRUS | Practical Use |
| 황산 | ECCBT | Encyclopaedia Britannica (H2So4) |
| 회사 | CO | Company |
| 회수 | RTRVL | Retrieval |
| 회신 | RPLY | Reply |
| 효율 | EFC | Efficiency |
| 효율성 | EFFCTV | Effectiveness |
| 휴대 | MBL | Mobile |
| 흡수정 | EXTTW | Extraction Well |
| 흡착 | ADST | Adsorption |
@@ -1,6 +1,6 @@
"use client"; "use client";
import { useState } from "react"; import { useEffect, useState } from "react";
import { import {
keepPreviousData, keepPreviousData,
useQuery, useQuery,
@@ -75,7 +75,7 @@ function AddAdminDialog() {
}); });
const query = useQuery({ const query = useQuery({
queryKey: [ENDPOINT.USER_SERVICE.USERS, pagination, "normal-user"], queryKey: [ENDPOINT.USER_SERVICE.USERS, "findPageUser", pagination],
queryFn: () => queryFn: () =>
UserApi.findPageUser({ UserApi.findPageUser({
...userSearchQuery, ...userSearchQuery,
@@ -181,6 +181,21 @@ function AddAdminDialog() {
query.refetch(); query.refetch();
}; };
useEffect(() => {
if (!open) {
setRowSelection({});
setSelectedGroupId("");
setUserSearchQuery({
keywordType: "userName",
keyword: "",
});
setPagination({ pageIndex: 0, pageSize: 10 });
queryClient.removeQueries({
queryKey: [ENDPOINT.USER_SERVICE.USERS, "findPageUser"],
});
}
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={setOpen}> <Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild> <DialogTrigger asChild>
@@ -1,53 +1,22 @@
// import { client } from "@/shared/api"; import { client } from "@/shared/api";
// import { ENDPOINT } from "@/shared/config"; import { ENDPOINT } from "@/shared/config";
import { import {
type BoardStatisticsParams, type BoardStatisticsParams,
type BoardStatistics, type BoardStatistics,
type BoardStatisticsService, type BoardStatisticsService,
} from "../model/board-statistics-interface"; } from "../model/board-statistics-interface";
// 임시 모의 데이터
const mockBoardStatisticsData: BoardStatistics = {
totalPosts: 2456,
totalComments: 156,
averageRating: 4.2,
totalViews: 45678,
dayList: [
{ date: "1월", posts: 10, comments: 5, views: 800 },
{ date: "2월", posts: 15, comments: 8, views: 1200 },
{ date: "3월", posts: 12, comments: 10, views: 1000 },
{ date: "4월", posts: 18, comments: 15, views: 1500 },
{ date: "5월", posts: 22, comments: 20, views: 1800 },
{ date: "6월", posts: 20, comments: 18, views: 1600 },
{ date: "7월", posts: 25, comments: 22, views: 2000 },
],
boardList: [
{ boardType: "notice", boardName: "공지사항", count: 45 },
{ boardType: "faq", boardName: "FAQ", count: 120 },
{ boardType: "qna", boardName: "Q&A", count: 180 },
{ boardType: "free", boardName: "자유게시판", count: 95 },
],
statusList: [
{ status: "completed", statusName: "답변완료", count: 75 },
{ status: "waiting", statusName: "답변대기", count: 25 },
],
};
class BoardStatisticsApiService implements BoardStatisticsService { class BoardStatisticsApiService implements BoardStatisticsService {
async getBoardStatistics( async getBoardStatistics(
params: BoardStatisticsParams, params: BoardStatisticsParams,
): Promise<BoardStatistics> { ): Promise<BoardStatistics> {
console.log("params: ", params);
try { try {
// 실제 API 연동 시 아래 코드 사용 // 실제 API 연동 시 아래 코드 사용
// const response = await client.get<BoardStatistics>( const response = await client.get<BoardStatistics>(
// `${ENDPOINT.CMS_SERVICE.BOARD_STATISTICS}`, `${ENDPOINT.BOARD_SERVICE.STATISTICS}`,
// { params }, { params },
// ); );
// return response.data; return response.data;
// 임시 모의 데이터 반환
return Promise.resolve(mockBoardStatisticsData);
} catch (error) { } catch (error) {
console.error("게시판 통계 데이터 조회 실패:", error); console.error("게시판 통계 데이터 조회 실패:", error);
throw error; throw error;
@@ -12,32 +12,36 @@ export interface BoardStatisticsParams extends PageableParams {
} }
export interface BoardStatistics { export interface BoardStatistics {
totalPosts: number; bbsTotalDto: BbsTotalDto; // 게시판 전체 통계
totalComments: number; pstAnsList: PstAnswerStatistics[]; // 게시물 답변 상태별 통계 목록
averageRating: number; bbsDailyList: BbsDailyStatistics[]; // 게시판 일별 통계 목록
totalViews: number; bbsPstCntList: BbsPostCountStatistics[]; // 게시판별 게시물 건수 통계 목록
dayList: DayStatistics[];
boardList: BoardTypeStatistics[];
statusList: StatusStatistics[];
} }
interface DayStatistics { interface BbsTotalDto {
date: string; pstInqCnt: number; // 게시물 조회 건수
posts: number; pstEvlAvg: number; // 게시물 평가 평균
comments: number; pstTotCnt: number; // 게시물 총 건수
views: number; pstAnsWaitCnt: number; // 게시물 답변 대기 건수
} }
interface BoardTypeStatistics { interface PstAnswerStatistics {
boardType: string; answerNm: string; // 답변 명
boardName: string; answerYn: string; // 답변 여부 (Y/N)
count: number; ansCnt: number; // 답변 건수
} }
interface StatusStatistics { interface BbsDailyStatistics {
status: string; dayYmd: string; // 일자 (YYYY-MM-DD)
statusName: string; pstInqCnt: number; // 게시물 조회 건수
count: number; pstCmntCnt: number; // 게시물 댓글 건수
pstNewCnt: number; // 게시물 신규 건수
}
interface BbsPostCountStatistics {
bbsId: number; // 게시판 ID
bbsNm: string; // 게시판 명
pstCnt: number; // 게시물 건수
} }
export interface BoardStatisticsService { export interface BoardStatisticsService {
@@ -11,20 +11,20 @@ export const chartData = {
} => { } => {
return { return {
data: { data: {
labels: data.dayList.map((item) => item.date), labels: data.bbsDailyList.map((item) => item.dayYmd),
datasets: [ datasets: [
{ {
type: "line", type: "line",
label: "신규게시물", label: "신규게시물",
data: data.dayList.map((item) => item.posts), data: data.bbsDailyList.map((item) => item.pstNewCnt),
borderColor: getCssVariableValue("--chart-1"), borderColor: getCssVariableValue("--chart-1"),
backgroundColor: "rgba(59, 130, 246, 0.1)", backgroundColor: "rgba(59, 130, 246, 0.1)",
tension: 0.4, tension: 0.4,
}, },
{ {
type: "line", type: "line",
label: "답변대기", label: "댓글수",
data: data.dayList.map((item) => item.comments), data: data.bbsDailyList.map((item) => item.pstCmntCnt),
borderColor: getCssVariableValue("--chart-2"), borderColor: getCssVariableValue("--chart-2"),
backgroundColor: "rgba(236, 72, 153, 0.1)", backgroundColor: "rgba(236, 72, 153, 0.1)",
tension: 0.4, tension: 0.4,
@@ -32,11 +32,10 @@ export const chartData = {
{ {
type: "line", type: "line",
label: "조회수", label: "조회수",
data: data.dayList.map((item) => item.views), data: data.bbsDailyList.map((item) => item.pstInqCnt),
borderColor: getCssVariableValue("--chart-3"), borderColor: getCssVariableValue("--chart-3"),
backgroundColor: "rgba(168, 85, 247, 0.1)", backgroundColor: "rgba(168, 85, 247, 0.1)",
tension: 0.4, tension: 0.4,
hidden: true,
}, },
], ],
}, },
@@ -67,13 +66,13 @@ export const chartData = {
} => { } => {
return { return {
data: { data: {
labels: data.boardList.map((item) => item.boardName), labels: data.bbsPstCntList.map((item) => item.bbsNm),
datasets: [ datasets: [
{ {
type: "bar", type: "bar",
label: "게시판별 분포", label: "게시판별 분포",
data: data.boardList.map((item) => item.count), data: data.bbsPstCntList.map((item) => item.pstCnt),
backgroundColor: data.boardList.map((_, index) => backgroundColor: data.bbsPstCntList.map((_, index) =>
getCssVariableValue(`--chart-${(index % 5) + 1}`), getCssVariableValue(`--chart-${(index % 5) + 1}`),
), ),
}, },
@@ -106,12 +105,12 @@ export const chartData = {
} => { } => {
return { return {
data: { data: {
labels: data.statusList.map((item) => item.statusName), labels: data.pstAnsList.map((item) => item.answerNm),
datasets: [ datasets: [
{ {
type: "doughnut", type: "doughnut",
data: data.statusList.map((item) => item.count), data: data.pstAnsList.map((item) => item.ansCnt),
backgroundColor: data.statusList.map((_, index) => backgroundColor: data.pstAnsList.map((_, index) =>
getCssVariableValue(`--chart-${(index % 5) + 1}`), getCssVariableValue(`--chart-${(index % 5) + 1}`),
), ),
}, },
@@ -26,7 +26,7 @@ import {
SelectValue, SelectValue,
} from "@common/components"; } from "@common/components";
import { SiteSelect } from "@/entities/site"; import { SiteSelect } from "@/entities/site";
// import { ENDPOINT } from "@/shared/config"; import { ENDPOINT } from "@/shared/config";
import { NoData } from "@/shared/ui/no-data"; import { NoData } from "@/shared/ui/no-data";
import { InputDateRangePicker } from "@/shared/ui/input-date-range-picker"; import { InputDateRangePicker } from "@/shared/ui/input-date-range-picker";
import { BoardStatisticsApi } from "../api/board-statistics-service"; import { BoardStatisticsApi } from "../api/board-statistics-service";
@@ -66,7 +66,7 @@ function BoardStatisticsPage() {
}); });
const { data: boardStatisticsData } = useQuery({ const { data: boardStatisticsData } = useQuery({
queryKey: ["board-statistics", searchParams], queryKey: [ENDPOINT.BOARD_SERVICE.STATISTICS, searchParams],
queryFn: () => queryFn: () =>
BoardStatisticsApi.getBoardStatistics({ BoardStatisticsApi.getBoardStatistics({
...searchParams, ...searchParams,
@@ -176,7 +176,8 @@ function BoardStatisticsPage() {
<h3 className="text-lg font-medium text-gray-500">총 게시물</h3> <h3 className="text-lg font-medium text-gray-500">총 게시물</h3>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="mt-2 text-4xl font-bold"> <div className="mt-2 text-4xl font-bold">
{boardStatisticsData?.totalPosts.toLocaleString() || 0} {boardStatisticsData?.bbsTotalDto?.pstTotCnt?.toLocaleString() ||
0}
</div> </div>
<div className="h-16 w-24"> <div className="h-16 w-24">
<Line <Line
@@ -210,7 +211,8 @@ function BoardStatisticsPage() {
<h3 className="text-lg font-medium text-gray-500">답변대기</h3> <h3 className="text-lg font-medium text-gray-500">답변대기</h3>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="mt-2 text-4xl font-bold"> <div className="mt-2 text-4xl font-bold">
{boardStatisticsData?.totalComments.toLocaleString() || 0} {boardStatisticsData?.bbsTotalDto?.pstAnsWaitCnt?.toLocaleString() ||
0}
</div> </div>
<div className="h-16 w-24"> <div className="h-16 w-24">
<Line <Line
@@ -244,7 +246,7 @@ function BoardStatisticsPage() {
<h3 className="text-lg font-medium text-gray-500">평균평점</h3> <h3 className="text-lg font-medium text-gray-500">평균평점</h3>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="mt-2 text-4xl font-bold"> <div className="mt-2 text-4xl font-bold">
{boardStatisticsData?.averageRating.toFixed(1) || 0} {boardStatisticsData?.bbsTotalDto?.pstEvlAvg?.toFixed(1) || 0}
</div> </div>
<div className="h-16 w-24"> <div className="h-16 w-24">
<Line <Line
@@ -278,7 +280,8 @@ function BoardStatisticsPage() {
<h3 className="text-lg font-medium text-gray-500">총 조회수</h3> <h3 className="text-lg font-medium text-gray-500">총 조회수</h3>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="mt-2 text-4xl font-bold"> <div className="mt-2 text-4xl font-bold">
{boardStatisticsData?.totalViews.toLocaleString() || 0} {boardStatisticsData?.bbsTotalDto?.pstInqCnt?.toLocaleString() ||
0}
</div> </div>
<div className="h-16 w-24"> <div className="h-16 w-24">
<Line <Line
@@ -315,7 +318,7 @@ function BoardStatisticsPage() {
<h3 className="text-2xl font-medium">일별 게시물 현황</h3> <h3 className="text-2xl font-medium">일별 게시물 현황</h3>
</div> </div>
<div className="h-96 p-4"> <div className="h-96 p-4">
{boardStatisticsData?.dayList?.length ? ( {boardStatisticsData?.bbsDailyList?.length ? (
<Line {...chartData.day(boardStatisticsData)} /> <Line {...chartData.day(boardStatisticsData)} />
) : ( ) : (
<NoData /> <NoData />
@@ -329,7 +332,7 @@ function BoardStatisticsPage() {
<h3 className="text-2xl font-medium">답변상태</h3> <h3 className="text-2xl font-medium">답변상태</h3>
</div> </div>
<div className="h-96 p-4"> <div className="h-96 p-4">
{boardStatisticsData?.statusList?.length ? ( {boardStatisticsData?.pstAnsList?.length ? (
<Doughnut {...chartData.status(boardStatisticsData)} /> <Doughnut {...chartData.status(boardStatisticsData)} />
) : ( ) : (
<NoData /> <NoData />
@@ -342,7 +345,7 @@ function BoardStatisticsPage() {
<h3 className="text-2xl font-medium">게시판별 분포</h3> <h3 className="text-2xl font-medium">게시판별 분포</h3>
</div> </div>
<div className="h-96 p-4"> <div className="h-96 p-4">
{boardStatisticsData?.boardList?.length ? ( {boardStatisticsData?.bbsPstCntList?.length ? (
<Bar {...chartData.board(boardStatisticsData)} /> <Bar {...chartData.board(boardStatisticsData)} />
) : ( ) : (
<NoData /> <NoData />
@@ -1,4 +1,4 @@
import { memo } from "react"; import { memo, useEffect } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery, useQueryClient } from "@tanstack/react-query"; import { useQuery, useQueryClient } from "@tanstack/react-query";
@@ -140,6 +140,10 @@ const LwpoCodeManagementDialog = memo(
} }
}; };
useEffect(() => {
if (!open) form.reset();
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={onOpenChange} {...props}> <Dialog open={open} onOpenChange={onOpenChange} {...props}>
<DialogTrigger asChild>{children}</DialogTrigger> <DialogTrigger asChild>{children}</DialogTrigger>
+5 -1
View File
@@ -1,4 +1,4 @@
import { memo } from "react"; import { memo, useEffect } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
@@ -96,6 +96,10 @@ const UpCodeManagementDialog = memo(
if (await confirm(confirmMessage)) callback(data); if (await confirm(confirmMessage)) callback(data);
}; };
useEffect(() => {
if (!open) form.reset();
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={onOpenChange} {...props}> <Dialog open={open} onOpenChange={onOpenChange} {...props}>
<DialogTrigger asChild>{children}</DialogTrigger> <DialogTrigger asChild>{children}</DialogTrigger>
@@ -1,6 +1,13 @@
import { client } from "@/shared/api"; import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config"; import { ENDPOINT } from "@/shared/config";
import type { Dashboard, DashboardService } from "../model/dashboard-interface"; import type {
Dashboard,
DashboardService,
NoticeUser,
Schedule,
ScheduleQueryParams,
} from "../model/dashboard-interface";
import type { PageableList } from "@/shared/model";
export class DashboardApiService implements DashboardService { export class DashboardApiService implements DashboardService {
public async getDashboard(): Promise<Dashboard> { public async getDashboard(): Promise<Dashboard> {
@@ -9,6 +16,25 @@ export class DashboardApiService implements DashboardService {
); );
return response.data; return response.data;
} }
public async getNoticeUserList(
recvUnqId: string,
): Promise<PageableList<NoticeUser>> {
const response = await client.get<PageableList<NoticeUser>>(
`${ENDPOINT.CMS_SERVICE.NOTICE_USER}/${recvUnqId}/list`,
);
return response.data;
}
public async getScheduleList(
params?: ScheduleQueryParams,
): Promise<Schedule[]> {
const response = await client.get<Schedule[]>(
ENDPOINT.CMS_SERVICE.SCHEDULES,
{ params },
);
return response.data;
}
} }
export const DashboardApi = new DashboardApiService(); export const DashboardApi = new DashboardApiService();
@@ -1,3 +1,5 @@
import type { PageableList } from "@/shared/model";
export interface SiteStatisticsContent { export interface SiteStatisticsContent {
siteId: string; siteId: string;
siteNm: string; siteNm: string;
@@ -27,6 +29,42 @@ export interface Dashboard {
menuAccessList: MenuStatisticsContent[]; menuAccessList: MenuStatisticsContent[];
} }
export interface NoticeUser {
notiId: number;
recvUnqId: string;
senderUnqId: string;
notiType: string;
notiTtl: string;
notReadYn: string;
regDt: string;
}
export interface Schedule {
schdlBgngDt: string;
schdlEndDt: string;
actualDate: string;
schdlSn: number;
siteId: string;
schdlTtl: string;
schdlSeCd: string;
schdlCn: string;
reptYn: string;
commSchdlYn: string;
atflCd: string | null;
}
export interface ScheduleQueryParams {
siteId?: string;
schdlTtl?: string;
schdlSeCd?: string;
schdlBgngYmd?: string;
schdlEndYmd?: string;
reptYn?: string;
commSchdlYn?: string;
}
export interface DashboardService { export interface DashboardService {
getDashboard(): Promise<Dashboard>; getDashboard(): Promise<Dashboard>;
getNoticeUserList(recvUnqId: string): Promise<PageableList<NoticeUser>>;
getScheduleList(params?: ScheduleQueryParams): Promise<Schedule[]>;
} }
@@ -1,5 +1,6 @@
"use client"; "use client";
import dayjs from "dayjs";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { getCoreRowModel } from "@tanstack/react-table"; import { getCoreRowModel } from "@tanstack/react-table";
@@ -17,8 +18,8 @@ import {
} from "chart.js"; } from "chart.js";
import { Bar, Line } from "react-chartjs-2"; import { Bar, Line } from "react-chartjs-2";
import { PostApi, type RecentPost } from "@/entities/post"; import { PostApi, type RecentPost } from "@/entities/post";
import { ENDPOINT } from "@/shared/config"; import { AUTH_USER_ID, ENDPOINT, SITE_ID } from "@/shared/config";
import { useDataTable } from "@/shared/lib"; import { getCookie, useDataTable } from "@/shared/lib";
import { DashboardApi } from "../api/dashboard-service"; import { DashboardApi } from "../api/dashboard-service";
import { chartData } from "../model/chart-data"; import { chartData } from "../model/chart-data";
import { import {
@@ -39,12 +40,44 @@ ChartJS.register(
); );
function DashboardPage() { function DashboardPage() {
const userId = getCookie(AUTH_USER_ID) ?? "";
const router = useRouter(); const router = useRouter();
const { data } = useQuery({ const { data } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.DASHBOARD], queryKey: [ENDPOINT.CMS_SERVICE.DASHBOARD],
queryFn: () => DashboardApi.getDashboard(), queryFn: () => DashboardApi.getDashboard(),
}); });
const { data: noticeUserList } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.NOTICE_USER],
queryFn: () => DashboardApi.getNoticeUserList(userId),
enabled: !!userId,
select: (data) => {
// 오늘 ~ 한 달 전 사이의 일정
const today = dayjs().endOf("day");
const monthAgo = dayjs().subtract(1, "month").startOf("day");
return data.content?.filter((item) => {
const regDt = dayjs(item.regDt);
return (
(regDt.isSame(monthAgo) || regDt.isAfter(monthAgo)) &&
(regDt.isSame(today) || regDt.isBefore(today))
);
});
},
});
const { data: scheduleList } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.SCHEDULES],
queryFn: () =>
DashboardApi.getScheduleList({
siteId: SITE_ID,
schdlBgngYmd: dayjs().format("YYYY-MM-DD"),
schdlEndYmd: dayjs().add(1, "month").format("YYYY-MM-DD"),
commSchdlYn: "Y",
}),
});
const noticePostQuery = useQuery({ const noticePostQuery = useQuery({
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS], queryKey: [ENDPOINT.BOARD_SERVICE.POSTS],
queryFn: () => queryFn: () =>
@@ -323,22 +356,15 @@ function DashboardPage() {
</div> </div>
<div className="p-4"> <div className="p-4">
<div className="space-y-4 text-foreground"> <div className="space-y-4 text-foreground">
<div className="flex items-center justify-between border-b border-border pb-4"> {noticeUserList?.map((item) => (
<span className="font-medium">신규 사용자 가입</span> <div
<span>{(1).toLocaleString()}분 전</span> key={item.notiId}
</div> className="flex items-center justify-between border-b border-border pb-4"
<div className="flex items-center justify-between border-b border-border pb-4"> >
<span className="font-medium">메뉴 수정 요청</span> <span className="font-medium">{item.notiTtl}</span>
<span>{(5).toLocaleString()}분 전</span> <span>{dayjs(item.regDt).fromNow()}</span>
</div> </div>
<div className="flex items-center justify-between border-b border-border pb-4"> ))}
<span className="font-medium">게시물 신고</span>
<span>{(10).toLocaleString()}분 전</span>
</div>
<div className="flex items-center justify-between">
<span className="font-medium">컨텐츠 승인 요청</span>
<span>{(15).toLocaleString()}분 전</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -349,24 +375,44 @@ function DashboardPage() {
</div> </div>
<div className="p-4"> <div className="p-4">
<div className="space-y-4 text-foreground"> <div className="space-y-4 text-foreground">
<div className="flex items-center justify-between border-b border-border pb-4"> {scheduleList && scheduleList.length > 0 ? (
<span className="font-medium"> scheduleList.map((schedule, index) => {
{(3).toLocaleString()}월 정기 시스템 점검 const today = dayjs();
</span> const scheduleDate = dayjs(schedule.actualDate);
<span>내일</span> const daysUntil = scheduleDate.diff(today, "day");
</div>
<div className="flex items-center justify-between border-b border-border pb-4"> let timeText = "";
<span className="font-medium">서버 업데이트 예정</span> if (daysUntil === 0) {
<span>{(3).toLocaleString()}일 후</span> timeText = "오늘";
</div> } else if (daysUntil === 1) {
<div className="flex items-center justify-between border-b border-border pb-4"> timeText = "내일";
<span className="font-medium">백업 스케줄</span> } else if (daysUntil > 1) {
<span>{(5).toLocaleString()}일 후</span> timeText = `${daysUntil}일 후`;
</div> } else {
<div className="flex items-center justify-between"> timeText = scheduleDate.format("YYYY-MM-DD");
<span className="font-medium">정기 보안 점검</span> }
<span>{(7).toLocaleString()}일 후</span>
</div> return (
<div
key={schedule.schdlSn}
className={`flex items-center justify-between ${
index < scheduleList.length - 1
? "border-b border-border pb-4"
: ""
}`}
>
<span className="font-medium">
{schedule.schdlTtl}
</span>
<span>{timeText}</span>
</div>
);
})
) : (
<div className="text-center text-muted-foreground">
예정된 일정이 없습니다.
</div>
)}
</div> </div>
</div> </div>
</div> </div>
@@ -1,4 +1,4 @@
import { useState, useRef } from "react"; import { useState, useRef, useEffect } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
@@ -48,25 +48,14 @@ function MenuAuthorityDialog({ groupId }: MenuAuthorityDialogProps) {
keywordType: "", keywordType: "",
siteId: "", siteId: "",
}); });
const handleReset = () => {
if (inputRef.current) inputRef.current.value = "";
setKeywordType("");
setSiteId("");
setSearchParams({
keyword: "",
keywordType: "",
siteId: "",
});
};
const query = useQuery({ const query = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.MENU_AUTHRTS, groupId, searchParams], queryKey: [ENDPOINT.CMS_SERVICE.MENU_AUTHRTS, groupId, searchParams],
queryFn: () => MenuAuthorityApi.getGroupMenuAuthorityList({ queryFn: () =>
groupId, MenuAuthorityApi.getGroupMenuAuthorityList({
...searchParams groupId,
}), ...searchParams,
}),
enabled: open && !!groupId, enabled: open && !!groupId,
}); });
@@ -117,6 +106,21 @@ function MenuAuthorityDialog({ groupId }: MenuAuthorityDialogProps) {
}); });
}; };
const handleReset = () => {
if (inputRef.current) inputRef.current.value = "";
setSiteId("");
setKeywordType("");
setSearchParams({
keyword: "",
keywordType: "",
siteId: "",
});
};
useEffect(() => {
if (!open) handleReset();
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={setOpen}> <Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild> <DialogTrigger asChild>
@@ -1,4 +1,4 @@
import { useState, memo } from "react"; import { useState, memo, useEffect } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
@@ -90,6 +90,10 @@ const ManagementAuthorityDialog = memo(
} }
}; };
useEffect(() => {
if (!open) form.reset();
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={setOpen}> <Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild> <DialogTrigger asChild>
@@ -1,4 +1,4 @@
import { useState, useRef } from "react"; import { useState, useRef, useEffect } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query"; import { useQuery, useQueryClient } from "@tanstack/react-query";
import { getCoreRowModel, type ColumnDef } from "@tanstack/react-table"; import { getCoreRowModel, type ColumnDef } from "@tanstack/react-table";
import { import {
@@ -113,6 +113,10 @@ function MappingRoleDialog({
}, },
}); });
useEffect(() => {
if (!open) handleReset();
}, [open]);
return ( return (
<Dialog open={open} onOpenChange={onOpenChange} {...props}> <Dialog open={open} onOpenChange={onOpenChange} {...props}>
<DialogTrigger asChild> <DialogTrigger asChild>
+2
View File
@@ -56,6 +56,7 @@ export const ENDPOINT = {
APILOG: "/cms-service/api/v1/api-logs", APILOG: "/cms-service/api/v1/api-logs",
SITE_AUTHORITY: "/cms-service/api/v1/site-authrt", SITE_AUTHORITY: "/cms-service/api/v1/site-authrt",
CONNECTION_LOG: "/cms-service/api/v1/cntnlog", CONNECTION_LOG: "/cms-service/api/v1/cntnlog",
NOTICE_USER: "/cms-service/api/v1/noti/user",
}, },
BOARD_SERVICE: { BOARD_SERVICE: {
BBS: "/board-service/api/v1/bbs", BBS: "/board-service/api/v1/bbs",
@@ -63,6 +64,7 @@ export const ENDPOINT = {
POSTS: "/board-service/api/v1/posts", POSTS: "/board-service/api/v1/posts",
POSTS_COMMENTS: "/board-service/api/v1/posts-cmnts", POSTS_COMMENTS: "/board-service/api/v1/posts-cmnts",
POST_EVALUATION: "/board-service/api/v1/pstEvl", POST_EVALUATION: "/board-service/api/v1/pstEvl",
STATISTICS: "/board-service/api/v1/stat/bbs",
}, },
}; };
+6 -7
View File
@@ -4,20 +4,19 @@ 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_PORT = 3005 NEXT_PUBLIC_PORT = 3005
#NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11035
NEXT_PUBLIC_PROXY_HOST = http://localhost:3005 NEXT_PUBLIC_PROXY_HOST = http://localhost:3005
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/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:11083/operation-service/api/v1
# NEXT_PUBLIC_FO_SERVER_API_URL = http://192.168.1.222:8883/operation-service/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_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_DM_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
# NEXT_PUBLIC_FO_SERVER_API_URL = http://192.168.1.222:8883/operation-service/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service/api/v1
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
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_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/api/v1
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr
NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y}
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 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 # 박이정
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
+1
View File
@@ -14,6 +14,7 @@ NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/ap
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr
NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y} NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y}
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service # 개발 서버 API
NEXT_PUBLIC_GATEWAY_URL=http://con.mind-one.co.kr:11083 # 개발 서버 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 # 박이정
NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://dev.onasys.co.kr:3000/auth/login
+1
View File
@@ -15,6 +15,7 @@ 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_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1 NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service
NEXT_PUBLIC_GATEWAY_URL = http://apigateway.iipbs-was.svc.cluster.local:8000
NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact
NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x}
@@ -87,9 +87,9 @@ export default function ModalSimilarPage({ sply = 0, usageCd = '', money = 0 }:
}, [getSimilarCaseList, money, searchUseType, sply, usageCd]); }, [getSimilarCaseList, money, searchUseType, sply, usageCd]);
return ( return (
<div className="align-top w-[1360px] overflow-x-auto"> <div className="align-top w-[1360px] h-full">
<Title title="유사사례 조회" /> <Title title="유사사례 조회" />
<div className="overflow-x-auto h-[450px] w-full mt-8" tabIndex={0} aria-label="유사사례 테이블 영역"> <div className="overflow-x-auto h-[480px] w-full mt-8" tabIndex={0} aria-label="유사사례 테이블 영역">
<div className="w-[150%]"> <div className="w-[150%]">
<div className="card-header justify-self-start"> <div className="card-header justify-self-start">
<h3 className="text-2xl font-medium text-label">유사사례</h3> <h3 className="text-2xl font-medium text-label">유사사례</h3>
@@ -148,7 +148,7 @@ export default function ModalSimilarPage({ sply = 0, usageCd = '', money = 0 }:
</div> </div>
</div> </div>
</div> </div>
<div className="overflow-x-auto h-[270px] w-full mt-8"> <div className="overflow-x-auto h-[270px] w-full mt-8 overflow-y-hidden">
<div className="w-[130%]"> <div className="w-[130%]">
<UiTable <UiTable
headName={"사업비 상세정보"} headName={"사업비 상세정보"}
@@ -1,5 +1,11 @@
"use client"; "use client";
/**
* 수요정보등록 화면
*
* 🔗 사용 API
* - 수요정보등록: POST /reuseFc/request/demandInfo
*/
import { useDmStore } from "@/app/store"; import { useDmStore } from "@/app/store";
import { sdmInfoFormSchema, type DemandCompBizType, type SdmInfoFormData } from "@/app/store/sdmMng"; import { sdmInfoFormSchema, type DemandCompBizType, type SdmInfoFormData } from "@/app/store/sdmMng";
import { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component"; import { SdmInfoRegForm } from "@/components/ui/sdmInfoInsertForm/component";
@@ -60,7 +66,7 @@ function SdmInfoInsertContent() {
...prev, ...prev,
sdmNm: searchParams.get("dmdCoNm") || "", sdmNm: searchParams.get("dmdCoNm") || "",
})); }));
if(searchParams.get("dmdInfoId")){ if (searchParams.get("dmdInfoId")) {
// const data = { // const data = {
// dmdCoNm: searchParams.get("dmdCoNm") || '', // dmdCoNm: searchParams.get("dmdCoNm") || '',
// ctpvCd: searchParams.get("ctpvCd") || '', // ctpvCd: searchParams.get("ctpvCd") || '',
@@ -69,8 +75,8 @@ function SdmInfoInsertContent() {
// daddr: searchParams.get("daddr") || '', // daddr: searchParams.get("daddr") || '',
// telno: searchParams.get("telno") || '', // telno: searchParams.get("telno") || '',
// } // }
// sessionStorage.setItem("user", JSON.stringify(data || {})); // sessionStorage.setItem("user", JSON.stringify(data || {}));
} }
//sessionStorage.setItem("user", JSON.parse(user||'') || ""); //sessionStorage.setItem("user", JSON.parse(user||'') || "");
setIsLogin(user || searchParams.get("dmdInfoId") ? true : false); setIsLogin(user || searchParams.get("dmdInfoId") ? true : false);
@@ -121,7 +127,7 @@ function SdmInfoInsertContent() {
const userData = JSON.parse(user); const userData = JSON.parse(user);
if (userData.dmdCoNm) { if (userData.dmdCoNm) {
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);
@@ -203,10 +209,10 @@ function SdmInfoInsertContent() {
tph: Number(data.tph) || null, tph: Number(data.tph) || null,
trbt: Number(data.trbt) || null, trbt: Number(data.trbt) || null,
ph: data.ph || "", ph: data.ph || "",
blgcOxygDmndQnt: Number(data.bod) ||null, blgcOxygDmndQnt: Number(data.bod) || null,
clIonQnt: Number(data.clIonQnt) || null, clIonQnt: Number(data.clIonQnt) || null,
smll: data.smll || "", smll: data.smll || "",
cdtnv: Number(data.cdtnv) ||null, cdtnv: Number(data.cdtnv) || null,
crmty: Number(data.crmty) || null, crmty: Number(data.crmty) || null,
rmrk: data.rmrk || "", rmrk: data.rmrk || "",
bzmnNo: "", bzmnNo: "",
@@ -0,0 +1,22 @@
"use client";
/**
* 수요처 로그아웃 화면
*
* 🔗 사용 API
*
*/
import { useDmStore } from "@/app/store";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
export default function SdmLogout() {
const router = useRouter();
const { actionLogout } = useDmStore((state) => state);
useEffect(() => {
actionLogout();
router.push("/pages/sdmMng/sdmInfoInsert");
}, [actionLogout, router]);
return null;
}
+3
View File
@@ -1,5 +1,8 @@
"use client"; "use client";
import "./globals.css"; import "./globals.css";
import { setCookie } from "../src/shared/lib";
setCookie("site-id-key", process.env.NEXT_PUBLIC_SITE_ID || "DM");
export default function RootLayout({ export default function RootLayout({
children, children,
+326 -303
View File
@@ -50,8 +50,8 @@ export const sdmInfoFormSchema = z.object({
// 모든 수질 관련 필드 // 모든 수질 관련 필드
// 총대장균군수는 null 값을 불검출로 표시하기때문에 해당 검사에서 제외함. // 총대장균군수는 null 값을 불검출로 표시하기때문에 해당 검사에서 제외함.
const allFields: (keyof typeof data)[] = [ const allFields: (keyof typeof data)[] = [
"tn", "combResdch", "tph", "tn", "combResdch", "tph",
"trbt", "ph", "bod", "clIonQnt", "trbt", "ph", "bod", "clIonQnt",
"smll", "cdtnv", "crmty", "smll", "cdtnv", "crmty",
]; ];
@@ -104,38 +104,38 @@ export type SdmInfoFormData = z.infer<typeof sdmInfoFormSchema>;
// 수요처 정보 // 수요처 정보
export type DemandCompBizType = { export type DemandCompBizType = {
index : number | ''; index: number | '';
dmdInfoId : string | ''; dmdInfoId: string | '';
dmdInfoFk : string | ''; dmdInfoFk: string | '';
bzmnNo : string | ''; bzmnNo: string | '';
dmdCoNm : string | ''; dmdCoNm: string | '';
daddr : string | ''; daddr: string | '';
telno : string | ''; telno: string | '';
rgtr : string | ''; rgtr: string | '';
useUsgCd : string | ''; useUsgCd: string | '';
ctpvCd : string | ''; ctpvCd: string | '';
sggCd : string | ''; sggCd: string | '';
dmdAplyPswd : string | ''; dmdAplyPswd: string | '';
wntUntprc : number | ''; wntUntprc: number | '';
dmndTmng : Date | ''; dmndTmng: Date | '';
dmndQty : number | ''; dmndQty: number | '';
grssClfg : number | null //총대장균군수 grssClfg: number | null //총대장균군수
tn : number | null //총질소 tn: number | null //총질소
combResdch : number | null //결합잔류염소 combResdch: number | null //결합잔류염소
tph : number | null //총인 tph: number | null //총인
trbt : number | null //탁도 trbt: number | null //탁도
ph : string | ''; //수소이온농 ph: string | ''; //수소이온농
blgcOxygDmndQnt : number | null //생물학적산소요구량 blgcOxygDmndQnt: number | null //생물학적산소요구량
clIonQnt : number | null //염화물 clIonQnt: number | null //염화물
smll : string | ''; //냄새 smll: string | ''; //냄새
cdtnv : number | null; //전기전도도 cdtnv: number | null; //전기전도도
crmty : number | null //색도 crmty: number | null //색도
rmrk : string | ''; rmrk: string | '';
reqDt : string | ''; reqDt: string | '';
dmdInfoSn : number | ''; dmdInfoSn: number | '';
status : string | ''; status: string | '';
splyCndtList:SupplyCandidate[]|[], splyCndtList: SupplyCandidate[] | [],
ruseUtztnFcltNm?:string|'' ruseUtztnFcltNm?: string | ''
} }
@@ -147,107 +147,107 @@ export type SupplyCandidate = {
export type DemandMatchings = { export type DemandMatchings = {
splyFcltFk : string | ''; splyFcltFk: string | '';
splyFcltFlg : string | ''; splyFcltFlg: string | '';
pbnstRuseFcltBizFk : number | ''; pbnstRuseFcltBizFk: number | '';
splyBgngDay : string | ''; splyBgngDay: string | '';
splyEndDay : string | ''; splyEndDay: string | '';
splyCpct : number | ''; splyCpct: number | '';
splyFmYn : string | ''; splyFmYn: string | '';
useUsgCd : string | ''; useUsgCd: string | '';
dmdInfoSn : number | ''; dmdInfoSn: number | '';
splyCndtList : string | ''; splyCndtList: string | '';
mtchnCmptnYmd : string | ''; mtchnCmptnYmd: string | '';
rvwCmptnYmd : string | ''; rvwCmptnYmd: string | '';
regDt : string | ''; regDt: string | '';
rgtr : string | ''; rgtr: string | '';
mdfcnDt : string | ''; mdfcnDt: string | '';
mdfr : string | ''; mdfr: string | '';
} }
// 유사사례 // 유사사례
export type SimilarCaseType = { export type SimilarCaseType = {
ruseBizNm : string | ''; ruseBizNm: string | ''; // 사업명
bizBgngDate : string | ''; bizBgngDate: string | '';
bizEndDate : string | ''; bizEndDate: string | '';
splyFcltKnd : string | ''; splyFcltKnd: string | '';
splyFcltNm : string | ''; splyFcltNm: string | '';
splyFcltCpct : string | ''; splyFcltCpct: string | '';
dmdFcltNm : string | ''; dmdFcltNm: string | '';
dmdFcltAddr : string | ''; dmdFcltAddr: string | '';
ruseFcltCpct : string | ''; ruseFcltCpct: string | '';
ruseFcltPplLen : string | ''; ruseFcltPplLen: string | '';
ruseFcltUsg : string | ''; ruseFcltUsg: string | '';
ruseFcltSplyCpct : string | ''; ruseFcltSplyCpct: string | '';
ruseFcltPrcsMsrc : string | ''; ruseFcltPrcsMsrc: string | '';
grnteWqUsg : string | ''; grnteWqUsg: string | '';
grnteWqGrssClfg : string | ''; grnteWqGrssClfg: string | '';
grnteWqCombResdch : string | ''; grnteWqCombResdch: string | '';
grnteWqTrbt : string | ''; grnteWqTrbt: string | '';
grnteWqBod : string | ''; grnteWqBod: string | '';
grnteWqSmll : string | ''; grnteWqSmll: string | '';
grnteWqCrmty : string | ''; grnteWqCrmty: string | '';
grnteWqTn : string | ''; grnteWqTn: string | '';
grnteWqTp : string | ''; grnteWqTp: string | '';
grnteWqPh : string | ''; grnteWqPh: string | '';
grnteWqClIonQnt : string | ''; grnteWqClIonQnt: string | '';
grnteWqCndctStat : string | ''; grnteWqCndctStat: string | '';
grnteWqRmrk : string | ''; grnteWqRmrk: string | '';
reqBizReuseFcltCst : string | ''; reqBizReuseFcltCst: string | '';
reqBizPplCst : string | ''; reqBizPplCst: string | '';
reqBizArchCst : string | ''; reqBizArchCst: string | '';
reqBizMchnCst : string | ''; reqBizMchnCst: string | '';
reqBizMtrngCst : string | ''; reqBizMtrngCst: string | '';
reqBizGisCst : string | ''; reqBizGisCst: string | '';
reqBizCctvCst : string | ''; reqBizCctvCst: string | '';
reqBizCmcnCst : string | ''; reqBizCmcnCst: string | '';
reqBizWstCst : string | ''; reqBizWstCst: string | '';
reqBizDesignCst : string | ''; reqBizDesignCst: string | '';
reqBizSpvsCst : string | ''; reqBizSpvsCst: string | '';
reqBizSbsdCst : string | ''; reqBizSbsdCst: string | '';
reqBizEtc : string | ''; reqBizEtc: string | '';
reqBizGrssCst : string | ''; reqBizGrssCst: string | '';
prcmPlanNlep : string | ''; prcmPlanNlep: string | '';
prcmPlanLcep : string | ''; prcmPlanLcep: string | '';
prcmPlanBrdnCst : string | ''; prcmPlanBrdnCst: string | '';
prcmPlanEcqrRt : string | ''; prcmPlanEcqrRt: string | '';
prcmPlanGrssCst : string | ''; prcmPlanGrssCst: string | '';
clclnNlep : string | ''; clclnNlep: string | '';
clclnLcep : string | ''; clclnLcep: string | '';
clclnBrdnCst : string | ''; clclnBrdnCst: string | '';
clclnEcqrRt : string | ''; clclnEcqrRt: string | '';
clclnGrssCst : string | ''; clclnGrssCst: string | '';
} }
// 사업비 상세정보 // 사업비 상세정보
export type MoneyDetailType = { export type MoneyDetailType = {
reqBizGrssCst : string | ''; reqBizGrssCst: string | '';
reqBizReuseFcltCst : string | ''; reqBizReuseFcltCst: string | '';
reqBizPplCst : string | ''; reqBizPplCst: string | '';
reqBizArchCst : string | ''; reqBizArchCst: string | '';
reqBizMchnCst : string | ''; reqBizMchnCst: string | '';
reqBizMtrngCst : string | ''; reqBizMtrngCst: string | '';
reqBizGisCst : string | ''; reqBizGisCst: string | '';
reqBizCctvCst : string | ''; reqBizCctvCst: string | '';
reqBizCmcnCst : string | ''; reqBizCmcnCst: string | '';
reqBizWstCst : string | ''; reqBizWstCst: string | '';
reqBizDesignCst : string | ''; reqBizDesignCst: string | '';
reqBizSpvsCst : string | ''; reqBizSpvsCst: string | '';
reqBizSbsdCst : string | ''; reqBizSbsdCst: string | '';
reqBizEtc : string | ''; reqBizEtc: string | '';
/** 재원조달계획(백만원원) */ /** 재원조달계획(백만원원) */
prcmPlanGrssCst : string | ''; prcmPlanGrssCst: string | '';
prcmPlanNlep : string | ''; prcmPlanNlep: string | '';
prcmPlanLcep : string | ''; prcmPlanLcep: string | '';
prcmPlanBrdnCst : string | ''; prcmPlanBrdnCst: string | '';
prcmPlanEcqrRt : string | ''; prcmPlanEcqrRt: string | '';
/** 사업비 정산(백만원) */ /** 사업비 정산(백만원) */
clclnGrssCst : string | ''; clclnGrssCst: string | '';
clclnNlep : string | ''; clclnNlep: string | '';
clclnLcep : string | ''; clclnLcep: string | '';
clclnBrdnCst : string | ''; clclnBrdnCst: string | '';
clclnEcqrRt : string | ''; clclnEcqrRt: string | '';
} }
// 규칙 타입 선언 // 규칙 타입 선언
export type DisableRulesType = Record<string, string[]>; export type DisableRulesType = Record<string, string[]>;
@@ -255,144 +255,144 @@ export type DisableRulesType = Record<string, string[]>;
* Store - 데이터 * Store - 데이터
====================================*/ ====================================*/
// 수요처 정보 // 수요처 정보
const demandCompList : DemandCompType[] = [ const demandCompList: DemandCompType[] = [
] ]
const disableRules: DisableRulesType = { const disableRules: DisableRulesType = {
"청소": ["tn", 'tph',"clIonQnt" ,'cdtnv'], "청소": ["tn", 'tph', "clIonQnt", 'cdtnv'],
"화장실용수": ["tn", 'tph',"clIonQnt" ,'cdtnv'], "화장실용수": ["tn", 'tph', "clIonQnt", 'cdtnv'],
"세척": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'], "세척": ["combResdch", "crmty", 'tph', 'tn', "clIonQnt", 'cdtnv'],
"살수": ["combResdch", "crmty",'tph','tn',"clIonQnt",'cdtnv'], "살수": ["combResdch", "crmty", 'tph', 'tn', "clIonQnt", 'cdtnv'],
"조경": ["combResdch", "crmty",'tph','cdtnv'], "조경": ["combResdch", "crmty", 'tph', 'cdtnv'],
"농업_간접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'], "농업_간접용수": ["combResdch", "crmty", 'tn', 'tph', 'clIonQnt'],
"농업_직접용수": ["combResdch", "crmty",'tn','tph','clIonQnt'], "농업_직접용수": ["combResdch", "crmty", 'tn', 'tph', 'clIonQnt'],
"하천": ["combResdch", "trbt", "crmty" ,'clIonQnt','cdtnv'], "하천": ["combResdch", "trbt", "crmty", 'clIonQnt', 'cdtnv'],
'공업':[] '공업': []
}; };
const defaultRules: Record<string, object> = { const defaultRules: Record<string, object> = {
"청소": { "청소": {
grssClfg: null, grssClfg: null,
combResdch:0.2, combResdch: 0.2,
trbt: 2, trbt: 2,
bod: 5, bod: 5,
crmty: 20, crmty: 20,
ph: "5.8~8.5", ph: "5.8~8.5",
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
tn:null, tn: null,
tph: null, tph: null,
clIonQnt: null, clIonQnt: null,
cdtnv: null, cdtnv: null,
}, },
"화장실용수": { "화장실용수": {
grssClfg: null, grssClfg: null,
combResdch:0.2, combResdch: 0.2,
trbt: 2, trbt: 2,
bod: 5, bod: 5,
crmty: 20, crmty: 20,
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
ph: "5.8~8.5", ph: "5.8~8.5",
tn:null, tn: null,
tph: null, tph: null,
clIonQnt: null, clIonQnt: null,
cdtnv: null, cdtnv: null,
}, },
"세척": { "세척": {
grssClfg: null, grssClfg: null,
trbt: 2, trbt: 2,
bod: 5, bod: 5,
ph: "5.8~8.5", ph: "5.8~8.5",
combResdch:null, combResdch: null,
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
crmty:null, crmty: null,
tn:null, tn: null,
tph: null, tph: null,
clIonQnt: null, clIonQnt: null,
cdtnv: null, cdtnv: null,
}, },
"살수": { "살수": {
grssClfg: null, grssClfg: null,
trbt: 2, trbt: 2,
bod: 5, bod: 5,
ph: "5.8~8.5", ph: "5.8~8.5",
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
combResdch:null, combResdch: null,
crmty:null, crmty: null,
tn:null, tn: null,
tph: null, tph: null,
clIonQnt: null, clIonQnt: null,
cdtnv: null, cdtnv: null,
}, },
"조경": { "조경": {
grssClfg: null, grssClfg: null,
trbt: 2, trbt: 2,
bod: 5, bod: 5,
ph: "5.8~8.5", ph: "5.8~8.5",
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
clIonQnt:250, clIonQnt: 250,
combResdch:null, combResdch: null,
crmty:null, crmty: null,
tn:null, tn: null,
tph: null, tph: null,
cdtnv: null, cdtnv: null,
}, },
"농업_간접용수": { "농업_간접용수": {
grssClfg: null, grssClfg: null,
trbt: 5, trbt: 5,
bod: 8, bod: 8,
ph: "5.8~8.5", ph: "5.8~8.5",
cdtnv:2000, cdtnv: 2000,
combResdch:null, combResdch: null,
crmty:null, crmty: null,
tn:null, tn: null,
tph: null, tph: null,
clIonQnt: null, clIonQnt: null,
}, },
"농업_직접용수": { "농업_직접용수": {
grssClfg: null, grssClfg: null,
trbt: 2, trbt: 2,
bod: 8, bod: 8,
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
ph: "5.8~8.5", ph: "5.8~8.5",
cdtnv:700, cdtnv: 700,
combResdch:null, combResdch: null,
crmty:null, crmty: null,
tn:null, tn: null,
tph: null, tph: null,
clIonQnt: null, clIonQnt: null,
}, },
"하천": { "하천": {
grssClfg: 1000, grssClfg: 1000,
bod: 5, bod: 5,
tn: 10, tn: 10,
tph: 0.5, tph: 0.5,
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
ph: "5.8~8.5", ph: "5.8~8.5",
combResdch:null, combResdch: null,
trbt:null, trbt: null,
crmty:null, crmty: null,
clIonQnt: null, clIonQnt: null,
cdtnv:null cdtnv: null
}, },
'공업':{ '공업': {
grssClfg: null, grssClfg: null,
bod: null, bod: null,
tn: null, tn: null,
tph: null, tph: null,
ph: "~", ph: "~",
combResdch:null, combResdch: null,
smll:'불쾌하지않을것', smll: '불쾌하지않을것',
trbt:null, trbt: null,
crmty:null, crmty: null,
clIonQnt: null, clIonQnt: null,
cdtnv:null cdtnv: null
} }
}; };
// 사용용도 // 사용용도
const useTypesData : SelectDataType[] = [ const useTypesData: SelectDataType[] = [
{ text: '청소', val: "청소" }, { text: '청소', val: "청소" },
{ text: "화장실용수", val: "화장실용수" }, { text: "화장실용수", val: "화장실용수" },
{ text: "세척", val: "세척" }, { text: "세척", val: "세척" },
@@ -440,8 +440,8 @@ export const similarCaseModalHeader: TableUpperProps[] = [
] ]
// 유사사례 데이터 // 유사사례 데이터
const similarCaseList : SimilarCaseType[] = [ const similarCaseList: SimilarCaseType[] = [
] ]
// 사업비 상세정보 모달 헤더 // 사업비 상세정보 모달 헤더
@@ -477,12 +477,12 @@ export const moneyDetailModalHeader: TableUpperProps[] = [
] ]
// 사업비 상세정보 // 사업비 상세정보
const moneyDetailList : MoneyDetailType[] = [ const moneyDetailList: MoneyDetailType[] = [
] ]
// 수요정보 신청현황 헤더 // 수요정보 신청현황 헤더
export const upHeadSdmInfoStatus: TableUpperProps[] = [ export const upHeadSdmInfoStatus: TableUpperProps[] = [
{ id: "index", title: "No."}, { id: "index", title: "No." },
{ id: "ctpvCd", title: "시도", row: 0, rowSpan: 2 }, { id: "ctpvCd", title: "시도", row: 0, rowSpan: 2 },
{ id: "sggCd", title: "시군구", row: 0, rowSpan: 2 }, { id: "sggCd", title: "시군구", row: 0, rowSpan: 2 },
{ id: "dmdCoNm", title: "회사명", row: 0, rowSpan: 2 }, { id: "dmdCoNm", title: "회사명", row: 0, rowSpan: 2 },
@@ -501,7 +501,7 @@ export const upHeadSdmInfoStatus: TableUpperProps[] = [
const postSdmData = async (data: DemandCompType) => { const postSdmData = async (data: DemandCompType) => {
try { try {
await postFetch("/reuseFc/request", data); await postFetch("/reuseFc/request", data);
sessionStorage.setItem("user", JSON.stringify(data) ); sessionStorage.setItem("user", JSON.stringify(data));
toast.success("수요처 등록에 성공하였습니다."); toast.success("수요처 등록에 성공하였습니다.");
return true; return true;
} catch (error) { } catch (error) {
@@ -526,16 +526,16 @@ const postSdmLoginData = async (data: DemandCompType) => {
try { try {
const res = await postFetch("/reuseFc/request/login", data); const res = await postFetch("/reuseFc/request/login", data);
const jsonData = await res.json(); const jsonData = await res.json();
const status = jsonData.status; const status = jsonData.status;
const loginData = jsonData.data; const loginData = jsonData.data;
let loginSuccess = false; let loginSuccess = false;
if(status === 200 && loginData != null) { if (status === 200 && loginData != null) {
alert("수요처 로그인에 성공하였습니다."); alert("수요처 로그인에 성공하였습니다.");
sessionStorage.setItem("user", JSON.stringify(loginData)); sessionStorage.setItem("user", JSON.stringify(loginData));
loginSuccess = true; loginSuccess = true;
} else if(status === 401) { } else if (status === 401) {
alert("패스워드가 틀렸습니다."); alert("패스워드가 일치하지 않습니다.");
loginSuccess = false; loginSuccess = false;
} else { } else {
alert("등록된 수요처가 없습니다."); alert("등록된 수요처가 없습니다.");
@@ -553,35 +553,35 @@ const getDemandCompList = async (searchText: string, pageCnt: number) => {
try { try {
const url = '/reuseFc/request/' + (searchText ? searchText : '') + '/' + pageCnt; const url = '/reuseFc/request/' + (searchText ? searchText : '') + '/' + pageCnt;
const res = await getFetch(fetchType.WR, url); const res = await getFetch(fetchType.WR, url);
return { return {
data: res?.data || [], data: res?.data || [],
count: res?.count || 0 count: res?.count || 0
} }
} catch (error) { } catch (error) {
console.error(error+' 수요처 정보를 불러오지 못했습니다.'); console.error(error + ' 수요처 정보를 불러오지 못했습니다.');
return { data: [], count: 0 }; return { data: [], count: 0 };
} }
} }
const getSdmInfoStatusList = async (dmdInfoId : string) => { const getSdmInfoStatusList = async (dmdInfoId: string) => {
try { try {
const url = '/reuseFc/request/' + dmdInfoId; const url = '/reuseFc/request/' + dmdInfoId;
const res = await getFetch(fetchType.WR, url); const res = await getFetch(fetchType.WR, url);
return res?.data || []; return res?.data || [];
} catch (error) { } catch (error) {
console.error(error+' 수요정보 신청현황을 불러오지 못했습니다.'); console.error(error + ' 수요정보 신청현황을 불러오지 못했습니다.');
return []; return [];
} }
} }
// 유사사례 조회 // 유사사례 조회
const fetchGetSimilarCaseList = async (part: string, value: number|string) => { const fetchGetSimilarCaseList = async (part: string, value: number | string) => {
try { try {
const url = '/reuseFc/pubFcRuseCase/dm/' + part + '/' + (value ? value : 0); const url = '/reuseFc/pubFcRuseCase/dm/' + part + '/' + (value ? value : 0);
const res = await getFetch(fetchType.WR, url); const res = await getFetch(fetchType.WR, url);
return res?.data || []; return res?.data || [];
} catch (error) { } catch (error) {
console.error(error+' 유사사례 조회에 실패하였습니다.'); console.error(error + ' 유사사례 조회에 실패하였습니다.');
return []; return [];
} }
} }
@@ -590,23 +590,24 @@ const fetchGetSimilarCaseList = async (part: string, value: number|string) => {
* Store - expaort * Store - expaort
====================================*/ ====================================*/
export type SdmActions = { export type SdmActions = {
initializeSdmData: () => void; initializeSdmData: () => void;
insertSdmData: (data: DemandCompType) => Promise<void>; insertSdmData: (data: DemandCompType) => Promise<void>;
insertSdmInfoData: (data: DemandCompBizType) => Promise<void>; insertSdmInfoData: (data: DemandCompBizType) => Promise<void>;
getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>; getDemandCompList: (searchText: string, pageCnt: number) => Promise<void>;
actionLogin: (data: DemandCompType) => Promise<void>; actionLogin: (data: DemandCompType) => Promise<void>;
getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>; getSdmInfoStatusList: (dmdInfoId: string) => Promise<void>;
getSimilarCaseList: (part: string, value: number|string) => Promise<void>; getSimilarCaseList: (part: string, value: number | string) => Promise<void>;
actionLogout: () => Promise<void>;
} }
export type SdmType ={ export type SdmType = {
Sdm :{ Sdm: {
isInit: boolean; isInit: boolean;
useTypesData: SelectDataType[]; useTypesData: SelectDataType[];
demandCompList: DemandCompType[]; demandCompList: DemandCompType[];
upHeadSimilarCaseList: TableUpperProps[]; upHeadSimilarCaseList: TableUpperProps[];
similarCaseList: SimilarCaseType[]; similarCaseList: SimilarCaseType[];
upHeadMoneyDetailList : TableUpperProps[]; upHeadMoneyDetailList: TableUpperProps[];
moneyDetailList: MoneyDetailType[]; moneyDetailList: MoneyDetailType[];
// 수요정보 신청현황 // 수요정보 신청현황
@@ -615,28 +616,28 @@ export type SdmType ={
defaultRules: Record<string, object> defaultRules: Record<string, object>
disableRules: DisableRulesType; disableRules: DisableRulesType;
// 로그인관련 // 로그인관련
successNextPage : boolean; successNextPage: boolean;
successLogin: boolean; successLogin: boolean;
} }
} }
export const SdmState: SdmType = { export const SdmState: SdmType = {
Sdm:{ Sdm: {
isInit:false, isInit: false,
useTypesData: useTypesData, useTypesData: useTypesData,
demandCompList: demandCompList, demandCompList: demandCompList,
upHeadSimilarCaseList: similarCaseModalHeader, upHeadSimilarCaseList: similarCaseModalHeader,
similarCaseList: similarCaseList, similarCaseList: similarCaseList,
upHeadMoneyDetailList : moneyDetailModalHeader, upHeadMoneyDetailList: moneyDetailModalHeader,
moneyDetailList: moneyDetailList, moneyDetailList: moneyDetailList,
// 수요정보 신청현황 // 수요정보 신청현황
sdmInfoStatusList: [], sdmInfoStatusList: [],
defaultRules:defaultRules, defaultRules: defaultRules,
disableRules:disableRules, disableRules: disableRules,
upHeadSdmInfoStatus: upHeadSdmInfoStatus, upHeadSdmInfoStatus: upHeadSdmInfoStatus,
// 로그인관련 // 로그인관련
successNextPage : false, successNextPage: false,
successLogin: false, successLogin: false,
} }
} }
@@ -648,13 +649,13 @@ export const SdmReducer = (set: any): SdmActions => {
insertSdmData: async (data: DemandCompType) => { insertSdmData: async (data: DemandCompType) => {
const preRes = await getSdmInfoStatusList(data.dmdInfoId); const preRes = await getSdmInfoStatusList(data.dmdInfoId);
if(preRes?.dmdInfoId) { if (preRes?.dmdInfoId) {
toast.error('이미 등록된 수요처입니다.'); toast.error('이미 등록된 수요처입니다.');
return; return;
} }
const res = await postSdmData(data); const res = await postSdmData(data);
if(res) { if (res) {
set((state: SdmType) => ({ set((state: SdmType) => ({
Sdm: { Sdm: {
...state.Sdm, ...state.Sdm,
@@ -671,7 +672,7 @@ export const SdmReducer = (set: any): SdmActions => {
// 수요처 정보 // 수요처 정보
getDemandCompList: async (searchText: string, pageCnt: number) => { getDemandCompList: async (searchText: string, pageCnt: number) => {
const res = await getDemandCompList(searchText, pageCnt); const res = await getDemandCompList(searchText, pageCnt);
if(res.data.length === 0) { if (res.data.length === 0) {
set((state: SdmType) => ({ set((state: SdmType) => ({
Sdm: { Sdm: {
...state.Sdm, ...state.Sdm,
@@ -693,7 +694,7 @@ export const SdmReducer = (set: any): SdmActions => {
getSdmInfoStatusList: async (dmdInfoId: string) => { getSdmInfoStatusList: async (dmdInfoId: string) => {
const res = await getSdmInfoStatusList(dmdInfoId); const res = await getSdmInfoStatusList(dmdInfoId);
if(res.length === 0) { if (res.length === 0) {
set((state: SdmType) => ({ set((state: SdmType) => ({
Sdm: { Sdm: {
...state.Sdm, ...state.Sdm,
@@ -704,13 +705,13 @@ export const SdmReducer = (set: any): SdmActions => {
} }
//const sdmInfoStatusList : DemandCompBizType[] = []; //const sdmInfoStatusList : DemandCompBizType[] = [];
const sdmInfoStatusList : DemandCompBizType[]= res.demandInfo.map((el: DemandCompBizType, index: number) => { const sdmInfoStatusList: DemandCompBizType[] = res.demandInfo.map((el: DemandCompBizType, index: number) => {
const matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn); const matchingInfo = res.demandMatchings.find((matching: DemandMatchings) => matching.dmdInfoSn === el.dmdInfoSn);
const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청'; const status = matchingInfo?.splyFcltFlg?.trim() === 'Sub' ? '검토' : matchingInfo?.splyFcltFlg?.trim() === 'matched' ? '매칭완료' : '신청';
const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : ''; const ruseUtztnFcltNm = matchingInfo?.ruseUtztnFcltNm ? matchingInfo.ruseUtztnFcltNm : '';
return( { return ({
...el, ...el,
index: ++index, index: ++index,
bzmnNo: res.bzmnNo, bzmnNo: res.bzmnNo,
@@ -723,8 +724,8 @@ export const SdmReducer = (set: any): SdmActions => {
sggCd: res.sggCd, sggCd: res.sggCd,
useUsgCd: el.useUsgCd, useUsgCd: el.useUsgCd,
dmndTmng: el.dmndTmng, dmndTmng: el.dmndTmng,
dmdInfoSn : el.dmdInfoSn, dmdInfoSn: el.dmdInfoSn,
status : status, status: status,
splyCndtList: el.splyCndtList, splyCndtList: el.splyCndtList,
ruseUtztnFcltNm: ruseUtztnFcltNm || '' ruseUtztnFcltNm: ruseUtztnFcltNm || ''
}) })
@@ -749,25 +750,47 @@ export const SdmReducer = (set: any): SdmActions => {
}, },
// 유사사례 조회 // 유사사례 조회
getSimilarCaseList: async (part: string, value: number|string) => { getSimilarCaseList: async (part: string, value: number | string) => {
const res = await fetchGetSimilarCaseList(part, value); const res = await fetchGetSimilarCaseList(part, value);
if(res && res.length !== 0) { const similarCaseList = res.map((el: SimilarCaseType) => {
const maskedBizNm = el.ruseBizNm
? el.ruseBizNm.replace(/^(\s*)^\S+/, "***") // 첫 단어(공백 전까지) 치환
: el.ruseBizNm;
return {
...el,
ruseBizNm: maskedBizNm,
};
});
console.log(similarCaseList);
if (similarCaseList && similarCaseList.length !== 0) {
set((state: SdmType) => ({ set((state: SdmType) => ({
Sdm: { Sdm: {
...state.Sdm, ...state.Sdm,
similarCaseList: res, similarCaseList: similarCaseList,
} }
})) }))
return; return;
}else{ } else {
set((state: SdmType) => ({ set((state: SdmType) => ({
Sdm: { Sdm: {
...state.Sdm, ...state.Sdm,
similarCaseList: [], similarCaseList: [],
} }
})) }))
return; return;
} }
},
actionLogout: async () => {
sessionStorage.removeItem("user");
set((state: SdmType) => ({
Sdm: {
...state.Sdm,
successLogin: false,
}
}))
} }
} }
} }
+6 -8
View File
@@ -85,22 +85,20 @@ export const DmStatusReducer = (set: any): DmStatusActions => {
const boardData: DmStatusBoardType[] = data.data.map( const boardData: DmStatusBoardType[] = data.data.map(
(item: DmStatusDataType) => { (item: DmStatusDataType) => {
const regionText = cityCd.find((city) => item.region === city.val); const regionText = item.sidoNm; //cityCd.find((city) => item.region === city.val);
const sewage = item.sewage; const sewage = item.sewage;
const rainwater = item.rainwater; const rainwater = item.rainwater;
const reclaimed = item.reclaimed; const reclaimed = item.reclaimed;
const sewageCnt = item.sewageCnt; const sewageCnt = item.sewageCnt;
const rainwaterCnt = item.rainwaterCnt; const rainwaterCnt = item.rainwaterCnt;
const reclaimedCnt = item.reclaimedCnt; const reclaimedCnt = item.reclaimedCnt;
console.log("regionText ", regionText);
if (regionText && regionText.text) {
return { return {
region: regionText ? regionText.text : item.region, region: regionText ? regionText : item.region,
sewage: sewageCnt + "(" + sewage + ")", sewage: sewageCnt + "(" + sewage.toLocaleString() + ")",
rainwater: rainwaterCnt + "(" + rainwater + ")", rainwater: rainwaterCnt + "(" + rainwater.toLocaleString() + ")",
reclaimed: reclaimedCnt + "(" + reclaimed + ")", reclaimed: reclaimedCnt + "(" + reclaimed.toLocaleString() + ")",
}; };
}
} }
).filter((item): item is DmStatusBoardType => item !== undefined); ).filter((item): item is DmStatusBoardType => item !== undefined);
+6 -4
View File
@@ -1,14 +1,16 @@
export type DmStatusDataType = { export type DmStatusDataType = {
region: string; sidoNm: string; // 시도명
region: string; // 시도코드
sewage: string; sewage: string;
rainwater: string; rainwater: string;
reclaimed: string; reclaimed: string;
sewageCnt:string sewageCnt:string;
rainwaterCnt:string rainwaterCnt:string;
reclaimedCnt:string reclaimedCnt:string;
}; };
export type DmStatusBoardType = { export type DmStatusBoardType = {
sidoNm: string; // 시도명
region: string; region: string;
sewage: string; sewage: string;
rainwater: string; rainwater: string;
+19 -6
View File
@@ -1,23 +1,33 @@
//8880 //8880
import { AUTH_USER_ID, CLAIM_NAME } from "@/src/shared/config"; import { AUTH_USER_ID, CLAIM_NAME } from "@/src/shared/config";
import { DEV_URL_FO, DEV_URL_WR } from "../config";
import { getCookie } from "@common/components/lib/cookie"; import { getCookie } from "@common/components/lib/cookie";
const tokenId = getCookie(AUTH_USER_ID); const tokenId = getCookie(AUTH_USER_ID);
const Authorization = getCookie(CLAIM_NAME); const Authorization = getCookie(CLAIM_NAME);
export const fetchType = { export const fetchType = {
COMMON: "common", COMMON: "common",
WR: "wr", WR: "wr",
FO:'fo' FO: "fo",
SN: "sn"
}; };
const API_VERSION = "/api/v1"
const servers = {
common: "",
local: "",
fo: "/operation-service" + API_VERSION,
wr: "/reuse-service" + API_VERSION,
sn: "/sewerage-service" + API_VERSION,
}
interface RequestParams { interface RequestParams {
[key: string]: unknown; [key: string]: unknown;
} }
export const getFetch = async (type: string, url: string) => { export const getFetch = async (type: string, url: string) => {
const baseUrl = type === fetchType.FO ? DEV_URL_FO : DEV_URL_WR; const baseUrl = servers[type];
const response = await fetch(baseUrl + url, { const response = await fetch(baseUrl + url, {
method: "GET", method: "GET",
headers: { headers: {
@@ -35,7 +45,8 @@ export const getFetch = async (type: string, url: string) => {
}; };
export const postFetch = async (url: string, params: RequestParams) => { export const postFetch = async (url: string, params: RequestParams) => {
const response = await fetch(DEV_URL_WR + url, { const baseUrl = servers[fetchType.WR];
const response = await fetch(baseUrl + url, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -52,7 +63,8 @@ export const postFetch = async (url: string, params: RequestParams) => {
}; };
export const putFetch = async (url: string, params: RequestParams) => { export const putFetch = async (url: string, params: RequestParams) => {
const response = await fetch(DEV_URL_WR + url, { const baseUrl = servers[fetchType.WR];
const response = await fetch(baseUrl + url, {
method: "PUT", method: "PUT",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -69,7 +81,8 @@ export const putFetch = async (url: string, params: RequestParams) => {
}; };
export const deleteFetch = async (url: string, params: RequestParams) => { export const deleteFetch = async (url: string, params: RequestParams) => {
const response = await fetch(DEV_URL_WR + url, { const baseUrl = servers[fetchType.WR];
const response = await fetch(baseUrl + url, {
method: "DELETE", method: "DELETE",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -950,7 +950,7 @@ export function SdmInfoRegForm({
body={ body={
<ModalSimilarPage sply={sply} usageCd={usageCd} money={money} /> <ModalSimilarPage sply={sply} usageCd={usageCd} money={money} />
} }
bodyClass="sm:max-w-[100vw] w-[1400px] h-[900px]" bodyClass="sm:max-w-[100vw] w-[1400px] h-[100dvh] max-h-[900px] overflow-y-auto overflow-x-hidden"
open={isSimilarCase} open={isSimilarCase}
onOpenChange={(open) => !open && setIsSimilarCase(false)} onOpenChange={(open) => !open && setIsSimilarCase(false)}
noHeaderYn="Y" noHeaderYn="Y"
+8 -15
View File
@@ -1,13 +1,13 @@
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config"; import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config";
import { SERVER_API_FO_URL, SERVER_API_WR_URL } from "./src/shared/config/env"; // import { SERVER_API_FO_URL, SERVER_API_WR_URL } from "./src/shared/config/env";
// const CLAIM_NAME = "Authorization"; // const CLAIM_NAME = "Authorization";
// const AUTH_USER_ID = "token-id"; // const AUTH_USER_ID = "token-id";
const serverApiUrl = process.env.NEXT_PUBLIC_CS_SERVER_API_URL; const serverApiUrl = process.env.NEXT_PUBLIC_CS_SERVER_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 || "";
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; const GATEWAY_URL = process.env.NEXT_PUBLIC_GATEWAY_URL || "";
const BUSINESS_JUSO_API_URL = process.env.NEXT_PUBLIC_FINDADRESS_URL || ""; const BUSINESS_JUSO_API_URL = process.env.NEXT_PUBLIC_FINDADRESS_URL || "";
const AdressKey = process.env.NEXT_PRIVATE_WR_ADDRESS_KEY || ""; const AdressKey = process.env.NEXT_PRIVATE_WR_ADDRESS_KEY || "";
@@ -112,7 +112,7 @@ export function middleware(req: NextRequest) {
const url = req.nextUrl.clone(); const url = req.nextUrl.clone();
url.searchParams.set("TYPENAME", typename.replace("hasudo:", "")); url.searchParams.set("TYPENAME", typename.replace("hasudo:", ""));
queryParams = url.searchParams.toString(); queryParams = url.searchParams.toString();
newUrl = `${SEWERAGE_API_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; newUrl = `${GATEWAY_URL}/api/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`;
} }
console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`);
@@ -121,24 +121,17 @@ export function middleware(req: NextRequest) {
if (pathname.startsWith("/reuse-service")) { if (pathname.startsWith("/reuse-service")) {
const queryParams = searchParams.toString(); const queryParams = searchParams.toString();
const newUrl = `${SERVER_API_WR_URL}${pathname.replace("/reuse-service", "")}${queryParams ? `?${queryParams}` : "" const newUrl = `${GATEWAY_URL}${pathname}${queryParams ? `?${queryParams}` : ""}`;
}`;
console.log(`[Middleware] Rewriting from '/reuse-service' path to: ${newUrl}`); console.log(`[Middleware] Rewriting from '/reuse-service' path to: ${newUrl}`);
return NextResponse.rewrite(new URL(newUrl)); return NextResponse.rewrite(new URL(newUrl));
} } else if (pathname.startsWith("/operation-service")) {
if (pathname.startsWith("/operation-service")) {
const queryParams = searchParams.toString(); const queryParams = searchParams.toString();
const newUrl = `${SERVER_API_FO_URL}${pathname.replace("/operation-service", "")}${queryParams ? `?${queryParams}` : "" const newUrl = `${GATEWAY_URL}${pathname}${queryParams ? `?${queryParams}` : ""}`;
}`;
console.log(`[Middleware] Rewriting from '/operation-service' path to: ${newUrl}`); console.log(`[Middleware] Rewriting from '/operation-service' path to: ${newUrl}`);
return NextResponse.rewrite(new URL(newUrl)); return NextResponse.rewrite(new URL(newUrl));
} } else if (pathname.startsWith("/sewerage-service")) {
if (pathname.startsWith("/sewerage-service")) {
const queryParams = searchParams.toString(); const queryParams = searchParams.toString();
const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service", "")}${queryParams ? `?${queryParams}` : "" const newUrl = `${GATEWAY_URL}${pathname}${queryParams ? `?${queryParams}` : ""}`;
}`;
console.log(`[Middleware] Rewriting from '/sewerage-service' path to: ${newUrl}`); console.log(`[Middleware] Rewriting from '/sewerage-service' path to: ${newUrl}`);
return NextResponse.rewrite(new URL(newUrl)); return NextResponse.rewrite(new URL(newUrl));
} }
+3
View File
@@ -5,6 +5,9 @@ const subDomain =
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
output: "standalone", output: "standalone",
experimental: {
proxyTimeout: 600000,
},
async rewrites() { async rewrites() {
return { return {
beforeFiles: [ beforeFiles: [
+1 -1
View File
@@ -8,7 +8,7 @@ NEXT_PUBLIC_PROXY_HOST = http://localhost:3000
NEXT_PUBLIC_SUB_DOMAIN = http://localhost:13000 NEXT_PUBLIC_SUB_DOMAIN = http://localhost:13000
#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login #NEXT_PUBLIC_CM_LOGIN_PAGE_URL = http://localhost:3001/auth/login
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11083/operation-service
NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service/ NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11083/reuse-service
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 = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/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
+2 -3
View File
@@ -8,13 +8,12 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
#NEXT_PUBLIC_PROXY_HOST = https://devlarva.hasuon.or.kr #NEXT_PUBLIC_PROXY_HOST = https://devlarva.hasuon.or.kr
#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login #NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login
NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service
NEXT_PUBLIC_FO_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/operation-service/api/v1 NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service
NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000 NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local: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://172.29.143.87:8080/geoserver 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_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl
NEXT_PUBLIC_WR_SERVER_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/reuse-service/api/v1
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service
NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service NEXT_PUBLIC_DC_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/dc-service
NEXT_PUBLIC_SEWERAGE_API_URL = http://apigateway.iipbs-was.svc.cluster.local:8000/sewerage-service
NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact NEXT_PUBLIC_NGII_URL = http://172.29.143.87/poiact
NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x} NEXT_PUBLIC_NGII_PARAM = BDE2BEF39DAFEC293AB6730150F222AC&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={y}&tilerow={x}
@@ -9,67 +9,111 @@
* @author jsyang * @author jsyang
*/ */
export default function CalcRainEffect(data : any, weather='ALL') { export default function CalcRainEffect(data: any, weather = 'ALL') {
/* console.log("%c Calculate RainEffect !" , "background:blue;color:white"); const rtnDataAll: any = [];
console.log("%c Data Length :"+data.length+" Weather : "+weather , "background:yellow;color:blue");*/ const rtnDataSunny: any = [];
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) const rtnDataRain: any = [];
for(let idx = 0; idx < data.length; idx++) { let rtnData: any = [];
let rainEffectStd = 0;
for (let idx = 0; idx < data.length; idx++) {
const item = data[idx]; const item = data[idx];
if(item){ if (item.infoRnDay == null || item.infoRnDay == 'x' || item.infoRnDay == '') item.infoRnDay = 0;
if(item.infoRnDay && Number(item.infoRnDay) >= 3) { // 강우량이 3 이상인 경우 if (Number(item.infoRnDay) >= 3) { // 강우일
item.rainEffectDay = 1; rainEffectStd = 2;
} else { item.toBeInfoRnDay = item.infoRnDay;
item.rainEffectDay = 0; } else {
} rainEffectStd--;
if(item.infoRnDay == 'x'){
item.infoRnDay = '0.0';
item.toBeInfoRnDay = '0.0';
}else{
item.infoRnDay = Number(item.infoRnDay).toFixed(1);
item.toBeInfoRnDay = Number(item.infoRnDay).toFixed(1);
}
} }
}
// 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 if (rainEffectStd < 0) { // 청천일
for(let idx = 0; idx < data.length; idx++) { item.rainEffectDay = 0;
if(data[idx]) { rtnDataSunny.push(item);
// 하루 전이 강우영향일(3 이상)인 경우 } else if (rainEffectStd >= 0) { // 강우일 + 강우영향일
if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { item.rainEffectDay = 1;
data[idx]!.rainEffectDay = 1; if (idx > 2) {
}
// 이틀 전이 강우영향일(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){
// 전날 비가 왔고 오늘 강우량 3미만인 경우 전날 강우량이 3이상이면 오늘 toBeInfoRnDay을 전날 강우량으로 설정
if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.toBeInfoRnDay = data[idx-1]!.infoRnDay;
}
}
if(idx > 2){
// 전전날 비가 왔고 오늘 강우량 3미만인 경우 전전날 강우량이 3이상이면 오늘 toBeInfoRnDay을 전전날 강우량으로 설정 // 전전날 비가 왔고 오늘 강우량 3미만인 경우 전전날 강우량이 3이상이면 오늘 toBeInfoRnDay을 전전날 강우량으로 설정
if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { if (data[idx - 2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx - 2]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.toBeInfoRnDay = data[idx-2]!.infoRnDay; data[idx]!.toBeInfoRnDay = data[idx - 2]!.infoRnDay;
} }
} }
if (idx > 1) {
// 전날 비가 왔고 오늘 강우량 3미만인 경우 전날 강우량이 3이상이면 오늘 toBeInfoRnDay을 전날 강우량으로 설정
if (data[idx - 1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx - 1]?.infoRnDay.toString().trim()) >= 3) {
data[idx]!.toBeInfoRnDay = data[idx - 1]!.infoRnDay;
}
}
rtnDataRain.push(item);
} }
rtnDataAll.push(item);
} }
let rtnData : any = [];
// // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
// for(let idx = 0; idx < data.length; idx++) {
// const item = data[idx];
// if(item){
// if(item.infoRnDay && Number(item.infoRnDay) >= 3) { // 강우량이 3 이상인 경우
// item.rainEffectDay = 1;
// } else {
// item.rainEffectDay = 0;
// }
// if(item.infoRnDay == 'x'){
// item.infoRnDay = '0.0';
// item.toBeInfoRnDay = '0.0';
// }else{
// item.infoRnDay = Number(item.infoRnDay).toFixed(1);
// item.toBeInfoRnDay = Number(item.infoRnDay).toFixed(1);
// }
// }
// }
// // 이틀 전, 하루 전이 강우영향일(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){
// // 전날 비가 왔고 오늘 강우량 3미만인 경우 전날 강우량이 3이상이면 오늘 toBeInfoRnDay을 전날 강우량으로 설정
// if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) {
// data[idx]!.toBeInfoRnDay = data[idx-1]!.infoRnDay;
// }
// }
// if(idx > 2){
// // 전전날 비가 왔고 오늘 강우량 3미만인 경우 전전날 강우량이 3이상이면 오늘 toBeInfoRnDay을 전전날 강우량으로 설정
// if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) {
// data[idx]!.toBeInfoRnDay = data[idx-2]!.infoRnDay;
// }
// }
// }
// }
// if (weather === 'ALL') {
// rtnData = data;
// } else if (weather === 'SUNNY') {
// rtnData = data.filter((item: any) => item.rainEffectDay === 0);
// } else {
// rtnData = data.filter((item: any) => item.rainEffectDay === 1);
// }
if (weather === 'ALL') { if (weather === 'ALL') {
rtnData = data; rtnData = rtnDataAll;
} else if (weather === 'SUNNY') { } else if (weather === 'SUNNY') {
rtnData = data.filter((item: any) => item.rainEffectDay === 0); rtnData = rtnDataSunny;
} else { } else {
rtnData = data.filter((item: any) => item.rainEffectDay === 1); rtnData = rtnDataRain;
} }
return rtnData; return rtnData;
} }
+50 -23
View File
@@ -4,12 +4,39 @@
item: Record<string, unknown>; item: Record<string, unknown>;
} }
export const roundNumber = (value : any, decimals: number) => { /**
* yyyymm 형태의 문자열을 받아 해당 월의 일수를 반환
* @param {string} yyyymm - 예: "202502", "202412"
* @returns {number} 해당 월의 일수 (예: 28, 29, 30, 31)
*/
export const getDaysInMonth = (yyyymm: string) => {
if (typeof yyyymm !== 'string' || yyyymm.length !== 6) {
throw new Error("입력은 'yyyymm' 형식의 문자열이어야 합니다. 예: '202502'");
}
const year = parseInt(yyyymm.slice(0, 4), 10); // "2025" -> 2025
const month = parseInt(yyyymm.slice(4, 6), 10); // "02" -> 2
if (isNaN(year) || isNaN(month) || month < 1 || month > 12) {
throw new Error("유효한 년/월이 아닙니다.");
}
// Date(year, month, 0) -> 전달의 마지막 날
// month에 '다음달'을 넣고, 일(day)에 0을 주면 해당 월의 마지막 날짜가 됨
return new Date(year, month, 0).getDate();
}
export const roundNumber = (value: any, decimals: number) => {
if (typeof value === 'number') { if (typeof value === 'number') {
return addCommas((Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals)).toFixed(decimals)); return addCommas((Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals)).toFixed(decimals));
} else if (typeof value === 'string' && !isNaN(Number(value))) { } else if (typeof value === 'string') {
return addCommas(Number(value).toFixed(decimals)); // 콤마가 포함된 문자열 처리 ('1,083.0' 같은 경우)
const cleanedValue = value.replace(/,/g, '');
if (!isNaN(Number(cleanedValue))) {
return addCommas(Number(cleanedValue).toFixed(decimals));
}
} }
return value; // 변환 불가능한 경우 원래 값 반환
} }
export const addCommas = (value: string | number): any => { export const addCommas = (value: string | number): any => {
@@ -18,48 +45,48 @@ export const addCommas = (value: string | number): any => {
index === 0 ? part : part.replace(/(\d{3})/g, '$1,') index === 0 ? part : part.replace(/(\d{3})/g, '$1,')
).join('.'); ).join('.');
} else if (typeof value === 'string') { } else if (typeof value === 'string') {
return value.includes('.')?value.split('.').map((part, index) => return value.includes('.') ? value.split('.').map((part, index) =>
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
).join('.'):String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ","); ).join('.') : String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
} }
} }
export default function DataForm({ type, column, item }: DataFormProps) { export default function DataForm({ type, column, item }: DataFormProps) {
if(item) { if (item) {
const value = item[column]; const value = item[column];
switch(type){ switch (type) {
case 'date': case 'date':
if(value && typeof value === 'string' && value.length >= 8) if (value && typeof value === 'string' && value.length >= 8 && !value.includes('-'))
item[column] = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6, 8); item[column] = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6, 8);
break; break;
case 'number': case 'number':
if(value && value != '') { if (value && value != '') {
item[column] = value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); item[column] = value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
} }
break; break;
case 'float0': case 'float0':
if(value) { if (value) {
item[column] = item[column] = String(value).includes('.')?String(Math.round(parseFloat(value.toString().replace(/,/g, '')) * 1) / 1).split('.').map((part, index) => item[column] = item[column] = String(value).includes('.') ? String(Math.round(parseFloat(value.toString().replace(/,/g, '')) * 1) / 1).split('.').map((part, index) =>
index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part
).join('.') ).join('.')
: String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ","); : String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
} }
break; break;
case 'float1': case 'float1':
if(value) { if (value) {
item[column] = roundNumber(value, 1); item[column] = roundNumber(value, 1);
} }
break; break;
case 'float2': case 'float2':
if(value) { if (value) {
item[column] = roundNumber(value, 2); item[column] = roundNumber(value, 2);
} }
break; break;
case 'float3': case 'float3':
if(value) { if (value) {
item[column] = roundNumber(value, 3); item[column] = roundNumber(value, 3);
} }
break; break;
} }
} }
} }
@@ -4,14 +4,14 @@ import ListDiv from '@common/business_components/ui/list_div';
import { Table, TableCell, TableHead, TableRow } from '@common/components/ui'; import { Table, TableCell, TableHead, TableRow } from '@common/components/ui';
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
type FacilityTermModalHeaderProps<T extends { msrDt: string }> = { type FacilityTermModalHeaderProps<T extends { msrDt: string }> = { // T는 반드시 msrDt: string 필드를 가져야 한다
fcltyCd : string; fcltyCd: string;
fcltyName: string; fcltyName: string;
tabName: string; tabName: string;
searchYear: string; searchYear: string;
searchList: T[]; searchList: T[];
ref: React.RefObject<ReturnType<T>>; ref: React.RefObject<ReturnType<T>>;
queryClick:(returnType:ReturnType<T>) => void; queryClick: (returnType: ReturnType<T>) => void;
} }
export type ReturnType<T> = { export type ReturnType<T> = {
@@ -21,27 +21,28 @@ export type ReturnType<T> = {
filteredList: T[]; filteredList: T[];
} }
export default function FacilityTermModalHeader<T extends { msrDt: string }>({ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
searchList, searchList,
fcltyName, fcltyName,
tabName, tabName,
searchYear, searchYear,
queryClick, queryClick,
ref ref
}: FacilityTermModalHeaderProps<T & { msrDt: string }>) { }: FacilityTermModalHeaderProps<T & { msrDt: string }>) {
const {Common} = useFoStore((state) => state); const { Common } = useFoStore((state) => state);
const { selectFlowPanel } = Common; const { selectFlowPanel } = Common;
const [startDate, setStartDate] = useState<Date>(new Date(Number(searchYear), 0, 1)); const [startDate, setStartDate] = useState<Date>(new Date(Number(searchYear), 0, 1));
const [endDate, setEndDate] = useState<Date>(new Date(Number(searchYear), 11, 31)); const [endDate, setEndDate] = useState<Date>(new Date(Number(searchYear), 11, 31));
const startPickerRef = useRef<HTMLDivElement>(null); const startPickerRef = useRef<HTMLDivElement>(null);
const endPickerRef = useRef<HTMLDivElement>(null); const endPickerRef = useRef<HTMLDivElement>(null);
const [flowPanel, setFlowPanel] = useState<string>(selectFlowPanel[0]?.val ?? '00'); const [flowPanel, setFlowPanel] = useState<string>(selectFlowPanel[0]?.val ?? '0'); // 강수구분 : 초기값 "전체"
const [copySearchList, setCopySearchList] = useState<T[]>(searchList); const [copySearchList, setCopySearchList] = useState<T[]>(searchList);
const [standSearchList, setStandSearchList] = useState<T[]>(searchList); const [standSearchList, setStandSearchList] = useState<T[]>(searchList);
const isDateInRanges = (date: Date) => { const isDateInRanges = (date: Date) => {
const standYear = parseInt(searchYear); const standYear = parseInt(searchYear);
const dateRanges:{start:Date, end:Date}[] = []; const isLeapYear = (standYear % 4 === 0 && standYear % 100 !== 0) || (standYear % 400 === 0);
const dateRanges: { start: Date, end: Date }[] = [];
if (tabName.includes("_summer")) { if (tabName.includes("_summer")) {
dateRanges.push({ dateRanges.push({
@@ -51,7 +52,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
} else if (tabName.includes("_winter")) { } else if (tabName.includes("_winter")) {
dateRanges.push({ dateRanges.push({
start: new Date(standYear, 0, 1), start: new Date(standYear, 0, 1),
end: new Date(standYear, 1, 28) end: new Date(standYear, 1, isLeapYear ? 29 : 28)
}); });
} else { } else {
dateRanges.push({ dateRanges.push({
@@ -70,67 +71,69 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
useEffect(() => { useEffect(() => {
let startDate = new Date(Number(searchYear), 0, 1); let startDate = new Date(Number(searchYear), 0, 1);
let endDate = new Date(Number(searchYear), 11, 31); let endDate = new Date(Number(searchYear), 11, 31);
const standYear = Number(searchYear);
const isLeapYear = (standYear % 4 === 0 && standYear % 100 !== 0) || (standYear % 400 === 0);
if(tabName.includes("_summer")) { if (tabName.includes("_summer")) { // 하절기
startDate = new Date(Number(searchYear), 5, 1); startDate = new Date(Number(searchYear), 5, 1); // 6월 ~
endDate = new Date(Number(searchYear), 7, 31); endDate = new Date(Number(searchYear), 7, 31); // 8월
setStartDate(startDate); setStartDate(startDate);
setEndDate(endDate); setEndDate(endDate);
} else if (tabName.includes("_winter")) { } else if (tabName.includes("_winter")) { // 동절기
startDate = new Date(Number(searchYear), 0, 1); startDate = new Date(Number(searchYear), 0, 1); // 1월 ~
endDate = new Date(Number(searchYear), 1, 28); endDate = new Date(Number(searchYear), 1, isLeapYear ? 29 : 28); // 2월
setStartDate(startDate); setStartDate(startDate);
setEndDate(endDate); setEndDate(endDate);
} else { } else { // 연간
startDate = new Date(Number(searchYear), 0, 1); startDate = new Date(Number(searchYear), 0, 1);
endDate = new Date(Number(searchYear), 11, 31); endDate = new Date(Number(searchYear), 11, 31);
setStartDate(startDate); setStartDate(startDate);
setEndDate(endDate); setEndDate(endDate);
} }
let filteredData: T[] = []; let filteredData: T[] = [];
if(tabName.includes("_rain")) { if (tabName.includes("_rain")) { // 강우시
filteredData = searchList.filter((item) => { filteredData = searchList.filter((item) => {
const itemDate = new Date((item as T & { msrDt: string }).msrDt); const itemDate = new Date((item as T & { msrDt: string }).msrDt);
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 rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay; const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay;
if(flowPanel === '2'){ if (flowPanel === '2') { //3~10mm미만
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
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') { //10~20mm미만
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 10 && infoRnDay < 20; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 10 && infoRnDay < 20;
} else if(flowPanel === '4'){ } else if (flowPanel === '4') { //20~30mm미만
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 20 && infoRnDay < 30; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 20 && infoRnDay < 30;
} else if(flowPanel === '5'){ } else if (flowPanel === '5') { //30~40mm미만
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 30 && infoRnDay < 40; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 30 && infoRnDay < 40;
} else if(flowPanel === '6'){ } else if (flowPanel === '6') { //40~50mm미만
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 40 && infoRnDay < 50; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 40 && infoRnDay < 50;
} else if(flowPanel === '7'){ } else if (flowPanel === '7') { //50~60mm미만
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 50 && infoRnDay < 60; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 50 && infoRnDay < 60;
} else if(flowPanel === '8'){ } else if (flowPanel === '8') {
const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60;
} else { } else {
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (rainEffectDay ===1); return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (rainEffectDay === 1);
} }
}); });
} else if(tabName.includes("_chuncheon")) { } else if (tabName.includes("_chuncheon")) { // 청천시
filteredData = searchList.filter((item) => { filteredData = searchList.filter((item) => {
const itemDate = new Date((item as T & { msrDt: string }).msrDt); const itemDate = new Date((item as T & { msrDt: string }).msrDt);
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 rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay; const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay;
return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && rainEffectDay==0; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && rainEffectDay == 0;
}); });
} else { } else {
filteredData = searchList.filter((item) => { filteredData = searchList.filter((item) => {
@@ -146,7 +149,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
}, [searchList, searchYear, tabName, flowPanel]); }, [searchList, searchYear, tabName, flowPanel]);
const handleStartDateSelect = (day: Date | undefined) => { const handleStartDateSelect = (day: Date | undefined) => {
if(day && day > endDate) { if (day && day > endDate) {
alert('종료일은 시작일 이전일 수 없습니다.'); alert('종료일은 시작일 이전일 수 없습니다.');
return; return;
} }
@@ -169,7 +172,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
}; };
const handleEndDateSelect = (day: Date | undefined) => { const handleEndDateSelect = (day: Date | undefined) => {
if(day && day < startDate) { if (day && day < startDate) {
alert('종료일은 시작일 이후일 수 없습니다.'); alert('종료일은 시작일 이후일 수 없습니다.');
return; return;
} }
@@ -190,7 +193,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
}); });
setCopySearchList(filteredData); setCopySearchList(filteredData);
}; };
const fncSetFilteredList = useCallback(() => { const fncSetFilteredList = useCallback(() => {
queryClick({ queryClick({
startDate: startDate, startDate: startDate,
@@ -203,9 +206,9 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
useEffect(() => { useEffect(() => {
fncSetFilteredList(); fncSetFilteredList();
}, [fncSetFilteredList]); }, [fncSetFilteredList]);
useEffect(() => { useEffect(() => {
if(ref && ref.current) { if (ref && ref.current) {
const customRef = ref.current; const customRef = ref.current;
customRef.startDate = startDate; customRef.startDate = startDate;
customRef.endDate = endDate; customRef.endDate = endDate;
@@ -222,18 +225,18 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
<TableRow className="!h-[20px]"> <TableRow className="!h-[20px]">
<TableHead className="w-[120px]">{'시설명'}</TableHead> <TableHead className="w-[120px]">{'시설명'}</TableHead>
{tabName === "tab_term_rain" ? <TableCell className="w-[300px]">{fcltyName}</TableCell> : {tabName === "tab_term_rain" ? <TableCell className="w-[300px]">{fcltyName}</TableCell> :
<TableCell className="w-[380px]">{fcltyName}</TableCell>} <TableCell className="w-[380px]">{fcltyName}</TableCell>}
{tabName === "tab_term_rain" && ( {tabName === "tab_term_rain" && (
<> <>
<TableHead className="w-[120px]">{'강수구분'}</TableHead> <TableHead className="w-[120px]">{'강수구분'}</TableHead>
<TableCell className="w-[250px]"> <TableCell className="w-[250px]">
<div className="justify-center"> <div className="justify-center">
<SelectBox <SelectBox
selectArray={selectFlowPanel} selectArray={selectFlowPanel}
value={flowPanel} value={flowPanel}
onSelectValue={(val) => setFlowPanel(val.toString())} onSelectValue={(val) => setFlowPanel(val.toString())}
className="mx-3 w-[150px]" className="mx-3 w-[150px]"
label="" label=""
selectClass="w-full p-1 border rounded bg-white" selectClass="w-full p-1 border rounded bg-white"
/> />
</div> </div>
@@ -244,7 +247,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
<TableCell className=""> <TableCell className="">
<div className="flex"> <div className="flex">
<div ref={startPickerRef} className="flex justify-center"> <div ref={startPickerRef} className="flex justify-center">
<DatePickerRange <DatePickerRange
mode="single" mode="single"
selected={startDate} selected={startDate}
onSelect={(date) => handleStartDateSelect(date as Date)} onSelect={(date) => handleStartDateSelect(date as Date)}
@@ -258,7 +261,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({
<DatePickerRange <DatePickerRange
mode="single" mode="single"
selected={endDate} selected={endDate}
onSelect={(date) => handleEndDateSelect(date as Date)} onSelect={(date) => handleEndDateSelect(date as Date)}
className="w-full p-1 border rounded bg-white" className="w-full p-1 border rounded bg-white"
disabled={(date) => !isDateInRanges(date)} disabled={(date) => !isDateInRanges(date)}
defaultMonth={endDate} defaultMonth={endDate}
@@ -271,7 +271,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}:
(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 === 0)?<TableCell rowSpan={5} 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 === '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 === 11)?<TableCell rowSpan={2} 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 === '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 === 'groundWaterAvg'||head.id === 'groundWaterSummer'||head.id === 'groundWaterWinter')&&(index === 0)?<TableCell rowSpan={7} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{Number.isNaN(el[head.id]) ? "" : 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 === 7)?<TableCell rowSpan={6} 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 === 'rdi'&&index === 0)?<TableCell rowSpan={7} 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}>{el[head.id]}</TableCell>: (head.id === 'rdi'&&index === 7)?<TableCell rowSpan={6} className="text-right" style={{ whiteSpace: 'pre-line' }} key={head.id+index}>{el[head.id]}</TableCell>:
@@ -6,7 +6,10 @@
"use client" "use client"
import { useFoStore } from "@/app/store"; import { useFoStore } from "@/app/store";
import { ContentsDiv, downloadExcel, downloadMultipleExcel, filePickedBlobArray, MainDiv, SelectBox, UITab, type SelectDataType } from "@common/business_components"; import {
ContentsDiv, downloadExcelFormat, downloadMultipleExcel, filePickedBlobArrayFormat, MainDiv
, SelectBox, UITab, type SelectDataType
} from "@common/business_components";
import { Button, TabsContent } from "@common/components/ui"; import { Button, TabsContent } from "@common/components/ui";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import DashBoardFclty from "../dashboardMain/page"; import DashBoardFclty from "../dashboardMain/page";
@@ -50,13 +53,17 @@ type FacilityType = {
export default function DashBoard() { export default function DashBoard() {
// 입력값 상태 관리 // 입력값 상태 관리
const { Common, initializeCommonData, searchMainGraph, searchRainManage, searchOperationStatus, OperationStatus, RainManage, MainGraph, PlanFclty } = useFoStore((state) => state); const { Common, initializeCommonData, searchMainGraph, searchRainManage, searchOperationStatus
, OperationStatus, RainManage, MainGraph, PlanFclty } = useFoStore((state) => state);
const [activeTab, setActiveTab] = useState<string>('facilityInfo'); const [activeTab, setActiveTab] = useState<string>('facilityInfo');
const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([{ text: "전체", val: '0' }]); const [filteredSigunData, setFilteredSigunData] = useState<SelectDataType[]>([{ text: "전체", val: '0' }]);
const [sidoValue, setSidoValue] = useState<string>('0'); const [sidoValue, setSidoValue] = useState<string>('0');
const [sigunValue, setSigunValue] = useState<string>('0'); const [sigunValue, setSigunValue] = useState<string>('0');
const { isInit, selectSearchYear, btnClass, selectSidoData, selectSigunData, } = Common; const { isInit, selectSearchYear, btnClass, selectSidoData, selectSigunData, } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { planFcltyList } = PlanFclty; const { planFcltyList } = PlanFclty;
const { operationalStatusList } = OperationStatus; const { operationalStatusList } = OperationStatus;
const { excelList } = RainManage; const { excelList } = RainManage;
@@ -72,7 +79,7 @@ export default function DashBoard() {
/******************선택된 데이터******************/ /******************선택된 데이터******************/
const [searchYear, setSearchYear] = useState<string>(selectSearchYear[0]?.val || '0'); // 연도 const [searchYear, setSearchYear] = useState<string>(defaultSearchYear); // 연도
// 시설명 // 시설명
const [fcltyList, setFcltyList] = useState<FacilityType>({ const [fcltyList, setFcltyList] = useState<FacilityType>({
bscFctCd: '11000SW001R', bscFctCd: '11000SW001R',
@@ -135,13 +142,11 @@ export default function DashBoard() {
} }
} }
const excelDownload = () => { const excelDownload = async () => {
if (!fcltyList.bscFctCd) return; if (!fcltyList.bscFctCd) return;
switch (activeTab) { switch (activeTab) {
case 'facilityInfo': // 시설정보 및 운영현황 case 'facilityInfo': // 시설정보 및 운영현황
searchOperationStatus(false, searchYear, fcltyList.bscFctCd).then(() => { setTimeout(() => { makeExcelData(); }, 200); });
const makeExcelData = async () => { const makeExcelData = async () => {
fetch(`/mainDashBoard.xlsx`, {}).then(async (response) => { fetch(`/mainDashBoard.xlsx`, {}).then(async (response) => {
if (!response.ok) { if (!response.ok) {
@@ -191,20 +196,27 @@ export default function DashBoard() {
headerNum: 3, headerNum: 3,
headerRange: 'A1:G2', headerRange: 'A1:G2',
sheetName: '운영실태', sheetName: '운영실태',
startCol: 'A' startCol: 'A',
decimalRange0: 'B3:G2,B9:B11',
decimalRange1: 'B5:G5',
}, },
{ {
data: excelData2, data: excelData2,
headerNum: 4, headerNum: 4,
headerRange: 'A1:Q3', headerRange: 'A1:Q3',
sheetName: '운영실태', sheetName: '운영실태',
startCol: 'C' startCol: 'C',
decimalRange0: 'C4:O8',
decimalRange1: 'C9:L10,M11:O11',
decimalRange3: 'C11:L16',
} }
]; ];
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환 // 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
await filePickedBlobArray(blobRet, '시설정보및운영현황', sheetParameter); await filePickedBlobArrayFormat(blobRet, '시설정보및운영현황', sheetParameter);
}); });
}; };
await searchOperationStatus(false, searchYear, fcltyList.bscFctCd);
await makeExcelData();
break; break;
case 'mainGraph': // 주요그래프 case 'mainGraph': // 주요그래프
@@ -255,7 +267,15 @@ export default function DashBoard() {
case 'rainManage': // 강우일 운영현황 case 'rainManage': // 강우일 운영현황
searchRainManage(searchYear, fcltyList.bscFctCd, true); searchRainManage(searchYear, fcltyList.bscFctCd, true);
if (excelList && excelList.length > 0) { if (excelList && excelList.length > 0) {
downloadExcel({ data: excelList as unknown as JSON[], fileName: '강우일 운영현황', sheetNameArray: ['강우일 운영현황'], headerRange: 'A1:T1' }); downloadExcelFormat({
data: excelList as unknown as JSON[],
fileName: '강우일 운영현황',
sheetNameArray: ['강우일 운영현황'],
headerRange: 'A1:T1',
decimalArray0: [2,3],
decimalArray1: [1,4,5,6,7,10,11,12,15,16,17],
decimalArray3: [8,9,13,14,18,19],
});
} }
break; break;
// Add other cases for different tabs as needed // Add other cases for different tabs as needed
@@ -280,7 +300,7 @@ export default function DashBoard() {
trtFrfNm: '표준활성슬러지법, MLE, A2O', trtFrfNm: '표준활성슬러지법, MLE, A2O',
efflWqltStndrdNm: '500톤 이상(Ⅲ지역)' efflWqltStndrdNm: '500톤 이상(Ⅲ지역)'
}); });
setSearchYear(selectSearchYear[0]?.val || '0'); setSearchYear(defaultSearchYear);
searchFcltyList.bscFctNm = '난지'; searchFcltyList.bscFctNm = '난지';
setSidoValue('0'); setSidoValue('0');
@@ -15,27 +15,13 @@ export type facilityInfoProps = {
fcltyList?: { bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string, efflWqltStndrdNm: string }[]; fcltyList?: { bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string, efflWqltStndrdNm: string }[];
}; };
export default function RainManageTab({searchYear = '', fcltyList = []}: facilityInfoProps) { export default function RainManageTab({ searchYear = '', fcltyList = [] }: facilityInfoProps) {
const {
Common,
searchRainManage,
RainManage
} = useFoStore((state) => state);
const { Common, searchRainManage, RainManage } = useFoStore((state) => state);
const [hasSearched, setHasSearched] = useState(false); const [hasSearched, setHasSearched] = useState(false);
// 이전 시설코드 저장 const [prevFacilityCode, setPrevFacilityCode] = useState<string>(''); // 이전 시설코드 저장
const [prevFacilityCode, setPrevFacilityCode] = useState<string>(''); const { isInit, } = Common;
const { upHeadListRainManage, rainManageList, } = RainManage;
const {
isInit,
} = Common;
const {
upHeadListRainManage,
rainManageList,
} = RainManage;
const tableData = fcltyList; const tableData = fcltyList;
useEffect(() => { useEffect(() => {
@@ -50,17 +36,17 @@ export default function RainManageTab({searchYear = '', fcltyList = []}: facilit
useEffect(() => { useEffect(() => {
setHasSearched(false); setHasSearched(false);
}, [searchYear]); }, [searchYear]);
return ( return (
<div> <div>
<UiTable <UiTable
headName="" headName=""
tableData={rainManageList} tableData={rainManageList}
headlist={upHeadListRainManage} headlist={upHeadListRainManage}
pageSize={0} pageSize={0}
total={0} total={0}
cellClick={undefined} cellClick={undefined}
onPageChange={() => {}} onPageChange={() => { }}
widthFixed={true} widthFixed={true}
> >
</UiTable> </UiTable>
@@ -9,7 +9,7 @@ import CalcRainEffect from "@/app/components/common/CalcRainEffect";
import { roundNumber } from "@/app/components/common/DataForm"; import { roundNumber } from "@/app/components/common/DataForm";
import { useFoStore } from "@/app/store"; import { useFoStore } from "@/app/store";
import type { PrecipitationPropsDetailProps } from "@/app/store/facilityPrecipitation"; import type { PrecipitationPropsDetailProps } from "@/app/store/facilityPrecipitation";
import { DatePickerRange, downloadExcel, UiTable } from "@common/business_components/ui"; import { DatePickerRange, downloadExcelHeaders, UiTable } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui"; import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
@@ -45,7 +45,7 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
const standYear = parseInt(props.searchYear); const standYear = parseInt(props.searchYear);
return [{ return [{
start: new Date(standYear, 0, 1), start: new Date(standYear, 0, 1),
end: new Date(standYear, 11, 31) end: new Date(standYear, 11, 31) //월의 index는 0부터 시작
}]; }];
}; };
@@ -112,7 +112,6 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
const getTableData = () => { const getTableData = () => {
const totals = calculateTotals(); const totals = calculateTotals();
totals.infoRnDay = roundNumber(totals.infoRnDay, 1); totals.infoRnDay = roundNumber(totals.infoRnDay, 1);
return [ return [
{ {
bscFctCd: "", bscFctCd: "",
@@ -157,19 +156,26 @@ export default function PrecipitationModal(props: PrecipitationModalProps) {
const excelDownload = () => { const excelDownload = () => {
const totData = getTableData(); const totData = getTableData();
const excelDownList: any[] = [];
// 헤더 순서를 명시적으로 정의
const headers = ["날짜", "강수량(mm/일)", "강우일(일)", "강우영향일(일)"] as const;
const excelDownList: Record<string, string | number>[] = [];
if(totData.length > 0){ if(totData.length > 0){
totData.forEach((item) => { totData.forEach((item) => {
excelDownList.push({ // 순서를 보장하기 위해 헤더 순서대로 객체 생성
"날짜": item.rainDt, const row: Record<string, string | number> = {};
"강수량(mm/일)": roundNumber(item.infoRnDay, 1), row[headers[0]] = item.rainDt;
"강우일(일)": roundNumber(item.rainDay, 0), row[headers[1]] = roundNumber(item.infoRnDay, 1);
"강우영향일(일)": roundNumber(item.rainEffectDay, 0), row[headers[2]] = roundNumber(item.rainDay, 0);
}); row[headers[3]] = roundNumber(item.rainEffectDay, 0);
excelDownList.push(row);
}); });
} }
if (excelDownList && excelDownList.length > 0) { if (excelDownList && excelDownList.length > 0) {
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 강수현황', sheetNameArray: ['지하수유입량'], headerRange: 'A1:D1' }); downloadExcelHeaders({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 강수현황'
, sheetNameArray: ['지하수유입량'], headerRange: 'A1:D1', headers });
} else if (totData.length == 0) { } else if (totData.length == 0) {
alert('다운받을 데이터가 없습니다.'); alert('다운받을 데이터가 없습니다.');
} }
@@ -5,11 +5,11 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common"; import type { TableUpperProps } from "@/app/store/common";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, 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, useContext, useEffect, useRef, useState } from "react";
import PrecipitationModal from "./modal/page"; import PrecipitationModal from "./modal/page";
import LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UnderComment from "@/app/components/common/UnderComment"; import UnderComment from "@/app/components/common/UnderComment";
@@ -22,6 +22,11 @@ export default function FacilityPrecipitation() {
,initializeCommonData ,initializeCommonData
,searchFacilityPrecipitationList ,searchFacilityPrecipitationList
} = useFoStore((state) => state) || { processAreaList: { processAreaList: [] }}; } = useFoStore((state) => state) || { processAreaList: { processAreaList: [] }};
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
@@ -37,6 +42,11 @@ export default function FacilityPrecipitation() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
labelArray, labelArray,
} = FacilityPrecipitationSearch; } = FacilityPrecipitationSearch;
@@ -45,7 +55,6 @@ export default function FacilityPrecipitation() {
upHeadList1, upHeadList1,
upHeadList2, upHeadList2,
upHeadList3, upHeadList3,
excelList,
facilityPrecipitation, facilityPrecipitation,
facilityPrecipitationCount, facilityPrecipitationCount,
isLoading, isLoading,
@@ -90,8 +99,9 @@ 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>(defaultSearchYear);
// 엑셀다운로드 트리거
const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
/** /**
* 페이지 함수 * 페이지 함수
*/ */
@@ -102,7 +112,7 @@ export default function FacilityPrecipitation() {
// 상태값 설정 // 상태값 설정
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
setSearchYear(selectSearchYear[0]?.val || "0"); setSearchYear(defaultSearchYear);
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -111,7 +121,7 @@ export default function FacilityPrecipitation() {
input.value = ""; input.value = "";
} }
} }
searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0"); searchFacilityPrecipitationList(1, 10, defaultSearchYear);
} }
// 모달 닫기 // 모달 닫기
@@ -134,20 +144,9 @@ export default function FacilityPrecipitation() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0"); searchFacilityPrecipitationList(1, 10, defaultSearchYear);
} }
}, [isInit, initializeCommonData, searchFacilityPrecipitationList, selectSearchYear]); }, [isInit, initializeCommonData, searchFacilityPrecipitationList, defaultSearchYear]);
useEffect(() => {
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
fileName: '시설별 강수현황',
sheetNameArray: ['시설별 강수현황'],
headerRange: 'A1:N1'
});
}
}, [excelList]);
useEffect(() => { useEffect(() => {
if (facilityPrecipitation.length > 0) { if (facilityPrecipitation.length > 0) {
@@ -159,7 +158,7 @@ export default function FacilityPrecipitation() {
* 콜백함수 * 콜백함수
*/ */
// 조회 // 조회
const searchFacilityPrecipitation = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { const searchFacilityPrecipitation = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
let nameCd, partStr let nameCd, partStr
switch (partValue) { switch (partValue) {
case 'R': case 'R':
@@ -177,9 +176,9 @@ export default function FacilityPrecipitation() {
break; break;
} }
if (partStr.length > 1 || operationValue!== '0' || fcltCpct !== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) { if (partStr.length > 1 || operationValue!== '0' || fcltCpct !== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchFacilityPrecipitationList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchFacilityPrecipitationList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} else { } else {
searchFacilityPrecipitationList(pageNo, pageCnt, searchYear); await searchFacilityPrecipitationList(pageNo, pageCnt, searchYear);
} }
}, [operationValue, fcltyName, searchFacilityPrecipitationList, searchYear, fcltCpct]); }, [operationValue, fcltyName, searchFacilityPrecipitationList, searchYear, fcltCpct]);
@@ -190,9 +189,43 @@ export default function FacilityPrecipitation() {
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
// 엑셀다운로드 // 엑셀다운로드
const excelDownload = useCallback((searchReturn: ReturnType) => { const excelDownload = useCallback(async (searchReturn: ReturnType) => {
searchFacilityPrecipitation(searchReturn, 1, 10000); if (isExcelDownClick) return;
}, [searchFacilityPrecipitation]); // if (ref.current.partValue === 'A') { // 행정별
// if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
setIsExcelDownClick(true);
try {
await searchFacilityPrecipitation(searchReturn, 1, 10000);
const latestExcelList = store.getState().FacilityPrecipitation.excelList || [];
if (latestExcelList.length > 0) {
downloadExcelFormat({
data: latestExcelList as unknown as JSON[],
fileName: '시설별 강수현황',
sheetNameArray: ['시설별 강수현황'],
headerRange: 'A1:N1',
decimalArray0: [9, 11, 12, 13],
});
} else {
alert("조회된 결과가 없습니다.");
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchFacilityPrecipitation, store]);
// 페이지 변경 // 페이지 변경
const handlePageChange = useCallback((page: number) => { const handlePageChange = useCallback((page: number) => {
@@ -209,10 +242,13 @@ export default function FacilityPrecipitation() {
<ContentsDiv> <ContentsDiv>
<SearchBaseForm <SearchBaseForm
leftChildren={<> leftChildren={<>
<SelectBox className="col-span-3" label={labelArray[3] as string} selectArray={selectUpdownData} onSelectValue={(val) => setFcltCpct(val.toString())} value={fcltCpct} selectClass={undefined} /> <SelectBox className="col-span-3" label={labelArray[3] as string} selectArray={selectUpdownData}
onSelectValue={(val) => setFcltCpct(val.toString())} value={fcltCpct} selectClass={undefined} />
<SearchInput className={"col-span-3"} label={labelArray[4] as string} textValue={fcltyName} setText={setFcltyName} /> <SearchInput className={"col-span-3"} label={labelArray[4] as string} textValue={fcltyName} setText={setFcltyName} />
<SelectBox className="col-span-3" label={labelArray[6] as string} selectArray={selectSearchYear} onSelectValue={(val) => setSearchYear(val.toString())} value={searchYear} selectClass={undefined} /> <SelectBox className="col-span-3" label={labelArray[6] as string} selectArray={selectSearchYear}
<SelectBox className="col-span-3" label={labelArray[5] as string} selectArray={selectOperationData} onSelectValue={(val) => setOperationValue(val.toString())} value={operationValue} selectClass={undefined} /> onSelectValue={(val) => setSearchYear(val.toString())} value={searchYear} selectClass={undefined} />
<SelectBox className="col-span-3" label={labelArray[5] as string} selectArray={selectOperationData}
onSelectValue={(val) => setOperationValue(val.toString())} value={operationValue} selectClass={undefined} />
</>} </>}
rightChildren={undefined} rightChildren={undefined}
selectSidoData={selectSidoData} selectSidoData={selectSidoData}
@@ -224,18 +260,22 @@ export default function FacilityPrecipitation() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false}/> ref={ref} isAdmin={false}/>
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll min-[1200px]:overflow-x-hidden"> <div className="h-full w-full overflow-x-scroll min-[1200px]:overflow-x-hidden">
<div className="w-[120%] min-[1200px]:w-[100%]"> <div className="w-[120%] min-[1200px]:w-[100%]">
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"시설별 강수현황"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)}
headName={"시설별 강수현황"}
tableData={mainList} headlist={upheadList} pageSize={10} total={total}
resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} />
</div>
<UnderComment divHeight={"3"} commentArray={["강우일은 3mm 이상만 해당 / 강우영향일은 강우일 및 강우일 후 연속 2일간으로 정의"]} />
</div> </div>
<UnderComment divHeight={"3"} commentArray={["강우일은 3mm 이상만 해당 / 강우영향일은 강우일 및 강우일 후 연속 2일간으로 정의"]} /> </ListDiv>
</div> </ContentsDiv>
</ListDiv>
</ContentsDiv>
{selectedRow !== null && ( {selectedRow !== null && (
<UiModal <UiModal
body={<PrecipitationModal searchYear={searchYear} fcltyName={fcltyNm} facilityCd={fcltyCd} detailList={gridListPrecipitationDetail}></PrecipitationModal>} body={<PrecipitationModal searchYear={searchYear} fcltyName={fcltyNm} facilityCd={fcltyCd} detailList={gridListPrecipitationDetail}></PrecipitationModal>}
@@ -248,4 +288,4 @@ export default function FacilityPrecipitation() {
)} )}
</MainDiv> </MainDiv>
); );
} }
@@ -25,10 +25,10 @@ const commentArrayRain = [
"강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날" "강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날"
]; ];
type ModalProps ={ type ModalProps = {
fcltyName: string; fcltyName: string;
facilityCd : string; facilityCd: string;
searchYear : string; searchYear: string;
} }
const tabList1 = [ const tabList1 = [
@@ -50,15 +50,13 @@ const tabList3 = [
{ value: 'tab_term_winter_chongin', label: '동절기' } { value: 'tab_term_winter_chongin', label: '동절기' }
]; ];
export default function WaterQualityModal({fcltyName='', facilityCd='', searchYear=new Date().getFullYear().toString()} : ModalProps) { export default function WaterQualityModal({ fcltyName = '', facilityCd = '', searchYear = new Date().getFullYear().toString() }: ModalProps) {
const [tabName, setTabName] = useState<string>('tab_num1'); const [tabName, setTabName] = useState<string>('tab_num1');
// 날짜 필터링 관련 상태
// 그리드 관련 const [copyYearList, setCopyYearList] = useState<FacilityWaterQltyProps[]>([]);
const {FacilityWaterQltyModal, const [chongInWaterQltyYearList, setChongInWaterQltyYearList] = useState<FacilityWaterQltyProps[]>([]);
searchFacilityWaterQltyListHist, const { FacilityWaterQltyModal, searchFacilityWaterQltyListHist, Common } = useFoStore((state) => state);
Common const { btnClass, COD_YEAR } = Common;
} = useFoStore((state) => state);
const {btnClass, COD_YEAR} = Common;
const { const {
upHeadListModalYear, upHeadListModalYear,
upHeadListModalYearCod, upHeadListModalYearCod,
@@ -71,7 +69,17 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
const prevExcelListRef = useRef<modalExcelType[] | null>(null); const prevExcelListRef = useRef<modalExcelType[] | null>(null);
const prevChoinginExcelListRef = useRef<modalChoinginExcelType[] | null>(null); const prevChoinginExcelListRef = useRef<modalChoinginExcelType[] | null>(null);
useEffect(() => {
searchFacilityWaterQltyListHist(searchYear, facilityCd);
}, [searchYear, facilityCd, searchFacilityWaterQltyListHist]);
useEffect(() => {
const filteredYearData = setFilterAfterData(facilityWaterQltyYearList);
setCopyYearList(filteredYearData as FacilityWaterQltyProps[]);
setChongInWaterQltyYearList(facilityWaterQltyYearList);
}, [facilityWaterQltyYearList]);
// 필터링 된 후 최대, 최소, 평균 값 계산 // 필터링 된 후 최대, 최소, 평균 값 계산
const setFilterAfterData = (filteredData: FacilityWaterQltyProps[]) => { const setFilterAfterData = (filteredData: FacilityWaterQltyProps[]) => {
// 쉼표가 포함된 문자열을 숫자로 변환하는 함수 // 쉼표가 포함된 문자열을 숫자로 변환하는 함수
@@ -100,7 +108,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let maxNoProcessInflAmnt = 0; let maxNoProcessInflAmnt = 0;
let maxInfoRnDay = 0; let maxInfoRnDay = 0;
// 초기값 설정 // 초기값 설정
let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0; let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0;
let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0; let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0;
@@ -108,14 +116,14 @@ 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 minefflWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltCod) : 0; let minefflWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltCod) : 0;
let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0; let minEfflWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltSs) : 0;
let mininflAssctBfrWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltBod) : 0; let mininflAssctBfrWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltBod) : 0;
let mininflAssctBfrWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltTn) : 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 mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0; let mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0;
let mininflAssctBfrWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltCod) : 0; let mininflAssctBfrWqltCod = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltCod) : 0;
let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0; let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0;
let minTpInflWqltBod = 99999999; let minTpInflWqltBod = 99999999;
let minTpInflWqltTp = 99999999; let minTpInflWqltTp = 99999999;
let minNoProcessInflAmnt = 99999999; let minNoProcessInflAmnt = 99999999;
@@ -143,27 +151,27 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
let noProcessInflAmntCnt = 0; let noProcessInflAmntCnt = 0;
let avgInfoRnDay = 0; let avgInfoRnDay = 0;
filteredData.forEach((item: FacilityWaterQltyProps) => { filteredData.forEach((item: FacilityWaterQltyProps) => {
const efflWqltBod = parseNumber(item.efflWqltBod); const efflWqltBod = parseNumber(item.efflWqltBod);
const efflWqltTn = parseNumber(item.efflWqltTn); const efflWqltTn = parseNumber(item.efflWqltTn);
const efflWqltTp = parseNumber(item.efflWqltTp); const efflWqltTp = parseNumber(item.efflWqltTp);
const efflWqltToc = parseNumber(item.efflWqltToc); const efflWqltToc = parseNumber(item.efflWqltToc);
const efflWqltCod = parseNumber(item.efflWqltCod?item.efflWqltCod.replaceAll("(","").replaceAll(")",""):0); const efflWqltCod = parseNumber(item.efflWqltCod ? item.efflWqltCod.replaceAll("(", "").replaceAll(")", "") : 0);
const efflWqltSs = parseNumber(item.efflWqltSs); const efflWqltSs = parseNumber(item.efflWqltSs);
const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod); const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod);
const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn); const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn);
const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp); const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp);
const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc); const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc);
const inflAssctBfrWqltCod = parseNumber(item.inflAssctBfrWqltCod?item.inflAssctBfrWqltCod.replaceAll("(","").replaceAll(")",""):0); const inflAssctBfrWqltCod = parseNumber(item.inflAssctBfrWqltCod ? item.inflAssctBfrWqltCod.replaceAll("(", "").replaceAll(")", "") : 0);
const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs); const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs);
const tpInflWqltBod = parseNumber(item.tpInflWqltBod); const tpInflWqltBod = parseNumber(item.tpInflWqltBod);
const tpInflWqltTp = parseNumber(item.tpInflWqltTp); const tpInflWqltTp = parseNumber(item.tpInflWqltTp);
if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){ if (item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined) {
tpInflWqltBodCnt += 1; tpInflWqltBodCnt += 1;
} }
if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){ if (item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined) {
tpInflWqltTpCnt += 1; tpInflWqltTpCnt += 1;
} }
@@ -175,7 +183,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc); maxefflWqltToc = Math.max(maxefflWqltToc, efflWqltToc);
maxefflWqltCod = Math.max(maxefflWqltCod, efflWqltCod); maxefflWqltCod = Math.max(maxefflWqltCod, efflWqltCod);
maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs); maxEfflWqltSs = Math.max(maxEfflWqltSs, efflWqltSs);
maxinflAssctBfrWqltBod = Math.max(maxinflAssctBfrWqltBod, inflAssctBfrWqltBod); maxinflAssctBfrWqltBod = Math.max(maxinflAssctBfrWqltBod, inflAssctBfrWqltBod);
maxinflAssctBfrWqltTn = Math.max(maxinflAssctBfrWqltTn, inflAssctBfrWqltTn); maxinflAssctBfrWqltTn = Math.max(maxinflAssctBfrWqltTn, inflAssctBfrWqltTn);
maxInflAssctBfrWqltTp = Math.max(maxInflAssctBfrWqltTp, inflAssctBfrWqltTp); maxInflAssctBfrWqltTp = Math.max(maxInflAssctBfrWqltTp, inflAssctBfrWqltTp);
@@ -202,11 +210,11 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
mininflAssctBfrWqltCod = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltCod); mininflAssctBfrWqltCod = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltCod);
mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs); mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs);
if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){ if (item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined) {
minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod); minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod);
avgTpInflWqltBod += tpInflWqltBod; avgTpInflWqltBod += tpInflWqltBod;
} }
if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){ if (item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined) {
minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp); minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp);
avgTpInflWqltTp += tpInflWqltTp; avgTpInflWqltTp += tpInflWqltTp;
} }
@@ -227,12 +235,12 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
avginflAssctBfrWqltCod += inflAssctBfrWqltCod; avginflAssctBfrWqltCod += inflAssctBfrWqltCod;
avginflAssctBfrWqltSs += inflAssctBfrWqltSs; avginflAssctBfrWqltSs += inflAssctBfrWqltSs;
if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){ if (item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined) {
const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',','')); const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',', ''));
avgNoProcessInflAmnt += noProcessInflAmnt; avgNoProcessInflAmnt += noProcessInflAmnt;
maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt); maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt);
minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt); minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt);
noProcessInflAmntCnt +=1; noProcessInflAmntCnt += 1;
} }
avgInfoRnDay += infoRnDay; avgInfoRnDay += infoRnDay;
@@ -241,18 +249,18 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
const newFilteredData = [ const newFilteredData = [
{ {
msrDt: '평균', msrDt: '평균',
efflWqltBod: filteredData.length==0 || avgEfflWqltBod===0?'0.0':roundNumber((avgEfflWqltBod / filteredData.length), 1), efflWqltBod: filteredData.length == 0 || avgEfflWqltBod === 0 ? '0.0' : roundNumber((avgEfflWqltBod / filteredData.length), 1),
efflWqltToc: filteredData.length==0 || avgefflWqltToc===0?'0.0':roundNumber((avgefflWqltToc / filteredData.length), 1), efflWqltToc: filteredData.length == 0 || avgefflWqltToc === 0 ? '0.0' : roundNumber((avgefflWqltToc / filteredData.length), 1),
efflWqltCod: filteredData.length==0 || avgefflWqltCod===0?"(0.0)":"("+roundNumber((avgefflWqltCod / filteredData.length), 1)+")", efflWqltCod: filteredData.length == 0 || avgefflWqltCod === 0 ? "(0.0)" : "(" + roundNumber((avgefflWqltCod / filteredData.length), 1) + ")",
efflWqltSs: filteredData.length==0 || avgEfflWqltSs===0?'0.0':roundNumber((avgEfflWqltSs / filteredData.length), 1), efflWqltSs: filteredData.length == 0 || avgEfflWqltSs === 0 ? '0.0' : roundNumber((avgEfflWqltSs / filteredData.length), 1),
efflWqltTn: filteredData.length==0 || avgEfflWqltTn ===0?'0.000':roundNumber((avgEfflWqltTn / filteredData.length), 3), efflWqltTn: filteredData.length == 0 || avgEfflWqltTn === 0 ? '0.000' : roundNumber((avgEfflWqltTn / filteredData.length), 3),
efflWqltTp: filteredData.length==0 || avgEfflWqltTp ===0?'0.000':roundNumber((avgEfflWqltTp / filteredData.length), 3), efflWqltTp: filteredData.length == 0 || avgEfflWqltTp === 0 ? '0.000' : roundNumber((avgEfflWqltTp / filteredData.length), 3),
inflAssctBfrWqltBod: filteredData.length==0 || avginflAssctBfrWqltBod===0?'0.0':roundNumber((avginflAssctBfrWqltBod / filteredData.length), 1), inflAssctBfrWqltBod: filteredData.length == 0 || avginflAssctBfrWqltBod === 0 ? '0.0' : roundNumber((avginflAssctBfrWqltBod / filteredData.length), 1),
inflAssctBfrWqltTn: filteredData.length==0 || avginflAssctBfrWqltTn===0?'0.000':roundNumber((avginflAssctBfrWqltTn / filteredData.length), 3), inflAssctBfrWqltTn: filteredData.length == 0 || avginflAssctBfrWqltTn === 0 ? '0.000' : roundNumber((avginflAssctBfrWqltTn / filteredData.length), 3),
inflAssctBfrWqltTp: filteredData.length==0 || avgInflAssctBfrWqltTp===0?'0.000':roundNumber((avgInflAssctBfrWqltTp / filteredData.length), 3), inflAssctBfrWqltTp: filteredData.length == 0 || avgInflAssctBfrWqltTp === 0 ? '0.000' : roundNumber((avgInflAssctBfrWqltTp / filteredData.length), 3),
inflAssctBfrWqltToc: filteredData.length==0 || avginflAssctBfrWqltToc===0?'0.0':roundNumber((avginflAssctBfrWqltToc / filteredData.length), 1), inflAssctBfrWqltToc: filteredData.length == 0 || avginflAssctBfrWqltToc === 0 ? '0.0' : roundNumber((avginflAssctBfrWqltToc / filteredData.length), 1),
inflAssctBfrWqltCod: filteredData.length==0 || avginflAssctBfrWqltCod===0?'(0.0)':"("+roundNumber((avginflAssctBfrWqltCod / filteredData.length), 1)+")", inflAssctBfrWqltCod: filteredData.length == 0 || avginflAssctBfrWqltCod === 0 ? '(0.0)' : "(" + roundNumber((avginflAssctBfrWqltCod / filteredData.length), 1) + ")",
inflAssctBfrWqltSs: filteredData.length==0 || avginflAssctBfrWqltSs===0?'0.0':roundNumber((avginflAssctBfrWqltSs / filteredData.length), 1), inflAssctBfrWqltSs: filteredData.length == 0 || avginflAssctBfrWqltSs === 0 ? '0.0' : roundNumber((avginflAssctBfrWqltSs / filteredData.length), 1),
bscFctCd: "", bscFctCd: "",
bscFctNm: "", bscFctNm: "",
lclgvrnmntNm: "", lclgvrnmntNm: "",
@@ -260,25 +268,25 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
sggNm: "", sggNm: "",
addr: "", addr: "",
fctCpc: 0, fctCpc: 0,
noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0), noProcessInflAmnt: roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0),
infoRnDay: filteredData.length==0 || avgInfoRnDay===0?'0.0':roundNumber(avgInfoRnDay / filteredData.length, 1), infoRnDay: filteredData.length == 0 || avgInfoRnDay === 0 ? '0.0' : roundNumber(avgInfoRnDay / filteredData.length, 1),
tpInflWqltBod: filteredData.length==0 || avgTpInflWqltBod ===0 ?'0.0':roundNumber(avgTpInflWqltBod / tpInflWqltBodCnt, 1), tpInflWqltBod: filteredData.length == 0 || avgTpInflWqltBod === 0 ? '0.0' : roundNumber(avgTpInflWqltBod / tpInflWqltBodCnt, 1),
tpInflWqltTp: filteredData.length==0 || avgTpInflWqltTp === 0?'0.000':roundNumber(avgTpInflWqltTp / tpInflWqltTpCnt, 3) tpInflWqltTp: filteredData.length == 0 || avgTpInflWqltTp === 0 ? '0.000' : roundNumber(avgTpInflWqltTp / tpInflWqltTpCnt, 3)
}, },
{ {
msrDt : '최대', msrDt: '최대',
efflWqltBod : Math.round(maxEfflWqltBod * 10) / 10?roundNumber(maxEfflWqltBod, 1):'0.0', efflWqltBod: Math.round(maxEfflWqltBod * 10) / 10 ? roundNumber(maxEfflWqltBod, 1) : '0.0',
efflWqltToc : Math.round(maxefflWqltToc * 10) / 10?roundNumber(maxefflWqltToc, 1):'0.0', efflWqltToc: Math.round(maxefflWqltToc * 10) / 10 ? roundNumber(maxefflWqltToc, 1) : '0.0',
efflWqltCod : Math.round(maxefflWqltCod * 10) / 10?"("+roundNumber(maxefflWqltCod, 1)+")":'(0.0)', efflWqltCod: Math.round(maxefflWqltCod * 10) / 10 ? "(" + roundNumber(maxefflWqltCod, 1) + ")" : '(0.0)',
efflWqltSs : Math.round(maxEfflWqltSs * 10) / 10?roundNumber(maxEfflWqltSs, 1):'0.0', efflWqltSs: Math.round(maxEfflWqltSs * 10) / 10 ? roundNumber(maxEfflWqltSs, 1) : '0.0',
efflWqltTn : Math.round(maxEfflWqltTn * 1000) / 1000?roundNumber(maxEfflWqltTn, 3):'0.000', efflWqltTn: Math.round(maxEfflWqltTn * 1000) / 1000 ? roundNumber(maxEfflWqltTn, 3) : '0.000',
efflWqltTp : Math.round(maxEfflWqltTp * 1000) / 1000?roundNumber(maxEfflWqltTp, 3):'0.000', efflWqltTp: Math.round(maxEfflWqltTp * 1000) / 1000 ? roundNumber(maxEfflWqltTp, 3) : '0.000',
inflAssctBfrWqltBod : Math.round(maxinflAssctBfrWqltBod * 10) / 10?roundNumber(maxinflAssctBfrWqltBod, 1):'0.0', inflAssctBfrWqltBod: Math.round(maxinflAssctBfrWqltBod * 10) / 10 ? roundNumber(maxinflAssctBfrWqltBod, 1) : '0.0',
inflAssctBfrWqltTn : Math.round(maxinflAssctBfrWqltTn * 1000) / 1000?roundNumber(maxinflAssctBfrWqltTn, 3):'0.000', inflAssctBfrWqltTn: Math.round(maxinflAssctBfrWqltTn * 1000) / 1000 ? roundNumber(maxinflAssctBfrWqltTn, 3) : '0.000',
inflAssctBfrWqltTp : Math.round(maxInflAssctBfrWqltTp * 1000) / 1000?roundNumber(maxInflAssctBfrWqltTp, 3):'0.000', inflAssctBfrWqltTp: Math.round(maxInflAssctBfrWqltTp * 1000) / 1000 ? roundNumber(maxInflAssctBfrWqltTp, 3) : '0.000',
inflAssctBfrWqltToc : Math.round(maxinflAssctBfrWqltToc * 10) / 10?roundNumber(maxinflAssctBfrWqltToc, 1):'0.0', inflAssctBfrWqltToc: Math.round(maxinflAssctBfrWqltToc * 10) / 10 ? roundNumber(maxinflAssctBfrWqltToc, 1) : '0.0',
inflAssctBfrWqltCod : Math.round(maxinflAssctBfrWqltCod * 10) / 10?"("+roundNumber(maxinflAssctBfrWqltCod, 1)+")":'(0.0)', inflAssctBfrWqltCod: Math.round(maxinflAssctBfrWqltCod * 10) / 10 ? "(" + roundNumber(maxinflAssctBfrWqltCod, 1) + ")" : '(0.0)',
inflAssctBfrWqltSs : Math.round(maxinflAssctBfrWqltSs * 10) / 10?roundNumber(maxinflAssctBfrWqltSs, 1):'0.0', inflAssctBfrWqltSs: Math.round(maxinflAssctBfrWqltSs * 10) / 10 ? roundNumber(maxinflAssctBfrWqltSs, 1) : '0.0',
bscFctCd: "", bscFctCd: "",
bscFctNm: "", bscFctNm: "",
lclgvrnmntNm: "", lclgvrnmntNm: "",
@@ -286,25 +294,25 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
sggNm: "", sggNm: "",
addr: "", addr: "",
fctCpc: 0, fctCpc: 0,
noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0), noProcessInflAmnt: roundNumber(maxNoProcessInflAmnt, 0),
infoRnDay: Math.round(maxInfoRnDay * 10) / 10?roundNumber(maxInfoRnDay, 1):'0.0', infoRnDay: Math.round(maxInfoRnDay * 10) / 10 ? roundNumber(maxInfoRnDay, 1) : '0.0',
tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10?roundNumber(maxTpInflWqltBod, 1):'0.0', tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10 ? roundNumber(maxTpInflWqltBod, 1) : '0.0',
tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000?roundNumber(maxTpInflWqltTp, 3):'0.000' tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000 ? roundNumber(maxTpInflWqltTp, 3) : '0.000'
}, },
{ {
msrDt : '최소', msrDt: '최소',
efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?roundNumber(minEfflWqltBod, 1) : '0.0', efflWqltBod: Math.round(minEfflWqltBod * 10) / 10 ? roundNumber(minEfflWqltBod, 1) : '0.0',
efflWqltToc : Math.round(minefflWqltToc * 10) / 10?roundNumber(minefflWqltToc, 1) : '0.0', efflWqltToc: Math.round(minefflWqltToc * 10) / 10 ? roundNumber(minefflWqltToc, 1) : '0.0',
efflWqltCod : Math.round(minefflWqltCod * 10) / 10?"("+roundNumber(minefflWqltCod, 1)+")" : '(0.0)', efflWqltCod: Math.round(minefflWqltCod * 10) / 10 ? "(" + roundNumber(minefflWqltCod, 1) + ")" : '(0.0)',
efflWqltSs : Math.round(minEfflWqltSs * 10) / 10?roundNumber(minEfflWqltSs, 1) : '0.0', efflWqltSs: Math.round(minEfflWqltSs * 10) / 10 ? roundNumber(minEfflWqltSs, 1) : '0.0',
efflWqltTn : Math.round(minEfflWqltTn * 1000) / 1000?roundNumber(minEfflWqltTn, 3) : '0.000', efflWqltTn: Math.round(minEfflWqltTn * 1000) / 1000 ? roundNumber(minEfflWqltTn, 3) : '0.000',
efflWqltTp : Math.round(minEfflWqltTp * 1000) / 1000?roundNumber(minEfflWqltTp, 3) : '0.000', efflWqltTp: Math.round(minEfflWqltTp * 1000) / 1000 ? roundNumber(minEfflWqltTp, 3) : '0.000',
inflAssctBfrWqltBod : Math.round(mininflAssctBfrWqltBod * 10) / 10?roundNumber(mininflAssctBfrWqltBod, 1) : '0.0', inflAssctBfrWqltBod: Math.round(mininflAssctBfrWqltBod * 10) / 10 ? roundNumber(mininflAssctBfrWqltBod, 1) : '0.0',
inflAssctBfrWqltTn : Math.round(mininflAssctBfrWqltTn * 1000) / 1000?roundNumber(mininflAssctBfrWqltTn, 3) : '0.000', inflAssctBfrWqltTn: Math.round(mininflAssctBfrWqltTn * 1000) / 1000 ? roundNumber(mininflAssctBfrWqltTn, 3) : '0.000',
inflAssctBfrWqltTp : Math.round(minInflAssctBfrWqltTp * 1000) / 1000?roundNumber(minInflAssctBfrWqltTp, 3) : '0.000', inflAssctBfrWqltTp: Math.round(minInflAssctBfrWqltTp * 1000) / 1000 ? roundNumber(minInflAssctBfrWqltTp, 3) : '0.000',
inflAssctBfrWqltToc : Math.round(mininflAssctBfrWqltToc * 10) / 10?roundNumber(mininflAssctBfrWqltToc, 1) : '0.0', inflAssctBfrWqltToc: Math.round(mininflAssctBfrWqltToc * 10) / 10 ? roundNumber(mininflAssctBfrWqltToc, 1) : '0.0',
inflAssctBfrWqltCod : Math.round(mininflAssctBfrWqltCod * 10) / 10?"("+roundNumber(mininflAssctBfrWqltCod, 1)+")" : '(0.0)', inflAssctBfrWqltCod: Math.round(mininflAssctBfrWqltCod * 10) / 10 ? "(" + roundNumber(mininflAssctBfrWqltCod, 1) + ")" : '(0.0)',
inflAssctBfrWqltSs : Math.round(mininflAssctBfrWqltSs * 10) / 10?roundNumber(mininflAssctBfrWqltSs, 1) : '0.0', inflAssctBfrWqltSs: Math.round(mininflAssctBfrWqltSs * 10) / 10 ? roundNumber(mininflAssctBfrWqltSs, 1) : '0.0',
bscFctCd: "", bscFctCd: "",
bscFctNm: "", bscFctNm: "",
lclgvrnmntNm: "", lclgvrnmntNm: "",
@@ -312,10 +320,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
sggNm: "", sggNm: "",
addr: "", addr: "",
fctCpc: 0, fctCpc: 0,
noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0), noProcessInflAmnt: roundNumber(minNoProcessInflAmnt, 0),
infoRnDay: Math.round(minInfoRnDay * 10) / 10?'0.0':roundNumber(minInfoRnDay, 1), infoRnDay: Math.round(minInfoRnDay * 10) / 10 ? roundNumber(minInfoRnDay, 1) : '0.0',
tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999?roundNumber(minTpInflWqltBod, 1):'0.0', tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999 ? roundNumber(minTpInflWqltBod, 1) : '0.0',
tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999?roundNumber(minTpInflWqltTp, 3):'0.000' tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999 ? roundNumber(minTpInflWqltTp, 3) : '0.000'
}, },
...filteredData ...filteredData
]; ];
@@ -323,20 +331,6 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
return newFilteredData; return newFilteredData;
} }
// 날짜 필터링 관련 상태
const [copyYearList, setCopyYearList] = useState<FacilityWaterQltyProps[]>([]);
const [chongInWaterQltyYearList, setChongInWaterQltyYearList] = useState<FacilityWaterQltyProps[]>([]);
useEffect(() => {
searchFacilityWaterQltyListHist(searchYear, facilityCd);
}, [searchYear, facilityCd, searchFacilityWaterQltyListHist]);
useEffect(() => {
const filteredYearData = setFilterAfterData(facilityWaterQltyYearList);
setCopyYearList(filteredYearData as FacilityWaterQltyProps[]);
setChongInWaterQltyYearList(filteredYearData as FacilityWaterQltyProps[]);
}, [facilityWaterQltyYearList]);
const yesterDay = new Date(); const yesterDay = new Date();
yesterDay.setDate(yesterDay.getDate() - 1); yesterDay.setDate(yesterDay.getDate() - 1);
const yesterDayStr = yesterDay.toISOString().split('T')[0]; const yesterDayStr = yesterDay.toISOString().split('T')[0];
@@ -350,14 +344,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
const filterData = useCallback((returnType: ReturnType<FacilityWaterQltyProps>) => { const filterData = useCallback((returnType: ReturnType<FacilityWaterQltyProps>) => {
const filteredData = setFilterAfterData(returnType.filteredList); const filteredData = setFilterAfterData(returnType.filteredList);
setCopyYearList(filteredData as FacilityWaterQltyProps[]); setCopyYearList(filteredData as FacilityWaterQltyProps[]); // 처리시설/총인설비 수질현황
}, []); }, []);
const excelDownload = () => { const excelDownload = () => {
if(tabName === 'tab_num1'){ if (tabName === 'tab_num1') { //처리시설 수질현황
const excelDownList: modalExcelType[] = []; const excelDownList: modalExcelType[] = [];
if(copyYearList.length > 0){ if (copyYearList.length > 0) {
copyYearList.forEach((item) => { copyYearList.forEach((item) => {
excelDownList.push({ excelDownList.push({
날짜: item.msrDt, 날짜: item.msrDt,
@@ -371,44 +365,48 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
"유출SS(mg/L)": CommaToNumber(item.efflWqltSs), "유출SS(mg/L)": CommaToNumber(item.efflWqltSs),
"유출TN(mg/L)": CommaToNumber(item.efflWqltTn), "유출TN(mg/L)": CommaToNumber(item.efflWqltTn),
"유출TP(mg/L)": CommaToNumber(item.efflWqltTp), "유출TP(mg/L)": CommaToNumber(item.efflWqltTp),
"강우량(mm/일)": CommaToNumber(item.infoRnDay?item.infoRnDay.toString():"0.0"), "강우량(mm/일)": CommaToNumber(item.infoRnDay ? item.infoRnDay.toString() : "0.0"),
}); });
}); });
} }
if (excelDownList && excelDownList.length > 0) { if (excelDownList && excelDownList.length > 0) {
downloadExcelFormat( downloadExcelFormat(
{ data: JSON.parse(JSON.stringify(excelDownList)) {
, fileName: searchYear+'년 '+fcltyName + ' 수질현황' data: JSON.parse(JSON.stringify(excelDownList))
, fileName: searchYear + '년 ' + fcltyName + ' 수질현황'
, sheetNameArray: [fcltyName + ' 수질현황'] , sheetNameArray: [fcltyName + ' 수질현황']
, headerRange: 'A1:L1' , headerRange: 'A1:L1'
, decimalArray1: [1,2,3,6,7,8,11] , decimalArray1: [1, 2, 3, 6, 7, 8, 11]
, decimalArray3: [4,5,9,10] , decimalArray3: [4, 5, 9, 10]
}); });
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) { } else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.'); alert('다운받을 데이터가 없습니다.');
} }
prevExcelListRef.current = excelDownList; prevExcelListRef.current = excelDownList;
}else{ } else { // 총인설비 수질현황
const excelDownList: modalChoinginExcelType[] = []; const excelDownList: modalChoinginExcelType[] = [];
if(chongInWaterQltyYearList.length > 0){ // if (chongInWaterQltyYearList.length > 0) {
chongInWaterQltyYearList.forEach((item) => { // chongInWaterQltyYearList.forEach((item) => {
if (copyYearList.length > 0) {
copyYearList.forEach((item) => {
excelDownList.push({ excelDownList.push({
날짜: item.msrDt, 날짜: item.msrDt,
"유입BOD(mg/L)": CommaToNumber(item.tpInflWqltBod), "유입BOD(mg/L)": CommaToNumber(item.tpInflWqltBod),
"유입TP(mg/L)": CommaToNumber(item.tpInflWqltTp), "유입TP(mg/L)": CommaToNumber(item.tpInflWqltTp),
"유출BOD(mg/L)": CommaToNumber(item.efflWqltBod), "유출BOD(mg/L)": CommaToNumber(item.efflWqltBod),
"유출TP(mg/L)": CommaToNumber(item.efflWqltTn), "유출TP(mg/L)": CommaToNumber(item.efflWqltTp),
}); });
}); });
} }
if (excelDownList && excelDownList.length > 0) { if (excelDownList && excelDownList.length > 0) {
downloadExcelFormat( downloadExcelFormat(
{ data: JSON.parse(JSON.stringify(excelDownList)) {
, fileName: searchYear+'년 '+fcltyName + ' 총인설비수질현황' data: JSON.parse(JSON.stringify(excelDownList))
, fileName: searchYear + '년 ' + fcltyName + ' 총인설비수질현황'
, sheetNameArray: [fcltyName + ' 총인설비수질현황'] , sheetNameArray: [fcltyName + ' 총인설비수질현황']
, headerRange: 'A1:E1' , headerRange: 'A1:E1'
, decimalArray1: [1,3] , decimalArray1: [1, 3]
, decimalArray3: [2,4] , decimalArray3: [2, 4]
}); });
} else if (prevChoinginExcelListRef.current && prevChoinginExcelListRef.current.length > 0) { } else if (prevChoinginExcelListRef.current && prevChoinginExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.'); alert('다운받을 데이터가 없습니다.');
@@ -424,168 +422,127 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
return ( return (
<> <>
<UITab tabList={tabList1} defaultValue="tab_num1" onValueChange={(value) => setTabName(value)}> <UITab tabList={tabList1} defaultValue="tab_num1" onValueChange={(value) => setTabName(value)}>
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}> <Button className={btnClass} style={{ float: 'right' }} color="green" onClick={excelDownload}>
{"엑셀다운로드"} {"엑셀다운로드"}
</Button> </Button>
{/* 처리시설 수질현황 */} {/* 처리시설 수질현황 */}
<TabsContent value="tab_num1"> <TabsContent value="tab_num1">
<UITab tabList={tabList2} defaultValue="tab_term_year"> <UITab tabList={tabList2} defaultValue="tab_term_year">
<TabsContent value="tab_term_year"> <TabsContent value="tab_term_year">{/* 연간 */}
<FacilityTermModalHeader<FacilityWaterQltyProps> <FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={facilityWaterQltyYearList} searchList={facilityWaterQltyYearList}
fcltyCd={facilityCd} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_year"
fcltyName={fcltyName} searchYear={searchYear} ref={ref} queryClick={filterData}
tabName={"tab_term_year"}
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/> />
<div className="overflow-y-auto h-[350px]"> <div className="overflow-y-auto h-[350px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={copyYearList} tableData={copyYearList}
headlist={Number(searchYear)<COD_YEAR?upHeadListModalYearCod:upHeadListModalYear} headlist={Number(searchYear) < COD_YEAR ? upHeadListModalYearCod : upHeadListModalYear}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} className="h-[310px]" boldArray={[0, 1, 2]}
cellClick={undefined}
onPageChange={() => {}}
className="h-[310px]"
boldArray={[0,1,2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
</UiTable> </UiTable>
</div> </div>
<div className="card-header"> <div className="card-header border-t mt-1">
<h3 className="text-2xl font-medium text-label">수질 TMS</h3> <h3 className="text-2xl font-medium text-label">수질 TMS</h3>
{/*<h3 className="text-2xl font-medium text-label text-right">({msrmtDate?msrmtDate.substring(0,4)+'-'+msrmtDate.substring(4,6)+'-'+msrmtDate.substring(6,8):yesterDayStr})</h3> */} <h3 className="text-2xl font-medium text-label text-right">
({msrmtDate ? msrmtDate.substring(0, 4) + '-' + msrmtDate.substring(4, 6) + '-' + msrmtDate.substring(6, 8) : yesterDayStr})
</h3>
</div> </div>
<div className="overflow-y-auto h-[250px]"> <div className="overflow-y-auto h-[250px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={tmsList} tableData={tmsList}
headlist={upHeadListModalTms} headlist={upHeadListModalTms}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} boldArray={[0, 1, 2]}
cellClick={undefined}
onPageChange={() => {}}
boldArray={[0,1,2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalTms} layoutNum={4} /> <HeadMakeColSpan upHeadList={upHeadListModalTms} layoutNum={4} />
</UiTable> </UiTable>
{msrmtDate != yesterDayStr?.replaceAll('-','') ? ( {msrmtDate != yesterDayStr?.replaceAll('-', '') ? (
<UnderComment commentArray={["전날 데이터 결측으로 인해 가장 최근 데이터 표출함"]} divHeight="0"/> <UnderComment commentArray={["전날 데이터 결측으로 인해 가장 최근 데이터 표출함"]} divHeight="0" />
) : null} ) : null}
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_summer"> <TabsContent value="tab_term_summer">{/* 하절기 */}
<FacilityTermModalHeader<FacilityWaterQltyProps> <FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={facilityWaterQltyYearList} searchList={facilityWaterQltyYearList}
fcltyCd={facilityCd} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_summer"
fcltyName={fcltyName} searchYear={searchYear} ref={ref} queryClick={filterData}
tabName="tab_term_summer"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/> />
<div className="overflow-y-auto h-[500px]"> <div className="overflow-y-auto h-[500px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={copyYearList} tableData={copyYearList}
headlist={Number(searchYear)<COD_YEAR?upHeadListModalYearCod:upHeadListModalYear} headlist={Number(searchYear) < COD_YEAR ? upHeadListModalYearCod : upHeadListModalYear}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
cellClick={undefined}
onPageChange={() => { } }
className="h-[500px]"
boldArray={[0,1,2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
</UiTable> </UiTable>
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_winter"> <TabsContent value="tab_term_winter">{/* 동절기 */}
<FacilityTermModalHeader<FacilityWaterQltyProps> <FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={facilityWaterQltyYearList} searchList={facilityWaterQltyYearList}
fcltyCd={facilityCd} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_winter"
fcltyName={fcltyName} searchYear={searchYear} ref={ref} queryClick={filterData}
tabName="tab_term_winter"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/> />
<div className="overflow-y-auto h-[500px]"> <div className="overflow-y-auto h-[500px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={copyYearList} tableData={copyYearList}
headlist={Number(searchYear)<COD_YEAR?upHeadListModalYearCod:upHeadListModalYear} headlist={Number(searchYear) < COD_YEAR ? upHeadListModalYearCod : upHeadListModalYear}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
cellClick={undefined}
onPageChange={() => {}}
className="h-[500px]"
boldArray={[0,1,2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
</UiTable> </UiTable>
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_chuncheon"> <TabsContent value="tab_term_chuncheon">{/* 청천시 */}
<FacilityTermModalHeader<FacilityWaterQltyProps> <FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={facilityWaterQltyYearList} searchList={facilityWaterQltyYearList}
fcltyCd={facilityCd} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_chuncheon"
fcltyName={fcltyName} searchYear={searchYear} ref={ref} queryClick={filterData}
tabName="tab_term_chuncheon"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/> />
<div className="overflow-y-auto h-[500px]"> <div className="overflow-y-auto h-[500px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={copyYearList} tableData={copyYearList}
headlist={Number(searchYear)<COD_YEAR?upHeadListModalYearCod:upHeadListModalYear} headlist={Number(searchYear) < COD_YEAR ? upHeadListModalYearCod : upHeadListModalYear}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
cellClick={undefined}
onPageChange={() => {}}
className="h-[500px]"
boldArray={[0,1,2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
</UiTable> </UiTable>
</div> </div>
<UnderComment commentArray={commentArrayChungchun} divHeight="10"/> <UnderComment commentArray={commentArrayChungchun} divHeight="10" />
</TabsContent> </TabsContent>
<TabsContent value="tab_term_rain"> <TabsContent value="tab_term_rain">{/* 강우시 */}
<FacilityTermModalHeader<FacilityWaterQltyProps> <FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={facilityWaterQltyYearList} searchList={facilityWaterQltyYearList}
fcltyCd={facilityCd} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_rain"
fcltyName={fcltyName} searchYear={searchYear} ref={ref} queryClick={filterData}
tabName="tab_term_rain"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/> />
<div className="overflow-y-auto h-[500px]"> <div className="overflow-y-auto h-[500px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={copyYearList} tableData={copyYearList}
headlist={Number(searchYear)<COD_YEAR?upHeadListModalYearCod:upHeadListModalYear} headlist={Number(searchYear) < COD_YEAR ? upHeadListModalYearCod : upHeadListModalYear}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
cellClick={undefined}
onPageChange={() => {}}
className="h-[500px]"
boldArray={[0,1,2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} />
</UiTable> </UiTable>
</div> </div>
<UnderComment commentArray={commentArrayRain} divHeight="10"/> <UnderComment commentArray={commentArrayRain} divHeight="10" />
</TabsContent> </TabsContent>
</UITab> </UITab>
</TabsContent> </TabsContent>
@@ -593,81 +550,57 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
{/* 총인설비 수질현황 */} {/* 총인설비 수질현황 */}
<TabsContent value="tab_num2" > <TabsContent value="tab_num2" >
<UITab tabList={tabList3} defaultValue="tab_term_year_chongin"> <UITab tabList={tabList3} defaultValue="tab_term_year_chongin">
<TabsContent value="tab_term_year_chongin"> <TabsContent value="tab_term_year_chongin">{/* 연간 */}
<FacilityTermModalHeader<FacilityWaterQltyProps> <FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={chongInWaterQltyYearList} searchList={chongInWaterQltyYearList}
fcltyCd={facilityCd} fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_year"
fcltyName={fcltyName} searchYear={searchYear} ref={ref} queryClick={filterData}
tabName="tab_term_year"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/> />
<div className="overflow-y-auto h-[550px]"> <div className="overflow-y-auto h-[550px]">
<UiTable <UiTable
headName={undefined} headName={undefined}
tableData={copyYearList} tableData={copyYearList}
headlist={upHeadListModalChongIn}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[500px]"
boldArray={[0,1,2]}
>
<HeadMakeColSpan upHeadList={upHeadListModalChongIn} layoutNum={5} />
</UiTable>
</div>
</TabsContent>
<TabsContent value="tab_term_summer_chongin">
<FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={chongInWaterQltyYearList}
fcltyCd={facilityCd}
fcltyName={fcltyName}
tabName="tab_term_summer"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/>
<div className="overflow-y-auto h-[550px]">
<UiTable
headName={undefined}
tableData={copyYearList}
headlist={upHeadListModalChongIn}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={() => {}}
className="h-[500px]"
boldArray={[0,1,2]}
>
<HeadMakeColSpan upHeadList={upHeadListModalChongIn} layoutNum={5} />
</UiTable>
</div>
</TabsContent>
<TabsContent value="tab_term_winter_chongin">
<FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={chongInWaterQltyYearList}
fcltyCd={facilityCd}
fcltyName={fcltyName}
tabName="tab_term_winter"
searchYear={searchYear}
ref={ref}
queryClick={filterData}
/>
<div className="overflow-y-auto h-[550px]">
<UiTable
headName={undefined}
tableData={copyYearList}
headlist={upHeadListModalChongIn} headlist={upHeadListModalChongIn}
pageSize={0} pageSize={0} total={0} cellClick={undefined}
total={0} onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
cellClick={undefined} >
onPageChange={() => {}} <HeadMakeColSpan upHeadList={upHeadListModalChongIn} layoutNum={5} />
className="h-[500px]" </UiTable>
boldArray={[0,1,2]} </div>
</TabsContent>
<TabsContent value="tab_term_summer_chongin">{/* 하절기 */}
<FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={chongInWaterQltyYearList}
fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_summer"
searchYear={searchYear} ref={ref} queryClick={filterData}
/>
<div className="overflow-y-auto h-[550px]">
<UiTable
headName={undefined}
tableData={copyYearList}
headlist={upHeadListModalChongIn}
pageSize={0} total={0} cellClick={undefined}
onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
>
<HeadMakeColSpan upHeadList={upHeadListModalChongIn} layoutNum={5} />
</UiTable>
</div>
</TabsContent>
<TabsContent value="tab_term_winter_chongin">{/* 동절기 */}
<FacilityTermModalHeader<FacilityWaterQltyProps>
searchList={chongInWaterQltyYearList}
fcltyCd={facilityCd} fcltyName={fcltyName} tabName="tab_term_winter"
searchYear={searchYear} ref={ref} queryClick={filterData}
/>
<div className="overflow-y-auto h-[550px]">
<UiTable
headName={undefined}
tableData={copyYearList}
headlist={upHeadListModalChongIn}
pageSize={0} total={0} cellClick={undefined}
onPageChange={() => { }} className="h-[500px]" boldArray={[0, 1, 2]}
> >
<HeadMakeColSpan upHeadList={upHeadListModalChongIn} layoutNum={5} /> <HeadMakeColSpan upHeadList={upHeadListModalChongIn} layoutNum={5} />
</UiTable> </UiTable>
@@ -678,4 +611,4 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe
</UITab> </UITab>
</> </>
); );
} }
@@ -6,13 +6,13 @@
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common"; import type { TableUpperProps } from "@/app/store/common";
import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty"; import type { FacilityWaterQltyProps } from "@/app/store/facilityWaterQlty";
import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, 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 LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useContext, useEffect, useRef, useState } from "react";
import WaterQualityModal from "./modal/page"; import WaterQualityModal from "./modal/page";
export default function ProcessFacilitySearch() { export default function ProcessFacilitySearch() {
@@ -21,9 +21,14 @@ export default function ProcessFacilitySearch() {
, initializeCommonData , initializeCommonData
, searchFacilityWaterQltyList , searchFacilityWaterQltyList
} = useFoStore((state) => state) || { FacilityWaterQltyList: { facilityWaterQltyList: [], facilityWaterQltyCount: 0 } }; } = useFoStore((state) => state) || { FacilityWaterQltyList: { facilityWaterQltyList: [], facilityWaterQltyCount: 0 } };
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
selectUpdownData, selectUpdownData,
selectOperationData, selectOperationData,
selectSidoData, selectSidoData,
@@ -36,6 +41,11 @@ export default function ProcessFacilitySearch() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
mainLabelArray, mainLabelArray,
upHeadList1, upHeadList1,
@@ -43,13 +53,13 @@ export default function ProcessFacilitySearch() {
upHeadList3, upHeadList3,
facilityWaterQltyList, facilityWaterQltyList,
facilityWaterQltyCount, facilityWaterQltyCount,
excelList,
isLoading, isLoading,
} = FacilityWaterQltyMain; } = FacilityWaterQltyMain;
const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || []; const mainList: FacilityWaterQltyProps[] = facilityWaterQltyList || [];
const [initTrigger, setInitTrigger] = useState<boolean>(false); const [initTrigger, setInitTrigger] = useState<boolean>(false);
const [excelTrigger, setExcelTrigger] = useState<boolean>(false); // 엑셀다운로드 트리거
const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
// 그리드 관련 // 그리드 관련
const [resetPage, setResetPage] = useState<boolean>(false); const [resetPage, setResetPage] = useState<boolean>(false);
const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null); const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null);
@@ -57,7 +67,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>(defaultSearchYear);
const [fcltCpct, setFcltCpct] = useState<string>("0"); const [fcltCpct, setFcltCpct] = useState<string>("0");
// 모달 상태 추가 // 모달 상태 추가
@@ -66,27 +76,27 @@ export default function ProcessFacilitySearch() {
const [fcltyCd, setFcltyCd] = useState<string>(""); const [fcltyCd, setFcltyCd] = useState<string>("");
const [modalYear, setModalYear] = useState<string>(""); const [modalYear, setModalYear] = useState<string>("");
const searchFcltyQltyList = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { const searchFcltyQltyList = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt: number = 20) => {
let nameCd, partStr; let nameCd, partStr;
switch (partValue) { switch (partValue) {
case 'R': case 'R':
if (regionValue !== '0') { if (regionValue !== '0') {
if(unitWaterShedValue==='0') nameCd = regionValue; if (unitWaterShedValue === '0') nameCd = regionValue;
else if (middleRegionValue==='0') nameCd = unitWaterShedValue; else if (middleRegionValue === '0') nameCd = unitWaterShedValue;
else nameCd = middleRegionValue; else nameCd = middleRegionValue;
} }
partStr = partValue partStr = partValue
break; break;
default: default:
if(sidoValue !== '0') nameCd = ref.current.sidoValue!="0"?ref.current.sidoValue:sidoValue; if (sidoValue !== '0') nameCd = ref.current.sidoValue != "0" ? ref.current.sidoValue : sidoValue;
if(sigunValue !== '0') nameCd = sigunValue; if (sigunValue !== '0') nameCd = sigunValue;
partStr = envPartValue !== '0' ? envPartValue:partValue; partStr = envPartValue !== '0' ? envPartValue : partValue;
break; break;
} }
if(partStr ==='G'){ if (partStr === 'G') {
searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue); await searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue);
}else{ } else {
searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchFacilityWaterQltyList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} }
}, [operationValue, fcltyName, searchFacilityWaterQltyList, searchYearValue, fcltCpct]); }, [operationValue, fcltyName, searchFacilityWaterQltyList, searchYearValue, fcltCpct]);
@@ -96,7 +106,7 @@ export default function ProcessFacilitySearch() {
// 상태값 설정 // 상태값 설정
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"); setSearchYearValue(defaultSearchYear);
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -138,42 +148,60 @@ export default function ProcessFacilitySearch() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
if(!initTrigger){ if (!initTrigger) {
initializeCommonData(); initializeCommonData();
searchFcltyQltyList(ref.current, 1, 10); searchFcltyQltyList(ref.current, 1, 10);
setInitTrigger(true); setInitTrigger(true);
} }
} }
}, [isInit, initializeCommonData, searchFacilityWaterQltyList, searchFcltyQltyList, initTrigger]); }, [isInit, initializeCommonData, searchFacilityWaterQltyList, searchFcltyQltyList, initTrigger]);
useEffect(() => { const chkVal = useCallback((returntype: ReturnType) => {
if(!excelTrigger) return;
if (excelList && excelList.length > 0) {
downloadExcelFormat(
{
data: excelList as unknown as JSON[],
fileName: '시설별 수질현황',
sheetNameArray: ['시설별 수질현황'],
headerRange: 'A1:T1',
decimalArray1:[10,11,12,15,16,17],
decimalArray3:[13,14,18,19]
}
);
}
}, [excelList, excelTrigger]);
const chkVal = useCallback((returntype:ReturnType) => {
// setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]") // setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]")
setUpheadList(returntype.partValue == 'R' ? upHeadList2 : returntype.partValue == 'G'?upHeadList3:upHeadList1); setUpheadList(returntype.partValue == 'R' ? upHeadList2 : returntype.partValue == 'G' ? upHeadList3 : upHeadList1);
setResetPage(true); setResetPage(true);
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
const excelDownload = useCallback(() => { const excelDownload = useCallback(async () => {
setExcelTrigger(true); if (isExcelDownClick) return;
searchFcltyQltyList(ref.current, 1, 10000); if (ref.current.partValue === 'A') { // 행정별
}, [searchFcltyQltyList]); if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
setIsExcelDownClick(true);
try {
await searchFcltyQltyList(ref.current, 1, 10000);
const latestExcelList = store.getState().FacilityWaterQltyMain.excelList || [];
if (latestExcelList.length > 0) {
downloadExcelFormat(
{
data: latestExcelList as unknown as JSON[],
fileName: '시설별 수질현황',
sheetNameArray: ['시설별 수질현황'],
headerRange: 'A1:T1',
decimalArray0: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
}
);
} else {
alert("조회된 결과가 없습니다.");
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchFcltyQltyList, store]);
const handlePageChange = useCallback((page: number) => { const handlePageChange = useCallback((page: number) => {
setResetPage(false); setResetPage(false);
searchFcltyQltyList(ref.current, page, 10); searchFcltyQltyList(ref.current, page, 10);
@@ -201,8 +229,9 @@ export default function ProcessFacilitySearch() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} initSidoValue={"11"}/> ref={ref} isAdmin={false} initSidoValue={"11"} />
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll min-[1200px]:overflow-x-hidden"> <div className="h-full w-full overflow-x-scroll min-[1200px]:overflow-x-hidden">
@@ -215,7 +244,7 @@ export default function ProcessFacilitySearch() {
{selectedRow !== null && ( {selectedRow !== null && (
<UiModal <UiModal
body={<WaterQualityModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={modalYear}></WaterQualityModal>} body={<WaterQualityModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={modalYear}></WaterQualityModal>}
bodyClass="sm:max-w-[90vw] w-[1300px] h-[920px]" bodyClass="sm:max-w-[90vw] w-[1300px] h-[100dvh] max-h-[930px] overflow-y-auto"
open={selectedRow !== null} open={selectedRow !== null}
onOpenChange={(open) => !open && closeModal()} onOpenChange={(open) => !open && closeModal()}
noHeaderYn="Y" noHeaderYn="Y"
@@ -224,4 +253,4 @@ export default function ProcessFacilitySearch() {
)} )}
</MainDiv> </MainDiv>
); );
} }
@@ -8,7 +8,8 @@
import FacilityTermModalHeader from "@/app/components/common/FacilityTermModalHeader"; import FacilityTermModalHeader from "@/app/components/common/FacilityTermModalHeader";
import { useFoStore } from "@/app/store"; import { useFoStore } from "@/app/store";
import type { FlowRateModalInterface, modalExcelType } from "@/app/store/flowRate"; import type { FlowRateModalInterface, modalExcelType } from "@/app/store/flowRate";
import { downloadExcel, UITab, UiTable } from "@common/business_components/ui"; import { dataFormSetting } from "@/app/store/flowRate";
import { downloadExcelFormat, UITab, UiTable } from "@common/business_components/ui";
import { Button, TabsContent } from "@common/components/ui"; import { Button, TabsContent } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader"; import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader";
@@ -33,12 +34,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
const { btnClass } = Common; const { btnClass } = Common;
const [copyYearList, setCopyYearList] = useState<FlowRateModalInterface[]>([]); const [copyYearList, setCopyYearList] = useState<FlowRateModalInterface[]>([]);
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [activeTab, setActiveTab] = useState<string>("tab_term_year");
const prevExcelListRef = useRef<modalExcelType[] | null>(null); const prevExcelListRef = useRef<modalExcelType[] | null>(null);
const { const { modalFlowRateListYear, upHeadListFlowRateModalYear, } = FlowRateModal;
modalFlowRateListYear,
upHeadListFlowRateModalYear,
} = FlowRateModal;
const ref = useRef<ReturnType<FlowRateModalInterface>>({ const ref = useRef<ReturnType<FlowRateModalInterface>>({
startDate: new Date(), startDate: new Date(),
endDate: new Date(), endDate: new Date(),
@@ -52,11 +51,11 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
const filteredData = setFilterAfterData(returnType.filteredList as FlowRateModalInterface[]); const filteredData = setFilterAfterData(returnType.filteredList as FlowRateModalInterface[]);
setCopyYearList(filteredData); setCopyYearList(filteredData);
}, []); }, []);
// 필터링 된 후 최대, 최소, 평균 값 계산 // 필터링 된 후 최대, 최소, 평균 값 계산
const setFilterAfterData = (filteredData: FlowRateModalInterface[]) => { const setFilterAfterData = (filteredData: FlowRateModalInterface[]) => {
if (!filteredData || filteredData.length === 0) return []; if (!filteredData || filteredData.length === 0) return [];
// 쉼표가 포함된 문자열을 숫자로 변환하는 함수 // 쉼표가 포함된 문자열을 숫자로 변환하는 함수
const parseNumber = (value: string | number | null | undefined): number => { const parseNumber = (value: string | number | null | undefined): number => {
if (value === null || value === undefined || value === '') return 0; if (value === null || value === undefined || value === '') return 0;
@@ -79,7 +78,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
let minreturnAmnt = parseNumber(filteredData[0]?.returnAmnt); let minreturnAmnt = parseNumber(filteredData[0]?.returnAmnt);
let minefflAmnt = parseNumber(filteredData[0]?.efflAmnt); let minefflAmnt = parseNumber(filteredData[0]?.efflAmnt);
let mininfoRnDay = parseNumber(filteredData[0]?.infoRnDay && filteredData[0]?.infoRnDay.toString().trim() !== 'x' ? filteredData[0]?.infoRnDay.toString().trim() : 0); let mininfoRnDay = parseNumber(filteredData[0]?.infoRnDay && filteredData[0]?.infoRnDay.toString().trim() !== 'x' ? filteredData[0]?.infoRnDay.toString().trim() : 0);
let minNoProcessInflAmnt = 99999999; let minNoProcessInflAmnt = 99999999; // 미처리하수 추정량
let avgtotInflAmnt = 0; let avgtotInflAmnt = 0;
let avginflAmnt = 0; let avginflAmnt = 0;
@@ -89,7 +88,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
let avginfoRnDay = 0; let avginfoRnDay = 0;
let avgNoProcessInflAmnt = 0; let avgNoProcessInflAmnt = 0;
let noProcessInflAmntCnt = 0; let noProcessInflAmntCnt = 0;
filteredData.forEach((item: FlowRateModalInterface) => { filteredData.forEach((item: FlowRateModalInterface) => {
const totInflAmnt = parseNumber(item.totInflAmnt); const totInflAmnt = parseNumber(item.totInflAmnt);
const inflAmnt = parseNumber(item.inflAmnt); const inflAmnt = parseNumber(item.inflAmnt);
@@ -119,24 +118,30 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
avgefflAmnt += efflAmnt; avgefflAmnt += efflAmnt;
avginfoRnDay += infoRnDay; avginfoRnDay += infoRnDay;
if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){ if (item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined) {
const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',','')); const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',', ''));
avgNoProcessInflAmnt += noProcessInflAmnt; avgNoProcessInflAmnt += noProcessInflAmnt;
maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt); maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt);
minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt); minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt);
noProcessInflAmntCnt +=1; noProcessInflAmntCnt += 1;
} }
}); });
const formattedData = filteredData.map((item: FlowRateModalInterface) => {
const newItem = { ...item };
dataFormSetting(newItem);
return newItem;
});
const newFilteredData = [ const newFilteredData = [
{ {
msrDt: '평균', msrDt: '평균',
totInflAmnt: avgtotInflAmnt && avgtotInflAmnt!=0 ? roundUp((avgtotInflAmnt / filteredData.length), 0) : 0, totInflAmnt: avgtotInflAmnt && avgtotInflAmnt != 0 ? roundUp((avgtotInflAmnt / filteredData.length), 0) : 0,
inflAmnt: avginflAmnt && avginflAmnt!=0 ? roundUp((avginflAmnt / filteredData.length), 0) : 0, inflAmnt: avginflAmnt && avginflAmnt != 0 ? roundUp((avginflAmnt / filteredData.length), 0) : 0,
sumFlow: avgsumFlow && avgsumFlow!=0 ? roundUp((avgsumFlow / filteredData.length), 0) : 0, sumFlow: avgsumFlow && avgsumFlow != 0 ? roundUp((avgsumFlow / filteredData.length), 0) : 0,
returnAmnt: avgreturnAmnt && avgreturnAmnt!=0 ? roundUp((avgreturnAmnt / filteredData.length), 0) : 0, returnAmnt: avgreturnAmnt && avgreturnAmnt != 0 ? roundUp((avgreturnAmnt / filteredData.length), 0) : 0,
efflAmnt: avgefflAmnt && avgefflAmnt!=0 ? roundUp((avgefflAmnt / filteredData.length), 0) : 0, efflAmnt: avgefflAmnt && avgefflAmnt != 0 ? roundUp((avgefflAmnt / filteredData.length), 0) : 0,
noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0), noProcessInflAmnt: roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0),
infoRnDay: avginfoRnDay > 0 ? roundUp((avginfoRnDay / filteredData.length), 1) : '0.0', infoRnDay: avginfoRnDay > 0 ? roundUp((avginfoRnDay / filteredData.length), 1) : '0.0',
rainEffectDay: 0, rainEffectDay: 0,
}, },
@@ -147,7 +152,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
sumFlow: roundUp(maxsumFlow, 0), sumFlow: roundUp(maxsumFlow, 0),
returnAmnt: roundUp(maxreturnAmnt, 0), returnAmnt: roundUp(maxreturnAmnt, 0),
efflAmnt: roundUp(maxefflAmnt, 0), efflAmnt: roundUp(maxefflAmnt, 0),
noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0), noProcessInflAmnt: roundNumber(maxNoProcessInflAmnt, 0),
infoRnDay: maxinfoRnDay > 0 ? roundUp(maxinfoRnDay, 1) : '0.0', infoRnDay: maxinfoRnDay > 0 ? roundUp(maxinfoRnDay, 1) : '0.0',
rainEffectDay: 0, rainEffectDay: 0,
}, },
@@ -158,11 +163,11 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
sumFlow: roundUp(minsumFlow, 0), sumFlow: roundUp(minsumFlow, 0),
returnAmnt: roundUp(minreturnAmnt, 0), returnAmnt: roundUp(minreturnAmnt, 0),
efflAmnt: roundUp(minefflAmnt, 0), efflAmnt: roundUp(minefflAmnt, 0),
noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0), noProcessInflAmnt: roundNumber(minNoProcessInflAmnt, 0),
infoRnDay: mininfoRnDay > 0 ? roundUp(mininfoRnDay, 1) : '0.0', infoRnDay: mininfoRnDay > 0 ? roundUp(mininfoRnDay, 1) : '0.0',
rainEffectDay: 0, rainEffectDay: 0,
}, },
...filteredData ...formattedData
]; ];
return newFilteredData; return newFilteredData;
} }
@@ -179,13 +184,9 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
fetchData(); fetchData();
}, [props.facilityCd, props.searchYear, searchFlowRateModalList]); }, [props.facilityCd, props.searchYear, searchFlowRateModalList]);
if (isLoading) {
return <div>로딩 중...</div>;
}
const excelDownload = () => { const excelDownload = () => {
const excelDownList: modalExcelType[] = []; const excelDownList: modalExcelType[] = [];
if(copyYearList.length > 0){ if (copyYearList.length > 0) {
copyYearList.forEach((item) => { copyYearList.forEach((item) => {
excelDownList.push({ excelDownList.push({
"날짜": item.msrDt, "날짜": item.msrDt,
@@ -200,20 +201,58 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
}); });
} }
if (excelDownList && excelDownList.length > 0) { if (excelDownList && excelDownList.length > 0) {
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 유량현황', sheetNameArray: [props.fcltyName + ' 유량현황'], headerRange: 'A1:H1' }); downloadExcelFormat({
data: JSON.parse(JSON.stringify(excelDownList)),
fileName: props.searchYear + '년 ' + props.fcltyName + ' 유량현황',
sheetNameArray: [props.fcltyName + ' 유량현황'],
headerRange: 'A1:H1',
decimalArray0: [1, 2, 3, 4, 5, 6],
decimalArray1: [0],
});
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) { } else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.'); alert('조회된 결과가 없습니다.');
} }
prevExcelListRef.current = excelDownList; prevExcelListRef.current = excelDownList;
} }
// const rainCellClassName = useCallback(
// (row: FlowRateModalInterface, headId: string, rowIndex: number) => {
// if (activeTab !== "tab_term_rain") return "";
// if (headId !== "infoRnDay") return "";
// if (rowIndex < 3) return "";
// const raw = row.infoRnDay;
// const value = typeof raw === "string" ? Number(raw.replace(/,/g, "").trim()) : Number(raw);
// if (!Number.isFinite(value)) return "";
// return value > 3 ? "bg-red-50 font-semibold" : "";
// },
// [activeTab],
// );
const rainRowClassName = useCallback(
(row: FlowRateModalInterface, rowIndex: number) => {
if (activeTab !== "tab_term_rain") return "";
if (rowIndex < 3) return "";
const raw = row.infoRnDay;
const value = typeof raw === "string" ? Number(raw.replace(/,/g, "").trim()) : Number(raw);
if (!Number.isFinite(value)) return "";
return value > 3 ? "bg-slate-50" : "";
},
[activeTab],
);
if (isLoading) {
return <div>로딩 중...</div>;
}
return ( return (
<> <>
<UITab tabList={tabList} defaultValue="tab_term_year"> <UITab tabList={tabList} defaultValue="tab_term_year" onValueChange={setActiveTab}>
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}> <Button className={btnClass} style={{ float: 'right' }} color="green" onClick={excelDownload}>
{"엑셀다운로드"} {"엑셀다운로드"}
</Button> </Button>
<TabsContent value="tab_term_year"> <TabsContent value="tab_term_year"> {/* 연간 */}
<FacilityTermModalHeader<FlowRateModalInterface> <FacilityTermModalHeader<FlowRateModalInterface>
searchList={modalFlowRateListYear} searchList={modalFlowRateListYear}
fcltyCd={props.facilityCd} fcltyCd={props.facilityCd}
@@ -224,23 +263,23 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
queryClick={filterData} queryClick={filterData}
/> />
<div className="h-[370px] overflow-y-auto overflow-x-hidden"> <div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable <UiTable
headName="유량현황" headName="유량현황"
tableData={copyYearList} tableData={copyYearList}
headlist={upHeadListFlowRateModalYear} headlist={upHeadListFlowRateModalYear}
pageSize={0} pageSize={0}
total={0} total={0}
cellClick={undefined} cellClick={undefined}
onPageChange={() => {}} onPageChange={() => { }}
className="h-[370px]" className="h-[370px]"
boldArray={[0,1,2]} boldArray={[0, 1, 2]}
/> />
</div> </div>
<div className="mt-20"> <div className="mt-20">
<UnderComment commentArray={[commentArray]} /> <UnderComment commentArray={[commentArray]} />
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_summer"> <TabsContent value="tab_term_summer"> {/* 하절기 */}
<FacilityTermModalHeader<FlowRateModalInterface> <FacilityTermModalHeader<FlowRateModalInterface>
searchList={modalFlowRateListYear} searchList={modalFlowRateListYear}
fcltyCd={props.facilityCd} fcltyCd={props.facilityCd}
@@ -251,23 +290,23 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
queryClick={filterData} queryClick={filterData}
/> />
<div className="h-[370px] overflow-y-auto overflow-x-hidden"> <div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable <UiTable
headName="유량현황" headName="유량현황"
tableData={copyYearList} tableData={copyYearList}
headlist={upHeadListFlowRateModalYear} headlist={upHeadListFlowRateModalYear}
pageSize={0} pageSize={0}
total={0} total={0}
cellClick={undefined} cellClick={undefined}
onPageChange={() => {}} onPageChange={() => { }}
className="h-[370px]" className="h-[370px]"
boldArray={[0,1,2]} boldArray={[0, 1, 2]}
/> />
</div> </div>
<div className="mt-20"> <div className="mt-20">
<UnderComment commentArray={[commentArray]} /> <UnderComment commentArray={[commentArray]} />
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_winter"> <TabsContent value="tab_term_winter"> {/* 동절기 */}
<FacilityTermModalHeader<FlowRateModalInterface> <FacilityTermModalHeader<FlowRateModalInterface>
searchList={modalFlowRateListYear} searchList={modalFlowRateListYear}
fcltyCd={props.facilityCd} fcltyCd={props.facilityCd}
@@ -278,23 +317,23 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
queryClick={filterData} queryClick={filterData}
/> />
<div className="h-[370px] overflow-y-auto overflow-x-hidden"> <div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable <UiTable
headName="유량현황" headName="유량현황"
tableData={copyYearList} tableData={copyYearList}
headlist={upHeadListFlowRateModalYear} headlist={upHeadListFlowRateModalYear}
pageSize={0} pageSize={0}
total={0} total={0}
cellClick={undefined} cellClick={undefined}
onPageChange={() => {}} onPageChange={() => { }}
className="h-[370px]" className="h-[370px]"
boldArray={[0,1,2]} boldArray={[0, 1, 2]}
/> />
</div> </div>
<div className="mt-20"> <div className="mt-20">
<UnderComment commentArray={[commentArray]} /> <UnderComment commentArray={[commentArray]} />
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_chuncheon"> <TabsContent value="tab_term_chuncheon"> {/* 청천시 */}
<FacilityTermModalHeader<FlowRateModalInterface> <FacilityTermModalHeader<FlowRateModalInterface>
searchList={modalFlowRateListYear} searchList={modalFlowRateListYear}
fcltyCd={props.facilityCd} fcltyCd={props.facilityCd}
@@ -305,23 +344,23 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
queryClick={filterData} queryClick={filterData}
/> />
<div className="h-[370px] overflow-y-auto overflow-x-hidden"> <div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable <UiTable
headName="유량현황" headName="유량현황"
tableData={copyYearList} tableData={copyYearList}
headlist={upHeadListFlowRateModalYear} headlist={upHeadListFlowRateModalYear}
pageSize={0} pageSize={0}
total={0} total={0}
cellClick={undefined} cellClick={undefined}
onPageChange={() => {}} onPageChange={() => { }}
className="h-[370px]" className="h-[370px]"
boldArray={[0,1,2]} boldArray={[0, 1, 2]}
/> />
</div> </div>
<div className="mt-20"> <div className="mt-20">
<UnderComment commentArray={[commentArray]} /> <UnderComment commentArray={[commentArray]} />
</div> </div>
</TabsContent> </TabsContent>
<TabsContent value="tab_term_rain"> <TabsContent value="tab_term_rain"> {/* 강우시 */}
<FacilityTermModalHeader<FlowRateModalInterface> <FacilityTermModalHeader<FlowRateModalInterface>
searchList={modalFlowRateListYear} searchList={modalFlowRateListYear}
fcltyCd={props.facilityCd} fcltyCd={props.facilityCd}
@@ -332,13 +371,15 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st
queryClick={filterData} queryClick={filterData}
/> />
<div className="h-[370px] overflow-y-auto overflow-x-hidden"> <div className="h-[370px] overflow-y-auto overflow-x-hidden">
<UiTable headName="유량현황" tableData={copyYearList} headlist={upHeadListFlowRateModalYear} pageSize={0} total={0} cellClick={undefined} onPageChange={() => {}} className="h-[370px]" boldArray={[0,1,2]}/> <UiTable headName="유량현황" tableData={copyYearList} headlist={upHeadListFlowRateModalYear} pageSize={0} total={0}
cellClick={undefined} onPageChange={() => { }} className="h-[370px]" boldArray={[0, 1, 2]}
rowClassName={rainRowClassName} />
</div> </div>
<div className="mt-20"> <div className="mt-20">
<UnderComment commentArray={["미처리하수 추정량 산식 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)","강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날"]} /> <UnderComment commentArray={["미처리하수 추정량 산식 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]/강우시 일별유입BOD)", "강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날"]} />
</div> </div>
</TabsContent> </TabsContent>
</UITab> </UITab>
</> </>
); );
} }
@@ -5,13 +5,13 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common"; import type { TableUpperProps } from "@/app/store/common";
import type { ExcelType } from "@/app/store/flowRate"; // import type { ExcelType } from "@/app/store/flowRate";
import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, 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 LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useContext, useEffect, useRef, useState } from "react";
import FlowRateModal from "./modal/page"; import FlowRateModal from "./modal/page";
export default function ProcessFacilitySearch() { export default function ProcessFacilitySearch() {
@@ -21,6 +21,11 @@ export default function ProcessFacilitySearch() {
,initializeCommonData ,initializeCommonData
,searchFlowRateList ,searchFlowRateList
} = useFoStore((state) => state); } = useFoStore((state) => state);
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null); const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null);
@@ -38,6 +43,11 @@ export default function ProcessFacilitySearch() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
flowRateSearchLabelArray flowRateSearchLabelArray
} = FlowRateSearch; } = FlowRateSearch;
@@ -49,7 +59,6 @@ export default function ProcessFacilitySearch() {
upHeadList3, upHeadList3,
flowRateList, flowRateList,
flowRateCount, flowRateCount,
excelList,
isLoading, isLoading,
} = FlowRateList; } = FlowRateList;
@@ -57,20 +66,20 @@ export default function ProcessFacilitySearch() {
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>(defaultSearchYear);
// 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);
const prevExcelListRef = useRef<ExcelType[] | null>(null); // const prevExcelListRef = useRef<ExcelType[] | null>(null);
// 모달 상태 추가 // 모달 상태 추가
const [selectedRow, setSelectedRow] = useState<number | null>(null); const [selectedRow, setSelectedRow] = useState<number | null>(null);
const [fcltyNm, setFcltyNm] = useState<string>(""); const [fcltyNm, setFcltyNm] = useState<string>("");
const [fcltyCd, setFcltyCd] = useState<string>(""); const [fcltyCd, setFcltyCd] = useState<string>("");
const [excelTrigger, setExcelTrigger] = useState<boolean>(false); const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
const [initTrigger, setInitTrigger] = useState<boolean>(false); const [initTrigger, setInitTrigger] = useState<boolean>(false);
const searchFlowRate = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { const searchFlowRate = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
let nameCd, partStr; let nameCd, partStr;
switch (partValue) { switch (partValue) {
@@ -89,9 +98,9 @@ export default function ProcessFacilitySearch() {
break; break;
} }
if(partStr==='G'){ if(partStr==='G'){
searchFlowRateList(pageNo, pageCnt, searchYearValue); await searchFlowRateList(pageNo, pageCnt, searchYearValue);
}else{ }else{
searchFlowRateList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchFlowRateList(pageNo, pageCnt, searchYearValue, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} }
}, [searchFlowRateList, searchYearValue, fcltCpct, operationValue, fcltyName]); }, [searchFlowRateList, searchYearValue, fcltCpct, operationValue, fcltyName]);
@@ -99,7 +108,7 @@ export default function ProcessFacilitySearch() {
// setWidthSize("w-[120%]"); // setWidthSize("w-[120%]");
setUpheadList(upHeadList1) setUpheadList(upHeadList1)
// 상태값 설정 // 상태값 설정
setSearchYearValue(selectSearchYear[0]?.val || "0"); setSearchYearValue(defaultSearchYear);
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
// SearchInputSelect 초기화 // SearchInputSelect 초기화
@@ -146,17 +155,6 @@ export default function ProcessFacilitySearch() {
} }
}, [isInit, initializeCommonData, searchFlowRateList, selectSearchYear, searchFlowRate, initTrigger]); }, [isInit, initializeCommonData, searchFlowRateList, selectSearchYear, searchFlowRate, initTrigger]);
useEffect(() => {
if(!excelTrigger) return;
if (excelList && excelList.length > 0) {
downloadExcelFormat({ data: JSON.parse(JSON.stringify(excelList)), fileName: '시설별 유량현황', sheetNameArray: ['시설별 유량현황'], headerRange: 'A1:O1', decimalArray0: [9,10,11,12,13,14] });
} else if (prevExcelListRef.current && prevExcelListRef.current.length > 0) {
alert('다운받을 데이터가 없습니다.');
}
prevExcelListRef.current = excelList;
}, [excelList, excelTrigger]);
const ref = useRef<ReturnType>({ const ref = useRef<ReturnType>({
partValue: '', partValue: '',
sidoValue: '11', sidoValue: '11',
@@ -175,10 +173,37 @@ export default function ProcessFacilitySearch() {
setResetPage(true); setResetPage(true);
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
const excelDownload = useCallback(() => { const excelDownload = useCallback(async () => {
searchFlowRate(ref.current, 1, 10000); if (isExcelDownClick) return;
setExcelTrigger(true); if (ref.current.partValue === 'A') { // 행정별
}, [searchFlowRate]); if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
setIsExcelDownClick(true);
try {
await searchFlowRate(ref.current, 1, 10000);
const latestExcelList = store.getState().FlowRateList.excelList || [];
if (latestExcelList.length > 0) {
downloadExcelFormat({ data: JSON.parse(JSON.stringify(latestExcelList)), fileName: '시설별 유량현황', sheetNameArray: ['시설별 유량현황'], headerRange: 'A1:O1', decimalArray0: [9,10,11,12,13,14] });
} else {
alert('조회된 결과가 없습니다.');
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchFlowRate, store]);
const total = flowRateCount; const total = flowRateCount;
return ( return (
@@ -203,6 +228,7 @@ export default function ProcessFacilitySearch() {
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
initClick={resetVal} initClick={resetVal}
excelDisabled={isExcelDownClick}
ref={ref} isAdmin={false} initSidoValue={'11'}/> ref={ref} isAdmin={false} initSidoValue={'11'}/>
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
@@ -216,7 +242,7 @@ export default function ProcessFacilitySearch() {
{selectedRow !== null && ( {selectedRow !== null && (
<UiModal <UiModal
body={<FlowRateModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={searchYearValue}></FlowRateModal>} body={<FlowRateModal fcltyName={fcltyNm} facilityCd={fcltyCd} searchYear={searchYearValue}></FlowRateModal>}
bodyClass="sm:max-w-[90vw] w-[1250px] h-[780px]" bodyClass="sm:max-w-[90vw] w-[1250px] h-[100dvh] max-h-[780px]"
open={selectedRow !== null} open={selectedRow !== null}
onOpenChange={(open: boolean) => !open && closeModal()} onOpenChange={(open: boolean) => !open && closeModal()}
/> />
@@ -5,11 +5,11 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common"; import type { TableUpperProps } from "@/app/store/common";
import { downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components"; import { downloadExcelFormat, 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, useContext, useEffect, useRef, useState } from "react";
import LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UnderComment from "@/app/components/common/UnderComment"; import UnderComment from "@/app/components/common/UnderComment";
@@ -26,6 +26,11 @@ export default function PlanSewage() {
, initializeCommonData , initializeCommonData
, searchPlanSewageList , searchPlanSewageList
} = useFoStore((state) => state) || { processAreaList: { processAreaList: [] } }; } = useFoStore((state) => state) || { processAreaList: { processAreaList: [] } };
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
@@ -41,6 +46,11 @@ export default function PlanSewage() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
labelArray, labelArray,
} = PlanSewageSearch; } = PlanSewageSearch;
@@ -51,7 +61,6 @@ export default function PlanSewage() {
upHeadList3, upHeadList3,
planSewageList, planSewageList,
planSewageCount, planSewageCount,
excelList,
isLoading, isLoading,
} = PlanSewage; } = PlanSewage;
@@ -85,11 +94,12 @@ 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>(defaultSearchYear);
const [initTrigger, setInitTrigger] = useState<boolean>(false); const [initTrigger, setInitTrigger] = useState<boolean>(false);
// 엑셀다운로드 트리거
const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
const [excelTrigger, setExcelTrigger] = useState<boolean>(false);
/** /**
* 페이지 함수 * 페이지 함수
*/ */
@@ -100,7 +110,7 @@ export default function PlanSewage() {
// 상태값 설정 // 상태값 설정
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
setSearchYear(selectSearchYear[0]?.val || "0"); setSearchYear(defaultSearchYear);
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -113,24 +123,11 @@ export default function PlanSewage() {
searchPlanSewage(ref.current, 1, 10); searchPlanSewage(ref.current, 1, 10);
} }
useEffect(() => {
if (!excelTrigger) return;
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
fileName: '계획하수량 산정지표 현황',
sheetNameArray: ['계획하수량 산정지표 현황'],
headerRange: 'A1:M1'
});
}
}, [excelList, excelTrigger]);
/** /**
* 콜백함수 * 콜백함수
*/ */
// 조회 // 조회
const searchPlanSewage = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt: number = 20) => { const searchPlanSewage = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt: number = 20) => {
let nameCd, partStr let nameCd, partStr
switch (partValue) { switch (partValue) {
case 'R': case 'R':
@@ -150,10 +147,10 @@ export default function PlanSewage() {
if (partStr === 'G') { if (partStr === 'G') {
partValue = partValue === 'G' ? 'A' : partValue; partValue = partValue === 'G' ? 'A' : partValue;
searchPlanSewageList(pageNo, pageCnt, searchYear, partValue); await searchPlanSewageList(pageNo, pageCnt, searchYear, partValue);
} }
else { else {
searchPlanSewageList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchPlanSewageList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} }
}, [operationValue, fcltyName, searchPlanSewageList, searchYear, fcltCpct]); }, [operationValue, fcltyName, searchPlanSewageList, searchYear, fcltCpct]);
@@ -168,7 +165,7 @@ export default function PlanSewage() {
setInitTrigger(true); setInitTrigger(true);
} }
} }
}, [isInit, initializeCommonData, searchPlanSewageList, selectSearchYear, initTrigger, searchPlanSewage]); }, [isInit, initializeCommonData, initTrigger, searchPlanSewage]);
const chkVal = useCallback((returntype: ReturnType) => { const chkVal = useCallback((returntype: ReturnType) => {
// setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]") // setWidthSize(returntype.partValue=='A' ?"w-[120%]":"w-[130%]")
@@ -177,10 +174,66 @@ export default function PlanSewage() {
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
// 엑셀다운로드 // 엑셀다운로드
const excelDownload = useCallback((searchReturn: ReturnType) => { const excelDownload = useCallback(async (searchReturn: ReturnType) => {
searchPlanSewage(searchReturn, 1, 10000); if (isExcelDownClick) return;
setExcelTrigger(true); if (ref.current.partValue === 'A') { // 행정별
}, [searchPlanSewage]); if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
setIsExcelDownClick(true);
try {
await searchPlanSewage(searchReturn, 1, 10000);
const latestExcelList = store.getState().PlanSewage.excelList || [];
if (latestExcelList.length > 0) {
const toNumber = (value: unknown) => {
if (value === null || value === undefined || value === '') return '';
const parsed = typeof value === "number" ? value : Number(String(value).replace(/,/g, ""));
return Number.isFinite(parsed) ? parsed : '';
};
const numericKeys = [
"시설용량(m³/일)",
"여유용량(m³/일)",
"변동부하율(%)",
"분류식화율(%)",
];
const excelData = latestExcelList.map((row) => {
const nextRow = { ...row } as Record<string, unknown>;
numericKeys.forEach((key) => {
if (key in nextRow) {
nextRow[key] = toNumber(nextRow[key]);
}
});
return nextRow;
});
downloadExcelFormat({
data: excelData as unknown as JSON[],
fileName: '계획하수량 산정지표 현황',
sheetNameArray: ['계획하수량 산정지표 현황'],
headerRange: 'A1:M1',
decimalArray0: [9, 10, 11, 12]
});
} else {
alert("조회된 결과가 없습니다.");
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchPlanSewage, store]);
// 페이지 변경 // 페이지 변경
const handlePageChange = useCallback((page: number) => { const handlePageChange = useCallback((page: number) => {
@@ -211,6 +264,7 @@ export default function PlanSewage() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} initSidoValue={"11"} /> ref={ref} isAdmin={false} initSidoValue={"11"} />
<ListDiv> <ListDiv>
@@ -224,4 +278,4 @@ export default function PlanSewage() {
</ListDiv> </ListDiv>
</MainDiv> </MainDiv>
); );
} }
@@ -5,27 +5,36 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { useShallow } from 'zustand/react/shallow';
import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SelectBox, Title, UiModal, 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, useContext, useEffect, useRef, useState } from "react";
import ProcessFacilityInfoModal from "./modal/page"; import ProcessFacilityInfoModal from "./modal/page";
import LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
export default function ProcessArea() { export default function ProcessArea() {
const {Common, const {
Common,
ProcessArea, ProcessArea,
ProcessAreaSearch, ProcessAreaSearch,
initializeCommonData, initializeCommonData,
searchProcessAreaList searchProcessAreaList
} = useFoStore((state) => state) || { } = useFoStore(
Common: { isInit: false, selectSidoData: [], selectSigunData: [], selectRegionData: [], selectUnitWaterShedData: [], selectMiddleRegionData: [], selectEnvPartData: [], selectSearchYear: [{ val: "0" }], btnClass: "" }, useShallow((state) => ({ // 다른 무관한 상태가 변경되어도 이 컴포넌트는 불필요하게 다시 렌더링 되지 않음.
ProcessArea: { processAreaList: [], processAreaCount: 0, excelList: [], upHeadList1: [] }, Common: state.Common,
ProcessAreaSearch: { processFacilityLabelArray: [] }, ProcessArea: state.ProcessArea,
initializeCommonData: () => {}, ProcessAreaSearch: state.ProcessAreaSearch,
searchProcessAreaList: () => {} initializeCommonData: state.initializeCommonData,
}; searchProcessAreaList: state.searchProcessAreaList,
}))
);
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
selectSidoData, selectSidoData,
@@ -37,7 +46,12 @@ export default function ProcessArea() {
selectSearchYear, selectSearchYear,
btnClass, btnClass,
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
processFacilityLabelArray, processFacilityLabelArray,
} = ProcessAreaSearch; } = ProcessAreaSearch;
@@ -46,7 +60,6 @@ export default function ProcessArea() {
upHeadList1, upHeadList1,
processAreaList, processAreaList,
processAreaCount, processAreaCount,
excelList,
isLoading, isLoading,
} = ProcessArea; } = ProcessArea;
@@ -54,13 +67,15 @@ export default function ProcessArea() {
// 그리드 관련 // 그리드 관련
const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null); const searchInputRef = useRef<HTMLDivElement & HTMLInputElement>(null);
// 모달 상태 추가 // 모달 상태 추가
const [selectedRow, setSelectedRow] = useState<number | null>(null); const [selectedRow, setSelectedRow] = useState<number | null>(null);
const [fcltyNm, setFcltyNm] = useState<string>(""); const [fcltyNm, setFcltyNm] = useState<string>("");
const [fcltyCd, setFcltyCd] = useState<string>(""); const [fcltyCd, setFcltyCd] = useState<string>("");
const [resetPage, setResetPage] = useState<boolean>(false); const [resetPage, setResetPage] = useState<boolean>(false);
const [searchYearValue, setSearchYearValue] = useState<string>(selectSearchYear[0]?.val || "0"); const [searchYearValue, setSearchYearValue] = useState<string>(defaultSearchYear);
const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
const ref = useRef<ReturnType>({ const ref = useRef<ReturnType>({
partValue: '', partValue: '',
@@ -74,8 +89,8 @@ export default function ProcessArea() {
sigunText: '', sigunText: '',
}); });
const searchProcessArea = useCallback(({ sidoText, sigunText}: ReturnType, pageNo: number, pageCnt:number=20) => { const searchProcessArea = useCallback(async ({ sidoText, sigunText }: ReturnType, pageNo: number, pageCnt: number = 20) => {
searchProcessAreaList(pageNo, pageCnt, sidoText, sigunText, searchYearValue); await searchProcessAreaList(pageNo, pageCnt, sidoText, sigunText, searchYearValue);
}, [searchProcessAreaList, searchYearValue]); }, [searchProcessAreaList, searchYearValue]);
// 조회 // 조회
@@ -91,8 +106,8 @@ export default function ProcessArea() {
input.value = ""; input.value = "";
} }
} }
setSearchYearValue(selectSearchYear[0]?.val || "0"); setSearchYearValue(defaultSearchYear);
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0"); searchProcessAreaList(1, 10, '', '', defaultSearchYear);
} }
// 셀 클릭 시 모달 표시 // 셀 클릭 시 모달 표시
@@ -112,24 +127,49 @@ export default function ProcessArea() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchProcessAreaList(1, 10, '', '', selectSearchYear[0]?.val || "0"); searchProcessAreaList(1, 10, '', '', defaultSearchYear);
} }
}, [isInit, initializeCommonData, searchProcessAreaList]); }, [isInit, initializeCommonData, searchProcessAreaList, defaultSearchYear]);
useEffect(() => { const excelDownload = useCallback(async () => {
if (excelList && excelList.length > 0) { if (isExcelDownClick) return;
downloadExcel({ // if (ref.current.partValue === 'A') { // 행정별
data: excelList as unknown as JSON[], // if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
fileName: '처리구역정보', // alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
sheetNameArray: ['처리구역정보'], // return;
headerRange: 'A1:W1' // }
}); // } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
setIsExcelDownClick(true);
try {
await searchProcessArea(ref.current, 1, 10000);
const latestExcelList = store.getState().ProcessArea.excelList || [];
if (latestExcelList.length > 0) {
downloadExcelFormat({
data: latestExcelList as unknown as JSON[],
fileName: '처리구역정보',
sheetNameArray: ['처리구역정보'],
headerRange: 'A1:W1',
decimalArray0: [3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15],
decimalArray2: [16, 17, 18, 19, 20, 21],
});
} else {
alert('조회된 결과가 없습니다.');
}
} finally {
setIsExcelDownClick(false);
} }
}, [excelList]); }, [isExcelDownClick, searchProcessArea, store]);
const excelDownload = useCallback(() => {
searchProcessArea(ref.current, 1, 10000);
}, [searchProcessArea]);
const handlePageChange = useCallback((pageNo: number) => { const handlePageChange = useCallback((pageNo: number) => {
setResetPage(false); setResetPage(false);
@@ -143,7 +183,7 @@ export default function ProcessArea() {
<ContentsDiv> <ContentsDiv>
<SearchBaseForm <SearchBaseForm
leftChildren={<> leftChildren={<>
<SelectBox className="col-span-3" label={processFacilityLabelArray[6] as string} selectArray={selectSearchYear} onSelectValue={(val) => setSearchYearValue(val.toString())} value={searchYearValue} selectClass={undefined}/> <SelectBox className="col-span-3" label={processFacilityLabelArray[6] as string} selectArray={selectSearchYear} onSelectValue={(val) => setSearchYearValue(val.toString())} value={searchYearValue} selectClass={undefined} />
</>} </>}
rightChildren={undefined} rightChildren={undefined}
selectSidoData={selectSidoData} selectSidoData={selectSidoData}
@@ -155,6 +195,7 @@ export default function ProcessArea() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} ref={ref}
isAdmin={true} isAdmin={true}
@@ -163,19 +204,20 @@ export default function ProcessArea() {
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll min-[1900px]:overflow-x-hidden"> <div className="h-full w-full overflow-x-scroll min-[1900px]:overflow-x-hidden">
<div className="w-[160%] min-[1900px]:w-[100%]"> <div className="w-[160%] min-[1900px]:w-[100%]">
<UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList} headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} /> <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"처리구역정보"} tableData={mainList}
headlist={upHeadList1} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} />
</div> </div>
</div> </div>
</ListDiv> </ListDiv>
</ContentsDiv> </ContentsDiv>
{selectedRow !== null && ( {selectedRow !== null && (
<UiModal <UiModal
body={<ProcessFacilityInfoModal fcltyName={fcltyNm} facilityCd={fcltyCd}></ProcessFacilityInfoModal>} body={<ProcessFacilityInfoModal fcltyName={fcltyNm} facilityCd={fcltyCd}></ProcessFacilityInfoModal>}
bodyClass="sm:max-w-[90vw] w-[1200px] h-[900px]" bodyClass="sm:max-w-[90vw] w-[1200px] h-[100dvh] max-h-[900px] overflow-y-auto"
open={selectedRow !== null} open={selectedRow !== null}
onOpenChange={(open: boolean) => !open && closeModal()} onOpenChange={(open: boolean) => !open && closeModal()}
/> />
)} )}
</MainDiv> </MainDiv>
); );
} }
@@ -5,6 +5,7 @@
*/ */
"use client" "use client"
import { useCallback, useRef } from "react";
import { useFoStore } from "@/app/store"; import { useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/dashboard"; import type { TableUpperProps } from "@/app/store/dashboard";
import { downloadExcelFormat, filePickedBlobArray, UITab, UiTable } from "@common/business_components/ui"; import { downloadExcelFormat, filePickedBlobArray, UITab, UiTable } from "@common/business_components/ui";
@@ -121,6 +122,21 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
const upHeadListPlanInfoChange = headMakeList(upHeadListPlanInfo, 2); const upHeadListPlanInfoChange = headMakeList(upHeadListPlanInfo, 2);
const upHeadListFcltyHistInfoChange = headMakeList(upHeadListFcltyHistInfo, 3); const upHeadListFcltyHistInfoChange = headMakeList(upHeadListFcltyHistInfo, 3);
const upHeadListFcltyWaterQltyInfoChange = headMakeList(upHeadListFcltyWaterQltyInfo, 4); const upHeadListFcltyWaterQltyInfoChange = headMakeList(upHeadListFcltyWaterQltyInfo, 4);
const historyTopScrollRef = useRef<HTMLDivElement>(null);
const historyBottomScrollRef = useRef<HTMLDivElement>(null);
const syncLockRef = useRef(false);
const syncScroll = useCallback((source: HTMLDivElement | null, target: HTMLDivElement | null) => {
if (!source || !target || syncLockRef.current) return;
syncLockRef.current = true;
const nextTop = source.scrollTop;
if (target.scrollTop !== nextTop) {
target.scrollTop = nextTop;
}
requestAnimationFrame(() => {
syncLockRef.current = false;
});
}, []);
const excelDownloadPlan = () => { const excelDownloadPlan = () => {
const excelDownList: any[] = []; const excelDownList: any[] = [];
@@ -137,11 +153,19 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
"시운전완료일": item.trlrnCmplDt, "시운전완료일": item.trlrnCmplDt,
"가동개시일": item.rnDt, "가동개시일": item.rnDt,
"시설용량(m³/일)": item.fctCpc&&item.fctCpc.toString().trim()!=''?Number(item.fctCpc.toString().replaceAll(',','')):'', "시설용량(m³/일)": item.fctCpc&&item.fctCpc.toString().trim()!=''?Number(item.fctCpc.toString().replaceAll(',','')):'',
"공법구분": item.trtSrsHanNm,
"공법계열": item.trtMocHanNm,
"방법": item.trtFrfHanNm,
}); });
}); });
} }
if (excelDownList && excelDownList.length > 0) { if (excelDownList && excelDownList.length > 0) {
downloadExcelFormat({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.fcltyName + ' 시설이력관리', sheetNameArray: [props.fcltyName + ' 시설이력관리'], headerRange: 'A1:I1' }); downloadExcelFormat({
data: JSON.parse(JSON.stringify(excelDownList)),
fileName: props.fcltyName + ' 시설이력관리',
sheetNameArray: [props.fcltyName + ' 시설이력관리'],
decimalArray0: [8],
headerRange: 'A1:L1' });
} else if (gridListFcltyHistInfo.length == 0) { } else if (gridListFcltyHistInfo.length == 0) {
alert('다운받을 데이터가 없습니다.'); alert('다운받을 데이터가 없습니다.');
} }
@@ -182,7 +206,7 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
const sheetParameter = [ const sheetParameter = [
{ {
data: excelData, data: excelData,
headerNum: 2, headerNum: 3,
headerRange: 'A1:S2', headerRange: 'A1:S2',
sheetName: '시설 수질정보', sheetName: '시설 수질정보',
startCol: 'A' startCol: 'A'
@@ -218,7 +242,7 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
<h3 className="text-2xl font-medium text-label">시설 기본정보</h3> <h3 className="text-2xl font-medium text-label">시설 기본정보</h3>
</div> </div>
<div className="card !m-[1.2rem] max-h-[40rem] overflow-auto !p-0r"> <div className="card !m-[1.2rem] max-h-[40rem] overflow-auto !p-0r">
<Table> <Table variant="secondary">
<thead> <thead>
<TableRow className=""> <TableRow className="">
<TableHead className="w-1/6">{'시설명'}</TableHead> <TableHead className="w-1/6">{'시설명'}</TableHead>
@@ -262,7 +286,11 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
<TabsContent value="history_info"> <TabsContent value="history_info">
<ListDiv> <ListDiv>
<div className="h-[250px] w-full overflow-y-auto overflow-x-hidden"> <div
className="h-[250px] w-full overflow-y-auto overflow-x-hidden"
ref={historyTopScrollRef}
onScroll={() => syncScroll(historyTopScrollRef.current, historyBottomScrollRef.current)}
>
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadPlan}> <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadPlan}>
{"엑셀다운로드"} {"엑셀다운로드"}
</Button> </Button>
@@ -274,7 +302,11 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
</div> </div>
</ListDiv> </ListDiv>
<ListDiv> <ListDiv>
<div className="h-[250px] w-full overflow-y-auto overflow-x-hidden"> <div
className="h-[250px] w-full overflow-y-auto overflow-x-hidden"
ref={historyBottomScrollRef}
onScroll={() => syncScroll(historyBottomScrollRef.current, historyTopScrollRef.current)}
>
<Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadQlty}> <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadQlty}>
{"엑셀다운로드"} {"엑셀다운로드"}
</Button> </Button>
@@ -292,4 +324,4 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
</div> </div>
</> </>
); );
} }
@@ -6,11 +6,11 @@
"use client" "use client"
import UnderComment from "@/app/components/common/UnderComment"; import UnderComment from "@/app/components/common/UnderComment";
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, 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 LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useContext, useEffect, useRef, useState } from "react";
import ProcessFacilityInfoModal from "./modal/page"; import ProcessFacilityInfoModal from "./modal/page";
export default function ProcessFacilitySearch() { export default function ProcessFacilitySearch() {
@@ -25,6 +25,11 @@ export default function ProcessFacilitySearch() {
//시설데이터 수질정보 조회 //시설데이터 수질정보 조회
,searchProcessFacilityWaterQlty ,searchProcessFacilityWaterQlty
} = useFoStore((state) => state) || { ProcessFacilityList: { processFacilityList: [], processFacilityCount: 0 }}; } = useFoStore((state) => state) || { ProcessFacilityList: { processFacilityList: [], processFacilityCount: 0 }};
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
@@ -69,7 +74,6 @@ export default function ProcessFacilitySearch() {
upHeadList1, upHeadList1,
upHeadList2, upHeadList2,
upHeadList3, upHeadList3,
excelList,
isLoading, isLoading,
} = ProcessFacilityList; } = ProcessFacilityList;
@@ -89,6 +93,7 @@ export default function ProcessFacilitySearch() {
const [partValue, setPartValue] = useState<string>("A"); const [partValue, setPartValue] = useState<string>("A");
// const [widthSize, setWidthSize] = useState<string>("w-[120%]"); // const [widthSize, setWidthSize] = useState<string>("w-[120%]");
const [upHeadList, setUpheadList] = useState(upHeadList1); const [upHeadList, setUpheadList] = useState(upHeadList1);
const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
/** /**
* 모달 상태 변수 * 모달 상태 변수
@@ -149,13 +154,7 @@ export default function ProcessFacilitySearch() {
} }
}, [partValue, upHeadList1, upHeadList2, upHeadList3]); }, [partValue, upHeadList1, upHeadList2, upHeadList3]);
useEffect(() => { const searchFcltyList = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=10) => {
if (excelList && excelList.length > 0) {
downloadExcel({ data: excelList as unknown as JSON[], fileName: '처리시설 시설정보', sheetNameArray: ['처리시설 시설정보'], headerRange: 'A1:P1' });
}
}, [excelList]);
const searchFcltyList = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=10) => {
let nameCd, partStr let nameCd, partStr
switch (partValue) { switch (partValue) {
case 'R': case 'R':
@@ -172,7 +171,7 @@ export default function ProcessFacilitySearch() {
partStr = envPartValue !== '0' ? envPartValue:partValue; partStr = envPartValue !== '0' ? envPartValue:partValue;
break; break;
} }
searchProcessFacility(pageNo, pageCnt, partStr, nameCd || '0', fcltCpct, operationValue, facilityPartValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchProcessFacility(pageNo, pageCnt, partStr, nameCd || '0', fcltCpct, operationValue, facilityPartValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
if(isSearch) { if(isSearch) {
setIsSearch(false); setIsSearch(false);
} }
@@ -235,9 +234,44 @@ export default function ProcessFacilitySearch() {
} }
} }
const excelDownload = useCallback(() => { const excelDownload = useCallback(async () => {
searchFcltyList(ref.current, 1, 10000); if (isExcelDownClick) return;
}, [searchFcltyList]); // if (ref.current.partValue === 'A') { // 행정별
// if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
setIsExcelDownClick(true);
try {
await searchFcltyList(ref.current, 1, 10000);
const latestExcelList = store.getState().ProcessFacilityList.excelList || [];
if (latestExcelList.length > 0) {
downloadExcelFormat({
data: latestExcelList as unknown as JSON[],
fileName: '처리시설 시설정보',
sheetNameArray: ['처리시설 시설정보'],
headerRange: 'A1:P1',
decimalArray0: [9, 10, 11],
});
} else {
alert('조회된 결과가 없습니다.');
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchFcltyList, store]);
// 모달 닫기 // 모달 닫기
const closeModal = () => { const closeModal = () => {
@@ -266,6 +300,7 @@ export default function ProcessFacilitySearch() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} /> ref={ref} isAdmin={false} />
<ListDiv> <ListDiv>
@@ -292,11 +327,11 @@ export default function ProcessFacilitySearch() {
{selectedRow !== null && ( {selectedRow !== null && (
<UiModal <UiModal
body={<ProcessFacilityInfoModal fcltyName={modalFcltyNm} facilityCd={modalFcltyCd} sido={modalSido} gugun={modalGugun} daddr={modalAddr} fctCpc={modalFctCpc} trtFrfNm={modalTrtFrfNm} rnDt={modalRnDt} cmplDt={modalCmplDt} trstOprEtpNm={modalTrstOprEtpNm} bscFctClsNm={modalBscFctClsNm} mnstr={modalMnstr} efflWtrrgn={modalEfflWtrrgn} lgbsn={modalLgbsn} efflWqltStndrdNm={modalEfflWqltStndrdNm} rgnNm={modalRgnNm} rvbsn={modalRvbsn}></ProcessFacilityInfoModal>} body={<ProcessFacilityInfoModal fcltyName={modalFcltyNm} facilityCd={modalFcltyCd} sido={modalSido} gugun={modalGugun} daddr={modalAddr} fctCpc={modalFctCpc} trtFrfNm={modalTrtFrfNm} rnDt={modalRnDt} cmplDt={modalCmplDt} trstOprEtpNm={modalTrstOprEtpNm} bscFctClsNm={modalBscFctClsNm} mnstr={modalMnstr} efflWtrrgn={modalEfflWtrrgn} lgbsn={modalLgbsn} efflWqltStndrdNm={modalEfflWqltStndrdNm} rgnNm={modalRgnNm} rvbsn={modalRvbsn}></ProcessFacilityInfoModal>}
bodyClass="sm:max-w-[70vw] sm:max-h-[95vh]" bodyClass="sm:max-w-[100vw] w-[1300px] h-[100dvh] max-h-[800px]"
open={selectedRow !== null} open={selectedRow !== null}
onOpenChange={(open) => !open && closeModal()} onOpenChange={(open) => !open && closeModal()}
/> />
)} )}
</MainDiv> </MainDiv>
); );
} }
+89 -29
View File
@@ -5,11 +5,11 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common"; import type { TableUpperProps } from "@/app/store/common";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, 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, useContext, useEffect, useRef, useState } from "react";
import LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import UnderComment from "@/app/components/common/UnderComment"; import UnderComment from "@/app/components/common/UnderComment";
@@ -26,6 +26,11 @@ export default function Rdi() {
,RdiSearch ,RdiSearch
,searchRdiList ,searchRdiList
} = useFoStore((state) => state) || { processAreaList: { processAreaList: [] }}; } = useFoStore((state) => state) || { processAreaList: { processAreaList: [] }};
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
@@ -41,6 +46,11 @@ export default function Rdi() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
labelArray, labelArray,
} = RdiSearch; } = RdiSearch;
@@ -51,7 +61,6 @@ export default function Rdi() {
upHeadList3, upHeadList3,
rdiList, rdiList,
rdiCount, rdiCount,
excelList,
isLoading, isLoading,
} = Rdi; } = Rdi;
@@ -83,9 +92,10 @@ export default function Rdi() {
// 시설상태 // 시설상태
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>(defaultSearchYear);
// 엑셀 다운로드 트리거 // 엑셀 다운로드 트리거
const [isInitExcelDownload, setIsInitExcelDownload] = useState<boolean>(false); const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
const [initTrigger, setInitTrigger] = useState<boolean>(false); const [initTrigger, setInitTrigger] = useState<boolean>(false);
/** /**
@@ -99,7 +109,7 @@ export default function Rdi() {
// 상태값 설정 // 상태값 설정
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
setSearchYear(selectSearchYear[0]?.val || "0"); setSearchYear(defaultSearchYear);
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -112,23 +122,11 @@ export default function Rdi() {
searchRdi(ref.current, 1, 10); searchRdi(ref.current, 1, 10);
} }
useEffect(() => {
if(!isInitExcelDownload) return ;
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
fileName: 'RDII추정',
sheetNameArray: ['RDII추정'],
headerRange: 'A1:R1'
});
}
}, [excelList, isInitExcelDownload]);
/** /**
* 콜백함수 * 콜백함수
*/ */
// 조회 // 조회
const searchRdi = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { const searchRdi = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
let nameCd, partStr let nameCd, partStr
switch (partValue) { switch (partValue) {
case 'R': case 'R':
@@ -147,10 +145,9 @@ export default function Rdi() {
} }
if(partStr === 'G'){ if(partStr === 'G'){
searchRdiList(pageNo, pageCnt, searchYear); await searchRdiList(pageNo, pageCnt, searchYear);
}else{ }else{
searchRdiList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchRdiList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined);
} }
}, [operationValue, fcltyName, searchRdiList, searchYear, fcltCpct]); }, [operationValue, fcltyName, searchRdiList, searchYear, fcltCpct]);
@@ -174,10 +171,71 @@ export default function Rdi() {
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
// 엑셀다운로드 // 엑셀다운로드
const excelDownload = useCallback(() => { const excelDownload = useCallback(async () => {
searchRdi(ref.current, 1, 5000); if (isExcelDownClick) return;
setIsInitExcelDownload(true); // if (ref.current.partValue === 'A') { // 행정별
}, [searchRdi]); // if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
// alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'R') { // 유역별
// if (!ref.current.regionValue || ref.current.regionValue === '0') {
// alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// } else if (ref.current.partValue === 'G') { // 환경청별
// if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
// alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
// return;
// }
// }
setIsExcelDownClick(true);
try {
await searchRdi(ref.current, 1, 5000);
const latestExcelList = store.getState().Rdi.excelList || [];
if (latestExcelList.length > 0) {
const toNumber = (value: unknown) => {
if (value === null || value === undefined || value === '') return '';
const parsed = typeof value === "number" ? value : Number(String(value).replace(/,/g, ""));
return Number.isFinite(parsed) ? parsed : '';
};
const numericKeys = [
"시설용량(m³/일)",
"청천시유입하수량(m³/일)",
"하절기강우일최저유입BOD(mg/L)",
"하절기최저유입BOD유입유량(m³/일)",
"동절기청천시유입BOD(mg/L)",
"RDII추정",
"RDII추정시일강수량(mm)",
"강우시총추정유입량(m³/일)",
];
const excelData = latestExcelList.map((row) => {
const nextRow = { ...row } as Record<string, unknown>;
numericKeys.forEach((key) => {
if (key in nextRow) {
nextRow[key] = toNumber(nextRow[key]);
}
});
return nextRow;
});
downloadExcelFormat({
data: excelData as unknown as JSON[],
fileName: 'RDII추정',
sheetNameArray: ['RDII추정'],
headerRange: 'A1:R1',
decimalArray0: [9, 10, 11, 12, 13, 14, 15, 16],
});
} else {
alert("조회된 결과가 없습니다.");
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchRdi, store]);
// 페이지 변경 // 페이지 변경
const handlePageChange = useCallback((page: number) => { const handlePageChange = useCallback((page: number) => {
@@ -209,13 +267,15 @@ export default function Rdi() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} isAdmin={false} initSidoValue={"11"}/> ref={ref} isAdmin={false} initSidoValue={"11"}/>
<ListDiv> <ListDiv>
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
<div className="h-full w-full overflow-x-scroll min-[1200px]:overflow-x-hidden"> <div className="h-full w-full overflow-x-scroll min-[1200px]:overflow-x-hidden">
<div className="w-[120%] min-[1200px]:w-[100%]"> <div className="w-[120%] min-[1200px]:w-[100%]">
<UiTable cellClick={ undefined } headName={"RDII추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} /> <UiTable cellClick={ undefined } headName={"RDII추정"} tableData={mainList} headlist={upheadList}
pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} widthFixed={true} />
</div> </div>
<UnderComment divHeight={"0"} commentArray={commentArray} /> <UnderComment divHeight={"0"} commentArray={commentArray} />
</div> </div>
@@ -223,4 +283,4 @@ export default function Rdi() {
</ContentsDiv> </ContentsDiv>
</MainDiv> </MainDiv>
); );
} }
@@ -8,7 +8,7 @@
import { roundNumber } from "@/app/components/common/DataForm"; import { roundNumber } from "@/app/components/common/DataForm";
import { useFoStore } from "@/app/store"; import { useFoStore } from "@/app/store";
import type { modalTableType } from "@/app/store/sewageOccur"; import type { modalTableType } from "@/app/store/sewageOccur";
import { DateMonthPicker, downloadExcel, UiTable } from "@common/business_components/ui"; import { DateMonthPicker, downloadExcelHeaders, UiTable } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div"; import ListDiv from "@common/business_components/ui/list_div";
import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui"; import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@@ -69,20 +69,25 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd
} }
}, [endYearMonth, startYearMonth]); }, [endYearMonth, startYearMonth]);
const excelDownload = () => { const excelDownload = () => {
// 헤더 순서를 명시적으로 정의
const headers = ["날짜", "물사용량(m³/일)", "오수전환율(%)", "오수발생량 추정(m³/일)"] as const;
const excelDownList: any[] = []; const excelDownList: any[] = [];
if(detailList.length > 0){ if(detailList.length > 0){
detailList.forEach((item) => { detailList.forEach((item) => {
excelDownList.push({ // 순서를 보장하기 위해 헤더 순서대로 객체 생성
"날짜": item.msrDt, const row: Record<string, string | number> = {};
"물사용량(m³/일)": roundNumber(item.waterUsage, 0), row[headers[0]] = item.msrDt;
"오수전환율(%)": roundNumber(item.swageChangePercent, 0), row[headers[1]] = roundNumber(item.waterUsage, 0);
"오수발생량 추정(m³/일)": roundNumber(item.estimationSewage, 0), row[headers[2]] = roundNumber(item.swageChangePercent, 0);
}); row[headers[3]] = roundNumber(item.estimationSewage, 0);
excelDownList.push(row);
}); });
} }
if (excelDownList && excelDownList.length > 0) { if (excelDownList && excelDownList.length > 0) {
downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 오수발생량 추정', sheetNameArray: [props.fcltyName + ' 오수발생량 추정'], headerRange: 'A1:D1' }); downloadExcelHeaders({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 오수발생량 추정'
, sheetNameArray: [props.fcltyName + ' 오수발생량 추정'], headerRange: 'A1:D1', headers });
} else if (detailList.length == 0) { } else if (detailList.length == 0) {
alert('다운받을 데이터가 없습니다.'); alert('다운받을 데이터가 없습니다.');
} }
@@ -6,13 +6,13 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import { type TableUpperProps } from "@/app/store/common"; import { type TableUpperProps } from "@/app/store/common";
import type { SewageOccurProps } from "@/app/store/sewageOccur"; import type { SewageOccurProps } from "@/app/store/sewageOccur";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, 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 LoadingOverlay from "@common/business_components/ui/loadingBar"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useContext, useEffect, useRef, useState } from "react";
import SewageOccurModal from "./modal/page"; import SewageOccurModal from "./modal/page";
export default function PlanSewage() { export default function PlanSewage() {
@@ -29,6 +29,11 @@ export default function PlanSewage() {
searchSewageOccurList: () => {}, searchSewageOccurList: () => {},
calculateModalDataForAllFacilities: async () => [] calculateModalDataForAllFacilities: async () => []
}; };
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
@@ -44,6 +49,11 @@ export default function PlanSewage() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
labelArray, labelArray,
} = SewageOccurSearch; } = SewageOccurSearch;
@@ -54,7 +64,6 @@ export default function PlanSewage() {
upHeadList3, upHeadList3,
sewageOccurList, sewageOccurList,
sewageOccurCount, sewageOccurCount,
excelList,
isLoading, isLoading,
} = SewageOccur; } = SewageOccur;
@@ -93,10 +102,9 @@ 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>(defaultSearchYear);
// 엑셀다운로드 트리거 // 엑셀 조회 중 상태
const [isInitExcelDownload, setIsInitExcelDownload] = useState<boolean>(false); const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
/** /**
* 페이지 함수 * 페이지 함수
*/ */
@@ -107,7 +115,7 @@ export default function PlanSewage() {
// 상태값 설정 // 상태값 설정
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
setSearchYear(selectSearchYear[0]?.val || "0"); setSearchYear(defaultSearchYear);
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -116,7 +124,7 @@ export default function PlanSewage() {
input.value = ""; input.value = "";
} }
} }
searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0"); searchSewageOccurList(1, 10, defaultSearchYear);
} }
// 모달 닫기 // 모달 닫기
@@ -139,32 +147,15 @@ export default function PlanSewage() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchSewageOccurList(1, 10, selectSearchYear[0]?.val || "0"); searchSewageOccurList(1, 10, defaultSearchYear);
} }
}, [isInit, initializeCommonData, searchSewageOccurList, selectSearchYear]); }, [isInit, initializeCommonData, searchSewageOccurList, defaultSearchYear]);
useEffect(() => {
if(!isInitExcelDownload) return ;
const timer = setTimeout(() => {
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
fileName: '오수발생량 추정',
sheetNameArray: ['오수발생량 추정'],
headerRange: 'A1:O1'
});
}
}, 500); // 약간의 지연을 두고 다운로드 실행
return () => clearTimeout(timer);
}, [excelList, isInit, isInitExcelDownload]);
/** /**
* 콜백함수 * 콜백함수
*/ */
// 조회 // 조회
const searchFacilityPrecipitation = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { const searchFacilityPrecipitation = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
let nameCd, partStr let nameCd, partStr
switch (partValue) { switch (partValue) {
case 'R': case 'R':
@@ -182,9 +173,10 @@ export default function PlanSewage() {
break; break;
} }
if (partStr.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) { if (partStr.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchSewageOccurList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchSewageOccurList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue
, fcltyName.trim() !== ""? fcltyName : undefined);
} else { } else {
searchSewageOccurList(pageNo, pageCnt, searchYear); await searchSewageOccurList(pageNo, pageCnt, searchYear);
} }
}, [fcltCpct, operationValue, fcltyName, searchSewageOccurList, searchYear]); }, [fcltCpct, operationValue, fcltyName, searchSewageOccurList, searchYear]);
@@ -195,10 +187,68 @@ export default function PlanSewage() {
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
// 엑셀다운로드 // 엑셀다운로드
const excelDownload = useCallback(() => { const excelDownload = useCallback(async () => {
searchFacilityPrecipitation(ref.current, 1, 5000); if (isExcelDownClick) return;
setIsInitExcelDownload(true); if (ref.current.partValue === 'A') { //
}, [searchFacilityPrecipitation]); if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
setIsExcelDownClick(true);
try {
await searchFacilityPrecipitation(ref.current, 1, 5000);
const latestExcelList = store.getState().SewageOccur.excelList || [];
if (latestExcelList.length > 0) {
const toNumber = (value: unknown) => {
if (value === null || value === undefined || value === '') return '';
const parsed = typeof value === "number" ? value : Number(String(value).replace(/,/g, ""));
return Number.isFinite(parsed) ? parsed : '';
};
const numericKeys = [
"시설용량(m³/일)",
"물사용량(m³/일)",
"오수전환율(%)",
"오수발생량추정(m³/일)",
"연간하수유입량(m³/일)",
"청천시하수유입량(m³/일)",
];
const excelData = latestExcelList.map((row) => {
const nextRow = { ...row } as Record<string, unknown>;
numericKeys.forEach((key) => {
if (key in nextRow) {
nextRow[key] = toNumber(nextRow[key]);
}
});
return nextRow;
});
downloadExcelFormat({
data: excelData as unknown as JSON[],
fileName: '오수발생량 추정',
sheetNameArray: ['오수발생량 추정'],
headerRange: 'A1:O1',
decimalArray0: [9, 10, 11, 12, 13, 14]
});
} else {
alert("조회된 결과가 없습니다.");
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchFacilityPrecipitation]);
// 페이지 변경 // 페이지 변경
const handlePageChange = useCallback((page: number) => { const handlePageChange = useCallback((page: number) => {
@@ -230,6 +280,7 @@ export default function PlanSewage() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} ref={ref}
isAdmin={false} isAdmin={false}
@@ -250,7 +301,7 @@ export default function PlanSewage() {
facilityCd={fcltyCd} facilityCd={fcltyCd}
searchYear={searchYear} searchYear={searchYear}
/>} />}
bodyClass="sm:max-w-[90vw] w-[1000px] h-[770px]" bodyClass="sm:max-w-[90vw] w-[1000px] h-[100dvh] max-h-[770px]"
open={selectedRow !== null} open={selectedRow !== null}
onOpenChange={(open) => !open && closeModal()} onOpenChange={(open) => !open && closeModal()}
noHeaderYn="Y" noHeaderYn="Y"
@@ -29,7 +29,7 @@ const tabList1 = [
export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYear=new Date().getFullYear().toString()} : ModalProps) { export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYear=new Date().getFullYear().toString()} : ModalProps) {
// 그리드 관련 // 그리드 관련
const {Common, UnderWaterDetail, unserWaterModal} = useFoStore((state) => state); const {Common, UnderWaterDetail, underWaterModal} = useFoStore((state) => state);
const { btnClass } = Common; const { btnClass } = Common;
const [startYmDate, setStartYmDate] = useState<string>(searchYear+'01'); const [startYmDate, setStartYmDate] = useState<string>(searchYear+'01');
const [endYmDate, setEndYmDate] = useState<string>(searchYear+'12'); const [endYmDate, setEndYmDate] = useState<string>(searchYear+'12');
@@ -74,8 +74,8 @@ export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYea
}, [searchYear, tabTerm]); }, [searchYear, tabTerm]);
useEffect(()=>{ useEffect(()=>{
unserWaterModal(fcltyCd, searchYear, searchYear+'01', searchYear+'12'); underWaterModal(fcltyCd, searchYear, searchYear+'01', searchYear+'12');
}, [fcltyCd, searchYear, unserWaterModal]); }, [fcltyCd, searchYear, underWaterModal]);
useEffect(() => { useEffect(() => {
if(endYmDate < startYmDate) { if(endYmDate < startYmDate) {
@@ -93,8 +93,8 @@ export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYea
}, [startYmDate, endYmDate, gridListUnderWaterDetail, prevStartYmDate, prevEndYmDate]); }, [startYmDate, endYmDate, gridListUnderWaterDetail, prevStartYmDate, prevEndYmDate]);
useEffect(() => { useEffect(() => {
unserWaterModal(fcltyCd, searchYear, prevStartYmDate, prevEndYmDate); underWaterModal(fcltyCd, searchYear, prevStartYmDate, prevEndYmDate);
} , [fcltyCd, searchYear, unserWaterModal, prevStartYmDate, prevEndYmDate]); } , [fcltyCd, searchYear, underWaterModal, prevStartYmDate, prevEndYmDate]);
const excelDownload = () => { const excelDownload = () => {
const excelDownList: any[] = []; const excelDownList: any[] = [];
@@ -7,11 +7,11 @@
*/ */
"use client" "use client"
import { useFoStore } from "@/app/store"; import { StoreContext, useFoStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/common"; import type { TableUpperProps } from "@/app/store/common";
import { ContentsDiv, downloadExcel, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, UiTable, type ReturnType } from "@common/business_components"; import { ContentsDiv, downloadExcelFormat, MainDiv, SearchBaseForm, SearchInput, SelectBox, Title, UiModal, 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, useContext, 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"; import LoadingOverlay from "@common/business_components/ui/loadingBar";
@@ -35,6 +35,11 @@ export default function UnderWaterInput() {
initializeCommonData: () => {}, initializeCommonData: () => {},
searchUnderWaterList: () => {} searchUnderWaterList: () => {}
}; };
const store = useContext(StoreContext);
if (!store) {
throw new Error("StoreContext is not available. Ensure StoreProvider is mounted.");
}
const { const {
isInit, isInit,
@@ -50,6 +55,11 @@ export default function UnderWaterInput() {
btnClass btnClass
} = Common; } = Common;
const defaultSearchYear =
selectSearchYear.find((item) => item.selected)?.val ||
selectSearchYear[0]?.val ||
"0";
const { const {
labelArray, labelArray,
} = UnderWaterSearch; } = UnderWaterSearch;
@@ -60,7 +70,6 @@ export default function UnderWaterInput() {
upHeadList3, upHeadList3,
underWaterList, underWaterList,
underWaterCount, underWaterCount,
excelList,
isLoading, isLoading,
} = UnderWater; } = UnderWater;
@@ -98,9 +107,9 @@ 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>(defaultSearchYear);
// 엑셀다운로드 트리거 // 엑셀다운로드 트리거
const [isMount, setIsMount] = useState<boolean>(false); const [isExcelDownClick, setIsExcelDownClick] = useState<boolean>(false);
/** /**
* 페이지 함수 * 페이지 함수
@@ -112,7 +121,7 @@ export default function UnderWaterInput() {
// 상태값 설정 // 상태값 설정
setFcltCpct(selectUpdownData[0]?.val || "0"); setFcltCpct(selectUpdownData[0]?.val || "0");
setOperationValue(selectOperationData[0]?.val || "0"); setOperationValue(selectOperationData[0]?.val || "0");
setSearchYear(selectSearchYear[0]?.val || "0"); setSearchYear(defaultSearchYear);
// SearchInputSelect 초기화 // SearchInputSelect 초기화
setFcltyName(""); setFcltyName("");
if (searchInputRef.current) { if (searchInputRef.current) {
@@ -121,7 +130,7 @@ export default function UnderWaterInput() {
input.value = ""; input.value = "";
} }
} }
searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0"); searchUnderWaterList(1, 10, defaultSearchYear);
} }
// 모달 닫기 // 모달 닫기
@@ -144,31 +153,15 @@ export default function UnderWaterInput() {
useEffect(() => { useEffect(() => {
if (!isInit) { if (!isInit) {
initializeCommonData(); initializeCommonData();
searchUnderWaterList(1, 10, selectSearchYear[0]?.val || "0"); searchUnderWaterList(1, 10, defaultSearchYear);
} }
}, [isInit, initializeCommonData, searchUnderWaterList, selectSearchYear]); }, [isInit, initializeCommonData, searchUnderWaterList, defaultSearchYear]);
useEffect(() => {
if(!isMount) return ;
const timer = setTimeout(() => {
if (excelList && excelList.length > 0) {
downloadExcel({
data: excelList as unknown as JSON[],
fileName: '지하수유입량 추정',
sheetNameArray: ['지하수유입량 추정'],
headerRange: 'A1:O1'
});
}
}, 1000); // 약간의 지연을 두고 다운로드 실행
return () => clearTimeout(timer);
}, [excelList, isMount]);
/** /**
* 콜백함수 * 콜백함수
*/ */
// 조회 // 조회
const searchFacilityPrecipitation = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { const searchFacilityPrecipitation = useCallback(async ({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => {
let nameCd, partStr let nameCd, partStr
switch (partValue) { switch (partValue) {
case 'R': case 'R':
@@ -186,9 +179,10 @@ export default function UnderWaterInput() {
break; break;
} }
if (partStr.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) { if (partStr.length > 1 || fcltCpct !== '0' || operationValue!== '0' ||nameCd ||(fcltyName.trim() !== "" && fcltyName.trim() !== null)) {
searchUnderWaterList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue, fcltyName.trim() !== "" || fcltyName.trim() !== null ? fcltyName : undefined); await searchUnderWaterList(pageNo, pageCnt, searchYear, partStr, nameCd || '0', fcltCpct, operationValue
, fcltyName.trim() !== ""? fcltyName : undefined);
} else { } else {
searchUnderWaterList(pageNo, pageCnt, searchYear); await searchUnderWaterList(pageNo, pageCnt, searchYear);
} }
}, [fcltCpct, operationValue, fcltyName, searchUnderWaterList, searchYear]); }, [fcltCpct, operationValue, fcltyName, searchUnderWaterList, searchYear]);
@@ -199,10 +193,67 @@ export default function UnderWaterInput() {
}, [upHeadList1, upHeadList2, upHeadList3]); }, [upHeadList1, upHeadList2, upHeadList3]);
// 엑셀다운로드 // 엑셀다운로드
const excelDownload = useCallback(() => { const excelDownload = useCallback(async () => {
searchFacilityPrecipitation(ref.current, 1, 5000); if (isExcelDownClick) return;
setIsMount(true); if (ref.current.partValue === 'A') { //
}, [searchFacilityPrecipitation]); if (!ref.current.sidoValue || ref.current.sidoValue === '0') {
alert('엑셀 다운로드는 시도 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'R') { // 유역별
if (!ref.current.regionValue || ref.current.regionValue === '0') {
alert('엑셀 다운로드는 유역 조건을 선택한 후 이용 가능합니다.');
return;
}
} else if (ref.current.partValue === 'G') { // 환경청별
if (!ref.current.envPartValue || ref.current.envPartValue === '0') {
alert('엑셀 다운로드는 환경청 조건을 선택한 후 이용 가능합니다.');
return;
}
}
setIsExcelDownClick(true);
try {
await searchFacilityPrecipitation(ref.current, 1, 5000);
const latestExcelList = store.getState().UnderWater.excelList || [];
if (latestExcelList.length > 0) {
const toNumber = (value: unknown) => {
if (value === null || value === undefined || value === '') return '';
const parsed = typeof value === "number" ? value : Number(String(value).replace(/,/g, ""));
return Number.isFinite(parsed) ? parsed : '';
};
const numericKeys = [
"시설용량(m³/일)",
"평균유입하수량(m³/일)",
"연간지하수유입량(m³/일)",
"하절기지하수유입량(m³/일)",
"동절기지하수유입량(m³/일)",
];
const excelData = latestExcelList.map((row) => {
const nextRow = { ...row } as Record<string, unknown>;
numericKeys.forEach((key) => {
if (key in nextRow) {
nextRow[key] = toNumber(nextRow[key]);
}
});
return nextRow;
});
downloadExcelFormat({
data: excelData as unknown as JSON[],
fileName: '지하수유입량 추정',
sheetNameArray: ['지하수유입량 추정'],
headerRange: 'A1:O1',
decimalArray0: [9, 10, 11, 12, 13]
});
} else {
alert("조회된 결과가 없습니다.");
}
} finally {
setIsExcelDownClick(false);
}
}, [isExcelDownClick, searchFacilityPrecipitation, store]);
// 페이지 변경 // 페이지 변경
const handlePageChange = useCallback((page: number) => { const handlePageChange = useCallback((page: number) => {
@@ -234,6 +285,7 @@ export default function UnderWaterInput() {
btnClass={btnClass} btnClass={btnClass}
queryClick={chkVal} queryClick={chkVal}
excelClick={excelDownload} excelClick={excelDownload}
excelDisabled={isExcelDownClick}
initClick={resetVal} initClick={resetVal}
ref={ref} ref={ref}
isAdmin={false} isAdmin={false}
@@ -251,7 +303,7 @@ export default function UnderWaterInput() {
{selectedRow !== null && ( {selectedRow !== null && (
<UiModal <UiModal
body={<UnderWaterInputModal fcltyCd={fcltyCd} fcltyName={fcltyNm} searchYear={searchYear}></UnderWaterInputModal>} body={<UnderWaterInputModal fcltyCd={fcltyCd} fcltyName={fcltyNm} searchYear={searchYear}></UnderWaterInputModal>}
bodyClass="sm:max-w-[90vw] w-[1000px] h-[770px]" bodyClass="sm:max-w-[90vw] w-[1000px] h-[100dvh] max-h-[770px]"
open={selectedRow !== null} open={selectedRow !== null}
onOpenChange={(open) => !open && closeModal()} onOpenChange={(open) => !open && closeModal()}
noHeaderYn="Y" noHeaderYn="Y"
@@ -260,4 +312,4 @@ export default function UnderWaterInput() {
)} )}
</MainDiv> </MainDiv>
); );
} }
+15 -15
View File
@@ -12,6 +12,8 @@ import { getFetch, getFetchAreaList } from "@/app/components/api";
export type SelectDataType = { export type SelectDataType = {
text: string; text: string;
val: string; val: string;
selected?: boolean;
hidden?: boolean;
} }
// grid header // grid header
export type TableUpperProps = { export type TableUpperProps = {
@@ -161,22 +163,20 @@ const getYearData = () => {
const today = new Date(); const today = new Date();
const year = today.getFullYear(); const year = today.getFullYear();
const month = today.getMonth() + 1; const month = today.getMonth() + 1;
// 상반기(6월까지)는 2년 전, 하반기는 1년 전부터 시작 // 상반기(6월까지)는 2년 전, 하반기는 1년 전부터 시작
const startYear = month <= 6 ? (year - 2) : (year - 1); const defaultIdx = month <= 6 ? 2 : 1;
const startYear = year;
const year1 = startYear; // 최근 10개년도 제공 (기본값: 첫 번째 항목 선택)
const year2 = startYear - 1; return Array.from({ length: 10 }, (_, index) => {
const year3 = startYear - 2; const targetYear = startYear - index;
const year4 = startYear - 3; return {
const year5 = startYear - 4; text: `${targetYear}년`,
return [ val: targetYear.toString(),
{ text: year1 + "년", val: year1.toString() }, selected: index === defaultIdx,
{ text: year2 + "년", val: year2.toString() }, };
{ text: year3 + "년", val: year3.toString() }, });
{ text: year4 + "년", val: year4.toString() },
{ text: year5 + "년", val: year5.toString() },
]
} }
const selectSearchYear: SelectDataType[] = getYearData(); const selectSearchYear: SelectDataType[] = getYearData();
@@ -486,4 +486,4 @@ export const CommonReducer = (
} }
} }
export type CommonStore = CommonType & CommonAction; export type CommonStore = CommonType & CommonAction;
File diff suppressed because it is too large Load Diff
@@ -153,7 +153,9 @@ export const fetchFacilityRainDetailList = async (searchYear: string|undefined,
} }
}; };
const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string
, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ; const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ;
const url = '/fclt/rain' + tailStr; const url = '/fclt/rain' + tailStr;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
+213 -202
View File
@@ -2,7 +2,7 @@
import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import DataForm, { roundNumber } from "@/app/components/common/DataForm";
import type { TableUpperProps } from "../dashboard"; import type { TableUpperProps } from "../dashboard";
import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import CalcRainEffect from "@/app/components/common/CalcRainEffect";
import { COD_YEAR } from "../common"; import { COD_YEAR } from "../common"; // 2021년
import CommaToNumber from "@/app/components/common/CommaToNumber"; import CommaToNumber from "@/app/components/common/CommaToNumber";
export type { TableUpperProps }; export type { TableUpperProps };
@@ -28,17 +28,19 @@ export interface FacilityRdiiDetailProps {
export interface FacilityWaterQltyProps { export interface FacilityWaterQltyProps {
bscFctCd: string, bscFctCd: string,
bscFctNm: string, bscFctNm: string,
msrDt: string msrDt: string,
sidoNm: string, sido: string,
sggNm: string, gugun: string,
// sidoNm: string,
// sggNm: string,
addr: string, addr: string,
fctCpc: number, fctCpc: number,
inflAssctBfrWqltBod: string | '', inflAssctBfrWqltBod: string | '',
inflAssctAftWqltBod: string | '', inflAssctAftWqltBod: string | '',
inflAssctBfrWqltToc: string | '', inflAssctBfrWqltToc: string | '',
inflAssctAftWqltToc: string | '', inflAssctAftWqltToc: string | '',
inflAssctBfrWqltCod : string | '', inflAssctBfrWqltCod: string | '',
inflAssctAftWqltCod : string | '', inflAssctAftWqltCod: string | '',
inflAssctBfrWqltSs: string | '', inflAssctBfrWqltSs: string | '',
inflAssctAftWqltSs: string | '', inflAssctAftWqltSs: string | '',
inflAssctBfrWqltTn: string | '', inflAssctBfrWqltTn: string | '',
@@ -47,14 +49,14 @@ export interface FacilityWaterQltyProps {
inflAssctAftWqltTp: string | '', inflAssctAftWqltTp: string | '',
efflWqltBod: string | '', efflWqltBod: string | '',
efflWqltToc: string | '', efflWqltToc: string | '',
efflWqltCod : string | '', efflWqltCod: string | '',
efflWqltSs: string | '', efflWqltSs: string | '',
efflWqltTn: string | '', efflWqltTn: string | '',
efflWqltTp: string | '', efflWqltTp: string | '',
rgnNm:string|'', rgnNm: string | '',
rvbsn:string|'', rvbsn: string | '',
lgbsn:string|'', lgbsn: string | '',
mdmbsn:string|'', mdmbsn: string | '',
inflAmnt: number | '', inflAmnt: number | '',
lclgvrnmntNm: string, lclgvrnmntNm: string,
infoRnDay: number | string | '', infoRnDay: number | string | '',
@@ -68,14 +70,14 @@ export interface FacilityWaterQltyProps {
tpInflWqltTp: string | '', tpInflWqltTp: string | '',
tpInflWqltEclgyTox: string | '', tpInflWqltEclgyTox: string | '',
tpInflWqltClfgrpcnt: string | '', tpInflWqltClfgrpcnt: string | '',
noProcessInflAmnt : string | number | '', noProcessInflAmnt: string | number | '',
} }
export interface ExcelType { export interface ExcelType {
시설코드: string, 시설코드: string,
권역:string|'', 권역: string | '',
단위유역:string|'', 단위유역: string | '',
중권역:string|'', 중권역: string | '',
환경청:string|'', 환경청: string | '',
시도: string, 시도: string,
시군구: string, 시군구: string,
시설이름: string, 시설이름: string,
@@ -146,74 +148,74 @@ const mainLabelArray: string[] = ['구분', '시도', '시군구', '용량별',
// 시설수질리스트 헤더(행정별) // 시설수질리스트 헤더(행정별)
const upHeadList1: TableUpperProps[] = [ const upHeadList1: TableUpperProps[] = [
{ id: "C", title: "행정명", colSpan: 2, row:0, widthPercent:10 }, { id: "C", title: "행정명", colSpan: 2, row: 0, widthPercent: 10 },
{ id: "sidoNm", title: "시도", row: 1, widthPercent:5}, { id: "sido", title: "시도", row: 1, widthPercent: 5 },
{ id: "sggNm", title: "시군구", row: 1, widthPercent:5 }, { id: "gugun", title: "시군구", row: 1, widthPercent: 5 },
{ id: "bscFctNm", title: "시설명", rowSpan: 2, row: 0, widthPercent: 10 }, { id: "bscFctNm", title: "시설명", rowSpan: 2, row: 0, widthPercent: 10 },
{ id: "addr", title: "주소", rowSpan: 2, row: 0 }, { id: "addr", title: "주소", rowSpan: 2, row: 0 },
{ id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0, widthPercent:10 }, { id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 2, row: 0, widthPercent: 10 },
{ id: "A", title: "유입", colSpan: 5, row: 0, widthPercent:25 }, { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 25 },
{ id: "B", title: "방류", colSpan: 5, row: 0, widthPercent:25 }, { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 25 },
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent:5 }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent:5 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1, widthPercent:5 }, { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 4, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent:5 }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent:5 }, { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 4, align: "right", row: 1, widthPercent:5 }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 4, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent:5 }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
]; ];
// 시설수질리스트 헤더(권역별) // 시설수질리스트 헤더(권역별)
const upHeadList2: TableUpperProps[] = [ const upHeadList2: TableUpperProps[] = [
{ id: "C", title: "유역", colSpan: 3, row: 0, widthPercent:15 }, { id: "C", title: "유역", colSpan: 3, row: 0, widthPercent: 15 },
{ id: "rvbsn", title: "권역", upName: "upChangeRe1", upSequnce: 1, row:1, widthPercent:5 }, { id: "rvbsn", title: "권역", upName: "upChangeRe1", upSequnce: 1, row: 1, widthPercent: 5 },
{ id: "lgbsn", title: "단위유역", upName: "upChangeRe1", upSequnce: 2, row:1, widthPercent:5 }, { id: "lgbsn", title: "단위유역", upName: "upChangeRe1", upSequnce: 2, row: 1, widthPercent: 5 },
{ id: "mdmbsn", title: "중권역", upName: "upChangeRe1", upSequnce: 3, row:1, widthPercent:5 }, { id: "mdmbsn", title: "중권역", upName: "upChangeRe1", upSequnce: 3, row: 1, widthPercent: 5 },
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent:10 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "addr", title: "주소", row:0, rowSpan:2 }, { id: "addr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2, widthPercent:8 }, { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "A", title: "유입", colSpan: 5, row: 0, widthPercent:25 }, { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 25 },
{ id: "B", title: "방류", colSpan: 5, row: 0, widthPercent:25 }, { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 25 },
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1, widthPercent:5 }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent:5 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent:5 }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent:5 }, { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 5 },
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent:5 }, { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1, widthPercent:5 }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent:5 }, { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent:5 }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent:5 }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 5 },
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent:5 }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 5 },
]; ];
// 시설수질리스트 헤더(환경청별) // 시설수질리스트 헤더(환경청별)
const upHeadList3: TableUpperProps[] = [ const upHeadList3: TableUpperProps[] = [
{ id: "C", title: "유역", colSpan: 3, row: 0, widthPercent: 15 }, { id: "C", title: "유역", colSpan: 3, row: 0, widthPercent: 15 },
{ id: "rvbsn", title: "권역", row:1, widthPercent: 5 }, { id: "rvbsn", title: "권역", row: 1, widthPercent: 5 },
{ id: "lgbsn", title: "단위유역", row:1, widthPercent: 5 }, { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 5 },
{ id: "mdmbsn", title: "중권역", row:1, widthPercent: 5 }, { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 5 },
{ id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 7 }, { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "D", title: "행정명", colSpan: 2, row: 0, widthPercent: 10 }, { id: "D", title: "행정명", colSpan: 2, row: 0, widthPercent: 10 },
{ id: "sidoNm", title: "시도", upName: "upChangeRe2", row:1, widthPercent: 5 }, { id: "sido", title: "시도", upName: "upChangeRe2", row: 1, widthPercent: 5 },
{ id: "sggNm", title: "시군구", upName: "upChangeRe2", row:1, widthPercent: 5 }, { id: "gugun", title: "시군구", upName: "upChangeRe2", row: 1, widthPercent: 5 },
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "addr", title: "주소", row:0, rowSpan:2 }, { id: "addr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량(m³/L)", align: "right", row:0, rowSpan:2, widthPercent: 5 }, { id: "fctCpc", title: "시설용량(m³/L)", align: "right", row: 0, rowSpan: 2, widthPercent: 5 },
{ id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 20 }, { id: "A", title: "유입", colSpan: 5, row: 0, widthPercent: 20 },
{ id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 20 }, { id: "B", title: "방류", colSpan: 5, row: 0, widthPercent: 20 },
{ id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row:1, widthPercent: 4 }, { id: "inflAssctBfrWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe3", upSequnce: 1, align: "right", row: 1, widthPercent: 4 },
{ id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, { id: "inflAssctBfrWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 4 },
{ id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, { id: "inflAssctBfrWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 4 },
{ id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, { id: "inflAssctBfrWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe3", upSequnce: 2, align: "right", row: 1, widthPercent: 4 },
{ id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, { id: "inflAssctBfrWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe3", upSequnce: 3, align: "right", row: 1, widthPercent: 4 },
{ id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row:1, widthPercent: 4 }, { id: "efflWqltBod", title: "BOD\n(mg/L)", upName: "upChangeRe4", upSequnce: 1, align: "right", row: 1, widthPercent: 4 },
{ id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, { id: "efflWqltToc", title: "TOC\n(COD)\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 4 },
{ id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 4 },
{ id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row:1, widthPercent: 4 }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe4", upSequnce: 2, align: "right", row: 1, widthPercent: 4 },
{ id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row:1, widthPercent: 4 }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe4", upSequnce: 3, align: "right", row: 1, widthPercent: 4 },
]; ];
/** /**
@@ -282,20 +284,24 @@ const upHeadListModalChongIn: TableUpperProps[] = [
====================================*/ ====================================*/
// 메인페이지 // 메인페이지
// 시설정보 수질 리스트 데이터 호출 // 시설정보 수질 리스트 데이터 호출
const fetchFacilityWaterQltyList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string|undefined, nameCd?: string|undefined, fcltCpct?: string|undefined, operationValue?: string|undefined, fcltyNm?: string | undefined): Promise<{ data: FacilityWaterQltyProps[], count: number }> => { const fetchFacilityWaterQltyList = async (
pageNo: number, pageSize: number, searchYear: string, partCd?: string | undefined
, nameCd?: string | undefined, fcltCpct?: string | undefined
, operationValue?: string | undefined, fcltyNm?: string | undefined
): Promise<{ data: FacilityWaterQltyProps[], count: number, status: number }> => {
try { try {
const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const tailStr = partCd ? '/' + partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/fclt/qlty/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; const url = '/fclt/qlty/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
return { data: res.data, count: res.count } return { data: res.data, count: res.count, status: res.status };
} catch (error) { } catch (error) {
console.error('시설정보 수질현황 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 수질현황 데이터를 가져오는데 실패했습니다:', error);
return { data: [], count: 0 }; return { data: [], count: 0, status: 300 };
} }
} }
// 시설정보 수질 리스트 데이터 호출(모달-수질TMS) // 시설정보 수질 리스트 데이터 호출(모달-수질TMS)
const fetchFacilityWaterQltyTmsList = async (facilityCd: string|undefined) => { const fetchFacilityWaterQltyTmsList = async (facilityCd: string | undefined) => {
try { try {
const res = await getFetch('wr', '/il/getTms/' + facilityCd); const res = await getFetch('wr', '/il/getTms/' + facilityCd);
return { data: res.data, count: res.count }; return { data: res.data, count: res.count };
@@ -306,7 +312,7 @@ const fetchFacilityWaterQltyTmsList = async (facilityCd: string|undefined) => {
}; };
// 시설정보 수질 리스트 데이터 호출(모달-이력) // 시설정보 수질 리스트 데이터 호출(모달-이력)
export const fetchFacilityWaterQltyListHist = async (searchYear: string|undefined, facilityCd: string|undefined): Promise<WaterQualityHistoryResponse | null> => { export const fetchFacilityWaterQltyListHist = async (searchYear: string | undefined, facilityCd: string | undefined): Promise<WaterQualityHistoryResponse | null> => {
try {// try {//
const res = await getFetch('fo', '/fclt/qlty/hist/' + searchYear + '/' + facilityCd); const res = await getFetch('fo', '/fclt/qlty/hist/' + searchYear + '/' + facilityCd);
return res; return res;
@@ -316,9 +322,9 @@ export const fetchFacilityWaterQltyListHist = async (searchYear: string|undefine
} }
}; };
// 시설정보 RDII 상세 [{BOD - inflAssctBfrWqltBod, 유입유량 inflAmnt, 강우량 infoRnDay, 측정일 msrDt}] // 시설정보 RDII 상세 [{BOD - inflAssctBfrWqltBod, 유입유량 inflAmnt, 강우량 infoRnDay, 측정일 msrDt}]
export const fetchFacilityRdiiDetailList = async (searchYear: string|undefined, swtrmtFcltCdList: string[]): Promise<FacilityRdiiDetailProps | null> => { export const fetchFacilityRdiiDetailList = async (searchYear: string | undefined, swtrmtFcltCdList: string[]): Promise<FacilityRdiiDetailProps | null> => {
try { try {
const res = await postFetch('fo', '/rdii/detail/'+searchYear, swtrmtFcltCdList); const res = await postFetch('fo', '/rdii/detail/' + searchYear, swtrmtFcltCdList);
return res; return res;
} catch (error) { } catch (error) {
console.error('시설정보 RDII 상세 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 RDII 상세 데이터를 가져오는데 실패했습니다:', error);
@@ -345,7 +351,7 @@ export type FacilityWaterQltyType = {
FacilityWaterQltyModal: { FacilityWaterQltyModal: {
// 처리시설 수질현황 // 처리시설 수질현황
upHeadListModalYear: TableUpperProps[]; upHeadListModalYear: TableUpperProps[];
upHeadListModalYearCod : TableUpperProps[]; upHeadListModalYearCod: TableUpperProps[];
facilityWaterQltyYearList: FacilityWaterQltyProps[]; facilityWaterQltyYearList: FacilityWaterQltyProps[];
upHeadListModalTms: TableUpperProps[]; upHeadListModalTms: TableUpperProps[];
facilityWaterQltyTmsList: FacilityWaterQltyTmsProps[]; facilityWaterQltyTmsList: FacilityWaterQltyTmsProps[];
@@ -432,7 +438,8 @@ const dataFormSetting = (item: FacilityWaterQltyProps) => {
export type FacilityWaterQltyStore = FacilityWaterQltyType & FacilityWaterQltyActions; export type FacilityWaterQltyStore = FacilityWaterQltyType & FacilityWaterQltyActions;
export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType) => FacilityWaterQltyType) => void): FacilityWaterQltyActions => { type SetFunc = (fn: (state: FacilityWaterQltyType) => FacilityWaterQltyType) => void;
export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions => {
return { return {
// 메인페이지 // 메인페이지
/** /**
@@ -446,7 +453,9 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
* @param operationValue : 운영상태코드 * @param operationValue : 운영상태코드
* @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) => ({ set((state: FacilityWaterQltyType) => ({
...state, ...state,
FacilityWaterQltyMain: { FacilityWaterQltyMain: {
@@ -454,64 +463,90 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
isLoading: true, isLoading: true,
}, },
})); }));
const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
const rtnData = res.data.map(item => { // const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
//---------
const waterQltyList: any[] = [];
let recordCount = 0;
if (pageSize < 5000) {
const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
waterQltyList.push(...res.data);
recordCount = res.count;
} else {
for (let idx = 0; idx < pageSize; idx += 100) {
const tmpPageNo = Math.floor(idx / 100) + 1;
const tmpPageSize = Math.min(100, pageSize - idx);
const result = await fetchFacilityWaterQltyList(tmpPageNo, tmpPageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
if (result?.status === 200 && Array.isArray(result?.data)) {
waterQltyList.push(...result.data);
}
recordCount = result?.count || 0;
if (result?.count < tmpPageNo * tmpPageSize) {
break; // 더 이상 데이터가 없으면 중지
}
}
}
//-------
// const rtnData = res.data.map(item => {
const rtnData = waterQltyList.map(item => {
dataFormSetting(item) dataFormSetting(item)
if(item.inflAssctBfrWqltTn) { if (item.inflAssctBfrWqltTn) {
item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 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.inflAssctBfrWqltTp){ if (item.inflAssctBfrWqltTp) {
item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 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.inflAssctBfrWqltToc){ if (item.inflAssctBfrWqltToc) {
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 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.inflAssctBfrWqltBod){ if (item.inflAssctBfrWqltBod) {
item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 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.inflAssctBfrWqltSs){ if (item.inflAssctBfrWqltSs) {
item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 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.inflAssctBfrWqltToc){ if (item.inflAssctBfrWqltToc) {
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 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);
} }
return item; return item;
}); });
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
if(pageSize>5000){ if (pageSize > 5000) {
res.data.forEach(item => { // res.data.forEach(item => {
waterQltyList.forEach(item => {
dataFormSetting(item) dataFormSetting(item)
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; // item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; // item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
item.inflAssctBfrWqltToc = Number(searchYear)<COD_YEAR? "("+item.inflAssctBfrWqltToc+")" : item.inflAssctBfrWqltToc; item.inflAssctBfrWqltToc = Number(searchYear) < COD_YEAR ? "(" + item.inflAssctBfrWqltToc + ")" : item.inflAssctBfrWqltToc;
item.efflWqltToc = Number(searchYear)<COD_YEAR? "("+item.efflWqltToc+")" : item.efflWqltToc; item.efflWqltToc = Number(searchYear) < COD_YEAR ? "(" + item.efflWqltToc + ")" : item.efflWqltToc;
excelDownList.push({ excelDownList.push({
시설코드: item.bscFctCd, 시설코드: item.bscFctCd,
권역: item.rvbsn, 권역: item.rvbsn,
단위유역: item.lgbsn, 단위유역: item.lgbsn,
중권역: item.mdmbsn, 중권역: item.mdmbsn,
환경청: item.rgnNm, 환경청: item.rgnNm,
시도: item.sidoNm, 시도: item.sido,
시군구: item.sggNm, 시군구: item.gugun,
시설이름: item.bscFctNm, 시설이름: item.bscFctNm,
주소: item.addr, 주소: item.addr,
"시설용량(m³/일)": CommaToNumber(item.fctCpc), "시설용량(m³/일)": CommaToNumber(item.fctCpc),
@@ -527,27 +562,28 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
"유출TP(mg/L)": CommaToNumber(item.efflWqltTp), "유출TP(mg/L)": CommaToNumber(item.efflWqltTp),
}); });
}); });
}else{ } else {
res.data.forEach((item: FacilityWaterQltyProps) => { // res.data.forEach((item: FacilityWaterQltyProps) => {
waterQltyList.forEach((item: FacilityWaterQltyProps) => {
dataFormSetting(item) dataFormSetting(item)
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; // item.sidoNm = item.;
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; // item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
item.inflAssctBfrWqltToc = Number(searchYear)<COD_YEAR? "("+item.inflAssctBfrWqltToc+")" : item.inflAssctBfrWqltToc; item.inflAssctBfrWqltToc = Number(searchYear) < COD_YEAR ? "(" + item.inflAssctBfrWqltToc + ")" : item.inflAssctBfrWqltToc;
item.efflWqltToc = Number(searchYear)<COD_YEAR? "("+item.efflWqltToc+")" : item.efflWqltToc; item.efflWqltToc = Number(searchYear) < COD_YEAR ? "(" + item.efflWqltToc + ")" : item.efflWqltToc;
}); });
} }
set((state: FacilityWaterQltyType) => ({ set((state: FacilityWaterQltyType) => ({
...state, ...state,
FacilityWaterQltyMain: pageSize<5000?{ FacilityWaterQltyMain: pageSize < 5000 ? {
...state.FacilityWaterQltyMain, ...state.FacilityWaterQltyMain,
facilityWaterQltyList: rtnData, facilityWaterQltyList: rtnData,
facilityWaterQltyCount: res.count, facilityWaterQltyCount: recordCount,
isLoading : false, isLoading: false,
}:{ } : {
...state.FacilityWaterQltyMain, ...state.FacilityWaterQltyMain,
excelList: excelDownList, excelList: excelDownList,
isLoading : false, isLoading: false,
}, },
})) }))
}, },
@@ -555,10 +591,10 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
searchFacilityWaterQltyListHist: async (searchYear: string, facilityCd: string) => { searchFacilityWaterQltyListHist: async (searchYear: string, facilityCd: string) => {
const res = await fetchFacilityWaterQltyListHist(searchYear, facilityCd); const res = await fetchFacilityWaterQltyListHist(searchYear, facilityCd);
const res1 = await fetchFacilityWaterQltyTmsList(facilityCd); const res1 = await fetchFacilityWaterQltyTmsList(facilityCd);
let rtnMsrmtDate = ''; let rtnMsrmtDate = '';
const rtnTmsList: FacilityWaterQltyTmsProps[] = []; const rtnTmsList: FacilityWaterQltyTmsProps[] = [];
if(res1.data){ if (res1.data) {
rtnTmsList.push({ rtnTmsList.push({
part: '평균', part: '평균',
toc: res1.data.tocAvgVl, toc: res1.data.tocAvgVl,
@@ -566,7 +602,6 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
tn: res1.data.tnAvgVl, tn: res1.data.tnAvgVl,
tp: res1.data.tpAvgVl, tp: res1.data.tpAvgVl,
}); });
rtnTmsList.push({ rtnTmsList.push({
part: '최대', part: '최대',
toc: res1.data.tocMaxVl, toc: res1.data.tocMaxVl,
@@ -574,7 +609,6 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
tn: res1.data.tnMaxVl, tn: res1.data.tnMaxVl,
tp: res1.data.tpMaxVl, tp: res1.data.tpMaxVl,
}); });
rtnTmsList.push({ rtnTmsList.push({
part: '최소', part: '최소',
toc: res1.data.tocMinVl, toc: res1.data.tocMinVl,
@@ -584,42 +618,21 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
}); });
rtnMsrmtDate = res1.data.msrmtDate; rtnMsrmtDate = res1.data.msrmtDate;
}else{ } else {
rtnTmsList.push({ rtnTmsList.push({ part: '평균', toc: 0, ss: 0, tn: 0, tp: 0, });
part: '평균', rtnTmsList.push({ part: '최대', toc: 0, ss: 0, tn: 0, tp: 0, });
toc: 0, rtnTmsList.push({ part: '최소', toc: 0, ss: 0, tn: 0, tp: 0, });
ss: 0,
tn: 0,
tp: 0,
});
rtnTmsList.push({
part: '최대',
toc: 0,
ss: 0,
tn: 0,
tp: 0,
});
rtnTmsList.push({
part: '최소',
toc: 0,
ss: 0,
tn: 0,
tp: 0,
});
rtnMsrmtDate = ''; rtnMsrmtDate = '';
} }
if(Array.isArray(res) || !res || !('data' in res) || !res.data || !res.data.wqltObjs || res.data.wqltObjs.length === 0) { if (Array.isArray(res) || !res || !('data' in res) || !res.data || !res.data.wqltObjs || res.data.wqltObjs.length === 0) {
set((state: FacilityWaterQltyType) => ({ set((state: FacilityWaterQltyType) => ({
...state, ...state,
FacilityWaterQltyModal: { FacilityWaterQltyModal: {
...state.FacilityWaterQltyModal, ...state.FacilityWaterQltyModal,
facilityWaterQltyYearList: [], facilityWaterQltyYearList: [],
tmsList : rtnTmsList, tmsList: rtnTmsList,
msrmtDate : rtnMsrmtDate msrmtDate: rtnMsrmtDate
} }
})) }))
return; return;
@@ -627,19 +640,17 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
// facilityPrecipitation의 rainEffectDay 계산 로직을 적용 // facilityPrecipitation의 rainEffectDay 계산 로직을 적용
const data = CalcRainEffect(res.data.wqltObjs); const data = CalcRainEffect(res.data.wqltObjs);
/** /**
* [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​ * [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​
/강우시 일별유입BOD) /강우시 일별유입BOD)
*/ */
//let rainInflAmnt = 0;
let sunnyInflAmnt = 0; let sunnyInflAmnt = 0;
let sunnyBod = 0; let sunnyBod = 0;
//let rainDay = 0;
let sunnyDay = 0; let sunnyDay = 0;
data.forEach(item => { data.forEach(item => {
if(item.rainEffectDay == 1){ if (item.rainEffectDay == 1) {
//rainDay += 1; //rainDay += 1;
//rainInflAmnt += Number(item.inflAmnt); //rainInflAmnt += Number(item.inflAmnt);
} else { } else {
@@ -650,69 +661,69 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
}); });
//const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay; //const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay;
const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay; const yearSunnyAmnt = sunnyInflAmnt === 0 ? 0 : sunnyInflAmnt / sunnyDay;
const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay; const yearSunnyBod = sunnyBod === 0 ? 0 : sunnyBod / sunnyDay;
// //
const rtnData = data.map((item: FacilityWaterQltyProps) => { const rtnData = data.map((item: FacilityWaterQltyProps) => {
dataFormSetting(item) dataFormSetting(item)
if(item.inflAssctBfrWqltTn) { if (item.inflAssctBfrWqltTn) {
item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 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.inflAssctBfrWqltTp){ if (item.inflAssctBfrWqltTp) {
item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 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.inflAssctBfrWqltToc){ if (item.inflAssctBfrWqltToc) {
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 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.inflAssctBfrWqltCod){ if (item.inflAssctBfrWqltCod) {
item.inflAssctBfrWqltCod = "("+Number(Math.round(Number(item.inflAssctBfrWqltCod) * 10)/10).toFixed(1)+")"; item.inflAssctBfrWqltCod = "(" + Number(Math.round(Number(item.inflAssctBfrWqltCod) * 10) / 10).toFixed(1) + ")";
} }
if(item.efflWqltCod){ if (item.efflWqltCod) {
item.efflWqltCod = "("+Number(Math.round(Number(item.efflWqltCod) * 10)/10).toFixed(1)+")"; item.efflWqltCod = "(" + Number(Math.round(Number(item.efflWqltCod) * 10) / 10).toFixed(1) + ")";
} }
if(item.inflAssctBfrWqltBod){ if (item.inflAssctBfrWqltBod) {
item.inflAssctBfrWqltBod = Number(Math.round(Number(item.inflAssctBfrWqltBod) * 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.inflAssctBfrWqltSs){ if (item.inflAssctBfrWqltSs) {
item.inflAssctBfrWqltSs = Number(Math.round(Number(item.inflAssctBfrWqltSs) * 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.inflAssctBfrWqltToc){ if (item.inflAssctBfrWqltToc) {
item.inflAssctBfrWqltToc = Number(Math.round(Number(item.inflAssctBfrWqltToc) * 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.tpInflWqltBod){ if (item.tpInflWqltBod) { // 총인 유입수질 BOD(mg/L)
item.tpInflWqltBod = item.tpInflWqltBod?Number(Math.round(Number(item.tpInflWqltBod) * 10)/10).toFixed(1):Number(item.tpInflWqltBod)===0?'0.0':''; item.tpInflWqltBod = item.tpInflWqltBod ? Number(Math.round(Number(item.tpInflWqltBod) * 10) / 10).toFixed(1) : Number(item.tpInflWqltBod) === 0 ? '0.0' : '';
}else{ } else {
item.tpInflWqltBod = ''; item.tpInflWqltBod = '';
} }
if(item.tpInflWqltTp){ if (item.tpInflWqltTp) { // 총인 유입수질 TP(mg/L)
item.tpInflWqltTp = item.tpInflWqltTp?Number(Math.round(Number(item.tpInflWqltTp) * 1000)/1000).toFixed(3): Number(item.tpInflWqltTp)===0?'0.000':''; item.tpInflWqltTp = item.tpInflWqltTp ? Number(Math.round(Number(item.tpInflWqltTp) * 1000) / 1000).toFixed(3) : Number(item.tpInflWqltTp) === 0 ? '0.000' : '';
}else{ } else {
item.tpInflWqltTp = ''; item.tpInflWqltTp = '';
} }
const dayBod = Number(item.inflAssctBfrWqltBod); const dayBod = Number(item.inflAssctBfrWqltBod);
const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0) const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0)
item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : ''; item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',', '')) > 0 ? noProcessInflAmnt : '';
return item; return item;
}) })
@@ -721,8 +732,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType
FacilityWaterQltyModal: { FacilityWaterQltyModal: {
...state.FacilityWaterQltyModal, ...state.FacilityWaterQltyModal,
facilityWaterQltyYearList: rtnData, facilityWaterQltyYearList: rtnData,
tmsList : rtnTmsList, tmsList: rtnTmsList,
msrmtDate : rtnMsrmtDate msrmtDate: rtnMsrmtDate
} }
})) }))
}, },
+198 -160
View File
@@ -1,6 +1,6 @@
import { getFetch } from "@/app/components/api"; import { getFetch } from "@/app/components/api";
import type { TableUpperProps } from "../dashboard"; import type { TableUpperProps } from "../dashboard";
import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import DataForm from "@/app/components/common/DataForm";
import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import CalcRainEffect from "@/app/components/common/CalcRainEffect";
import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty"; import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty";
import CommaToNumber from "@/app/components/common/CommaToNumber"; import CommaToNumber from "@/app/components/common/CommaToNumber";
@@ -12,34 +12,34 @@ import CommaToNumber from "@/app/components/common/CommaToNumber";
/** /**
* (1) 메인페이지 * (1) 메인페이지
*/ */
const FlowRateSearchLabelArray:string[] = ['구분', '시도', '시군구', '용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별']; const FlowRateSearchLabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별'];
export type flowRateListProps = { export type flowRateListProps = {
bscFctCd : string, bscFctCd: string,
sido : string, sido: string,
gugun : string, gugun: string,
bscFctNm : string, bscFctNm: string,
daddr : string, daddr: string,
fctCpc : number, fctCpc: number,
lclgvrnmntNm : string, lclgvrnmntNm: string,
totInflAmnt : number | '', totInflAmnt: number | '',
inflAmnt : number | '', inflAmnt: number | '',
sumFlow : number | '', sumFlow: number | '',
returnAmnt : number | '', returnAmnt: number | '',
efflAmnt : number | '', efflAmnt: number | '',
rgnNm : string, rgnNm: string,
rvbsn : string, rvbsn: string,
lgbsn : string, lgbsn: string,
mdmbsn : string, mdmbsn: string,
infoRnDay : number | '', infoRnDay: number | '',
} }
export interface ExcelType { export interface ExcelType {
시설코드: string, 시설코드: string,
권역:string|'', 권역: string | '',
단위유역:string|'', 단위유역: string | '',
중권역:string|'', 중권역: string | '',
환경청:string|'', 환경청: string | '',
시도: string, 시도: string,
시군구: string, 시군구: string,
시설이름: string, 시설이름: string,
@@ -66,105 +66,105 @@ export type modalExcelType = {
* (2) 모달 * (2) 모달
*/ */
export interface FlowRateModalInterface { export interface FlowRateModalInterface {
msrDt : string, msrDt: string,
totInflAmnt : number | '', totInflAmnt: number | '',
inflAmnt : number | '', inflAmnt: number | '',
sumFlow : number | '', sumFlow: number | '',
returnAmnt : number | '', returnAmnt: number | '',
efflAmnt : number | '', efflAmnt: number | '',
infoRnDay : number | string | '', infoRnDay: number | string | '',
rainEffectDay : number | string | '' , rainEffectDay: number | string | '',
noProcessInflAmnt : number | string | '' noProcessInflAmnt: number | string | ''
} }
export type FlowRateModalProps = { export type FlowRateModalProps = {
msrDt : string, msrDt: string,
totInflAmnt : number, totInflAmnt: number,
inflAmnt : number, inflAmnt: number,
sumFlow : number, sumFlow: number,
returnAmnt : number, returnAmnt: number,
efflAmnt : number, efflAmnt: number,
infoRnDay : number | string | '', infoRnDay: number | string | '',
rainEffectDay : number | string | '', rainEffectDay: number | string | '',
noProcessInflAmnt : number | string | '' noProcessInflAmnt: number | string | ''
} }
/**==================================== /**====================================
* Store - data * Store - data
====================================*/ ====================================*/
/** /**
* (1) 메인페이지 * (1) 메인페이지
*/ */
// 리스트 (행정별) // 리스트 (행정별)
const upHeadList1:TableUpperProps[] = [ const upHeadList1: TableUpperProps[] = [
{ id: "A", title: "행정명", row: 0, colSpan: 2, widthPercent: 16 }, { id: "A", title: "행정명", row: 0, colSpan: 2, widthPercent: 16 },
{ id: "sido", title: "시도", upName:"upChangeRe", row:1, widthPercent: 8 }, { id: "sido", title: "시도", upName: "upChangeRe", row: 1, widthPercent: 8 },
{ id: "gugun", title: "시군구", upName:"upChangeRe", row:1, widthPercent: 8 }, { id: "gugun", title: "시군구", upName: "upChangeRe", row: 1, widthPercent: 8 },
{ id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10}, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "daddr", title: "주소", row: 0, rowSpan: 2 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "fctCpc", title: "시설용량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "totInflAmnt", title: "총 유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "totInflAmnt", title: "총 유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "inflAmnt", title: "하수유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "inflAmnt", title: "하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "sumFlow", title: '연계처리량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "sumFlow", title: '연계처리량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "efflAmnt", title: '방류량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 } { id: "efflAmnt", title: '방류량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 }
]; ];
// 리스트 (권역별) // 리스트 (권역별)
const upHeadList2:TableUpperProps[] = [ const upHeadList2: TableUpperProps[] = [
{ id: "A", title: "유역", row: 0, colSpan: 3, widthPercent: 24 }, { id: "A", title: "유역", row: 0, colSpan: 3, widthPercent: 24 },
{ id: "rvbsn", title: "권역", upName:"upChangeRe", row:1, widthPercent: 8 }, { id: "rvbsn", title: "권역", upName: "upChangeRe", row: 1, widthPercent: 8 },
{ id: "lgbsn", title: "단위유역", upName:"upChangeRe", row:1, widthPercent: 8 }, { id: "lgbsn", title: "단위유역", upName: "upChangeRe", row: 1, widthPercent: 8 },
{ id: "mdmbsn", title: "중권역", upName:"upChangeRe", row:1, widthPercent: 8 }, { id: "mdmbsn", title: "중권역", upName: "upChangeRe", row: 1, widthPercent: 8 },
{ id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "daddr", title: "주소", row: 0, rowSpan: 2 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 10 }, { id: "fctCpc", title: "시설용량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "totInflAmnt", title: "총 유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "totInflAmnt", title: "총 유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "inflAmnt", title: "하수유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "inflAmnt", title: "하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "sumFlow", title: '연계처리량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "sumFlow", title: '연계처리량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "efflAmnt", title: '방류량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 } { id: "efflAmnt", title: '방류량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 }
]; ];
// 리스트 (환경청별별) // 리스트 (환경청별별)
const upHeadList3:TableUpperProps[] = [ const upHeadList3: TableUpperProps[] = [
{ id: "A", title: "유역", row: 0, colSpan: 3, widthPercent: 15 }, { id: "A", title: "유역", row: 0, colSpan: 3, widthPercent: 15 },
{ id: "rvbsn", title: "권역", upName:"upChangeRe1", row:1, widthPercent: 5 }, { id: "rvbsn", title: "권역", upName: "upChangeRe1", row: 1, widthPercent: 5 },
{ id: "lgbsn", title: "단위유역", upName:"upChangeRe1", row:1, widthPercent: 5 }, { id: "lgbsn", title: "단위유역", upName: "upChangeRe1", row: 1, widthPercent: 5 },
{ id: "mdmbsn", title: "중권역", upName:"upChangeRe1", row:1, widthPercent: 5 }, { id: "mdmbsn", title: "중권역", upName: "upChangeRe1", row: 1, widthPercent: 5 },
{ id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 7 }, { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "B", title: "행정명", row: 0 ,colSpan: 2, widthPercent: 10 }, { id: "B", title: "행정명", row: 0, colSpan: 2, widthPercent: 10 },
{ id: "sido", title: "시도", upName:"upChangeRe2", row:1, widthPercent: 5 }, { id: "sido", title: "시도", upName: "upChangeRe2", row: 1, widthPercent: 5 },
{ id: "gugun", title: "시군구", upName:"upChangeRe2", row:1, widthPercent: 5 }, { id: "gugun", title: "시군구", upName: "upChangeRe2", row: 1, widthPercent: 5 },
{ id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "daddr", title: "주소", row: 0, rowSpan: 2 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "fctCpc", title: "시설용량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "totInflAmnt", title: "총 유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "totInflAmnt", title: "총 유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "inflAmnt", title: "하수유입량\n(m³/일)", align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "inflAmnt", title: "하수유입량\n(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "sumFlow", title: '연계처리량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "sumFlow", title: '연계처리량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 }, { id: "returnAmnt", title: '총인 반류수량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 },
{ id: "efflAmnt", title: '방류량\n(m³/일)', align:"right", row: 0, rowSpan: 2, widthPercent: 7 } { id: "efflAmnt", title: '방류량\n(m³/일)', align: "right", row: 0, rowSpan: 2, widthPercent: 7 }
]; ];
const flowRateList:flowRateListProps[] = [ const flowRateList: flowRateListProps[] = [
] ]
/** /**
* (2) 모달 * (2) 모달
*/ */
const upHeadListFlowRateModal:TableUpperProps[] = [ const upHeadListFlowRateModal: TableUpperProps[] = [
{ id: "msrDt", title: "날짜"}, { id: "msrDt", title: "날짜" },
{ id: "totInflAmnt", title: "총 유입량(m³/일)", align:"right"}, { id: "totInflAmnt", title: "총 유입량(m³/일)", align: "right" },
{ id: "inflAmnt", title: "하수유입량(m³/일)", align:"right"}, { id: "inflAmnt", title: "하수유입량(m³/일)", align: "right" },
{ id: "sumFlow", title: "연계처리량(m³/일)", align:"right"}, { id: "sumFlow", title: "연계처리량(m³/일)", align: "right" },
{ id: "returnAmnt", title: "총인 반류수량(m³/일)", align:"right"}, { id: "returnAmnt", title: "총인 반류수량(m³/일)", align: "right" },
{ id: "efflAmnt", title: "방류량(m³/일)", align:"right"}, { id: "efflAmnt", title: "방류량(m³/일)", align: "right" },
{ id: "noProcessInflAmnt", title: "미처리하수 추정량(m³/일)", align:"right"}, { id: "noProcessInflAmnt", title: "미처리하수 추정량(m³/일)", align: "right" },
{ id: "infoRnDay", title: "강우량(mm/일)", align:"right"} { id: "infoRnDay", title: "강우량(mm/일)", align: "right" }
] ]
const modalFlowRateListYear:FlowRateModalProps[] = [ const modalFlowRateListYear: FlowRateModalProps[] = [
] ]
/**==================================== /**====================================
@@ -172,13 +172,14 @@ const modalFlowRateListYear:FlowRateModalProps[] = [
====================================*/ ====================================*/
const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
try { try {
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);
return { data: res.data, count: res.count } return { data: res.data, count: res.count, status: res.status}
} catch (error) { } catch (error) {
console.error('시설정보 유량현황 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 유량현황 데이터를 가져오는데 실패했습니다:', error);
return { data: [], count: 0 }; console.log(error);
return { data: [], count: 0, status: 300 };
} }
} }
@@ -186,12 +187,12 @@ export const fetchFlowRateModalList = async (bscFctCd: string, searchYear: strin
try { try {
const url = '/fclt/flow/' + bscFctCd + '/' + searchYear; const url = '/fclt/flow/' + bscFctCd + '/' + searchYear;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
// msrDt 오름차순으로 정렬 // msrDt 오름차순으로 정렬
const sortedData = res.data.sort((a: FlowRateModalInterface, b: FlowRateModalInterface) => { const sortedData = res.data.sort((a: FlowRateModalInterface, b: FlowRateModalInterface) => {
return new Date(a.msrDt).getTime() - new Date(b.msrDt).getTime(); return new Date(a.msrDt).getTime() - new Date(b.msrDt).getTime();
}); });
return { data: sortedData } return { data: sortedData }
} catch (error) { } catch (error) {
console.error('시설정보 유량현황 모달 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 유량현황 모달 데이터를 가져오는데 실패했습니다:', error);
@@ -206,69 +207,69 @@ export const fetchFlowRateModalList = async (bscFctCd: string, searchYear: strin
export type FlowRateSearchActions = { export type FlowRateSearchActions = {
searchFlowRateList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void; searchFlowRateList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void;
searchFlowRateModalList : (bscFctCd: string, searchYear: string) => void; searchFlowRateModalList: (bscFctCd: string, searchYear: string) => void;
} }
export type FlowRateSearchType = { export type FlowRateSearchType = {
FlowRateSearch: { FlowRateSearch: {
isInit: boolean; isInit: boolean;
flowRateSearchLabelArray:string[]; flowRateSearchLabelArray: string[];
}, },
FlowRateList : { FlowRateList: {
isInit : boolean; isInit: boolean;
upHeadList1: TableUpperProps[]; upHeadList1: TableUpperProps[];
upHeadList2: TableUpperProps[]; upHeadList2: TableUpperProps[];
upHeadList3: TableUpperProps[]; upHeadList3: TableUpperProps[];
flowRateList:flowRateListProps[]; flowRateList: flowRateListProps[];
flowRateCount: number; flowRateCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean; isLoading: boolean;
}, },
FlowRateModal : { FlowRateModal: {
isInit : boolean; isInit: boolean;
modalFlowRateListYear : FlowRateModalProps[]; modalFlowRateListYear: FlowRateModalProps[];
upHeadListFlowRateModalYear : TableUpperProps[]; upHeadListFlowRateModalYear: TableUpperProps[];
} }
} }
export type FlowRateSearchStore = FlowRateSearchType & FlowRateSearchActions; export type FlowRateSearchStore = FlowRateSearchType & FlowRateSearchActions;
const dataFormSetting=(item : flowRateListProps | FlowRateModalProps)=> { export const dataFormSetting = (item: flowRateListProps | FlowRateModalProps | FlowRateModalInterface) => {
DataForm({ type: 'date', column: 'msrDt', item: item as unknown as Record<string, unknown> }); DataForm({ type: 'date', column: 'msrDt', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'totInflAmnt', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'totInflAmnt', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'sumFlow', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'sumFlow', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'efflWqltBod', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'efflWqltBod', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'returnAmnt', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'returnAmnt', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'efflAmnt', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'efflAmnt', item: item as unknown as Record<string, unknown> });
} }
export const flowRateSearchInitState:FlowRateSearchType = { export const flowRateSearchInitState: FlowRateSearchType = {
FlowRateSearch: { FlowRateSearch: {
isInit: false, isInit: false,
flowRateSearchLabelArray: FlowRateSearchLabelArray, flowRateSearchLabelArray: FlowRateSearchLabelArray,
}, },
FlowRateList : { FlowRateList: {
isInit : false, isInit: false,
upHeadList1 : upHeadList1, upHeadList1: upHeadList1,
upHeadList2 : upHeadList2, upHeadList2: upHeadList2,
upHeadList3 : upHeadList3, upHeadList3: upHeadList3,
flowRateList : flowRateList, flowRateList: flowRateList,
flowRateCount : 0, flowRateCount: 0,
excelList: [], excelList: [],
isLoading: true, isLoading: true,
}, },
FlowRateModal : { FlowRateModal: {
isInit : false, isInit: false,
upHeadListFlowRateModalYear : upHeadListFlowRateModal, upHeadListFlowRateModalYear: upHeadListFlowRateModal,
modalFlowRateListYear : modalFlowRateListYear, modalFlowRateListYear: modalFlowRateListYear,
} }
} }
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) => ({ set((state: FlowRateSearchType) => ({
@@ -278,17 +279,50 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
isLoading: true, isLoading: true,
}, },
})); }));
const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data; // const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
//---------
const flowRateList: any[] = [];
const results: any[] = [];
if (pageSize < 5000) {
const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
flowRateList.push(...res.data);
results.push(res);
} else {
for (let idx = 0; idx < pageSize; idx += 100) {
const tmpPageNo = Math.floor(idx / 100) + 1;
const tmpPageSize = Math.min(100, pageSize - idx);
const result = await fetchFlowRateList( tmpPageNo, tmpPageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
results.push(result);
if (result?.count < tmpPageNo * tmpPageSize) {
break; // 더 이상 데이터가 없으면 중지
}
}
// console.log(results);
// 결과를 합치기
for (const res of results) {
if (res?.status === 200 && Array.isArray(res?.data)) {
flowRateList.push(...res.data);
}
}
}
//---------
const recordCount = results[0]?.count || 0;
//-------
// const data = res.data;
const data = flowRateList;
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
const rtnData = data.map((item: flowRateListProps) => { const rtnData = data.map((item: flowRateListProps) => {
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
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); // 하수유입량 + 연계처리량 + 반류수유량(m³/일)
dataFormSetting(item); dataFormSetting(item);
return item; return item;
}); });
if(pageSize>5000){ if (pageSize > 5000) {
rtnData.forEach((item: flowRateListProps) => { rtnData.forEach((item: flowRateListProps) => {
excelDownList.push({ excelDownList.push({
시설코드: item.bscFctCd, 시설코드: item.bscFctCd,
@@ -312,15 +346,15 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
set((state: FlowRateSearchType) => ({ set((state: FlowRateSearchType) => ({
...state, ...state,
FlowRateList: pageSize<5000?{ FlowRateList: pageSize < 5000 ? {
...state.FlowRateList, ...state.FlowRateList,
flowRateList: rtnData, flowRateList: rtnData,
flowRateCount: res.count, flowRateCount: recordCount,
isLoading : false, isLoading: false,
}:{ } : {
...state.FlowRateList, ...state.FlowRateList,
excelList: excelDownList, excelList: excelDownList,
isLoading : false, isLoading: false,
}, },
})) }))
}, },
@@ -329,44 +363,48 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow
const inflData = CalcRainEffect(res.data); const inflData = CalcRainEffect(res.data);
const res2 = await fetchFacilityWaterQltyListHist(searchYear, bscFctCd); const res2 = await fetchFacilityWaterQltyListHist(searchYear, bscFctCd);
const wqltData = CalcRainEffect(res2?.data.wqltObjs); const wqltData = res2?.data.wqltObjs;
//const wqltData = CalcRainEffect(res2?.data.wqltObjs);
/** /**
* [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​ * [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)] / 강우시 일별유입BOD
/강우시 일별유입BOD)
*/ */
//let rainInflAmnt = 0; let sunnyInflAmnt = 0; // 청천시 일별유입유량
let sunnyInflAmnt = 0; let sunnyBod = 0; // 청천시 일별유입BOD
let sunnyBod = 0;
//let rainDay = 0;
let sunnyDay = 0; let sunnyDay = 0;
let rainEffectDay = 0;
inflData.forEach(item => { wqltData?.forEach(item => {
if(item.rainEffectDay == 1){ if (item.infoRnDay == null) item.infoRnDay = 0;
//rainDay += 1; if (Number(item.infoRnDay) >= 3) {
//rainInflAmnt += Number(item.inflAmnt); rainEffectDay = 2;
} else { } else {
const msrDt = item.msrDt.replaceAll('-',''); rainEffectDay--;
}
if (rainEffectDay < 0) { //청천시
sunnyDay += 1; sunnyDay += 1;
sunnyInflAmnt += Number(item.inflAmnt); sunnyInflAmnt += Number(item.inflAmnt);
sunnyBod += Number(wqltData.filter((wqitem)=>wqitem.msrDt === msrDt)[0].inflAssctBfrWqltBod); sunnyBod += Number(item.inflAssctBfrWqltBod);
} }
}); });
//const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay; const yearSunnyAmnt = sunnyDay > 0 ? sunnyInflAmnt / sunnyDay : 0; // 청천시 연평균유입유량
const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay; const yearSunnyBod = sunnyDay > 0 ? sunnyBod / sunnyDay : 0; // 청천시 연평균유입BOD
const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay; //console.log(inflData);
const rtnData = inflData.map((item: FlowRateModalProps) => { const rtnData = inflData.map((item: FlowRateModalProps) => {
const dayBod = Number(wqltData.filter(wqitem=>wqitem.msrDt === item.msrDt.replaceAll('-',''))[0].inflAssctBfrWqltBod); const targetWqItem = wqltData?.find(wqitem => wqitem.msrDt === item.msrDt.replaceAll('-', ''));
const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0) const dayBod = targetWqItem ? Number(targetWqItem.inflAssctBfrWqltBod) : 0;
const noProcessInflAmnt = Math.round(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod)
item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0); const totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0);
item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : '';
dataFormSetting(item); return {
return item; ...item,
totInflAmnt,
noProcessInflAmnt: noProcessInflAmnt && noProcessInflAmnt > 0 ? noProcessInflAmnt : '',
msrDt: (item.msrDt.length === 8 && !item.msrDt.includes('-')) ?
`${item.msrDt.slice(0, 4)}-${item.msrDt.slice(4, 6)}-${item.msrDt.slice(6, 8)}`
: item.msrDt,
};
}); });
//console.log(rtnData);
set((state: FlowRateSearchType) => ({ set((state: FlowRateSearchType) => ({
...state, ...state,
FlowRateModal: { FlowRateModal: {
+41 -8
View File
@@ -4,6 +4,7 @@ import { getFetch, postFetch } from "@/app/components/api";
import { type ApiResponse } from "../underWaterInput"; import { type ApiResponse } from "../underWaterInput";
// import CalcRainEffect from "@/app/components/common/CalcRainEffect"; // import CalcRainEffect from "@/app/components/common/CalcRainEffect";
import { roundUp } from "../common"; import { roundUp } from "../common";
// import { fetchSweageOccurListFlow, fetchWtrUsgYmList } from "../sewageOccur";
export type { TableUpperProps }; export type { TableUpperProps };
/** /**
* 처리시설 연간 운영현황 > 계획하수량 산정지표 현황 * 처리시설 연간 운영현황 > 계획하수량 산정지표 현황
@@ -101,14 +102,15 @@ const planSewageList: PlanSewageProps[] = [
* @param oprtngSttsCd : 운영 상태 코드 * @param oprtngSttsCd : 운영 상태 코드
* @param facilityName : 시설명 * @param facilityName : 시설명
*/ */
const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string
, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
const tailStr = partCd ? '/' + partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') + '/0' + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const tailStr = partCd ? '/' + partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') + '/0' + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/prcsFclt/info/plan/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; const url = '/prcsFclt/info/plan/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
return { data: res.data, count: res.count } return { data: res.data, count: res.count }
} }
// 분류식화율 구하기 위한 api 호출 // 분류식화율 구하기 위한 api 호출 : 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) × 100
const fetchPlanZoneList = async (searchYear: string, fcltCdList: string[]) => { const fetchPlanZoneList = async (searchYear: string, fcltCdList: string[]) => {
try { try {
const res = await postFetch('fo', '/prcsFclt/info/planZone/' + searchYear, fcltCdList); const res = await postFetch('fo', '/prcsFclt/info/planZone/' + searchYear, fcltCdList);
@@ -251,19 +253,50 @@ export const planSewageReducer: (set: (fn: (state: PlanSewageType) => PlanSewage
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
// const data = res.data // const data = res.data
const planZoneRes: any = await fetchPlanZoneList(searchYear, fcltCdList); // 분류식화율 구하기 위한 api 호출 : 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) × 100
const planZoneList = planZoneRes?.data; // const planZoneRes: any = await fetchPlanZoneList(searchYear, fcltCdList);
// const detailRes: any = await fetchFlow(searchYear, fcltCdList);
//---------
const planZoneList: any[] = [];
const flowDetailList: Record<string, any[]> = {};
// const results: any[] = [];
const flowDetailResults: any[] = [];
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
const slicedItems = fcltCdList.slice(idx, idx + 100);
const result = await fetchPlanZoneList(searchYear, slicedItems); // 분류식화율 구하기 위한 api 호출 : 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) × 100
const flowResult = await fetchFlow(searchYear, slicedItems);
if (result?.status === 200 && Array.isArray(result?.data)) {
planZoneList.push(...result.data);
}
flowDetailResults.push(flowResult);
}
//console.log(results);
// 결과를 합치기
for (const res of flowDetailResults) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
if (!flowDetailList[keyStr]) flowDetailList[keyStr] = [];
flowDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
// const planZoneList = planZoneRes?.data;
planZoneList?.forEach(item => { planZoneList?.forEach(item => {
const planSewageItem = planSewageList.find(item2 => item2.bscFctCd == item.bscFctCd); const planSewageItem = planSewageList.find(item2 => item2.bscFctCd == item.bscFctCd);
if (planSewageItem) { if (planSewageItem) {
planSewageItem.sprtProcZoneAr = item.sprtProcZoneAr; planSewageItem.sprtProcZoneAr = item.sprtProcZoneAr; // 처리구역면적_분류식
planSewageItem.procZoneSm = item.procZoneSm; planSewageItem.procZoneSm = item.procZoneSm; //처리구역면적합계
} }
}); });
const detailRes: any = await fetchFlow(searchYear, fcltCdList); //const detailRes: any = await fetchFlow(searchYear, fcltCdList);
for (const item of planSewageList) { for (const item of planSewageList) {
const detailList = detailRes?.data[item.bscFctCd]; // const detailList = detailRes?.data[item.bscFctCd];
const detailList = flowDetailList[item.bscFctCd];
let avgInflAmnt = 0; let avgInflAmnt = 0;
let sumInflAmntSunny = 0; let sumInflAmntSunny = 0;
+262 -260
View File
@@ -12,52 +12,52 @@ export type { TableUpperProps };
*/ */
// 처리구역 리스트 // 처리구역 리스트
export type ProcessAreaProps = { export type ProcessAreaProps = {
swtrmtFcltCd : string, swtrmtFcltCd: string,
ctpvNm?: string, ctpvNm?: string,
sggNm?: string, sggNm?: string,
swtrmtFcltNm : string, swtrmtFcltNm: string,
location : string, location: string,
fctCpc : number | '', fctCpc: number | '',
fcltCpctSum : number | '', fcltCpctSum: number | '',
ruse : boolean, ruse: boolean,
planYrDt4 : string, planYrDt4: string,
planYr : string, planYr: string,
planYrDc1 : string, planYrDc1: string,
planYrDc2 : string, planYrDc2: string,
planYrDc3 : string, planYrDc3: string,
planYrDc4 : string, planYrDc4: string,
/** /**
* 증설계획 * 증설계획
*/ */
// 기승인(당초4단계), 현재, 변경1~4 // 기승인(당초4단계), 현재, 변경1~4
planSwageQntSumDt4 : number | '', planSwageQntSumDt4: number | '',
planSwageQntSum : number | '', planSwageQntSum: number | '',
planSwageQntSumDc1 : number | '', planSwageQntSumDc1: number | '',
planSwageQntSumDc2 : number | '', planSwageQntSumDc2: number | '',
planSwageQntSumDc3 : number | '', planSwageQntSumDc3: number | '',
planSwageQntSumDc4 : number | '', planSwageQntSumDc4: number | '',
/** /**
* 처리인구 * 처리인구
*/ */
// 기승인(당초4단계), 변경1~4 // 기승인(당초4단계), 변경1~4
swtrmtPpltnCntDt4 : number | '', swtrmtPpltnCntDt4: number | '',
swtrmtPpltnCnt : number | '', swtrmtPpltnCnt: number | '',
swtrmtPpltnCntDc1 : number | '', swtrmtPpltnCntDc1: number | '',
swtrmtPpltnCntDc2 : number | '', swtrmtPpltnCntDc2: number | '',
swtrmtPpltnCntDc3 : number | '', swtrmtPpltnCntDc3: number | '',
swtrmtPpltnCntDc4 : number | '', swtrmtPpltnCntDc4: number | '',
/** /**
* 처리구역면적 * 처리구역면적
*/ */
// 기승인(당초4단계), 변경1~4 // 기승인(당초4단계), 변경1~4
swtrmtZoneAreaDt4 : number | '', swtrmtZoneAreaDt4: number | '',
swtrmtZoneArea : number | '', swtrmtZoneArea: number | '',
swtrmtZoneAreaDc1 : number | '', swtrmtZoneAreaDc1: number | '',
swtrmtZoneAreaDc2 : number | '', swtrmtZoneAreaDc2: number | '',
swtrmtZoneAreaDc3 : number | '', swtrmtZoneAreaDc3: number | '',
swtrmtZoneAreaDc4 : number | '', swtrmtZoneAreaDc4: number | '',
// 처리구역 // 처리구역
trtDstr : string | '', trtDstr: string | '',
} }
export interface ExcelType { export interface ExcelType {
@@ -89,32 +89,32 @@ export interface ExcelType {
// (2) 처리구역 팝업 // (2) 처리구역 팝업
// 시설증설 계획 // 시설증설 계획
export type FcltyImproveInfoProps = { export type FcltyImproveInfoProps = {
planSwageQntSumDt4 : number | '', planSwageQntSumDt4: number | '',
planSwageQntSum : number | '', planSwageQntSum: number | '',
planSwageQntSumDc1 : number | '', planSwageQntSumDc1: number | '',
planSwageQntSumDc2 : number | '', planSwageQntSumDc2: number | '',
planSwageQntSumDc3 : number | '', planSwageQntSumDc3: number | '',
planSwageQntSumDc4 : number | '', planSwageQntSumDc4: number | '',
} }
// 처리인구 계획 // 처리인구 계획
export type ProcessPopulationProps = { export type ProcessPopulationProps = {
swtrmtPpltnCntDt4 : number | '', swtrmtPpltnCntDt4: number | '',
swtrmtPpltnCnt : number | '', swtrmtPpltnCnt: number | '',
swtrmtPpltnCntDc1 : number | '', swtrmtPpltnCntDc1: number | '',
swtrmtPpltnCntDc2 : number | '', swtrmtPpltnCntDc2: number | '',
swtrmtPpltnCntDc3 : number | '', swtrmtPpltnCntDc3: number | '',
swtrmtPpltnCntDc4 : number | '', swtrmtPpltnCntDc4: number | '',
} }
// 처리구역 계획 // 처리구역 계획
export type ProcessAreaPlanProps = { export type ProcessAreaPlanProps = {
swtrmtZoneAreaDt4 : number | '', swtrmtZoneAreaDt4: number | '',
swtrmtZoneArea : number | '', swtrmtZoneArea: number | '',
swtrmtZoneAreaDc1 : number | '', swtrmtZoneAreaDc1: number | '',
swtrmtZoneAreaDc2 : number | '', swtrmtZoneAreaDc2: number | '',
swtrmtZoneAreaDc3 : number | '', swtrmtZoneAreaDc3: number | '',
swtrmtZoneAreaDc4 : number | '', swtrmtZoneAreaDc4: number | '',
trtDstr : string, trtDstr: string,
} }
/**==================================== /**====================================
@@ -123,93 +123,93 @@ export type ProcessAreaPlanProps = {
/** /**
* (1) 메인페이지 * (1) 메인페이지
*/ */
// 검색단 // 검색단
const ProcessFacilityLabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '시설상태', '연도별', '권역', '단위유역', '중권역', '환경청별']; const ProcessFacilityLabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '시설상태', '연도별', '권역', '단위유역', '중권역', '환경청별'];
// 리스트 헤더(행정별) // 리스트 헤더(행정별)
const upHeadList1:TableUpperProps[] = [ const upHeadList1: TableUpperProps[] = [
{ id: "A", title: "행정구역", colSpan:2, rowSpan:2, row:0 }, { id: "A", title: "행정구역", colSpan: 2, rowSpan: 2, row: 0 },
{ id: "ctpvNm", title: "시도", upName:"upChangeRe", row:2, widthPercent:4 }, { id: "ctpvNm", title: "시도", upName: "upChangeRe", row: 2, widthPercent: 4 },
{ id: "sggNm", title: "시군구", upName:"upChangeRe", row:2, widthPercent:4 }, { id: "sggNm", title: "시군구", upName: "upChangeRe", row: 2, widthPercent: 4 },
{ id: "swtrmtFcltNm", title: "시설명", rowSpan:3, row:0, widthPercent: 6 }, { id: "swtrmtFcltNm", title: "시설명", rowSpan: 3, row: 0, widthPercent: 6 },
{ id: "location", title: "주소", rowSpan:3, row:0, widthPercent: 12 }, { id: "location", title: "주소", rowSpan: 3, row: 0, widthPercent: 12 },
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", rowSpan:3, row:0, widthPercent: 5 }, { id: "fctCpc", title: "시설용량(m³/일)", align: "right", rowSpan: 3, row: 0, widthPercent: 5 },
{ id: "B", title: "시설계획", colSpan:19, row: 0 }, { id: "B", title: "시설계획", colSpan: 18, row: 0 },
{ id: "C", title: "증설계획(m³/일)", colSpan:6, row: 1 }, { id: "C", title: "증설계획(m³/일)", colSpan: 6, row: 1 },
{ id: "planSwageQntSumDt4", title: "기승인\n4단계", row:2, align:"right", widthPercent: 3.5 }, { id: "planSwageQntSumDt4", title: "기승인\n4단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "planSwageQntSum", title: "현재", row:2, align:"right", widthPercent: 3.5 }, { id: "planSwageQntSum", title: "현재", row: 2, align: "right", widthPercent: 3.5 },
{ id: "planSwageQntSumDc1", title: "1단계", row:2, align:"right", widthPercent: 3.5 }, { id: "planSwageQntSumDc1", title: "1단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "planSwageQntSumDc2", title: "2단계", row:2, align:"right", widthPercent: 3.5 }, { id: "planSwageQntSumDc2", title: "2단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "planSwageQntSumDc3", title: "3단계", row:2, align:"right", widthPercent: 3.5 }, { id: "planSwageQntSumDc3", title: "3단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "planSwageQntSumDc4", title: "4단계", row:2, align:"right", widthPercent: 3.5 }, { id: "planSwageQntSumDc4", title: "4단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "D", title: "처리인구(인)", colSpan:6, row:1 }, { id: "D", title: "처리인구(인)", colSpan: 6, row: 1 },
{ id: "swtrmtPpltnCntDt4", title: "기승인\n4단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtPpltnCntDt4", title: "기승인\n4단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtPpltnCnt", title: "현재", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtPpltnCnt", title: "현재", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtPpltnCntDc1", title: "1단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtPpltnCntDc1", title: "1단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtPpltnCntDc2", title: "2단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtPpltnCntDc2", title: "2단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtPpltnCntDc3", title: "3단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtPpltnCntDc3", title: "3단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtPpltnCntDc4", title: "4단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtPpltnCntDc4", title: "4단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "E", title: "처리구역(km²)", colSpan:7, row:1 }, { id: "E", title: "처리구역(km²)", colSpan: 6, row: 1 },
{ id: "swtrmtZoneAreaDt4", title: "기승인\n4단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtZoneAreaDt4", title: "기승인\n4단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtZoneArea", title: "현재", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtZoneArea", title: "현재", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtZoneAreaDc1", title: "1단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtZoneAreaDc1", title: "1단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtZoneAreaDc2", title: "2단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtZoneAreaDc2", title: "2단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtZoneAreaDc3", title: "3단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtZoneAreaDc3", title: "3단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "swtrmtZoneAreaDc4", title: "4단계", row:2, align:"right", widthPercent: 3.5 }, { id: "swtrmtZoneAreaDc4", title: "4단계", row: 2, align: "right", widthPercent: 3.5 },
{ id: "trtDstr", title: "처리구역", row:2} { id: "trtDstr", title: "처리구역", row: 0, rowSpan: 3 } // row - header에서 몇번째 행인지
]; ];
const processAreaList:ProcessAreaProps[] = [ const processAreaList: ProcessAreaProps[] = [
] ]
/** /**
* 처리구역정보 상세팝업 * 처리구역정보 상세팝업
*/ */
// 시설증설 계획 (헤더) // 시설증설 계획 (헤더)
const upHeadListFcltyImproveInfo:TableUpperProps[] = [ const upHeadListFcltyImproveInfo: TableUpperProps[] = [
{ id: "planSwageQntSumDt4", title: "기승인\n4단계(m³/일)", rowSpan:2, row:0, align:"right"}, { id: "planSwageQntSumDt4", title: "기승인\n4단계(m³/일)", rowSpan: 2, row: 0, align: "right" },
{ id: "A", title: "증설계획(m³/일)", colSpan:5, row:0}, { id: "A", title: "증설계획(m³/일)", colSpan: 5, row: 0 },
{ id: "planSwageQntSum", title: "현재", row:1, align:"right"}, { id: "planSwageQntSum", title: "현재", row: 1, align: "right" },
{ id: "planSwageQntSumDc1", title: "1단계", row:1, align:"right"}, { id: "planSwageQntSumDc1", title: "1단계", row: 1, align: "right" },
{ id: "planSwageQntSumDc2", title: "2단계", row:1, align:"right"}, { id: "planSwageQntSumDc2", title: "2단계", row: 1, align: "right" },
{ id: "planSwageQntSumDc3", title: "3단계", row:1, align:"right"}, { id: "planSwageQntSumDc3", title: "3단계", row: 1, align: "right" },
{ id: "planSwageQntSumDc4", title: "4단계", row:1, align:"right"}, { id: "planSwageQntSumDc4", title: "4단계", row: 1, align: "right" },
]; ];
// 시설증설 계획 (리스트) // 시설증설 계획 (리스트)
const gridListFcltyImproveInfo:FcltyImproveInfoProps[] = [ const gridListFcltyImproveInfo: FcltyImproveInfoProps[] = [
]; ];
// 처리인구 계획 (헤더) // 처리인구 계획 (헤더)
const upHeadListProcessPopulation:TableUpperProps[] = [ const upHeadListProcessPopulation: TableUpperProps[] = [
{ id: "swtrmtPpltnCntDt4", title: "기승인\n4단계(인)", rowSpan:2, row:0, align:"right"}, { id: "swtrmtPpltnCntDt4", title: "기승인\n4단계(인)", rowSpan: 2, row: 0, align: "right" },
{ id: "A", title: "처리인구(인)", colSpan:5, row:0}, { id: "A", title: "처리인구(인)", colSpan: 5, row: 0 },
{ id: "swtrmtPpltnCnt", title: "현재", row:1, align:"right"}, { id: "swtrmtPpltnCnt", title: "현재", row: 1, align: "right" },
{ id: "swtrmtPpltnCntDc1", title: "1단계", row:1, align:"right"}, { id: "swtrmtPpltnCntDc1", title: "1단계", row: 1, align: "right" },
{ id: "swtrmtPpltnCntDc2", title: "2단계", row:1, align:"right"}, { id: "swtrmtPpltnCntDc2", title: "2단계", row: 1, align: "right" },
{ id: "swtrmtPpltnCntDc3", title: "3단계", row:1, align:"right"}, { id: "swtrmtPpltnCntDc3", title: "3단계", row: 1, align: "right" },
{ id: "swtrmtPpltnCntDc4", title: "4단계", row:1, align:"right"}, { id: "swtrmtPpltnCntDc4", title: "4단계", row: 1, align: "right" },
]; ];
// 처리인구 계획 (리스트) // 처리인구 계획 (리스트)
const gridListProcessPopulation:ProcessPopulationProps[] = [ const gridListProcessPopulation: ProcessPopulationProps[] = [
]; ];
// 처리구역 계획 (헤더) // 처리구역 계획 (헤더)
const upHeadListProcessAreaPlan:TableUpperProps[] = [ const upHeadListProcessAreaPlan: TableUpperProps[] = [
{ id: "swtrmtZoneAreaDt4", title: "기승인\n4단계(km²)", rowSpan:2, row:0, align:"right"}, { id: "swtrmtZoneAreaDt4", title: "기승인\n4단계(km²)", rowSpan: 2, row: 0, align: "right" },
{ id: "A", title: "처리면적(km²)", colSpan:6, row:0, align:"right"}, { id: "A", title: "처리면적(km²)", colSpan: 5, row: 0, align: "right" },
{ id: "swtrmtZoneArea", title: "현재", row:1, align:"right"}, { id: "swtrmtZoneArea", title: "현재", row: 1, align: "right" },
{ id: "swtrmtZoneAreaDc1", title: "1단계", row:1, align:"right"}, { id: "swtrmtZoneAreaDc1", title: "1단계", row: 1, align: "right" },
{ id: "swtrmtZoneAreaDc2", title: "2단계", row:1, align:"right"}, { id: "swtrmtZoneAreaDc2", title: "2단계", row: 1, align: "right" },
{ id: "swtrmtZoneAreaDc3", title: "3단계", row:1, align:"right"}, { id: "swtrmtZoneAreaDc3", title: "3단계", row: 1, align: "right" },
{ id: "swtrmtZoneAreaDc4", title: "4단계", row:1, align:"right"}, { id: "swtrmtZoneAreaDc4", title: "4단계", row: 1, align: "right" },
{ id: "trtDstr", title: "처리구역", row:1} // { id: "trtDstr", title: "처리구역", row: 1 }
]; ];
// 시설증설 계획 (리스트) // 시설증설 계획 (리스트)
const gridListProcessAreaPlan:ProcessAreaPlanProps[] = [ const gridListProcessAreaPlan: ProcessAreaPlanProps[] = [
]; ];
/**==================================== /**====================================
@@ -227,113 +227,115 @@ const gridListProcessAreaPlan:ProcessAreaPlanProps[] = [
} }
}; */ }; */
const fetchFacilityDetailInfo = async (pageNo:number, pageSize:number, swtrmtFcltCd: string[]) : Promise<{data:any[], count:number}> => { const fetchFacilityDetailInfo = async (pageNo: number, pageSize: number, swtrmtFcltCd: string[]): Promise<{ data: any[], count: number }> => {
try { try {
const res = await postFetch('fo', '/prcsFclt/ruseInfo/'+pageNo+'/'+pageSize, swtrmtFcltCd); const res = await postFetch('fo', '/prcsFclt/ruseInfo/' + pageNo + '/' + pageSize, swtrmtFcltCd);
return {data: res.data, count:res.count}; return { data: res.data, count: res.count };
} catch (error) { } catch (error) {
console.error('시설정보 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 데이터를 가져오는데 실패했습니다:', error);
return {data:[], count:0}; return { data: [], count: 0 };
} }
}; };
// 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) // 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우)
const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined, set : (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{data:any[], count:number}> => { const fetchProcessAreaList = async (pageNo: number, pageSize: number, ctpvNm: string | undefined, sggNm: string | undefined
try { , targetYear: string | undefined, set: (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{ data: any[], count: number }> => {
const res = await fetchPlanInfo(targetYear, ctpvNm, sggNm, undefined); try {
if(res && res.length > 0){ const res = await fetchPlanInfo(targetYear, ctpvNm, sggNm, undefined);
const enrichedData = await Promise.all( if (res && res.length > 0) {
res.map(async (item: ProcessAreaProps) => { const enrichedData = await Promise.all(
upHeadList1.forEach((head:TableUpperProps) => { res.map(async (item: ProcessAreaProps) => {
/* if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { upHeadList1.forEach((head: TableUpperProps) => {
head.title = '현재\n(' + item.planYr + '년)'; /* if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { head.title = '현재\n(' + item.planYr + '년)';
head.title = '1단계\n(' + item.planYrDc1 + '년)'; } else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { head.title = '1단계\n(' + item.planYrDc1 + '년)';
head.title = '2단계\n(' + item.planYrDc2 + '년)'; } else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { head.title = '2단계\n(' + item.planYrDc2 + '년)';
head.title = '3단계\n(' + item.planYrDc3 + '년)'; } else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { head.title = '3단계\n(' + item.planYrDc3 + '년)';
head.title = '4단계\n(' + item.planYrDc4 + '년)'; } else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { head.title = '4단계\n(' + item.planYrDc4 + '년)';
head.title = '기승인\n4단계(' + item.planYrDt4 + '년)'; } else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
} */ head.title = '기승인\n4단계(' + item.planYrDt4 + '년)';
if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') { } */
head.title = '현재'; if (head.id === 'planSwageQntSum' || head.id === 'swtrmtPpltnCnt' || head.id === 'swtrmtZoneArea') {
} else if(head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') { head.title = '현재';
head.title = '1단계'; } else if (head.id === 'planSwageQntSumDc1' || head.id === 'swtrmtPpltnCntDc1' || head.id === 'swtrmtZoneAreaDc1') {
} else if(head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') { head.title = '1단계';
head.title = '2단계'; } else if (head.id === 'planSwageQntSumDc2' || head.id === 'swtrmtPpltnCntDc2' || head.id === 'swtrmtZoneAreaDc2') {
} else if(head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') { head.title = '2단계';
head.title = '3단계'; } else if (head.id === 'planSwageQntSumDc3' || head.id === 'swtrmtPpltnCntDc3' || head.id === 'swtrmtZoneAreaDc3') {
} else if(head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') { head.title = '3단계';
head.title = '4단계'; } else if (head.id === 'planSwageQntSumDc4' || head.id === 'swtrmtPpltnCntDc4' || head.id === 'swtrmtZoneAreaDc4') {
} else if(head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') { head.title = '4단계';
head.title = '기승인\n4단계'; } else if (head.id === 'planSwageQntSumDt4' || head.id === 'swtrmtPpltnCntDt4' || head.id === 'swtrmtZoneAreaDt4') {
} head.title = '기승인\n4단계';
}); }
return item; });
return item;
})
);
const startIndex = (pageNo - 1) * pageSize;
const endIndex = startIndex + pageSize;
const paginatedData = enrichedData.slice(startIndex, endIndex);
const fcltyCdList: string[] = [];
paginatedData.forEach(item => {
fcltyCdList.push(item.swtrmtFcltCd);
}) })
);
const startIndex = (pageNo - 1) * pageSize; const detailFcltylist = await fetchFacilityDetailInfo(1, pageSize, fcltyCdList);
const endIndex = startIndex + pageSize; paginatedData.forEach(item => {
const paginatedData = enrichedData.slice(startIndex, endIndex); const filterdData = detailFcltylist.data.filter(fItem => fItem.bscFctCd === item.swtrmtFcltCd)[0] || null;
item.fcltCpctSum = filterdData ? filterdData.fctCpc : '';
const fcltyCdList : string[]= []; item.location = filterdData ? filterdData.addr : '';
paginatedData.forEach(item => { item.ctpvNm = filterdData ? filterdData.sido : '';
fcltyCdList.push(item.swtrmtFcltCd); item.sggNm = filterdData ? filterdData.gugun : '';
}) item.trtDstr = filterdData ? filterdData.trtDstr : '';
});
const detailFcltylist = await fetchFacilityDetailInfo(1, pageSize, fcltyCdList); return { data: paginatedData, count: enrichedData.length };
paginatedData.forEach(item => { } else {
const filterdData = detailFcltylist.data.filter(fItem=>fItem.bscFctCd === item.swtrmtFcltCd)[0] || null; return { data: [], count: 0 };
item.fcltCpctSum = filterdData ? filterdData.fctCpc : '';
item.location = filterdData ? filterdData.addr : '';
item.ctpvNm = filterdData ? filterdData.sido : '';
item.sggNm = filterdData ? filterdData.gugun : '';
});
return {data: paginatedData, count: enrichedData.length};
}else{
return {data: [], count: 0};
}
} catch (error) {
console.error('시설계획정보를 가져오는데 실패했습니다:', error);
set((state) => ({
...state,
ProcessArea : {
...state.ProcessArea,
isLoading : false
} }
})); } catch (error) {
return {data: [], count: 0}; console.error('시설계획정보를 가져오는데 실패했습니다:', error);
} set((state) => ({
...state,
ProcessArea: {
...state.ProcessArea,
isLoading: false
}
}));
return { data: [], count: 0 };
}
}; };
/**==================================== /**====================================
* Store - expaort * Store - expaort
=====================================*/ =====================================*/
export type ProcessAreaActions = { export type ProcessAreaActions = {
searchProcessAreaList : (pageNo: number, pageSize: number, ctpvNm?:string, sggNm?:string, targetYear?:string) => void; searchProcessAreaList: (pageNo: number, pageSize: number, ctpvNm?: string, sggNm?: string, targetYear?: string) => void;
initModalData : (swtrmtFcltCd:string) => void; initModalData: (swtrmtFcltCd: string) => void;
} }
export type ProcessAreaType = { export type ProcessAreaType = {
ProcessAreaSearch: { ProcessAreaSearch: {
isInit: boolean; isInit: boolean;
processFacilityLabelArray:string[]; processFacilityLabelArray: string[];
}, },
ProcessArea : { ProcessArea: {
isInit: boolean; isInit: boolean;
upHeadList1: TableUpperProps[]; upHeadList1: TableUpperProps[];
processAreaList: ProcessAreaProps[]; processAreaList: ProcessAreaProps[];
processAreaCount: number; processAreaCount: number;
excelList: ExcelType[]; excelList: ExcelType[];
isLoading: boolean; isLoading: boolean;
}, },
ProcessAreaDetail : { ProcessAreaDetail: {
isInit: boolean; isInit: boolean;
upHeadListFcltyImproveInfo: TableUpperProps[]; upHeadListFcltyImproveInfo: TableUpperProps[];
gridListFcltyImproveInfo: FcltyImproveInfoProps[]; // Changed from facilityAreaProps to ProcessAreaProps gridListFcltyImproveInfo: FcltyImproveInfoProps[]; // Changed from facilityAreaProps to ProcessAreaProps
@@ -350,23 +352,23 @@ export const processAreaInitState: ProcessAreaType = {
processFacilityLabelArray: ProcessFacilityLabelArray, processFacilityLabelArray: ProcessFacilityLabelArray,
}, },
ProcessArea : { ProcessArea: {
isInit : false, isInit: false,
upHeadList1 : upHeadList1, upHeadList1: upHeadList1,
processAreaList : processAreaList, processAreaList: processAreaList,
processAreaCount : 0, processAreaCount: 0,
excelList : [], excelList: [],
isLoading : true, isLoading: true,
}, },
ProcessAreaDetail : { ProcessAreaDetail: {
isInit : false, isInit: false,
upHeadListFcltyImproveInfo : upHeadListFcltyImproveInfo, upHeadListFcltyImproveInfo: upHeadListFcltyImproveInfo,
gridListFcltyImproveInfo : gridListFcltyImproveInfo, gridListFcltyImproveInfo: gridListFcltyImproveInfo,
upHeadListProcessPopulation : upHeadListProcessPopulation, upHeadListProcessPopulation: upHeadListProcessPopulation,
gridListProcessPopulation : gridListProcessPopulation, gridListProcessPopulation: gridListProcessPopulation,
upHeadListProcessAreaPlan : upHeadListProcessAreaPlan, upHeadListProcessAreaPlan: upHeadListProcessAreaPlan,
gridListProcessAreaPlan : gridListProcessAreaPlan, gridListProcessAreaPlan: gridListProcessAreaPlan,
}, },
} }
@@ -375,14 +377,14 @@ type SetStateFunction = (state: ProcessAreaType | ((state: ProcessAreaType) => P
export type ProcessAreaStore = ProcessAreaType & ProcessAreaActions; export type ProcessAreaStore = ProcessAreaType & ProcessAreaActions;
export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set: SetStateFunction) => { export const processAreaReducer: (set: SetStateFunction) => ProcessAreaActions = (set: SetStateFunction) => {
return { return {
/** /**
* 시설정보 리스트 데이터 호출 * 시설정보 리스트 데이터 호출
* @param pageNo : 페이지 번호 * @param pageNo : 페이지 번호
* @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) => {
set((state: ProcessAreaType) => ({ set((state: ProcessAreaType) => ({
...state, ...state,
ProcessArea: { ProcessArea: {
@@ -391,12 +393,12 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
}, },
})); }));
const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set); const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set);
res.data.forEach((item:ProcessAreaProps) => { res.data.forEach((item: ProcessAreaProps) => {
item.fctCpc = item.fcltCpctSum; item.fctCpc = item.fcltCpctSum;
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> });
}) })
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
if(pageSize>5000){ if (pageSize > 5000) {
res.data.forEach(item => { res.data.forEach(item => {
item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : ''; item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : '';
excelDownList.push({ excelDownList.push({
@@ -425,78 +427,78 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set:
처리구역: item.trtDstr 처리구역: item.trtDstr
}); });
}); });
}else{ } else {
res.data.forEach(item => { res.data.forEach(item => {
item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : ''; item.fctCpc = item.fctCpc ? parseFloat(item.fctCpc.toString().replace(/,/g, '')) : '';
}) })
} }
set((state:ProcessAreaType) => ({ set((state: ProcessAreaType) => ({
...state, ...state,
ProcessArea: pageSize<5000?{ ProcessArea: pageSize < 5000 ? {
...state.ProcessArea, ...state.ProcessArea,
processAreaList: res.data, processAreaList: res.data,
processAreaCount: res.count, processAreaCount: res.count,
isLoading : false, isLoading: false,
}:{ } : {
...state.ProcessArea, ...state.ProcessArea,
excelList: excelDownList, excelList: excelDownList,
isLoading : false, isLoading: false,
}, },
})) }))
}, },
initModalData: async (swtrmtFcltCd:string) => { initModalData: async (swtrmtFcltCd: string) => {
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 = rtnData.planYr? '현재\n(' + rtnData.planYr + '년)':head.title = '현재'; head.title = rtnData.planYr ? '현재\n(' + rtnData.planYr + '년)' : 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 = rtnData.planYrDc1? '1단계\n(' + rtnData.planYrDc1 + '년)':head.title = '1단계'; head.title = rtnData.planYrDc1 ? '1단계\n(' + rtnData.planYrDc1 + '년)' : 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 = rtnData.planYrDc2? '2단계\n(' + rtnData.planYrDc2 + '년)':head.title = '2단계'; head.title = rtnData.planYrDc2 ? '2단계\n(' + rtnData.planYrDc2 + '년)' : 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 = rtnData.planYrDc3? '3단계\n(' + rtnData.planYrDc3 + '년)':head.title = '3단계'; head.title = rtnData.planYrDc3 ? '3단계\n(' + rtnData.planYrDc3 + '년)' : 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 = rtnData.planYrDc4? '4단계\n(' + rtnData.planYrDc4 + '년)':head.title = '4단계'; head.title = rtnData.planYrDc4 ? '4단계\n(' + rtnData.planYrDc4 + '년)' : 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 = rtnData.planYrDt4? '기승인\n4단계(' + rtnData.planYrDt4 + '년)':head.title = '기승인\n4단계'; head.title = rtnData.planYrDt4 ? '기승인\n4단계(' + rtnData.planYrDt4 + '년)' : 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 = rtnData.planYr? '현재\n(' + rtnData.planYr + '년)':head.title = '현재'; head.title = rtnData.planYr ? '현재\n(' + rtnData.planYr + '년)' : 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 = rtnData.planYrDc1?'1단계\n(' + rtnData.planYrDc1 + '년)':head.title = '1단계'; head.title = rtnData.planYrDc1 ? '1단계\n(' + rtnData.planYrDc1 + '년)' : 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 = rtnData.planYrDc2?'2단계\n(' + rtnData.planYrDc2 + '년)':head.title = '2단계'; head.title = rtnData.planYrDc2 ? '2단계\n(' + rtnData.planYrDc2 + '년)' : 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 = rtnData.planYrDc3? '3단계\n(' + rtnData.planYrDc3 + '년)':head.title = '3단계'; head.title = rtnData.planYrDc3 ? '3단계\n(' + rtnData.planYrDc3 + '년)' : 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 = rtnData.planYrDc4?'4단계\n(' + rtnData.planYrDc4 + '년)':head.title = '4단계'; head.title = rtnData.planYrDc4 ? '4단계\n(' + rtnData.planYrDc4 + '년)' : 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 = rtnData.planYrDt4?'기승인\n4단계(' + rtnData.planYrDt4 + '년)':head.title = '기승인\n4단계'; head.title = rtnData.planYrDt4 ? '기승인\n4단계(' + rtnData.planYrDt4 + '년)' : 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 = rtnData.planYr?'현재\n(' + rtnData.planYr + '년)':head.title = '현재'; head.title = rtnData.planYr ? '현재\n(' + rtnData.planYr + '년)' : 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 = rtnData.planYrDc1?'1단계\n(' + rtnData.planYrDc1 + '년)':head.title = '1단계'; head.title = rtnData.planYrDc1 ? '1단계\n(' + rtnData.planYrDc1 + '년)' : 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 = rtnData.planYrDc2?'2단계\n(' + rtnData.planYrDc2 + '년)':head.title = '2단계'; head.title = rtnData.planYrDc2 ? '2단계\n(' + rtnData.planYrDc2 + '년)' : 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 = rtnData.planYrDc3?'3단계\n(' + rtnData.planYrDc3 + '년)':head.title = '3단계'; head.title = rtnData.planYrDc3 ? '3단계\n(' + rtnData.planYrDc3 + '년)' : 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 = rtnData.planYrDc4?'4단계\n(' + rtnData.planYrDc4 + '년)':head.title = '4단계'; head.title = rtnData.planYrDc4 ? '4단계\n(' + rtnData.planYrDc4 + '년)' : 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 = rtnData.planYrDt4?'기승인\n4단계(' + rtnData.planYrDt4 + '년)':head.title = '기승인\n4단계'; head.title = rtnData.planYrDt4 ? '기승인\n4단계(' + rtnData.planYrDt4 + '년)' : head.title = '기승인\n4단계';
} }
}); });
// 시설증설 계획 데이터 생성 // 시설증설 계획 데이터 생성
const fcltyImproveInfo: FcltyImproveInfoProps = { const fcltyImproveInfo: FcltyImproveInfoProps = {
planSwageQntSumDt4: rtnData.planSwageQntSumDt4, planSwageQntSumDt4: rtnData.planSwageQntSumDt4,
+15 -4
View File
@@ -113,7 +113,10 @@ export type fcltyHistInfoProps = {
sitArea: number, sitArea: number,
trtDstrArea: number, trtDstrArea: number,
swrTrtPopl: number, swrTrtPopl: number,
fctCpc: number | '' fctCpc: number | '',
trtSrsHanNm?: string, // 공법구분
trtMocHanNm?: string, // 공법계열
trtFrfHanNm?: string, // 방법
} }
// 시설 수질정보 // 시설 수질정보
@@ -328,6 +331,9 @@ const upHeadListFcltyHistInfo: TableUpperProps[] = [
{ id: "trlrnCmplDt", title: "시운전완료일" }, { id: "trlrnCmplDt", title: "시운전완료일" },
{ id: "rnDt", title: "가동개시일" }, { id: "rnDt", title: "가동개시일" },
{ id: "fctCpc", title: "시설용량(m³/일)", align: 'right' }, { id: "fctCpc", title: "시설용량(m³/일)", align: 'right' },
{ id: "trtSrsHanNm", title: "공법구분" },
{ id: "trtMocHanNm", title: "공법계열" },
{ id: "trtFrfHanNm", title: "방법" },
]; ];
// 시설 이력관리 (리스트) // 시설 이력관리 (리스트)
@@ -344,7 +350,10 @@ const gridListFcltyHistInfo: fcltyHistInfoProps[] = [
sitArea: 0, sitArea: 0,
trtDstrArea: 0, trtDstrArea: 0,
swrTrtPopl: 0, swrTrtPopl: 0,
fctCpc: 860000 fctCpc: 860000,
trtFrfHanNm: "",
trtMocHanNm: "",
trtSrsHanNm: "",
} }
]; ];
@@ -418,7 +427,9 @@ const gridListFcltyWaterQltyInfo: fcltyWaterQltyInfoProps[] = [
*/ */
export const fetchFacilityListInit = async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string): Promise<{ data: facilityListProps[], count: number }> => { export const fetchFacilityListInit = async (pageNo: number, pageSize: number, partValue?: string, nameCd?: string, fcltCpct?: string, oprtngSttsCd?: string, facilityPartValue?: string, facilityName?: string): Promise<{ data: facilityListProps[], count: number }> => {
try { try {
const tailStr = partValue ? '/' + (partValue === 'G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd + '/' + facilityPartValue + (facilityName && facilityName !== '' ? '/' + facilityName : '') : ''; const tailStr = partValue ? '/' + (partValue === 'G' ? 'A' : partValue) + '/' + nameCd + '/' + fcltCpct + '/' + oprtngSttsCd
+ (facilityPartValue && facilityPartValue !== ''? '/' + facilityPartValue : '')
+ (facilityName && facilityName !== ''? '/' + facilityName : '') : '';
const url = '/prcsFclt/info/' + pageNo + '/' + pageSize + tailStr; const url = '/prcsFclt/info/' + pageNo + '/' + pageSize + tailStr;
const res = await getFetch('fo', url); const res = await getFetch('fo', url);
res.data.forEach((item: Record<string, unknown>) => { res.data.forEach((item: Record<string, unknown>) => {
@@ -900,4 +911,4 @@ export const processFacilityReducer: (set: SetStateFunction) => ProcessFacilityA
} }
} }
} }
} }
+25 -7
View File
@@ -322,15 +322,33 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
fcltCdList.push(item.bscFctCd); fcltCdList.push(item.bscFctCd);
}); });
const rdiiDetailListRes : any = await fetchFacilityRdiiDetailList(searchYear, fcltCdList); // const rdiiDetailListRes : any = await fetchFacilityRdiiDetailList(searchYear, fcltCdList);
console.log(rdiiDetailListRes);
//---------
const rainDetailList: Record<string, any[]> = {};
const results: any[] = [];
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
const slicedItems = fcltCdList.slice(idx, idx + 100);
const result = await fetchFacilityRdiiDetailList(searchYear, slicedItems);
results.push(result);
}
//console.log(results);
// 결과를 합치기
for (const res of results) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
if (!rainDetailList[keyStr]) rainDetailList[keyStr] = [];
rainDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
// console.log(rdiiDetailListRes);
for (const item of rtnData) { for (const item of rtnData) {
//const fcltyCd = item.bscFctCd; // const rdiiDetailList = rdiiDetailListRes?.data[item.bscFctCd];
//const res: any = await fetchFacilityWaterQltyListHist(searchYear, fcltyCd); const rdiiDetailList = rainDetailList[item.bscFctCd];
//const rdiiDetailList = res.data.wqltObjs;
const rdiiDetailList = rdiiDetailListRes?.data[item.bscFctCd];
//console.log(rdiiDetailListRes);
let rtnWinterInflBod = 0; let rtnWinterInflBod = 0;
let rtnSummerBodInfl = 0; let rtnSummerBodInfl = 0;
+70 -117
View File
@@ -4,6 +4,7 @@ import { roundNumber } from "@/app/components/common/DataForm";
import { OSU_PERCENT } from "../common"; import { OSU_PERCENT } from "../common";
import type { TableUpperProps } from "../dashboard"; import type { TableUpperProps } from "../dashboard";
import { fetchFacilityListInit } from "../processFacility"; import { fetchFacilityListInit } from "../processFacility";
// import { fetchFacilityRainDetailList } from "../facilityPrecipitation";
export type { TableUpperProps }; export type { TableUpperProps };
/** /**
@@ -29,7 +30,7 @@ export type SewageOccurProps = {
mdmbsn: string, mdmbsn: string,
msrDt: string, msrDt: string,
} }
export type modalTableType = { msrDt: string, waterUsage: number, swageChangePercent: number, estimationSewage: number }; export type modalTableType = { msrDt: string, waterUsage: number, swageChangePercent: number, estimationSewage: number, }
export type SewageOccurDetailProps = { export type SewageOccurDetailProps = {
cnt: number, cnt: number,
sum: number, sum: number,
@@ -39,6 +40,8 @@ export type SewageOccurDetailProps = {
sumWtrUsg: number, // 물사용량 합 sumWtrUsg: number, // 물사용량 합
avgWtrUsg: number, // 일평균 물사용량 avgWtrUsg: number, // 일평균 물사용량
monWtrUsg: number, // 월 물사용량 monWtrUsg: number, // 월 물사용량
maxEstSewerage: number, // 최대 오수발생량 추정
minEstSewerage: number, // 최소 오수발생량 추정
} }
export type WtrUsgYmProps = { export type WtrUsgYmProps = {
bscFctCd: string, // 처리구역시설코드 bscFctCd: string, // 처리구역시설코드
@@ -326,16 +329,52 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
}); });
}); });
const soccurDetailRes: any = await fetchSweageOccurListFlow(searchYear, fcltCdList); // const soccurDetailRes: any = await fetchSweageOccurListFlow(searchYear, fcltCdList);
const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList); // const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
// const wtrUsgMap : Record<string, number> = {};
// wtrUsgRes.data.forEach(fclt => { //---------
// wtrUsgMap[fclt.bscFctCd] = fclt.wtrUsg; const rainDetailList: Record<string, any[]> = {};
// }); const wtrDetailList: Record<string, any[]> = {};
const results: any[] = [];
const wtrResults: any[] = [];
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
const slicedItems = fcltCdList.slice(idx, idx + 100);
const result = await fetchSweageOccurListFlow(searchYear, slicedItems);
const wtrResult = await fetchWtrUsgYmList(searchYear, slicedItems);
results.push(result);
wtrResults.push(wtrResult);
}
//console.log(results);
// 결과를 합치기
for (const res of results) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
//rainDetailList[keyStr] = [...(rainDetailList[keyStr] || []), ...(value as any[])];
if (!rainDetailList[keyStr]) rainDetailList[keyStr] = [];
rainDetailList[keyStr].push(...(value as any[]));
}
}
}
for (const res of wtrResults) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
// wtrDetailList[keyStr] = [...(wtrDetailList[keyStr] || []), ...(value as any[])];
if (!wtrDetailList[keyStr]) wtrDetailList[keyStr] = [];
wtrDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
let maxEstimationSewage = 0, minEstimationSewage = 999999999;
for (const item of sewageOccurPropsList) { for (const item of sewageOccurPropsList) {
const detailList = soccurDetailRes?.data[item.bscFctCd]; //const detailList = soccurDetailRes?.data[item.bscFctCd];
const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd]; // const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd];
const detailList = rainDetailList[item.bscFctCd];
const wtrUsgYmList = wtrDetailList[item.bscFctCd];
item.swageChangePercent = 90; item.swageChangePercent = 90;
let sumChungcunDay = 0; // 청천일수 let sumChungcunDay = 0; // 청천일수
@@ -367,18 +406,16 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
// console.log("totWaterUsage:", totWaterUsage); // console.log("totWaterUsage:", totWaterUsage);
const count = detailList ? detailList.length : 0; const count = detailList ? detailList.length : 0;
const avg = count == 0 ? 0 : totWaterUsage / count; // 일평균 유입량 const avg = count == 0 ? 0 : totWaterUsage / count; // 연간 하수유입량(m³/일)
item.waterUsage = parseFloat((avg * 0.65).toFixed(2)); // 물사용량 = 일평균 유입량 * 65% item.waterUsage = parseFloat((avg * 0.65).toFixed(2)); // 물사용량 = 연간 하수유입량(m³/일) * 65% : 실제 수용가의 물사용량 없는 경우
if (wtrUsgYearTotal > 0 && wtrUsgYearDays > 0) { if (wtrUsgYearTotal > 0 && wtrUsgYearDays > 0) {
item.waterUsage = wtrUsgYearDays > 0 ? wtrUsgYearTotal / wtrUsgYearDays : 0; // 일평균 물사용량 item.waterUsage = wtrUsgYearDays > 0 ? wtrUsgYearTotal / wtrUsgYearDays : 0; // 일평균 물사용량: 실제 수용가의 물사용량
} }
item.sewageInputYear = parseFloat(avg.toFixed(2)); // 연간 하수유입량(m³/일) item.sewageInputYear = parseFloat(avg.toFixed(2)); // 연간 하수유입량(m³/일)
item.sewageInputChungchun = parseFloat((chungcunSumFlow === 0 ? 0 : (chungcunSumFlow / sumChungcunDay)).toFixed(2)); // 청천시 하수유입량 item.sewageInputChungchun = parseFloat((chungcunSumFlow === 0 ? 0 : (chungcunSumFlow / sumChungcunDay)).toFixed(2)); // 청천시 하수유입량
item.estimationSewage = parseFloat((item.waterUsage * OSU_PERCENT).toFixed(2)); // 오수발생량 추정(m³/일) item.estimationSewage = parseFloat((item.waterUsage * OSU_PERCENT).toFixed(2)); // 오수발생량 추정(m³/일)
if (item.bscFctCd === '11200PB001R') { if (item.estimationSewage > maxEstimationSewage) maxEstimationSewage = item.estimationSewage;
console.log('chungcunSumFlow:', chungcunSumFlow); if (item.estimationSewage < minEstimationSewage) minEstimationSewage = item.estimationSewage;
console.log('sumChungcunDay:', sumChungcunDay);
}
// 반올림 처리 // 반올림 처리
["fctCpc", "waterUsage", "swageChangePercent", "estimationSewage", "sewageInputYear", "sewageInputChungchun"].forEach( ["fctCpc", "waterUsage", "swageChangePercent", "estimationSewage", "sewageInputYear", "sewageInputChungchun"].forEach(
(key) => (item[key] = roundNumber(item[key], 0)) (key) => (item[key] = roundNumber(item[key], 0))
@@ -427,93 +464,11 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
})); }));
} }
/* fetchSewageOccurList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm).then(async (res) => {
const excelDownList: ExcelType[] = [];
const data = res.data;
// Promise.all을 사용하여 모든 비동기 작업이 완료될 때까지 기다림
const calData = await Promise.all(data.map(async (item: SewageOccurProps) => {
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
item.sggNm = item.lclgvrnmntNm.split(' ')[1]?.toString() || '';
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.swageChangePercent = 90;
const bscFctCd = item.bscFctCd;
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as FlowResponse;
let sumChungcunDay = 0;
let chungcunSumFlow = 0;
let totWaterUsage = 0;
// 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일)
const rainEffectData = CalcRainEffect(res2.data);
rainEffectData.forEach((item: FlowDataItem) => {
if(Number(item.rainEffectDay) === 0){
chungcunSumFlow += Number(item.inflAmnt);
sumChungcunDay += 1;
}
totWaterUsage += Number(item.inflAmnt);
});
const avg = totWaterUsage /res2.count;
item.waterUsage = parseFloat((avg * 0.65).toFixed(2));
item.sewageInputYear = parseFloat(avg.toFixed(2));
item.sewageInputChungchun = parseFloat((chungcunSumFlow===0?0:(chungcunSumFlow / sumChungcunDay)).toFixed(2));
item.estimationSewage = parseFloat((item.waterUsage * (item.swageChangePercent/100)).toFixed(2));
return item;
}));
calData.forEach((item: SewageOccurProps) => {
DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'waterUsage', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'swageChangePercent', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'estimationSewage', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'sewageInputYear', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'sewageInputChungchun', item: item as unknown as Record<string, unknown> });
});
if(pageSize>5000){
calData.forEach((item: SewageOccurProps) => {
excelDownList.push({
시설코드: item.bscFctCd,
권역: item.rvbsn,
단위유역: item.lgbsn,
중권역: item.mdmbsn,
환경청: item.rgnNm,
시설명: item.bscFctNm,
시도: item.sidoNm,
시군구: item.sggNm,
주소: item.daddr,
"시설용량(m³/일)": item.fctCpc,
"물사용량(m³/일)": item.waterUsage,
"오수전환율(%)": item.swageChangePercent,
"오수발생량추정(m³/일)": item.estimationSewage,
"연간하수유입량(m³/일)": item.sewageInputYear,
"청천시하수유입량(m³/일)": item.sewageInputChungchun,
});
});
}
// 조회 데이터 설정
set((state: any) => ({
...state,
SewageOccur: pageSize<5000?{
...state.SewageOccur,
sewageOccurList: calData,
sewageOccurCount: res.count,
isLoading : false,
}:{
...state.SewageOccur,
excelList: excelDownList,
isLoading : false,
},
}))
}); */
}, },
searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string, startYm?: string, endYm?: string) => { searchSewageOccurDetailList: async (bscFctCd: string, searchYear: string, startYm?: string, endYm?: string) => {
const fcltCdList = [bscFctCd]; const fcltCdList = [bscFctCd];
const wtrUsgRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList); const wtrUsgRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList); // 수용가의 실제 물사용량
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear); const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
const monthData: SewageOccurDetailProps[] = []; const monthData: SewageOccurDetailProps[] = [];
let tot = 0, cnt = 0; let tot = 0, cnt = 0;
@@ -554,15 +509,15 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
} else { } else {
monthData[monthIdx] = { monthData[monthIdx] = {
cnt: 1, sum: Number(item.inflAmnt), yr: item.msrDt.substring(0, 4) cnt: 1, sum: Number(item.inflAmnt), yr: item.msrDt.substring(0, 4)
, usage: 0, cntWtrUsg: 0, sumWtrUsg: 0, avgWtrUsg: 0, monWtrUsg: 0 , usage: 0, cntWtrUsg: 0, sumWtrUsg: 0, avgWtrUsg: 0, monWtrUsg: 0, maxEstSewerage: 0, minEstSewerage: 999999999
}; };
} }
} }
tot += Number(item.inflAmnt) tot += Number(item.inflAmnt); // 연간 유입량
cnt++ cnt++
}); });
// 물사용량 // 수용가 실제 물사용량
let totWtrUsg = 0; let totWtrUsg = 0;
let cntWtrUsg = 0; let cntWtrUsg = 0;
if (wtrUsgRes && wtrUsgRes.data && wtrUsgRes.data[bscFctCd]) { if (wtrUsgRes && wtrUsgRes.data && wtrUsgRes.data[bscFctCd]) {
@@ -582,25 +537,23 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
const tableData: modalTableType[] = [] const tableData: modalTableType[] = []
let maxWaterUsage = 0; let maxWaterUsage = 0, minWaterUsage = 9999999999;
let minWaterUsage = 9999999999; let maxEstSewage = 0, minEstSewage = 9999999999;
let avgWaterUsage = 0; let avgWaterUsage = 0;
monthData.forEach((item, index) => { monthData.forEach((item, index) => {
item.avgWtrUsg = item.sum / item.cnt * 0.65; // 일평균 물사용량 = 일평균유입수 * 0.65 item.avgWtrUsg = item.sum / item.cnt * 0.65; // 일평균 물사용량 = 일평균유입수 * 0.65 : 수용가 실제 물사용량이 없으면
if (item.sumWtrUsg > 0 && item.cntWtrUsg > 0) item.avgWtrUsg = item.sumWtrUsg / item.cntWtrUsg; if (item.sumWtrUsg > 0 && item.cntWtrUsg > 0) item.avgWtrUsg = item.sumWtrUsg / item.cntWtrUsg; //수용가 실제 물사용량이 있는 경우
const estSewage = Math.round(item.avgWtrUsg * OSU_PERCENT * 1) / 1; // 오수발생량 추정
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.avgWtrUsg * 1) / 1, waterUsage: Math.round(item.avgWtrUsg * 1) / 1,
swageChangePercent: OSU_PERCENT * 100,//(Math.round((item.usage/item.usage*OSU_PERCENT) * 100) / 100) * 100, swageChangePercent: OSU_PERCENT * 100, //오수전환율 (Math.round((item.usage/item.usage*OSU_PERCENT) * 100) / 100) * 100,
estimationSewage: Math.round(item.avgWtrUsg * OSU_PERCENT * 1) / 1 estimationSewage: estSewage,
}) })
if (item.avgWtrUsg > maxWaterUsage) { if (item.avgWtrUsg > maxWaterUsage) maxWaterUsage = item.avgWtrUsg; // 물사용량 최대
maxWaterUsage = item.avgWtrUsg; if (item.avgWtrUsg < minWaterUsage) minWaterUsage = item.avgWtrUsg; // 물사용량 최소
} if (maxEstSewage < estSewage) maxEstSewage = estSewage; // 오수발생량 최대
if (minEstSewage > estSewage) minEstSewage = estSewage; // 오수발생량 최소
if (item.avgWtrUsg < minWaterUsage) {
minWaterUsage = item.avgWtrUsg;
}
}); });
avgWaterUsage = tot / cnt * 0.65 avgWaterUsage = tot / cnt * 0.65
@@ -617,13 +570,13 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
msrDt: '최대', msrDt: '최대',
waterUsage: roundNumber(Math.round(maxWaterUsage * 100) / 100, 0), waterUsage: roundNumber(Math.round(maxWaterUsage * 100) / 100, 0),
swageChangePercent: OSU_PERCENT * 100, swageChangePercent: OSU_PERCENT * 100,
estimationSewage: roundNumber(Math.round(maxWaterUsage * OSU_PERCENT * 1) / 1, 0), estimationSewage: roundNumber(maxEstSewage / 1, 0),
}, },
{ {
msrDt: '최소', msrDt: '최소',
waterUsage: roundNumber(Math.round(minWaterUsage * 100) / 100, 0), waterUsage: roundNumber(Math.round(minWaterUsage * 100) / 100, 0),
swageChangePercent: OSU_PERCENT * 100, swageChangePercent: OSU_PERCENT * 100,
estimationSewage: roundNumber(Math.round(minWaterUsage * OSU_PERCENT * 1) / 1, 0), estimationSewage: roundNumber(minEstSewage / 1, 0),
}, },
...tableData ...tableData
] ]
+21 -20
View File
@@ -42,8 +42,9 @@ import {
export type FoStore = CommonStore & tableType & DashBoardStore & ProcessFacilityStore & ProcessAreaStore & FlowRateSearchStore & FacilityPrecipitationStore & FacilityWaterQltyStore & PlanSewageStore & SewageOccurStore & UnderWaterStore & RdiStore; export type FoStore = CommonStore & tableType & DashBoardStore & ProcessFacilityStore & ProcessAreaStore & FlowRateSearchStore & FacilityPrecipitationStore & FacilityWaterQltyStore & PlanSewageStore & SewageOccurStore & UnderWaterStore & RdiStore;
export type FoState = CommonType & tableState & ProcessFacilityType & ProcessAreaType & FacilityPrecipitationType & FlowRateSearchType & DashBoardType & FacilityWaterQltyType & PlanSewageType & SewageOccurType & UnderWaterType & RdiType; export type FoState = CommonType & tableState & ProcessFacilityType & ProcessAreaType & FacilityPrecipitationType & FlowRateSearchType & DashBoardType & FacilityWaterQltyType & PlanSewageType & SewageOccurType & UnderWaterType & RdiType;
export const StoreZus = export const StoreZus =
(initState: FoState = { ...commonState, (initState: FoState = {
...commonState,
...tableStateExport ...tableStateExport
, ...processFacilityInitState , ...processFacilityInitState
, ...processAreaInitState , ...processAreaInitState
@@ -57,22 +58,22 @@ export const StoreZus =
, ...rdiInitState , ...rdiInitState
} }
) => { ) => {
return createStore<FoStore>()((set) => { return createStore<FoStore>()((set, get) => {
return { return {
...initState, ...initState,
...CommonReducer(set), ...CommonReducer(set),
...tableActionsExport(set), ...tableActionsExport(set),
...dashBoardReducer(set), ...dashBoardReducer(set, get),
...processFacilityReducer(set), ...processFacilityReducer(set),
...processAreaReducer(set), ...processAreaReducer(set),
...facilityPrecipitationReducer(set), ...facilityPrecipitationReducer(set),
...flowRateSearchReducer(set), ...flowRateSearchReducer(set),
...facilityWaterQltyReducer(set), ...facilityWaterQltyReducer(set),
...planSewageReducer(set), ...planSewageReducer(set),
...sewageOccurReducer(set), ...sewageOccurReducer(set),
...underWaterReducer(set), ...underWaterReducer(set),
...rdiReducer(set), ...rdiReducer(set),
} }
}) })
} }
//store 등록하는 부분 //store 등록하는 부분
+332 -303
View File
@@ -5,20 +5,21 @@ import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps, WtrUsgYmPro
// import CalcRainEffect from "@/app/components/common/CalcRainEffect"; // import CalcRainEffect from "@/app/components/common/CalcRainEffect";
import { OSU_PERCENT } from "../common"; import { OSU_PERCENT } from "../common";
import { fetchFacilityListInit } from "../processFacility"; import { fetchFacilityListInit } from "../processFacility";
import { getDaysInMonth } from "@/app/components/common/DataForm";
export type { TableUpperProps }; export type { TableUpperProps };
// SewageOccurDetailProps 타입을 여기에 정의 // SewageOccurDetailProps 타입을 여기에 정의
export type SewageOccurDetailProps = { export type SewageOccurDetailProps = {
cnt : number, cnt: number,
sum : number, sum: number,
yr:string, yr: string,
usage:number, // 일평균 유입량 usage: number, // 일평균 유입량
sunnyCnt : number, sunnyCnt: number,
sunnyInflAmnt : number, sunnyInflAmnt: number,
sunnyAvgInflAmnt : number, // 청천시 일평균 유입량 sunnyAvgInflAmnt: number, // 청천시 일평균 유입량
cntWtrUsg : number, // 물사용량 일자수 cntWtrUsg: number, // 물사용량 일자수
sumWtrUsg : number, // 물사용량 합 sumWtrUsg: number, // 물사용량 합
avgWtrUsg:number, // 일평균 물사용량 avgWtrUsg: number, // 일평균 물사용량
} }
/**==================================== /**====================================
* Store - 타입 * Store - 타입
@@ -35,145 +36,145 @@ export type SewageOccurDetailProps = {
/** /**
* (1) 메인페이지 * (1) 메인페이지
*/ */
// 검색단 // 검색단
const LabelArray:string[] = ['구분', '시도', '시군구','용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별']; const LabelArray: string[] = ['구분', '시도', '시군구', '용량별', '시설명', '조회기간', '시설상태', '권역', '단위유역', '중권역', '환경청별'];
// 리스트 헤더 // 리스트 헤더
const upHeadList1:TableUpperProps[] = [ const upHeadList1: TableUpperProps[] = [
{ id: "A", title: "행정구역", row:0, colSpan:2 }, { id: "A", title: "행정구역", row: 0, colSpan: 2 },
{ id: "sidoNm", title: "시도", row:1, widthPercent: 8 }, { id: "sidoNm", title: "시도", row: 1, widthPercent: 8 },
{ id: "sggNm", title: "시군구", row:1, widthPercent: 8 }, { id: "sggNm", title: "시군구", row: 1, widthPercent: 8 },
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, { id: "fctCpc", title: "시설용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 10 }, { id: "inflAmnt", title: "연평균유입하수량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "C", title: "지하수 유입량 추정", align: "right", row: 0, colSpan: 3 },
{ id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1, widthPercent: 8 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align: "right", row: 1, widthPercent: 8 },
{ id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1, widthPercent: 8 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align: "right", row: 1, widthPercent: 8 },
{ id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1, widthPercent: 8 }, { id: "underWaterInputWinter", title: "동절기\n(m³/일)", align: "right", row: 1, widthPercent: 8 },
{ id: "properYn", title: "적정여부", row:0, rowSpan:2, widthPercent: 8 }, { id: "properYn", title: "적정여부", row: 0, rowSpan: 2, widthPercent: 8 },
]; ];
const upHeadList2:TableUpperProps[] = [ const upHeadList2: TableUpperProps[] = [
{ id: "A", title: "유역", row:0, colSpan:3 }, { id: "A", title: "유역", row: 0, colSpan: 3 },
{ id: "rvbsn", title: "권역", row:1, widthPercent: 5 }, { id: "rvbsn", title: "권역", row: 1, widthPercent: 5 },
{ id: "lgbsn", title: "단위유역", row:1, widthPercent: 5 }, { id: "lgbsn", title: "단위유역", row: 1, widthPercent: 5 },
{ id: "mdmbsn", title: "중권역", row:1, widthPercent: 5 }, { id: "mdmbsn", title: "중권역", row: 1, widthPercent: 5 },
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 8 }, { id: "fctCpc", title: "시설용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 10 }, { id: "inflAmnt", title: "연평균유입하수량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "C", title: "지하수 유입량 추정", align: "right", row: 0, colSpan: 3 },
{ id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1, widthPercent: 8 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align: "right", row: 1, widthPercent: 8 },
{ id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1, widthPercent: 8 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align: "right", row: 1, widthPercent: 8 },
{ id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1, widthPercent: 8 }, { id: "underWaterInputWinter", title: "동절기\n(m³/일)", align: "right", row: 1, widthPercent: 8 },
{ id: "properYn", title: "적정여부", row:0, rowSpan:2, widthPercent: 8 }, { id: "properYn", title: "적정여부", row: 0, rowSpan: 2, widthPercent: 8 },
]; ];
const upHeadList3:TableUpperProps[] = [ const upHeadList3: TableUpperProps[] = [
{ id: "A", title: "유역", row:0, colSpan:3 }, { id: "A", title: "유역", row: 0, colSpan: 3 },
{ id: "rvbsn", title: "권역", upName:"upChangeRe1", upSequnce:1, row:1, widthPercent: 5 }, { id: "rvbsn", title: "권역", upName: "upChangeRe1", upSequnce: 1, row: 1, widthPercent: 5 },
{ id: "lgbsn", title: "단위유역", upName:"upChangeRe1", upSequnce:2, row:1, widthPercent: 5 }, { id: "lgbsn", title: "단위유역", upName: "upChangeRe1", upSequnce: 2, row: 1, widthPercent: 5 },
{ id: "mdmbsn", title: "중권역", upName:"upChangeRe1", upSequnce:3, row:1, widthPercent: 5 }, { id: "mdmbsn", title: "중권역", upName: "upChangeRe1", upSequnce: 3, row: 1, widthPercent: 5 },
{ id: "rgnNm", title: "환경청", row:0, rowSpan:2, widthPercent: 8 }, { id: "rgnNm", title: "환경청", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "B", title: "행정구역", row:0, colSpan:2 }, { id: "B", title: "행정구역", row: 0, colSpan: 2 },
{ id: "sidoNm", title: "시도", row:1, widthPercent: 6 }, { id: "sidoNm", title: "시도", row: 1, widthPercent: 6 },
{ id: "sggNm", title: "시군구", row:1, widthPercent: 6 }, { id: "sggNm", title: "시군구", row: 1, widthPercent: 6 },
{ id: "bscFctNm", title: "시설명", row:0, rowSpan:2, widthPercent: 8 }, { id: "bscFctNm", title: "시설명", row: 0, rowSpan: 2, widthPercent: 8 },
{ id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row: 0, rowSpan: 2 },
{ id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 6 }, { id: "fctCpc", title: "시설용량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 6 },
{ id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2, widthPercent: 10 }, { id: "inflAmnt", title: "연평균유입하수량(m³/일)", align: "right", row: 0, rowSpan: 2, widthPercent: 10 },
{ id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "C", title: "지하수 유입량 추정", align: "right", row: 0, colSpan: 3 },
{ id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1, widthPercent: 6}, { id: "underWaterInputYear", title: "연간\n(m³/일)", align: "right", row: 1, widthPercent: 6 },
{ id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1, widthPercent: 6 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align: "right", row: 1, widthPercent: 6 },
{ id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1, widthPercent: 6 }, { id: "underWaterInputWinter", title: "동절기\n(m³/일)", align: "right", row: 1, widthPercent: 6 },
{ id: "properYn", title: "적정여부", row:0, rowSpan:2, widthPercent: 6 }, { id: "properYn", title: "적정여부", row: 0, rowSpan: 2, widthPercent: 6 },
]; ];
// 모달 // 모달
const upHeadListUnderWaterDetail:TableUpperProps[] = [ const upHeadListUnderWaterDetail: TableUpperProps[] = [
{ id: "msrDt", title: "날짜" }, { id: "msrDt", title: "날짜" },
{ id: "realSewageInput", title: "청천시 실제 하수유입량\n(m³/일)", align:"right" }, { id: "realSewageInput", title: "청천시 실제 하수유입량\n(m³/일)", align: "right" },
{ id: "sewageOccur", title: "오수발생량\n(m³/일)", align:"right" }, { id: "sewageOccur", title: "오수발생량\n(m³/일)", align: "right" },
{ id: "underWaterInput", title: "지하수 유입량\n(m³/일)", align:"right" }, { id: "underWaterInput", title: "지하수 유입량\n(m³/일)", align: "right" },
]; ];
const underWaterList:UnderWaterProps[] = [ const underWaterList: UnderWaterProps[] = [
] ]
const underWaterDetailList:UnderWaterInputModalProps[] = [ const underWaterDetailList: UnderWaterInputModalProps[] = [
{ {
msrDt : "2024-01", msrDt: "2024-01",
realSewageInput : 178007, realSewageInput: 178007,
sewageOccur : 10.5, sewageOccur: 10.5,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-02", msrDt: "2024-02",
realSewageInput : 123007, realSewageInput: 123007,
sewageOccur : 10.7, sewageOccur: 10.7,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-03", msrDt: "2024-03",
realSewageInput : 213007, realSewageInput: 213007,
sewageOccur : 10.1, sewageOccur: 10.1,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-04", msrDt: "2024-04",
realSewageInput : 83007, realSewageInput: 83007,
sewageOccur : 9.57, sewageOccur: 9.57,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-05", msrDt: "2024-05",
realSewageInput : 15007, realSewageInput: 15007,
sewageOccur : 3.57, sewageOccur: 3.57,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-06", msrDt: "2024-06",
realSewageInput : 123007, realSewageInput: 123007,
sewageOccur : '', sewageOccur: '',
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-07", msrDt: "2024-07",
realSewageInput : 101007, realSewageInput: 101007,
sewageOccur : 1, sewageOccur: 1,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-08", msrDt: "2024-08",
realSewageInput : 103807, realSewageInput: 103807,
sewageOccur : 10.57, sewageOccur: 10.57,
underWaterInput : '', underWaterInput: '',
}, },
{ {
msrDt : "2024-09", msrDt: "2024-09",
realSewageInput : 9007, realSewageInput: 9007,
sewageOccur : 10.57, sewageOccur: 10.57,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-10", msrDt: "2024-10",
realSewageInput : 163007, realSewageInput: 163007,
sewageOccur : 10.57, sewageOccur: 10.57,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-11", msrDt: "2024-11",
realSewageInput : 123007, realSewageInput: 123007,
sewageOccur : 10.57, sewageOccur: 10.57,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
{ {
msrDt : "2024-12", msrDt: "2024-12",
realSewageInput : 1007, realSewageInput: 1007,
sewageOccur : 10.57, sewageOccur: 10.57,
underWaterInput : 80.6, underWaterInput: 80.6,
}, },
] ]
/**==================================== /**====================================
@@ -185,8 +186,8 @@ export interface FlowDataItem {
inflAmnt: number | string; inflAmnt: number | string;
infoRnDay: number; infoRnDay: number;
msrDt: string; msrDt: string;
rainEffectDay? : number; rainEffectDay?: number;
sumFlow? : number | string | ''; sumFlow?: number | string | '';
} }
export interface ApiResponse { export interface ApiResponse {
@@ -216,9 +217,9 @@ const fetchUnderWaterList = async (pageNo: number, pageSize: number, searchYear:
// } // }
// 시설들 유량 정보 조회 // 시설들 유량 정보 조회
export const fetchDetailListFlow = async (searchYear: string|undefined, fcltCdList: string[]): Promise<UnderWaterProps | null> => { export const fetchDetailListFlow = async (searchYear: string | undefined, fcltCdList: string[]): Promise<UnderWaterProps | null> => {
try { try {
const res = await postFetch('fo', '/fclt/flow/'+searchYear, fcltCdList); const res = await postFetch('fo', '/fclt/flow/' + searchYear, fcltCdList);
return res; return res;
} catch (error) { } catch (error) {
console.error('시설정보 오수발생량 상세 데이터를 가져오는데 실패했습니다:', error); console.error('시설정보 오수발생량 상세 데이터를 가져오는데 실패했습니다:', error);
@@ -226,9 +227,9 @@ export const fetchDetailListFlow = async (searchYear: string|undefined, fcltCdLi
} }
}; };
// 시설들 월별 물사용량 정보 조회 // 시설들 월별 물사용량 정보 조회
export const fetchWtrUsgYmList = async (searchYear: string|undefined, fcltCdList: string[]): Promise<WtrUsgYmProps | null> => { export const fetchWtrUsgYmList = async (searchYear: string | undefined, fcltCdList: string[]): Promise<WtrUsgYmProps | null> => {
try { try {
const res = await postFetch('fo', '/fclt/flow/wtrUsgYm/'+searchYear, fcltCdList); const res = await postFetch('fo', '/fclt/flow/wtrUsgYm/' + searchYear, fcltCdList);
return res; return res;
} catch (error) { } catch (error) {
console.error('시설들 월별 물사용량 데이터를 가져오는데 실패했습니다:', error); console.error('시설들 월별 물사용량 데이터를 가져오는데 실패했습니다:', error);
@@ -241,16 +242,16 @@ export const fetchWtrUsgYmList = async (searchYear: string|undefined, fcltCdList
====================================*/ ====================================*/
export type UnderWaterActions = { export type UnderWaterActions = {
searchUnderWaterList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void; searchUnderWaterList: (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => void;
unserWaterModal:(bscFctCd:string, searchYear:string, startYm:string, endYm:string)=>void underWaterModal: (bscFctCd: string, searchYear: string, startYm: string, endYm: string) => void
} }
export type UnderWaterType = { export type UnderWaterType = {
UnderWaterSearch: { UnderWaterSearch: {
isInit: boolean; isInit: boolean;
labelArray:string[]; labelArray: string[];
}, },
UnderWater : { UnderWater: {
isInit: boolean; isInit: boolean;
upHeadList1: TableUpperProps[]; upHeadList1: TableUpperProps[];
upHeadList2: TableUpperProps[]; upHeadList2: TableUpperProps[];
@@ -261,7 +262,7 @@ export type UnderWaterType = {
isLoading: boolean; isLoading: boolean;
}, },
UnderWaterDetail : { UnderWaterDetail: {
isInit: boolean; isInit: boolean;
upHeadListUnderWaterDetail: TableUpperProps[]; upHeadListUnderWaterDetail: TableUpperProps[];
gridListUnderWaterDetail: UnderWaterInputModalProps[]; gridListUnderWaterDetail: UnderWaterInputModalProps[];
@@ -274,30 +275,30 @@ export const underWaterInitState: UnderWaterType = {
labelArray: LabelArray, labelArray: LabelArray,
}, },
UnderWater : { UnderWater: {
isInit : false, isInit: false,
upHeadList1 : upHeadList1, upHeadList1: upHeadList1,
upHeadList2 : upHeadList2, upHeadList2: upHeadList2,
upHeadList3 : upHeadList3, upHeadList3: upHeadList3,
underWaterList : underWaterList, underWaterList: underWaterList,
underWaterCount : 4, underWaterCount: 4,
excelList : [], excelList: [],
isLoading : true, isLoading: true,
}, },
UnderWaterDetail : { UnderWaterDetail: {
isInit: false, isInit: false,
upHeadListUnderWaterDetail: upHeadListUnderWaterDetail, upHeadListUnderWaterDetail: upHeadListUnderWaterDetail,
gridListUnderWaterDetail: underWaterDetailList, gridListUnderWaterDetail: underWaterDetailList,
} }
} }
const dataFormSetting=(item : UnderWaterProps)=> { const dataFormSetting = (item: UnderWaterProps) => {
DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record<string, unknown> }); DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record<string, unknown> }); DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'underWaterInputYear', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'underWaterInputYear', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'underWaterInputSummer', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'underWaterInputSummer', item: item as unknown as Record<string, unknown> });
DataForm({ type: 'float0', column: 'underWaterInputWinter', item: item as unknown as Record<string, unknown>}); DataForm({ type: 'float0', column: 'underWaterInputWinter', item: item as unknown as Record<string, unknown> });
} }
// 병렬 처리 제한용 헬퍼 // 병렬 처리 제한용 헬퍼
@@ -310,47 +311,34 @@ const dataFormSetting=(item : UnderWaterProps)=> {
// } // }
// return results; // return results;
// } // }
/**
* yyyymm 형태의 문자열을 받아 해당 월의 일수를 반환
* @param {string} yyyymm - 예: "202502", "202412"
* @returns {number} 해당 월의 일수 (예: 28, 29, 30, 31)
*/
function getDaysInMonth(yyyymm) {
if (typeof yyyymm !== 'string' || yyyymm.length !== 6) {
throw new Error("입력은 'yyyymm' 형식의 문자열이어야 합니다. 예: '202502'");
}
const year = parseInt(yyyymm.slice(0, 4), 10); // "2025" -> 2025
const month = parseInt(yyyymm.slice(4, 6), 10); // "02" -> 2
if (isNaN(year) || isNaN(month) || month < 1 || month > 12) {
throw new Error("유효한 년/월이 아닙니다.");
}
// Date(year, month, 0) -> 전달의 마지막 날
// month에 '다음달'을 넣고, 일(day)에 0을 주면 해당 월의 마지막 날짜가 됨
return new Date(year, month, 0).getDate();
}
export type UnderWaterStore = UnderWaterType & UnderWaterActions; export type UnderWaterStore = UnderWaterType & UnderWaterActions;
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 facilityInitData = await fetchFacilityListInit(pageNo, pageSize, part, nameCd, fcltCpct, operationValue, fcltyNm); const facilityInitData = await fetchFacilityListInit(pageNo, pageSize, part, nameCd, fcltCpct, operationValue, fcltyNm);
if(pageSize < 5000){ if (pageSize < 5000) {
set((state: UnderWaterType) => ({ set((state: UnderWaterType) => ({
...state, ...state,
UnderWater: { UnderWater: {
...state.UnderWater, ...state.UnderWater,
underWaterList : facilityInitData.data, underWaterList: facilityInitData.data,
underWaterCount : facilityInitData.count, underWaterCount: facilityInitData.count,
isInit : true, isInit: true,
isLoading: true, isLoading: true,
}, },
})); }));
}else{ } else {
set((state: UnderWaterType) => ({ set((state: UnderWaterType) => ({
...state, ...state,
UnderWater: { UnderWater: {
@@ -359,43 +347,79 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
}, },
})); }));
} }
const fcltylist = facilityInitData.data; const fcltylist = facilityInitData.data;
const fcltCdList : string[] = []; // 시설코드목록 const fcltCdList: string[] = []; // 시설코드목록
const underWaterPropsList : UnderWaterProps[] = []; // 오수발생량시설목록 const underWaterPropsList: UnderWaterProps[] = []; // 오수발생량시설목록
fcltylist.forEach(item => { fcltylist.forEach(item => {
fcltCdList.push(item.bscFctCd); fcltCdList.push(item.bscFctCd);
underWaterPropsList.push({ underWaterPropsList.push({
bscFctCd : item.bscFctCd, bscFctCd: item.bscFctCd,
sidoNm : item.sido, sidoNm: item.sido,
sggNm : item.gugun, sggNm: item.gugun,
lclgvrnmntNm : '', lclgvrnmntNm: '',
bscFctNm : item.bscFctNm, bscFctNm: item.bscFctNm,
daddr : item.daddr, daddr: item.daddr,
fctCpc : parseFloat(item.fctCpc.toString().replace(/,/g, '')), fctCpc: parseFloat(item.fctCpc.toString().replace(/,/g, '')),
inflAmnt : 0, inflAmnt: 0,
waterUsage : 0, waterUsage: 0,
underWaterInputYear : 0, underWaterInputYear: 0,
underWaterInputSummer : 0, underWaterInputSummer: 0,
underWaterInputWinter : 0, underWaterInputWinter: 0,
properYn : '', properYn: '',
infoRnDay : 0, infoRnDay: 0,
rgnNm : item.rgnNm, rgnNm: item.rgnNm,
rvbsn : item.rvbsn, rvbsn: item.rvbsn,
lgbsn : item.lgbsn, lgbsn: item.lgbsn,
mdmbsn : item.mdmbsn, mdmbsn: item.mdmbsn,
msrDt : '', msrDt: '',
}); });
}); });
const soccurDetailRes : any = await fetchDetailListFlow(searchYear, fcltCdList); // const soccurDetailRes: any = await fetchDetailListFlow(searchYear, fcltCdList);
const wtrUsgYmRes : any = await fetchWtrUsgYmList(searchYear, fcltCdList); // const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
//---------
const rainDetailList: Record<string, any[]> = {};
const wtrDetailList: Record<string, any[]> = {};
const results: any[] = [];
const wtrResults: any[] = [];
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
const slicedItems = fcltCdList.slice(idx, idx + 100);
const result = await fetchDetailListFlow(searchYear, slicedItems);
const wtrResult = await fetchWtrUsgYmList(searchYear, slicedItems);
results.push(result);
wtrResults.push(wtrResult);
}
//console.log(results);
// 결과를 합치기
for (const res of results) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
//rainDetailList[keyStr] = [...(rainDetailList[keyStr] || []), ...(value as any[])];
if (!rainDetailList[keyStr]) rainDetailList[keyStr] = [];
rainDetailList[keyStr].push(...(value as any[]));
}
}
}
for (const res of wtrResults) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
// wtrDetailList[keyStr] = [...(wtrDetailList[keyStr] || []), ...(value as any[])];
if (!wtrDetailList[keyStr]) wtrDetailList[keyStr] = [];
wtrDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
for (const item of underWaterPropsList) { for (const item of underWaterPropsList) {
const detailList = soccurDetailRes?.data[item.bscFctCd]; // const detailList = soccurDetailRes?.data[item.bscFctCd];
const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd]; // const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd];
const detailList = rainDetailList[item.bscFctCd];
const wtrUsgYmList = wtrDetailList[item.bscFctCd];
let chungcunSumFlow = 0; // 청천유입량 let chungcunSumFlow = 0; // 청천유입량
let sumChungcunDay = 0; // 청천일수 let sumChungcunDay = 0; // 청천일수
let sumSummerChungcunDay = 0; // 하절기 청천일수 let sumSummerChungcunDay = 0; // 하절기 청천일수
@@ -407,39 +431,39 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
let totWinterUsage = 0; // 동절기 하수유입량 let totWinterUsage = 0; // 동절기 하수유입량
let totSummerDays = 0; // 하절기 일수 let totSummerDays = 0; // 하절기 일수
let totWinterDays = 0; // 동절기 일수 let totWinterDays = 0; // 동절기 일수
const summerMonth = ['06', '07', '08']; const summerMonth = ['06', '07', '08'];
const winterMonth = ['01', '02']; const winterMonth = ['01', '02'];
let rainEffectDay = 0; let rainEffectDay = 0;
detailList?.forEach(item2 => { detailList?.forEach(item2 => {
if (item2.infoRnDay == null || item2.infoRnDay.trim() == 'x') item2.infoRnDay = 0; if (item2.infoRnDay == null || item2.infoRnDay.trim() == 'x') item2.infoRnDay = 0;
if(Number(item2.infoRnDay) >= 3) { if (Number(item2.infoRnDay) >= 3) {
rainEffectDay = 2; rainEffectDay = 2;
}else{ } else {
rainEffectDay--; rainEffectDay--;
} }
if(rainEffectDay<0){ //청천시 if (rainEffectDay < 0) { //청천시
chungcunSumFlow += Number(item2.inflAmnt); chungcunSumFlow += Number(item2.inflAmnt);
sumChungcunDay += 1; sumChungcunDay += 1;
if(item2.msrDt.substring(4,6) ==='06' || item2.msrDt.substring(4,6) ==='07' || item2.msrDt.substring(4,6) ==='08'){ if (item2.msrDt.substring(4, 6) === '06' || item2.msrDt.substring(4, 6) === '07' || item2.msrDt.substring(4, 6) === '08') {
// 하절기 6,7,8월 // 하절기 6,7,8월
sumSummerChungcunDay += 1; sumSummerChungcunDay += 1;
sumSummerChungcunFlow += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0; sumSummerChungcunFlow += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;
}else if(item2.msrDt.substring(4,6) ==='01' || item2.msrDt.substring(4,6) ==='02'){ } else if (item2.msrDt.substring(4, 6) === '01' || item2.msrDt.substring(4, 6) === '02') {
// 동절기 1,2월 // 동절기 1,2월
sumWinterChungcunDay += 1; sumWinterChungcunDay += 1;
sumWinterChungcunFlow += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0; sumWinterChungcunFlow += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;
} }
} }
totWaterUsage += Number(item2.inflAmnt); totWaterUsage += Number(item2.inflAmnt);
if(item2.msrDt.substring(4,6) ==='06' || item2.msrDt.substring(4,6) ==='07' || item2.msrDt.substring(4,6) ==='08'){ if (item2.msrDt.substring(4, 6) === '06' || item2.msrDt.substring(4, 6) === '07' || item2.msrDt.substring(4, 6) === '08') {
// 하절기 6,7,8월 // 하절기 6,7,8월
totSummerDays += 1; totSummerDays += 1;
totSummerUsage += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0; totSummerUsage += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;
}else if(item2.msrDt.substring(4,6) ==='01' || item2.msrDt.substring(4,6) ==='02'){ } else if (item2.msrDt.substring(4, 6) === '01' || item2.msrDt.substring(4, 6) === '02') {
// 동절기 1,2월 // 동절기 1,2월
totWinterDays += 1; totWinterDays += 1;
totWinterUsage += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0; totWinterUsage += Number(item2.inflAmnt); //item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;
@@ -447,8 +471,8 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
}); });
const count = detailList ? detailList.length : 0; const count = detailList ? detailList.length : 0;
const avg = count == 0 ? 0 : totWaterUsage / count; // 일평균 유입량 const avg = count == 0 ? 0 : totWaterUsage / count; // 연간 일평균 유입량
let wtrUsgYearTotal = 0; // 연간 물사용량 let wtrUsgYearTotal = 0; // 연간 물사용량
let summerWtrUsgTot = 0; // 하절기 물사용량 let summerWtrUsgTot = 0; // 하절기 물사용량
let winterWtrUsgTot = 0; // 동절기 물사용량 let winterWtrUsgTot = 0; // 동절기 물사용량
@@ -459,52 +483,52 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
const days = getDaysInMonth(item3.levyYm); const days = getDaysInMonth(item3.levyYm);
wtrUsgYearTotal += Number(item3.wtrUsg); wtrUsgYearTotal += Number(item3.wtrUsg);
wtrUsgYearDays += days; wtrUsgYearDays += days;
if(summerMonth.includes(item3.levyYm.slice(-2))){ if (summerMonth.includes(item3.levyYm.slice(-2))) {
summerWtrUsgTot += Number(item3.wtrUsg); summerWtrUsgTot += Number(item3.wtrUsg);
summerWtrUsgDays += days; summerWtrUsgDays += days;
}else if(winterMonth.includes(item3.levyYm.slice(-2))){ } else if (winterMonth.includes(item3.levyYm.slice(-2))) {
winterWtrUsgTot += Number(item3.wtrUsg); winterWtrUsgTot += Number(item3.wtrUsg);
winterWtrUsgDays += days; winterWtrUsgDays += days;
} }
}); });
if (wtrUsgYearTotal > 0) { // 물사용량이 있는 경우 if (wtrUsgYearTotal > 0) { // 물사용량이 있는 경우
const usage = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / sumChungcunDay:0; // 청천시 일평균 유입량 const usage = chungcunSumFlow && chungcunSumFlow > 0 ? chungcunSumFlow / sumChungcunDay : 0; // 청천시 일평균 유입량
const summerUsage = sumSummerChungcunFlow?sumSummerChungcunFlow / sumSummerChungcunDay:0; // 하절기 청천시 일평균 유입량 const summerUsage = sumSummerChungcunFlow ? sumSummerChungcunFlow / sumSummerChungcunDay : 0; // 하절기 청천시 일평균 유입량
const winterUsage = sumWinterChungcunFlow?sumWinterChungcunFlow / sumWinterChungcunDay:0; // 동절기 청천시 일평균 유입량 const winterUsage = sumWinterChungcunFlow ? sumWinterChungcunFlow / sumWinterChungcunDay : 0; // 동절기 청천시 일평균 유입량
const wtrUsg = wtrUsgYearDays>0? wtrUsgYearTotal / wtrUsgYearDays: 0; // 일평균 물사용량 const wtrUsg = wtrUsgYearDays > 0 ? wtrUsgYearTotal / wtrUsgYearDays : 0; // 일평균 물사용량
const summerWtrUsg = summerWtrUsgTot?summerWtrUsgTot / summerWtrUsgDays:0; // 하절기 일평균 물사용량 const summerWtrUsg = summerWtrUsgTot ? summerWtrUsgTot / summerWtrUsgDays : 0; // 하절기 일평균 물사용량
const winterWtrUsg = winterWtrUsgTot?winterWtrUsgTot / winterWtrUsgDays:0; // 동절기 일평균 물사용량 const winterWtrUsg = winterWtrUsgTot ? winterWtrUsgTot / winterWtrUsgDays : 0; // 동절기 일평균 물사용량
item.inflAmnt = roundNumber(avg, 0); item.inflAmnt = roundNumber(avg, 0);
item.underWaterInputYear = Math.round((usage-(wtrUsg*OSU_PERCENT)) * 1) / 1; // 연간지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율) item.underWaterInputYear = Math.round((usage - (wtrUsg * OSU_PERCENT)) * 1) / 1; // 연간지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율)
item.underWaterInputSummer = Math.round((summerUsage-(summerWtrUsg*OSU_PERCENT)) * 1) / 1; // 하절기지하수유입량(m³/일) item.underWaterInputSummer = Math.round((summerUsage - (summerWtrUsg * OSU_PERCENT)) * 1) / 1; // 하절기지하수유입량(m³/일)
item.underWaterInputWinter = Math.round((winterUsage-(winterWtrUsg*OSU_PERCENT)) * 1) / 1; // 동절기지하수유입량(m³/일) item.underWaterInputWinter = Math.round((winterUsage - (winterWtrUsg * OSU_PERCENT)) * 1) / 1; // 동절기지하수유입량(m³/일)
item.properYn = Math.round( (Number(usage-(wtrUsg*OSU_PERCENT)) / Number(item.inflAmnt)) * 100 * 1 ) / 1 > 20?'초과유입':'적정'; // 적정여부 item.properYn = Math.round((Number(usage - (wtrUsg * OSU_PERCENT)) / Number(item.inflAmnt)) * 100 * 1) / 1 > 20 ? '초과유입' : '적정'; // 적정여부
} else { // 물사용량이 없는 경우, 일평균 유입량으로 물사용량 추정(물사용량 = 유입량*0.65) } else { // 물사용량이 없는 경우, 일평균 유입량으로 물사용량 추정(물사용량 = 유입량*0.65)
const usage = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / sumChungcunDay:0; // 청천시 일평균 유입량 const usage = chungcunSumFlow && chungcunSumFlow > 0 ? chungcunSumFlow / sumChungcunDay : 0; // 청천시 일평균 유입량
const summerUsage = sumSummerChungcunFlow?sumSummerChungcunFlow / sumSummerChungcunDay:0; // 하절기 청천시 일평균 유입량 const summerUsage = sumSummerChungcunFlow ? sumSummerChungcunFlow / sumSummerChungcunDay : 0; // 하절기 청천시 일평균 유입량
const winterUsage = sumWinterChungcunFlow?sumWinterChungcunFlow / sumWinterChungcunDay:0; // 동절기 청천시 일평균 유입량 const winterUsage = sumWinterChungcunFlow ? sumWinterChungcunFlow / sumWinterChungcunDay : 0; // 동절기 청천시 일평균 유입량
const wtrUsg = avg * 0.65; // 일평균 물사용량 const wtrUsg = avg * 0.65; // 일평균 물사용량
const summerWtrUsg = totSummerDays>0? (totSummerUsage / totSummerDays)*0.65:0; // 하절기 일평균 물사용량 const summerWtrUsg = totSummerDays > 0 ? (totSummerUsage / totSummerDays) * 0.65 : 0; // 하절기 일평균 물사용량
const winterWtrUsg = totWinterDays>0? (totWinterUsage / totWinterDays)*0.65:0; // 동절기 일평균 물사용량 const winterWtrUsg = totWinterDays > 0 ? (totWinterUsage / totWinterDays) * 0.65 : 0; // 동절기 일평균 물사용량
item.inflAmnt = roundNumber(avg, 0); item.inflAmnt = roundNumber(avg, 0);
//item.underWaterInputYear = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 1) / 1; // 연간지하수유입량(m³/일) //item.underWaterInputYear = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 1) / 1; // 연간지하수유입량(m³/일)
item.underWaterInputYear = Math.round((usage-(wtrUsg*OSU_PERCENT)) * 1) / 1; // 연간지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율) item.underWaterInputYear = Math.round((usage - (wtrUsg * OSU_PERCENT)) * 1) / 1; // 연간지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율)
item.underWaterInputSummer = Math.round((summerUsage-(summerWtrUsg*OSU_PERCENT)) * 1) / 1; // 하절기지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율) item.underWaterInputSummer = Math.round((summerUsage - (summerWtrUsg * OSU_PERCENT)) * 1) / 1; // 하절기지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율)
item.underWaterInputWinter = Math.round((winterUsage-(winterWtrUsg*OSU_PERCENT)) * 1) / 1; // 동절기지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율) item.underWaterInputWinter = Math.round((winterUsage - (winterWtrUsg * OSU_PERCENT)) * 1) / 1; // 동절기지하수유입량(m³/일) = 청천시 실제유입량 - (물사용량 × 오수전환율)
item.properYn = Math.round( (Number(usage-(wtrUsg*OSU_PERCENT)) / Number(item.inflAmnt)) * 100 * 1 ) / 1 > 20?'초과유입':'적정'; // 적정여부 item.properYn = Math.round((Number(usage - (wtrUsg * OSU_PERCENT)) / Number(item.inflAmnt)) * 100 * 1) / 1 > 20 ? '초과유입' : '적정'; // 적정여부
// 반올림 처리 // 반올림 처리
// ["fctCpc", "inflAmnt", "underWaterInputYear", "underWaterInputSummer", "underWaterInputWinter"].forEach( // ["fctCpc", "inflAmnt", "underWaterInputYear", "underWaterInputSummer", "underWaterInputWinter"].forEach(
// (key) => (item[key] = roundNumber(item[key], 0)) // (key) => (item[key] = roundNumber(item[key], 0))
// ); // );
} }
} }
if(pageSize>= 5000){ if (pageSize >= 5000) {
const excelDownList: ExcelType[] = []; const excelDownList: ExcelType[] = [];
underWaterPropsList.forEach((item : any) => { underWaterPropsList.forEach((item: any) => {
dataFormSetting(item) dataFormSetting(item)
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, '')); item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
excelDownList.push({ excelDownList.push({
@@ -530,10 +554,10 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
UnderWater: { UnderWater: {
...state.UnderWater, ...state.UnderWater,
excelList: excelDownList, excelList: excelDownList,
isLoading : false, isLoading: false,
}, },
})); }));
}else{ } else {
set((state: UnderWaterType) => ({ set((state: UnderWaterType) => ({
...state, ...state,
UnderWater: { UnderWater: {
@@ -541,21 +565,21 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
underWaterList: underWaterPropsList, underWaterList: underWaterPropsList,
underWaterCount: facilityInitData.count, underWaterCount: facilityInitData.count,
excelList: [], excelList: [],
isLoading : false, isLoading: false,
}, },
})); }));
} }
}, },
unserWaterModal:async (bscFctCd, searchYear, startYm, endYm)=>{ underWaterModal: async (bscFctCd, searchYear, startYm, endYm) => {
const fcltCdList = [bscFctCd]; const fcltCdList = [bscFctCd];
const wtrUsgRes : any = await fetchWtrUsgYmList(searchYear, fcltCdList); const wtrUsgRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear); const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear);
const monthData: SewageOccurDetailProps[] = []; const monthData: SewageOccurDetailProps[] = [];
let tot = 0, cnt = 0; let tot = 0, cnt = 0;
let sunnyTot = 0, sunnyCnt = 0; let sunnyTot = 0, sunnyCnt = 0;
if(startYm) { if (startYm) {
res.data = res.data.filter((item: FlowDataItem) => { res.data = res.data.filter((item: FlowDataItem) => {
const month = item.msrDt?.substring(0, 6); const month = item.msrDt?.substring(0, 6);
return month >= startYm; return month >= startYm;
@@ -567,7 +591,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
}); });
} }
} }
if(endYm) { if (endYm) {
res.data = res.data.filter((item: FlowDataItem) => { res.data = res.data.filter((item: FlowDataItem) => {
const month = item.msrDt?.substring(0, 6); const month = item.msrDt?.substring(0, 6);
return month <= endYm; return month <= endYm;
@@ -582,36 +606,40 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
let rainEffectDay = 0; let rainEffectDay = 0;
res.data?.forEach(item2 => { res.data?.forEach(item2 => {
if (item2.infoRnDay == null || item2.infoRnDay.trim() == 'x') item2.infoRnDay = 0; if (item2.infoRnDay == null || item2.infoRnDay.trim() == 'x') item2.infoRnDay = 0;
if(Number(item2.infoRnDay) >= 3) { if (Number(item2.infoRnDay) >= 3) {
rainEffectDay = 2; rainEffectDay = 2;
}else{ } else {
rainEffectDay--; rainEffectDay--;
} }
const month = item2.msrDt?.substring(4, 6); const month = item2.msrDt?.substring(4, 6);
const monthIdx = month ? Number(month) - 1 : -1; const monthIdx = month ? Number(month) - 1 : -1;
if (monthIdx >= 0 && (monthIdx>=Number(startYm.substring(4,6))-1 && monthIdx <= Number(endYm.substring(4, 6))-1)) { if (monthIdx >= 0 && (monthIdx >= Number(startYm.substring(4, 6)) - 1 && monthIdx <= Number(endYm.substring(4, 6)) - 1)) {
if (typeof monthData[monthIdx] === 'object') { if (typeof monthData[monthIdx] === 'object') {
monthData[monthIdx].sum += Number(item2.inflAmnt); // 유입량 합 monthData[monthIdx].sum += Number(item2.inflAmnt); // 유입량 합
monthData[monthIdx].cnt++; monthData[monthIdx].cnt++;
} else { } else {
monthData[monthIdx] = {cnt:1, sum:Number(item2.inflAmnt), yr:item2.msrDt.substring(0,4) monthData[monthIdx] = {
, usage:0, sunnyCnt:0, sunnyInflAmnt:0, sunnyAvgInflAmnt: 0, cntWtrUsg:0, sumWtrUsg:0, avgWtrUsg:0}; cnt: 1, sum: Number(item2.inflAmnt), yr: item2.msrDt.substring(0, 4)
, usage: 0, sunnyCnt: 0, sunnyInflAmnt: 0, sunnyAvgInflAmnt: 0, cntWtrUsg: 0, sumWtrUsg: 0, avgWtrUsg: 0
};
} }
} }
if(month >= startYm.substring(4, 6) && month <= endYm.substring(4, 6)){ if (month >= startYm.substring(4, 6) && month <= endYm.substring(4, 6)) {
cnt++; cnt++;
tot += item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0; tot += item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;
} }
if(rainEffectDay<0) { // 청천시 if (rainEffectDay < 0) { // 청천시
if (typeof monthData[monthIdx] === 'object') { if (typeof monthData[monthIdx] === 'object') {
monthData[monthIdx].sunnyInflAmnt += Number(item2.inflAmnt); // 청천 유입량 합 monthData[monthIdx].sunnyInflAmnt += Number(item2.inflAmnt); // 청천 유입량 합
monthData[monthIdx].sunnyCnt++; monthData[monthIdx].sunnyCnt++;
}else { } else {
monthData[monthIdx] = {cnt:1, sum:Number(item2.inflAmnt), yr:item2.msrDt.substring(0,4) monthData[monthIdx] = {
, usage:0, sunnyCnt:0, sunnyInflAmnt:0, sunnyAvgInflAmnt: 0, cntWtrUsg:0, sumWtrUsg:0, avgWtrUsg:0}; cnt: 1, sum: Number(item2.inflAmnt), yr: item2.msrDt.substring(0, 4)
, usage: 0, sunnyCnt: 0, sunnyInflAmnt: 0, sunnyAvgInflAmnt: 0, cntWtrUsg: 0, sumWtrUsg: 0, avgWtrUsg: 0
};
} }
if (month >= startYm.substring(4, 6) && month <= endYm.substring(4, 6)){ if (month >= startYm.substring(4, 6) && month <= endYm.substring(4, 6)) {
sunnyCnt++; sunnyCnt++;
sunnyTot += item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0; sunnyTot += item2.inflAmnt && item2.inflAmnt !== 'x' ? Number(item2.inflAmnt.toString().trim()) : 0;
} }
@@ -630,77 +658,78 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy
if (typeof monthData[monthIdx] === 'object') { if (typeof monthData[monthIdx] === 'object') {
monthData[monthIdx].sumWtrUsg += Number(item.wtrUsg); monthData[monthIdx].sumWtrUsg += Number(item.wtrUsg);
monthData[monthIdx].cntWtrUsg += days; monthData[monthIdx].cntWtrUsg += days;
} }
} }
totWtrUsg += Number(item.wtrUsg); totWtrUsg += Number(item.wtrUsg);
cntWtrUsg += days; cntWtrUsg += days;
}); });
} }
const tableData:UnderWaterInputModalProps[] = [] const tableData: UnderWaterInputModalProps[] = []
let maxWaterUsage = 0; let maxWaterUsage = 0, minWaterUsage = 9999999999, avgWaterUsage = 0; // 물사용량
let minWaterUsage = 9999999999; let maxSunnyInflAmnt = 0, minSunnyInflAmnt = 9999999999, avgSunnyInflAmnt = 0; // 청천 유입량
let avgWaterUsage = 0; let maxUnderWaterInput = 0, minUnderWaterInput = 9999999999; // 지하수 유입량
let maxSunnyInflAmnt = 0;
let minSunnyInflAmnt = 9999999999;
let avgSunnyInflAmnt = 0;
monthData.forEach((item, index) => { monthData.forEach((item, index) => {
item.usage = item.sum/item.cnt; // 일평균 유입량 item.usage = item.sum / item.cnt; // 일평균 유입량
item.avgWtrUsg = item.sum/item.cnt * 0.65; // 일평균 물사용량 item.avgWtrUsg = item.sum / item.cnt * 0.65; // 일평균 물사용량 : 수용가 물사용량이 없는 경우
if (item.sumWtrUsg > 0 && item.cntWtrUsg > 0) item.avgWtrUsg = item.sumWtrUsg / item.cntWtrUsg; // 일평균 물사용량 // 일평균 물사용량 : 수용가 물사용량이 있는 경우
if (item.sumWtrUsg > 0 && item.cntWtrUsg > 0) item.avgWtrUsg = item.sumWtrUsg / item.cntWtrUsg;
item.sunnyAvgInflAmnt = item.sunnyInflAmnt / item.sunnyCnt; // 청천 일평균 유입량 item.sunnyAvgInflAmnt = item.sunnyInflAmnt / item.sunnyCnt; // 청천 일평균 유입량
const underWtrInput = Math.round((item.sunnyAvgInflAmnt - (item.avgWtrUsg * OSU_PERCENT)) * 1) / 1; // 지하수 유입량 평균
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.sunnyAvgInflAmnt*1) /1, // 청천 실제 하수유입량 realSewageInput: Math.round(item.sunnyAvgInflAmnt * 1) / 1, // 청천 실제 하수유입량
sewageOccur:Math.round(item.avgWtrUsg*OSU_PERCENT * 1) / 1,// 오수발생량 sewageOccur: Math.round(item.avgWtrUsg * OSU_PERCENT * 1) / 1,// 오수발생량
underWaterInput:Math.round((item.sunnyAvgInflAmnt-(item.avgWtrUsg*OSU_PERCENT)) * 1) / 1, // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율) underWaterInput: underWtrInput, // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)
}) })
if (item.avgWtrUsg > maxWaterUsage) maxWaterUsage = item.avgWtrUsg; if (item.avgWtrUsg > maxWaterUsage) maxWaterUsage = item.avgWtrUsg;
if (item.sunnyAvgInflAmnt > maxSunnyInflAmnt) maxSunnyInflAmnt = item.sunnyAvgInflAmnt; if (item.sunnyAvgInflAmnt > maxSunnyInflAmnt) maxSunnyInflAmnt = item.sunnyAvgInflAmnt;
if (item.avgWtrUsg < minWaterUsage) minWaterUsage = item.avgWtrUsg; if (item.avgWtrUsg < minWaterUsage) minWaterUsage = item.avgWtrUsg;
if (item.sunnyAvgInflAmnt < minSunnyInflAmnt) minSunnyInflAmnt = item.sunnyAvgInflAmnt; if (item.sunnyAvgInflAmnt < minSunnyInflAmnt) minSunnyInflAmnt = item.sunnyAvgInflAmnt;
if (underWtrInput > maxUnderWaterInput) maxUnderWaterInput = underWtrInput;
if (underWtrInput < minUnderWaterInput) minUnderWaterInput = underWtrInput;
}); });
if(monthData.length == 0){ if (monthData.length == 0) {
maxWaterUsage = 0; minWaterUsage = 0; avgWaterUsage = 0; maxWaterUsage = 0; minWaterUsage = 0; avgWaterUsage = 0;
maxSunnyInflAmnt = 0; minSunnyInflAmnt = 0; avgSunnyInflAmnt = 0; maxSunnyInflAmnt = 0; minSunnyInflAmnt = 0; avgSunnyInflAmnt = 0;
} }
avgWaterUsage = cnt>0? tot/cnt * 0.65:0; // 일평균 물사용량
if (totWtrUsg > 0 && cntWtrUsg > 0) avgWaterUsage = totWtrUsg / cntWtrUsg; // 일평균 물사용량
avgSunnyInflAmnt = (sunnyCnt>0)?sunnyTot/sunnyCnt:0; // 청천 일평균 유입량
const newData= [ avgWaterUsage = cnt > 0 ? tot / cnt * 0.65 : 0; // 일평균 물사용량
{ if (totWtrUsg > 0 && cntWtrUsg > 0) avgWaterUsage = totWtrUsg / cntWtrUsg; // 일평균 물사용량
msrDt: '평균', avgSunnyInflAmnt = (sunnyCnt > 0) ? sunnyTot / sunnyCnt : 0; // 청천 일평균 유입량
realSewageInput:Math.round(avgSunnyInflAmnt*1) /1, // 청천시 실제 하수유입량
sewageOccur:Math.round(avgWaterUsage*OSU_PERCENT * 1) / 1, // 오수발생량 const newData = [
underWaterInput: Math.round((avgSunnyInflAmnt-(avgWaterUsage*OSU_PERCENT)) * 1) / 1 // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율) {
//underWaterInput:Math.round((avgWaterUsage-(avgWaterUsage*0.65*0.8)) * 100) / 100, msrDt: '평균',
}, realSewageInput: Math.round(avgSunnyInflAmnt * 1) / 1, // 청천시 실제 하수유입량
{ sewageOccur: Math.round(avgWaterUsage * OSU_PERCENT * 1) / 1, // 오수발생량
msrDt: '최대', underWaterInput: Math.round((avgSunnyInflAmnt - (avgWaterUsage * OSU_PERCENT)) * 1) / 1 // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)
realSewageInput: Math.round(maxSunnyInflAmnt*1) /1, // 청천시 실제 하수유입량 //underWaterInput:Math.round((avgWaterUsage-(avgWaterUsage*0.65*0.8)) * 100) / 100,
sewageOccur: Math.round(maxWaterUsage*OSU_PERCENT * 1) / 1, // 오수발생량 },
underWaterInput: Math.round((maxSunnyInflAmnt-(maxWaterUsage*OSU_PERCENT)) * 1) / 1, // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율) {
}, msrDt: '최대',
{ realSewageInput: Math.round(maxSunnyInflAmnt * 1) / 1, // 청천시 실제 하수유입량
msrDt: '최소', sewageOccur: Math.round(maxWaterUsage * OSU_PERCENT * 1) / 1, // 오수발생량
realSewageInput: Math.round(minSunnyInflAmnt*1) /1, // 청천시 실제 하수유입량 underWaterInput: maxUnderWaterInput, // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)
sewageOccur: Math.round(minWaterUsage*OSU_PERCENT * 1) / 1, // 오수발생량 },
underWaterInput: Math.round((minSunnyInflAmnt-(minWaterUsage*OSU_PERCENT)) * 1) / 1, // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율) {
}, msrDt: '최소',
...tableData realSewageInput: Math.round(minSunnyInflAmnt * 1) / 1, // 청천시 실제 하수유입량
sewageOccur: Math.round(minWaterUsage * OSU_PERCENT * 1) / 1, // 오수발생량
underWaterInput: minUnderWaterInput, // 지하수 유입량 : 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)
},
...tableData
] ]
set((state: UnderWaterType) => ({ set((state: UnderWaterType) => ({
...state, ...state,
UnderWaterDetail: { UnderWaterDetail: {
...state.UnderWaterDetail, ...state.UnderWaterDetail,
gridListUnderWaterDetail:newData gridListUnderWaterDetail: newData
} }
})) }))
} }
} }
} }
@@ -1,3 +1,4 @@
"use client";
import { createContext, useState } from "react"; import { createContext, useState } from "react";
interface PromptContext { interface PromptContext {
+1 -1
View File
@@ -5,7 +5,7 @@ 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_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302
NEXT_PUBLIC_SUB_DOMAIN = http://con.mind-one.co.kr:11300 NEXT_PUBLIC_SUB_DOMAIN = http://con.mind-one.co.kr:13000
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/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
@@ -27,7 +27,8 @@ export const MsSwagePplCol = [
// { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, // { id: 'ftre_smbol_cd', title: '지형지물부호코드' },
// { id: 'lyrTypeNm', title: '레이어타입명' }, // { id: 'lyrTypeNm', title: '레이어타입명' },
] ]
export const MsSwagePplCol2 = [ // 하수관로 searchModal 기본정보tab
export const MsSwagePplCol2 = [
{ id: 'rowNumber', title: '일련\n번호' }, { id: 'rowNumber', title: '일련\n번호' },
{ id: 'fcltMngNo', title: '시설\n관리번호' }, { id: 'fcltMngNo', title: '시설\n관리번호' },
{ id: 'instMngNo', title: '기관\n관리번호' }, { id: 'instMngNo', title: '기관\n관리번호' },
@@ -44,13 +45,13 @@ export const MsSwagePplCol2 = [
{ id: 'tmptMhlMngNo', title: '시점맨홀\n관리번호' }, { id: 'tmptMhlMngNo', title: '시점맨홀\n관리번호' },
{ id: 'scendDpth', title: '종점깊이\n(m)' }, { id: 'scendDpth', title: '종점깊이\n(m)' },
{ id: 'scendMhlMngNo', title: '종점맨홀\n관리번호' }, { id: 'scendMhlMngNo', title: '종점맨홀\n관리번호' },
// { id: 'vrtcLen', title: '세로길이\n(m)' }, { id: 'vrtcLen', title: '세로길이\n(m)' },
// { id: 'wdthLen', title: '가로길이\n(m)' }, { id: 'wdthLen', title: '가로길이\n(m)' },
// { id: 'fcltyShpCd', title: '시설물형태코드' }, { id: 'fcltyShpCd', title: '시설물형태코드' },
// { id: 'fid', title: 'FID' }, // { id: 'fid', title: 'FID' },
// { id: 'ftreSmbolCd', title: '지형지물부호코드' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' },
// { id: 'mngInstCd', title: '관리기관코드' }, // { id: 'mngInstCd', title: '관리기관코드' },
// { id: 'mqltCd', title: '재질코드' }, { id: 'mqltCd', title: '재질코드' },
// { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, // { id: 'pbadmsEmdCd', title: '행정읍면동코드' },
// { id: 'usgCd', title: '용도코드' }, // { id: 'usgCd', title: '용도코드' },
// { id: 'lyrTypeNm', title: '레이어타입명' }, // { id: 'lyrTypeNm', title: '레이어타입명' },
@@ -69,6 +70,10 @@ export const MsSwagePplExcelCol = {
'tmptMhlMngNo': '시점맨홀 관리번호', 'tmptMhlMngNo': '시점맨홀 관리번호',
'scendDpth': '종점 깊이(m)', 'scendDpth': '종점 깊이(m)',
'scendMhlMngNo': '종점맨홀 관리번호', 'scendMhlMngNo': '종점맨홀 관리번호',
'vrtcLen': '세로길이(m)',
'wdthLen': '가로길이(m)',
'fcltyShpCd': '시설물형태코드',
'mqltCd': '재질코드',
}; };
// 하수관로 용도 코드표 // 하수관로 용도 코드표
export const MS_SWAGE_PPL_USE_CODES = [ export const MS_SWAGE_PPL_USE_CODES = [
@@ -275,7 +280,80 @@ export const MS_SWAGE_PPL_CODES = [
{ val: "MOP977", text: "전주용입상관" }, { val: "MOP977", text: "전주용입상관" },
{ val: "MOP978", text: "MD관" }, { val: "MOP978", text: "MD관" },
]; ];
// 하수관로 'fcltyShpCd' '시설물형태코드'
export const MS_SWAGE_PPL_SHAPE = [
{ val: "FOR000 ", text: "미분류" },
{ val: "FOR001 ", text: "원형" },
{ val: "FOR002 ", text: "원추형" },
{ val: "FOR003 ", text: "원통형" },
{ val: "FOR004 ", text: "구형" },
{ val: "FOR005 ", text: "타원형" },
{ val: "FOR006 ", text: "난원" },
{ val: "FOR007 ", text: "반원형" },
{ val: "FOR010 ", text: "피라미드형" },
{ val: "FOR011 ", text: "사면체형" },
{ val: "FOR012 ", text: "기둥,축" },
{ val: "FOR013 ", text: "돛대,활대처럼 둥글고 긴 원재" },
{ val: "FOR014 ", text: "아치형" },
{ val: "FOR015 ", text: "다중아치형" },
{ val: "FOR016 ", text: "돔형" },
{ val: "FOR017 ", text: "고형체형" },
{ val: "FOR020 ", text: "사각형" },
{ val: "FOR021 ", text: "평방형" },
{ val: "FOR022 ", text: "다이아몬드형" },
{ val: "FOR023 ", text: "사다리꼴" },
{ val: "FOR024 ", text: "각형" },
{ val: "FOR025 ", text: "마제형관" },
{ val: "FOR026 ", text: "태형" },
{ val: "FOR030 ", text: "A형" },
{ val: "FOR031 ", text: "H형" },
{ val: "FOR032 ", text: "I형" },
{ val: "FOR033 ", text: "Y형" },
{ val: "FOR034 ", text: "T형" },
{ val: "FOR050 ", text: "불규칙한 형태" },
{ val: "FOR900 ", text: "계란형" },
{ val: "FOR901 ", text: "구(사각)형" },
{ val: "FOR902 ", text: "높이조절철개형" },
{ val: "FOR903 ", text: "박스형(RCB)" },
{ val: "FOR904 ", text: "반월개거" },
{ val: "FOR905 ", text: "반월개거(측구)" },
{ val: "FOR906 ", text: "벽돌조" },
{ val: "FOR907 ", text: "사각철판" },
{ val: "FOR908 ", text: "석축개거" },
{ val: "FOR909 ", text: "석축개거(측구)" },
{ val: "FOR910 ", text: "승수로" },
{ val: "FOR911 ", text: "옹벽개거" },
{ val: "FOR912 ", text: "옹벽개거(측구)" },
{ val: "FOR913 ", text: "이단" },
{ val: "FOR914 ", text: "이중침전형" },
{ val: "FOR915 ", text: "자연개거" },
{ val: "FOR916 ", text: "자연개거(측구)" },
{ val: "FOR917 ", text: "조립식" },
{ val: "FOR918 ", text: "지상관" },
{ val: "FOR919 ", text: "지상단구" },
{ val: "FOR920 ", text: "지상쌍구" },
{ val: "FOR921 ", text: "지하단구" },
{ val: "FOR922 ", text: "지하쌍구" },
{ val: "FOR923 ", text: "직사각형" },
{ val: "FOR924 ", text: "타설식" },
{ val: "FOR925 ", text: "토류형" },
{ val: "FOR926 ", text: "흄관원형" },
{ val: "FOR927 ", text: "L형측구" },
{ val: "FOR928 ", text: "LO형측구" },
{ val: "FOR929 ", text: "LU형측구" },
{ val: "FOR930 ", text: "PVC이중벽관" },
{ val: "FOR931 ", text: "RCB 맨홀" },
{ val: "FOR932 ", text: "U형" },
{ val: "FOR933 ", text: "U형측구(미복개)" },
{ val: "FOR934 ", text: "U형측구(복개)" },
{ val: "FOR999 ", text: "기타" }
];
// 하수처리시설 // 하수처리시설
export const SwtrmtFcltCol = [ export const SwtrmtFcltCol = [
{ id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, { id: 'swtrmt_fclt_nm', title: '하수처리시설명' },
@@ -125,10 +125,9 @@ const SearchModal: React.FC = () => {
{/* 📋 결과 리스트 */} {/* 📋 결과 리스트 */}
{/* 기본정보 탭 */} {/* 기본정보 탭 */}
{activeTab === 'basic' && ( {activeTab === 'basic' && (
<div className="h-[79vh] w-full overflow-x-hidden overflow-y-auto rounded-lg border mt-4"> <div className="h-[79dvh] w-full rounded-lg border mt-4 overflow-x-scroll">
<div className="flex-1 px-2 pb-2"> <LoadingOverlay isLoading={isLoading} />
<LoadingOverlay isLoading={isLoading} /> <UiTable className='w-[120%]'
<UiTable
headName={(() => { headName={(() => {
const label = BASIC_TYPES.find((type) => type.val === basicType)?.text const label = BASIC_TYPES.find((type) => type.val === basicType)?.text
return (<>{label} 조회 결과 ({tableCount.toLocaleString('ko-KR')})건</>); return (<>{label} 조회 결과 ({tableCount.toLocaleString('ko-KR')})건</>);
@@ -150,66 +149,65 @@ const SearchModal: React.FC = () => {
</div> </div>
} }
/> />
</div>
</div> </div>
)} )}
{/* 유지관리 정보 탭 */} {/* 유지관리 정보 탭 */}
{activeTab === 'operation' && ( {activeTab === 'operation' && (
<> <>
<div className="h-[39vh] w-full overflow-hidden rounded-lg border mt-4"> <div className="h-[39dvh] w-full overflow-x-hidden overflow-y-auto rounded-lg border mt-4">
<div className="flex-1 px-2 pb-2"> {/* <div className="flex-1 px-2 pb-2"> */}
<LoadingOverlay isLoading={isLoading} /> <LoadingOverlay isLoading={isLoading} />
<UiTable <UiTable
headName={ headName={
(() => { (() => {
const label = WORK_TYPES.find((type) => type.val === workType)?.text const label = WORK_TYPES.find((type) => type.val === workType)?.text
return (<>{label} 사업 현황 ({tableCount.toLocaleString('ko-KR')})건</>); return (<>{label} 사업 현황 ({tableCount.toLocaleString('ko-KR')})건</>);
})() })()
} }
tableData={tableData} tableData={tableData}
headlist={dynamicHeadlist} headlist={dynamicHeadlist}
pageSize={OPERATION_TABLE_SIZE} pageSize={OPERATION_TABLE_SIZE}
total={tableCount} total={tableCount}
cellClick={handleOperationCellClick} cellClick={handleOperationCellClick}
onPageChange={setCurPage} onPageChange={setCurPage}
resetPageNo={isResetPage} resetPageNo={isResetPage}
resetSelection={isResetSelection} resetSelection={isResetSelection}
curPage={curPage} curPage={curPage}
headButton={ headButton={
<Button className="px-4 py-2 !mr-[1.2rem] text-white rounded-sm text-sm font-medium green" size="sm" onClick={operationExcelDownload}>파일 다운로드</Button> <Button className="px-4 py-2 !mr-[1.2rem] text-white rounded-sm text-sm font-medium green" size="sm" onClick={operationExcelDownload}>파일 다운로드</Button>
} }
/> />
</div> {/* </div> */}
</div> </div>
<div className="h-[39vh] w-full overflow-hidden rounded-lg border"> <div className="h-[39dvh] w-full overflow-x-hidden overflow-y-auto rounded-lg border">
{/* 테이블2 영역 */} {/* 테이블2 영역 */}
<div className="flex-1 px-2 pb-2"> {/* <div className="flex-1 px-2 pb-2"> */}
<LoadingOverlay isLoading={isDetailLoading} /> <LoadingOverlay isLoading={isDetailLoading} />
<UiTable <UiTable
headName={ headName={
(() => { (() => {
const label = WORK_TYPES.find((type) => type.val === workType)?.text const label = WORK_TYPES.find((type) => type.val === workType)?.text
return (<>{label} 결과표 ({detailTableCount.toLocaleString('ko-KR')})건</>); return (<>{label} 결과표 ({detailTableCount.toLocaleString('ko-KR')})건</>);
})() })()
} }
tableData={detailTableData} tableData={detailTableData}
headlist={dynamicHeadlist2} headlist={dynamicHeadlist2}
pageSize={OPERATION_TABLE_SIZE} pageSize={OPERATION_TABLE_SIZE}
total={detailTableCount} total={detailTableCount}
cellClick={handleOperationResultCellClick} cellClick={handleOperationResultCellClick}
onPageChange={setDetailCurPage} onPageChange={setDetailCurPage}
resetPageNo={isResetDetailPage} resetPageNo={isResetDetailPage}
resetSelection={isResetDetailSelection} resetSelection={isResetDetailSelection}
curPage={detailCurPage} curPage={detailCurPage}
headButton={ headButton={
<div className='flex'> <div className='flex'>
<Button className="px-4 py-2 !mr-[1.2rem] text-white rounded-sm text-lg font-medium primary" size="sm" onClick={viewMultipleFeature}>지도에서 보기</Button> <Button className="px-4 py-2 !mr-[1.2rem] text-white rounded-sm text-lg font-medium primary" size="sm" onClick={viewMultipleFeature}>지도에서 보기</Button>
<Button className="px-4 py-2 !mr-[1.2rem] text-white rounded-sm text-lg font-medium green" size="sm" onClick={operationResultExcelDownload}>파일 다운로드</Button> <Button className="px-4 py-2 !mr-[1.2rem] text-white rounded-sm text-lg font-medium green" size="sm" onClick={operationResultExcelDownload}>파일 다운로드</Button>
</div> </div>
} }
/> />
</div> {/* </div> */}
</div> </div>
</> </>
)} )}
@@ -224,8 +222,8 @@ const SearchModal: React.FC = () => {
bodyClass={` bodyClass={`
h-[100dvh] h-[100dvh]
w-[90dvw] w-[90dvw]
max-w-[1200px] max-w-[1220px]
max-h-[100dvh] max-h-[970px]
overflow-y-hidden overflow-y-hidden
z-[101] z-[101]
`} `}
@@ -14,7 +14,7 @@
*/ */
import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui'; import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui';
import { import {
MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES, MS_SWAGE_PPL_USE_CODES, MS_SWAGE_PPL_CODES, MS_SWAGE_PPL_SHAPE, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES,
MsSwagePplExcelCol, SwtrmtFcltExcelCol, SwtrmtPrcsZoneExcelCol, MsSwageMhlExcelCol, ExclnSewagePumpExcelCol, stofcbrExcelCol MsSwagePplExcelCol, SwtrmtFcltExcelCol, SwtrmtPrcsZoneExcelCol, MsSwageMhlExcelCol, ExclnSewagePumpExcelCol, stofcbrExcelCol
} from '../components/common/table'; } from '../components/common/table';
import { getData } from "@/components/lib/api"; import { getData } from "@/components/lib/api";
@@ -46,6 +46,7 @@ export default function useBasicTab() {
} = useSearchModalStore(); } = useSearchModalStore();
const { ctpv, sgg } = useStore(); const { ctpv, sgg } = useStore();
const fetchBasicFilteredData = async () => { const fetchBasicFilteredData = async () => {
let cqlFilters: string[] = []; let cqlFilters: string[] = [];
const queryParams = new URLSearchParams({ const queryParams = new URLSearchParams({
@@ -79,8 +80,15 @@ export default function useBasicTab() {
if (!sggCd && code) sggCd = code.slice(0, 5); if (!sggCd && code) sggCd = code.slice(0, 5);
} }
const matchedMhlCode = MS_SWAGE_MHL_CODES.find(code => code.val === item?.mqltCd?.trim()); const matchedMqltCode = basicType === 'tb_ms_swage_ppl'
const matchedMhlUsgCode = MS_SWAGE_MHL_USE_CODES.find(code => code.val === item?.usgCd); ? MS_SWAGE_PPL_CODES.find(code => code.val === item?.mqltCd?.trim()) // 하수관로 재질
: basicType === 'tb_ms_swage_mhl'
? MS_SWAGE_MHL_CODES.find(code => code.val === item?.mqltCd?.trim()) // 맨홀 재질
: undefined;
const matchedMhlUsgCode = MS_SWAGE_MHL_USE_CODES.find(code => code.val === item?.usgCd); // 맨홀 용도
const matchedPplShpCode = MS_SWAGE_PPL_SHAPE.find(code => code.val === item?.fcltyShpCd); // 하수관로 시설물형태코드
const ctpvNm = ctpv.find(code => code.val.trim() === ctpvCd)?.text || item?.ctpvNm; const ctpvNm = ctpv.find(code => code.val.trim() === ctpvCd)?.text || item?.ctpvNm;
const sggNm = sgg.find(code => code.val.trim() === sggCd)?.text || item?.sggNm; const sggNm = sgg.find(code => code.val.trim() === sggCd)?.text || item?.sggNm;
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());
@@ -90,15 +98,17 @@ export default function useBasicTab() {
...formattedItem, ...formattedItem,
rowNumber: (curPage - 1) * 10 + index + 1, // 1부터 시작하는 일련번호 추가 rowNumber: (curPage - 1) * 10 + index + 1, // 1부터 시작하는 일련번호 추가
scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item?.scsYn, // scsYn이 null이면 'N'으로 변경 scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item?.scsYn, // scsYn이 null이면 'N'으로 변경
mqltCd: matchedMhlCode ? matchedMhlCode.text : item?.mqltCd, mqltCd: matchedMqltCode ? matchedMqltCode.text : item?.mqltCd,
usgCd: matchedMhlUsgCode ? matchedMhlUsgCode.text : (usgCdObj ? usgCdObj.text : item?.usgCd), usgCd: matchedMhlUsgCode ? matchedMhlUsgCode.text : (usgCdObj ? usgCdObj.text : item?.usgCd),
ctpvNm: ctpvNm ?? '-', ctpvNm: ctpvNm ?? '-',
sggNm: sggNm ?? '-', sggNm: sggNm ?? '-',
swtrmt_zone_nm: item.swtrmtZoneNm || item.swtrmt_zone_nm || '-', swtrmt_zone_nm: item.swtrmtZoneNm || item.swtrmt_zone_nm || '-',
fcltyShpCd: matchedPplShpCode? matchedPplShpCode.text : item?.fcltyShpCd,
}; };
}); });
setTableData(dataWithRowNumber); setTableData(dataWithRowNumber);
// console.log(tableData);
setTableCount(res.count || []); setTableCount(res.count || []);
}; };
@@ -150,7 +160,7 @@ export default function useBasicTab() {
// 하수관로 // 하수관로
cqlFilters = swagePplCqlFilters() cqlFilters = swagePplCqlFilters()
headerMapping = MsSwagePplExcelCol; headerMapping = MsSwagePplExcelCol;
headerRange = "A1:M1"; headerRange = "A1:Q1";
break; break;
} }
case 'tb_il_swage_prcs_fclt': { case 'tb_il_swage_prcs_fclt': {
@@ -196,6 +206,8 @@ export default function useBasicTab() {
const mhlUsgCdMap = new Map(MS_SWAGE_MHL_USE_CODES.map(code => [code.val?.trim(), code.text])); const mhlUsgCdMap = new Map(MS_SWAGE_MHL_USE_CODES.map(code => [code.val?.trim(), code.text]));
const pplUsgCdMap = new Map(MS_SWAGE_PPL_USE_CODES.map(code => [code.val?.trim(), code.text])); const pplUsgCdMap = new Map(MS_SWAGE_PPL_USE_CODES.map(code => [code.val?.trim(), code.text]));
const pplMqltCdMap = new Map(MS_SWAGE_PPL_CODES.map(code => [code.val?.trim(), code.text]));
const pplShpCdMap = new Map(MS_SWAGE_PPL_SHAPE.map(code => [code.val?.trim(), code.text])); // 관로 시설물형태코드
const ctpvMap = new Map(ctpv.map(code => [code.val?.trim(), code.text])); const ctpvMap = new Map(ctpv.map(code => [code.val?.trim(), code.text]));
const sggMap = new Map(sgg.map(code => [code.val?.trim(), code.text])); const sggMap = new Map(sgg.map(code => [code.val?.trim(), code.text]));
@@ -232,6 +244,10 @@ export default function useBasicTab() {
tmptMhlMngNo: formattedItem.tmptMhlMngNo ?? item.tmptMhlMngNo ?? '-', tmptMhlMngNo: formattedItem.tmptMhlMngNo ?? item.tmptMhlMngNo ?? '-',
scendDpth: formattedItem.scendDpth ?? item.scendDpth ?? '-', scendDpth: formattedItem.scendDpth ?? item.scendDpth ?? '-',
scendMhlMngNo: formattedItem.scendMhlMngNo ?? item.scendMhlMngNo ?? '-', scendMhlMngNo: formattedItem.scendMhlMngNo ?? item.scendMhlMngNo ?? '-',
vrtcLen: formattedItem.vrtcLen ?? item.vrtcLen ?? '-',
wdthLen: formattedItem.wdthLen ?? item.wdthLen ?? '-',
fcltyShpCd: pplShpCdMap.get(item?.fcltyShpCd?.trim()) || item.fcltyShpCd || formattedItem.fcltyShpCd || '-',
mqltCd: pplMqltCdMap.get(item?.mqltCd?.trim()) || item.mqltCd || formattedItem.mqltCd || '-',
}; };
} }
case 'tb_il_swage_prcs_fclt': { case 'tb_il_swage_prcs_fclt': {
@@ -329,4 +345,4 @@ export default function useBasicTab() {
return { fetchBasicFilteredData, handleBasicCellClick, basicExcelDownload }; return { fetchBasicFilteredData, handleBasicCellClick, basicExcelDownload };
}; };
+4 -5
View File
@@ -19,15 +19,14 @@ import { LoginApi } from "@/entities/auth";
import { useEffect } from "react"; import { useEffect } from "react";
import { getCookie } from "@/shared/lib"; import { getCookie } from "@/shared/lib";
import { AUTH_USER_ID } from "@/shared/config"; import { AUTH_USER_ID } from "@/shared/config";
import { useRouter } from "next/navigation";
export default function Home() { export default function Home() {
const router = useRouter();
const checkToken = getCookie(AUTH_USER_ID); const checkToken = getCookie(AUTH_USER_ID);
useEffect(() => { useEffect(() => {
const hostname = window.location.hostname; const hostname = window.location.hostname;
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") { if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") {
if (!checkToken) { if (!checkToken) {
async function doLogin() { async function doLogin() {
@@ -39,7 +38,7 @@ export default function Home() {
} }
} }
doLogin(); doLogin();
} else router.push("/map"); } else window.location.href = "/map";
} else router.push("/map"); } else window.location.href = "/map";
}, []); }, []);
} }
@@ -47,7 +47,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
// 개발 환경에서는 localhost 도메인 사용 // 개발 환경에서는 localhost 도메인 사용
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr")
router.push("/"); // 개발시 홈으로 돌아가기 window.location.href = "/";
// 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용
// router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용 // router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용
+1 -1
View File
@@ -3,7 +3,7 @@ import { PROXY_HOST } from "./env";
// 브라우저에서는 동일 오리진으로 상대경로 호출 → CORS/localhost 고정 문제 방지 // 브라우저에서는 동일 오리진으로 상대경로 호출 → CORS/localhost 고정 문제 방지
// (Next middleware가 /server/* 요청을 백엔드로 rewrite) // (Next middleware가 /server/* 요청을 백엔드로 rewrite)
// 서버 환경(SSR 등)에서는 절대 URL이 필요할 수 있어 기존 PROXY_HOST 기반 유지 // 서버 환경(SSR 등)에서는 절대 URL이 필요할 수 있어 기존 PROXY_HOST 기반 유지
export const BASE_URL = typeof window === "undefined" ? `${PROXY_HOST}/server` : "/server"; export const BASE_URL = `${PROXY_HOST}/server`;
export const ENDPOINT = { export const ENDPOINT = {
ATTACH_SERVICE: { ATTACH_SERVICE: {
+2 -1
View File
@@ -38,4 +38,5 @@ yarn-error.log*
next-env.d.ts next-env.d.ts
.env* .env*
!.env.example !.env.example
*.md
+2 -1
View File
@@ -1,3 +1,4 @@
{ {
"plugins": ["prettier-plugin-tailwindcss"] "plugins": ["prettier-plugin-tailwindcss"],
"tabWidth": 4
} }
+64 -5
View File
@@ -1,12 +1,13 @@
"use client"; "use client";
import { useEffect, useCallback } from "react"; import { useEffect, useCallback, useMemo } from "react";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import { useQueryClient, useQuery } from "@tanstack/react-query"; import { useQueryClient, useQuery } from "@tanstack/react-query";
import type { MenuItem } from "@/entities/menu"; import type { MenuItem } from "@/entities/menu";
import { useMenuStore, useAlertStore } from "@/shared/lib"; import { useMenuStore, useAlertStore } from "@/shared/lib";
import { useTabStore, getTabStoreState } from "@/store/tab-store"; import { useTabStore, getTabStoreState } from "@/store/tab-store";
import { useTabStore as gridTabStore } from "@rsone/components";
import { getConfig } from "@common/config"; import { getConfig } from "@common/config";
import { getCookie } from "@/shared/lib"; import { getCookie } from "@/shared/lib";
import { getMenuList } from "../../../../packages/common/components/src/api"; import { getMenuList } from "../../../../packages/common/components/src/api";
@@ -29,10 +30,17 @@ export default function WithBaseLayout({
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo); const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo);
const currentMenuInfo = useMenuStore((state) => state.currentMenuInfo);
const addTab = useTabStore((state) => state.addTab); const addTab = useTabStore((state) => state.addTab);
const setActiveTab = useTabStore((state) => state.setActiveTab); const setActiveTab = useTabStore((state) => state.setActiveTab);
const setMenuList = useTabStore((state) => state.setMenuList); const setMenuList = useTabStore((state) => state.setMenuList);
const activeTabId = useTabStore((state) => state.activeTabId);
const menuList = useTabStore((state) => state.menuList);
const tabs = useTabStore((state) => state.tabs);
const addTabForGrid = gridTabStore((state) => state.addTab);
const setActiveTabForGrid = gridTabStore((state) => state.setActiveTab);
const setMenuListForGrid = gridTabStore((state) => state.setMenuList);
const alert = useAlertStore((state) => state.setMessage); const alert = useAlertStore((state) => state.setMessage);
const { data: menuListData } = useQuery({ const { data: menuListData } = useQuery({
@@ -44,8 +52,9 @@ export default function WithBaseLayout({
useEffect(() => { useEffect(() => {
if (menuListData) { if (menuListData) {
setMenuList(menuListData); setMenuList(menuListData);
setMenuListForGrid(menuListData);
} }
}, [menuListData, setMenuList]); }, [menuListData, setMenuList, setMenuListForGrid]);
useEffect(() => { useEffect(() => {
if (!pathname) return; if (!pathname) return;
@@ -55,23 +64,73 @@ export default function WithBaseLayout({
const tab = currentTabs.find((t) => t.path === pathname); const tab = currentTabs.find((t) => t.path === pathname);
if (tab) { if (tab) {
setActiveTab(tab.id); setActiveTab(tab.id);
setActiveTabForGrid(tab.id);
} }
}, [pathname, setActiveTab]); }, [pathname, setActiveTab, setActiveTabForGrid]);
// 활성 탭의 메뉴를 찾아서 urlPath를 가져옴. 탭이 전부 닫히면 ''를 넘겨 LNB에서 메뉴 강조 제거
const currentPath = useMemo(() => {
if (tabs.length === 0) return "";
if (activeTabId && menuList) {
// menuList에서 활성 탭의 메뉴 찾기
const findMenuByEngNm = (items: MenuItem[]): MenuItem | null => {
for (const item of items) {
if (item.menuEngNm === activeTabId) {
return item;
}
if (item.children) {
const found = findMenuByEngNm(item.children);
if (found) return found;
}
}
return null;
};
const activeMenu = findMenuByEngNm(menuList);
if (activeMenu?.urlPath) {
return activeMenu.urlPath;
}
}
// 탭에서 직접 찾기
if (activeTabId) {
const currentTabs = getTabStoreState().tabs;
const activeTab = currentTabs.find((t) => t.id === activeTabId);
if (activeTab?.menuItem?.urlPath) {
return activeTab.menuItem.urlPath;
}
}
// currentMenuInfo에서 가져오기
if (currentMenuInfo?.urlPath) {
return currentMenuInfo.urlPath;
}
// 기본값으로 pathname 사용
return pathname ?? "";
}, [tabs.length, activeTabId, menuList, currentMenuInfo, pathname]);
const handleMenuClick = useCallback((item: MenuItem) => { const handleMenuClick = useCallback((item: MenuItem) => {
setCurrentMenuInfo(item); setCurrentMenuInfo(item);
const addTabResult: boolean = addTab(item); const addTabResult: boolean = addTab(item);
// packages/rsone의 스토어에도 동기화
if (addTabResult) {
addTabForGrid(item);
}
if (!addTabResult) { if (!addTabResult) {
alert(`최대 추가 할 수 있는 화면 수를 초과 하였습니다. alert(`최대 추가 할 수 있는 화면 수를 초과 하였습니다.
기존 화면을 닫은 후 이용해주세요.`); 기존 화면을 닫은 후 이용해주세요.`);
} }
}, [setCurrentMenuInfo, addTab]); }, [setCurrentMenuInfo, addTab, addTabForGrid, alert]);
return ( return (
<BaseLayout <BaseLayout
queryClient={queryClient} queryClient={queryClient}
currentPath={pathname ?? ""} currentPath={currentPath}
handleMenuClick={handleMenuClick} handleMenuClick={handleMenuClick}
> >
<StatisticsPageLayout>{children}</StatisticsPageLayout> <StatisticsPageLayout>{children}</StatisticsPageLayout>
@@ -1,3 +1,3 @@
import { statisticsPage } from "@/pages/statistics"; import { StatisticsPage } from "@/pages/statistics";
export default statisticsPage; export default StatisticsPage;
+2 -2
View File
@@ -32,7 +32,7 @@ export function middleware(req: NextRequest) {
`[Request]\n Original Pathname: ${pathname}`, `[Request]\n Original Pathname: ${pathname}`,
]; ];
if (pathname.startsWith("/st-service")) { if (pathname.startsWith("/st-management-service") || pathname.startsWith("/st-input-service")) {
const requestHeaders = new Headers(req.headers); const requestHeaders = new Headers(req.headers);
const token = req.cookies.get(CLAIM_NAME)?.value; const token = req.cookies.get(CLAIM_NAME)?.value;
const userId = req.cookies.get(AUTH_USER_ID)?.value; const userId = req.cookies.get(AUTH_USER_ID)?.value;
@@ -138,5 +138,5 @@ export function middleware(req: NextRequest) {
} }
export const config = { export const config = {
matcher: ["/server/:path*", "/attach-service/:path*", "/api/link/:path*", "/st-service/:path*", "/"], matcher: ["/server/:path*", "/attach-service/:path*", "/api/link/:path*", "/st-management-service/:path*", "/st-input-service/:path*", "/"],
}; };
+2
View File
@@ -12,6 +12,7 @@
"@common/assets": "workspace:*", "@common/assets": "workspace:*",
"@common/components": "workspace:*", "@common/components": "workspace:*",
"@common/config": "workspace:*", "@common/config": "workspace:*",
"@faker-js/faker": "^9.9.0",
"@fontsource-variable/noto-sans-kr": "^5.2.5", "@fontsource-variable/noto-sans-kr": "^5.2.5",
"@frontend-opensource/use-react-hooks": "^1.1.4", "@frontend-opensource/use-react-hooks": "^1.1.4",
"@fullcalendar/core": "^6.1.17", "@fullcalendar/core": "^6.1.17",
@@ -25,6 +26,7 @@
"@radix-ui/react-label": "^2.1.2", "@radix-ui/react-label": "^2.1.2",
"@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.8", "@radix-ui/react-tooltip": "^1.1.8",
"@rsone/components": "workspace:*",
"@tanstack/react-query": "^5.67.1", "@tanstack/react-query": "^5.67.1",
"@tanstack/react-query-devtools": "^5.75.5", "@tanstack/react-query-devtools": "^5.75.5",
"@tanstack/react-table": "^8.21.2", "@tanstack/react-table": "^8.21.2",
@@ -13,6 +13,7 @@ import { PromptDialog } from "@/shared/ui/prompt-dialog";
import { ConfirmDialog } from "@/shared/ui/confirm-dialog"; import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
import { SelectPromptDialog } from "@/shared/ui/select-prompt-dialog"; import { SelectPromptDialog } from "@/shared/ui/select-prompt-dialog";
import { PromptProvider, StoreProvider } from "@/shared/providers"; import { PromptProvider, StoreProvider } from "@/shared/providers";
import { AlertDialog as RsoneAlertDialog } from "@rsone/components";
const AppProvider = ({ children }: Readonly<{ children: React.ReactNode }>) => { const AppProvider = ({ children }: Readonly<{ children: React.ReactNode }>) => {
const queryClient = new QueryClient(); const queryClient = new QueryClient();
@@ -31,6 +32,7 @@ const AppProvider = ({ children }: Readonly<{ children: React.ReactNode }>) => {
</DndProvider> </DndProvider>
</MenuWrapper> </MenuWrapper>
<AlertDialog /> <AlertDialog />
<RsoneAlertDialog />
<PromptDialog /> <PromptDialog />
<ConfirmDialog /> <ConfirmDialog />
<SelectPromptDialog /> <SelectPromptDialog />
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface AddArticleButtonProps {
addArticleFunc: () => void;
}
const AddArticleButton = ({ addArticleFunc }: AddArticleButtonProps) => {
return (
<Button className="h-[3.2rem] w-[96px]" onClick={addArticleFunc}>
<i className="ri-add-fill" />
<span>항목 추가</span>
</Button>
);
};
export default AddArticleButton;
@@ -6,9 +6,9 @@ interface ApproveButtonProps {
const ApproveButton = ({ approveFunc }: ApproveButtonProps) => { const ApproveButton = ({ approveFunc }: ApproveButtonProps) => {
return ( return (
<Button color="emerald" className="px-6" onClick={approveFunc}> <Button className="h-[3.2rem] w-[96px]" onClick={approveFunc}>
<i className="diveicon di-check-circle translate-y-[1px]" /> <i className="diveicon di-check-circle" />
<span className="translate-y-[-1px]">승인</span> <span>승인</span>
</Button> </Button>
); );
}; };
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface DeleteArticleButtonProps {
deleteArticleFunc: () => void;
}
const DeleteArticleButton = ({ deleteArticleFunc }: DeleteArticleButtonProps) => {
return (
<Button className="h-[3.2rem] w-[96px]" color="red" onClick={deleteArticleFunc}>
<i className="ri-subtract-fill"></i>
<span>항목 제거</span>
</Button>
);
};
export default DeleteArticleButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface InstallationStatusButtonProps {
installationStatusFunc: () => void;
}
const InstallationStatusButton = ({ installationStatusFunc }: InstallationStatusButtonProps) => {
return (
<Button className="h-[3.2rem] w-[176px]" color="lightGray" onClick={installationStatusFunc}>
<i className="diveicon di-server-line"></i>
<span>시설별 설치 현황관리</span>
</Button>
);
};
export default InstallationStatusButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface LastYearDataButtonProps {
getLastYearDataFunc: () => void;
}
const LastYearDataButton = ({ getLastYearDataFunc }: LastYearDataButtonProps) => {
return (
<Button color="emerald" className="h-[3.2rem] w-[176px]" onClick={getLastYearDataFunc}>
<i className="diveicon di-search" />
<span>지난연도 데이터 가져오기</span>
</Button>
);
};
export default LastYearDataButton;
@@ -0,0 +1,28 @@
import { Checkbox, buttonVariants, cn } from "@common/components";
import type React from "react";
interface NotApplicableCheckButtonProp {
isCheck: boolean;
setIsCheck: React.Dispatch<React.SetStateAction<boolean>>;
}
const NotApplicableCheckButton = ({ isCheck, setIsCheck }: NotApplicableCheckButtonProp) => {
const handleCheckChange = (value: boolean) => {
setIsCheck(value);
};
return (
<div className={cn(buttonVariants({ variant: "default", size: "default" }), "w-[124px] bg-[#ebebeb] border border-[#999] text-[rgb(146 146 146)] text-opacity-100")}>
<label htmlFor="notApplicable">해당사항 없음</label>
<Checkbox
id="notApplicable"
className="!border-[#999] data-[state=checked]:!bg-[#999]"
checked={isCheck}
onCheckedChange={handleCheckChange}
/>
</div>
);
};
export default NotApplicableCheckButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface OperateDataButtonProps {
getOperateDataFunc: () => void;
}
const OperateDataButton = ({ getOperateDataFunc }: OperateDataButtonProps) => {
return (
<Button color="emerald" className="h-[3.2rem] w-[176px]" onClick={getOperateDataFunc}>
<i className="diveicon di-arrow-left-right" />
<span>운영 데이터 가져오기</span>
</Button>
);
};
export default OperateDataButton;
@@ -6,9 +6,9 @@ interface RejectButtonProps {
const RejectButton = ({ rejectFunc }: RejectButtonProps) => { const RejectButton = ({ rejectFunc }: RejectButtonProps) => {
return ( return (
<Button color="red" className="px-6" onClick={rejectFunc}> <Button color="red" className="h-[3.2rem] w-[96px]" onClick={rejectFunc}>
<i className="diveicon di-exclamation-circle translate-y-[1px]" /> <i className="diveicon di-exclamation-circle" />
<span className="translate-y-[-1px]">보완 요청</span> <span>보완 요청</span>
</Button> </Button>
); );
}; };
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface ReturnButtonProps {
returnFunc: () => void;
}
const ReturnButton = ({ returnFunc }: ReturnButtonProps) => {
return (
<Button color="red" className="h-[3.2rem] w-[96px]" onClick={returnFunc}>
<i className="diveicon di-arrow-reset" />
<span>반려</span>
</Button>
);
};
export default ReturnButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface ReviewOpinionButtonProps {
reviewOpinionFunc: () => void;
}
const ReviewOpinionButton = ({ reviewOpinionFunc }: ReviewOpinionButtonProps) => {
return (
<Button color="emerald" className="h-[3.2rem] w-[124px]" onClick={reviewOpinionFunc}>
<i className="diveicon di-pencil" />
<span>검토의견 작성</span>
</Button>
);
};
export default ReviewOpinionButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface SaveButtonProps {
saveFunc: () => void;
}
const SaveButton = ({ saveFunc }: SaveButtonProps) => {
return (
<Button color="green" className="h-[3.2rem] w-[96px]" onClick={saveFunc}>
<i className="diveicon di-download" />
<span>저장</span>
</Button>
);
};
export default SaveButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface SubmitExceptionButtonProps {
SubmitExceptionFunc: () => void;
}
const SubmitExceptionButton = ({ SubmitExceptionFunc }: SubmitExceptionButtonProps) => {
return (
<Button color="red" className="h-[3.2rem] w-[96px]" onClick={SubmitExceptionFunc}>
<i className="diveicon di-box-arrow-upload" />
<span>예외제출</span>
</Button>
);
};
export default SubmitExceptionButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface SubmitButtonProps {
submitFunc: () => void;
}
const SubmitButton = ({ submitFunc }: SubmitButtonProps) => {
return (
<Button className="h-[3.2rem] w-[96px]" onClick={submitFunc}>
<i className="diveicon di-upload" />
<span>제출</span>
</Button>
);
};
export default SubmitButton;
@@ -0,0 +1,16 @@
import { Button } from "@common/components";
interface UpdateOperateDataButtonProps {
updateOperateDataButtonFunc: () => void;
}
const UpdateOperateDataButton = ({ updateOperateDataButtonFunc }: UpdateOperateDataButtonProps) => {
return (
<Button color="emerald" className="h-[3.2rem] w-[176px]" onClick={updateOperateDataButtonFunc}>
<i className="diveicon di-arrow-up-down" />
<span>운영 데이터 업데이트</span>
</Button>
);
};
export default UpdateOperateDataButton;
+42 -104
View File
@@ -1,105 +1,43 @@
/* RealGrid2 폰트 설정 - 루트 폰트와 일치 */ @tailwind components;
.rg-root,
.rg-grid, @layer components {
.rg-body, .rg-grid .rg-header .rg-table .rg-header-group-cell {
.rg-cell, @apply !bg-[#466995] !text-[#fff];
.rg-header, }
.rg-head, .rg-grid .rg-header .rg-table .rg-header-cell {
.rg-rowbarcontainer { @apply !bg-[#5987bf] !text-[#fff];
font-family: "Noto Sans KR", sans-serif !important; }
font-size: 12px !important; .rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
font-weight: 500; @apply !bg-white;
color: #333 !important; }
[data-theme="black"] {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#3C4043] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#62686d] !text-[#fff];
}
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell {
@apply !bg-[#545556] !text-[#fff];
}
}
[data-theme="red"] {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#646469] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#8d8d94] !text-[#fff];
}
}
[data-theme="green"] {
.rg-grid .rg-header .rg-table .rg-header-group-cell {
@apply !bg-[#518585] !text-[#fff];
}
.rg-grid .rg-header .rg-table .rg-header-cell {
@apply !bg-[#6bafae] !text-[#fff];
}
}
} }
/* RealGrid2 컨테이너 스타일 */
.rg-root {
border-radius: 0.5rem !important;
overflow: hidden !important;
border: 1px solid #dbe2e6 !important;
}
.rg-grid {
border-radius: 0.5rem !important;
/* box-shadow: 0 0 10px -1px rgba(0, 0, 0, 0.06); */
}
/* 헤더 스타일 */
.rg-header,
.rg-head,
.rg-foot,
.rg-footer,
.rg-fixed-footer {
background-color: #f5f7fa !important;
color: #333 !important;
}
/* 헤더 셀 스타일 */
.rg-header .rg-cell,
.rg-head .rg-cell {
background-color: #f5f7fa !important;
}
/* 헤더 필터링 영역 위치 조정 - 오른쪽 여백 추가 */
.rg-header-filtering {
left: auto !important;
right: 8px !important;
}
/* 그룹 헤더 스타일 */
.rg-header-group,
.rg-header-group-cell {
background-color: #f5f7fa !important;
}
/* 첫 번째 헤더 셀 - 왼쪽 상단 모서리 */
.rg-header .rg-cell:first-child,
.rg-head .rg-cell:first-child {
border-top-left-radius: 8px !important;
}
/* 마지막 헤더 셀 - 오른쪽 상단 모서리 */
.rg-header .rg-cell:last-child,
.rg-head .rg-cell:last-child {
border-top-right-radius: 8px !important;
}
/* border color 통일 */
.rg-header .rg-table tr td,
.rg-head .rg-table tr td:not(:first-child),
.rg-body .rg-table tr td,
.rg-rowbarcontainer .rg-table tr td:not(:first-child) {
border-left: 1px solid #dbe2e6 !important;
border-bottom: 1px solid #dbe2e6 !important;
border-right: none !important;
}
.rg-rowindicator-head,
.rg-rowbarcontainer .rg-table tr td:first-child {
border-right: none !important;
border-bottom: 1px solid #dbe2e6 !important;
border-left: none !important;
}
.rg-footer .rg-table tr td,
.rg-fixed-footer .rg-table tr td,
.rg-foot .rg-table tr td {
border-right: 1px solid #dbe2e6 !important;
border-top: 1px solid #dbe2e6 !important;
}
.rg-rowbarcontainer .rg-table tr td {
background-color: #f5f7fa !important;
}
/* 푸터 마지막 요소 - 오른쪽 border 제거 */
.rg-footer .rg-table tr td:last-child {
border-right: none !important;
}
/* 고정 컬럼 바 */
.rg-fixed-column-bar {
background-color: #ccc !important;
border-right: 1px solid #ccc !important;
}

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