From 66126bbe621ffbed124f4f4531ade58855f32eeb Mon Sep 17 00:00:00 2001 From: swcho Date: Thu, 12 Jun 2025 18:57:49 +0900 Subject: [PATCH 001/259] =?UTF-8?q?etc:=20=EC=A4=91=EA=B0=84=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/components/lib/api/index.ts | 2 +- apps/sn/app/components/ui/modal.tsx | 10 +- apps/sn/app/components/ui/verticalTable.tsx | 87 ++++- apps/sn/app/map/components/common/index.ts | 32 +- apps/sn/app/map/components/common/table.ts | 93 ++++- .../app/map/components/popupComponent/Ssc.tsx | 173 ++++++--- .../components/popupComponent/SwtrmtFclt.tsx | 70 ++-- .../app/map/components/popupComponent/smh.tsx | 2 +- apps/wr/app/map/featureClickEventPopup.tsx | 201 ++++++++++ apps/wr/app/map/govSidoSigunguSearchForm.tsx | 114 ++++++ apps/wr/app/map/htdflSttn/page.tsx | 113 ++++++ apps/wr/app/map/mapSearchBar.tsx | 154 ++++++++ apps/wr/app/map/mapSearchForm.tsx | 347 ++++++++++++++++++ apps/wr/app/map/searchModal.tsx | 82 +++++ apps/wr/app/map/service/index.ts | 1 + apps/wr/app/map/service/map.ts | 47 +++ apps/wr/app/page.tsx | 12 + .../images/map/layericon/BML_CBAS_PS.png | Bin 0 -> 1547 bytes .../images/map/layericon/BML_ELEV_PS.png | Bin 0 -> 1030 bytes .../images/map/layericon/BML_ETCP_PS.png | Bin 0 -> 961 bytes .../images/map/layericon/BML_STMS_PS.png | Bin 0 -> 1542 bytes .../images/map/layericon/BML_SYMB_PS.png | Bin 0 -> 970 bytes .../images/map/layericon/RDL_BYST_PS.png | Bin 0 -> 1196 bytes .../images/map/layericon/RDL_CROS_PS.png | Bin 0 -> 1083 bytes .../images/map/layericon/RDL_ETCT_PS.png | Bin 0 -> 1016 bytes .../images/map/layericon/RDL_OCUP_PS.png | Bin 0 -> 1061 bytes .../images/map/layericon/RDL_RDSN_PS.png | Bin 0 -> 1313 bytes .../images/map/layericon/RDL_SCLT_PS.png | Bin 0 -> 1072 bytes .../images/map/layericon/RDL_SEPC_PS.png | Bin 0 -> 1068 bytes .../images/map/layericon/RDL_STAT_PS.png | Bin 0 -> 1075 bytes .../images/map/layericon/RDL_STLT_PS.png | Bin 0 -> 1089 bytes .../images/map/layericon/RDL_TFSN_PS.png | Bin 0 -> 1291 bytes .../images/map/layericon/RDL_TRCT_PS.png | Bin 0 -> 1412 bytes .../images/map/layericon/RDL_TREE_PS.png | Bin 0 -> 1136 bytes .../images/map/layericon/RDL_TRSN_PS.png | Bin 0 -> 1375 bytes .../images/map/layericon/RDL_TSCT_PS.png | Bin 0 -> 1700 bytes .../images/map/layericon/SWL_CLAY_PS.png | Bin 0 -> 1146 bytes .../images/map/layericon/SWL_CLAY_PS_RED.png | Bin 0 -> 468 bytes .../images/map/layericon/SWL_DEPT_PS.png | Bin 0 -> 1079 bytes .../images/map/layericon/SWL_MANH_PS.png | Bin 0 -> 1559 bytes .../map/layericon/SWL_MANH_PS_BLACK.png | Bin 0 -> 757 bytes .../images/map/layericon/SWL_MANH_PS_BLUE.png | Bin 0 -> 785 bytes .../images/map/layericon/SWL_MANH_PS_GRAY.png | Bin 0 -> 1054 bytes .../map/layericon/SWL_MANH_PS_GREEN.png | Bin 0 -> 791 bytes .../images/map/layericon/SWL_MANH_PS_RED.png | Bin 0 -> 782 bytes .../map/layericon/SWL_MANH_PS_YELLOW.png | Bin 0 -> 782 bytes .../images/map/layericon/SWL_SPEW_PS.png | Bin 0 -> 1217 bytes .../images/map/layericon/SWL_SPOT_PS.png | Bin 0 -> 1067 bytes .../map/layericon/SWL_SPOT_PS_BLACK.png | Bin 0 -> 217 bytes .../images/map/layericon/SWL_SPOT_PS_BLUE.png | Bin 0 -> 217 bytes .../map/layericon/SWL_SPOT_PS_GREEN.png | Bin 0 -> 217 bytes .../images/map/layericon/SWL_SPOT_PS_GREY.png | Bin 0 -> 217 bytes .../images/map/layericon/SWL_SPOT_PS_RED.png | Bin 0 -> 217 bytes .../images/map/layericon/SWL_VENT_PS.png | Bin 0 -> 1033 bytes .../images/map/layericon/TL_SPBD_ENTRC.png | Bin 0 -> 1260 bytes .../images/map/layericon/TL_SPGF_LOC.png | Bin 0 -> 1383 bytes .../images/map/layericon/TL_SPOT_NOIN.png | Bin 0 -> 1009 bytes .../images/map/layericon/TL_SPRD_BANO.png | Bin 0 -> 1044 bytes .../images/map/layericon/TL_SPRD_CRSRD.png | Bin 0 -> 1083 bytes .../images/map/layericon/TL_SPRD_NONM.png | Bin 0 -> 1049 bytes .../images/map/layericon/TL_SPRD_RENM.png | Bin 0 -> 1009 bytes .../images/map/layericon/TL_SPRD_RWNM.png | Bin 0 -> 1049 bytes .../images/map/layericon/UFL_BMAN_PS.png | Bin 0 -> 1552 bytes .../images/map/layericon/UFL_BOPC_PS.png | Bin 0 -> 1132 bytes .../images/map/layericon/UFL_BPIP_PS.png | Bin 0 -> 1017 bytes .../images/map/layericon/UFL_BPOL_PS.png | Bin 0 -> 1193 bytes .../images/map/layericon/UFL_BTRS_PS.png | Bin 0 -> 1097 bytes .../images/map/layericon/UFL_GMNT_PS.png | Bin 0 -> 1166 bytes .../images/map/layericon/UFL_GPIP_PS.png | Bin 0 -> 1103 bytes .../images/map/layericon/UFL_GPRS_PS.png | Bin 0 -> 1408 bytes .../images/map/layericon/UFL_GVAL_PS.png | Bin 0 -> 1426 bytes .../images/map/layericon/UFL_KMAN_PS.png | Bin 0 -> 1572 bytes .../images/map/layericon/UFL_KPOL_PS.png | Bin 0 -> 1122 bytes .../images/map/layericon/UFL_VALV_PS.png | Bin 0 -> 1058 bytes .../images/map/layericon/WTL_FIRE_PS.png | Bin 0 -> 1072 bytes .../images/map/layericon/WTL_FLOW_PS.png | Bin 0 -> 1137 bytes .../images/map/layericon/WTL_MANH_PS.png | Bin 0 -> 1557 bytes .../images/map/layericon/WTL_META_PS.png | Bin 0 -> 1100 bytes .../images/map/layericon/WTL_PIPE_PS.png | Bin 0 -> 1075 bytes .../images/map/layericon/WTL_RSRV_PS.png | Bin 0 -> 1057 bytes .../images/map/layericon/WTL_RSRV_PS_GRAY.png | Bin 0 -> 259 bytes .../images/map/layericon/WTL_VALV_PS.png | Bin 0 -> 1077 bytes .../public/images/map/layericon/default.png | Bin 0 -> 160 bytes apps/wr/public/images/map/layericon/reset.png | Bin 0 -> 108 bytes .../business_components/src/ui/map/Gis.js | 50 ++- .../map/{MapToggleBtn.js => GisMapToggle.js} | 0 .../src/ui/map/GisSelect.js | 55 +-- .../business_components/src/ui/map/GisTree.js | 110 ++++-- .../src/ui/map/lib/gis.core.js | 21 +- 89 files changed, 1584 insertions(+), 192 deletions(-) create mode 100644 apps/wr/app/map/featureClickEventPopup.tsx create mode 100644 apps/wr/app/map/govSidoSigunguSearchForm.tsx create mode 100644 apps/wr/app/map/htdflSttn/page.tsx create mode 100644 apps/wr/app/map/mapSearchBar.tsx create mode 100644 apps/wr/app/map/mapSearchForm.tsx create mode 100644 apps/wr/app/map/searchModal.tsx create mode 100644 apps/wr/app/map/service/index.ts create mode 100644 apps/wr/app/map/service/map.ts create mode 100644 apps/wr/public/images/map/layericon/BML_CBAS_PS.png create mode 100644 apps/wr/public/images/map/layericon/BML_ELEV_PS.png create mode 100644 apps/wr/public/images/map/layericon/BML_ETCP_PS.png create mode 100644 apps/wr/public/images/map/layericon/BML_STMS_PS.png create mode 100644 apps/wr/public/images/map/layericon/BML_SYMB_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_BYST_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_CROS_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_ETCT_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_OCUP_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_RDSN_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_SCLT_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_SEPC_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_STAT_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_STLT_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_TFSN_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_TRCT_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_TREE_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_TRSN_PS.png create mode 100644 apps/wr/public/images/map/layericon/RDL_TSCT_PS.png create mode 100644 apps/wr/public/images/map/layericon/SWL_CLAY_PS.png create mode 100644 apps/wr/public/images/map/layericon/SWL_CLAY_PS_RED.png create mode 100644 apps/wr/public/images/map/layericon/SWL_DEPT_PS.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS_BLACK.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS_BLUE.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS_GRAY.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS_GREEN.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS_RED.png create mode 100644 apps/wr/public/images/map/layericon/SWL_MANH_PS_YELLOW.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPEW_PS.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPOT_PS.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPOT_PS_BLACK.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPOT_PS_BLUE.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPOT_PS_GREEN.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPOT_PS_GREY.png create mode 100644 apps/wr/public/images/map/layericon/SWL_SPOT_PS_RED.png create mode 100644 apps/wr/public/images/map/layericon/SWL_VENT_PS.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPBD_ENTRC.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPGF_LOC.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPOT_NOIN.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPRD_BANO.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPRD_CRSRD.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPRD_NONM.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPRD_RENM.png create mode 100644 apps/wr/public/images/map/layericon/TL_SPRD_RWNM.png create mode 100644 apps/wr/public/images/map/layericon/UFL_BMAN_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_BOPC_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_BPIP_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_BPOL_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_BTRS_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_GMNT_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_GPIP_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_GPRS_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_GVAL_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_KMAN_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_KPOL_PS.png create mode 100644 apps/wr/public/images/map/layericon/UFL_VALV_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_FIRE_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_FLOW_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_MANH_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_META_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_PIPE_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_RSRV_PS.png create mode 100644 apps/wr/public/images/map/layericon/WTL_RSRV_PS_GRAY.png create mode 100644 apps/wr/public/images/map/layericon/WTL_VALV_PS.png create mode 100644 apps/wr/public/images/map/layericon/default.png create mode 100644 apps/wr/public/images/map/layericon/reset.png rename packages/common/business_components/src/ui/map/{MapToggleBtn.js => GisMapToggle.js} (100%) diff --git a/apps/sn/app/components/lib/api/index.ts b/apps/sn/app/components/lib/api/index.ts index a171844a1..24f15ed10 100644 --- a/apps/sn/app/components/lib/api/index.ts +++ b/apps/sn/app/components/lib/api/index.ts @@ -1,4 +1,4 @@ -const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ''; +const BASE_URL = 'http://con.mind-one.co.kr:11083/sewerage-service/api'; export const postData = async (url: string, data: object): Promise => { const options: RequestInit = { diff --git a/apps/sn/app/components/ui/modal.tsx b/apps/sn/app/components/ui/modal.tsx index bc8085f71..f1dda48a6 100644 --- a/apps/sn/app/components/ui/modal.tsx +++ b/apps/sn/app/components/ui/modal.tsx @@ -7,20 +7,24 @@ interface ModalProps { title?: string; children: React.ReactNode; closeModal: () => void; + saveModal?: () => void } -const Modal: React.FC = ({ isModalOpen, setIsModalOpen, title, children, closeModal }) => { +const Modal: React.FC = ({ isModalOpen, setIsModalOpen, title, children, closeModal,saveModal }) => { return ( - - + + {title ? {title} : null} {children} +
+ {saveModal ? : null} +
diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 36451bfbd..e5e506796 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -4,16 +4,29 @@ import { useEffect, useState } from "react"; type UiTableProps = { headName: React.ReactNode | undefined; + tableName1?: React.ReactNode | undefined; tableData: { [key: string]: string | number | boolean | object }[]; headlist: UiHeadProps[]; pageSize: number; total: number; - children: React.ReactNode | undefined; + children: Record | undefined; cellClick: ((index: number | undefined, headId: string) => void) | undefined; onPageChange: (page: number) => void; className?: string; resetPageNo?: boolean; isEditable?: boolean; + tableName2?: React.ReactNode | undefined; + tableData2?: { [key: string]: string | number | boolean | object }[]; + headlist2?: UiHeadProps[]; + pageSize2?: number; + total2?: number; + children2?: Record | undefined; + cellClick2?: ((index: number | undefined, headId: string) => void) | undefined; + onPageChange2?: (page: number) => void; + className2?: string; + resetPageNo2?: boolean; + isEditable2?: boolean; + showSecondTable?: boolean; }; type UiHeadProps = { @@ -25,17 +38,30 @@ type UiHeadProps = { }; export function VerticalTable({ + headName, + tableName1, tableData, headlist, pageSize, total, children, - headName, cellClick, onPageChange, className = "", resetPageNo = false, isEditable = false, + tableName2, + tableData2, + headlist2, + pageSize2, + total2, + children2, + cellClick2, + onPageChange2, + className2 = "", + resetPageNo2 = false, + isEditable2 = false, + showSecondTable = false, }: UiTableProps) { const [cur, setCur] = useState(1); const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({}); @@ -45,7 +71,7 @@ export function VerticalTable({ onPageChange(1); } }, [onPageChange, resetPageNo]); - + useEffect(() => { if (tableData.length > 0 && tableData[0]) { setFormData(tableData[0] as { [key: string]: string | number | boolean }); @@ -72,6 +98,9 @@ export function VerticalTable({ ) : null}
+ {tableName1 && ( // tableName prop이 있으면 표시 +
{tableName1}
+ )} {headlist?.map((head) => ( @@ -82,9 +111,10 @@ export function VerticalTable({ {/* 데이터 값 또는 입력 필드 */} - {isEditable ? ( + {children && children[head.id] ? children[head.id] : isEditable ? ( head.type === "select" ? ( ) : head.type === "input" ? ( handleInputChange(head.id, e.target.value)} @@ -113,6 +144,54 @@ export function VerticalTable({ ))}
+ {tableName2 && ( // tableName prop이 있으면 표시 +
{tableName2}
+ )} + {showSecondTable && ( + + + {headlist2?.map((head) => ( + + {/* 컬럼 제목 */} + + {head.title} + + {/* 데이터 값 또는 입력 필드 */} + + {children && children[head.id] ? children[head.id] : isEditable2 ? ( + head.type === "select" ? ( + + ) : head.type === "input" ? ( + handleInputChange(head.id, e.target.value)} + className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" + /> + ) : ( + {formData[head.id] ?? "-"} + ) + ) : ( + {formData[head.id] ?? "-"} + )} + + + ))} + +
+ )} {total > 0 && ( ; + props?: any; + }; +}; // 레이어 이름과 컴포넌트를 매핑 -const layerContentMap: { [key: string]: { component?: React.FC ; props?: any; } } = { +// 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업 +const layerContentMap: LayerContentMap = { // TODO: gis데이터 추가되면 추가 작업 필요 - "하수처리시설": { - component: SwtrmtFclt, - }, + "하수처리시설": { component: SwtrmtFclt, }, "하수처리구역": { }, - "중점우수토실":{component: Ssc,}, - "하수관로":{component: SwtrmtFclt,}, + "우수토실":{component: Ssc,}, + "중점우수토실":{component: Ssc, }, // 중점우수토실 여부 설정 + // "하수관로":{component: MsSwagePpl,}, "하수맨홀":{component: smh,}, + // "빗물펌프":{component:StormWaterPump}, + // "오수펌프":{component:sewagePump}, }; // 동적 컴포넌트 반환 함수 -export const getLayerContentComponent = (layerNm: string): React.FC => { +export const getLayerContentComponent = (layerNm: string): React.FC | null => { const component = layerContentMap[layerNm]; if (!component || !component.component) { // component가 없으면 null 반환 return () => null; } - return component.component; + return component.component }; // 사용자 입력 필드 (보수 및 갱신, 청소 및 준설, 점검 및 진단) export const handleInputChange = (section: string, diff --git a/apps/sn/app/map/components/common/table.ts b/apps/sn/app/map/components/common/table.ts index a64e610d3..6c641f9be 100644 --- a/apps/sn/app/map/components/common/table.ts +++ b/apps/sn/app/map/components/common/table.ts @@ -7,11 +7,11 @@ export const SwtrmtFcltCol = [ { id: 'oprtngStrtYmd', title: '가동개시일자' }, { id: 'clsgYmd', title: '폐쇄일자' }, { id: 'prcsMsrcCd', title: '처리공법코드' }, - { id: 'laeCd', title: '지자체코드' }, + // { id: 'laeCd', title: '지자체코드' }, { id: 'laeNm', title: '지자체명' }, { id: 'ctpvNm', title: '시도명' }, { id: 'sggNm', title: '시군구명' }, - { id: 'sareaCd', title: '권역코드' }, + // { id: 'sareaCd', title: '권역코드' }, { id: 'sareaNm', title: '권역명' }, { id: 'lrgeSareaNm', title: '대권역명' }, { id: 'rvrNm', title: '하천명' }, @@ -26,7 +26,7 @@ export const SwtrmtFcltCol = [ { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, - { id: 'oprtngSttsCd', title: '가동상태코드' }, + // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprsMsrcCn', title: '대표공법내용' }, { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, { id: 'sttyCrtrToc', title: '법정기준TOC' }, @@ -35,17 +35,94 @@ export const SwtrmtFcltCol = [ { id: 'sttyCrtrTph', title: '법정기준총인' }, { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, { id: 'bsnNm', title: '유역명' }, - { id: 'obsrvnSptCd', title: '관측지점코드' }, + // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; // 하수처리구역 export const SwtrmtPrcsZoneCol = [ { id: 'swtrmtZoneSn', title: '하수처리구역 일련번호' }, { id: 'swtrmtZoneNm', title: '하수처리구역명' }, - { id: 'swtrmtFcltCd', title: '하수처리시설코드' }, - { id: 'ctpvCd', title: '시도코드' }, + // { id: 'swtrmtFcltCd', title: '하수처리시설코드' }, + // { id: 'ctpvCd', title: '시도코드' }, { id: 'ctpvNm', title: '시도명' }, - { id: 'sggCd', title: '시군구코드' }, + // { id: 'sggCd', title: '시군구코드' }, { id: 'sggNm', title: '시군구명' }, { id: 'swtrmtFcltNm', title: '하수처리시설명' }, -] +]; + +// 하수맨홀 +export const MsSwageMhlCol = [ + { id: 'fid', title: 'FID' }, + { id: 'geom', title: 'geometry' }, + { id: 'ftreSmblCd', title: '지형지물부호코드' }, + { id: 'mngNo', title: '관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'lastDrdgnYmd', title: '최종준설일자' }, + { id: 'usgCd', title: '용도코드' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + { id: 'mhlKndCd', title: '맨홀종류코드' }, + { id: 'swageMhDiam', title: '하수맨홀구경' }, + { id: 'wdthLen', title: '가로길이' }, + { id: 'vrtcLen', title: '세로길이' }, + // { id: 'mqltCd', title: '재질코드' }, + { id: 'altdVl', title: '표고값' }, + { id: 'dpthlVl', title: '심도값' }, + { id: 'instMngNo', title:'기관관리번호'} +]; + +// 중점우수토실 측정지점 +export const untrtSwgRainCol1 = [ + { id: 'manage_no', title: '관리번호' }, + { id: 'swr_ppl_eqp_nm', title: '처리구역' }, + { id: 'swr_ppl_trt_nm', title: '처리분구' }, + { id: 'addr', title: '인근주소' }, + { id: 'chmbr_xcnts', title: '토실 위도' }, + { id: 'chmbr_ydnts', title: '토실 경도' } +]; + +// 중점우수토실 측정지점 시설현황 +export const untrtSwgRainCol2 = [ + { id: 'flwmtr_mesure_tp_etc', title: '구분' }, + { id: 'discharge_pipe_spec', title: '방류관로 규격' }, + { id: 'swr_ppl_eqp_ar', title: '배수구역 면적(m²)' }, + { id: 'swr_trt_popl', title: '하수처리 인구(인)' }, + { id: 'screen_instl_at', title: '스크린설치 여부' }, + { id: 'weir_hg', title: '위어 높이(m)' }, + { id: 'weir_lt', title: '위어 길이(m)' } +]; + +// 중점우수토실 강우정보 (id값 틀릴 수 있음) +export const untrtSwgRainCol3 = [ + { id: 'rain_begin_dt', title: '강우시작일시' }, + { id: 'rain_end_dt', title: '강우종료일시' }, + { id: 'precdng_dry', title: '선행건기(h)' }, + { id: 'rain_info', title: '강우정보' }, + { id: 'rain_fall', title: '누적강우량(mm)' }, + { id: 'cntnc_time', title: '지속시간(h)' }, + { id: 'rain_in', title: '강우강도(mm/h)' } +]; + +// 중점우수토실 측정정보 (id값 틀릴 수 있음) +export const untrtSwgRainCol4 = [ + { id: 'mesure_begin_dt', title: '측정시작일시' }, + { id: 'mesure_end_dt', title: '측정종료일시' }, + { id: 'mesure_intrvl', title: '측정간격(분)' }, + { id: 'mesure_mhrls_instl_lc', title: '측정기기 설치위치' }, + { id: 'flwmtr_combined', title: '유량계 종류 및 모델명' }, // 합쳐진 컬럼 + { id: 'qltwtr_begin_dt', title: '채수시작일시' }, + { id: 'qltwtr_end_dt', title: '채수종료일시' }, + { id: 'qltwtr_co', title: '채수횟수' } +]; + +// 중점우수토실 수량/수질측정 정보 +export const untrtSwgRainCol5 = [ + { id: 'odr', title: '회차' }, + { id: 'mesureDt', title: '측정일자' }, + { id: 'mesureQy', title: '수량(m)' }, + { id: 'mesureBod', title: 'BOD(mg/L)' }, + { id: 'mesureToc', title: 'TOC(mg/L)' }, + { id: 'mesureLoad', title: '오염부하량(kg)' } +]; \ No newline at end of file diff --git a/apps/sn/app/map/components/popupComponent/Ssc.tsx b/apps/sn/app/map/components/popupComponent/Ssc.tsx index a6e783ac9..2ca7c174d 100644 --- a/apps/sn/app/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/map/components/popupComponent/Ssc.tsx @@ -1,18 +1,16 @@ // 우수토실 -import Modal from '@/components/ui/modal'; -import { VerticalTable } from '@/components/ui/verticalTable'; -import { UiTable } from '@common/business_components/ui'; +import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; -import React from 'react' -const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "mainSscYn", title: "중점우수토실 대상여부", type: "select", options: ['Y', 'N'] }, -]; -const headlist = [ - { id: 'startrain', title: '강우시작일시' }, { id: 'endrain', title: '강우종료일시' }, { id: '선행건기', title: '선행건기(h)' }, { id: '강우정보', title: '강우정보' }, { id: '누적강우량', title: '누적강우량(mm)' }, { id: '지속시간', title: '지속시간(h)' }, { id: '강우강도', title: '강우강도(mm/h)' }, -] -const headlist3 = [{ id: 'nm', title: '회차' }, { id: 'date', title: '측정일자' }, { id: 'measure', title: '수량(m)' }, { id: 'bod', title: 'BOD(mg/L)' }, { id: 'toc', title: 'TOC(mg/L)' }, { id: '오염부하량', title: '오염부하량(kg)' }] -const Ssc = () => { +import React from 'react'; +import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; + +const Ssc = ({ featureData, chkMainSsc, additionalData }: { + featureData: any, + chkMainSsc?: boolean, + additionalData?: any +}) => { + console.log('Additional data received:', additionalData); // 추가 데이터 확인용 + const [isModalOpen, setIsModalOpen] = React.useState(false); const openModal = () => { setIsModalOpen(true); @@ -20,45 +18,120 @@ const Ssc = () => { const closeModal = () => { setIsModalOpen(false); }; + + // 데이터 전처리: 합쳐진 필드 추가 + const preprocessedData = featureData ? [{ + ...featureData, + flwmtr_combined: `${featureData.flwmtr_mesure_tp_etc || '-'} / ${featureData.flwmtr_knd || '-'}` + }] : []; + + const renderModalBody = () => ( +
+ {/* 강우정보 테이블 */} + + + {/* 측정정보 테이블 */} + + {/* 커스텀 헤더 */} + + 수량 + 수질 + + + 측정시작일시 + 측정종료일시 + 측정간격(분) + 측정기기설치위치 + 유량계 종류 및 모델명 + 채수시작일시 + 채수종료일시 + 채수횟수 + + + + {/* 수량/수질측정 정보 테이블 */} + +
+ ); + return ( -
-
-
-

중점우수토실 운영정보

+
+ {/* */} + + {!chkMainSsc ? null : +
+
+

중점우수토실 운영정보

+
+ + +
- - -
- {/* 커스텀 헤더 */} - - - 수량 - - - 수질 - - - - 측정시작일시 - 측정종료일시 - 측정간격(분) - 측정기기설치위치 - 유량계 종류 및 모델명 - 채수시작일시 - 채수종료일시 - 채수횟수 - -
-
-
+ }
) } diff --git a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx b/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx index b6d785414..0d1c3ef2e 100644 --- a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx +++ b/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx @@ -1,44 +1,48 @@ -import { VerticalTable } from '@/components/ui/verticalTable'; +import Modal from '../../../components/ui/modal'; +import { VerticalTable } from '../../../components/ui/verticalTable'; +import { UiTable } from '@common/business_components/ui'; +import { Button, TableCell } from '@common/components/ui'; import React, { useState } from 'react' -import InputSection from '../InputSection'; -import { handleInputChange } from '../common'; + // 하수처리시설 -// TODO: 컬럼에 보고서 엉 ? 이거 버튼누르면 팝업으로 상세화면 띄워주는 건지 확인 필요 -const inputColumn = [ - { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "bungu", title: "배수분구", type: "input" }, - { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, - { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, -]; +const headList = [ + { id: "title", title: "하수도정비 기본계획보고서" }, + { id: "cad", title: "하수도대장 평면도" },] +const modalHeadList = [ + { id: "no", title: "번호" }, + { id: "year", title: "승인연도" }, + { id: "cad", title: '평면도'}, + { id: "fileNm", title: "파일명" }, + { id: "date", title: "입력시간" }, +] + const SwtrmtFclt = () => { - const [repairData, setRepairData] = useState([ - { year: "2025", type: "개대체" }, - { year: "2025", type: "보수" }, - ]); - const [cleaningData, setCleaningData] = useState([ - { year: "2025", type: "청소" }, - { year: "2025", type: "준설" }, - ]); - const [inspectionData, setInspectionData] = useState([ - { year: "2025", type: "관로기술진단" }, - { year: "2025", type: "관로기술진단" }, - ]); - const dataMap = { - repair: { data: repairData, setData: setRepairData }, - cleaning: { data: cleaningData, setData: setCleaningData }, - inspection: { data: inspectionData, setData: setInspectionData }, + const [isModalOpen, setIsModalOpen] = useState(false); + const [modalTitle, setModalTitle] = useState(''); + const openModal = (title:string) => { + setIsModalOpen(true); + setModalTitle(title) + }; + const closeModal = () => { + setIsModalOpen(false); }; return (
- openModal('하수도정비 기본계획보고서')}>보고서, + cad: , + }} headName='디지털 자료관 연계정보' tableData={[]} headlist={headList} pageSize={20} total={0} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { throw new Error("Function not implemented."); }}> - handleInputChange(section, index, field, value, dataMap)} /> - handleInputChange(section, index, field, value, dataMap)} /> - handleInputChange(section, index, field, value, dataMap)} />
+ +
+ +
+
+
) } diff --git a/apps/sn/app/map/components/popupComponent/smh.tsx b/apps/sn/app/map/components/popupComponent/smh.tsx index e693a28ce..39920232b 100644 --- a/apps/sn/app/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/map/components/popupComponent/smh.tsx @@ -1,5 +1,5 @@ // 하수맨홀 -import { VerticalTable } from '@/components/ui/verticalTable'; +import { VerticalTable } from '../../../components/ui/verticalTable'; import React from 'react' const inputColumn = [ { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, diff --git a/apps/wr/app/map/featureClickEventPopup.tsx b/apps/wr/app/map/featureClickEventPopup.tsx new file mode 100644 index 000000000..8048d0997 --- /dev/null +++ b/apps/wr/app/map/featureClickEventPopup.tsx @@ -0,0 +1,201 @@ +'use client' +import { getData, putData } from "../../../sn/app/components/lib/api"; +import Modal from "../../../sn/app/components/ui/modal"; +import { VerticalTable } from "../../../sn/app/components/ui/verticalTable"; +import { useGisContext } from "@common/business_components/ui/map/Gis"; +import { Button } from "@common/components/ui"; +import { useEffect, useRef, useState } from "react"; +import { getLayerContentComponent } from "../../../sn/app/map/components/common"; +// TODO: +const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { + const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; + // const featureId = featureData.getId(); // 피처의 id 가져오기 + const featureId = typeof featureData.getId === 'function' + ? featureData.getId() + : featureData.fid; + const [layerNm, setLayerNm] = useState(""); // 레이어 이름 상태 + const [tableData, setTableData] = useState(null); // 피처 데이터 + const [mntrngsData, setMntrngsData] = useState(false); // 수량/수질 측정 정보 + const [headlist, setHeadlist] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 + const [headlist2, setHeadlist2] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 + const [buttonChk, setButtonChk] = useState(true) + const [fetchData, setfetchData] = useState(); // api 호출여부 + const contentRef = useRef(null); + const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태 + const [chkMainSsc, setChkMainSsc] = useState(false); // 중점우수토실 여부 + + // 피쳐데이터의 현재 레이어 이름 가져오는 함수 + const getSelectedLayers = () => { + let result = null; + const layers = gisMap.getLayers().getArray(); // gisMap에서 모든 레이어 가져오기 + let featureLayer: { get: (key: string) => any } = { get: (key: string) => null }; // 피처가 속한 레이어를 찾기 위한 변수 + layers.forEach((layer: any) => { + const source = layer.getSource(); + if (source && source.hasFeature && featureData + && typeof featureData.getId === 'function' && source.hasFeature(featureData)) { + featureLayer = layer; // 피처가 속한 레이어 찾기 + } + }); + // SearchModal 클릭 이벤트와 Gis 클릭 이벤트 구분하기 + if (featureLayer.get('lyrNm') === null) { + if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; + else if (featureData.lyrTypeNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; + else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; + } + else result = featureLayer.get('lyrNm'); + + return result; + // return featureLayer.get('lyrNm'); // 레이어 이름 출력 + }; + + useEffect(() => { + const fetchData = async () => { + if (featureId) { + const selectedLayerName = getSelectedLayers(); // 레이어 이름 가져오기 + setLayerNm(selectedLayerName); // 상태 업데이트 + const layerId = featureId.split('.')[0] + let data = await getData(`v1/fclts/${featureId}?lyrTypeNm=${layerId}`); + setfetchData(data) + switch (selectedLayerName) { + case '하수처리시설': + setButtonChk(false) + break; + case '하수처리구역': + setButtonChk(false) + break; + case '중점우수토실': + setButtonChk(false) + setChkMainSsc(true) + + // 데이터 전처리: 합쳐진 필드 추가 + data = data ? { + ...data, + discharge_pipe_spec: `직경: ${data.pipe_diameter || '-'} / 높이: ${data.pipe_hg || '-'} / 길이: ${data.pipe_lt || '-'}` + } : {}; + + // 수량/수질측정 정보 데이터 호출 + const additionalResponse = await getData(`v1/onsemiro/swgRain/${data.adst_dstr_cd}/${data.manage_no}/mntrngs`); + setMntrngsData(additionalResponse.content); + break; + case '우수토실': + setButtonChk(true) + break; + case '하수관로': + setButtonChk(true) + break; + case '오수펌프': + setButtonChk(true) + break; + case '빗물펌프': + setButtonChk(true) + break; + case '하수맨홀': + setButtonChk(true) + break; + default: + break; + } + setTableData(data); + }; + } + fetchData(); + }, [featureId]); + + // 저장 시 모달 띄우기 + const handleSaveClick = () => { + setIsModalOpen(true); // 모달 열기 + }; + + const handleModalSave = () => { + setIsModalOpen(false); // 모달 닫기 + btnClickEvent(); // 저장 이벤트 실행 + }; + + const handleModalClose = () => { + setIsModalOpen(false); // 모달 닫기 + }; + + const btnClickEvent = async () => { + const bodyData: Record = {} + if (buttonChk && contentRef.current) { + const inputElements = contentRef.current.querySelectorAll('input'); + const selectElements = contentRef.current.querySelectorAll('select'); + // 카멜케이스 변환 함수 + const toCamelCase = (str: string) => + str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()); + // select 태그의 값 가져오기 + selectElements.forEach((select) => { + const camelCaseId = toCamelCase(select.id); + bodyData[camelCaseId] = select.value; + }); + // input 태그의 값 가져오기 + inputElements.forEach((input) => { + const camelCaseId = toCamelCase(input.id); + bodyData[camelCaseId] = input.value; + }); + if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' + else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' + else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' + else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' + else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' + bodyData['fid'] = featureId + const data = await putData(`v1/fclts/${featureId}`, bodyData); + if (data.status == 200) { + alert('저장되었습니다') + setTableData(data) + setfetchData(data) + } + } + } + type ContentComponentProps = { + featureData: any; + chkMainSsc: boolean; + additionalData: any; + }; + const ContentComponent = layerNm ? getLayerContentComponent(layerNm) as React.ComponentType : null; + return ( + + ) +} +export default FeatureClickEventPopup; \ No newline at end of file diff --git a/apps/wr/app/map/govSidoSigunguSearchForm.tsx b/apps/wr/app/map/govSidoSigunguSearchForm.tsx new file mode 100644 index 000000000..127d02f78 --- /dev/null +++ b/apps/wr/app/map/govSidoSigunguSearchForm.tsx @@ -0,0 +1,114 @@ +import { useWrStore } from "@/app/store"; +import { getCityOrSgg } from "@/components/lib/func/commom"; +import { + type ReturnType +} from "@common/business_components/ui"; +import { SelectBox } from '@common/business_components/ui/select'; +import React, { useEffect, useRef, useState } from 'react'; + +export type comCodeState = { + code: { + isInit: boolean; + chBuCd: SelectDataType[] + rainFcltCd: SelectDataType[]; + bdstUsgCd: SelectDataType[]; + cityCd: SelectDataType[]; + sggCd: SelectDataType[]; + rvbsnCd: SelectDataType[]; + mdmbsnCd: SelectDataType[]; + lgbsnCd: SelectDataType[]; + lclgvrnmntCd: EnvPartSelectDataType[]; + orgwtKndCd: SelectDataType[]; + yn: SelectDataType[]; + buildingType: { + RST: string, + RNB: string, + HTB: string + } + }; +}; + +type SelectDataType = { + text: string; + val: string; + sido?: string; // 시도 코드 (선택 사항) +} + +type EnvPartSelectDataType = SelectDataType & { + adstDliStrCd: string, +} + +type SearchFormLeftProps = { + isShowPart?: boolean | undefined; + children: React.ReactNode; + selectSidoData?: SelectDataType[] | []; + selectSigunData?: SelectDataType[] | []; + selectRegionData?: SelectDataType[] | []; + selectUnitWaterShedData?: SelectDataType[] | []; + selectMiddleRegionData?: SelectDataType[] | []; + selectEnvPartData?: EnvPartSelectDataType[] | []; + selectEnvPartSidoData?: SelectDataType[] | []; + selectEnvPartSigunData?: SelectDataType[] | []; + + setRtnPartValue?: (value: string) => void; + setRtnSidoValue?: (value: string) => void; + setRtnSigunValue?: (value: string) => void; + setRtnRegionValue?: (value: string) => void; + setRtnUnitWaterShedValue?: (value: string) => void; + setRtnMiddleRegionValue?: (value: string) => void; + setRtnEnvPartValue?: (value: string) => void; + setRtnEnvPartSidoValue?: (value: string) => void; + setRtnEnvPartSigunValue?: (value: { val: string, text: string }) => void; // setRtnEnvPartSigunValue prop 타입을 객체로 변경 + resetTrigger?: boolean; +} + + + +function GovSidoSigunguSearchForm({ + isShowPart = false, + children, + selectSidoData = [], + selectSigunData = [], + selectRegionData = [], + selectUnitWaterShedData = [], + selectMiddleRegionData = [], + selectEnvPartData = [], + setRtnPartValue, + setRtnSidoValue, + setRtnSigunValue, + setRtnRegionValue, + setRtnUnitWaterShedValue, + setRtnMiddleRegionValue, + setRtnEnvPartValue, + setRtnEnvPartSidoValue, + setRtnEnvPartSigunValue, + resetTrigger = false +}: SearchFormLeftProps) { + const { code, pbnstSttn, pbnstSttnSearch } = useWrStore((state) => state); + + const ref = useRef({} as ReturnType); + const codeData = getCityOrSgg(ref); + //환경청별 시도 시군구 + const [envPartValue, setEnvPartValue] = useState('0'); + // 환경청 + const [filteredEnvPartSigunDataSelected, setFilteredEnvPartSigunDataSelected] = useState([]); + + return ( + isShowPart ? ( +
+ <> + onSelectValue(val.toString(), 'envPart')} value={envPartValue} selectClass={'rounded-lg bg-white truncate'} /> + onSelectValue(val.toString(), 'envPartSido')} value={envPartSidoValue} selectClass={'rounded-lg bg-white truncate'} /> + onSelectValue(val.toString(), 'envPartSigun')} value={envPartSigunValue} selectClass={'rounded-lg bg-white truncate'} /> + + {children} +
+ ) : ( +
+ {children} +
+ ) + ) +} + +export { GovSidoSigunguSearchForm }; diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx new file mode 100644 index 000000000..f6b967c05 --- /dev/null +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -0,0 +1,113 @@ +"use client"; + +import Gis from "@common/business_components/ui/map/Gis"; +import GisApp from "@common/business_components/ui/map/lib/gis.core"; +import { useEffect, useRef, useState } from "react"; +import SearchModal from "../searchModal"; +import FeatureClickEventPopup from "../featureClickEventPopup"; +import { mapService } from "../service"; + +const Map = () => { + const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 + const [selectedFeature, setSelectedFeature] = useState(null); // 선택된 피처 상태 + const gisMaps = useRef(null); + const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 + const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태 + const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터 + const fetchData = async () => { + try { + const response = await mapService.getLyrStngs(); + setTreeData(response); // API 응답 저장 + } catch (error) { + console.error("데이터 불러오기 실패:", error); + } + }; + + // 컴포넌트 마운트 시 1회 실행 + useEffect(() => { + fetchData(); + }, []); + + // SearchModal, GisContent 등에서 호출 + // const onFeatureSelect = (data: any) => { + // let map = gisMaps.current; + // if (!map) { + // console.warn("지도가 초기화되지 않았습니다."); + // return; + // } + + // // 항상 같은 select 객체 사용 + // const select = GisApp.Module.select as any; + // if (!select) return; + + // // 1. 기존 선택 초기화 + // select.resetSelectedFeature(); + + // // 2. data가 OpenLayers Feature 인스턴스인지 확인 + // let foundFeature = null; + // if ( + // data && + // typeof data.getGeometry === "function" && + // typeof data.setStyle === "function" + // ) { + // // 이미 Feature 인스턴스라면 그대로 사용 + // foundFeature = data; + // } else { + // // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용 + // const featureId = data.fid || data.ftrIdn || data.id; + // map + // .getLayers() + // .getArray() + // .forEach((layer: any) => { + // const source = layer.getSource?.(); + // if (source?.getFeatureById) { + // const feature = source.getFeatureById(String(featureId).trim()); + // if (feature) foundFeature = feature; + // } + // }); + // } + + // // 3. 피처 선택 + // if (foundFeature) { + // let geometry = foundFeature.getGeometry(); + // if (geometry) { + // let extent = geometry.getExtent(); + + // map.getView().fit(extent, { + // duration: 300, + // padding: [50, 50, 50, 50], + // maxZoom: 16, + // constrainResolution: true, + // nearest: true, + // }); + // } + // select.selectFeature(foundFeature, true); + // } else { + // console.warn("OpenLayers Feature를 찾을 수 없습니다:", data); + // } + + // setFeatureData(data); + // setIsOpen(true); + // setIsSearchModalOpen(false); + // }; + return ( +
+ +
+ ); +}; + +export default Map; diff --git a/apps/wr/app/map/mapSearchBar.tsx b/apps/wr/app/map/mapSearchBar.tsx new file mode 100644 index 000000000..a578dfac2 --- /dev/null +++ b/apps/wr/app/map/mapSearchBar.tsx @@ -0,0 +1,154 @@ +"use client" + +import { Button } from "@common/components/ui"; +import { useCallback, useEffect, useState } from "react"; +import type { EnvPartSelectDataType } from "@common/business_components/ui/search_form_left"; +import { SearchFormRight } from "@common/business_components/ui/search_form_right"; +import type { SelectDataType } from "@common/business_components/ui/search_input_select"; +import type { ReturnType } from "@common/business_components/ui/search_base_form"; +import { MapSearchForm } from "./mapSearchForm"; + +type SearchBaseType = { + selectSidoData?: SelectDataType[] | []; + selectSigunData?: SelectDataType[] | []; + selectRegionData?: SelectDataType[] | []; + selectUnitWaterShedData?: SelectDataType[] | []; + selectMiddleRegionData?: SelectDataType[] | []; + selectEnvPartData?: EnvPartSelectDataType[] | []; + queryClick: (returnType: ReturnType) => void; + excelName?: string; + excelClick: (returnType: ReturnType) => void; + initClick: () => void; + btnClass: string; + ref: React.RefObject; + isAdmin: boolean; + leftClassName?: string; + rightClassName?: string; + showQueryButton?: boolean; + showInitButton?: boolean; + showApplyButton?: boolean; +} + +export function MapSearchBar({ + selectSidoData, + selectSigunData, + selectRegionData, + selectUnitWaterShedData, + selectMiddleRegionData, + selectEnvPartData, + btnClass, + excelName, + queryClick, + excelClick, + initClick, + ref, + isAdmin = false, + leftClassName, + rightClassName, + showQueryButton = true, + showInitButton = true, + showApplyButton = false +}: SearchBaseType) { + const [partValue, setPartValue] = useState("A"); + const [sidoValue, setSidoValue] = useState("0"); + const [sigunValue, setSigunValue] = useState("0"); + const [sidoText, setSidoText] = useState(""); + const [sigunText, setSigunText] = useState(""); + const [regionValue, setRegionValue] = useState("0"); + const [untitWaterShedValue, setUntitWaterShedValue] = useState("0"); + const [middleRegionValue, setMiddleRegionValue] = useState("0"); + const [envPartValue, setEnvPartValue] = useState("0"); + const [resetTrigger, setResetTrigger] = useState(false); + + const queryVal = () => { + console.log("조회버튼 클릭"); + queryClick({ + partValue: partValue, + sidoValue: sidoValue, + sigunValue: sigunValue, + regionValue: regionValue, + unitWaterShedValue: untitWaterShedValue, + middleRegionValue: middleRegionValue, + envPartValue: envPartValue, + sidoText: sidoText, + sigunText: sigunText, + }); + } + + const initVal = useCallback(() => { + setResetTrigger(true); + initClick(); + }, [setResetTrigger, initClick]); + + useEffect(() => { + if (resetTrigger) { + setResetTrigger(false); + } + }, [resetTrigger]); + + const excelDownload = () => { + excelClick({ + partValue: partValue, + sidoValue: sidoValue, + sigunValue: sigunValue, + regionValue: regionValue, + unitWaterShedValue: untitWaterShedValue, + middleRegionValue: middleRegionValue, + envPartValue: envPartValue, + sidoText: sidoText, + sigunText: sigunText, + }) + }; + + useEffect(() => { + if (ref && ref.current) { + const customRef = ref.current; + customRef.partValue = partValue; + customRef.sidoValue = sidoValue; + customRef.sigunValue = sigunValue; + customRef.regionValue = regionValue; + customRef.unitWaterShedValue = untitWaterShedValue; + customRef.middleRegionValue = middleRegionValue; + customRef.envPartValue = envPartValue; + customRef.sidoText = sidoText; + customRef.sigunText = sigunText; + } + }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, sidoText, sigunText, ref]); + + return ( +
+ {/* 검색 조건 부분 */} + + {/* 버튼 부분 */} +
+
+ {showQueryButton && } + {showInitButton && } + {showApplyButton && } +
+
+
+ ) +} diff --git a/apps/wr/app/map/mapSearchForm.tsx b/apps/wr/app/map/mapSearchForm.tsx new file mode 100644 index 000000000..00ba8e6f0 --- /dev/null +++ b/apps/wr/app/map/mapSearchForm.tsx @@ -0,0 +1,347 @@ +"use client" + +import React, { useEffect, useState } from 'react'; +import type { SelectDataType } from "@common/business_components/ui/search_input_select"; +import { SelectBox } from '@common/business_components/ui/select'; + +/** + * 검색 폼 왼쪽 컴포넌트 타입 + * + * @param isShowPart 구분 조회 여부 + * @param children 자식 컴포넌트 + * @param selectSidoData 시도 데이터 + * @param selectSigunData 시군구 데이터 + * @param selectRegionData 유역 데이터 + * @param selectUnitWaterShedData 단위유역 데이터 + * @param selectMiddleRegionData 중권역 데이터 + * @param selectEnvPartData 환경청 데이터 + * @param selectEnvPartSidoData 환경청 시도 데이터 + * @param selectEnvPartSigunData 환경청 시군구 데이터 + * @param setRtnPartValue 부분 값 변경 핸들러 + */ +type SearchFormLeftProps = { + isShowPart?: boolean | undefined; + children: React.ReactNode; + selectSidoData?: SelectDataType[] | []; + selectSigunData?: SelectDataType[] | []; + selectRegionData?: SelectDataType[] | []; + selectUnitWaterShedData?: SelectDataType[] | []; + selectMiddleRegionData?: SelectDataType[] | []; + selectEnvPartData?: EnvPartSelectDataType[] | []; + selectEnvPartSidoData?: SelectDataType[] | []; + selectEnvPartSigunData?: SelectDataType[] | []; + + setRtnPartValue?: (value: string) => void; + setRtnSidoValue?: (value: string) => void; + setRtnSigunValue?: (value: string) => void; + setRtnRegionValue?: (value: string) => void; + setRtnUnitWaterShedValue?: (value: string) => void; + setRtnMiddleRegionValue?: (value: string) => void; + setRtnEnvPartValue?: (value: string) => void; + setRtnEnvPartSidoValue?: (value: string) => void; + setRtnEnvPartSigunValue?: (value: string) => void; + setRtnSidoText?: (value: string) => void; + setRtnSigunText?: (value: string) => void; + resetTrigger?: boolean; + isAdmin?: boolean; +} + +export type EnvPartSelectDataType = SelectDataType & { + adstDliStrCd: string, +} + +const selectPartData: SelectDataType[] = [ + { text: "행정별", val: 'A' }, + { text: "유역별", val: 'R' }, + { text: "환경청별", val: 'G' }, +]; + +const selectType: SelectDataType[] = [ + { text: "행정별", val: 'A' }, + { text: "유역별", val: 'R' }, + { text: "환경청별", val: 'G' }, +]; + +function MapSearchForm({ isShowPart = false, children, selectSidoData = [], selectSigunData = [], selectRegionData = [], selectUnitWaterShedData = [], selectMiddleRegionData = [], selectEnvPartData = [], setRtnPartValue, setRtnSidoValue, setRtnSidoText, setRtnSigunValue, setRtnSigunText, setRtnRegionValue, setRtnUnitWaterShedValue, setRtnMiddleRegionValue, setRtnEnvPartValue, setRtnEnvPartSidoValue, setRtnEnvPartSigunValue, resetTrigger = false, isAdmin = false }: SearchFormLeftProps) { + /******************선택된 데이터******************/ + const [partValue, setPartValue] = useState('A'); + //행정별 시도 시군구 + const [sidoValue, setSidoValue] = useState('0'); + const [sigunValue, setSigunValue] = useState('0'); + const [sidoText, setSidoText] = useState(''); + const [sigunText, setSigunText] = useState(''); + //유역별 + const [regionValue, setRegionValue] = useState('0'); + const [unitWaterShedValue, setUnitWaterShedValue] = useState('0'); + const [middleRegionValue, setMiddleRegionValue] = useState('0'); + //환경청별 시도 시군구 + const [envPartValue, setEnvPartValue] = useState('0'); + // 환경청 + const [filteredEnvPartSigunDataSelected, setFilteredEnvPartSigunDataSelected] = useState([]); + + /****************** 셀렉트 리스트 데이터. ******************/ + // 조회된 조건에 맞는 시도 시군 유역 + const [filteredSigunData, setFilteredSigunData] = useState([{ text: "전체", val: '0' }]); + const [filteredUnitWaterShedData, setFilteredUnitWaterShedData] = useState([{ text: "전체", val: '0' }]); + const [filteredMiddleRegionData, setFilteredMiddleRegionData] = useState([{ text: "전체", val: '0' }]); + // 조회된 조건에 맞는 환경청 시도 시군 + const [filteredEnvPartData, setFilteredEnvPartData] = useState([{ text: "전체", val: '0', adstDliStrCd: '' }]); + const [filteredEnvPartSidoData, setFilteredEnvPartSidoData] = useState([{ text: "전체", val: '0', adstDliStrCd: '' }]); + const [filteredEnvPartSigunData, setFilteredEnvPartSigunData] = useState([{ text: "전체", val: '0' }]); + + // 시군구 세팅 + const initializeSigunData = (sidoCd: string) => { + if (sidoCd === '0') { + setSigunValue('0'); + setFilteredSigunData([{ text: "전체", val: '0' }]); + } else { + const newFilteredData = [ + { text: "전체", val: '0' }, + ...selectSigunData.filter((item: SelectDataType) => item.val.substring(0, 2) === sidoCd) + ]; + setSigunValue('0'); + setFilteredSigunData(newFilteredData); + } + } + + // 단위유역 세팅 + const initializeUnitWaterShedData = (regionCd: string) => { + if (regionCd === '0') { + setUnitWaterShedValue('0'); + setFilteredUnitWaterShedData([{ text: "전체", val: '0' }]); + } else { + const newFilteredData = [ + { text: "전체", val: '0' }, + ...selectUnitWaterShedData.filter((item: SelectDataType) => item.val.substring(0, 1) === regionCd) + ]; + setUnitWaterShedValue('0'); + setFilteredUnitWaterShedData(newFilteredData); + } + } + + // 중권역 세팅 + const initializeMiddleRegionData = (unitWaterShedCd: string) => { + if (unitWaterShedCd === '0') { + setMiddleRegionValue('0'); + setFilteredMiddleRegionData([{ text: "전체", val: '0' }]); + } else { + const newFilteredData = [ + { text: "전체", val: '0' }, + ...selectMiddleRegionData.filter((item: SelectDataType) => item.val.substring(0, 2) === unitWaterShedCd) + ]; + setMiddleRegionValue('0'); + setFilteredMiddleRegionData(newFilteredData); + } + } + + // 환경청 세팅 - 시도 + const initializeCityDataByEnvPartSido = (envPartCd: string) => { + const foundEnvPart = selectEnvPartData.find((item: EnvPartSelectDataType) => item.val === envPartCd); + const cityArray = foundEnvPart?.adstDliStrCd.toString().split('|').join('').split(','); + + // 시군구 데이터 + const envSigunData = selectSigunData.filter((item: SelectDataType) => cityArray?.includes(item.val)); + + // 환경청 시도 데이터 + const sidoArray = [...new Set(envSigunData.map((item: SelectDataType) => item.val.substring(0, 2)))]; + const envSidoData = selectSidoData.filter((item: SelectDataType) => sidoArray?.includes(item.val)); + setFilteredEnvPartSigunDataSelected(envSigunData); + + setFilteredEnvPartSidoData([ + { text: "전체", val: '0', adstDliStrCd: '' }, + ...envSidoData.map((item: SelectDataType) => ({ text: item.text, val: item.val, adstDliStrCd: '' })) + ]); + } + + // 환경청 세팅 - 시군구 + const initializeCityDataByEnvPartSigun = (sidoCd: string) => { + const envSigunData = filteredEnvPartSigunDataSelected.filter((item: SelectDataType) => item.val.substring(0, 2) === sidoCd); + setFilteredEnvPartSigunData([ + { text: "전체", val: '0' }, + ...envSigunData.map((item: SelectDataType) => ({ text: item.text, val: item.val })) + ]); + } + + const onSelectValue = (val: string, type: string) => { + let selectedSido; + let selectedSigun; + let selectedEnvPartSido; + let selectedEnvPartSigun; + + switch (type) { + case 'part': + setPartValue(val); + if (setRtnPartValue) { + setRtnPartValue(val); + } + // 구분 + if (val == 'R') { + initializeMiddleRegionData('0'); + initializeUnitWaterShedData('0'); + } else if (val == 'G') { + setFilteredEnvPartData([ + { text: "전체", val: '0', adstDliStrCd: '' }, + ...selectEnvPartData.filter((item: EnvPartSelectDataType) => item.val !== null && item.adstDliStrCd !== '') + ]); + setEnvPartValue('0'); + initializeCityDataByEnvPartSido('0'); + } else { + initializeSigunData('0'); + onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); + } + + // 다른 selectbox 전체로 초기화 + onSelectValue(selectSidoData[0]?.val || '0', 'sido'); + onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); + break; + case 'sido': + setSidoValue(val); + selectedSido = selectSidoData.find(item => item.val === val); + setSidoText(selectedSido?.text || ''); + if (setRtnSidoValue) { + setRtnSidoValue(val); + } + if (setRtnSidoText) { + setRtnSidoText(selectedSido?.text || ''); + } + initializeSigunData(val); + onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); + break; + case 'sigun': + if (setRtnSigunValue) { + setRtnSigunValue(val); + } + setSigunValue(val); + selectedSigun = filteredSigunData.find(item => item.val === val); + if (setRtnSigunText) { + setRtnSigunText(selectedSigun?.text || ''); + } + setSigunText(selectedSigun?.text || ''); + break; + + // 유역 세팅 + case 'region': + setRegionValue(val); + if (setRtnRegionValue) { + setRtnRegionValue(val); + } + initializeUnitWaterShedData(val); + onSelectValue(selectUnitWaterShedData[0]?.val || '0', 'unitWaterShed'); + break; + case 'unitWaterShed': + setUnitWaterShedValue(val); + if (setRtnUnitWaterShedValue) { + setRtnUnitWaterShedValue(val); + } + initializeMiddleRegionData(val); + onSelectValue(selectMiddleRegionData[0]?.val || '0', 'middleRegion'); + break; + case 'middleRegion': + setMiddleRegionValue(val); + if (setRtnMiddleRegionValue) { + setRtnMiddleRegionValue(val); + } + break; + + // 환경청 세팅 + case 'envPart': + setEnvPartValue(val); + if (setRtnEnvPartValue) { + setRtnEnvPartValue(val); + } + initializeCityDataByEnvPartSido(val); + onSelectValue(filteredEnvPartSidoData[0]?.val || '0', 'envPartSido'); + break; + case 'envPartSido': + setSidoValue(val); + selectedEnvPartSido = filteredEnvPartSidoData.find(item => item.val === val); + setSidoText(selectedEnvPartSido?.text || ''); + if (setRtnEnvPartSidoValue) { + setRtnEnvPartSidoValue(val); + } + initializeCityDataByEnvPartSigun(val); + onSelectValue(filteredEnvPartSigunData[0]?.val || '0', 'envPartSigun'); + break; + case 'envPartSigun': + setSigunValue(val); + selectedEnvPartSigun = filteredEnvPartSigunData.find(item => item.val === val); + setSigunText(selectedEnvPartSigun?.text || ''); + if (setRtnEnvPartSigunValue) { + setRtnEnvPartSigunValue(val); + } + break; + } + } + + // 리셋 함수 + const resetAllValues = () => { + setPartValue('A'); + setSidoValue('0'); + setSigunValue('0'); + setRegionValue('0'); + setUnitWaterShedValue('0'); + setMiddleRegionValue('0'); + setEnvPartValue('0'); + + setFilteredSigunData([{ text: "전체", val: '0' }]); + setFilteredUnitWaterShedData([{ text: "전체", val: '0' }]); + setFilteredMiddleRegionData([{ text: "전체", val: '0' }]); + setFilteredEnvPartData([{ text: "전체", val: '0', adstDliStrCd: '' }]); + setFilteredEnvPartSidoData([{ text: "전체", val: '0', adstDliStrCd: '' }]); + setFilteredEnvPartSigunData([{ text: "전체", val: '0' }]); + + if (setRtnPartValue) setRtnPartValue('A'); + if (setRtnSidoValue) setRtnSidoValue('0'); + if (setRtnSigunValue) setRtnSigunValue('0'); + if (setRtnRegionValue) setRtnRegionValue('0'); + if (setRtnUnitWaterShedValue) setRtnUnitWaterShedValue('0'); + if (setRtnMiddleRegionValue) setRtnMiddleRegionValue('0'); + if (setRtnEnvPartValue) setRtnEnvPartValue('0'); + if (setRtnEnvPartSidoValue) setRtnEnvPartSidoValue('0'); + if (setRtnEnvPartSigunValue) setRtnEnvPartSigunValue('0'); + }; + + // 리셋 트리거 변경 감지 + useEffect(() => { + if (resetTrigger) { + resetAllValues(); + // 리셋 후 트리거를 false로 설정 + if (setRtnPartValue) { + setRtnPartValue('0'); + } + } + }, [resetTrigger]); + + return ( + isShowPart ? ( +
+ onSelectValue(val.toString(), 'part')} value={partValue} selectClass={undefined} /> + {partValue === 'R' ? ( + <> + onSelectValue(val.toString(), 'region')} value={regionValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'unitWaterShed')} value={unitWaterShedValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'middleRegion')} value={middleRegionValue} selectClass={undefined} /> + + ) : partValue === 'G' ? ( + <> + onSelectValue(val.toString(), 'envPart')} value={envPartValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'envPartSido')} value={sidoValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'envPartSigun')} value={sigunValue} selectClass={undefined} /> + + ) : ( + <> + onSelectValue(val.toString(), 'sido')} value={sidoValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={undefined} /> + + )} + {children} +
+ ) : ( +
+ {children} +
+ ) + ) +} + +export { MapSearchForm }; diff --git a/apps/wr/app/map/searchModal.tsx b/apps/wr/app/map/searchModal.tsx new file mode 100644 index 000000000..d5dfaccc2 --- /dev/null +++ b/apps/wr/app/map/searchModal.tsx @@ -0,0 +1,82 @@ +"use client" + +import { useWrStore } from "@/app/store"; +import { btnClass } from "@/app/store/common/code"; +import React, { useCallback, useEffect, useRef, useState } from 'react'; +import { MapSearchBar, type ReturnType } from "./mapSearchBar"; +import { Button } from "@common/components/ui"; +import { SearchFormLeft, type EnvPartSelectDataType } from "@common/business_components/ui/search_form_left"; +import { SearchFormRight } from "@common/business_components/ui/search_form_right"; +import type { SelectDataType } from "@common/business_components/ui/search_input_select"; + +const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; + +const YEARS = Array.from({ length: 100 }, (_, i) => `${2025 - i}`); + +interface SearchModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; + onFeatureSelect: (row: any) => void; +} + +// 날짜 조합 함수 +const getDateString = ( + year: string, + month: string, + day: string, + defaultDate: string, +) => { + if (!year && !month && !day) return defaultDate; + const y = year || defaultDate.slice(0, 4); + const m = month || defaultDate.slice(4, 6); + const d = day || defaultDate.slice(6, 8); + return `${y}${m}${d}`; +}; + +const SearchModal: React.FC = ({ + open, + onOpenChange, + onFeatureSelect, +}) => { + + // 로딩바 + const [isLoading, setIsLoading] = useState(false); + // 상세 정보 조회를 위한 상태 추가 + const [popupFeature, setPopupFeature] = useState(null); + const { code, pbnstSttn, pbnstSttnSearch } = useWrStore((state) => state); + const [isChHead, setIsChHead] = useState(false); + const ref = useRef({} as ReturnType); + + return ( +
+ +
+ ); +}; + +export default React.memo(SearchModal); diff --git a/apps/wr/app/map/service/index.ts b/apps/wr/app/map/service/index.ts new file mode 100644 index 000000000..c6bfcff72 --- /dev/null +++ b/apps/wr/app/map/service/index.ts @@ -0,0 +1 @@ +export * from './map' diff --git a/apps/wr/app/map/service/map.ts b/apps/wr/app/map/service/map.ts new file mode 100644 index 000000000..bf0c8a694 --- /dev/null +++ b/apps/wr/app/map/service/map.ts @@ -0,0 +1,47 @@ + +/** + * 관망도 API + */ +// const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map` +const API_URL = "http://con.mind-one.co.kr:11083/sewerage-service/api/v1/map"; + +export type LyrStngProps = { + lyr_sn: string + lyr_nm: string + upper_lyr_sn: string + drawOrdr: string + flterSql: string + gobjTy: string + lyrTpNm: string + useYn: string + minViewSize: string + iconNm: string + lblAtrbNm: string + fontNm: string + fontIntnColor: string + fontExtnColor: string + fontExtnWdth: string + lnWdth: string + lnColor: string + polgnColor: string + initEprssYn: string + clickPsblYn: string +} + +export const mapService = { + //레이어 설정 조회 + getLyrStngs: async () => { + const response = await fetch(`${API_URL}/lyrStngs/WR_NETWORK`, { + method: 'GET', + headers: { + 'Accept': 'application/json', + }, + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + return response.json(); + } +} diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index ff6ef558d..c24d49500 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -136,6 +136,18 @@ export default function Home() {
+ + {/* 시설 현황(지도) */} +
+

시설 현황(지도)

+
+
+ +
+
+
); diff --git a/apps/wr/public/images/map/layericon/BML_CBAS_PS.png b/apps/wr/public/images/map/layericon/BML_CBAS_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..5ff4add3ef67899ca56ef065952b919b8426d086 GIT binary patch literal 1547 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`$o& z6x?pH#Hm*w=oo!a#3DsBObD2IKumbD1#;jCKQ#}S+KYh6+H&5{UIqrHdQTU}kcwM# zCdYbA4wN|lzxuh^-KyftM`9}$b|eHj#ydx=Nojj7R_fibWOhtktBRwzr;AGL6JLcX zP9asojgm^Nvyv>YoZNEAS66w8U5Los;>%~ht$SX1yNy%n%YpY#=RBYD{eR7zVv*&a zHg7yw)KPTEN8<3l%tLM_g0*X7YcHPdDrJgV)VE?sNS)uzi4)u2J~Hz-$nY#Z{b5O+ zn|F2jglp2BSwbJzieC`a_ZJb3;`&^C;m;P%xwd6GyY5cNP>d5PEO@UsWuC6v_uqA2 ztlg|m)V8_oF?{%<)YbL4?(SgT9XV^8jz4d=GUMYsCQ?~=c0bqc2kI7fy9%~0;^Ao3 z`RnX=Zd=fT{>}|zGDZ)d-L3kexg^7*Ma_@fQ6Qz_jGbq|BgbUpPoIh+uUG9-IKJeJ zkN3)jv-tO9Wgb5Agg?Wzc8g~tflT*nqwc24D_r^eK(M07myPQdht9O1E(DK!JCiZNB zzeiH|raMOx65h_&*cMm)<@t$<#hNS+^COS+R2N!$F45U>`_2aQz0QG*+fLXNDYaDy zde2LpcWy(^SyL;u`NavPsi);W%v-$krbKb?sgs)yJid0_cHw8$;{vP29>hoX2aQPz!58&o`d My85}Sb4q9e0Czo2EdT%j literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/BML_ELEV_PS.png b/apps/wr/public/images/map/layericon/BML_ELEV_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..83970a3311924d9ae070ef863066a89d337b9ced GIT binary patch literal 1030 zcmaJ=O=#0#7!J-&H=Oh5qB14R5EX3xnr3ZS99`47f|;c&tQ+Xel5cI;k}pfX*{mSq zK(HP}$G{1C5cQ}>FT&gof)g+5%^y4ndKjXhh)2J4ZRf!nl6*fr&-1?D`#xVeJ#@0Y z?LZqr5bdc!C4}dC39#PPNJgb0wQj}2|%VSEe|q4Gv;R2KrcZw zQD!!Wa_T8bhZd~`7}~cS%qEE5KHt&wDS*fckT-3a`u5~0MVf|8jYL#dbrPUp4whUn zTpG&ir71mTP<Ae$+H~Ku=o{2oFGL+iSHq+4~3(-#-x-{2CA{}N~Q`3ITFJZi$%H^ zrlFf>xL7O}Xz+XpBSPMsjWj=Gd)+k!1$eq^I>>}J87OKKa2ClF&UE7lmQ$Cty=s|o z!5Ck27>;IxBh`Sa`hTcp)zKcxfX#gWDePtE9Kd9N2WMR!H*T^!2<1o#7ib8&SqP_V zRZJHkf?feSWMWt(kB*qO0gK+T3SL#El@H^S~Hzp+#1XESZgS>1n7} z|c$pZDIEW)4FZ(qHcU(W4F85)>pg6^Y}`XQc67Qzg=8-*GhEl z*!szpb4$(T=Fz1y@8_M4z4tyJX?=NxZrN=~p3x%oe+21+&n literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/BML_ETCP_PS.png b/apps/wr/public/images/map/layericon/BML_ETCP_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..df9e4957ba7412d8684ee344371ee72728a40899 GIT binary patch literal 961 zcmaJ=zi-n(7&Q$8tyBrYQkYIo2at$=#dZ@brfPi&jfATxv6PH;>}z5r_8I$voeqV< z0NsF*m7R$NF@O*YLnS1{!o@n9pC$mDh!ijJ*z`H=3ULf zK4)hbF7-poW|+!m8rseP5zs|FFVNXv@7}Y(b9J_@n1UG^sPF9@M5uMJYdHr4r|hzu zw?QS}gURvjGeoA)s)@f+L6`P*qNp6;%~) z0Z9-gUZAg95M@nKHE9D(AC^Xo+B;k@Ghoc@ZmdoW#Ly`&< zQHaL@vC~2j=VuBK#ZKgf#KQr|6zwh^5uK%(o*uyu=dwXOEfXympV}cWazb{b8PGKU z5B2>yIwnnYmhZX3u{916-$XGUMGkG;em)BoYDR=?f+Gv#;jD^{J|;Ns;}94v72Ifh zfs2#)<^*q=T0Mw~9XO~Cb(Sh{p66;Mp|&Ln5|owVhA39$vLM4!8J22>3^!y!m~kO? zMm`G2jO(6ps|&fA75tD!hA8sxBexb|A54y{d5d$|UZ^+ax{Gr$7IJx-44*ajpGMEN zsC%;M+_rQvH$Doe+aqf0C*Rb^^hzjoxMii^yT3P&j@Cacefo0+KDAEX{8+u3JASx) t!h9UQuyPmjU%tLNTw6ZeTUW-pi)+l=m;BEM?Vg!ks(N)7zTVz@^cR&XC_w-K literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/BML_STMS_PS.png b/apps/wr/public/images/map/layericon/BML_STMS_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..423f2e8fcb87d6c1b9192d1547a4cf97c3bb7292 GIT binary patch literal 1542 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDkc?Br}XH{644~kf%h=vIPQxAv!Z9mxW?6};@ zEo2|D%REmdk7w!IEnAsXx3Fee%g-}U76loozD!P z&)&Lq>vfBCkG(7`X&G_Lf*+s096UWhW9E%h;$|vw%~()q&4|I^Q@J~*G4D0Fh-ibWa?D}1IL z51*v6Bq*7&YTk!CH|nJ>%zXC!xsRIdY>y*~lO3j=&^@SJFq1VhVC9tnohe>l^nO*X zPnWL4S3e!)m$$clI?+9yv+1q9 z*{4e3_h$DN<(4m4J!?M0E|$|ij}FdN)#zfs_*bZgY4=sDBp2q})uC5rm1=ByboJdl z4oOayi!VzOt?$;mghbZQ`F8Kc3kw;yU3SLpZofGuJ+6AWS}R$@h)0*f*HnPlo#mZa zVdSe1!6_edtg0)s3{(zoGqu^X_eG->i}{RD4GRY41&6okY|)*q%AvciH|O7ve@!<; z9XA-woavCdymN6H^VUyh{3qjfojsf!BVmxh!!o0{)g_C`O{3{bg_KIf2h)PO>--B| zvZ<+0iiof8uQ}MVj8kwWqkQ*7VP(TL&+-z!A2_srZf)b%KiyAuP3k&0q0y_9{rFox zrd@uHp_4S`nU?gb-qe_7I&I14c^MYBSwknL=H!MamP>c=x+`vEeq{D5w?u~hVSvEz zuU4gr?rloTWkpWE+rB>DZ+(f4+~>6Yfm-4_#s0os7x9nFfMHhRx5p)mI~zeIv!|<{ J%Q~loCIHG1Mo<6% literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/BML_SYMB_PS.png b/apps/wr/public/images/map/layericon/BML_SYMB_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..497589bea2f5a6aa1ee6c8f4756a96a4ec8b6bf7 GIT binary patch literal 970 zcmaJ=O>5LZ7!DMr6beE;XfKYl2o>CXZ8mm?rfZvI+ZD5v?Lya!G@DF!Lz~PrnY!76 zSiSi(`~md`sL&NW)RR~7CVKPW!K+Xw+uf~)t|7^M@I24^&ig*|YNNI`J2O8c2*PZ2 z-Kz8PTJ}v}<^Nm1&s;v-WOkEnk{#A{V=S!rq=i8>blbR&UB9>g2`>r46bu?o)^r{r zkA$L|VZ=0~oGl1T<&?VKE@q&G+d*W&U++#J2z&!>6&=~3Chi35hcVtftTnvDU9aTB z@-kRT5f=zCb3q#JMF~m`IM79Wo^4AI3?OXRfaggyoef};7=xl%$a}J)09_Xqt*GnD zJ)p{pD#`rS^NNOwI#Tb0;RAWJ*xx~Qt1^tmR|f1bMv)|SyIrwc5J}vYlv1gbX{c(R zBl1ZvVs4s`lH5qa!ig6Llm#RLnWEbw2h4yx)AJ*QbSxVs!!q%LNvTUEMU=B6jew5x ze`pwv(Fv>Li+nE?P8vOmr8-W?LG1Cy?c}mh6qzx08HpQ&?2W3p(IJc^9YTS*se^^B zAo58!xjVo+4yr~8b0ZH|Edz1|F$jF5n59+Iv}LWRX^LWNEB0!^UepR^MJ;K%x;Wxm z#5)La#712Ig3H@9fty(&q&%{P%BV~>K zr_rM=?w)Kqwk=yNSre)!A4}Si+a6FgYuBu(L-mGrF F{0katFXsRN literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/RDL_BYST_PS.png b/apps/wr/public/images/map/layericon/RDL_BYST_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..1e78cba6874b6dd9f8f3d1ce95a120e0ec52dd5e GIT binary patch literal 1196 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`Vr*gN=xSkTV&ZIRXy|HU;pXCG>E>i^;OJuN zH{644~kf%h=vIPQxAvIJCflpNy)(IT{C~%tb#?nlypKc4j32kqDx;@2v0ppbYTLR2w=B#nrQhxMN z0~6ou_h|hk2c&?`pw(~ZH5-Rb%% z>W_l_=KW`mR7zYRop6!M=Ak)1)?9S%C(mwwxC`_SR{9qWy( z>`Nzha87l7^inrrRmIZD+()1IyuQV;=ZLbNYoCeyqW;5N`DTH>;l?gXf-{%Me3a78 zU#$Fl&YwHVmoH8<&Uno@^U2T=Lp>FVdQ I&MBb@01j)NZvX%Q literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/RDL_CROS_PS.png b/apps/wr/public/images/map/layericon/RDL_CROS_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..57b5f2ca51d03eb08728f311091e33ba37747c4f GIT binary patch literal 1083 zcmaJ=T}TvB7#$Kz{443Dg6K98CA2#;yX)vqZlXK8?nWcFyP!dV>bp*LIYk zh<*rs2`mW0iU@0a5zcpcp&Y>KL`aZFiBLkwDByJm#wuMfv)ps69csX}5UGYmVl zSdRshJq;0-3wp3=I|_I31!FlWLY4K^R#O zRCxU!h2=QF^Ik4c!SmcM;A1%-!;+WxZ~>u$7krgq>7hw9OKlSpVst4MS%v5hj7@=I zGMS7wdaQLu>)abcOVmllRVhjq!}v8*yRg&NfP3Qjb%fDaWO;_1+S*50vq-P{FPN= zAP}zQxJV!v;H#?GfUhnb^>ds*nB|H{>C&Nrvs`tB8_CIat)QDEvIs5h2vnmM(!s)! z1ub_jbvgBxxN7cP!a2DNNrrJ7`&Xm0Tf{x?blJ9Kv21*35Vu>z)(>9$zL6_&J1*9y zoar~onUV=mJbd%$z2fu~Y$<&TipFc!4;2^PABhd`+`e~uZeYiOyRUwHIs?kC-a3%p zesbtE7p<-S@Yuj*1NoQi%SA8k`9o{o{gnIfT+tKhUvuXZsr2>4i&)=4|J%G%qhrsM zgV*xQpG@rU9m$+yKTf{ypV}~yoV*y_{kfisK8hTldOR~xcY*hxZ0tQX8kN!<`(?J^ lhPG<1=9s*;mmi$nI!?vb^=)?A=1bk{9FH`JgLN$@{s3DZXz>65 literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/RDL_ETCT_PS.png b/apps/wr/public/images/map/layericon/RDL_ETCT_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..29c0b77b4ee74276df8de9416fe284e4c8bc15ec GIT binary patch literal 1016 zcmaJ=OK8+k6b&tw(vJ!*{1ogXU8vB>XPTs)II*3XOznWFWjfFSH)fL8PUs{rOLPIEJ`Y)veC zaC&*NU@XrY36mZ@2a&j#vZL>6}L-4#p@0u!VQy_yp2t;Nm zW^g&?IzmCdARTQpTd4&$%Skl`e@NJNa1D&qEN1!@t}^8S3s!J z$l_EPVdR&Q3o_FZI6Y%ICaU^p>Ud3)bB>R7$ACFip@{-xS*ARm&19rhd{__#k>|5Q zN)$#$QrT=;Oi1Y=Dc#_z$XK+YgBx6PpF7f$8?}P%lE^CbtSitQ_mB=~;C%-tp>_^m#%!?s|Img;0{mI&}x^+$K0(R84*dBH;O}?(#mV7b!y0*iE z8*?alQ&5?^$i#!92*ZQF8;I!1o2VDBDvTW_3R9S0y0-IR4N1Nqp67Yr?|q-|a$@9U zd&`j)f*{((VIhgf1NOJiiT_78wj?}splBAQU>=nu6A)nq<^U;b(ilhrNvWKB3;GGd zL8<91%EnLeGSu9Xjd7PX1G5RDf1qqg@&rI+4veXKh+2R8k|I?lL}mPOCT>JPK^>kp zL27y=El*F#L4_JPLH3tZ~gWz>-bXKq}NpTT#lvA_`GB)9oW@MnhJ& zYGuL&qsx*(vu?&dQXLqN{~xMp4YY-lU?<;y3R~%l0q7*KV9}Iuq-9nNs15pT3Si!BT3h$3{0UyhReSU9@ zWuv};j|mLvMp*SP|eiyF{TovZ9{hnjM2D`*CeEC5rT0!qw;8d*IuuQtym z&{VI+Rhs7#Y|5o^GPK>;zZzZN!tSxB4cp>H!}vhQZa1;54?CBG_)6Rqg>bt3Dc9T6 zv-xhY>&x02P%|R zoz92LEzabJwgk=0?mnH#TvzDP7w0<;UZN8$Q$ftg+0gdDnYIg;-c_cm>i7R7gvmq2oHwN G&i(c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`XliC^=xA}MIS0CsYeNe?*c64j% zfB56=W}dy#X$z$`Jo=W$ChMrm7AaTQ7AbzsuqHJj`N8AF^dDcIsz=BzDSY~q*TMXM zQpKNNns-=x>Z-N>H9P%!ak=}!1>ehD2|Ip0GCRDnU0kB1;;Ljzok!#14-emWJM^A^ zurXn23P+!)Sc(1FU0e8savi=+Ex+D)v0PNJw}olqnk775%-uPw6j$F|93Hbogaz|vQNBhD!**w9UANs~$5m%`b-^`R7u-XTvolYfbmmPnPj~c? z5()`Hc~Sy{qJteWLOMhTmHyFLyad{}OdJ3i;SzQz*n<1_3`CVEp6_dD$S>6ygF`z~MuaXr|K7rNzWyEVAP1L5vNKVeakLR&ZukMsSfu$37zAd`j`8Zl+kxc*ugq{$n?^SgL<*iHm_*9BZ>K2xC874)ZCJH`PRk(04oQMc)V=yQL zSvDRFxB5d7u}z4F*?=InwH3G`l1DVC;{sPX<_3#$T`On?i7Y}>9feB5L>kyXGN%^L zg)ORg$W@Bx5-7@LNHUDu*uNTG*dp$6r$@FWizDMhow(g3ww_N+Z<8zWBq_FL>`%Ep z$BC8JO`dwbEhaMSyG~-rSL>j^!7RO6H#}E_r6Ypq=WiTfa;DWA@MTr5|exXZwWu z(UPxIC*L*nF718Z-27ED7u{;P_VUKY#N+QLny2rb=fN;_AzoJp?~3iUPbsiUY0t&Bt>Dcv7J#@duSVG=3Mx`@BhyK|7X0t z?L>9efhvlks*|l^nvA=huW|?ZAN*dB$WV*pUAP1F;GASas#!r<2$GuA3)4_ihR-j; zMvAJS)l3)eN}Up9q%o3%VQkGHY>H}ZvJFY@hZtmGuc}AsuaBP4Kvkl2C!g}Bj2P@w zTSrXTG18WiNBZT6LN^@)jkZ7pG>9c&YXiC^*im{-S0Hm|o29`T1oubjbyHobb`V1* z1U%#S$X<>E!63s0_+XGb0(@T1$9l;d^l$-z4+_2z*m!6X%~X1Xw3yh4MOIO|4`V}M z*<3EiH0BHVrK_Xv(B;J#|hfLx`DB z!pO`ZG*HZ9dmqBc>O%&Ibp$~}r>ZL`XB}R{r&2;vx3HwkFeyf9qQI!CB8VZLWVyv3 z;Qb=U#RCyB;g5N}VQ)Ab3Uh&Ykt-s3P=h)ya+NJ^pd{C611NxK#b)C}opifN+B&OUY9Uu*Iw>}1 z?04CGq0m&}YB>6{E*zeF|9kB6!i9axtNW*4*S2nN*da#p@XF-m{H@h5Z*HzuQ)OtEs7R-3_4+-Tc+@i!F1bCztYXXN`Mz9yhjCtURQq64zaJe#QOk9GD-v#?0+q z5+8j0_UZYar{yg%2Rn~b-KGcDbte*gsmT|@u? literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/RDL_STAT_PS.png b/apps/wr/public/images/map/layericon/RDL_STAT_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..13d8ea6899c02aa0d0917b630ca9f697783fd6ff GIT binary patch literal 1075 zcmaJ=&rj1(9512<`H{#)kqa+fOw_P--MZ=;1{vKZiMjYDVVY{1~JIMQOyX^pH}bFKvP5XU_kOprU zru$RM^q3M<>7H)TRS<}P4zUah`nX{Wg%G`?E0Dc&%+O#5g2zJiZcu3{0Yqd$5b*fj zikD>p&wE%d!1HV;@OfDu<0UWeW;r3i3%=7}@1cn|OC1rCk=ULuVuk1|#-_k9`F!4! z_j`~v%CNy;(9!Vu+yvparwl9?+=lI{C`6#GSel77WB^A|&Y&C)(InE{6m+vHYuI~b zA_Zd#vdOR>uai;*C`tc^>UtGz<0SkO?>~j@)RYOCB(zb^Qb^-QT#hSK5G^QUWTg-q zuT(LSMHtyxWCC%32PXzKLq&P}GZk(GDLEY)xWZNcaQT{CXB2dkc#c3zn}ll2LOR$|c$p9Fgg9w$-sEMs@I^L8jdzV}1OY-y&DyRy-0;6<%ew%H^JV zzVupXjlM;>ZWo{HyvOCIS2I^-|6J?Z0Wkk`VB^ijLzBFB=EJsl<;(3=cId&}xjPGs zpsi_Q`Qf|pQtxK_1*XV#|N6FYsjW08nU6nin%`GDdOo)o{msL(3qL#dFVEMxR;76pH}7 QeD7T2c(gyV)H{6nH~m6mg#Z8m literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/RDL_STLT_PS.png b/apps/wr/public/images/map/layericon/RDL_STLT_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..489524b5c4cd57a22db674f7ad8897be209f617b GIT binary patch literal 1089 zcmaJ=OK8+U7*1WNwN|WBL`&5ny(qXzW}Dr*p=%$>wq0=Rx?OA)!KTTy8@9=$$<*D} zR}~LdJrwoe>!3off`~7AC?Zw`6;TgG5D`3h5H0AzLvfwdZtKA{B$)@__x=Ar|2Jca zj9B!ByGbYRBU#l!OtX%A5r~;;KT0B1A0B*$ z8W_gM8mVs59p5Qw*yL0X!{tnyvKgkKF=wk<1`*JU`VA|>ew&P>6$KFcgB@KtO;2UZ8Kt4@D^$k^=Q$;bCbsNAHu8O6x)_x{9!ALTriW zv)L?{t>duM&%}do7ev0tB!xm9uU6Mpg`TkSbO%2uwD+4J<^(8JW%Jr;Z+BC9)9OEF;TODkI`I050 zXf9&3sNMosFPe+kT9nJvWO%Q!e>J+WMcv~~7i~)yi^fM5b-P1tov{<%mADgAnp3%V zy>t0|qmQf1JocT}_aFYUa!>H=Ohwb{Q`a}W2UWh=v{KR}um4yxULw?J&tA+PTlOeF zbx-+~&rdVc`J)?`zv;QP0-*fv9|BC2U3_)5^-@XII2u>W^VId1+i#{ac-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`X=>TGCfV&ZIOXy|HUVc=%uYVK%eZ02m} zYUJt$)9aF-T$-DjR|3v4~Pj*wm=R%;iu*SQ+p9GSx<7P{msC@SnuiL7*cWT zNbq@YCP#@{{xujiT|43Is=hl#K*R0%KL*Ywy;v(2$I9*nR$tk_$XD<$%HG~r zs;8vm!5OsD`P8o0@2+o8ov=u$BICiqb7y|v`+o0CpMnyPu}YgvE$ga{B@GLCA3x|R zywR^vHJ7nGu31-a;ir8Eg0_^@8gF0_XFoZOKWk5(MSk6ZNvzaI2kKZ|J#uz7X$9DY@pZJ2^2XfX0RUW?I zbf`nXX?K6Xve)x2bFaI&H)^ZumXpsn>MRzM3KzZ;_@^XqcR}0vR+;S&_OS8Hs|qY? z@;5spU(VA!we!qB`{f^Y-c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDkcX71!{VPIiwV&d#*Xy|HUY2s?=YGL5)WMpb! zZer;O)9aF-T$-DjR|3v4~Pj*wm=R%;iu*SQ+p9GS=)AZ&0}C-{Nd^17*cWT zO7Q;d5J!Q3W#!-g?)a`(e(z|^jzjVaQo<8e5;ko7Dxj;PVD^u@sW)Ny+RzCmU28kU zk{0&Lu?Y6IyJ>F>IN#vN;bkFI^z7ZHG3EoY(R)qB~B zx^Z+bi-TCIF*Al zu{V3^1|AJn#i@NK_0NPpJ|z>q&u2-UDAV1p!y9&Py<7QEW8Z}0hdn3Fdm2U9nqr@& z#%!!k8gY_DPv*PsGw6|*eCxi{m+Xh_e##q51r;e+2_57%IloqC7JS`vlhhYC4P;T zzQ*{P{d@BJ7aC0m{^!iRe<@!5ZpqD%Ad}7)Zu*{j5ig3p9!v@0knUyUleKG__gRaJ zsbb#uGY{)8*~hmZurk*FHLu+I%A+Ozk6dTWHfz7|xuRG3))sDQb+M4%ehQ&N3-5~pO390-7eP6xbW?BvRF_L5hVB!g%xO7mN-5V^!xdE z#OsauShmR<^~3`KkJ}#!G{ybVK%~Uwq1dYc6_vQsA8xcP*S3P9;mADDrf#l zO6KJ9xdh7UO>(93xdh8{8JrAbH}AL0jzO6XbQ1#~N`|;hc!z*LQ7JnjM7R}-v;$rna?VOeRaKN$f!~sXg zlA$%j#FdqekM0tyw_MwO`_5*oMs<6}dS}e0Mj3K8K<>No=;q#HvLP* z;OE@CaNJROc(CHk+3I6sTZ7AHwH~^(V6Ikl?Qq_+25TQ$5%2TbC(Q>B-aJ}WIq%i% p*3R4KzcOn*jZy!R(-lO;Ok&{YWB$SF^#k@lAkmcKFGo9e{Q~RKeFFdh literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/RDL_TRSN_PS.png b/apps/wr/public/images/map/layericon/RDL_TRSN_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..15675cb315243b6ee8ea7977c337e3387ddcb6d5 GIT binary patch literal 1375 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`W@&0v4~Pj*wm=R%;iu*SQ+p9GS(i^N{Kvq+c-hm%F{I+w zl*x|%w+%#&|KAwATq|_9qlSXwEWfDRvdiW!D|~*e)mnr_zESx;<3U!=PVP&6yWdnR z_zKIIB}lCnXrJ1`HN_-%(zSzzOB|#XD=tl*|MvU5xAX4@A2M)J=~{GRW7OJz!p#RQ z-Iq8D9Qawtw@IK0h(ntNYjR+Tv2bp;(aD_jaL(XxR-@KLd*iK2hQ(1 zx@sX;^uhN2`4dj2O?>fthNIqe?&L#t#}5{rJ#=YO=d#Kshd(YVvzE24TJ?_qu0oQ6 z*>l%LM$cofWT}~%N&TJ7*MDk#g2KAmf(ebe!8_|})+ipmp)DaGnqDd!pJqJi;O-*U zqcbl~H=eNd0{4YkL5coBCc2yD4NfR*W+CNHncK3J8d++=o7*be86k9Pwol1?dak#)BomwnS08u~!#wj5t!CX~C0F*K&VFQg% z=BwGDLK$w*fYF9^La8A^8XzMCv4B7w0~1hzs2I?x5+Q`4V-m)78Q9#qO(Fo}5Hx{F zc$buj9|^Ew4G7SPKHgF?g#ys&M2atsPN%E^sALM2M8_6zk3poCKWLTQs+ z4lGSlfe<>$l}&N|$kTGIR#2(2$Q)3kOa^6P8dwF4m&{O3p9^PNy$P;t+Fa<|X}KgU z8IrZJ|7!H)7Umx7bjr5aV#@d+gt=XV*_sLU$g!_w5swoh)IA6k#40}H;>T{9-nPDk z^6DR$io9uMF|)VLSzRp(NnBP0h`4K5_Pf4Ugq%pTXYFw)v!8uZqzHa|>VEJxvg_3k z(!a@kRhYK^PUP*JqRj7F^KbNCPBDAlGQ}?S_d(=0hw{zMi<=fo@XMQ5@4480GKa-) z!5{Iz5`(*I^ILMAc4vf*?d>gwjc$BLBt_x5qj1%tr2Dp8Z`%pFzi{hz4|jL6Dah6f zU#=(vo4VJoxw@jFYa``~c!^i=^PN?v3XJm_n}*@k_Xm$$ADnl>h|7s+`lPnUE~mAr zzO42M`Im5|sj6h)_P4V%wAK z(6BYJ@`tl$+)VagHk{*?_zxW4Z7y)kZQ{XpiVJv;!?JSQr!Ivp$zUHFvYqP~QZvf~ zZ;9^EuN`VVACaXZ8m^axX{*w68ok<&8Oisd&Xoa1wbAv_>?H>qf+RunJHL8WwD)Oq zuF;+KI;?$XiqEC~cxQcV+nKDqit>1M*RV_Aa3fA$dO_Xx!lhoa(423YQ*)Xn>`QV{ znIxA6tLr-tIhFa$y0cr|J44(j$w;Wt?HLl5Sw3pZMVuqPxOeSplxsB_|E#;iZMb2y zAHEdn{b(>VGu!fdW@`WS%YmY(I%9LkdtC+fmK)t#{Mi2abALpnZ|-e)t$Ul_8+edd zpOC)3E;r{%-KWy7Itt4oEVkeNsu9=ULaC>*~S)^ X+MJ>?k7n6e{~J8+I!ZAjE$9G`_Em1P7{TC`@E(cNvkx9-+mYBw(rogH^qT0}UvM;+JptnIn(G%C;_ z45Ipy5q&5M`&K~_LPcqPDItjHi}X4EV+a1vA2m1V+$9phKza zGC;hmF(Gv&CBIBnZ6yO44il&ViDX9IubEsXNX_zccyArk6gdk)$sqMRsb(QchM)mR zkHck`7?vfyUI**;c)hHRbTX`yX7KH`vu@7g<(!+zxr@Tl47rVq@!`2x*a}h|2wsI?!&V>vh zB4{Ka+@I}Yv;!h&c0ipB#l2)@lcLEmZEl>!3j!C>OeAU&i10xQGdL7Q<`|~N$#_Ce zw}%a}Y^@txe5ls%^M%7K>ka#|zC4stD$r2YSN`Mc%IRxKLDg|&9vI3&Acqa8lCvdq zO72{koP2Y>a_(HPWOCF&<78-Suzw9YdxX_vZRcf+jd|e%4XfS2vMw0j_85N>Un6`? zA~SL&Uca=PDIPCgvAMF8c`$PCxZZ1Q2^8+F4lGPgy=;{~G{i6NTv4%ZylnLD)2sP> zB58|mQl%c-@R9!KQ$b&T<-kB+>FFi5o->`d>uwZQP|Tr{hFve8MEVDh4Qj>9hYA12 zZ{J(W)(D@5F6HI5mv8UB-YZ_1d{(kJRnao>Y{TidPy7o?s!`vVZSY04KAnOEACHbr z+*`Ij`oi9?oH#Y}ZeQ8p`6iD&w)*g!l{=2Vsyxegoh(}F8FiIZN%5hZhc3_Td4$}) zFW38A=PFLTp03|xpB&mfT}^z>e>n2~$MP0ppx^AB>A5v#{S6|ujr_H3E#1EWplg9C literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_CLAY_PS_RED.png b/apps/wr/public/images/map/layericon/SWL_CLAY_PS_RED.png new file mode 100644 index 0000000000000000000000000000000000000000..0e5450688f9dda207fc2f3679b15d7b2a3e3c982 GIT binary patch literal 468 zcmV;_0W1EAP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0clA@K~y+TrIXuj z+b|S{KdLGu%C0GrvMt4y^VA~Qpx5(TnDUjyZ0ojg!gEY(1p z^aqG@0r~0YMM^~YA4TKFOQm)l9Q*9Ac7Fc4Rl9W$IQE&GetI9eqCox0YL(*4kDCD` zV!Rk=qYkp8R)zZXZ2^eWU?lDg#pxpeZ`1IxIBNk&5_*M~`29@A4`-+? z@a8#JF`Rr>^oN*iA$b$_(G+mpmVRf|0>I%ykZP5u6mnLUz*pd^IGnBt$!xtZ%G8F`6vIj*G6a*)z58{J}GN1Itm!arH5X5>i*Xn~cBsmwp@B9Dr|KB;$ z-?yiswz-y~sD@;Zm?GnP_gh;{{#%xdG8vk1_W(|#VO)?cNX1l?g&?WRIhca7I)3OG z?4+nFTFVUJ0jZZ)knWdVjNj2s!ltOsF2|IW5r{z+<}@Qpf4cvW2AUeB_l2c^WC}2^ z^-NeWJ<*p@CPtKqN_XuBoeoa~bcki(=%a?sJ5hQ?mnU;~o1wu91dl}N-$@Nf{Xjq# z1Yv)hPYJLr;5a`U3UeIW3W5PP$OOpC`PdL2=J;ScSbb;`%~FT?l$cnJMOINdkFm)! zOrcQl7ux*D$}wyt5^*(xK_5Z*>~RCjj?b{YB?S@Milv!YLk4ga`v|&O zmNo3vGLeEYj%+flKj0pz1eB!zLv_83ws8vn$@ibac4pj!ObXg)%u-0>hP`emlNT%~ zV`OCz8ZA|^KaVi7^T-53ngcucX@-gl_O2DYB=JeZ##`6wmTGSPb7qncsLS^#N!>YaEU7-WlV<#E^*aAT%jV@wSsPv$Rf0~!%$6FNCzuN z=C#VXL@Mg7a@ESY#42(bk__WE_OC{lwupP&Y1y`9Q8qp_h}$h<>&C@z8_AWJONz0K zvzYx+EOu43Of}AUTCe2THN~6U@U}d4EAisa{de!*9zAfV`SCGndG=cN`d#m5cCg0s ztZkdV_`O*C;N7sa@aD|c>b*6usvh;;`*CU=n9Ie#-DaMo9yG_kJe8}s`Wbq1vi|ku zy3wDFr>{0$I{T99&s>?_%`NP|dXOCwz4PLcIxsiAW7}6ewKRxl&NU1@+J5|F@8E?S hvzxA;-<c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`W?|%N}T^vIy zZY>G+^bZacvCDt+IwkY%lxaq0S2#F2yJs%*&;kG)y6C8B4ovh9#bUt|9$Gh>UDL!ihPm6Q3V zoc>LW?^-g;lvc03j5f!aGB3X0_FOfx&|P?D=)nUY z-5Qm5*fK5A=P>&{Y0odqs-$0XzoX|%m0p$C)n_!hZhgPe*+;~kUsIqpYKN3nZYm45H zocd-bw?pI8zuRXV%`ss({qOmI5l;rs4>HP@Z^fo2M+W=mtbP2nyOBxYqQRTVDp$jn z^S6H5887e<9B~= zygn`9o3b!O(0bnOZABGzQalz#F)BN(pFThQ`C!xKJl#c%DgW>D38&2Edo8{G^tXda zVhxFs=br9RZGG?i`ckL;i{;$qM;lXoZT2{y`L=X>!%5p5=VPI@eVfE*zg?$4QSX%< zhYde_yXPkHw3sy-r!VLW7L~j;e8~S>ngFVjS~ zp*D&%hdOP4!W1`ikp-F{h+?3{hAU*2b2c-pM?CPJm-l&}^PJ}#ZDs~1n0AIn5JWIH zmBqt-^56tgkQoUl__#gwvAo*q08YmG*uN~IEu#ogWA za=E;`yj-i*c6D`uTv1U0T1`z&V`HP$Y6S;^ot>RPT3T8lVltT^qE@SgLLr!Nf?AzU z*VfhsCq+d?P$(`g)@U@PrKQN|1x|l|KlsqEudfFO9a~#lr>3UhUm}snWHLAu2n2!YW9{wj z@UPeFv7ElXJ~%O(%@&JgbaWK{pI&$!f}L_7@iO>CBqA;@IhoDoaxr#C$Jp4L@rjAI zi;JIESJ#|Qr_1G9ce}qMHa0w-O~jVhyS=@$v*Y*w-rL(p{6%>7d`S>JR-T$GAqe{P z!6CgD4Lkt2%w;jN8T-C238lTDOAss^+w;}azMPiaEo%Qa9V`1gyhx2Kw zv$4_c`>_QE&-zP2l;^S|Fl_!4{mR0e&v%;}^y~UMh335I-+jypp!)qw%d#0Y^?6h; zd7q*t@8`J0WF|T5iS_3s)0{skoQsGiv8C}VS2yjW(f<_lNo|CU&ARhqM1N1AVh)U) z%T%z@mltzshQm*r%^?_ed(0QnNYAOSy+er!A8Da^Yher8*&zClYvFNS%Grd0X`wFK=Gj5Nzu8p8`eIVwEur#cJGuu|NV3OChhs3-nq4S%89tT6?ID< z1ZMUGW>1)~?|)Fv1fa60(zzuwPEXwbKOnOwAhR!`cy`g$;|X=ELi48-O*8G6CCN?e)7!VEcWle-+>zO}GrM$I2>t;<>9w76fu?d6ctjR6Fz_7) zVaDV6D^h@hH$7b(Lo|Yu53t=};nmX8n(|}j!Wuro%a7Jv*`i|0sb?_X*X63pt=s3_ zZyH8Ul2%c8k)@LzA|SIScd~@e5e^XpjZV|+n%q1mPy2n?{D7G&B!#tIWm!w>&)>Ii zS7|k{1kIVF>~vUJ+3Cs?@57EvCxeP+GES`g$oNjLRe@2JKYMr0{trJ+OxQ5PVgked z)Fii{2LFN?ixPb%*abAWTHHGAWvqV5-#hBAFN4N`1Im)G76i#Xp1oR8`4pE>!UK`( zzWQBU+y=tQ?4KniW>knCI(+ymtHLLZhDJt)YxngOh3bmifu3aWboFyt=akR{03h6M Ao&W#< literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_MANH_PS_GRAY.png b/apps/wr/public/images/map/layericon/SWL_MANH_PS_GRAY.png new file mode 100644 index 0000000000000000000000000000000000000000..e19f3d8b36c0d5c05f2bd0156cde3a42819d0733 GIT binary patch literal 1054 zcmX|9dq`7p6uxS{W{M1_SrG(+mJc#5qoUBvC8e2)FwNA|d{&~SNl+mv^+)tjs1Qpb zQ6$ZUt_RM?bZ$PcZnNp;eCwuOXD(BlufBDo1NYo>&+nY`ec$=rCn3RXYsOv%K@iq~ z7yLunJhM52Yy@7!N znkotahnOVEv9U2=p$3zY2O@}}7@)|Y1$zecf0=Y8Es!pzR|G`N1To;^3NV>Qq_smP z2tzw=Q>9V?bbNdq3kP#t7IdlA>V<^`tyT-|*h2}+wg%UqpB)+;MwpwMGnsaFES86d zM?e6ZeGQhBl$?^1T3A?ER#skKSI6ZxL8q_-+(jh$U7=8o0>A+Acl@kct#m> z7PU)DKYjoQKtB!kYjt&Pef_t=ut2?j1BQif{j=?D>5EJa*jQ#<;A9bmO`G8{65Xy! zz@K^`(BC)QB`m(h=C!F^P^vGpus$ zSbd(DC`fm>!^>G&;eGb;Q9IoTI!Z7&zs_gm1hvLUF$KKK{)#73_zbO5o->0`*PraP$y&H0OnXz(n98C)DhF|>VT6Enx zr(R!jQvSZ%s9=x(N_AxX)mPa*iKpJ=rTol)bV8V&>Y|oyXP%S!up87^TGbLezEy~00DNQ ACIA2c literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_MANH_PS_GREEN.png b/apps/wr/public/images/map/layericon/SWL_MANH_PS_GREEN.png new file mode 100644 index 0000000000000000000000000000000000000000..4503c13c63f182dc291aaa8184b523c09d5363ea GIT binary patch literal 791 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%Gqe0X`wFK=GhSDbcfYJD<#+{eNwEZ|bc7>mvG6X8+%izqPLHL}%)X;?@VV zLVFU!CnV4KzX3?j{J%bKZf@o2-dX?G1I0u8l453Ommlv+T~!)6C9UFQSHi;l@QJC} zo2p9>w}thmL`+GW`F}&g{M@XKRoyQaL`+FfSzcUvxIKPeZr=8~%G2F77bb-EC#9__ z4V#bxR2efXD|=&A{;r0C-HkK;t`F*nid)x-6t8A$@fj(5~27Sxq;lhV>@{ zwWKU73hIoHn3S5oqhZ>wHNiazQPVTx=H|rB%k^)L_HT&}?1%#z64VJq@xfj3!QBZ! zb3%F(LqRAB=zg#{$>9@I!Y8Ey&54+t3iL?i)byyS>CrPXV`gRnofJDOJ7Ioa;-Z42 z#f3>r3X_)>r7SB>U0DKjPv-i{+^w~_+v@Um)aUPPDBRmra~6*gPoKYd@d^muym|NTJrI2Q{Q1k5Z{NQC`0?xa@4rCs4+u)H?VJlVm9xMj zvY3H^?=T269?xHq0u;RI>Ealo5uAL0?FI|)s#U9|{Fu40hEMSFr8!@EL~J?r4Cec~ zTvfSt`@H*2!_Z06Dhe;Mbh1N4gx2Iv7STGwA!4B6ZE$@h2aom%-%pz#Fmr`GZD~NS%GpH0X`wFK=DZq4znE`o5Y+y6N^bDf+{hlT>VKyjer*^Z9KLqb-$yHByRI~f|f(AjySt?ec+ufst> z{Wdm0L7>X{&dwXXyMOQ3>IE2}Omt8ObRpdr0rXZP9IKuiF-7N{L)3(##-?d@kc zILvf#06GI`3((n%TwE3dk*n(xSJ$PkuFKrqR=T?bow452bE}WfHXolIzP>yC{Pz0$ z9}EmU5)^bSIQV*0)Q#xqJ25ej;^UttBmljyCL^)~7}j1TL4LsuGC-iFW^3!}>gn0o z*f@Fe&Yin<@7}ZL(6wuK?%#j#`|;z~ z@85rc;2#i_UfVerXewucM`SSr1K(i~W;~w1A_XXT)6>NvC1))a~o;Hw^I^E9WE9-F zk@1}#s{*4cfA(&h`x|a_Jh<>eVgked)S4=%2LFH+ixNu~*abAWTAVuVWo&)O-#hBA zFN4N`1Im(*76ggCoxE64`4pE>!UK`(zS=!JyavL_?4KniW>knCI&|m@tHLLZhDJt) Y#s0d7PA`?`1A3Cd)78&qol`;+05Lm9=Kufz literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_MANH_PS_YELLOW.png b/apps/wr/public/images/map/layericon/SWL_MANH_PS_YELLOW.png new file mode 100644 index 0000000000000000000000000000000000000000..b7de1fbfdfdb1b373ac6c53c3541dbf14a53cc43 GIT binary patch literal 782 zcmW+ydrVSc6u*>KQl^!)thOx7(aYJ~np@chgBh0Q&_Albw8v~cmg})K*B{XPfj~&h zG<#@IZI(4lq?Sq33KcHOD=?5i;oi%=m*-GZJM`Q4o%4O?obPvj=et=_T#(FM#Y7M! zS+JWY1fLq;3+94lZ%ru$$2co2;392E#pJnk1G6V zLp181ot?$?HDEDR3YH%22>ZSV>@Q;hC$5*^1~~)?ecbv@jS-&~4!BN&>!f~TL)6Vq2E_98r{AU0orUdUj?S8@xdnYO%qa^hhhFlhF27=tUaqW0Zx^%isxReGXZ| zpa{7-XQn4Xl7ILfX=((1U;kxa{}pWD29Q7vHh2ru-Nxe!WY@s3xL%6uWjHDa!N35G zKrJXFhVJ@@>-@(1eq%i-rz}mBwVAR$rL51WU(adVE07WR{U+$_2#$UTj&_Dzs?eX$ zVb9md__xS-Z;Uj9yb0Pq8FEdAJuv=u1Ns2|y6~K^xD;6f$jZvk=ko;uu~=MNt5S8T z)t^4~m`rwu!|8UrJs!`v*NXuNf+Q(GFcb=hqtR$AHaRsl4VVF(H>nzdHK}U%fwKs* zSQFojzSA#{K+r1Samv`Ghr8!l5|V#vwRdCppIltLWT>fMIn2vX%FcOI#4~38vgrz} z+XRZ$nHk>WTTUp~E`5EfHg)~C1!*~KX|8!=@}hx(Li)XPE>l@~?MhbW^{W$8He2;3 zQG%lJ0gJ0)vA9O}o*vE|f$&T^n%A*@GMAP+)67MiCCr66%MQ;E nrLU~Ju)Ig3i6mwO*&;Cm>D!;3^kS^F7=}ay{9;}kxBSvSe_-5< literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_SPEW_PS.png b/apps/wr/public/images/map/layericon/SWL_SPEW_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..d260ea3a668f2d7fba866de62fb10c4220409ca9 GIT binary patch literal 1217 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDkcWM*z=V&ZCSVrt}UXy|HUX=-NdXzJu@Y3^d? z=H_Aq)9aF-T$-DjR|3Y4 z5WOk5-C~4OuRhQ*`k;tKifEV+F!g|#@MH_*z!QFI9x$~R0h6`2pt1!61EZ;@i(^Q| zt)xHy|JyUGHn7fo{OXzCg)Mh?ml-9QGA!A-f4#Wt$M^R258ssM-#>6wQThy@e{k1zgC6apd*5wu4cAOPFNvKfD zApKrVTPwG?(S}V1#v)>(&9RK-j6R=#`_C_wVwlw5-=Dr>O}-27k<;7XHCZa0^`CFs z?7gq@XOp8#4AV&tO@o!Im-T#TS~t(m=9SKxH4mgNGM-r=e7x`AQN7qb2Tn|yIMp@i zkfDKrgRh6UUQ9wkNohOxoBMl(eT21-F%=7W2&r_uaY;HdLqdZ^MEZcm)07wgV;W6) z{-^&&T#n)DpWjO{an^LB{Ts5>LH|o literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_SPOT_PS.png b/apps/wr/public/images/map/layericon/SWL_SPOT_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..84c7992e41cc3c681f1b6ea44d7059de78fa2a9a GIT binary patch literal 1067 zcmaJ=O-$2Z7_NeZAS8HlkQi!_D8}_?KZO;>&(`5)ERr#Wi-xZKHX3NZ+J3mPi-3s{ zNIa+qO-wW#^g=Y=NQ}{hEQ%)+Pa0!L1;jG|HLte`-hmK_Y8)lJMMi0r|IMdxD=w?~g zu#08F1!JB5038lMD~@*Xix|L|8uJ3w8Ltom{xY6`?Yv0|S+~>K@lyk?UANH*sVUSlSh!4p>kpcaAJ* zm2+V$>J_%=rIjQcW&Qo>3Unc)bwn6pL*j$in+GD#MPE9}4+= zzVPMNW8D>vMz@cjJldAt7(4&Tf%U#)>ifmRjBBfzeRyv^Sw-xxC*B-Hr>^D$ QPo3)NS%G|s0G|+7AT1;$q@$x_YisN8@1K^IR#H;Z+uOU`V#QvN0VP3x!3+-1ZlnP@ zoCO|{#S9F5he4R}c>anMprEa%i(`mJ@YEhlJ_ZF27DmB;|C4zmKX$bGZ8bi6NqUmP zgc-Z9PLfOg>^NS%G|s0G|+7AZ-}A$iHYqa^ud5Nrxt{IJbD~)%|B4Z8@v20y3Z^$S;_|;n|He zAcwQSBeIx*f$uN~Gak=hkpdL7^>lFz(FmT}W68&$z`?>O`0sx*Z{)|0R==&rM=wcF zQkXDf_ti;qsh_NS%G|s0G|+7ARRTqtY|@S)9Uoe+p1R_ox1hx(ld7tn!Zc302xpcNS%G|s0G|+7AYETyKXKy3dGqG2UcGwHo;^p89=(43`o{-TdO!x01o;IsI6S+N z2IO!SctjR6Fz_7)VaDV6D^h@hww^AIAsWF`do1}F6gXHI1^@j|=8gQ=(dxI=_~<3+ zNeUBY?7lilF7>nbgm>8;@jeTB3@wzopr E07Dc;WdHyG literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/SWL_SPOT_PS_RED.png b/apps/wr/public/images/map/layericon/SWL_SPOT_PS_RED.png new file mode 100644 index 0000000000000000000000000000000000000000..a2da36f9bd0c68654350c5ed8840a5a513e05c5b GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|+7AT7?tWho)yuc(-&t=(#2G2PyNyRWbE`itTq14@GYf*Bm1-ADs+ zI14-?iy0XB4ude`@%$AjKtWqi7sn8d;Hf>9d<+U4ER2Hx{wMQBe(Y%V+iHCDlJq2n z2{U$Iog|m~*?Ypf?2dS!1wDoq%;y&@fxHa7-4%z4m{Oi^LYPn%|KSU0+4KLt~^wz7fAwAdM zd!m=3sQ%Qvk|E<@@Ez?T|5Lwe8W~3LOde-Z5mz-AQb_|9AV^u-3d}&wSiABDPEb@Q zZRYYguU?RJWHDNRVSLLWY>Jwg@*PbtLktRV#k3Rj{>xW1FpUJg6jeFZkzvW4Uw2`4 zJ)P6n%X-|PrzXLKFA)I?Vh#9K#r7mWLDzL9G7q*{8q^`UoS+X(<<$isBNu`w6A9@Y z&jV3pcp)l^{1^yxe3<3PD~5PMii%Qr95f!9M01Uzlu>3IvB)YxmoRoDmaSH+Of|wF zcZKES@pzyS4u=RLWQ7fQToS=!*gA^>MC2M<)VT!-1gh%)p_bJ`dpH9R{r*$f%dI((%|H*Wx;iObaWn|!NU{qxjNBYTmF6if zln_Q<2{}N{is0OmX&b2Oov-6nRZ7_&)@&W7lmtx_7}GQ)IVlT*m>d@bd79^EgjhVn z%h4DwipiJ~my=Ddg7j4j+PKLz4!N9vv`M$Sq^<957f+HaaV@1JbN*i8cda(nd1j;g z!TT*^Wbx6(9fjZCy~7P}2$w$Y4#FSLN9R7@_A|IO3kE|r_;+f{s2UANB{r; literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/TL_SPBD_ENTRC.png b/apps/wr/public/images/map/layericon/TL_SPBD_ENTRC.png new file mode 100644 index 0000000000000000000000000000000000000000..8e7de8593acb28bd70cc17bc07f51fe41104a3d4 GIT binary patch literal 1260 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`Vrt-GY+`0%VrpV;Xy|I1JVR zVPRv4~Pj*wm=R%;iu*SQ+p9GSzA2OwPs*oOz?DZ45_#^ zCD_*ch=V}w?%4$eVnq+wJEkUNK9=9Gb@S%yr~J6S1xR`N| zJvQ5C?o3u`PthfQ5-al93`?KC+#KK4)4bnrwtm;#UOhuS$xiNBH3#lG?~)07@@xLf z#2-q(E=e`?ujg1?p%eG;x!ZZrDK;@68tDnm{r-UW|S17>0 literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/TL_SPGF_LOC.png b/apps/wr/public/images/map/layericon/TL_SPGF_LOC.png new file mode 100644 index 0000000000000000000000000000000000000000..74b0adac361882af61b2f8d1a29c7a3f4c8063ad GIT binary patch literal 1383 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`Y~<|b;_T>bVrt}UXy|HU;p}W+;cDb!Vq)a# zW@79F)9aF-T$-DjR|3v4~Pj*wm=R%;iu*SQ+p9GS-(v#`NF`!c-zy(F{I+w zlF6sNr2|Edoj-f#$;Ca(9JefR6p#;PcHZT2l>INWj@BaXi5gdYx8E%dytG!^wII^9 z;Q6Ai0P%Mr0$G}wZ`C-QF0}G!?F%r@RGVL(=OMwJEN)q_&H28UHD=1T`s$be@TJYmI(%^28qHs(l4VPW8$&Ht~udsoCUlg3EBf%aQk< za+8_=3w>f;RDC(J(RRk{aIKoHR-!w579Do=_EN3?e(=nfB(E-2ls8_x|9s z?Gjfu@T|SeZF`sJvA?p~y*EU-oi*rrdt!T>V>egLkY4Wy)EqO6{v)NAK zVJLX;ASi<1P4OTeM3EutO)p+NO+>wU5k)sIz_C?!K5Ynwuc4|ly%C_< zjY7%VSg{nFoj3u;BS-~YL`)F5t6m5rm96VSI*+$`7SthRMP+xBDjPFE!vO+mE}5_d zQ3SHgiK(mD(qgclAq6?7C@f#VYgdmvUcD|n5lEX{QH2(I6f^}>$cD#DWbi6|0x`n)_uemQHa+9i#Bd)C=TUAEkGv0K?&p4W))|u znBcIAeW1KX>xUJt+~h}O|HGimD+M+E4V(5tfRm=kL+B4T~I$VblT>U&b8HRaP9WF z2yMAMO@@yf`&XlzThu-Av}IemXc-@Q)a?Pa_2WyMkX{K|y~$Gaw(@IdXQE3Il1Xjg zWapj2t%`oodU5Z;_tfT%g{|Q^ZNc9@@Z@;s>$685bzYa=b$@)LU+d^Kra!}=_pSv# z?0flp>cUpJZ?ST_|H_~+();}8)i3X#o_g59baXS{J`Ef`^K))HzJ&Q~LBF3_y!Zzu Cr9T`1 literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/TL_SPRD_BANO.png b/apps/wr/public/images/map/layericon/TL_SPRD_BANO.png new file mode 100644 index 0000000000000000000000000000000000000000..8d08dca2996d0ea7bc0c52c6296323f9721077a4 GIT binary patch literal 1044 zcmaJ=PiWIn9F8j+b2uD$*;MqAq0G7FU)yXAtJ~VFu42pRit9nJY4WyaTk>M^X45gD z4h9Y;cb2r@l+n;-~+c#SjoqNvWqgq$X0m-n@|k^k`@y9yb4@OTzap&49MY)Fl1C=WrxP-bBoDq89C8#qi+ zK3dOYaW;8gQjx(Z9)@uZi?Atbc*M07bsl1nhqJmFp}%fEr-80T=;=_BOIk5l&?lB` zIJK0@s7v!|SffYIfMHi60tUniaE%4ik=zJf)s@KH+h%D{h2Z%Jy_ZxrISFFOh9JZQ z{3^%uKol817!pN(00lW6L2|Pt5j}~!+CYkOX!LS;#rc)~u zDH!W27Rxi7cceNnnfyQ0FdAqFr{SM`|0(QbN)}|(&_Ro~N*XuQ>xHtUm<<(->;vR3>uq|0Mj1NuXcAMDxacX&)T#4%mc`W0;&+qK+ zj`-T;c>LF;V^3DDb$31OUr~O3|GW;wL%!8=>xQ~*p1XAt!lP~F(OeG1AUtv5Mx|0Y z@a5futxAiws+IP&^@r{~-250nqWDHr7vGjo4{U!L9PJ6?*WX@#*etHCx5AxA<%4&( oT3+qfySraR`)*DM>bp*LIYk zh<*rs2`mW0iU@0a5zcpcp&Y>KL`aZFiBLkwDByJm#wuMfv)ps69csX}5UGYmVl zSdRshJq;0-3wp3=I|_I31!FlWLY4K^R#O zRCxU!h2=QF^Ik4c!SmcM;A1%-!;+WxZ~>u$7krgq>7hw9OKlSpVst4MS%v5hj7@=I zGMS7wdaQLu>)abcOVmllRVhjq!}v8*yRg&NfP3Qjb%fDaWO;_1+S*50vq-P{FPN= zAP}zQxJV!v;H#?GfUhnb^>ds*nB|H{>C&Nrvs`tB8_CIat)QDEvIs5h2vnmM(!s)! z1ub_jbvgBxxN7cP!a2DNNrrJ7`&Xm0Tf{x?blJ9Kv21*35Vu>z)(>9$zL6_&J1*9y zoar~onUV=mJbd%$z2fu~Y$<&TipFc!4;2^PABhd`+`e~uZeYiOyRUwHIs?kC-a3%p zesbtE7p<-S@Yuj*1NoQi%SA8k`9o{o{gnIfT+tKhUvuXZsr2>4i&)=4|J%G%qhrsM zgV*xQpG@rU9m$+yKTf{ypV}~yoV*y_{kfisK8hTldOR~xcY*hxZ0tQX8kN!<`(?J^ lhPG<1=9s*;mmi$nI!?vb^=)?A=1bk{9FH`JgLN$@{s3DZXz>65 literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/TL_SPRD_NONM.png b/apps/wr/public/images/map/layericon/TL_SPRD_NONM.png new file mode 100644 index 0000000000000000000000000000000000000000..e68c05ab606783899526d999e99e088f96d1fa5e GIT binary patch literal 1049 zcmaJ=&rj1}7%o{D1R>Fr;)O5e0@1Z=*A~_=eyy7X5z(gFvb}F0F{V|2TivvH3b>*=kebj@9)g6a7GVae`r^VzI6_fA z+Q{Z`E_qqjkjbbXhN+r1VN=w|Sk+dwIfy|X77Z&x@4bFY14EC{Gh#BBw4<9J8TQk98-39$;Q=Dg*~)d*eJmC4-OW@%7|;JFBWWGa_TgD7$!5SdUw z3vwKgB!&}2N#ZU7KFINGki1fW6J$}6`5|!p&?K6p7vzi*KaNFK5xRu2EwgN;Qei3~ z202BR3x~s=2G0iwBH%7sSgi&ux4)sFKv#1N8ym<1o}!vZWgMZ2)1xDpc2m}JkJCgF z##U9E<(Qy%qy{jV{6Ew*n`jqj;ECUV3cJ}w8?qVbqOzlr!WH_xP_`U(po)=`MQFZ} z#dHZ_PqSF!>m@zCJRouZkKADsgmWx$Og9#-<69vXFbeWq}h9y205=36&xR?;; zL*j5q9Fk&TNg9rZ8e9cwWfNMs!PQT=LQAgK3Z_jWE6_2nLp|;w6V#6^8?C*NvbXYb z#MN7S;ahT9Vutk!`&XeGTcmruX|rv~qS^S+BHiwgwqAJN`<+~g)r2yUt$xiP93GDO zq^ULtlzqGv8aphab)BS@{E|puN^3+s_ zS>2(&JX!7=;&}e&EdkNb&ODv~(MRV7+QHeiQ{%O(v;Ot%b~~5;;d|l#wEJu2^N0D3 q9x&K__lB^tIlk_*VKLt}ezT3bGx}!tT6|ORE^8u|QeIBZuKWSyOihgd literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/TL_SPRD_RENM.png b/apps/wr/public/images/map/layericon/TL_SPRD_RENM.png new file mode 100644 index 0000000000000000000000000000000000000000..4800beaeb5d42b54c5c28451bcecc023bbbf7506 GIT binary patch literal 1009 zcmaJ=PiWIn9L_czGB(&{iUakLU7W1>*EU-oi*rrdt!T>V>egLkY4Wy)EqO6{v)NAK zVJLX;ASi<1P4OTeM3EutO)p+NO+>wU5k)sIz_C?!K5Ynwuc4|ly%C_< zjY7%VSg{nFoj3u;BS-~YL`)F5t6m5rm96VSI*+$`7SthRMP+xBDjPFE!vO+mE}5_d zQ3SHgiK(mD(qgclAq6?7C@f#VYgdmvUcD|n5lEX{QH2(I6f^}>$cD#DWbi6|0x`n)_uemQHa+9i#Bd)C=TUAEkGv0K?&p4W))|u znBcIAeW1KX>xUJt+~h}O|HGimD+M+E4V(5tfRm=kL+B4T~I$VblT>U&b8HRaP9WF z2yMAMO@@yf`&XlzThu-Av}IemXc-@Q)a?Pa_2WyMkX{K|y~$Gaw(@IdXQE3Il1Xjg zWapj2t%`oodU5Z;_tfT%g{|Q^ZNc9@@Z@;s>$685bzYa=b$@)LU+d^Kra!}=_pSv# z?0flp>cUpJZ?ST_|H_~+();}8)i3X#o_g59baXS{J`Ef`^K))HzJ&Q~LBF3_y!Zzu Cr9T`1 literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/TL_SPRD_RWNM.png b/apps/wr/public/images/map/layericon/TL_SPRD_RWNM.png new file mode 100644 index 0000000000000000000000000000000000000000..e68c05ab606783899526d999e99e088f96d1fa5e GIT binary patch literal 1049 zcmaJ=&rj1}7%o{D1R>Fr;)O5e0@1Z=*A~_=eyy7X5z(gFvb}F0F{V|2TivvH3b>*=kebj@9)g6a7GVae`r^VzI6_fA z+Q{Z`E_qqjkjbbXhN+r1VN=w|Sk+dwIfy|X77Z&x@4bFY14EC{Gh#BBw4<9J8TQk98-39$;Q=Dg*~)d*eJmC4-OW@%7|;JFBWWGa_TgD7$!5SdUw z3vwKgB!&}2N#ZU7KFINGki1fW6J$}6`5|!p&?K6p7vzi*KaNFK5xRu2EwgN;Qei3~ z202BR3x~s=2G0iwBH%7sSgi&ux4)sFKv#1N8ym<1o}!vZWgMZ2)1xDpc2m}JkJCgF z##U9E<(Qy%qy{jV{6Ew*n`jqj;ECUV3cJ}w8?qVbqOzlr!WH_xP_`U(po)=`MQFZ} z#dHZ_PqSF!>m@zCJRouZkKADsgmWx$Og9#-<69vXFbeWq}h9y205=36&xR?;; zL*j5q9Fk&TNg9rZ8e9cwWfNMs!PQT=LQAgK3Z_jWE6_2nLp|;w6V#6^8?C*NvbXYb z#MN7S;ahT9Vutk!`&XeGTcmruX|rv~qS^S+BHiwgwqAJN`<+~g)r2yUt$xiP93GDO zq^ULtlzqGv8aphab)BS@{E|puN^3+s_ zS>2(&JX!7=;&}e&EdkNb&ODv~(MRV7+QHeiQ{%O(v;Ot%b~~5;;d|l#wEJu2^N0D3 q9x&K__lB^tIlk_*VKLt}ezT3bGx}!tT6|ORE^8u|QeIBZuKWSyOihgd literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_BMAN_PS.png b/apps/wr/public/images/map/layericon/UFL_BMAN_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..f2f64a641080ceee0479ecc735869a2d146d2513 GIT binary patch literal 1552 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`U~b~(=3?e-V&V)8bypKdCpQZhM*~xHL!gkQ zs~JqMOMY@`Zfaf$Om7N8uM1ASprnvn0JPa9wJ5VJHN~wcKUV?lWvfiwZgIqE9#n4% zZnrq$)TknMZjcjY$NByz`)ev>EaktaVsa- zJ6kwV!nRzla-zv(6WwjgwuYFqF7;R`7OvFs-{DB>gH<~MjndRf` z8>)5!_Q!hHZrtpfBeZ@_lgl^c3alKiw!qDJTCl(e+cotnRx`{wgL(9y>Vk6&s_@7d|kjXWkvY@3-Zsea-q_pjo!R&$M&xmSp+iFZ8p;1CbbH`P92 zo~r^Yh0?7oc${x)hJX$z{qB|hbo5x@QV*jS;TNsM#Lx+ey4d~5DZlhm9f;x6qf#Huy< z=z-Gyg>A3qT{~#^@!Nw3;zenUOM@&gH|DK+CcW~+tY!DLr&{Hht-t<0Yg5>x>l1~_ zAFD*Y{&uU|@9IN|(-(GKP;vCk4$RbCt})+X_VyrBK7@LqWSUvzOU+aNBgp&6P&Bbs=8@=Wpjmv0Z%; zBZ?jh%K{-Rqn@M7Lt#WkP$WTxLC{N^6j@;wMFpC6MqTZpZJ3#J;rqV-KmY%ob$9n^AoWYK9q)c%PB$@|AZnsHQ&KtrB4yB~84+sg_Fan9)CjddC^DiM1MONv zj|G~0n$k*7hZ0t)=q|D*$72Bo{JG=pEx!v^>u$NNI$;zQwRmYU&HLVPh6UPY*OgiM~M zv)QaS>-R#djb_8)u%qGgc`(9bcN<8`c?`R%pdbKSu{0BD&>$T}Nrqi0Lg7poj-Z=M zvWC4_CR{K&Cz&+sWt<}wfTH++sID)eZIlAb`TkSbPIsGtP5~QsSqg4krpgIr@-YiY z2wG_f4;HGJY=;Qi?a(A+%^bOHzh9NC*)MD|j_cwxQcUwM9fTsCdnwWhJL(U*5Uy%1e7cKgtz{OiYLWwrb5yAAhB zFBAP+l7m;tHT|xn+&45d)Hg7&{z(P^kZ*locB6M@X7tPSPsmJ9|D1A1duNY)lH}pF htwPmy;!IUZshi-wpAg^66XVYPPt-RFSL#|1{{cK~fpGu; literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_BPIP_PS.png b/apps/wr/public/images/map/layericon/UFL_BPIP_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..dcc3622a76eeccb7c555f8fd9f30f76ce8591f08 GIT binary patch literal 1017 zcmaJ=U2D@&7|tBbF*i^Ybl!N#5EN{_+N3nBt6j6Xf+?dbtRjA-$ypoL-_i7Wh(Q4sO*>A1d;Nw6rV*!SMU_*X6fBuj3oe{l z$mH~ec|B&(i7_zh%S6C}SOdOQwmsR8(@kBO%!6%~22BW_kJI}}<<)7BLM{X%6AtMd z&jU$f_=qS;`~@Izyufngl|p<(7A0ATg4RQmXs$6QXO+oTEV7EzC5#=JWvkUHQw=l7 zEwX$p77H{4Aw&=%uV!P-582*GTS0-I?wSrZkqrVxt$->xPLoXck6<|+S=(!si4=_W zHHYOHE;v#fsH*>mT2=?`;VeAJ_n*REuI4~C3q4eEb<()Gksy>Kr(CFE(nS_%9$7ZK=Mw9x*Ww!8 zb4hmPvLqQcXzX8&Zf_Cy1k;Xf$)aO?XcM=)#MbYA(#Oe_u+mC0=YKBjHX4cE!52$Q zjp+NAaN|R`uu-q~EH2l!A8&nHDh{$w6VU(h>+I^Q#RtQ8e($dL*H<5w?=COzHEw*l zvQoZ2*2C@X)DQO=Z`XF7Y;CUG|2TB2vhwW6ZDZ54zNH<*u#Rk>P(9XCg5894sLM$cg6$rAb zI0TDOlt)ke1mhUif-9x6UCzDENxDjiK8A2r1F>taQq_JTsCgaI{AntNVK!vslT=lqSac%-%)#cFK-zIUe3bBV1 z__L(SxdPyI6M`tw6P75N1}sa^ktoa3A;3^HLsIBv!*qm;vK+G;tUWl2X3B$HQOK;t zLaPK`wQYkVNyl*rr-#tZA(D>8V!j5$gb^ZajcT^&hBd3Zp&&p@G8MyCbPf25VnrXZ z6FAEBSqZAKE~{B<$Ak`ybVY-t3Cb_20nFw8AF8VBXv;3b=lTApuvHp0AX$W#K4MC! zaf97{D1+loDB8MN()HtwQ!G?>N-uS$C{gSMj+Vm(?s=)FhY{5;#&I z6h-FJDL$3qX+9E-Ff^Tx>|yzgAjBAoN-+YxXLo}u=+cM^HM_x;pL2z#T;B?+fg%gg zR8B%UW9lkcEtylA=aOowx5ky5=W?Jamqf{seq;aD=*AXuk3U_vEn2J_A8N?$CbIRf z`Q9ZA3v9~@sgnCk<&ozlTUtN5k@a4v1liM{eB3b=3eE<)H+e6e{VZ^+uj z-%G({`6v}1ot`Yz7H-tvOSfOVmn6u^4X4HVcb(wG?3+EGXOD>P^5V9>o|f9+r`V6b zZ*V*FcNX7XSbAgom*);19`77KmIf_PpDxeTA3oUIdE&gZ@WFHTj9{rL6yx4f>>1uxL?sQ0S?_~Jr( z{G3OfQ7|fa=r8YPePud+x5hC0^S5VfB!jh5*vQm3mCMO1bN=O#P3MIx2adh-4>{eP A^#A|> literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_BTRS_PS.png b/apps/wr/public/images/map/layericon/UFL_BTRS_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..557c17089a8e791685cbd7fed39d5418549c6531 GIT binary patch literal 1097 zcmaJ=O-K}B7#=mH{OONMvxCD(v4uOcv+j=0uu&^FA>_rvo%@B6*)^Ihv` zJ6%#(UPur`Nw`&v;Bmk6?JmIoiXUki4@XgR40Xa@l$0$%G^#KT$gnQ=fe4V*k-_&M zKoEJ97LB2pbWTv9PRkC4PU$9Q6GWgsWy(rFKx7>BX-1G*pPr>iO$}0Ae#s-5A&}5o zM=j7f+7?wt`xRcL>g&irO27g-Kr)%q2Mk+C1*r{P0neRnh9Wm0s6R+;CKZ!9$Plyu z>8GpRiic%Mj-y$hpX1mn((7Tpj0eA*oAn8PPVm-{TMvb!S!%Bk5nHxm;Z=}IAY=** zlT0S*WHk+~K8EFa-qG-S-5BAvM+_vV+=gA5Q4oQxSel76XpoMg9EU?FNa0L3kD!~| zvWC4?CR{KkC7TROdz>R>fRglosIG6LZ4?1J`TkSbj*ggsi2xf8Sqg4kZ>1B;6han| z5wxNZ4rHp>k$?!=322g`PL6bSX@&}u_Q?&rBne@|MzW!Ruo$GU0FO@h27&!w{43T+r|e5cDsdbtqfh7!B=7?EH*|{ z%kf|7bbaXT$lO@LQjQ{h$t^fi*4`SslX$Sc^5*J``(>_ORbO+LyjJY6G5PY)#QN&D z;_qDL!ra`=Ds_B?4ERDxyVKI7CrCo xxeoQ?r#_5*PUp`zlwR>vp6PB_lpho0L>>{GGM>WaPig0Jhnw5PsivOGe*l2=X6*m~ literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_GMNT_PS.png b/apps/wr/public/images/map/layericon/UFL_GMNT_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..6081d8b00f9a9d5a9e9ee32b353bd1ad1042a5b5 GIT binary patch literal 1166 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`?qX)?WMJuRVrpV+Xy|I<v4~Pj*wm=R%;iu*SQ+p9GS>M`mbt(e`Ba^3#V@SoV zHIr?*4mk+4syjM<5SS*XkX!Y3?Vg4kw>T^tm#Tkc2s0~t#h7E$u%JV+cT&&ivUG)i zOQP8AJno&TKDlZ4T4Tf75Vf9`eHTL43iKWFin!9gILbjwrTudz? z7MwhvG>c2qpIvHB&$xE|=9StQ=CX`CZCP2XE}hRfagNDoVN=Gl<843f68C+vsc1`6 zlw$C2YuNjD+sySRZ@;%%5b2R?S literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_GPIP_PS.png b/apps/wr/public/images/map/layericon/UFL_GPIP_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..5d7e86fd28d67d9256ec0e6f5b6c5a70b5e3038f GIT binary patch literal 1103 zcmaJ=Pe>F|93HbIBuS&fBJweU6}0nb-JP0gH{IQFYoQfe7u?XI*_r1$+02_}-nOer zsnx;i&>_lBNd$JP=p+egWnee2b*S(lRD^*A9fIwRx!R#^n3?y7@B4ng_xpWsq^kF(WJBO* z8a*n<^FR<7-scwten0SXyqD$3D|mRH$DL$j-35D2lFz*Xtn&kJD#jCGRnv`l5mi9o5z?tRoY+ib@(~agZjN{yBnSt;(9t zN|{K(*t}w~Jj1z1Dgxv2|3eL9746^zT+8>L!cMZ!f@}ghC~K>vaozQ9C`*diP{GJf zB6PM`#kL-Vk<)`L5NQ{{-VWW=P|n%6jE~2qnCW1}RAEdG(nNvLbxq=b;w0kpY&EEa|0l zIapF}g{zg$MJ&l>NiwY4*uNTG+#>FAr>nLli&f)8lepa`wtg_}NaRYqipim5{$2WK zq0m%b{p;S?*tddm;%(va9cE}f7;YBBqa$Ti)~CQmTedLpY+`Uj zM=j^|&S%%nUA>X28WigmwrQ6`>Dldrn_h4qkN1hE_FSKt8JpQUTl++x#?5n6LyBTW zCVqSe@0%;X7Orsp>GDq-E|i@)R4;TcEq=(1K79DIPMhq?>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`X=vzX>1bkVV&dd%Xy|I<v4~Pj*wm=R%;iu*SQ+p9GSu@w9+cPjQe(`j145_%4 z^dv1Q)q#EY&yXbzAyNYEPOV|gA9b$#m(NpN{rl5*ac1t0hvKud&z?E6<;~U8&u#eM z-LfTkNLNsleevy_Vd1VN%Z=EzbnNuUhAkR ziV7TLdMtZqQx)@sUF=6<)FbS_6>s?PBzseVM8lJFe}C5HKRy5bdgB@03kO=6#Z0=b z9FHu#AMfx(VL~SNkz)ZnH#^iw+)dTt*}#oXD@?|_rvpU1_F9>umrf8@oU^o38j z_CECbrITrCkAEE4@Ks?M<0+#xJo$YmmdyR0w1e$Zk4)>f_xrWpTr!z;=9ucC56`}G z`-tDE{q&n*LK#Ehy+7#_Qw|9IUz4+jXOYk(oHPAIbBZ|UOqpmbtRc{t zxzBx0=TTdC1zP@JP6>&yTnds^2=d#Wzp$Pz-{}=QC literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_GVAL_PS.png b/apps/wr/public/images/map/layericon/UFL_GVAL_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..e8f7cde2e6b5547f88f9d06f44527a8fdf956cda GIT binary patch literal 1426 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`Vrgt-X5?&PVrt}KXy|HU>Fna_V&rOS;p%MW z=4xyV)9aF-T$-DjR|3v4~Pj*wm=R%;iu*SQ+p9GS=UH!EoWe0V)Jxy45_%4 z^ymM7duFR02hX=_axnHt$=fgF*l;J>SpMA4^Cyn{u-5!8UtOwq_^q>hpvbCQk;Z>= z=Kh)g@L{1^+y46h#tv%}YHG{mC!FPYwx{&VZ~jYvl7D*ntp5KuJ)yskLGlno3G3sf zSBn+&ejGk@{J@zb97oP1FgjLdwgq1@;wfrBzfj`CiEAAPc{IK=othqSG2sXI7rWD& z=i5uh+3h{Apr~*lfx|@dNxkKYMQZ7?2C>_}bKN)~?!dE2R^{8P`|)gcj*4u{>>Yyd z)l{7?`1sCrN4DdSzxQO%sXgQ4@jCU2N8e1pxPeVU+2`WxetF4#|9>7nz#_zGIlpyg z>%(Vfl?&AOR~8*-KKAeP*Ujpi%FoTY!*}H{%f^>qPA=vNUqA2J&Wdjr(!VrJo*0_` zz`u+X=F%7fIZ{M(9pi%Mjld-c`mE7TFyq_hn>BXO0 zkehI9!OEp)7`peBu6|b6<#pm?Lge0>PkH|@@U(4TpJ#AqZ?SmZf$Q=;8fwihCdvJ8~^Mu=p4~|a{=Q+RM;l`v(n|KZ-NjY3&WE0Cd zDe58;{&my$ZKD4fHeTMGZSiLA-nyn6u9gQiPRbl^*r%DDcxL|TYqH5H3JfzOG*}YE sb7E|pReTq0XnL7=WZGO$Mg~SU2FAd1S2y18F$0y7p00i_>zopr0Fdb%6951J literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_KMAN_PS.png b/apps/wr/public/images/map/layericon/UFL_KMAN_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..764ce8ba5dcfbccd8ca87ccd6a270597c2d441a0 GIT binary patch literal 1572 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`XyR($o& z6x?pHz^PXs=oo!a#3DsBObD2IKumbD1#;jCKQ#}S+KYh6`qIybz?{W2!_&nvq~cai zuywXbqKNH%bK~Dhljq(|xt_9EDJ#*zQ?MyXwdqD=XGg0-m{LasN0?&o*0~%>s$z!q ziYikDgr}64bqQ>8+`Rexn=@(8pYC)Pn*73iPHOtIdDZ7_zxU0Wxvwqxxl&>O4#zo4 zA{#w*gx`1S&%Zv6uj%SS7BNG2o6X%zx8#Zox(Z%esk3Jv_x9_qiyyMo{BNu9+cD{c zjmtlSm<{>iTFDwy-5yrz-FnM5r7uu#x?um5z?C6qdwb{iSMPntdhGrrmET-(n;vxw zCkt~NX4t)3?~ullvbZS4zNCBZ8n=`KP95ogfB(Y!>h~wASNt^AoOEpUrM#ZGaomiP zCE6I*>PDnV-OS-DlzI65n^?_#=bb@Q7x8zTzI5pCC6AjIq7Ii52Y45#-e@tZ3rERx&D||?l)ZDhQJH$#^(RHtRdf2kaCv1*C%8%6; ze~1i~T$AB+S^Pe~K&#**gN3TecNQ&PeA9=o@x9thmw#{WT&}lSan&qwhE}HOl9e{O zo*QoDndyuA-F|UQCU(unZM#0j^Xpvp5=o0V^Sb&|M(nqQuKIoR?9EqRy2&%kPxeyx zBKe6w99Fdh_2j&d{onU46u4r@WNb z!9|sG=Wd%Iej?gPZB@F$X^*i`<=X`KL{ae#??A6LmrpcX+5WM)|VWo{v?1 z&Uf*?{{vxeM}Z#e-d`f>i*&SIzo$-}sFJmPmP>Q?yR*jM^e$TcGkrII^%3QySrT`p li<8%f{uC1DXa6sl!0;kmk>gzTt=FJ(+tbz0Wt~$(69BpkPN4t* literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/UFL_KPOL_PS.png b/apps/wr/public/images/map/layericon/UFL_KPOL_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..d9fa712cf6c3528d5673c19c6c3cc6aaa42fe604 GIT binary patch literal 1122 zcmaJ=TWHfz7|xtjom2NBIzc_lKoo4!)HbuBb#}?BMO#K&aOydsF z6J(%1i6{!9h$y~@^8(Hx-awoeHWV*UKBxngDT0XgWUkW(Ye;e~eBbx~=l{QRpdq|z*4Hwl}f!nKYmD{T;iENsz?2>tQ;O&VxwgkBd+_!6cFTea2Q z7EE_1GfH=x5>n~f6(H;gL_mjF29Dlt*n$(G$8-fUcehy@j6rZ)g#MjWW1<0w$bulq zEb}TpjsrZ;aDgDtb4!8W$N5z_Q~t?COGo1Z~CAOspXTxQcQXb>Ik1GW~r7-JFm$ z?C~;@g0YTlvK-@ck5m9A690$l`UKj>DflPfe+t`~E)%jTXrm5GA&qOUc0-whXh9hx zD}zvbp^6Qy2qU`{nLteQVDUQ5P*KiaGKNnigt%d2*-&6yiqJ%X(KJ;E1*K>#Aaa3# z=;yflK!^|WVzkaD)`X;(CqG;o2d{^9zIa$PIvCW$OTOY4Mc%tAUCJF=h^ z&803@RBxQC7SF|3l*^K2Shul%HM+1x+~ZCsY)cjs#)k%RyG3mMF*#gKuEbDWie{V_ z*&q3QZ7JW7-ZZ*d6pzb~PDILIhQsCQvq^aSOz*yuS%ZVmCO@q~uLjQTpLT3ZXD9!1 zJ(zQ2+qd4Tsue$LAA3%g>iYaAO*?14zPWA9(UL3Z&7$X&({sJA&v);^{Zl=MMkZ~i z&X@Erzgw~Kl37(6f4B0>UB=V9YF1@);KJUiftn)=dMe*mJUq3-(>Ht9VL#t~Vc`3l zE7@pKD3{fhAENU1j3f%eFk6Cwc({*PzH(XnG7xdEEnWH=E%$a76?J8kt zq6rojArweP5K&MU-2|2u84I(`Yuw+v;kP3CuR+Lh35cw&b>BbQ>qbRFe z`7+^xF=EHg{|a}0hlBF$48?=M7NNn%OE29DXc)Nsv@{KJ{S&p!)}io zS3TrzPeu4O{kIUM;6r5 zxrin8@?524F5XZ{E`yU{?8g4p=)x9uk3B8g7B7m%2Re4UiEaJMq_*M9u^ncLGeHr>)p%vD@!;U``# z#gk%1;(Kl((_k##n3z3teeLa=n$a&0_rF`&E~f8~tkl&$seXE(aqmEP>n9@ja(Q`t z{4gE3Sv?<{yu8J`?>4#3e9(QcqCGHPdG=hINX%@$SUGk46tSt2m{>hMKY8!ibNkjt LLLK6r*6y+26oFXm literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/WTL_FIRE_PS.png b/apps/wr/public/images/map/layericon/WTL_FIRE_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..4137a3f74526c367650a0bf2b998b01a3fe31e12 GIT binary patch literal 1072 zcmaJ=TWHfz7>=xLV>qt}I&g;UMP*Hzu1(jlI@@NKf~m8st`91v$ypn=!U=7x6k}n~cG{AWnTzaD(m17bo*Y5a-FZZa!E;l5^qvzW+b}|DFD} zXiH^9RRuv1m628kzr^8 z(o5GlWf#km97nSrFUPU9q}#>185e#zC+p$89Pjp#s}F^vnMx-g6Pj0J;Z=Z2BV_Ol zlgVW0OdSo)6vO)cep|!sc4CCn>eZ2yb?R14K|uhPY^nxQp-$S0QWEx{0EIJMIf7=a z$?Dc>nQ+0FtYk1O?Xr(l0E*)Op_;aawonYL=lf4#E8c4WCI&3nW6HR3oi%nSgAbcP zLePvu*j=b%TN)y0rJ+HF+c|P?hpH2(Jg4*z1+KErZ7#~St)Lk=vH(o=3{aX)sFBM@ z=GEf4gp2B}a+Tt_2t~OJPKL1?`&Xk2Ti8AJbj`MSv1WXrW4D{w)=&Gl-@sSmc0>rq zv!5nn?4~@q(UF>&gTJo*o-Es0HZwLc-xpVF?;PD$I&eJQ{iHgjm5<+LKabRx4n0U* zCg{!Ie{3C!#B+-C zZxL_8C6$Z$s>tgPfrXyxdB<2qBKhThwB;)`{_5e5U~b_2+|t>F=Pz4t4x7<~nZfCa a_WTAyAH6Vm<>PMAzQd8GsBkZIs_zd&Kw|U& literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/WTL_FLOW_PS.png b/apps/wr/public/images/map/layericon/WTL_FLOW_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..285f7edfa81fce7e403067fa779164e206500b58 GIT binary patch literal 1137 zcmaJ>TWHi+7)~t?T3gu_#S1Pyr0!O6XOc6Q*u=)}?4+Z!I(3|mwm#WRa@xi=IWak% znbw!O%Ibn3!ipj&7D4u*%C0P|s}EL0t>S}XABvz9K~O=e)Z2qtPim+7;A}{8{&V=g z@4qI$r<&GRRV=Gu7^W(*K}pl~8}FIpqwng8NtG^3Nnioj&@|DmQigLX+8eUA65!fvM5MqC=XxX00G$V!MM9v#Z)II*zLqNh&2mfWs70yIPb2S!Y7kb!g7gfX(*w{EL8{?hAxG| zaZ!MLI2?g72phvuYKTIe2*WTQ7eh*st6;6iL>4J>_0QZ$Nv<~vrcFI7$T4zAk2}}| zQz=VE=~#j#^`^Oc=~zM~xf~6K^BVg_ql-s$dOUMxZ0TlZ@R3EQ-JxT>ZQq>%`bj)a zDA7#ee)j$3WJ9?ybo~Av_T}!}>>8ox;AkadG;RE4-^9_Amv6jy{XRPQ+h6<`b8m1( zYSEd0w5|K^^$%*?kZ_e5o~`WO^9SF?EbX5+u~~jo{p8i;yAd9y=GfO~3D;I!oAvL2 zTv6Qug5THHo*wl*+OfJSTlbu;TwMNlG&?$SerUbren?a^<$r2hB=_J^&5Pnm_Mm@*%;YWbnPrw70R?c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDi`VQ%K?Vrt-QVruAYXy|HUY3X8N>11x~Z0PJ} zU~1_G)9aF-T$-DjR|3v4~Pj*wm=R%;iu*SQ+p9GS^s~$av=i)Q>UkkV@SoV zCBeS_!hs@t-=Cd*-EX;r_i_O*(bR?9_DyP9oQa7Yf7qR4B*Ts!Int^vw(HVdPU~Lp z$NmR8)(P~e{b;;D%faP9(2TNMm&)w!e=cK?EnKc|d2-L5Io0QPe&?AObm+g#uIF_e zhMgLUDJ>P?0zRbO6 z@_2e*sf4rSvU`(S{N7KBSn~Nu(Bi_Bs$|_6Yr_^^SmPX%cwy6x^)Iv6O^H2!>gdE4 zr^-ofdseP!JzXZyV`IYIIrGx8(va(Gxqmhv*l4ZJbWW6Gv5;w1H~&xt;H zvY7SQvux2{r?i$g2tD4hu3CL^t^fn4uE;FEZ5OtfYSw;WZB0Ec?R2i9+oNooLcU&I zYvt)9=NWiR+1~aXG{4Qada+f`QinMW)6;wkT0bs&y~b9;V)Fm3t&_5ue~HW~3>0LV z_U0|)sws`@0s=M`^aK^}FbxutmQ)}j&`ZOcI;!o7cQg*F*v!hpp9=6QT zVe2>VR%m!3v1a?6P0}7eH+_$9a9~P{`Kh5QdpsiE<;@zeq%~7NZOgIR>D|Zna{hUL aMmC1RZ)#d6L=Wu;71W-telF{r5}E*KPgV5* literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/WTL_META_PS.png b/apps/wr/public/images/map/layericon/WTL_META_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..22c7af31b32386e501fbc0948bcf4bdf44d58332 GIT binary patch literal 1100 zcmaJ=TWHfz7>-oSm~Ko^)Cqc)sheP%OWSC()wwmDE7~!-$_j!uP0rT1B_}3lHmgI2 zV;fT+L=;4P5?_4Lf#8b|-f%Eb@J$p%MCOY(ydd7^$+k`(tRcy{@O|I^pa1{Pct`ur zit_4milQpwZBmkqRqj{jCI9swXJj(0!Lc;%MBO+qTaap2Q5J%@F89DBl+}TQQ?QYu zJhYZd<8)%Ts36@hyBNQtn}khKjZKazE4>hdEbP&Y2>tHHO&VxwgzgF@*n}B{IjyZ= z!OlW^N-6XzVU=#$4jLVi2w(A(MnQ>bDfqxb9jvlqp6nC}U)$ z5b7&du_K2tvUA7;(M|!>cWH)-^7iIgd?F#n4I9gb0^?GICJKH{Q$;qw@`A867z}X| z$HjupEj$};4e?S-fR9CET#+jwrC)~zE^^gB+)zobYX#jTktJwphoIVOAsx&fS=37B z!k5&W=c=W136$hABpJqS>|c#8ZV~sm(*@g-#e(snLELT;Tfg#5?I2g;R$OXMIZv`b zW@ef^8;6!ZrQQq$FKpWPls&Qh>LT#q`lPr`Zy5YsK3ZdXGUspp{5HHNuxjnn^xN0d zYwJfRGM!G>WaV9Ix^8Tu`lL*?UAufdI6ShV?(TTcv*({QZ-aO0@OO4u=Faqf^#Q0} zmAU;gbxH^3w@S|i@A%Q$Now%dJ?})JdGDFwntPAdjcl5tb}h9>U(~fAicuN=xS0Z>&&g AEdT%j literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/WTL_PIPE_PS.png b/apps/wr/public/images/map/layericon/WTL_PIPE_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..c9c6863f68f8ce9b39d7758ae2bc1d0814d46948 GIT binary patch literal 1075 zcmaJ=OK8+k6n(8)wNlV3s9k7CD=0e2WI7W&Vbb4Zq9dl1=|HDa#58$rV@+O~ymr!$ zQi@g-E3QK2{g=0waKAdyzefOSsrnO~X zMR`>@0H7kdUrLd2z5lH#BmeE+aw-|N;zS0wp>CX29SE9q)CH-esrJAWRP~|$=P(Aq z3ff3#a7H;OXvkz#AH#U2P1pd$8a!Lo`XHvdV2@#m^q2cHG-c=_-5ybbiXDf&#{OXk zwhgzWwc$Q3s?!biRLm2IfC;fmdFC<86+Ds7>k4G>+0E;xq^!E`=ds)_U zm&!y6#(JvFa!k-aQURza|A(69GTOx{_$S|g3cKkc8?q_rq5(%Ejq9%VL)k*yfhtB$ z8lhu_Dz^3_jND#iQ}H&Q+SzVcI?B4c@_0oNl9r2AOM^*Cq=^D!7`o70$2Ui0IUbI1 zagIxb>*S_LBE<8u6qiGCG+5wDNE%p4(iBF9TP|r^o zxm<4aemu|@!+!)pRYV9y)9peIrC#+9iRB|V*xxFn|{A$ z(~E`Csj{)@a`F3}tuNm`I#p6#)xV>%6Lg3h4=j`_r{4mXIVWGde)PZ%>+rQhR?RA~ Zatrt{J2@{+9zW|}<7A>my48GS{1?p)VJH9q literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/WTL_RSRV_PS.png b/apps/wr/public/images/map/layericon/WTL_RSRV_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..d7b307a61bcaa6059fe5565713ae6055c29d209b GIT binary patch literal 1057 zcmaJ=O=#0#7>?|RF*leyZM!UFtW31|=}%_EYU!GGE80=o!is_{O}?#RO}?0Xv)vFK zia+zyB!Hw$pL`Am z2%?TsQ)!fr9TjA#(UOg!3z~u11ThdO7?L~*5SalJs_v)0E-X@{s`#l(M|u=wSjoJa8Tf~%h_KNOB;D&s;zjFe;Hm7mHYWC#qC z&*$m9n}+5D!})wZTf^mYVuaJ0){#_j>Q+xhK?Ig;ss>V_PTGo622LSAg)`kLK{Kkd zx>Y_Vd|*sLG8m3#?UE|MSnU5$O{=0UlmNT={!`dWO&fqo01Hl;GH%>>j~&VoLMD(9 zG*b}fDyJCFLIkZWG{{hrC;LWKU4eOPe+eIp2~pibk}iX&=%=s(t*VOPW?4SSdt4qb zCvsfa6LdwmLwwll@kK)3aKEp@6`?$(0UcGi$}ZPklWSW+GjL=PnCdB@L`1jXD^d3}ZL;uSQq4uzT!j)wXz1H9pX>+f8ii?@j3=_)1)hiosOj zZRTgO7^v%=ZJ57pJZo=BZmeCFR_nDQTHIAGDY zWXc1lPdC`srZos0TDLEC?t;)gN!Fb+Bv)nKtA18_%+mdO>6NIHmdpWOiIHMnnpdJ` zF3X(yChSMs{s-bLm%jhK&0eB%Ok;Wck14mcZ5S1f`OHr}BH0XdBZH@_pUXO@geCxp CKw=aC literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/WTL_VALV_PS.png b/apps/wr/public/images/map/layericon/WTL_VALV_PS.png new file mode 100644 index 0000000000000000000000000000000000000000..ca2b4788b74c2c48d2c6a71fee593031ab421a82 GIT binary patch literal 1077 zcmaJ=TSyd97#=k&P0b(>Lvk2}GTfP+buaGVD(lRu8;vgOf*bVE?95RIojKFYv0Z&p zQ$&j(Gcw6udJuXjdI^Fal7cQq?-3$hjGijGJP0LrMt9d9+J>1q7ryWN|MUOfnTd3^ zmlhu`CJ3T5+#y8qSZ;s&3h}@C$CiYLN)(EtZrF>Gk_m{Q0uz7?Yf>MG0!bM@`vNo( zL;JC~_Nu1_IPhQgJat^3VjN zhi-7lPL?ITUYd1#yk54RbU9fU7oyb4hL2pJs1 zB$G)x*+4_Hk750OzpdeNIWWRu4eLlsIdrQgqaXlFHdOX( zvbvQn6D}B&k_?8Wo%WG3KvDcZRMWC(3q`?hzW)@qV#5YtqQHVfri>fcTVsbZINk&j zf@TcD!Aun+{SZN`9~vaz?In-(sJa4^R^2vU6uGc&AxW1(SO`#9fmT(83%Pv0#-OLs z?O}PA4Y~axC*RoW6Ik9AbOzg6Gh6}6LmJRghO6vy{W-a|6*L1!7J#Xq14^3-HFEpN zoSHiqZ%(~5SIM1=FDIA5$uM?f|7vt*3%kdjW^IcXS>pp8yWPaLzWJ)_6TT9+!$L5Y zdXw1L+G;5%xv{XY*}gP0EAKh@e0g=Xs^0j%9&RgikBMda*u=!fBr7i5*;tR{udJ8IEDy!;YEe%*XruYA&OU*vG8Q@GoD=KLQ_Vqx_F literal 0 HcmV?d00001 diff --git a/apps/wr/public/images/map/layericon/default.png b/apps/wr/public/images/map/layericon/default.png new file mode 100644 index 0000000000000000000000000000000000000000..92bf1f587e549c99cabe90492d4421dd2f8a8dbc GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^(jd&j3?%D+y-WjAJOMr-t{fa3iV^}#7cKqw|Nnm$ z%?m(rmXaX9U?7jdL2Km~AfL0qBeIx*f$sEak7F*Vu1jg5_``2YX^v17+v zG)>uiB)-dvm@BaA1RpYY5rpXW7lzz`{*&wxTB^!gCocK!zUrl|Wb_P#ZKbLh* G2~7Ysgdv9j literal 0 HcmV?d00001 diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index f68d0798a..42ef97f70 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -1,25 +1,38 @@ -import './lib/css/gis.common.css'; -import React, { createContext, useContext, useEffect, useMemo, useRef, useState, useCallback } from 'react'; +import { Search } from 'lucide-react'; import OlMap from 'ol/Map'; import View from 'ol/View'; import { defaults as defaultControls, OverviewMap } from 'ol/control'; import { defaults } from 'ol/interaction'; import * as olProj from 'ol/proj'; -import proj4 from 'proj4'; import { register } from 'ol/proj/proj4'; -import GisApp from './lib/gis.core'; -import GisContent from './GisContent'; -import GisTree from './GisTree'; +import proj4 from 'proj4'; +import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; import GisLonLat from './GisLonLat'; +import GisMapToggle from './GisMapToggle'; import GisSelect from './GisSelect'; import GisToolBar from './GisToolBar'; -import GisMapToggle from './GisMapToggle'; -import { Search } from 'lucide-react'; +import GisTree from './GisTree'; +import './lib/css/gis.common.css'; +import GisApp from './lib/gis.core'; +import GisContent from './GisContent'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); -function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = false, isMiniMap = false, setIsOpen, setFeatureData, featureData, searchView : SearchView, detailView: DetailView, onFeatureSelect, setIsSearchModalOpen }) { +function Gis({ + isOpen , + gisMaps, + isSearchModalOpen, + treeData = [], + isSearch = false, + isMiniMap = false, + setIsOpen, + setFeatureData, + featureData, + searchView : SearchView, + detailView: DetailView, + onFeatureSelect = null, + setIsSearchModalOpen }) { const mapRef = useRef(); const [mapObject, setMapObject] = useState({}); const [tabVisible, setTabVisible] = useState(true); @@ -92,6 +105,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa setIsSearchModalOpen(false); }, [mapInstanceRef]); + // 지도 생성 및 초기화 useEffect(() => { if (!mapRef.current) return; if (mapInstanceRef.current) return; // 이미 생성된 맵이 있다면 중단 @@ -105,7 +119,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa ]); register(proj4); - //맵 생성 + // OpenLayers 지도 객체 생성 const map = new OlMap({ layers: [gisCore.baseLayers['base'], gisCore.baseLayers['satellite']], renderer: 'webgl', @@ -133,7 +147,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa gisMaps.current = map - //미니맵 + // 미니맵 추가 if(isMiniMap){ const overviewMap = new OverviewMap({ layers: [GisApp.Module.core.baseMiniMapLayers['base']], @@ -148,6 +162,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa map.addControl(overviewMap); } + // 스케일 컨트롤 및 베이스 레이어 설정 gisCore.__proto__.map = map; gisCore.scaleControl(); gisCore.changeBaseLayer('base'); @@ -155,20 +170,25 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa mapInstanceRef.current = map; // 생성 완료 플래그 설정 }, []); + // treeData 변경 시 레이어 코드 생성 useEffect(() => { if (!treeData || treeData.length === 0) return; + // 기존 오버레이 및 레이어 모두 삭제 gisCore.deleteAllOverlay(); gisCore.deleteAllLayer(); + // 트리 데이터를 레이어 코드 객체로 변환 const layerCode = gisCore.convertLayerInfosToLayerCode(treeData, 'lyrSn'); - GisApp.layerCode = layerCode; + GisApp.layerCode = layerCode; // 전역 레이어 코드 설정 //setTreeData(data); + // 편집 가능한 레이어 목록 생성 const layerItems = getLayerItems(layerCode); //setEditLayerItems(prev => [...layerItems]) }, [treeData]); + // 레이어 코드에서 편집 가능한 레이어만 추출 const getLayerItems = (layerCode) => { const layerItems = Object.entries(layerCode) .filter(([key, obj], idx) => obj?.updtPsblYn === 'Y') @@ -213,12 +233,12 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa - + {isSearch && ( @@ -243,4 +263,4 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa ); } -export default React.memo(Gis); +export default React.memo(Gis); \ No newline at end of file diff --git a/packages/common/business_components/src/ui/map/MapToggleBtn.js b/packages/common/business_components/src/ui/map/GisMapToggle.js similarity index 100% rename from packages/common/business_components/src/ui/map/MapToggleBtn.js rename to packages/common/business_components/src/ui/map/GisMapToggle.js diff --git a/packages/common/business_components/src/ui/map/GisSelect.js b/packages/common/business_components/src/ui/map/GisSelect.js index 4aa8f3049..e9deb72f7 100644 --- a/packages/common/business_components/src/ui/map/GisSelect.js +++ b/packages/common/business_components/src/ui/map/GisSelect.js @@ -1,37 +1,42 @@ -import React, { useCallback, useContext, useEffect, useRef, useState } from 'react'; +import React, { useContext, useEffect } from 'react'; +import { GisContext } from './Gis'; import GisApp from './lib/gis.core'; import GisOlSelect from './lib/gis.select'; -import { GisContext } from './Gis'; export default React.memo(function GisSelect({ onFeatureSelect }) { const { gisMap } = useContext(GisContext); - - - // useEffect(() => { - // if (!gisMap) return; // 아직 초기화 안 됐으면 아무것도 안 함 - - // const select = new GisOlSelect(gisMap); - // GisApp.Module.select = select; - - // select.getSelectedInfo(function (features) { - // if (features?.[0]) { - // // onFeatureClick?.(features[0]); // props로 넘긴 함수 실행 - // onFeatureSelect(layer.getProperties()); //피쳐 속성데이터 상위컴포넌트로 전달 - // } - // }); - // }, [gisMap, onFeatureSelect]); - const select = new GisOlSelect(gisMap); - GisApp.Module.select = select; - select.getSelectedInfo(function (features) { - //clickFeature(features[0]); - if(features.length > 0) { - const layer = features[0]; - onFeatureSelect(layer); //피쳐 속성데이터 상위컴포넌트로 전달 + useEffect(() => { + if (!gisMap) return; // 아직 초기화 안 됐으면 아무것도 안 함 + + // 이미 select가 있으면 재생성하지 않음 + if (!GisApp.Module.select) { + const select = new GisOlSelect(gisMap); + GisApp.Module.select = select; + + // 피처 선택 시 콜백 등록 + select.getSelectedInfo(function (features) { + if (features?.[0]) { + console.log('GisSelect features', features); + onFeatureSelect(features[0]); + } + }); } - }); + }, [gisMap, onFeatureSelect]); + + // const select = new GisOlSelect(gisMap); + // GisApp.Module.select = select; + + // select.getSelectedInfo(function (features) { + // //clickFeature(features[0]); + // if(features.length > 0) { + // const layer = features[0]; + // // console.log('GisSelect layer', layer); + // onFeatureSelect(layer); //피쳐 속성데이터 상위컴포넌트로 전달 + // } + // }); return ( <> diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index d01786187..dec618926 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -1,21 +1,20 @@ -import GisApp from './lib/gis.core'; -import { util } from './lib/util'; -import React, { useEffect, useState } from 'react'; -import { useGisContext } from './Gis'; -import { DndProvider } from "react-dnd"; import { - Tree, MultiBackend, + Tree, getBackendOptions } from "@minoru/react-dnd-treeview"; -import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components/ui/tabs"; +import { ChevronLeft, ChevronRight } from 'lucide-react'; +import React, { useEffect, useState } from 'react'; +import { DndProvider } from "react-dnd"; +import { useGisContext } from './Gis'; +import GisApp from './lib/gis.core'; -export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => {} }) { +export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible }) { const { gisCore, treeData } = useGisContext(); const [checked, setChecked] = useState([]); const [expanded, setExpanded] = useState([]); const [nodes, setNodes] = useState([]); - const [isSidebarOpen, setIsSidebarOpen] = useState(true); + const [activeTab, setActiveTab] = useState('layers'); useEffect(() => { if (treeData && treeData.length > 0) { @@ -25,19 +24,27 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes } }, [treeData]); + // 트리 노드 체크 시 레이어 표시/숨김 useEffect(() => { if (nodes.length > 0) { + // 기본으로 체크된 노드들 찾기 const defaultChecked = getDefaultCheckedNodes(nodes); setChecked(defaultChecked); + console.log('defaultChecked : ', defaultChecked); + + // 기본으로 확장된 노드들 설정 const defaultExpanded = Array.from(new Set([ ...defaultChecked, ...defaultChecked.flatMap((id) => getAncestors(id, nodes)) ])); setExpanded(defaultExpanded); + + // 기본 체크된 레이어들을 지도에 표시 gisCore.setLayerOnMap(defaultChecked, true); } }, [nodes]); + // 초기 표시 여부가 'Y'인 레이어들 찾기 const getDefaultCheckedNodes = (nodes, values = []) => { for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; @@ -115,7 +122,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes }; const makeLegendSrc = layerinfo => { - if(!layerinfo.gobjTy) return null; + if (!layerinfo.gobjTy) return null; let src; if (layerinfo.iconNm) { @@ -176,34 +183,61 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes return ( <> - - ( -
- {node.droppable && ( - - - )} - handleCheck(node.id)} className="cursor-pointer"/> - {node.icon && {node.icon}} - {node.text} -
- )} - sort={(a, b) => { - const aOrder = parseInt(a.data?.sortOrdr ?? '0'); - const bOrder = parseInt(b.data?.sortOrdr ?? '0'); - return aOrder - bOrder; - }} - /> -
+
+
+

레이어

+
+ + ( +
+ {node.droppable && ( + + + )} + handleCheck(node.id)} className="cursor-pointer" /> + {node.icon && {node.icon}} + {node.text} +
+ )} + sort={(a, b) => { + const aOrder = parseInt(a.data?.sortOrdr ?? '0'); + const bOrder = parseInt(b.data?.sortOrdr ?? '0'); + return aOrder - bOrder; + }} + /> +
+
+ {/* 접기 버튼 */} + +
+ {/* 열기 버튼 */} + {!visible && ( + + )} ); }); diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index faebb90d3..309012a44 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -26,10 +26,13 @@ const GisApp = {}; //레이어 정보 GisApp.layerInfos = []; //기본정보 -//GisApp.GEOSERVER_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/ows'; -//GisApp.GEOSERVER_WMS_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/wms'; -GisApp.GEOSERVER_URL = '/sn/geoserver/hasudo/ows'; -GisApp.GEOSERVER_WMS_URL = '/sn/geoserver/hasudo/wms'; +GisApp.GEOSERVER_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/ows'; +GisApp.GEOSERVER_WMS_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/wms'; +// GisApp.GEOSERVER_URL = '/sn/geoserver/hasudo/ows'; +// GisApp.GEOSERVER_WMS_URL = '/sn/geoserver/hasudo/wms'; +// GisApp.GEOSERVER_URL = '/geoserver/hasudo/ows'; +// GisApp.SN_GEOSERVER_URL = '/sewerage-service/api/v1/map/geometry'; +// GisApp.GEOSERVER_WMS_URL = '/geoserver/hasudo/wms'; //맵 정보 GisApp.EMAP_URL = '/emap/'; @@ -47,7 +50,8 @@ GisApp.BASE_MAP_TYPES = []; GisApp.FROM_PROJ = 'EPSG:4326'; GisApp.TO_PROJ = 'EPSG:3857'; GisApp.TO_DATA_PROJ = 'EPSG:4326'; -GisApp.CONTEXT_LAYER_PATH = '/sn/images/map/layericon/'; +// GisApp.CONTEXT_LAYER_PATH = '/sn/images/map/layericon/'; +GisApp.CONTEXT_LAYER_PATH = '/images/map/layericon/'; GisApp.layerCode = {}; GisApp.hlLayerId = 'LightFeatureList'; GisApp.hLayerId = 'highLightFeature'; @@ -507,6 +511,7 @@ GisApp.core.prototype = { * * Returns: */ + // 레이어를 지도에 표시/숨김 setLayerOnMap: function (layerIds, visible, addQurryFlter) { for (let i in layerIds) { let id = layerIds[i]; @@ -517,10 +522,14 @@ GisApp.core.prototype = { const layerCode = GisApp.layerCode[id]; const queryFlter = layerCode?.flterSql || '' + ' ' + (addQurryFlter || ''); layerCode['flterSql'] = queryFlter; - //layer = this.addWmsLayer(layerCode); + //layer = this.addWmsLayer(layerCode); + + // WFS 레이어 생성 및 지도에 추가 layer = this.addWfsLayer(layerCode); } } + + // 선택 인터랙션 및 스냅 기능 설정 if (GisApp.Module.select) { this.setSelectInteraction(); } From 6b2b5b56d4bbf067b2fabccc3845cfac224e625b Mon Sep 17 00:00:00 2001 From: swcho Date: Fri, 13 Jun 2025 11:26:08 +0900 Subject: [PATCH 002/259] =?UTF-8?q?fix:=20merge=20=ED=9B=84=20import=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx | 2 +- apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx | 4 ++-- .../sn/app/map/components/popupComponent/chart/infilChart.tsx | 2 +- apps/sn/app/map/components/popupComponent/sewagePump.tsx | 2 +- apps/sn/app/map/components/popupComponent/stormWaterPump.tsx | 2 +- packages/common/business_components/src/ui/map/Gis.js | 4 ---- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx index 1db284c8e..1fc0cef80 100644 --- a/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx @@ -1,4 +1,4 @@ -import { VerticalTable } from '@/components/ui/verticalTable'; +import { VerticalTable } from '../../../components/ui/verticalTable'; import React, { useState } from 'react' import InputSection from '../InputSection'; import { handleInputChange } from '../common'; diff --git a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx b/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx index eef14ea5e..0d1c3ef2e 100644 --- a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx +++ b/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx @@ -1,5 +1,5 @@ -import Modal from '@/components/ui/modal'; -import { VerticalTable } from '@/components/ui/verticalTable'; +import Modal from '../../../components/ui/modal'; +import { VerticalTable } from '../../../components/ui/verticalTable'; import { UiTable } from '@common/business_components/ui'; import { Button, TableCell } from '@common/components/ui'; import React, { useState } from 'react' diff --git a/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx index ba0b70455..06c5b5fec 100644 --- a/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_components"; -import Modal from '@/components/ui/modal'; +import Modal from '../../../../components/ui/modal'; import { Button } from '@common/components/ui'; type ModalOpenProp = { isModalOpen: boolean, diff --git a/apps/sn/app/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/map/components/popupComponent/sewagePump.tsx index 5776df5b2..79103a40e 100644 --- a/apps/sn/app/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/map/components/popupComponent/sewagePump.tsx @@ -1,4 +1,4 @@ -import { VerticalTable } from '@/components/ui/verticalTable'; +import { VerticalTable } from '../../../components/ui/verticalTable'; import React from 'react' const inputColumn = [ { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, diff --git a/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx b/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx index eefef8b3b..172022f31 100644 --- a/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx +++ b/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx @@ -1,4 +1,4 @@ -import { VerticalTable } from '@/components/ui/verticalTable'; +import { VerticalTable } from '../../../components/ui/verticalTable'; import React from 'react' const inputColumn = [ { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 3d498f40c..48dce9284 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -15,10 +15,6 @@ import GisLonLat from './GisLonLat'; import GisMapToggle from './GisMapToggle'; import GisSelect from './GisSelect'; import GisToolBar from './GisToolBar'; -import GisTree from './GisTree'; -import './lib/css/gis.common.css'; -import GisApp from './lib/gis.core'; -import GisContent from './GisContent'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); From 0ebe5e8ab8efd6f7fd2b54c5df2bf9a42f8961e0 Mon Sep 17 00:00:00 2001 From: swcho Date: Fri, 13 Jun 2025 12:50:43 +0900 Subject: [PATCH 003/259] =?UTF-8?q?-=20refactor:=20=EC=95=88=20=EC=93=B0?= =?UTF-8?q?=EB=8A=94=20import=20=EC=A0=95=EB=A6=AC=20-=20feat:=20=EC=A7=80?= =?UTF-8?q?=EB=8F=84=EC=97=90=EC=84=9C=20Search=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=88=A8=EA=B9=80,=20searchModal.tsx=20props=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/htdflSttn/page.tsx | 2 +- apps/wr/app/map/searchModal.tsx | 2 -- .../business_components/src/ui/map/GisContent.js | 12 ++++-------- .../business_components/src/ui/map/GisMapToggle.js | 2 -- .../business_components/src/ui/map/GisTree.js | 8 ++++---- .../business_components/src/ui/map/lib/gis.core.js | 14 ++++++-------- 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx index f6b967c05..f3ff3da1c 100644 --- a/apps/wr/app/map/htdflSttn/page.tsx +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -94,7 +94,7 @@ const Map = () => {
= ({ selectUnitWaterShedData={code.lgbsnCd} selectMiddleRegionData={code.mdmbsnCd} selectEnvPartData={code.lclgvrnmntCd} - rightChildren={undefined} - leftChildren={undefined} queryClick={function (returnType: ReturnType): void { // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' let con; diff --git a/packages/common/business_components/src/ui/map/GisContent.js b/packages/common/business_components/src/ui/map/GisContent.js index a8ac408e8..4133beed0 100644 --- a/packages/common/business_components/src/ui/map/GisContent.js +++ b/packages/common/business_components/src/ui/map/GisContent.js @@ -1,12 +1,8 @@ -import React, { useCallback, useEffect, useRef, useState } from 'react'; -import GisApp from './lib/gis.core'; -import { useGisContext } from './Gis'; -import GisLonLat from './GisLonLat'; -import GisSelect from './GisSelect'; -import GisToolBar from './GisToolBar'; -import './lib/css/gis.edit.css'; -import GisMapToggle from './GisMapToggle'; import { Search } from 'lucide-react'; +import { useCallback, useEffect, useRef, useState } from 'react'; +import { useGisContext } from './Gis'; +import './lib/css/gis.edit.css'; +import GisApp from './lib/gis.core'; export default function GisContent({ edit = false, onFeatureSelect, isSearch, setIsSearchModalOpen }) { const { gisMap, gisCore } = useGisContext(); diff --git a/packages/common/business_components/src/ui/map/GisMapToggle.js b/packages/common/business_components/src/ui/map/GisMapToggle.js index b157dc141..c890f75f8 100644 --- a/packages/common/business_components/src/ui/map/GisMapToggle.js +++ b/packages/common/business_components/src/ui/map/GisMapToggle.js @@ -1,7 +1,5 @@ import React, { useContext, useState } from 'react'; -import { Button } from "@common/components"; import { GisContext } from './Gis'; -import GisApp from './lib/gis.core'; export default React.memo(function MapToggleBtn() { const { gisCore } = useContext(GisContext); diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index babdf69b2..dec618926 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -1,13 +1,13 @@ -import GisApp from './lib/gis.core'; -import React, { useEffect, useState } from 'react'; -import { useGisContext } from './Gis'; -import { DndProvider } from "react-dnd"; import { MultiBackend, Tree, getBackendOptions } from "@minoru/react-dnd-treeview"; import { ChevronLeft, ChevronRight } from 'lucide-react'; +import React, { useEffect, useState } from 'react'; +import { DndProvider } from "react-dnd"; +import { useGisContext } from './Gis'; +import GisApp from './lib/gis.core'; export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible }) { const { gisCore, treeData } = useGisContext(); diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index 693fbfa0c..72a584970 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -1,26 +1,24 @@ import MousePosition from 'ol/control/MousePosition'; import ScaleLine from 'ol/control/ScaleLine'; +import { getTopLeft } from 'ol/extent'; import Feature from 'ol/Feature'; +import GeoSJON from 'ol/format/GeoJSON'; import WKT from 'ol/format/WKT'; +import { Point } from 'ol/geom'; import LinearRing from 'ol/geom/LinearRing'; import Draw from 'ol/interaction/Draw'; import TileLayer from 'ol/layer/Tile'; +import VectorLayer from 'ol/layer/Vector'; import * as olProj from 'ol/proj'; import VectorSource from 'ol/source/Vector'; +import TileWMTS from 'ol/source/WMTS'; import XYZ from 'ol/source/XYZ'; -import GeoSJON from 'ol/format/GeoJSON'; import { Fill, Stroke, Style } from 'ol/style'; import CircleStyle from 'ol/style/Circle'; -import VectorLayer from 'ol/layer/Vector'; -import { Point } from 'ol/geom'; -import { getTopLeft } from 'ol/extent'; -import TileWMTS from 'ol/source/WMTS'; import WMTSTileGrid from 'ol/tilegrid/WMTS'; // import { get as getProjection } from 'ol/proj'; -import proj4 from 'proj4'; import { register } from 'ol/proj/proj4'; -import olSourceImageWMS from 'ol/source/ImageWMS'; -import { GeoJSON } from 'ol/format'; +import proj4 from 'proj4'; import GisOlEditLayer from './gis.edit'; import GisOlLayer from './gis.layer'; From 16bed417723b53a399df51bdd829b9aed25d06ee Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 17 Jun 2025 18:17:21 +0900 Subject: [PATCH 004/259] =?UTF-8?q?feat:=20-=20wr=20middleware.ts=EC=97=90?= =?UTF-8?q?=20geoserver=20path=20=EC=B6=94=EA=B0=80=20-=20mapSearchBar.tsx?= =?UTF-8?q?=20UI=20=EA=B5=AC=ED=98=84=20(API,=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=EB=84=88=20=EC=9E=91=EC=97=85=20=ED=95=84?= =?UTF-8?q?=EC=9A=94)=20-=20mapSearchForm.tsx=20css=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20-=20=EC=A7=80=EB=8F=84=20=ED=99=94=EB=A9=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20searchView=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/govSidoSigunguSearchForm.tsx | 114 ------- apps/wr/app/map/htdflSttn/page.tsx | 17 +- apps/wr/app/map/mapSearchBar.tsx | 328 +++++++++++++++---- apps/wr/app/map/mapSearchForm.tsx | 33 +- apps/wr/app/map/searchModal.tsx | 80 ----- apps/wr/middleware.ts | 13 +- 6 files changed, 304 insertions(+), 281 deletions(-) delete mode 100644 apps/wr/app/map/govSidoSigunguSearchForm.tsx delete mode 100644 apps/wr/app/map/searchModal.tsx diff --git a/apps/wr/app/map/govSidoSigunguSearchForm.tsx b/apps/wr/app/map/govSidoSigunguSearchForm.tsx deleted file mode 100644 index 127d02f78..000000000 --- a/apps/wr/app/map/govSidoSigunguSearchForm.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import { useWrStore } from "@/app/store"; -import { getCityOrSgg } from "@/components/lib/func/commom"; -import { - type ReturnType -} from "@common/business_components/ui"; -import { SelectBox } from '@common/business_components/ui/select'; -import React, { useEffect, useRef, useState } from 'react'; - -export type comCodeState = { - code: { - isInit: boolean; - chBuCd: SelectDataType[] - rainFcltCd: SelectDataType[]; - bdstUsgCd: SelectDataType[]; - cityCd: SelectDataType[]; - sggCd: SelectDataType[]; - rvbsnCd: SelectDataType[]; - mdmbsnCd: SelectDataType[]; - lgbsnCd: SelectDataType[]; - lclgvrnmntCd: EnvPartSelectDataType[]; - orgwtKndCd: SelectDataType[]; - yn: SelectDataType[]; - buildingType: { - RST: string, - RNB: string, - HTB: string - } - }; -}; - -type SelectDataType = { - text: string; - val: string; - sido?: string; // 시도 코드 (선택 사항) -} - -type EnvPartSelectDataType = SelectDataType & { - adstDliStrCd: string, -} - -type SearchFormLeftProps = { - isShowPart?: boolean | undefined; - children: React.ReactNode; - selectSidoData?: SelectDataType[] | []; - selectSigunData?: SelectDataType[] | []; - selectRegionData?: SelectDataType[] | []; - selectUnitWaterShedData?: SelectDataType[] | []; - selectMiddleRegionData?: SelectDataType[] | []; - selectEnvPartData?: EnvPartSelectDataType[] | []; - selectEnvPartSidoData?: SelectDataType[] | []; - selectEnvPartSigunData?: SelectDataType[] | []; - - setRtnPartValue?: (value: string) => void; - setRtnSidoValue?: (value: string) => void; - setRtnSigunValue?: (value: string) => void; - setRtnRegionValue?: (value: string) => void; - setRtnUnitWaterShedValue?: (value: string) => void; - setRtnMiddleRegionValue?: (value: string) => void; - setRtnEnvPartValue?: (value: string) => void; - setRtnEnvPartSidoValue?: (value: string) => void; - setRtnEnvPartSigunValue?: (value: { val: string, text: string }) => void; // setRtnEnvPartSigunValue prop 타입을 객체로 변경 - resetTrigger?: boolean; -} - - - -function GovSidoSigunguSearchForm({ - isShowPart = false, - children, - selectSidoData = [], - selectSigunData = [], - selectRegionData = [], - selectUnitWaterShedData = [], - selectMiddleRegionData = [], - selectEnvPartData = [], - setRtnPartValue, - setRtnSidoValue, - setRtnSigunValue, - setRtnRegionValue, - setRtnUnitWaterShedValue, - setRtnMiddleRegionValue, - setRtnEnvPartValue, - setRtnEnvPartSidoValue, - setRtnEnvPartSigunValue, - resetTrigger = false -}: SearchFormLeftProps) { - const { code, pbnstSttn, pbnstSttnSearch } = useWrStore((state) => state); - - const ref = useRef({} as ReturnType); - const codeData = getCityOrSgg(ref); - //환경청별 시도 시군구 - const [envPartValue, setEnvPartValue] = useState('0'); - // 환경청 - const [filteredEnvPartSigunDataSelected, setFilteredEnvPartSigunDataSelected] = useState([]); - - return ( - isShowPart ? ( -
- <> - onSelectValue(val.toString(), 'envPart')} value={envPartValue} selectClass={'rounded-lg bg-white truncate'} /> - onSelectValue(val.toString(), 'envPartSido')} value={envPartSidoValue} selectClass={'rounded-lg bg-white truncate'} /> - onSelectValue(val.toString(), 'envPartSigun')} value={envPartSigunValue} selectClass={'rounded-lg bg-white truncate'} /> - - {children} -
- ) : ( -
- {children} -
- ) - ) -} - -export { GovSidoSigunguSearchForm }; diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx index f3ff3da1c..6c75edb92 100644 --- a/apps/wr/app/map/htdflSttn/page.tsx +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -1,11 +1,10 @@ "use client"; import Gis from "@common/business_components/ui/map/Gis"; -import GisApp from "@common/business_components/ui/map/lib/gis.core"; import { useEffect, useRef, useState } from "react"; -import SearchModal from "../searchModal"; import FeatureClickEventPopup from "../featureClickEventPopup"; import { mapService } from "../service"; +import { MapSearchBar } from "../mapSearchBar"; const Map = () => { const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 @@ -90,6 +89,18 @@ const Map = () => { // setIsOpen(true); // setIsSearchModalOpen(false); // }; + + // MapSearchBar 래퍼 컴포넌트 + const CustomMapSearchBar = (props: any) => { + return ( + + ); + }; + return (
{ isSearch={false} gisMaps={gisMaps} isMiniMap={true} - searchView={SearchModal} + searchView={CustomMapSearchBar} detailView={FeatureClickEventPopup} setIsOpen={setIsOpen} setFeatureData={setFeatureData} diff --git a/apps/wr/app/map/mapSearchBar.tsx b/apps/wr/app/map/mapSearchBar.tsx index a578dfac2..ca746ccce 100644 --- a/apps/wr/app/map/mapSearchBar.tsx +++ b/apps/wr/app/map/mapSearchBar.tsx @@ -1,14 +1,19 @@ "use client" -import { Button } from "@common/components/ui"; -import { useCallback, useEffect, useState } from "react"; -import type { EnvPartSelectDataType } from "@common/business_components/ui/search_form_left"; +import { Button, Input, Label } from "@common/components/ui"; +import React, { useCallback, useEffect, useRef, useState, useMemo } from "react"; +import { SearchFormLeft, type EnvPartSelectDataType } from "@common/business_components/ui/search_form_left"; import { SearchFormRight } from "@common/business_components/ui/search_form_right"; import type { SelectDataType } from "@common/business_components/ui/search_input_select"; import type { ReturnType } from "@common/business_components/ui/search_base_form"; -import { MapSearchForm } from "./mapSearchForm"; +import { MapSearchFormLeft } from "./mapSearchForm"; +import { useWrStore } from "@/app/store"; +import { btnClass } from "@/app/store/common/code"; +import { SelectBox } from "@common/business_components/ui/select"; +import { SearchBaseForm } from "@common/business_components"; type SearchBaseType = { + searchType: string; selectSidoData?: SelectDataType[] | []; selectSigunData?: SelectDataType[] | []; selectRegionData?: SelectDataType[] | []; @@ -16,12 +21,11 @@ type SearchBaseType = { selectMiddleRegionData?: SelectDataType[] | []; selectEnvPartData?: EnvPartSelectDataType[] | []; queryClick: (returnType: ReturnType) => void; - excelName?: string; - excelClick: (returnType: ReturnType) => void; initClick: () => void; - btnClass: string; - ref: React.RefObject; - isAdmin: boolean; + applyClick: () => void; + btnClass?: string; + ref?: React.RefObject; + isAdmin?: boolean; leftClassName?: string; rightClassName?: string; showQueryButton?: boolean; @@ -29,7 +33,24 @@ type SearchBaseType = { showApplyButton?: boolean; } +const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; + +const YEARS = Array.from({ length: 100 }, (_, i) => `${2025 - i}`); + +interface SearchModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; + onFeatureSelect: (row: any) => void; +} + +interface SelectedDataTypeWithSggNm { + text: string; + val: string; + sggNm: string; +} + export function MapSearchBar({ + searchType, selectSidoData, selectSigunData, selectRegionData, @@ -37,28 +58,77 @@ export function MapSearchBar({ selectMiddleRegionData, selectEnvPartData, btnClass, - excelName, queryClick, - excelClick, initClick, - ref, + applyClick, isAdmin = false, leftClassName, rightClassName, showQueryButton = true, showInitButton = true, - showApplyButton = false + showApplyButton = true }: SearchBaseType) { + + // 로딩바 + const [isLoading, setIsLoading] = useState(false); + // 상세 정보 조회를 위한 상태 추가 + const [popupFeature, setPopupFeature] = useState(null); + const { code } = useWrStore((state) => state); + const [isChHead, setIsChHead] = useState(false); + const ref = useRef({} as ReturnType); + + // 전체 목록 const [partValue, setPartValue] = useState("A"); const [sidoValue, setSidoValue] = useState("0"); const [sigunValue, setSigunValue] = useState("0"); - const [sidoText, setSidoText] = useState(""); - const [sigunText, setSigunText] = useState(""); const [regionValue, setRegionValue] = useState("0"); const [untitWaterShedValue, setUntitWaterShedValue] = useState("0"); const [middleRegionValue, setMiddleRegionValue] = useState("0"); const [envPartValue, setEnvPartValue] = useState("0"); const [resetTrigger, setResetTrigger] = useState(false); + const [sidoText, setSidoText] = useState("0"); + const [sigunText, setSigunText] = useState("0"); + // 공급처 후보지 조회 필터 목록 + const [selectedSido, setSelectedSido] = useState({ text: "전체", val: '0' }); + const [selectedSigun, setSelectedSigun] = useState({ text: "전체", val: '0' }); + const [selectedFclt, setSelectedFclt] = useState({ text: "전체", val: '0' }); + // 전체 시설 + let allFclt: SelectedDataTypeWithSggNm[] = [{ text: "전체", val: '0', sggNm: '전체' }]; + // 우리동네가뭄지도 필터 목록 + const [selectedDong, setSelectedDong] = useState({ text: "전체", val: '0' }); // 행정동 + + const [allSido, setAllSido] = useState([ + { text: "전체", val: '0' }, + ...(code?.cityCd || []) + ]); + const [allRegion, setAllRegion] = useState([ + { text: "전체", val: '0' }, + ...(code?.rvbsnCd || []) + ]); + + const filteredSigunData = useMemo(() => { + if (!selectedSido || selectedSido.val === '0' || !selectedSido.val) return [{ text: "전체", val: '0' }]; + return [ + { text: "전체", val: '0' }, + ...code.sggCd.filter(item => item.val.substring(0, 2) === selectedSido.val.substring(0, 2)) + ]; + }, [selectedSido]); + + const filteredFcltData = useMemo(() => { + if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) return [{ text: "전체", val: '0', sggNm: '전체' }]; + return [ + { text: "전체", val: '0', sggNm: '전체' }, + ...allFclt.filter(item => item.sggNm === selectedSido.text) + ]; + }, [selectedSigun]); + + const filteredDong = useMemo(() => { + if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) return [{ text: "전체", val: '0', sggNm: '전체' }]; + return [ + { text: "전체", val: '0', sggNm: '전체' }, + // ...code.dong.filter(item => item.sggNm === selectedSido.text) + ]; + }, [selectedSigun]); const queryVal = () => { console.log("조회버튼 클릭"); @@ -70,8 +140,8 @@ export function MapSearchBar({ unitWaterShedValue: untitWaterShedValue, middleRegionValue: middleRegionValue, envPartValue: envPartValue, - sidoText: sidoText, - sigunText: sigunText, + sidoText: selectedSido.text, + sigunText: selectedSigun.text, }); } @@ -80,25 +150,68 @@ export function MapSearchBar({ initClick(); }, [setResetTrigger, initClick]); + const applyVal = useCallback(() => { + if (searchType == '공급처 후보지 조회') { + } else if (searchType == '우리동네가뭄지도보기') { + } else if (searchType == '지도보기') { + + } + }, [setResetTrigger, initClick]); + useEffect(() => { if (resetTrigger) { setResetTrigger(false); } }, [resetTrigger]); - const excelDownload = () => { - excelClick({ - partValue: partValue, - sidoValue: sidoValue, - sigunValue: sigunValue, - regionValue: regionValue, - unitWaterShedValue: untitWaterShedValue, - middleRegionValue: middleRegionValue, - envPartValue: envPartValue, - sidoText: sidoText, - sigunText: sigunText, - }) - }; + // 시설 조회 + useEffect(() => { + const fetchData = async () => { + setIsLoading(true); + if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) { + allFclt = ([{ text: "전체", val: '0', sggNm: '전체' }]); + setIsLoading(false); + return; + } + + try { + const queryParamsFacility = new URLSearchParams({ + lyrTypeNm: 'tb_il_swage_prcs_fclt', + page: '0', + size: '100000', + sort: 'string', + }); + const cqlFiltersFacility: string[] = []; + if (selectedSigun.text && selectedSigun.val !== '0') { + cqlFiltersFacility.push(`sgg_nm ILIKE '%${selectedSigun.text}%'`); + } + if (cqlFiltersFacility.length > 0) { + queryParamsFacility.append('cqlFiter', cqlFiltersFacility.join(' and ')); + } + console.log("BaseLayout API URL for Facilities:", `v1/fclts?${queryParamsFacility.toString()}`); + + const facilityRes = await fetch(`${API_URL}/v1/fclts?${queryParamsFacility.toString()}`, { + method: "GET", + headers: { accept: "application/json" } + }).then(res => res.json()); + + const facilities = (facilityRes.data || []).map((item: any) => ({ + text: item.swtrmtFcltNm, + val: item.fid, + sggNm: item.sggNm + })); + allFclt = (facilities); + + } catch (error) { + console.error("BaseLayout: 지역/시설 데이터 조회 중 오류 발생:", error); + allFclt = ([{ text: "전체", val: '0', sggNm: '전체' }]); + } finally { + setIsLoading(false); + } + }; + + fetchData(); + }, [selectedSigun]); useEffect(() => { if (ref && ref.current) { @@ -110,43 +223,132 @@ export function MapSearchBar({ customRef.unitWaterShedValue = untitWaterShedValue; customRef.middleRegionValue = middleRegionValue; customRef.envPartValue = envPartValue; - customRef.sidoText = sidoText; - customRef.sigunText = sigunText; + customRef.sidoText = selectedSido.text; + customRef.sigunText = selectedSigun.text; } - }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, sidoText, sigunText, ref]); - + }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, ref]); + return ( -
- {/* 검색 조건 부분 */} - - {/* 버튼 부분 */} -
-
+
+
+
+ {searchType == "공급처 후보지 조회" && ( + <> + { + const selected = code.cityCd.find(item => (item.val === val)); + setSelectedSido(selected || { text: "전체", val: '0' }); + }} + value={selectedSido.val} + selectClass={'w-32'} + /> + { + const selected = filteredSigunData.find(item => (item.val === val)); + setSelectedSigun(selected || { text: "전체", val: '0' }); + }} + value={selectedSigun.val} + selectClass={'w-32'} + /> + { + const selected = allFclt.find(item => (item.val === val)); + setSelectedFclt(selected || { text: "전체", val: '0', sggNm: '전체' }); + }} + value={selectedFclt.val} + selectClass={'w-32'} + /> + +
+ +
+ + )} + {searchType == "우리동네가뭄지도보기" && ( + <> + { + const selected = code.cityCd.find(item => (item.val === val)); + setSelectedSido(selected || { text: "전체", val: '0' }); + }} + value={selectedSido.val} + selectClass={'w-32'} + /> + { + const selected = filteredSigunData.find(item => (item.val === val)); + setSelectedSigun(selected || { text: "전체", val: '0' }); + }} + value={selectedSigun.val} + selectClass={'w-32'} + /> + { + const selected = filteredDong.find(item => (item.val === val)); + setSelectedDong(selected || { text: "전체", val: '0', sggNm: '전체' }); + }} + value={selectedDong.val} + selectClass={'w-32'} + /> + + )} + {searchType == "지도보기" && ( +
+
{/* SearchFormLeft 래퍼 */} + +
+ +
+ +
+
+ )} +
+ {/* 버튼 부분 */} +
{showQueryButton && } {showInitButton && } - {showApplyButton && } + {showApplyButton && }
diff --git a/apps/wr/app/map/mapSearchForm.tsx b/apps/wr/app/map/mapSearchForm.tsx index 00ba8e6f0..a148fdf67 100644 --- a/apps/wr/app/map/mapSearchForm.tsx +++ b/apps/wr/app/map/mapSearchForm.tsx @@ -1,7 +1,7 @@ "use client" import React, { useEffect, useState } from 'react'; -import type { SelectDataType } from "@common/business_components/ui/search_input_select"; +import type { SelectDataType } from '@common/business_components/ui/search_input_select'; import { SelectBox } from '@common/business_components/ui/select'; /** @@ -56,13 +56,7 @@ const selectPartData: SelectDataType[] = [ { text: "환경청별", val: 'G' }, ]; -const selectType: SelectDataType[] = [ - { text: "행정별", val: 'A' }, - { text: "유역별", val: 'R' }, - { text: "환경청별", val: 'G' }, -]; - -function MapSearchForm({ isShowPart = false, children, selectSidoData = [], selectSigunData = [], selectRegionData = [], selectUnitWaterShedData = [], selectMiddleRegionData = [], selectEnvPartData = [], setRtnPartValue, setRtnSidoValue, setRtnSidoText, setRtnSigunValue, setRtnSigunText, setRtnRegionValue, setRtnUnitWaterShedValue, setRtnMiddleRegionValue, setRtnEnvPartValue, setRtnEnvPartSidoValue, setRtnEnvPartSigunValue, resetTrigger = false, isAdmin = false }: SearchFormLeftProps) { +function MapSearchFormLeft({ isShowPart = false, children, selectSidoData = [], selectSigunData = [], selectRegionData = [], selectUnitWaterShedData = [], selectMiddleRegionData = [], selectEnvPartData = [], setRtnPartValue, setRtnSidoValue, setRtnSidoText, setRtnSigunValue, setRtnSigunText, setRtnRegionValue, setRtnUnitWaterShedValue, setRtnMiddleRegionValue, setRtnEnvPartValue, setRtnEnvPartSidoValue, setRtnEnvPartSigunValue, resetTrigger = false, isAdmin = false }: SearchFormLeftProps) { /******************선택된 데이터******************/ const [partValue, setPartValue] = useState('A'); //행정별 시도 시군구 @@ -314,27 +308,26 @@ function MapSearchForm({ isShowPart = false, children, selectSidoData = [], sele return ( isShowPart ? ( -
- onSelectValue(val.toString(), 'part')} value={partValue} selectClass={undefined} /> +
+ onSelectValue(val.toString(), 'part')} value={partValue} selectClass={'w-32'} /> {partValue === 'R' ? ( <> - onSelectValue(val.toString(), 'region')} value={regionValue} selectClass={undefined} /> - onSelectValue(val.toString(), 'unitWaterShed')} value={unitWaterShedValue} selectClass={undefined} /> - onSelectValue(val.toString(), 'middleRegion')} value={middleRegionValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'region')} value={regionValue} selectClass={'w-44'} /> + onSelectValue(val.toString(), 'unitWaterShed')} value={unitWaterShedValue} selectClass={'w-44'} /> + onSelectValue(val.toString(), 'middleRegion')} value={middleRegionValue} selectClass={'w-44'} /> ) : partValue === 'G' ? ( <> - onSelectValue(val.toString(), 'envPart')} value={envPartValue} selectClass={undefined} /> - onSelectValue(val.toString(), 'envPartSido')} value={sidoValue} selectClass={undefined} /> - onSelectValue(val.toString(), 'envPartSigun')} value={sigunValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'envPart')} value={envPartValue} selectClass={'w-44'} /> + onSelectValue(val.toString(), 'envPartSido')} value={sidoValue} selectClass={'w-44'} /> + onSelectValue(val.toString(), 'envPartSigun')} value={sigunValue} selectClass={'w-44'} /> ) : ( <> - onSelectValue(val.toString(), 'sido')} value={sidoValue} selectClass={undefined} /> - onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={undefined} /> + onSelectValue(val.toString(), 'sido')} value={sidoValue} selectClass={'w-40'} /> + onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={'w-40'} /> )} - {children}
) : (
@@ -344,4 +337,4 @@ function MapSearchForm({ isShowPart = false, children, selectSidoData = [], sele ) } -export { MapSearchForm }; +export { MapSearchFormLeft }; diff --git a/apps/wr/app/map/searchModal.tsx b/apps/wr/app/map/searchModal.tsx deleted file mode 100644 index 658c9545f..000000000 --- a/apps/wr/app/map/searchModal.tsx +++ /dev/null @@ -1,80 +0,0 @@ -"use client" - -import { useWrStore } from "@/app/store"; -import { btnClass } from "@/app/store/common/code"; -import React, { useCallback, useEffect, useRef, useState } from 'react'; -import { MapSearchBar, type ReturnType } from "./mapSearchBar"; -import { Button } from "@common/components/ui"; -import { SearchFormLeft, type EnvPartSelectDataType } from "@common/business_components/ui/search_form_left"; -import { SearchFormRight } from "@common/business_components/ui/search_form_right"; -import type { SelectDataType } from "@common/business_components/ui/search_input_select"; - -const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; - -const YEARS = Array.from({ length: 100 }, (_, i) => `${2025 - i}`); - -interface SearchModalProps { - open: boolean; - onOpenChange: (open: boolean) => void; - onFeatureSelect: (row: any) => void; -} - -// 날짜 조합 함수 -const getDateString = ( - year: string, - month: string, - day: string, - defaultDate: string, -) => { - if (!year && !month && !day) return defaultDate; - const y = year || defaultDate.slice(0, 4); - const m = month || defaultDate.slice(4, 6); - const d = day || defaultDate.slice(6, 8); - return `${y}${m}${d}`; -}; - -const SearchModal: React.FC = ({ - open, - onOpenChange, - onFeatureSelect, -}) => { - - // 로딩바 - const [isLoading, setIsLoading] = useState(false); - // 상세 정보 조회를 위한 상태 추가 - const [popupFeature, setPopupFeature] = useState(null); - const { code, pbnstSttn, pbnstSttnSearch } = useWrStore((state) => state); - const [isChHead, setIsChHead] = useState(false); - const ref = useRef({} as ReturnType); - - return ( -
- -
- ); -}; - -export default React.memo(SearchModal); diff --git a/apps/wr/middleware.ts b/apps/wr/middleware.ts index 330252074..3fabc529d 100644 --- a/apps/wr/middleware.ts +++ b/apps/wr/middleware.ts @@ -5,6 +5,8 @@ import { CS_URL } from "./components/lib/config"; const CLAIM_NAME = "Authorization"; const AUTH_USER_ID = "token-id"; const serverApiUrl = CS_URL; +const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; + export function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; console.log(`[Middleware] Request URL: ${req.url}`); @@ -44,9 +46,18 @@ export function middleware(req: NextRequest) { }); } + if (pathname.startsWith("/geoserver")) { + const queryParams = searchParams.toString(); + const newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ + queryParams ? `?${queryParams}` : "" + }`; + console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } + return NextResponse.next(); } export const config = { - matcher: ["/server/:path*", "/attach-service/:path*"], + matcher: ["/server/:path*", "/attach-service/:path*", "/geoserver/:path*"], }; From b095dda5adca7512e1928120d950e647d7a510e0 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 17 Jun 2025 19:01:02 +0900 Subject: [PATCH 005/259] =?UTF-8?q?feat:=20=EC=A7=80=EB=8F=84=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=94=BC=EC=B2=98=20=EC=84=A0=ED=83=9D=EC=8B=9C=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=ED=95=9C=20=ED=99=94=EB=A9=B4=EC=97=90=20?= =?UTF-8?q?=ED=94=BC=EC=B2=98=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20return?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/Gis.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 48dce9284..887207530 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -103,6 +103,7 @@ function Gis({ setFeatureData(data); setIsOpen(true); setIsSearchModalOpen(false); + onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출 }, [mapInstanceRef]); // 지도 생성 및 초기화 From 3208b02fb2379920407a5f8f54db34b1abac8524 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 17 Jun 2025 19:14:10 +0900 Subject: [PATCH 006/259] =?UTF-8?q?feat:=20=EC=B4=88=EA=B8=B0=ED=99=94,=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EB=B2=84=ED=8A=BC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/mapSearchBar.tsx | 66 +++++++++++++++++++------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/apps/wr/app/map/mapSearchBar.tsx b/apps/wr/app/map/mapSearchBar.tsx index ca746ccce..86e9f939a 100644 --- a/apps/wr/app/map/mapSearchBar.tsx +++ b/apps/wr/app/map/mapSearchBar.tsx @@ -22,7 +22,7 @@ type SearchBaseType = { selectEnvPartData?: EnvPartSelectDataType[] | []; queryClick: (returnType: ReturnType) => void; initClick: () => void; - applyClick: () => void; + onFeatureSelect: () => void; btnClass?: string; ref?: React.RefObject; isAdmin?: boolean; @@ -60,7 +60,7 @@ export function MapSearchBar({ btnClass, queryClick, initClick, - applyClick, + onFeatureSelect, isAdmin = false, leftClassName, rightClassName, @@ -91,11 +91,11 @@ export function MapSearchBar({ // 공급처 후보지 조회 필터 목록 const [selectedSido, setSelectedSido] = useState({ text: "전체", val: '0' }); const [selectedSigun, setSelectedSigun] = useState({ text: "전체", val: '0' }); - const [selectedFclt, setSelectedFclt] = useState({ text: "전체", val: '0' }); + const [selectedFclt, setSelectedFclt] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 // 전체 시설 let allFclt: SelectedDataTypeWithSggNm[] = [{ text: "전체", val: '0', sggNm: '전체' }]; // 우리동네가뭄지도 필터 목록 - const [selectedDong, setSelectedDong] = useState({ text: "전체", val: '0' }); // 행정동 + const [selectedDong, setSelectedDong] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 // 행정동 const [allSido, setAllSido] = useState([ { text: "전체", val: '0' }, @@ -131,32 +131,46 @@ export function MapSearchBar({ }, [selectedSigun]); const queryVal = () => { - console.log("조회버튼 클릭"); - queryClick({ - partValue: partValue, - sidoValue: sidoValue, - sigunValue: sigunValue, - regionValue: regionValue, - unitWaterShedValue: untitWaterShedValue, - middleRegionValue: middleRegionValue, - envPartValue: envPartValue, - sidoText: selectedSido.text, - sigunText: selectedSigun.text, - }); - } - - const initVal = useCallback(() => { - setResetTrigger(true); - initClick(); - }, [setResetTrigger, initClick]); - - const applyVal = useCallback(() => { if (searchType == '공급처 후보지 조회') { } else if (searchType == '우리동네가뭄지도보기') { } else if (searchType == '지도보기') { - + console.log("조회버튼 클릭"); + queryClick({ + partValue: partValue, + sidoValue: sidoValue, + sigunValue: sigunValue, + regionValue: regionValue, + unitWaterShedValue: untitWaterShedValue, + middleRegionValue: middleRegionValue, + envPartValue: envPartValue, + sidoText: selectedSido.text, + sigunText: selectedSigun.text, + }); } - }, [setResetTrigger, initClick]); + } + + const initVal = useCallback(() => { + setPartValue("A"); + setSidoValue("0"); + setSigunValue("0"); + setRegionValue("0"); + setUntitWaterShedValue("0"); + setMiddleRegionValue("0"); + setEnvPartValue("0"); + setSidoText("전체"); + setSigunText("전체"); + setSelectedSido({ text: "전체", val: '0' }); + setSelectedSigun({ text: "전체", val: '0' }); + setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); + setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); + setResetTrigger(true); + + initClick(); // 부모로부터 받은 초기화 함수 호출 + }, [initClick]); + + const applyVal = useCallback(() => { + onFeatureSelect + }, [onFeatureSelect]); useEffect(() => { if (resetTrigger) { From aad3e978b8fb459c9331e73e84ed4056c7f2b576 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 18 Jun 2025 16:59:55 +0900 Subject: [PATCH 007/259] =?UTF-8?q?fix:=20=EC=B9=A8=EC=9E=85=EC=88=98=20?= =?UTF-8?q?=EB=B6=84=EC=84=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=20key?= =?UTF-8?q?=20=EC=97=86=EB=8A=94=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/ii/irsetting/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/app/ii/irsetting/page.tsx b/apps/sn/app/ii/irsetting/page.tsx index 2944af9c0..68bdf64a5 100644 --- a/apps/sn/app/ii/irsetting/page.tsx +++ b/apps/sn/app/ii/irsetting/page.tsx @@ -261,7 +261,7 @@ const IrSetting = () => { isLoading={isLoadingResult} onAnalysis={handleAnalysisClick} > - {[
+ {[
Date: Wed, 18 Jun 2025 17:56:20 +0900 Subject: [PATCH 008/259] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EB=A9=94=EB=89=B4=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/layout.tsx | 34 +++++ .../{ => (map-layout)}/map/SearchModal.tsx | 0 .../map/components/InputSection.tsx | 0 .../map/components/common/index.ts | 0 .../map/components/common/table.ts | 0 .../components/popupComponent/MsSwagePpl.tsx | 0 .../map/components/popupComponent/Ssc.tsx | 0 .../components/popupComponent/SwtrmtFclt.tsx | 0 .../popupComponent/chart/infilChart.tsx | 0 .../components/popupComponent/sewagePump.tsx | 0 .../map/components/popupComponent/smh.tsx | 0 .../popupComponent/stormWaterPump.tsx | 0 .../map/featureClickEventPopup.tsx | 0 apps/sn/app/{ => (map-layout)}/map/page.tsx | 33 ++++- .../ii/BaseLayout.tsx | 2 - .../ii/irsetting/page.tsx | 2 +- .../{ => (with-base-layout)}/ii/rdii/page.tsx | 6 +- .../ii/rdii_result/page.tsx | 2 +- .../ii/result/page.tsx | 2 +- apps/sn/app/(with-base-layout)/layout.tsx | 35 ++++++ .../oper/floodPre/page.tsx | 5 +- .../{ => (with-base-layout)}/oper/index.ts | 0 .../oper/oldPp/page.tsx | 9 +- apps/sn/app/clientLayout.tsx | 7 -- .../components/lib/utils/fileDeleteUtil.tsx | 2 +- .../components/lib/utils/fileUploadUtil.tsx | 2 +- apps/sn/app/components/lib/utils/index.tsx | 7 +- apps/sn/app/components/ui/fileUploadForm.tsx | 2 +- .../app/components/ui/operFileUploadForm.tsx | 2 +- apps/sn/app/layout.tsx | 27 +--- apps/sn/app/page.tsx | 47 ++++--- apps/sn/app/service/index.ts | 1 - apps/sn/app/service/map.ts | 37 ------ apps/sn/app/store/index.tsx | 1 - apps/sn/app/store/user-store.tsx | 74 ----------- apps/sn/package.json | 5 +- apps/sn/src/app/index.tsx | 20 +++ apps/sn/src/app/providers/app-provider.tsx | 46 +++++++ apps/sn/src/app/providers/index.ts | 1 + apps/sn/{ => src}/app/styles/base.css | 0 apps/sn/{ => src}/app/styles/components.css | 0 .../entities/auth/api/login-service.ts} | 44 ++----- .../index.tsx => src/entities/auth/index.ts} | 0 .../entities}/auth/lib/auth-wrapper.tsx | 28 ++--- .../entities/auth/lib/token-manager.ts} | 6 +- .../entities/auth/model/login-interface.ts} | 0 .../sn/src/entities/menu-authority/@x/menu.ts | 1 + .../src/entities/menu-authority/@x/posting.ts | 1 + .../api/menu-authority-service.ts | 40 ++++++ apps/sn/src/entities/menu-authority/index.ts | 2 + .../model/menu-authority-interface.ts | 48 +++++++ .../model/menu-authority-table-columns.tsx | 117 ++++++++++++++++++ .../menu-authority/ui/authority-button.tsx | 26 ++++ .../ui/management-authority-dialog.tsx | 103 +++++++++++++++ apps/sn/src/entities/menu/api/menu-service.ts | 14 +++ apps/sn/src/entities/menu/index.ts | 2 + .../sn/src/entities/menu/lib/menu-wrapper.tsx | 59 +++++++++ apps/sn/src/entities/menu/lib/utils.ts | 20 +++ .../src/entities/menu/model/menu-interface.ts | 23 ++++ apps/sn/src/shared/api/client.ts | 8 ++ apps/sn/src/shared/api/index.ts | 1 + apps/sn/src/shared/config/api.ts | 56 +++++++++ apps/sn/src/shared/config/env.ts | 11 ++ apps/sn/src/shared/config/index.ts | 2 + apps/sn/src/shared/lib/index.ts | 5 + apps/sn/src/shared/lib/use-alert-store.ts | 14 +++ apps/sn/src/shared/lib/use-menu-store.ts | 14 +++ .../src/shared/lib/use-mutation-wrapper.tsx | 31 +++++ apps/sn/src/shared/lib/use-prompt.tsx | 26 ++++ apps/sn/src/shared/lib/use-user-store.ts | 14 +++ apps/sn/src/shared/providers/index.ts | 2 + .../src/shared/providers/prompt-provider.tsx | 37 ++++++ .../shared/providers}/store-provider.tsx | 13 +- apps/sn/src/shared/store/alert-store.ts | 25 ++++ apps/sn/src/shared/store/attachment-store.ts | 25 ++++ apps/sn/src/shared/store/index.ts | 4 + apps/sn/src/shared/store/menu-store.ts | 93 ++++++++++++++ apps/sn/src/shared/store/user-store.ts | 57 +++++++++ apps/sn/src/shared/ui/alert-dialog.tsx | 34 +++++ apps/sn/src/shared/ui/confirm-dialog.tsx | 48 +++++++ apps/sn/src/shared/ui/map-layout.tsx | 13 ++ apps/sn/src/shared/ui/page-layout.tsx | 22 ++++ apps/sn/src/shared/ui/prompt-dialog.tsx | 45 +++++++ apps/sn/tsconfig.json | 16 ++- pnpm-lock.yaml | 9 ++ 85 files changed, 1318 insertions(+), 252 deletions(-) create mode 100644 apps/sn/app/(map-layout)/layout.tsx rename apps/sn/app/{ => (map-layout)}/map/SearchModal.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/InputSection.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/common/index.ts (100%) rename apps/sn/app/{ => (map-layout)}/map/components/common/table.ts (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/MsSwagePpl.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/Ssc.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/SwtrmtFclt.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/chart/infilChart.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/sewagePump.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/smh.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/components/popupComponent/stormWaterPump.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/featureClickEventPopup.tsx (100%) rename apps/sn/app/{ => (map-layout)}/map/page.tsx (84%) rename apps/sn/app/{ => (with-base-layout)}/ii/BaseLayout.tsx (98%) rename apps/sn/app/{ => (with-base-layout)}/ii/irsetting/page.tsx (99%) rename apps/sn/app/{ => (with-base-layout)}/ii/rdii/page.tsx (99%) rename apps/sn/app/{ => (with-base-layout)}/ii/rdii_result/page.tsx (99%) rename apps/sn/app/{ => (with-base-layout)}/ii/result/page.tsx (99%) create mode 100644 apps/sn/app/(with-base-layout)/layout.tsx rename apps/sn/app/{ => (with-base-layout)}/oper/floodPre/page.tsx (97%) rename apps/sn/app/{ => (with-base-layout)}/oper/index.ts (100%) rename apps/sn/app/{ => (with-base-layout)}/oper/oldPp/page.tsx (96%) delete mode 100644 apps/sn/app/clientLayout.tsx delete mode 100644 apps/sn/app/service/index.ts delete mode 100644 apps/sn/app/service/map.ts delete mode 100644 apps/sn/app/store/index.tsx delete mode 100644 apps/sn/app/store/user-store.tsx create mode 100644 apps/sn/src/app/index.tsx create mode 100644 apps/sn/src/app/providers/app-provider.tsx create mode 100644 apps/sn/src/app/providers/index.ts rename apps/sn/{ => src}/app/styles/base.css (100%) rename apps/sn/{ => src}/app/styles/components.css (100%) rename apps/sn/{app/components/lib/auth/api/login-service.tsx => src/entities/auth/api/login-service.ts} (69%) rename apps/sn/{app/components/lib/auth/index.tsx => src/entities/auth/index.ts} (100%) rename apps/sn/{app/components/lib => src/entities}/auth/lib/auth-wrapper.tsx (72%) rename apps/sn/{app/components/lib/auth/lib/token-manager.tsx => src/entities/auth/lib/token-manager.ts} (86%) rename apps/sn/{app/components/lib/auth/model/login-interface.tsx => src/entities/auth/model/login-interface.ts} (100%) create mode 100644 apps/sn/src/entities/menu-authority/@x/menu.ts create mode 100644 apps/sn/src/entities/menu-authority/@x/posting.ts create mode 100644 apps/sn/src/entities/menu-authority/api/menu-authority-service.ts create mode 100644 apps/sn/src/entities/menu-authority/index.ts create mode 100644 apps/sn/src/entities/menu-authority/model/menu-authority-interface.ts create mode 100644 apps/sn/src/entities/menu-authority/model/menu-authority-table-columns.tsx create mode 100644 apps/sn/src/entities/menu-authority/ui/authority-button.tsx create mode 100644 apps/sn/src/entities/menu-authority/ui/management-authority-dialog.tsx create mode 100644 apps/sn/src/entities/menu/api/menu-service.ts create mode 100644 apps/sn/src/entities/menu/index.ts create mode 100644 apps/sn/src/entities/menu/lib/menu-wrapper.tsx create mode 100644 apps/sn/src/entities/menu/lib/utils.ts create mode 100644 apps/sn/src/entities/menu/model/menu-interface.ts create mode 100644 apps/sn/src/shared/api/client.ts create mode 100644 apps/sn/src/shared/api/index.ts create mode 100644 apps/sn/src/shared/config/api.ts create mode 100644 apps/sn/src/shared/config/env.ts create mode 100644 apps/sn/src/shared/config/index.ts create mode 100644 apps/sn/src/shared/lib/index.ts create mode 100644 apps/sn/src/shared/lib/use-alert-store.ts create mode 100644 apps/sn/src/shared/lib/use-menu-store.ts create mode 100644 apps/sn/src/shared/lib/use-mutation-wrapper.tsx create mode 100644 apps/sn/src/shared/lib/use-prompt.tsx create mode 100644 apps/sn/src/shared/lib/use-user-store.ts create mode 100644 apps/sn/src/shared/providers/index.ts create mode 100644 apps/sn/src/shared/providers/prompt-provider.tsx rename apps/sn/{app/store => src/shared/providers}/store-provider.tsx (60%) create mode 100644 apps/sn/src/shared/store/alert-store.ts create mode 100644 apps/sn/src/shared/store/attachment-store.ts create mode 100644 apps/sn/src/shared/store/index.ts create mode 100644 apps/sn/src/shared/store/menu-store.ts create mode 100644 apps/sn/src/shared/store/user-store.ts create mode 100644 apps/sn/src/shared/ui/alert-dialog.tsx create mode 100644 apps/sn/src/shared/ui/confirm-dialog.tsx create mode 100644 apps/sn/src/shared/ui/map-layout.tsx create mode 100644 apps/sn/src/shared/ui/page-layout.tsx create mode 100644 apps/sn/src/shared/ui/prompt-dialog.tsx diff --git a/apps/sn/app/(map-layout)/layout.tsx b/apps/sn/app/(map-layout)/layout.tsx new file mode 100644 index 000000000..e245cfdf1 --- /dev/null +++ b/apps/sn/app/(map-layout)/layout.tsx @@ -0,0 +1,34 @@ +"use client"; + +import { usePathname, useRouter } from "next/navigation"; +import { useQueryClient } from "@tanstack/react-query"; +import { BaseLayout } from "@common/components"; +import type { MenuItem } from "@/entities/menu"; +import { useMenuStore } from "@/shared/lib"; + +export default function MapLayout({ + children, +}: { + children: React.ReactNode; +}) { + const router = useRouter(); + const pathname = usePathname(); + const queryClient = useQueryClient(); + + const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo); + + const handleMenuClick = (item: MenuItem) => { + setCurrentMenuInfo(item); + router.push(item.urlPath); + }; + + return ( + + {children} + + ); +} diff --git a/apps/sn/app/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx similarity index 100% rename from apps/sn/app/map/SearchModal.tsx rename to apps/sn/app/(map-layout)/map/SearchModal.tsx diff --git a/apps/sn/app/map/components/InputSection.tsx b/apps/sn/app/(map-layout)/map/components/InputSection.tsx similarity index 100% rename from apps/sn/app/map/components/InputSection.tsx rename to apps/sn/app/(map-layout)/map/components/InputSection.tsx diff --git a/apps/sn/app/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts similarity index 100% rename from apps/sn/app/map/components/common/index.ts rename to apps/sn/app/(map-layout)/map/components/common/index.ts diff --git a/apps/sn/app/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts similarity index 100% rename from apps/sn/app/map/components/common/table.ts rename to apps/sn/app/(map-layout)/map/components/common/table.ts diff --git a/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx diff --git a/apps/sn/app/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/Ssc.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx diff --git a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/SwtrmtFclt.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/SwtrmtFclt.tsx diff --git a/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/chart/infilChart.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx diff --git a/apps/sn/app/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/sewagePump.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx diff --git a/apps/sn/app/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/smh.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx diff --git a/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx similarity index 100% rename from apps/sn/app/map/components/popupComponent/stormWaterPump.tsx rename to apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx diff --git a/apps/sn/app/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx similarity index 100% rename from apps/sn/app/map/featureClickEventPopup.tsx rename to apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx diff --git a/apps/sn/app/map/page.tsx b/apps/sn/app/(map-layout)/map/page.tsx similarity index 84% rename from apps/sn/app/map/page.tsx rename to apps/sn/app/(map-layout)/map/page.tsx index e1a90d5f1..9b42a26f9 100644 --- a/apps/sn/app/map/page.tsx +++ b/apps/sn/app/(map-layout)/map/page.tsx @@ -1,12 +1,36 @@ "use client"; import Gis, { useGisContext } from "@common/business_components/ui/map/Gis"; -import { mapService } from "@service"; +import { getData } from "../../components/lib/api"; import { useCallback, useEffect, useRef, useState } from "react"; import GisApp from "@common/business_components/ui/map/lib/gis.core"; import SearchModal from "./SearchModal"; import FeatureClickEventPopup from "./featureClickEventPopup"; +// 타입 정의 추가 +export type LyrStngProps = { + lyr_sn: string; + lyr_nm: string; + upper_lyr_sn: string; + drawOrdr: string; + flterSql: string; + gobjTy: string; + lyrTpNm: string; + useYn: string; + minViewSize: string; + iconNm: string; + lblAtrbNm: string; + fontNm: string; + fontIntnColor: string; + fontExtnColor: string; + fontExtnWdth: string; + lnWdth: string; + lnColor: string; + polgnColor: string; + initEprssYn: string; + clickPsblYn: string; +}; + const Map = () => { const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 const [selectedFeature, setSelectedFeature] = useState(null); // 선택된 피처 상태 @@ -14,20 +38,19 @@ const Map = () => { const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); // SearchModal 열림 상태 const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터 + const fetchData = async () => { try { - const response = await mapService.getLyrStngs(); - setTreeData(response.data); // API 응답 저장 + const data = await getData('v1/map/lyrStngs/SN_NETWORK'); + setTreeData(data); } catch (error) { console.error("데이터 불러오기 실패:", error); } }; - // 컴포넌트 마운트 시 1회 실행 useEffect(() => { fetchData(); }, []); - // SearchModal, GisContent 등에서 호출 const onFeatureSelect = (data: any) => { let map = gisMaps.current; diff --git a/apps/sn/app/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx similarity index 98% rename from apps/sn/app/ii/BaseLayout.tsx rename to apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index 544802744..6b16ad36a 100644 --- a/apps/sn/app/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -202,7 +202,6 @@ const BaseLayout = ({ return (
- {/* searchBox.title이 있으면 h3 태그로 제목을 표시합니다. */} {selectBox?.title && ( @@ -268,7 +267,6 @@ const BaseLayout = ({
{children?.[1]}
: null } -
) } diff --git a/apps/sn/app/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx similarity index 99% rename from apps/sn/app/ii/irsetting/page.tsx rename to apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 2944af9c0..79facb5ef 100644 --- a/apps/sn/app/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -9,7 +9,7 @@ import { zodResolver } from '@hookform/resolvers/zod' import { useState } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' -import { excelToFlowRateData, excelToMatchingResultData, excelToTimePatternData } from '../../components/lib/utils/excelToJson' +import { excelToFlowRateData, excelToMatchingResultData, excelToTimePatternData } from '@/components/lib/utils' import BaseLayout from '../BaseLayout' const formSchema = z.object({ diff --git a/apps/sn/app/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx similarity index 99% rename from apps/sn/app/ii/rdii/page.tsx rename to apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 2f61b57b9..116d87462 100644 --- a/apps/sn/app/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -3,7 +3,7 @@ import { postData } from '@/components/lib/api' import FileUploadForm from "@/components/ui/fileUploadForm" import FormSection from "@/components/ui/formSection" -import BaseLayout from "@/ii/BaseLayout" +import BaseLayout from "../BaseLayout" import { DatePicker, filePicked } from "@common/business_components/ui" import { Input } from "@common/components/ui" import { zodResolver } from "@hookform/resolvers/zod" @@ -11,8 +11,8 @@ import { Label } from '@radix-ui/react-label' import { useState } from "react" import { useFieldArray, useForm } from "react-hook-form" import { z } from "zod" -import { excelToMatchingResultData, excelToRainData } from '../../components/lib/utils/excelToJson' -import { EditableFormTable, type EditableTableHeadItem } from '../../components/ui/EditableFormTable' +import { excelToMatchingResultData, excelToRainData } from '@/components/lib/utils' +import { EditableFormTable, type EditableTableHeadItem } from '../../../components/ui/EditableFormTable' // zod 스키마 정의 diff --git a/apps/sn/app/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx similarity index 99% rename from apps/sn/app/ii/rdii_result/page.tsx rename to apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx index 130c25419..b37a06dad 100644 --- a/apps/sn/app/ii/rdii_result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx @@ -6,7 +6,7 @@ import { useState } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' import BaseLayout from '../BaseLayout' -import { handleDelete } from '@/components/lib/utils/fileDeleteUtil' +import { handleDelete } from '@/components/lib/utils' const formSchema = z.object({ diff --git a/apps/sn/app/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx similarity index 99% rename from apps/sn/app/ii/result/page.tsx rename to apps/sn/app/(with-base-layout)/ii/result/page.tsx index e2015c8d9..4759a2877 100644 --- a/apps/sn/app/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -6,7 +6,7 @@ import { useState } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' import BaseLayout from '../BaseLayout' -import { handleDelete } from '@/components/lib/utils/fileDeleteUtil' +import { handleDelete } from '@/components/lib/utils' const formSchema = z.object({ diff --git a/apps/sn/app/(with-base-layout)/layout.tsx b/apps/sn/app/(with-base-layout)/layout.tsx new file mode 100644 index 000000000..3c1a527d7 --- /dev/null +++ b/apps/sn/app/(with-base-layout)/layout.tsx @@ -0,0 +1,35 @@ +"use client"; + +import { usePathname, useRouter } from "next/navigation"; +import { useQueryClient } from "@tanstack/react-query"; +import { BaseLayout } from "@common/components"; +import type { MenuItem } from "@/entities/menu"; +import { useMenuStore } from "@/shared/lib"; +import { PageLayout } from "@/shared/ui/page-layout"; + +export default function WithBaseLayout({ + children, +}: { + children: React.ReactNode; +}) { + const router = useRouter(); + const pathname = usePathname(); + const queryClient = useQueryClient(); + + const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo); + + const handleMenuClick = (item: MenuItem) => { + setCurrentMenuInfo(item); + router.push(item.urlPath); + }; + + return ( + + {children} + + ); +} diff --git a/apps/sn/app/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx similarity index 97% rename from apps/sn/app/oper/floodPre/page.tsx rename to apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 013b1a36c..000389a3e 100644 --- a/apps/sn/app/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -2,13 +2,12 @@ import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' import { Button, DatePicker, Input, Label, LoadingWithAnimation } from '@common/components/ui' import React, { useEffect, useState } from 'react' -import OperFileUploadForm from '../../components/ui/operFileUploadForm' +import OperFileUploadForm from '../../../components/ui/operFileUploadForm' import ListDiv from '@common/business_components/ui/list_div' import ContentLayout from '@/components/ui/contentLayout' import { searchCmmnCd, searchData } from '@/components/lib/common/apiHelpers' import { tableHeadlist } from '..' -import { handleDownload } from '@/components/lib/utils/fileDownload' -import { formatDate, yearOptions } from '@/components/lib/utils/date' +import { formatDate, yearOptions, handleDownload } from '@/components/lib/utils' import { deleteData, postData } from '@/components/lib/api' import LoadingOverlay from '@/components/ui/LoadingBar' diff --git a/apps/sn/app/oper/index.ts b/apps/sn/app/(with-base-layout)/oper/index.ts similarity index 100% rename from apps/sn/app/oper/index.ts rename to apps/sn/app/(with-base-layout)/oper/index.ts diff --git a/apps/sn/app/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx similarity index 96% rename from apps/sn/app/oper/oldPp/page.tsx rename to apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 92d7fe6aa..695ae7a28 100644 --- a/apps/sn/app/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -2,13 +2,12 @@ import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' import { Button, DatePicker, Input, Label } from '@common/components/ui' import React, { useEffect, useState } from 'react' -import OperFileUploadForm from '../../components/ui/operFileUploadForm' +import OperFileUploadForm from '../../../components/ui/operFileUploadForm' import ListDiv from '@common/business_components/ui/list_div' import ContentLayout from '@/components/ui/contentLayout' import { tableHeadlistOldPp } from '..' -import { handleDownload } from '@/components/lib/utils/fileDownload' import { searchData } from '@/components/lib/common/apiHelpers' -import { formatDate, yearOptions } from '@/components/lib/utils/date' +import { formatDate, yearOptions, handleDownload } from '@/components/lib/utils' import { deleteData, postData } from '@/components/lib/api' const Page = () => { const [fromDate, setFromDate] = useState(()=>{const date = new Date(); date.setDate(date.getDate()-7); return date}); @@ -87,7 +86,7 @@ const Page = () => { if (data) {alert('파일이 등록되었습니다.');fetchData() } } return ( - + <>
@@ -154,7 +153,7 @@ const Page = () => { { await registFile(file, year, quater, cd, id) }} /> - + ) } diff --git a/apps/sn/app/clientLayout.tsx b/apps/sn/app/clientLayout.tsx deleted file mode 100644 index e8fdbe032..000000000 --- a/apps/sn/app/clientLayout.tsx +++ /dev/null @@ -1,7 +0,0 @@ -'use client' - -import { BaseLayout } from "@common/components"; - -export function ClientLayout({ children }: { children: React.ReactNode }) { - return {children}; -} \ No newline at end of file diff --git a/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx b/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx index bf8a70130..f487034d1 100644 --- a/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx +++ b/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx @@ -1,4 +1,4 @@ -import { getCookie } from "@utils"; +import { getCookie } from "@/components/lib/utils"; import { ENDPOINT } from "../api/attachment/attachment-service"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; diff --git a/apps/sn/app/components/lib/utils/fileUploadUtil.tsx b/apps/sn/app/components/lib/utils/fileUploadUtil.tsx index 9b3721cd0..195a96b0d 100644 --- a/apps/sn/app/components/lib/utils/fileUploadUtil.tsx +++ b/apps/sn/app/components/lib/utils/fileUploadUtil.tsx @@ -1,5 +1,5 @@ import { Upload, type HttpResponse } from "tus-js-client"; -import { getCookie, setCookie } from "@utils"; +import { getCookie, setCookie } from "@/components/lib/utils"; import { ENDPOINT } from "../api/attachment/attachment-service"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; diff --git a/apps/sn/app/components/lib/utils/index.tsx b/apps/sn/app/components/lib/utils/index.tsx index 0b9999c87..9a41c2740 100644 --- a/apps/sn/app/components/lib/utils/index.tsx +++ b/apps/sn/app/components/lib/utils/index.tsx @@ -1,4 +1,7 @@ -export { getCookie, setCookie, removeCookie } from "./cookie"; -export { handleUpload } from "./fileUploadUtil"; +export * from "./cookie"; +export * from "./fileUploadUtil"; export * from "./fileDownload"; export * from './date' +export * from './excelToJson' +export * from './fileDeleteUtil' +export * from './fileDownload' diff --git a/apps/sn/app/components/ui/fileUploadForm.tsx b/apps/sn/app/components/ui/fileUploadForm.tsx index 0760b3252..7fcdeb353 100644 --- a/apps/sn/app/components/ui/fileUploadForm.tsx +++ b/apps/sn/app/components/ui/fileUploadForm.tsx @@ -1,7 +1,7 @@ "use client" import { FileUploader } from "@common/components"; import { Button } from '@common/components/ui'; -import { handleUpload } from "@utils"; +import { handleUpload } from "@/components/lib/utils"; import { useId, useState } from 'react'; import type { HttpResponse, Upload } from "tus-js-client"; diff --git a/apps/sn/app/components/ui/operFileUploadForm.tsx b/apps/sn/app/components/ui/operFileUploadForm.tsx index bd1c67996..c3aaa6ddd 100644 --- a/apps/sn/app/components/ui/operFileUploadForm.tsx +++ b/apps/sn/app/components/ui/operFileUploadForm.tsx @@ -2,7 +2,7 @@ import { SelectBox } from '@common/business_components/ui'; import React, { useState } from 'react' import FileUploadForm from './fileUploadForm'; -import { yearOptions } from '../lib/utils'; +import { yearOptions } from '@/components/lib/utils'; const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (files: string, year: string, quarter: string, code:string, id:string) => void }) => { const [atflCd, setAtflCd] = useState(null); diff --git a/apps/sn/app/layout.tsx b/apps/sn/app/layout.tsx index f983b20bc..066d9646b 100644 --- a/apps/sn/app/layout.tsx +++ b/apps/sn/app/layout.tsx @@ -1,10 +1,5 @@ -import "./styles/base.css"; -import "./styles/components.css"; import type { Metadata } from "next"; -import { cookies } from "next/headers"; -import { StoreProvider } from "./store/store-provider"; -import { AuthWrapper } from "./components/lib/auth"; -import { ClientLayout } from "./clientLayout"; +import { App } from "@/app"; export const metadata: Metadata = { title: "디지털 하수관로", @@ -16,22 +11,4 @@ export const metadata: Metadata = { } }; -export default async function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - const theme = (await cookies()).get("site-theme-key"); - - return ( - - - - - {children} - - - - - ); -} +export default App; \ No newline at end of file diff --git a/apps/sn/app/page.tsx b/apps/sn/app/page.tsx index 36295f554..846a46ad0 100644 --- a/apps/sn/app/page.tsx +++ b/apps/sn/app/page.tsx @@ -1,27 +1,46 @@ -'use client' +"use client"; import Link from "next/link"; import { Button } from "@common/components/ui"; export default function Home() { return (
-

하수관망도

-
- -
-
-

운영정보 관리

+
+

하수관망도

- - + + +
-

I/I 분석(기초정보 설정)

+
+

운영정보 관리

- - - - + + + + + + +
+
+
+

+ I/I 분석(기초정보 설정) +

+
+ + + + + + + + + + + +
diff --git a/apps/sn/app/service/index.ts b/apps/sn/app/service/index.ts deleted file mode 100644 index c6bfcff72..000000000 --- a/apps/sn/app/service/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './map' diff --git a/apps/sn/app/service/map.ts b/apps/sn/app/service/map.ts deleted file mode 100644 index 2182e88c8..000000000 --- a/apps/sn/app/service/map.ts +++ /dev/null @@ -1,37 +0,0 @@ - -import axios from 'axios' - -/** - * 관망도 API - */ -const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map` - -export type LyrStngProps = { - lyr_sn: string - lyr_nm: string - upper_lyr_sn: string - drawOrdr: string - flterSql: string - gobjTy: string - lyrTpNm: string - useYn: string - minViewSize: string - iconNm: string - lblAtrbNm: string - fontNm: string - fontIntnColor: string - fontExtnColor: string - fontExtnWdth: string - lnWdth: string - lnColor: string - polgnColor: string - initEprssYn: string - clickPsblYn: string -} - -export const mapService = { - //레이어 설정 조회 - getLyrStngs: () => { - return axios.get(`${API_URL}/lyrStngs/SN_NETWORK`) - } -} diff --git a/apps/sn/app/store/index.tsx b/apps/sn/app/store/index.tsx deleted file mode 100644 index a9fc1288d..000000000 --- a/apps/sn/app/store/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { useUserStore, type IUserInfo } from "./user-store"; diff --git a/apps/sn/app/store/user-store.tsx b/apps/sn/app/store/user-store.tsx deleted file mode 100644 index 8719dc842..000000000 --- a/apps/sn/app/store/user-store.tsx +++ /dev/null @@ -1,74 +0,0 @@ -"use client"; - -import { create } from "zustand"; -import { persist } from "zustand/middleware"; -import { createStore } from "zustand/vanilla"; - -export interface IUserInfo { - regDt: string; - mdfcnDt: string; - rgtr: string; - mdfr: string; - adminRoleYn: string; - userUnqId: string; - userId: string; - userName: string; - email: string; - encryptedPassword: string; - refreshToken: string; - userStateCode: string; - lastLoginDate: string; - loginFailCount: number; - pswdHnt: string; - pswdAns: string; - mphn: string; - telno: string; - zip: string; - addr: string; - daddr: string; - laeSeCd: string; - ogdpSeCd: string; - aprvYn: string; - autzrId: string; - expryYmd: string; - lastPswdChgDt: string; - googleId: string; - kakaoId: string; - naverId: string; - isSocialUser: boolean; - hasPassword: boolean; - } - -export type UserState = { - userInfo: IUserInfo | null; -}; - -type UserStore = { - userInfo: IUserInfo | null; - setUserInfo: (userInfo: IUserInfo | null) => void; -}; - -// ✅ zustand 기본 create + persist 적용 -export const useUserStore = create()( - persist( - (set) => ({ - userInfo: null, - setUserInfo: (userInfo) => set({ userInfo }), - }), - { - name: "user-store", // localStorage 키 - partialize: (state) => ({ userInfo: state.userInfo }), // 선택적 저장 - }, - ), -); - -export const defaultInitState: UserState = { - userInfo: null, -}; - -export const createUserStore = (initState: UserState = defaultInitState) => { - return createStore()((set) => ({ - ...initState, - setUserInfo: (userInfo: IUserInfo | null) => set(() => ({ userInfo })), - })); -}; diff --git a/apps/sn/package.json b/apps/sn/package.json index 42c19afa7..caac2aadb 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev -p 3002", + "dev": "next dev -p 3000", "build": "next build", "start": "next start", "lint": "next lint" @@ -14,9 +14,11 @@ "@common/components": "workspace:*", "@frontend-opensource/use-react-hooks": "^1.1.4", "@hookform/resolvers": "^4.1.3", + "@minoru/react-dnd-treeview": "3.5.1-alpha.1", "@radix-ui/react-label": "^2.1.2", "@radix-ui/react-slot": "^1.1.2", "@tanstack/react-query": "^5.67.1", + "@tanstack/react-query-devtools": "^5.75.5", "@tanstack/react-table": "^8.21.2", "axios": "^1.8.1", "chart.js": "^4.4.8", @@ -24,6 +26,7 @@ "js-cookie": "^3.0.5", "next": "15.1.7", "react-chartjs-2": "^5.3.0", + "react-dnd": "^16.0.1", "react-hook-form": "^7.54.2", "tailwindcss-animate": "^1.0.7", "zod": "^3.24.2", diff --git a/apps/sn/src/app/index.tsx b/apps/sn/src/app/index.tsx new file mode 100644 index 000000000..692b55ef0 --- /dev/null +++ b/apps/sn/src/app/index.tsx @@ -0,0 +1,20 @@ +import "./styles/base.css"; +import "./styles/components.css"; +import "@fontsource-variable/noto-sans-kr"; + +import { AppProvider } from "./providers"; +import { cookies } from "next/headers"; + +const App = async ({ children }: Readonly<{ children: React.ReactNode }>) => { + const theme = (await cookies()).get("site-theme-key"); + + return ( + + + {children} + + + ); +}; + +export { App }; diff --git a/apps/sn/src/app/providers/app-provider.tsx b/apps/sn/src/app/providers/app-provider.tsx new file mode 100644 index 000000000..81821a635 --- /dev/null +++ b/apps/sn/src/app/providers/app-provider.tsx @@ -0,0 +1,46 @@ +"use client"; + +import { DndProvider } from "react-dnd"; +import { MultiBackend, getBackendOptions } from "@minoru/react-dnd-treeview"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; +import { ConfirmProvider } from "@frontend-opensource/use-react-hooks"; +import { AuthWrapper } from "@/entities/auth"; +import { MenuWrapper } from "@/entities/menu"; +import { PromptProvider, StoreProvider } from "@/shared/providers"; +import { AlertDialog } from "@/shared/ui/alert-dialog"; +import { PromptDialog } from "@/shared/ui/prompt-dialog"; +import { ConfirmDialog } from "@/shared/ui/confirm-dialog"; + + +const AppProvider = ({ children }: Readonly<{ children: React.ReactNode }>) => { + const queryClient = new QueryClient(); + return ( + + + + + + + + {children} + + + + + + + + + +
+ +
+
+ ); +}; + +export { AppProvider }; diff --git a/apps/sn/src/app/providers/index.ts b/apps/sn/src/app/providers/index.ts new file mode 100644 index 000000000..15f99b7fd --- /dev/null +++ b/apps/sn/src/app/providers/index.ts @@ -0,0 +1 @@ +export { AppProvider } from "./app-provider"; diff --git a/apps/sn/app/styles/base.css b/apps/sn/src/app/styles/base.css similarity index 100% rename from apps/sn/app/styles/base.css rename to apps/sn/src/app/styles/base.css diff --git a/apps/sn/app/styles/components.css b/apps/sn/src/app/styles/components.css similarity index 100% rename from apps/sn/app/styles/components.css rename to apps/sn/src/app/styles/components.css diff --git a/apps/sn/app/components/lib/auth/api/login-service.tsx b/apps/sn/src/entities/auth/api/login-service.ts similarity index 69% rename from apps/sn/app/components/lib/auth/api/login-service.tsx rename to apps/sn/src/entities/auth/api/login-service.ts index 44b7da488..c1968fe36 100644 --- a/apps/sn/app/components/lib/auth/api/login-service.tsx +++ b/apps/sn/src/entities/auth/api/login-service.ts @@ -1,31 +1,14 @@ import { AxiosError } from "axios"; +import { + ENDPOINT, + JWT_EXPIRATION_TIME, + ACCESS_TOKEN, + AUTH_USER_ID, + CLAIM_NAME, +} from "@/shared/config"; +import type { LoginService, ILogin } from "../model/login-interface"; import { tokenManager } from "../lib/token-manager"; -const ENDPOINT = { - USER_SERVICE: { - LOGIN: "/user-service/login", - USERS: "/user-service/api/v1/users", - SILENT_REFRESH: "/user-service/api/v1/users/token/refresh", - AUTHORIZATIONS: "/user-service/api/v1/authorizations", - ROLE_AUTHORIZATIONS: "/user-service/api/v1/role-authorizations", - }, -}; -const JWT_EXPIRATION_TIME = 1800000; -const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; -const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; -const ACCESS_TOKEN = process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token"; - - -export interface ILogin { - userId: string; - password: string; -} - -export interface LoginService { - login(payload: ILogin): Promise; - silentRefresh(): Promise; -} - export class LoginApiService implements LoginService { private static instance: LoginApiService; @@ -51,14 +34,13 @@ export class LoginApiService implements LoginService { const data = await response.json(); const accessToken = data[ACCESS_TOKEN]; const tokenId = data[AUTH_USER_ID]; - + if (!accessToken || !tokenId) { throw new Error("Missing required authentication tokens"); } tokenManager.setToken(CLAIM_NAME, accessToken); tokenManager.setToken(AUTH_USER_ID, tokenId); - tokenManager.setupRefreshTimer( () => this.silentRefresh(), JWT_EXPIRATION_TIME, @@ -75,14 +57,12 @@ export class LoginApiService implements LoginService { try { const response = await fetch( `/api/proxy${ENDPOINT.USER_SERVICE.SILENT_REFRESH}`, - { - method: "PUT", - }, + { method: "PUT" }, ); const data = await response.json(); - const accessToken = response.headers.get("access-token"); - const tokenId = response.headers.get("token-id"); + const accessToken = data[ACCESS_TOKEN]; + const tokenId = data[AUTH_USER_ID]; if (!accessToken || !tokenId) { throw new Error("Missing required authentication tokens"); diff --git a/apps/sn/app/components/lib/auth/index.tsx b/apps/sn/src/entities/auth/index.ts similarity index 100% rename from apps/sn/app/components/lib/auth/index.tsx rename to apps/sn/src/entities/auth/index.ts diff --git a/apps/sn/app/components/lib/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx similarity index 72% rename from apps/sn/app/components/lib/auth/lib/auth-wrapper.tsx rename to apps/sn/src/entities/auth/lib/auth-wrapper.tsx index 0b72cc768..c09ca55c6 100644 --- a/apps/sn/app/components/lib/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -1,30 +1,20 @@ "use client"; import { useEffect } from "react"; -import { useRouter, usePathname } from "next/navigation"; +import { useRouter } from "next/navigation"; +import { client } from "@/shared/api"; +import type { IUserInfo } from "@/shared/store"; +import { useUserStore } from "@/shared/lib"; +import { ENDPOINT, AUTH_USER_ID } from "@/shared/config"; +import { getCookie } from "@/components/lib/utils"; import axios from "axios"; -import Cookies from "js-cookie"; -import { useUserStore, type IUserInfo } from "@store"; -import { getCookie } from "@utils"; import { LoginApi } from "../api/login-service"; import { tokenManager } from "../lib/token-manager"; const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; -const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; - -const ENDPOINT = { - USER_SERVICE: { - LOGIN: "/user-service/login", - USERS: "/user-service/api/v1/users", - SILENT_REFRESH: "/user-service/api/v1/users/token/refresh", - AUTHORIZATIONS: "/user-service/api/v1/authorizations", - ROLE_AUTHORIZATIONS: "/user-service/api/v1/role-authorizations", - }, -}; const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); - const pathname = usePathname(); // 현재 경로 const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { @@ -62,7 +52,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { try { await authCheck(); } catch (error) { - console.error("Auth check failed:", error); + console.error(error); try { await LoginApi.silentRefresh(); @@ -70,7 +60,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - + // TODO 운영에 반영 할때 수정해야..... // 현재 경로가 로그인 페이지가 아닐 때만 redirect // if (!pathname.startsWith("/auth/login")) { @@ -79,7 +69,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } } })(); - }, [pathname]); // pathname도 의존성에 포함 + }, []); return <>{children}; }; diff --git a/apps/sn/app/components/lib/auth/lib/token-manager.tsx b/apps/sn/src/entities/auth/lib/token-manager.ts similarity index 86% rename from apps/sn/app/components/lib/auth/lib/token-manager.tsx rename to apps/sn/src/entities/auth/lib/token-manager.ts index 9feab4af0..bf3d68265 100644 --- a/apps/sn/app/components/lib/auth/lib/token-manager.tsx +++ b/apps/sn/src/entities/auth/lib/token-manager.ts @@ -1,7 +1,5 @@ -import { getCookie, setCookie, removeCookie } from "@utils"; - -const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; -const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; +import { AUTH_USER_ID, CLAIM_NAME } from "@/shared/config"; +import { getCookie, setCookie, removeCookie } from "@/components/lib/utils"; export class TokenManager { private static instance: TokenManager; diff --git a/apps/sn/app/components/lib/auth/model/login-interface.tsx b/apps/sn/src/entities/auth/model/login-interface.ts similarity index 100% rename from apps/sn/app/components/lib/auth/model/login-interface.tsx rename to apps/sn/src/entities/auth/model/login-interface.ts diff --git a/apps/sn/src/entities/menu-authority/@x/menu.ts b/apps/sn/src/entities/menu-authority/@x/menu.ts new file mode 100644 index 000000000..86479f859 --- /dev/null +++ b/apps/sn/src/entities/menu-authority/@x/menu.ts @@ -0,0 +1 @@ +export { MenuAuthorityApi } from "../api/menu-authority-service"; diff --git a/apps/sn/src/entities/menu-authority/@x/posting.ts b/apps/sn/src/entities/menu-authority/@x/posting.ts new file mode 100644 index 000000000..bfe84fa0d --- /dev/null +++ b/apps/sn/src/entities/menu-authority/@x/posting.ts @@ -0,0 +1 @@ +export { AuthorityButton } from "../ui/authority-button"; diff --git a/apps/sn/src/entities/menu-authority/api/menu-authority-service.ts b/apps/sn/src/entities/menu-authority/api/menu-authority-service.ts new file mode 100644 index 000000000..14988eee0 --- /dev/null +++ b/apps/sn/src/entities/menu-authority/api/menu-authority-service.ts @@ -0,0 +1,40 @@ +import { client } from "@/shared/api"; +import { ENDPOINT } from "@/shared/config"; +import type { + MenuAuthorityList, + MenuAuthorityParams, + MenuAuthorityPayload, + MenuAuthorityService, + PageMenuAuthority, +} from "../model/menu-authority-interface"; + +export class MenuAuthorityApiService implements MenuAuthorityService { + public async getMenuAuthorityList( + params: MenuAuthorityParams, + ): Promise { + const response = await client.get( + `${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}`, + { params }, + ); + return response.data; + } + + public async getPageMenuAuthority( + menuCd: number, + ): Promise { + const response = await client.get( + `${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}/pageinfo/${menuCd}`, + ); + return response.data; + } + + public async saveMenuAuthority(data: MenuAuthorityPayload[]): Promise { + const response = await client.post( + `${ENDPOINT.CMS_SERVICE.MENU_AUTHRTS}`, + data, + ); + return response.data; + } +} + +export const MenuAuthorityApi = new MenuAuthorityApiService(); diff --git a/apps/sn/src/entities/menu-authority/index.ts b/apps/sn/src/entities/menu-authority/index.ts new file mode 100644 index 000000000..2a555b77e --- /dev/null +++ b/apps/sn/src/entities/menu-authority/index.ts @@ -0,0 +1,2 @@ +export { AuthorityButton } from "./ui/authority-button"; +export { ManagementAuthorityDialog } from "./ui/management-authority-dialog"; diff --git a/apps/sn/src/entities/menu-authority/model/menu-authority-interface.ts b/apps/sn/src/entities/menu-authority/model/menu-authority-interface.ts new file mode 100644 index 000000000..b59574c2f --- /dev/null +++ b/apps/sn/src/entities/menu-authority/model/menu-authority-interface.ts @@ -0,0 +1,48 @@ +import { z } from "zod"; +import type { PageableList, PageableParams } from "@/shared/model"; + +export interface MenuAuthorityParams extends PageableParams { + groupId?: string; + menuCd?: number; + useYn?: string; +} + +export interface PageMenuAuthority { + mngAuthrtYn: string; + inqAuthrtYn: string; + regAuthrtYn: string; + mdfcnAuthrtYn: string; + delAuthrtYn: string; +} + +export const menuAuthoritySchema = z.object({ + groupId: z.string(), + groupNm: z.string(), + menuCd: z.number(), + mngAuthrtYn: z.string(), + inqAuthrtYn: z.string(), + regAuthrtYn: z.string(), + mdfcnAuthrtYn: z.string(), + delAuthrtYn: z.string(), + useYn: z.string(), + mode: z.string(), +}); + +export const menuAuthorityPayloadSchema = menuAuthoritySchema.omit({ + groupNm: true, +}); + +export const menuAuthorityFormSchema = z.object({ + menuAuthority: z.array(menuAuthorityPayloadSchema), +}); + +export type MenuAuthority = z.infer; +export type MenuAuthorityList = PageableList; +export type MenuAuthorityPayload = z.infer; +export type MenuAuthorityFormData = z.infer; + +export interface MenuAuthorityService { + getMenuAuthorityList(params: MenuAuthorityParams): Promise; + getPageMenuAuthority(menuCd: number): Promise; + saveMenuAuthority(data: MenuAuthorityPayload[]): Promise; +} diff --git a/apps/sn/src/entities/menu-authority/model/menu-authority-table-columns.tsx b/apps/sn/src/entities/menu-authority/model/menu-authority-table-columns.tsx new file mode 100644 index 000000000..6969a85e9 --- /dev/null +++ b/apps/sn/src/entities/menu-authority/model/menu-authority-table-columns.tsx @@ -0,0 +1,117 @@ +import type { ColumnDef } from "@tanstack/react-table"; +import type { UseFormReturn } from "react-hook-form"; +import { Checkbox } from "@common/components"; +import type { + MenuAuthority, + MenuAuthorityFormData, + MenuAuthorityPayload, +} from "./menu-authority-interface"; + +export const createColumns = ( + form: UseFormReturn, +): ColumnDef[] => { + const getCurrentRow = (i: number) => form.watch("menuAuthority")[i]; + + const handleCheckedChange = + (i: number, key: keyof MenuAuthorityPayload) => (checked: boolean) => { + if (getCurrentRow(i)?.mode === "R") { + form.setValue(`menuAuthority.${i}.mode`, "U"); + } + form.setValue(`menuAuthority.${i}.${key}`, checked ? "Y" : "N"); + }; + + return [ + { + accessorKey: "groupNm", + header: "그룹명", + }, + { + accessorKey: "mngAuthrtYn", + header: "관리권한", + cell: ({ row }) => { + return ( + { + if (checked) { + handleCheckedChange( + row.index, + "regAuthrtYn", + )(checked as boolean); + handleCheckedChange( + row.index, + "mdfcnAuthrtYn", + )(checked as boolean); + handleCheckedChange( + row.index, + "delAuthrtYn", + )(checked as boolean); + handleCheckedChange( + row.index, + "inqAuthrtYn", + )(checked as boolean); + } + handleCheckedChange(row.index, "mngAuthrtYn")(checked as boolean); + }} + /> + ); + }, + }, + { + accessorKey: "regAuthrtYn", + header: "등록권한", + cell: ({ row }) => { + return ( + { + if (checked) { + handleCheckedChange( + row.index, + "inqAuthrtYn", + )(checked as boolean); + } + handleCheckedChange(row.index, "regAuthrtYn")(checked as boolean); + }} + /> + ); + }, + }, + { + accessorKey: "mdfcnAuthrtYn", + header: "수정권한 ", + cell: ({ row }) => { + return ( + + ); + }, + }, + { + accessorKey: "delAuthrtYn", + header: "삭제권한", + cell: ({ row }) => { + return ( + + ); + }, + }, + { + accessorKey: "inqAuthrtYn", + header: "조회권한", + cell: ({ row }) => { + return ( + + ); + }, + }, + ]; +}; diff --git a/apps/sn/src/entities/menu-authority/ui/authority-button.tsx b/apps/sn/src/entities/menu-authority/ui/authority-button.tsx new file mode 100644 index 000000000..257ab6e5d --- /dev/null +++ b/apps/sn/src/entities/menu-authority/ui/authority-button.tsx @@ -0,0 +1,26 @@ +import { useMenuStore } from "@/shared/lib"; +import { Button, cn, type ButtonProps } from "@common/components"; +import type { PageMenuAuthority } from "../model/menu-authority-interface"; + +type AuthorityButtonProps = { + authority: keyof PageMenuAuthority; +} & ButtonProps; + +function AuthorityButton({ + authority, + className, + children, + ...props +}: AuthorityButtonProps) { + const pageMenuAuthority = useMenuStore((state) => state.pageMenuAuthority); + + const isAuthority = pageMenuAuthority?.[authority] === "Y"; + + return ( + + ); +} + +export { AuthorityButton }; diff --git a/apps/sn/src/entities/menu-authority/ui/management-authority-dialog.tsx b/apps/sn/src/entities/menu-authority/ui/management-authority-dialog.tsx new file mode 100644 index 000000000..4a73cb596 --- /dev/null +++ b/apps/sn/src/entities/menu-authority/ui/management-authority-dialog.tsx @@ -0,0 +1,103 @@ +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useQuery } from "@tanstack/react-query"; +import { getCoreRowModel, useReactTable } from "@tanstack/react-table"; +import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { + Button, + DataTable, + Dialog, + DialogClose, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@common/components"; +import { ENDPOINT } from "@/shared/config"; +import { useAlertStore, useMutationWrapper } from "@/shared/lib"; +import { + menuAuthorityFormSchema, + type MenuAuthorityFormData, + type MenuAuthorityPayload, +} from "../model/menu-authority-interface"; +import { createColumns } from "../model/menu-authority-table-columns"; +import { MenuAuthorityApi } from "../api/menu-authority-service"; + +type ManagementAuthorityDialogProps = { + menuCd?: number; +} & React.ComponentProps; + +function ManagementAuthorityDialog({ + menuCd, + ...props +}: ManagementAuthorityDialogProps) { + const { confirm } = useConfirm(); + const alert = useAlertStore((state) => state.setMessage); + + const { data: menuAuthorityList } = useQuery({ + queryKey: [ENDPOINT.CMS_SERVICE.MENU_AUTHRTS, menuCd], + queryFn: () => MenuAuthorityApi.getMenuAuthorityList({ menuCd }), + enabled: !!menuCd, + }); + + const { mutateAsync: saveMenuAuthority } = useMutationWrapper({ + mutationFn: (data: MenuAuthorityPayload[]) => + MenuAuthorityApi.saveMenuAuthority(data), + onSuccess: () => { + alert("저장되었습니다."); + }, + }); + + const form = useForm({ + resolver: zodResolver(menuAuthorityFormSchema), + values: { + menuAuthority: menuAuthorityList?.content ?? [], + }, + }); + + const table = useReactTable({ + data: menuAuthorityList?.content ?? [], + columns: createColumns(form), + getCoreRowModel: getCoreRowModel(), + }); + + const handleSave = async () => { + if (await confirm("저장하시겠습니까?")) { + const data = form.getValues("menuAuthority"); + const filteredData = data.filter((item) => item.mode !== "R"); + await saveMenuAuthority(filteredData); + } + }; + + return ( + + + + + + + 그룹별 메뉴 권한 + +
+ +
+ + + + + + +
+
+ ); +} + +export { ManagementAuthorityDialog }; diff --git a/apps/sn/src/entities/menu/api/menu-service.ts b/apps/sn/src/entities/menu/api/menu-service.ts new file mode 100644 index 000000000..4424f8d37 --- /dev/null +++ b/apps/sn/src/entities/menu/api/menu-service.ts @@ -0,0 +1,14 @@ +import { client } from "@/shared/api"; +import { ENDPOINT } from "@/shared/config"; +import type { MenuItem, MenuService } from "../model/menu-interface"; + +export class MenuApiService implements MenuService { + async getMenuRoles(siteId: string): Promise { + const response = await client.get( + `${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`, + ); + return response.data; + } +} + +export const MenuApi = new MenuApiService(); diff --git a/apps/sn/src/entities/menu/index.ts b/apps/sn/src/entities/menu/index.ts new file mode 100644 index 000000000..04f63e38b --- /dev/null +++ b/apps/sn/src/entities/menu/index.ts @@ -0,0 +1,2 @@ +export { MenuWrapper } from "./lib/menu-wrapper"; +export type { MenuItem } from "./model/menu-interface"; diff --git a/apps/sn/src/entities/menu/lib/menu-wrapper.tsx b/apps/sn/src/entities/menu/lib/menu-wrapper.tsx new file mode 100644 index 000000000..e00d3696e --- /dev/null +++ b/apps/sn/src/entities/menu/lib/menu-wrapper.tsx @@ -0,0 +1,59 @@ +"use client"; + +import { useEffect } from "react"; +import { usePathname, useRouter } from "next/navigation"; +import { MenuAuthorityApi } from "@/entities/menu-authority/@x/menu"; +import { useAlertStore, useMenuStore } from "@/shared/lib"; +import { getCookie } from "@/components/lib/utils"; +import { SITE_ID } from "@/shared/config"; +import { MenuApi } from "../api/menu-service"; +import { getCurrentMenu } from "./utils"; + +const MenuWrapper = ({ children }: { children: React.ReactNode }) => { + const router = useRouter(); + const pathname = usePathname(); + + const alert = useAlertStore((state) => state.setMessage); + const { pageMenuAuthority, setCurrentMenuInfo, setPageMenuAuthority } = + useMenuStore((state) => state); + + const getCurrentMenuInfo = async () => { + const menuRoles = await MenuApi.getMenuRoles(SITE_ID); + if (!menuRoles) return; + return getCurrentMenu(menuRoles, pathname ?? ""); + }; + + const getPageMenuAuthority = async () => { + const menuCd = getCookie("menu-code-key"); + if (!menuCd) return; + const response = await MenuAuthorityApi.getPageMenuAuthority( + parseInt(menuCd), + ); + return response; + }; + + const checkInquiryAuthority = () => { + return pageMenuAuthority?.inqAuthrtYn === "Y"; + }; + + useEffect(() => { + (async () => { + const currentMenu = await getCurrentMenuInfo(); + if (currentMenu) setCurrentMenuInfo(currentMenu); + + const response = await getPageMenuAuthority(); + if (response?.length) setPageMenuAuthority(response[0]!); + })(); + }, []); + + useEffect(() => { + if (!pageMenuAuthority) return; + const inquiryAuthority = checkInquiryAuthority(); + if (!inquiryAuthority) + alert("페이지에 대한 조회 권한이 없습니다.", () => router.push("/")); + }, [pageMenuAuthority]); + + return <>{children}; +}; + +export { MenuWrapper }; diff --git a/apps/sn/src/entities/menu/lib/utils.ts b/apps/sn/src/entities/menu/lib/utils.ts new file mode 100644 index 000000000..1cf4514d9 --- /dev/null +++ b/apps/sn/src/entities/menu/lib/utils.ts @@ -0,0 +1,20 @@ +import type { MenuItem } from "../model/menu-interface"; + +export const getCurrentMenu = ( + menus: MenuItem[], + pathname: string, +): MenuItem | null => { + for (const menu of menus) { + if ( + menu.urlPath !== "" && + (menu.urlPath === pathname || pathname.startsWith(menu.urlPath)) + ) + return menu; + + if (menu.children) { + const children = getCurrentMenu(menu.children, pathname); + if (children) return children; + } + } + return null; +}; diff --git a/apps/sn/src/entities/menu/model/menu-interface.ts b/apps/sn/src/entities/menu/model/menu-interface.ts new file mode 100644 index 000000000..12c7d007a --- /dev/null +++ b/apps/sn/src/entities/menu/model/menu-interface.ts @@ -0,0 +1,23 @@ +export interface MenuItem { + menuCd: number; + menuKornNm: string; + menuEngNm: string; + parentId: number | null; + sortSeq: number; + iconNm?: string; + children: MenuItem[] | null; + levelNo: number; + urlPath: string; + menuLnkgTypeCd: string; + menuLnkgSn: number; + menuPath: string; + qrcd: string; + useYn: string; + otptYn: string; + newWndwYn: string; + requiredUrlPath: boolean; +} + +export interface MenuService { + getMenuRoles(siteId: string): Promise; +} diff --git a/apps/sn/src/shared/api/client.ts b/apps/sn/src/shared/api/client.ts new file mode 100644 index 000000000..709bb44a5 --- /dev/null +++ b/apps/sn/src/shared/api/client.ts @@ -0,0 +1,8 @@ +import { Client } from "@common/network"; +import { BASE_URL } from "../config/api"; +import { SITE_ID } from "../config/env"; + +export const client = Client.getInstance({ + baseURL: BASE_URL, + siteId: SITE_ID, +}); diff --git a/apps/sn/src/shared/api/index.ts b/apps/sn/src/shared/api/index.ts new file mode 100644 index 000000000..b7b9d6121 --- /dev/null +++ b/apps/sn/src/shared/api/index.ts @@ -0,0 +1 @@ +export { client } from "./client"; diff --git a/apps/sn/src/shared/config/api.ts b/apps/sn/src/shared/config/api.ts new file mode 100644 index 000000000..3eba9fa91 --- /dev/null +++ b/apps/sn/src/shared/config/api.ts @@ -0,0 +1,56 @@ +import { PROXY_HOST } from "./env"; + +export const BASE_URL = `${PROXY_HOST}/server`; + +export const ENDPOINT = { + ATTACH_SERVICE: { + TUS_UPLOAD: "/attach-service/api/v1/tus/upload", + EDITOR_UPLOAD: "/attach-service/api/v1/upload/editor", + IMAGES: "/attach-service/api/v1/images", + MOVIE_THUMBNAIL: "/attach-service/api/v1/movie/thumbnail", + ATTACHMENTS: "/attach-service/api/v1/atfl/attachments", + DOWNLOAD: "/attach-service/api/v1/atflcd/download", + STREAM_VIDEO: "/attach-service/api/v1/stream/video", + }, + USER_SERVICE: { + LOGIN: "/user-service/login", + USERS: "/user-service/api/v1/users", + SILENT_REFRESH: "/user-service/api/v1/users/token/refresh", + AUTHORIZATIONS: "/user-service/api/v1/authorizations", + ROLE_AUTHORIZATIONS: "/user-service/api/v1/role-authorizations", + ROLES: "/user-service/api/v1/roles", + }, + CMS_SERVICE: { + SITES: "/cms-service/api/v1/sites", + IPS: "/cms-service/api/v1/site-ips", + DOMAINS: "/cms-service/api/v1/site-dmns", + POSTINGS: "/cms-service/api/v1/site-pstgs", + CODE: "/cms-service/api/v1/code/cache", + MENUS: "/cms-service/api/v1/menus", + MENU_ROLES: "/cms-service/api/v1/menu-roles", + MENU_AUTHRTS: "/cms-service/api/v1/menu-authrts", + CONTENTS: "/cms-service/api/v1/contents", + CONTENTS_DETAILS: "/cms-service/api/v1/contents-details", + ORGANIZATIONS: "/cms-service/api/v1/ognzs", + USER_ORGANIZATION: "/cms-service/api/v1/user-ognz", + IMAGES: "/cms-service/api/v1/images", + BANNERS: "/cms-service/api/v1/bnrs", + TEMPLATE: "/cms-service/api/v1/tmplt", + TERMS: "/cms-service/api/v1/trms", + LWPO_CODE: "/cms-service/api/v1/lwpo-cds", + UP_CODE: "/cms-service/api/v1/up-codes", + POPUPS: "/cms-service/api/v1/popups", + SCHEDULES: "/cms-service/api/v1/schdls", + SURVEY: "/cms-service/api/v1/srvy", + SURVEY_QUESTION: "/cms-service/api/v1/srvy-qitem", + SURVEY_ARTICLE: "/cms-service/api/v1/srvy-artcl", + }, + BOARD_SERVICE: { + BBS: "/board-service/api/v1/bbs", + BBS_TEMPLATES: "/board-service/api/v1/bbsTmplt", + POSTS: "/board-service/api/v1/posts", + POSTS_COMMENTS: "/board-service/api/v1/posts-cmnts", + }, +}; + +export const JWT_EXPIRATION_TIME = 1800000; diff --git a/apps/sn/src/shared/config/env.ts b/apps/sn/src/shared/config/env.ts new file mode 100644 index 000000000..c6373724f --- /dev/null +++ b/apps/sn/src/shared/config/env.ts @@ -0,0 +1,11 @@ +export const PORT = process.env.NEXT_PUBLIC_PORT || "3000"; +export const PROXY_HOST = + process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; +export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL; +export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "CS"; +export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; +export const ACCESS_TOKEN = + process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token"; +export const REFRESH_TOKEN = + process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token"; +export const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; diff --git a/apps/sn/src/shared/config/index.ts b/apps/sn/src/shared/config/index.ts new file mode 100644 index 000000000..cd83447d5 --- /dev/null +++ b/apps/sn/src/shared/config/index.ts @@ -0,0 +1,2 @@ +export * from "./api"; +export * from "./env"; diff --git a/apps/sn/src/shared/lib/index.ts b/apps/sn/src/shared/lib/index.ts new file mode 100644 index 000000000..bca6d2476 --- /dev/null +++ b/apps/sn/src/shared/lib/index.ts @@ -0,0 +1,5 @@ +export { useMutationWrapper } from "./use-mutation-wrapper"; +export { useAlertStore } from "./use-alert-store"; +export { useMenuStore } from "./use-menu-store"; +export { useUserStore } from "./use-user-store"; +export { usePrompt } from "./use-prompt"; diff --git a/apps/sn/src/shared/lib/use-alert-store.ts b/apps/sn/src/shared/lib/use-alert-store.ts new file mode 100644 index 000000000..c21a00ed3 --- /dev/null +++ b/apps/sn/src/shared/lib/use-alert-store.ts @@ -0,0 +1,14 @@ +import { useStore } from "zustand"; +import { useContext } from "react"; +import type { AlertStore } from "../store/alert-store"; +import { StoreContext } from "../providers/store-provider"; + +export const useAlertStore = (selector: (store: AlertStore) => T): T => { + const storeContext = useContext(StoreContext); + + if (!storeContext) { + throw new Error("useAlertStore must be used within StoreProvider"); + } + + return useStore(storeContext.alertStore, selector); +}; diff --git a/apps/sn/src/shared/lib/use-menu-store.ts b/apps/sn/src/shared/lib/use-menu-store.ts new file mode 100644 index 000000000..66e41c76c --- /dev/null +++ b/apps/sn/src/shared/lib/use-menu-store.ts @@ -0,0 +1,14 @@ +import { useStore } from "zustand"; +import { useContext } from "react"; +import type { MenuStore } from "../store/menu-store"; +import { StoreContext } from "../providers/store-provider"; + +export const useMenuStore = (selector: (store: MenuStore) => T): T => { + const storeContext = useContext(StoreContext); + + if (!storeContext) { + throw new Error("useMenuStore must be used within StoreProvider"); + } + + return useStore(storeContext.menuStore, selector); +}; diff --git a/apps/sn/src/shared/lib/use-mutation-wrapper.tsx b/apps/sn/src/shared/lib/use-mutation-wrapper.tsx new file mode 100644 index 000000000..ce119d2a7 --- /dev/null +++ b/apps/sn/src/shared/lib/use-mutation-wrapper.tsx @@ -0,0 +1,31 @@ +import { AxiosError } from "axios"; +import { useMutation, type UseMutationOptions } from "@tanstack/react-query"; +import { useAlertStore } from "./use-alert-store"; + +export const useMutationWrapper = < + TData = unknown, + TError = unknown, + TVariables = void, + TContext = unknown, +>( + mutationOptions: UseMutationOptions, +) => { + const alert = useAlertStore((state) => state.setMessage); + return useMutation({ + ...mutationOptions, + onError: (error) => { + let errorMessage = ""; + + if (error instanceof AxiosError) { + if (error.response?.status) + errorMessage += `status: ${error.response.status}\n`; + if (error.response?.data?.message) + errorMessage += `${error.response.data.message}\n`; + if (error.response?.data?.errors[0]?.message) + errorMessage += `${error.response.data.errors[0].message}\n`; + } + + alert(`[Error] ${errorMessage}`); + }, + }); +}; diff --git a/apps/sn/src/shared/lib/use-prompt.tsx b/apps/sn/src/shared/lib/use-prompt.tsx new file mode 100644 index 000000000..f36858eb0 --- /dev/null +++ b/apps/sn/src/shared/lib/use-prompt.tsx @@ -0,0 +1,26 @@ +import { useContext } from "react"; +import { PromptContext } from "../providers/prompt-provider"; + +export const usePrompt = () => { + const { message, resolve, setMessage, setResolve } = + useContext(PromptContext); + + const prompt = (message: string) => { + setMessage(message); + return new Promise<{ resolved: boolean; value?: string }>((resolve) => { + setResolve(() => resolve); + }); + }; + + const onSubmit = (value: string) => { + resolve?.({ resolved: true, value }); + setMessage(""); + }; + + const onCancel = () => { + resolve?.({ resolved: false }); + setMessage(""); + }; + + return { message, isOpen: !!message, prompt, onSubmit, onCancel }; +}; diff --git a/apps/sn/src/shared/lib/use-user-store.ts b/apps/sn/src/shared/lib/use-user-store.ts new file mode 100644 index 000000000..748caed4c --- /dev/null +++ b/apps/sn/src/shared/lib/use-user-store.ts @@ -0,0 +1,14 @@ +import { useStore } from "zustand"; +import { useContext } from "react"; +import type { UserStore } from "../store/user-store"; +import { StoreContext } from "../providers/store-provider"; + +export const useUserStore = (selector: (store: UserStore) => T): T => { + const storeContext = useContext(StoreContext); + + if (!storeContext) { + throw new Error("useUserStore must be used within StoreProvider"); + } + + return useStore(storeContext.userStore, selector); +}; diff --git a/apps/sn/src/shared/providers/index.ts b/apps/sn/src/shared/providers/index.ts new file mode 100644 index 000000000..fa8320fe7 --- /dev/null +++ b/apps/sn/src/shared/providers/index.ts @@ -0,0 +1,2 @@ +export { StoreProvider } from "./store-provider"; +export { PromptProvider } from "./prompt-provider"; diff --git a/apps/sn/src/shared/providers/prompt-provider.tsx b/apps/sn/src/shared/providers/prompt-provider.tsx new file mode 100644 index 000000000..10338c338 --- /dev/null +++ b/apps/sn/src/shared/providers/prompt-provider.tsx @@ -0,0 +1,37 @@ +import { createContext, useState } from "react"; + +interface PromptContext { + message?: string; + resolve?: ({ + resolved, + value, + }: { + resolved: boolean; + value?: string; + }) => void; + setMessage: (message: string) => void; + setResolve: (resolve: () => void) => void; +} + +export const PromptContext = createContext({ + message: "", + resolve() {}, + setMessage() {}, + setResolve() {}, +}); + +export const PromptProvider = ({ children }: { children: React.ReactNode }) => { + const [message, setMessage] = useState(); + const [resolve, setResolve] = + useState< + ({ resolved, value }: { resolved: boolean; value?: string }) => void + >(); + + return ( + + {children} + + ); +}; diff --git a/apps/sn/app/store/store-provider.tsx b/apps/sn/src/shared/providers/store-provider.tsx similarity index 60% rename from apps/sn/app/store/store-provider.tsx rename to apps/sn/src/shared/providers/store-provider.tsx index 8a2e8347e..a0ec17b61 100644 --- a/apps/sn/app/store/store-provider.tsx +++ b/apps/sn/src/shared/providers/store-provider.tsx @@ -1,9 +1,17 @@ "use client"; import { createContext, useRef } from "react"; -import { createUserStore } from "../store/user-store"; +import { + createAlertStore, + createAttachmentStore, + createMenuStore, + createUserStore, +} from "../store"; type StoreContextType = { + alertStore: ReturnType; + attachmentStore: ReturnType; + menuStore: ReturnType; userStore: ReturnType; }; @@ -15,6 +23,9 @@ export const StoreProvider = ({ children }: { children: React.ReactNode }) => { const storeRef = useRef(null); if (storeRef.current === null) { storeRef.current = { + alertStore: createAlertStore(), + attachmentStore: createAttachmentStore(), + menuStore: createMenuStore(), userStore: createUserStore(), }; } diff --git a/apps/sn/src/shared/store/alert-store.ts b/apps/sn/src/shared/store/alert-store.ts new file mode 100644 index 000000000..3bba65848 --- /dev/null +++ b/apps/sn/src/shared/store/alert-store.ts @@ -0,0 +1,25 @@ +import { createStore } from "zustand/vanilla"; + +export type AlertState = { + message: string; + callback?: () => void; +}; + +export type AlertActions = { + setMessage: (message: string, callback?: () => void) => void; +}; + +export type AlertStore = AlertState & AlertActions; + +export const defaultInitState: AlertState = { + message: "", + callback: undefined, +}; + +export const createAlertStore = (initState: AlertState = defaultInitState) => { + return createStore()((set) => ({ + ...initState, + setMessage: (message: string, callback?: () => void) => + set(() => ({ message, callback })), + })); +}; diff --git a/apps/sn/src/shared/store/attachment-store.ts b/apps/sn/src/shared/store/attachment-store.ts new file mode 100644 index 000000000..faa700949 --- /dev/null +++ b/apps/sn/src/shared/store/attachment-store.ts @@ -0,0 +1,25 @@ +import { createStore } from "zustand/vanilla"; + +export type AttachmentState = { + attachmentFileCode: string; +}; + +export type AttachmentActions = { + setAttachmentFileCode: (attachmentFileCode: string) => void; +}; + +export type AttachmentStore = AttachmentState & AttachmentActions; + +export const defaultInitState: AttachmentState = { + attachmentFileCode: "", +}; + +export const createAttachmentStore = ( + initState: AttachmentState = defaultInitState, +) => { + return createStore()((set) => ({ + ...initState, + setAttachmentFileCode: (attachmentFileCode: string) => + set({ attachmentFileCode }), + })); +}; diff --git a/apps/sn/src/shared/store/index.ts b/apps/sn/src/shared/store/index.ts new file mode 100644 index 000000000..a41d6f928 --- /dev/null +++ b/apps/sn/src/shared/store/index.ts @@ -0,0 +1,4 @@ +export { createAlertStore } from "./alert-store"; +export { createAttachmentStore } from "./attachment-store"; +export { createMenuStore, type BbsType } from "./menu-store"; +export { createUserStore, type IUserInfo } from "./user-store"; diff --git a/apps/sn/src/shared/store/menu-store.ts b/apps/sn/src/shared/store/menu-store.ts new file mode 100644 index 000000000..8536011ee --- /dev/null +++ b/apps/sn/src/shared/store/menu-store.ts @@ -0,0 +1,93 @@ +import { createStore } from "zustand/vanilla"; + +export const BBS_TYPE = { + BBSNOTICE: "BBSNOTICE", + BBSNORMAL: "BBSNORMAL", + BBSFAQ: "BBSFAQ", + BBSIMAGE: "BBSIMAGE", + BBSMOVIE: "BBSMOVIE", +} as const; + +export type BbsType = (typeof BBS_TYPE)[keyof typeof BBS_TYPE]; + +export interface IBbs { + bbsId: number; + bbsTypeCd: BbsType; + bbsTypeNm: string; + bbsNm: string; + bbsExpln: string; + rfrncUseYn: string; + atflUseYn: string; + atflMaxCnt: number; + atflMaxFileSz: number; + ansUseYn: string; + ansUseAuthrt: string; + cmntUseYn: string; + dgstfnEvlUseYn: string; + smsUseYn: string; + upndFixUseYn: string; + pstgPrdUseYn: string; + popupUseYn: string; + delYn: string; + useYn: string; + mdfcnDt: string; + mdfrNm: string; +} + +interface IMenu { + menuCd: number; + menuKornNm: string; + menuEngNm: string; + parentId: number | null; + sortSeq: number; + iconNm?: string; + children: IMenu[] | null; + levelNo: number; + urlPath: string; + menuLnkgTypeCd: string; + menuLnkgSn: number; + menuPath: string; + qrcd: string; + useYn: string; + otptYn: string; + newWndwYn: string; + requiredUrlPath: boolean; +} + +interface IAuthority { + mngAuthrtYn: string; + inqAuthrtYn: string; + regAuthrtYn: string; + mdfcnAuthrtYn: string; + delAuthrtYn: string; +} + +export type MenuState = { + bbsInfo: IBbs | null; + currentMenuInfo: IMenu | null; + pageMenuAuthority: IAuthority | null; +}; + +export type MenuActions = { + setBbsInfo: (bbs: IBbs) => void; + setCurrentMenuInfo: (menu: IMenu) => void; + setPageMenuAuthority: (authority: IAuthority) => void; +}; + +export type MenuStore = MenuState & MenuActions; + +export const defaultInitState: MenuState = { + currentMenuInfo: null, + bbsInfo: null, + pageMenuAuthority: null, +}; + +export const createMenuStore = (initState: MenuState = defaultInitState) => { + return createStore()((set) => ({ + ...initState, + setBbsInfo: (bbs: IBbs) => set({ bbsInfo: bbs }), + setCurrentMenuInfo: (menu: IMenu) => set({ currentMenuInfo: menu }), + setPageMenuAuthority: (authority: IAuthority) => + set({ pageMenuAuthority: authority }), + })); +}; diff --git a/apps/sn/src/shared/store/user-store.ts b/apps/sn/src/shared/store/user-store.ts new file mode 100644 index 000000000..65d897cf1 --- /dev/null +++ b/apps/sn/src/shared/store/user-store.ts @@ -0,0 +1,57 @@ +import { createStore } from "zustand/vanilla"; + +export interface IUserInfo { + regDt: string; + mdfcnDt: string; + rgtr: string; + mdfr: string; + adminRoleYn: string; + userUnqId: string; + userId: string; + userName: string; + email: string; + encryptedPassword: string; + refreshToken: string; + userStateCode: string; + lastLoginDate: string; + loginFailCount: number; + pswdHnt: string; + pswdAns: string; + mphn: string; + telno: string; + zip: string; + addr: string; + daddr: string; + laeSeCd: string; + ogdpSeCd: string; + aprvYn: string; + autzrId: string; + expryYmd: string; + lastPswdChgDt: string; + googleId: string; + kakaoId: string; + naverId: string; + isSocialUser: boolean; + hasPassword: boolean; +} + +export type UserState = { + userInfo: IUserInfo | null; +}; + +export type UserActions = { + setUserInfo: (userInfo: IUserInfo | null) => void; +}; + +export type UserStore = UserState & UserActions; + +export const defaultInitState: UserState = { + userInfo: null, +}; + +export const createUserStore = (initState: UserState = defaultInitState) => { + return createStore()((set) => ({ + ...initState, + setUserInfo: (userInfo: IUserInfo | null) => set(() => ({ userInfo })), + })); +}; diff --git a/apps/sn/src/shared/ui/alert-dialog.tsx b/apps/sn/src/shared/ui/alert-dialog.tsx new file mode 100644 index 000000000..6160d5301 --- /dev/null +++ b/apps/sn/src/shared/ui/alert-dialog.tsx @@ -0,0 +1,34 @@ +import { + Dialog, + DialogContent, + DialogFooter, + DialogClose, + Button, +} from "@common/components"; +import { useAlertStore } from "../lib/use-alert-store"; + +function AlertDialog() { + const { message, callback, setMessage } = useAlertStore((state) => state); + const handleOpenChange = () => { + setMessage(""); + callback?.(); + }; + return ( + + +
+

+ {message} +

+
+ + + + + +
+
+ ); +} + +export { AlertDialog }; diff --git a/apps/sn/src/shared/ui/confirm-dialog.tsx b/apps/sn/src/shared/ui/confirm-dialog.tsx new file mode 100644 index 000000000..6a4996bfb --- /dev/null +++ b/apps/sn/src/shared/ui/confirm-dialog.tsx @@ -0,0 +1,48 @@ +import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { + Dialog, + DialogContent, + DialogFooter, + DialogClose, + Button, + type ButtonProps, +} from "@common/components"; + +type ConfirmDialogProps = { + isOpen?: boolean; + confirmButtonProps?: ButtonProps & { label?: string }; + cancelButtonProps?: ButtonProps & { label?: string }; +}; + +function ConfirmDialog({ + isOpen, + confirmButtonProps, + cancelButtonProps, +}: ConfirmDialogProps) { + const { message, isOpen: isGlobalOpen, onConfirm, onCancel } = useConfirm(); + return ( + + +
+

+ {message} +

+
+ + + + + + + + +
+
+ ); +} + +export { ConfirmDialog }; diff --git a/apps/sn/src/shared/ui/map-layout.tsx b/apps/sn/src/shared/ui/map-layout.tsx new file mode 100644 index 000000000..e05666401 --- /dev/null +++ b/apps/sn/src/shared/ui/map-layout.tsx @@ -0,0 +1,13 @@ +import { useMenuStore } from "../lib/use-menu-store"; + +function MapLayout({ children }: { children: React.ReactNode }) { + const currentMenuInfo = useMenuStore((state) => state.currentMenuInfo); + + return ( +
+ {children} +
+ ); +} + +export { MapLayout }; diff --git a/apps/sn/src/shared/ui/page-layout.tsx b/apps/sn/src/shared/ui/page-layout.tsx new file mode 100644 index 000000000..358d3b5db --- /dev/null +++ b/apps/sn/src/shared/ui/page-layout.tsx @@ -0,0 +1,22 @@ +import { PageTitle } from "@common/components"; +import { useMenuStore } from "../lib/use-menu-store"; + +function PageLayout({ children }: { children: React.ReactNode }) { + const currentMenuInfo = useMenuStore((state) => state.currentMenuInfo); + + const menuPaths = currentMenuInfo?.menuPath + ?.split(">") + .map((path) => path.trim()); + + return ( +
+ + {children} +
+ ); +} + +export { PageLayout }; diff --git a/apps/sn/src/shared/ui/prompt-dialog.tsx b/apps/sn/src/shared/ui/prompt-dialog.tsx new file mode 100644 index 000000000..54c2f3fcc --- /dev/null +++ b/apps/sn/src/shared/ui/prompt-dialog.tsx @@ -0,0 +1,45 @@ +import { useState } from "react"; +import { + Button, + Dialog, + DialogContent, + DialogFooter, + DialogClose, + Input, +} from "@common/components"; +import { usePrompt } from "@/shared/lib/use-prompt"; + +function PromptDialog() { + const { message, isOpen, onSubmit, onCancel } = usePrompt(); + const [value, setValue] = useState(""); + + return ( + + +
+

+ {message} +

+ setValue(e.target.value)} + /> +
+ + + + + + + + +
+
+ ); +} + +export { PromptDialog }; diff --git a/apps/sn/tsconfig.json b/apps/sn/tsconfig.json index a65fab364..078e6ae2b 100644 --- a/apps/sn/tsconfig.json +++ b/apps/sn/tsconfig.json @@ -22,19 +22,17 @@ "name": "next" } ], - "baseUrl": "app", + "baseUrl": "./src", "paths": { - "@/*": ["./*"], - "@common/components/*": ["../../../packages/common/components/src/*"], + "@/*": ["*"], "@common/components": ["../../../packages/common/components/src"], - "@common/business_components/*": ["../../../packages/common/business_components/src/*"], + "@common/components/*": ["../../../packages/common/components/src/*"], "@common/business_components": ["../../../packages/common/business_components/src"], - "@common/network/*": ["../../../packages/common/network/*"], + "@common/business_components/*": ["../../../packages/common/business_components/src/*"], "@common/network": ["../../../packages/common/network/"], - "@store": ["./store"], - "@service": ["./service"], - "@utils": ["./components/lib/utils"], - "@common/config": ["../../../packages/common/config/dist/"] + "@common/config": ["../../../packages/common/config/dist/"], + "@utils": ["../app/components/lib/utils"], + "@/components/*": ["../app/components/*"] } }, "include": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c9b54a0c..54d7d12ec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -317,6 +317,9 @@ importers: '@hookform/resolvers': specifier: ^4.1.3 version: 4.1.3(react-hook-form@7.54.2) + '@minoru/react-dnd-treeview': + specifier: 3.5.1-alpha.1 + version: 3.5.1-alpha.1(dnd-core@16.0.1)(react-dnd@16.0.1)(react-dom@18.3.1)(react@18.3.1) '@radix-ui/react-label': specifier: ^2.1.2 version: 2.1.2(@types/react-dom@18.3.5)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) @@ -326,6 +329,9 @@ importers: '@tanstack/react-query': specifier: ^5.67.1 version: 5.67.1(react@18.3.1) + '@tanstack/react-query-devtools': + specifier: ^5.75.5 + version: 5.75.5(@tanstack/react-query@5.67.1)(react@18.3.1) '@tanstack/react-table': specifier: ^8.21.2 version: 8.21.2(react-dom@18.3.1)(react@18.3.1) @@ -356,6 +362,9 @@ importers: react-chartjs-2: specifier: ^5.3.0 version: 5.3.0(chart.js@4.4.8)(react@18.3.1) + react-dnd: + specifier: ^16.0.1 + version: 16.0.1(@types/node@22.13.9)(@types/react@18.3.18)(react@18.3.1) react-hook-form: specifier: ^7.54.2 version: 7.54.2(react@18.3.1) From 409c7843878db6597cc8e7afbd20bbe105d403d4 Mon Sep 17 00:00:00 2001 From: swcho Date: Mon, 23 Jun 2025 16:20:12 +0900 Subject: [PATCH 009/259] =?UTF-8?q?feat:=20-=20=EB=A1=9C=EB=94=A9=EB=B0=94?= =?UTF-8?q?=20=EC=9E=AC=EC=B6=94=EA=B0=80=20-=20=EC=B9=A8=EC=9E=85?= =?UTF-8?q?=EC=88=98=20=EB=B6=84=EC=84=9D=ED=99=98=EA=B2=BD=EC=B2=AD?= =?UTF-8?q?=EC=BD=94=EB=93=9C,=20=EC=8B=9C=EB=8F=84,=20=EC=8B=9C=EA=B5=B0?= =?UTF-8?q?=EA=B5=AC,=20=ED=95=98=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5,=20?= =?UTF-8?q?=ED=95=98=EC=88=98=EC=B2=98=EB=A6=AC=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=EA=B0=92=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-base-layout)/ii/BaseLayout.tsx | 125 +++++++++--------- .../(with-base-layout)/ii/irsetting/page.tsx | 29 ++-- .../app/(with-base-layout)/ii/rdii/page.tsx | 10 +- 3 files changed, 85 insertions(+), 79 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index 6b16ad36a..c6fca1fbd 100644 --- a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -7,6 +7,7 @@ import ListDiv from '@common/business_components/ui/list_div' import { SelectBox2 } from '@common/business_components/ui/select/index-2' import { Button, Label } from '@common/components/ui' import { useEffect, useState, type ReactNode } from 'react' +import LoadingOverlay from '@/components/ui/LoadingBar' type TitleName = { mainTitle: string @@ -102,7 +103,7 @@ const BaseLayout = ({ const [processingZoneOptions, setProcessingZoneOptions] = useState([]); const [treatmentFacilityOptions, setTreatmentFacilityOptions] = useState([]); - const [isLoadingAreaData, setIsLoadingAreaData] = useState(false); + const [isLoadingAreaData, setIsLoadingAreaData] = useState(isLoading || false); const [atflId, setAtflId] = useState('') const [fileNm, setFileNm] = useState('') const [dcrpPplMtncBizSn, setDcrpPplMtncBizSn] = useState('') @@ -127,6 +128,7 @@ const BaseLayout = ({ }); const cqlFiltersZone: string[] = []; if (sigungu.val && sigungu.val !== '0') { + // console.log("시군구 코드", sigungu.val); cqlFiltersZone.push(`sgg_cd='${sigungu.val}'`); } if (cqlFiltersZone.length > 0) { @@ -202,71 +204,72 @@ const BaseLayout = ({ return (
- - {/* searchBox.title이 있으면 h3 태그로 제목을 표시합니다. */} - {selectBox?.title && ( -
-

{selectBox.title}

-
- )} -
- {showDatePicker && ( // showDatePicker 값에 따라 DatePicker 렌더링 - <> - - console.log("DatePicker onChange:", date)) - }} - selectClass="ml-5 date-picker-trigger" /> - - )} - setEnoCd?.(val)} - setRtnEnvPartSidoValue={(val) => setCtpvCd?.(val)} - setRtnEnvPartSigunValue={setSigungu} // 선택된 시군구 값을 받을 콜백 함수 전달 - > - onSwageTreatmentPlantChange?.(val)} /> - onSwageProcessingZoneChange?.(val)} /> - - {selectBox?.searchChk ? : null} -
-
- + + + {/* searchBox.title이 있으면 h3 태그로 제목을 표시합니다. */} + {selectBox?.title && (
-

{titleName.firstCardTitle}

+

{selectBox.title}

+
+ )} +
+ {showDatePicker && ( // showDatePicker 값에 따라 DatePicker 렌더링 + <> + + console.log("DatePicker onChange:", date)) + }} + selectClass="ml-5 date-picker-trigger" /> + + )} + setEnoCd?.(val)} + setRtnEnvPartSidoValue={(val) => setCtpvCd?.(val)} + setRtnEnvPartSigunValue={setSigungu} // 선택된 시군구 값을 받을 콜백 함수 전달 + > + onSwageTreatmentPlantChange?.(val)} /> + onSwageProcessingZoneChange?.(val)} /> + + {selectBox?.searchChk ? : null} +
+
+ +
+

{titleName.firstCardTitle}

+
+ {graphBtn ? : null} + {/* 그래프 있을 시 */} + {graphBtn ? : null} + {/* 분석 버튼 */} + {analysisBtn ? : null} +
+
+ + +
+ {/* 폼 정보 입력 칸 */} + {children?.[0]} +
+ + +
+ { + children?.[1] != null ? +
+

{titleName?.secondCardTitle}

- {graphBtn ? : null} + {graphBtn ? : null} {/* 그래프 있을 시 */} - {graphBtn ? : null} - {/* 분석 버튼 */} - {analysisBtn ? : null} + {graphBtn ? : null}
-
- -
- {/* 폼 정보 입력 칸 */} - {children?.[0]} -
-
- -
- { - children?.[1] != null ? -
-

{titleName?.secondCardTitle}

-
- {graphBtn ? : null} - {/* 그래프 있을 시 */} - {graphBtn ? : null} -
-
-
{children?.[1]}
-
: null - } +
{children?.[1]}
+
: null + } ) } diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 03fb1e82c..03eeec3cf 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -125,10 +125,13 @@ const IrSetting = () => { const data = await postData('v1/inftwtAnls', analysisData); console.log("Response from backend:", data); if (data) { + setIsLoadingResult(false); // 로딩 상태 시작 alert("분석 데이터가 성공적으로 제출되었습니다."); resetAllForms(); // 성공 시 폼 초기화 함수 호출 - } else alert("분석 데이터 제출 중 오류가 발생했습니다."); - setIsLoadingResult(false); // 로딩 상태 시작 + } else { + setIsLoadingResult(false); // 로딩 상태 시작 + alert("분석 데이터 제출 중 오류가 발생했습니다."); + } }; // 침입수 분석 실행 버튼 클릭 핸들러 @@ -207,11 +210,11 @@ const IrSetting = () => { // 새로운 JSON 데이터 생성 const combinedAnalysisData = { - enoCd: select1.toString(), // 환경청코드 - ctpvCd: select2.toString(), // 시도코드 - sggCd: select3.val.toString(), // 시군구코드 - swageTmplntCd: select4.toString(), // 하수처리장코드 - swtrmtZoneCd: select5.toString(), // 하수처리구역코드 + enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) + ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) + sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) + swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) ? select4.toString() : null, // 하수처리장코드 (선택값) + swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) ? select5.toString() : null, // 하수처리구역코드 (선택값) aplcnYm: new Date(selectedDate).toISOString().substring(0, 7).replace("-", ""), // 적용연월 drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환) anlsInfo: input2, // 분석정보 @@ -346,12 +349,12 @@ const IrSetting = () => {
handleFileSelection(3, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={3} + key={`file-upload-3-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(3, file, cd, id)} + showButton={false} + showPreview={true} + accept={".xls, .xlsx, .xlsm, .xltx"} + fileIdx={3} />
diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 116d87462..ff069d7c3 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -222,12 +222,12 @@ export default function RTKForm() { // 새로운 JSON 데이터 생성 const combinedAnalysisData = { - enoCd: select1.toString(), // 환경청코드 + enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) aplcnYm: new Date(formData.date).toISOString().substring(0, 7).replace("-", ""), // 적용연월 (YYYYMM 형식) - ctpvCd: select2.toString(), // 시도코드 - sggCd: select3.val.toString(), // 시군구코드 - swageTmplntCd: select4.toString(), // 하수처리장코드 - swtrmtZoneCd: select5.toString(), // 하수처리구역코드 + ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) + sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) + swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) ? select4.toString() : null, // 하수처리장코드 (선택값) + swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) ? select5.toString() : null, // 하수처리구역코드 (선택값) atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) atflId: file1?.atflId, // 첨부파일ID (오수관망도) atflInpNm: file1?.file?.name || "", // 오수관망도 파일명 From a8fa116db4bd59cfd1e4e71fe993548d95a867a3 Mon Sep 17 00:00:00 2001 From: swcho Date: Mon, 23 Jun 2025 20:23:35 +0900 Subject: [PATCH 010/259] =?UTF-8?q?feat:=20=EB=B6=84=EC=84=9D=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=95=98=EC=88=98=EC=B2=98=EB=A6=AC=EA=B5=AC=EC=97=AD=20Column?= =?UTF-8?q?=20=EB=B0=8F=20=ED=95=98=EC=88=98=EC=B2=98=EB=A6=AC=EA=B5=AC?= =?UTF-8?q?=EC=97=AD=20SELECTBOX=20=EC=A3=BC=EC=84=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx | 2 +- apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx | 2 +- apps/sn/app/(with-base-layout)/ii/result/page.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index c6fca1fbd..8f3cdcd44 100644 --- a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -232,7 +232,7 @@ const BaseLayout = ({ setRtnEnvPartSigunValue={setSigungu} // 선택된 시군구 값을 받을 콜백 함수 전달 > onSwageTreatmentPlantChange?.(val)} /> - onSwageProcessingZoneChange?.(val)} /> + {/* onSwageProcessingZoneChange?.(val)} /> */} {selectBox?.searchChk ? : null}
diff --git a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx index b37a06dad..2a86d9eff 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx @@ -26,7 +26,7 @@ type ResultFormValues = z.infer const tableColumn = [ { id: 'rainInfwtAnlsSn', title: '분석번호' }, { id: 'swageTmplntNm', title: '하수처리장' }, - { id: 'swtrmtZoneNm', title: '처리구역' }, + // { id: 'swtrmtZoneNm', title: '처리구역' }, { id: 'aplcnYm', title: '상수사용연월' }, { id: 'drtwSwtcRt', title: '오수 전환율' }, { id: 'srcNm', title: 'RTX 계수 출처' }, diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 4759a2877..38d3e689f 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -27,7 +27,7 @@ const tableColumn = [ // { id: 'no', title: '번호' }, { id: 'inftwtAnlsSn', title: '분석번호' }, { id: 'swageTmplntNm', title: '하수처리장' }, - { id: 'swtrmtZoneNm', title: '처리구역' }, + // { id: 'swtrmtZoneNm', title: '처리구역' }, { id: 'aplcnYm', title: '적용연월' }, { id: 'drtwSwtcRt', title: '오수 전환율' }, { id: 'anlsInfo', title: '침입수 분석정보' }, From 34145fbc2816f39d9321d3298053b4a0ddb6f844 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 24 Jun 2025 09:06:35 +0900 Subject: [PATCH 011/259] =?UTF-8?q?feat:=20=ED=8F=AC=ED=8A=B8=203002?= =?UTF-8?q?=EB=B2=88=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/package.json b/apps/sn/package.json index caac2aadb..fb8707352 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev -p 3000", + "dev": "next dev -p 3002", "build": "next build", "start": "next start", "lint": "next lint" From 774a7e084a91931d2993b8e6c040a1d7605f6efc Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 24 Jun 2025 09:12:11 +0900 Subject: [PATCH 012/259] =?UTF-8?q?feat:=20env=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- apps/sn/.env.local | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 apps/sn/.env.local diff --git a/.gitignore b/.gitignore index d0bb49da9..6b685ea40 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,5 @@ apps/wr/.next/**/* apps/fo/.next/**/* # env -.env* +#.env* .qodo diff --git a/apps/sn/.env.local b/apps/sn/.env.local new file mode 100644 index 000000000..a24d15e67 --- /dev/null +++ b/apps/sn/.env.local @@ -0,0 +1,13 @@ +NEXT_PUBLIC_PORT=3002 +NEXT_PUBLIC_SERVER_API_URL=http://dev.onasys.co.kr:8000 +# 개발 서버 API +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api +# 최용성 부장님 API +# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api +# 박이정 차장님 API +# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api +# NEXT_PUBLIC_SEWERAGE_API_URL=http://localhost:8883/sewerage-service/api +NEXT_PUBLIC_SITE_ID=SN +NEXT_PUBLIC_GEOSERVER_URL=http://rsone.iptime.org:10010/geoserver/ +export const CLAIM_NAME = Authorization +export const AUTH_USER_ID = token-id \ No newline at end of file From de96cb5acb456d10b0b8d702064996595f82a82c Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 24 Jun 2025 11:02:01 +0900 Subject: [PATCH 013/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98?= =?UTF-8?q?=EB=B6=84=EC=84=9D,=20RDII=20=EB=B6=84=EC=84=9D=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=95=98=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5?= =?UTF-8?q?=EB=AA=85=20requestDTO=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx | 10 +++++++--- apps/sn/app/(with-base-layout)/ii/rdii/page.tsx | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 03eeec3cf..3b68f494a 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -6,7 +6,7 @@ import { DatePicker, filePicked } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { Input } from '@common/components/ui' import { zodResolver } from '@hookform/resolvers/zod' -import { useState } from 'react' +import { useState, useEffect } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' import { excelToFlowRateData, excelToMatchingResultData, excelToTimePatternData } from '@/components/lib/utils' @@ -213,8 +213,12 @@ const IrSetting = () => { enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) - swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) ? select4.toString() : null, // 하수처리장코드 (선택값) - swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) ? select5.toString() : null, // 하수처리구역코드 (선택값) + swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) + ? select4.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리장코드 (선택값) + swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) + ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리구역코드 (선택값) aplcnYm: new Date(selectedDate).toISOString().substring(0, 7).replace("-", ""), // 적용연월 drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환) anlsInfo: input2, // 분석정보 diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index ff069d7c3..6ddf2fcb2 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -226,8 +226,12 @@ export default function RTKForm() { aplcnYm: new Date(formData.date).toISOString().substring(0, 7).replace("-", ""), // 적용연월 (YYYYMM 형식) ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) - swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) ? select4.toString() : null, // 하수처리장코드 (선택값) - swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) ? select5.toString() : null, // 하수처리구역코드 (선택값) + swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) + ? select4.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리장코드 (선택값) + swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) + ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리구역코드 (선택값) atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) atflId: file1?.atflId, // 첨부파일ID (오수관망도) atflInpNm: file1?.file?.name || "", // 오수관망도 파일명 From 04d43408f7ae71f3d37747b95f508f48e2e869f2 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 24 Jun 2025 12:14:54 +0900 Subject: [PATCH 014/259] =?UTF-8?q?feat:=20-=20=ED=95=98=EC=88=98=EC=9E=AC?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=EC=8B=9C=EC=84=A4,=20=EB=B9=97=EB=AC=BC?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=EC=8B=9C=EC=84=A4,=20=EC=A4=91=EC=88=98?= =?UTF-8?q?=EB=8F=84=EC=8B=9C=EC=84=A4,=20=EC=98=A8=EB=B0=B0=EC=88=98?= =?UTF-8?q?=EC=8B=9C=EC=84=A4=20=ED=99=94=EB=A9=B4=EC=9D=98=20=ED=98=84?= =?UTF-8?q?=ED=99=A9(=EC=A7=80=EB=8F=84),=20=EB=AA=A9=EB=A1=9D,=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20UI=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=20(=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=20=EB=AF=B8=EA=B5=AC=ED=98=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/htdflPrfmncSttnPopup.tsx | 621 ++++++++++++++++++ apps/wr/app/map/htdflSttn/page.tsx | 142 ++-- apps/wr/app/map/mapSearchBar.tsx | 192 ++++-- apps/wr/app/map/mapSearchForm.tsx | 4 +- apps/wr/app/map/newWindowPopup.tsx | 380 +++++++++++ apps/wr/app/map/newWindowPortal.tsx | 90 +++ apps/wr/app/map/pbnstPrfmncSttnPopup.tsx | 596 +++++++++++++++++ apps/wr/app/map/rainPrfmncSttnPopup.tsx | 421 ++++++++++++ apps/wr/app/map/rswtrPrfmncSttnPopup.tsx | 404 ++++++++++++ apps/wr/app/page.tsx | 2 +- .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 34 +- .../sttn/pbnstSttnModal/pbnstSttnModal.tsx | 18 +- .../business_components/src/ui/map/Gis.js | 182 ++++- .../business_components/src/ui/map/GisTree.js | 7 +- 14 files changed, 2921 insertions(+), 172 deletions(-) create mode 100644 apps/wr/app/map/htdflPrfmncSttnPopup.tsx create mode 100644 apps/wr/app/map/newWindowPopup.tsx create mode 100644 apps/wr/app/map/newWindowPortal.tsx create mode 100644 apps/wr/app/map/pbnstPrfmncSttnPopup.tsx create mode 100644 apps/wr/app/map/rainPrfmncSttnPopup.tsx create mode 100644 apps/wr/app/map/rswtrPrfmncSttnPopup.tsx diff --git a/apps/wr/app/map/htdflPrfmncSttnPopup.tsx b/apps/wr/app/map/htdflPrfmncSttnPopup.tsx new file mode 100644 index 000000000..8d1bec486 --- /dev/null +++ b/apps/wr/app/map/htdflPrfmncSttnPopup.tsx @@ -0,0 +1,621 @@ +"use client"; + +import { + Form, + FormField, + FormUi, + SelectBox, +} from "@common/business_components/ui"; +import { Button, Input } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; +import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { + hdtflZod, + type customHtdflBdst, +} from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; +import { useEffect } from "react"; +import BdstReg from "@/components/ui/form/fcltReg/bdstReg/bdstReg"; +import { + formatCommaNumber, + handleCommaNumberChange, +} from "@/components/lib/func/commom"; +import { formH1Class } from "@/components/lib/class/comClass"; + +export default function HtdflPrfmncSttnPopup({ + htdflForm, + isModal, +}: { + htdflForm: customHtdflBdst; + isModal: boolean; +}) { + const { code, htdflBdstUpdate, htdflBdstReg } = useWrStore((state) => state); + + const defaultValues: z.infer = hdtflZod.parse({}); + + const form = useForm>({ + resolver: zodResolver(hdtflZod), + defaultValues: defaultValues, + }); + + const onSubmit = (values: z.infer) => { + if (isModal) { + htdflBdstReg(values, '41'); + } else { + htdflBdstUpdate(values, '41'); + } + }; + + + const cleanHtdflData = (raw: any): z.infer => { + return { + ...raw, + frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), + archChgPrmsnDt: raw?.archChgPrmsnDt + ? new Date(raw?.archChgPrmsnDt) + : null, + chgBuilding: (raw?.chgBuilding || []).map((item: any) => ({ + ...item, + archChgPrmsnDt: + item?.archChgPrmsnDt === null + ? new Date() + : new Date(item?.archChgPrmsnDt), + bdstChgNm: item?.bdstChgNm ?? "", // null → "" + })), + reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + ...item, + instlCmptnDt: new Date(item?.instlCmptnDt), + htdflObj: { + ...item?.htdflObj, + }, + })), + }; + }; + + useEffect(() => { + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); + + useEffect(() => { + if (hdtflZod) form.reset(cleanHtdflData(htdflForm)); + }, [htdflForm]); + + return ( +
+
+ + {/*
*/} +
+
+

온배수 시설 정보

+
+
+ + {isModal && htdflForm != undefined ? : <>} + {isModal ? ( +

+ 온배수 시설 정보{" "} +

+ ) : ( + <> + )} + +
+
+ ( + + + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+
+

+ 온배수 시설 운영현황 +

+
+ +
+
+ ( + + { + field.onChange(Number(e.target.value)); + }} + readOnly={true} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ ( + + + + )} + /> +
+
+ +
+

+ 요구수질 +

+
+ +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ +
+
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + + )} + /> +
+
+ + +
+ ); +} diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx index 6c75edb92..5ba199c8c 100644 --- a/apps/wr/app/map/htdflSttn/page.tsx +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -1,18 +1,23 @@ "use client"; import Gis from "@common/business_components/ui/map/Gis"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState, useCallback } from "react"; import FeatureClickEventPopup from "../featureClickEventPopup"; import { mapService } from "../service"; import { MapSearchBar } from "../mapSearchBar"; +import NewWindowPopup from "../newWindowPopup"; +import GisApp from "@common/business_components/ui/map/lib/gis.core"; const Map = () => { const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정 const [selectedFeature, setSelectedFeature] = useState(null); // 선택된 피처 상태 - const gisMaps = useRef(null); + const gisMaps = useRef(null); const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 const [isSearchModalOpen, setIsSearchModalOpen] = useState(true); // SearchModal 열림 상태 const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터 + const [checkedLayers, setCheckedLayers] = useState([]); + const [checkedLayersData, setCheckedLayersData] = useState([]); + const fetchData = async () => { try { const response = await mapService.getLyrStngs(); @@ -22,80 +27,92 @@ const Map = () => { } }; + // 팝업 닫기 핸들러를 useCallback으로 메모이제이션 + const handlePopupClose = useCallback(() => { + setIsOpen(false); + setFeatureData(null); + }, []); + // 컴포넌트 마운트 시 1회 실행 useEffect(() => { fetchData(); }, []); + // 체크된 레이어 정보를 받는 핸들러 + const handleCheckedLayersChange = (checkedIds: string[], checkedNodesData: any[]) => { + setCheckedLayers(checkedIds); + setCheckedLayersData(checkedNodesData); + }; + // SearchModal, GisContent 등에서 호출 - // const onFeatureSelect = (data: any) => { - // let map = gisMaps.current; - // if (!map) { - // console.warn("지도가 초기화되지 않았습니다."); - // return; - // } + const onFeatureSelect = (data: any) => { + let map = gisMaps.current; + if (!map) { + console.warn("지도가 초기화되지 않았습니다."); + return; + } - // // 항상 같은 select 객체 사용 - // const select = GisApp.Module.select as any; - // if (!select) return; + // 항상 같은 select 객체 사용 + const select = GisApp.Module.select as any; + if (!select) return; - // // 1. 기존 선택 초기화 - // select.resetSelectedFeature(); + // 1. 기존 선택 초기화 + select.resetSelectedFeature(); - // // 2. data가 OpenLayers Feature 인스턴스인지 확인 - // let foundFeature = null; - // if ( - // data && - // typeof data.getGeometry === "function" && - // typeof data.setStyle === "function" - // ) { - // // 이미 Feature 인스턴스라면 그대로 사용 - // foundFeature = data; - // } else { - // // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용 - // const featureId = data.fid || data.ftrIdn || data.id; - // map - // .getLayers() - // .getArray() - // .forEach((layer: any) => { - // const source = layer.getSource?.(); - // if (source?.getFeatureById) { - // const feature = source.getFeatureById(String(featureId).trim()); - // if (feature) foundFeature = feature; - // } - // }); - // } + // 2. data가 OpenLayers Feature 인스턴스인지 확인 + let foundFeature = null; + if ( + data && + typeof data.getGeometry === "function" && + typeof data.setStyle === "function" + ) { + // 이미 Feature 인스턴스라면 그대로 사용 + foundFeature = data; + } else { + // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용 + const featureId = data.fid || data.ftrIdn || data.id; + map + .getLayers() + .getArray() + .forEach((layer: any) => { + const source = layer.getSource?.(); + if (source?.getFeatureById) { + const feature = source.getFeatureById(String(featureId).trim()); + if (feature) foundFeature = feature; + } + }); + } - // // 3. 피처 선택 - // if (foundFeature) { - // let geometry = foundFeature.getGeometry(); - // if (geometry) { - // let extent = geometry.getExtent(); + // 3. 피처 선택 + if (foundFeature) { + let geometry = foundFeature.getGeometry(); + if (geometry) { + let extent = geometry.getExtent(); - // map.getView().fit(extent, { - // duration: 300, - // padding: [50, 50, 50, 50], - // maxZoom: 16, - // constrainResolution: true, - // nearest: true, - // }); - // } - // select.selectFeature(foundFeature, true); - // } else { - // console.warn("OpenLayers Feature를 찾을 수 없습니다:", data); - // } + map.getView().fit(extent, { + duration: 300, + padding: [50, 50, 50, 50], + maxZoom: 16, + constrainResolution: true, + nearest: true, + }); + } + select.selectFeature(foundFeature, true); + } else { + console.warn("OpenLayers Feature를 찾을 수 없습니다:", data); + } - // setFeatureData(data); - // setIsOpen(true); - // setIsSearchModalOpen(false); - // }; + setFeatureData(data); + setIsOpen(true); + setIsSearchModalOpen(false); + }; // MapSearchBar 래퍼 컴포넌트 const CustomMapSearchBar = (props: any) => { return ( ); @@ -109,13 +126,20 @@ const Map = () => { gisMaps={gisMaps} isMiniMap={true} searchView={CustomMapSearchBar} - detailView={FeatureClickEventPopup} + detailView={(props: any) => ( + + )} + onFeatureSelect={undefined} setIsOpen={setIsOpen} setFeatureData={setFeatureData} featureData={featureData} setIsSearchModalOpen={setIsSearchModalOpen} isOpen={isOpen} isSearchModalOpen={isSearchModalOpen} + onCheckedLayersChange={handleCheckedLayersChange} />
); diff --git a/apps/wr/app/map/mapSearchBar.tsx b/apps/wr/app/map/mapSearchBar.tsx index 86e9f939a..f5d693ee3 100644 --- a/apps/wr/app/map/mapSearchBar.tsx +++ b/apps/wr/app/map/mapSearchBar.tsx @@ -2,15 +2,35 @@ import { Button, Input, Label } from "@common/components/ui"; import React, { useCallback, useEffect, useRef, useState, useMemo } from "react"; -import { SearchFormLeft, type EnvPartSelectDataType } from "@common/business_components/ui/search_form_left"; -import { SearchFormRight } from "@common/business_components/ui/search_form_right"; -import type { SelectDataType } from "@common/business_components/ui/search_input_select"; -import type { ReturnType } from "@common/business_components/ui/search_base_form"; +import { useForm } from "react-hook-form"; import { MapSearchFormLeft } from "./mapSearchForm"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; -import { SelectBox } from "@common/business_components/ui/select"; import { SearchBaseForm } from "@common/business_components"; +import { FormUi, SelectBox, SearchFormLeft, SearchFormRight, Form, FormField } from "@common/business_components/ui"; +import type { ReturnType, SelectDataType, EnvPartSelectDataType } from "@common/business_components/ui"; +import SearchInputText from "@/components/ui/searchInput/searchInput"; +import { zodResolver } from "@hookform/resolvers/zod"; + + +// 건물 검색 타입 정의 +interface BuildingInfo { + bdstInfoPk: number; + ctpvCd: number; + sggCd: number; + daddr: string; + bdstNm: string; + frstArchPrmsnDt: string; + archArea: number; + ctpvNm: string | null; + sggNm: string | null; + lat: number | null; + lot: number | null; + regDt: string; + rgtr: string | null; + mdfcnDt: string; + mdfr: string | null; +} type SearchBaseType = { searchType: string; @@ -20,8 +40,6 @@ type SearchBaseType = { selectUnitWaterShedData?: SelectDataType[] | []; selectMiddleRegionData?: SelectDataType[] | []; selectEnvPartData?: EnvPartSelectDataType[] | []; - queryClick: (returnType: ReturnType) => void; - initClick: () => void; onFeatureSelect: () => void; btnClass?: string; ref?: React.RefObject; @@ -58,8 +76,6 @@ export function MapSearchBar({ selectMiddleRegionData, selectEnvPartData, btnClass, - queryClick, - initClick, onFeatureSelect, isAdmin = false, leftClassName, @@ -77,6 +93,10 @@ export function MapSearchBar({ const [isChHead, setIsChHead] = useState(false); const ref = useRef({} as ReturnType); + const [selectedBuilding, setSelectedBuilding] = useState(null); + const [buildingSearchText, setBuildingSearchText] = useState(""); + const [buildingList, setBuildingList] = useState([]); + // 전체 목록 const [partValue, setPartValue] = useState("A"); const [sidoValue, setSidoValue] = useState("0"); @@ -97,15 +117,6 @@ export function MapSearchBar({ // 우리동네가뭄지도 필터 목록 const [selectedDong, setSelectedDong] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 // 행정동 - const [allSido, setAllSido] = useState([ - { text: "전체", val: '0' }, - ...(code?.cityCd || []) - ]); - const [allRegion, setAllRegion] = useState([ - { text: "전체", val: '0' }, - ...(code?.rvbsnCd || []) - ]); - const filteredSigunData = useMemo(() => { if (!selectedSido || selectedSido.val === '0' || !selectedSido.val) return [{ text: "전체", val: '0' }]; return [ @@ -130,26 +141,82 @@ export function MapSearchBar({ ]; }, [selectedSigun]); + // 건물 검색 API 호출 함수 + const searchBuildings = async (searchText: string) => { + if (!searchText.trim()) { + setBuildingList([]); + return; + } + + try { + const flg = "41"; // 적절한 플래그 값으로 설정 + const sigunCode = selectedSigun.val !== '0' ? selectedSigun.val : ''; + const apiEndpoint = `${API_URL}/v1/reuseFc/building/${flg}/${sigunCode}/${encodeURIComponent(searchText)}`; + + const response = await fetch(apiEndpoint, { + method: "GET", + headers: { + accept: "application/json", + "Content-Type": "application/json" + } + }); + + if (!response.ok) { + throw new Error(`API 호출 실패: ${response.status}`); + } + + const result = await response.json(); + + if (result.status === 200 && Array.isArray(result.data)) { + // 건물 검색 결과를 demandCompList 형태로 변환 + const convertedList = result.data.map((building: BuildingInfo) => ({ + dmdInfoPk: String(building.bdstInfoPk), + dmdCoNm: building.bdstNm, + daddr: building.daddr, + useUsgCd: "", + splyCpct: 0, + splyFmYn: "Y", + // 추가 필드들... + })); + setBuildingList(result.data); + // 글로벌 상태에도 업데이트 (SearchInputText가 사용할 수 있도록) + // getDemandCompList를 직접 호출하는 대신 상태를 직접 설정 + const { setBuildingSearchResults } = useWrStore.getState(); + if (setBuildingSearchResults) { + setBuildingSearchResults(convertedList); + } + } else { + setBuildingList([]); + } + } catch (error) { + console.error("건물 검색 중 오류 발생:", error); + setBuildingList([]); + } + }; + + // 조회 함수 const queryVal = () => { + console.log("조회버튼 클릭"); if (searchType == '공급처 후보지 조회') { + // queryClick({ + // partValue: partValue, + // sidoValue: sidoValue, + // sigunValue: sigunValue, + // regionValue: regionValue, + // unitWaterShedValue: untitWaterShedValue, + // middleRegionValue: middleRegionValue, + // envPartValue: envPartValue, + // sidoText: selectedSido.text, + // sigunText: selectedSigun.text, + // }); } else if (searchType == '우리동네가뭄지도보기') { } else if (searchType == '지도보기') { - console.log("조회버튼 클릭"); - queryClick({ - partValue: partValue, - sidoValue: sidoValue, - sigunValue: sigunValue, - regionValue: regionValue, - unitWaterShedValue: untitWaterShedValue, - middleRegionValue: middleRegionValue, - envPartValue: envPartValue, - sidoText: selectedSido.text, - sigunText: selectedSigun.text, - }); + } } - const initVal = useCallback(() => { + // 초기화 함수 + const initVal = () => { setPartValue("A"); setSidoValue("0"); setSigunValue("0"); @@ -164,13 +231,12 @@ export function MapSearchBar({ setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); setResetTrigger(true); - - initClick(); // 부모로부터 받은 초기화 함수 호출 - }, [initClick]); + }; - const applyVal = useCallback(() => { - onFeatureSelect - }, [onFeatureSelect]); + // 적용 버튼 + const applyVal = () => { + onFeatureSelect(); + }; useEffect(() => { if (resetTrigger) { @@ -251,10 +317,11 @@ export function MapSearchBar({ { const selected = code.cityCd.find(item => (item.val === val)); setSelectedSido(selected || { text: "전체", val: '0' }); + setSelectedSigun({ text: "전체", val: '0' }); }} value={selectedSido.val} selectClass={'w-32'} @@ -266,24 +333,39 @@ export function MapSearchBar({ onSelectValue={(val) => { const selected = filteredSigunData.find(item => (item.val === val)); setSelectedSigun(selected || { text: "전체", val: '0' }); + setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); }} value={selectedSigun.val} selectClass={'w-32'} /> - { - const selected = allFclt.find(item => (item.val === val)); - setSelectedFclt(selected || { text: "전체", val: '0', sggNm: '전체' }); - }} - value={selectedFclt.val} - selectClass={'w-32'} - /> - + {/*
+
*/} +
+ +
+ { + setBuildingSearchText(searchText || ""); + if (searchText) { + searchBuildings(searchText); + } + }} + setRtnData={(buildingData) => { + if (buildingData && buildingData.length > 0 && buildingData[0]) { + // 선택된 건물 정보를 찾아서 설정 + const selectedBuildingInfo = buildingList.find(building => + building.bdstNm === buildingData[0].dmdCoNm + ); + setSelectedBuilding(selectedBuildingInfo || null); + console.log("선택된 시설:", selectedBuildingInfo); + } + }} + /> +
)} @@ -292,13 +374,14 @@ export function MapSearchBar({ { const selected = code.cityCd.find(item => (item.val === val)); setSelectedSido(selected || { text: "전체", val: '0' }); + setSelectedSigun({ text: "전체", val: '0' }); }} value={selectedSido.val} - selectClass={'w-32'} + selectClass={'w-44'} /> { const selected = filteredSigunData.find(item => (item.val === val)); setSelectedSigun(selected || { text: "전체", val: '0' }); + setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); }} value={selectedSigun.val} selectClass={'w-32'} @@ -329,9 +413,9 @@ export function MapSearchBar({
{/* SearchFormLeft 래퍼 */} ) : ( <> - onSelectValue(val.toString(), 'sido')} value={sidoValue} selectClass={'w-40'} /> - onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={'w-40'} /> + onSelectValue(val.toString(), 'sido')} value={sidoValue} selectClass={'w-44'} /> + onSelectValue(val.toString(), 'sigun')} value={sigunValue} selectClass={'w-44'} /> )}
diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx new file mode 100644 index 000000000..e67b2b0fb --- /dev/null +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -0,0 +1,380 @@ +import { useWrStore } from "@/app/store"; +import { btnClass } from "@/app/store/common/code"; +import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; +import { excelDownload } from "@/components/lib/func/commom"; +import { Title, UiTable, UITab, ContentsDiv } from '@common/business_components'; +import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; +import { Button } from "@common/components/ui"; +import React, { useCallback, useState, useEffect } from 'react'; +import NewWindowPortal from '@/app/map/newWindowPortal'; +import PbnstPrfmncSttnPopup from "@/app/map/pbnstPrfmncSttnPopup"; +import { PbnstSttnModal } from "@/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal"; +import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type"; +import type { chgBuilding, customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import RainPrfmncSttnPopup from "@/app/map/rainPrfmncSttnPopup"; +import RswtrPrfmncsSttnPopup from "@/app/map/rswtrPrfmncSttnPopup"; +import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; +import HtdflPrfmncSttnPopup from "@/app/map/htdflPrfmncSttnPopup"; +import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; + +interface NewWindowPopupProps { + featureData: any; + checkedLayers?: string[]; + checkedLayersData?: any[]; + onClose: () => void; +} + +// 탭 +const TABS = [ + { val: "0", text: "재이용시설1" }, + { val: "1", text: "재이용시설2" }, + { val: "2", text: "재이용시설n" }, +]; + +// 데이터의 속성(key)을 사용자에게 보여줄 한글 이름으로 변환하기 위한 맵 +// 실제 데이터에 맞게 이 부분을 확장해야 합니다. +const propertyNameMap: { [key: string]: string } = { + fid: '고유 ID', + fcltNm: '시설명', + opertDe: '운영일자', + addr: '주소', + // ... 필요한 만큼 속성 매핑 추가 +}; + +const NewWindowPopup: React.FC = ({ + featureData, + checkedLayers = [], + checkedLayersData = [], + onClose +}) => { + const [activeTab, setActiveTab] = useState(TABS[0]?.val ?? "0"); + const [showDetailView, setShowDetailView] = useState(false); // 상세정보 화면 표시 상태 추가 + + // onClose 함수를 useCallback으로 메모이제이션 + const memoizedOnClose = useCallback(() => { + onClose(); + }, [onClose]); + + // 하수재이용시설 변수 + const { + code, + pbnstSttn, + pbnstSttnSearch, + pbnSttnInit, + getPbnStnDetail, + pbnNmSearch, + } = useWrStore((state) => state); + const [bdstTable, setBdstTable] = useState(); + const [pageNation, setPageNation] = useState(1); + const [pbnDetaileData, setPbnDetaileData] = useState<{ + isModal: boolean; + data: customPbnst; + }>({ isModal: false, data: {} as customPbnst }); + + // 빗물재이용시설 변수 + const { rainSttn, rainSttnSearch, rainSttnInit } = useWrStore( + (state) => state + ); + const { rainSttnRes } = rainSttn; + const [rainTable, setRainTable] = useState(); + const [rainBdstChgProps, setRainBdstChgProps] = useState<{ + isOpen: boolean; + chBuilding: chgBuilding[]; + }>({ isOpen: false, chBuilding: [] }); + const [rainDetailModal, setRainDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false }); + + // 중수도시설 변수 + const { rswtSttn, rswtSttnSearch, rswtSttnInit } = useWrStore( + (state) => state + ); + const { rswtSttnRes } = rswtSttn; + const [rswtrTable, setRswtrTable] = useState(); + const [rswtrDetailModal, setRswtrDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false }); + const [rswtrBdstChgProps, setRswtrBdstChgProps] = useState<{ + isOpen: boolean; + chBuilding: chgBuilding[]; + }>({ isOpen: false, chBuilding: [] }); + + // 온배수시설 변수 + const { htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore((state) => state); + const { htdflSttnRes } = htdflSttn; + const [htdflTable, setHtdflTable] = useState(); + const [htdflDetailModal, setHtdflDetailModal] = useState<{ isOpen: boolean, data: customHtdflBdst | undefined }>({ data: undefined, isOpen: false }); + const [bdstChgProps, setBdstChgProps] = useState<{ isOpen: boolean, chBuilding: chgBuilding[] }>({ isOpen: false, chBuilding: [] }); + + if (!featureData) { + return null; + } + + // 2. RuseMngTable에 필요한 tableData를 생성합니다. (단일 행 데이터) + const tableData = [featureData]; + console.log("tableData", tableData); + + // 물재이용시설 cellClick 이벤트 (상세정보) + const pbnstCellClick = (index: number | undefined) => { + if ( + index !== undefined && + pbnstSttn.pbnstSttnRes && + pbnstSttn.pbnstSttnRes[index] + ) { + const pbnstRuseFcltPk = pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk; + getPbnStnDetail(pbnstRuseFcltPk); + } + }; + + useEffect(() => { + setBdstTable(pbnstSttn.pbnstSttnRes); + }, [pbnstSttn.pbnstSttnRes]); + + useEffect(() => { + if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk) setShowDetailView(true); + }, [pbnstSttn.pbnstDetail]); + + + // 빗물재이용시설 cellClick 이벤트 (상세정보) + const rainCellClick = (index: number | undefined, headId: string) => { + if ( + index !== undefined && + rainTable !== undefined && + headId !== 'chBuildingYn') { + setRainDetailModal({ isOpen: true, data: rainTable[index] }) + } else if (headId === 'chBuildingYn' && index !== undefined && rainTable !== undefined) { + if (rainTable[index] && rainTable[index]?.chgBuilding[0]?.bdstChgNm !== null) + setRainBdstChgProps({ isOpen: true, chBuilding: rainTable[index].chgBuilding }); + } + } + + // 중수도시설 cellClick 이벤트 (상세정보) + const rswtCellClick = (index: number | undefined, headId: string) => { + if (headId !== 'chBuildingYn' && index !== undefined && rswtrTable !== undefined) { + setRswtrDetailModal({ isOpen: true, data: rswtrTable[index] }) + } else if (headId === 'chBuildingYn' && index !== undefined && rswtrTable !== undefined) { + if (rswtrTable[index] && rswtrTable[index]?.chBuildingYn === 'Y') { + setRswtrBdstChgProps({ isOpen: true, chBuilding: rswtrTable[index].chgBuilding }); + } + } + } + + // 온배수시설 cellClick 이벤트 (상세정보) + const htdflCellClick = (index: number | undefined, headId: string) => { + if ( + headId !== "chBuildingYn" && + index !== undefined && + htdflTable !== undefined + ) { + setHtdflDetailModal({ isOpen: true, data: htdflTable[index] }); + } + }; + + const excelClick = useCallback(() => { + // if (codeData) pbnstSttnSearch(1, "10000", codeData); + excelDownload( + [[]], + "하수재이용시설 현황", + "sample_pbnstSttn.xlsx", + "A1:U2" + ); + }, [pbnstSttnSearch]); + + // 체크된 레이어에 따른 조건부 컴포넌트 렌더링 함수 + const renderConditionalContent = () => { + // 특정 레이어가 체크되었는지 확인 + const hasWaterTreatmentLayer = checkedLayersData.some(layer => + layer.data?.lyrNm?.includes('하수처리') || layer.data?.lyrNm?.includes('재이용시설') + ); + + // 재이용시설 + const isPbnst = false; + // 빗물이용시설 + const isRain = false; + // 중수도시설 + const isRswt = false; + // 온배수시설 + const isHtdfl = true; + + + return ( +
+ {/* 체크된 레이어가 없는 경우 (재이용시설 목록) */} + {isPbnst && ( + <> + {showDetailView ? ( + // 재이용시설 상세 + <> +
+ + </div> + <div className="flex justify-between items-center mb-8"> + <UITab + defaultValue={TABS[0]?.val} + tabList={TABS.map((tab) => ({ + value: tab.val, + label: tab.text, + onClick: () => setActiveTab(tab.val), + }))} + children={undefined} + /> + </div> + <PbnstSttnModal + data={pbnDetaileData.data || ({} as customPbnst)} + titleVisible={false} + /> + <PbnstPrfmncSttnPopup isVisible={false} /> + </> + ) : ( + // 재이용시설 목록 + <> + <div className="flex justify-between items-center"> + <Title title='하수재이용시설 현황' /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> + </div> + </div> + <UiTable + headName={[]} + tableData={bdstTable || []} + children={ + <HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} /> + } + headlist={pbnstSttn.pbnstSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + pbnstCellClick(index); + }} + onPageChange={setPageNation} + /> + </> + )} + </> + )} + {/* 빗물이용시설 */} + {isRain && ( + <> + {showDetailView ? ( + // 빗물이용시설 상세 + <> + <div className="flex justify-between items-center mb-4"> + <Title title='빗물이용시설 상세정보' /> + </div> + <RainPrfmncSttnPopup rainForm={rainDetailModal.data as customRainBdst} isModal={false} /> + {/* TODO: 지도 점검 결과 현황 추가 할 것 */} + </> + ) : ( + // 빗물이용시설 목록 + <> + <div className="flex justify-between items-center"> + <Title title='빗물이용시설 현황' /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> + </div> + </div> + <UiTable + headName={[]} + tableData={rainTable || []} + children={ + <HeadMakeColSpan upHeadList={rainSttn.rainSttNodeList} /> + } + headlist={rainSttn.rainSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + rainCellClick(index ?? undefined, headId) + }} + onPageChange={setPageNation} + /> + </> + )} + </> + )} + {/* 중수도시설 */} + {isRswt && ( + <> + {showDetailView ? ( + // 재이용시설 상세 + <> + <div className="flex justify-between items-center mb-4"> + <Title title='중수도시설 상세정보' /> + </div> + <RswtrPrfmncsSttnPopup rswtForm={rswtrDetailModal.data as customRswtBdst} isModal={false} /> + {/* TODO: 지도 점검 결과 현황 추가 할 것 */} + </> + ) : ( + // 재이용시설 목록 + <> + <div className="flex justify-between items-center"> + <Title title='중수도시설 현황' /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> + </div> + </div> + <UiTable + headName={[]} + tableData={rswtrTable || []} + children={ + <HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} /> + } + headlist={rswtSttn.rswtSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + rswtCellClick(index, headId); + }} + onPageChange={setPageNation} + /> + </> + )} + </> + )} + {/* 온배수시설 */} + {isHtdfl && ( + <> + {showDetailView ? ( + // 재이용시설 상세 + <> + <div className="flex justify-between items-center mb-4"> + <Title title='온배수시설 상세정보' /> + </div> + {/* <HtdflPrfmncSttnPopup htdflForm={htdflDetailModal.data as customHtdflBdst} isModal={false} /> */} + <HtdflPrfmncSttnPopup htdflForm={htdflDetailModal.data as customHtdflBdst} isModal={false} /> + </> + ) : ( + // 재이용시설 목록 + <> + <div className="flex justify-between items-center"> + <Title title='온배수시설 현황' /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> + </div> + </div> + <UiTable + headName={[]} + tableData={bdstTable || []} + children={ + <HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} /> + } + headlist={htdflSttn.htdflSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + htdflCellClick(index ?? undefined, headId); + }} + onPageChange={setPageNation} + /> + </> + )} + </> + )} + </div> + ); + }; + + return ( + <NewWindowPortal onClose={memoizedOnClose} title="시설 상세 정보"> + {/* 체크된 레이어에 따른 조건부 렌더링 */} + {renderConditionalContent()} + </NewWindowPortal> + ); +}; + +export default NewWindowPopup; \ No newline at end of file diff --git a/apps/wr/app/map/newWindowPortal.tsx b/apps/wr/app/map/newWindowPortal.tsx new file mode 100644 index 000000000..49949e0f4 --- /dev/null +++ b/apps/wr/app/map/newWindowPortal.tsx @@ -0,0 +1,90 @@ +import React, { useState, useEffect, useRef, useCallback } from 'react'; +import { createPortal } from 'react-dom'; + +// 현재 문서의 스타일(CSS)을 새 창으로 복사하는 함수 +const copyStyles = (sourceDoc: Document, targetDoc: Document) => { + Array.from(sourceDoc.styleSheets).forEach(styleSheet => { + try { + if (styleSheet.cssRules) { // <style> 태그로 주입된 CSS + const newStyleEl = sourceDoc.createElement('style'); + Array.from(styleSheet.cssRules).forEach(cssRule => { + newStyleEl.appendChild(sourceDoc.createTextNode(cssRule.cssText)); + }); + targetDoc.head.appendChild(newStyleEl); + } else if (styleSheet.href) { // <link> 태그로 연결된 CSS 파일 + const newLinkEl = sourceDoc.createElement('link'); + newLinkEl.rel = 'stylesheet'; + newLinkEl.href = styleSheet.href; + targetDoc.head.appendChild(newLinkEl); + } + } catch (e) { + console.warn('스타일시트를 복사할 수 없습니다:', e); + } + }); +}; + +interface NewWindowPortalProps { + children: React.ReactNode; + onClose: () => void; + title?: string; +} + +const NewWindowPortal: React.FC<NewWindowPortalProps> = ({ children, onClose, title = "Detail" }) => { + const [container, setContainer] = useState<HTMLElement | null>(null); + const newWindowRef = useRef<Window | null>(null); + const onCloseRef = useRef(onClose); + + // onClose 함수를 ref로 저장하여 의존성 문제 해결 + useEffect(() => { + onCloseRef.current = onClose; + }, [onClose]); + + const handleUnload = useCallback(() => { + onCloseRef.current(); + }, []); + + useEffect(() => { + // 이미 창이 열려있으면 새로 열지 않음 + if (newWindowRef.current && !newWindowRef.current.closed) return; + + // 1. 새 창을 열고 참조를 저장합니다. + newWindowRef.current = window.open('', title, 'width=1400,height=1024,resizable=yes,scrollbars=yes'); + + if (newWindowRef.current) { + newWindowRef.current.document.title = title; + + // 2. React 컴포넌트를 마운트할 컨테이너 div를 생성하여 새 창의 body에 추가합니다. + const div = newWindowRef.current.document.createElement('div'); + newWindowRef.current.document.body.appendChild(div); + setContainer(div); + + // 3. 메인 창의 스타일을 새 창으로 복사합니다. (매우 중요) + copyStyles(document, newWindowRef.current.document); + + // 4. 사용자가 창을 닫을 때 부모에게 알리기 위한 이벤트 리스너를 설정합니다. + // const handleUnload = () => { + // onClose(); + // }; + newWindowRef.current.addEventListener('unload', handleUnload); + + // 5. 컴포넌트가 사라질 때 창을 닫는 클린업 함수를 반환합니다. + return () => { + if (newWindowRef.current) { + newWindowRef.current.removeEventListener('unload', handleUnload); + if (!newWindowRef.current.closed) { + newWindowRef.current.close(); + } + } + }; + } else { + alert('팝업이 차단되었습니다. 팝업 차단을 해제하고 다시 시도해주세요.'); + onCloseRef.current(); + // onClose(); + } + }, [onClose, title]); + + // `createPortal`을 사용해 children을 새 창의 container div에 렌더링합니다. + return container ? createPortal(children, container) : null; +}; + +export default NewWindowPortal; \ No newline at end of file diff --git a/apps/wr/app/map/pbnstPrfmncSttnPopup.tsx b/apps/wr/app/map/pbnstPrfmncSttnPopup.tsx new file mode 100644 index 000000000..f6d870092 --- /dev/null +++ b/apps/wr/app/map/pbnstPrfmncSttnPopup.tsx @@ -0,0 +1,596 @@ +"use client"; + +import { useWrStore } from "@/app/store"; +import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType, type PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type"; +import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SelectBox, UiTable, type ChartConfig, type ReturnType } from "@common/business_components"; +import ListDiv from "@common/business_components/ui/list_div"; +import { useEffect, useRef, useState } from "react"; +import { Toaster } from "react-hot-toast"; + +interface PbnstPrfmncSttnPopupProps { + isVisible?: boolean; +} + +export default function PbnstPrfmncSttnPopup({ isVisible = true }: PbnstPrfmncSttnPopupProps) { + const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncInit, pbnstPrfmncSearch, prfmnc } = useWrStore((state) => state); + const { monthHeadList } = prfmnc + const { pbnstPrfHeadList, pbnstPrfmncRes, prfmncRes, rawData, selectYearList } = pbnstPrfmncSttn; + const [isChHead, setIsChHead] = useState(false); + const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear())); + const [toDate, setToDate] = useState<string>(String(new Date().getFullYear())); + const [year, setYear] = useState<string>(String(new Date().getFullYear())); + const [bdstTable, setbdstTable] = useState<FcPrfType[]>(); + const ref = useRef<ReturnType>({} as ReturnType); + const [swtrmtFcltNm, setSwtrmtFcltNm] = useState<string>(); + const [chartConfig, setChartConfig] = useState<ChartConfig>({}); + const [chartData, setChartData] = useState<dnChartForm[]>([]); + const [dnInUsage, setDnInUsage] = useState<dnChartForm[]>([]); + const [dnInChartConfig, setDnInChartConfig] = useState<ChartConfig>({}); + const [dnOutUsage, setDnOutUsage] = useState<dnChartForm[]>([]); + const [dnOutChartConfig, setDnOutChartConfig] = useState<ChartConfig>({}); + const [barData, setBarData] = useState<barChartForm[]>([]); + const [barChartConfig, setBarChartConfig] = useState<ChartConfig>({}); + const [prfData, setPrfData] = useState<any[]>(); + const [lnInChartConfig, setLnInChartConfig] = useState<ChartConfig>({}); + const [lnOutChartConfig, setLnOutChartConfig] = useState<ChartConfig>({}); + const [inLineData, setInLineData] = useState<{ + chartData1: lineChartDataProps[]; + chartData2: lineChartDataProps[]; + chartData3: lineChartDataProps[]; + chartData4: lineChartDataProps[]; + chartData5: lineChartDataProps[]; + chartData6: lineChartDataProps[]; + chartData7: lineChartDataProps[]; + chartData8: lineChartDataProps[]; + chartData9: lineChartDataProps[]; + }>(); + // const [lnInChartConfig, setLnInChartConfig] = useState<ChartConfig>({}); + const [outLineData, setOutLineData] = useState<{ + chartData1: lineChartDataProps[]; + chartData2: lineChartDataProps[]; + chartData3: lineChartDataProps[]; + chartData4: lineChartDataProps[]; + chartData5: lineChartDataProps[]; + chartData6: lineChartDataProps[]; + }>(); + + + + type dnChartForm = { label: string, val: number, fill?: string }; + type barChartForm = { label: string, "장내용수": number, "장외용수": number }; + type lineChartDataProps = { label: string, val: number, color: string }; + + const prfTableData = (prfList: PrfType[], year: string) => { + const inUsageData = initValInUsage; + const outUsageData = initValOutUsage; + + const inSubtotal = subTotalObj; + const outSubtotal = subTotalObj; + + console.log(' prfList ', prfList) + const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year) + if (prfList && prfFilter.length > 0) { + prfList?.forEach((prfItem) => { + const month = Number(prfItem?.ym?.slice(4)); // "MM" + const monthKey = `${month}월`; + + inUsageData.forEach((inData: any) => { + const usageKey = inData.usage; + const value = (prfItem as any)[usageKey] ?? 0; + + inData[monthKey] = value; + inData.total += value; + + if (inSubtotal && usageKey !== "subtotal") { + (inSubtotal as any)[monthKey] = + ((inSubtotal as any)[monthKey] ?? 0) + value; + inSubtotal.total += value; + } + }); + + outUsageData.forEach((outData: any) => { + const usageKey = outData.usage; + const value = (prfItem as any)[usageKey] ?? 0; + + outData[monthKey] = value; + outData.total += value; + + if (usageKey !== "subtotal") { + (outSubtotal as any)[monthKey] = + ((outSubtotal as any)[monthKey] ?? 0) + value; + outSubtotal.total += value; + } + }); + }); + inUsageData.push(inSubtotal); + outUsageData.push(outSubtotal); + const usageTotalObj: { [key: string]: any } = totalObj; + for (const key in usageTotalObj) { + if (["usage", "gubun", "edit"].includes(key)) continue; + const val = + (Number((inSubtotal as any)[key]) || 0) + + (Number((outSubtotal as any)[key]) || 0); + + (usageTotalObj as any)[key] = val; + } + const tableData = [...inUsageData, ...outUsageData, usageTotalObj]; + setPrfData(tableData); + + } else { + setPrfData([]); + } + } + useEffect(() => { + let wshwtr = 0; + let coolUswtr = 0; + let cleanUswtr = 0; + let drwtUswtr = 0; + let dltnUswtr = 0; + let ithlRswtr = 0; + let ithlEtcUswtr = 0; + let cleanToilUswtr = 0; + let resn = 0; + let lndwtr = 0; + let hydUswtr = 0; + let ugwtChr = 0; + let farmUswtr = 0; + let rvrKeepUswtr = 0; + let indstUswtr = 0; + if (rawData) { + rawData.forEach((item) => { + prfTableData(item.prfList, year); + item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + + wshwtr += element.wshwtr; //세척수 + coolUswtr += element.coolUswtr; //냉각수 + cleanUswtr += element.cleanUswtr; //청소수 + drwtUswtr += element.drwtUswtr; //식수대 + dltnUswtr += element.dltnUswtr //희석용수 + ithlRswtr += element.ithlRswtr //중수도 + ithlEtcUswtr += element.ithlEtcUswtr //기타 + cleanToilUswtr += element.cleanToilUswtr //청소화장실용수 + resn += element.resn //세척살수용수 + + lndwtr += element.lndwtr; //조경용수 + hydUswtr += element.hydUswtr; //친수용수 + ugwtChr += element.ugwtChr; //지하수충전 + farmUswtr += element.farmUswtr //농업용수 + rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수 + indstUswtr += element.indstUswtr //공업용수 + + }); + }) + const data: dnChartForm[] = [] + data?.push({ label: "세척수", val: wshwtr, fill: "red" }) + data?.push({ label: "냉각수", val: coolUswtr, fill: "orange" }) + data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }) + data?.push({ label: "식수대", val: drwtUswtr, fill: "green" }) + data?.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" }) + data?.push({ label: "중수도", val: ithlRswtr, fill: "blue" }) + data?.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" }) + data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" }) + data?.push({ label: "세척살수용수", val: resn, fill: "orange" }) + data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" }) + data?.push({ label: "친수용수", val: hydUswtr, fill: "green" }) + data?.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" }) + data?.push({ label: "농업용수", val: farmUswtr, fill: "blue" }) + data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" }) + data?.push({ label: "공업용수", val: indstUswtr, fill: "black" }) + setChartData(data); + } + }, [rawData, year]) + + + useEffect(() => { + const newChartConfig = chartData.reduce((config, element) => { + config[element.label] = { + label: element.label, + fill: element.fill + }; + return config; + }, {} as Record<string, { label: string; fill?: string }>) satisfies ChartConfig; + setChartConfig(newChartConfig); + }, [chartData]); + + // 장내용수 도넛차트 + useEffect(() => { + let wshwtr = 0; + let coolUswtr = 0; + let cleanUswtr = 0; + let drwtUswtr = 0; + let dltnUswtr = 0; + let ithlRswtr = 0; + let ithlEtcUswtr = 0; + let cleanToilUswtr = 0; + let resn = 0; + if (rawData) { + rawData.forEach((item) => { + item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + + wshwtr += element.wshwtr; //세척수 + coolUswtr += element.coolUswtr; //냉각수 + cleanUswtr += element.cleanUswtr; //청소수 + drwtUswtr += element.drwtUswtr; //식수대 + dltnUswtr += element.dltnUswtr //희석용수 + ithlRswtr += element.ithlRswtr //중수도 + ithlEtcUswtr += element.ithlEtcUswtr //기타 + cleanToilUswtr += element.cleanToilUswtr //청소화장실용수 + resn += element.resn //세척살수용수 + }); + }) + const data: dnChartForm[] = [] + data?.push({ label: "세척수", val: wshwtr, fill: "yellow" }) + data?.push({ label: "냉각수", val: coolUswtr, fill: "green" }) + data?.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }) + data?.push({ label: "식수대", val: drwtUswtr, fill: "green" }) + data?.push({ label: "희석용수", val: dltnUswtr, fill: "yellow" }) + data?.push({ label: "중수도", val: ithlRswtr, fill: "green" }) + data?.push({ label: "기타", val: ithlEtcUswtr, fill: "yellow" }) + data?.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "green" }) + data?.push({ label: "세척살수용수", val: resn, fill: "yellow" }) + setDnInUsage(data); + } + }, [rawData, year]) + + useEffect(() => { + const newChartConfig = dnInUsage.reduce((config, element) => { + config[element.label] = { + label: element.label, + fill: element.fill + }; + return config; + }, {} as Record<string, { label: string; color: string; }>) satisfies ChartConfig; + setDnInChartConfig(newChartConfig); + }, [dnInUsage]); + + // 장외용수 도넛차트 + useEffect(() => { + let lndwtr = 0; + let hydUswtr = 0; + let ugwtChr = 0; + let farmUswtr = 0; + let rvrKeepUswtr = 0; + let indstUswtr = 0; + if (rawData) { + rawData.forEach((item) => { + item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + lndwtr += element.lndwtr; //조경용수 + hydUswtr += element.hydUswtr; //친수용수 + ugwtChr += element.ugwtChr; //지하수충전 + farmUswtr += element.farmUswtr //농업용수 + rvrKeepUswtr += element.rvrKeepUswtr //하천등유지용수 + indstUswtr += element.indstUswtr //공업용수 + + }); + }) + const data: dnChartForm[] = [] + data?.push({ label: "조경용수", val: lndwtr, fill: "yellow" }) + data?.push({ label: "친수용수", val: hydUswtr, fill: "black" }) + data?.push({ label: "지하수충전", val: ugwtChr, fill: "yellow" }) + data?.push({ label: "농업용수", val: farmUswtr, fill: "black" }) + data?.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "yellow" }) + data?.push({ label: "공업용수", val: indstUswtr, fill: "black" }) + setDnOutUsage(data); + } + }, [rawData, year]) + + useEffect(() => { + const newChartConfig = dnOutUsage.reduce((config, element) => { + config[element.label] = { + label: element.label, + fill: element.fill + }; + return config; + }, {} as Record<string, { label: string; color: string; }>) satisfies ChartConfig; + setDnOutChartConfig(newChartConfig); + }, [dnOutUsage]); + + //월별 장내외 용수 총 실적 막대차트 + useEffect(() => { + let wshwtr = 0; + let coolUswtr = 0; + let cleanUswtr = 0; + let drwtUswtr = 0; + let dltnUswtr = 0; + let ithlRswtr = 0; + let ithlEtcUswtr = 0; + let cleanToilUswtr = 0; + let resn = 0; + let lndwtr = 0; + let hydUswtr = 0; + let ugwtChr = 0; + let farmUswtr = 0; + let rvrKeepUswtr = 0; + let indstUswtr = 0; + let inUsageSum = 0; + let outUsageSum = 0; + let inUsageArr = []; + let outUsageArr = []; + + + if (rawData) { + const data: barChartForm[] = [] + rawData.forEach((item) => { + item.prfList + .filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + + wshwtr = element.wshwtr; //세척수 + coolUswtr = element.coolUswtr; //냉각수 + cleanUswtr = element.cleanUswtr; //청소수 + drwtUswtr = element.drwtUswtr; //식수대 + dltnUswtr = element.dltnUswtr //희석용수 + ithlRswtr = element.ithlRswtr //중수도 + ithlEtcUswtr = element.ithlEtcUswtr //기타 + cleanToilUswtr = element.cleanToilUswtr //청소화장실용수 + resn = element.resn //세척살수용수 + + lndwtr = element.lndwtr; //조경용수 + hydUswtr = element.hydUswtr; //친수용수 + ugwtChr = element.ugwtChr; //지하수충전 + farmUswtr = element.farmUswtr //농업용수 + rvrKeepUswtr = element.rvrKeepUswtr //하천등유지용수 + indstUswtr = element.indstUswtr //공업용수 + + inUsageSum = wshwtr + coolUswtr + cleanUswtr + drwtUswtr + dltnUswtr + ithlRswtr + ithlEtcUswtr + cleanToilUswtr + resn; + inUsageArr.push(inUsageSum) + outUsageSum = lndwtr + hydUswtr + ugwtChr + farmUswtr + rvrKeepUswtr + indstUswtr; + outUsageArr.push(outUsageSum) + + const month = Number(element.ym.slice(4, 6)) + data.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum }) + + }, + ); + + }) + + setBarData(data); + } + }, [rawData, year]) + + useEffect(() => { + const newChartConfig = barData.reduce((config, element) => { + config[element.label] = { + label: element.label, + }; + return config; + + }, {} as Record<string, { label: string }>) satisfies ChartConfig; + setBarChartConfig(newChartConfig); + }, [barData]); + + //월별 장내 용수 실적 라인차트 + useEffect(() => { + + if (rawData) { + const wshwtrData: lineChartDataProps[] = [] + const coolUswtrData: lineChartDataProps[] = [] + const cleanUswtrData: lineChartDataProps[] = [] + const drwtUswtrData: lineChartDataProps[] = [] + const dltnUswtrData: lineChartDataProps[] = [] + const ithlRswtrData: lineChartDataProps[] = [] + const ithlEtcUswtrData: lineChartDataProps[] = [] + const cleanToilUswtrData: lineChartDataProps[] = [] + const resnData: lineChartDataProps[] = [] + rawData.forEach((item) => { + item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + const month = Number(element.ym.slice(4, 6)) + wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" }) + coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "red" }) + cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "red" }) + drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "red" }) + dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "red" }) + ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "red" }) + ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "red" }) + cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "red" }) + resnData.push({ label: `${month}월`, val: element.resn, color: "red" }) + + }, + ); + }) + const rtndata = { + chartData1: wshwtrData, + chartData2: coolUswtrData, + chartData3: cleanUswtrData, + chartData4: drwtUswtrData, + chartData5: dltnUswtrData, + chartData6: ithlRswtrData, + chartData7: ithlEtcUswtrData, + chartData8: cleanToilUswtrData, + chartData9: resnData + } + + setInLineData(rtndata) + } + }, [rawData, year]) + + useEffect(() => { + if (inLineData?.chartData1) { + const newChartConfig = { + chartData1: { + label: '세척수', + color: "red", + }, + chartData2: { + label: '냉각수', + color: "orange", + }, + chartData3: { + label: '청소수', + color: "yellow", + }, + chartData4: { + label: '식수대', + color: "pink", + }, + chartData5: { + label: '희석용수', + color: "purple", + }, + chartData6: { + label: '중수도', + color: "green", + }, + chartData7: { + label: '기타', + color: "blue", + }, + chartData8: { + label: '청소화장실용수', + color: "magenta", + }, + chartData9: { + label: '세척살수용수', + color: "skyblue", + }, + } satisfies ChartConfig; + setLnInChartConfig(newChartConfig); + } + }, [inLineData]); + + //월별 장외 용수 실적 라인차트 + useEffect(() => { + if (rawData) { + const lndwtrData: lineChartDataProps[] = [] + const hydUswtrData: lineChartDataProps[] = [] + const ugwtChrData: lineChartDataProps[] = [] + const farmUswtrData: lineChartDataProps[] = [] + const rvrKeepUswtrData: lineChartDataProps[] = [] + const indstUswtrData: lineChartDataProps[] = [] + rawData.forEach((item) => { + item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { + const month = Number(element.ym.slice(4, 6)) + lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }) + hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "red" }) + ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "red" }) + farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "red" }) + rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "red" }) + indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "red" }) + }, + ); + }) + setOutLineData({ + chartData1: lndwtrData, + chartData2: hydUswtrData, + chartData3: ugwtChrData, + chartData4: farmUswtrData, + chartData5: rvrKeepUswtrData, + chartData6: indstUswtrData, + }) + } + }, [rawData, year]) + + useEffect(() => { + if (outLineData?.chartData1) { + const newChartConfig = { + chartData1: { + label: '조경용수', + color: "red", + }, + chartData2: { + label: '친수용수', + color: "orange", + }, + chartData3: { + label: '지하수충전', + color: "yellow", + }, + chartData4: { + label: '농업용수', + color: "green", + }, + chartData5: { + label: '하천등유지용수', + color: "blue", + }, + chartData6: { + label: '공업용수', + color: "purple", + }, + } satisfies ChartConfig; + setLnOutChartConfig(newChartConfig); + } + }, [outLineData]); + + useEffect(() => { + if (!pbnstPrfmncSttn.isInit) { + pbnstPrfmncInit("1", "11"); + } + }, [pbnstPrfmncSttn.isInit, pbnstPrfmncInit]); + + useEffect(() => { + setbdstTable(prfmncRes); + }, [prfmncRes]); + + return ( + <> + <ContentsDiv> + <ListDiv> + <hr /> + <h3 className="mt-4 ml-2 text-2xl font-medium text-label">하수재이용실적 상세현황</h3> + + <SelectBox + className="w-1/12 text-2xl mt-4 ml-2" + label="연도" + selectClass={""} + selectArray={selectYearList} + value={year} + onSelectValue={(val: string | number) => setYear(String(val))} /> + <h1 className="mt-4 ml-2">장내·외 용도별 하수재이용실적 현황(계)</h1> + + <div className="flex"> + <div className="w-1/3"> + <MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적"} chartForm={CHART_FORM.DN} /> + </div> + <div className="w-1/3"> + <MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적"} chartForm={CHART_FORM.DN} /> + </div> + <div className="w-1/3"> + <MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적"} chartForm={CHART_FORM.DN} /> + </div> + </div> + <h1 className="">장내·외 월별 하수재이용실적 현황</h1> + <div className="flex"> + <div className="w-1/3"> + <MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} /> + </div> + <div className="w-1/3"> + <MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적"} chartForm={CHART_FORM.LINE} /> + </div> + <div className="w-1/3"> + <MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적"} chartForm={CHART_FORM.LINE} /> + </div> + </div> + {/* 하수재이용실적 현황 - 조건부 렌더링 */} + {isVisible && ( + <> + <h1 className="">하수재이용실적 현황</h1> + <ListDiv className="col-span-8 pr-6 "> + <ScrollArea className="h-[60vh]"> + <div className="card-header"> + <h3 className="text-2xl font-medium text-label"> + {"하수처리수재이용 실적(m3) 등록결과"} + </h3> + </div> + + <UiTable + headName={undefined} + tableData={prfData || []} + headlist={monthHeadList} + pageSize={0} + total={0} + cellClick={undefined} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }}> + </UiTable> + </ScrollArea> + </ListDiv> + </> + )} + </ListDiv> + </ContentsDiv> + <Toaster position="top-center" /> + </> + ) +} diff --git a/apps/wr/app/map/rainPrfmncSttnPopup.tsx b/apps/wr/app/map/rainPrfmncSttnPopup.tsx new file mode 100644 index 000000000..18cdac8e6 --- /dev/null +++ b/apps/wr/app/map/rainPrfmncSttnPopup.tsx @@ -0,0 +1,421 @@ +"use client"; + +import { useWrStore } from "@/app/store"; +import { + rainZod, + selectClass, + TEST_UUID, + type customRainBdst, +} from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { DatePicker, FormUi } from "@common/business_components"; +import { Form, FormField, SelectBox } from "@common/business_components/ui"; +import { Button, Input } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useEffect, useState } from "react"; +import { useForm, useWatch, type UseFormReturn } from "react-hook-form"; +import { z } from "zod"; +import BdstReg from "@/components/ui/form/fcltReg/bdstReg/bdstReg"; +import { + formatCommaNumber, + handleCommaNumberChange, +} from "@/components/lib/func/commom"; +import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; +import { Label } from "@common/business_components/ui/form/lib/label"; + +export default function RainPrfmncSttnPopup({ + rainForm, + isModal, +}: { + rainForm: customRainBdst; + isModal: boolean; +}) { + const { code, rainBdstReg, rainBdstUpdate, rain } = useWrStore( + (state) => state + ); + const { rainFcltCd } = code; + const defaultValues: z.infer<typeof rainZod> = rainZod.parse({}); + + const form = useForm<z.infer<typeof rainZod>>({ + resolver: zodResolver(rainZod), + defaultValues: defaultValues, + }); + + const [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn] = form.watch([ + "reuseBuilding.0.grntchBdstCertYn", + "reuseBuilding.0.instlCstSprtYn", + "reuseBuilding.0.rainyObj.filtrTrtmfctYn", + ]); + + const cleanRainData = (raw: any): z.infer<typeof rainZod> => { + return { + ...raw, + frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), + archChgPrmsnDt: raw?.archChgPrmsnDt + ? new Date(raw?.archChgPrmsnDt) + : null, + reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + ...item, + instlCmptnDt: new Date(item?.instlCmptnDt), + operMngCd: item?.operMngCd ?? "", // null → "" + grntchBdstCertYr: + typeof item?.grntchBdstCertYr === "string" + ? item?.grntchBdstCertYr + : "", // null → "" + rainObj: { + ...item?.rainObj, + }, + })), + }; + }; + + useEffect(() => { + if (grntchBdstCertYn === "N") { + form.setValue("reuseBuilding.0.grntchBdstCertYr", ""); + form.setValue("reuseBuilding.0.grntchBdstCertNo", ""); + form.setValue("reuseBuilding.0.grntchBdstCertGrd", ""); + } else if (instlCstSprtYn === "N") { + form.setValue("reuseBuilding.0.instlCstSprtAmt", 0); + } else if (filtrTrtmfctYn === "N") { + form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctCpct", 0); + form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctPrs", ""); + } + }, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn]); + + // form 값이 변경될 때마다 로그 출력 + useEffect(() => { + const subscription = form.watch((value) => { + }); + + + return () => subscription.unsubscribe(); + }, [form]); + + useEffect(() => { + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); + + const onSubmit = (values: z.infer<typeof rainZod>) => { + if (isModal) { + rainBdstReg(values, "41"); + } else { + rainBdstUpdate(values, "41"); + } + }; + + useEffect(() => { + if (rainZod) form.reset(cleanRainData(rainForm)); + }, [rainForm]); + + + return ( + <div className="!mx-[1.6rem] !p-0r"> + <Form {...form}> + <form onSubmit={form.handleSubmit(onSubmit)}> + <div> + <div className="grid grid-cols-12 flex items-center card-header"> + <h1 className="text-2xl font-medium text-label col-span-10"> + {isModal ? "건축물 운영정보" : "빗물이용시설 정보"} + </h1> + </div> + </div> + {isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>} + {isModal ? ( + <h1 className="pl-3 text-xl col-span-10 mt-4"> + 빗물이용시설 정보{" "} + </h1> + ) : ( + <></> + )} + <h1 className={formH1Class}> + 기본정보 + </h1> + + <div className="grid grid-cols-4 gap-2 mt-4"> + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCmptnDt" + render={({ field }) => ( + <FormUi label="설치완료일"> + <DatePicker + mode="single" + field={{ + value: + field.value && !isNaN(new Date(field.value).getTime()) + ? new Date(field.value) + : new Date(), // Provide a default Date value + onChange: (date) => field.onChange(date), + }} + selectClass={"w-full"} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCst" + render={({ field }) => ( + <FormUi label="설치비"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + </div> + <div className=""> + <h1 className={formH1Class}> + 빗물이용시설 정보 + </h1> + </div> + <div> + <h2 className={formH2Class}>집수면</h2> + </div> + <div className="grid grid-cols-10 gap-4 mt-4 "> + <div className="col-span-5"> + <FormField + control={form.control} + name="reuseBuilding.0.rainyObj.pntfColKnd" + render={({ field }) => ( + <FormUi label="종류"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={rainFcltCd} + onSelectValue={field.onChange} + value={field.value ?? rainFcltCd[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5"> + <FormField + control={form.control} + name="reuseBuilding.0.rainyObj.pntfColArea" + render={({ field }) => ( + <FormUi label="면적(m³)"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + /> + </FormUi> + )} + /> + </div> + </div> + + <div> + <h2 className={formH2Class}>여과 등 처리시설</h2> + </div> + <div className="grid grid-cols-12 gap-2 mt-4"> + <div className="col-span-4"> + <FormField + control={form.control} + name="reuseBuilding.0.rainyObj.filtrTrtmfctYn" + render={({ field }) => ( + <FormUi label="유무"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={code.yn} + onSelectValue={field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-4"> + <FormField + control={form.control} + name="reuseBuilding.0.rainyObj.filtrTrtmfctCpct" + render={({ field }) => ( + <FormUi label="용량(m³/일)"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={filtrTrtmfctYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-4"> + <FormField + control={form.control} + name="reuseBuilding.0.rainyObj.filtrTrtmfctPrs" + render={({ field }) => ( + <FormUi label="처리공정"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={filtrTrtmfctYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + </div> + <div className=" my-2"> + <h1 className={formH1Class}> + 인센티브 정보 + </h1> + </div> + <div> + <h2 className={formH2Class}>설치비 지원</h2> + </div> + <div className="grid grid-cols-10 gap-2 mt-4"> + <div className="col-span-5"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCstSprtYn" + render={({ field }) => ( + <FormUi label="지원 여부"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={code.yn} + onSelectValue={field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-5"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCstSprtAmt" + render={({ field }) => ( + <FormUi label="지원금액(원)"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={instlCstSprtYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + </div> + + <div> + <h2 className={formH2Class}>녹색건축물 인증</h2> + </div> + <div className="grid grid-cols-6 gap-2 mt-4"> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertYn" + render={({ field }) => ( + <FormUi label="인증여부"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={code.yn} + onSelectValue={field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertYr" + render={({ field }) => ( + <FormUi label="인증년도"> + <Input + className={'w-full !text-xl'} + placeholder="2024" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={grntchBdstCertYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3 "> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertNo" + render={({ field }) => ( + <FormUi label="인증번호"> + <Input + className={'w-full !text-xl'} + placeholder="ab1234678" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={grntchBdstCertYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertGrd" + render={({ field }) => ( + <FormUi label="인증등급"> + <Input + className={'w-full !text-xl'} + placeholder="A" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={grntchBdstCertYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + </div> + </form> + </Form> + </div> + ); +} diff --git a/apps/wr/app/map/rswtrPrfmncSttnPopup.tsx b/apps/wr/app/map/rswtrPrfmncSttnPopup.tsx new file mode 100644 index 000000000..e7f94a3b5 --- /dev/null +++ b/apps/wr/app/map/rswtrPrfmncSttnPopup.tsx @@ -0,0 +1,404 @@ +"use client"; + +import { + DatePicker, + Form, + FormField, + FormUi, + SelectBox, +} from "@common/business_components/ui"; +import { Button, Input } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; +import { useWrStore } from "@/app/store"; +import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { + rswtZod, + type customRswtBdst, +} from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; +import { useEffect } from "react"; +import BdstReg from "@/components/ui/form/fcltReg/bdstReg/bdstReg"; +import { + formatCommaNumber, + handleCommaNumberChange, +} from "@/components/lib/func/commom"; +import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; +import { Label } from "@common/business_components/ui/form/lib/label"; + +export default function RswtrPrfmncsSttnPopup({ + rswtForm, + isModal, +}: { + rswtForm: customRswtBdst; + isModal: boolean; +}) { + const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore( + (state) => state + ); + + const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({}); + + const form = useForm<z.infer<typeof rswtZod>>({ + resolver: zodResolver(rswtZod), + defaultValues: defaultValues, + }); + + const [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctProcs] = form.watch([ + "reuseBuilding.0.grntchBdstCertYn", + "reuseBuilding.0.instlCstSprtYn", + "reuseBuilding.0.rswtrObj.filtrTrtmfctProcs", + ]); + + const onSubmit = (values: z.infer<typeof rswtZod>) => { + if (isModal) { + rswtBdstReg(values, "41"); + } else { + rswtBdstUpdate(values, "41"); + } + }; + const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => { + return { + ...raw, + frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), + archChgPrmsnDt: raw?.archChgPrmsnDt + ? new Date(raw?.archChgPrmsnDt) + : null, + reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + ...item, + instlCmptnDt: new Date(item?.instlCmptnDt), + operMngCd: item?.operMngCd ?? "", // null → "" + grntchBdstCertYr: + typeof item?.grntchBdstCertYr === "string" + ? item?.grntchBdstCertYr + : "", // null → "" + rswtrObj: { + ...item?.rswtrObj, + }, + })), + }; + }; + + useEffect(() => { + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); + + useEffect(() => { + console.log("filtrTrtmfctProcs ", filtrTrtmfctProcs); + if (grntchBdstCertYn === "N") { + form.setValue("reuseBuilding.0.grntchBdstCertYr", ""); + form.setValue("reuseBuilding.0.grntchBdstCertNo", ""); + form.setValue("reuseBuilding.0.grntchBdstCertGrd", ""); + } else if (instlCstSprtYn === "N") { + form.setValue("reuseBuilding.0.instlCstSprtAmt", 0); + } + }, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctProcs]); + + useEffect(() => { + if (rswtZod) form.reset(cleanRswtData(rswtForm)); + }, [rswtForm]); + + return ( + <div className="!mx-[1.6rem] !p-0r"> + <Form {...form}> + <form onSubmit={form.handleSubmit(onSubmit)}> + {/* <div className="flex justify-between items-center mx-3"> */} + <div> + <div className="grid grid-cols-12 flex items-center card-header"> + <h1 className="text-2xl font-medium text-label col-span-10"> + 건축물 운영정보 + </h1> + </div> + </div> + + {isModal && rswtForm != undefined ? <BdstReg form={form} /> : <></>} + {isModal ? ( + <h1 className="pl-3 text-xl col-span-10 mt-4 "> + 중수도 시설 정보{" "} + </h1> + ) : ( + <></> + )} + <h1 className={formH1Class}>기본정보</h1> + <div className="grid grid-cols-4 gap-2 mt-4"> + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCmptnDt" + render={({ field }) => ( + <FormUi label="설치완료일"> + <DatePicker + mode="single" + field={{ + value: + field.value && !isNaN(new Date(field.value).getTime()) + ? new Date(field.value) + : new Date(), // Provide a default Date value + onChange: (date) => field.onChange(date), + }} + selectClass={"w-full"} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCst" + render={({ field }) => ( + <FormUi label="설치비"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + </div> + <div className="grid grid-cols-4 gap-2 mt-4"> + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.rswtrObj.wtrUsqty" + render={({ field }) => ( + <FormUi label="물사용량(m³)"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + + <div className="col-span-2"> + <FormField + control={form.control} + name="reuseBuilding.0.rswtrObj.oblgTrgtWtrUsqty" + render={({ field }) => ( + <FormUi label="의무대상 물사용량(m³)"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + </div> + <div className=" my-4"> + <h1 className={formH1Class}>중수도 시설 정보</h1> + </div> + + <div className="grid grid-cols-12 gap-1 mt-4"> + <div className="col-span-4"> + <FormField + control={form.control} + name="reuseBuilding.0.rswtrObj.filtrTrtmfctCpct" + render={({ field }) => ( + <FormUi label="처리시설 용량"> + <Input + className={'w-full !text-xl'} + placeholder="0" + type="number" + value={field.value ?? ""} + onChange={(e)=>{field.onChange(Number(e.target.value))} } + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-4"> + <FormField + control={form.control} + name="reuseBuilding.0.rswtrObj.orgwtKndCd" + render={({ field }) => ( + <FormUi label="원수 종류"> + <SelectBox + className={""} + label={""} + selectClass={selectClass} + selectArray={code.orgwtKndCd} + onSelectValue={field.onChange} + value={field.value ?? code.orgwtKndCd[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-4"> + <FormField + control={form.control} + name="reuseBuilding.0.rswtrObj.filtrTrtmfctProcs" + render={({ field }) => ( + <FormUi label="주요처리공정"> + <Input + className={'w-full !text-xl'} + placeholder="주요처리공정" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + </div> + + <div className=" my-2"> + <h1 className={formH1Class}>인센티브 정보</h1> + </div> + <div> + <h2 className={formH2Class}>설치비 지원</h2> + </div> + <div className="grid grid-cols-2 gap-2 mt-4"> + <div className="col-span-1"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCstSprtYn" + render={({ field }) => ( + <FormUi label="설치비 지원여부"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={code.yn} + onSelectValue={field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-1"> + <FormField + control={form.control} + name="reuseBuilding.0.instlCstSprtAmt" + render={({ field }) => ( + <FormUi label="지원금액(원)"> + <Input + className={'w-full !text-xl'} + placeholder="1,000,000" + type="text" + onChange={(e) => { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={instlCstSprtYn !== "Y"} + /> + </FormUi> + )} + /> + </div> + </div> + + <div> + <h2 className={formH2Class}>녹색건축물 인증</h2> + </div> + <div className="grid grid-cols-6 gap-2 mt-4"> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertYn" + render={({ field }) => ( + <FormUi label="인증여부"> + <SelectBox + className={""} + selectClass={selectClass} + label={""} + selectArray={code.yn} + onSelectValue={field.onChange} + value={field.value ?? code.yn[0]?.val} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertYr" + render={({ field }) => ( + <FormUi label="인증년도"> + <Input + className={'w-full !text-xl'} + placeholder="2024" + type="text" + {...field} + value={field.value ?? ""} + onChange={field.onChange} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertNo" + render={({ field }) => ( + <FormUi label="인증번호"> + <Input + className={'w-full !text-xl'} + placeholder="ab1234678" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + <div className="col-span-3"> + <FormField + control={form.control} + name="reuseBuilding.0.grntchBdstCertGrd" + render={({ field }) => ( + <FormUi label="인증등급"> + <Input + className={'w-full !text-xl'} + placeholder="A" + type="" + value={field.value ?? ""} + onChange={field.onChange} + readOnly={true} + /> + </FormUi> + )} + /> + </div> + </div> + </form> + </Form> + </div> + ); +} diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index 960971d6b..70261c4c6 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -160,7 +160,7 @@ export default function Home() { <div className="grid grid-cols-12 gap-4"> <div className="col-span-2"> <Button className="w-full"> - <Link href="map/htdflSttn">온배수시설 현황(지도)</Link> + <Link href="map/htdflSttn">시설 현황(지도)</Link> </Button> </div> </div> diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index 88b3c8649..0af6072de 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -37,10 +37,7 @@ export default function RainSttn() { const [pageNation, setPageNation] = useState(1); const [isChHead, setIsChHead] = useState(false); const [bdstTable, setBdstTable] = useState<customRainBdst[]>(); - const [detailModal, setDetailModal] = useState<{ - isOpen: boolean; - data: customRainBdst | undefined; - }>({ data: undefined, isOpen: false }); + const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false }) const [bdstChgProps, setBdstChgProps] = useState<{ isOpen: boolean; chBuilding: chgBuilding[]; @@ -49,25 +46,12 @@ export default function RainSttn() { const codeData = getCityOrSgg(ref); const cellClick = (index: number | undefined, headId: string) => { - if ( - headId !== "chBuildingYn" && - index !== undefined && - bdstTable !== undefined - ) { - setDetailModal({ isOpen: true, data: bdstTable[index] }); - } else if ( - headId === "chBuildingYn" && - index !== undefined && - bdstTable !== undefined - ) { - if ( - bdstTable[index] && - bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null - ) { - setBdstChgProps({ - isOpen: true, - chBuilding: bdstTable[index].chgBuilding, - }); + + if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) { + setDetailModal({ isOpen: true, data: bdstTable[index] }) + } else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) { + if (bdstTable[index] && bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null) { + setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding }); } } }; @@ -168,9 +152,7 @@ export default function RainSttn() { headlist={rainSttn.rainSttHeadList} pageSize={20} total={100000} - cellClick={(index: number | undefined, headId: string) => { - cellClick(index ?? undefined, headId); - }} + cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }} onPageChange={setPageNation} ></UiTable> </ListDiv> diff --git a/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx b/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx index 438ab439c..0d3c2ca63 100644 --- a/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx +++ b/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx @@ -28,7 +28,7 @@ import { useEffect, useState } from "react"; import { set, useForm } from "react-hook-form"; import { z } from "zod"; -export function PbnstSttnModal({ data }: { data: customPbnst }) { +export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titleVisible?: boolean }) { const { code, pbnstSttn, prfmnc } = useWrStore((state) => state); const [fcltTab, setFcltTab] = useState<string>("fclt"); const [ruseTab, setRuseTab] = useState<string>("inoutTotal"); @@ -233,20 +233,24 @@ export function PbnstSttnModal({ data }: { data: customPbnst }) { } }, [pbnstSttn.pbnstSttnRes, data]); - useEffect(() => {}, [ruseBizData?.head]); + useEffect(() => { }, [ruseBizData?.head]); - useEffect(()=>{ + useEffect(() => { - if(data){ - form.reset({items:[data]}) + if (data) { + form.reset({ items: [data] }) } - },[data, form]) + }, [data, form]) return ( <> <div> - <Title title={"하수재이용 시설 상세정보"} /> + {titleVisible && ( + <> + <Title title={"하수재이용 시설 상세정보"} /> + </> + )} <ScrollArea className={"h-[70vh]"}> <PbnstMngForm form={form} diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index bb169c3ff..c09247f2f 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -1,5 +1,6 @@ import { Search } from 'lucide-react'; import OlMap from 'ol/Map'; +import Overlay from 'ol/Overlay'; import View from 'ol/View'; import { defaults as defaultControls, OverviewMap } from 'ol/control'; import { defaults } from 'ol/interaction'; @@ -7,31 +8,35 @@ import * as olProj from 'ol/proj'; import { register } from 'ol/proj/proj4'; import proj4 from 'proj4'; import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; +import { createRoot } from 'react-dom/client'; import GisLonLat from './GisLonLat'; import GisMapToggle from './GisMapToggle'; import GisSelect from './GisSelect'; import GisToolBar from './GisToolBar'; import GisTree from './GisTree'; +import FacilityInfoPopup from './facilityInfoPopup'; import './lib/css/gis.common.css'; import GisApp from './lib/gis.core'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); -function Gis({ - isOpen , - gisMaps, - isSearchModalOpen, - treeData = [], - isSearch = false, - isMiniMap = false, - setIsOpen, - setFeatureData, - featureData, - searchView : SearchView, - detailView: DetailView, - onFeatureSelect = null, - setIsSearchModalOpen }) { +function Gis({ + isOpen, + gisMaps, + isSearchModalOpen, + treeData = [], + isSearch = false, + isMiniMap = false, + setIsOpen, + setFeatureData, + featureData, + searchView: SearchView, + detailView: DetailView, + onFeatureSelect, + setIsSearchModalOpen, + onCheckedLayersChange +}) { const mapRef = useRef(); const [mapObject, setMapObject] = useState({}); const [tabVisible, setTabVisible] = useState(true); @@ -41,13 +46,21 @@ function Gis({ const gisCore = useMemo(() => new GisApp.core({ targetId: mapRef.current }), []); const mapInstanceRef = useRef(null); const checkedLayerIds = useRef([]); + + // 팝업 데이터를 저장할 상태와 오버레이 참조를 저장할 ref 추가 + const [facilityInfoPopupData, setFacilityInfoPopupData] = useState([]); + const facilityOverlaysRef = useRef([]); + // 체크된 레이어 상태 관리 + const [checkedLayers, setCheckedLayers] = useState([]); + const [checkedLayersData, setCheckedLayersData] = useState([]); + let gisMap = null; const closePopup = () => { setIsOpen(false); // 팝업 닫기 setFeatureData(null) }; - // SearchModal, GisContent 등에서 호출 + // Feature Click Event const handleFeatureSelect = useCallback((data) => { gisMap = mapInstanceRef.current; @@ -148,7 +161,7 @@ function Gis({ gisMaps.current = map // 미니맵 추가 - if(isMiniMap){ + if (isMiniMap) { const overviewMap = new OverviewMap({ layers: [GisApp.Module.core.baseMiniMapLayers['base']], view: new View({ @@ -213,15 +226,140 @@ function Gis({ } } + // 데이터 로드 및 팝업 생성 로직 + useEffect(() => { + if (!mapInstanceRef.current) return; // 맵이 생성되지 않았으면 실행 안 함 + + // 1. 팝업 데이터 가져오기 (feature.js의 getData와 유사) + const fetchPopupData = async () => { + // 실제 API 호출 로직으로 대체해야 합니다. + // 예시: const response = await yourApiService.getFcltyWtCnt(); + // setFacilityInfoPopupData(response.data); + + // 임시 목업 데이터 + const mockData = [ + { ftrIdn: 1, ftrCde: 'SA206', bplcNm: '처리장A', fcltyUseYn: 'Y', x: 127.005, y: 37.282, aCnt: 10, cCnt: 5, eCnt: 3, mCnt: 8, iCnt: 2 }, + { ftrIdn: 2, ftrCde: 'SA112', bplcNm: '처리장B', fcltyUseYn: 'N', x: 127.010, y: 37.285, aCnt: 8, cCnt: 4, eCnt: 2, mCnt: 6, iCnt: 1 } + ]; + setFacilityInfoPopupData(mockData); + }; + + fetchPopupData(); + + }, [mapInstanceRef.current]); // 맵 인스턴스가 생성된 후 한 번만 실행 + + // 데이터가 변경되면 오버레이를 생성/업데이트하는 로직 + useEffect(() => { + const map = mapInstanceRef.current; + if (!map || facilityInfoPopupData.length === 0) return; + + // 기존 오버레이 정리 + facilityOverlaysRef.current.forEach(overlay => map.removeOverlay(overlay)); + facilityOverlaysRef.current = []; + + facilityInfoPopupData.forEach(data => { + const popupId = `${data.ftrIdn}_${data.ftrCde}`; + + // 팝업을 담을 div 엘리먼트 생성 + const popupElement = document.createElement('div'); + popupElement.id = popupId; + + // OpenLayers Overlay 생성 + const position = olProj.transform([Number(data.x), Number(data.y)], GisApp.FROM_PROJ, GisApp.TO_PROJ); + const overlay = new Overlay({ + element: popupElement, + position: position, + offset: [-75, -210], // 팝업 너비의 절반, 높이만큼 오프셋 조정 + positioning: 'bottom-center', + className: 'facility-popup-overlay' // 필요시 공통 클래스 추가 + }); + + map.addOverlay(overlay); + facilityOverlaysRef.current.push(overlay); + + // React 컴포넌트를 popupElement에 렌더링 + const root = createRoot(popupElement); + root.render(<FacilityInfoPopup data={data} />); + }); + + // 초기 가시성 업데이트 + updatePopupVisibility(); + + }, [facilityInfoPopupData]); // 팝업 데이터가 변경될 때마다 실행 + + // 레이어 가시성에 따라 팝업 가시성을 제어하는 함수 + const updatePopupVisibility = useCallback(() => { + const map = mapInstanceRef.current; + if (!map) return; + + const visibleLayers = new Set(); + map.getLayers().forEach(layer => { + if (layer.getVisible()) { + // feature.js의 로직처럼 typeName이나 ftrCde를 사용해 필터링 + const typeName = layer.get('typeName'); + if (typeName === 'VW_WTL_FCLTY_AS') { // 예시 레이어 이름 + visibleLayers.add(layer.get('ftrCde')); + } + } + }); + + facilityOverlaysRef.current.forEach(overlay => { + const element = overlay.getElement(); + const ftrCde = element.querySelector('table')?.classList[0]; // FacilityPopup의 클래스에서 ftrCde 가져오기 + + if (visibleLayers.has(ftrCde)) { + element.style.display = ''; + } else { + element.style.display = 'none'; + } + }); + }, []); + + // GisTree에서 체크 상태가 변경될 때 이 함수를 호출하도록 연결해야 합니다. + // 예시: GisTree 컴포넌트에 onCheck 콜백을 추가하고, 그 콜백에서 이 함수를 호출 + useEffect(() => { + // 레이어 가시성이 변경될 때마다 팝업 가시성 업데이트 + const map = mapInstanceRef.current; + if (!map) return; + + const handleLayerVisibilityChange = () => { + updatePopupVisibility(); + }; + + map.getLayers().on('change:length', handleLayerVisibilityChange); + map.getLayers().forEach(layer => { + layer.on('change:visible', handleLayerVisibilityChange); + }); + + return () => { + // 클린업 + map.getLayers().un('change:length', handleLayerVisibilityChange); + map.getLayers().forEach(layer => { + layer.un('change:visible', handleLayerVisibilityChange); + }); + }; + }, [updatePopupVisibility]); + + // 체크된 레이어 정보를 처리하는 함수 + const handleCheckedLayersChange = useCallback((checkedIds, checkedNodesData) => { + setCheckedLayers(checkedIds); + setCheckedLayersData(checkedNodesData); + onCheckedLayersChange?.(checkedIds, checkedNodesData); + }, [onCheckedLayersChange]); + return ( <> <GisContext.Provider value={{ gisCore, gisMap: mapInstanceRef.current, treeData, checkedLayerIds }}> <div className="h-[calc(100vh-10rem)] flex relative"> <div ref={mapRef} className="gis-map flex-1 relative" style={{ height: '100%', padding: 0 }} /> - <GisTree visible={tabVisible} setVisible={setTabVisible} /> - + <GisTree + visible={tabVisible} + setVisible={setTabVisible} + onCheckedChange={handleCheckedLayersChange} + /> + {/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */} - + {/* isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} {isOpen && featureData && !isSearchModalOpen && ( <DetailView @@ -234,9 +372,9 @@ function Gis({ onOpenChange={setIsSearchModalOpen} onFeatureSelect={handleFeatureSelect} /> - <GisLonLat/> - <GisToolBar/> - <GisMapToggle/> + <GisLonLat /> + <GisToolBar /> + <GisMapToggle /> <GisSelect onFeatureSelect={handleFeatureSelect} /> </div> diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index dec618926..e36569143 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -9,7 +9,7 @@ import { DndProvider } from "react-dnd"; import { useGisContext } from './Gis'; import GisApp from './lib/gis.core'; -export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible }) { +export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible, onCheckedChange }) { const { gisCore, treeData } = useGisContext(); const [checked, setChecked] = useState([]); const [expanded, setExpanded] = useState([]); @@ -102,6 +102,11 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes const unchecked = allIds.filter((nid) => !newChecked.includes(nid)); gisCore.setLayerOnMap(newChecked, true); gisCore.setLayerOnMap(unchecked, false); + + // 체크된 노드 정보와 함께 노드 데이터를 상위로 전달 + const checkedNodesData = nodes.filter(node => newChecked.includes(node.id)); + onCheckedChange?.(newChecked, checkedNodesData); + return newChecked; }); }; From c3c9f841c484c6a60802b780a4a455d4117e9b7e Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 14:05:18 +0900 Subject: [PATCH 015/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=20=ED=91=9C=EC=8B=9C=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/entities/menu/api/menu-service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sn/src/entities/menu/api/menu-service.ts b/apps/sn/src/entities/menu/api/menu-service.ts index 4424f8d37..fb4aaf865 100644 --- a/apps/sn/src/entities/menu/api/menu-service.ts +++ b/apps/sn/src/entities/menu/api/menu-service.ts @@ -4,6 +4,7 @@ import type { MenuItem, MenuService } from "../model/menu-interface"; export class MenuApiService implements MenuService { async getMenuRoles(siteId: string): Promise<MenuItem[]> { + console.log( `${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`); const response = await client.get<MenuItem[]>( `${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`, ); From 09f3c6318a26208382c96a6977fde2d53ad9bcab Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 15:54:37 +0900 Subject: [PATCH 016/259] =?UTF-8?q?env=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 26 +++++++++---------- apps/sn/src/entities/menu/api/menu-service.ts | 1 - 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index a24d15e67..d53160fd7 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,13 +1,13 @@ -NEXT_PUBLIC_PORT=3002 -NEXT_PUBLIC_SERVER_API_URL=http://dev.onasys.co.kr:8000 -# 개발 서버 API -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api -# 최용성 부장님 API -# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api -# 박이정 차장님 API -# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api -# NEXT_PUBLIC_SEWERAGE_API_URL=http://localhost:8883/sewerage-service/api -NEXT_PUBLIC_SITE_ID=SN -NEXT_PUBLIC_GEOSERVER_URL=http://rsone.iptime.org:10010/geoserver/ -export const CLAIM_NAME = Authorization -export const AUTH_USER_ID = token-id \ No newline at end of file +NEXT_PUBLIC_SITE_ID = SN +NEXT_PUBLIC_PORT = 3002 +NEXT_PUBLIC_PROXY_HOST = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_CLAIM_NAME = Authorization +NEXT_PUBLIC_AUTH_USER_ID = token-id +NEXT_PUBLIC_ACCESS_TOKEN = access-token +NEXT_PUBLIC_REFRESH_TOKEN = refresh-token + +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 차장님 API diff --git a/apps/sn/src/entities/menu/api/menu-service.ts b/apps/sn/src/entities/menu/api/menu-service.ts index fb4aaf865..4424f8d37 100644 --- a/apps/sn/src/entities/menu/api/menu-service.ts +++ b/apps/sn/src/entities/menu/api/menu-service.ts @@ -4,7 +4,6 @@ import type { MenuItem, MenuService } from "../model/menu-interface"; export class MenuApiService implements MenuService { async getMenuRoles(siteId: string): Promise<MenuItem[]> { - console.log( `${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`); const response = await client.get<MenuItem[]>( `${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`, ); From 618828c7d74620a50c91b8874106d604e0947ae9 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 17:54:33 +0900 Subject: [PATCH 017/259] =?UTF-8?q?evn=20=ED=94=84=EB=A1=9D=EC=8B=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index d53160fd7..51abdda6f 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,6 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 3002 -NEXT_PUBLIC_PROXY_HOST = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_CLAIM_NAME = Authorization From 17a097cf346b1ca6019eec442c60cab1b3726454 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 18:00:09 +0900 Subject: [PATCH 018/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20env=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 51abdda6f..f088fe73c 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,6 +1,8 @@ NEXT_PUBLIC_SITE_ID = SN -NEXT_PUBLIC_PORT = 3002 -NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 +#NEXT_PUBLIC_PORT = 3002 +NEXT_PUBLIC_PORT = 11302 +#NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_CLAIM_NAME = Authorization From a9ae39b013b9fd0a493e46855c29128048558032 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 18:21:14 +0900 Subject: [PATCH 019/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20env=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 10 ++++++++++ apps/sn/.env.local | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 apps/sn/.env.development diff --git a/apps/sn/.env.development b/apps/sn/.env.development new file mode 100644 index 000000000..9c8967741 --- /dev/null +++ b/apps/sn/.env.development @@ -0,0 +1,10 @@ +NEXT_PUBLIC_SITE_ID = SN +NEXT_PUBLIC_PORT = 11302 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_CLAIM_NAME = Authorization +NEXT_PUBLIC_AUTH_USER_ID = token-id +NEXT_PUBLIC_ACCESS_TOKEN = access-token +NEXT_PUBLIC_REFRESH_TOKEN = refresh-token +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API diff --git a/apps/sn/.env.local b/apps/sn/.env.local index f088fe73c..51abdda6f 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,8 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN -#NEXT_PUBLIC_PORT = 3002 -NEXT_PUBLIC_PORT = 11302 -#NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 -NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_PORT = 3002 +NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_CLAIM_NAME = Authorization From 5985154d062cd4378953b06c273b90cd89b54237 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 18:27:27 +0900 Subject: [PATCH 020/259] =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/shared/config/env.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/sn/src/shared/config/env.ts b/apps/sn/src/shared/config/env.ts index c6373724f..ad982d727 100644 --- a/apps/sn/src/shared/config/env.ts +++ b/apps/sn/src/shared/config/env.ts @@ -1,11 +1,8 @@ export const PORT = process.env.NEXT_PUBLIC_PORT || "3000"; -export const PROXY_HOST = - process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; +export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL; -export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "CS"; +export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "SN"; export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; -export const ACCESS_TOKEN = - process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token"; -export const REFRESH_TOKEN = - process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token"; +export const ACCESS_TOKEN = process.env.NEXT_PUBLIC_ACCESS_TOKEN || "access-token"; +export const REFRESH_TOKEN = process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token"; export const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; From fccfa500c82b63d546b8d5977a635d23d26bd7f8 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 18:56:25 +0900 Subject: [PATCH 021/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/shared/api/client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/sn/src/shared/api/client.ts b/apps/sn/src/shared/api/client.ts index 709bb44a5..e5252b68f 100644 --- a/apps/sn/src/shared/api/client.ts +++ b/apps/sn/src/shared/api/client.ts @@ -2,6 +2,8 @@ import { Client } from "@common/network"; import { BASE_URL } from "../config/api"; import { SITE_ID } from "../config/env"; +console.log("SITE_ID:", SITE_ID); + export const client = Client.getInstance({ baseURL: BASE_URL, siteId: SITE_ID, From 3442edc92ca832ef71d5ac8c96550b107a303326 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 19:09:59 +0900 Subject: [PATCH 022/259] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/shared/api/client.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/sn/src/shared/api/client.ts b/apps/sn/src/shared/api/client.ts index e5252b68f..709bb44a5 100644 --- a/apps/sn/src/shared/api/client.ts +++ b/apps/sn/src/shared/api/client.ts @@ -2,8 +2,6 @@ import { Client } from "@common/network"; import { BASE_URL } from "../config/api"; import { SITE_ID } from "../config/env"; -console.log("SITE_ID:", SITE_ID); - export const client = Client.getInstance({ baseURL: BASE_URL, siteId: SITE_ID, From be18d726f6f0110a07af5d4bcae6e54e53b1f51c Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 19:29:31 +0900 Subject: [PATCH 023/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/components/src/api/site.ts | 1 + packages/common/components/src/ui/header/index.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/common/components/src/api/site.ts b/packages/common/components/src/api/site.ts index 8d8109571..06798a99f 100644 --- a/packages/common/components/src/api/site.ts +++ b/packages/common/components/src/api/site.ts @@ -26,6 +26,7 @@ export interface SiteInfo { const client = getApiClient(); export const getSiteInfo = async (siteId: string) => { + console.log("2:::",siteId) const response = await client.get<SiteInfo>( `${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`, ); diff --git a/packages/common/components/src/ui/header/index.tsx b/packages/common/components/src/ui/header/index.tsx index 41384a766..bce365935 100644 --- a/packages/common/components/src/ui/header/index.tsx +++ b/packages/common/components/src/ui/header/index.tsx @@ -30,6 +30,7 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) { enabled: !viewOnly, }); + console.log("1:::",{SITE_ID}) const { data: siteInfo } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.SITES, SITE_ID], queryFn: () => getSiteInfo(SITE_ID ?? ""), From 1b7affe789614418d82af0b23086427483293267 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 19:42:27 +0900 Subject: [PATCH 024/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/components/src/ui/header/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/common/components/src/ui/header/index.tsx b/packages/common/components/src/ui/header/index.tsx index bce365935..3387f56ef 100644 --- a/packages/common/components/src/ui/header/index.tsx +++ b/packages/common/components/src/ui/header/index.tsx @@ -31,6 +31,7 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) { }); console.log("1:::",{SITE_ID}) + console.log("1.1:::", process.env.NEXT_PUBLIC_SITE_ID) const { data: siteInfo } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.SITES, SITE_ID], queryFn: () => getSiteInfo(SITE_ID ?? ""), From 5c3e7d6b974bf4efa6468869278189bcc184b241 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 24 Jun 2025 20:29:58 +0900 Subject: [PATCH 025/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index 9c8967741..1c90d2e08 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -7,4 +7,5 @@ NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token + NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API From b6730c1e15d5b48cb967dff9945177ddbcb32262 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 25 Jun 2025 11:33:32 +0900 Subject: [PATCH 026/259] =?UTF-8?q?feat:,=20fix:=20-=20=EC=B9=A8=EC=9E=85?= =?UTF-8?q?=EC=88=98=EB=B6=84=EC=84=9D,=20RDII=EB=B6=84=EC=84=9D=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=95=AD?= =?UTF-8?q?=EB=AA=A9=20=EA=B0=9C=EC=88=98=201000=EB=A7=8C=EA=B1=B4?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95=20-=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=ED=9B=84=20=EC=9E=AC=EC=A1=B0=ED=9A=8C=20=EC=8B=9C?= =?UTF-8?q?=EC=97=90=20cell=20=ED=81=B4=EB=A6=AD=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94=20-=20=EC=82=AD=EC=A0=9C=20=ED=9B=84=20=EC=9E=AC?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ii/rdii_result/page.tsx | 22 ++++++++++++----- .../app/(with-base-layout)/ii/result/page.tsx | 24 +++++++++++++------ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx index 2a86d9eff..ea61cae37 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx @@ -55,6 +55,7 @@ const Result = () => { const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 const [selectedRowData, setSelectedRowData] = useState<any>(null); const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); + const [resetSelection, setResetSelection] = useState<boolean>(false); const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { @@ -85,7 +86,7 @@ const Result = () => { const queryParams = new URLSearchParams({ page: '0', - size: '10', + size: '10000000', sort: 'rainInfwtAnlsSn,desc' }); Object.entries(inftwtAnlsSearchDto).forEach(([key, value]) => { @@ -181,21 +182,29 @@ const Result = () => { console.log("File delete response1:", response1); console.log("File delete response2:", response2); + // 테이블 선택 상태 초기화 트리거 + setResetSelection(true); + // 삭제 후 테이블 새로고침을 위해 재검색 const customFormValues: Partial<ResultFormValues> = { - aplcnYm: selectedRowData.aplcnYm || '0', - enoCd: selectedRowData.enoCd || '0', - ctpvCd: selectedRowData.ctpvCd || '0', - sggCd: selectedRowData.sggCd || '0', - swtrmtZoneCd: selectedRowData.swtrmtZoneCd || '0', + aplcnYm: selectedRowData.aplcnYm || null, + enoCd: selectedRowData.enoCd || null, + ctpvCd: selectedRowData.ctpvCd || null, + sggCd: selectedRowData.sggCd || null, + swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, }; await handleSearchButtonClick(customFormValues); // 선택된 행 초기화 setSelectedRowData(null); setSelectedRowIndex(undefined); + setIsLoadingResult(false); alert('삭제가 완료되었습니다.'); + + setTimeout(() => { + setResetSelection(false); + }, 100); } catch (error) { console.error("분석결과 파일 삭제 중 오류 발생:", error); alert("분석결과 파일 삭제 중 오류가 발생했습니다. 다시 시도해주세요."); @@ -247,6 +256,7 @@ const Result = () => { children={undefined} cellClick={handleCellClick} onPageChange={(e) => { }} + resetSelection={resetSelection} /> </div> </div> diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 38d3e689f..7b220125a 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -54,6 +54,7 @@ const Result = () => { const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 const [selectedRowData, setSelectedRowData] = useState<any>(null); const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); + const [resetSelection, setResetSelection] = useState<boolean>(false); const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { @@ -84,7 +85,7 @@ const Result = () => { const queryParams = new URLSearchParams({ page: '0', - size: '10', + size: '10000000', sort: 'inftwtAnlsSn,desc' }); Object.entries(inftwtAnlsSearchDto).forEach(([key, value]) => { @@ -169,7 +170,8 @@ const Result = () => { } try { - // 삭제 API 호출 + // // 삭제 API 호출 + console.log("Deleting analysis result with inftwtAnlsSn:", selectedRowData.inftwtAnlsSn); const response1 = await deleteData(`v1/inftwtAnlsRslt/${selectedRowData.inftwtAnlsSn}`); const response2 = await deleteData(`v1/inftwtAnls/${selectedRowData.inftwtAnlsSn}`); // 첨부파일(inp파일) 삭제 API 호출 @@ -181,13 +183,16 @@ const Result = () => { console.log("File delete response1:", response1); console.log("File delete response2:", response2); + // 테이블 선택 상태 초기화 트리거 + setResetSelection(true); + // 삭제 후 테이블 새로고침을 위해 재검색 const customFormValues: Partial<ResultFormValues> = { - aplcnYm: selectedRowData.aplcnYm || '0', - enoCd: selectedRowData.enoCd || '0', - ctpvCd: selectedRowData.ctpvCd || '0', - sggCd: selectedRowData.sggCd || '0', - swtrmtZoneCd: selectedRowData.swtrmtZoneCd || '0', + aplcnYm: selectedRowData.aplcnYm || null, + enoCd: selectedRowData.enoCd || null, + ctpvCd: selectedRowData.ctpvCd || null, + sggCd: selectedRowData.sggCd || null, + swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, }; await handleSearchButtonClick(customFormValues); @@ -197,6 +202,10 @@ const Result = () => { setIsLoadingResult(false); alert('삭제가 완료되었습니다.'); + + setTimeout(() => { + setResetSelection(false); + }, 100); } catch (error) { setIsLoadingResult(false); console.error("분석결과 파일 삭제 중 오류 발생:", error); @@ -248,6 +257,7 @@ const Result = () => { children={undefined} cellClick={handleCellClick} onPageChange={(e) => { }} + resetSelection={resetSelection} /> </div> </div> From f679277192a44abe9268fa547c23e903d2fee0a8 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 25 Jun 2025 14:24:30 +0900 Subject: [PATCH 027/259] =?UTF-8?q?rafactor:=20tab=20size=204=20->=202?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 314 ++++---- .../map/components/InputSection.tsx | 80 +- .../map/components/common/index.ts | 78 +- .../map/components/common/table.ts | 194 ++--- .../components/popupComponent/MsSwagePpl.tsx | 144 ++-- .../map/components/popupComponent/Ssc.tsx | 10 +- .../components/popupComponent/SwtrmtFclt.tsx | 66 +- .../popupComponent/chart/infilChart.tsx | 252 +++--- .../components/popupComponent/sewagePump.tsx | 12 +- .../map/components/popupComponent/smh.tsx | 18 +- .../popupComponent/stormWaterPump.tsx | 12 +- .../map/featureClickEventPopup.tsx | 388 ++++----- apps/sn/app/(map-layout)/map/page.tsx | 2 +- .../app/(with-base-layout)/ii/BaseLayout.tsx | 464 +++++------ .../(with-base-layout)/ii/irsetting/page.tsx | 658 +++++++-------- .../app/(with-base-layout)/ii/rdii/page.tsx | 756 +++++++++--------- .../ii/rdii_result/page.tsx | 488 +++++------ .../app/(with-base-layout)/ii/result/page.tsx | 490 ++++++------ .../(with-base-layout)/oper/floodPre/page.tsx | 282 +++---- apps/sn/app/(with-base-layout)/oper/index.ts | 24 +- .../(with-base-layout)/oper/oldPp/page.tsx | 285 +++---- apps/sn/app/components/lib/api/index.ts | 104 +-- .../app/components/lib/common/apiHelpers.ts | 32 +- apps/sn/app/components/lib/utils/date.ts | 20 +- apps/sn/app/components/ui/fileUploadForm.tsx | 246 +++--- apps/sn/app/components/ui/formSection.tsx | 28 +- apps/sn/app/components/ui/modal.tsx | 52 +- .../app/components/ui/operFileUploadForm.tsx | 76 +- apps/sn/app/components/ui/verticalTable.tsx | 376 ++++----- 29 files changed, 2976 insertions(+), 2975 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index e1c2bd0de..ea6f6e923 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -438,43 +438,43 @@ const SearchModal: React.FC<SearchModalProps> = ({ // 검색 API 호출 함수 const fetchFilteredData = async () => { - setIsLoading(true); // 로딩 시작 - try { - const queryParams = new URLSearchParams({ - lyrTypeNm: basicType, - page: `${curPage - 1}`, - size: '10', - sort: 'string', - }); - - let cqlFilters: string[] = []; - if (activeTab === 'basic') { - if (basicType === 'tb_ms_swage_prcs_zone') cqlFilters = zoneCqlFilters(); - else if (basicType === 'tb_il_swage_prcs_fclt') cqlFilters = facilityCqlFilters(); - else if (basicType === 'tb_ms_swage_ppl') cqlFilters = pplCqlFilters(); - } else if (activeTab === 'operation') { - cqlFilters = zoneCqlFilters(); - } else { - cqlFilters = reportCqlFilters(); - } - - if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); - - console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); - const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); - console.log('필터링된 API 결과(개수):', res.data.count); - console.log('필터링된 API 결과(데이터):', res.data.data); - - setTableData(res.data.data || []); - setTableCount(res.data.count || []); - console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 - setShowTable(true); - } catch (err) { - console.error('API ERROR:', err); - setTableData([]); - } finally { - setIsLoading(false); // 로딩 종료 + setIsLoading(true); // 로딩 시작 + try { + const queryParams = new URLSearchParams({ + lyrTypeNm: basicType, + page: `${curPage - 1}`, + size: '10', + sort: 'string', + }); + + let cqlFilters: string[] = []; + if (activeTab === 'basic') { + if (basicType === 'tb_ms_swage_prcs_zone') cqlFilters = zoneCqlFilters(); + else if (basicType === 'tb_il_swage_prcs_fclt') cqlFilters = facilityCqlFilters(); + else if (basicType === 'tb_ms_swage_ppl') cqlFilters = pplCqlFilters(); + } else if (activeTab === 'operation') { + cqlFilters = zoneCqlFilters(); + } else { + cqlFilters = reportCqlFilters(); } + + if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); + + console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); + const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); + console.log('필터링된 API 결과(개수):', res.data.count); + console.log('필터링된 API 결과(데이터):', res.data.data); + + setTableData(res.data.data || []); + setTableCount(res.data.count || []); + console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 + setShowTable(true); + } catch (err) { + console.error('API ERROR:', err); + setTableData([]); + } finally { + setIsLoading(false); // 로딩 종료 + } }; const renderBody = () => ( @@ -814,83 +814,83 @@ const SearchModal: React.FC<SearchModalProps> = ({ {/* 분기처리: 하수펌프장 */} {(basicType === "tb_ms_swage_psmtn_1" || basicType === "tb_ms_swage_psmtn_2") && ( - <div className="mb-3"> - {/* 설치년도 */} - <div className="flex items-center mb-2"> - <YearRangeSelectBox - start={yearFilter.시작} - end={yearFilter.종료} - onChange={range => setYearFilter({ ...yearFilter, 시작: range.start, 종료: range.end })} - startLabel="설치년도" - endLabel="" - /> - {/* 경과년도 */} - <Label className="w-auto text-xl text-gray-600 mr-2">경과년도</Label> - <Input - className='!text-xl w-[100px] placeholder:text-center mr-8' - placeholder="입력" - value={yearFilter.경과년도} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ''); - setYearFilter({ ...yearFilter, 경과년도: val }); - }} - /> + <div className="mb-3"> + {/* 설치년도 */} + <div className="flex items-center mb-2"> + <YearRangeSelectBox + start={yearFilter.시작} + end={yearFilter.종료} + onChange={range => setYearFilter({ ...yearFilter, 시작: range.start, 종료: range.end })} + startLabel="설치년도" + endLabel="" + /> + {/* 경과년도 */} + <Label className="w-auto text-xl text-gray-600 mr-2">경과년도</Label> + <Input + className='!text-xl w-[100px] placeholder:text-center mr-8' + placeholder="입력" + value={yearFilter.경과년도} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ''); + setYearFilter({ ...yearFilter, 경과년도: val }); + }} + /> + </div> + <div className="flex items-center mb-2"> + {/* 일일처리용량 - 오수맨홀 */} + <Label className="mr-2 w-auto text-xl text-gray-600"> + 일일처리용량 + </Label> + <Input + className="w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={시작1} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set시작1(val); + }} + /> + <span className="mx-2 text-xl font-semibold">~</span> + <Input + className="mr-8 w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={종료1} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set종료1(val); + }} + /> + {/* 우수양수능력 - 우수맨홀 */} + <Label className="mr-2 w-auto text-xl text-gray-600"> + 우수양수능력 + </Label> + <Input + className="w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={시작2} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set시작2(val); + }} + /> + <span className="mx-2 text-xl font-semibold">~</span> + <Input + className="mr-8 w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={종료2} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set종료2(val); + }} + /> + </div> </div> - <div className="flex items-center mb-2"> - {/* 일일처리용량 - 오수맨홀 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> - 일일처리용량 - </Label> - <Input - className="w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={시작1} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set시작1(val); - }} - /> - <span className="mx-2 text-xl font-semibold">~</span> - <Input - className="mr-8 w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={종료1} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set종료1(val); - }} - /> - {/* 우수양수능력 - 우수맨홀 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> - 우수양수능력 - </Label> - <Input - className="w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={시작2} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set시작2(val); - }} - /> - <span className="mx-2 text-xl font-semibold">~</span> - <Input - className="mr-8 w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={종료2} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set종료2(val); - }} - /> - </div> - </div> - )} + )} {/* 분기처리: 우수토실? 토구? */} {basicType === "tb_ms_otfl" && ( <div className="mb-3"> @@ -981,20 +981,20 @@ const SearchModal: React.FC<SearchModalProps> = ({ /> {/* 설치년도 */} - <YearRangeSelectBox - start={yearFilter.시작} - end={yearFilter.종료} - onChange={(range) => - setYearFilter({ - ...yearFilter, - 시작: range.start, - 종료: range.end, - }) - } - startLabel="설치년도" - endLabel="" - /> - <div className="flex items-center"> + <YearRangeSelectBox + start={yearFilter.시작} + end={yearFilter.종료} + onChange={(range) => + setYearFilter({ + ...yearFilter, + 시작: range.start, + 종료: range.end, + }) + } + startLabel="설치년도" + endLabel="" + /> + <div className="flex items-center"> {/* 경과년도 */} <Label className="mr-2 w-auto text-xl text-gray-600"> 경과년도 @@ -1009,12 +1009,12 @@ const SearchModal: React.FC<SearchModalProps> = ({ setYearFilter({ ...yearFilter, 경과년도: val }); }} /> - </div> - </div> - {/* 조회 버튼 중앙 정렬 */} - <div className="absolute bottom-4 right-4 mr-2"> - <Button className="text-base py-2" onClick={handleSearch}>조회</Button> </div> + </div> + {/* 조회 버튼 중앙 정렬 */} + <div className="absolute bottom-4 right-4 mr-2"> + <Button className="text-base py-2" onClick={handleSearch}>조회</Button> + </div> </div> )} {/* 하수도정비기본계획보고서 탭 */} @@ -1026,9 +1026,9 @@ const SearchModal: React.FC<SearchModalProps> = ({ sido={시도} sigungu={시군구} onSidoChange={(sidoId) => { - set시도(sidoId); - set시군구(0); - }} + set시도(sidoId); + set시군구(0); + }} onSigunguChange={set시군구} /> </div> @@ -1071,28 +1071,28 @@ const SearchModal: React.FC<SearchModalProps> = ({ {/* 📋 결과 리스트 */} <div className="h-[60vh] w-full space-y-2 overflow-hidden rounded-lg border"> - {/* 테이블 영역 (가로/세로 스크롤 가능) */} - <div className="flex-1 px-2 pb-2"> - <LoadingOverlay isLoading={isLoading}/> - <UiTable2 - headName={ - (() => { - const resultCount = tableData.length; - const label = - activeTab === "basic" - ? BASIC_TYPES.find((type) => type.val === basicType)?.text - : activeTab === "operation" - ? WORK_TYPES.find((type) => type.val === workType)?.text - : activeTab === "report" - ? "하수도정비기본계획보고서" - : TABS.find((tab) => tab.val === activeTab)?.text; - return ( - <> - {label} 조회 결과 ({tableCount})건 - </> - ); - })() - } + {/* 테이블 영역 (가로/세로 스크롤 가능) */} + <div className="flex-1 px-2 pb-2"> + <LoadingOverlay isLoading={isLoading} /> + <UiTable2 + headName={ + (() => { + const resultCount = tableData.length; + const label = + activeTab === "basic" + ? BASIC_TYPES.find((type) => type.val === basicType)?.text + : activeTab === "operation" + ? WORK_TYPES.find((type) => type.val === workType)?.text + : activeTab === "report" + ? "하수도정비기본계획보고서" + : TABS.find((tab) => tab.val === activeTab)?.text; + return ( + <> + {label} 조회 결과 ({tableCount})건 + </> + ); + })() + } tableData={tableData} headlist={dynamicHeadlist} pageSize={tableData.length < 10 ? tableData.length : 10} @@ -1103,8 +1103,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ resetPageNo={false} cur={curPage} /> + </div> </div> - </div> </> ); diff --git a/apps/sn/app/(map-layout)/map/components/InputSection.tsx b/apps/sn/app/(map-layout)/map/components/InputSection.tsx index 6c411e2cf..fe8897703 100644 --- a/apps/sn/app/(map-layout)/map/components/InputSection.tsx +++ b/apps/sn/app/(map-layout)/map/components/InputSection.tsx @@ -2,49 +2,49 @@ import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from "@ import React from "react"; interface InputSectionProps { - title: string; - data: { year: string; type: string }[]; - sectionKey: string; - onInputChange: (section: string, index: number, field: string, value: string) => void; + title: string; + data: { year: string; type: string }[]; + sectionKey: string; + onInputChange: (section: string, index: number, field: string, value: string) => void; } const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, onInputChange }) => { - return ( - <div> - {/* 섹션 제목 */} - <div className="card-header"> - <h3 className="text-2xl mx-3 font-medium text-label">{title}</h3> - </div> - {/* 테이블 */} - <div className="card !m-[1.2rem] !p-0r"> - <Table variant="secondary" className="w-full"> - <TableHeader> - <TableRow> - <TableHead className="border border-gray-300 px-2 py-2 text-sm">년도</TableHead> - <TableHead className="border border-gray-300 px-2 py-2 text-sm">구분</TableHead> - </TableRow> - </TableHeader> - <TableBody> - {data.map((row, index) => ( - <TableRow key={index}> - <TableCell className="border border-gray-300 px-2 py-2 text-sm"> - <input - type="text" - value={row.year} - onChange={(e) => onInputChange(sectionKey, index, "year", e.target.value)} - className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal" - /> - </TableCell> - <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal"> - {row.type} - </TableCell> - </TableRow> - ))} - </TableBody> - </Table> - </div> - </div> - ); + return ( + <div> + {/* 섹션 제목 */} + <div className="card-header"> + <h3 className="text-2xl mx-3 font-medium text-label">{title}</h3> + </div> + {/* 테이블 */} + <div className="card !m-[1.2rem] !p-0r"> + <Table variant="secondary" className="w-full"> + <TableHeader> + <TableRow> + <TableHead className="border border-gray-300 px-2 py-2 text-sm">년도</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm">구분</TableHead> + </TableRow> + </TableHeader> + <TableBody> + {data.map((row, index) => ( + <TableRow key={index}> + <TableCell className="border border-gray-300 px-2 py-2 text-sm"> + <input + type="text" + value={row.year} + onChange={(e) => onInputChange(sectionKey, index, "year", e.target.value)} + className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal" + /> + </TableCell> + <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal"> + {row.type} + </TableCell> + </TableRow> + ))} + </TableBody> + </Table> + </div> + </div> + ); }; export default InputSection; \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index b72ec26d5..e5273180b 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -5,58 +5,58 @@ import Ssc from "../popupComponent/Ssc"; import StormWaterPump from "../popupComponent/stormWaterPump"; import SwtrmtFclt from "../popupComponent/SwtrmtFclt"; -type LayerComponentProps = { - featureData: any; - chkMainSsc?: boolean; - additionalData?: any; +type LayerComponentProps = { + featureData: any; + chkMainSsc?: boolean; + additionalData?: any; }; type LayerContentMap = { - [key: string]: { - component?: React.FC<LayerComponentProps>; - props?: any; - }; + [key: string]: { + component?: React.FC<LayerComponentProps>; + props?: any; + }; }; // 레이어 이름과 컴포넌트를 매핑 // 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업 const layerContentMap: LayerContentMap = { - // TODO: gis데이터 추가되면 추가 작업 필요 - "하수처리시설": { component: SwtrmtFclt, }, - "하수처리구역": { }, - "우수토실":{component: Ssc,}, - "중점우수토실":{component: Ssc, }, // 중점우수토실 여부 설정 - "하수관로":{component: MsSwagePpl,}, - "하수맨홀":{component: smh,}, - "빗물펌프":{component:StormWaterPump}, - "오수펌프":{component:sewagePump}, + // TODO: gis데이터 추가되면 추가 작업 필요 + "하수처리시설": { component: SwtrmtFclt, }, + "하수처리구역": {}, + "우수토실": { component: Ssc, }, + "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 + "하수관로": { component: MsSwagePpl, }, + "하수맨홀": { component: smh, }, + "빗물펌프": { component: StormWaterPump }, + "오수펌프": { component: sewagePump }, }; // 동적 컴포넌트 반환 함수 export const getLayerContentComponent = (layerNm: string): React.FC<LayerComponentProps> | null => { - const component = layerContentMap[layerNm]; - if (!component || !component.component) { - // component가 없으면 null 반환 - return () => null; - } - return component.component + const component = layerContentMap[layerNm]; + if (!component || !component.component) { + // component가 없으면 null 반환 + return () => null; + } + return component.component }; // 사용자 입력 필드 (보수 및 갱신, 청소 및 준설, 점검 및 진단) export const handleInputChange = (section: string, - index: number, - field: string, - value: string, - dataMap: { - [key: string]: { - data: { year: string; type: string }[]; - setData: React.Dispatch<React.SetStateAction<{ year: string; type: string }[]>>; - }; - } + index: number, + field: string, + value: string, + dataMap: { + [key: string]: { + data: { year: string; type: string }[]; + setData: React.Dispatch<React.SetStateAction<{ year: string; type: string }[]>>; + }; + } ) => { - const target = dataMap[section]; - if (!target) return; + const target = dataMap[section]; + if (!target) return; - const updated = [...target.data]; - if (updated[index]) { - updated[index][field as keyof typeof updated[number]] = value; - } - target.setData(updated); + const updated = [...target.data]; + if (updated[index]) { + updated[index][field as keyof typeof updated[number]] = value; + } + target.setData(updated); }; \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 6c641f9be..d06973d37 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,128 +1,128 @@ // 하수처리시설 export const SwtrmtFcltCol = [ - { id: 'swtrmtFcltNm', title: '하수처리시설명' }, - { id: 'fcltCpct', title: '시설용량' }, - { id: 'rgnExpln', title: '지역설명' }, - { id: 'cmcnYmd', title: '준공일자' }, - { id: 'oprtngStrtYmd', title: '가동개시일자' }, - { id: 'clsgYmd', title: '폐쇄일자' }, - { id: 'prcsMsrcCd', title: '처리공법코드' }, - // { id: 'laeCd', title: '지자체코드' }, - { id: 'laeNm', title: '지자체명' }, - { id: 'ctpvNm', title: '시도명' }, - { id: 'sggNm', title: '시군구명' }, - // { id: 'sareaCd', title: '권역코드' }, - { id: 'sareaNm', title: '권역명' }, - { id: 'lrgeSareaNm', title: '대권역명' }, - { id: 'rvrNm', title: '하천명' }, - { id: 'addr', title: '주소' }, - { id: 'daddr', title: '상세주소' }, - { id: 'rdnmAddr', title: '도로명주소' }, - { id: 'dtlRdnmAddr', title: '상세도로명주소' }, - { id: 'dschgWtstNm', title: '방류수계명' }, - { id: 'pllnArea', title: '부지면적' }, - { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, - { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, - { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, - { id: 'xcrd', title: 'X좌표' }, - { id: 'ycrd', title: 'Y좌표' }, - // { id: 'oprtngSttsCd', title: '가동상태코드' }, - { id: 'rprsMsrcCn', title: '대표공법내용' }, - { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, - { id: 'sttyCrtrToc', title: '법정기준TOC' }, - { id: 'sttyCrtrSs', title: '법정기준SS' }, - { id: 'sttyCrtrTn', title: '법정기준총질소' }, - { id: 'sttyCrtrTph', title: '법정기준총인' }, - { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, - { id: 'bsnNm', title: '유역명' }, - // { id: 'obsrvnSptCd', title: '관측지점코드' }, + { id: 'swtrmtFcltNm', title: '하수처리시설명' }, + { id: 'fcltCpct', title: '시설용량' }, + { id: 'rgnExpln', title: '지역설명' }, + { id: 'cmcnYmd', title: '준공일자' }, + { id: 'oprtngStrtYmd', title: '가동개시일자' }, + { id: 'clsgYmd', title: '폐쇄일자' }, + { id: 'prcsMsrcCd', title: '처리공법코드' }, + // { id: 'laeCd', title: '지자체코드' }, + { id: 'laeNm', title: '지자체명' }, + { id: 'ctpvNm', title: '시도명' }, + { id: 'sggNm', title: '시군구명' }, + // { id: 'sareaCd', title: '권역코드' }, + { id: 'sareaNm', title: '권역명' }, + { id: 'lrgeSareaNm', title: '대권역명' }, + { id: 'rvrNm', title: '하천명' }, + { id: 'addr', title: '주소' }, + { id: 'daddr', title: '상세주소' }, + { id: 'rdnmAddr', title: '도로명주소' }, + { id: 'dtlRdnmAddr', title: '상세도로명주소' }, + { id: 'dschgWtstNm', title: '방류수계명' }, + { id: 'pllnArea', title: '부지면적' }, + { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, + { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, + { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, + { id: 'xcrd', title: 'X좌표' }, + { id: 'ycrd', title: 'Y좌표' }, + // { id: 'oprtngSttsCd', title: '가동상태코드' }, + { id: 'rprsMsrcCn', title: '대표공법내용' }, + { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, + { id: 'sttyCrtrToc', title: '법정기준TOC' }, + { id: 'sttyCrtrSs', title: '법정기준SS' }, + { id: 'sttyCrtrTn', title: '법정기준총질소' }, + { id: 'sttyCrtrTph', title: '법정기준총인' }, + { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, + { id: 'bsnNm', title: '유역명' }, + // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; // 하수처리구역 export const SwtrmtPrcsZoneCol = [ - { id: 'swtrmtZoneSn', title: '하수처리구역 일련번호' }, - { id: 'swtrmtZoneNm', title: '하수처리구역명' }, - // { id: 'swtrmtFcltCd', title: '하수처리시설코드' }, - // { id: 'ctpvCd', title: '시도코드' }, - { id: 'ctpvNm', title: '시도명' }, - // { id: 'sggCd', title: '시군구코드' }, - { id: 'sggNm', title: '시군구명' }, - { id: 'swtrmtFcltNm', title: '하수처리시설명' }, + { id: 'swtrmtZoneSn', title: '하수처리구역 일련번호' }, + { id: 'swtrmtZoneNm', title: '하수처리구역명' }, + // { id: 'swtrmtFcltCd', title: '하수처리시설코드' }, + // { id: 'ctpvCd', title: '시도코드' }, + { id: 'ctpvNm', title: '시도명' }, + // { id: 'sggCd', title: '시군구코드' }, + { id: 'sggNm', title: '시군구명' }, + { id: 'swtrmtFcltNm', title: '하수처리시설명' }, ]; // 하수맨홀 export const MsSwageMhlCol = [ - { id: 'fid', title: 'FID' }, - { id: 'geom', title: 'geometry' }, - { id: 'ftreSmblCd', title: '지형지물부호코드' }, - { id: 'mngNo', title: '관리번호' }, - // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'mapshtNo', title: '도엽번호' }, - // { id: 'mngInstCd', title: '관리기관코드' }, - { id: 'instlYmd', title: '설치일자' }, - { id: 'lastDrdgnYmd', title: '최종준설일자' }, - { id: 'usgCd', title: '용도코드' }, - // { id: 'fcltyShpCd', title: '시설물형태코드' }, - { id: 'mhlKndCd', title: '맨홀종류코드' }, - { id: 'swageMhDiam', title: '하수맨홀구경' }, - { id: 'wdthLen', title: '가로길이' }, - { id: 'vrtcLen', title: '세로길이' }, - // { id: 'mqltCd', title: '재질코드' }, - { id: 'altdVl', title: '표고값' }, - { id: 'dpthlVl', title: '심도값' }, - { id: 'instMngNo', title:'기관관리번호'} + { id: 'fid', title: 'FID' }, + { id: 'geom', title: 'geometry' }, + { id: 'ftreSmblCd', title: '지형지물부호코드' }, + { id: 'mngNo', title: '관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'lastDrdgnYmd', title: '최종준설일자' }, + { id: 'usgCd', title: '용도코드' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + { id: 'mhlKndCd', title: '맨홀종류코드' }, + { id: 'swageMhDiam', title: '하수맨홀구경' }, + { id: 'wdthLen', title: '가로길이' }, + { id: 'vrtcLen', title: '세로길이' }, + // { id: 'mqltCd', title: '재질코드' }, + { id: 'altdVl', title: '표고값' }, + { id: 'dpthlVl', title: '심도값' }, + { id: 'instMngNo', title: '기관관리번호' } ]; // 중점우수토실 측정지점 export const untrtSwgRainCol1 = [ - { id: 'manage_no', title: '관리번호' }, - { id: 'swr_ppl_eqp_nm', title: '처리구역' }, - { id: 'swr_ppl_trt_nm', title: '처리분구' }, - { id: 'addr', title: '인근주소' }, - { id: 'chmbr_xcnts', title: '토실 위도' }, - { id: 'chmbr_ydnts', title: '토실 경도' } + { id: 'manage_no', title: '관리번호' }, + { id: 'swr_ppl_eqp_nm', title: '처리구역' }, + { id: 'swr_ppl_trt_nm', title: '처리분구' }, + { id: 'addr', title: '인근주소' }, + { id: 'chmbr_xcnts', title: '토실 위도' }, + { id: 'chmbr_ydnts', title: '토실 경도' } ]; // 중점우수토실 측정지점 시설현황 export const untrtSwgRainCol2 = [ - { id: 'flwmtr_mesure_tp_etc', title: '구분' }, - { id: 'discharge_pipe_spec', title: '방류관로 규격' }, - { id: 'swr_ppl_eqp_ar', title: '배수구역 면적(m²)' }, - { id: 'swr_trt_popl', title: '하수처리 인구(인)' }, - { id: 'screen_instl_at', title: '스크린설치 여부' }, - { id: 'weir_hg', title: '위어 높이(m)' }, - { id: 'weir_lt', title: '위어 길이(m)' } + { id: 'flwmtr_mesure_tp_etc', title: '구분' }, + { id: 'discharge_pipe_spec', title: '방류관로 규격' }, + { id: 'swr_ppl_eqp_ar', title: '배수구역 면적(m²)' }, + { id: 'swr_trt_popl', title: '하수처리 인구(인)' }, + { id: 'screen_instl_at', title: '스크린설치 여부' }, + { id: 'weir_hg', title: '위어 높이(m)' }, + { id: 'weir_lt', title: '위어 길이(m)' } ]; // 중점우수토실 강우정보 (id값 틀릴 수 있음) export const untrtSwgRainCol3 = [ - { id: 'rain_begin_dt', title: '강우시작일시' }, - { id: 'rain_end_dt', title: '강우종료일시' }, - { id: 'precdng_dry', title: '선행건기(h)' }, - { id: 'rain_info', title: '강우정보' }, - { id: 'rain_fall', title: '누적강우량(mm)' }, - { id: 'cntnc_time', title: '지속시간(h)' }, - { id: 'rain_in', title: '강우강도(mm/h)' } + { id: 'rain_begin_dt', title: '강우시작일시' }, + { id: 'rain_end_dt', title: '강우종료일시' }, + { id: 'precdng_dry', title: '선행건기(h)' }, + { id: 'rain_info', title: '강우정보' }, + { id: 'rain_fall', title: '누적강우량(mm)' }, + { id: 'cntnc_time', title: '지속시간(h)' }, + { id: 'rain_in', title: '강우강도(mm/h)' } ]; // 중점우수토실 측정정보 (id값 틀릴 수 있음) export const untrtSwgRainCol4 = [ - { id: 'mesure_begin_dt', title: '측정시작일시' }, - { id: 'mesure_end_dt', title: '측정종료일시' }, - { id: 'mesure_intrvl', title: '측정간격(분)' }, - { id: 'mesure_mhrls_instl_lc', title: '측정기기 설치위치' }, - { id: 'flwmtr_combined', title: '유량계 종류 및 모델명' }, // 합쳐진 컬럼 - { id: 'qltwtr_begin_dt', title: '채수시작일시' }, - { id: 'qltwtr_end_dt', title: '채수종료일시' }, - { id: 'qltwtr_co', title: '채수횟수' } + { id: 'mesure_begin_dt', title: '측정시작일시' }, + { id: 'mesure_end_dt', title: '측정종료일시' }, + { id: 'mesure_intrvl', title: '측정간격(분)' }, + { id: 'mesure_mhrls_instl_lc', title: '측정기기 설치위치' }, + { id: 'flwmtr_combined', title: '유량계 종류 및 모델명' }, // 합쳐진 컬럼 + { id: 'qltwtr_begin_dt', title: '채수시작일시' }, + { id: 'qltwtr_end_dt', title: '채수종료일시' }, + { id: 'qltwtr_co', title: '채수횟수' } ]; // 중점우수토실 수량/수질측정 정보 export const untrtSwgRainCol5 = [ - { id: 'odr', title: '회차' }, - { id: 'mesureDt', title: '측정일자' }, - { id: 'mesureQy', title: '수량(m)' }, - { id: 'mesureBod', title: 'BOD(mg/L)' }, - { id: 'mesureToc', title: 'TOC(mg/L)' }, - { id: 'mesureLoad', title: '오염부하량(kg)' } + { id: 'odr', title: '회차' }, + { id: 'mesureDt', title: '측정일자' }, + { id: 'mesureQy', title: '수량(m)' }, + { id: 'mesureBod', title: 'BOD(mg/L)' }, + { id: 'mesureToc', title: 'TOC(mg/L)' }, + { id: 'mesureLoad', title: '오염부하량(kg)' } ]; \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 1db284c8e..43f70de24 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -7,81 +7,81 @@ import InfilChart from './chart/infilChart'; // 하수관로 // TODO: RDII 버튼인가 그거 팝업 두개 구현 필요 const inputColumn = [ - { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, - { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, + { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, + { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "basu", title: "배수구역", type: "input" }, + { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, + { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, + { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, + { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; const SwtrmtFclt = ({ featureData }: { featureData: any }) => { - console.log("featureData", featureData); - const [isModalOpen, setIsModalOpen] = React.useState(false); - const [btnTxt, setBtnTxt] = useState<string>(""); - const openModal = (e: React.MouseEvent<HTMLButtonElement>) => { - e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) - setIsModalOpen(true); - }; - const closeModal = () => { - setIsModalOpen(false); - }; - const [repairData, setRepairData] = useState([ - { year: "2025", type: "개대체" }, - { year: "2025", type: "보수" }, - ]); - const [cleaningData, setCleaningData] = useState([ - { year: "2025", type: "청소" }, - { year: "2025", type: "준설" }, - ]); - const [inspectionData, setInspectionData] = useState([ - { year: "2025", type: "관로기술진단" }, - { year: "2025", type: "관로기술진단" }, - ]); - const dataMap = { - repair: { data: repairData, setData: setRepairData }, - cleaning: { data: cleaningData, setData: setCleaningData }, - inspection: { data: inspectionData, setData: setInspectionData }, - }; - const keysToExtract = [ - "swtrmt_zone_cd", - "mltv_dtdv_nm", - "fid", - "lyrTypeNm", - "reg_dt", - "mdfcn_dt", - "rgtr", - "mdfr", - ]; - // const filteredData = Object.entries(featureData) - // .filter(([key]) => keysToExtract.includes(key)) // 필요한 키만 필터링 - // .map(([key, value]) => ({ key, value: value ?? "N/A" })); // 테이블 데이터 형식으로 변환 + console.log("featureData", featureData); + const [isModalOpen, setIsModalOpen] = React.useState(false); + const [btnTxt, setBtnTxt] = useState<string>(""); + const openModal = (e: React.MouseEvent<HTMLButtonElement>) => { + e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) + setIsModalOpen(true); + }; + const closeModal = () => { + setIsModalOpen(false); + }; + const [repairData, setRepairData] = useState([ + { year: "2025", type: "개대체" }, + { year: "2025", type: "보수" }, + ]); + const [cleaningData, setCleaningData] = useState([ + { year: "2025", type: "청소" }, + { year: "2025", type: "준설" }, + ]); + const [inspectionData, setInspectionData] = useState([ + { year: "2025", type: "관로기술진단" }, + { year: "2025", type: "관로기술진단" }, + ]); + const dataMap = { + repair: { data: repairData, setData: setRepairData }, + cleaning: { data: cleaningData, setData: setCleaningData }, + inspection: { data: inspectionData, setData: setInspectionData }, + }; + const keysToExtract = [ + "swtrmt_zone_cd", + "mltv_dtdv_nm", + "fid", + "lyrTypeNm", + "reg_dt", + "mdfcn_dt", + "rgtr", + "mdfr", + ]; + // const filteredData = Object.entries(featureData) + // .filter(([key]) => keysToExtract.includes(key)) // 필요한 키만 필터링 + // .map(([key, value]) => ({ key, value: value ?? "N/A" })); // 테이블 데이터 형식으로 변환 - return ( - <div> - <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}></VerticalTable> - <InputSection title="보수 및 갱신" data={repairData} sectionKey="repair" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - <InputSection title="청소 및 준설" data={cleaningData} sectionKey="cleaning" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - <InputSection title="점검 및 진단" data={inspectionData} sectionKey="inspection" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - <div className="absolute bottom-0 left-0 w-full flex justify-start space-x-2 p-4"> - <Button - className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700" - onClick={openModal} - > - Infil - </Button> - <Button - className="px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700" - onClick={openModal} - > - RDII - </Button> - </div> - <InfilChart btnTxt={btnTxt} isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} /> - </div> - ) + return ( + <div> + <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }}></VerticalTable> + <InputSection title="보수 및 갱신" data={repairData} sectionKey="repair" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> + <InputSection title="청소 및 준설" data={cleaningData} sectionKey="cleaning" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> + <InputSection title="점검 및 진단" data={inspectionData} sectionKey="inspection" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> + <div className="absolute bottom-0 left-0 w-full flex justify-start space-x-2 p-4"> + <Button + className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700" + onClick={openModal} + > + Infil + </Button> + <Button + className="px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700" + onClick={openModal} + > + RDII + </Button> + </div> + <InfilChart btnTxt={btnTxt} isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} /> + </div> + ) } export default SwtrmtFclt \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 2ca7c174d..762929e69 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -4,10 +4,10 @@ import { Button, TableHead, TableRow } from '@common/components/ui'; import React from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; -const Ssc = ({ featureData, chkMainSsc, additionalData }: { - featureData: any, - chkMainSsc?: boolean, - additionalData?: any +const Ssc = ({ featureData, chkMainSsc, additionalData }: { + featureData: any, + chkMainSsc?: boolean, + additionalData?: any }) => { console.log('Additional data received:', additionalData); // 추가 데이터 확인용 @@ -128,7 +128,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { body={renderModalBody()} noHeaderYn='Y' noFooterYn='N' - // footerContent={renderFooterContent()} + // footerContent={renderFooterContent()} /> </div> } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/SwtrmtFclt.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/SwtrmtFclt.tsx index eef14ea5e..50d6d5606 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/SwtrmtFclt.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/SwtrmtFclt.tsx @@ -6,44 +6,44 @@ import React, { useState } from 'react' // 하수처리시설 const headList = [ - { id: "title", title: "하수도정비 기본계획보고서" }, - { id: "cad", title: "하수도대장 평면도" },] + { id: "title", title: "하수도정비 기본계획보고서" }, + { id: "cad", title: "하수도대장 평면도" },] const modalHeadList = [ - { id: "no", title: "번호" }, - { id: "year", title: "승인연도" }, - { id: "cad", title: '평면도'}, - { id: "fileNm", title: "파일명" }, - { id: "date", title: "입력시간" }, + { id: "no", title: "번호" }, + { id: "year", title: "승인연도" }, + { id: "cad", title: '평면도' }, + { id: "fileNm", title: "파일명" }, + { id: "date", title: "입력시간" }, ] const SwtrmtFclt = () => { - const [isModalOpen, setIsModalOpen] = useState(false); - const [modalTitle, setModalTitle] = useState<string>(''); - const openModal = (title:string) => { - setIsModalOpen(true); - setModalTitle(title) - }; - const closeModal = () => { - setIsModalOpen(false); - }; - return ( - <div> - <VerticalTable children={{ - title: <Button onClick={() => openModal('하수도정비 기본계획보고서')}>보고서</Button>, - cad: <Button onClick={() => openModal('하수도대장 평면도')}>평면도</Button>, - }} headName='디지털 자료관 연계정보' tableData={[]} headlist={headList} pageSize={20} total={0} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}></VerticalTable> - <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> - <div className='grid grid-col-2'> - <UiTable headName={modalTitle} tableData={[]} headlist={modalHeadList} pageSize={20} total={0} cellClick={undefined} children={undefined} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - } - }></UiTable> - </div> - </Modal> + const [isModalOpen, setIsModalOpen] = useState(false); + const [modalTitle, setModalTitle] = useState<string>(''); + const openModal = (title: string) => { + setIsModalOpen(true); + setModalTitle(title) + }; + const closeModal = () => { + setIsModalOpen(false); + }; + return ( + <div> + <VerticalTable children={{ + title: <Button onClick={() => openModal('하수도정비 기본계획보고서')}>보고서</Button>, + cad: <Button onClick={() => openModal('하수도대장 평면도')}>평면도</Button>, + }} headName='디지털 자료관 연계정보' tableData={[]} headlist={headList} pageSize={20} total={0} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }}></VerticalTable> + <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> + <div className='grid grid-col-2'> + <UiTable headName={modalTitle} tableData={[]} headlist={modalHeadList} pageSize={20} total={0} cellClick={undefined} children={undefined} onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + } + }></UiTable> </div> - ) + </Modal> + </div> + ) } export default SwtrmtFclt \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index ba0b70455..f82184db8 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -3,138 +3,138 @@ import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_compon import Modal from '@/components/ui/modal'; import { Button } from '@common/components/ui'; type ModalOpenProp = { - isModalOpen: boolean, - setIsModalOpen: (open: boolean) => void, - closeModal: () => void, - btnTxt?: string, + isModalOpen: boolean, + setIsModalOpen: (open: boolean) => void, + closeModal: () => void, + btnTxt?: string, } const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { - const [popupOpen, setPopupOpen] = React.useState(false); - const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 - const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 - const openPopup = () => { - if (buttonRef.current) { - const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 - setPopupPosition({ - top: rect.bottom + window.scrollY, // 버튼 아래쪽 - left: rect.left + window.scrollX, // 버튼 왼쪽 - }); - } + const [popupOpen, setPopupOpen] = React.useState(false); + const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 + const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 + const openPopup = () => { + if (buttonRef.current) { + const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 + setPopupPosition({ + top: rect.bottom + window.scrollY, // 버튼 아래쪽 + left: rect.left + window.scrollX, // 버튼 왼쪽 + }); + } setPopupOpen(true); // 팝업 열기 + }; + console.log("btnTxt", btnTxt); + const closePopup = () => { setPopupOpen(false); }; // 팝업 닫기 + const chartForm = CHART_FORM.LINE; + const chartData = { + chartData1: [ + { label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 }, + ], + chartData2: [ + { label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 }, + ], + } + const chartConfig = Object.values(chartData).flat().reduce((config, element) => { + config[element.label] = { + label: element.label, + color: "hsl(var(--chart-1))", }; - console.log("btnTxt", btnTxt); - const closePopup = () => {setPopupOpen(false);}; // 팝업 닫기 - const chartForm = CHART_FORM.LINE; - const chartData = { - chartData1: [ - { label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 }, - ], - chartData2: [ - { label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 }, - ], - } - const chartConfig = Object.values(chartData).flat().reduce((config, element) => { - config[element.label] = { - label: element.label, - color: "hsl(var(--chart-1))", - }; - return config; - }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; - const getCurrentDate = () => { - const today = new Date(); - const year = today.getFullYear(); - const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 - return `${year}-${month}`; - }; - return ( - <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> - {/* 분석 입력현황 조회 */} - <div className='grid grid-cols-4 gap-4'> - <div className="grid grid-rows-4 gap-4 mb-4"> - <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> - 분석 입력현황 조회 - </Button> + return config; + }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; + const getCurrentDate = () => { + const today = new Date(); + const year = today.getFullYear(); + const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 + return `${year}-${month}`; + }; + return ( + <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> + {/* 분석 입력현황 조회 */} + <div className='grid grid-cols-4 gap-4'> + <div className="grid grid-rows-4 gap-4 mb-4"> + <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> + 분석 입력현황 조회 + </Button> - {/* 침입수량 분석결과 */} - <div className="bg-white text-red-600 font-bold px-4 py-2 "> - 침입수량 분석결과 - <div className="flex items-center mt-2"> - <span className="text-black text-xl font-bold">120</span> - <span className="ml-2 text-black">m³/d</span> - </div> - </div> - </div> - {/* 차트 */} - <div className="w-[500px] h-[300px] bg-white p-4"> - <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} /> - </div> + {/* 침입수량 분석결과 */} + <div className="bg-white text-red-600 font-bold px-4 py-2 "> + 침입수량 분석결과 + <div className="flex items-center mt-2"> + <span className="text-black text-xl font-bold">120</span> + <span className="ml-2 text-black">m³/d</span> </div> - {popupOpen && ( - <div - className="absolute bg-gray-100 border border-gray-300 w-[320px] shadow-lg p-4 rounded" - style={{ - top: popupPosition.top, - left: popupPosition.left, - zIndex: 1000, - }} - > - <div className="text-lg font-bold mb-2">분석 입력현황</div> - <div className="grid grid-cols-2 gap-2"> - <div>상수사용량 정보:</div> - <div> - <input type='month' defaultValue={getCurrentDate()} className="border border-gray-300 rounded px-2 py-1"/> - </div> - <div>오수 전환율:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>0.85</option> - <option>0.90</option> - </select> - </div> - <div>수용가-맨홀 매칭:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>매칭(양평).shp</option> - <option>매칭(서울).shp</option> - </select> - </div> - <div>관망도 자료:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>양평.inp</option> - <option>서울.inp</option> - </select> - </div> - {btnTxt === 'RDII' ? <><div>강우 자료:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>R20240815.xlsx</option> - </select> - </div> - <div>RTX 계수 출처:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>2015년 하수도정비기본계획</option> - </select> - </div> - </> : null} - </div> - <div className="flex justify-end mt-4 space-x-2"> - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> - 저장 - </button> - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> - 종료 - </button> - </div> - </div> - )} - </Modal> - ) + </div> + </div> + {/* 차트 */} + <div className="w-[500px] h-[300px] bg-white p-4"> + <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} /> + </div> + </div> + {popupOpen && ( + <div + className="absolute bg-gray-100 border border-gray-300 w-[320px] shadow-lg p-4 rounded" + style={{ + top: popupPosition.top, + left: popupPosition.left, + zIndex: 1000, + }} + > + <div className="text-lg font-bold mb-2">분석 입력현황</div> + <div className="grid grid-cols-2 gap-2"> + <div>상수사용량 정보:</div> + <div> + <input type='month' defaultValue={getCurrentDate()} className="border border-gray-300 rounded px-2 py-1" /> + </div> + <div>오수 전환율:</div> + <div> + <select className="border border-gray-300 rounded px-2 py-1"> + <option>0.85</option> + <option>0.90</option> + </select> + </div> + <div>수용가-맨홀 매칭:</div> + <div> + <select className="border border-gray-300 rounded px-2 py-1"> + <option>매칭(양평).shp</option> + <option>매칭(서울).shp</option> + </select> + </div> + <div>관망도 자료:</div> + <div> + <select className="border border-gray-300 rounded px-2 py-1"> + <option>양평.inp</option> + <option>서울.inp</option> + </select> + </div> + {btnTxt === 'RDII' ? <><div>강우 자료:</div> + <div> + <select className="border border-gray-300 rounded px-2 py-1"> + <option>R20240815.xlsx</option> + </select> + </div> + <div>RTX 계수 출처:</div> + <div> + <select className="border border-gray-300 rounded px-2 py-1"> + <option>2015년 하수도정비기본계획</option> + </select> + </div> + </> : null} + </div> + <div className="flex justify-end mt-4 space-x-2"> + <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> + 저장 + </button> + <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> + 종료 + </button> + </div> + </div> + )} + </Modal> + ) } export default InfilChart \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index 5776df5b2..3867e16f9 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -1,17 +1,17 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' const inputColumn = [ - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "freq", title: "설계빈도", type: "input" }, + { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, + { id: "freq", title: "설계빈도", type: "input" }, ] // 오수펌프 const sewagePump = ({ featureData }: { featureData: any }) => { return ( <div><VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={0} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error('Function not implemented.'); - }} /> - </div> + throw new Error('Function not implemented.'); + }} /> + </div> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx index e693a28ce..c2463ddfb 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx @@ -2,19 +2,19 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "bungu", title: "배수분구", type: "input" }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, - {id:'spec', title:'규격', type:'input'}, + { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "basu", title: "배수구역", type: "input" }, + { id: "bungu", title: "배수분구", type: "input" }, + { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, + { id: 'spec', title: '규격', type: 'input' }, ]; const Smh = () => { return ( - <div> - <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { + <div> + <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { throw new Error("Function not implemented."); - }}></VerticalTable> - </div> + }}></VerticalTable> + </div> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx index eefef8b3b..a82ee45b2 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx @@ -1,18 +1,18 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' const inputColumn = [ - { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, + { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, + { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, ] // 빗물펌프 const StormWaterPump = ({ featureData }: { featureData: Record<string, any> }) => { const validKey = inputColumn.map((item) => item.id); - const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record<string, any>, [key, value]) => {obj[key] = value; return obj;}, {}); + const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record<string, any>, [key, value]) => { obj[key] = value; return obj; }, {}); return ( <div><VerticalTable headName='자체 입력정보' tableData={[filteredData]} headlist={inputColumn} pageSize={0} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error('Function not implemented.'); - }} /> - </div> + throw new Error('Function not implemented.'); + }} /> + </div> ) } diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 24174585c..064d8bc2d 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -9,202 +9,202 @@ import { getLayerContentComponent } from "./components/common"; import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2 } from "./components/common/table"; // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { - const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject<number[]>; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; - // const featureId = featureData.getId(); // 피처의 id 가져오기 - const featureId = typeof featureData.getId === 'function' - ? featureData.getId() - : featureData.fid; - const [layerNm, setLayerNm] = useState<string>(""); // 레이어 이름 상태 - const [tableData, setTableData] = useState<any>(null); // 피처 데이터 - const [mntrngsData, setMntrngsData] = useState(false); // 수량/수질 측정 정보 - const [headlist, setHeadlist] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 - const [headlist2, setHeadlist2] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 - const [buttonChk, setButtonChk] = useState(true) - const [fetchData, setfetchData] = useState<any>(); // api 호출여부 - const contentRef = useRef<HTMLDivElement>(null); - const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태 - const [chkMainSsc, setChkMainSsc] = useState(false); // 중점우수토실 여부 + const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject<number[]>; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; + // const featureId = featureData.getId(); // 피처의 id 가져오기 + const featureId = typeof featureData.getId === 'function' + ? featureData.getId() + : featureData.fid; + const [layerNm, setLayerNm] = useState<string>(""); // 레이어 이름 상태 + const [tableData, setTableData] = useState<any>(null); // 피처 데이터 + const [mntrngsData, setMntrngsData] = useState(false); // 수량/수질 측정 정보 + const [headlist, setHeadlist] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 + const [headlist2, setHeadlist2] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 + const [buttonChk, setButtonChk] = useState(true) + const [fetchData, setfetchData] = useState<any>(); // api 호출여부 + const contentRef = useRef<HTMLDivElement>(null); + const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태 + const [chkMainSsc, setChkMainSsc] = useState(false); // 중점우수토실 여부 - // 피쳐데이터의 현재 레이어 이름 가져오는 함수 - const getSelectedLayers = () => { - let result = null; - const layers = gisMap.getLayers().getArray(); // gisMap에서 모든 레이어 가져오기 - let featureLayer: { get: (key: string) => any } = { get: (key: string) => null }; // 피처가 속한 레이어를 찾기 위한 변수 - layers.forEach((layer: any) => { - const source = layer.getSource(); - if (source && source.hasFeature && featureData - && typeof featureData.getId === 'function' && source.hasFeature(featureData)) { - featureLayer = layer; // 피처가 속한 레이어 찾기 - } - }); - // SearchModal 클릭 이벤트와 Gis 클릭 이벤트 구분하기 - if (featureLayer.get('lyrNm') === null) { - if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; - else if (featureData.lyrTypeNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; - else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; - } - else result = featureLayer.get('lyrNm'); - - return result; - // return featureLayer.get('lyrNm'); // 레이어 이름 출력 - }; - - useEffect(() => { - const fetchData = async () => { - if (featureId) { - const selectedLayerName = getSelectedLayers(); // 레이어 이름 가져오기 - setLayerNm(selectedLayerName); // 상태 업데이트 - const layerId = featureId.split('.')[0] - let data = await getData(`v1/fclts/${featureId}?lyrTypeNm=${layerId}`); - setfetchData(data) - switch (selectedLayerName) { - case '하수처리시설': - setHeadlist(SwtrmtFcltCol); - setButtonChk(false) - break; - case '하수처리구역': - setHeadlist(SwtrmtPrcsZoneCol) - setButtonChk(false) - break; - case '중점우수토실': - setHeadlist(untrtSwgRainCol1) - setHeadlist2(untrtSwgRainCol2) - setButtonChk(false) - setChkMainSsc(true) - - // 데이터 전처리: 합쳐진 필드 추가 - data = data ? { - ...data, - discharge_pipe_spec: `직경: ${data.pipe_diameter || '-'} / 높이: ${data.pipe_hg || '-'} / 길이: ${data.pipe_lt || '-'}` - } : {}; - - // 수량/수질측정 정보 데이터 호출 - const additionalResponse = await getData(`v1/onsemiro/swgRain/${data.adst_dstr_cd}/${data.manage_no}/mntrngs`); - setMntrngsData(additionalResponse.content); - break; - case '우수토실': - setButtonChk(true) - break; - case '하수관로': - setButtonChk(true) - break; - case '오수펌프': - setButtonChk(true) - break; - case '빗물펌프': - setButtonChk(true) - break; - case '하수맨홀': - setButtonChk(true) - break; - default: - break; - } - setTableData(data); - }; - } - fetchData(); - }, [featureId]); - - // 저장 시 모달 띄우기 - const handleSaveClick = () => { - setIsModalOpen(true); // 모달 열기 - }; - - const handleModalSave = () => { - setIsModalOpen(false); // 모달 닫기 - btnClickEvent(); // 저장 이벤트 실행 - }; - - const handleModalClose = () => { - setIsModalOpen(false); // 모달 닫기 - }; - - const btnClickEvent = async () => { - const bodyData: Record<string, any> = {} - if (buttonChk && contentRef.current) { - const inputElements = contentRef.current.querySelectorAll('input'); - const selectElements = contentRef.current.querySelectorAll('select'); - // 카멜케이스 변환 함수 - const toCamelCase = (str: string) => - str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()); - // select 태그의 값 가져오기 - selectElements.forEach((select) => { - const camelCaseId = toCamelCase(select.id); - bodyData[camelCaseId] = select.value; - }); - // input 태그의 값 가져오기 - inputElements.forEach((input) => { - const camelCaseId = toCamelCase(input.id); - bodyData[camelCaseId] = input.value; - }); - if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' - else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' - else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' - else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' - else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' - bodyData['fid'] = featureId - const data = await putData(`v1/fclts/${featureId}`, bodyData); - if (data.status == 200) { - alert('저장되었습니다') - setTableData(data) - setfetchData(data) - } - } + // 피쳐데이터의 현재 레이어 이름 가져오는 함수 + const getSelectedLayers = () => { + let result = null; + const layers = gisMap.getLayers().getArray(); // gisMap에서 모든 레이어 가져오기 + let featureLayer: { get: (key: string) => any } = { get: (key: string) => null }; // 피처가 속한 레이어를 찾기 위한 변수 + layers.forEach((layer: any) => { + const source = layer.getSource(); + if (source && source.hasFeature && featureData + && typeof featureData.getId === 'function' && source.hasFeature(featureData)) { + featureLayer = layer; // 피처가 속한 레이어 찾기 + } + }); + // SearchModal 클릭 이벤트와 Gis 클릭 이벤트 구분하기 + if (featureLayer.get('lyrNm') === null) { + if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; + else if (featureData.lyrTypeNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; + else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; } - const ContentComponent = layerNm ? getLayerContentComponent(layerNm) : null; - return ( - <div id="popup" className="absolute top-0 right-0 w-[350px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-[50]"> - <div className="card-header bg-primary flex items-center justify-between p-4"> - <div className="flex mx-3 flex-col"> - <h3 className="text-2xl font-medium text-white text-label">{layerNm} 정보</h3> - {/* <div className="font-medium text-white text-label">(00구 00리 하수관로)</div> */} - </div> - <button - onClick={onClose} - className="text-white hover:text-gray-700 focus:outline-none" - aria-label="닫기" - > - ✕ - </button> - </div> - <div className="overflow-y-auto overflow-x-hidden flex-1" ref={contentRef}> - <VerticalTable - headName='LX 연계정보' - tableName1={layerNm === '중점우수토실' ? "측정지점" : undefined} - tableData={[tableData]} - headlist={headlist} - pageSize={20} - total={0} - children={undefined} - cellClick={undefined} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }} - // 두 번째 테이블 조건부 props - showSecondTable={layerNm === '중점우수토실' ? true : false} - tableName2={layerNm === '중점우수토실' ? "시설현황" : undefined} - tableData2={layerNm === '중점우수토실' && tableData ? [tableData] : []} - headlist2={layerNm === '중점우수토실' ? headlist2 : undefined} - pageSize2={20} - total2={0} - isEditable2={buttonChk} - /> - <div className="w-full mx-5 flex items-center justify-end space-x-2"> - {buttonChk ? <Button onClick={handleSaveClick} className="px-4 mr-5 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700"> - 저장 - </Button> : null} - </div> - <Modal isModalOpen={isModalOpen} title="자체입력정보 저장" setIsModalOpen={setIsModalOpen} closeModal={handleModalClose} saveModal={handleModalSave}><div className="text-lg">정보를 저장하시겠습니까?</div></Modal> - {ContentComponent && - <ContentComponent - featureData={fetchData} - chkMainSsc={chkMainSsc} - additionalData={mntrngsData} - /> - } - </div> + else result = featureLayer.get('lyrNm'); + + return result; + // return featureLayer.get('lyrNm'); // 레이어 이름 출력 + }; + + useEffect(() => { + const fetchData = async () => { + if (featureId) { + const selectedLayerName = getSelectedLayers(); // 레이어 이름 가져오기 + setLayerNm(selectedLayerName); // 상태 업데이트 + const layerId = featureId.split('.')[0] + let data = await getData(`v1/fclts/${featureId}?lyrTypeNm=${layerId}`); + setfetchData(data) + switch (selectedLayerName) { + case '하수처리시설': + setHeadlist(SwtrmtFcltCol); + setButtonChk(false) + break; + case '하수처리구역': + setHeadlist(SwtrmtPrcsZoneCol) + setButtonChk(false) + break; + case '중점우수토실': + setHeadlist(untrtSwgRainCol1) + setHeadlist2(untrtSwgRainCol2) + setButtonChk(false) + setChkMainSsc(true) + + // 데이터 전처리: 합쳐진 필드 추가 + data = data ? { + ...data, + discharge_pipe_spec: `직경: ${data.pipe_diameter || '-'} / 높이: ${data.pipe_hg || '-'} / 길이: ${data.pipe_lt || '-'}` + } : {}; + + // 수량/수질측정 정보 데이터 호출 + const additionalResponse = await getData(`v1/onsemiro/swgRain/${data.adst_dstr_cd}/${data.manage_no}/mntrngs`); + setMntrngsData(additionalResponse.content); + break; + case '우수토실': + setButtonChk(true) + break; + case '하수관로': + setButtonChk(true) + break; + case '오수펌프': + setButtonChk(true) + break; + case '빗물펌프': + setButtonChk(true) + break; + case '하수맨홀': + setButtonChk(true) + break; + default: + break; + } + setTableData(data); + }; + } + fetchData(); + }, [featureId]); + + // 저장 시 모달 띄우기 + const handleSaveClick = () => { + setIsModalOpen(true); // 모달 열기 + }; + + const handleModalSave = () => { + setIsModalOpen(false); // 모달 닫기 + btnClickEvent(); // 저장 이벤트 실행 + }; + + const handleModalClose = () => { + setIsModalOpen(false); // 모달 닫기 + }; + + const btnClickEvent = async () => { + const bodyData: Record<string, any> = {} + if (buttonChk && contentRef.current) { + const inputElements = contentRef.current.querySelectorAll('input'); + const selectElements = contentRef.current.querySelectorAll('select'); + // 카멜케이스 변환 함수 + const toCamelCase = (str: string) => + str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()); + // select 태그의 값 가져오기 + selectElements.forEach((select) => { + const camelCaseId = toCamelCase(select.id); + bodyData[camelCaseId] = select.value; + }); + // input 태그의 값 가져오기 + inputElements.forEach((input) => { + const camelCaseId = toCamelCase(input.id); + bodyData[camelCaseId] = input.value; + }); + if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' + else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' + else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' + else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' + else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' + bodyData['fid'] = featureId + const data = await putData(`v1/fclts/${featureId}`, bodyData); + if (data.status == 200) { + alert('저장되었습니다') + setTableData(data) + setfetchData(data) + } + } + } + const ContentComponent = layerNm ? getLayerContentComponent(layerNm) : null; + return ( + <div id="popup" className="absolute top-0 right-0 w-[350px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-[50]"> + <div className="card-header bg-primary flex items-center justify-between p-4"> + <div className="flex mx-3 flex-col"> + <h3 className="text-2xl font-medium text-white text-label">{layerNm} 정보</h3> + {/* <div className="font-medium text-white text-label">(00구 00리 하수관로)</div> */} </div> - ) + <button + onClick={onClose} + className="text-white hover:text-gray-700 focus:outline-none" + aria-label="닫기" + > + ✕ + </button> + </div> + <div className="overflow-y-auto overflow-x-hidden flex-1" ref={contentRef}> + <VerticalTable + headName='LX 연계정보' + tableName1={layerNm === '중점우수토실' ? "측정지점" : undefined} + tableData={[tableData]} + headlist={headlist} + pageSize={20} + total={0} + children={undefined} + cellClick={undefined} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }} + // 두 번째 테이블 조건부 props + showSecondTable={layerNm === '중점우수토실' ? true : false} + tableName2={layerNm === '중점우수토실' ? "시설현황" : undefined} + tableData2={layerNm === '중점우수토실' && tableData ? [tableData] : []} + headlist2={layerNm === '중점우수토실' ? headlist2 : undefined} + pageSize2={20} + total2={0} + isEditable2={buttonChk} + /> + <div className="w-full mx-5 flex items-center justify-end space-x-2"> + {buttonChk ? <Button onClick={handleSaveClick} className="px-4 mr-5 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700"> + 저장 + </Button> : null} + </div> + <Modal isModalOpen={isModalOpen} title="자체입력정보 저장" setIsModalOpen={setIsModalOpen} closeModal={handleModalClose} saveModal={handleModalSave}><div className="text-lg">정보를 저장하시겠습니까?</div></Modal> + {ContentComponent && + <ContentComponent + featureData={fetchData} + chkMainSsc={chkMainSsc} + additionalData={mntrngsData} + /> + } + </div> + </div> + ) } export default FeatureClickEventPopup; \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/page.tsx b/apps/sn/app/(map-layout)/map/page.tsx index 9b42a26f9..55bd0f123 100644 --- a/apps/sn/app/(map-layout)/map/page.tsx +++ b/apps/sn/app/(map-layout)/map/page.tsx @@ -38,7 +38,7 @@ const Map = () => { const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); // SearchModal 열림 상태 const [featureData, setFeatureData] = useState(null); // 선택된 피쳐 데이터 - + const fetchData = async () => { try { const data = await getData('v1/map/lyrStngs/SN_NETWORK'); diff --git a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index 8f3cdcd44..967676c8d 100644 --- a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -10,55 +10,55 @@ import { useEffect, useState, type ReactNode } from 'react' import LoadingOverlay from '@/components/ui/LoadingBar' type TitleName = { - mainTitle: string - firstCardTitle: string - secondCardTitle?: string + mainTitle: string + firstCardTitle: string + secondCardTitle?: string } type SelectBox = { - labelNm?: Label - searchChk?: boolean - title?: string; - onSearchClick?: () => Promise<void>; + labelNm?: Label + searchChk?: boolean + title?: string; + onSearchClick?: () => Promise<void>; } type Label = { - first: string - second: string - third: string - fourth: string + first: string + second: string + third: string + fourth: string } // API로부터 받아올 데이터 타입을 정의 (SelectBox에 사용될 형태) interface ApiSelectOption { - text: string; - val: string; + text: string; + val: string; } type BaseLayout = { - children?: ReactNode[] - titleName: TitleName - form: any - onSubmitEvent: Function - graphBtn?: boolean - analysisBtn?: string - firstDivBtn?: boolean - selectBox?: SelectBox - showDatePicker?: boolean; - enoCd?: string | number - setEnoCd?: (enoCd: string) => void - ctpvCd?: string | number - setCtpvCd?: (ctpvCd: string) => void - sigungu?: ApiSelectOption - setSigungu?: (sigungu: ApiSelectOption) => void - selectedSwageTreatmentPlant?: string | number; - onSwageTreatmentPlantChange?: (value: string | number) => void; - selectedSwageProcessingZone?: string | number; - onSwageProcessingZoneChange?: (value: string | number) => void; - aplcnYm?: Date - setAplcnYm?: (aplcnYm: Date | undefined) => void; - isLoading?: boolean; - // Excel 다운로드 관련 props 추가 - onExcelDownload?: () => void; - onDeleteFile?: () => void; - onAnalysis?: () => void; - selectedRowData?: any; + children?: ReactNode[] + titleName: TitleName + form: any + onSubmitEvent: Function + graphBtn?: boolean + analysisBtn?: string + firstDivBtn?: boolean + selectBox?: SelectBox + showDatePicker?: boolean; + enoCd?: string | number + setEnoCd?: (enoCd: string) => void + ctpvCd?: string | number + setCtpvCd?: (ctpvCd: string) => void + sigungu?: ApiSelectOption + setSigungu?: (sigungu: ApiSelectOption) => void + selectedSwageTreatmentPlant?: string | number; + onSwageTreatmentPlantChange?: (value: string | number) => void; + selectedSwageProcessingZone?: string | number; + onSwageProcessingZoneChange?: (value: string | number) => void; + aplcnYm?: Date + setAplcnYm?: (aplcnYm: Date | undefined) => void; + isLoading?: boolean; + // Excel 다운로드 관련 props 추가 + onExcelDownload?: () => void; + onDeleteFile?: () => void; + onAnalysis?: () => void; + selectedRowData?: any; } // TODO: 나중에 이벤트 추가되면 파라미터 추가 필요 ? /** @@ -71,207 +71,207 @@ type BaseLayout = { * @returns */ const BaseLayout = ({ - children, - titleName, - form, - onSubmitEvent, - graphBtn = false, - analysisBtn, - selectBox, - showDatePicker = false, - enoCd, - setEnoCd, - ctpvCd, - setCtpvCd, - sigungu, - setSigungu, - selectedSwageTreatmentPlant, - onSwageTreatmentPlantChange, - selectedSwageProcessingZone, - onSwageProcessingZoneChange, - aplcnYm, - setAplcnYm, - isLoading, - // Excel 다운로드 관련 props 추가 - onExcelDownload, - onDeleteFile, - onAnalysis, - selectedRowData + children, + titleName, + form, + onSubmitEvent, + graphBtn = false, + analysisBtn, + selectBox, + showDatePicker = false, + enoCd, + setEnoCd, + ctpvCd, + setCtpvCd, + sigungu, + setSigungu, + selectedSwageTreatmentPlant, + onSwageTreatmentPlantChange, + selectedSwageProcessingZone, + onSwageProcessingZoneChange, + aplcnYm, + setAplcnYm, + isLoading, + // Excel 다운로드 관련 props 추가 + onExcelDownload, + onDeleteFile, + onAnalysis, + selectedRowData }: BaseLayout) => { - const defaultOption: ApiSelectOption = { val: '0', text: '선택' }; + const defaultOption: ApiSelectOption = { val: '0', text: '선택' }; - const [processingZoneOptions, setProcessingZoneOptions] = useState<ApiSelectOption[]>([]); - const [treatmentFacilityOptions, setTreatmentFacilityOptions] = useState<ApiSelectOption[]>([]); - const [isLoadingAreaData, setIsLoadingAreaData] = useState<boolean>(isLoading || false); - const [atflId, setAtflId] = useState('') - const [fileNm, setFileNm] = useState('') - const [dcrpPplMtncBizSn, setDcrpPplMtncBizSn] = useState('') + const [processingZoneOptions, setProcessingZoneOptions] = useState<ApiSelectOption[]>([]); + const [treatmentFacilityOptions, setTreatmentFacilityOptions] = useState<ApiSelectOption[]>([]); + const [isLoadingAreaData, setIsLoadingAreaData] = useState<boolean>(isLoading || false); + const [atflId, setAtflId] = useState('') + const [fileNm, setFileNm] = useState('') + const [dcrpPplMtncBizSn, setDcrpPplMtncBizSn] = useState('') - useEffect(() => { - const fetchData = async () => { - if (!sigungu || sigungu.val === '0' || !sigungu.val) { - console.log("BaseLayout: Skipping fetchData because sigungu.val is:", sigungu?.val); - setProcessingZoneOptions([defaultOption]); - setTreatmentFacilityOptions([defaultOption]); - setIsLoadingAreaData(false); - return; - } + useEffect(() => { + const fetchData = async () => { + if (!sigungu || sigungu.val === '0' || !sigungu.val) { + console.log("BaseLayout: Skipping fetchData because sigungu.val is:", sigungu?.val); + setProcessingZoneOptions([defaultOption]); + setTreatmentFacilityOptions([defaultOption]); + setIsLoadingAreaData(false); + return; + } - setIsLoadingAreaData(true); - try { - const queryParamsZone = new URLSearchParams({ - lyrTypeNm: 'tb_ms_swage_prcs_zone', - page: '0', - size: '100000', - sort: 'string', - }); - const cqlFiltersZone: string[] = []; - if (sigungu.val && sigungu.val !== '0') { - // console.log("시군구 코드", sigungu.val); - cqlFiltersZone.push(`sgg_cd='${sigungu.val}'`); - } - if (cqlFiltersZone.length > 0) { - queryParamsZone.append('cqlFiter', cqlFiltersZone.join(' and ')); - } - - const queryParamsFacility = new URLSearchParams({ - lyrTypeNm: 'tb_il_swage_prcs_fclt', - page: '0', - size: '100000', // 요청하신 URL에 맞게 50으로 변경 가능 - sort: 'string', - }); - const cqlFiltersFacility: string[] = []; - if (sigungu.text && sigungu.val !== '0') { - cqlFiltersFacility.push(`sgg_nm ILIKE '%${sigungu.text}%'`); - } - if (cqlFiltersFacility.length > 0) { - queryParamsFacility.append('cqlFiter', cqlFiltersFacility.join(' and ')); // API 명세에 따라 cqlFilter 또는 cqlFiter - } - - console.log("BaseLayout API URL for Zones:", `v1/fclts?${queryParamsZone.toString()}`); - console.log("BaseLayout API URL for Facilities:", `v1/fclts?${queryParamsFacility.toString()}`); - - const [zoneRes, facilityRes] = await Promise.all([ - getData(`v1/fclts?${queryParamsZone.toString()}`), - getData(`v1/fclts?${queryParamsFacility.toString()}`) - ]); - - const zones = (zoneRes.data || []).map((item: any) => ({ - text: item.swtrmtZoneNm || item.name || `구역 ${item.id || item.gid || item.objectid}`, - val: item.fid || item.id || item.gid || item.objectid - })); - setProcessingZoneOptions([defaultOption, ...zones]); - console.log("BaseLayout Fetched Processing Zones:", [defaultOption, ...zones]); - - - const facilities = (facilityRes.data || []).map((item: any) => ({ - text: item.swtrmtFcltNm || item.name || `시설 ${item.id || item.gid || item.objectid}`, - val: item.fid || item.id || item.gid || item.objectid - })); - setTreatmentFacilityOptions([defaultOption, ...facilities]); - console.log("BaseLayout Fetched Treatment Facilities:", [defaultOption, ...facilities]); - - } catch (error) { - console.error("BaseLayout: 지역/시설 데이터 조회 중 오류 발생:", error); - setProcessingZoneOptions([defaultOption]); - setTreatmentFacilityOptions([defaultOption]); - } finally { - setIsLoadingAreaData(false); - } - }; - - fetchData(); - }, [sigungu]); // sigungu 상태가 변경될 때마다 실행 - - // 파일 다운로드 - const isChckFile = () => { - // Excel 다운로드 함수가 있으면 Excel 다운로드 실행 - if (onExcelDownload) { - onExcelDownload(); - return; + setIsLoadingAreaData(true); + try { + const queryParamsZone = new URLSearchParams({ + lyrTypeNm: 'tb_ms_swage_prcs_zone', + page: '0', + size: '100000', + sort: 'string', + }); + const cqlFiltersZone: string[] = []; + if (sigungu.val && sigungu.val !== '0') { + // console.log("시군구 코드", sigungu.val); + cqlFiltersZone.push(`sgg_cd='${sigungu.val}'`); } - return true - } - // 파일 삭제 - const isDeleteFile = async () => { - // Excel 다운로드 함수가 있으면 Excel 다운로드 실행 - if (onDeleteFile) { - onDeleteFile(); - return; + if (cqlFiltersZone.length > 0) { + queryParamsZone.append('cqlFiter', cqlFiltersZone.join(' and ')); } - } - return ( - <Form {...form} className="min-h-screen flex flex-col"> - <LoadingOverlay isLoading={isLoading ?? false} /> - <ListDiv> - {/* searchBox.title이 있으면 h3 태그로 제목을 표시합니다. */} - {selectBox?.title && ( - <div className="card-header"> - <h3 className="text-2xl font-medium">{selectBox.title}</h3> - </div> - )} - <div className="flex items-center w-full"> - {showDatePicker && ( // showDatePicker 값에 따라 DatePicker 렌더링 - <> - <Label className="ml-4 w-20 text-xl text-gray-600 whitespace-nowrap">분석기간</Label> - <DatePicker - mode={"single"} - field={{ - value: aplcnYm ?? new Date(), - onChange: setAplcnYm ?? ((date: Date | undefined) => console.log("DatePicker onChange:", date)) - }} - selectClass="ml-5 date-picker-trigger" /> - </> - )} - <GovSidoSigunguSearchForm - isShowPart={true} - setRtnEnvPartValue={(val) => setEnoCd?.(val)} - setRtnEnvPartSidoValue={(val) => setCtpvCd?.(val)} - setRtnEnvPartSigunValue={setSigungu} // 선택된 시군구 값을 받을 콜백 함수 전달 - > - <SelectBox2 label={"하수처리장"} value={selectedSwageTreatmentPlant} selectArray={treatmentFacilityOptions} className="col-span-3" selectClass="rounded-lg bg-white truncate" onSelectValue={(val) => onSwageTreatmentPlantChange?.(val)} /> - {/* <SelectBox2 label={"하수처리구역"} value={selectedSwageProcessingZone} selectArray={processingZoneOptions} className="col-span-3" selectClass="rounded-lg bg-white truncate" onSelectValue={(val) => onSwageProcessingZoneChange?.(val)} /> */} - </GovSidoSigunguSearchForm> - {selectBox?.searchChk ? <SearchFormRight><Button size="sm" onClick={() => selectBox.onSearchClick?.()}>조회</Button></SearchFormRight> : null} - </div> - </ListDiv> - <ListDiv> - <div className="card-header"> - <h3 className="text-2xl font-medium">{titleName.firstCardTitle}</h3> - <div> - {graphBtn ? <Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile}>파일 다운로드</Button> : null} - {/* 그래프 있을 시 */} - {graphBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> : null} - {/* 분석 버튼 */} - {analysisBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={onAnalysis}>{analysisBtn}</Button> : null} - </div> - </div> - <Form {...form}> - <form onSubmit={form.handleSubmit(onSubmitEvent)} className="flex-grow flex flex-col"> - <div className="card !m-[1.2rem] flex-grow flex flex-col"> - {/* 폼 정보 입력 칸 */} - {children?.[0]} - </div> - </form> - </Form> - </ListDiv> - { - children?.[1] != null ? <ListDiv> - <div className="card-header flex items-center justify-between"> - <h3 className="text-2xl font-medium">{titleName?.secondCardTitle}</h3> - <div> - {graphBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm">파일 다운로드</Button> : null} - {/* 그래프 있을 시 */} - {graphBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm">삭제</Button> : null} - </div> - </div> - <div className="card !m-[1.2rem]">{children?.[1]}</div> - </ListDiv> : null - } + const queryParamsFacility = new URLSearchParams({ + lyrTypeNm: 'tb_il_swage_prcs_fclt', + page: '0', + size: '100000', // 요청하신 URL에 맞게 50으로 변경 가능 + sort: 'string', + }); + const cqlFiltersFacility: string[] = []; + if (sigungu.text && sigungu.val !== '0') { + cqlFiltersFacility.push(`sgg_nm ILIKE '%${sigungu.text}%'`); + } + if (cqlFiltersFacility.length > 0) { + queryParamsFacility.append('cqlFiter', cqlFiltersFacility.join(' and ')); // API 명세에 따라 cqlFilter 또는 cqlFiter + } + + console.log("BaseLayout API URL for Zones:", `v1/fclts?${queryParamsZone.toString()}`); + console.log("BaseLayout API URL for Facilities:", `v1/fclts?${queryParamsFacility.toString()}`); + + const [zoneRes, facilityRes] = await Promise.all([ + getData(`v1/fclts?${queryParamsZone.toString()}`), + getData(`v1/fclts?${queryParamsFacility.toString()}`) + ]); + + const zones = (zoneRes.data || []).map((item: any) => ({ + text: item.swtrmtZoneNm || item.name || `구역 ${item.id || item.gid || item.objectid}`, + val: item.fid || item.id || item.gid || item.objectid + })); + setProcessingZoneOptions([defaultOption, ...zones]); + console.log("BaseLayout Fetched Processing Zones:", [defaultOption, ...zones]); + + + const facilities = (facilityRes.data || []).map((item: any) => ({ + text: item.swtrmtFcltNm || item.name || `시설 ${item.id || item.gid || item.objectid}`, + val: item.fid || item.id || item.gid || item.objectid + })); + setTreatmentFacilityOptions([defaultOption, ...facilities]); + console.log("BaseLayout Fetched Treatment Facilities:", [defaultOption, ...facilities]); + + } catch (error) { + console.error("BaseLayout: 지역/시설 데이터 조회 중 오류 발생:", error); + setProcessingZoneOptions([defaultOption]); + setTreatmentFacilityOptions([defaultOption]); + } finally { + setIsLoadingAreaData(false); + } + }; + + fetchData(); + }, [sigungu]); // sigungu 상태가 변경될 때마다 실행 + + // 파일 다운로드 + const isChckFile = () => { + // Excel 다운로드 함수가 있으면 Excel 다운로드 실행 + if (onExcelDownload) { + onExcelDownload(); + return; + } + return true + } + // 파일 삭제 + const isDeleteFile = async () => { + // Excel 다운로드 함수가 있으면 Excel 다운로드 실행 + if (onDeleteFile) { + onDeleteFile(); + return; + } + } + + return ( + <Form {...form} className="min-h-screen flex flex-col"> + <LoadingOverlay isLoading={isLoading ?? false} /> + <ListDiv> + {/* searchBox.title이 있으면 h3 태그로 제목을 표시합니다. */} + {selectBox?.title && ( + <div className="card-header"> + <h3 className="text-2xl font-medium">{selectBox.title}</h3> + </div> + )} + <div className="flex items-center w-full"> + {showDatePicker && ( // showDatePicker 값에 따라 DatePicker 렌더링 + <> + <Label className="ml-4 w-20 text-xl text-gray-600 whitespace-nowrap">분석기간</Label> + <DatePicker + mode={"single"} + field={{ + value: aplcnYm ?? new Date(), + onChange: setAplcnYm ?? ((date: Date | undefined) => console.log("DatePicker onChange:", date)) + }} + selectClass="ml-5 date-picker-trigger" /> + </> + )} + <GovSidoSigunguSearchForm + isShowPart={true} + setRtnEnvPartValue={(val) => setEnoCd?.(val)} + setRtnEnvPartSidoValue={(val) => setCtpvCd?.(val)} + setRtnEnvPartSigunValue={setSigungu} // 선택된 시군구 값을 받을 콜백 함수 전달 + > + <SelectBox2 label={"하수처리장"} value={selectedSwageTreatmentPlant} selectArray={treatmentFacilityOptions} className="col-span-3" selectClass="rounded-lg bg-white truncate" onSelectValue={(val) => onSwageTreatmentPlantChange?.(val)} /> + {/* <SelectBox2 label={"하수처리구역"} value={selectedSwageProcessingZone} selectArray={processingZoneOptions} className="col-span-3" selectClass="rounded-lg bg-white truncate" onSelectValue={(val) => onSwageProcessingZoneChange?.(val)} /> */} + </GovSidoSigunguSearchForm> + {selectBox?.searchChk ? <SearchFormRight><Button size="sm" onClick={() => selectBox.onSearchClick?.()}>조회</Button></SearchFormRight> : null} + </div> + </ListDiv> + <ListDiv> + <div className="card-header"> + <h3 className="text-2xl font-medium">{titleName.firstCardTitle}</h3> + <div> + {graphBtn ? <Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile}>파일 다운로드</Button> : null} + {/* 그래프 있을 시 */} + {graphBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> : null} + {/* 분석 버튼 */} + {analysisBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={onAnalysis}>{analysisBtn}</Button> : null} + </div> + </div> + <Form {...form}> + <form onSubmit={form.handleSubmit(onSubmitEvent)} className="flex-grow flex flex-col"> + <div className="card !m-[1.2rem] flex-grow flex flex-col"> + {/* 폼 정보 입력 칸 */} + {children?.[0]} + </div> + </form> </Form> - ) + </ListDiv> + { + children?.[1] != null ? <ListDiv> + <div className="card-header flex items-center justify-between"> + <h3 className="text-2xl font-medium">{titleName?.secondCardTitle}</h3> + <div> + {graphBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm">파일 다운로드</Button> : null} + {/* 그래프 있을 시 */} + {graphBtn ? <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm">삭제</Button> : null} + </div> + </div> + <div className="card !m-[1.2rem]">{children?.[1]}</div> + </ListDiv> : null + } + </Form> + ) } export default BaseLayout \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 3b68f494a..87a11d265 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -13,358 +13,358 @@ import { excelToFlowRateData, excelToMatchingResultData, excelToTimePatternData import BaseLayout from '../BaseLayout' const formSchema = z.object({ - managenm: z.string(), - region: z.string(), - suyeonga: z.number(), - inputdate: z.coerce.date(), - rtkSource: z.string(), - suyeongaPlace: z.string(), - pattern: z.string() + managenm: z.string(), + region: z.string(), + suyeonga: z.number(), + inputdate: z.coerce.date(), + rtkSource: z.string(), + suyeongaPlace: z.string(), + pattern: z.string() }) // 각 파일 업로드 폼의 데이터를 저장할 인터페이스 정의 interface UploadedFileInfo { - file: File | null; - atflCd: string | null; - atflId: string | null; - // 필요하다면 파일 이름 등 추가 정보 저장 가능 - // fileName: string; + file: File | null; + atflCd: string | null; + atflId: string | null; + // 필요하다면 파일 이름 등 추가 정보 저장 가능 + // fileName: string; } // 초기 파일 정보 상태 const initialFileInfo: UploadedFileInfo = { file: null, atflCd: null, atflId: null }; interface ApiSelectOption { - text: string; - val: string; + text: string; + val: string; } const IrSetting = () => { - const form = useForm<z.infer<typeof formSchema>>({ - resolver: zodResolver(formSchema), - defaultValues: { - managenm: "", - region: "", - suyeonga: 0, - inputdate: new Date(), - rtkSource: "", - suyeongaPlace: "", - pattern: "" - } - }) + const form = useForm<z.infer<typeof formSchema>>({ + resolver: zodResolver(formSchema), + defaultValues: { + managenm: "", + region: "", + suyeonga: 0, + inputdate: new Date(), + rtkSource: "", + suyeongaPlace: "", + pattern: "" + } + }) - const [uploadedFilesData, setUploadedFilesData] = useState<UploadedFileInfo[]>([ - initialFileInfo, // 0: 오수관망도 - initialFileInfo, // 1: 수용가-맨홀 매칭결과 - initialFileInfo, // 2: 오수량 시간패턴 - initialFileInfo // 3: 유량자료 등록 + const [uploadedFilesData, setUploadedFilesData] = useState<UploadedFileInfo[]>([ + initialFileInfo, // 0: 오수관망도 + initialFileInfo, // 1: 수용가-맨홀 매칭결과 + initialFileInfo, // 2: 오수량 시간패턴 + initialFileInfo // 3: 유량자료 등록 + ]); + + const [selectedDate, setSelectedDate] = useState(new Date()); + const [input1, setInput1] = useState(''); + const [input2, setInput2] = useState(''); + const [select1, setSelect1] = useState('0'); // 환경청코드 + const [select2, setSelect2] = useState('0'); // 시도코드 + const [select3, setSelect3] = useState<ApiSelectOption>({ val: '0', text: '전체' }); // 시군구 상태를 객체로 변경 + const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장코드 + const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역코드 + const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태 + const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 + + // 폼 초기화 함수 + const resetAllForms = () => { + form.reset({ // react-hook-form 초기화 + managenm: "", + region: "", + suyeonga: 0, + inputdate: new Date(), + rtkSource: "", + suyeongaPlace: "", + pattern: "" + }); + setUploadedFilesData([ // 파일 업로드 상태 초기화 + initialFileInfo, + initialFileInfo, + initialFileInfo, + initialFileInfo ]); + setSelectedDate(new Date()); // 날짜 선택 초기화 + setInput1(''); // 입력 필드 초기화 + setInput2(''); // 입력 필드 초기화 + setSelect1('0'); // 선택 필드 초기화 + setSelect2('0'); + setSelect3({ val: '0', text: '전체' }); + setSelect4(0); + setSelect5(0); + setFormResetKey(prevKey => prevKey + 1); // FileUploadForm 재마운트를 위해 key 변경 + }; - const [selectedDate, setSelectedDate] = useState(new Date()); - const [input1, setInput1] = useState(''); - const [input2, setInput2] = useState(''); - const [select1, setSelect1] = useState('0'); // 환경청코드 - const [select2, setSelect2] = useState('0'); // 시도코드 - const [select3, setSelect3] = useState<ApiSelectOption>({ val: '0', text: '전체' }); // 시군구 상태를 객체로 변경 - const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장코드 - const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역코드 - const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태 - const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 - - // 폼 초기화 함수 - const resetAllForms = () => { - form.reset({ // react-hook-form 초기화 - managenm: "", - region: "", - suyeonga: 0, - inputdate: new Date(), - rtkSource: "", - suyeongaPlace: "", - pattern: "" - }); - setUploadedFilesData([ // 파일 업로드 상태 초기화 - initialFileInfo, - initialFileInfo, - initialFileInfo, - initialFileInfo - ]); - setSelectedDate(new Date()); // 날짜 선택 초기화 - setInput1(''); // 입력 필드 초기화 - setInput2(''); // 입력 필드 초기화 - setSelect1('0'); // 선택 필드 초기화 - setSelect2('0'); - setSelect3({ val: '0', text: '전체' }); - setSelect4(0); - setSelect5(0); - setFormResetKey(prevKey => prevKey + 1); // FileUploadForm 재마운트를 위해 key 변경 - }; - - // FileUploadForm의 onFileSelect prop으로 전달될 콜백 함수 - const handleFileSelection = ( - index: number, // FileUploadForm의 fileIdx 값 - selectedFile: File | null, - cd: string | null, - id: string | null - ) => { - setUploadedFilesData(prevData => { - const newData = [...prevData]; - newData[index] = { - file: selectedFile, - atflCd: cd, - atflId: id, - }; - return newData; - }); - console.log(`Page: File data received for form index ${index}`, { fileName: selectedFile?.name, cd, id }); - }; + // FileUploadForm의 onFileSelect prop으로 전달될 콜백 함수 + const handleFileSelection = ( + index: number, // FileUploadForm의 fileIdx 값 + selectedFile: File | null, + cd: string | null, + id: string | null + ) => { + setUploadedFilesData(prevData => { + const newData = [...prevData]; + newData[index] = { + file: selectedFile, + atflCd: cd, + atflId: id, + }; + return newData; + }); + console.log(`Page: File data received for form index ${index}`, { fileName: selectedFile?.name, cd, id }); + }; - const registFile = async (analysisData: any) => { - setIsLoadingResult(true); // 로딩 상태 시작 - console.log("Submitting combined analysis data to backend:", analysisData); - // 추후 API 엔드포인트에 맞게 URL 수정 필요 - const data = await postData('v1/inftwtAnls', analysisData); - console.log("Response from backend:", data); - if (data) { - setIsLoadingResult(false); // 로딩 상태 시작 - alert("분석 데이터가 성공적으로 제출되었습니다."); - resetAllForms(); // 성공 시 폼 초기화 함수 호출 - } else { - setIsLoadingResult(false); // 로딩 상태 시작 - alert("분석 데이터 제출 중 오류가 발생했습니다."); - } - }; + const registFile = async (analysisData: any) => { + setIsLoadingResult(true); // 로딩 상태 시작 + console.log("Submitting combined analysis data to backend:", analysisData); + // 추후 API 엔드포인트에 맞게 URL 수정 필요 + const data = await postData('v1/inftwtAnls', analysisData); + console.log("Response from backend:", data); + if (data) { + setIsLoadingResult(false); // 로딩 상태 시작 + alert("분석 데이터가 성공적으로 제출되었습니다."); + resetAllForms(); // 성공 시 폼 초기화 함수 호출 + } else { + setIsLoadingResult(false); // 로딩 상태 시작 + alert("분석 데이터 제출 중 오류가 발생했습니다."); + } + }; - // 침입수 분석 실행 버튼 클릭 핸들러 - const handleAnalysisClick = async () => { - setIsLoadingResult(true); // 로딩 상태 시작 - console.log(uploadedFilesData); - const file1 = uploadedFilesData[0]; // 오수관망도 - const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 - const file3 = uploadedFilesData[2]; // 오수량 시간패턴 - const file4 = uploadedFilesData[3]; // 유량자료 + // 침입수 분석 실행 버튼 클릭 핸들러 + const handleAnalysisClick = async () => { + setIsLoadingResult(true); // 로딩 상태 시작 + console.log(uploadedFilesData); + const file1 = uploadedFilesData[0]; // 오수관망도 + const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 + const file3 = uploadedFilesData[2]; // 오수량 시간패턴 + const file4 = uploadedFilesData[3]; // 유량자료 - console.log("오수관망도 정보:", file1?.file); - console.log("수용가-맨홀 매칭결과 정보:", file2); - console.log("오수량 시간패턴 정보:", file3); - console.log("유량자료 정보:", file4); + console.log("오수관망도 정보:", file1?.file); + console.log("수용가-맨홀 매칭결과 정보:", file2); + console.log("오수량 시간패턴 정보:", file3); + console.log("유량자료 정보:", file4); - // 모든 필수 파일이 선택되었는지 확인 (UploadedFileInfo 객체와 그 안의 file 객체 모두 확인) - // 유량자료는 선택값 - if (!file1?.file || !file2?.file || !file3?.file) { - setIsLoadingResult(false); - alert('모든 분석용 파일을 선택해주세요.'); - return; - } - - type MatchingResult = { anlsSn: number; mhlMngNo: string; rcptrNo: string; }; - type TimePattern = { hrId: number; rt?: number | null | undefined; }; - type FlowRate = { pplMngNo: string; mtrngDt: string; oilq?: number | null | undefined; }; - - const filePickers: { - file: UploadedFileInfo; - parser: (excelData: any) => MatchingResult[] | TimePattern[] | FlowRate[]; - }[] = [ - { file: file2, parser: excelToMatchingResultData }, - { file: file3, parser: excelToTimePatternData } - ]; - - if (file4?.file) { - filePickers.push({ file: file4, parser: excelToFlowRateData }); - } - - try { - const parsedResults = await Promise.all( - filePickers.map(async ({ file, parser }) => { - if (!file || !file.file) return null; - - const jsonData = await filePicked(file.file, 0); - - if (jsonData === undefined) { - console.warn(`Warning: filePicked returned undefined for ${file.file.name}`); - return { - fileName: file.file.name, - atflCd: file.atflCd, - atflId: file.atflId, - parsedData: null - }; - } - - // jsonData를 각 parser 함수로 처리 - const parsedDataBySpecificFunction = parser(jsonData); - - return { - fileName: file.file.name, - atflCd: file.atflCd, - atflId: file.atflId, - parsedData: parsedDataBySpecificFunction - }; - }) - ); - - // 각 파싱 결과 접근 - const matchingResultData = parsedResults.find(r => r && r.fileName === file2.file?.name)?.parsedData; - const timePatternData = parsedResults.find(r => r && r.fileName === file3.file?.name)?.parsedData; - const flowRateData = file4?.file - ? parsedResults.find(r => r && r.fileName === file4.file?.name)?.parsedData - : null; - - // 새로운 JSON 데이터 생성 - const combinedAnalysisData = { - enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) - ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) - sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) - swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) - ? select4.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 - : null, // 하수처리장코드 (선택값) - swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) - ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 - : null, // 하수처리구역코드 (선택값) - aplcnYm: new Date(selectedDate).toISOString().substring(0, 7).replace("-", ""), // 적용연월 - drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환) - anlsInfo: input2, // 분석정보 - atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) - atflId: file1?.atflId, // 첨부파일ID (오수관망도) - atflInpNm: file1?.file?.name, // 오수관망도 파일명 - atflHrPttnNm: file3?.file?.name, // 오수량 시간패턴 파일명 - atflMpngNm: file2?.file?.name, // 수용가-맨홀 매칭결과 파일명 - atflOilqNm: file4?.file?.name || null, // 유량자료 파일명 (없을 수 있음) - tbSnRcptrMhlMpng: matchingResultData, // 수용가-맨홀 매칭결과 - tbSnHrPttn: timePatternData, // 오수량 시간패턴 - tbSnOilqData: flowRateData, // 유량자료 (없을 수 있음) - }; - - console.log("통합 분석 데이터 (JSON):", combinedAnalysisData); - - // 수정된 registFile 함수를 호출하여 combinedAnalysisData를 전송합니다. - await registFile(combinedAnalysisData); - setIsLoadingResult(false); - } catch (error) { - setIsLoadingResult(false); - console.error("파일 파싱 중 오류 발생:", error); - alert("파일 처리 중 오류가 발생했습니다."); - return; - } + // 모든 필수 파일이 선택되었는지 확인 (UploadedFileInfo 객체와 그 안의 file 객체 모두 확인) + // 유량자료는 선택값 + if (!file1?.file || !file2?.file || !file3?.file) { + setIsLoadingResult(false); + alert('모든 분석용 파일을 선택해주세요.'); + return; } - return ( - <> - <BaseLayout - titleName={{ mainTitle: '침입수 분석', firstCardTitle: '침입수 분석 자료 입력' }} - form={form} - onSubmitEvent={() => { }} - graphBtn={false} - analysisBtn={'침입수분석 실행'} - selectBox={{ title: '분석 대상지역 선택' }} - enoCd={select1} - setEnoCd={setSelect1} - ctpvCd={select2} - setCtpvCd={setSelect2} - sigungu={select3} - setSigungu={setSelect3} - selectedSwageTreatmentPlant={select4} - onSwageTreatmentPlantChange={setSelect4} - selectedSwageProcessingZone={select5} - onSwageProcessingZoneChange={setSelect5} - isLoading={isLoadingResult} - onAnalysis={handleAnalysisClick} - > - {[<div key="irsetting-layout-key" className="grid gap-4"> - <FormSection name='suyeongaPlace' form={form} titleNm='▷ 오수관망도'> - <FileUploadForm - key={`file-upload-0-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(0, file, cd, id)} - showButton={false} - showPreview={true} - accept={""} - fileIdx={0} /> - </FormSection> - <FormSection name='suyeonga' form={form} titleNm='▷ 수용가-맨홀 매칭결과'> - <FileUploadForm - key={`file-upload-1-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(1, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={1} /> - </FormSection> - <FormSection name='pattern' form={form} titleNm='▷ 오수량 시간패턴'> - <FileUploadForm - key={`file-upload-2-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(2, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={2} /> - </FormSection> - <FormSection - name='inputdate' - form={form} - titleNm='▷ 상수사용량 적용기간'> - <DatePicker - mode={"single"} - field={{ - value: selectedDate, // 현재 페이지의 selectedDate 상태 사용 - onChange: (date: Date | undefined) => { - if (date) { - setSelectedDate(date); - form.setValue('inputdate', date, { shouldValidate: true }); - } - } - }} - selectClass="ml-5 date-picker-trigger" // date-picker.css의 스타일 적용 - /> - </FormSection> - <FormSection - name='rtkSource' - form={form} - titleNm='▷ 오수전환율'> - <Input - value={input1} - onChange={(e) => { - const newValue = e.target.value; + type MatchingResult = { anlsSn: number; mhlMngNo: string; rcptrNo: string; }; + type TimePattern = { hrId: number; rt?: number | null | undefined; }; + type FlowRate = { pplMngNo: string; mtrngDt: string; oilq?: number | null | undefined; }; - if (newValue === "") { - setInput1(newValue); - return; - } + const filePickers: { + file: UploadedFileInfo; + parser: (excelData: any) => MatchingResult[] | TimePattern[] | FlowRate[]; + }[] = [ + { file: file2, parser: excelToMatchingResultData }, + { file: file3, parser: excelToTimePatternData } + ]; - // 숫자와 '.'만 허용하고, '.'은 최대 하나인지 확인 - const isValidChars = /^[0-9]*\.?[0-9]*$/.test(newValue); - if (!isValidChars) return; // 유효하지 않은 문자 또는 여러 개의 '.' 포함 + if (file4?.file) { + filePickers.push({ file: file4, parser: excelToFlowRateData }); + } - // '.' 기호가 포함된 경우, 처음이나 끝에 오면 안 됨 - if (newValue.includes('.') && newValue.startsWith('.')) return; // '.'이 처음에는 올 수 없음 + try { + const parsedResults = await Promise.all( + filePickers.map(async ({ file, parser }) => { + if (!file || !file.file) return null; - setInput1(newValue); - }} - className="ml-5 h-[3.2rem] text-center text-xl w-[150px]" - placeholder="예: 0.75" /> - </FormSection> - <FormSection - name='analysis information' - form={form} - titleNm='▷ 분석 정보'> - <Input - value={input2} - onChange={(e) => setInput2(e.target.value)} - className="ml-5 h-[3.2rem] text-center text-xl w-[150px]" /> - </FormSection> - <ListDiv> - <div className="card !m-[1.2rem]"> - <FormSection name='region' form={form} titleNm='▷ 유량자료 등록'> - <FileUploadForm - key={`file-upload-3-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(3, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={3} - /> - </FormSection> - </div> - </ListDiv> - </div>]} - {/* <div className="flex items-center gap-4"> + const jsonData = await filePicked(file.file, 0); + + if (jsonData === undefined) { + console.warn(`Warning: filePicked returned undefined for ${file.file.name}`); + return { + fileName: file.file.name, + atflCd: file.atflCd, + atflId: file.atflId, + parsedData: null + }; + } + + // jsonData를 각 parser 함수로 처리 + const parsedDataBySpecificFunction = parser(jsonData); + + return { + fileName: file.file.name, + atflCd: file.atflCd, + atflId: file.atflId, + parsedData: parsedDataBySpecificFunction + }; + }) + ); + + // 각 파싱 결과 접근 + const matchingResultData = parsedResults.find(r => r && r.fileName === file2.file?.name)?.parsedData; + const timePatternData = parsedResults.find(r => r && r.fileName === file3.file?.name)?.parsedData; + const flowRateData = file4?.file + ? parsedResults.find(r => r && r.fileName === file4.file?.name)?.parsedData + : null; + + // 새로운 JSON 데이터 생성 + const combinedAnalysisData = { + enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) + ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) + sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) + swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) + ? select4.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리장코드 (선택값) + swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) + ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리구역코드 (선택값) + aplcnYm: new Date(selectedDate).toISOString().substring(0, 7).replace("-", ""), // 적용연월 + drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환) + anlsInfo: input2, // 분석정보 + atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) + atflId: file1?.atflId, // 첨부파일ID (오수관망도) + atflInpNm: file1?.file?.name, // 오수관망도 파일명 + atflHrPttnNm: file3?.file?.name, // 오수량 시간패턴 파일명 + atflMpngNm: file2?.file?.name, // 수용가-맨홀 매칭결과 파일명 + atflOilqNm: file4?.file?.name || null, // 유량자료 파일명 (없을 수 있음) + tbSnRcptrMhlMpng: matchingResultData, // 수용가-맨홀 매칭결과 + tbSnHrPttn: timePatternData, // 오수량 시간패턴 + tbSnOilqData: flowRateData, // 유량자료 (없을 수 있음) + }; + + console.log("통합 분석 데이터 (JSON):", combinedAnalysisData); + + // 수정된 registFile 함수를 호출하여 combinedAnalysisData를 전송합니다. + await registFile(combinedAnalysisData); + setIsLoadingResult(false); + } catch (error) { + setIsLoadingResult(false); + console.error("파일 파싱 중 오류 발생:", error); + alert("파일 처리 중 오류가 발생했습니다."); + return; + } + } + + return ( + <> + <BaseLayout + titleName={{ mainTitle: '침입수 분석', firstCardTitle: '침입수 분석 자료 입력' }} + form={form} + onSubmitEvent={() => { }} + graphBtn={false} + analysisBtn={'침입수분석 실행'} + selectBox={{ title: '분석 대상지역 선택' }} + enoCd={select1} + setEnoCd={setSelect1} + ctpvCd={select2} + setCtpvCd={setSelect2} + sigungu={select3} + setSigungu={setSelect3} + selectedSwageTreatmentPlant={select4} + onSwageTreatmentPlantChange={setSelect4} + selectedSwageProcessingZone={select5} + onSwageProcessingZoneChange={setSelect5} + isLoading={isLoadingResult} + onAnalysis={handleAnalysisClick} + > + {[<div key="irsetting-layout-key" className="grid gap-4"> + <FormSection name='suyeongaPlace' form={form} titleNm='▷ 오수관망도'> + <FileUploadForm + key={`file-upload-0-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(0, file, cd, id)} + showButton={false} + showPreview={true} + accept={""} + fileIdx={0} /> + </FormSection> + <FormSection name='suyeonga' form={form} titleNm='▷ 수용가-맨홀 매칭결과'> + <FileUploadForm + key={`file-upload-1-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(1, file, cd, id)} + showButton={false} + showPreview={true} + accept={".xls, .xlsx, .xlsm, .xltx"} + fileIdx={1} /> + </FormSection> + <FormSection name='pattern' form={form} titleNm='▷ 오수량 시간패턴'> + <FileUploadForm + key={`file-upload-2-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(2, file, cd, id)} + showButton={false} + showPreview={true} + accept={".xls, .xlsx, .xlsm, .xltx"} + fileIdx={2} /> + </FormSection> + <FormSection + name='inputdate' + form={form} + titleNm='▷ 상수사용량 적용기간'> + <DatePicker + mode={"single"} + field={{ + value: selectedDate, // 현재 페이지의 selectedDate 상태 사용 + onChange: (date: Date | undefined) => { + if (date) { + setSelectedDate(date); + form.setValue('inputdate', date, { shouldValidate: true }); + } + } + }} + selectClass="ml-5 date-picker-trigger" // date-picker.css의 스타일 적용 + /> + </FormSection> + <FormSection + name='rtkSource' + form={form} + titleNm='▷ 오수전환율'> + <Input + value={input1} + onChange={(e) => { + const newValue = e.target.value; + + if (newValue === "") { + setInput1(newValue); + return; + } + + // 숫자와 '.'만 허용하고, '.'은 최대 하나인지 확인 + const isValidChars = /^[0-9]*\.?[0-9]*$/.test(newValue); + if (!isValidChars) return; // 유효하지 않은 문자 또는 여러 개의 '.' 포함 + + // '.' 기호가 포함된 경우, 처음이나 끝에 오면 안 됨 + if (newValue.includes('.') && newValue.startsWith('.')) return; // '.'이 처음에는 올 수 없음 + + setInput1(newValue); + }} + className="ml-5 h-[3.2rem] text-center text-xl w-[150px]" + placeholder="예: 0.75" /> + </FormSection> + <FormSection + name='analysis information' + form={form} + titleNm='▷ 분석 정보'> + <Input + value={input2} + onChange={(e) => setInput2(e.target.value)} + className="ml-5 h-[3.2rem] text-center text-xl w-[150px]" /> + </FormSection> + <ListDiv> + <div className="card !m-[1.2rem]"> + <FormSection name='region' form={form} titleNm='▷ 유량자료 등록'> + <FileUploadForm + key={`file-upload-3-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(3, file, cd, id)} + showButton={false} + showPreview={true} + accept={".xls, .xlsx, .xlsm, .xltx"} + fileIdx={3} + /> + </FormSection> + </div> + </ListDiv> + </div>]} + {/* <div className="flex items-center gap-4"> <FormSection name='region' form={form} titleNm='▷ 유량자료 등록'> <FileUploadForm @@ -379,9 +379,9 @@ const IrSetting = () => { <Button size="sm" type="submit" onClick={handleAnalysisClick}>침입수분석 실행</Button> </div> </div> */} - </BaseLayout> - </> - ) + </BaseLayout> + </> + ) } export default IrSetting \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 6ddf2fcb2..689c267ff 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -17,393 +17,393 @@ import { EditableFormTable, type EditableTableHeadItem } from '../../../componen // zod 스키마 정의 const formSchema = z.object({ - enoCd: z.string(), // 환경청코드 - ctpvCd: z.string(), // 시도코드 - sggCd: z.string(), // 시군구코드 - swageTmplntCd: z.string(), // 하수처리장코드 - swtrmtZoneCd: z.string(), // 하수처리구역코드 - rtkSource: z.string(), // RTK계수 출처 - rdiiArea: z.string(), // RDII 기여면적 - unitFactors: z.array(z.object({ // 단위도 계수 - response: z.string(), - R: z.string(), - T: z.string(), - K: z.string(), - })), - initialDepths: z.array(z.object({ // 초기 차단 깊이 - response: z.string(), - Dmax: z.string(), - Drec: z.string(), - Do: z.string(), - })), - // osumap: z.instanceof(File).optional(), // 오수관망도 - // matching: z.instanceof(File).optional(), // 수용가-맨홀 매칭결과 - aplcnYm: z.string(), // 상수사용량 적용기간 (YYYYMM 형식) - rate: z.string(), // 오수전환율 - // rain: z.instanceof(File).optional(), // 강우자료 - analysisInfo: z.string().optional(), // 분석 정보 - date: z.date(), - // date: z.coerce.date(), + enoCd: z.string(), // 환경청코드 + ctpvCd: z.string(), // 시도코드 + sggCd: z.string(), // 시군구코드 + swageTmplntCd: z.string(), // 하수처리장코드 + swtrmtZoneCd: z.string(), // 하수처리구역코드 + rtkSource: z.string(), // RTK계수 출처 + rdiiArea: z.string(), // RDII 기여면적 + unitFactors: z.array(z.object({ // 단위도 계수 + response: z.string(), + R: z.string(), + T: z.string(), + K: z.string(), + })), + initialDepths: z.array(z.object({ // 초기 차단 깊이 + response: z.string(), + Dmax: z.string(), + Drec: z.string(), + Do: z.string(), + })), + // osumap: z.instanceof(File).optional(), // 오수관망도 + // matching: z.instanceof(File).optional(), // 수용가-맨홀 매칭결과 + aplcnYm: z.string(), // 상수사용량 적용기간 (YYYYMM 형식) + rate: z.string(), // 오수전환율 + // rain: z.instanceof(File).optional(), // 강우자료 + analysisInfo: z.string().optional(), // 분석 정보 + date: z.date(), + // date: z.coerce.date(), }) // zod 스키마 타입 추론 type FormSchemaType = z.infer<typeof formSchema>; // 기본 폼 값 정의 (테스트 편의를 위해 초기값 설정, 추후 삭제 필요) const defaultFormValues: FormSchemaType = { - enoCd: "", - ctpvCd: "", - sggCd: "", - swageTmplntCd: "", - swtrmtZoneCd: "", - rtkSource: "출처", - rdiiArea: "123", // 문자열로 기본값 설정 - unitFactors: [ - { response: "Short-Term", R: "0.040", T: "0.5", K: "1" }, // 문자열로 기본값 설정 - { response: "Medium-Term", R: "0.005", T: "1", K: "2" }, - { response: "Long-Term", R: "0.005", T: "2", K: "3" }, - ], - initialDepths: [ - { response: "Short-Term", Dmax: "0", Drec: "0", Do: "0" }, // 문자열로 기본값 설정 - { response: "Medium-Term", Dmax: "0", Drec: "0", Do: "0" }, - { response: "Long-Term", Dmax: "0", Drec: "0", Do: "0" }, - ], - // osumap: undefined, - // matchingResultFile: undefined, - aplcnYm: "", - rate: "0.8", // 문자열로 기본값 설정 - // rainFile: undefined, - analysisInfo: "test 분석정보", - date: new Date(), + enoCd: "", + ctpvCd: "", + sggCd: "", + swageTmplntCd: "", + swtrmtZoneCd: "", + rtkSource: "출처", + rdiiArea: "123", // 문자열로 기본값 설정 + unitFactors: [ + { response: "Short-Term", R: "0.040", T: "0.5", K: "1" }, // 문자열로 기본값 설정 + { response: "Medium-Term", R: "0.005", T: "1", K: "2" }, + { response: "Long-Term", R: "0.005", T: "2", K: "3" }, + ], + initialDepths: [ + { response: "Short-Term", Dmax: "0", Drec: "0", Do: "0" }, // 문자열로 기본값 설정 + { response: "Medium-Term", Dmax: "0", Drec: "0", Do: "0" }, + { response: "Long-Term", Dmax: "0", Drec: "0", Do: "0" }, + ], + // osumap: undefined, + // matchingResultFile: undefined, + aplcnYm: "", + rate: "0.8", // 문자열로 기본값 설정 + // rainFile: undefined, + analysisInfo: "test 분석정보", + date: new Date(), }; // 각 파일 업로드 폼의 데이터를 저장할 인터페이스 정의 interface UploadedFileInfo { - file: File | null; - atflCd: string | null; - atflId: string | null; + file: File | null; + atflCd: string | null; + atflId: string | null; } // 초기 파일 정보 상태 const initialFileInfo: UploadedFileInfo = { file: null, atflCd: null, atflId: null }; interface ApiSelectOption { - text: string; - val: string; + text: string; + val: string; } export default function RTKForm() { - const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태 - const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 + const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태 + const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 - // FileUploadForm에서 전달받은 파일 정보를 저장할 상태 배열 - // 각 인덱스는 FileUploadForm의 fileIdx와 매칭됨 - const [uploadedFilesData, setUploadedFilesData] = useState<UploadedFileInfo[]>([ - initialFileInfo, // 0: 오수관망도 - initialFileInfo, // 1: 수용가-맨홀 매칭결과 - initialFileInfo, // 2: 강우자료 + // FileUploadForm에서 전달받은 파일 정보를 저장할 상태 배열 + // 각 인덱스는 FileUploadForm의 fileIdx와 매칭됨 + const [uploadedFilesData, setUploadedFilesData] = useState<UploadedFileInfo[]>([ + initialFileInfo, // 0: 오수관망도 + initialFileInfo, // 1: 수용가-맨홀 매칭결과 + initialFileInfo, // 2: 강우자료 + ]); + + const [select1, setSelect1] = useState('0'); // 환경청코드 (enoCd) + const [select2, setSelect2] = useState('0'); // 시도코드 (ctpvCd) + const [select3, setSelect3] = useState<ApiSelectOption>({ val: '0', text: '전체' }); // 시군구 (sggCd) + const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장 (swageTmplntCd) + const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역 (swtrmtZoneCd) + + + // form 인스턴스 생성 + const form = useForm<FormSchemaType>({ + resolver: zodResolver(formSchema), + defaultValues: defaultFormValues + }); + + // 폼 초기화 함수 + const resetAllForms = () => { + form.reset(defaultFormValues); // 폼 값 초기화 + setUploadedFilesData([ // 파일 업로드 상태 초기화 (3개 파일) + initialFileInfo, + initialFileInfo, + initialFileInfo, ]); + setFormResetKey(prevKey => prevKey + 1); // FileUploadForm 재마운트를 위해 key 변경 + setSelect1('0'); + setSelect2('0'); + setSelect3({ val: '0', text: '전체' }); + setSelect4('0'); + setSelect5('0'); + }; - const [select1, setSelect1] = useState('0'); // 환경청코드 (enoCd) - const [select2, setSelect2] = useState('0'); // 시도코드 (ctpvCd) - const [select3, setSelect3] = useState<ApiSelectOption>({ val: '0', text: '전체' }); // 시군구 (sggCd) - const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장 (swageTmplntCd) - const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역 (swtrmtZoneCd) - - - // form 인스턴스 생성 - const form = useForm<FormSchemaType>({ - resolver: zodResolver(formSchema), - defaultValues: defaultFormValues + // FileUploadForm의 onFileSelect prop으로 전달될 콜백 함수 + const handleFileSelection = ( + index: number, // FileUploadForm의 fileIdx 값 + selectedFile: File | null, + cd: string | null, + id: string | null + ) => { + setUploadedFilesData(prevData => { + const newData = [...prevData]; + newData[index] = { + file: selectedFile, + atflCd: cd, + atflId: id, + }; + return newData; }); + console.log(`Page: File data received for form index ${index}`, { fileName: selectedFile?.name, cd, id }); + }; - // 폼 초기화 함수 - const resetAllForms = () => { - form.reset(defaultFormValues); // 폼 값 초기화 - setUploadedFilesData([ // 파일 업로드 상태 초기화 (3개 파일) - initialFileInfo, - initialFileInfo, - initialFileInfo, - ]); - setFormResetKey(prevKey => prevKey + 1); // FileUploadForm 재마운트를 위해 key 변경 - setSelect1('0'); - setSelect2('0'); - setSelect3({ val: '0', text: '전체' }); - setSelect4('0'); - setSelect5('0'); - }; + const registFile = async (analysisData: any) => { + console.log("Submitting combined analysis data to backend"); + // 추후 API 엔드포인트에 맞게 URL 수정 필요 + const data = await postData('v1/rdiiAnls', analysisData); + if (data) { + alert("분석 데이터가 성공적으로 제출되었습니다."); + resetAllForms(); // 성공 시 폼 초기화 함수 호출 + } else alert("분석 데이터 제출 중 오류가 발생했습니다."); + }; - // FileUploadForm의 onFileSelect prop으로 전달될 콜백 함수 - const handleFileSelection = ( - index: number, // FileUploadForm의 fileIdx 값 - selectedFile: File | null, - cd: string | null, - id: string | null - ) => { - setUploadedFilesData(prevData => { - const newData = [...prevData]; - newData[index] = { - file: selectedFile, - atflCd: cd, - atflId: id, - }; - return newData; - }); - console.log(`Page: File data received for form index ${index}`, { fileName: selectedFile?.name, cd, id }); - }; + // 침입수 분석 실행 버튼 클릭 핸들러 + const handleAnalysisClick = async () => { + setIsLoadingResult(true); // 로딩 상태 시작 + const formData = form.getValues(); + console.log(uploadedFilesData); + const file1 = uploadedFilesData[0]; // 오수관망도 + const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 + const file3 = uploadedFilesData[2]; // 강우자료 - const registFile = async (analysisData: any) => { - console.log("Submitting combined analysis data to backend"); - // 추후 API 엔드포인트에 맞게 URL 수정 필요 - const data = await postData('v1/rdiiAnls', analysisData); - if (data) { - alert("분석 데이터가 성공적으로 제출되었습니다."); - resetAllForms(); // 성공 시 폼 초기화 함수 호출 - } else alert("분석 데이터 제출 중 오류가 발생했습니다."); - }; + console.log("오수관망도 정보:", file1?.file); + console.log("수용가-맨홀 매칭결과 정보:", file2); + console.log("강우자료:", file3); - // 침입수 분석 실행 버튼 클릭 핸들러 - const handleAnalysisClick = async () => { - setIsLoadingResult(true); // 로딩 상태 시작 - const formData = form.getValues(); - console.log(uploadedFilesData); - const file1 = uploadedFilesData[0]; // 오수관망도 - const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 - const file3 = uploadedFilesData[2]; // 강우자료 - - console.log("오수관망도 정보:", file1?.file); - console.log("수용가-맨홀 매칭결과 정보:", file2); - console.log("강우자료:", file3); - - // 모든 필수 파일이 선택되었는지 확인 - if (!file1?.file || !file2?.file || !file3?.file) { - setIsLoadingResult(false); - alert('모든 분석용 파일을 선택해주세요.'); - return; - } - - const filePickers = [ - { file: file2, parser: excelToMatchingResultData }, - { file: file3, parser: excelToRainData }, - ]; - - try { - const parsedResults = await Promise.all( - filePickers.map(async ({ file, parser }) => { - if (!file || !file.file) return null; // fileInfo 객체 및 file 객체 null 체크 - - // filePicked 함수에 File 객체와 headerNum 전달 - const jsonData = await filePicked(file.file, 0); - - if (jsonData === undefined) { - console.warn(`Warning: filePicked returned undefined for ${file.file.name}`); - return { - fileName: file.file.name, - atflCd: file.atflCd, - atflId: file.atflId, - parsedData: null // 또는 적절한 기본값 - }; - } - - // jsonData를 각 parser 함수로 처리 - // parser 함수가 filePicked가 반환하는 JSON 형식을 직접 처리한다고 가정 - const parsedDataBySpecificFunction = parser(jsonData); - - return { - fileName: file.file.name, - atflCd: file.atflCd, - atflId: file.atflId, - parsedData: parsedDataBySpecificFunction - }; - }) - ); - - // 각 파싱 결과 접근 - const matchingResultData = parsedResults.find(r => r && r.fileName === file2.file?.name)?.parsedData; - const rainData = parsedResults.find(r => r && r.fileName === file3.file?.name)?.parsedData; - - // 새로운 JSON 데이터 생성 - const combinedAnalysisData = { - enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) - aplcnYm: new Date(formData.date).toISOString().substring(0, 7).replace("-", ""), // 적용연월 (YYYYMM 형식) - ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) - sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) - swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) - ? select4.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 - : null, // 하수처리장코드 (선택값) - swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) - ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 - : null, // 하수처리구역코드 (선택값) - atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) - atflId: file1?.atflId, // 첨부파일ID (오수관망도) - atflInpNm: file1?.file?.name || "", // 오수관망도 파일명 - atflMpngNm: file2?.file?.name || "", // 수용가-맨홀 매칭결과 파일명 - atflRainNm: file3?.file?.name || "", // 강우자료 파일명 - cntbArea: parseFloat(formData.rdiiArea) || null, // RDII 기여면적(ha) - srcNm: formData.rtkSource, // 출처이름 (RTK계수 출처) - - shortPrdR: parseFloat(formData.unitFactors[0]?.R || "0"), - shortPrdT: parseFloat(formData.unitFactors[0]?.T || "0"), - shortPrdK: parseFloat(formData.unitFactors[0]?.K || "0"), - - mdPrdR: parseFloat(formData.unitFactors[1]?.R || "0"), - mdPrdT: parseFloat(formData.unitFactors[1]?.T || "0"), - mdPrdK: parseFloat(formData.unitFactors[1]?.K || "0"), - - longPrdR: parseFloat(formData.unitFactors[2]?.R || "0"), - longPrdT: parseFloat(formData.unitFactors[2]?.T || "0"), - longPrdK: parseFloat(formData.unitFactors[2]?.K || "0"), - - shortPrdMaxDpth: parseFloat(formData.initialDepths[0]?.Dmax || "0"), - shortPrdRcvryRt: parseFloat(formData.initialDepths[0]?.Drec || "0"), - shortPrdBgngDpth: parseFloat(formData.initialDepths[0]?.Do || "0"), - - mdPrdMaxDpth: parseFloat(formData.initialDepths[1]?.Dmax || "0"), - mdPrdRcvryRt: parseFloat(formData.initialDepths[1]?.Drec || "0"), - mdPrdBgngDpth: parseFloat(formData.initialDepths[1]?.Do || "0"), - - longTermMaxDpth: parseFloat(formData.initialDepths[2]?.Dmax || "0"), - longTermRcvryRt: parseFloat(formData.initialDepths[2]?.Drec || "0"), - longTermBgngDpth: parseFloat(formData.initialDepths[2]?.Do || "0"), - - drtwSwtcRt: parseFloat(formData.rate || "0"), // 오수전환율 - anlsInfo: formData.analysisInfo, // 분석정보 - - tbSnRcptrMhlMpng: matchingResultData, // 수용가-맨홀 매칭결과 - tbSnRainData: rainData, // 강우자료 - }; - - console.log("통합 분석 데이터 (JSON):", combinedAnalysisData); - - // 수정된 registFile 함수를 호출하여 combinedAnalysisData를 전송합니다. - await registFile(combinedAnalysisData); - setIsLoadingResult(false); - } catch (error) { - setIsLoadingResult(false); - console.error("파일 파싱 중 오류 발생:", error); - alert("파일 처리 중 오류가 발생했습니다."); - return; - } + // 모든 필수 파일이 선택되었는지 확인 + if (!file1?.file || !file2?.file || !file3?.file) { + setIsLoadingResult(false); + alert('모든 분석용 파일을 선택해주세요.'); + return; } - const { fields: unitFactorFields } = useFieldArray({ - control: form.control, - name: "unitFactors" - }) - - const { fields: initialDepthFields } = useFieldArray({ - control: form.control, - name: "initialDepths" - }) - - const onSubmit = (data: z.infer<typeof formSchema>) => { - console.log("✅ 제출 데이터:", data) - } - - // 단위도 계수 테이블 설정 (EditableTableHeadItem 타입 사용 및 id 수정) - const unitFactorHeadlist: EditableTableHeadItem<FormSchemaType['unitFactors'][number]>[] = [ - { id: 'response', title: 'Response', editable: false, width: '150px' }, // width 속성 추가 - { id: 'R', title: 'R', editable: true, inputProps: { type: 'text' } }, - { id: 'T', title: 'T', editable: true, inputProps: { type: 'text' } }, - { id: 'K', title: 'K', editable: true, inputProps: { type: 'text' } } + const filePickers = [ + { file: file2, parser: excelToMatchingResultData }, + { file: file3, parser: excelToRainData }, ]; - // 초기 차단 깊이 테이블 설정 (EditableTableHeadItem 타입 사용) - const initialDepthHeadlist: EditableTableHeadItem<FormSchemaType['initialDepths'][number]>[] = [ - { id: 'response', title: 'Response', editable: false, width: '150px' }, // width 속성 추가 - { id: 'Dmax', title: 'Dmax', editable: true, inputProps: { type: 'text' } }, - { id: 'Drec', title: 'Drec', editable: true, inputProps: { type: 'text' } }, - { id: 'Do', title: 'Do', editable: true, inputProps: { type: 'text' } } - ]; + try { + const parsedResults = await Promise.all( + filePickers.map(async ({ file, parser }) => { + if (!file || !file.file) return null; // fileInfo 객체 및 file 객체 null 체크 - // 테이블 페이지 변경 핸들러 - const handlePageChange = (page: number) => { - console.log('Page changed:', page) + // filePicked 함수에 File 객체와 headerNum 전달 + const jsonData = await filePicked(file.file, 0); + + if (jsonData === undefined) { + console.warn(`Warning: filePicked returned undefined for ${file.file.name}`); + return { + fileName: file.file.name, + atflCd: file.atflCd, + atflId: file.atflId, + parsedData: null // 또는 적절한 기본값 + }; + } + + // jsonData를 각 parser 함수로 처리 + // parser 함수가 filePicked가 반환하는 JSON 형식을 직접 처리한다고 가정 + const parsedDataBySpecificFunction = parser(jsonData); + + return { + fileName: file.file.name, + atflCd: file.atflCd, + atflId: file.atflId, + parsedData: parsedDataBySpecificFunction + }; + }) + ); + + // 각 파싱 결과 접근 + const matchingResultData = parsedResults.find(r => r && r.fileName === file2.file?.name)?.parsedData; + const rainData = parsedResults.find(r => r && r.fileName === file3.file?.name)?.parsedData; + + // 새로운 JSON 데이터 생성 + const combinedAnalysisData = { + enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) + aplcnYm: new Date(formData.date).toISOString().substring(0, 7).replace("-", ""), // 적용연월 (YYYYMM 형식) + ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) + sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) + swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) + ? select4.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리장코드 (선택값) + swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) + ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 + : null, // 하수처리구역코드 (선택값) + atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) + atflId: file1?.atflId, // 첨부파일ID (오수관망도) + atflInpNm: file1?.file?.name || "", // 오수관망도 파일명 + atflMpngNm: file2?.file?.name || "", // 수용가-맨홀 매칭결과 파일명 + atflRainNm: file3?.file?.name || "", // 강우자료 파일명 + cntbArea: parseFloat(formData.rdiiArea) || null, // RDII 기여면적(ha) + srcNm: formData.rtkSource, // 출처이름 (RTK계수 출처) + + shortPrdR: parseFloat(formData.unitFactors[0]?.R || "0"), + shortPrdT: parseFloat(formData.unitFactors[0]?.T || "0"), + shortPrdK: parseFloat(formData.unitFactors[0]?.K || "0"), + + mdPrdR: parseFloat(formData.unitFactors[1]?.R || "0"), + mdPrdT: parseFloat(formData.unitFactors[1]?.T || "0"), + mdPrdK: parseFloat(formData.unitFactors[1]?.K || "0"), + + longPrdR: parseFloat(formData.unitFactors[2]?.R || "0"), + longPrdT: parseFloat(formData.unitFactors[2]?.T || "0"), + longPrdK: parseFloat(formData.unitFactors[2]?.K || "0"), + + shortPrdMaxDpth: parseFloat(formData.initialDepths[0]?.Dmax || "0"), + shortPrdRcvryRt: parseFloat(formData.initialDepths[0]?.Drec || "0"), + shortPrdBgngDpth: parseFloat(formData.initialDepths[0]?.Do || "0"), + + mdPrdMaxDpth: parseFloat(formData.initialDepths[1]?.Dmax || "0"), + mdPrdRcvryRt: parseFloat(formData.initialDepths[1]?.Drec || "0"), + mdPrdBgngDpth: parseFloat(formData.initialDepths[1]?.Do || "0"), + + longTermMaxDpth: parseFloat(formData.initialDepths[2]?.Dmax || "0"), + longTermRcvryRt: parseFloat(formData.initialDepths[2]?.Drec || "0"), + longTermBgngDpth: parseFloat(formData.initialDepths[2]?.Do || "0"), + + drtwSwtcRt: parseFloat(formData.rate || "0"), // 오수전환율 + anlsInfo: formData.analysisInfo, // 분석정보 + + tbSnRcptrMhlMpng: matchingResultData, // 수용가-맨홀 매칭결과 + tbSnRainData: rainData, // 강우자료 + }; + + console.log("통합 분석 데이터 (JSON):", combinedAnalysisData); + + // 수정된 registFile 함수를 호출하여 combinedAnalysisData를 전송합니다. + await registFile(combinedAnalysisData); + setIsLoadingResult(false); + } catch (error) { + setIsLoadingResult(false); + console.error("파일 파싱 중 오류 발생:", error); + alert("파일 처리 중 오류가 발생했습니다."); + return; } + } - return ( - // <BaseLayout searchBox={{ title: '분석 대상지역 선택' }} titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} form={form} onSubmitEvent={() => { }} graphBtn={false} > - <BaseLayout - selectBox={{ title: '분석 대상지역 선택' }} - titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} - form={form} // react-hook-form 인스턴스 전달 - onSubmitEvent={() => { }} // BaseLayout의 form 태그에 연결될 onSubmit - graphBtn={false} - analysisBtn={'RDII분석 실행'} - enoCd={select1} - setEnoCd={setSelect1} - ctpvCd={select2} - setCtpvCd={setSelect2} - sigungu={select3} - setSigungu={setSelect3} - selectedSwageTreatmentPlant={select4} - onSwageTreatmentPlantChange={setSelect4} - selectedSwageProcessingZone={select5} - onSwageProcessingZoneChange={setSelect5} - isLoading={isLoadingResult} - onAnalysis={handleAnalysisClick} - > - {[<div className="space-y-[1.2rem] overflow-x-auto pt-4 pb-4 px-2" key="form-section"> - <div className="grid grid-cols-2 gap-4"> - <FormSection name="rtkSource" form={form} titleNm="○ RTK계수 출처"> - <Input {...form.register("rtkSource")} className="h-12 text-center text-xl w-[225px]" /> - </FormSection> - <FormSection name="rdiiArea" form={form} titleNm="○ RDII 기여면적(ha)"> - <Input {...form.register("rdiiArea")} className="h-12 text-center text-xl w-[225px]" /> - </FormSection></div> - <div className="grid grid-cols-2 gap-4"> - <div> - <Label className="mb-2 text-xl font-medium">○ 단위도 계수</Label> - <EditableFormTable - form={form} - name="unitFactors" - fields={unitFactorFields} - headlist={unitFactorHeadlist} - tableClassName="w-[400px]" - /> - </div> - <div> - <Label className="mb-[1.2rem] text-xl font-medium">○ 초기 차단 깊이</Label> - <EditableFormTable - form={form} - name="initialDepths" - fields={initialDepthFields} - headlist={initialDepthHeadlist} - tableClassName="w-[400px]" - /> - </div> - </div> - <div className="grid grid-cols-2 gap-4"> - <FormSection name="suyeonga" form={form} titleNm="○ 오수관망도"><div className="w-[350px]"> - <FileUploadForm - key={`file-upload-0-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(0, file, cd, id)} - showButton={false} - showPreview={true} - accept={""} - fileIdx={0} /> - </div></FormSection> - <FormSection name="regopm" form={form} titleNm="○ 수용가-맨홀 매칭결과"><div className="w-[350px]"> - <FileUploadForm - key={`file-upload-1-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(1, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={1} /> - </div></FormSection> - <FormSection name="rain" form={form} titleNm="○ 강우자료"><div className="w-[350px]"> - <FileUploadForm - key={`file-upload-2-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(2, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={2} /> - </div></FormSection> - <FormSection name='rate' form={form} titleNm='○ 오수전환율'> - <Input {...form.register("rate")} className="h-12 text-center text-xl w-[225px] ml-5" /> - </FormSection> - <FormSection name='date' form={form} titleNm='○ 상수사용량 적용기간'> - {/* <DatePicker + const { fields: unitFactorFields } = useFieldArray({ + control: form.control, + name: "unitFactors" + }) + + const { fields: initialDepthFields } = useFieldArray({ + control: form.control, + name: "initialDepths" + }) + + const onSubmit = (data: z.infer<typeof formSchema>) => { + console.log("✅ 제출 데이터:", data) + } + + // 단위도 계수 테이블 설정 (EditableTableHeadItem 타입 사용 및 id 수정) + const unitFactorHeadlist: EditableTableHeadItem<FormSchemaType['unitFactors'][number]>[] = [ + { id: 'response', title: 'Response', editable: false, width: '150px' }, // width 속성 추가 + { id: 'R', title: 'R', editable: true, inputProps: { type: 'text' } }, + { id: 'T', title: 'T', editable: true, inputProps: { type: 'text' } }, + { id: 'K', title: 'K', editable: true, inputProps: { type: 'text' } } + ]; + + // 초기 차단 깊이 테이블 설정 (EditableTableHeadItem 타입 사용) + const initialDepthHeadlist: EditableTableHeadItem<FormSchemaType['initialDepths'][number]>[] = [ + { id: 'response', title: 'Response', editable: false, width: '150px' }, // width 속성 추가 + { id: 'Dmax', title: 'Dmax', editable: true, inputProps: { type: 'text' } }, + { id: 'Drec', title: 'Drec', editable: true, inputProps: { type: 'text' } }, + { id: 'Do', title: 'Do', editable: true, inputProps: { type: 'text' } } + ]; + + // 테이블 페이지 변경 핸들러 + const handlePageChange = (page: number) => { + console.log('Page changed:', page) + } + + return ( + // <BaseLayout searchBox={{ title: '분석 대상지역 선택' }} titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} form={form} onSubmitEvent={() => { }} graphBtn={false} > + <BaseLayout + selectBox={{ title: '분석 대상지역 선택' }} + titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} + form={form} // react-hook-form 인스턴스 전달 + onSubmitEvent={() => { }} // BaseLayout의 form 태그에 연결될 onSubmit + graphBtn={false} + analysisBtn={'RDII분석 실행'} + enoCd={select1} + setEnoCd={setSelect1} + ctpvCd={select2} + setCtpvCd={setSelect2} + sigungu={select3} + setSigungu={setSelect3} + selectedSwageTreatmentPlant={select4} + onSwageTreatmentPlantChange={setSelect4} + selectedSwageProcessingZone={select5} + onSwageProcessingZoneChange={setSelect5} + isLoading={isLoadingResult} + onAnalysis={handleAnalysisClick} + > + {[<div className="space-y-[1.2rem] overflow-x-auto pt-4 pb-4 px-2" key="form-section"> + <div className="grid grid-cols-2 gap-4"> + <FormSection name="rtkSource" form={form} titleNm="○ RTK계수 출처"> + <Input {...form.register("rtkSource")} className="h-12 text-center text-xl w-[225px]" /> + </FormSection> + <FormSection name="rdiiArea" form={form} titleNm="○ RDII 기여면적(ha)"> + <Input {...form.register("rdiiArea")} className="h-12 text-center text-xl w-[225px]" /> + </FormSection></div> + <div className="grid grid-cols-2 gap-4"> + <div> + <Label className="mb-2 text-xl font-medium">○ 단위도 계수</Label> + <EditableFormTable + form={form} + name="unitFactors" + fields={unitFactorFields} + headlist={unitFactorHeadlist} + tableClassName="w-[400px]" + /> + </div> + <div> + <Label className="mb-[1.2rem] text-xl font-medium">○ 초기 차단 깊이</Label> + <EditableFormTable + form={form} + name="initialDepths" + fields={initialDepthFields} + headlist={initialDepthHeadlist} + tableClassName="w-[400px]" + /> + </div> + </div> + <div className="grid grid-cols-2 gap-4"> + <FormSection name="suyeonga" form={form} titleNm="○ 오수관망도"><div className="w-[350px]"> + <FileUploadForm + key={`file-upload-0-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(0, file, cd, id)} + showButton={false} + showPreview={true} + accept={""} + fileIdx={0} /> + </div></FormSection> + <FormSection name="regopm" form={form} titleNm="○ 수용가-맨홀 매칭결과"><div className="w-[350px]"> + <FileUploadForm + key={`file-upload-1-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(1, file, cd, id)} + showButton={false} + showPreview={true} + accept={".xls, .xlsx, .xlsm, .xltx"} + fileIdx={1} /> + </div></FormSection> + <FormSection name="rain" form={form} titleNm="○ 강우자료"><div className="w-[350px]"> + <FileUploadForm + key={`file-upload-2-${formResetKey}`} // 폼 초기화를 위한 key + onFileSelect={(file, cd, id) => handleFileSelection(2, file, cd, id)} + showButton={false} + showPreview={true} + accept={".xls, .xlsx, .xlsm, .xltx"} + fileIdx={2} /> + </div></FormSection> + <FormSection name='rate' form={form} titleNm='○ 오수전환율'> + <Input {...form.register("rate")} className="h-12 text-center text-xl w-[225px] ml-5" /> + </FormSection> + <FormSection name='date' form={form} titleNm='○ 상수사용량 적용기간'> + {/* <DatePicker selected={form.watch("date")} onSelect={(date: Date | undefined) => { if (date) { @@ -413,30 +413,30 @@ export default function RTKForm() { mode={"single"} className="ml-5" /> */} - <DatePicker - mode={"single"} // mode는 DayPickerSingleProps에서 오므로 그대로 사용 가능 - field={{ - value: form.watch("date"), // react-hook-form의 "date" 필드 값 사용 - onChange: (date: Date | undefined) => { - if (date) { - form.setValue("date", date, { shouldValidate: true }); - } - } - }} - // className을 직접 사용하거나, DatePicker 내부에서 selectClass를 처리하도록 수정 필요 - // 여기서는 DatePicker의 selectClass prop을 사용하고, date-picker.css의 스타일을 적용 - selectClass="ml-5 date-picker-trigger" - /> - </FormSection> - <FormSection name='rate' form={form} titleNm='○ 분석 정보'> - <Input {...form.register("analysisInfo")} className="h-12 text-center text-xl w-[225px] ml-5" /> - </FormSection> - </div> - {/* <div className="flex justify-end mt-1"> + <DatePicker + mode={"single"} // mode는 DayPickerSingleProps에서 오므로 그대로 사용 가능 + field={{ + value: form.watch("date"), // react-hook-form의 "date" 필드 값 사용 + onChange: (date: Date | undefined) => { + if (date) { + form.setValue("date", date, { shouldValidate: true }); + } + } + }} + // className을 직접 사용하거나, DatePicker 내부에서 selectClass를 처리하도록 수정 필요 + // 여기서는 DatePicker의 selectClass prop을 사용하고, date-picker.css의 스타일을 적용 + selectClass="ml-5 date-picker-trigger" + /> + </FormSection> + <FormSection name='rate' form={form} titleNm='○ 분석 정보'> + <Input {...form.register("analysisInfo")} className="h-12 text-center text-xl w-[225px] ml-5" /> + </FormSection> + </div> + {/* <div className="flex justify-end mt-1"> <Button size="sm" type="submit" onClick={handleAnalysisClick}>RDII분석 실행</Button> </div> */} - </div> - ]} - </BaseLayout > - ) + </div> + ]} + </BaseLayout > + ) } diff --git a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx index ea61cae37..95397a13c 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx @@ -10,259 +10,259 @@ import { handleDelete } from '@/components/lib/utils' const formSchema = z.object({ - enoCd: z.string().default('0'), // 환경청코드 - ctpvCd: z.string().default('0'), // 시도코드 - sggCd: z.object({ // 시군구 - val: z.string().default('0'), - text: z.string().default('전체'), - }).default({ val: '0', text: '전체' }), - swageTmplntCd: z.string().default('0'), // 하수처리장 - swtrmtZoneCd: z.string().default('0'), // 하수처리구역 - aplcnYm: z.date().default(new Date()), // 분석일자 (DatePicker와 연동) + enoCd: z.string().default('0'), // 환경청코드 + ctpvCd: z.string().default('0'), // 시도코드 + sggCd: z.object({ // 시군구 + val: z.string().default('0'), + text: z.string().default('전체'), + }).default({ val: '0', text: '전체' }), + swageTmplntCd: z.string().default('0'), // 하수처리장 + swtrmtZoneCd: z.string().default('0'), // 하수처리구역 + aplcnYm: z.date().default(new Date()), // 분석일자 (DatePicker와 연동) }) type ResultFormValues = z.infer<typeof formSchema> const tableColumn = [ - { id: 'rainInfwtAnlsSn', title: '분석번호' }, - { id: 'swageTmplntNm', title: '하수처리장' }, - // { id: 'swtrmtZoneNm', title: '처리구역' }, - { id: 'aplcnYm', title: '상수사용연월' }, - { id: 'drtwSwtcRt', title: '오수 전환율' }, - { id: 'srcNm', title: 'RTX 계수 출처' }, - { id: 'cntbArea', title: 'RDII 기여면적' }, - { id: 'anlsInfo', title: 'RDII 분석정보' }, - { id: 'regDt', title: '분석일자' }, - { id: 'rgtrNm', title: '분석자' } + { id: 'rainInfwtAnlsSn', title: '분석번호' }, + { id: 'swageTmplntNm', title: '하수처리장' }, + // { id: 'swtrmtZoneNm', title: '처리구역' }, + { id: 'aplcnYm', title: '상수사용연월' }, + { id: 'drtwSwtcRt', title: '오수 전환율' }, + { id: 'srcNm', title: 'RTX 계수 출처' }, + { id: 'cntbArea', title: 'RDII 기여면적' }, + { id: 'anlsInfo', title: 'RDII 분석정보' }, + { id: 'regDt', title: '분석일자' }, + { id: 'rgtrNm', title: '분석자' } ] const Result = () => { - const form = useForm<ResultFormValues>({ - resolver: zodResolver(formSchema), - defaultValues: { - enoCd: '0', - ctpvCd: '0', - sggCd: { val: '0', text: '전체' }, - swageTmplntCd: '0', - swtrmtZoneCd: '0', - aplcnYm: new Date(), + const form = useForm<ResultFormValues>({ + resolver: zodResolver(formSchema), + defaultValues: { + enoCd: '0', + ctpvCd: '0', + sggCd: { val: '0', text: '전체' }, + swageTmplntCd: '0', + swtrmtZoneCd: '0', + aplcnYm: new Date(), + } + }) + + + const [tableData, setTableData] = useState<any[]>([]); // API 조회 결과 저장 상태 + const [totalData, setTotalData] = useState(0) //총 데이터 수 + const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 + const [selectedRowData, setSelectedRowData] = useState<any>(null); + const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); + const [resetSelection, setResetSelection] = useState<boolean>(false); + + + const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { + setIsLoadingResult(true); + const formValues = customFormValues || form.getValues(); // react-hook-form에서 현재 값 가져오기 + console.log("formValues", formValues); + + let inftwtAnlsSearchDto; + + if (customFormValues) { + inftwtAnlsSearchDto = { + "aplcnYm": formValues.aplcnYm, + "enoCd": formValues.enoCd, + "ctpvCd": formValues.ctpvCd, + "sggCd": formValues.sggCd, + "swtrmtZoneCd": formValues.swtrmtZoneCd, + }; + } else { + inftwtAnlsSearchDto = { + "aplcnYm": formValues.aplcnYm ? formValues.aplcnYm.toISOString().substring(0, 7).replace("-", "") : null, + "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, + "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, + "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, + "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, + }; + } + console.log("Search DTO:", inftwtAnlsSearchDto); + + const queryParams = new URLSearchParams({ + page: '0', + size: '10000000', + sort: 'rainInfwtAnlsSn,desc' + }); + Object.entries(inftwtAnlsSearchDto).forEach(([key, value]) => { + if (value !== undefined && value !== null && String(value).trim() !== '') { // undefined, null, 빈 문자열이 아닌 경우에만 추가 + queryParams.append(key, String(value)); + } + }); + const queryString = queryParams.toString(); + + console.log("API: ", `v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); + try { + const data = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); + setTableData(data.content || []); + setTotalData(tableData.length); + console.log("response:", data); + console.log("response data:", data.content || []); + setIsLoadingResult(false); + } catch (error) { + setIsLoadingResult(false); + console.error("Error fetching analysis result data:", error); + alert("분석결과 조회 중 오류가 발생했습니다."); + setTableData([]); + setTotalData(0); + } + }; + + // 테이블 셀 클릭 핸들러 추가 + const handleCellClick = (index: number | undefined, headId: string) => { + if (index !== undefined && tableData[index]) { + setSelectedRowData(tableData[index]); + setSelectedRowIndex(index); + console.log("Selected row data:", tableData[index]); + } + }; + + // Excel 다운로드 핸들러 추가 + const handleExcelDownload = async () => { + setIsLoadingResult(true); + console.log("Selected row data for download:", selectedRowData); + if (!selectedRowData || selectedRowData.rainInfwtAnlsSn === undefined) { + setIsLoadingResult(false); + alert('다운로드할 데이터를 선택해주세요.'); + return; + } + + try { + const data = await getData(`v1/rdiiAnlsRslt/ppl/${selectedRowData.rainInfwtAnlsSn}`); + + // 선택된 행 데이터를 Excel 다운로드 형식으로 변환 + const excelData = data.content; // 배열로 감싸서 전달 + + // 파일명 생성 (분석번호 기반) + const fileName = `RDII분석결과_${selectedRowData.rainInfwtAnlsSn}_${selectedRowData.aplcnYm}`; + + downloadExcel({ + data: excelData as JSON[], + fileName: fileName, + sheetNameArray: ["RDII 분석결과"], + headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정 + }); + setIsLoadingResult(false); + } catch (error) { + setIsLoadingResult(false); + console.error("Excel 다운로드 중 오류 발생:", error); + alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요."); + } + }; + + // 파일 삭제 핸들러 추가 + const handleFileDelete = async () => { + setIsLoadingResult(true); + console.log("Selected row data for deletion:", selectedRowData); + if (!selectedRowData || selectedRowData.rainInfwtAnlsSn === undefined) { + alert('삭제할 파일을 선택해주세요.'); + return; + } + // 삭제 확인 대화상자 + const confirmDelete = window.confirm('선택된 분석 결과를 삭제하시겠습니까?'); + if (!confirmDelete) { + return; + } + + try { + // 삭제 API 호출 + const response1 = await deleteData(`v1/rdiiAnlsRslt/${selectedRowData.rainInfwtAnlsSn}`); + const response2 = await deleteData(`v1/rdiiAnls/${selectedRowData.rainInfwtAnlsSn}`); + // 첨부파일(inp파일) 삭제 API 호출 + handleDelete(selectedRowData.atflCd, { + handleDeleteStart: () => console.log("파일 삭제 시작"), + handleDeleteSuccess: (response) => console.log("파일 삭제 성공:", response), + handleDeleteError: (error) => console.error("파일 삭제 실패:", error), + }); + console.log("File delete response1:", response1); + console.log("File delete response2:", response2); + + // 테이블 선택 상태 초기화 트리거 + setResetSelection(true); + + // 삭제 후 테이블 새로고침을 위해 재검색 + const customFormValues: Partial<ResultFormValues> = { + aplcnYm: selectedRowData.aplcnYm || null, + enoCd: selectedRowData.enoCd || null, + ctpvCd: selectedRowData.ctpvCd || null, + sggCd: selectedRowData.sggCd || null, + swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, + }; + await handleSearchButtonClick(customFormValues); + + // 선택된 행 초기화 + setSelectedRowData(null); + setSelectedRowIndex(undefined); + setIsLoadingResult(false); + + alert('삭제가 완료되었습니다.'); + + setTimeout(() => { + setResetSelection(false); + }, 100); + } catch (error) { + console.error("분석결과 파일 삭제 중 오류 발생:", error); + alert("분석결과 파일 삭제 중 오류가 발생했습니다. 다시 시도해주세요."); + } + setIsLoadingResult(false); + }; + + return ( + <BaseLayout + selectBox={{ title: '분석 대상지역 선택', searchChk: true, onSearchClick: handleSearchButtonClick }} + titleName={{ mainTitle: '분석결과', firstCardTitle: 'RDII 산정결과 현황' }} + form={form} // form 인스턴스 전달 + onSubmitEvent={() => { }} // BaseLayout의 form 태그에 연결될 onSubmit + graphBtn={true} + showDatePicker={true} + enoCd={form.watch("enoCd")} + setEnoCd={(val) => form.setValue("enoCd", val)} + ctpvCd={form.watch("ctpvCd")} + setCtpvCd={(val) => form.setValue("ctpvCd", val)} + sigungu={form.watch("sggCd")} + setSigungu={(val) => form.setValue("sggCd", val)} + selectedSwageTreatmentPlant={form.watch("swageTmplntCd")} + onSwageTreatmentPlantChange={(val) => form.setValue("swageTmplntCd", String(val))} + selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} + onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} + aplcnYm={form.watch("aplcnYm")} + setAplcnYm={(val) => { + if (val instanceof Date) { + form.setValue("aplcnYm", val) + } else if (val) { + form.setValue("aplcnYm", new Date(val)) } - }) - - - const [tableData, setTableData] = useState<any[]>([]); // API 조회 결과 저장 상태 - const [totalData, setTotalData] = useState(0) //총 데이터 수 - const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 - const [selectedRowData, setSelectedRowData] = useState<any>(null); - const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); - const [resetSelection, setResetSelection] = useState<boolean>(false); - - - const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { - setIsLoadingResult(true); - const formValues = customFormValues || form.getValues(); // react-hook-form에서 현재 값 가져오기 - console.log("formValues", formValues); - - let inftwtAnlsSearchDto; - - if (customFormValues) { - inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm, - "enoCd": formValues.enoCd, - "ctpvCd": formValues.ctpvCd, - "sggCd": formValues.sggCd, - "swtrmtZoneCd": formValues.swtrmtZoneCd, - }; - } else { - inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm ? formValues.aplcnYm.toISOString().substring(0, 7).replace("-", "") : null, - "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, - "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, - "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, - "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, - }; - } - console.log("Search DTO:", inftwtAnlsSearchDto); - - const queryParams = new URLSearchParams({ - page: '0', - size: '10000000', - sort: 'rainInfwtAnlsSn,desc' - }); - Object.entries(inftwtAnlsSearchDto).forEach(([key, value]) => { - if (value !== undefined && value !== null && String(value).trim() !== '') { // undefined, null, 빈 문자열이 아닌 경우에만 추가 - queryParams.append(key, String(value)); - } - }); - const queryString = queryParams.toString(); - - console.log("API: ", `v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); - try { - const data = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); - setTableData(data.content || []); - setTotalData(tableData.length); - console.log("response:", data); - console.log("response data:", data.content || []); - setIsLoadingResult(false); - } catch (error) { - setIsLoadingResult(false); - console.error("Error fetching analysis result data:", error); - alert("분석결과 조회 중 오류가 발생했습니다."); - setTableData([]); - setTotalData(0); - } - }; - - // 테이블 셀 클릭 핸들러 추가 - const handleCellClick = (index: number | undefined, headId: string) => { - if (index !== undefined && tableData[index]) { - setSelectedRowData(tableData[index]); - setSelectedRowIndex(index); - console.log("Selected row data:", tableData[index]); - } - }; - - // Excel 다운로드 핸들러 추가 - const handleExcelDownload = async () => { - setIsLoadingResult(true); - console.log("Selected row data for download:", selectedRowData); - if (!selectedRowData || selectedRowData.rainInfwtAnlsSn === undefined) { - setIsLoadingResult(false); - alert('다운로드할 데이터를 선택해주세요.'); - return; - } - - try { - const data = await getData(`v1/rdiiAnlsRslt/ppl/${selectedRowData.rainInfwtAnlsSn}`); - - // 선택된 행 데이터를 Excel 다운로드 형식으로 변환 - const excelData = data.content; // 배열로 감싸서 전달 - - // 파일명 생성 (분석번호 기반) - const fileName = `RDII분석결과_${selectedRowData.rainInfwtAnlsSn}_${selectedRowData.aplcnYm}`; - - downloadExcel({ - data: excelData as JSON[], - fileName: fileName, - sheetNameArray: ["RDII 분석결과"], - headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정 - }); - setIsLoadingResult(false); - } catch (error) { - setIsLoadingResult(false); - console.error("Excel 다운로드 중 오류 발생:", error); - alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요."); - } - }; - - // 파일 삭제 핸들러 추가 - const handleFileDelete = async () => { - setIsLoadingResult(true); - console.log("Selected row data for deletion:", selectedRowData); - if (!selectedRowData || selectedRowData.rainInfwtAnlsSn === undefined) { - alert('삭제할 파일을 선택해주세요.'); - return; - } - // 삭제 확인 대화상자 - const confirmDelete = window.confirm('선택된 분석 결과를 삭제하시겠습니까?'); - if (!confirmDelete) { - return; - } - - try { - // 삭제 API 호출 - const response1 = await deleteData(`v1/rdiiAnlsRslt/${selectedRowData.rainInfwtAnlsSn}`); - const response2 = await deleteData(`v1/rdiiAnls/${selectedRowData.rainInfwtAnlsSn}`); - // 첨부파일(inp파일) 삭제 API 호출 - handleDelete(selectedRowData.atflCd, { - handleDeleteStart: () => console.log("파일 삭제 시작"), - handleDeleteSuccess: (response) => console.log("파일 삭제 성공:", response), - handleDeleteError: (error) => console.error("파일 삭제 실패:", error), - }); - console.log("File delete response1:", response1); - console.log("File delete response2:", response2); - - // 테이블 선택 상태 초기화 트리거 - setResetSelection(true); - - // 삭제 후 테이블 새로고침을 위해 재검색 - const customFormValues: Partial<ResultFormValues> = { - aplcnYm: selectedRowData.aplcnYm || null, - enoCd: selectedRowData.enoCd || null, - ctpvCd: selectedRowData.ctpvCd || null, - sggCd: selectedRowData.sggCd || null, - swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, - }; - await handleSearchButtonClick(customFormValues); - - // 선택된 행 초기화 - setSelectedRowData(null); - setSelectedRowIndex(undefined); - setIsLoadingResult(false); - - alert('삭제가 완료되었습니다.'); - - setTimeout(() => { - setResetSelection(false); - }, 100); - } catch (error) { - console.error("분석결과 파일 삭제 중 오류 발생:", error); - alert("분석결과 파일 삭제 중 오류가 발생했습니다. 다시 시도해주세요."); - } - setIsLoadingResult(false); - }; - - return ( - <BaseLayout - selectBox={{ title: '분석 대상지역 선택', searchChk: true, onSearchClick: handleSearchButtonClick }} - titleName={{ mainTitle: '분석결과', firstCardTitle: 'RDII 산정결과 현황' }} - form={form} // form 인스턴스 전달 - onSubmitEvent={() => { }} // BaseLayout의 form 태그에 연결될 onSubmit - graphBtn={true} - showDatePicker={true} - enoCd={form.watch("enoCd")} - setEnoCd={(val) => form.setValue("enoCd", val)} - ctpvCd={form.watch("ctpvCd")} - setCtpvCd={(val) => form.setValue("ctpvCd", val)} - sigungu={form.watch("sggCd")} - setSigungu={(val) => form.setValue("sggCd", val)} - selectedSwageTreatmentPlant={form.watch("swageTmplntCd")} - onSwageTreatmentPlantChange={(val) => form.setValue("swageTmplntCd", String(val))} - selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} - onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} - aplcnYm={form.watch("aplcnYm")} - setAplcnYm={(val) => { - if (val instanceof Date) { - form.setValue("aplcnYm", val) - } else if (val) { - form.setValue("aplcnYm", new Date(val)) - } - }} - isLoading={isLoadingResult} - // Excel 다운로드 핸들러 추가 - onExcelDownload={handleExcelDownload} - onDeleteFile={handleFileDelete} - selectedRowData={selectedRowData} - > - {[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md"> - <div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div> - <div className="flex-grow overflow-auto"> - <UiTable - headName='' - headlist={tableColumn} - tableData={tableData} - total={totalData} - pageSize={10} - children={undefined} - cellClick={handleCellClick} - onPageChange={(e) => { }} - resetSelection={resetSelection} - /> - </div> - </div> - ]} - </BaseLayout> - ) + }} + isLoading={isLoadingResult} + // Excel 다운로드 핸들러 추가 + onExcelDownload={handleExcelDownload} + onDeleteFile={handleFileDelete} + selectedRowData={selectedRowData} + > + {[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md"> + <div className="mb-[1.2rem] text-xl font-medium">○ RDII 분석결과 현황</div> + <div className="flex-grow overflow-auto"> + <UiTable + headName='' + headlist={tableColumn} + tableData={tableData} + total={totalData} + pageSize={10} + children={undefined} + cellClick={handleCellClick} + onPageChange={(e) => { }} + resetSelection={resetSelection} + /> + </div> + </div> + ]} + </BaseLayout> + ) } export default Result \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 7b220125a..ecdce6566 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -10,260 +10,260 @@ import { handleDelete } from '@/components/lib/utils' const formSchema = z.object({ - enoCd: z.string().default('0'), // 환경청코드 - ctpvCd: z.string().default('0'), // 시도코드 - sggCd: z.object({ // 시군구 - val: z.string().default('0'), - text: z.string().default('전체'), - }).default({ val: '0', text: '전체' }), - swageTmplntCd: z.string().default('0'), // 하수처리장 - swtrmtZoneCd: z.string().default('0'), // 하수처리구역 - aplcnYm: z.date().default(new Date()), // 분석일자 (DatePicker와 연동) + enoCd: z.string().default('0'), // 환경청코드 + ctpvCd: z.string().default('0'), // 시도코드 + sggCd: z.object({ // 시군구 + val: z.string().default('0'), + text: z.string().default('전체'), + }).default({ val: '0', text: '전체' }), + swageTmplntCd: z.string().default('0'), // 하수처리장 + swtrmtZoneCd: z.string().default('0'), // 하수처리구역 + aplcnYm: z.date().default(new Date()), // 분석일자 (DatePicker와 연동) }) type ResultFormValues = z.infer<typeof formSchema> const tableColumn = [ - // { id: 'no', title: '번호' }, - { id: 'inftwtAnlsSn', title: '분석번호' }, - { id: 'swageTmplntNm', title: '하수처리장' }, - // { id: 'swtrmtZoneNm', title: '처리구역' }, - { id: 'aplcnYm', title: '적용연월' }, - { id: 'drtwSwtcRt', title: '오수 전환율' }, - { id: 'anlsInfo', title: '침입수 분석정보' }, - { id: 'regDt', title: '분석일자' }, - { id: 'rgtrNm', title: '분석자' } + // { id: 'no', title: '번호' }, + { id: 'inftwtAnlsSn', title: '분석번호' }, + { id: 'swageTmplntNm', title: '하수처리장' }, + // { id: 'swtrmtZoneNm', title: '처리구역' }, + { id: 'aplcnYm', title: '적용연월' }, + { id: 'drtwSwtcRt', title: '오수 전환율' }, + { id: 'anlsInfo', title: '침입수 분석정보' }, + { id: 'regDt', title: '분석일자' }, + { id: 'rgtrNm', title: '분석자' } ] const Result = () => { - const form = useForm<ResultFormValues>({ - resolver: zodResolver(formSchema), - defaultValues: { - enoCd: '0', - ctpvCd: '0', - sggCd: { val: '0', text: '전체' }, - swageTmplntCd: '0', - swtrmtZoneCd: '0', - aplcnYm: new Date(), + const form = useForm<ResultFormValues>({ + resolver: zodResolver(formSchema), + defaultValues: { + enoCd: '0', + ctpvCd: '0', + sggCd: { val: '0', text: '전체' }, + swageTmplntCd: '0', + swtrmtZoneCd: '0', + aplcnYm: new Date(), + } + }) + + + const [tableData, setTableData] = useState<any[]>([]); // API 조회 결과 저장 상태 + const [totalData, setTotalData] = useState(0) //총 데이터 수 + const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 + const [selectedRowData, setSelectedRowData] = useState<any>(null); + const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); + const [resetSelection, setResetSelection] = useState<boolean>(false); + + + const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { + setIsLoadingResult(true); + const formValues = customFormValues || form.getValues(); // react-hook-form에서 현재 값 가져오기 + console.log("formValues", formValues); + + let inftwtAnlsSearchDto; + + if (customFormValues) { + inftwtAnlsSearchDto = { + "aplcnYm": formValues.aplcnYm, + "enoCd": formValues.enoCd, + "ctpvCd": formValues.ctpvCd, + "sggCd": formValues.sggCd, + "swtrmtZoneCd": formValues.swtrmtZoneCd, + }; + } else { + inftwtAnlsSearchDto = { + "aplcnYm": formValues.aplcnYm ? formValues.aplcnYm.toISOString().substring(0, 7).replace("-", "") : null, + "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, + "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, + "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, + "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, + }; + } + console.log("Search DTO:", inftwtAnlsSearchDto); + + const queryParams = new URLSearchParams({ + page: '0', + size: '10000000', + sort: 'inftwtAnlsSn,desc' + }); + Object.entries(inftwtAnlsSearchDto).forEach(([key, value]) => { + if (value !== undefined && value !== null && String(value).trim() !== '') { // undefined, null, 빈 문자열이 아닌 경우에만 추가 + queryParams.append(key, String(value)); + } + }); + const queryString = queryParams.toString(); + + console.log("API: ", `v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); + try { + const data = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); + setTableData(data.content || []); + setTotalData(tableData.length); + console.log("response:", data); + console.log("response data:", data.content || []); + setIsLoadingResult(false); + } catch (error) { + setIsLoadingResult(false); + console.error("Error fetching analysis result data:", error); + alert("분석결과 조회 중 오류가 발생했습니다."); + setTableData([]); + setTotalData(0); + } + }; + + // 테이블 셀 클릭 핸들러 추가 + const handleCellClick = (index: number | undefined, headId: string) => { + if (index !== undefined && tableData[index]) { + setSelectedRowData(tableData[index]); + setSelectedRowIndex(index); + console.log("Selected row data:", tableData[index]); + } + }; + + // Excel 다운로드 핸들러 추가 + const handleExcelDownload = async () => { + setIsLoadingResult(true); + console.log("Selected row data for download:", selectedRowData); + if (!selectedRowData || selectedRowData.inftwtAnlsSn === undefined) { + setIsLoadingResult(false); + alert('다운로드할 데이터를 선택해주세요.'); + return; + } + + try { + const data = await getData(`v1/inftwtAnlsRslt/ppl/${selectedRowData.inftwtAnlsSn}`); + + // 선택된 행 데이터를 Excel 다운로드 형식으로 변환 + const excelData = data.content; // 배열로 감싸서 전달 + + // 파일명 생성 (분석번호 기반) + const fileName = `침입수분석결과_${selectedRowData.inftwtAnlsSn}_${selectedRowData.aplcnYm}`; + + downloadExcel({ + data: excelData as JSON[], + fileName: fileName, + sheetNameArray: ["침입수 분석결과"], + headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정 + }); + setIsLoadingResult(false); + } catch (error) { + setIsLoadingResult(false); + console.error("Excel 다운로드 중 오류 발생:", error); + alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요."); + } + }; + + // 파일 삭제 핸들러 추가 + const handleFileDelete = async () => { + setIsLoadingResult(true); + console.log("Selected row data for deletion:", selectedRowData); + if (!selectedRowData || selectedRowData.inftwtAnlsSn === undefined) { + setIsLoadingResult(false); + alert('삭제할 파일을 선택해주세요.'); + return; + } + // 삭제 확인 대화상자 + const confirmDelete = window.confirm('선택된 분석 결과를 삭제하시겠습니까?'); + if (!confirmDelete) { + return; + } + + try { + // // 삭제 API 호출 + console.log("Deleting analysis result with inftwtAnlsSn:", selectedRowData.inftwtAnlsSn); + const response1 = await deleteData(`v1/inftwtAnlsRslt/${selectedRowData.inftwtAnlsSn}`); + const response2 = await deleteData(`v1/inftwtAnls/${selectedRowData.inftwtAnlsSn}`); + // 첨부파일(inp파일) 삭제 API 호출 + handleDelete(selectedRowData.atflCd, { + handleDeleteStart: () => console.log("파일 삭제 시작"), + handleDeleteSuccess: (response) => console.log("파일 삭제 성공:", response), + handleDeleteError: (error) => console.error("파일 삭제 실패:", error), + }); + console.log("File delete response1:", response1); + console.log("File delete response2:", response2); + + // 테이블 선택 상태 초기화 트리거 + setResetSelection(true); + + // 삭제 후 테이블 새로고침을 위해 재검색 + const customFormValues: Partial<ResultFormValues> = { + aplcnYm: selectedRowData.aplcnYm || null, + enoCd: selectedRowData.enoCd || null, + ctpvCd: selectedRowData.ctpvCd || null, + sggCd: selectedRowData.sggCd || null, + swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, + }; + await handleSearchButtonClick(customFormValues); + + // 선택된 행 초기화 + setSelectedRowData(null); + setSelectedRowIndex(undefined); + setIsLoadingResult(false); + + alert('삭제가 완료되었습니다.'); + + setTimeout(() => { + setResetSelection(false); + }, 100); + } catch (error) { + setIsLoadingResult(false); + console.error("분석결과 파일 삭제 중 오류 발생:", error); + alert("분석결과 파일 삭제 중 오류가 발생했습니다. 다시 시도해주세요."); + } + }; + + return ( + <BaseLayout + selectBox={{ title: '분석 대상지역 선택', searchChk: true, onSearchClick: handleSearchButtonClick }} + titleName={{ mainTitle: '분석결과', firstCardTitle: '분석이력' }} + form={form} // form 인스턴스 전달 + onSubmitEvent={() => { }} // BaseLayout의 form 태그에 연결될 onSubmit + graphBtn={true} + showDatePicker={true} + enoCd={form.watch("enoCd")} + setEnoCd={(val) => form.setValue("enoCd", val)} + ctpvCd={form.watch("ctpvCd")} + setCtpvCd={(val) => form.setValue("ctpvCd", val)} + sigungu={form.watch("sggCd")} + setSigungu={(val) => form.setValue("sggCd", val)} + selectedSwageTreatmentPlant={form.watch("swageTmplntCd")} + onSwageTreatmentPlantChange={(val) => form.setValue("swageTmplntCd", String(val))} + selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} + onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} + aplcnYm={form.watch("aplcnYm")} + setAplcnYm={(val) => { + if (val instanceof Date) { + form.setValue("aplcnYm", val) + } else if (val) { + form.setValue("aplcnYm", new Date(val)) } - }) - - - const [tableData, setTableData] = useState<any[]>([]); // API 조회 결과 저장 상태 - const [totalData, setTotalData] = useState(0) //총 데이터 수 - const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태 - const [selectedRowData, setSelectedRowData] = useState<any>(null); - const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); - const [resetSelection, setResetSelection] = useState<boolean>(false); - - - const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { - setIsLoadingResult(true); - const formValues = customFormValues || form.getValues(); // react-hook-form에서 현재 값 가져오기 - console.log("formValues", formValues); - - let inftwtAnlsSearchDto; - - if (customFormValues) { - inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm, - "enoCd": formValues.enoCd, - "ctpvCd": formValues.ctpvCd, - "sggCd": formValues.sggCd, - "swtrmtZoneCd": formValues.swtrmtZoneCd, - }; - } else { - inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm ? formValues.aplcnYm.toISOString().substring(0, 7).replace("-", "") : null, - "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, - "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, - "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, - "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, - }; - } - console.log("Search DTO:", inftwtAnlsSearchDto); - - const queryParams = new URLSearchParams({ - page: '0', - size: '10000000', - sort: 'inftwtAnlsSn,desc' - }); - Object.entries(inftwtAnlsSearchDto).forEach(([key, value]) => { - if (value !== undefined && value !== null && String(value).trim() !== '') { // undefined, null, 빈 문자열이 아닌 경우에만 추가 - queryParams.append(key, String(value)); - } - }); - const queryString = queryParams.toString(); - - console.log("API: ", `v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); - try { - const data = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); - setTableData(data.content || []); - setTotalData(tableData.length); - console.log("response:", data); - console.log("response data:", data.content || []); - setIsLoadingResult(false); - } catch (error) { - setIsLoadingResult(false); - console.error("Error fetching analysis result data:", error); - alert("분석결과 조회 중 오류가 발생했습니다."); - setTableData([]); - setTotalData(0); - } - }; - - // 테이블 셀 클릭 핸들러 추가 - const handleCellClick = (index: number | undefined, headId: string) => { - if (index !== undefined && tableData[index]) { - setSelectedRowData(tableData[index]); - setSelectedRowIndex(index); - console.log("Selected row data:", tableData[index]); - } - }; - - // Excel 다운로드 핸들러 추가 - const handleExcelDownload = async () => { - setIsLoadingResult(true); - console.log("Selected row data for download:", selectedRowData); - if (!selectedRowData || selectedRowData.inftwtAnlsSn === undefined) { - setIsLoadingResult(false); - alert('다운로드할 데이터를 선택해주세요.'); - return; - } - - try { - const data = await getData(`v1/inftwtAnlsRslt/ppl/${selectedRowData.inftwtAnlsSn}`); - - // 선택된 행 데이터를 Excel 다운로드 형식으로 변환 - const excelData = data.content; // 배열로 감싸서 전달 - - // 파일명 생성 (분석번호 기반) - const fileName = `침입수분석결과_${selectedRowData.inftwtAnlsSn}_${selectedRowData.aplcnYm}`; - - downloadExcel({ - data: excelData as JSON[], - fileName: fileName, - sheetNameArray: ["침입수 분석결과"], - headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정 - }); - setIsLoadingResult(false); - } catch (error) { - setIsLoadingResult(false); - console.error("Excel 다운로드 중 오류 발생:", error); - alert("Excel 다운로드 중 오류가 발생했습니다. 다시 시도해주세요."); - } - }; - - // 파일 삭제 핸들러 추가 - const handleFileDelete = async () => { - setIsLoadingResult(true); - console.log("Selected row data for deletion:", selectedRowData); - if (!selectedRowData || selectedRowData.inftwtAnlsSn === undefined) { - setIsLoadingResult(false); - alert('삭제할 파일을 선택해주세요.'); - return; - } - // 삭제 확인 대화상자 - const confirmDelete = window.confirm('선택된 분석 결과를 삭제하시겠습니까?'); - if (!confirmDelete) { - return; - } - - try { - // // 삭제 API 호출 - console.log("Deleting analysis result with inftwtAnlsSn:", selectedRowData.inftwtAnlsSn); - const response1 = await deleteData(`v1/inftwtAnlsRslt/${selectedRowData.inftwtAnlsSn}`); - const response2 = await deleteData(`v1/inftwtAnls/${selectedRowData.inftwtAnlsSn}`); - // 첨부파일(inp파일) 삭제 API 호출 - handleDelete(selectedRowData.atflCd, { - handleDeleteStart: () => console.log("파일 삭제 시작"), - handleDeleteSuccess: (response) => console.log("파일 삭제 성공:", response), - handleDeleteError: (error) => console.error("파일 삭제 실패:", error), - }); - console.log("File delete response1:", response1); - console.log("File delete response2:", response2); - - // 테이블 선택 상태 초기화 트리거 - setResetSelection(true); - - // 삭제 후 테이블 새로고침을 위해 재검색 - const customFormValues: Partial<ResultFormValues> = { - aplcnYm: selectedRowData.aplcnYm || null, - enoCd: selectedRowData.enoCd || null, - ctpvCd: selectedRowData.ctpvCd || null, - sggCd: selectedRowData.sggCd || null, - swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, - }; - await handleSearchButtonClick(customFormValues); - - // 선택된 행 초기화 - setSelectedRowData(null); - setSelectedRowIndex(undefined); - setIsLoadingResult(false); - - alert('삭제가 완료되었습니다.'); - - setTimeout(() => { - setResetSelection(false); - }, 100); - } catch (error) { - setIsLoadingResult(false); - console.error("분석결과 파일 삭제 중 오류 발생:", error); - alert("분석결과 파일 삭제 중 오류가 발생했습니다. 다시 시도해주세요."); - } - }; - - return ( - <BaseLayout - selectBox={{ title: '분석 대상지역 선택', searchChk: true, onSearchClick: handleSearchButtonClick }} - titleName={{ mainTitle: '분석결과', firstCardTitle: '분석이력' }} - form={form} // form 인스턴스 전달 - onSubmitEvent={() => { }} // BaseLayout의 form 태그에 연결될 onSubmit - graphBtn={true} - showDatePicker={true} - enoCd={form.watch("enoCd")} - setEnoCd={(val) => form.setValue("enoCd", val)} - ctpvCd={form.watch("ctpvCd")} - setCtpvCd={(val) => form.setValue("ctpvCd", val)} - sigungu={form.watch("sggCd")} - setSigungu={(val) => form.setValue("sggCd", val)} - selectedSwageTreatmentPlant={form.watch("swageTmplntCd")} - onSwageTreatmentPlantChange={(val) => form.setValue("swageTmplntCd", String(val))} - selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} - onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} - aplcnYm={form.watch("aplcnYm")} - setAplcnYm={(val) => { - if (val instanceof Date) { - form.setValue("aplcnYm", val) - } else if (val) { - form.setValue("aplcnYm", new Date(val)) - } - }} - isLoading={isLoadingResult} // 로딩 상태 전달 - // Excel 다운로드 핸들러 추가 - onExcelDownload={handleExcelDownload} - onDeleteFile={handleFileDelete} - selectedRowData={selectedRowData} - > - {[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md"> - <div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div> - <div className="flex-grow overflow-auto"> - <UiTable - headName='' - headlist={tableColumn} - tableData={tableData} - total={totalData} - pageSize={10} - children={undefined} - cellClick={handleCellClick} - onPageChange={(e) => { }} - resetSelection={resetSelection} - /> - </div> - </div> - ]} - </BaseLayout> - ) + }} + isLoading={isLoadingResult} // 로딩 상태 전달 + // Excel 다운로드 핸들러 추가 + onExcelDownload={handleExcelDownload} + onDeleteFile={handleFileDelete} + selectedRowData={selectedRowData} + > + {[<div key='table1' className="h-[55vh] flex flex-col p-4 border rounded-lg bg-white shadow-md"> + <div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div> + <div className="flex-grow overflow-auto"> + <UiTable + headName='' + headlist={tableColumn} + tableData={tableData} + total={totalData} + pageSize={10} + children={undefined} + cellClick={handleCellClick} + onPageChange={(e) => { }} + resetSelection={resetSelection} + /> + </div> + </div> + ]} + </BaseLayout> + ) } export default Result \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 000389a3e..54438e6fe 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -12,150 +12,150 @@ import { deleteData, postData } from '@/components/lib/api' import LoadingOverlay from '@/components/ui/LoadingBar' const Page = () => { - // 조회조건 - const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) - const [toDate, setToDate] = useState(new Date()) - const [manageYear, setManageYear] = useState(yearOptions[0]?.val || ''); - const [mngQu, setMngQu] = useState(yearOptions[0]?.val || ''); - const [usr, setUsr] = useState('') - const [pjNm, setpjNm] = useState('') - // 파일업로드 관련 상태 - const [fileNm, setFileNm] = useState('') //파일명 - const [atflId, setAtflId] = useState('') //파일 ID - const [sbmrgPrevntBizSn, setSbmrgPrevntBizSn] = useState('') //파일 일련번호 - const [tableData, setTableData] = useState<any>([{}]) //테이블 데이터 - const [curPage, setCurPage] = useState(1) //현재 페이지 - const [totalData, setTotalData] = useState(0) //총 데이터 수 - const [isLoading, setIsLoading] = useState(true) //로딩 상태 - const fetchData = async () => { - setIsLoading(true) - searchCmmnCd('SITEKNDCD') - try { - const { data, total } = await searchData('v1/sbmrgPrevnt', { - fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, - toRegDt: formatDate(toDate), - atflNm: pjNm, - rgtrNm: usr, - page: curPage - 1, - size: '10' - }) - setTableData(data) - setTotalData(total) - } - catch (error) { console.error('Error fetching data:', error) } - finally { setIsLoading(false); } + // 조회조건 + const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) + const [toDate, setToDate] = useState(new Date()) + const [manageYear, setManageYear] = useState(yearOptions[0]?.val || ''); + const [mngQu, setMngQu] = useState(yearOptions[0]?.val || ''); + const [usr, setUsr] = useState('') + const [pjNm, setpjNm] = useState('') + // 파일업로드 관련 상태 + const [fileNm, setFileNm] = useState('') //파일명 + const [atflId, setAtflId] = useState('') //파일 ID + const [sbmrgPrevntBizSn, setSbmrgPrevntBizSn] = useState('') //파일 일련번호 + const [tableData, setTableData] = useState<any>([{}]) //테이블 데이터 + const [curPage, setCurPage] = useState(1) //현재 페이지 + const [totalData, setTotalData] = useState(0) //총 데이터 수 + const [isLoading, setIsLoading] = useState(true) //로딩 상태 + const fetchData = async () => { + setIsLoading(true) + searchCmmnCd('SITEKNDCD') + try { + const { data, total } = await searchData('v1/sbmrgPrevnt', { + fromRegDt: formatDate(fromDate), + fromMngYr: manageYear, + toMngYr: mngQu, + toRegDt: formatDate(toDate), + atflNm: pjNm, + rgtrNm: usr, + page: curPage - 1, + size: '10' + }) + setTableData(data) + setTotalData(total) } - useEffect(() => { - setCurPage(1) + catch (error) { console.error('Error fetching data:', error) } + finally { setIsLoading(false); } + } + useEffect(() => { + setCurPage(1) + fetchData() + }, []) + // 파일 다운로드 + const isChckFile = () => { + if (fileNm === '' || fileNm === undefined) { + alert('파일을 선택해주세요') + return false + } + handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) + } + // 선택 파일 삭제 + const isDeleteFile = async () => { + if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) { + alert('삭제할 파일을 선택해주세요') + return false + } + const data = await deleteData(`/attach-service/api/v1/atfl/attachments/${atflId}`) + if (data) { + const delData = await deleteData(`v1/sbmrgPrevnt/${sbmrgPrevntBizSn}`) + if (delData.status === 200) { + alert('삭제되었습니다.') fetchData() - }, []) - // 파일 다운로드 - const isChckFile = () => { - if (fileNm === '' || fileNm === undefined) { - alert('파일을 선택해주세요') - return false - } - handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) + } } - // 선택 파일 삭제 - const isDeleteFile = async () => { - if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) { - alert('삭제할 파일을 선택해주세요') - return false - } - const data = await deleteData(`/attach-service/api/v1/atfl/attachments/${atflId}`) - if (data) { - const delData = await deleteData(`v1/sbmrgPrevnt/${sbmrgPrevntBizSn}`) - if (delData.status === 200) { - alert('삭제되었습니다.') - fetchData() - } - } - } - // 현황 등록 - const registFile = async (fileName: string, year: string, quater: string, cd: string, id: string) => { - const data = await postData('v1/sbmrgPrevnt', { - atflNm: fileName, - mngYr: year, - mngQu: quater, - atflCd: cd, - atflId: id, - sbmrgPrevntBizNm: fileName - }) - if (data) { alert('파일이 등록되었습니다.'); fetchData() } - } - return ( - <ContentLayout title='도시침수 예방사업' isLoading={isLoading}> - <SearchDiv> - <SearchFormLeft> - <div className='flex items-center gap-5'> - <div className='flex items-center gap-2'> - <Label className="w-20 text-xl text-gray-600">등록기간</Label> - <DatePicker mode={'single'} - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> - <span>~</span> - <DatePicker mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> - </div> - <div className='flex items-center gap-2'> - <Label className="w-20 text-xl text-gray-600">관리년도</Label> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setManageYear(String(value))} - /> - <span>~</span> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setMngQu(String(value))} - /> - </div> - <div className='flex items-center'> - <Label className="w-20 text-xl text-gray-600">등록자</Label> - <Input - className='w-[100px]' - value={usr} - onChange={(e) => setUsr(e.target.value)} - /> - </div> - <div className='flex items-center'> - <Label className="w-20 text-xl text-gray-600">파일명</Label> - <Input - className='w-[100px]' - value={pjNm} - onChange={(e) => setpjNm(e.target.value)} - /> - </div> - </div> - </SearchFormLeft> - <SearchFormRight> - <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={async () => await fetchData()} >조회</Button> - </SearchFormRight> - </SearchDiv> - <ListDiv className="mt-4"> - <div className="card-header flex items-center justify-between"> - <h3 className="text-2xl font-medium">사업정보 등록현황</h3> - <div> - <Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile} >파일 다운로드</Button> - <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile} >삭제</Button> - </div> - </div> - <UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> - </ListDiv> - <ListDiv className="mt-4"> - <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> - </ListDiv> - </ContentLayout> - ) + } + // 현황 등록 + const registFile = async (fileName: string, year: string, quater: string, cd: string, id: string) => { + const data = await postData('v1/sbmrgPrevnt', { + atflNm: fileName, + mngYr: year, + mngQu: quater, + atflCd: cd, + atflId: id, + sbmrgPrevntBizNm: fileName + }) + if (data) { alert('파일이 등록되었습니다.'); fetchData() } + } + return ( + <ContentLayout title='도시침수 예방사업' isLoading={isLoading}> + <SearchDiv> + <SearchFormLeft> + <div className='flex items-center gap-5'> + <div className='flex items-center gap-2'> + <Label className="w-20 text-xl text-gray-600">등록기간</Label> + <DatePicker mode={'single'} + selected={fromDate} + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + <span>~</span> + <DatePicker mode={'single'} + selected={toDate} + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + </div> + <div className='flex items-center gap-2'> + <Label className="w-20 text-xl text-gray-600">관리년도</Label> + <SelectBox + className="w-[90px] mr-3 ml-4" + selectClass="rounded-lg bg-white" + label="" + selectArray={yearOptions} + onSelectValue={(value: string | number) => setManageYear(String(value))} + /> + <span>~</span> + <SelectBox + className="w-[90px] mr-3 ml-4" + selectClass="rounded-lg bg-white" + label="" + selectArray={yearOptions} + onSelectValue={(value: string | number) => setMngQu(String(value))} + /> + </div> + <div className='flex items-center'> + <Label className="w-20 text-xl text-gray-600">등록자</Label> + <Input + className='w-[100px]' + value={usr} + onChange={(e) => setUsr(e.target.value)} + /> + </div> + <div className='flex items-center'> + <Label className="w-20 text-xl text-gray-600">파일명</Label> + <Input + className='w-[100px]' + value={pjNm} + onChange={(e) => setpjNm(e.target.value)} + /> + </div> + </div> + </SearchFormLeft> + <SearchFormRight> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={async () => await fetchData()} >조회</Button> + </SearchFormRight> + </SearchDiv> + <ListDiv className="mt-4"> + <div className="card-header flex items-center justify-between"> + <h3 className="text-2xl font-medium">사업정보 등록현황</h3> + <div> + <Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile} >파일 다운로드</Button> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile} >삭제</Button> + </div> + </div> + <UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> + </ListDiv> + <ListDiv className="mt-4"> + <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> + </ListDiv> + </ContentLayout> + ) } export default Page \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/oper/index.ts b/apps/sn/app/(with-base-layout)/oper/index.ts index 54ba00374..e4be8bcf6 100644 --- a/apps/sn/app/(with-base-layout)/oper/index.ts +++ b/apps/sn/app/(with-base-layout)/oper/index.ts @@ -1,17 +1,17 @@ export const tableHeadlist = [ - { id: 'sbmrgPrevntBizSn', title: '일련번호' }, - { id: 'sbmrgPrevntBizNm', title: '파일명' }, - { id: 'mngYr', title: '년도' }, - { id: 'mngQu', title: '분기' }, - { id: 'regDt', title: '등록 일자' }, - { id: 'rgtr', title: '등록자' } + { id: 'sbmrgPrevntBizSn', title: '일련번호' }, + { id: 'sbmrgPrevntBizNm', title: '파일명' }, + { id: 'mngYr', title: '년도' }, + { id: 'mngQu', title: '분기' }, + { id: 'regDt', title: '등록 일자' }, + { id: 'rgtr', title: '등록자' } ] export const tableHeadlistOldPp = [ - { id: 'dcrpPplMtncBizSn', title: '일련번호' }, - { id: 'dcrpPplMtncBizNm', title: '파일명' }, - { id: 'mngYr', title: '년도' }, - { id: 'mngQu', title: '분기' }, - { id: 'regDt', title: '등록 일자' }, - { id: 'rgtr', title: '등록자' } + { id: 'dcrpPplMtncBizSn', title: '일련번호' }, + { id: 'dcrpPplMtncBizNm', title: '파일명' }, + { id: 'mngYr', title: '년도' }, + { id: 'mngQu', title: '분기' }, + { id: 'regDt', title: '등록 일자' }, + { id: 'rgtr', title: '등록자' } ] \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 695ae7a28..f756ab30f 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -10,151 +10,152 @@ import { searchData } from '@/components/lib/common/apiHelpers' import { formatDate, yearOptions, handleDownload } from '@/components/lib/utils' import { deleteData, postData } from '@/components/lib/api' const Page = () => { - const [fromDate, setFromDate] = useState<Date>(()=>{const date = new Date(); date.setDate(date.getDate()-7); return date}); - const [toDate, setToDate] = useState<Date>(new Date()); - const [manageYear, setManageYear] = useState(yearOptions[0]?.val || ''); - const [mngQu, setMngQu] = useState(yearOptions[0]?.val || ''); - const [usr, setUsr] = useState('') - const [pjNm, setpjNm] = useState('') - const [fileNm, setFileNm] = useState('') - const [atflId, setAtflId] = useState('') - const [dcrpPplMtncBizSn, setDcrpPplMtncBizSn] = useState('') - const [tableData, setTableData] = useState<any>([{}]) - const [curPage, setCurPage] = useState(1) - const [totalData, setTotalData] = useState(0) //총 데이터 수 - const [isLoading, setIsLoading] = useState(true) //로딩 상태 - // 데이터 조회 - const fetchData = async () => { - setIsLoading(true) - try { - const {data, total} = await searchData('v1/dcrpPpl', { - fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, - toRegDt: formatDate(toDate), - dcrpPplMtncBizNm: pjNm, - rgtrNm: usr, - page: curPage - 1, - size: '10' - }) - setTableData(data) - setTotalData(total) - console.log(data, total) - }catch (error) { - console.error('Error fetching data:', error)}finally{setIsLoading(false)} + const [fromDate, setFromDate] = useState<Date>(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }); + const [toDate, setToDate] = useState<Date>(new Date()); + const [manageYear, setManageYear] = useState(yearOptions[0]?.val || ''); + const [mngQu, setMngQu] = useState(yearOptions[0]?.val || ''); + const [usr, setUsr] = useState('') + const [pjNm, setpjNm] = useState('') + const [fileNm, setFileNm] = useState('') + const [atflId, setAtflId] = useState('') + const [dcrpPplMtncBizSn, setDcrpPplMtncBizSn] = useState('') + const [tableData, setTableData] = useState<any>([{}]) + const [curPage, setCurPage] = useState(1) + const [totalData, setTotalData] = useState(0) //총 데이터 수 + const [isLoading, setIsLoading] = useState(true) //로딩 상태 + // 데이터 조회 + const fetchData = async () => { + setIsLoading(true) + try { + const { data, total } = await searchData('v1/dcrpPpl', { + fromRegDt: formatDate(fromDate), + fromMngYr: manageYear, + toMngYr: mngQu, + toRegDt: formatDate(toDate), + dcrpPplMtncBizNm: pjNm, + rgtrNm: usr, + page: curPage - 1, + size: '10' + }) + setTableData(data) + setTotalData(total) + console.log(data, total) + } catch (error) { + console.error('Error fetching data:', error) + } finally { setIsLoading(false) } + } + useEffect(() => { + setCurPage(1) + fetchData() + }, []) + // 파일 다운로드 + const isChckFile = () => { + if (fileNm === '' || fileNm === undefined) { + alert('파일을 선택해주세요') + return false } - useEffect(() => { - setCurPage(1) + handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) + return true + } + // 파일 삭제 + const isDeleteFile = async () => { + if (dcrpPplMtncBizSn === '' || dcrpPplMtncBizSn === undefined) { + alert('삭제할 파일을 선택해주세요') + return false + } + const data = await deleteData(`/attach-service/api/v1/atfl/attachments/${atflId}`) + if (data) { + const delData = await deleteData(`v1/dcrpPpl/${dcrpPplMtncBizSn}`) + if (delData.status == 200) { + alert('삭제되었습니다.') fetchData() - }, []) - // 파일 다운로드 - const isChckFile = () => { - if (fileNm === '' || fileNm === undefined) { - alert('파일을 선택해주세요') - return false - } - handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) - return true + } else { + alert('삭제에 실패했습니다.') + } } - // 파일 삭제 - const isDeleteFile = async () => { - if (dcrpPplMtncBizSn === '' || dcrpPplMtncBizSn === undefined) { - alert('삭제할 파일을 선택해주세요') - return false - } - const data = await deleteData(`/attach-service/api/v1/atfl/attachments/${atflId}`) - if (data) { - const delData = await deleteData(`v1/dcrpPpl/${dcrpPplMtncBizSn}`) - if (delData.status == 200) { - alert('삭제되었습니다.') - fetchData() - } else { - alert('삭제에 실패했습니다.') - } - } - } - // 파일 등록 - const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => { - const data = await postData('v1/dcrpPpl', { - atflNm: fileNm, - mngYr: year, - mngQu: quater, - atflCd: cd, - atflId: id, - dcrpPplMtncBizNm: fileNm - }) - if (data) {alert('파일이 등록되었습니다.');fetchData() } - } - return ( - <> - <SearchDiv> - <SearchFormLeft> - <div className='flex items-center gap-4'> - <div className='flex items-center space-x-2'> - <Label className="w-20 text-xl text-gray-600">등록기간</Label> - <DatePicker mode={'single'} - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> - <span>~</span> - <DatePicker mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> - <div className='flex items-center gap-2'> - <Label className="w-20 text-xl text-gray-600">관리년도</Label> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setManageYear(String(value))} - /> - <span>~</span> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setMngQu(String(value))} - /> - </div> - <div className='flex items-center'> - <Label className="w-20 text-xl text-gray-600">등록자</Label> - <Input - className='w-[100px] !text-2xl' - value={usr} - onChange={(e) => setUsr(e.target.value)} - /> - </div> - <div className='flex items-center'> - <Label className="w-20 text-xl text-gray-600">파일명</Label> - <Input - className='w-[100px] !text-2xl' - value={pjNm} - onChange={(e) => {setpjNm(e.target.value)}} - /> - </div> - </div> - </div> - </SearchFormLeft> - <SearchFormRight> - <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 mr-2" size="sm" onClick={async () => {await fetchData()}}>조회</Button> - </SearchFormRight> - </SearchDiv> - <ListDiv className="mt-4"> - <div className="card-header flex items-center justify-between"> - <h3 className="text-2xl font-medium">사업정보 등록현황</h3> - <div> - <Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile}>파일 다운로드</Button> - <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> - </div> - </div> - <UiTable headName='' tableData={tableData} headlist={tableHeadlistOldPp} pageSize={10} total={totalData} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn) } }} onPageChange={async (page:number)=>{setCurPage(page); await fetchData()}}></UiTable> - </ListDiv> - <ListDiv className="mt-4"> - <OperFileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> - </ListDiv> - </> - ) + } + // 파일 등록 + const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => { + const data = await postData('v1/dcrpPpl', { + atflNm: fileNm, + mngYr: year, + mngQu: quater, + atflCd: cd, + atflId: id, + dcrpPplMtncBizNm: fileNm + }) + if (data) { alert('파일이 등록되었습니다.'); fetchData() } + } + return ( + <> + <SearchDiv> + <SearchFormLeft> + <div className='flex items-center gap-4'> + <div className='flex items-center space-x-2'> + <Label className="w-20 text-xl text-gray-600">등록기간</Label> + <DatePicker mode={'single'} + selected={fromDate} + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + <span>~</span> + <DatePicker mode={'single'} + selected={toDate} + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + <div className='flex items-center gap-2'> + <Label className="w-20 text-xl text-gray-600">관리년도</Label> + <SelectBox + className="w-[90px] mr-3 ml-4" + selectClass="rounded-lg bg-white" + label="" + selectArray={yearOptions} + onSelectValue={(value: string | number) => setManageYear(String(value))} + /> + <span>~</span> + <SelectBox + className="w-[90px] mr-3 ml-4" + selectClass="rounded-lg bg-white" + label="" + selectArray={yearOptions} + onSelectValue={(value: string | number) => setMngQu(String(value))} + /> + </div> + <div className='flex items-center'> + <Label className="w-20 text-xl text-gray-600">등록자</Label> + <Input + className='w-[100px] !text-2xl' + value={usr} + onChange={(e) => setUsr(e.target.value)} + /> + </div> + <div className='flex items-center'> + <Label className="w-20 text-xl text-gray-600">파일명</Label> + <Input + className='w-[100px] !text-2xl' + value={pjNm} + onChange={(e) => { setpjNm(e.target.value) }} + /> + </div> + </div> + </div> + </SearchFormLeft> + <SearchFormRight> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 mr-2" size="sm" onClick={async () => { await fetchData() }}>조회</Button> + </SearchFormRight> + </SearchDiv> + <ListDiv className="mt-4"> + <div className="card-header flex items-center justify-between"> + <h3 className="text-2xl font-medium">사업정보 등록현황</h3> + <div> + <Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={isChckFile}>파일 다운로드</Button> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> + </div> + </div> + <UiTable headName='' tableData={tableData} headlist={tableHeadlistOldPp} pageSize={10} total={totalData} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn) } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> + </ListDiv> + <ListDiv className="mt-4"> + <OperFileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> + </ListDiv> + </> + ) } export default Page \ No newline at end of file diff --git a/apps/sn/app/components/lib/api/index.ts b/apps/sn/app/components/lib/api/index.ts index d7db93f77..beb527c65 100644 --- a/apps/sn/app/components/lib/api/index.ts +++ b/apps/sn/app/components/lib/api/index.ts @@ -1,68 +1,68 @@ const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ''; export const postData = async (url: string, data: object): Promise<any> => { - const options: RequestInit = { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }; - const res = await fetch(`${BASE_URL}/${url}`, options); - if (res.ok) { - const resData = await res.json(); - return resData; - // const text = await res.text(); - // if (text) { - // return JSON.parse(text); // JSON 데이터가 있으면 파싱하여 반환 - // } - // return true; // 응답 본문이 비어 있으면 true 반환 - } + const options: RequestInit = { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }; + const res = await fetch(`${BASE_URL}/${url}`, options); + if (res.ok) { + const resData = await res.json(); + return resData; + // const text = await res.text(); + // if (text) { + // return JSON.parse(text); // JSON 데이터가 있으면 파싱하여 반환 + // } + // return true; // 응답 본문이 비어 있으면 true 반환 + } }; export const postMutiPart = async (url: string, data: FormData): Promise<any> => { - const options: RequestInit = { - method: "POST", - body: data, - }; - const res = await fetch(`${BASE_URL}/${url}`, options); - const resData = await res.json(); - return resData; + const options: RequestInit = { + method: "POST", + body: data, + }; + const res = await fetch(`${BASE_URL}/${url}`, options); + const resData = await res.json(); + return resData; }; export const putData = async (url: string, data: object): Promise<any> => { - const options: RequestInit = { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(data), - }; - const res = await fetch(`${BASE_URL}/${url}`, options); - const resData = await res.json(); - return resData; + const options: RequestInit = { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }; + const res = await fetch(`${BASE_URL}/${url}`, options); + const resData = await res.json(); + return resData; }; export const getData = async (url: string, data?: object): Promise<any> => { - const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, { - method: "GET", - }); - if (res.ok) { - const data = await res.json(); - return data; - } - throw new Error('Failed to fetch data'); + const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, { + method: "GET", + }); + if (res.ok) { + const data = await res.json(); + return data; + } + throw new Error('Failed to fetch data'); }; export const deleteData = async (url: string, data?: object): Promise<any> => { - const options: RequestInit = { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - body: data ? JSON.stringify(data) : undefined, - }; - const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, options); - if (res.status === 204) return true - return res; + const options: RequestInit = { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: data ? JSON.stringify(data) : undefined, + }; + const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, options); + if (res.status === 204) return true + return res; }; \ No newline at end of file diff --git a/apps/sn/app/components/lib/common/apiHelpers.ts b/apps/sn/app/components/lib/common/apiHelpers.ts index caaa3b050..4963516f7 100644 --- a/apps/sn/app/components/lib/common/apiHelpers.ts +++ b/apps/sn/app/components/lib/common/apiHelpers.ts @@ -1,24 +1,24 @@ import { getData } from "../api"; export const searchData = async<T extends Record<string, any>>(url: string, paramObj: T) => { - const params = new URLSearchParams( - Object.entries(paramObj) - .filter(([_, value]) => value !== undefined && value !== '') // 값이 있는 항목만 포함 - .reduce((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {} as Record<string, string>) - ); - const data = await getData(`${url}?${params.toString()}`); - return data && { data: data.content, total: data.totalElements } + const params = new URLSearchParams( + Object.entries(paramObj) + .filter(([_, value]) => value !== undefined && value !== '') // 값이 있는 항목만 포함 + .reduce((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {} as Record<string, string>) + ); + const data = await getData(`${url}?${params.toString()}`); + return data && { data: data.content, total: data.totalElements } } // 상위코드로 하위코드 조회 export const searchCmmnCd = async (upCd: string) => { - const data = await getData(`/cms-service/api/v1/code/cache/${upCd}`); - const filteredData = data.map((item: any) => ({ - lwpoCd: item.lwpoCd, - lwpoCdNm: item.lwpoCdNm, - })); - return filteredData; + const data = await getData(`/cms-service/api/v1/code/cache/${upCd}`); + const filteredData = data.map((item: any) => ({ + lwpoCd: item.lwpoCd, + lwpoCdNm: item.lwpoCdNm, + })); + return filteredData; } \ No newline at end of file diff --git a/apps/sn/app/components/lib/utils/date.ts b/apps/sn/app/components/lib/utils/date.ts index 75e3cbf32..9319d7013 100644 --- a/apps/sn/app/components/lib/utils/date.ts +++ b/apps/sn/app/components/lib/utils/date.ts @@ -1,13 +1,13 @@ export const formatDate = (date: Date): string => { - if (!date) return ''; - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); // 월은 0부터 시작하므로 +1 - const day = String(date.getDate()).padStart(2, '0'); - return `${year}-${month}-${day}`; + if (!date) return ''; + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // 월은 0부터 시작하므로 +1 + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; }; - // 현재 년도부터 10년 전까지의 년도 옵션 생성 - export const yearOptions = Array.from({ length: 10 }, (_, i) => { - const year = new Date().getFullYear() - i; - return { text: `${year}년`, val: year.toString() }; - }); +// 현재 년도부터 10년 전까지의 년도 옵션 생성 +export const yearOptions = Array.from({ length: 10 }, (_, i) => { + const year = new Date().getFullYear() - i; + return { text: `${year}년`, val: year.toString() }; +}); diff --git a/apps/sn/app/components/ui/fileUploadForm.tsx b/apps/sn/app/components/ui/fileUploadForm.tsx index 7fcdeb353..3cd663e01 100644 --- a/apps/sn/app/components/ui/fileUploadForm.tsx +++ b/apps/sn/app/components/ui/fileUploadForm.tsx @@ -6,143 +6,143 @@ import { useId, useState } from 'react'; import type { HttpResponse, Upload } from "tus-js-client"; interface FileUploadFormProps { - onSubmit?: (files: string, year: string, quarter: string, code: string, id: string) => void; - onFileSelect?: (file: File | null, atflCd: string | null, atflId: string | null) => void; // 파일 선택 시 호출될 콜백 추가 - showButton?: boolean; // 버튼 표시 여부 (기본값 true) - showPreview?: boolean; // 파일명 프리뷰 표시 여부 - accept?: string; // 파일 형식 지정 - fileIdx?: number; // 부모가 어떤 FileUploadForm인지 구분하기 위한 인덱스 + onSubmit?: (files: string, year: string, quarter: string, code: string, id: string) => void; + onFileSelect?: (file: File | null, atflCd: string | null, atflId: string | null) => void; // 파일 선택 시 호출될 콜백 추가 + showButton?: boolean; // 버튼 표시 여부 (기본값 true) + showPreview?: boolean; // 파일명 프리뷰 표시 여부 + accept?: string; // 파일 형식 지정 + fileIdx?: number; // 부모가 어떤 FileUploadForm인지 구분하기 위한 인덱스 } const FileUploadForm = ({ - onSubmit, - onFileSelect, - showButton = true, - showPreview = false, - accept = ".jpeg, .jpg, .png", - fileIdx // props에서 fileIdx 받기 + onSubmit, + onFileSelect, + showButton = true, + showPreview = false, + accept = ".jpeg, .jpg, .png", + fileIdx // props에서 fileIdx 받기 }: FileUploadFormProps) => { - const [internalAtflCd, setInternalAtflCd] = useState<string | null>(null); - const [internalAtflId, setInternalAtflId] = useState<string | null>(null); - const [currentFile, setCurrentFile] = useState<File | null>(null); // 현재 선택된 파일을 저장할 상태 - const [fileName, setFileName] = useState<string>(''); - const [files, setFiles] = useState<FileList | null>(null); - const [upload, setUpload] = useState<Upload | null>(null); - const uniqueId = useId(); // 각 FileUploadForm 인스턴스에 대한 고유 ID 생성 + const [internalAtflCd, setInternalAtflCd] = useState<string | null>(null); + const [internalAtflId, setInternalAtflId] = useState<string | null>(null); + const [currentFile, setCurrentFile] = useState<File | null>(null); // 현재 선택된 파일을 저장할 상태 + const [fileName, setFileName] = useState<string>(''); + const [files, setFiles] = useState<FileList | null>(null); + const [upload, setUpload] = useState<Upload | null>(null); + const uniqueId = useId(); // 각 FileUploadForm 인스턴스에 대한 고유 ID 생성 - const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }]; - // 현재 년도부터 10년 전까지의 년도 옵션 생성 - const yearOptions = Array.from({ length: 10 }, (_, i) => { - const year = new Date().getFullYear() - i; - return { text: `${year}년`, val: year.toString() }; - }); - const [selectedYear, setSelectedYear] = useState<string>(yearOptions[0]?.val || ''); - const [selectedQuarter, setSelectedQuarter] = useState<string>(quater[0]?.val || ''); + const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }]; + // 현재 년도부터 10년 전까지의 년도 옵션 생성 + const yearOptions = Array.from({ length: 10 }, (_, i) => { + const year = new Date().getFullYear() - i; + return { text: `${year}년`, val: year.toString() }; + }); + const [selectedYear, setSelectedYear] = useState<string>(yearOptions[0]?.val || ''); + const [selectedQuarter, setSelectedQuarter] = useState<string>(quater[0]?.val || ''); - const internalHandleUploadResponse = (file: File) => async (res: HttpResponse) => { - const fileInfo = res.getHeader("X-File-Info"); - if (!fileInfo) { - if (onFileSelect) onFileSelect(file, null, null); - return; - } - const { atflCd: newAtflCd, atflId: newAtflId } = JSON.parse(fileInfo) ?? {}; - const orgnlFileNm = file.name; - console.log(`FileUploadForm (idx: ${fileIdx ?? 'N/A'}) - orgnlFileNm:`, orgnlFileNm, 'New AtflCd:', newAtflCd, 'New AtflId:', newAtflId); - setFileName(orgnlFileNm); - setInternalAtflCd(newAtflCd); - setInternalAtflId(newAtflId); + const internalHandleUploadResponse = (file: File) => async (res: HttpResponse) => { + const fileInfo = res.getHeader("X-File-Info"); + if (!fileInfo) { + if (onFileSelect) onFileSelect(file, null, null); + return; + } + const { atflCd: newAtflCd, atflId: newAtflId } = JSON.parse(fileInfo) ?? {}; + const orgnlFileNm = file.name; + console.log(`FileUploadForm (idx: ${fileIdx ?? 'N/A'}) - orgnlFileNm:`, orgnlFileNm, 'New AtflCd:', newAtflCd, 'New AtflId:', newAtflId); + setFileName(orgnlFileNm); + setInternalAtflCd(newAtflCd); + setInternalAtflId(newAtflId); - if (onFileSelect) { - onFileSelect(file, newAtflCd, newAtflId); - } - }; + if (onFileSelect) { + onFileSelect(file, newAtflCd, newAtflId); + } + }; - return ( - <div> {/* 컴포넌트 루트 div */} - <div className="card p-6"> {/* 카드 스타일링 */} - <div className='flex items-center gap-2'> {/* FileUploader와 Button을 정렬하는 메인 flex 컨테이너 */} - <div className="w-[300px] mr-4"> {/* FileUploader의 너비와 오른쪽 여백을 제어하는 컨테이너 */} - <FileUploader - id={uniqueId} - className="!h-auto !max-w-none flex-row items-center gap-2" - accept={accept} - onUpload={(e) => { - const selectedFiles = e.target.files; - if (!selectedFiles || selectedFiles.length === 0) { - setFiles(null); - setCurrentFile(null); - setInternalAtflCd(null); - setInternalAtflId(null); - if (onFileSelect) { - onFileSelect(null, null, null); // 파일 선택 취소 시 null 전달 - } - return; - } + return ( + <div> {/* 컴포넌트 루트 div */} + <div className="card p-6"> {/* 카드 스타일링 */} + <div className='flex items-center gap-2'> {/* FileUploader와 Button을 정렬하는 메인 flex 컨테이너 */} + <div className="w-[300px] mr-4"> {/* FileUploader의 너비와 오른쪽 여백을 제어하는 컨테이너 */} + <FileUploader + id={uniqueId} + className="!h-auto !max-w-none flex-row items-center gap-2" + accept={accept} + onUpload={(e) => { + const selectedFiles = e.target.files; + if (!selectedFiles || selectedFiles.length === 0) { + setFiles(null); + setCurrentFile(null); + setInternalAtflCd(null); + setInternalAtflId(null); + if (onFileSelect) { + onFileSelect(null, null, null); // 파일 선택 취소 시 null 전달 + } + return; + } - const firstFile = selectedFiles[0]; - if (!firstFile) return; // 타입스크립트 undefined 가능성 제거 + const firstFile = selectedFiles[0]; + if (!firstFile) return; // 타입스크립트 undefined 가능성 제거 - setFiles(selectedFiles); - setCurrentFile(firstFile); + setFiles(selectedFiles); + setCurrentFile(firstFile); - if (onFileSelect) { - onFileSelect(firstFile, internalAtflCd, internalAtflId); - } + if (onFileSelect) { + onFileSelect(firstFile, internalAtflCd, internalAtflId); + } - handleUpload(selectedFiles, { - handleUploadStart: setUpload, - handleSuccess: setUpload, - // handleResponse는 tus-js-client의 Upload 인스턴스 콜백과 연동 필요 - // 여기서는 handleUpload 유틸리티가 응답을 직접 처리한다고 가정 - handleResponse: internalHandleUploadResponse(firstFile), - }); - }} - customPreview={ - showPreview ? ( - <div className="file-uploader-preview"> - {files && files.length > 0 - ? fileName - : "파일을 선택하세요."} - </div> - ) : null - } - /> - </div> - {showButton ? ( // showButton이 true일 때만 버튼 렌더링 - <Button - className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" - size="sm" - onClick={() => { - console.log(files?.[0]?.name) - if (!currentFile) { - alert('파일을 선택해주세요.'); - return; - } - if (!selectedYear) { - alert('등록년도를 선택해주세요.'); - return; - } - if (!selectedQuarter) { - alert('분기를 선택해주세요.'); - return; - } - const fileNm = currentFile.name; - if (onSubmit) { - // 부모에게 전달할 때는 내부 상태인 internalAtflCd, internalAtflId 사용 - onSubmit(fileNm, selectedYear, selectedQuarter, internalAtflCd || '', internalAtflId || ''); - setFiles(null); // 파일 업로드 후 파일 목록 초기화 - setFileName(''); // 파일명 초기화 - } - }} - > - 등록 - </Button> - ) : null} - </div> - </div> + handleUpload(selectedFiles, { + handleUploadStart: setUpload, + handleSuccess: setUpload, + // handleResponse는 tus-js-client의 Upload 인스턴스 콜백과 연동 필요 + // 여기서는 handleUpload 유틸리티가 응답을 직접 처리한다고 가정 + handleResponse: internalHandleUploadResponse(firstFile), + }); + }} + customPreview={ + showPreview ? ( + <div className="file-uploader-preview"> + {files && files.length > 0 + ? fileName + : "파일을 선택하세요."} + </div> + ) : null + } + /> + </div> + {showButton ? ( // showButton이 true일 때만 버튼 렌더링 + <Button + className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" + size="sm" + onClick={() => { + console.log(files?.[0]?.name) + if (!currentFile) { + alert('파일을 선택해주세요.'); + return; + } + if (!selectedYear) { + alert('등록년도를 선택해주세요.'); + return; + } + if (!selectedQuarter) { + alert('분기를 선택해주세요.'); + return; + } + const fileNm = currentFile.name; + if (onSubmit) { + // 부모에게 전달할 때는 내부 상태인 internalAtflCd, internalAtflId 사용 + onSubmit(fileNm, selectedYear, selectedQuarter, internalAtflCd || '', internalAtflId || ''); + setFiles(null); // 파일 업로드 후 파일 목록 초기화 + setFileName(''); // 파일명 초기화 + } + }} + > + 등록 + </Button> + ) : null} </div> - ) + </div> + </div> + ) } export default FileUploadForm \ No newline at end of file diff --git a/apps/sn/app/components/ui/formSection.tsx b/apps/sn/app/components/ui/formSection.tsx index 90bc8f735..384808aee 100644 --- a/apps/sn/app/components/ui/formSection.tsx +++ b/apps/sn/app/components/ui/formSection.tsx @@ -2,23 +2,23 @@ import { FormField } from '@common/business_components/ui' import React, { type ReactElement } from 'react' interface FormSectionProps { - children: ReactElement - titleNm: string - form: any - name: string + children: ReactElement + titleNm: string + form: any + name: string } const FormSection = ({ children, titleNm, form, name }: FormSectionProps) => { - return ( - <div className="grid grid-cols-[200px_1fr] items-center"> - <div className="text-xl font-medium">{titleNm}</div> - <FormField - control={form.control} - name={name} - render={({ field }) => children} - /> - </div> - ) + return ( + <div className="grid grid-cols-[200px_1fr] items-center"> + <div className="text-xl font-medium">{titleNm}</div> + <FormField + control={form.control} + name={name} + render={({ field }) => children} + /> + </div> + ) } export default FormSection \ No newline at end of file diff --git a/apps/sn/app/components/ui/modal.tsx b/apps/sn/app/components/ui/modal.tsx index f1dda48a6..b5421ecf3 100644 --- a/apps/sn/app/components/ui/modal.tsx +++ b/apps/sn/app/components/ui/modal.tsx @@ -2,34 +2,34 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogC import React from 'react' interface ModalProps { - isModalOpen: boolean; - setIsModalOpen: (open: boolean) => void; - title?: string; - children: React.ReactNode; - closeModal: () => void; - saveModal?: () => void + isModalOpen: boolean; + setIsModalOpen: (open: boolean) => void; + title?: string; + children: React.ReactNode; + closeModal: () => void; + saveModal?: () => void } -const Modal: React.FC<ModalProps> = ({ isModalOpen, setIsModalOpen, title, children, closeModal,saveModal }) => { - return ( - <Dialog open={isModalOpen} onOpenChange={setIsModalOpen}> - <DialogOverlay className='z-[200]' /> - <DialogContent className="w-auto max-w-[1200px] min-w-[400px] min-h-[150px] h-auto max-h-[450px] overflow-auto z-[1000]"> - {title ? <DialogHeader> - <DialogTitle>{title}</DialogTitle> - </DialogHeader> : null} - {children} - <DialogFooter> - <DialogClose> - <div className='flex justify-end gap-2'> - {saveModal ? <button className="px-4 py-2 bg-primary text-white rounded" onClick={saveModal}>저장</button> : null} - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closeModal}>닫기</button> - </div> - </DialogClose> - </DialogFooter> - </DialogContent> - </Dialog> - ) +const Modal: React.FC<ModalProps> = ({ isModalOpen, setIsModalOpen, title, children, closeModal, saveModal }) => { + return ( + <Dialog open={isModalOpen} onOpenChange={setIsModalOpen}> + <DialogOverlay className='z-[200]' /> + <DialogContent className="w-auto max-w-[1200px] min-w-[400px] min-h-[150px] h-auto max-h-[450px] overflow-auto z-[1000]"> + {title ? <DialogHeader> + <DialogTitle>{title}</DialogTitle> + </DialogHeader> : null} + {children} + <DialogFooter> + <DialogClose> + <div className='flex justify-end gap-2'> + {saveModal ? <button className="px-4 py-2 bg-primary text-white rounded" onClick={saveModal}>저장</button> : null} + <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closeModal}>닫기</button> + </div> + </DialogClose> + </DialogFooter> + </DialogContent> + </Dialog> + ) } export default Modal \ No newline at end of file diff --git a/apps/sn/app/components/ui/operFileUploadForm.tsx b/apps/sn/app/components/ui/operFileUploadForm.tsx index c3aaa6ddd..42d824e1b 100644 --- a/apps/sn/app/components/ui/operFileUploadForm.tsx +++ b/apps/sn/app/components/ui/operFileUploadForm.tsx @@ -4,48 +4,48 @@ import React, { useState } from 'react' import FileUploadForm from './fileUploadForm'; import { yearOptions } from '@/components/lib/utils'; -const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (files: string, year: string, quarter: string, code:string, id:string) => void }) => { - const [atflCd, setAtflCd] = useState<string | null>(null); - const [atflId, setAtflId] = useState<string | null>(null); +const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (files: string, year: string, quarter: string, code: string, id: string) => void }) => { + const [atflCd, setAtflCd] = useState<string | null>(null); + const [atflId, setAtflId] = useState<string | null>(null); - const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }] - const [selectedYear, setSelectedYear] = useState<string>(yearOptions[0]?.val || ''); - const [selectedQuarter, setSelectedQuarter] = useState<string>(quater[0]?.val || ''); + const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }] + const [selectedYear, setSelectedYear] = useState<string>(yearOptions[0]?.val || ''); + const [selectedQuarter, setSelectedQuarter] = useState<string>(quater[0]?.val || ''); - return ( - <div> - <div className='card-header'> - <h3 className="text-2xl font-medium">{title}</h3> - </div> - <div className="card p-6"> - <div className="grid grid-col-2 items-center space-x-4"> - <div className='flex'> - <SelectBox - className="w-50 mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="년도" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setSelectedYear(String(value))} - /><SelectBox - className="w-50" - selectClass="rounded-lg bg-white" - label="분기" - selectArray={quater} - onSelectValue={(value: string | number) => setSelectedQuarter(String(value))} - /> - <FileUploadForm - onSubmit={(files, year, quarter, code, id) => { - onSubmit(files, (selectedYear ?? year) || '', (selectedQuarter ?? quarter) || '', code, id); - }} - showButton={true} - showPreview={true} - accept={""} /> - </div> - </div> - </div> + return ( + <div> + <div className='card-header'> + <h3 className="text-2xl font-medium">{title}</h3> + </div> + <div className="card p-6"> + <div className="grid grid-col-2 items-center space-x-4"> + <div className='flex'> + <SelectBox + className="w-50 mr-3 ml-4" + selectClass="rounded-lg bg-white" + label="년도" + selectArray={yearOptions} + onSelectValue={(value: string | number) => setSelectedYear(String(value))} + /><SelectBox + className="w-50" + selectClass="rounded-lg bg-white" + label="분기" + selectArray={quater} + onSelectValue={(value: string | number) => setSelectedQuarter(String(value))} + /> + <FileUploadForm + onSubmit={(files, year, quarter, code, id) => { + onSubmit(files, (selectedYear ?? year) || '', (selectedQuarter ?? quarter) || '', code, id); + }} + showButton={true} + showPreview={true} + accept={""} /> + </div> </div> - ) + </div> + </div> + ) } export default operFileUploadForm \ No newline at end of file diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index e5e506796..6835489ca 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -3,204 +3,204 @@ import { Table, TableBody, TableCell, TableRow } from "@common/components"; import { useEffect, useState } from "react"; type UiTableProps = { - headName: React.ReactNode | undefined; - tableName1?: React.ReactNode | undefined; - tableData: { [key: string]: string | number | boolean | object }[]; - headlist: UiHeadProps[]; - pageSize: number; - total: number; - children: Record<string, React.ReactNode> | undefined; - cellClick: ((index: number | undefined, headId: string) => void) | undefined; - onPageChange: (page: number) => void; - className?: string; - resetPageNo?: boolean; - isEditable?: boolean; - tableName2?: React.ReactNode | undefined; - tableData2?: { [key: string]: string | number | boolean | object }[]; - headlist2?: UiHeadProps[]; - pageSize2?: number; - total2?: number; - children2?: Record<string, React.ReactNode> | undefined; - cellClick2?: ((index: number | undefined, headId: string) => void) | undefined; - onPageChange2?: (page: number) => void; - className2?: string; - resetPageNo2?: boolean; - isEditable2?: boolean; - showSecondTable?: boolean; + headName: React.ReactNode | undefined; + tableName1?: React.ReactNode | undefined; + tableData: { [key: string]: string | number | boolean | object }[]; + headlist: UiHeadProps[]; + pageSize: number; + total: number; + children: Record<string, React.ReactNode> | undefined; + cellClick: ((index: number | undefined, headId: string) => void) | undefined; + onPageChange: (page: number) => void; + className?: string; + resetPageNo?: boolean; + isEditable?: boolean; + tableName2?: React.ReactNode | undefined; + tableData2?: { [key: string]: string | number | boolean | object }[]; + headlist2?: UiHeadProps[]; + pageSize2?: number; + total2?: number; + children2?: Record<string, React.ReactNode> | undefined; + cellClick2?: ((index: number | undefined, headId: string) => void) | undefined; + onPageChange2?: (page: number) => void; + className2?: string; + resetPageNo2?: boolean; + isEditable2?: boolean; + showSecondTable?: boolean; }; type UiHeadProps = { - id: string; - title: string; - align?: string; - type?: string; - options?: string[]; + id: string; + title: string; + align?: string; + type?: string; + options?: string[]; }; export function VerticalTable({ - headName, - tableName1, - tableData, - headlist, - pageSize, - total, - children, - cellClick, - onPageChange, - className = "", - resetPageNo = false, - isEditable = false, - tableName2, - tableData2, - headlist2, - pageSize2, - total2, - children2, - cellClick2, - onPageChange2, - className2 = "", - resetPageNo2 = false, - isEditable2 = false, - showSecondTable = false, + headName, + tableName1, + tableData, + headlist, + pageSize, + total, + children, + cellClick, + onPageChange, + className = "", + resetPageNo = false, + isEditable = false, + tableName2, + tableData2, + headlist2, + pageSize2, + total2, + children2, + cellClick2, + onPageChange2, + className2 = "", + resetPageNo2 = false, + isEditable2 = false, + showSecondTable = false, }: UiTableProps) { - const [cur, setCur] = useState<number>(1); - const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({}); - useEffect(() => { - if (resetPageNo) { - setCur(1); - onPageChange(1); - } - }, [onPageChange, resetPageNo]); + const [cur, setCur] = useState<number>(1); + const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({}); + useEffect(() => { + if (resetPageNo) { + setCur(1); + onPageChange(1); + } + }, [onPageChange, resetPageNo]); - useEffect(() => { - if (tableData.length > 0 && tableData[0]) { - setFormData(tableData[0] as { [key: string]: string | number | boolean }); - } - }, [tableData]); + useEffect(() => { + if (tableData.length > 0 && tableData[0]) { + setFormData(tableData[0] as { [key: string]: string | number | boolean }); + } + }, [tableData]); - const handleInputChange = (id: string, value: string | number | boolean) => { - setFormData((prev) => ({ - ...prev, - [id]: value, - })); - }; + const handleInputChange = (id: string, value: string | number | boolean) => { + setFormData((prev) => ({ + ...prev, + [id]: value, + })); + }; - const handlePageChange = (page: number) => { - setCur(page); - onPageChange(page); - }; + const handlePageChange = (page: number) => { + setCur(page); + onPageChange(page); + }; - return ( - <> - {headName ? ( - <div className="card-header"> - <h3 className="text-2xl mx-3 font-medium text-label">{headName}</h3> - </div> - ) : null} - <div className={`card !m-[1.2rem] !p-0r ${className}`}> - {tableName1 && ( // tableName prop이 있으면 표시 - <div className="text-xl font-semibold my-2 mx-3">{tableName1}</div> - )} - <Table variant="secondary"> - <TableBody className="text-center"> - {headlist?.map((head) => ( - <TableRow key={head.id}> - {/* 컬럼 제목 */} - <TableCell className="font-bold bg-blue-100 text-xs"> - {head.title} - </TableCell> - {/* 데이터 값 또는 입력 필드 */} - <TableCell className="text-xs"> - {children && children[head.id] ? children[head.id] : isEditable ? ( - head.type === "select" ? ( - <select - id={head.id} - value={formData[head.id] ?? "-"} - onChange={(e) => handleInputChange(head.id, e.target.value)} - className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" - > - {head.options?.map((option) => ( - <option key={option} value={option}> - {option} - </option> - ))} - </select> - ) : head.type === "input" ? ( - <input - id={head.id} - type="text" - value={formData[head.id] ?? ""} - onChange={(e) => handleInputChange(head.id, e.target.value)} - className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" - /> - ) : ( - <span>{formData[head.id] ?? "-"}</span> - ) - ) : ( - <span>{formData[head.id] ?? "-"}</span> - )} - </TableCell> - </TableRow> + return ( + <> + {headName ? ( + <div className="card-header"> + <h3 className="text-2xl mx-3 font-medium text-label">{headName}</h3> + </div> + ) : null} + <div className={`card !m-[1.2rem] !p-0r ${className}`}> + {tableName1 && ( // tableName prop이 있으면 표시 + <div className="text-xl font-semibold my-2 mx-3">{tableName1}</div> + )} + <Table variant="secondary"> + <TableBody className="text-center"> + {headlist?.map((head) => ( + <TableRow key={head.id}> + {/* 컬럼 제목 */} + <TableCell className="font-bold bg-blue-100 text-xs"> + {head.title} + </TableCell> + {/* 데이터 값 또는 입력 필드 */} + <TableCell className="text-xs"> + {children && children[head.id] ? children[head.id] : isEditable ? ( + head.type === "select" ? ( + <select + id={head.id} + value={formData[head.id] ?? "-"} + onChange={(e) => handleInputChange(head.id, e.target.value)} + className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" + > + {head.options?.map((option) => ( + <option key={option} value={option}> + {option} + </option> ))} - </TableBody> - </Table> - {tableName2 && ( // tableName prop이 있으면 표시 - <div className="text-xl font-semibold mt-8 my-2 mx-3">{tableName2}</div> - )} - {showSecondTable && ( - <Table variant="secondary"> - <TableBody className="text-center"> - {headlist2?.map((head) => ( - <TableRow key={head.id}> - {/* 컬럼 제목 */} - <TableCell className="font-bold bg-blue-100 text-xs w-fit whitespace-nowrap"> - {head.title} - </TableCell> - {/* 데이터 값 또는 입력 필드 */} - <TableCell className="text-xs"> - {children && children[head.id] ? children[head.id] : isEditable2 ? ( - head.type === "select" ? ( - <select - id={head.id} - value={formData[head.id] ?? "-"} - onChange={(e) => handleInputChange(head.id, e.target.value)} - className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" - > - {head.options?.map((option) => ( - <option key={option} value={option}> - {option} - </option> - ))} - </select> - ) : head.type === "input" ? ( - <input - id={head.id} - type="text" - value={formData[head.id] ?? ""} - onChange={(e) => handleInputChange(head.id, e.target.value)} - className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" - /> - ) : ( - <span>{formData[head.id] ?? "-"}</span> - ) - ) : ( - <span>{formData[head.id] ?? "-"}</span> - )} - </TableCell> - </TableRow> - ))} - </TableBody> - </Table> - )} - {total > 0 && ( - <UiPageNations - total={total} - cur={cur} - pageSize={pageSize} - onPageChange={handlePageChange} - /> - )} - </div> - </> - ); + </select> + ) : head.type === "input" ? ( + <input + id={head.id} + type="text" + value={formData[head.id] ?? ""} + onChange={(e) => handleInputChange(head.id, e.target.value)} + className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" + /> + ) : ( + <span>{formData[head.id] ?? "-"}</span> + ) + ) : ( + <span>{formData[head.id] ?? "-"}</span> + )} + </TableCell> + </TableRow> + ))} + </TableBody> + </Table> + {tableName2 && ( // tableName prop이 있으면 표시 + <div className="text-xl font-semibold mt-8 my-2 mx-3">{tableName2}</div> + )} + {showSecondTable && ( + <Table variant="secondary"> + <TableBody className="text-center"> + {headlist2?.map((head) => ( + <TableRow key={head.id}> + {/* 컬럼 제목 */} + <TableCell className="font-bold bg-blue-100 text-xs w-fit whitespace-nowrap"> + {head.title} + </TableCell> + {/* 데이터 값 또는 입력 필드 */} + <TableCell className="text-xs"> + {children && children[head.id] ? children[head.id] : isEditable2 ? ( + head.type === "select" ? ( + <select + id={head.id} + value={formData[head.id] ?? "-"} + onChange={(e) => handleInputChange(head.id, e.target.value)} + className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" + > + {head.options?.map((option) => ( + <option key={option} value={option}> + {option} + </option> + ))} + </select> + ) : head.type === "input" ? ( + <input + id={head.id} + type="text" + value={formData[head.id] ?? ""} + onChange={(e) => handleInputChange(head.id, e.target.value)} + className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" + /> + ) : ( + <span>{formData[head.id] ?? "-"}</span> + ) + ) : ( + <span>{formData[head.id] ?? "-"}</span> + )} + </TableCell> + </TableRow> + ))} + </TableBody> + </Table> + )} + {total > 0 && ( + <UiPageNations + total={total} + cur={cur} + pageSize={pageSize} + onPageChange={handlePageChange} + /> + )} + </div> + </> + ); } \ No newline at end of file From 4b8ec343c9d5a9b5acfc3eddfdffead96b312e16 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 25 Jun 2025 16:12:46 +0900 Subject: [PATCH 028/259] =?UTF-8?q?feat:=20=EB=8F=84=EC=8B=9C=EC=B9=A8?= =?UTF-8?q?=EC=88=98=EC=98=88=EB=B0=A9=EC=82=AC=EC=97=85,=20=EB=85=B8?= =?UTF-8?q?=ED=9B=84=20=ED=95=98=EC=88=98=EA=B4=80=EB=A1=9C=20=EC=A0=95?= =?UTF-8?q?=EB=B9=84=EC=82=AC=EC=97=85=20ContentLayout=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20,LoadingOverlay=20=EC=B6=94=EA=B0=80,=20import=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(with-base-layout)/oper/floodPre/page.tsx | 23 ++++++++++--------- .../(with-base-layout)/oper/oldPp/page.tsx | 21 +++++++++-------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 54438e6fe..11803b7e8 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -1,15 +1,15 @@ 'use client' -import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' -import { Button, DatePicker, Input, Label, LoadingWithAnimation } from '@common/components/ui' -import React, { useEffect, useState } from 'react' -import OperFileUploadForm from '../../../components/ui/operFileUploadForm' -import ListDiv from '@common/business_components/ui/list_div' -import ContentLayout from '@/components/ui/contentLayout' -import { searchCmmnCd, searchData } from '@/components/lib/common/apiHelpers' -import { tableHeadlist } from '..' -import { formatDate, yearOptions, handleDownload } from '@/components/lib/utils' import { deleteData, postData } from '@/components/lib/api' +import { searchCmmnCd, searchData } from '@/components/lib/common/apiHelpers' +import { formatDate, handleDownload, yearOptions } from '@/components/lib/utils' import LoadingOverlay from '@/components/ui/LoadingBar' +import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' +import ListDiv from '@common/business_components/ui/list_div' +import { Button, DatePicker, Input, Label } from '@common/components/ui' +import { useEffect, useState } from 'react' +import { tableHeadlist } from '..' +import OperFileUploadForm from '../../../components/ui/operFileUploadForm' + const Page = () => { // 조회조건 @@ -87,7 +87,8 @@ const Page = () => { if (data) { alert('파일이 등록되었습니다.'); fetchData() } } return ( - <ContentLayout title='도시침수 예방사업' isLoading={isLoading}> + <> + <LoadingOverlay isLoading={isLoading ?? false} /> <SearchDiv> <SearchFormLeft> <div className='flex items-center gap-5'> @@ -154,7 +155,7 @@ const Page = () => { <ListDiv className="mt-4"> <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> </ListDiv> - </ContentLayout> + </> ) } diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index f756ab30f..392ed8af8 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -1,14 +1,16 @@ 'use client' -import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' -import { Button, DatePicker, Input, Label } from '@common/components/ui' -import React, { useEffect, useState } from 'react' -import OperFileUploadForm from '../../../components/ui/operFileUploadForm' -import ListDiv from '@common/business_components/ui/list_div' -import ContentLayout from '@/components/ui/contentLayout' -import { tableHeadlistOldPp } from '..' -import { searchData } from '@/components/lib/common/apiHelpers' -import { formatDate, yearOptions, handleDownload } from '@/components/lib/utils' import { deleteData, postData } from '@/components/lib/api' +import { searchData } from '@/components/lib/common/apiHelpers' +import { formatDate, handleDownload, yearOptions } from '@/components/lib/utils' +import LoadingOverlay from '@/components/ui/LoadingBar' +import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' +import ListDiv from '@common/business_components/ui/list_div' +import { Button, DatePicker, Input, Label } from '@common/components/ui' +import { useEffect, useState } from 'react' +import { tableHeadlistOldPp } from '..' +import OperFileUploadForm from '../../../components/ui/operFileUploadForm' + + const Page = () => { const [fromDate, setFromDate] = useState<Date>(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }); const [toDate, setToDate] = useState<Date>(new Date()); @@ -88,6 +90,7 @@ const Page = () => { } return ( <> + <LoadingOverlay isLoading={isLoading ?? false} /> <SearchDiv> <SearchFormLeft> <div className='flex items-center gap-4'> From a2ac2433f7e819b072444a1907a3e9113285e031 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 25 Jun 2025 18:25:28 +0900 Subject: [PATCH 029/259] =?UTF-8?q?refactor:=20verticalTable.tsx=20?= =?UTF-8?q?=EC=9D=98=20value=EA=B0=92=20String=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/components/ui/verticalTable.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 6835489ca..ae2108591 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -115,7 +115,7 @@ export function VerticalTable({ head.type === "select" ? ( <select id={head.id} - value={formData[head.id] ?? "-"} + value={String(formData[head.id]) ?? "-"} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" > @@ -129,7 +129,7 @@ export function VerticalTable({ <input id={head.id} type="text" - value={formData[head.id] ?? ""} + value={String(formData[head.id]) ?? ""} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" /> @@ -162,7 +162,7 @@ export function VerticalTable({ head.type === "select" ? ( <select id={head.id} - value={formData[head.id] ?? "-"} + value={String(formData[head.id]) ?? "-"} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" > @@ -176,7 +176,7 @@ export function VerticalTable({ <input id={head.id} type="text" - value={formData[head.id] ?? ""} + value={String(formData[head.id]) ?? ""} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" /> From d4c58a19df4f806641e85215350741186874eadb Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 26 Jun 2025 10:47:39 +0900 Subject: [PATCH 030/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98?= =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC,=20RDII=20=EB=B6=84?= =?UTF-8?q?=EC=84=9D=EA=B2=B0=EA=B3=BC=20=ED=8C=8C=EC=9D=BC=20=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20=ED=97=A4=EB=8D=94?= =?UTF-8?q?=EB=AA=85=20=EC=98=81=EC=96=B4=20->=20=ED=95=9C=EA=B8=80=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ii/rdii_result/page.tsx | 19 ++++++++++++++----- .../app/(with-base-layout)/ii/result/page.tsx | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx index 95397a13c..4bbfd0619 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx @@ -1,6 +1,6 @@ 'use client' import { deleteData, getData } from '@/components/lib/api' -import { UiTable, downloadExcel } from '@common/business_components/ui' +import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' import { zodResolver } from '@hookform/resolvers/zod' import { useState } from 'react' import { useForm } from 'react-hook-form' @@ -138,14 +138,23 @@ const Result = () => { // 선택된 행 데이터를 Excel 다운로드 형식으로 변환 const excelData = data.content; // 배열로 감싸서 전달 - // 파일명 생성 (분석번호 기반) - const fileName = `RDII분석결과_${selectedRowData.rainInfwtAnlsSn}_${selectedRowData.aplcnYm}`; + // 헤더 매핑 정의 + const headerMapping: { [key: string]: string } = { + 'rainInfwtAnlsSn': 'RDII분석\n일련번호', + 'pplMngNo': '관로\n관리번호', + 'anlsTm': '분석시각', + 'predcOilq': '예측유량' + }; - downloadExcel({ + // 파일명 생성 (분석번호 기반) + const fileName = `RDII분석결과_${selectedRowData.swageTmplntNm}_${selectedRowData.aplcnYm}_${selectedRowData.rainInfwtAnlsSn}`; + + await downloadExcelWithKoreanHeaders({ data: excelData as JSON[], fileName: fileName, sheetNameArray: ["RDII 분석결과"], - headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정 + headerRange: "A1:D1", + headerMapping: headerMapping }); setIsLoadingResult(false); } catch (error) { diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index ecdce6566..ee2bbe905 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -1,6 +1,6 @@ 'use client' import { deleteData, getData } from '@/components/lib/api' -import { UiTable, downloadExcel } from '@common/business_components/ui' +import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' import { zodResolver } from '@hookform/resolvers/zod' import { useState } from 'react' import { useForm } from 'react-hook-form' @@ -137,14 +137,23 @@ const Result = () => { // 선택된 행 데이터를 Excel 다운로드 형식으로 변환 const excelData = data.content; // 배열로 감싸서 전달 - // 파일명 생성 (분석번호 기반) - const fileName = `침입수분석결과_${selectedRowData.inftwtAnlsSn}_${selectedRowData.aplcnYm}`; + // 헤더 매핑 정의 + const headerMapping: { [key: string]: string } = { + 'inftwtAnlsSn': '침입수분석\n일련번호', + 'pplMngNo': '관로\n관리번호', + 'anlsTm': '분석시각', + 'predcOilq': '예측유량' + }; - downloadExcel({ + // 파일명 생성 (분석번호 기반) + const fileName = `침입수분석결과_${selectedRowData.swageTmplntNm}_${selectedRowData.aplcnYm}_${selectedRowData.inftwtAnlsSn}`; + + await downloadExcelWithKoreanHeaders({ data: excelData as JSON[], fileName: fileName, sheetNameArray: ["침입수 분석결과"], - headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정 + headerRange: "A1:D1", + headerMapping: headerMapping }); setIsLoadingResult(false); } catch (error) { From cbb915a3e51ec4c9be042cabad2a40b02d2133f7 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 26 Jun 2025 11:27:17 +0900 Subject: [PATCH 031/259] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80?= =?UTF-8?q?=ED=98=84=ED=99=A9=20=EB=B9=97=EB=AC=BC=20init=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80,=20=EC=A4=91=EC=88=98=EB=8F=84=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wr/app/matMng/coMng/ldrmntCoSttn/page.tsx | 8 +- .../prfmncSttn/chkgdnSttn/page.tsx | 71 +++++++------- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 9 +- .../chkgdnSttn/rswtChkgdnSttn/index.tsx | 92 +++++++++++-------- 4 files changed, 101 insertions(+), 79 deletions(-) diff --git a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx index f5dffbf8b..c5daee29c 100644 --- a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx @@ -99,8 +99,8 @@ export default function LdrmntCoSttn() { const tbData = Array.isArray(data) ? data.map((item: customLdrmnt) => ({ ...item, - ctpvCd: item.fctryAddr.split(" ")[0] || "", - sggCd: item.fctryAddr.split(" ")[1] || "" + ctpvCd: item.fctryAddr?.split(" ")[0] || "", + sggCd: item.fctryAddr?.split(" ")[1] || "" })) : []; @@ -114,8 +114,8 @@ export default function LdrmntCoSttn() { const data = Array.isArray(exData) ? exData.map((item: customLdrmnt) => { return { - "시도": item.fctryAddr.split(" ")[0] || "", - "시군구": item.fctryAddr.split(" ")[1] || "", + "시도": item.fctryAddr?.split(" ")[0] || "", + "시군구": item.fctryAddr?.split(" ")[1] || "", "회사명": item.dmdCoNm, "공장주소": item.fctryAddr, "공장관리번호": item.fctryMngNo, diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index f9a799c24..f415bf187 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -33,10 +33,9 @@ export default function Page() { code, rainChkSttn, rswtChkSttn, - - rainChkSttnInit, rainChkSttnSearch, + rswtChkSttnSearch, rswtChkSttnInit, isRainSttn, isRswtSttn @@ -51,25 +50,31 @@ export default function Page() { }); const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear())); const cellClick = () => { - if (searchYear) rainChkSttnSearch(searchYear, "0"); + if (searchYear) { + if(selFcltDiv === "RNB"){ + rainChkSttnSearch(searchYear, "0"); + }else{ + rswtChkSttnSearch(searchYear, "0"); + } + } }; useEffect(() => { if (!rainChkSttn.isInit) { isRainSttn(true) - rainChkSttnInit( "0"); + rainChkSttnInit(new Date().getFullYear().toString(), "0"); setIsModal({ data: {}, open: false }); } }, [rainChkSttn.isInit, rainChkSttnInit]); - useEffect(() => { + useEffect(() => { if (!rswtChkSttn.isInit) { setIsModal({ data: {}, open: false }); - rswtChkSttnInit( "0"); + rswtChkSttnInit(new Date().getFullYear().toString(), "0"); isRswtSttn(true) } - },[rswtChkSttn.isInit, rswtChkSttnInit]) + }, [rswtChkSttn.isInit, rswtChkSttnInit]) const handleClick = useCallback( @@ -78,25 +83,25 @@ export default function Page() { }, [isModal] ); -const excelDown=() =>{ - if(rainChkSttn.sttnExcelList && selFcltDiv === "RNB"){ - excelDownload( - rainChkSttn.sttnExcelList, - "빗물이용시설 지도점검 현황", - "sample_rainChkSttn.xlsx", - "A1:Q2", - 3 - ); - }else if(rswtChkSttn.sttnExcelList && selFcltDiv === "RST"){ - excelDownload( - rswtChkSttn.sttnExcelList, - "중수도시설 지도점검 현황", - "sample_rswtChkSttn.xlsx", - "A1:X2", - 3 - ); + const excelDown = () => { + if (rainChkSttn.sttnExcelList && selFcltDiv === "RNB") { + excelDownload( + rainChkSttn.sttnExcelList, + "빗물이용시설 지도점검 현황", + "sample_rainChkSttn.xlsx", + "A1:Q2", + 3 + ); + } else if (rswtChkSttn.sttnExcelList && selFcltDiv === "RST") { + excelDownload( + rswtChkSttn.sttnExcelList, + "중수도시설 지도점검 현황", + "sample_rswtChkSttn.xlsx", + "A1:X2", + 3 + ); + } } -} return ( <ContentsDiv> @@ -126,9 +131,9 @@ const excelDown=() =>{ selectClass={""} selectArray={rainChkSttn.fcltDiv} onSelectValue={(val: string | number) => - setSelFcltDiv(String(val)) - } - value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val} + setSelFcltDiv(String(val)) + } + value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val} /> </div> </SearchFormLeft> @@ -143,7 +148,7 @@ const excelDown=() =>{ > 조회 </Button> - <Button color="green" size={"sm"} onClick={(e) =>{excelDown()}}> + <Button color="green" size={"sm"} onClick={(e) => { excelDown() }}> 다운로드 </Button> </div> @@ -157,15 +162,15 @@ const excelDown=() =>{ <ListDiv> {selFcltDiv === "RNB" ? ( <RainChkgdTable - deleteData={() => {}} - detailUp={() => {}} + deleteData={() => { }} + detailUp={() => { }} handleClick={handleClick} rainChkData={rainChkSttn.rainChkRes} /> ) : ( <RswtChkgdTable - detaiRswtlUpdate={() => {}} - deleteRswtData={() => {}} + detaiRswtlUpdate={() => { }} + deleteRswtData={() => { }} handleRswtClick={handleClick} rswtChkData={rswtChkSttn.rswtChkRes} /> diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index 9fd948856..ea3f58a40 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -35,7 +35,7 @@ export type rainChkSttnState = { }; type rainChkSttnActions = { - rainChkSttnInit: ( sggCd: string) => void; + rainChkSttnInit: (searchTxt: string, sggCd: string) => void; rainChkSttnSearch: (searchTxt: string, sggCd: string) => void; isRainSttn:(isSttn:boolean) => void; getRainSttnExcel:(excelList:rainChkZodType[]) => void; @@ -58,9 +58,10 @@ export const rainChkSttnStateExport: rainChkSttnState = { }; const initFetch = async (txt: string | undefined, sgg: string | undefined) => { + const currentYear = new Date().getFullYear().toString(); const rainRes = await getFetch( "wr", - `/reuseChk/rainy/` + (txt ? `${txt}` : "2024") + (sgg ? `/${sgg}` : "/0") + `/reuseChk/rainy/` + (txt ? `${txt}` : currentYear) + (sgg ? `/${sgg}` : "/0") ); return rainRes; }; @@ -68,9 +69,9 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( set: any ) => { return { - rainChkSttnInit: async ( sggCd: string) => { + rainChkSttnInit: async (searchTxt: string, sggCd: string) => { try { - const rainChkRes = await initFetch(undefined, sggCd); + const rainChkRes = await initFetch(searchTxt, sggCd); return set((state: rainChkSttnState) => ({ ...state, diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx index b985cd944..cd95ef1fc 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx @@ -24,10 +24,10 @@ export type rswtChkSttnState = { }; type rswtChkSttnActions = { - rswtChkSttnInit: ( sggCd: string) => void; - isRswtSttn: (isSttn:boolean) => void; - getRswtSttnExcel:(excelList:rswtChkZodType[]) => void; - + rswtChkSttnInit: (searchTxt: string, sggCd: string) => void; + isRswtSttn: (isSttn: boolean) => void; + getRswtSttnExcel: (excelList: rswtChkZodType[]) => void; + rswtChkSttnSearch: (searchTxt: string, sggCd: string) => void; }; export type rswtChkSttnType = rswtChkSttnState & rswtChkSttnActions; @@ -40,16 +40,17 @@ export const rswtChkStateExport: rswtChkSttnState = { sttnExcelList: [], rswtChkRes: [], isInit: false, - isSttn:false, + isSttn: false, }, }; const initFetch = async (year: string | undefined, sgg: string | undefined) => { + const currentYear = new Date().getFullYear().toString(); const rswtChkRes = await getFetch( "wr", `/reuseChk/reuseWater/` + - (year ? `${year}` : "2024") + - (sgg ? `/${sgg}` : "/0") + (year ? `${year}` : currentYear) + + (sgg ? `/${sgg}` : "/0") ); return rswtChkRes; }; @@ -59,9 +60,9 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( set: any ) => { return { - rswtChkSttnInit: async ( sggCd: string) => { + rswtChkSttnInit: async (searchTxt: string, sggCd: string) => { try { - const rswtChkRes = await initFetch("2024", sggCd); + const rswtChkRes = await initFetch(searchTxt, sggCd); return set((state: rswtChkSttnState) => ({ ...state, rswtChkSttn: { @@ -73,35 +74,50 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( } catch (error) { console.log(error); } - },isRswtSttn :(isSttn:boolean) =>{ - try { - return set((state: rswtChkSttnState) => ({ - ...state, - rswtChkSttn: { - ...state.rswtChkSttn, - isSttn:isSttn - }, - })); - } catch (error) { - console.log(error); - } - },getRswtSttnExcel: async (excelList:rswtChkZodType []) => { - try { - - const excelData = buildingExcelRswtSttn(excelList) - - return set((state: rswtChkSttnState) => ({ - ...state, - rswtChkSttn: { - ...state.rswtChkSttn, - sttnExcelList:excelData - }, - })); - } catch (error) { - console.log(error); - } - } + }, + isRswtSttn: (isSttn: boolean) => { + try { + return set((state: rswtChkSttnState) => ({ + ...state, + rswtChkSttn: { + ...state.rswtChkSttn, + isSttn: isSttn + }, + })); + } catch (error) { + console.log(error); + } + }, + getRswtSttnExcel: async (excelList: rswtChkZodType[]) => { + try { - + const excelData = buildingExcelRswtSttn(excelList) + + return set((state: rswtChkSttnState) => ({ + ...state, + rswtChkSttn: { + ...state.rswtChkSttn, + sttnExcelList: excelData + }, + })); + } catch (error) { + console.log(error); + } + }, + rswtChkSttnSearch: async (searchTxt: string, sggCd: string) => { + try { + const rswtChkRes = await initFetch(searchTxt, sggCd); + + return set((state: rswtChkSttnState) => ({ + ...state, + rswtChkSttn: { + ...state.rswtChkSttn, + rswtChkRes: rswtChkRes + }, + })); + } catch (error) { + console.log(error); + } + }, }; }; From faed554108c0e77d3aa02d132d18e271d26bb234 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 26 Jun 2025 11:35:05 +0900 Subject: [PATCH 032/259] =?UTF-8?q?fix:=20inflChart.tsx=20button=20?= =?UTF-8?q?=EC=A4=91=EC=B2=A9=20=EC=97=90=EB=9F=AC=20=EB=B0=8F=20aria-desc?= =?UTF-8?q?ribtion=20=EB=88=84=EB=9D=BD=20warning=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(map-layout)/map/components/common/index.ts | 4 +++- apps/sn/app/components/ui/modal.tsx | 17 ++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index e5273180b..a17d2a0a8 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -21,6 +21,8 @@ type LayerContentMap = { const layerContentMap: LayerContentMap = { // TODO: gis데이터 추가되면 추가 작업 필요 "하수처리시설": { component: SwtrmtFclt, }, + // 하수관로 개발용 + // "하수처리시설": { component: MsSwagePpl, }, "하수처리구역": {}, "우수토실": { component: Ssc, }, "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 @@ -59,4 +61,4 @@ export const handleInputChange = (section: string, updated[index][field as keyof typeof updated[number]] = value; } target.setData(updated); -}; \ No newline at end of file +}; \ No newline at end of file diff --git a/apps/sn/app/components/ui/modal.tsx b/apps/sn/app/components/ui/modal.tsx index b5421ecf3..afc2b5c9a 100644 --- a/apps/sn/app/components/ui/modal.tsx +++ b/apps/sn/app/components/ui/modal.tsx @@ -1,4 +1,4 @@ -import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogClose, DialogOverlay } from '@common/components/ui' +import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogOverlay } from '@common/components/ui' import React from 'react' interface ModalProps { @@ -7,25 +7,24 @@ interface ModalProps { title?: string; children: React.ReactNode; closeModal: () => void; - saveModal?: () => void + saveModal?: () => void; + description?: string; } const Modal: React.FC<ModalProps> = ({ isModalOpen, setIsModalOpen, title, children, closeModal, saveModal }) => { return ( <Dialog open={isModalOpen} onOpenChange={setIsModalOpen}> <DialogOverlay className='z-[200]' /> - <DialogContent className="w-auto max-w-[1200px] min-w-[400px] min-h-[150px] h-auto max-h-[450px] overflow-auto z-[1000]"> + <DialogContent className="w-auto max-w-[1200px] min-w-[400px] min-h-[150px] h-auto max-h-[450px] overflow-auto z-[1000]" aria-describedby={undefined}> {title ? <DialogHeader> <DialogTitle>{title}</DialogTitle> </DialogHeader> : null} {children} <DialogFooter> - <DialogClose> - <div className='flex justify-end gap-2'> - {saveModal ? <button className="px-4 py-2 bg-primary text-white rounded" onClick={saveModal}>저장</button> : null} - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closeModal}>닫기</button> - </div> - </DialogClose> + <div className='flex justify-end gap-2'> + {saveModal ? <button className="px-4 py-2 bg-primary text-white rounded" onClick={saveModal}>저장</button> : null} + <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closeModal}>닫기</button> + </div> </DialogFooter> </DialogContent> </Dialog> From b6fa68453ae8d0fc421385580cbbe0c91a0c097d Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 26 Jun 2025 11:44:08 +0900 Subject: [PATCH 033/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98?= =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC,=20RDII=20=EB=B6=84?= =?UTF-8?q?=EC=84=9D=EA=B2=B0=EA=B3=BC=20=EC=97=91=EC=85=80=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=BB=AC=EB=9F=BC=EB=AA=85=EC=97=90=20=EB=8B=A8?= =?UTF-8?q?=EC=9C=84=20=EC=B6=94=EA=B0=80=20(m=C2=B3/h)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx | 2 +- apps/sn/app/(with-base-layout)/ii/result/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx index 4bbfd0619..2fa22a8b2 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx @@ -143,7 +143,7 @@ const Result = () => { 'rainInfwtAnlsSn': 'RDII분석\n일련번호', 'pplMngNo': '관로\n관리번호', 'anlsTm': '분석시각', - 'predcOilq': '예측유량' + 'predcOilq': '예측유량\n(m³/h)' }; // 파일명 생성 (분석번호 기반) diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index ee2bbe905..67569cd9b 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -142,7 +142,7 @@ const Result = () => { 'inftwtAnlsSn': '침입수분석\n일련번호', 'pplMngNo': '관로\n관리번호', 'anlsTm': '분석시각', - 'predcOilq': '예측유량' + 'predcOilq': '예측유량\n(m³/h)' }; // 파일명 생성 (분석번호 기반) From cd6568f4dfb2e0b86d5047cebd1e8c3878c57496 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Thu, 26 Jun 2025 16:08:00 +0900 Subject: [PATCH 034/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=8B=9C=EC=84=A4=20=EB=B0=B8=EB=A5=98=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B2=B4=ED=81=AC=20=EC=9E=91=EC=97=85?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 59 +++++++++++++++++-- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 1 - .../prfmncSttn/chkgdnSttn/page.tsx | 1 - .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 25 ++++---- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 4 +- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 6 +- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 10 ++-- 7 files changed, 75 insertions(+), 31 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 441eabf25..acc72ea0f 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -29,9 +29,9 @@ import { import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm"; import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm"; import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal"; -import toast, { Toaster } from "react-hot-toast"; +import toast, { Toaster } from "react-hot-toast"; // toast 이미 import 되어 있음 import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg"; -import { useFieldArray, useForm } from "react-hook-form"; +import { useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // FieldErrors 타입 추가 import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; @@ -105,6 +105,53 @@ export default function PublicReuseFaciltyInsert() { await pbnstRuseBizUpdate(bizs); }; + // 폼 유효성 검사 실패 시 호출될 함수 + const onInvalid = (errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[]; }>) => { + // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. + const findAllErrors = ( + errorObject: any, + path: (string | number)[] = [] + ): { message: string; path: (string | number)[] }[] => { + if (!errorObject) return []; + + return Object.keys(errorObject).flatMap((key) => { + const value = errorObject[key]; + const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; + const newPath = [...path, currentKey]; + + if (value && typeof value === "object") { + if (typeof value.message === "string") { + return [{ message: value.message, path: newPath }]; + } + return findAllErrors(value, newPath); + } + return []; + }); + }; + + const errorList = findAllErrors(errors); + + if (errorList.length > 0) { + errorList.forEach((errorInfo) => { + const { message, path } = errorInfo; + let finalMessage = message; + + const itemsIndex = path.indexOf("items"); + const fcBizsIndex = path.indexOf("fcBizs"); + + if (itemsIndex > -1 && fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + const itemIdx = path[itemsIndex + 1] as number; + const bizIdx = path[fcBizsIndex + 1] as number; + const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); + if (cycle) { + finalMessage = `[${cycle}차수] ${message}`; + } + } + toast.error(finalMessage); + }); + } + }; + useEffect(() => { if (code.sggCd.length) { if (searchFclts) { @@ -250,7 +297,7 @@ useEffect(() =>{ <div className="grid grid-cols-6 gap-4 h-full"> <div className="col-span-4 h-full min-h-0"> <ListDiv className="min-h-0"> - <ScrollArea className="h-[60vh]"> + <ScrollArea className="h-[60vh]"> {/* 높이 조정 */} <UiTable tableData={bdstTable || []} headlist={pubFacHeadList} @@ -276,8 +323,8 @@ useEffect(() =>{ </TabsTrigger> <Button size={"sm"} - onClick={form.handleSubmit(onSubmit)} - className="!justify-end" + onClick={form.handleSubmit(onSubmit,onInvalid)} + className="!justify-end" // 저장 버튼 위치 조정 > 저장 </Button> @@ -310,7 +357,7 @@ useEffect(() =>{ <UiModal body={ <PbnstRegModal - form={form} + form={form} // form prop 전달 data={isRuseReg.data || ({} as customPbnst)} ></PbnstRegModal> } diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 31743aaa9..221524918 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -80,7 +80,6 @@ export default function Home() { }; useEffect(() => { - console.log("getPageNation", pageNation); getRainData(pageNation, "41"); }, [pageNation]); diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index f415bf187..a5480a8b2 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -17,7 +17,6 @@ import { SearchDiv, SearchFormLeft, SearchFormRight, - SearchInput, SelectBox, Title, UiModal, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index a34985810..9c390d076 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -148,7 +148,7 @@ export const fcBizSchema = z.object({ pbnstRuseFcltFk: z.string().nullish(), superkey: z.string().default("").nullish(), cycl: zNum.default(1), - seCd: z.string().default(""), + seCd: z.string().max(10, "구분은 10자를 초과할 수 없습니다.").default(""), bizMthdCd: z.string().default(""), instlAprvSncnDt: zDateDefaultNow, bizCmcnDay: zDateDefaultNow, @@ -171,17 +171,17 @@ export const fcBizSchema = z.object({ wwtEmsnFcltPrmsnYn: z.string().default("Y"), tmsInstlYn: z.string().default("Y"), pbnstDrngInflwExclYn: z.string().default("Y"), - bod: zNumDefaultZero, - grssClfg: zNumDefaultZero, - combResdch: zNumDefaultZero, - trbt: zNumDefaultZero, - clIonQnt: zNumDefaultZero, - smll: zNumDefaultZero, - crmty: zNumDefaultZero, - tph: zNumDefaultZero, - tn: zNumDefaultZero, - ph: zNumDefaultZero, - cdtnv: zNumDefaultZero, + bod: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "BOD 값은 5자리 미만이어야 합니다.")).nullish(), + grssClfg: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총대장균군 값은 5자리 미만이어야 합니다.")).nullish(), + combResdch: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "결합잔류염소 값은 5자리 미만이어야 합니다.")).nullish(), + trbt: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "탁도 값은 5자리 미만이어야 합니다.")).nullish(), + clIonQnt: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "염소이온량 값은 5자리 미만이어야 합니다.")).nullish(), + smll: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "냄새 값은 5자리 미만이어야 합니다.")).nullish(), + crmty: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "색도 값은 5자리 미만이어야 합니다.")).nullish(), + tph: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총인 값은 5자리 미만이어야 합니다.")).nullish(), + tn: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총질소 값은 5자리 미만이어야 합니다.")).nullish(), + ph: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "수소이온농도 값은 5자리 미만이어야 합니다.")).nullish(), + cdtnv: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "전기전도도 값은 5자리 미만이어야 합니다.")).nullish(), designCst: zNumNullish, cstrnSpvsCst: zNumNullish, fcltSbsdCst: zNumNullish, @@ -241,4 +241,3 @@ export type fcOrgwtType = z.infer<typeof fcOrgwtSchema>; export type ppInstlType = z.infer<typeof pplInstlSchema>; export type operType = z.infer<typeof fcOperSchema>; export type fcFileType = z.infer<typeof fcFileSchema>; - diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 5b3ad6813..4681f7250 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -16,7 +16,7 @@ const rainyObjSchema = z.object({ pntfColKnd: z.string().default(""), pntfColArea: z.number().default(0), dtfcltCpct: z.number().default(0), - filtrTrtmfctYn: z.string().default("Y").nullish(), + filtrTrtmfctYn: z.string().default("Y"), filtrTrtmfctCpct: z.number().nullish().default(0), filtrTrtmfctPrs: z.string().default(""), annRnwtQty: z.number().default(0), @@ -59,7 +59,7 @@ const reuseBuildingSchema = z.object({ }).refine((data) => data.bdstUsgCd > 0, { message: validationMessages.requiredSelect("건축물용도"), path: ["bdstUsgCd"], -}); +}) ; const chgBuildingSchema = z.object({ bdstInfoFk: z.number().nullish(), diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index df63b3520..a729b2533 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -55,8 +55,6 @@ export function PbnstBuseForm({ code, pbnst, demandCompList, - getpbnstInsertIndex, - appendRuseFclt, getDemandCompList, regDemandCompany, } = useWrStore((state) => state); @@ -65,7 +63,6 @@ export function PbnstBuseForm({ control: form.control, name: `items.${indexMng}.fcBizs`, }); - const [bizCycle, setBizCycle] = useState("1"); const [ppiSelectList, setPpiSelectList] = useState<[{ name: string; val: SelectDataType[] }]>(); @@ -499,7 +496,7 @@ export function PbnstBuseForm({ ) || [] ).map((field, index) => ( <div - key={`fcDemands-${indexMng}-${indexBiz}`} // 이게 핵심! + key={`fcDemands-${indexMng}-${indexBiz}=${index}`} // 이게 핵심! className="grid grid-cols-12 gap-4 mt-3" > <div key={index + "keySon1"} className="col-span-4"> @@ -664,6 +661,7 @@ export function PbnstBuseForm({ )} /> </div> + <br></br> </div> ))} </div> diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 9ec4fc5c0..40a9bb436 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -60,10 +60,12 @@ export default function RainRegForm({ typeof item?.grntchBdstCertYr === "string" ? item?.grntchBdstCertYr : "", // null → "" + instlCstSprtYn: + item?.instlCstSprtYn ?? "Y", // null → "N" // Ensure enum fields are null if empty string to trigger Zod default rainyObj: { ...item?.rainyObj, - filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn === "" ? null : item?.rainyObj?.filtrTrtmfctYn, + filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ??"Y" }, })), }; @@ -266,7 +268,7 @@ export default function RainRegForm({ if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} - readOnly={filtrTrtmfctYn !== "Y"} + readOnly={filtrTrtmfctYn === "Y"} /> </FormUi> )} @@ -284,7 +286,7 @@ export default function RainRegForm({ type="text" value={field.value ?? ""} onChange={field.onChange} - readOnly={filtrTrtmfctYn !== "Y"} + readOnly={filtrTrtmfctYn === "Y" } /> </FormUi> )} @@ -333,7 +335,7 @@ export default function RainRegForm({ if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} - readOnly={instlCstSprtYn !== "Y"} + readOnly={instlCstSprtYn === "Y"} /> </FormUi> )} From a83cb2709cdf42ccbc9831b6bb8649184fa3b9f0 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Thu, 26 Jun 2025 16:18:52 +0900 Subject: [PATCH 035/259] =?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EB=B0=B8=EB=A5=98?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=EC=85=98=EC=9D=98=20=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=8B=9C=EC=84=A4=EB=AA=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 31 ++++++++++--------- .../store/prfmncReg/pbnstPrfmncReg/index.tsx | 1 - 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index acc72ea0f..6b45dacc9 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -111,43 +111,46 @@ export default function PublicReuseFaciltyInsert() { const findAllErrors = ( errorObject: any, path: (string | number)[] = [] - ): { message: string; path: (string | number)[] }[] => { + ): { message: string; path: (string | number)[]; }[] => { if (!errorObject) return []; return Object.keys(errorObject).flatMap((key) => { const value = errorObject[key]; const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; const newPath = [...path, currentKey]; - if (value && typeof value === "object") { if (typeof value.message === "string") { - return [{ message: value.message, path: newPath }]; + return [{ message: value.message, path: newPath }]; // 에러 메시지와 경로 반환 } return findAllErrors(value, newPath); } return []; }); }; - const errorList = findAllErrors(errors); - if (errorList.length > 0) { errorList.forEach((errorInfo) => { const { message, path } = errorInfo; - let finalMessage = message; - + let prefix = ""; const itemsIndex = path.indexOf("items"); - const fcBizsIndex = path.indexOf("fcBizs"); - if (itemsIndex > -1 && fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + if (itemsIndex > -1 && path.length > itemsIndex + 1) { const itemIdx = path[itemsIndex + 1] as number; - const bizIdx = path[fcBizsIndex + 1] as number; - const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); - if (cycle) { - finalMessage = `[${cycle}차수] ${message}`; + const facilityName = form.getValues(`items.${itemIdx}.ruseUtztnFcltNm`); + if (facilityName) { + prefix += `[${facilityName}] `; + } + + const fcBizsIndex = path.indexOf("fcBizs"); + if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + const bizIdx = path[fcBizsIndex + 1] as number; + const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); + if (cycle) { + prefix += `[${cycle}차수] `; + } } } - toast.error(finalMessage); + toast.error(`${prefix}${message}`); }); } }; diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index 87e827f60..82f2ed59c 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -77,7 +77,6 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( prfmncHasuInit: async (page: string, sggOrCity: string) => { try { const prfmncRes = await hasuListFetch(page, sggOrCity); - console.log("prfmncRes", prfmncRes); return set((state: pbnstPrfmncState) => ({ ...state, prfmnc: { From fd2dab7a7784fa960880191b0c9ef020f320ffa2 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 26 Jun 2025 16:32:02 +0900 Subject: [PATCH 036/259] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=ED=98=84=ED=99=A9=20=EB=AA=A8=EB=8B=AC=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20=ED=8F=89=EA=B7=A0=EA=B0=92=20=EC=86=8C?= =?UTF-8?q?=EC=88=98=EC=A0=90=20=EC=9E=90=EB=A6=AC=EC=88=98=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95,=20=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EC=8B=9C=20=EB=88=84=EB=9D=BD=EB=90=9C=20=EA=B0=92?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80,=20=ED=85=8C=EC=9D=B4=EB=B8=94=20merge=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 18 +++++---- .../prfmncSttn/chkgdnSttn/page.tsx | 21 +++++----- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 39 +++++++++++-------- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 22 +++++++---- .../chkgdnSttn/rswtChkgdnSttn/excel.tsx | 1 + .../chkgdnSttn/rswtChkgdnSttn/headList.tsx | 18 ++++----- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 20 +++++----- 7 files changed, 77 insertions(+), 62 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 18dbc7943..fd8e2a6d6 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -68,7 +68,12 @@ export default function Page() { data: {}, }); const cellClick = () => { - if (searchYear) rainChkInit(searchYear, "0"); + if (searchYear) + if (selFcltDiv === "RNB") { + rainChkInit(searchYear, "0"); + } else { + rswtChkgdnInit(searchYear, "0"); + } }; const [searchYear, setSearchYear] = useState<string>( @@ -91,8 +96,7 @@ export default function Page() { }, [rainChkgdn.isInit, rainChkInit]); useEffect(() => { - if (rswtChkgdn.excelList[0]&&rswtChkgdn.excelList[0]?.data.length > 1) { - + if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) { excelArrayDownload( "중수도시설 지도점검", "sample_rs_chk.xlsx", @@ -189,10 +193,10 @@ export default function Page() { label={""} selectClass={""} selectArray={rainChkgdn.fcltDiv} - onSelectValue={(val: string | number) =>{ - if(val === "RST") rswtChkPolInit(); - setSelFcltDiv(String(val)) - } + onSelectValue={(val: string | number) => { + if (val === "RST") rswtChkPolInit(); + setSelFcltDiv(String(val)) + } } value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val} /> diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index f415bf187..8960f468d 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -1,14 +1,10 @@ "use client"; import { useWrStore } from "@/app/store"; -import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { - excelArrayDownload, excelDownload, - yearOptions, + yearOptions } from "@/components/lib/func/commom"; -import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel"; import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal"; import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable"; import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable"; @@ -17,17 +13,15 @@ import { SearchDiv, SearchFormLeft, SearchFormRight, - SearchInput, SelectBox, Title, - UiModal, + UiModal } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; -//----------------------- export default function Page() { const { code, @@ -38,7 +32,8 @@ export default function Page() { rswtChkSttnSearch, rswtChkSttnInit, isRainSttn, - isRswtSttn + isRswtSttn, + rswtChkPolInit, } = useWrStore((state) => { return state; }); @@ -51,9 +46,9 @@ export default function Page() { const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear())); const cellClick = () => { if (searchYear) { - if(selFcltDiv === "RNB"){ + if (selFcltDiv === "RNB") { rainChkSttnSearch(searchYear, "0"); - }else{ + } else { rswtChkSttnSearch(searchYear, "0"); } } @@ -130,9 +125,11 @@ export default function Page() { label={""} selectClass={""} selectArray={rainChkSttn.fcltDiv} - onSelectValue={(val: string | number) => + onSelectValue={(val: string | number) => { + if (val === "RST") rswtChkPolInit(); setSelFcltDiv(String(val)) } + } value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val} /> </div> diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index ff612a0fb..3bd10169f 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -61,7 +61,7 @@ type rainChkgdnActions = { ): Promise<void>; rainChkExcelDataUPload(excelData: rainChkZodType[]): Promise<void>; rainChkDelete(chkgdnPks: number[]): Promise<void>; - rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit :boolean) => void; + rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void; }; export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; @@ -99,9 +99,10 @@ const makeMdfrChk = (data: rainChkZodType[], type: string, toDo: string) => { }; const initFetch = async (txt: string | undefined, sgg: string | undefined) => { + const currentYear = new Date().getFullYear().toString(); const rainRes = await getFetch( "wr", - `/reuseChk/rainy` + (txt ? `/${txt}` : "2024") + (sgg ? `/${sgg}` : "/0") + `/reuseChk/rainy` + (txt ? `/${txt}` : currentYear) + (sgg ? `/${sgg}` : "/0") ); return rainRes; }; @@ -130,13 +131,16 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => { try { const res = await postFectch("/reuseChk/rainy", excelData); + console.log("res", res); + console.log("res.ok", res.ok) if (res.ok) { ToastFormUi({ body: "지도점검 등록이 완료되었습니다. ", title: "지도점검 등록", }); } - const rainChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch(currentYear, "0"); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { @@ -178,7 +182,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( title: "지도점검 수정", }); } - const rainChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch(currentYear, "0"); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { @@ -201,7 +206,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( title: "지도점검 수정", }); } - const rainChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch(currentYear, "0"); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { @@ -223,7 +229,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( title: "지도점검 삭제", }); } - const rainChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch(currentYear, "0"); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { @@ -235,23 +242,23 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( ToastFormUi({ body: "삭제를 실패했습니다.. ", title: "지도점검 삭제" }); } }, - rainChkHeadChange: async (rainChkgdn: rainChkgdnState , isEdit :boolean) => { + rainChkHeadChange: async (rainChkgdn: rainChkgdnState, isEdit: boolean) => { try { const rainChkgdnHeadList = rainChkgdn.rainChkgdn.rainChkgdnHeadList; const splHeadList = rainChkgdn.rainChkgdn.splHeadList; const ruseHeadList = rainChkgdn.rainChkgdn.ruseHeadList; - rainChkgdnHeadList.forEach(( head) => { - if(head.edit!== undefined) - head.edit=isEdit; + rainChkgdnHeadList.forEach((head) => { + if (head.edit !== undefined) + head.edit = isEdit; }); splHeadList.forEach((head) => { - if(head.edit!== undefined) - head.edit=isEdit; + if (head.edit !== undefined) + head.edit = isEdit; }); ruseHeadList.forEach((head) => { - if(head.edit!== undefined) - head.edit=isEdit; + if (head.edit !== undefined) + head.edit = isEdit; }); return set((state: rainChkgdnState) => ({ @@ -259,8 +266,8 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( rainChkgdn: { ...state.rainChkgdn, rainChkgdnHeadList: rainChkgdnHeadList, - splHeadList:splHeadList, - ruseHeadList:ruseHeadList + splHeadList: splHeadList, + ruseHeadList: ruseHeadList }, })); } catch (error) { diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index eb0010047..1cc7bd766 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -80,10 +80,11 @@ export const rswtChkgdnStateExport: rswtChkgdnState = { }; const initFetch = async (year: string | undefined, sgg: string | undefined) => { + const currentYear = new Date().getFullYear().toString(); const rswtChkRes = await getFetch( "wr", `/reuseChk/reuseWater/` + - (year ? `${year}` : "2024") + + (year ? `${year}` : currentYear) + (sgg ? `/${sgg}` : "/0") ); return rswtChkRes; @@ -121,12 +122,12 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( excelList.push({ data: exceldata.guideDetail, headerNum: 0, - headerRange: "A1:AI1", + headerRange: "A1:AJ1", }); excelList.push({ data: exceldata.polutions, headerNum: 0, - headerRange: "A1:AZ1", + headerRange: "A1:BB1", }); return set((state: rswtChkgdnState) => ({ @@ -138,7 +139,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }, rswtChkgdnInit: async (year: string, sggCd: string) => { try { - const rswtChkRes = await initFetch("2024", sggCd); + const rswtChkRes = await initFetch(year, sggCd); return set((state: rswtChkgdnState) => ({ ...state, @@ -161,11 +162,13 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( title: "지도점검 등록", }); } - // const rainChkRes = await initFetch('2024', '0'); + const currentYear = new Date().getFullYear().toString(); + const rswtChkRes = await initFetch(currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, + rswtChkRes: rswtChkRes }, })); } catch (error) { @@ -184,7 +187,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( title: "지도점검 수정", }); } - const rswtChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rswtChkRes = await initFetch(currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { @@ -207,7 +211,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( title: "지도점검 삭제", }); } - const rswtChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rswtChkRes = await initFetch(currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { @@ -259,7 +264,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( title: "지도점검 수정", }); } - const rswtChkRes = await initFetch("2024", "0"); + const currentYear = new Date().getFullYear().toString(); + const rswtChkRes = await initFetch(currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/excel.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/excel.tsx index ff104bc91..6e6b5730c 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/excel.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/excel.tsx @@ -19,6 +19,7 @@ export const buildingExcelRswtSttn = (excelList: any[]) => { String(item.trbt) ?? "", String(item.bod) ?? "", String(item.smll) ?? "", + String(item.crmty) ?? "", String(item.tn) ?? "", String(item.tph) ?? "", String(item.ph) ?? "", diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx index f67e98101..91f6bf718 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx @@ -1,15 +1,15 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; export const rswtChkSttnHeadListExport: TableUpperProps[] = [ - { id: "order", title: "순번", rowSpan: true }, - { id: "cityText", title: "시도", rowSpan: true }, - { id: "sggText", title: "시군구", rowSpan: true }, - { id: "bdstNm", title: "시설명", rowSpan: true }, - { id: "operMngCd", title: "운영관리형태", rowSpan: true }, - { id: "anlOperCst", title: "연간운영비(원/년)", rowSpan: true }, - { id: "prcsCpct", title: "처리용량(m³)", rowSpan: true }, - { id: "spwtPositn", title: "채수지점", rowSpan: true }, - { id: "chckYmd", title: "점검일", rowSpan: true }, + { id: "order", title: "순번", mergeCell: true }, + { id: "cityText", title: "시도", mergeCell: true }, + { id: "sggText", title: "시군구", mergeCell: true }, + { id: "bdstNm", title: "시설명", mergeCell: true }, + { id: "operMngCd", title: "운영관리형태", mergeCell: true }, + { id: "anlOperCst", title: "연간운영비(원/년)", mergeCell: true }, + { id: "prcsCpct", title: "처리용량(m³)", mergeCell: true }, + { id: "spwtPositn", title: "채수지점", mergeCell: true }, + { id: "chckYmd", title: "점검일", mergeCell: true }, { id: "utztnUsgCd", title: "이용용도" }, { id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)", type: "number" }, { id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)", type: "number" }, diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index 9572d1228..4e3d61008 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -144,16 +144,16 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { const average = { utztnUsgCd: "평균", edit: false, - grssClfgUswtr: total.grssClfgUswtr / onlyData.length, - combResdch: total.combResdch / onlyData.length, - trbt: total.trbt / onlyData.length, - bod: total.bod / onlyData.length, - smll: total.smll / onlyData.length, - crmty: total.crmty / onlyData.length, - tph: total.tph / onlyData.length, - tn: total.tn / onlyData.length, - ph: total.ph / onlyData.length, - clIonQnt: total.clIonQnt / onlyData.length, + grssClfgUswtr: (total.grssClfgUswtr / onlyData.length).toFixed(1), + combResdch: (total.combResdch / onlyData.length).toFixed(1), + trbt: (total.trbt / onlyData.length).toFixed(1), + bod: (total.bod / onlyData.length).toFixed(1), + smll: (total.smll / onlyData.length).toFixed(1), + crmty: (total.crmty / onlyData.length).toFixed(1), + tph: (total.tph / onlyData.length).toFixed(1), + tn: (total.tn / onlyData.length).toFixed(1), + ph: (total.ph / onlyData.length).toFixed(1), + clIonQnt: (total.clIonQnt / onlyData.length).toFixed(1), }; if (!resultPolution[nodeKey]) { From e1fcaad73635457e0cb7fc782ed8dae6874731fb Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 26 Jun 2025 19:35:43 +0900 Subject: [PATCH 037/259] =?UTF-8?q?=EC=9E=A0=EC=9E=AC=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=B2=98=20=EC=A2=85=EC=97=85=EC=9B=90=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=ED=95=A9=EA=B3=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sttn/sttnDetailModal/coDatailModal.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/wr/components/ui/modal/sttn/sttnDetailModal/coDatailModal.tsx b/apps/wr/components/ui/modal/sttn/sttnDetailModal/coDatailModal.tsx index edffcc71d..b7229a559 100644 --- a/apps/wr/components/ui/modal/sttn/sttnDetailModal/coDatailModal.tsx +++ b/apps/wr/components/ui/modal/sttn/sttnDetailModal/coDatailModal.tsx @@ -7,7 +7,7 @@ import { handleCommaNumberChange } from "@/components/lib/func/commom"; import { DatePicker, Form, FormField, FormUi, ScrollArea } from "@common/business_components/ui"; import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import type { z } from "zod"; @@ -33,8 +33,24 @@ export default function SttnDetailModal({ useEffect(() => { if (ldrmntZod) form.reset(formObj); - }, [formObj]); + + useEffect(() => { + const male = Number(form.watch("maleEmpCnt") ?? 0); + const female = Number(form.watch("fmaleEmpCnt") ?? 0); + const frgnrMale = Number(form.watch("frgnrMaleEmpCnt") ?? 0); + const frgnrFemale = Number(form.watch("frgnrFmaleEmpCnt") ?? 0); + + const total = male + female + frgnrMale + frgnrFemale; + + form.setValue("totalEmpCnt", total); + }, [ + form.watch("maleEmpCnt"), + form.watch("fmaleEmpCnt"), + form.watch("frgnrMaleEmpCnt"), + form.watch("frgnrFmaleEmpCnt"), + ]); + return ( <div> <ScrollArea className="h-[85vh]"> @@ -324,6 +340,7 @@ export default function SttnDetailModal({ handleCommaNumberChange(e, field.onChange); }} value={field.value ?? 0} + min={0} /> </FormUi> )} @@ -343,6 +360,7 @@ export default function SttnDetailModal({ field.onChange(e.target.value); }} value={field.value ?? 0} + min={0} /> </FormUi> )} @@ -362,6 +380,7 @@ export default function SttnDetailModal({ field.onChange(e.target.value); }} value={field.value ?? 0} + min={0} /> </FormUi> )} @@ -381,6 +400,7 @@ export default function SttnDetailModal({ field.onChange(e.target.value); }} value={field.value ?? 0} + min={0} /> </FormUi> )} @@ -400,6 +420,8 @@ export default function SttnDetailModal({ field.onChange(e.target.value); }} value={field.value ?? 0} + min={0} + readOnly={true} /> </FormUi> )} From aae94a83ec6171699bd7d622b3a926fd87beb62b Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Thu, 26 Jun 2025 20:19:23 +0900 Subject: [PATCH 038/259] =?UTF-8?q?=EB=B9=97=EB=AC=BC=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EC=A0=90=EA=B2=80=20=EB=93=B1=EB=A1=9D=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 2 + apps/wr/app/store/common/searchCode/index.ts | 48 +++++++++++- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 77 +++++-------------- .../ruseFcltMng/fcltReg/rainReg/type.tsx | 45 +++++++++++ apps/wr/app/store/store.tsx | 12 +-- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 10 +-- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 40 ++++++---- .../fcltReg/bdstChgModal/bdstChgModal.tsx | 1 - 8 files changed, 148 insertions(+), 87 deletions(-) create mode 100644 apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 221524918..2fa8b12b8 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -38,8 +38,10 @@ export default function Home() { }>({ isOpen: false, chgBuilding: [] }); useEffect(() => { + setIsNewReg( false) if (!rain.isInit) { initRain('41'); + } }, [rain.isInit, initRain]); diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts index 8f05eca09..34c2c86c5 100644 --- a/apps/wr/app/store/common/searchCode/index.ts +++ b/apps/wr/app/store/common/searchCode/index.ts @@ -7,8 +7,50 @@ import { import type { pubHasuType } from "../../ruseFcltMng/fcltReg/pbnstReg/type"; import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import type { conCostFeeType, rateFeeType } from "./type"; + + +export const comFcltStateExport: comFcltState = { + searchFclts: [] as pubHasuType[], + demandCompList: [], + dmdIsSucees: '', + checkDemand: { + index: 0, + dmdInfoPk: "", + dmdInfoFk: "", + bzmnNo: "", + dmdCoNm: "", + daddr: "", + telno: "", + rgtr: "", + useUsgCd: "", + ctpvCd: "", + sggCd: "", + dmdAplyPswd: "", + wntUntprc: 0, + dmndTmng: "", + dmndQty: 0, + grssClfg: 0, + tn: 0, + combResdch: 0, + tph: 0, + trbt: 0, + ph: 0, + blgcOxygDmndQnt: 0, + clIonQnt: 0, + smll: 0, + cdtnv: 0, + crmty: 0, + rmrk: "", + reqDt: "" + }, + constCostRes:[], + rateFeeRes:[], +}; + +export type comFcltType = comFcltState & comFcltActions; + export type comFcltState = { - searchFclts: pubHasuType; + searchFclts: pubHasuType[]; demandCompList: DemandCompType[]; dmdIsSucees: string; checkDemand: DemandCompType; @@ -16,7 +58,7 @@ export type comFcltState = { rateFeeRes:rateFeeType[], }; -export type comFcltActions = { + type comFcltActions = { getSwtrmtFcltNm: (searchNm: string) => void; getDemandCompList: (searchNm: string, cnt: number) => void; regDemandCompany: (data: DemandCompType) => void; @@ -25,7 +67,7 @@ export type comFcltActions = { getRateFee: (year: string) => void; }; -export const searchActions: (set: any) => comFcltActions = (set: any) => { +export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { return { getSwtrmtFcltNm: async (searchNm: string) => { const fcltNm = await getFetch( diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 4681f7250..a029bd869 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -2,19 +2,15 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import { getFetch, postFectch, putFectch } from "@/components/lib/api"; import { z } from "zod"; import { makeMdfr, makeRstr } from "../bdstReg"; - -const validationMessages = { - required: (field: string) => `${field}을(를) 입력해주세요.`, - requiredSelect: (field: string) => `${field}을(를) 선택해주세요.`, - yearFormat: '4자리 연도만 입력하세요', -}; +import toast from "react-hot-toast"; +import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "./type"; export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e' const rainyObjSchema = z.object({ bdstReuseFcltFk: z.number().nullish(), - pntfColKnd: z.string().default(""), - pntfColArea: z.number().default(0), + pntfColKnd: z.string().min(1, { message: validationMessages.requiredSelect("종류") }), + pntfColArea: z.number().positive({ message: validationMessages.required("면적(m³)") }), dtfcltCpct: z.number().default(0), filtrTrtmfctYn: z.string().default("Y"), filtrTrtmfctCpct: z.number().nullish().default(0), @@ -23,55 +19,15 @@ const rainyObjSchema = z.object({ oilqMeasMthd: z.string().default("").nullish(), rgtr:z.string().nullish(), mdfr:z.string().nullish(), -}).refine((data) => data.pntfColKnd.length > 0, { - message: validationMessages.requiredSelect("종류"), - path: ["pntfColKnd"], -}).refine((data) => data.pntfColArea > 0, { - message: validationMessages.required("면적(m³)"), - path: ["pntfColArea"], }); -const reuseBuildingSchema = z.object({ - bdstRuseFcltPk: z.number().nullish(), - bdstInfoFk:z.number().nullish(), - instlCmptnDt: z.coerce.date().default(() => new Date()), - instlCst: z.number().nullish(), - operMngCd: z.string().optional().default(""), - anlOperCst: z.number().default(0), - instlCstSprtYn: z.string().default("Y"), - instlCstSprtAmt: z.number().nullish(), - grntchBdstCertYn: z.string().default("Y"), - grntchBdstCertYr: z.string().default("") - .refine((year)=> year.length===0 || /^\d{4}$/.test(year),{ - message: validationMessages.yearFormat - }), - grntchBdstCertNo: z.string().default(""), - grntchBdstCertGrd: z.string().default(""), - crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값 - crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값 - crgRdctAmt: z.number().default(0), // 안쓰는 값 - ruseFcltFlg: z.string().default(""), - bdstUsgCd: z.number().default(0), - lawTrgtYn: z.string().default("Y"), - rgtr:z.string().nullish(), - mdfr:z.string().nullish(), - rainyObj: rainyObjSchema.default({}) -}).refine((data) => data.bdstUsgCd > 0, { - message: validationMessages.requiredSelect("건축물용도"), - path: ["bdstUsgCd"], -}) ; -const chgBuildingSchema = z.object({ - bdstInfoFk: z.number().nullish(), - archChgPrmsnDt: z.coerce.date({required_error: validationMessages.required("허가일")}), - archChgArea: z.string().default("-"), - bdstChgNm: z.string().default(""), - rgtr:z.string().nullish(), - mdfr:z.string().nullish(), -}).refine(data => data.bdstChgNm.length > 0, { - message: validationMessages.requiredSelect("구분"), - path: ["bdstChgNm"] -}); + + + + const rainBuildingSchema = baseReuseBuildingSchema.extend({ + rainyObj: rainyObjSchema, +}) export const rainZod = z.object({ bdstInfoPk: z.number().optional(), @@ -85,7 +41,7 @@ export const rainZod = z.object({ archChgArea: z.number().default(0), rgtr:z.string().nullish(), mdfr:z.string().nullish(), - reuseBuilding: z.array(reuseBuildingSchema).default([]), + reuseBuilding: z.array(rainBuildingSchema).default([]), chgBuilding: z.array(chgBuildingSchema).default([]) }) @@ -219,15 +175,18 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( bdstInfoFk: chPK, }) ); - const chch= postFectch("/reuseFc/chgBuilding", makeCh); + const chch= postFectch("/reuseFc/chgBuilding", makeCh); return chch; }).then((chch: any) => { - if(chch.ok) { - alert("등록이 완료되었습니다."); + + console.log('chch ', chch) + if(chch.status ===200) { + toast.success("등록이 완료되었습니다."); + } }) }else{ - alert("등록이 완료되었습니다."); + toast.success("등록이 완료되었습니다."); } } const rainRes = await initFetch(code); diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx new file mode 100644 index 000000000..6e28c3e76 --- /dev/null +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx @@ -0,0 +1,45 @@ +import { z } from "zod"; + + +export const validationMessages = { + required: (field: string) => `${field}을(를) 입력해주세요.`, + requiredSelect: (field: string) => `${field}을(를) 선택해주세요.`, + yearFormat: '4자리 연도만 입력하세요', + }; + +export const baseReuseBuildingSchema = z.object({ + bdstRuseFcltPk: z.number().nullish(), + bdstInfoFk: z.number().nullish(), + instlCmptnDt: z.coerce.date().default(() => new Date()), + instlCst: z.number().nullish(), + operMngCd: z.string().optional().default(""), + anlOperCst: z.number().default(0), + instlCstSprtYn: z.string().default("Y"), + instlCstSprtAmt: z.number().nullish(), + grntchBdstCertYn: z.string().default("Y"), + grntchBdstCertYr: z.string().default("").refine( + (year) => year.length === 0 || /^\d{4}$/.test(year), + { + message: validationMessages.yearFormat, + } + ), + grntchBdstCertNo: z.string().default(""), + grntchBdstCertGrd: z.string().default(""), + crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값 + crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값 + crgRdctAmt: z.number().default(0), // 안쓰는 값 + ruseFcltFlg: z.string().default(""), + bdstUsgCd: z.number().min(1, { message: validationMessages.requiredSelect("건축물용도") }).default(0), + lawTrgtYn: z.string().default("Y"), + rgtr: z.string().nullish(), + mdfr: z.string().nullish(), +}); + +export const chgBuildingSchema = z.object({ + bdstInfoFk: z.number().nullish(), + archChgPrmsnDt: z.coerce.date({required_error: validationMessages.required("허가일")}), + archChgArea: z.string().default("-"), + bdstChgNm: z.string().min(1, { message: validationMessages.requiredSelect("구분") }), + rgtr:z.string().nullish(), + mdfr:z.string().nullish(), +}); diff --git a/apps/wr/app/store/store.tsx b/apps/wr/app/store/store.tsx index 4557662f8..7520f7998 100644 --- a/apps/wr/app/store/store.tsx +++ b/apps/wr/app/store/store.tsx @@ -86,7 +86,7 @@ import { import { rswtChkStateExport, rswtChkSttnActionsExport, type rswtChkSttnState, type rswtChkSttnType } from "./prfmncSttn/chkgdnSttn/rswtChkgdnSttn"; import { pbnstSttnActionsExport, pbnstSttnStateExport, type pbnstSttnState, type pbnstSttnType } from "./ruseFcltMng/fcltSttn/pbnstSttn"; import { coSttnActionsExport, coSttnStateExport, type coSttnState, type coSttnType } from "./matDmd/coSttn"; // 옮겨야함 -import { searchActions, type comFcltActions, type comFcltState } from "./common/searchCode"; +import { comFcltStateExport, comFcltSearchAction, type comFcltState, type comFcltType } from "./common/searchCode"; import { pbnstPrfmncActionsExport, pbnstPrfmncStateExport, type pbnstPrfmncState, type pbnstPrfmncType } from "./prfmncReg/pbnstPrfmncReg"; import { coRvwActionsExport, coRvwStateExport, type coRvwState, type coRvwType } from "./matDmd/coMatRvw"; import { ruseHstryActionsExport, ruseHstryStateExport, type ruseHstryState, type ruseHstryType } from "./matDmd/ruseRvwHstry"; @@ -113,7 +113,6 @@ export type WrStore = comCodeType & rainChkSttnType& rswtChkSttnType& pbnstSttnType& - comFcltActions&comFcltState& coSttnType& // 옮겨야함 ldrmntType& // 옮겨야함 pbnstPrfmncType& @@ -124,7 +123,8 @@ export type WrStore = comCodeType & ruseCaseType& rainStatType& rswtStatType& - matStatType + matStatType& + comFcltType ; export const StoreZus = ( @@ -141,6 +141,7 @@ export const StoreZus = ( rswtSttnState & htdflSttnState & rainChkSttnState& + comFcltState& rswtChkSttnState & pbnstSttnState& coSttnState& // 옮겨야함 @@ -180,7 +181,8 @@ export const StoreZus = ( ...ruseCaseStateExport, ...rainStatExport, ...rswtStatExport, - ...matStatExport + ...matStatExport, + ...comFcltStateExport } ) => { return createStore<WrStore>()((set) => { @@ -192,7 +194,7 @@ export const StoreZus = ( getEnvPartCd(set); return { ...initState, - ...searchActions(set), + ...comFcltSearchAction(set), ...pubFacActionsExport(set), ...rainFacActionsExport(set), ...rswtFacActionsExport(set), diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 5ab5edf98..0d00454e2 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -171,7 +171,7 @@ export default function BdstReg({ form }: { form: any }) { <FormUi label="위치"> <Input className={selectClass} - placeholder="1,000,000" + placeholder="" type="search" {...field} /> @@ -193,7 +193,7 @@ export default function BdstReg({ form }: { form: any }) { onSelectValue={(val) => { field.onChange(Number(val)); }} - value={field.value} + value={field.value??code.bdstUsgCd[0]?.val} /> </FormUi> )} @@ -208,7 +208,7 @@ export default function BdstReg({ form }: { form: any }) { <DatePicker mode={"single"} field={{ - value: field.value || new Date(), + value: field.value?? new Date(), onChange: (date: Date | undefined) => field.onChange(date), }} selectClass={'w-full'} @@ -226,7 +226,7 @@ export default function BdstReg({ form }: { form: any }) { <Input className={selectClass} placeholder="1,000,000" - type="number" + type="text" onChange={(e) => { handleCommaNumberChange(e, field.onChange); }} @@ -250,7 +250,7 @@ export default function BdstReg({ form }: { form: any }) { onSelectValue={(val) => { field.onChange(val); }} - value={field.value} + value={field.value??code.yn[0]?.val } /> </FormUi> )} diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 40a9bb436..fc4ed566e 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -46,32 +46,40 @@ export default function RainRegForm({ ]); const cleanRainData = (raw: any): z.infer<typeof rainZod> => { + const buildings = + raw?.reuseBuilding && raw.reuseBuilding.length > 0 + ? raw.reuseBuilding + : [{}]; return { ...raw, - frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), + frstArchPrmsnDt: raw?.frstArchPrmsnDt + ? new Date(raw.frstArchPrmsnDt) + : new Date(), // raw?.frstArchPrmsnDt가 유효하지 않으면 현재 날짜로 초기화 archChgPrmsnDt: raw?.archChgPrmsnDt ? new Date(raw?.archChgPrmsnDt) : null, - reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ + reuseBuilding: buildings.map((item: any) => ({ ...item, - instlCmptnDt: new Date(item?.instlCmptnDt), + instlCmptnDt: item?.instlCmptnDt + ? new Date(item.instlCmptnDt) + : new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화 operMngCd: item?.operMngCd ?? "", // null → "" grntchBdstCertYr: typeof item?.grntchBdstCertYr === "string" ? item?.grntchBdstCertYr : "", // null → "" - instlCstSprtYn: - item?.instlCstSprtYn ?? "Y", // null → "N" - // Ensure enum fields are null if empty string to trigger Zod default + instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" + grntchBdstCertYn:item?.grntchBdstCertYn??"Y", rainyObj: { ...item?.rainyObj, - filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ??"Y" + filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", }, })), }; }; useEffect(() => { + if (grntchBdstCertYn === "N") { form.setValue("reuseBuilding.0.grntchBdstCertYr", ""); form.setValue("reuseBuilding.0.grntchBdstCertNo", ""); @@ -84,6 +92,9 @@ export default function RainRegForm({ } }, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn]); + + + // form 값이 변경될 때마다 로그 출력 useEffect(() => { const subscription = form.watch((value) => { @@ -148,9 +159,8 @@ export default function RainRegForm({ value: field.value && !isNaN(new Date(field.value).getTime()) ? new Date(field.value) - : new Date(), // Provide a default Date value - onChange: (date) => field.onChange(date), - + : new Date(), + onChange: (date: Date | undefined) => field.onChange(date), }} selectClass={"w-full"} readOnly={readonly} @@ -247,7 +257,7 @@ export default function RainRegForm({ label={""} selectArray={code.yn} onSelectValue={readonly ? () => { } : field.onChange} - value={field.value || code.yn[0]?.val} + value={field.value ?? code.yn[0]?.val} readOnly={readonly} /> </FormUi> @@ -268,7 +278,8 @@ export default function RainRegForm({ if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} - readOnly={filtrTrtmfctYn === "Y"} + readOnly={readonly } + disabled={filtrTrtmfctYn !== "Y"} /> </FormUi> )} @@ -286,7 +297,8 @@ export default function RainRegForm({ type="text" value={field.value ?? ""} onChange={field.onChange} - readOnly={filtrTrtmfctYn === "Y" } + readOnly={readonly } + disabled={filtrTrtmfctYn !== "Y"} /> </FormUi> )} @@ -335,7 +347,7 @@ export default function RainRegForm({ if (!readonly) handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} - readOnly={instlCstSprtYn === "Y"} + readOnly={instlCstSprtYn !== "Y"} /> </FormUi> )} diff --git a/apps/wr/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal.tsx index 03c257c59..0b071aa91 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal.tsx @@ -14,7 +14,6 @@ const {bdst,rain} = useWrStore((state) => { return state; }); const { bdstChgHeadList } = bdst; - console.log("chgBuilding", chgBuilding); return ( From 55912433f6faa0ce3024cf1eaad4e0a783ccedf6 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 26 Jun 2025 21:44:38 +0900 Subject: [PATCH 039/259] =?UTF-8?q?=EA=B4=80=EC=B8=A1=EC=86=8C=20=EB=A8=B8?= =?UTF-8?q?=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/lib/gis.layer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/map/lib/gis.layer.js b/packages/common/business_components/src/ui/map/lib/gis.layer.js index d9657c313..bb4a4a20a 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.layer.js +++ b/packages/common/business_components/src/ui/map/lib/gis.layer.js @@ -77,7 +77,7 @@ GisOlLayer.prototype = { let lyrTyNm = options.lyrTyNm; let typename = this.storageNm + lyrTyNm; - if(options.lyrTyNm == "om_dt_untrt_swg_rain"){ //중점우수토실실 + if(options.lyrTyNm == "om_dt_untrt_swg_rain" || options.lyrTyNm == "om_wqlt_station" ){ //중점우수토실실, 관측소소 url = GisApp.SN_GEOSERVER_URL; typename = lyrTyNm; } From 7053966007354362c37c69c7b5c775933fe4efb8 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Fri, 27 Jun 2025 09:28:57 +0900 Subject: [PATCH 040/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC=20=EC=97=91=EC=85=80?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=ED=8C=9D=EC=97=85=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?=EB=B0=8F=20=ED=8C=9D=EC=97=85=EB=93=B1=EB=A1=9D=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 86 +++++---- .../wr/app/store/matDmd/ruseCaseMng/excel.tsx | 109 +++++++++++ .../wr/app/store/matDmd/ruseCaseMng/index.tsx | 110 ++++++++++- .../ruseCaseMng/ruseCaseMngExcelModal.tsx | 172 ++++++++++++++++++ 4 files changed, 432 insertions(+), 45 deletions(-) create mode 100644 apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx create mode 100644 apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index 4950ab0da..ad5a4f751 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -1,30 +1,48 @@ "use client"; + import { useWrStore } from "@/app/store"; import { ruseUtzType } from "@/app/store/matDmd/ruseCaseMng/headList"; import { getCity } from "@/components/lib/func/commom"; +import RuseCaseMngExcel from "@/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; -import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui"; +import { + ContentsDiv, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, + Title, + UiModal, + UiTable, + type SelectDataType, +} from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; import { useState } from "react"; export default function RuseCaseMng() { - const { code,ruseCase} = useWrStore((state) => state); - const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>() + const { code, ruseCaseMng } = useWrStore((state) => state); + const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>(); const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); - const [selectUtz, setSelectUtz] = useState<string[] | []>() - const [searchTxt, setSearchTxt] = useState<string>() + const [selectUtz, setSelectUtz] = useState<string[] | []>(); + const [searchTxt, setSearchTxt] = useState<string>(); const getSelCity = (val: string | number) => { const cityValue = String(val); const data = getCity(cityValue, code.sggCd); setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: '' }); + setObjSearch({ city: cityValue, sgg: "" }); }; const getSgg = (val: string | number) => { - setObjSearch({ ...objSearch, sgg: String(val) }) + setObjSearch({ ...objSearch, sgg: String(val) }); }; + + const [isExcelOpen, setIsExcelOpen] = useState<{ + isModal: boolean; + }>({ isModal: false }); + return ( <> <ContentsDiv> @@ -54,47 +72,32 @@ export default function RuseCaseMng() { selectClass={""} selectArray={ruseUtzType} onSelectValue={(val) => { - if(val) - setSelectUtz([String(val)])}} + if (val) setSelectUtz([String(val)]); + }} /> - <SearchInput className={"text-2xl"} label="수요처명" textValue={""} setText={(e) => { - setSearchTxt(e) + setSearchTxt(e); }} /> </div> - </SearchFormLeft> - <SearchFormRight - className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2"> <div className="space-y"> <div className="flex flex-row space-x-2"> - <Button - size={"sm"} - onClick={(e) => { }} - > + <Button size={"sm"} onClick={() => {}}> 조회 </Button> - <Button - size={"sm"} - onClick={(e) => { }} - > + <Button size={"sm"} onClick={() => { setIsExcelOpen({ isModal: true }); }}> 엑셀등록 </Button> - <Button - size={"sm"} - onClick={(e) => { }} - > + <Button size={"sm"} onClick={() => {}}> 다운로드 </Button> - <Button - size={"sm"} - onClick={(e) => { }} - > + <Button size={"sm"} onClick={() => {}}> 양식받기 </Button> </div> @@ -103,24 +106,33 @@ export default function RuseCaseMng() { </SearchDiv> </div> </div> - <div className="grid grid-cols-6 gap-4 "> + <div className="grid grid-cols-6 gap-4"> <div className="col-span-6"> <ListDiv> <UiTable headName={"물재이용사례 현황"} tableData={[]} children={undefined} - headlist={ruseCase.ruseHeadList} + headlist={ruseCaseMng.ruseHeadList} pageSize={20} total={100000} - cellClick={(index: number | undefined, headId: string) => { - }} - onPageChange={() => { }} - ></UiTable> + cellClick={(index: number | undefined, headId: string) => {}} + onPageChange={() => {}} + /> </ListDiv> </div> </div> </ContentsDiv> + + {/* 엑셀 등록 모달 */} + <UiModal + open={isExcelOpen.isModal} + onOpenChange={() => { + setIsExcelOpen({ isModal: !isExcelOpen.isModal }) + }} + bodyClass={"w-[40vw] max-w-none"} + body={<RuseCaseMngExcel />} + /> </> - ) + ); } \ No newline at end of file diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx new file mode 100644 index 000000000..ebbaa8b7a --- /dev/null +++ b/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx @@ -0,0 +1,109 @@ +import { z } from "zod"; + +export const reUseCaseExcel = z.object({ + file: z.any() +}); + +type nameMap = { + [key: string]: string; +} + +export const reUseCaseNames: nameMap = { + "사업명": "ruseBizNm", + "사업시작일": "bizBgngDate", + "사업종료일": "bizEndtDate", + "공급처_시설종류": "splyFcltKnd", + "공급처명": "splyFcltNm", + "공급처_시설용량(㎥/일)": "splyFcltCpct", + "수요처명": "dmdFcltNm", + "수요처_주소": "dmdFcltAddr", + "재이용시설_시설용량(㎥/일)": "ruseFcltCpct", + "재이용시설_관로(km)": "ruseFcltPplLen", + "재이용시설_용도": "ruseFcltUsg", + "재이용시설_공급량(㎥/일)": "ruseFcltSplyCpct", + "재이용시설_처리공법": "ruseFcltPrcsMsrc", + "보증수질_용도별": "grnteWqUsg", + "보증수질_총대장균군수": "grnteWqGrssClfg", + "보증수질_결합잔류염소": "grnteWqCombResdch", + "보증수질_탁도": "grnteWqTrbt", + "보증수질_생물학적산소요구량(BOD)(mg/L)": "grnteWqBod", + "보증수질_냄새": "grnteWqSmll", + "보증수질_색도(도)": "grnteWqCrmty", + "보증수질_총질소(T-N)(mg/L)": "grnteWqTn", + "보증수질_총인(T-P)(mg/L)": "grnteWqTp", + "보증수질_수소이온농도(pH)": "grnteWqPh", + "보증수질_염화물": "grnteWqClIonQnt", + "보증수질_전기전도도": "grnteWqCndctStat", + "보증수질_비고": "grnteWqRmrk", + "소요사업비_총(백만원)": "reqBizGrssCst", + "소요사업비_토목_재이용시설(백만원)": "reqBizReuseFcltCst", + "소요사업비_토목_관로(백만원)": "reqBizPplCst", + "소요사업비_건축(백만원)": "reqBizArchCst", + "소요사업비_기계(백만원)": "reqBizMchnCst", + "소요사업비_전기.계측(백만원)": "reqBizMtrngCst", + "소요사업비_GIS DB(백만원)": "reqBizGisCst", + "소요사업비_CCTV(백만원)": "reqBizCctvCst", + "소요사업비_시공 및 준공(백만원)": "reqBizCmcnCst", + "소요사업비_폐기물(백만원)": "reqBizWstCst", + "소요사업비_설계비(백만원)": "reqBizDesignCst", + "소요사업비_감리비(백만원)": "reqBizSpvsCst", + "소요사업비_시설부대비(백만원)": "reqBizSbsdCst", + "소요사업비_기타(백만원)": "reqBizEtc", + "재원조달계획_총(백만원)": "prcmPlanGrssCst", + "재원조달계획_국비(백만원)": "prcmPlanNlep", + "재원조달계획_지방비(백만원)": "prcmPlanLcep", + "재원조달계획_원인자부담(백만원)": "prcmPlanBrdnCst", + "재원조달계획_국고비율(백만원)": "prcmPlanEcqrRt", + "사업비 정산_총(백만원)": "clclnGrssCst", + "사업비 정산_국비(백만원)": "clclnNlep", + "사업비 정산_지방비(백만원)": "clclnLcep", + "사업비 정산_원인자부담(백만원)": "clclnBrdnCst", + "사업비 정산_국고비율(백만원)": "clclnEcqrRt" +} + +interface PbnstSttnItem { + rvbsn: string; + lgbsn: number; + mdmbsn?: string; + rgnNm?: string; + sido?: number; + gugun?: number; + bscFctNm?: string; + efflWqltStndrdNm?: string; + fctCpc?: number; + tel?: string; + ruseUtztnFcltNm?: string; + fcltCpct?: number; + splyExtraCpct?: number; + ruseCpct?: number; + usageTotal?: number; + inUsage?: number; + outUsage?: number; +} + +export const excelPbnstSttnParsing = (data: PbnstSttnItem[]): string[][] => { + const excelExportData: string[][] = []; + + data.forEach((item) => { + excelExportData.push([ + item.rvbsn, + String(item.lgbsn), + item.mdmbsn ?? "", + item.rgnNm ?? "", + String(item.sido ?? ""), + String(item.gugun ?? ""), + String(item.bscFctNm ?? ""), + String(item.efflWqltStndrdNm ?? ""), + String(item.fctCpc ?? ""), + String(item.tel ?? ""), + String(item.ruseUtztnFcltNm ?? ""), + String(item.fcltCpct ?? ""), + String(item.splyExtraCpct ?? ""), + String(item.ruseCpct ?? ""), + String(item.usageTotal ?? ""), + String(item.inUsage ?? ""), + String(item.outUsage ?? ""), + ]) + }) + return excelExportData; +}; \ No newline at end of file diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx index c54b0db1a..274af07af 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx @@ -1,24 +1,118 @@ +import { fetchType, postFectch } from "@/components/lib/api"; import type { TableUpperProps } from "../../common/type/header"; import { ruseCaseHeadListExport } from "./headList"; +import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; export type ruseCaseState = { - ruseCase: { - ruseHeadList:TableUpperProps[]; - }; + ruseCaseMng: { + ruseHeadList:TableUpperProps[]; + ruseCaseMngList:TableUpperProps[]; }; -type ruseCaseActions = { }; + +export interface ruseCaseMngExcelProps { + ruseBizNm: string, + bizBgngDate: string, + bizEndDate: string, + splyFcltKnd: string, + splyFcltNm: string, + splyFcltCpct: number | 0 |'', + dmdFcltNm: string, + dmdFcltAddr: string, + ruseFcltCpct: number | 0 |'', + ruseFcltPplLen: string, + ruseFcltUsg: string, + ruseFcltSplyCpct: number | 0 |'', + ruseFcltPrcsMsrc: string, + grnteWqUsg: string, + grnteWqGrssClfg: number | 0 |'', + grnteWqCombResdch: number | 0 |'', + grnteWqTrbt: string, + grnteWqBod: string, + grnteWqSmll: string, + grnteWqCrmty: string, + grnteWqTn: string, + grnteWqTp: string, + grnteWqPh: string, + grnteWqClIonQnt: string, + grnteWqCndctStat: string, + grnteWqRmrk: string, + reqBizReuseFcltCst: number | 0 |'', + reqBizPplCst: number | 0 |'', + reqBizArchCst: number | 0 |'', + reqBizMchnCst: number | 0 |'', + reqBizMtrngCst: number | 0 |'', + reqBizGisCst: number | 0 |'', + reqBizCctvCst: number | 0 |'', + reqBizCmcnCst: number | 0 |'', + reqBizWstCst: number | 0 |'', + reqBizDesignCst: number | 0 |'', + reqBizSpvsCst: number | 0 |'', + reqBizSbsdCst: number | 0 |'', + reqBizEtc: string, + reqBizGrssCst: number | 0 |'', + prcmPlanNlep: number | 0 |'', + prcmPlanLcep: number | 0 |'', + prcmPlanBrdnCst: number | 0 |'', + prcmPlanEcqrRt: number | 0 |'', + prcmPlanGrssCst: number | 0 |'', + clclnNlep: number | 0 |'', + clclnLcep: number | 0 |'', + clclnBrdnCst: number | 0 |'', + clclnEcqrRt: number | 0 |'', + clclnGrssCst: number | 0 |'', +} + +type ruseCaseActions = { + selectRuseCaseMng: (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => Promise<void>; + insertRuseCaseMng: (data: any) => Promise<void>; +}; + +export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { + const tailUrl = (sidoCd && !sigunguCd ? `/${sigunguCd}` : sigunguCd ? `/${sigunguCd}` : '/0') + (usageCd ? `/${usageCd}` : '') + (name ? `/${name}` : ''); + console.log('tailUrl : ', tailUrl); + const response = await postFectch(`/reuseFc/pubFcRuseCase${tailUrl}`, {usageCd, name}, fetchType.WR); + return []; +}; + +export const fetchInsertRuseCaseMng = async (data: any) => { + console.log('data : ', data) + const response = await postFectch('/reuseFc/pubFcRuseCase', data, fetchType.WR); + return response.data; +}; + export type ruseCaseType = ruseCaseState & ruseCaseActions; export const ruseCaseStateExport: ruseCaseState = { - ruseCase: { - ruseHeadList:ruseCaseHeadListExport, + ruseCaseMng: { + ruseHeadList:ruseCaseHeadListExport, + ruseCaseMngList:[], }, }; -export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( + +export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( set: any ) => { return { - + selectRuseCaseMng: async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { + const res = await fetchSearchRuseCaseMng(sidoCd, sigunguCd, usageCd, name); + + set((state: ruseCaseState) => ({ + ruseCaseMng: { + ...state.ruseCaseMng, + ruseCaseMngList: data, + }, + })); + }, + + insertRuseCaseMng: async (data: any) => { + const response = await fetchInsertRuseCaseMng(data); + if(response.status === 200){ + ToastFormUi({ + body: "잠재수요처 등록이 완료되었습니다. ", + title: "잠재수요처 등록", + }); + } + }, }; }; diff --git a/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx b/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx new file mode 100644 index 000000000..57424996e --- /dev/null +++ b/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx @@ -0,0 +1,172 @@ +import { coRegExcel } from "@/app/store/matDmd/coSttn/headList"; +import type { ruseCaseMngExcelProps } from "@/app/store/matDmd/ruseCaseMng/index"; +import { reUseCaseNames } from "@/app/store/matDmd/ruseCaseMng/excel"; +import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui"; +import { Form, FormField } from "@common/business_components/ui/form"; +import { Button } from "@common/components/ui"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import type { z } from "zod"; +import { useWrStore } from "@/app/store"; + +export default function RuseCaseMngExcel() { + const { insertRuseCaseMng } = useWrStore((state) => state); + const form = useForm<z.infer<typeof coRegExcel>>({ + resolver: zodResolver(coRegExcel), + }); + + const [file, setFiles] = useState<File | undefined>(); + + const onSubmit = () => { + if (file) { + filePicked(file, 0).then((res: unknown) => { + try { + const newArray: ruseCaseMngExcelProps[] = [] + const dataArray = Array.isArray(res) ? res : []; + dataArray.forEach((item: Record<string, unknown>) => { + const object: ruseCaseMngExcelProps = { + ruseBizNm: '', + bizBgngDate: '', + bizEndDate: '', + splyFcltKnd: '', + splyFcltNm: '', + splyFcltCpct: 0, + dmdFcltNm: '', + dmdFcltAddr: '', + ruseFcltCpct: 0, + ruseFcltPplLen: '', + ruseFcltUsg: '', + ruseFcltSplyCpct: 0, + ruseFcltPrcsMsrc: '', + grnteWqUsg: '', + grnteWqGrssClfg: 0, + grnteWqCombResdch: 0, + grnteWqTrbt: '', + grnteWqBod: '', + grnteWqSmll: '', + grnteWqCrmty: '', + grnteWqTn: '', + grnteWqTp: '', + grnteWqPh: '', + grnteWqClIonQnt: '', + grnteWqCndctStat: '', + grnteWqRmrk: '', + reqBizReuseFcltCst: 0, + reqBizPplCst: 0, + reqBizArchCst: 0, + reqBizMchnCst: 0, + reqBizMtrngCst: 0, + reqBizGisCst: 0, + reqBizCctvCst: 0, + reqBizCmcnCst: 0, + reqBizWstCst: 0, + reqBizDesignCst: 0, + reqBizSpvsCst: 0, + reqBizSbsdCst: 0, + reqBizEtc: '', + reqBizGrssCst: 0, + prcmPlanNlep: 0, + prcmPlanLcep: 0, + prcmPlanBrdnCst: 0, + prcmPlanEcqrRt: 0, + prcmPlanGrssCst: 0, + clclnNlep: 0, + clclnLcep: 0, + clclnBrdnCst: 0, + clclnEcqrRt: 0, + clclnGrssCst: 0, + }; + + Object.keys(reUseCaseNames).forEach((key: string) => { + if (item && reUseCaseNames[key] !== undefined) { + const mappedKey = reUseCaseNames[key]; + if (mappedKey && object.hasOwnProperty(mappedKey)) { + let value; + + if(value === "-"){ + value = ''; + } + if(key === "사업시작일" || key === "사업종료일"){ + if(item[key]?.toString().split(".")[1]?.length === 1){ + value = `${item[key]?.toString().split(".")[0] || ""}${item[key]?.toString().split(".")[1]?.length === 1 ? "0" : ""}${item[key]?.toString().split(".")[1] || ""}` + }else{ + value = `${item[key]?.toString().split(".")[0] || ""}${item[key]?.toString().split(".")[1] || ""}` + } + }else if(key === "재이용시설_관로(km)" || key?.toString().includes("보증수질_")){ + value = item[key]?.toString().trim() || ''; + }else{ + if(item[key]?.toString().includes("%") && Number(item[key]?.toString().replaceAll("%", ""))){ + value = item[key]?.toString().replaceAll("%", ""); + }else{ + value = item[key]; + } + } + + if(value === null || value?.toString().trim() === "-" || value?.toString().trim() === ""){ + if (typeof object[mappedKey as keyof ruseCaseMngExcelProps] === 'number') { + (object as unknown as Record<string, unknown>)[mappedKey] = ''; + } else { + (object as unknown as Record<string, unknown>)[mappedKey] = ''; + } + }else if (typeof object[mappedKey as keyof ruseCaseMngExcelProps] === 'number' && Number(value?.toString().replaceAll("%", "").replaceAll(",", ""))) { + (object as unknown as Record<string, unknown>)[mappedKey] = Number(value?.toString().replaceAll("%", "").replaceAll(",", "")); + }else{ + (object as unknown as Record<string, unknown>)[mappedKey] = value?.toString().trim() || ''; + } + } + } + }); + newArray.push(object); + }); + console.log("newArray : ", newArray); + insertRuseCaseMng(newArray); + } catch (e) { + console.log(e) + } + }); + }; + } + + return ( + <> + <div> + <Form {...form}> + <form onSubmit={form.handleSubmit(onSubmit)}> + <div> + <Title title={"물재이용 사례 등록"}> +
+
+

+ {"물재이용 사례 파일"} +

+ +
+ +
+ ( + + { + console.log("files", files) + if (files && files?.length === 1) setFiles(files[0]); + }} + fileTypes="" + maxFiles={1} + > + + )} + /> +
+ + +
+ + ); +} \ No newline at end of file From f949319db3a30920eff8cf4a57cced7ef52ed4ca Mon Sep 17 00:00:00 2001 From: YangJinSoo94 Date: Fri, 27 Jun 2025 09:31:56 +0900 Subject: [PATCH 041/259] =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index ad5a4f751..fecbb4ac6 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -22,12 +22,22 @@ import { Button } from "@common/components/ui"; import { useState } from "react"; export default function RuseCaseMng() { - const { code, ruseCaseMng } = useWrStore((state) => state); + const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); const [selectSgg, setSelectSgg] = useState(); const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); const [selectUtz, setSelectUtz] = useState(); const [searchTxt, setSearchTxt] = useState(); + const [sidoCd, setSidoCd] = useState(""); + const [sigunguCd, setSigunguCd] = useState(""); + const [usageCd, setUsageCd] = useState(""); + const [name, setName] = useState(""); + + const searchRuseCaseMng = async () => { + const res = await selectRuseCaseMng(sidoCd, sigunguCd, usageCd, name); + console.log('res : ', res); + } + const getSelCity = (val: string | number) => { const cityValue = String(val); const data = getCity(cityValue, code.sggCd); From 401b68fe24ad83c0ef2adc94c7f81f19e4a8b2bf Mon Sep 17 00:00:00 2001 From: YangJinSoo94 Date: Fri, 27 Jun 2025 11:21:03 +0900 Subject: [PATCH 042/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=ED=99=95=EC=9D=B8=EC=A4=91,=20=EC=83=98?= =?UTF-8?q?=ED=94=8C=EC=96=91=EC=8B=9D=20=EB=8B=A4=EC=9A=B4=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 69 ++++++++++++------ .../wr/app/store/matDmd/ruseCaseMng/index.tsx | 9 ++- apps/wr/public/sample_ruseCaseMng.xlsx | Bin 0 -> 19429 bytes 3 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 apps/wr/public/sample_ruseCaseMng.xlsx diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index ac68c4a66..5e4bddaad 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store"; import { ruseUtzType } from "@/app/store/matDmd/ruseCaseMng/headList"; -import { getCity } from "@/components/lib/func/commom"; +import { excelDownload, getCity } from "@/components/lib/func/commom"; import RuseCaseMngExcel from "@/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { @@ -23,36 +23,61 @@ import { useState } from "react"; export default function RuseCaseMng() { const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); - const [selectSgg, setSelectSgg] = useState(); + const [selectSgg, setSelectSgg] = useState([{val: "0", text: "전체"}]); const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); - const [selectUtz, setSelectUtz] = useState(); - const [searchTxt, setSearchTxt] = useState(); - + const [sidoCd, setSidoCd] = useState(""); const [sigunguCd, setSigunguCd] = useState(""); - const [usageCd, setUsageCd] = useState(""); + const [selectUtz, setSelectUtz] = useState(["조경용수"]); const [name, setName] = useState(""); + // 물재이용사례 조회 const searchRuseCaseMng = async () => { - const res = await selectRuseCaseMng(sidoCd, sigunguCd, usageCd, name); + console.log(selectUtz); + const res = await selectRuseCaseMng(sidoCd, sigunguCd, selectUtz, name); console.log('res : ', res); } + // 시도 선택 const getSelCity = (val: string | number) => { const cityValue = String(val); + const cityText = code.cityCd.find((item: any) => item.cityCd === cityValue)?.text; + setSidoCd(cityText || ""); + const data = getCity(cityValue, code.sggCd); setSelectSgg(data); setObjSearch({ city: cityValue, sgg: "" }); }; + // 시군구 선택 const getSgg = (val: string | number) => { + const sggValue = String(val); + const sggText = selectSgg?.find((item: any) => item.sggCd === sggValue)?.sggNm; + setSigunguCd(sggText || ""); setObjSearch({ ...objSearch, sgg: String(val) }); }; + // 엑셀 등록 모달 const [isExcelOpen, setIsExcelOpen] = useState<{ isModal: boolean; }>({ isModal: false }); + // 다운로드 + const download = () => { + console.log("다운로드"); + } + + // 양식받기 + const sampleDownLoad = () => { + excelDownload( + [[]], + "물재이용사례 관리", + "sample_ruseCaseMng.xlsx", + "A1:AX1", + 2 + ); + } + return ( <> @@ -88,9 +113,9 @@ export default function RuseCaseMng() { { - setSearchTxt(e); + setName(e); }} />
@@ -98,7 +123,7 @@ export default function RuseCaseMng() {
- -
@@ -119,16 +144,18 @@ export default function RuseCaseMng() {
- {}} - onPageChange={() => {}} - /> +
+ {}} + onPageChange={() => {}} + /> +
diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx index 274af07af..0b40c1826 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx @@ -1,4 +1,4 @@ -import { fetchType, postFectch } from "@/components/lib/api"; +import { fetchType, getFetch, postFectch } from "@/components/lib/api"; import type { TableUpperProps } from "../../common/type/header"; import { ruseCaseHeadListExport } from "./headList"; import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; @@ -71,8 +71,9 @@ type ruseCaseActions = { export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { const tailUrl = (sidoCd && !sigunguCd ? `/${sigunguCd}` : sigunguCd ? `/${sigunguCd}` : '/0') + (usageCd ? `/${usageCd}` : '') + (name ? `/${name}` : ''); console.log('tailUrl : ', tailUrl); - const response = await postFectch(`/reuseFc/pubFcRuseCase${tailUrl}`, {usageCd, name}, fetchType.WR); - return []; + const resp = await getFetch(fetchType.WR,`/reuseFc/pubFcRuseCase${tailUrl}`); + console.log('resp : ', resp); + return resp; }; export const fetchInsertRuseCaseMng = async (data: any) => { @@ -96,7 +97,7 @@ export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( return { selectRuseCaseMng: async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { const res = await fetchSearchRuseCaseMng(sidoCd, sigunguCd, usageCd, name); - + console.log('res : ', res); set((state: ruseCaseState) => ({ ruseCaseMng: { ...state.ruseCaseMng, diff --git a/apps/wr/public/sample_ruseCaseMng.xlsx b/apps/wr/public/sample_ruseCaseMng.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..3a88e0623e067d483927ce6dfdc452c2dbb2ee19 GIT binary patch literal 19429 zcmeIaby!?$vOU~LkRZXG1SddncXxMp3GVI|+(RHhaCdE-0KtPp;}+aKK=7~0IcLsH z=FFYB_xI2DJoh#ayxq{dsIFSIR_*RxuYxobGzI_$00#g7hyjA^fupt%008te0012T z2dOP=XX|Wg>#VQhVQ=cBOXqH5O_T!-`8o>#34Z?n-ToIxpiE`J_6q|_oBAHV$Y-_i z?9h@DID%#ZZL%HMkM0Q?Wc8c4ukU;)%@kFu;X26`tw*&f&UtXk=P5LW1lFzTZZze| z3=j&V%NO0j>{$dO2DEFqR58n6(Vy8JW4eq#u?FDe;9hwrRJ}VOwYUK-MtO= z#c`U`*DLB>^zXO>$K#?@v*f30+?p&mViC?$oX!te`t!@fX}@Zj9>`t6Ke*$VdSBSR z$vejm7~LVtV2nHUXbXmO3PG`00xUNlqJAfEDu>*GKmD%8j(viCn}{3(;^2t=G!IC2 zGsKRs;JQGB4nRB*b~K;8j3T%$T|iz+&k=m}E$I{){{dWQkB?9Qg?}hhpeh6DcQE#3 zz<)&mm#My^skIY5-P6ziE6@MMHTichy(~dizKa1dqDGo(Q+D%ZRg;>Sc zUvlvUFglkEf2p0407V5a2uj?q&G+u>!V*vPUO(~W8cSIu8U{CMy<2%m@{NNFEH#B= zl9)r;YB#Fu)Wy_ginx@=YuC0|>e9xdZ0Ug&QnATXk!qAtI(0mF^n8L4EZ&p=tzKEp zWuqSz5K}_Rhvgwv4eVKa??==8W|9hak@&+nWez4%F#Da1-p*Bc_gfQRT;r)Kn{!%J z8D%(fk$C8vSa+O@q_v~pd(+B&>Q^FRLHofpD&9w)b>XK~$8tKD?$ON--&NXwG7uQ~ zs%ROkSpQrk0ep$c=irDmgNpc8QIxcJ*n9rH3I>bG_aNb-M2C& zS?O*tr6W9qGPtF=VxrDD(~}&i?!SN=sH0k-AZGUczJgEPtgA6CO%G)k;&D9O=X%A8 zyat7S(MeMjfd=h~Zhg%C%x?I67z)nlu>579_%n30gT4LILj>ehC-f%1g#I@f7#v$a zUX$a7<`$5Md~ccvVX+)xaAC4^8YBD)#>`;dhW|~l@&O*0esoEFL-VA;}Hrp8Jn_2;9`kx_#ceP>01cpl(Gyw1d{0uN;{vIr4 zDzdTjKPAtv$~)8>MI#KZbTgM)38-Z=w}gPbE)y1MTv)Fxp!(=VDLFaeI9JkUa`%D# zd>P-%(~Fwy8nX9!IU3$~A1MKc^yfhNoyjd-JDG47nS2?`XYjm1`3G zpdk`v&5v|&y)rgAF@`Q(;GerO**xE}x4g`tMXCaA0V?A3c5X>44TQ$Ah}kMT$22K8 z-mq3aSEzW#NR-lbW=YZp9g3=yr!@;t^Ab^#*!Y7pK1+5`Ur=uUi@+PQgy#3iQAWsETAZMh(3{5+ z^`N$X)@I?Ct4`#I2FjqC;esEgJZ9Xt9XfKZz05QrF%W4YAW zEdZ~GE}Mjb_pb@q2k5KPD*6ay$x0k{~=r~{|a8_%hSjbPyj#*8UTRt z8@!y%4INEQl${+dY~MOP5mKGTiu}9+hOd6jWA-jO-_TkTZDc@d*qoWsrvdxQU;#{~ zc_yu4Z{cDQC~9dU5~YxH$`EqQh_2wr-iGC_$0}u0x-9wqLnwHRA0uv~Zs6~>&&75| zftr{~QaVX@2i=XyrqEO*;_DMNnYxIdy-t%%F<9S-cEM|+-5sQ6RVm+{zvUBE#J#J` z`!V;igo2V&F1#C>u`Fs(Qt*pi(ncbV+NrT+igE%KF@dU4U{(bDQU1(r2zr-8xGBk5 zMBdHZ434X4gr6=d@_RxOstTBjz)KxszAF`ENVc!yDJsRT%>R{HP z7qRrm+Ke6^QNeoJ4Z(kh>OB1&@$295{c%f3zVZk^6d+o(GTQ!9sW4(Du<*Xtiy z&JaUC{TyK~DKt;!07-)+z97Qzl2pnHCHv zP6|>&1M6Q6w3ly~E zPkMNsiH0J;bzabs&?|^nSgFnUH;0%R+;$$?Mn-aAxa2u?f^_$00w_D|F`FZ`%?Du6i5KsM0g{;OR7-kl@ntC7iW^G1Bgy}^FMQ)9=-lWud zEqz-yi^zyR+DIzYOR?8=G_F5-JAK$>%GW4imsG1I)(-O5LVdC5UQ`{*wT*tGJFq}` zJnz<8YVX?yaDQbV725O|ymn$44(^rzg4nrjn4~+w6(`;-M!vVze5yOW+!P>-G(x{nTJ_Oj=RFR_o^i@?bzJ3AKhe2 zyX7gyH$#qp18RnRw_%KJUUlL%Punh7&9S$L0Z+>lXE;gsITcDyPAa@FP6HF6`kf-# zJx-Tz_gr-hd~qD#)|_Ox2gAU1B>q@giKWe%K5QMm9Ps$fhL3s>7q61$!$FMCD<0e2 z_7RD*(O^l=I0L>M3C@1e!!v&)!F{*O3@aaG=mMLe!ShS_zlwmsi!-it7yuv|@9E6` zr?feno7$Mt|NQy$Wglp2N8+<%_|kvpM?63J!L~k#W>?kcT0d-yRwF0%(p3BMbt!I2 zd@DXWBzg9j5EaJ6M6%GznSvA)63h2|ely~1+1pp1dAMGAz)!=b$`c8!Z$<%xN1=Ou~-XBo()=TC#m;)c-!^#elU6gO1H~+ zpI2UVL_XbbwL6t;Lvw$+>urOiPY-O-Tk4=ukdXAQ3Zc6OT2>t#K4&s??t5-`qt~uC z5ViffKSb4afP&%;R+=NNP=m$`poKik!8(JIL1NbvaS9+w8-R!?Iy%uM z6T%<37iF4o;H4v)P?kxV#5W$Xaj761)2H1@7BD<8T*-~>7oi9wn6*A4>2)?qCWI!A zFjE^LLv}e3zXK>?aH^+NbzXhs6x!hKhUmfX@(D5^T`WZCbU{&1SIQtd8|10(J|i*P za@QGy{~~27aEl}vE8$)8Ia9&)aYfO!MJzL*U;(K;JhcJch)|iElEoYSh`(r2mnF8+ z2^k!}HzD~Aa>p8Glt4SOm`v_fV_p^pV>)_OUdRHsUk#P3B zN>TczB`G_?D&qnLPNPMj3L&N88am0Bdz4{=0DZNEF{)7+`6gy#g6aDbjl-~0_yx-= zhS>tnC1-1iIcz@9s*ia7<`aR2El_7gdKAJy`rYf7gBgq?m~%nNJ_uy9MJ4-P6-8N zQR-F`AaO=}uG@5LMfAhlWK~ySu(-x(*_Q8htbs{P7+N^`&Sq|8YIQVub3#oZb>@mCY!pXu!8JC zQIzOBXr8k`wB6nBm>7Ih&-c|;?=L!QDAI%*uewg-ne)y!@B%T;_f2;@7+3A@l;zqu zDeNW$0WR{KMS}_y1*r9KKin%B3EU{ zv!B7IDm`kElQNnTQqr$ENmpQJmoTHT`M#)=`hzXd=3CP=YqAz>xMe!IT#Adnku!_#{OKnAGz}sYVk7-xi?i>>3D;iNzou&3f zn)=)1fL476LdYDaLbYA?(qXysv9kKxXO#;U7^#Bg$~)76o((HVcVe}EGcL%OvsUU* zmD5%jmYYPc-GK>tE9O{xdifKVdxv79Rx86vjAQ32d`$ZOUYM1KeqgQo=M%NjDdM$o zu$l!6002n8shN|rhqdX?7J5TR&~AYZLLYM>CgJ%6Yvq!_&JPgKYeCZmK0bOLEL_DZ3Rvt{2 zr@%*pU9YbQ7-Aox>n&g6lmtR1M>#M6rz+_~wA58e_MnaXNFi#bFe5;)L9zUM;?A4d z=eR;D0mOm*YHt%qVqJJ0-}bxZKrx9!ET+VbxxL2dDtdh=Z$xpz~i{BFDjcYI{;I_{+pBc)}hW}+-#y4WIH z5#Z!3P_BhuOc;9yJp@Bj$)KY+(8Xpx+c0G?xf1XM@K~|!h*u_J$H1~u;CGY1gvWet z1o6#7_S+AMI``Y{w9*wln#a3~+l5R&!)VHw*tQRib8BsHuTyjX`S&Q?xQj-80@(x@7yO+>vhj8;i(w(W8Z$%=|Is`d_ej;BO-Ro=Y$V*^+ zUdX3?# zTrqFomuwSDwc5${+YoryhPxHS? zV8HnFbxn4NLp0jH&YLww&PEU=YXxqajI}eC**o<#4z26*SF80-i&wR2zdgwg<7#U1*7bV7pur@I+&051|HM{SmDobo z9vz{7^pZiwjoIT1C&GpG{U91|Dc)8q-jy`X zD%Y%ai=wGD%EdWZcDXw+H&^wxE^6{se%UFlW3NXDH(BV%!}b24p)-aIYs3eh@>CN0VVy^ zX~rJDGyAwQ)fyp3+Bawz#~*_;%7QZnxAA_nq_O$wKJ+ zxw?D(V>vw@yW^L9OFll{v)&xnR_ESlEA4mNes_1<>y!K$?bd7y*u`JE&O_hRFC1QF z>a}@3{4hN~Ji6XozZw?4(dXmm^J!Tqc=WzGoI1ZM99}A1%CghfPjB<}x!zk?y6=+I zTrDgVw&d}B@P2fd^uGIX+c4Z!|K_aj+Ot7+=J9Ux;kH)o_VP5&apfrE;q>m zLoe#n{rj2QL;aQg&K%u3jXYec zd_O!h+;_O8%(S;5YS>X38~gY=xGh+(Fm;q$Q1Sd|{qiAJ*7*ElKlJ_dZkoy3<3Rz{ z%R(x>P0j=3^vX8o!>!$(!r|?fm3CXZSC0p_M}D_8vgqwT9uLd+`ksmrGh2o7eyr@H zuijJbD(UHAya&fVmAc^Zac#k;x^cqF^J?^L{+QpU-J8S1>87T!=1{+f#v63S9~>wZe}>~Xs5B+n0bt5mpA&z#vDbnBaHOvKyO zFLrp~;w$%az_rU4xlxzW(P`y5uN*?P&4-@jE&X1Z#O>p8^Kd^`>{A^3`iI{00>5)* z=fNFV`csSNjgFWFus0<71Xdsmy+KjZuV~)-ZO|`t_zRnhB4KY;b+5VZcdmD9=#nZv za~+prb!5-vBiuT-*Nl$ne=gpu7na`RqIZ<6JiXh2;hW0W;~8Tr?7JK+uDDza_=C!6d2e*6#LwwK+9heyt9@*AH1@EA zS$De!iuF-eRqEdS)i}_nUVmX5Tb#bzXmrk0>Qta|^I&I2H2HkamlJ!x!#bAVle#%- z^m6dW-9i61{z+9Go*&rJ9y@B~(l^%ad85k@+NXXM(#`H!gkIkVbr0CNCnI2QsgqT2 zCt{CCoLMu|W-FHKUU>J6oJWUi&h4hWtVbSkk;Hy+dF{6$+uc;LvlgJnd84+Wqwahv zP^zQi^_ZKik$l-Cy_0)<Z#|sq?Nrn9gFpIAh|R z*kNxriG;oOAn=5@JEJ|{yl!cmJf^10are{u?6%k@ZL@5146dr((^2eQ^gxx(>s#GZ zkFH($9+y1Wo@N^TrZb;?IhE@SmNr~kOHc%fg-&zCceQiQHoJ%Qk=+gPbPF!Wn6X#5v3$o4e8L$@YHw(VK#_EcxL(vnF@|shyv{d)9?+3+NvLHc8iTc7X_>m^ zYB}F~b(TuQeXzmM`MM@V}*afDo)vI?v^V>6Q)IzrbSbxMN?mCUEsGl zohs?pjO^Bq?ADF!USZ$b>scL~xy9`fn`Pq+4aXdOpJ@7u~K)gp4I*4PCfm#ezN8BF0lOu2ejsjJN^rI+4 ztO05#Q=lrel}G(8QR$S_#(cfV?s?VXz*?s0T9)Wqw&+@p=vuDmTAt`yzUW$k=vtxZ zT9N2lvFO^~rmuEUc%>Toh!)wh7TJ*&*+apLl{4wr$b~O1nb2Zs(UNJ=GU=}lRnZIS z-G*1^*_NaUmh0cm0&Sq9;ZjlSNX(Nv>TFb;Nq0VgSNO|#Ps~unwKrWwIHLB1owCsD zaJHl$MHr$DusV4HMWF}b)KJSvi>B7jE2jjzTieiC9Y#^AM^S#L?`PF;n2UwK3;E6{ zCBuT(sDX|jE#}R_j%Sp&Kk3LcQz&9oxUZ}@$447KXWyeN+^r(qJ@x(k+v3ui)y=By zDSToZrQFqUD7yu*t1O-%X`mT&Iov!sgDf8A5}fDHRUP%;dA2z>-v$(M?VJkl<}XEq zrA2!|i-t|RSJld4p$ZP24>AUSxfB6Vf(Iy}s|`Z6)t~tcuvqvBz^An_!T{whu2|3Oz`{&9A1FjIX8> z8rwcd4AoIrPhJ!w*7<0Wv@`^U6}#HevfA2VcDJ$KcdwmL&~{fylA4Q*MP*?Mwm=t1 z=H}oFRz9t3)PaJZOmQ%C;VMWQ!wm>JZJ^)76`&50d=#$=Gr;Yn4s?MAYI#2Zxxzla zO~U|t!bZhHh~h8?UVKm($H9wHuFZtf`;pU4ZfS=JpAMChMOYb;wZi=grOoByq<&Yb zutv)km5Rw_2n3^Kthdh(Ms@vu6x$QK>i%7#bbn72c>VW@`Wu9J7V^i!eCnmMcm2bH zo|d4naPWePZ0=-I#~iWq0iy4P~VVhh*rg9 zsYQ;qtHGk45B24*We^)>5}#B~3z|BNMWG=e?HVV3G-t7|reMR1{$buQQB$)Z72ZAM z499fbX;gTtDa*+~=(y;&LqlIL`J8o%2slN=I=z@y3T%lLUD}rHu_Go}F5(6*$P3~T z$;M$xXotB&rMT9$CBH;CZ)=_~xr8tN#)@6H1Z3E981eP6<;!BPb|+}t z`IGy~6eiaNS336c6>!7~P4Hf>eJ;UeuhDd`Ni&$$Mb|fd#8*S-&T$NNm{vUJl0RZ8 zy5VpcU=dg+FfU~7)YsIEGlg!H#vRlArRaALVVWRtgBAm21PX|l<2d^vP2g)FHG}e& z>GYXq76dFy_ic(m8Z!$DE*!a@`=0nvw**C(&C9(4tg{!c#WkDIB zBNh2Dn?sJh=eaN+t>A{?Ht;rJOb{Irm>^ODhXl5W5aP)DpPL{hXtj6`9As0G0H=yT z>OmllAdqGd*PF^^ybq~X3Ykz-dbvt|NJ>FSIbFN{X4g`)nIlC5NyWqUJs|T^<|z?o26M@&aOhGV9bj2yb=at+WHlJTbpBae_OhIoYtqQF&dz4MX__u&1vmh*UzyKg zz5snM(QV-%a&))qtL45}V_y-r5}ybzcs7A$q|H6O`ya;&|7|cxwKf<}rMOZozqff> z>>AmsxS;~bST!18S!rd1s1l@Wl}zmg()@a>tBtIh;;No@Um=^Wb?A1e1b#0&^HZV+ zt#TKw^5DIfO|g2l6?UH>vfZIObkXNqGlEAwZp+lM#Fav0aiFO2lVdq@|9KJ@E0920 zQa(>%*(+0Y(U5Kf-_`O#R`JrcGS0#~&}va>n%;t^W}Q2p&v9yD>nr&QDmxn{*2RYU zoy7{;vK(L}Iw?459-q7K#Dq`F84PD)^5A6=@@T>7Dx2&n%0O9|cK~6EAu-ILq@wn- z_9OMjo?j%ydnP9oK^ouN?f^0A5>0oGSVOw+}r5G>DcW@9YO$FoGx+c^#|Lt6yY zy_=nmars$p+W$ehP4`0NbH&eFs(rZG)4~UWG@paGj-r!IMm>X$=O>>(7d`b*^Nz=JP^Bf*8cN zEBOb%BWUK&&{S;0m_#WyjQu14P)g7nfuy3^K(q4hyP-mgp$7`9w!q?AwVAT9;uf{S z2d(L1oYI%t>CM)f?M7u>HZFTW)4h7rIlHS`2F@h27{}sm*Rp0`i{6rBwZakoRQzWb z%Q31~w91dPlb8l66#U>Or?y>++icPMz$|66=8&H!t0R}t^kV2K zi{VdMl+}qTXp;Q|4qTdhvGmHhnePy-aZ@<<3Z|#K)iLPE9q$j0Vk}3J#m=Mbu47|S zC;G2gV0zou4_)bF8*RBdgUj?DNP7^ZI|$MrQgJE)1I!xDV5Vs_q0iAwn@41 zvCzYISzM}6A1bYAk*gdlKChTmeaq(RvNHWMR^PaE_YZ}J{N_d#-%dpw-(SFL3H%{6 zht8i=yPhz<%TXHgZ>VVnQsuLWD>|i;_92Db2RtiwhY~IkT@uzA(4Ml3Xx>9An46Zm zuceB5J_9!qQ}4$=B3_g~5rKBgT3IT{i65`jz|y06X4Y=4q;$4BmaA0Fo5s!jPy%m^ zMNo^#hPWQ+poWy|DP(Q6UWWHy7MxaQ%R;w@NGTmx%hxH*_Hd`N=6!aDJ#c`WX+Aa| zusck*l;D)=-O7G4p0aBXS0~Ud{V1$^l|E9v*Lv*yl3)4ioJ-xUL~cpr7w~=vb6Mg`llKFHr*#dK^_hq6u;h zKr^sRU|Q%Pq5{5lNuknUuk6@4;}YEL7b?#be-!4uY}hAQcuLppf=i5Q!~LOW@p-zQ zLqfTcp39OOS6|8b=Sk6R+nE87pI?jKo_FEkY=j*D9+~#3I;~LQIvGC8ZyfzY!MG)U zLUPp4_T*oP|MZq5TMkS-n2ORU=Qyf_LF7tKx>mWZ^HwT*PwJ7^#R{BlN8g5LeIg?H zh9}vlk*gVafAs{NBkfx|`5H{WvE8uSb9cG2&-lmMPlEBY2eIno`kA1X|3p@!gY@@G zEMj0(e`o0Ek}j>ia>e4N3ZSAMSXhxh;909Ua{yg?B##=WS&e?U< ztcIBOAq^(sC-JhsNwd{(U8=HfF`RSjsyPiY-9}R0pL}a|do1*RhWviDb_nD%2=W~S z`3*Wl{v~(cjHd()+0rq+BmyirG;T1mRa^9tTdF=I)0~APoq*YJH(-m36wM1-0*&q~3 z2LpI>K9i&Yik^ZvjR#)?Pn2&B35W)Q^jxG_h*Qyq!?r{aa>&Oc%w-eN1Tx~K0W}8= z(ty31bvlTmeU+g!SvUBO>N(eB0LXM5>}}!nE%a*_K8SvhZzce=3wZ)hG_!{0|E3Zm z8KALE1rf{$F~L4Z5D(x6?jLd~1{FzyNGxfX;008Zi^M_dCTRX85N`>TSkX+-1Vkwy z!g@s-M1Bd*ZskRy{&^Cg=2y4EIoqz96*dU!Ub8+MNR=HfOmH&MvxJgu8sHVO2YVNw zi^hsC=paP4(Xs-I@97|@otptVkUPLx=pq9Tq*-W%^!sI1Q%rb!5NGq6e9Y}qn;eM9 z5)BwO56+cA?_XuD1|GmNt+e&h-&}}=JQZ~~97{wx2Xj32HMu_zX)?fM&h9A|ec)Jt z$%#Gf2+iNP_7EJb!Cr9YOs*#REOh#$~#Ru1q2Ni+V^ zfU@&Mz!z$?Z$-xLyJ@TO00E?uR1w;odN5L6uWWX_RMd}`1%UAEdx@>0q359El-MBr zd$qn&094RR3PhN5IL8CcCF@AE(DT7YUBE`~UBMW3T?D(69^p~DO9#Qhwg8Syvvn)j z9gt@xAb*4skTQS#7dR&OuZn=?*mKvrar7huCse zaB9Xhr01ahErq83ffW-0j^%U^{WU932#o{wj2LJyvUE~8WNrUOH z99+{i(-LvA04h^-fO#31V+2^UEu~mUQ_*R|l0;~7SQVxGBbWm)-+(X61{cil>=OUq zWfxU40SC366E_GB8x{G&4B^)-VgFO$e#33DZrJ_w#C9>m{|}Mr(ai2b2NXu{?W%u> z0|>~L{9En?W4MSyMK;__#3|?5c!IfT9fcH_MlGAk7Qn%2wr(7Mq8EGX|3VY~6@a7Q z`F{Ge-ETdiXDU6u^tB$3$%um z0PB>1F)g_KOW;-i0a8kkCs8`}Kc&k4Nje9k|KOl~)BhF+{Vj9Y0!aV!w29IEUS&^0 zx%otkVByT7`)|qB-*VLsutfP=xApm#ZVOeHrUsR0^U7RiigrBM{2$mb0`Ss6x&0m% z0#v;I5Cqmpr$<46%U<&%kw4ePk{^mdI@d8jT$Wth)hlQPH|0|;a6#uY* z-I_8(4nBQ{7(64fe+AvYR~F{KRyDSY>c1{_fspk_-IM-JD^UNY6<+ASH-L$4@P8o| zJY>m-uIvyX)2=01aBJb{hAyDXwzLGTkZj}j^y~GfUt6}d!@qWUpzxPDyaKBS9Uv3n zNP9%_)C9Vr`@3Y=LIywaw8qW}bcaLk%`=7HyTJdxWB^_!47xsL2mfa?(e#uuaC1>K z_|IMPzhcBEN$+~XaLoTBhU5ML!%x}?7B2zada#zd%(;VsU3|d@A(buL3S9dq@EcDIoNC{pPIehg%Mp==uE~&wfG4wZ75J0= zWAmHut22Fvm#1kDGs)n~Cx(?z^^5Pe`})csLP6=)_3eIsr}syGc(sD>mbPr}1{%_119SoF#qQH-xBi?GL#eB(DKI+KQ#r z;-i~ft%3nAGVs%N&mBQQqNQtRBQjvJYekN# z^J9zpIz(kPW7R&%c=U<(hv270FKzkWiv1j0#@>@_r&nHN24-hJCh&i3PlF8~&yd%u&4DSN=qhuR>ntWF{u}EcrBvi3%mKkPR|O zN+&2KjFo=3!MQ8-gL8Y`zy9M9rBXUJ5?(d|_Z0dyllLWYgxy~vZ^m8w2RC>y=KvW1 zp#1I9CwuV3o3p8-vZ=H4)94%hFOM1Nj4W&q)JK&k1u%SV#!>HjGQYW>Db0VSH*8ES zU@)Agpa@vq5vpeqmSB>!)F!Z7Oh4UO`PLZ(%j0o%Fy7uB>DwZiPy5XuqzLQwwzkF2 zZRPfI)2q@V1#)deS%fQtxF@lY)>8n}GpbqQ97h``U7ZQNDNWz}M(>E!l$k}+&USRE zhD!L#f;&yLJ$-mpv!Ka|RmYe3{Yz9IEZOfX3e&1i{ZTn=Y_F8q&p8{IE^fLE&)+5; z6+}WFnsd_PuA4rT-dOS2r(7-enAO_az@1EjzP4tmib#iJDM;7BeBLJC#}rX|S*xi; zG;FLcdh}Je272zz9?1txIsnRBWnNtLx|#3od;&Huf{2YjhH1qrLZVv2X{nhVhuT`S{rFK2|(LQQ&yYBkN@ zV{t7;Y99P}xtnT;YdRGOaq#|mMt#bDH?QT7RS2izwHCTaP79=_zQvxBhEUbm_Y=rE z%lRSG0F#&3w%XLH&Mw&+2RY%Bz8Y6Ha{I*lq8vl?aseNxa>_aLm;KbWn=5>8ZlwI6 zG41S72y??7gMHEN3G0kmUf@=IoEEgAHEG4+v`=|ngnFoiaDC#B)62X=C?S;c%E!`Z z8*z(o2?$2-rE3f!8yny zx{pUOKeS{*9o$e52sgrz@7PF5wYu-wriv+=nu8JPjfSL2DFgX&n4}T_nUdV7H66Q- zsN5t_;RK)tb7T|dY(|L-?sh>xJ+mgb@h|o*8)76^5hORc;TzntQ7yY1t6!LGI+VHd z)^r4H%r!nVj{rPmMSR*5^Vz+bI$vPhV1I5JF@5&x_Wsz1k#B%}FpMFl(V>G6eN=eJ z(f~6^roU2s_gwrPeI4WD)lD+*^)FnrS5E1_4#)#`!Z};F*b9;bqm^+w03~lG1za}-w3%R zyA$4Jc&4R1&K!>#M^4Hb*J2qlEn`}94QRs1-A**RbXKTghf=h3#A1tIcc1P^3Vb zY#ziG0XDJ`t-F=6iTxOQ-OBm^|9lRFPQ3CsTdHD zsE?gIgv?inP^bR2Wf1lpPD3;LsdAq0d9P#@Y^A?c+!!s&Hb1BFt3c7iYUaln)DnHY zi{y&1g49iZ$TUx9qDRvZa@KRMx0CVc`D5MDlV^Z`>w8UZ%D2jP%?I#SM86GyKtR%h z$EN>!tD-+L_{aJe8y6`^|D%C_+(hM%1E1DHaGCtwmMXs<_>UV){QZGL;E|Mnz0Jh0 zc7EM$;7?1B;N6&h*?ZvEgMXbR|MOrygr5ih(`5Ot7Ji+H{nNrMSf+pf_y5&|?5_rY z9WnjW;5>LU1+c+i2Tp%AF#5|>&z}a0uzq_@f1C07_0V50uKx2-9WW#Q z{9}jwrwssLi5~#?r+)d@!+&ja{xqO2^wWu7nw-CEdVV$fkKFyINdRC*^zVH7oyirX VpMfz503d?DD8Mi-mUw#f{{gi`Sz7=A literal 0 HcmV?d00001 From 1493d0c6968e38d5945bc2bef76f59d2495c2da9 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Fri, 27 Jun 2025 15:51:33 +0900 Subject: [PATCH 043/259] =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 126 ++++++++++-------- 1 file changed, 74 insertions(+), 52 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 6b45dacc9..e5c9241d5 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -1,6 +1,7 @@ "use client"; import { ContentsDiv, + DateMonthPicker, ScrollArea, SearchDiv, SearchFormLeft, @@ -31,7 +32,7 @@ import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bug import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal"; import toast, { Toaster } from "react-hot-toast"; // toast 이미 import 되어 있음 import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg"; -import { useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // FieldErrors 타입 추가 +import { set, useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // FieldErrors 타입 추가 import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; @@ -41,6 +42,7 @@ export default function PublicReuseFaciltyInsert() { pbnst, searchFclts, pubHasuInit, + pbnstInsert, pbnstRegClick, pbnstRuseFcltUpdate, pubHasuSearch, @@ -50,8 +52,7 @@ export default function PublicReuseFaciltyInsert() { const [currentTab, setCurrentTab] = useState("mng"); const [isRuseReg, setIsRuseReg] = useState<{ isModal: boolean; - data: pubHasuType; - }>({ isModal: false, data: {} as pubHasuType }); + }>({ isModal: false }); const [indexMng, setIndexMng] = useState(0); const [indexBiz, setIndexBiz] = useState(0); @@ -60,7 +61,6 @@ export default function PublicReuseFaciltyInsert() { const [selectRow, setSelectRow] = useState(); const [pageNation, setPageNation] = useState(1); - const form = useForm<{ items: z.infer[]; }>({ @@ -88,30 +88,32 @@ export default function PublicReuseFaciltyInsert() { data.forEach((fclt) => { bizs = [...bizs, ...fclt.fcBizs]; }); - const pbnst =data.map((fclt) => { - return({ - pbnstRuseFcltPk: fclt.pbnstRuseFcltPk, - fcltCpct: fclt.fcltCpct, - ruseCpct: fclt.ruseCpct, - splyExtraCpct: fclt.splyExtraCpct, - rgtr: fclt.rgtr, - mdfr: fclt.mdfr, - fcFiles: fclt.fcFiles, - fcOpers: fclt.fcOpers, - }) - }) + const pbnst = data.map((fclt) => { + return { + pbnstRuseFcltPk: fclt.pbnstRuseFcltPk, + fcltCpct: fclt.fcltCpct, + ruseCpct: fclt.ruseCpct, + splyExtraCpct: fclt.splyExtraCpct, + rgtr: fclt.rgtr, + mdfr: fclt.mdfr, + fcFiles: fclt.fcFiles, + fcOpers: fclt.fcOpers, + }; + }); await pbnstRuseFcltUpdate(pbnst as customPbnst[]); await pbnstRuseBizUpdate(bizs); }; // 폼 유효성 검사 실패 시 호출될 함수 - const onInvalid = (errors: FieldErrors<{ items: z.infer[]; }>) => { + const onInvalid = ( + errors: FieldErrors<{ items: z.infer[] }> + ) => { // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. const findAllErrors = ( errorObject: any, path: (string | number)[] = [] - ): { message: string; path: (string | number)[]; }[] => { + ): { message: string; path: (string | number)[] }[] => { if (!errorObject) return []; return Object.keys(errorObject).flatMap((key) => { @@ -136,7 +138,9 @@ export default function PublicReuseFaciltyInsert() { if (itemsIndex > -1 && path.length > itemsIndex + 1) { const itemIdx = path[itemsIndex + 1] as number; - const facilityName = form.getValues(`items.${itemIdx}.ruseUtztnFcltNm`); + const facilityName = form.getValues( + `items.${itemIdx}.ruseUtztnFcltNm` + ); if (facilityName) { prefix += `[${facilityName}] `; } @@ -144,7 +148,9 @@ export default function PublicReuseFaciltyInsert() { const fcBizsIndex = path.indexOf("fcBizs"); if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { const bizIdx = path[fcBizsIndex + 1] as number; - const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); + const cycle = form.getValues( + `items.${itemIdx}.fcBizs.${bizIdx}.cycl` + ); if (cycle) { prefix += `[${cycle}차수] `; } @@ -156,12 +162,18 @@ export default function PublicReuseFaciltyInsert() { }; useEffect(() => { - if (code.sggCd.length) { - if (searchFclts) { - setbdstTable(tableData(searchFclts, { code })); - } else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { - setbdstTable(tableData(pbnstHasuRes, { code })); - } + console.log("bdstTable ", bdstTable); + }, [bdstTable]); + + + useEffect(() => { + + if (code.sggCd.length &&pbnstHasuRes.length > 0) { + setbdstTable(tableData(pbnstHasuRes, { code })); + // if (searchFclts) { + // setbdstTable(tableData(searchFclts, { code })); + // } else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { + // } } }, [code, pbnstHasuRes, searchFclts]); @@ -179,11 +191,10 @@ export default function PublicReuseFaciltyInsert() { }; useEffect(() => { - if (pbnst.pbnstRes&& pbnst.pbnstRes?.length>0) { + if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) { console.log("pbnst.pbnstRes", pbnstRes); form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) }); - }else{ - + } else { console.log("pbnst.pbnstRes is null", pbnstRes); form.reset({ items: [] }); } @@ -200,11 +211,9 @@ export default function PublicReuseFaciltyInsert() { const appendPbnstRuseFclt = useCallback(() => { const selecTableRow = selectRow; - if (pbnstRes && pbnstRes.length > 0) { const lastPbnst = pbnstRes[pbnstRes.length - 1]; if (lastPbnst && selecTableRow) { - append( pbnstRegZod.parse({ pbnstRuseFcltPk: @@ -220,32 +229,37 @@ export default function PublicReuseFaciltyInsert() { ] as fcBizType[], }) ); - setIsRuseReg({ ...isRuseReg, isModal: true }); + setIsRuseReg({ isModal: true }); } } else { if (selecTableRow) { append( - pbnstRegZod.parse({ - pbnstRuseFcltPk: String(selecTableRow.bscFctCd)+'1', - ruseUtztnFcltNm: "", - regDt: null, - mdfcnDt: null, - fcBizs: [fcBizSchema.parse({pbnstRuseFcltFk:String(selecTableRow.bscFctCd)+'1',cycl:1})] as fcBizType[], - }) - ) - setIsRuseReg({ ...isRuseReg, isModal: true }); + pbnstRegZod.parse({ + pbnstRuseFcltPk: String(selecTableRow.bscFctCd) + "1", + ruseUtztnFcltNm: "", + regDt: null, + mdfcnDt: null, + fcBizs: [ + fcBizSchema.parse({ + pbnstRuseFcltFk: String(selecTableRow.bscFctCd) + "1", + cycl: 1, + }), + ] as fcBizType[], + }) + ); + setIsRuseReg({ isModal: true }); } } }, [pbnstRegZod, pbnstRes, append, selectRow, form]); useEffect(() => { - // console.log(" page getgetvaslue ", form.getValues()); + // console.log(" page getgetvaslue ", form.getValues()); }, [form.getValues()]); -useEffect(() =>{ - pubHasuInit(String(pageNation), "41"); -},[pageNation,pubHasuInit]) - + useEffect(() => { + pubHasuInit(String(pageNation), "41"); + }, [pageNation, pubHasuInit]); + return ( <> @@ -278,7 +292,7 @@ useEffect(() =>{ size={"sm"} className="" onClick={() => { - // pbnstMngData([] as customPbnst[]); + // pbnstMngData([] as customPbnst[]); if (!selectRow) { toast.error( "하수리시시설을 테이블을 선택하고 등록버튼을 눌러주세요" @@ -291,6 +305,7 @@ useEffect(() =>{ > 신규등록 +
@@ -300,7 +315,9 @@ useEffect(() =>{
- {/* 높이 조정 */} + + {" "} + {/* 높이 조정 */} {
From 1c603efc6232a5e05742443195970fb00c901d5d Mon Sep 17 00:00:00 2001 From: YangJinSoo94 Date: Fri, 27 Jun 2025 16:51:10 +0900 Subject: [PATCH 044/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EA=B9=8C=EC=A7=80=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 3 +- .../app/store/matDmd/ruseCaseMng/headList.tsx | 121 ++++++++++-------- .../wr/app/store/matDmd/ruseCaseMng/index.tsx | 2 +- 3 files changed, 70 insertions(+), 56 deletions(-) diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index 5e4bddaad..63d0f662e 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -23,6 +23,7 @@ import { useState } from "react"; export default function RuseCaseMng() { const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); + const { ruseCaseMngList } = ruseCaseMng; const [selectSgg, setSelectSgg] = useState([{val: "0", text: "전체"}]); const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); @@ -147,7 +148,7 @@ export default function RuseCaseMng() {
ruseCaseActions = ( set((state: ruseCaseState) => ({ ruseCaseMng: { ...state.ruseCaseMng, - ruseCaseMngList: data, + ruseCaseMngList: res, }, })); }, From 6487b3c11efa71474c43139d18bdfb9e6618059e Mon Sep 17 00:00:00 2001 From: mind-one005 Date: Fri, 27 Jun 2025 19:03:15 +0900 Subject: [PATCH 045/259] =?UTF-8?q?=EC=B5=9C=EC=B4=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/index.ts | 4 +- .../components/popupComponent/MsSwagePpl.tsx | 1 + .../popupComponent/chart/aplcnYms.ts | 46 +++++++++++ .../popupComponent/chart/infilChart.tsx | 79 +++++++++++++++++-- apps/sn/app/components/lib/utils/date.ts | 12 +++ 5 files changed, 133 insertions(+), 9 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index a17d2a0a8..03edf7d7a 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -20,9 +20,9 @@ type LayerContentMap = { // 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업 const layerContentMap: LayerContentMap = { // TODO: gis데이터 추가되면 추가 작업 필요 - "하수처리시설": { component: SwtrmtFclt, }, + // "하수처리시설": { component: SwtrmtFclt, }, // 하수관로 개발용 - // "하수처리시설": { component: MsSwagePpl, }, + "하수처리시설": { component: MsSwagePpl, }, "하수처리구역": {}, "우수토실": { component: Ssc, }, "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 43f70de24..7d6e45d34 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -1,3 +1,4 @@ +'use client' import { VerticalTable } from '@/components/ui/verticalTable'; import React, { useState } from 'react' import InputSection from '../InputSection'; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts new file mode 100644 index 000000000..695c13560 --- /dev/null +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -0,0 +1,46 @@ +import {useState, useEffect} from 'react'; + +const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { + return yyyymms.map(dateStr => { + const year = dateStr.slice(0, 4); + const month = dateStr.slice(4, 6); + return { + text: `${year}-${month}`, + val: dateStr + }; + }); +}; +const selectAplcnYms = async() => { // 상수사용월 + try { + //const result = await getData('v1/inftwtAnlsRslt/aplcnYm'); + let result = null; + const res = await fetch('http://con.mind-one.co.kr:11083/sewerage-service/api/v1/inftwtAnlsRslt/aplcnYm', { + method: "GET", + body: null, + }); + if (res.ok) { + result = await res.json(); + } + + if (result && result.length > 0) { + //setAplcnYms(convertToTextValArray(result)); + console.log("selectAplcnYms", result); + return convertToTextValArray(result); + } + } catch (error) { + console.error(error); + } +}; +export const useAplcnYms = () => { + const [data, setData] = useState<{ text: string; val: string }[]>([]); + + useEffect(() => { + const fetch = async () => { + const result = await selectAplcnYms(); + if (result) setData(result); + }; + fetch(); + }, []); + + return data; +}; \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index f82184db8..7e6ba39b8 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -1,17 +1,25 @@ -import React, { useState } from 'react' +'use client' +import React, { useState, useMemo, useEffect } from 'react' +import { SelectBox } from '@common/business_components/ui' import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_components"; import Modal from '@/components/ui/modal'; import { Button } from '@common/components/ui'; +import { getData } from "@/components/lib/api"; +import { useAplcnYms } from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, closeModal: () => void, btnTxt?: string, } + const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { - const [popupOpen, setPopupOpen] = React.useState(false); + const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 + const [aplcnYm, setAplcnYm] = useState(""); + const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); + //const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -22,7 +30,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp } setPopupOpen(true); // 팝업 열기 }; - console.log("btnTxt", btnTxt); + //console.log("btnTxt", btnTxt); const closePopup = () => { setPopupOpen(false); }; // 팝업 닫기 const chartForm = CHART_FORM.LINE; const chartData = { @@ -50,6 +58,47 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 return `${year}-${month}`; }; + + const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { + return yyyymms.map(dateStr => { + const year = dateStr.slice(0, 4); + const month = dateStr.slice(4, 6); + return { + text: `${year}-${month}`, + val: dateStr + }; + }); + }; + const selectAplcnYms = async() => { // 상수사용월 + try { + //const result = await getData('v1/inftwtAnlsRslt/aplcnYm'); + let result = null; + const res = await fetch('http://con.mind-one.co.kr:11083/sewerage-service/api/v1/inftwtAnlsRslt/aplcnYm', { + method: "GET", + body: null, + }); + if (res.ok) { + result = await res.json(); + } + + if (result && result.length > 0) { + //setAplcnYms(convertToTextValArray(result)); + console.log("selectAplcnYms", result); + return convertToTextValArray(result); + } + } catch (error) { + console.error(error); + } + } + useEffect(() => { + const fetchAplcnYms = async () => { + const aplcnYmsData = await selectAplcnYms(); + setAplcnYms(aplcnYmsData||[]); + console.log("aplcnYms: ", aplcnYms); + //setAplcnYm(getCurrentDate()); + }; + fetchAplcnYms(); + }, [aplcnYms]); return ( {/* 분석 입력현황 조회 */} @@ -75,18 +124,34 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
{popupOpen && (
-
분석 입력현황
+
침입수분석 입력현황
-
상수사용량 정보:
+
- + setAplcnYm(String(value))} + /> +
+
+
+ setAplcnYm(String(value))} + />
오수 전환율:
diff --git a/apps/sn/app/components/lib/utils/date.ts b/apps/sn/app/components/lib/utils/date.ts index 9319d7013..fe717301f 100644 --- a/apps/sn/app/components/lib/utils/date.ts +++ b/apps/sn/app/components/lib/utils/date.ts @@ -11,3 +11,15 @@ export const yearOptions = Array.from({ length: 10 }, (_, i) => { const year = new Date().getFullYear() - i; return { text: `${year}년`, val: year.toString() }; }); + +// ["202506", "202505", "202502", "202405"] 을 SelectBox의 옵션으로 변환 +export const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { + return yyyymms.map(dateStr => { + const year = dateStr.slice(0, 4); + const month = dateStr.slice(4, 6); + return { + text: `${year}-${month}`, + val: dateStr + }; + }); +}; \ No newline at end of file From f5d8f8fe233f6cace257ab04710449af11d6e478 Mon Sep 17 00:00:00 2001 From: mind-one005 Date: Sat, 28 Jun 2025 10:57:35 +0900 Subject: [PATCH 046/259] =?UTF-8?q?=EC=A4=91=EA=B0=84..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 46 ++++++++++++++- .../popupComponent/chart/infilChart.tsx | 57 +++---------------- .../popupComponent/chart/inftwtAnls.ts | 0 3 files changed, 52 insertions(+), 51 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/components/popupComponent/chart/inftwtAnls.ts diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 695c13560..174cd4d7c 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -1,7 +1,7 @@ import {useState, useEffect} from 'react'; const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { - return yyyymms.map(dateStr => { + let yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); const month = dateStr.slice(4, 6); return { @@ -9,6 +9,8 @@ const convertToTextValArray = (yyyymms: string[]): { text: string; val: string } val: dateStr }; }); + yyyymms1.unshift({ val: '0', text: '선택' }); + return yyyymms1; }; const selectAplcnYms = async() => { // 상수사용월 try { @@ -23,7 +25,6 @@ const selectAplcnYms = async() => { // 상수사용월 } if (result && result.length > 0) { - //setAplcnYms(convertToTextValArray(result)); console.log("selectAplcnYms", result); return convertToTextValArray(result); } @@ -31,6 +32,47 @@ const selectAplcnYms = async() => { // 상수사용월 console.error(error); } }; +type InftwtAnls = { + inftwtAnlsSn:number; + aplcnYm: string; + enoCd: string; + ctpvCd: string; + sggCd: string; + swageTmplntCd: string; + swageTmplntNm: string; + swtrmtZoneCd: string; + swtrmtZoneNm: string; + atflCd: string; + atflId: string; + atflInpNm: string; + atflHrPttnNm: string; + atflMpngNm: string; + atflOilqNm: string; + atflNm: string; + drtwSwtcRt:number; + anlsInfo: string; + scsYn: string; +}; +const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 + try { + //const result = await getData('v1/inftwtAnlsRslt/aplcnYm'); + let result = null; + const res = await fetch('http://con.mind-one.co.kr:11083/sewerage-service/api/v1/inftwtAnls', { + method: "GET", + body: JSON.stringify({aplcnYm}), + }); + if (res.ok) { + result = await res.json(); + } + + if (result && result.numberOfElements > 0) { + console.log("selectInftwtAnls", result.content); + return result.content as InftwtAnls[]; + } + } catch (error) { + console.error(error); + } +}; export const useAplcnYms = () => { const [data, setData] = useState<{ text: string; val: string }[]>([]); diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 7e6ba39b8..5d1d5bb42 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -18,8 +18,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState(""); - const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); - //const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 + //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); + const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -59,46 +59,6 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp return `${year}-${month}`; }; - const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { - return yyyymms.map(dateStr => { - const year = dateStr.slice(0, 4); - const month = dateStr.slice(4, 6); - return { - text: `${year}-${month}`, - val: dateStr - }; - }); - }; - const selectAplcnYms = async() => { // 상수사용월 - try { - //const result = await getData('v1/inftwtAnlsRslt/aplcnYm'); - let result = null; - const res = await fetch('http://con.mind-one.co.kr:11083/sewerage-service/api/v1/inftwtAnlsRslt/aplcnYm', { - method: "GET", - body: null, - }); - if (res.ok) { - result = await res.json(); - } - - if (result && result.length > 0) { - //setAplcnYms(convertToTextValArray(result)); - console.log("selectAplcnYms", result); - return convertToTextValArray(result); - } - } catch (error) { - console.error(error); - } - } - useEffect(() => { - const fetchAplcnYms = async () => { - const aplcnYmsData = await selectAplcnYms(); - setAplcnYms(aplcnYmsData||[]); - console.log("aplcnYms: ", aplcnYms); - //setAplcnYm(getCurrentDate()); - }; - fetchAplcnYms(); - }, [aplcnYms]); return ( {/* 분석 입력현황 조회 */} @@ -135,13 +95,12 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
- setAplcnYm(String(value))} - /> +
diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/inftwtAnls.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/inftwtAnls.ts new file mode 100644 index 000000000..e69de29bb From 7c811df864ea4b8ca47fcd501f6a71e91f81ac6c Mon Sep 17 00:00:00 2001 From: leedj312 Date: Sat, 28 Jun 2025 14:59:17 +0900 Subject: [PATCH 047/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=95=84=EC=9A=A9=20?= =?UTF-8?q?=EA=B1=B4=EC=B6=95=EB=AC=BC=20=EB=93=B1=EB=A1=9D=20=EB=B9=97?= =?UTF-8?q?=EB=AC=BC/=EC=A4=91=EC=88=98=EB=8F=84/=EC=98=A8=EB=B0=B0?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 20 +- .../app/ruseFcltMng/fcltReg/rswtReg/page.tsx | 8 +- .../ruseFcltMng/fcltSttn/rswtSttn/page.tsx | 2 +- apps/wr/app/store/common/searchCode/index.ts | 1 + .../chkgdnReg/rainChkgdn/headList.tsx | 2 +- .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 176 ++++++++---------- .../ruseFcltMng/fcltReg/pbnstReg/index.tsx | 3 +- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 3 - .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 93 +++------ .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 26 +-- .../fcltReg/bdstRegModal/bdstRegModal.tsx | 5 +- .../fcltReg/pbnstRegModal/pbnstRegModal.tsx | 52 +++--- 12 files changed, 158 insertions(+), 233 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index e5c9241d5..d61478a75 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -1,7 +1,6 @@ "use client"; import { ContentsDiv, - DateMonthPicker, ScrollArea, SearchDiv, SearchFormLeft, @@ -40,7 +39,6 @@ export default function PublicReuseFaciltyInsert() { const { code, pbnst, - searchFclts, pubHasuInit, pbnstInsert, pbnstRegClick, @@ -60,7 +58,7 @@ export default function PublicReuseFaciltyInsert() { const [bdstTable, setbdstTable] = useState(); const [selectRow, setSelectRow] = useState(); const [pageNation, setPageNation] = useState(1); - + const [testMonth, setTestMonth] = useState("202406"); const form = useForm<{ items: z.infer[]; }>({ @@ -165,17 +163,16 @@ export default function PublicReuseFaciltyInsert() { console.log("bdstTable ", bdstTable); }, [bdstTable]); - useEffect(() => { - - if (code.sggCd.length &&pbnstHasuRes.length > 0) { + if (code.sggCd.length && pbnstHasuRes.length > 0) { setbdstTable(tableData(pbnstHasuRes, { code })); - // if (searchFclts) { + // if (searchFclts) { // 왜 오류가 발생할까? + // setbdstTable(tableData(searchFclts, { code })); // } else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { // } } - }, [code, pbnstHasuRes, searchFclts]); + }, [code, pbnstHasuRes]); const cellClick = (val: number | undefined) => { if (val === undefined) return; @@ -192,10 +189,8 @@ export default function PublicReuseFaciltyInsert() { useEffect(() => { if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) { - console.log("pbnst.pbnstRes", pbnstRes); form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) }); } else { - console.log("pbnst.pbnstRes is null", pbnstRes); form.reset({ items: [] }); } }, [pbnst.pbnstRes]); @@ -252,10 +247,6 @@ export default function PublicReuseFaciltyInsert() { } }, [pbnstRegZod, pbnstRes, append, selectRow, form]); - useEffect(() => { - // console.log(" page getgetvaslue ", form.getValues()); - }, [form.getValues()]); - useEffect(() => { pubHasuInit(String(pageNation), "41"); }, [pageNation, pubHasuInit]); @@ -305,7 +296,6 @@ export default function PublicReuseFaciltyInsert() { > 신규등록 -
diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx index 2931690b9..d57c730ce 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx @@ -42,8 +42,8 @@ export default function Home() { } }, [rswt.isInit, initRswt]); useEffect(() => { - if (code.sggCd.length > 0) { - const rswtData = tableData(rswtRes, { code }).map( + if (code.sggCd.length > 0 && rswtRes?.length > 0) { + const rswtData = tableData(rswtRes, { code })?.map( (item: customRswtBdst) => { return { ...item, @@ -151,7 +151,7 @@ export default function Home() {
} + body={} bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { @@ -162,7 +162,7 @@ export default function Home() { bodyClass={""} open={bdstChgProps.isOpen} body={ - + } onOpenChange={(open) => { setBdstChgProps({ ...bdstChgProps, isOpen: open }); diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx index 7a3444a9b..f9b3c6187 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx @@ -65,7 +65,7 @@ export default function RswtSttn() { }, [rswtSttn.isInit, rswtSttnInit]); useEffect(() => { - if (rswtSttnRes.length > 0 && code.cityCd.length > 0) { + if (rswtSttnRes?.length > 0 && code.cityCd.length > 0) { const data = tableData(rswtSttnRes, { code }); const chData = data .map((item: customRswtBdst) => ({ diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts index 34c2c86c5..51ebda8a5 100644 --- a/apps/wr/app/store/common/searchCode/index.ts +++ b/apps/wr/app/store/common/searchCode/index.ts @@ -82,6 +82,7 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { addr: item.addr, fctCpc: item.fctCpc, })); + set((state: comFcltState) => ({ ...state, searchFclts: searchFclts, diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx index 3cc75d70c..d8057cad6 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx @@ -17,7 +17,7 @@ export const chkgdRegExcel = z.object({ }, { message: "현재 년도보다 높은 수를 입력할 수 없습니다." } ), - file: z.instanceof(File).optional(), + file: z.instanceof(File).nullish(), }); export const guideDetail = z.object({ diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index 0a51ebb5d..314d5762b 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -1,10 +1,63 @@ import { getFetch, postFectch, putFectch } from "@/components/lib/api"; -import { upHeadList, type chgBuilding} from "../rainReg"; +import { upHeadList, type chgBuilding } from "../rainReg"; import { z } from "zod"; import { makeMdfr, makeRstr } from "../bdstReg"; +import { + baseReuseBuildingSchema, + chgBuildingSchema, + validationMessages, +} from "../rainReg/type"; // Import baseReuseBuildingSchema, chgBuildingSchema, validationMessages import type { TableUpperProps } from "@/app/store/common/type/header"; +const hdtflObjSchema = z.object({ + htdflFcltPk: z.number().nullish(), + bdstRuseFcltFk: z.number().nullish(), + etgtType: z + .string() + .min(1, { message: validationMessages.required("에너지원 종류") }), + fclCpct: z + .number() + .positive({ message: validationMessages.required("시설 용량") }), + plwtYn: z.enum(["Y", "N"]).default("Y"), + orgwtWtritSpt: z + .number() + .positive({ message: validationMessages.required("원수 취수량") }), + orgwtOcrnProcs: z + .string() + .min(1, { message: validationMessages.required("원수 발생 공정") }), + wtritEntrcTp: z + .number() + .max(100, { message: "온도는 100이상이 될 수 없습니다." }) + .default(0), // Changed max to 100 based on message + amtgnr: z.number().default(0), + prcsProcsYn: z.enum(["Y", "N"]).default("Y"), + prcsFcltCpct: z + .number() + .positive({ message: validationMessages.required("처리시설 용량") }), + fmYn: z.string().default(""), + utztnCpct: z + .number() + .positive({ message: validationMessages.required("이용 용량") }), + utztnUsg: z + .string() + .min(1, { message: validationMessages.required("이용 용도") }), + grssClfg: z.number().default(0), // Measurements, 0 is fine as default + combResdch: z.number().default(0), // Measurements, 0 is fine as default + trbt: z.number().default(0), // Measurements, 0 is fine as default + bod: z.number().default(0), // Measurements, 0 is fine as default + smll: z.number().default(0), // Measurements, 0 is fine as default + crmty: z.number().default(0), // Measurements, 0 is fine as default + tn: z.number().default(0), // Measurements, 0 is fine as default + tph: z.number().default(0), // Measurements, 0 is fine as default + ph: z.number().default(0), // Measurements, 0 is fine as default + clIonQnt: z.number().default(0), // Measurements, 0 is fine as default + cdtnv: z.number().default(0), // Measurements, 0 is fine as default + emsnExitTp: z.number().default(0), // Measurements, 0 is fine as default + rgtr: z.string().nullish().default(null), + mdfr: z.string().nullish().default(null), +}); + export const hdtflZod = z.object({ bdstInfoPk: z.number().nullish(), ctpvCd: z.number().default(0), @@ -14,85 +67,25 @@ export const hdtflZod = z.object({ daddr: z.string().default(" "), bdstNm: z.string().default(" "), frstArchPrmsnDt: z.date().default(() => new Date()), - archChgPrmsnDt: z.date().default(() => new Date()).nullish() , + archChgPrmsnDt: z + .date() + .default(() => new Date()) + .nullish(), archArea: z.number().default(0), archChgArea: z.number().nullish().default(0), - rgtr:z.string().nullish().default(null), - mdfr:z.string().nullish().default(null), + rgtr: z.string().nullish().default(null), + mdfr: z.string().nullish().default(null), reuseBuilding: z .array( - z.object({ - bdstRuseFcltPk: z.number().nullish(), - bdstInfoFk: z.number().nullish(), - instlCmptnDt: z.coerce.date().default(() => new Date()), - instlCst: z.number().nullish().default(0), - operMngCd: z.string().nullish().default(""), - anlOperCst: z.number().default(0), - instlCstSprtYn: z.enum(["Y", "N"]).nullish(), - instlCstSprtAmt: z.number().nullish().default(0), - grntchBdstCertNo: z.string().nullish().default(""), - grntchBdstCertGrd: z.string().nullish().default(""), - ruseFcltFlg: z.string().nullish().default(""), - bdstUsgCd: z.number().default(0), - lawTrgtYn: z.enum(["Y", "N"]).nullish(), - rgtr:z.string().nullish().default(null), - mdfr:z.string().nullish().default(null), - // htdflObj 매핑 - htdflObj: z - .object({ - htdflFcltPk: z.number().nullish(), - bdstRuseFcltFk: z.number().nullish(), - etgtType: z.string().default(""), - fclCpct: z.number().default(0), - plwtYn: z.enum(["Y", "N"]), - orgwtWtritSpt: z.number().default(0), - orgwtOcrnProcs: z.string().default(""), - wtritEntrcTp: z.number().max(4, "온도는 100이상이 될 수 없습니다.") - .default(0), - amtgnr: z.number().default(0), - prcsProcsYn: z.enum(["Y", "N"]), - prcsFcltCpct: z.number().default(0), - fmYn: z.string().default(""), - utztnCpct: z.number().default(0), - utztnUsg: z.string().default(""), - grssClfg: z.number().default(0), - combResdch: z.number().default(0), - trbt: z.number().default(0), - bod: z.number().default(0), - smll: z.number().default(0), - crmty: z.number().default(0), - tn: z.number().default(0), - tph: z.number().default(0), - ph: z.number().default(0), - clIonQnt: z.number().default(0), - cdtnv: z.number().default(0), - emsnExitTp: z.number().default(0), - rgtr:z.string().nullish().default(null), - mdfr:z.string().nullish().default(null), - }) - .default({ - plwtYn: "N", - prcsProcsYn: "N", - }), - }) - ) - .default([]), - chgBuilding: z - .array( - z.object({ - bdstInfoFk: z.number().nullish(), - archChgPrmsnDt: z.coerce.date() , - archChgArea: z.string().default("-").nullish(), - bdstChgNm: z.string().default(""), - rgtr:z.string().nullish().default(null), - mdfr:z.string().nullish().default(null), + baseReuseBuildingSchema.extend({ + htdflObj: hdtflObjSchema, }) ) .default([]), + chgBuilding: z.array(chgBuildingSchema).default([]), // Use imported chgBuildingSchema }); - export type customHtdflBdst = z.infer - +export type customHtdflBdst = z.infer; export type htdflFacState = { htdfl: { @@ -102,11 +95,10 @@ export type htdflFacState = { }; }; type htdflFacSActions = { - initHtdfl: (code: string ) => void; - htdflBdstUpdate:(data: customHtdflBdst, code:string|number) => void; - htdflBdstReg:(data: customHtdflBdst, code:string|number) => void; - getHtdflBdstData:(pageNation:number, code:string|number) =>void; - + initHtdfl: (code: string) => void; + htdflBdstUpdate: (data: customHtdflBdst, code: string | number) => void; + htdflBdstReg: (data: customHtdflBdst, code: string | number) => void; + getHtdflBdstData: (pageNation: number, code: string | number) => void; }; const htdflRes: customHtdflBdst[] = []; @@ -121,25 +113,22 @@ export const htdflFacStateExport: htdflFacState = { }, }; +const initFetch = async (code: string | number) => { + const rswtRes = await getFetch("wr", `/facilityList/1/20/${code}`); -const initFetch = async (code:string|number) => { - const rswtRes = await getFetch( - "wr", - `/facilityList/1/20/${code}`) - return rswtRes; }; export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( set: any ) => { return { - getHtdflBdstData: async (pageNation: number, code: string | number) => { + getHtdflBdstData: async (pageNation: number, code: string | number) => { try { const rswtRes = await getFetch( "wr", `/drain/facilityList/${pageNation}/20/${code}` ); - console.log(pageNation) + console.log(pageNation); // 여기서 상태 업데이트 return set((state: htdflFacState) => ({ ...state, @@ -154,8 +143,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( } }, - - initHtdfl: async (code: string ) => { + initHtdfl: async (code: string) => { try { const htdflRes = await initFetch(code); set((state: htdflFacState) => { @@ -172,9 +160,9 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( console.log(error); } }, - htdflBdstUpdate: async (data: customHtdflBdst, code:string|number) => { + htdflBdstUpdate: async (data: customHtdflBdst, code: string | number) => { try { - const chData=await makeMdfr(data) + const chData = await makeMdfr(data); const res = await putFectch("/drain/facility", data); if (res.ok) { alert(" 수정이 완료되었습니다."); @@ -196,18 +184,17 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( ); } }, - htdflBdstReg: async (data: customHtdflBdst , code:string|number) => { + htdflBdstReg: async (data: customHtdflBdst, code: string | number) => { try { - const chData=await makeRstr(data) + const chData = await makeRstr(data); const res = await postFectch("/drain/facility", data); if (res.ok) { - - if(data.chgBuilding.length > 0){ + if (data.chgBuilding.length > 0) { await res .json() .then((resData: any) => { const chPK = resData?.data?.bdstInfoPk; - + const makeCh = resData.data.chgBuilding.map( (item: chgBuilding) => ({ ...item, @@ -222,9 +209,8 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( alert("등록이 완료되었습니다."); } }); - }else{ + } else { alert("등록이 완료되었습니다."); - } } const htdflRes = await initFetch(code); @@ -238,7 +224,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( })); } catch (errorReg) { alert("등록 오류입니다."); - } + } }, }; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index fb799c26c..67a9f36f4 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -102,12 +102,10 @@ const checkWrRegList = async () => { const hasuListFetch = async (page: string, sggOrCity: string, searchTxt?:string) => { const checkWrRegListRes = await checkWrRegList(); - console.log(' checkWrRegListRes ', checkWrRegListRes) let url = `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity? sggOrCity : "11"}/0/1/SW`; const data = checkWrRegListRes.filter((item:string) => item !== "") - console.log(' checkWrRegListRes ' ) if(searchTxt){ url= url +`/${searchTxt}` @@ -177,6 +175,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { try { const pbnstHasuRes = await hasuListFetch(page, sggOrCity); + return set((state: pubFacState) => ({ ...state, pbnst: { diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index a029bd869..372a4bd9a 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -22,9 +22,6 @@ const rainyObjSchema = z.object({ }); - - - const rainBuildingSchema = baseReuseBuildingSchema.extend({ rainyObj: rainyObjSchema, }) diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 3c2504b9a..178badd3b 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -1,10 +1,32 @@ import { getFetch, postFectch, putFectch } from "@/components/lib/api"; -import { upHeadList, type chgBuilding } from "../rainReg"; +import { upHeadList, type chgBuilding } from "../rainReg"; import type { TableUpperProps } from "@/app/store/common/type/header"; import { z } from "zod"; +import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "../rainReg/type"; import { makeMdfr, makeRstr } from "../bdstReg"; + const rswtrObjSchema = z.object({ + bdstRuseFcltFk: z.number().nullish(), + wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), + oblgTrgtWtrUsqty: z.number().nullish().default(0), + orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }), + filtrTrtmfctCpct: z.number({ required_error: validationMessages.required("처리시설 용량") }).positive({ message: validationMessages.required("처리시설 용량") }), + filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }), + filtrTrtmfctUsgCd: z.string().default("").nullish(), + rswtrUsqty: z.number().default(0), + altUswtrUtztnYn: z.enum(["Y", "N"]).nullish(), //안쓰는값 + altUswtrKndCd: z.string().default("").nullish(), //안쓰는값 + altUswtrUtztnQnt: z.number().default(0), //안쓰는값 + altUswtrIdntyMthdCd: z.string().default("").nullish(), //안쓰는값 + rgtr: z.string().nullish().default(null), + mdfr: z.string().nullish().default(null), +}); + + const rswtBuildingSchema = baseReuseBuildingSchema.extend({ + rswtrObj: rswtrObjSchema, +}) + export const rswtZod = z.object({ bdstInfoPk: z.number().nullish(), ctpvCd: z.number().default(0), @@ -21,73 +43,8 @@ export const rswtZod = z.object({ bdstUsgText: z.string().default(""), cityText: z.string().default(""), sggText: z.string().default(""), - - reuseBuilding: z - .array( - z.object({ - bdstRuseFcltPk: z.number().nullish(), - bdstInfoFk: z.number().nullish(), - instlCmptnDt: z.coerce.date().default(() => new Date()), - instlCst: z.number().default(0), - operMngCd: z.string().nullish().default(""), - - anlOperCst: z.number().default(0), - instlCstSprtYn: z.enum(["Y", "N"]), - instlCstSprtAmt: z.number().default(0), - - grntchBdstCertYn: z.enum(["Y", "N"]), - grntchBdstCertYr: z - .string() - .default("") - .refine((year) => year.length === 0 || /^\d{4}$/.test(year), { - message: "4자리 연도만 입력하세요", - }), - grntchBdstCertNo: z.string().default(""), - grntchBdstCertGrd: z.string().default(""), - - crgRdctYn: z.string().default("N").nullish(), // 안쓰는 값 - crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값 - crgRdctAmt: z.number().default(0), // 안쓰는 값 - ruseFcltFlg: z.string().default(""), - bdstUsgCd: z.number().default(0), - lawTrgtYn: z.string().default(""), - rgtr: z.string().nullish().default(null), - mdfr: z.string().nullish().default(null), - - rswtrObj: z - .object({ - bdstRuseFcltFk: z.number().nullish(), - wtrUsqty: z.number().default(0), - oblgTrgtWtrUsqty: z.number().nullish().default(0), - orgwtKndCd: z.string().default(""), - filtrTrtmfctCpct: z.number().default(0), - filtrTrtmfctProcs: z.string().default(""), - filtrTrtmfctUsgCd: z.string().default("").nullish(), - rswtrUsqty: z.number().default(0), - altUswtrUtztnYn: z.enum(["Y", "N"]).nullish(), //안쓰는값 - altUswtrKndCd: z.string().default("").nullish(), //안쓰는값 - altUswtrUtztnQnt: z.number().default(0), //안쓰는값 - altUswtrIdntyMthdCd: z.string().default("").nullish(), //안쓰는값 - rgtr: z.string().nullish().default(null), - mdfr: z.string().nullish().default(null), - }) - .default({}), - }) - ) - .default([]), - - chgBuilding: z - .array( - z.object({ - bdstInfoFk: z.number().nullish(), - archChgPrmsnDt: z.coerce.date(), - archChgArea: z.string().default("-"), - bdstChgNm: z.string().default(""), - rgtr: z.string().nullish().default(null), - mdfr: z.string().nullish().default(null), - }) - ) - .default([]), + reuseBuilding: z.array(rswtBuildingSchema).default([]), + chgBuilding: z.array(chgBuildingSchema).default([]), }); export type customRswtBdst = z.infer; diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index a4f29477a..d820bddc1 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -28,10 +28,12 @@ import BdstReg from "../bdstReg/bdstReg"; export default function RswtrRegForm({ rswtForm, isModal, + setIsModal, readonly = false }: { rswtForm: customRswtBdst; isModal: boolean; + setIsModal?: (isModal: boolean) => void; readonly?: boolean; }) { const { rswt, code, rswtBdstUpdate, rswtBdstReg } = useWrStore( @@ -54,6 +56,7 @@ export default function RswtrRegForm({ const onSubmit = (values: z.infer) => { if (isModal) { rswtBdstReg(values, "41"); + if(setIsModal) setIsModal(false) } else { rswtBdstUpdate(values, "41"); } @@ -61,28 +64,29 @@ export default function RswtrRegForm({ const cleanRswtData = (raw: any): z.infer => { return { ...raw, - frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null), + frstArchPrmsnDt: raw?.frstArchPrmsnDt + ? new Date(raw.frstArchPrmsnDt) + : new Date(), // raw?.frstArchPrmsnDt가 유효하지 않으면 현재 날짜로 초기화 archChgPrmsnDt: raw?.archChgPrmsnDt ? new Date(raw?.archChgPrmsnDt) : null, reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ ...item, - instlCmptnDt: new Date(item?.instlCmptnDt), - operMngCd: item?.operMngCd ?? "", // null → "" - grntchBdstCertYr: - typeof item?.grntchBdstCertYr === "string" - ? item?.grntchBdstCertYr - : "", // null → "" - rswtrObj: { + instlCmptnDt: item?.instlCmptnDt + ? new Date(item.instlCmptnDt) + : new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화 + operMngCd: item?.operMngCd ?? "", // null → "" + instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" + grntchBdstCertYn:item?.grntchBdstCertYn??"Y", + rswtrObj: { ...item?.rswtrObj, + filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", + }, })), }; }; - useEffect(()=>{ - console.log("rswtForm:", rswtForm) - }, [rswtForm]) useEffect(() => { console.log("form errors:", form.formState.errors); diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 315f9397f..205846bb4 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -29,9 +29,10 @@ export type objSearchType = { interface BdstRegProps { moType: T; + setIsModal?: (open: boolean) => void; } -export function BdstReg({ moType }: BdstRegProps) { +export function BdstReg({ moType,setIsModal }: BdstRegProps) { const { rain, code, bdst,findBdst } = useWrStore((state) => { return state; }); @@ -143,7 +144,7 @@ export function BdstReg({ moType }: BdstRegProps) { { moType === 'RNB'? :moType==='RST' - ? + ? {setIsModal}}> : } diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index b930a36bb..cc0eb80bf 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -20,13 +20,13 @@ import { useFieldArray, type UseFormReturn } from "react-hook-form"; import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg"; export function PbnstRegModal({ - data, form, + setPbnstInsert }: { - data: pubHasuType; form: UseFormReturn<{ items: PbnstRegArrrayType }>; + setPbnstInsert: (data: customPbnst) => void }) { - const { pbnst, pbnstInsert } = useWrStore((state) => { + const { pbnstInsert } = useWrStore((state) => { return state; }); const [pbnstBdstForm, setPbnstBdstForm] = useState( @@ -35,40 +35,30 @@ export function PbnstRegModal({ const [currentTab, setCurrentTab] = useState("mng"); const [indexMng, setIndexMng] = useState(0); const [indexBiz, setIndexBiz] = useState(0); - const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { - - const item = valuse.items[indexMng]; - const data = item ? writeRgtrAndMdfr([item]) : []; + const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { + const item = valuse.items[indexMng]; + const data = item ? writeRgtrAndMdfr([item]) : []; - if(data && data[0]){ - pbnstInsert(data[0]) - } - }; + if (data && data[0]) { + // pbnstInsert(data[0]); + setPbnstInsert(data[0]) + } + }; const handleTabChange = (value: string) => { setCurrentTab(value); - }; - - useEffect(() => { - console.log("form errors:", form.formState.errors); - }, [form.formState.errors]); - - + }; useEffect(() => { - if (data) { - - const firstForm = form.getValues("items"); - setIndexMng(firstForm.length - 1) } - }, [data, form]); - - + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); useEffect(() => { - console.log(' form.getValues() ' ,form.getValues()) - - }, [form.getValues()]); - + const firstForm = form.getValues("items"); + if (firstForm) { + setIndexMng(firstForm.length - 1); + } + }, [form]); return ( <>

@@ -86,7 +76,7 @@ export function PbnstRegModal({ 차수별정보 + + + + + + ); +}; diff --git a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx new file mode 100644 index 000000000..acf17fba4 --- /dev/null +++ b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx @@ -0,0 +1,125 @@ +import { cn } from "../../lib/utils"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@common/components/ui"; +import { + eachMonthOfInterval, + endOfYear, + format, + isEqual, + isFuture, + parse, + startOfMonth, + startOfToday, +} from "date-fns"; +import { ko } from "date-fns/locale"; + +function getStartOfCurrentMonth() { + return startOfMonth(startOfToday()); +} + +export type MonthPickerProps = { + currentMonth: Date; + onMonthChange: ( + newMonth: Date | undefined, + shouldClosePopover?: boolean + ) => void; +}; + +export function MonthPicker({ currentMonth, onMonthChange }: MonthPickerProps) { + + const today = startOfToday(); +const currentYear = today.getFullYear(); + const yearFromProp = format(currentMonth, "yyyy"); +const selectedYear = parseInt(yearFromProp); + + // 현재 월의 시작 날짜 + const fullYearStart = parse(yearFromProp, "yyyy", new Date()); + + const yearEnd = + selectedYear === currentYear ? today : endOfYear(fullYearStart); + + + + + const yearRange = Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + const months = eachMonthOfInterval({ start: fullYearStart, end: yearEnd }); + + const getMonthButtonClass = (month: Date) => + cn( + "inline-flex h-9 w-16 items-center justify-center rounded-md p-0 text-sm font-normal ring-offset-white transition-colors hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-selected:opacity-100 dark:ring-offset-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:focus-visible:ring-slate-800", + isEqual(month, currentMonth) && + "bg-slate-900 text-slate-50 hover:bg-slate-900 hover:text-slate-50 focus:bg-slate-900 focus:text-slate-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50 dark:hover:text-slate-900 dark:focus:bg-slate-50 dark:focus:text-slate-900", + !isEqual(month, currentMonth) && + isEqual(month, getStartOfCurrentMonth()) && + "bg-slate-100 text-slate-900 dark:bg-slate-800 dark:text-slate-50" + ); + + return ( +
+
+
+ {/* 년도 셀렉트 */} +
+ +
+ + {/* 월 그리드 */} +
+ {months.map((month) => ( +
+ +
+ ))} +
+
+
+
+ ); +} diff --git a/packages/common/business_components/src/ui/index.ts b/packages/common/business_components/src/ui/index.ts index 19d966a53..fd1e6fe9e 100644 --- a/packages/common/business_components/src/ui/index.ts +++ b/packages/common/business_components/src/ui/index.ts @@ -20,4 +20,5 @@ export * from "./table"; export * from "./table_div"; export * from "./title"; export * from "./sdmInsertForm"; -export * from "./popover_ui" \ No newline at end of file +export * from "./popover_ui"; +export * from "./date_month_picker"; \ No newline at end of file From 9d5bffb403a74b1705b19dfc8023ab69c6a23fda Mon Sep 17 00:00:00 2001 From: leedj312 Date: Sat, 28 Jun 2025 16:19:54 +0900 Subject: [PATCH 049/259] =?UTF-8?q?=EC=9B=90=EC=88=98=EC=B7=A8=EC=88=98=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=AC=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 19 +- .../fcOrgwtsRegModal/fcOrgwtsRegModal.tsx | 247 ++++++++++-------- 2 files changed, 138 insertions(+), 128 deletions(-) diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index a729b2533..be1459947 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -247,23 +247,6 @@ export function PbnstBuseForm({ setSumCpct(sum); }, [form.formState, indexMng, indexBiz]); - // // 차수별 정보(fcBizs)가 하나도 없을 경우 플레이스홀더 UI를 보여줍니다. - // if (fcBizs.length === 0) { - // return ( - //
- //

등록된 차수별 정보가 없습니다.

- //

아래 버튼을 눌러 신규 차수 정보를 등록해주세요.

- // - //
- // ); - // } const pbnstBiz = form.watch(`items.${indexMng}.fcBizs`); return ( @@ -672,7 +655,7 @@ export function PbnstBuseForm({ setIsFcOrgwts(open)} - bodyClass={"w-[50vw] max-w-none h-[90vh]"} + bodyClass={"w-[70vw] max-w-none max-h-[90vh] overflow-y-auto"} body={ { diff --git a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx index 92b40e146..9c8f2cdd6 100644 --- a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx @@ -1,6 +1,10 @@ "use client"; import { useWrStore } from "@/app/store"; -import type { pubHasuType, fcBizType, fcOrgwtType,} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; +import type { + pubHasuType, + fcBizType, + fcOrgwtType, +} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; import type { TableUpperProps } from "@/app/store/common/type/header"; import { tableData } from "@/components/lib/func/commom"; import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable"; @@ -11,138 +15,161 @@ import { Input } from "@common/components/ui"; import { ArrowLeft, ArrowRight } from "lucide-react"; import { useEffect, useRef, useState } from "react"; -export default function FcOrgwtsRegModal({ onRightSet, closeModal }: { onRightSet?: (rightData:fcOrgwtType[]) => void,closeModal?:(val:boolean) =>void }) { - const { code, pbnst, getSwtrmtFcltNm, searchFclts } = useWrStore((state) => state); +export default function FcOrgwtsRegModal({ + onRightSet, + closeModal, +}: { + onRightSet?: (rightData: fcOrgwtType[]) => void; + closeModal?: (val: boolean) => void; +}) { + const { code, pbnst, getSwtrmtFcltNm, searchFclts } = useWrStore( + (state) => state + ); const { fcOrgwtsHeadList, pbnstHasuRes } = pbnst; const [bdstTable, setbdstTable] = useState(); const rightRef = useRef([] as pubHasuType[]); const leftRef = useRef([] as pubHasuType[]); const [rightData, setRightData] = useState(); const [inputVal, setInputVal] = useState(""); - - useEffect(()=>{ - if(Array.isArray(searchFclts)){ + + useEffect(() => { + if (Array.isArray(searchFclts)) { const filteredData = searchFclts.filter((item) => { - if(rightData){ - if(rightData.find(rightItem =>rightItem.bscFctCd===item.bscFctCd)) + if (rightData) { + if ( + rightData.find((rightItem) => rightItem.bscFctCd === item.bscFctCd) + ) return false; } - return true - }) - setbdstTable(Array.isArray(filteredData) ? [...filteredData] : []) + return true; + }); + setbdstTable(Array.isArray(filteredData) ? [...filteredData] : []); } - - }, [searchFclts]) + }, [searchFclts]); useEffect(() => { if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { setbdstTable(tableData(pbnstHasuRes, { code })); - console.log('bdstTable ', bdstTable) + console.log("bdstTable ", bdstTable); } }, [code, pbnstHasuRes]); useEffect(() => { - console.log('rightData ', rightData) - if(onRightSet) - onRightSet( - (rightData as pubHasuType[])?.map(item => ({ - swtrmtFcltFk: item.bscFctCd, // 임시값, 실제 데이터에 맞게 수정 - orgwtWtritQnt: Number(item.fctCpc), // 임시값, 실제 데이터에 맞게 수정 - tmsYn: "N", // 임시값, 실제 데이터에 맞게 수정 - dschgFmYn: "N", // 임시값, 실제 데이터에 맞게 수정 - dtlPstnExpln: item.addr, // 임시값, 실제 데이터에 맞게 수정 - choose: false, // 임시값, 실제 데이터에 맞게 수정 - // 필요한 경우 다른 속성들도 추가 - })) as unknown as fcOrgwtType[] - ); - }, [rightData]) + console.log("rightData ", rightData); + if (onRightSet) + onRightSet( + (rightData as pubHasuType[])?.map((item) => ({ + swtrmtFcltFk: item.bscFctCd, // 임시값, 실제 데이터에 맞게 수정 + orgwtWtritQnt: Number(item.fctCpc), // 임시값, 실제 데이터에 맞게 수정 + tmsYn: "N", // 임시값, 실제 데이터에 맞게 수정 + dschgFmYn: "N", // 임시값, 실제 데이터에 맞게 수정 + dtlPstnExpln: item.addr, // 임시값, 실제 데이터에 맞게 수정 + choose: false, // 임시값, 실제 데이터에 맞게 수정 + // 필요한 경우 다른 속성들도 추가 + })) as unknown as fcOrgwtType[] + ); + }, [rightData]); return ( - <> -
-
- - <Button className="m-2" size={"sm"} - onClick={() => {closeModal && closeModal(false) }}>저장</Button> - </div> + <div className="flex flex-col h-[80vh]"> + <div className="shrink-0 p-4 border-b z-10 bg-white"> + <div className="flex items-center"> + <Title title="취수하수처리장 추가" /> + {/* <Button size="sm" onClick={() => closeModal?.(false)}>저장</Button> */} + <div className="flex items-center gap-2 mt-8"> - <div className="flex flex-row flex-grow gap-4 mt-4"> - <div className="w-3/7"> - <div className="flex items-center justify-between"> - <Label className="w-full text-2xl text-gray-600 text-left">공공하수처리시설 목록</Label> - <div className="flex items-center"> - <Label className="w-full text-xl text-gray-600 text-right">시설명</Label> - <Input className="w-1/2 !text-xl ml-2" type="text" value={inputVal} onChange={(e) => {setInputVal(e.target.value)}} /> - <Button className="m-2" size={"sm"} onClick={() => getSwtrmtFcltNm(inputVal)}>조회</Button> - </div> - </div> - <div className="border-t border-gray-300 my-4"></div> - <RuseMngTable - tableData={bdstTable || []} - headList={fcOrgwtsHeadList} - upHeadList={[]} // TODO: Replace with actual upHeadList data if available - ref={leftRef} - /> - </div> - <div className="flex flex-col items-center justify-center w-1/7 gap-2"> - <ArrowRight - type="button" - onClick={() => { - if (leftRef && typeof leftRef === "object" && "current" in leftRef) { - const checked = leftRef.current?.filter((item) => ((item as unknown as pubHasuType)?.choose)) - const unchecked = leftRef.current?.filter((item) => !(item as unknown as pubHasuType)?.choose) - if (checked && checked.length > 0) { - checked.forEach(item=>(item as unknown as pubHasuType).choose = false) - setRightData([...(checked as unknown as pubHasuType[]), - ...((rightRef.current ?? []) as unknown as pubHasuType[]) - ]) - - } - if (unchecked && unchecked.length > 0) { - setbdstTable([...(unchecked as unknown as pubHasuType[])]) - }else{ - setbdstTable([]) - } - } - } - } - className="w-12 h-12 text-gray-500 cursor-pointer" - /> - <ArrowLeft - type="button" - onClick={() => { - if (rightRef && typeof rightRef === "object" && "current" in rightRef) { - const checked = rightRef.current?.filter((item) => ((item as unknown as pubHasuType)?.choose)) - const unchecked = rightRef.current?.filter((item) => !(item as unknown as pubHasuType)?.choose) - if (checked && checked.length > 0) { - checked.forEach(item=>(item as unknown as pubHasuType).choose = false) - setbdstTable([ - ...(checked as unknown as pubHasuType[]), - ...((leftRef.current ?? []) as unknown as pubHasuType[]) - ]) - } - if (unchecked && unchecked.length > 0) { - setRightData([...(unchecked as unknown as pubHasuType[])]) - }else{ - setRightData([]) - } - } - }} - className="w-12 h-12 text-gray-500 cursor-pointer mt-5" /> - </div> - {/* Right Table container: Takes 2/5 of the width */} - <div className="w-3/7"> - <Label className="w-full text-2xl text-gray-600 text-right">취수하수처리장 목록</Label> - <div className="border-t border-gray-300 my-4"></div> - <RuseMngTable - tableData={rightData || []} - headList={fcOrgwtsHeadList} - upHeadList={[]} // TODO: Replace with actual upHeadList data if available - ref={rightRef} - /> + <Label className="text-xl text-gray-600">시설명</Label> + <Input + className="w-48 text-xl" + type="text" + value={inputVal} + onChange={(e) => setInputVal(e.target.value)} + /> + <Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}> + 조회 + </Button> </div> </div> </div> - </> + {/* <div className="flex items-center justify-between"> + <div className="flex items-center gap-2"> + <Label className="text-xl text-gray-600">시설명</Label> + <Input + className="w-48 text-xl" + type="text" + value={inputVal} + onChange={(e) => setInputVal(e.target.value)} + /> + <Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}>조회</Button> + </div> + </div> + </div> */} + + {/* 테이블 영역 */} + <div className="flex flex-row gap-4 flex-grow p-4 overflow-x-auto"> + {/* 왼쪽 테이블 */} + + <div className="w-5/12 min-w-[400px]"> + <Label className="text-2xl text-gray-600 mb-2 block text-right"> + 공공하수처리시설 목록 + </Label> + <RuseMngTable + tableData={bdstTable || []} + headList={fcOrgwtsHeadList} + upHeadList={[]} + ref={leftRef} + /> + </div> + + {/* 중간 이동 버튼 */} + <div className="flex flex-col justify-center items-center gap-4 w-[200px] min-w-[120px]"> + <ArrowRight + onClick={() => { + const checked = leftRef.current?.filter((item) => item.choose); + const unchecked = leftRef.current?.filter((item) => !item.choose); + if (checked?.length) { + checked.forEach((item) => (item.choose = false)); + setRightData([ + ...(checked as pubHasuType[]), + ...(rightRef.current ?? []), + ]); + } + setbdstTable(unchecked ?? []); + }} + className="w-8 h-8 text-gray-500 cursor-pointer" + /> + <ArrowLeft + onClick={() => { + const checked = rightRef.current?.filter((item) => item.choose); + const unchecked = rightRef.current?.filter( + (item) => !item.choose + ); + if (checked?.length) { + checked.forEach((item) => (item.choose = false)); + setbdstTable([ + ...(checked as pubHasuType[]), + ...(leftRef.current ?? []), + ]); + } + setRightData(unchecked ?? []); + }} + className="w-8 h-8 text-gray-500 cursor-pointer" + /> + </div> + + {/* 오른쪽 테이블 */} + <div className="w-5/12 min-w-[400px]"> + <Label className="text-2xl text-gray-600 mb-2 block text-right"> + 취수하수처리장 목록 + </Label> + <RuseMngTable + tableData={rightData || []} + headList={fcOrgwtsHeadList} + upHeadList={[]} + ref={rightRef} + /> + </div> + </div> + </div> ); } From dc6348e4f9db01708f445decd46063c9dd8225b6 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sat, 28 Jun 2025 16:20:15 +0900 Subject: [PATCH 050/259] =?UTF-8?q?=EB=AA=A8=EB=8B=AC=EC=95=88=EC=97=90=20?= =?UTF-8?q?div=20=EA=B0=90=EC=8B=B8=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/dialog_ui/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/dialog_ui/index.tsx b/packages/common/business_components/src/ui/dialog_ui/index.tsx index b9e341279..bbb27d327 100644 --- a/packages/common/business_components/src/ui/dialog_ui/index.tsx +++ b/packages/common/business_components/src/ui/dialog_ui/index.tsx @@ -1,4 +1,5 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader } from "@common/components"; +import { cn } from "../../lib/utils"; type ModalType = { bodyClass: string; @@ -25,15 +26,20 @@ export function UiModal({ return ( <> <Dialog open={open} onOpenChange={onOpenChange}> - <DialogContent className={bodyClass}> - {noHeaderYn === 'N' && ( + <DialogContent className={bodyClass}> + {noHeaderYn === 'N' && ( <DialogHeader> <DialogDescription> {headerTitle} </DialogDescription> </DialogHeader> )} - {(open && body)} + {(open && body) ? + <div> {body}</div>:<></> + + + + } {noFooterYn === 'N' && ( <DialogFooter className="sm:justify-start"> {footerContent} From 381bae8e2664b27d4c3d1a8edb841fc86a86e683 Mon Sep 17 00:00:00 2001 From: mind-one005 <mind-one005@mind-one.co.kr> Date: Sat, 28 Jun 2025 22:01:56 +0900 Subject: [PATCH 051/259] =?UTF-8?q?=EC=B9=A8=EC=9E=85=EC=88=98=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=84=A0=ED=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 83 +++++++++---------- .../popupComponent/chart/infilChart.tsx | 58 ++++++++----- 2 files changed, 77 insertions(+), 64 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 174cd4d7c..9b20398e3 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -1,38 +1,6 @@ import {useState, useEffect} from 'react'; - -const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { - let yyyymms1 = yyyymms.map(dateStr => { - const year = dateStr.slice(0, 4); - const month = dateStr.slice(4, 6); - return { - text: `${year}-${month}`, - val: dateStr - }; - }); - yyyymms1.unshift({ val: '0', text: '선택' }); - return yyyymms1; -}; -const selectAplcnYms = async() => { // 상수사용월 - try { - //const result = await getData('v1/inftwtAnlsRslt/aplcnYm'); - let result = null; - const res = await fetch('http://con.mind-one.co.kr:11083/sewerage-service/api/v1/inftwtAnlsRslt/aplcnYm', { - method: "GET", - body: null, - }); - if (res.ok) { - result = await res.json(); - } - - if (result && result.length > 0) { - console.log("selectAplcnYms", result); - return convertToTextValArray(result); - } - } catch (error) { - console.error(error); - } -}; -type InftwtAnls = { +import { getData } from '@/components/lib/api'; +export type TInftwtAnls = { inftwtAnlsSn:number; aplcnYm: string; enoCd: string; @@ -53,21 +21,46 @@ type InftwtAnls = { anlsInfo: string; scsYn: string; }; -const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 - try { - //const result = await getData('v1/inftwtAnlsRslt/aplcnYm'); - let result = null; - const res = await fetch('http://con.mind-one.co.kr:11083/sewerage-service/api/v1/inftwtAnls', { - method: "GET", - body: JSON.stringify({aplcnYm}), +const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] => { + let yyyymms1 = yyyymms.map(dateStr => { + const year = dateStr.slice(0, 4); + const month = dateStr.slice(4, 6); + return { + text: `${year}-${month}`, + val: dateStr + }; }); - if (res.ok) { - result = await res.json(); + yyyymms1.unshift({ val: '0', text: '선택' }); + return yyyymms1; +}; +export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string; val: number }[] => { + const options = anlsArr.map(anls => ({ + text: anls.anlsInfo, + val: anls.inftwtAnlsSn, + })); + options.unshift({ val: 0, text: '선택' }); + return options; +}; +const selectAplcnYms = async() => { // 상수사용월 + try { + const queryString = ''; + const result = await getData(`v1/inftwtAnlsRslt/aplcnYm${queryString ? `?${queryString}` : ''}`); + if (result && result.length > 0) { + console.log("selectAplcnYms", result); + return getOptionsAplcnYm(result); } + } catch (error) { + console.error(error); + } +}; +export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 + try { + const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); if (result && result.numberOfElements > 0) { console.log("selectInftwtAnls", result.content); - return result.content as InftwtAnls[]; + return result.content; } } catch (error) { console.error(error); @@ -85,4 +78,4 @@ export const useAplcnYms = () => { }, []); return data; -}; \ No newline at end of file +}; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 5d1d5bb42..2fbaf845a 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -5,7 +5,9 @@ import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_compon import Modal from '@/components/ui/modal'; import { Button } from '@common/components/ui'; import { getData } from "@/components/lib/api"; -import { useAplcnYms } from './aplcnYms'; +import type { TInftwtAnls } from './aplcnYms'; +import { useAplcnYms, selectInftwtAnls, getOptionsInftwtAnlsInfo} from './aplcnYms'; +import { set } from 'react-hook-form'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, @@ -18,6 +20,11 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState(""); + const [inftwtAnlss, setInftwtAnlss] = useState<TInftwtAnls[]>([]); + const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([]); // 침입수분석정보 options + const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls|null>(null); // 침입수분석정보 + const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 + //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { @@ -58,7 +65,24 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 return `${year}-${month}`; }; - + const onChangeAplcnYm = (e: React.ChangeEvent<HTMLSelectElement>) => { + const selectedValue = e.target.value; + selectInftwtAnls(selectedValue).then((data) => { + setInftwtAnlss(data ?? []); + console.log("onChangeAplcnYm", selectedValue, inftwtAnlss); + setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data ?? [])); + }); + setAplcnYm(selectedValue); + }; + const onChangeInftwtAnlsInfo = (e: React.ChangeEvent<HTMLSelectElement>) => { + const selectedInfo = e.target.value; + setInftwtAnlsSn(Number(selectedInfo)); // 선택값 상태로 저장 + // 선택된 침입수분석 정보에 대한 처리 로직 추가 + const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === Number(selectedInfo)); + if (selectedAnls) { + setInftwtAnls(selectedAnls); + } + }; return ( <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> {/* 분석 입력현황 조회 */} @@ -92,11 +116,11 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp }} > <div className="font-bold mb-6 text-3xl">침입수분석 입력현황</div> - <div className="grid grid-cols-2 gap-2"> + <div className="grid grid-cols-[35%_65%] gap-2"> <div><label>상수사용월:</label></div> <div> <select className="border border-gray-300 rounded px-2 py-1" - onChange={e => setAplcnYm(e.target.value)} value={aplcnYm}> + onChange={onChangeAplcnYm} value={aplcnYm}> {aplcnYms.map(opt => ( <option key={opt.val} value={opt.val}>{opt.text}</option> ))} @@ -104,20 +128,19 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp </div> <div><label>분석정보:</label></div> <div> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={aplcnYms} - onSelectValue={(value: string|number) => setAplcnYm(String(value))} - /> + <select className="border border-gray-300 rounded px-2 py-1" + onChange={onChangeInftwtAnlsInfo} value={inftwtAnlsSn}> + {inftwtAnlsInfos.map(opt => ( + <option key={opt.val} value={opt.val}>{opt.text}</option> + ))} + </select> </div> <div>오수 전환율:</div> <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>0.85</option> - <option>0.90</option> - </select> + <input + type="text" + value={inftwtAnls?.drtwSwtcRt ?? ""} + className="border border-gray-300 rounded px-2 py-1 w-full" /> </div> <div>수용가-맨홀 매칭:</div> <div> @@ -149,10 +172,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp </div> <div className="flex justify-end mt-4 space-x-2"> <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> - 저장 - </button> - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> - 종료 + 분석결과 도표 </button> </div> </div> From 713d4efd46a70acb2ea16c549a4c4cf8a9f7eb39 Mon Sep 17 00:00:00 2001 From: mind-one005 <mind-one005@mind-one.co.kr> Date: Sun, 29 Jun 2025 20:58:27 +0900 Subject: [PATCH 052/259] =?UTF-8?q?=EC=B9=A8=EC=9E=85=EC=88=98=EB=B6=84?= =?UTF-8?q?=EC=84=9D=EA=B2=B0=EA=B3=BC=20=EC=A1=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/popupComponent/MsSwagePpl.tsx | 2 +- .../popupComponent/chart/aplcnYms.ts | 54 ++++++++++++++----- .../popupComponent/chart/infilChart.tsx | 22 ++++---- .../popupComponent/chart/inftwtAnls.ts | 0 4 files changed, 54 insertions(+), 24 deletions(-) delete mode 100644 apps/sn/app/(map-layout)/map/components/popupComponent/chart/inftwtAnls.ts diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 7d6e45d34..a3c634306 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -16,7 +16,7 @@ const inputColumn = [ { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; -const SwtrmtFclt = ({ featureData }: { featureData: any }) => { +const MsSwagePpl = ({ featureData }: { featureData: any }) => { // SwtrmtFclt console.log("featureData", featureData); const [isModalOpen, setIsModalOpen] = React.useState(false); const [btnTxt, setBtnTxt] = useState<string>(""); diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 9b20398e3..ccce0095a 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -21,6 +21,12 @@ export type TInftwtAnls = { anlsInfo: string; scsYn: string; }; +export type TInftwtAnlsRslt = { + inftwtAnlsSn: number; + pplMngNo: string; + anlsTm: string; + predcOilq:number; +} const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] => { let yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); @@ -53,19 +59,6 @@ const selectAplcnYms = async() => { // 상수사용월 console.error(error); } }; - -export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 - try { - const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; - const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); - if (result && result.numberOfElements > 0) { - console.log("selectInftwtAnls", result.content); - return result.content; - } - } catch (error) { - console.error(error); - } -}; export const useAplcnYms = () => { const [data, setData] = useState<{ text: string; val: string }[]>([]); @@ -79,3 +72,38 @@ export const useAplcnYms = () => { return data; }; + +export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 + try { + const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); + if (result && result.numberOfElements > 0) { + console.log("selectInftwtAnls", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; +export const getChartDataInftwtAnlsRslt = (arr: TInftwtAnlsRslt[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.anlsTm, + val: anlsRslt.predcOilq, + })); + return options; +}; +export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 + try { + if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { + console.warn("inftwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/inftwtAnlsRslt/ppl/${inftwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectInftwtAnlsRslt", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 2fbaf845a..40534a849 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -5,8 +5,9 @@ import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_compon import Modal from '@/components/ui/modal'; import { Button } from '@common/components/ui'; import { getData } from "@/components/lib/api"; -import type { TInftwtAnls } from './aplcnYms'; +import type { TInftwtAnls, TInftwtAnlsRslt } from './aplcnYms'; import { useAplcnYms, selectInftwtAnls, getOptionsInftwtAnlsInfo} from './aplcnYms'; +import { selectInftwtAnlsRslt, getChartDataInftwtAnlsRslt} from './aplcnYms'; import { set } from 'react-hook-form'; type ModalOpenProp = { isModalOpen: boolean, @@ -15,7 +16,7 @@ type ModalOpenProp = { btnTxt?: string, } -const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { +const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 @@ -24,7 +25,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls|null>(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 - + //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { @@ -38,7 +39,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp setPopupOpen(true); // 팝업 열기 }; //console.log("btnTxt", btnTxt); - const closePopup = () => { setPopupOpen(false); }; // 팝업 닫기 + const chartForm = CHART_FORM.LINE; const chartData = { chartData1: [ @@ -59,11 +60,12 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp }; return config; }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; - const getCurrentDate = () => { - const today = new Date(); - const year = today.getFullYear(); - const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 - return `${year}-${month}`; + + const closePopup = () => { // 팝업 닫기 + selectInftwtAnlsRslt(inftwtAnlsSn,"L13101003").then((data) => { + chartData.chartData1 = getChartDataInftwtAnlsRslt(data ?? []); + }); + setPopupOpen(false); }; const onChangeAplcnYm = (e: React.ChangeEvent<HTMLSelectElement>) => { const selectedValue = e.target.value; @@ -84,7 +86,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp } }; return ( - <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> + <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} > {/* 분석 입력현황 조회 */} <div className='grid grid-cols-4 gap-4'> <div className="grid grid-rows-4 gap-4 mb-4"> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/inftwtAnls.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/inftwtAnls.ts deleted file mode 100644 index e69de29bb..000000000 From a2d48745b34db67a46e7c331063743a42052401e Mon Sep 17 00:00:00 2001 From: mind-one005 <mind-one005@mind-one.co.kr> Date: Sun, 29 Jun 2025 21:55:41 +0900 Subject: [PATCH 053/259] =?UTF-8?q?chartdata=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/popupComponent/MsSwagePpl.tsx | 2 +- .../popupComponent/chart/infilChart.tsx | 68 ++++++++++++------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index a3c634306..e1829085c 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -85,4 +85,4 @@ const MsSwagePpl = ({ featureData }: { featureData: any }) => { // SwtrmtFclt ) } -export default SwtrmtFclt \ No newline at end of file +export default MsSwagePpl \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 40534a849..31c92d339 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -25,6 +25,14 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls|null>(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 + const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 @@ -41,18 +49,18 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe //console.log("btnTxt", btnTxt); const chartForm = CHART_FORM.LINE; - const chartData = { - chartData1: [ - { label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 }, - ], - chartData2: [ - { label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 }, - ], - } + // const chartData = { + // chartData1: [ + // { label: "1", val: 20 }, + // { label: "3", val: 40 }, + // { label: "5", val: 60 }, + // ], + // chartData2: [ + // { label: "1", val: 15 }, + // { label: "3", val: 35 }, + // { label: "5", val: 55 }, + // ], + // } const chartConfig = Object.values(chartData).flat().reduce((config, element) => { config[element.label] = { label: element.label, @@ -62,8 +70,12 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; const closePopup = () => { // 팝업 닫기 - selectInftwtAnlsRslt(inftwtAnlsSn,"L13101003").then((data) => { - chartData.chartData1 = getChartDataInftwtAnlsRslt(data ?? []); + selectInftwtAnlsRslt(inftwtAnlsSn,"L13101003").then((data) => {// 침입수분석 결과 조회 + const rsltData = getChartDataInftwtAnlsRslt(data ?? []); + setChartData({ + chartData1: rsltData, + chartData2: rsltData, // 예시로 같은 데이터를 사용 + }); }); setPopupOpen(false); }; @@ -139,24 +151,28 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe </div> <div>오수 전환율:</div> <div> - <input - type="text" - value={inftwtAnls?.drtwSwtcRt ?? ""} + <input type="text" value={inftwtAnls?.drtwSwtcRt ?? ""} + className="border border-gray-300 rounded px-2 py-1 w-full" /> + </div> + <div>시간패턴 파일명:</div> + <div> + <input type="text" value={inftwtAnls?.atflHrPttnNm ?? ""} className="border border-gray-300 rounded px-2 py-1 w-full" /> </div> <div>수용가-맨홀 매칭:</div> <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>매칭(양평).shp</option> - <option>매칭(서울).shp</option> - </select> + <input type="text" value={inftwtAnls?.atflMpngNm ?? ""} + className="border border-gray-300 rounded px-2 py-1 w-full" /> </div> - <div>관망도 자료:</div> + <div>관망도 파일명:</div> <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>양평.inp</option> - <option>서울.inp</option> - </select> + <input type="text" value={inftwtAnls?.atflInpNm ?? ""} + className="border border-gray-300 rounded px-2 py-1 w-full" /> + </div> + <div>유량 파일명:</div> + <div> + <input type="text" value={inftwtAnls?.atflOilqNm ?? ""} + className="border border-gray-300 rounded px-2 py-1 w-full" /> </div> {btnTxt === 'RDII' ? <><div>강우 자료:</div> <div> From d2564012e31f10d2c73634c236cffdf9cb6b518c Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Mon, 30 Jun 2025 11:46:42 +0900 Subject: [PATCH 054/259] =?UTF-8?q?=ED=95=98=EC=88=98=EA=B4=80=EB=A1=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 1 + apps/sn/.env.local | 5 ++-- .../map/featureClickEventPopup.tsx | 2 +- apps/sn/app/page.tsx | 8 ++++--- apps/sn/middleware.ts | 23 +++++++++++++++++-- .../business_components/src/ui/map/Gis.js | 2 +- .../src/ui/map/lib/gis.core.js | 2 +- packages/common/components/src/api/site.ts | 1 - .../common/components/src/ui/header/index.tsx | 2 -- 9 files changed, 33 insertions(+), 13 deletions(-) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index 1c90d2e08..ae171eaae 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -3,6 +3,7 @@ NEXT_PUBLIC_PORT = 11302 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_TEMP_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 51abdda6f..0feaf6f97 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -3,11 +3,12 @@ NEXT_PUBLIC_PORT = 3002 NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_TEMP_GEOSERVER_URL = http://192.168.1.20:8080/geoserver #TODO 운영에서 바꿔야 함 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API -#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 차장님 API diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 064d8bc2d..79f90a32a 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -170,7 +170,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, </div> <div className="overflow-y-auto overflow-x-hidden flex-1" ref={contentRef}> <VerticalTable - headName='LX 연계정보' + headName='기본정보' tableName1={layerNm === '중점우수토실' ? "측정지점" : undefined} tableData={[tableData]} headlist={headlist} diff --git a/apps/sn/app/page.tsx b/apps/sn/app/page.tsx index 846a46ad0..c6db7fabe 100644 --- a/apps/sn/app/page.tsx +++ b/apps/sn/app/page.tsx @@ -1,8 +1,9 @@ -"use client"; -import Link from "next/link"; -import { Button } from "@common/components/ui"; +import { redirect } from "next/navigation"; export default function Home() { + redirect("/map"); + + /* return ( <div> <div> @@ -45,4 +46,5 @@ export default function Home() { </div> </div> ); + */ } diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index f76696f53..922d9d6dc 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -3,8 +3,9 @@ import { NextRequest, NextResponse } from "next/server"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL || ""; -const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; +const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; +const TEMP_GEOSERVER_URL = process.env.NEXT_PUBLIC_TEMP_GEOSERVER_URL || ""; export function middleware(req: NextRequest) { console.log("Middleware 진입:", req.nextUrl.pathname); @@ -22,7 +23,25 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/geoserver")) { const queryParams = searchParams.toString(); - const newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ + + //TODO 운영에서 변경 해야함. + const typename = searchParams.get("TYPENAME"); + + let newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ + queryParams ? `?${queryParams}` : "" + }`; + if(typename == 'hasudo:tb_ms_swage_ppl'){ + newUrl = `${TEMP_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ + queryParams ? `?${queryParams}` : "" + }`; + } + console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); + return NextResponse.rewrite(new URL(newUrl)); + } + + if (pathname.startsWith("/tempgeoserver")) { + const queryParams = searchParams.toString(); + const newUrl = `${TEMP_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ queryParams ? `?${queryParams}` : "" }`; console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index f45fe4e12..fa1cf7ab4 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -121,7 +121,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa projection: GisApp.TO_PROJ, zoom: gisCore.defaults.zoom, center: olProj.transform( - [126.6757, 37.5585], + [127.4875, 37.4916], GisApp.FROM_PROJ, GisApp.TO_PROJ ), diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index db58c898f..ddfcec3a1 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -94,7 +94,7 @@ GisApp.core.prototype = { target: '', centerX: 37.2806094, centerY: 127.0032502, - zoom: 12, + zoom: 15, minZoom: 6, maxZoom: 20, }, diff --git a/packages/common/components/src/api/site.ts b/packages/common/components/src/api/site.ts index 06798a99f..8d8109571 100644 --- a/packages/common/components/src/api/site.ts +++ b/packages/common/components/src/api/site.ts @@ -26,7 +26,6 @@ export interface SiteInfo { const client = getApiClient(); export const getSiteInfo = async (siteId: string) => { - console.log("2:::",siteId) const response = await client.get<SiteInfo>( `${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`, ); diff --git a/packages/common/components/src/ui/header/index.tsx b/packages/common/components/src/ui/header/index.tsx index 3b8f5e2ab..8457b28dd 100644 --- a/packages/common/components/src/ui/header/index.tsx +++ b/packages/common/components/src/ui/header/index.tsx @@ -31,8 +31,6 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) { enabled: !viewOnly, }); - console.log("1:::",{SITE_ID}) - console.log("1.1:::", process.env.NEXT_PUBLIC_SITE_ID) const { data: siteInfo } = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.SITES, SITE_ID], queryFn: () => getSiteInfo(SITE_ID ?? ""), From 16bcaf89473364fb4859f6947d2f46874f19093c Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Mon, 30 Jun 2025 14:21:52 +0900 Subject: [PATCH 055/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 96 +++++++++++++++++-- .../app/store/matDmd/ruseCaseMng/headList.tsx | 4 +- .../wr/app/store/matDmd/ruseCaseMng/index.tsx | 8 +- 3 files changed, 92 insertions(+), 16 deletions(-) diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index 63d0f662e..436b77736 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -7,6 +7,7 @@ import RuseCaseMngExcel from "@/components/ui/modal/coMat/ruseCaseMng/ruseCaseMn import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import { ContentsDiv, + filePickedBlobArray, SearchDiv, SearchFormLeft, SearchFormRight, @@ -24,7 +25,7 @@ import { useState } from "react"; export default function RuseCaseMng() { const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); const { ruseCaseMngList } = ruseCaseMng; - const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>([{val: "0", text: "전체"}]); + const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>([]); const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); const [sidoCd, setSidoCd] = useState<string>(""); @@ -34,17 +35,19 @@ export default function RuseCaseMng() { // 물재이용사례 조회 const searchRuseCaseMng = async () => { - console.log(selectUtz); - const res = await selectRuseCaseMng(sidoCd, sigunguCd, selectUtz, name); - console.log('res : ', res); + const res = await selectRuseCaseMng( + sidoCd ?? "", + sigunguCd ?? "", + selectUtz[0] ?? "", + name ?? "" + ); } // 시도 선택 const getSelCity = (val: string | number) => { const cityValue = String(val); - const cityText = code.cityCd.find((item: any) => item.cityCd === cityValue)?.text; + const cityText = code.cityCd.find((item: { val: string; text: string }) => item.val === cityValue)?.text; setSidoCd(cityText || ""); - const data = getCity(cityValue, code.sggCd); setSelectSgg(data); setObjSearch({ city: cityValue, sgg: "" }); @@ -53,7 +56,7 @@ export default function RuseCaseMng() { // 시군구 선택 const getSgg = (val: string | number) => { const sggValue = String(val); - const sggText = selectSgg?.find((item: any) => item.sggCd === sggValue)?.sggNm; + const sggText = selectSgg?.find((item: { val: string; text: string }) => item.val === sggValue)?.text; setSigunguCd(sggText || ""); setObjSearch({ ...objSearch, sgg: String(val) }); }; @@ -65,7 +68,82 @@ export default function RuseCaseMng() { // 다운로드 const download = () => { - console.log("다운로드"); + searchRuseCaseMng(); + + fetch(`/sample_ruseCaseMng.xlsx`, {}).then(async (response) => { + if (!response.ok) { + throw Error(response.statusText); + } + // 받은 파일 바인너리 처리 + const blobRet = await response.arrayBuffer(); + + const excelData1 = ruseCaseMngList.map((item) => { + return [ + item.ruseBizNm, + item.bizBgngDate, + item.bizEndDate, + item.splyFcltKnd, + item.splyFcltNm, + item.splyFcltCpct, + item.dmdFcltNm, + item.dmdFcltAddr, + item.ruseFcltCpct, + item.ruseFcltPplLen, + item.ruseFcltUsg, + item.ruseFcltSplyCpct, + item.ruseFcltPrcsMsrc, + item.grnteWqUsg, + item.grnteWqGrssClfg, + item.grnteWqCombResdch, + item.grnteWqTrbt, + item.grnteWqBod, + item.grnteWqSmll, + item.grnteWqCrmty, + item.grnteWqTn, + item.grnteWqTp, + item.grnteWqPh, + item.grnteWqClIonQnt, + item.grnteWqCndctStat, + item.grnteWqRmrk, + item.reqBizGrssCst, + item.reqBizReuseFcltCst, + item.reqBizPplCst, + item.reqBizArchCst, + item.reqBizMchnCst, + item.reqBizMtrngCst, + item.reqBizGisCst, + item.reqBizCctvCst, + item.reqBizCmcnCst, + item.reqBizWstCst, + item.reqBizDesignCst, + item.reqBizSpvsCst, + item.reqBizSbsdCst, + item.reqBizEtc, + item.prcmPlanGrssCst, + item.prcmPlanNlep, + item.prcmPlanLcep, + item.prcmPlanBrdnCst, + item.prcmPlanEcqrRt, + item.clclnGrssCst, + item.clclnNlep, + item.clclnLcep, + item.clclnBrdnCst, + item.clclnEcqrRt, + ]; + }); + + const sheetParameter = [ + { + data: excelData1, + headerNum: 2, + headerRange: 'A1:AX1', + sheetName: '물재이용사례', + startCol: 'A' + } + ]; + // 버퍼에 있는 엑셀데이터 전달 후 json으로 변환 + await filePickedBlobArray(blobRet, '시설정보및운영현황황', sheetParameter); + }); } // 양식받기 @@ -130,7 +208,7 @@ export default function RuseCaseMng() { <Button size={"sm"} onClick={() => { setIsExcelOpen({ isModal: true }); }}> 엑셀등록 </Button> - <Button size={"sm"} onClick={() => {}}> + <Button size={"sm"} onClick={() => { download() }}> 다운로드 </Button> <Button size={"sm"} onClick={() => { sampleDownLoad() }}> diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx index 0a722e6c4..8c3a232e7 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/headList.tsx @@ -110,7 +110,7 @@ export const ruseCaseHeadListExport: TableUpperProps[] = [ title: "보증수질", visible: true, row: 0, - colSpan: 14, + colSpan: 13, }, { id: "grnteWqUsg", @@ -205,7 +205,7 @@ export const ruseCaseHeadListExport: TableUpperProps[] = [ }, { id: "reqBizReuseFcltCst", - title: "토목재이용시설", + title: "토목재이용시설", visible: true, row: 1, }, diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx index 7ef350565..915740f79 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx @@ -6,7 +6,7 @@ import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; export type ruseCaseState = { ruseCaseMng: { ruseHeadList:TableUpperProps[]; - ruseCaseMngList:TableUpperProps[]; + ruseCaseMngList:ruseCaseMngExcelProps[]; }; }; @@ -69,15 +69,13 @@ type ruseCaseActions = { }; export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { - const tailUrl = (sidoCd && !sigunguCd ? `/${sigunguCd}` : sigunguCd ? `/${sigunguCd}` : '/0') + (usageCd ? `/${usageCd}` : '') + (name ? `/${name}` : ''); - console.log('tailUrl : ', tailUrl); + + const tailUrl = ((sigunguCd !== '전체' && sigunguCd !=='') ? `/${sigunguCd}` : (sidoCd != '전체' && sidoCd != '') ? `/${sidoCd}` : `/0`) + (usageCd? `/${usageCd}` : '/0') + (name? `/${name}` : ''); const resp = await getFetch(fetchType.WR,`/reuseFc/pubFcRuseCase${tailUrl}`); - console.log('resp : ', resp); return resp; }; export const fetchInsertRuseCaseMng = async (data: any) => { - console.log('data : ', data) const response = await postFectch('/reuseFc/pubFcRuseCase', data, fetchType.WR); return response.data; }; From 515f75bd804f0645cc383ed3e742fad46dbb2f78 Mon Sep 17 00:00:00 2001 From: mind-one005 <mind-one005@mind-one.co.kr> Date: Mon, 30 Jun 2025 15:45:01 +0900 Subject: [PATCH 056/259] =?UTF-8?q?=EA=B7=B8=EB=9E=98=ED=94=84=20x?= =?UTF-8?q?=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 32 ++++++++- .../popupComponent/chart/infilChart.tsx | 70 ++++++++++--------- 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index ccce0095a..53b4c7954 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -27,6 +27,12 @@ export type TInftwtAnlsRslt = { anlsTm: string; predcOilq:number; } +export type TOilqData = { + inftwtAnlsSn: number; // 침입수분석 일련번호 + pplMngNo: string; // 관로관리번호 + mtrngDt: string; // 계측일시 + oilq: number; // 유량 +} const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] => { let yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); @@ -78,7 +84,7 @@ export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); if (result && result.numberOfElements > 0) { - console.log("selectInftwtAnls", result.content); + //console.log("selectInftwtAnls", result.content); return result.content; } } catch (error) { @@ -100,7 +106,29 @@ export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string) } const result = await getData(`v1/inftwtAnlsRslt/ppl/${inftwtAnlsSn}/${pplMngNo}`); if (result && result.numberOfElements > 0) { - console.log("selectInftwtAnlsRslt", result.content); + //console.log("selectInftwtAnlsRslt", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; +export const getChartDataOilq = (arr: TOilqData[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.mtrngDt, + val: anlsRslt.oilq, + })); + return options; +}; +export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // 유량 + try { + if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { + console.warn("inftwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/inftwtAnlsRslt/oilqppl/${inftwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectOilq", result.content); return result.content; } } catch (error) { diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 31c92d339..fcdf5dbf8 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -5,9 +5,11 @@ import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_compon import Modal from '@/components/ui/modal'; import { Button } from '@common/components/ui'; import { getData } from "@/components/lib/api"; + import type { TInftwtAnls, TInftwtAnlsRslt } from './aplcnYms'; import { useAplcnYms, selectInftwtAnls, getOptionsInftwtAnlsInfo} from './aplcnYms'; import { selectInftwtAnlsRslt, getChartDataInftwtAnlsRslt} from './aplcnYms'; +import { selectOilq, getChartDataOilq} from './aplcnYms'; import { set } from 'react-hook-form'; type ModalOpenProp = { isModalOpen: boolean, @@ -26,14 +28,25 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls|null>(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ - chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], - chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], - }); - + chartData1: [],chartData2: [],}); + useEffect(() => { + if(isModalOpen === false){ + setPopupOpen(true); // 모달이 닫힐 때 팝업은 + setAplcnYm(""); // 상수사용월 초기화 + setInftwtAnlss([]); // 침입수분석 초기화 + setInftwtAnlsInfos([]); // 침입수분석정보 초기화 + setInftwtAnls(null); // 침입수분석정보 초기화 + setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 + setChartData({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); // 차트 데이터 초기화 + } + }, [isModalOpen]); //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { @@ -49,34 +62,26 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe //console.log("btnTxt", btnTxt); const chartForm = CHART_FORM.LINE; - // const chartData = { - // chartData1: [ - // { label: "1", val: 20 }, - // { label: "3", val: 40 }, - // { label: "5", val: 60 }, - // ], - // chartData2: [ - // { label: "1", val: 15 }, - // { label: "3", val: 35 }, - // { label: "5", val: 55 }, - // ], - // } - const chartConfig = Object.values(chartData).flat().reduce((config, element) => { - config[element.label] = { - label: element.label, - color: "hsl(var(--chart-1))", - }; - return config; - }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; - + const chartConfig = { + chartData1: {label: '침입수예측유량',color: "red",}, + chartData2: {label: '실측유량',color: "orange",} + } as ChartConfig; + const closePopup = () => { // 팝업 닫기 selectInftwtAnlsRslt(inftwtAnlsSn,"L13101003").then((data) => {// 침입수분석 결과 조회 const rsltData = getChartDataInftwtAnlsRslt(data ?? []); - setChartData({ - chartData1: rsltData, - chartData2: rsltData, // 예시로 같은 데이터를 사용 - }); + setChartData(prev => ({ + ...prev, + chartData1: rsltData // 침입수분석결과 + })); }); + // selectOilq(inftwtAnlsSn,"L13101003").then((data) => {// 유량 조회 + // const rsltData = getChartDataOilq(data ?? []); + // setChartData(prev => ({ + // ...prev, + // chartData2: rsltData // 유량 + // })); + // }); setPopupOpen(false); }; const onChangeAplcnYm = (e: React.ChangeEvent<HTMLSelectElement>) => { @@ -97,6 +102,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe setInftwtAnls(selectedAnls); } }; + return ( <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} > {/* 분석 입력현황 조회 */} From a0ee6f34f5dad2038ade287ae51d7b62be7392ec Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 30 Jun 2025 15:46:12 +0900 Subject: [PATCH 057/259] =?UTF-8?q?refactor=20:=20inflChart.tsx=20?= =?UTF-8?q?=EA=B3=B5=ED=86=B5=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/infilChart.tsx | 310 +++++++++++++----- 1 file changed, 221 insertions(+), 89 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 31c92d339..f96065a4e 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -1,13 +1,12 @@ 'use client' import React, { useState, useMemo, useEffect } from 'react' import { SelectBox } from '@common/business_components/ui' -import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_components"; -import Modal from '@/components/ui/modal'; -import { Button } from '@common/components/ui'; +import { type ChartConfig, MainChart, CHART_FORM, UiModal } from "@common/business_components"; +import { Button, Input, Label } from '@common/components'; import { getData } from "@/components/lib/api"; import type { TInftwtAnls, TInftwtAnlsRslt } from './aplcnYms'; -import { useAplcnYms, selectInftwtAnls, getOptionsInftwtAnlsInfo} from './aplcnYms'; -import { selectInftwtAnlsRslt, getChartDataInftwtAnlsRslt} from './aplcnYms'; +import { useAplcnYms, selectInftwtAnls, getOptionsInftwtAnlsInfo } from './aplcnYms'; +import { selectInftwtAnlsRslt, getChartDataInftwtAnlsRslt } from './aplcnYms'; import { set } from 'react-hook-form'; type ModalOpenProp = { isModalOpen: boolean, @@ -16,26 +15,86 @@ type ModalOpenProp = { btnTxt?: string, } -const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpenProp) => { +// 더미 데이터 리스트 +const rainDataList = [ + { val: "R20240815.xlsx", text: "R20240815.xlsx" }, + { val: "R20240701.xlsx", text: "R20240701.xlsx" }, + { val: "R20240615.xlsx", text: "R20240615.xlsx" }, + { val: "R20240531.xlsx", text: "R20240531.xlsx" }, + { val: "R20240420.xlsx", text: "R20240420.xlsx" }, +]; +const rtxSourceList = [ + { val: "2015년 하수도정비기본계획", text: "2015년 하수도정비기본계획" }, + { val: "2018년 하수도정비기본계획", text: "2018년 하수도정비기본계획" }, + { val: "2020년 하수도정비기본계획", text: "2020년 하수도정비기본계획" }, + { val: "2022년 하수도정비기본계획", text: "2022년 하수도정비기본계획" }, + { val: "2024년 하수도정비기본계획", text: "2024년 하수도정비기본계획" }, +]; +// 상수사용월 더미 데이터 +const dummyAplcnYms = [ + { val: '0', text: '선택' }, + { val: '202401', text: '2024-01' }, + { val: '202402', text: '2024-02' }, + { val: '202403', text: '2024-03' }, + { val: '202404', text: '2024-04' }, + { val: '202405', text: '2024-05' }, + { val: '202406', text: '2024-06' }, + { val: '202407', text: '2024-07' }, + { val: '202408', text: '2024-08' }, + { val: '202409', text: '2024-09' }, + { val: '202410', text: '2024-10' }, + { val: '202411', text: '2024-11' }, + { val: '202412', text: '2024-12' }, +]; +// 침입수분석정보 더미 데이터 +const dummyInftwtAnlsInfos = [ + { val: 0, text: '선택' }, + { val: 1001, text: '서울시 강남구 침입수분석 1차' }, + { val: 1002, text: '서울시 강남구 침입수분석 2차' }, + { val: 1003, text: '서울시 서초구 침입수분석 1차' }, + { val: 1004, text: '부산시 해운대구 침입수분석 1차' }, + { val: 1005, text: '대구시 수성구 침입수분석 1차' }, + { val: 1006, text: '인천시 연수구 침입수분석 1차' }, + { val: 1007, text: '광주시 북구 침입수분석 1차' }, + { val: 1008, text: '대전시 유성구 침입수분석 1차' }, + { val: 1009, text: '울산시 남구 침입수분석 1차' }, + { val: 1010, text: '경기도 성남시 침입수분석 1차' }, +]; + +const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState(""); const [inftwtAnlss, setInftwtAnlss] = useState<TInftwtAnls[]>([]); - const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([]); // 침입수분석정보 options - const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls|null>(null); // 침입수분석정보 + // const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([]); // 침입수분석정보 options + const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 + const [drtwSwtcRt, setDrtwSwtcRt] = useState<number>(0); // 오수전환율 + const [atflHrPttnNm, setAtflHrPttnNm] = useState<number>(0); // 시간패턴 파일명 + const [atflMpng, setAtflMpng] = useState<number>(0); // 수용가-맨홀 매칭 + const [atflInpNm, setAtflInpNm] = useState<number>(0); // 관망도 파일명 + const [tbSnOilqData, setTbSnOilqData] = useState<number>(0); // 유량 파일명 const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], + { label: "3", val: 40 }, + { label: "5", val: 60 },], chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], + { label: "3", val: 35 }, + { label: "5", val: 55 },], }); + // 상수사용월, 분석정보 더미 데이터로 초기화 (API 호출 실패 시 대비) + const [selectedAplcnYms, setSelectedAplcnYms] = useState<string>(dummyAplcnYms[0]?.val || "0"); + const [selectedInftwtAnlsInfos, setSelectedInftwtAnlsInfos] = useState<number>(dummyInftwtAnlsInfos[0]?.val || 0); + // 선택된 값들을 위한 상태 추가 + const [selectedRainData, setSelectedRainData] = useState<string>(rainDataList[0]?.val || "선택"); // 초기값으로 첫 번째 항목 선택 + const [selectedRtxSource, setSelectedRtxSource] = useState<string>(rtxSourceList[0]?.val || "선택"); + // API에서 데이터를 가져오지 못할 경우 더미 데이터 사용 + // const aplcnYms = useAplcnYms().length > 0 ? useAplcnYms() : dummyAplcnYms; + //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); - const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 + // const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -47,7 +106,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe setPopupOpen(true); // 팝업 열기 }; //console.log("btnTxt", btnTxt); - + const chartForm = CHART_FORM.LINE; // const chartData = { // chartData1: [ @@ -70,35 +129,38 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; const closePopup = () => { // 팝업 닫기 - selectInftwtAnlsRslt(inftwtAnlsSn,"L13101003").then((data) => {// 침입수분석 결과 조회 + selectInftwtAnlsRslt(inftwtAnlsSn, "L13101003").then((data) => {// 침입수분석 결과 조회 const rsltData = getChartDataInftwtAnlsRslt(data ?? []); setChartData({ chartData1: rsltData, chartData2: rsltData, // 예시로 같은 데이터를 사용 }); }); - setPopupOpen(false); + setPopupOpen(false); }; - const onChangeAplcnYm = (e: React.ChangeEvent<HTMLSelectElement>) => { - const selectedValue = e.target.value; - selectInftwtAnls(selectedValue).then((data) => { - setInftwtAnlss(data ?? []); - console.log("onChangeAplcnYm", selectedValue, inftwtAnlss); - setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data ?? [])); - }); - setAplcnYm(selectedValue); - }; - const onChangeInftwtAnlsInfo = (e: React.ChangeEvent<HTMLSelectElement>) => { - const selectedInfo = e.target.value; - setInftwtAnlsSn(Number(selectedInfo)); // 선택값 상태로 저장 - // 선택된 침입수분석 정보에 대한 처리 로직 추가 - const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === Number(selectedInfo)); - if (selectedAnls) { - setInftwtAnls(selectedAnls); - } - }; - return ( - <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} > + // const onChangeAplcnYm = (e: React.ChangeEvent<HTMLSelectElement>) => { + // const selectedValue = e.target.value; + // selectInftwtAnls(selectedValue).then((data) => { + // setInftwtAnlss(data ?? []); + // console.log("onChangeAplcnYm", selectedValue, inftwtAnlss); + // setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data ?? [])); + // }); + // setAplcnYm(selectedValue); + // }; + // const onChangeInftwtAnlsInfo = (e: React.ChangeEvent<HTMLSelectElement>) => { + // const selectedInfo = e.target.value; + // setInftwtAnlsSn(Number(selectedInfo)); // 선택값 상태로 저장 + // // 선택된 침입수분석 정보에 대한 처리 로직 추가 + // const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === Number(selectedInfo)); + // if (selectedAnls) { + // setInftwtAnls(selectedAnls); + // } + // }; + + + const renderBody = () => ( + <> + {/* <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} > */} {/* 분석 입력현황 조회 */} <div className='grid grid-cols-4 gap-4'> <div className="grid grid-rows-4 gap-4 mb-4"> @@ -130,72 +192,142 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal}: ModalOpe }} > <div className="font-bold mb-6 text-3xl">침입수분석 입력현황</div> - <div className="grid grid-cols-[35%_65%] gap-2"> - <div><label>상수사용월:</label></div> - <div> - <select className="border border-gray-300 rounded px-2 py-1" - onChange={onChangeAplcnYm} value={aplcnYm}> - {aplcnYms.map(opt => ( - <option key={opt.val} value={opt.val}>{opt.text}</option> - ))} - </select> + <div className='flex flex-col'> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">상수사용월:</Label> + <SelectBox + className="w-[200px] mr-8 z-[51]" + selectClass="rounded-lg bg-white" + label='' + selectArray={dummyAplcnYms} + value={selectedAplcnYms} + onSelectValue={(val) => { + setSelectedAplcnYms(String(val)); + }} + /> </div> - <div><label>분석정보:</label></div> - <div> - <select className="border border-gray-300 rounded px-2 py-1" - onChange={onChangeInftwtAnlsInfo} value={inftwtAnlsSn}> - {inftwtAnlsInfos.map(opt => ( - <option key={opt.val} value={opt.val}>{opt.text}</option> - ))} - </select> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">분석정보:</Label> + <SelectBox + className="w-[200px] mr-8 z-[51]" + selectClass="rounded-lg bg-white" + label='' + selectArray={dummyInftwtAnlsInfos} + value={selectedInftwtAnlsInfos} + onSelectValue={(val) => { + setSelectedInftwtAnlsInfos(Number(val)); + }} + /> </div> - <div>오수 전환율:</div> - <div> - <input type="text" value={inftwtAnls?.drtwSwtcRt ?? ""} - className="border border-gray-300 rounded px-2 py-1 w-full" /> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">오수전환율:</Label> + <Input + className="mr-8 w-[200px] !text-xl placeholder:text-center" + placeholder="입력" + value={drtwSwtcRt} + onChange={(e) => { + setDrtwSwtcRt(Number(e.target.value)); + }} + /> </div> - <div>시간패턴 파일명:</div> - <div> - <input type="text" value={inftwtAnls?.atflHrPttnNm ?? ""} - className="border border-gray-300 rounded px-2 py-1 w-full" /> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">시간패턴 파일명:</Label> + <Input + className="mr-8 w-[200px] !text-xl placeholder:text-center" + placeholder="입력" + value={atflHrPttnNm} + onChange={(e) => { + setAtflHrPttnNm(Number(e.target.value)); + }} + /> </div> - <div>수용가-맨홀 매칭:</div> - <div> - <input type="text" value={inftwtAnls?.atflMpngNm ?? ""} - className="border border-gray-300 rounded px-2 py-1 w-full" /> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">수용가-맨홀 매칭:</Label> + <Input + className="mr-8 w-[200px] !text-xl placeholder:text-center" + placeholder="입력" + value={atflMpng} + onChange={(e) => { + setAtflMpng(Number(e.target.value)); + }} + /> </div> - <div>관망도 파일명:</div> - <div> - <input type="text" value={inftwtAnls?.atflInpNm ?? ""} - className="border border-gray-300 rounded px-2 py-1 w-full" /> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">관망도 파일명:</Label> + <Input + className="mr-8 w-[200px] !text-xl placeholder:text-center" + placeholder="입력" + value={atflInpNm} + onChange={(e) => { + setAtflInpNm(Number(e.target.value)); + }} + /> </div> - <div>유량 파일명:</div> - <div> - <input type="text" value={inftwtAnls?.atflOilqNm ?? ""} - className="border border-gray-300 rounded px-2 py-1 w-full" /> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">유량 파일명:</Label> + <Input + className="mr-8 w-[200px] !text-xl placeholder:text-center" + placeholder="입력" + value={tbSnOilqData} + onChange={(e) => { + setTbSnOilqData(Number(e.target.value)); + }} + /> </div> - {btnTxt === 'RDII' ? <><div>강우 자료:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>R20240815.xlsx</option> - </select> - </div> - <div>RTX 계수 출처:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>2015년 하수도정비기본계획</option> - </select> - </div> - </> : null} + {btnTxt === 'RDII' ? + <> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">강우 자료:</Label> + <SelectBox + className="w-[150px] mr-8 z-[51]" + selectClass="rounded-lg bg-white" + label='' + selectArray={rainDataList} + value={selectedRainData} + onSelectValue={(val) => { + setSelectedRainData(String(val)); + }} + /> + </div> + <div className='flex items-center justify-between'> + <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">RTX 계수 출처:</Label> + <SelectBox + className="w-[150px] mr-8 z-[51]" + selectClass="rounded-lg bg-white" + label='' + selectArray={rtxSourceList} + value={selectedRtxSource} + onSelectValue={(val) => { + setSelectedRtxSource(String(val)); + }} + /> + </div> + </> : null} </div> <div className="flex justify-end mt-4 space-x-2"> <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> 분석결과 도표 </button> </div> - </div> - )} - </Modal> + </div>)} + {/* </Modal > */} + </> + ) + + return ( + <UiModal + open={isModalOpen} + onOpenChange={setIsModalOpen} + bodyClass={` + h-[50vh] + w-[40vw] + max-w-none + max-h-none + overflow-visible + z-[50] + `} + body={renderBody()} + /> ) } From 2c3b2785bcef03905d0191e29bc009c7a2f60243 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 30 Jun 2025 16:33:54 +0900 Subject: [PATCH 058/259] =?UTF-8?q?refactor:=20infilChart.tsx=20=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/infilChart.tsx | 242 ++++++------------ 1 file changed, 79 insertions(+), 163 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index c8816d114..7de4848e5 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -1,15 +1,11 @@ 'use client' -import React, { useState, useMemo, useEffect } from 'react' -import { SelectBox } from '@common/business_components/ui' -import { type ChartConfig, MainChart, CHART_FORM, UiModal } from "@common/business_components"; +import { CHART_FORM, type ChartConfig, MainChart, UiModal } from "@common/business_components"; +import { SelectBox } from '@common/business_components/ui'; import { Button, Input, Label } from '@common/components'; -import { getData } from "@/components/lib/api"; +import React, { useEffect, useState } from 'react'; -import type { TInftwtAnls, TInftwtAnlsRslt } from './aplcnYms'; -import { useAplcnYms, selectInftwtAnls, getOptionsInftwtAnlsInfo} from './aplcnYms'; -import { selectInftwtAnlsRslt, getChartDataInftwtAnlsRslt} from './aplcnYms'; -import { selectOilq, getChartDataOilq} from './aplcnYms'; -import { set } from 'react-hook-form'; +import type { TInftwtAnls } from './aplcnYms'; +import { getChartDataInftwtAnlsRslt, getOptionsInftwtAnlsInfo, selectInftwtAnls, selectInftwtAnlsRslt, useAplcnYms } from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, @@ -17,51 +13,7 @@ type ModalOpenProp = { btnTxt?: string, } -// 더미 데이터 리스트 -const rainDataList = [ - { val: "R20240815.xlsx", text: "R20240815.xlsx" }, - { val: "R20240701.xlsx", text: "R20240701.xlsx" }, - { val: "R20240615.xlsx", text: "R20240615.xlsx" }, - { val: "R20240531.xlsx", text: "R20240531.xlsx" }, - { val: "R20240420.xlsx", text: "R20240420.xlsx" }, -]; -const rtxSourceList = [ - { val: "2015년 하수도정비기본계획", text: "2015년 하수도정비기본계획" }, - { val: "2018년 하수도정비기본계획", text: "2018년 하수도정비기본계획" }, - { val: "2020년 하수도정비기본계획", text: "2020년 하수도정비기본계획" }, - { val: "2022년 하수도정비기본계획", text: "2022년 하수도정비기본계획" }, - { val: "2024년 하수도정비기본계획", text: "2024년 하수도정비기본계획" }, -]; -// 상수사용월 더미 데이터 -const dummyAplcnYms = [ - { val: '0', text: '선택' }, - { val: '202401', text: '2024-01' }, - { val: '202402', text: '2024-02' }, - { val: '202403', text: '2024-03' }, - { val: '202404', text: '2024-04' }, - { val: '202405', text: '2024-05' }, - { val: '202406', text: '2024-06' }, - { val: '202407', text: '2024-07' }, - { val: '202408', text: '2024-08' }, - { val: '202409', text: '2024-09' }, - { val: '202410', text: '2024-10' }, - { val: '202411', text: '2024-11' }, - { val: '202412', text: '2024-12' }, -]; -// 침입수분석정보 더미 데이터 -const dummyInftwtAnlsInfos = [ - { val: 0, text: '선택' }, - { val: 1001, text: '서울시 강남구 침입수분석 1차' }, - { val: 1002, text: '서울시 강남구 침입수분석 2차' }, - { val: 1003, text: '서울시 서초구 침입수분석 1차' }, - { val: 1004, text: '부산시 해운대구 침입수분석 1차' }, - { val: 1005, text: '대구시 수성구 침입수분석 1차' }, - { val: 1006, text: '인천시 연수구 침입수분석 1차' }, - { val: 1007, text: '광주시 북구 침입수분석 1차' }, - { val: 1008, text: '대전시 유성구 침입수분석 1차' }, - { val: 1009, text: '울산시 남구 침입수분석 1차' }, - { val: 1010, text: '경기도 성남시 침입수분석 1차' }, -]; + const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); @@ -72,11 +24,6 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 - const [drtwSwtcRt, setDrtwSwtcRt] = useState<number>(0); // 오수전환율 - const [atflHrPttnNm, setAtflHrPttnNm] = useState<number>(0); // 시간패턴 파일명 - const [atflMpng, setAtflMpng] = useState<number>(0); // 수용가-맨홀 매칭 - const [atflInpNm, setAtflInpNm] = useState<number>(0); // 관망도 파일명 - const [tbSnOilqData, setTbSnOilqData] = useState<number>(0); // 유량 파일명 const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ chartData1: [{ label: "1", val: 20 }, { label: "3", val: 40 }, @@ -86,36 +33,12 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp { label: "5", val: 55 },], }); // chartData1: [],chartData2: [],}); - useEffect(() => { - if(isModalOpen === false){ - setPopupOpen(true); // 모달이 닫힐 때 팝업은 - setAplcnYm(""); // 상수사용월 초기화 - setInftwtAnlss([]); // 침입수분석 초기화 - setInftwtAnlsInfos([]); // 침입수분석정보 초기화 - setInftwtAnls(null); // 침입수분석정보 초기화 - setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 - setChartData({ - chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], - chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], - }); // 차트 데이터 초기화 - } - }, [isModalOpen]); - // 상수사용월, 분석정보 더미 데이터로 초기화 (API 호출 실패 시 대비) - const [selectedAplcnYms, setSelectedAplcnYms] = useState<string>(dummyAplcnYms[0]?.val || "0"); - const [selectedInftwtAnlsInfos, setSelectedInftwtAnlsInfos] = useState<number>(dummyInftwtAnlsInfos[0]?.val || 0); - // 선택된 값들을 위한 상태 추가 - const [selectedRainData, setSelectedRainData] = useState<string>(rainDataList[0]?.val || "선택"); // 초기값으로 첫 번째 항목 선택 - const [selectedRtxSource, setSelectedRtxSource] = useState<string>(rtxSourceList[0]?.val || "선택"); // API에서 데이터를 가져오지 못할 경우 더미 데이터 사용 // const aplcnYms = useAplcnYms().length > 0 ? useAplcnYms() : dummyAplcnYms; //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); - // const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 + const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -130,10 +53,60 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const chartForm = CHART_FORM.LINE; const chartConfig = { - chartData1: {label: '침입수예측유량',color: "red",}, - chartData2: {label: '실측유량',color: "orange",} - } as ChartConfig; - + chartData1: { label: '침입수예측유량', color: "red", }, + chartData2: { label: '실측유량', color: "orange", } + } as ChartConfig; + + useEffect(() => { + if (isModalOpen === false) { + setPopupOpen(true); // 모달이 닫힐 때 팝업은 + setAplcnYm(""); // 상수사용월 초기화 + setInftwtAnlss([]); // 침입수분석 초기화 + setInftwtAnlsInfos([]); // 침입수분석정보 초기화 + setInftwtAnls(null); // 침입수분석정보 초기화 + setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 + setChartData({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); // 차트 데이터 초기화 + } + }, [isModalOpen]); + + // 상수사용월 변경시 분석 정보 리스트 가져오기 + useEffect(() => { + // aplcnYm이 비어있거나 "0"이면 API 호출하지 않음 + if (!aplcnYm || aplcnYm === "0" || aplcnYm === "") { + setInftwtAnlsSn(0); // 초기화 + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); + return; + } + + selectInftwtAnls(aplcnYm) + .then((data) => { + setInftwtAnlss(data ?? []); + setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data)); + }) + .catch((error) => { + console.error("selectInftwtAnls 에러:", error); + setInftwtAnlss([]); + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); + }); + setInftwtAnlsSn(0); // 초기화 + }, [aplcnYm]); + + // 값 표시 + useEffect(() => { + // 선택된 침입수분석 정보에 대한 처리 로직 + const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === inftwtAnlsSn); + if (selectedAnls) { + setInftwtAnls(selectedAnls); + } + }, [inftwtAnlsSn, inftwtAnlss]); + const closePopup = () => { // 팝업 닫기 selectInftwtAnlsRslt(inftwtAnlsSn, "L13101003").then((data) => {// 침입수분석 결과 조회 const rsltData = getChartDataInftwtAnlsRslt(data ?? []); @@ -149,27 +122,9 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp // chartData2: rsltData // 유량 // })); // }); - setPopupOpen(false); + setPopupOpen(false); }; - const onChangeAplcnYm = (e: React.ChangeEvent<HTMLSelectElement>) => { - const selectedValue = e.target.value; - selectInftwtAnls(selectedValue).then((data) => { - setInftwtAnlss(data ?? []); - console.log("onChangeAplcnYm", selectedValue, inftwtAnlss); - setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data ?? [])); - }); - setAplcnYm(selectedValue); - }; - const onChangeInftwtAnlsInfo = (e: React.ChangeEvent<HTMLSelectElement>) => { - const selectedInfo = e.target.value; - setInftwtAnlsSn(Number(selectedInfo)); // 선택값 상태로 저장 - // 선택된 침입수분석 정보에 대한 처리 로직 추가 - const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === Number(selectedInfo)); - if (selectedAnls) { - setInftwtAnls(selectedAnls); - } - }; - + const renderBody = () => ( @@ -213,10 +168,10 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp className="w-[200px] mr-8 z-[51]" selectClass="rounded-lg bg-white" label='' - selectArray={dummyAplcnYms} - value={selectedAplcnYms} + selectArray={aplcnYms} + value={aplcnYm} onSelectValue={(val) => { - setSelectedAplcnYms(String(val)); + setAplcnYm(String(val)); }} /> </div> @@ -226,10 +181,10 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp className="w-[200px] mr-8 z-[51]" selectClass="rounded-lg bg-white" label='' - selectArray={dummyInftwtAnlsInfos} - value={selectedInftwtAnlsInfos} + selectArray={inftwtAnlsInfos} + value={inftwtAnlsSn} onSelectValue={(val) => { - setSelectedInftwtAnlsInfos(Number(val)); + setInftwtAnlsSn(Number(val)); }} /> </div> @@ -238,10 +193,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp <Input className="mr-8 w-[200px] !text-xl placeholder:text-center" placeholder="입력" - value={drtwSwtcRt} - onChange={(e) => { - setDrtwSwtcRt(Number(e.target.value)); - }} + value={inftwtAnls?.drtwSwtcRt ?? ""} + readOnly={true} /> </div> <div className='flex items-center justify-between'> @@ -249,10 +202,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp <Input className="mr-8 w-[200px] !text-xl placeholder:text-center" placeholder="입력" - value={atflHrPttnNm} - onChange={(e) => { - setAtflHrPttnNm(Number(e.target.value)); - }} + value={inftwtAnls?.atflHrPttnNm ?? ""} + readOnly={true} /> </div> <div className='flex items-center justify-between'> @@ -260,10 +211,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp <Input className="mr-8 w-[200px] !text-xl placeholder:text-center" placeholder="입력" - value={atflMpng} - onChange={(e) => { - setAtflMpng(Number(e.target.value)); - }} + value={inftwtAnls?.atflMpngNm ?? ""} + readOnly={true} /> </div> <div className='flex items-center justify-between'> @@ -271,10 +220,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp <Input className="mr-8 w-[200px] !text-xl placeholder:text-center" placeholder="입력" - value={atflInpNm} - onChange={(e) => { - setAtflInpNm(Number(e.target.value)); - }} + value={inftwtAnls?.atflInpNm ?? ""} + readOnly={true} /> </div> <div className='flex items-center justify-between'> @@ -282,41 +229,10 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp <Input className="mr-8 w-[200px] !text-xl placeholder:text-center" placeholder="입력" - value={tbSnOilqData} - onChange={(e) => { - setTbSnOilqData(Number(e.target.value)); - }} + value={inftwtAnls?.atflOilqNm ?? "없음"} + readOnly={true} /> </div> - {btnTxt === 'RDII' ? - <> - <div className='flex items-center justify-between'> - <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">강우 자료:</Label> - <SelectBox - className="w-[150px] mr-8 z-[51]" - selectClass="rounded-lg bg-white" - label='' - selectArray={rainDataList} - value={selectedRainData} - onSelectValue={(val) => { - setSelectedRainData(String(val)); - }} - /> - </div> - <div className='flex items-center justify-between'> - <Label className="mr-2 w-auto text-2xl text-gray-600 whitespace-nowrap">RTX 계수 출처:</Label> - <SelectBox - className="w-[150px] mr-8 z-[51]" - selectClass="rounded-lg bg-white" - label='' - selectArray={rtxSourceList} - value={selectedRtxSource} - onSelectValue={(val) => { - setSelectedRtxSource(String(val)); - }} - /> - </div> - </> : null} </div> <div className="flex justify-end mt-4 space-x-2"> <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> From 8bb8825c5ee503fcd284701c6ddf6360af618fa5 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Mon, 30 Jun 2025 18:00:56 +0900 Subject: [PATCH 059/259] =?UTF-8?q?=EA=B4=80=EB=A1=9C=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 2 +- apps/sn/app/(map-layout)/map/page.tsx | 2 +- .../ii/{rdii_result => rdiiResult}/page.tsx | 0 apps/sn/middleware.ts | 23 +++++++++--------- .../map/layericon/SWL_MANH_PS_ORANGE.png | Bin 0 -> 455 bytes .../map/layericon/WTL_RSRV_PS_BLACK.png | Bin 0 -> 167 bytes .../map/layericon/WTL_RSRV_PS_GREEN.png | Bin 0 -> 167 bytes .../map/layericon/WTL_RSRV_PS_ORANGE.png | Bin 0 -> 164 bytes .../map/layericon/WTL_RSRV_PS_PURPLE.png | Bin 0 -> 165 bytes .../images/map/layericon/WTL_RSRV_PS_RED.png | Bin 0 -> 165 bytes .../map/layericon/WTL_RSRV_PS_YELLOW.png | Bin 0 -> 163 bytes 11 files changed, 13 insertions(+), 14 deletions(-) rename apps/sn/app/(with-base-layout)/ii/{rdii_result => rdiiResult}/page.tsx (100%) create mode 100644 apps/sn/public/images/map/layericon/SWL_MANH_PS_ORANGE.png create mode 100644 apps/sn/public/images/map/layericon/WTL_RSRV_PS_BLACK.png create mode 100644 apps/sn/public/images/map/layericon/WTL_RSRV_PS_GREEN.png create mode 100644 apps/sn/public/images/map/layericon/WTL_RSRV_PS_ORANGE.png create mode 100644 apps/sn/public/images/map/layericon/WTL_RSRV_PS_PURPLE.png create mode 100644 apps/sn/public/images/map/layericon/WTL_RSRV_PS_RED.png create mode 100644 apps/sn/public/images/map/layericon/WTL_RSRV_PS_YELLOW.png diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 0feaf6f97..b755f2b4b 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -3,7 +3,7 @@ NEXT_PUBLIC_PORT = 3002 NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver -NEXT_PUBLIC_TEMP_GEOSERVER_URL = http://192.168.1.20:8080/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_TEMP_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token diff --git a/apps/sn/app/(map-layout)/map/page.tsx b/apps/sn/app/(map-layout)/map/page.tsx index 55bd0f123..dd3ce64eb 100644 --- a/apps/sn/app/(map-layout)/map/page.tsx +++ b/apps/sn/app/(map-layout)/map/page.tsx @@ -119,7 +119,7 @@ const Map = () => { treeData={treeData} isSearch={true} gisMaps={gisMaps} - isMiniMap={true} + isMiniMap={false} searchView={SearchModal} detailView={FeatureClickEventPopup} onFeatureSelect={onFeatureSelect} diff --git a/apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx similarity index 100% rename from apps/sn/app/(with-base-layout)/ii/rdii_result/page.tsx rename to apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index 922d9d6dc..c191917a9 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -23,14 +23,19 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/geoserver")) { const queryParams = searchParams.toString(); - + //TODO 운영에서 변경 해야함. const typename = searchParams.get("TYPENAME"); let newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ queryParams ? `?${queryParams}` : "" }`; - if(typename == 'hasudo:tb_ms_swage_ppl'){ + if ( + typename == "hasudo:tb_ms_swage_ppl" || + typename == "hasudo:tb_ms_swage_mhl" || + typename == "hasudo:tb_ms_swage_pmstn" || + typename == "hasudo:tb_ms_stofcbr" + ) { newUrl = `${TEMP_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ queryParams ? `?${queryParams}` : "" }`; @@ -39,15 +44,6 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } - if (pathname.startsWith("/tempgeoserver")) { - const queryParams = searchParams.toString(); - const newUrl = `${TEMP_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${ - queryParams ? `?${queryParams}` : "" - }`; - console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); - return NextResponse.rewrite(new URL(newUrl)); - } - if (pathname.startsWith("/sewerage-service/api/v1/map/geometry")) { const queryParams = searchParams.toString(); const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service/api", "")}${ @@ -57,7 +53,10 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } - if (pathname.startsWith("/attach-service") || pathname.startsWith("/cms-service")) { + if ( + pathname.startsWith("/attach-service") || + pathname.startsWith("/cms-service") + ) { const requestHeaders = new Headers(req.headers); const token = req.cookies.get(CLAIM_NAME)?.value; const userId = req.cookies.get(AUTH_USER_ID)?.value; diff --git a/apps/sn/public/images/map/layericon/SWL_MANH_PS_ORANGE.png b/apps/sn/public/images/map/layericon/SWL_MANH_PS_ORANGE.png new file mode 100644 index 0000000000000000000000000000000000000000..288d1afa833075756c7e627c0f46e9e21e8264ca GIT binary patch literal 455 zcmV;&0XY7NP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0004wNkl<Zc${Nk zpb#)3bEfS1ua^Ci@g_Ef6D9vQeR%(Lc0;ht6J&8F7-Q0&|F+pL8E;OM`1`r~_jL>d z@}D!-eR}bDLGhFmt{4VP+4Em5_a)<@HqMvNZlBxtx0O|s!Dnv^0|NsCgWrJ;xZ+*` zOXnUzi(UVhGW<vJ!vCcV|NBLM{kwDVz^AEFZUPJp3=H|N4>C*?wP#>pU|=Zyc>49< ze}8!T1T8sH{2$H02=~I<=l7Ukn#;dkcr7fc2v_*^%R5nI&3*?uzhbxmTfh+lC@vrt z<i9=qu<rjIIG>;aSx<MO@PGgKD*O4}3xq2e7*M@X{rkqxk8hu{PmypY=o+{eCQANq zf(f>=YQQxkM<Fi2#J~VaB&DBE?_ywJVDQ=7442&GP=TVj_~S{86vhN|3Kx&)1O^5M zhAqyuaLH!2rwj}X3=IAUI~cN_>|pr&`<D<_0~i<>7@A@fwxdhFfBBGsfq{WxqkRR# xG#L+u`&W;0!{ivFA>qe}u8Ej50n<zs000z%la&rdS(pF-002ovPDHLkV1fd$&I|wm literal 0 HcmV?d00001 diff --git a/apps/sn/public/images/map/layericon/WTL_RSRV_PS_BLACK.png b/apps/sn/public/images/map/layericon/WTL_RSRV_PS_BLACK.png new file mode 100644 index 0000000000000000000000000000000000000000..395abeb7887400a6d8c94a0ede737e17211f6d9c GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`d7dtgAr*7pPTt7dU?9N!wj=RI z*V-4x42LhY`U<$t;d&Wp=P{v;X}bRJxVo2`oVHSX6i;?(b<Q*2a>y|C$dvqrq6gX- z6QtJH@E`ijww8BZ&fEvB({qpSk@Ic%8g5>(O8x^Y1LK~5YMv?Y&C9|yo=2;{@ny4; Q1lr8t>FVdQ&MBb@03aDW=l}o! literal 0 HcmV?d00001 diff --git a/apps/sn/public/images/map/layericon/WTL_RSRV_PS_GREEN.png b/apps/sn/public/images/map/layericon/WTL_RSRV_PS_GREEN.png new file mode 100644 index 0000000000000000000000000000000000000000..33933b9e04b38435d3d4ff138a135e6dfd1f6c27 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`d7dtgAr*6y|NQ@N&#c<OI$I%G zS-EZH|JVPGlY&pTcz-_BQP0Dz{O_Tu$YF+*vphiXQ9I!5@iY!)9iD=l4ZI4~?VPip zZJlT@v5fWKp-hHNRXqj@qCHXu5<Ceh83_v3=6~1!KYzj_GjGWaZU&F(8gJy1zU>0q O%;4$j=d#Wzp$P!6M?0AS literal 0 HcmV?d00001 diff --git a/apps/sn/public/images/map/layericon/WTL_RSRV_PS_ORANGE.png b/apps/sn/public/images/map/layericon/WTL_RSRV_PS_ORANGE.png new file mode 100644 index 0000000000000000000000000000000000000000..7a78c34664d8f302243822cf89403706bd4d5e2a GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`*`6+rAr*6y|NQ@N&#c<Oy84BY zn@{lKf5u6{r&_!}D?P5~>F)Xe&|Ks&gUVSRASg_~c;<K#hq4V%!Hot{h01o$+0RPV z>?M}H{&OgoVN%r@0|mhzDFX?fgg^VIH2%3G@^${iiI?tpY!qks)vRtZf#L5gptTI1 Lu6{1-oD!M<Xu>?# literal 0 HcmV?d00001 diff --git a/apps/sn/public/images/map/layericon/WTL_RSRV_PS_PURPLE.png b/apps/sn/public/images/map/layericon/WTL_RSRV_PS_PURPLE.png new file mode 100644 index 0000000000000000000000000000000000000000..ef25607cf502431098e70d5f01ad934c70dd4252 GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ii4<#Ar*6y|NQ@N&#c<OIy*r* zS-EZH*Z;32H?B-Qv^4Ugn{4x=UaLKANfHffW;Ql9KHTRf>^R-<&>@EDyf+v&mCx9a zd2MgxL4~r7T+10xyfQr05Mq#ZAi<zvW8=ccH+Mq*@1Hku;-xzt8^sw`9?^W$V`VP~ Pw3ort)z4*}Q$iB}IT1qM literal 0 HcmV?d00001 diff --git a/apps/sn/public/images/map/layericon/WTL_RSRV_PS_RED.png b/apps/sn/public/images/map/layericon/WTL_RSRV_PS_RED.png new file mode 100644 index 0000000000000000000000000000000000000000..26fd5f68ecc5dd2af30b562997465693e930e090 GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ii4<#Ar*6y|NQ@N&#c<Ox>`e7 zdD+VU|BaJ^Pqlb|UL^frLhSC3_WJ=m%o9wE4Gav9WG<N5e^kJ&LgK*&Ms0^re8OgD zU+4Wxm{IppJdb(8mE<<Y&V(xs2NM_`*R!#GD!%;xe^1YpXKr1485ri<s=g9n|7``d Om%-E3&t;ucLK6Tltv=oW literal 0 HcmV?d00001 diff --git a/apps/sn/public/images/map/layericon/WTL_RSRV_PS_YELLOW.png b/apps/sn/public/images/map/layericon/WTL_RSRV_PS_YELLOW.png new file mode 100644 index 0000000000000000000000000000000000000000..76718e8652d9f6cbd7e2f512ff52ef1d5d3fc86b GIT binary patch literal 163 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`S)MMAAr*6y|NQ@N&#c<Oy4yfm zEcm~1Qt-(Z@6U^7|CbQE`^Wu201vakEJ+CoiAPs1o;_~TA}GjqBliHGz`evn%PQ}# zmFKyv|MyTbgOlwv0|nk5DFX?fgg^i1H#Xh*GJhg#xSFC^z#CSEXmQ1N3CiW?fVMJt My85}Sb4q9e0Oc_`xc~qF literal 0 HcmV?d00001 From b6e847a55a97b41ab81af6b5306cf9df8489244e Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Mon, 30 Jun 2025 19:27:37 +0900 Subject: [PATCH 060/259] =?UTF-8?q?=EC=9A=B0=EB=A6=AC=EB=8F=99=EB=84=A4?= =?UTF-8?q?=EA=B0=80=EB=AD=84=20=EC=A1=B0=ED=9A=8C,=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMng/drgtSttn/page.tsx | 140 +++++++++++++++--- .../wr/app/store/matDmd/drgtSttn/headList.tsx | 33 ++--- apps/wr/app/store/matDmd/drgtSttn/index.tsx | 138 +++++++++++++++-- .../ui/modal/coMat/drgtDetailModal.tsx | 80 +++++----- 4 files changed, 310 insertions(+), 81 deletions(-) diff --git a/apps/wr/app/matMng/coMng/drgtSttn/page.tsx b/apps/wr/app/matMng/coMng/drgtSttn/page.tsx index 77bbe4a5a..d7c5170b2 100644 --- a/apps/wr/app/matMng/coMng/drgtSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/drgtSttn/page.tsx @@ -1,32 +1,68 @@ "use client"; import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; -import type { customCoSttnBdst } from "@/app/store/matDmd/coSttn"; +import type { customDrgt } from "@/app/store/matDmd/drgtSttn"; import { drgtHeadListExport } from "@/app/store/matDmd/drgtSttn/headList"; import { excelDownload, getCity } from "@/components/lib/func/commom"; +import DrgtDetailModal from "@/components/ui/modal/coMat/drgtDetailModal"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; -import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui"; +import { ContentsDiv, DateMonthPicker, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, Title, UiModal, UiTable, type SelectDataType } from "@common/business_components/ui"; +import { MonthPicker } from "@common/business_components/ui/date_month_picker/mothPicker"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, DatePicker, Label } from "@common/components/ui"; -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; +import { toast, Toaster } from "react-hot-toast"; export default function DrgtSttn() { - const { code, } = useWrStore((state) => state); - const [fromDate, setFromDate] = useState<Date>(new Date()); - const [toDate, setToDate] = useState<Date>(new Date()); + const { code, drgt, drgtSearch, drgtModalSearch } = useWrStore((state) => state); + const { drgtRes, drgtMoRes } = drgt; + const [fromDate, setFromDate] = useState<string>(); + const [toDate, setToDate] = useState<string>(); const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>(); const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); + const [tableData, setTableData] = useState<customDrgt[]>(); + const [selectedSgg, setSelectedSgg] = useState<string>(''); + const [drgtModal, setDrgtModal] = useState<{ + isOpen: boolean; + data: customDrgt | undefined; + }>({ data: undefined, isOpen: false }); - const getSelCity = (val: string | number) => { - const cityValue = String(val); // Ensure val is treated as a string - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: '' }); + const cellClick = (index: number | undefined, headId: string) => { + if (fromDate && toDate) { + drgtModalSearch(fromDate, toDate, drgtRes[index].sggNm); + } else { + toast.error("조회기간을 선택해주세요."); + } + } + + useEffect(() => { + if (drgtMoRes && drgtMoRes.length > 0) { + setDrgtModal({ isOpen: true, data: drgtMoRes }); + } + }, [drgtMoRes]); + + const getCityVal = (val: string, sggCd: SelectDataType[]) => { + const data = sggCd + .filter((item) => String(item.val).substring(0, 2) === val) + .map((item) => ({ + val: item.val, + text: item.text, // 한국어 텍스트 + })); + return data; }; + const getSelCity = (val: string | number) => { + const cityValue = String(val); + const data = getCityVal(cityValue, code.sggCd); + setSelectSgg(data); + + const sggVal = data.length > 0 ? data[0].val : ''; + setSelectedSgg(sggVal); // 시군구 value 세팅 + setObjSearch({ city: cityValue, sgg: sggVal }); + }; const getSgg = (val: string | number) => { - console.log(val); - setObjSearch({ ...objSearch, sgg: String(val) }) + setSelectedSgg(String(val)); + setObjSearch({ ...objSearch, sgg: String(val) }); }; const excelClick = useCallback(() => { @@ -37,6 +73,17 @@ export default function DrgtSttn() { "A1:H1" ); }, []); + + useEffect(() => { + if (fromDate === undefined && toDate === undefined) { + const today = new Date(); + const year = today.getFullYear(); + const month = String(today.getMonth() + 1).padStart(2, '0'); + const formatted = `${year}${month}`; + setFromDate(formatted); + setToDate(formatted); + } + }, [fromDate, toDate]) return ( <> <ContentsDiv> @@ -59,18 +106,41 @@ export default function DrgtSttn() { selectClass={""} selectArray={selectSgg || []} onSelectValue={getSgg} + value={selectedSgg} /> <div className="col-span-5 w-auto"> <div className="flex flex-row items-center"> <Label className="text-xl text-gray-600">조회기간</Label> <div className="flex flex-row w-1/4"> - <DatePicker mode={'single'} - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + <DateMonthPicker + field={{ + value: fromDate, + onChange: (date: string) => { + const year = date.slice(0, 4); + let month = date.slice(4); + if (month.length < 2) { + month = month.padStart(2, "0"); + } + const formatted = `${year}${month}`; + setFromDate(formatted); + } + }} + /> <span>~</span> - <DatePicker mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + <DateMonthPicker + field={{ + value: toDate, + onChange: (date: string) => { + const year = date.slice(0, 4); + let month = date.slice(4); + if (month.length < 2) { + month = month.padStart(2, "0"); + } + const formatted = `${year}${month}`; + setToDate(formatted); + } + }} + /> </div> </div> </div> @@ -81,7 +151,22 @@ export default function DrgtSttn() { <div className="flex flex-row space-x-2"> <Button size={"sm"} - onClick={(e) => { }} + onClick={(e) => { + let sidoText = ''; + let sggText = ''; + + if (objSearch?.city.toString().length > 0) { + sidoText = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? ''; + } + if (objSearch?.sgg.toString().length > 1) { + sggText = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? ''; + } + if (sidoText === '세종특별자치시') { + sidoText = '세종시'; + sggText = sidoText; + } + drgtSearch(fromDate ?? "", toDate ?? "", sidoText, sggText) + }} > 조회 </Button> @@ -116,16 +201,27 @@ export default function DrgtSttn() { <ListDiv> <UiTable headName={[]} - tableData={[]} + tableData={drgtRes || []} headlist={drgtHeadListExport} pageSize={20} total={10000} - cellClick={(index: number | undefined, headId: string) => { }} + cellClick={(index: number | undefined, headId: string) => { + cellClick(index ?? undefined, headId); + }} onPageChange={() => { }} ></UiTable> </ListDiv> </div> </div> + <UiModal + open={drgtModal.isOpen} + onOpenChange={() => { + setDrgtModal({ ...drgtModal, isOpen: !drgtModal.isOpen }); + }} + bodyClass={"w-[50vw] max-w-none h-[80vh]"} + body={<DrgtDetailModal data={drgtModal.data} /*formObj={drgtModal.data}*/ />} + /> + <Toaster position="top-center" /> </ContentsDiv> </> ) diff --git a/apps/wr/app/store/matDmd/drgtSttn/headList.tsx b/apps/wr/app/store/matDmd/drgtSttn/headList.tsx index 40eae47e3..1741b7456 100644 --- a/apps/wr/app/store/matDmd/drgtSttn/headList.tsx +++ b/apps/wr/app/store/matDmd/drgtSttn/headList.tsx @@ -1,5 +1,19 @@ +import { z } from "zod"; import type { CommonTableProps } from "../../common/type/header"; +export const drgtZod = z.object({ + ctpvCd: z.string().default(''), + sggNm: z.string().default(''), + normal: z.string().default(''), + attention: z.string().default(''), + caution: z.string().default(''), + warning: z.string().default(''), + ranking: z.string().default(''), + year: z.string().default(''), + month: z.string().default(''), + drgtState: z.string().default('') +}) + export const drgtHeadListExport: CommonTableProps[] = [ { id: "ctpvCd", @@ -10,21 +24,13 @@ export const drgtHeadListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "sggCd", + id: "sggNm", title: "시군구", visible: true, row: 1, rowSpan: 1, colSpan: 1, }, - { - id: "haengjung", - title: "행정동", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, - }, { id: "normal", title: "정상(횟수)", @@ -83,16 +89,9 @@ export const drgtDetailHeadListExport: CommonTableProps[] = [ row: 1, rowSpan: 1, colSpan: 1, - },{ - id: "day", - title: "일", - visible: true, - row: 1, - rowSpan: 1, - colSpan: 1, }, { - id: "state", + id: "drgtState", title: "가뭄상태", visible: true, row: 1, diff --git a/apps/wr/app/store/matDmd/drgtSttn/index.tsx b/apps/wr/app/store/matDmd/drgtSttn/index.tsx index edbbc2f28..698ba5984 100644 --- a/apps/wr/app/store/matDmd/drgtSttn/index.tsx +++ b/apps/wr/app/store/matDmd/drgtSttn/index.tsx @@ -1,27 +1,147 @@ +import { fetchType, getFetch } from "@/components/lib/api"; import type { CommonTableProps } from "../../common/type/header"; -import { drgtHeadListExport } from "./headList"; +import { drgtHeadListExport, drgtZod } from "./headList"; +import type { z } from "zod"; const drgtHeadList = drgtHeadListExport; +export type customDrgt = z.infer<typeof drgtZod>; + +const drgtRes: customDrgt[] = []; + export type drgtState = { - drgt:{ - drgtHeadList: CommonTableProps[]; - } + drgt: { + drgtHeadList: CommonTableProps[]; + drgtRes: customDrgt[]; + drgtMoRes: customDrgt[]; + } } type drgtActions = { + drgtSearch: (fromDate: string, toDate: string, sido: string, sgg: string) => void + drgtModalSearch: (fromDate: string, toDate: string, sgg: string) => void }; export type drgtType = drgtState & drgtActions; export const drgtStateExport: drgtState = { - drgt: { - drgtHeadList: drgtHeadList, - } + drgt: { + drgtHeadList: drgtHeadList, + drgtRes: drgtRes, + drgtMoRes: drgtRes, + } } export const drgtActionsExport: (set: any) => drgtActions = ( set: any ) => { - return {}; -}; \ No newline at end of file + return { + drgtSearch: async (fromDate: string, toDate: string, sido: string, sgg: string) => { + try { + let searchUrl = ""; + + if (sido === "" || sido === "전체") { + searchUrl = `/il/getDataCount/${fromDate}/${toDate}`; + } else { + searchUrl = `/il/getDataCount/${fromDate}/${toDate}/${sido}/${sgg}`; + } + + console.log("searchUrl", searchUrl); + + const drgtData = await getFetch( + fetchType.WR, + searchUrl + ); + + console.log("drgtRes", drgtData) + + //주의, 관심, 정상 추출 + const statusData = Array.from( + new Set(drgtData.map((e) => e.lvngMfgUswtrDrgtInfo)) + ); + + const statusMap = drgtData.reduce((acc: any, { sggNm, lvngMfgUswtrDrgtInfo: status, countDrgt }: { sggNm: string; lvngMfgUswtrDrgtInfo: string; countDrgt: number }) => { + if (!acc[sggNm]) { + acc[sggNm] = { sggNm, ...Object.fromEntries(statusData.map((e) => [e, 0])) }; + } + acc[sggNm][status] = Number(countDrgt); + return acc; + }, {}); + const data = Object.values(statusMap); + + const formatStatus = data.map((item) => { + const attention = item['관심'] || 0; + const caution = item['주의'] || 0; + return { + sggNm: item.sggNm, + normal: String(item['정상'] || 0), + caution: String(caution), + attention: String(attention), + warning: String(attention + caution), + }; + }); + + const ranking = Array.from( + new Set(formatStatus.map(e => Number(e.warning))) + ).sort((a, b) => b - a); + + const rankData = ranking.reduce((acc, val, idx) => { + acc[val] = idx + 1; + return acc; + }, {}); + + const drgtRes = formatStatus.map(item => ({ + ...item, + warning: String(item.warning), + ranking: rankData[Number(item.warning)], + })); + set((state: drgtState) => { + return { + ...state, + drgt: { + ...state.drgt, + drgtRes: drgtRes, + }, + } + }); + } catch (e) { + console.log(e) + } + }, + drgtModalSearch: async (fromDate: string, toDate: string, sgg: string) => { + try { + const drgtMoData = await getFetch( + fetchType.WR, + `/il/getData/${fromDate}/${toDate}/${sgg}/${sgg}` + ); + + console.log("drgtMoData", drgtMoData) + + const drgtMoRes = drgtMoData.map((item) => { + console.log("item", item) + const year = item.anlsYmd.slice(0, 4); + const month = item.anlsYmd.slice(4, 6); + const drgtState = item.lvngMfgUswtrDrgtInfo; + const sggNm = item.sggNm; + return { + year: year, + month: month, + drgtState: drgtState, + sggNm: sggNm + } + }); + set((state: drgtState) => { + return { + ...state, + drgt: { + ...state.drgt, + drgtMoRes: drgtMoRes, + }, + } + }); + } catch (e) { + console.log(e) + } + }, + } +} \ No newline at end of file diff --git a/apps/wr/components/ui/modal/coMat/drgtDetailModal.tsx b/apps/wr/components/ui/modal/coMat/drgtDetailModal.tsx index a6b05ca77..1be95fae6 100644 --- a/apps/wr/components/ui/modal/coMat/drgtDetailModal.tsx +++ b/apps/wr/components/ui/modal/coMat/drgtDetailModal.tsx @@ -1,48 +1,62 @@ "use client" import { btnClass } from "@/app/store/common/code" +import type { customDrgt } from "@/app/store/matDmd/drgtSttn" import { drgtDetailHeadListExport } from "@/app/store/matDmd/drgtSttn/headList" -import { ContentsDiv, Title, UiTable } from "@common/business_components/ui" +import { excelDownload } from "@/components/lib/func/commom" +import { Title, UiTable } from "@common/business_components/ui" import ListDiv from "@common/business_components/ui/list_div" import { Button } from "@common/components/ui" +import { useCallback, useEffect } from "react" + +export default function DrgtDetailModal({ + data, +}: { + data: customDrgt; +}) { + const excelClick = useCallback(() => { + excelDownload( + [[]], + "우리동네가뭄", + "sample_drgtSttn.xlsx", + "A1:H1" + ); + }, []); -export default function DrgtDetailModal() { return ( <> - <ContentsDiv> - <div className="grid grid-cols-4 gap-4 "> - <div className="col-span-4"> - <Title title={"우리동네가뭄 상세내용"} /> - <div className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> - <div className="flex flex-row space-x-2"> - <Button - size={"sm"} - className={`${btnClass} green`} - onClick={() => { }} - > - 다운로드 - </Button> - </div> - <div className="grid grid-cols-6 gap-4 "> - <div className="col-span-6"> - <ListDiv> - <UiTable - headName={[]} - tableData={[]} - headlist={drgtDetailHeadListExport} - pageSize={10} - total={10000} - cellClick={(index: number | undefined, headId: string) => { }} - onPageChange={() => { }} - ></UiTable> - </ListDiv> - </div> - </div> + <div className="grid grid-cols-4 gap-4 h-full"> + <div className="col-span-4"> + <div className="flex items-center justify-between"> + <Title title={`우리동네가뭄 상세내용 - ${data[0].sggNm}`} /> + <div className="flex flex-row space-x-2"> + <Button + size={"sm"} + className={`${btnClass} green mt-12`} + onClick={excelClick} + > + 다운로드 + </Button> + </div> + </div> + <hr className="mt-2 mb-2" /> + <div className="grid grid-cols-6 gap-4 "> + <div className="col-span-6"> + <ListDiv> + <UiTable + headName={[]} + tableData={data} + headlist={drgtDetailHeadListExport} + pageSize={10} + total={10000} + cellClick={(index: number | undefined, headId: string) => { }} + onPageChange={() => { }} + ></UiTable> + </ListDiv> </div> </div> </div> - - </ContentsDiv> + </div> </> ) } \ No newline at end of file From 19621c17b43c3872c350fc0cf646a4dce9b1a215 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Mon, 30 Jun 2025 20:13:28 +0900 Subject: [PATCH 061/259] =?UTF-8?q?=EC=9E=A0=EC=9E=AC=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=B2=98=20=EC=97=91=EC=85=80=20=EB=93=B1=EB=A1=9D=20=EC=A0=84?= =?UTF-8?q?=ED=99=94=EB=B2=88=ED=98=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coReg/coRegExcel/coRegExcelModal.tsx | 114 +++++++++--------- 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx index 1fa8fa8f3..34d46043f 100644 --- a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx +++ b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx @@ -1,12 +1,12 @@ import { useWrStore } from "@/app/store"; import { coRegExcel } from "@/app/store/matDmd/coSttn/headList"; import type { customLdrmnt } from "@/app/store/matDmd/ldrmntCoSttn"; -import { excelToLdrmntData, names } from "@/app/store/matDmd/ldrmntCoSttn/excel"; +import { names } from "@/app/store/matDmd/ldrmntCoSttn/excel"; import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui"; import { Form, FormField } from "@common/business_components/ui/form"; -import { Button, Input } from "@common/components/ui"; +import { Button } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import type { z } from "zod"; @@ -26,34 +26,41 @@ export default function CoRegExcel() { ldrmntDelete(); if (file) { filePicked(file, 0).then((res) => { + //TODO:loading try { - console.log("res", res) let array: { [key: string]: string | number }[] = [] - if (Array.isArray(res)) - res.forEach((item, index) => { + let isError = false; + if (Array.isArray(res)){ + res.some((item, index) => { let object: { [key: string]: string | number } = {} - Object.keys(names).forEach((key) => { + Object.keys(names).some((key) => { if (item && names[key] !== undefined) { - if (key === "공장관리번호") + if (key === "공장관리번호") { item[key] = String(item[key]) - object[names[key] as string] = item[key]; + } else { + object[names[key] as string] = item[key]; + } } - + return false; }) + if(isError === true) + return true; array.push(object) if (index != 0 && index % 5000 == 0) { ldrmntRegData(array); - console.log("array", array) array = [] array.length = 0; - // throw new Error("error") } + return false; }) + } + if(isError === false) ldrmntRegData(array); - console.log("array끝", array) } catch (e) { console.log(e) + alert(e) + return true; } }); @@ -61,47 +68,46 @@ export default function CoRegExcel() { } - return ( - <> - <div> - <Form {...form}> - <form onSubmit={form.handleSubmit(onSubmit)}> - <div> - <Title title={"잠재수요처 등록"}> -
-
-

- {"잠재수요처 파일"} -

+ return ( + <> +
+
+ +
+ +
+
+

+ {"잠재수요처 파일"} +

- -
+ +
-
+
- ( - - { - console.log("files", files) - if (files && files?.length === 1) setFiles(files[0]); - }} - fileTypes="" - maxFiles={1} - > - - )} - /> -
- - -
- - ); - } + ( + + { + if (files && files?.length === 1) setFiles(files[0]); + }} + fileTypes="" + maxFiles={1} + > + + )} + /> +
+ + +
+ + ); +} From 852cb00d01ddc4c9d125eac55fe7d857900235cf Mon Sep 17 00:00:00 2001 From: swcho Date: Mon, 30 Jun 2025 20:17:25 +0900 Subject: [PATCH 062/259] =?UTF-8?q?feat:=20=ED=95=98=EC=88=98=EA=B4=80?= =?UTF-8?q?=EB=A1=9C=20=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20API=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(=EB=B0=B1=EC=97=94=EB=93=9C=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=EC=8B=9C=20=EC=B6=94=ED=9B=84=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=ED=95=84=EC=9A=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/index.ts | 4 +-- .../map/components/common/table.ts | 29 +++++++++++++++++++ .../components/popupComponent/MsSwagePpl.tsx | 6 ++-- .../popupComponent/chart/infilChart.tsx | 2 +- .../map/featureClickEventPopup.tsx | 14 +++++++-- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index 03edf7d7a..251733075 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -20,9 +20,7 @@ type LayerContentMap = { // 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업 const layerContentMap: LayerContentMap = { // TODO: gis데이터 추가되면 추가 작업 필요 - // "하수처리시설": { component: SwtrmtFclt, }, - // 하수관로 개발용 - "하수처리시설": { component: MsSwagePpl, }, + "하수처리시설": { component: SwtrmtFclt, }, "하수처리구역": {}, "우수토실": { component: Ssc, }, "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index d06973d37..e71e4bdfd 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,3 +1,32 @@ +// 하수관로 +export const MsSwagePplCol = [ + { id: 'avg_grdn', title: '평균구배' }, + { id: 'clar_fvlc', title: '맑음유속' }, + { id: 'drtw_mltv_area', title: '오수배수면적' }, + { id: 'excln_mltv_area', title: '우수배수면적' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, + { id: 'fclty_shp_cd', title: '시설물형태코드' }, + { id: 'fid', title: 'FID' }, + { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'inst_mng_no', title: '기관관리번호' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'mapsht_no', title: '도엽번호' }, + { id: 'mng_inst_cd', title: '관리기관코드' }, + { id: 'mqlt_cd', title: '재질코드' }, + { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'pdmt', title: '관경' }, + { id: 'prlg', title: '연장' }, + { id: 'rnyssn_fvlc', title: '우기유속' }, + { id: 'scend_dpth', title: '종점깊이' }, + { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, + { id: 'tmpt_dpth', title: '시점깊이' }, + { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, + { id: 'trfln_cnt', title: '차선수' }, + { id: 'usg_cd', title: '용도코드' }, + { id: 'vrtc_len', title: '세로길이' }, + { id: 'wdth_len', title: '가로길이' }, +] + // 하수처리시설 export const SwtrmtFcltCol = [ { id: 'swtrmtFcltNm', title: '하수처리시설명' }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index e1829085c..2aa29ef91 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -5,8 +5,9 @@ import InputSection from '../InputSection'; import { handleInputChange } from '../common'; import { Button } from '@common/components/ui'; import InfilChart from './chart/infilChart'; + + // 하수관로 -// TODO: RDII 버튼인가 그거 팝업 두개 구현 필요 const inputColumn = [ { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, @@ -16,8 +17,7 @@ const inputColumn = [ { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; -const MsSwagePpl = ({ featureData }: { featureData: any }) => { // SwtrmtFclt - console.log("featureData", featureData); +const MsSwagePpl = () => { const [isModalOpen, setIsModalOpen] = React.useState(false); const [btnTxt, setBtnTxt] = useState(""); const openModal = (e: React.MouseEvent) => { diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 7de4848e5..a420c4b40 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -19,7 +19,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 - const [aplcnYm, setAplcnYm] = useState(""); + const [aplcnYm, setAplcnYm] = useState("0"); const [inftwtAnlss, setInftwtAnlss] = useState([]); const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState([]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState(null); // 침입수분석정보 diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 79f90a32a..3e7b0db2e 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2 } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol } from "./components/common/table"; // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; @@ -42,8 +42,17 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; else if (featureData.lyrTypeNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; + else if (featureData.lyrTypeNm === 'tb_ms_swage_ppl') result = '하수관로'; + // else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; + } + else { + const lyrTyNm = featureLayer.get('lyrTyNm'); + if (lyrTyNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; + else if (lyrTyNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; + else if (lyrTyNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; + else if (lyrTyNm === 'tb_ms_swage_ppl') result = '하수관로'; + else result = featureLayer.get('lyrNm'); } - else result = featureLayer.get('lyrNm'); return result; // return featureLayer.get('lyrNm'); // 레이어 이름 출력 @@ -86,6 +95,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setButtonChk(true) break; case '하수관로': + setHeadlist(MsSwagePplCol) setButtonChk(true) break; case '오수펌프': From 31e2e3dea14e298ce1a49e9c8f5dec3ac4ac8fae Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 30 Jun 2025 20:18:18 +0900 Subject: [PATCH 063/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=8B=9C=EC=84=A4=20=EB=93=B1=EB=A1=9D=20=EA=B2=B0?= =?UTF-8?q?=ED=95=A8=EB=8C=80=EC=9E=A5=20=EC=88=98=EC=A0=95=2011=EB=B2=88?= =?UTF-8?q?=1C=20=EA=B9=8C=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 122 +++++++++++------- apps/wr/app/store/common/code/index.ts | 34 +++++ .../ruseFcltMng/fcltReg/pbnstReg/headList.tsx | 45 +++---- .../ruseFcltMng/fcltReg/pbnstReg/index.tsx | 22 ++++ .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 105 ++++++++------- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 57 +++++++- .../fcltReg/pbnstReg/mngReg/mngRegForm.tsx | 55 ++++---- .../mngRegFormDetail/mngRegFormDetail.tsx | 60 +++++---- 8 files changed, 329 insertions(+), 171 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index d61478a75..174f268d0 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -31,7 +31,7 @@ import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bug import { PbnstRegModal } from "@/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal"; import toast, { Toaster } from "react-hot-toast"; // toast 이미 import 되어 있음 import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg"; -import { set, useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // FieldErrors 타입 추가 +import { useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // FieldErrors 타입 추가 import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; @@ -57,8 +57,8 @@ export default function PublicReuseFaciltyInsert() { const [searchTxt, setSearchTxt] = useState(); const [bdstTable, setbdstTable] = useState(); const [selectRow, setSelectRow] = useState(); + const [pageNation, setPageNation] = useState(1); - const [testMonth, setTestMonth] = useState("202406"); const form = useForm<{ items: z.infer[]; }>({ @@ -74,6 +74,8 @@ export default function PublicReuseFaciltyInsert() { control: form.control, name: `items`, }); + + const formWatch = form.watch("items"); useEffect(() => { if (!pbnst.isInit) { pubHasuInit("1", "41"); @@ -159,18 +161,9 @@ export default function PublicReuseFaciltyInsert() { } }; - useEffect(() => { - console.log("bdstTable ", bdstTable); - }, [bdstTable]); - useEffect(() => { if (code.sggCd.length && pbnstHasuRes.length > 0) { setbdstTable(tableData(pbnstHasuRes, { code })); - // if (searchFclts) { // 왜 오류가 발생할까? - - // setbdstTable(tableData(searchFclts, { code })); - // } else if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { - // } } }, [code, pbnstHasuRes]); @@ -180,6 +173,8 @@ export default function PublicReuseFaciltyInsert() { setSelectRow(pbnstHasuRes?.[val]); if (selectRow) { pbnstRegClick(selectRow); + } else { + console.error("선택된 행이 없습니다."); } }; @@ -261,7 +256,7 @@ export default function PublicReuseFaciltyInsert() { { setSearchTxt(e); @@ -323,45 +318,76 @@ export default function PublicReuseFaciltyInsert() {

- - - - 시설정보 - - - 차수별정보 - - + + + { + console.log("setIndexMng", index); + setIndexMng(index); + }} + indexMng={indexMng} + /> + + + { + setIndexBiz(index); + }} + indexMng={indexMng} + indexBiz={indexBiz} + /> + + + ) : ( + <> +
+ 등록된 재이용시설 정보가 없습니다. +
+
+

+ 신규등록 버튼을 클릭하여 재이용시설을 등록해주세요. +

+ - - - { - console.log("setIndexMng", index); - setIndexMng(index); - }} - indexMng={indexMng} - /> - - - { - setIndexBiz(index); - }} - indexMng={indexMng} - indexBiz={indexBiz} - /> - - +
+ + + )}
void; pbnstRuseBizUpdate: (ruseRes: fcBizType[]) => void; pubHasuSearch :(page: string, sggOrCity: string , searchTxt:string) => void + getFcOrgwts: (fcltPkList: string[], size:number) => void; }; export type pubFacType = pubFacState & pubFacActions; @@ -90,6 +92,7 @@ export const pubFacStateExport: pubFacState = { pbnstBizCycle: [{ text: "없음", val: "1" }], pbnstMngRegData: [], pbnsUpdateIndex: {} as pbnstInsertIndex, + fcOrgwtsNmList:[], dmdComList: [], }, }; @@ -398,6 +401,25 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { } catch (e) { console.log(e); } + },getFcOrgwts : async (fcltPkList: string[] ,size:number) => { + let url = `/prcsFclt/ruseInfo/1/${size}/A/0/0/1/SW`; + + const fcOrgwtsNmList = await postFectch( + url, + fcltPkList, + fetchType.COMMON + ); + + return set((state: pubFacState) => ({ + ...state, + pbnst: { + ...state.pbnst, + fcOrgwtsNmList:fcOrgwtsNmList.data??[] + }, + })); + + + } }; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index 9c390d076..b908750fd 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -14,10 +14,10 @@ export type selectLabel = { val: string; }; -export type pbnstInsertIndex ={ - mng:number, - biz:number -} +export type pbnstInsertIndex = { + mng: number; + biz: number; +}; export type publicReuseFacilityType = { sido: string; @@ -45,20 +45,20 @@ export type ruseFcltType = { }; export type PbnstDemandComType = { - dmdInfoPk : string | ''; - bzmnNo : string | ''; - dmdCoNm : string | ''; - daddr : string | ''; - telno : string | ''; - rgtr : string | ''; - useUsgCd : string | ''; - ctpvCd : string | ''; - sggCd : string | ''; - dmdAplyPswd: string | ''; + dmdInfoPk: string | ""; + bzmnNo: string | ""; + dmdCoNm: string | ""; + daddr: string | ""; + telno: string | ""; + rgtr: string | ""; + useUsgCd: string | ""; + ctpvCd: string | ""; + sggCd: string | ""; + dmdAplyPswd: string | ""; splyCpct: number | 0; - splyFmYn:string|'Y' -// dmdInfoFk:string|'' -} + splyFmYn: string | "Y"; + // dmdInfoFk:string|'' +}; const pubHasuZod = z.object({ choose: z.boolean().default(false), @@ -68,23 +68,27 @@ const pubHasuZod = z.object({ bscFctNm: z.string().default(""), efflWqltStndrdNm: z.string().default(""), fctCpc: z.number().default(0), - addr:z.string().nullish() + addr: z.string().nullish(), }); - export type pubHasuType = z.infer; -const zDate = z.preprocess((v) => (v ? new Date(v as string) : undefined), z.date()).nullish() ; +const zDate = z + .preprocess((v) => (v ? new Date(v as string) : undefined), z.date()) + .nullish(); const zDateNullish = zDate.nullish(); const zDateDefaultNow = zDate.default(new Date()); -const zNum = z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number()); +const zNum = z.preprocess( + (v) => (v !== null && v !== undefined ? Number(v) : v), + z.number() +); const zNumNullish = zNum.nullish(); const zNumDefaultZero = zNum.default(0).nullish(); const pplInstlSchema = z.object({ ruseFcltBizFk: zNumNullish, choose: z.boolean().default(false), - pdmt: z.string().default(''), + pdmt: z.string().default(""), ppMqlt: z.string().default(""), cpct: zNumDefaultZero, }); @@ -115,22 +119,23 @@ export const fcOperSchema = z.object({ }); const fcOrgwtSchema = z.object({ - pbnstRuseFcltBizFk:zNumNullish, + pbnstRuseFcltBizFk: zNumNullish, swtrmtFcltFk: z.string().nullish(), orgwtWtritQnt: zNum, tmsYn: z.enum(["Y", "N"]).default("N"), dschgFmYn: z.enum(["Y", "N"]).default("N"), - dtlPstnExpln: z.string().default(''), + dtlPstnExpln: z.string().default(""), regDt: zDateNullish, - rgtr: z.string().default(''), + rgtr: z.string().default(""), mdfcnDt: zDateNullish, - mdfr: z.string().default(''), + mdfr: z.string().default(""), choose: z.boolean().default(false), + ruseUtztnFcltNm:z.string().nullish() }); const dmdColist = z.object({ - dmdInfoPk: z.string().default(''), - dmdCoNm: z.string().default(''), + dmdInfoPk: z.string().default(""), + dmdCoNm: z.string().default(""), daddr: z.string(), useUsgCd: z.string().nullish(), splyBgngDay: zDateDefaultNow, @@ -155,11 +160,11 @@ export const fcBizSchema = z.object({ gvsbs: zNumDefaultZero, lcep: zNumDefaultZero, cusrAlotm: zNumDefaultZero, - etc: z.string().default(''), + etc: z.string().default(""), totalMoney: zNumNullish.default(0), rprcsFcltCpct: zNumDefaultZero, majorPrcsMsrcCd: z.string().default(""), - addr: z.string().default(''), + addr: z.string().default(""), rprcsMthdCd: z.string().default(""), inoutYn: z.enum(["Y", "N"]).default("Y"), mainSplyPumpCpct: zNumNullish, @@ -171,17 +176,29 @@ export const fcBizSchema = z.object({ wwtEmsnFcltPrmsnYn: z.string().default("Y"), tmsInstlYn: z.string().default("Y"), pbnstDrngInflwExclYn: z.string().default("Y"), - bod: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "BOD 값은 5자리 미만이어야 합니다.")).nullish(), - grssClfg: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총대장균군 값은 5자리 미만이어야 합니다.")).nullish(), - combResdch: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "결합잔류염소 값은 5자리 미만이어야 합니다.")).nullish(), - trbt: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "탁도 값은 5자리 미만이어야 합니다.")).nullish(), - clIonQnt: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "염소이온량 값은 5자리 미만이어야 합니다.")).nullish(), - smll: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "냄새 값은 5자리 미만이어야 합니다.")).nullish(), - crmty: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "색도 값은 5자리 미만이어야 합니다.")).nullish(), - tph: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총인 값은 5자리 미만이어야 합니다.")).nullish(), - tn: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총질소 값은 5자리 미만이어야 합니다.")).nullish(), - ph: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "수소이온농도 값은 5자리 미만이어야 합니다.")).nullish(), - cdtnv: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "전기전도도 값은 5자리 미만이어야 합니다.")).nullish(), + // bod: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "BOD 값은 5자리 미만이어야 합니다.")).nullish(), + // grssClfg: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총대장균군 값은 5자리 미만이어야 합니다.")).nullish(), + // combResdch: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "결합잔류염소 값은 5자리 미만이어야 합니다.")).nullish(), + // trbt: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "탁도 값은 5자리 미만이어야 합니다.")).nullish(), + // clIonQnt: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "염소이온량 값은 5자리 미만이어야 합니다.")).nullish(), + // smll: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "냄새 값은 5자리 미만이어야 합니다.")).nullish(), + // crmty: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "색도 값은 5자리 미만이어야 합니다.")).nullish(), + // tph: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총인 값은 5자리 미만이어야 합니다.")).nullish(), + // tn: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "총질소 값은 5자리 미만이어야 합니다.")).nullish(), + // ph: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "수소이온농도 값은 5자리 미만이어야 합니다.")).nullish(), + // cdtnv: z.preprocess((v) => (v !== null && v !== undefined ? Number(v) : v), z.number().max(9999, "전기전도도 값은 5자리 미만이어야 합니다.")).nullish(), + bod: z.string().nullish(), + grssClfg: z.string().nullish(), + combResdch: z.string().nullish(), + trbt: z.string().nullish(), + clIonQnt: z.string().nullish(), + smll: z.string().nullish(), + crmty: z.string().nullish(), + tph: z.string().nullish(), + tn: z.string().nullish(), + ph: z.string().nullish(), + cdtnv: z.string().nullish(), + designCst: zNumNullish, cstrnSpvsCst: zNumNullish, fcltSbsdCst: zNumNullish, @@ -217,7 +234,7 @@ export const fcBizSchema = z.object({ }); export const pbnstRegZod = z.object({ - pbnstRuseFcltPk: z.string().default(''), + pbnstRuseFcltPk: z.string().default(""), swtrmtFcltFk: z.string().default(""), ruseUtztnFcltNm: z.string().default(""), fcltCpct: zNumDefaultZero, @@ -232,9 +249,9 @@ export const pbnstRegZod = z.object({ fcOpers: z.array(fcOperSchema).default([]).nullish(), }); -export const pbnstRegArrayZod = z.array(pbnstRegZod) +export const pbnstRegArrayZod = z.array(pbnstRegZod); -export type PbnstRegArrrayType = z.infer +export type PbnstRegArrrayType = z.infer; export type fcBizType = z.infer; export type fcOrgwtType = z.infer; diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index be1459947..152441c70 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -56,14 +56,14 @@ export function PbnstBuseForm({ pbnst, demandCompList, getDemandCompList, + getFcOrgwts, regDemandCompany, } = useWrStore((state) => state); - const { pbnstBizCycle, pbnstRes } = pbnst; + const { fcOrgwtsNmList } = pbnst; const { fields: fcBizs, append: appendBiz } = useFieldArray({ control: form.control, name: `items.${indexMng}.fcBizs`, }); - const [bizCycle, setBizCycle] = useState("1"); const [ppiSelectList, setPpiSelectList] = useState<[{ name: string; val: SelectDataType[] }]>(); const [ppiYn, setPpiYn] = useState("Y"); @@ -76,25 +76,72 @@ export function PbnstBuseForm({ >([{ text: "없음", val: 0 }]); const [isFcOrgwts, setIsFcOrgwts] = useState(false); const [sumCpct, setSumCpct] = useState(0); - const [getDmdList, setGetFmdList] = useState(0); const [isDmdModal, setIsDmdModal] = useState<{ isMoal: boolean; data: DemandCompType; }>({ isMoal: false, data: {} as DemandCompType }); useEffect(() => { - const total = + const etc= isNaN(Number(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`))) + let total = (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`) ?? 0) + (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`) ?? 0) + - (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`) ?? 0); + (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`) ?? 0) + + if( !etc ) { + total+=Number(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`)) + } form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.totalMoney`, total); }, [ form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`), form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`), form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`), + form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`) ]); + + const fcOrgwts = form.watch( `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`) + + useEffect(() =>{ + + console.log('fcOrgwts ', fcOrgwts) + if(fcOrgwts&&fcOrgwts?.length>0){ + const swtrmtFcltFkList = fcOrgwts.map((item) => item.swtrmtFcltFk); + + console.log('swtrmtFcltFkList ', swtrmtFcltFkList) + + if(swtrmtFcltFkList.length > 0){ + getFcOrgwts(swtrmtFcltFkList.filter((item): item is string => item != null), fcOrgwts?.length) + } + } + },[fcOrgwts]) + + useEffect(() =>{ + + if (fcOrgwtsNmList && fcOrgwtsNmList.length > 0) { + + console.log('fcOrgwtsNmList ', fcOrgwtsNmList) + console.log('fcOrgwts ', fcOrgwts) + + fcOrgwts?.forEach((item, index) => { + const orgwtNm = fcOrgwtsNmList.find( + (orgwt) => orgwt.bscFctCd === item.swtrmtFcltFk + )?.bscFctNm; + + console.log('orgwtNm ', orgwtNm) + if (orgwtNm) { + form.setValue( + `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts.${index}.ruseUtztnFcltNm`, + orgwtNm + ); + } + }); + } + + },[fcOrgwtsNmList,fcOrgwts]) + + // fcBizs 데이터가 변경될 때마다 차수 선택 목록을 업데이트합니다. useEffect(() => { const cycleLength = fcBizs.length; diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx index d07d24a23..e1454342b 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -29,6 +29,10 @@ import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { Label } from "@common/business_components/ui/form/lib/label"; import React from "react"; import RuseMngTableForm from "@/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm"; +import { + handleCommaNumberChange, + formatCommaNumber, +} from "@/components/lib/func/commom"; export type FilesType = { atflCd: string; file: File; @@ -46,13 +50,9 @@ export function PbnstMngForm({ indexMng: number; setIndexMng: (index: number) => void; }) { - const { - code, - pbnst, - pbnstInsert, - fileDelete, - fileDownLoad, - } = useWrStore((state) => state); + const { code, pbnst, pbnstInsert, fileDelete, fileDownLoad } = useWrStore( + (state) => state + ); const { pbnstRes } = pbnst; const [regFileList, setRegFileList] = useState(null); @@ -215,16 +215,14 @@ export function PbnstMngForm({ useEffect(() => { if (pbnst.pbnstRes && pbnst.pbnstRes?.length >= 0) { - const fcltNmList = pbnst.pbnstRes?.map((item, index) => ({ text: item.ruseUtztnFcltNm, val: String(index), })); - - console.log(' fcltNmList ', fcltNmList) + console.log(" fcltNmList ", fcltNmList); if (fcltNmList) setFcltNm(fcltNmList); - }else{ + } else { setFcltNm(null); } }, [pbnst.pbnstRes]); @@ -253,16 +251,14 @@ export function PbnstMngForm({ } }, [code]); - - useEffect(() =>{ - // console.log(' fcltNm ', watchedItem?.ruseUtztnFcltNm) - },[watchedItem]) - + useEffect(() => { + // console.log(' fcltNm ', watchedItem?.ruseUtztnFcltNm) + }, [watchedItem]); useEffect(() => { console.log(" form indexMng ", indexMng); - }, [indexMng]); - + }, [indexMng]); + return (
@@ -297,8 +293,6 @@ export function PbnstMngForm({ render={({ field }) => ( { - field.onChange(Number(e.target.value)); + if (formType !== "sttn") + handleCommaNumberChange(e, field.onChange); }} - value={field.value ?? 0} + value={formatCommaNumber(field.value)} readOnly={formType === "sttn" ? true : false} /> @@ -401,11 +396,12 @@ export function PbnstMngForm({ { - field.onChange(Number(e.target.value)); + if (formType !== "sttn") + handleCommaNumberChange(e, field.onChange); }} - value={field.value ?? 0} + value={formatCommaNumber(field.value)} readOnly={formType === "sttn" ? true : false} /> @@ -422,11 +418,12 @@ export function PbnstMngForm({ { - field.onChange(Number(e.target.value)); + if (formType !== "sttn") + handleCommaNumberChange(e, field.onChange); }} - value={field.value ?? 0} + value={formatCommaNumber(field.value)} readOnly={formType === "sttn" ? true : false} /> diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx index 971888e10..6e13058ab 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx @@ -2,17 +2,14 @@ import { useWrStore } from "@/app/store"; import type { formDetailType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList"; import { formH1Class } from "@/components/lib/class/comClass"; -import { safeDate } from "@/components/lib/func/commom"; +import { formatCommaNumber, handleCommaNumberChange, safeDate } from "@/components/lib/func/commom"; import { DatePicker, FormField, FormUi, - SearchInputSelect, SelectBox, - type SelectDataType, } from "@common/business_components/ui"; import { Input } from "@common/components/ui"; -import { useState } from "react"; export default function MngRegFormDetail({ formList, @@ -55,9 +52,7 @@ export default function MngRegFormDetail({ name={fieldId} render={({ field }) => ( - {formHead.type === "select" ? ( - - ) : formHead.type === "date" ? ( + {formHead.type === "date" ? ( ) : formHead.type === "number" ? ( { - field.onChange(Number(e.target.value)); + handleCommaNumberChange( + e, + field.onChange + ); }} - readOnly={formHead.option === "readOnly"?true:false} - /> - ) : formHead.type === "selectYn" ? ( - - field.onChange(val) - } - value={field.value ?? "Y"} + value={formatCommaNumber(field.value)} + readOnly={formHead.option === "readOnly" ? true : false} + disabled={formHead.option === "disabled" ? true : false} + /> + ) : formHead.type === "select" ? ( + (() => { + const potentialOptions = formHead.selectData + ? code[formHead.selectData as keyof typeof code] + : []; + + return ( + + ); + })() ) : ( )} From 27c4204fd860d5c8ba320aea7401fb85345e6c3c Mon Sep 17 00:00:00 2001 From: swcho Date: Mon, 30 Jun 2025 20:52:13 +0900 Subject: [PATCH 064/259] =?UTF-8?q?feat:=20=ED=95=98=EC=88=98=ED=8E=8C?= =?UTF-8?q?=ED=94=84=EC=9E=A5=20=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20API?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84=20(=EB=B0=B1=EC=97=94=EB=93=9C=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=EC=8B=9C=20=EC=B6=94=ED=9B=84=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=95=84=EC=9A=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/index.ts | 5 +++-- .../map/components/common/table.ts | 22 +++++++++++++++++++ .../components/popupComponent/sewagePump.tsx | 14 +++++++----- .../map/featureClickEventPopup.tsx | 17 +++++++++----- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index 251733075..875c647e3 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -26,8 +26,9 @@ const layerContentMap: LayerContentMap = { "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 "하수관로": { component: MsSwagePpl, }, "하수맨홀": { component: smh, }, - "빗물펌프": { component: StormWaterPump }, - "오수펌프": { component: sewagePump }, + "하수펌프장": { component: sewagePump }, + // "빗물펌프": { component: StormWaterPump }, + // "오수펌프": { component: sewagePump }, }; // 동적 컴포넌트 반환 함수 diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index e71e4bdfd..60ddd9bf6 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -102,6 +102,28 @@ export const MsSwageMhlCol = [ { id: 'instMngNo', title: '기관관리번호' } ]; +// 하수펌프장 +export const SewagePump = [ + { id: 'fid', title: 'FID' }, + { id: 'geom', title: 'geometry' }, + { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, + { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'mapsht_no', title: '도엽번호' }, + { id: 'mng_inst_cd', title: '관리기관코드' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'swage_pmstn_nm', title: '하수펌프장명' }, + { id: 'plln_area', title: '부지면적' }, + { id: 'opng_stts_cd', title: '개통상태코드' }, + { id: 'usg_cd', title: '용도코드' }, + { id: 'daily_prcs_cpct', title: '일일처리용량' }, + { id: 'max_impnd_cpct', title: '최대저수용량' }, + { id: 'altd_vl', title: '표고값' }, + { id: 'wtlv_vl', title: '수위값' }, + { id: 'excln_wpmp_ablt', title: '우수양수능력값' }, + { id: 'inst_mng_no', title: '기관관리번호' }, +] + // 중점우수토실 측정지점 export const untrtSwgRainCol1 = [ { id: 'manage_no', title: '관리번호' }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index 3867e16f9..97ae09a10 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -5,13 +5,15 @@ const inputColumn = [ { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, { id: "freq", title: "설계빈도", type: "input" }, ] -// 오수펌프 -const sewagePump = ({ featureData }: { featureData: any }) => { +// 하수펌프장 +const sewagePump = () => { return ( -
-
+ <> + + ) } diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 3e7b0db2e..64dd2d2b1 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump } from "./components/common/table"; // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; @@ -43,7 +43,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, else if (featureData.lyrTypeNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (featureData.lyrTypeNm === 'tb_ms_swage_ppl') result = '하수관로'; - // else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; + else if (featureData.lyrTypeNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; } else { const lyrTyNm = featureLayer.get('lyrTyNm'); @@ -51,6 +51,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, else if (lyrTyNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; else if (lyrTyNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (lyrTyNm === 'tb_ms_swage_ppl') result = '하수관로'; + else if (lyrTyNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; else result = featureLayer.get('lyrNm'); } @@ -98,10 +99,14 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setHeadlist(MsSwagePplCol) setButtonChk(true) break; - case '오수펌프': - setButtonChk(true) - break; - case '빗물펌프': + // case '오수펌프': + // setButtonChk(true) + // break; + // case '빗물펌프': + // setButtonChk(true) + // break; + case '하수펌프장': + setHeadlist(SewagePump) setButtonChk(true) break; case '하수맨홀': From 5aebb3ba77ff0628e6494ea83e197ee09a7de258 Mon Sep 17 00:00:00 2001 From: mind-one005 Date: Mon, 30 Jun 2025 21:19:25 +0900 Subject: [PATCH 065/259] =?UTF-8?q?rdii=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 4 +- .../components/popupComponent/MsSwagePpl.tsx | 30 +- .../popupComponent/chart/aplcnYms.ts | 209 +++++++++++++ .../popupComponent/chart/infilChart.tsx | 275 +++++++++++++----- .../popupComponent/chart/rdiiChart.tsx | 258 ++++++++++++++++ package.json | 2 +- 6 files changed, 688 insertions(+), 90 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts create mode 100644 apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx diff --git a/apps/sn/.env.local b/apps/sn/.env.local index b755f2b4b..6c43ab12c 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -9,6 +9,6 @@ NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -#NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API -NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 차장님 API diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 43f70de24..212bfedf4 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -1,9 +1,11 @@ +'use client' import { VerticalTable } from '@/components/ui/verticalTable'; import React, { useState } from 'react' import InputSection from '../InputSection'; import { handleInputChange } from '../common'; import { Button } from '@common/components/ui'; import InfilChart from './chart/infilChart'; +import RdiiChart from './chart/rdiiChart'; // 하수관로 // TODO: RDII 버튼인가 그거 팝업 두개 구현 필요 const inputColumn = [ @@ -15,17 +17,24 @@ const inputColumn = [ { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; -const SwtrmtFclt = ({ featureData }: { featureData: any }) => { +const MsSwagePpl = ({ featureData }: { featureData: any }) => { // SwtrmtFclt console.log("featureData", featureData); - const [isModalOpen, setIsModalOpen] = React.useState(false); + const [isModalInfil, setIsModalInfil] = React.useState(false); + const [isModalRdii, setIsModalRdii] = React.useState(false); const [btnTxt, setBtnTxt] = useState(""); - const openModal = (e: React.MouseEvent) => { + const openModalRdii = (e: React.MouseEvent) => { e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) - setIsModalOpen(true); + setIsModalRdii(true); + } + const openModalInfil = (e: React.MouseEvent) => { + e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) + setIsModalInfil(true); }; - const closeModal = () => { - setIsModalOpen(false); + const closeModalInfil = () => { + setIsModalInfil(false); }; + const closeModalRdii = () => { + setIsModalRdii(false);}; const [repairData, setRepairData] = useState([ { year: "2025", type: "개대체" }, { year: "2025", type: "보수" }, @@ -68,20 +77,21 @@ const SwtrmtFclt = ({ featureData }: { featureData: any }) => {
- + +
) } -export default SwtrmtFclt \ No newline at end of file +export default MsSwagePpl \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts new file mode 100644 index 000000000..c9106fb16 --- /dev/null +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -0,0 +1,209 @@ +import {useState, useEffect} from 'react'; +import { getData } from '@/components/lib/api'; +export type TInftwtAnls = { + inftwtAnlsSn:number; + aplcnYm: string; + enoCd: string; + ctpvCd: string; + sggCd: string; + swageTmplntCd: string; + swageTmplntNm: string; + swtrmtZoneCd: string; + swtrmtZoneNm: string; + atflCd: string; + atflId: string; + atflInpNm: string; + atflHrPttnNm: string; + atflMpngNm: string; + atflOilqNm: string; + atflNm: string; + drtwSwtcRt:number; + anlsInfo: string; + scsYn: string; +}; +export type TInftwtAnlsRslt = { + inftwtAnlsSn: number; + pplMngNo: string; + anlsTm: string; + predcOilq:number; +} +export type TRdiiAnls = { + rainInfwtAnlsSn:number; + aplcnYm: string; + enoCd: string; + ctpvCd: string; + sggCd: string; + swageTmplntCd: string; + swageTmplntNm: string; + swtrmtZoneCd: string; + swtrmtZoneNm: string; + atflCd: string; + atflId: string; + atflInpNm: string; + atflHrPttnNm: string; + atflMpngNm: string; + atflRainNm: string; + atflNm: string; + drtwSwtcRt:number; + anlsInfo: string; + scsYn: string; + srcNm: string; // 출처이름 +}; +export type TRdiiAnlsRslt = { + rainInfwtAnlsSn: number; + pplMngNo: string; + anlsTm: string; + predcOilq:number; +} +export type TOilqData = { + inftwtAnlsSn: number; // 침입수분석 일련번호 + pplMngNo: string; // 관로관리번호 + mtrngDt: string; // 계측일시 + oilq: number; // 유량 +} +const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] => { + let yyyymms1 = yyyymms.map(dateStr => { + const year = dateStr.slice(0, 4); + const month = dateStr.slice(4, 6); + return { + text: `${year}-${month}`, + val: dateStr + }; + }); + yyyymms1.unshift({ val: '0', text: '선택' }); + return yyyymms1; +}; +const selectAplcnYms = async(gubun:string) => { // 상수사용월 + try { + const queryString = ''; + const result = await getData(`v1/${gubun}/aplcnYm${queryString ? `?${queryString}` : ''}`); + if (result && result.length > 0) { + console.log("selectAplcnYms", result); + return getOptionsAplcnYm(result); + } + } catch (error) { + console.error(error); + } +}; +export const useAplcnYms = (gubun:string) => { + const [data, setData] = useState<{ text: string; val: string }[]>([]); + + useEffect(() => { + const fetch = async (gubun:string) => { + const result = await selectAplcnYms(gubun); + if (result) setData(result); + }; + fetch(gubun); + }, []); + + return data; +}; +export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string; val: number }[] => { + const options = anlsArr.map(anls => ({ + text: anls.anlsInfo, + val: anls.inftwtAnlsSn, + })); + options.unshift({ val: 0, text: '선택' }); + return options; +}; + +export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 + try { + const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); + if (result && result.numberOfElements > 0) { + console.log("selectInftwtAnls", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; +export const getChartDataInftwtAnlsRslt = (arr: TInftwtAnlsRslt[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.anlsTm, + val: anlsRslt.predcOilq, + })); + return options; +}; +export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 + try { + if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { + console.warn("inftwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/inftwtAnlsRslt/ppl/${inftwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectInftwtAnlsRslt", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; +export const getChartDataOilq = (arr: TOilqData[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.mtrngDt, + val: anlsRslt.oilq, + })); + return options; +}; +export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // 유량 + try { + if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { + console.warn("inftwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/inftwtAnlsRslt/oilqppl/${inftwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectOilq", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; + +export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number }[] => { + const options = anlsArr.map(anls => ({ + text: anls.anlsInfo, + val: anls.rainInfwtAnlsSn, + })); + options.unshift({ val: 0, text: '선택' }); + return options; +}; + +export const selectRdiiAnls = async(aplcnYm:String) => { // 침입수분석 + try { + const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const result = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); + if (result && result.numberOfElements > 0) { + console.log("selectRdiiAnls", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; +export const getChartDataRdiiAnlsRslt = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.anlsTm, + val: anlsRslt.predcOilq, + })); + return options; +}; +export const selectRdiiAnlsRslt = async(rainInfwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 + try { + if ((rainInfwtAnlsSn === undefined || rainInfwtAnlsSn === 0) || !pplMngNo) { + console.warn("RdiiAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/rdiiAnlsRslt/ppl/${rainInfwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectRdiiAnlsRslt", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index f82184db8..467ad2bba 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -1,17 +1,38 @@ -import React, { useState } from 'react' -import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_components"; -import Modal from '@/components/ui/modal'; -import { Button } from '@common/components/ui'; +'use client' +import { CHART_FORM, type ChartConfig, MainChart, UiModal } from "@common/business_components"; +import { SelectBox } from '@common/business_components/ui'; +import { Button, Input, Label } from '@common/components'; +import React, { useEffect, useState } from 'react'; + +import type { TInftwtAnls } from './aplcnYms'; +import { getChartDataInftwtAnlsRslt, getOptionsInftwtAnlsInfo, selectInftwtAnls, selectInftwtAnlsRslt, useAplcnYms } from './aplcnYms'; +import { selectOilq, getChartDataOilq } from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, closeModal: () => void, btnTxt?: string, } + const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { - const [popupOpen, setPopupOpen] = React.useState(false); + const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 + const [aplcnYm, setAplcnYm] = useState(""); + const [inftwtAnlss, setInftwtAnlss] = useState([]); + const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState([]); // 침입수분석정보 options + const [inftwtAnls, setInftwtAnls] = useState(null); // 침입수분석정보 + const [inftwtAnlsSn, setInftwtAnlsSn] = useState(0); // 침입수분석 정보 선택시 사용 + const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); + + const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -22,36 +43,90 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp } setPopupOpen(true); // 팝업 열기 }; - console.log("btnTxt", btnTxt); - const closePopup = () => { setPopupOpen(false); }; // 팝업 닫기 + //console.log("btnTxt", btnTxt); + const chartForm = CHART_FORM.LINE; - const chartData = { - chartData1: [ - { label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 }, - ], - chartData2: [ - { label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 }, - ], - } - const chartConfig = Object.values(chartData).flat().reduce((config, element) => { - config[element.label] = { - label: element.label, - color: "hsl(var(--chart-1))", - }; - return config; - }, {} as Record) satisfies ChartConfig; - const getCurrentDate = () => { - const today = new Date(); - const year = today.getFullYear(); - const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 - return `${year}-${month}`; + const chartConfig = { + chartData1: { label: '침입수예측유량', color: "red", }, + chartData2: { label: '실측유량', color: "orange", } + } as ChartConfig; + + useEffect(() => { + if (isModalOpen === false) { + setPopupOpen(true); // 모달이 닫힐 때 팝업은 + setAplcnYm(""); // 상수사용월 초기화 + setInftwtAnlss([]); // 침입수분석 초기화 + setInftwtAnlsInfos([]); // 침입수분석정보 초기화 + setInftwtAnls(null); // 침입수분석정보 초기화 + setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 + setChartData({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); // 차트 데이터 초기화 + } + }, [isModalOpen]); + + // 상수사용월 변경시 분석 정보 리스트 가져오기 + useEffect(() => { + // aplcnYm이 비어있거나 "0"이면 API 호출하지 않음 + if (!aplcnYm || aplcnYm === "0" || aplcnYm === "") { + setInftwtAnlsSn(0); // 초기화 + setInftwtAnlsInfos([]); + return; + } + + selectInftwtAnls(aplcnYm) + .then((data) => { + setInftwtAnlss(data ?? []); + setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data)); + setInftwtAnlsSn(0); // 초기화 + }) + .catch((error) => { + console.error("selectInftwtAnls 에러:", error); + setInftwtAnlss([]); + setInftwtAnlsInfos([]); + }); + + }, [aplcnYm]); + + // 값 표시 + useEffect(() => { + // 선택된 침입수분석 정보에 대한 처리 로직 + if (inftwtAnlsSn === 0) return; + const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === inftwtAnlsSn); + if (selectedAnls) { + setInftwtAnls(selectedAnls); + } + }, [inftwtAnlsSn]); + + const closePopup = () => { // 팝업 닫기 + selectInftwtAnlsRslt(inftwtAnlsSn, "L13101003").then((data) => {// 침입수분석 결과 조회 + const rsltData = getChartDataInftwtAnlsRslt(data ?? []); + setChartData(prev => ({ + ...prev, + chartData1: rsltData // 침입수분석결과 + })); + }); + + selectOilq(inftwtAnlsSn,"L13101003").then((data) => {// 유량 조회 + const rsltData = getChartDataOilq(data ?? []); + setChartData(prev => ({ + ...prev, + chartData2: rsltData // 유량 + })); + }); + setPopupOpen(false); }; - return ( - + + + + const renderBody = () => ( + <> + {/* */} {/* 분석 입력현황 조회 */}
@@ -75,65 +150,111 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
{popupOpen && (
-
분석 입력현황
-
-
상수사용량 정보:
-
- +
침입수분석 입력현황
+
+
+ + { + setAplcnYm(String(val)); + }} + />
-
오수 전환율:
-
- +
+ + { + setInftwtAnlsSn(Number(val)); + }} + />
-
수용가-맨홀 매칭:
-
- +
+ +
-
관망도 자료:
-
- +
+ + +
+
+ + +
+
+ + +
+
+ +
- {btnTxt === 'RDII' ? <>
강우 자료:
-
- -
-
RTX 계수 출처:
-
- -
- : null}
-
-
- )} - +
)} + {/* */} + + ) + + return ( + ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx new file mode 100644 index 000000000..8de5b080f --- /dev/null +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -0,0 +1,258 @@ +'use client' +import { CHART_FORM, type ChartConfig, MainChart, UiModal } from "@common/business_components"; +import { SelectBox } from '@common/business_components/ui'; +import { Button, Input, Label } from '@common/components'; +import React, { useEffect, useState } from 'react'; + +import type { TRdiiAnls, TRdiiAnlsRslt, TOilqData } from './aplcnYms'; +import { getChartDataRdiiAnlsRslt, selectRdiiAnlsRslt } from './aplcnYms'; +import { getOptionsRdiiAnlsInfo, selectRdiiAnls, useAplcnYms } from './aplcnYms'; +type ModalOpenProp = { + isModalOpen: boolean, + setIsModalOpen: (open: boolean) => void, + closeModal: () => void, + btnTxt?: string, +} + +const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { + const [popupOpen, setPopupOpen] = React.useState(true); + const buttonRef = React.useRef(null); // 버튼 참조 + const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 + const [aplcnYm, setAplcnYm] = useState(""); + const [rdiiAnlss, setRdiiAnlss] = useState([]); + const [rdiiAnlsInfos, setRdiiAnlsInfos] = useState([]); // 강우유입수분석정보 options + const [rdiiAnls, setRdiiAnls] = useState(null); // 강우유입수분석정보 + const [rainInfwtAnlsSn, setRainInfwtAnlsSn] = useState(0); // 강우유입수분석 정보 선택시 사용 + const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); + + const aplcnYms = useAplcnYms('rdiiAnlsRslt'); // 상수사용월 데이터 가져오기 + const openPopup = () => { + if (buttonRef.current) { + const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 + setPopupPosition({ + top: rect.bottom + window.scrollY, // 버튼 아래쪽 + left: rect.left + window.scrollX, // 버튼 왼쪽 + }); + } + setPopupOpen(true); // 팝업 열기 + }; + //console.log("btnTxt", btnTxt); + + const chartForm = CHART_FORM.LINE; + const chartConfig = { + chartData1: { label: '강우유입수예측유량', color: "red", }, + chartData2: { label: '실측유량', color: "orange", } + } as ChartConfig; + + useEffect(() => { + if (isModalOpen === false) { + setPopupOpen(true); // 모달이 닫힐 때 팝업은 + setAplcnYm(""); // 상수사용월 초기화 + setRdiiAnlss([]); // 강우유입수분석 초기화 + setRdiiAnlsInfos([]); // 강우유입수분석정보 초기화 + setRdiiAnls(null); // 강우유입수분석정보 초기화 + setRainInfwtAnlsSn(0); // 강우유입수분석 일련번호 초기화 + setChartData({ + chartData1: [{ label: "1", val: 20 }, + { label: "3", val: 40 }, + { label: "5", val: 60 },], + chartData2: [{ label: "1", val: 15 }, + { label: "3", val: 35 }, + { label: "5", val: 55 },], + }); // 차트 데이터 초기화 + } + }, [isModalOpen]); + + // 상수사용월 변경시 분석 정보 리스트 가져오기 + useEffect(() => { + // aplcnYm이 비어있거나 "0"이면 API 호출하지 않음 + if (!aplcnYm || aplcnYm === "0" || aplcnYm === "") { + setRainInfwtAnlsSn(0); // 초기화 + setRdiiAnlsInfos([]); + return; + } + + selectRdiiAnls(aplcnYm) + .then((data) => { + setRdiiAnlss(data ?? []); + setRdiiAnlsInfos(getOptionsRdiiAnlsInfo(data)); + setRainInfwtAnlsSn(0); // 초기화 + }) + .catch((error) => { + console.error("selectrdiiAnls 에러:", error); + setRdiiAnlss([]); + setRdiiAnlsInfos([]); + }); + }, [aplcnYm]); + + // 값 표시 + useEffect(() => { + // 선택된 강우유입수분석 정보에 대한 처리 로직 + if (rainInfwtAnlsSn === 0) return; + const selectedAnls = rdiiAnlss.find(anls => anls.rainInfwtAnlsSn === rainInfwtAnlsSn); + if (selectedAnls) { + setRdiiAnls(selectedAnls); + } + }, [rainInfwtAnlsSn]); + + const closePopup = () => { // 팝업 닫기 + selectRdiiAnlsRslt(rainInfwtAnlsSn, "L13101003").then((data) => {// 강우유입수분석 결과 조회 + const rsltData = getChartDataRdiiAnlsRslt(data ?? []); + setChartData(prev => ({ + ...prev, + chartData1: rsltData // 강우유입수분석결과 + })); + }); + // selectOilq(rdiiAnlsSn,"L13101003").then((data) => {// 유량 조회 + // const rsltData = getChartDataOilq(data ?? []); + // setChartData(prev => ({ + // ...prev, + // chartData2: rsltData // 유량 + // })); + // }); + setPopupOpen(false); + }; + + + + const renderBody = () => ( + <> + {/* 분석 입력현황 조회 */} +
+
+ + + {/* 강우유입수량 분석결과 */} +
+ 강우유입수량 분석결과 +
+ 120 + m³/d +
+
+
+ {/* 차트 */} +
+ +
+
+ {popupOpen && ( +
+
강우유입수분석 입력현황
+
+
+ + { + setAplcnYm(String(val)); + }} + /> +
+
+ + { + setRainInfwtAnlsSn(Number(val)); + }} + /> +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
)} + {/* */} + + ) + + return ( + + ) +} + +export default RdiiChart \ No newline at end of file diff --git a/package.json b/package.json index 818c7999d..1af128b94 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "packages/*" ], "scripts": { - "build": "turbo run build --filter=!wr", + "build": "turbo run build --filter=!wr --filter=!cs", "build:common": "turbo run build --filter=@common/*", "dev": "turbo run dev", "dev:cs": "turbo run dev --filter=cs", From dccb05549829017fd1904163cd4ee4bbac6a3bac Mon Sep 17 00:00:00 2001 From: swcho Date: Mon, 30 Jun 2025 21:19:54 +0900 Subject: [PATCH 066/259] =?UTF-8?q?feat:=20-=20=ED=95=98=EC=88=98=EB=A7=A8?= =?UTF-8?q?=ED=99=80=20=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20API=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(=EB=B0=B1=EC=97=94=EB=93=9C=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=99=84=EB=A3=8C)?= =?UTF-8?q?=20-=20=ED=95=98=EC=88=98=EA=B4=80=EB=A1=9C,=20=ED=95=98?= =?UTF-8?q?=EC=88=98=ED=8E=8C=ED=94=84=EC=9E=A5=20=EB=B0=B1=EC=97=94?= =?UTF-8?q?=EB=93=9C=20=EC=97=B0=EA=B2=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/table.ts | 103 +++++++++--------- .../map/featureClickEventPopup.tsx | 6 +- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 60ddd9bf6..54a75e27e 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,30 +1,31 @@ // 하수관로 export const MsSwagePplCol = [ - { id: 'avg_grdn', title: '평균구배' }, - { id: 'clar_fvlc', title: '맑음유속' }, - { id: 'drtw_mltv_area', title: '오수배수면적' }, - { id: 'excln_mltv_area', title: '우수배수면적' }, - { id: 'fclt_mng_no', title: '시설관리번호' }, - { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'fid', title: 'FID' }, - { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, - { id: 'inst_mng_no', title: '기관관리번호' }, - { id: 'instl_ymd', title: '설치일자' }, - { id: 'mapsht_no', title: '도엽번호' }, - { id: 'mng_inst_cd', title: '관리기관코드' }, - { id: 'mqlt_cd', title: '재질코드' }, - { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'avgGrdn', title: '평균구배' }, + { id: 'clarFvlc', title: '맑음유속' }, + { id: 'drtwMltvArea', title: '오수배수면적' }, + { id: 'exclnMltvArea', title: '우수배수면적' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + // { id: 'fid', title: 'FID' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'instMngNo', title: '기관관리번호' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + // { id: 'mqltCd', title: '재질코드' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, { id: 'pdmt', title: '관경' }, { id: 'prlg', title: '연장' }, - { id: 'rnyssn_fvlc', title: '우기유속' }, - { id: 'scend_dpth', title: '종점깊이' }, - { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, - { id: 'tmpt_dpth', title: '시점깊이' }, - { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, - { id: 'trfln_cnt', title: '차선수' }, - { id: 'usg_cd', title: '용도코드' }, - { id: 'vrtc_len', title: '세로길이' }, - { id: 'wdth_len', title: '가로길이' }, + { id: 'rnyssnFvlc', title: '우기유속' }, + { id: 'scendDpth', title: '종점깊이' }, + { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, + { id: 'tmptDpth', title: '시점깊이' }, + { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, + { id: 'trflnCnt', title: '차선수' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'vrtcLen', title: '세로길이' }, + { id: 'wdthLen', title: '가로길이' }, + // { id: 'lyrTypeNm', title: '레이어타입명' }, ] // 하수처리시설 @@ -35,7 +36,7 @@ export const SwtrmtFcltCol = [ { id: 'cmcnYmd', title: '준공일자' }, { id: 'oprtngStrtYmd', title: '가동개시일자' }, { id: 'clsgYmd', title: '폐쇄일자' }, - { id: 'prcsMsrcCd', title: '처리공법코드' }, + // { id: 'prcsMsrcCd', title: '처리공법코드' }, // { id: 'laeCd', title: '지자체코드' }, { id: 'laeNm', title: '지자체명' }, { id: 'ctpvNm', title: '시도명' }, @@ -81,47 +82,47 @@ export const SwtrmtPrcsZoneCol = [ // 하수맨홀 export const MsSwageMhlCol = [ - { id: 'fid', title: 'FID' }, - { id: 'geom', title: 'geometry' }, - { id: 'ftreSmblCd', title: '지형지물부호코드' }, - { id: 'mngNo', title: '관리번호' }, + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fcltMngNo', title: '시설관리번호' }, // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, { id: 'mapshtNo', title: '도엽번호' }, // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, { id: 'lastDrdgnYmd', title: '최종준설일자' }, - { id: 'usgCd', title: '용도코드' }, + // { id: 'usgCd', title: '용도코드' }, // { id: 'fcltyShpCd', title: '시설물형태코드' }, - { id: 'mhlKndCd', title: '맨홀종류코드' }, + // { id: 'mhlKndCd', title: '맨홀종류코드' }, { id: 'swageMhDiam', title: '하수맨홀구경' }, { id: 'wdthLen', title: '가로길이' }, { id: 'vrtcLen', title: '세로길이' }, // { id: 'mqltCd', title: '재질코드' }, - { id: 'altdVl', title: '표고값' }, - { id: 'dpthlVl', title: '심도값' }, - { id: 'instMngNo', title: '기관관리번호' } + { id: 'altdVl', title: '표고' }, + { id: 'dpthlVl', title: '심도' }, + // { id: 'instMngNo', title: '기관관리번호' } ]; // 하수펌프장 export const SewagePump = [ - { id: 'fid', title: 'FID' }, - { id: 'geom', title: 'geometry' }, - { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, - { id: 'fclt_mng_no', title: '시설관리번호' }, - { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, - { id: 'mapsht_no', title: '도엽번호' }, - { id: 'mng_inst_cd', title: '관리기관코드' }, - { id: 'instl_ymd', title: '설치일자' }, - { id: 'swage_pmstn_nm', title: '하수펌프장명' }, - { id: 'plln_area', title: '부지면적' }, - { id: 'opng_stts_cd', title: '개통상태코드' }, - { id: 'usg_cd', title: '용도코드' }, - { id: 'daily_prcs_cpct', title: '일일처리용량' }, - { id: 'max_impnd_cpct', title: '최대저수용량' }, - { id: 'altd_vl', title: '표고값' }, - { id: 'wtlv_vl', title: '수위값' }, - { id: 'excln_wpmp_ablt', title: '우수양수능력값' }, - { id: 'inst_mng_no', title: '기관관리번호' }, + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'swagePmstnNm', title: '하수펌프장명' }, + { id: 'pllnArea', title: '부지면적' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'dailyPrcsCpct', title: '일일처리용량' }, + { id: 'maxImpndCpct', title: '최대저수용량' }, + { id: 'altdVl', title: '표고' }, + { id: 'wtlvVl', title: '수위' }, + { id: 'exclnWpmpAblt', title: '우수양수능력' }, + { id: 'instMngNo', title: '기관관리번호' }, ] // 중점우수토실 측정지점 diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 64dd2d2b1..68a23de87 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol } from "./components/common/table"; // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; @@ -37,6 +37,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureLayer = layer; // 피처가 속한 레이어 찾기 } }); + console.log("featureLayer.get('lyrTyNm');", featureLayer.get('lyrTyNm')); // SearchModal 클릭 이벤트와 Gis 클릭 이벤트 구분하기 if (featureLayer.get('lyrNm') === null) { if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; @@ -44,6 +45,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (featureData.lyrTypeNm === 'tb_ms_swage_ppl') result = '하수관로'; else if (featureData.lyrTypeNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; + else if (featureData.lyrTypeNm === 'tb_ms_swage_mhl') result = '하수맨홀'; } else { const lyrTyNm = featureLayer.get('lyrTyNm'); @@ -52,6 +54,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, else if (lyrTyNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (lyrTyNm === 'tb_ms_swage_ppl') result = '하수관로'; else if (lyrTyNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; + else if (lyrTyNm === 'tb_ms_swage_mhl') result = '하수맨홀'; else result = featureLayer.get('lyrNm'); } @@ -110,6 +113,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setButtonChk(true) break; case '하수맨홀': + setHeadlist(MsSwageMhlCol) setButtonChk(true) break; default: From c3f8c792826e4817e2f1ae612465b9f993358426 Mon Sep 17 00:00:00 2001 From: mind-one005 Date: Tue, 1 Jul 2025 00:23:15 +0900 Subject: [PATCH 067/259] =?UTF-8?q?=EA=B0=95=EC=9A=B0=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EB=AA=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 104 +++++++++++++++--- 1 file changed, 88 insertions(+), 16 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 53b4c7954..c9106fb16 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -27,6 +27,34 @@ export type TInftwtAnlsRslt = { anlsTm: string; predcOilq:number; } +export type TRdiiAnls = { + rainInfwtAnlsSn:number; + aplcnYm: string; + enoCd: string; + ctpvCd: string; + sggCd: string; + swageTmplntCd: string; + swageTmplntNm: string; + swtrmtZoneCd: string; + swtrmtZoneNm: string; + atflCd: string; + atflId: string; + atflInpNm: string; + atflHrPttnNm: string; + atflMpngNm: string; + atflRainNm: string; + atflNm: string; + drtwSwtcRt:number; + anlsInfo: string; + scsYn: string; + srcNm: string; // 출처이름 +}; +export type TRdiiAnlsRslt = { + rainInfwtAnlsSn: number; + pplMngNo: string; + anlsTm: string; + predcOilq:number; +} export type TOilqData = { inftwtAnlsSn: number; // 침입수분석 일련번호 pplMngNo: string; // 관로관리번호 @@ -45,18 +73,10 @@ const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] = yyyymms1.unshift({ val: '0', text: '선택' }); return yyyymms1; }; -export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string; val: number }[] => { - const options = anlsArr.map(anls => ({ - text: anls.anlsInfo, - val: anls.inftwtAnlsSn, - })); - options.unshift({ val: 0, text: '선택' }); - return options; -}; -const selectAplcnYms = async() => { // 상수사용월 +const selectAplcnYms = async(gubun:string) => { // 상수사용월 try { const queryString = ''; - const result = await getData(`v1/inftwtAnlsRslt/aplcnYm${queryString ? `?${queryString}` : ''}`); + const result = await getData(`v1/${gubun}/aplcnYm${queryString ? `?${queryString}` : ''}`); if (result && result.length > 0) { console.log("selectAplcnYms", result); return getOptionsAplcnYm(result); @@ -65,26 +85,34 @@ const selectAplcnYms = async() => { // 상수사용월 console.error(error); } }; -export const useAplcnYms = () => { +export const useAplcnYms = (gubun:string) => { const [data, setData] = useState<{ text: string; val: string }[]>([]); useEffect(() => { - const fetch = async () => { - const result = await selectAplcnYms(); + const fetch = async (gubun:string) => { + const result = await selectAplcnYms(gubun); if (result) setData(result); }; - fetch(); + fetch(gubun); }, []); return data; }; +export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string; val: number }[] => { + const options = anlsArr.map(anls => ({ + text: anls.anlsInfo, + val: anls.inftwtAnlsSn, + })); + options.unshift({ val: 0, text: '선택' }); + return options; +}; export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 try { const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); if (result && result.numberOfElements > 0) { - //console.log("selectInftwtAnls", result.content); + console.log("selectInftwtAnls", result.content); return result.content; } } catch (error) { @@ -106,7 +134,7 @@ export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string) } const result = await getData(`v1/inftwtAnlsRslt/ppl/${inftwtAnlsSn}/${pplMngNo}`); if (result && result.numberOfElements > 0) { - //console.log("selectInftwtAnlsRslt", result.content); + console.log("selectInftwtAnlsRslt", result.content); return result.content; } } catch (error) { @@ -135,3 +163,47 @@ export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // console.error(error); } }; + +export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number }[] => { + const options = anlsArr.map(anls => ({ + text: anls.anlsInfo, + val: anls.rainInfwtAnlsSn, + })); + options.unshift({ val: 0, text: '선택' }); + return options; +}; + +export const selectRdiiAnls = async(aplcnYm:String) => { // 침입수분석 + try { + const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const result = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); + if (result && result.numberOfElements > 0) { + console.log("selectRdiiAnls", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; +export const getChartDataRdiiAnlsRslt = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.anlsTm, + val: anlsRslt.predcOilq, + })); + return options; +}; +export const selectRdiiAnlsRslt = async(rainInfwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 + try { + if ((rainInfwtAnlsSn === undefined || rainInfwtAnlsSn === 0) || !pplMngNo) { + console.warn("RdiiAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/rdiiAnlsRslt/ppl/${rainInfwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectRdiiAnlsRslt", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; From 5b9747b7b1730e5011be88d163a1fbc336ade134 Mon Sep 17 00:00:00 2001 From: mind-one005 Date: Tue, 1 Jul 2025 08:48:23 +0900 Subject: [PATCH 068/259] =?UTF-8?q?=EC=83=81=EC=88=98=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9B=94=20=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/infilChart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index a420c4b40..a899b2b33 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -38,7 +38,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp // const aplcnYms = useAplcnYms().length > 0 ? useAplcnYms() : dummyAplcnYms; //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); - const aplcnYms = useAplcnYms(); // 상수사용월 데이터 가져오기 + const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 From 29cf135892346f533b8d21ce4ce4bd9ed6b77ce7 Mon Sep 17 00:00:00 2001 From: ljpark Date: Tue, 1 Jul 2025 09:30:43 +0900 Subject: [PATCH 069/259] =?UTF-8?q?=EB=94=94=EC=9E=90=EC=9D=B8=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/index.ts | 3 +- .../popupComponent/chart/infilChart.tsx | 36 ++++++++----------- .../popupComponent/chart/rdiiChart.tsx | 20 +++++------ 3 files changed, 26 insertions(+), 33 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index 875c647e3..feee420b3 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -20,7 +20,8 @@ type LayerContentMap = { // 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업 const layerContentMap: LayerContentMap = { // TODO: gis데이터 추가되면 추가 작업 필요 - "하수처리시설": { component: SwtrmtFclt, }, + //"하수처리시설": { component: SwtrmtFclt, }, + "하수처리시설": { component: MsSwagePpl, }, "하수처리구역": {}, "우수토실": { component: Ssc, }, "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index a899b2b33..21e81bd43 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -13,15 +13,13 @@ type ModalOpenProp = { btnTxt?: string, } - - const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState("0"); const [inftwtAnlss, setInftwtAnlss] = useState([]); - const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState([]); // 침입수분석정보 options + const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState([{ val: 0, text: '선택' }]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ @@ -32,12 +30,6 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp { label: "3", val: 35 }, { label: "5", val: 55 },], }); - // chartData1: [],chartData2: [],}); - - // API에서 데이터를 가져오지 못할 경우 더미 데이터 사용 - // const aplcnYms = useAplcnYms().length > 0 ? useAplcnYms() : dummyAplcnYms; - - //const [aplcnYms, setAplcnYms] = useState<{ text: string; val: string }[]>([]); const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 const openPopup = () => { if (buttonRef.current) { @@ -62,7 +54,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp setPopupOpen(true); // 모달이 닫힐 때 팝업은 setAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 - setInftwtAnlsInfos([]); // 침입수분석정보 초기화 + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 setChartData({ @@ -153,7 +145,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
{popupOpen && (
@@ -200,8 +192,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
@@ -209,8 +201,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
@@ -218,8 +210,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
@@ -227,7 +219,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState(""); const [rdiiAnlss, setRdiiAnlss] = useState([]); - const [rdiiAnlsInfos, setRdiiAnlsInfos] = useState([]); // 강우유입수분석정보 options + const [rdiiAnlsInfos, setRdiiAnlsInfos] = useState([{ val: 0, text: '선택' }]); // 강우유입수분석정보 options const [rdiiAnls, setRdiiAnls] = useState(null); // 강우유입수분석정보 const [rainInfwtAnlsSn, setRainInfwtAnlsSn] = useState(0); // 강우유입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ @@ -56,7 +56,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpe setPopupOpen(true); // 모달이 닫힐 때 팝업은 setAplcnYm(""); // 상수사용월 초기화 setRdiiAnlss([]); // 강우유입수분석 초기화 - setRdiiAnlsInfos([]); // 강우유입수분석정보 초기화 + setRdiiAnlsInfos([{ val: 0, text: '선택' }]); // 강우유입수분석정보 초기화 setRdiiAnls(null); // 강우유입수분석정보 초기화 setRainInfwtAnlsSn(0); // 강우유입수분석 일련번호 초기화 setChartData({ @@ -147,7 +147,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpe
{popupOpen && (
Date: Tue, 1 Jul 2025 10:00:14 +0900 Subject: [PATCH 070/259] =?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9D=BC=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/lib/gis.style.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/map/lib/gis.style.js b/packages/common/business_components/src/ui/map/lib/gis.style.js index 713347f54..8cff08dca 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.style.js +++ b/packages/common/business_components/src/ui/map/lib/gis.style.js @@ -87,7 +87,7 @@ GisOlStyle.prototype = { this.setOverlay(layer, feature, overlayHtml); } - let baseResolution = 20; + let baseResolution = 2; let minScale = 0.4; let maxScale = 1.5; let scale = baseResolution / resolution > maxScale ? maxScale : baseResolution / resolution; From 464f026ad1ad9e168f6699b255876e90c8b0dd14 Mon Sep 17 00:00:00 2001 From: ljpark Date: Tue, 1 Jul 2025 10:01:17 +0900 Subject: [PATCH 071/259] =?UTF-8?q?i/i=20=EA=B7=B8=EB=9E=98=ED=94=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/infilChart.tsx | 27 ++++++++++--------- .../popupComponent/chart/rdiiChart.tsx | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 21e81bd43..7385d84cc 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -5,7 +5,8 @@ import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; import type { TInftwtAnls } from './aplcnYms'; -import { getChartDataInftwtAnlsRslt, getOptionsInftwtAnlsInfo, selectInftwtAnls, selectInftwtAnlsRslt, useAplcnYms } from './aplcnYms'; +import { useAplcnYms, getOptionsInftwtAnlsInfo, selectInftwtAnls } from './aplcnYms'; +import { getChartDataInftwtAnlsRslt, selectInftwtAnlsRslt, selectOilq, getChartDataOilq } from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, @@ -81,23 +82,25 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp .then((data) => { setInftwtAnlss(data ?? []); setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data)); + setInftwtAnlsSn(0); // 초기화 }) .catch((error) => { console.error("selectInftwtAnls 에러:", error); setInftwtAnlss([]); setInftwtAnlsInfos([{ val: 0, text: '선택' }]); }); - setInftwtAnlsSn(0); // 초기화 + }, [aplcnYm]); // 값 표시 useEffect(() => { // 선택된 침입수분석 정보에 대한 처리 로직 + if (inftwtAnlsSn === 0) return; const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === inftwtAnlsSn); if (selectedAnls) { setInftwtAnls(selectedAnls); } - }, [inftwtAnlsSn, inftwtAnlss]); + }, [inftwtAnlsSn]); const closePopup = () => { // 팝업 닫기 selectInftwtAnlsRslt(inftwtAnlsSn, "L13101003").then((data) => {// 침입수분석 결과 조회 @@ -107,13 +110,13 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp chartData1: rsltData // 침입수분석결과 })); }); - // selectOilq(inftwtAnlsSn,"L13101003").then((data) => {// 유량 조회 - // const rsltData = getChartDataOilq(data ?? []); - // setChartData(prev => ({ - // ...prev, - // chartData2: rsltData // 유량 - // })); - // }); + selectOilq(inftwtAnlsSn,"L13101003").then((data) => {// 유량 조회 + const rsltData = getChartDataOilq(data ?? []); + setChartData(prev => ({ + ...prev, + chartData2: rsltData // 유량 + })); + }); setPopupOpen(false); }; @@ -220,8 +223,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp
diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 449f7bbde..3b13a3df7 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -223,7 +223,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpe
From c5830e0326f7804533abda9d51e86317928b0425 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Tue, 1 Jul 2025 10:26:37 +0900 Subject: [PATCH 072/259] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index 152441c70..17983edf2 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -504,7 +504,7 @@ export function PbnstBuseForm({ size={commonButonSize} className="mt-6 mr-3" > - 수요항목 추가 + 수요처 추가
{( From 5579ab677d6a352c65ab5118882d4fa3aed09fed Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 10:26:40 +0900 Subject: [PATCH 073/259] =?UTF-8?q?feat:=20=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=8B=9C=EC=84=A4=ED=98=84=ED=99=A9=20=EC=83=81=EB=8B=A8=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EB=B0=94=20=EC=8B=9C=EC=84=A4=EB=AA=85=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=99=84=EC=84=B1=20=EA=B2=80=EC=83=89=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(=EC=A1=B0=ED=9A=8C=20=EB=B2=84=ED=8A=BC,?= =?UTF-8?q?=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=B2=84=ED=8A=BC=20=EB=AF=B8?= =?UTF-8?q?=EA=B5=AC=ED=98=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/map/page.tsx | 1 + apps/wr/app/map/htdflSttn/page.tsx | 31 ++-- apps/wr/app/map/mapSearchBar.tsx | 157 +++++++----------- apps/wr/app/page.tsx | 4 +- .../business_components/src/ui/map/GisTree.js | 6 +- 5 files changed, 88 insertions(+), 111 deletions(-) diff --git a/apps/sn/app/map/page.tsx b/apps/sn/app/map/page.tsx index e1a90d5f1..d8bab06bb 100644 --- a/apps/sn/app/map/page.tsx +++ b/apps/sn/app/map/page.tsx @@ -106,6 +106,7 @@ const Map = () => { setIsSearchModalOpen={setIsSearchModalOpen} isOpen={isOpen} isSearchModalOpen={isSearchModalOpen} + onCheckedLayersChange={undefined} />
); diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx index 5ba199c8c..937490fe2 100644 --- a/apps/wr/app/map/htdflSttn/page.tsx +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -108,15 +108,15 @@ const Map = () => { }; // MapSearchBar 래퍼 컴포넌트 - const CustomMapSearchBar = (props: any) => { - return ( - - ); - }; + // const CustomMapSearchBar = (props: any) => { + // return ( + // + // ); + // }; return (
@@ -125,10 +125,21 @@ const Map = () => { isSearch={false} gisMaps={gisMaps} isMiniMap={true} - searchView={CustomMapSearchBar} + searchView={(props: any) => ( + + ) + } detailView={(props: any) => ( )} diff --git a/apps/wr/app/map/mapSearchBar.tsx b/apps/wr/app/map/mapSearchBar.tsx index f5d693ee3..eabc6b892 100644 --- a/apps/wr/app/map/mapSearchBar.tsx +++ b/apps/wr/app/map/mapSearchBar.tsx @@ -1,16 +1,12 @@ "use client" -import { Button, Input, Label } from "@common/components/ui"; -import React, { useCallback, useEffect, useRef, useState, useMemo } from "react"; -import { useForm } from "react-hook-form"; -import { MapSearchFormLeft } from "./mapSearchForm"; import { useWrStore } from "@/app/store"; -import { btnClass } from "@/app/store/common/code"; -import { SearchBaseForm } from "@common/business_components"; -import { FormUi, SelectBox, SearchFormLeft, SearchFormRight, Form, FormField } from "@common/business_components/ui"; -import type { ReturnType, SelectDataType, EnvPartSelectDataType } from "@common/business_components/ui"; import SearchInputText from "@/components/ui/searchInput/searchInput"; -import { zodResolver } from "@hookform/resolvers/zod"; +import type { EnvPartSelectDataType, ReturnType, SelectDataType } from "@common/business_components/ui"; +import { SelectBox } from "@common/business_components/ui"; +import { Button, Input, Label } from "@common/components/ui"; +import React, { useEffect, useMemo, useRef, useState } from "react"; +import { MapSearchFormLeft } from "./mapSearchForm"; // 건물 검색 타입 정의 @@ -49,6 +45,8 @@ type SearchBaseType = { showQueryButton?: boolean; showInitButton?: boolean; showApplyButton?: boolean; + checkedLayers?: string[]; + checkedLayersData?: any[]; } const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -82,17 +80,29 @@ export function MapSearchBar({ rightClassName, showQueryButton = true, showInitButton = true, - showApplyButton = true + showApplyButton = true, + checkedLayers = [], + checkedLayersData = [], }: SearchBaseType) { // 로딩바 const [isLoading, setIsLoading] = useState(false); // 상세 정보 조회를 위한 상태 추가 const [popupFeature, setPopupFeature] = useState(null); - const { code } = useWrStore((state) => state); const [isChHead, setIsChHead] = useState(false); const ref = useRef({} as ReturnType); + // zustand store에서 건물 검색 함수와 데이터 가져오기 + const { + code, + bdst, + findBdst, + wrMap, + // buildingSearchRes, + buildingNmSearch, + buildingNmSearchMultiple + } = useWrStore((state) => state); + const [selectedBuilding, setSelectedBuilding] = useState(null); const [buildingSearchText, setBuildingSearchText] = useState(""); const [buildingList, setBuildingList] = useState([]); @@ -141,77 +151,16 @@ export function MapSearchBar({ ]; }, [selectedSigun]); - // 건물 검색 API 호출 함수 - const searchBuildings = async (searchText: string) => { - if (!searchText.trim()) { - setBuildingList([]); - return; - } - - try { - const flg = "41"; // 적절한 플래그 값으로 설정 - const sigunCode = selectedSigun.val !== '0' ? selectedSigun.val : ''; - const apiEndpoint = `${API_URL}/v1/reuseFc/building/${flg}/${sigunCode}/${encodeURIComponent(searchText)}`; - - const response = await fetch(apiEndpoint, { - method: "GET", - headers: { - accept: "application/json", - "Content-Type": "application/json" - } - }); - - if (!response.ok) { - throw new Error(`API 호출 실패: ${response.status}`); - } - - const result = await response.json(); - - if (result.status === 200 && Array.isArray(result.data)) { - // 건물 검색 결과를 demandCompList 형태로 변환 - const convertedList = result.data.map((building: BuildingInfo) => ({ - dmdInfoPk: String(building.bdstInfoPk), - dmdCoNm: building.bdstNm, - daddr: building.daddr, - useUsgCd: "", - splyCpct: 0, - splyFmYn: "Y", - // 추가 필드들... - })); - setBuildingList(result.data); - // 글로벌 상태에도 업데이트 (SearchInputText가 사용할 수 있도록) - // getDemandCompList를 직접 호출하는 대신 상태를 직접 설정 - const { setBuildingSearchResults } = useWrStore.getState(); - if (setBuildingSearchResults) { - setBuildingSearchResults(convertedList); - } - } else { - setBuildingList([]); - } - } catch (error) { - console.error("건물 검색 중 오류 발생:", error); - setBuildingList([]); - } - }; - // 조회 함수 const queryVal = () => { - console.log("조회버튼 클릭"); - if (searchType == '공급처 후보지 조회') { - // queryClick({ - // partValue: partValue, - // sidoValue: sidoValue, - // sigunValue: sigunValue, - // regionValue: regionValue, - // unitWaterShedValue: untitWaterShedValue, - // middleRegionValue: middleRegionValue, - // envPartValue: envPartValue, - // sidoText: selectedSido.text, - // sigunText: selectedSigun.text, - // }); - } else if (searchType == '우리동네가뭄지도보기') { - } else if (searchType == '지도보기') { - + // 46 : 하수처리시설 + // 47 : 하수재이용시설 + // 48 : 빗물이용시설 + // 49 : 중수도시설 + // 50 : 온배수시설 + console.log("조회버튼 클릭: ", checkedLayers); + if (checkedLayers && checkedLayers.includes('48')) { + // searchBuildings } } @@ -308,6 +257,27 @@ export function MapSearchBar({ } }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, ref]); + // buildingSearchText가 변경될 때 API 호출 + useEffect(() => { + if (buildingSearchText && buildingSearchText.length > 1) { + if (checkedLayers && checkedLayers.length > 0) { + // 다중 레이어 검색 + // buildingNmSearchMultiple(checkedLayers, selectedSigun.val || "", buildingSearchText); + buildingNmSearch("RNB", selectedSigun.val, buildingSearchText); + } else { + // 단일 레이어 검색 + // buildingNmSearch(checkedLayers[0], selectedSigun.val, buildingSearchText); + } + } else { + // 검색 텍스트가 짧으면 리스트 초기화 + if (checkedLayers && checkedLayers.length > 0) { + // buildingNmSearchMultiple(checkedLayers, selectedSigun.val || "", ""); + } else { + buildingNmSearch("RNB", selectedSigun.val || "", ""); + } + } + }, [buildingSearchText]); + return (
@@ -338,32 +308,23 @@ export function MapSearchBar({ value={selectedSigun.val} selectClass={'w-32'} /> - {/* -
- -
*/}
{ - setBuildingSearchText(searchText || ""); - if (searchText) { - searchBuildings(searchText); - } + setValue={(searchNm?: string) => { + setBuildingSearchText(searchNm || ""); }} - setRtnData={(buildingData) => { - if (buildingData && buildingData.length > 0 && buildingData[0]) { - // 선택된 건물 정보를 찾아서 설정 - const selectedBuildingInfo = buildingList.find(building => - building.bdstNm === buildingData[0].dmdCoNm - ); - setSelectedBuilding(selectedBuildingInfo || null); - console.log("선택된 시설:", selectedBuildingInfo); - } + setRtnData={function (rtnData: any): void { + // 선택된 건물 데이터 처리 + // if (rtnData && rtnData.bdstInfoPk) { + // setSelectedBuilding(rtnData); + // setBuildingSearchText(rtnData.bdstNm || ""); + // } }} + searchList={wrMap.buildingSearchRes || []} />
diff --git a/apps/wr/app/page.tsx b/apps/wr/app/page.tsx index 70261c4c6..c2be341cf 100644 --- a/apps/wr/app/page.tsx +++ b/apps/wr/app/page.tsx @@ -159,8 +159,8 @@ export default function Home() {

시설 현황(지도)

-
diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index e36569143..3c2cb2819 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -41,8 +41,12 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes // 기본 체크된 레이어들을 지도에 표시 gisCore.setLayerOnMap(defaultChecked, true); + + // 초기 체크된 레이어 정보를 상위로 전달 + const defaultCheckedNodesData = nodes.filter(node => defaultChecked.includes(node.id)); + onCheckedChange?.(defaultChecked, defaultCheckedNodesData); } - }, [nodes]); + }, [nodes]); // onCheckedChange를 의존성에 추가 // 초기 표시 여부가 'Y'인 레이어들 찾기 const getDefaultCheckedNodes = (nodes, values = []) => { From 0dcbe8549caa13decc9721b0f51490ac273dea19 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Tue, 1 Jul 2025 10:28:48 +0900 Subject: [PATCH 074/259] =?UTF-8?q?libphonenumber=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A0=84=ED=99=94=EB=B2=88=ED=98=B8=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/package.json | 1 + .../src/ui/sdmInsertForm/form.tsx | 30 ++++++++++++++++--- .../src/ui/sdmInsertForm/index.tsx | 4 +-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/common/business_components/package.json b/packages/common/business_components/package.json index e7aae9fc5..da6f8c344 100644 --- a/packages/common/business_components/package.json +++ b/packages/common/business_components/package.json @@ -35,6 +35,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^3.6.0", + "libphonenumber-js": "^1.12.9", "lucide-react": "^0.474.0", "path": "^0.12.7", "react-day-picker": "^8.10.1", diff --git a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx index 6ccaac946..2d7d2bf90 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx @@ -3,9 +3,9 @@ import { SelectBox } from "../select"; import { Input } from "@common/components"; import { FormUi } from "../form_ui"; import { useCallback, useEffect, useState } from "react"; +import { AsYouType } from "libphonenumber-js"; import type { ControllerRenderProps, UseFormReturn } from "react-hook-form"; import { SdmSearchForm } from "./sdmNameBox"; -import { set } from "date-fns"; // 수요처 정보 export type DemandCompType = { @@ -79,6 +79,19 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const [updateCoNm, setUpdateNm] = useState('') + + const formatPhoneNumber = (value:string) => { + const input = value; + const formatter = new AsYouType("KR"); + const formatted = formatter.input(input); + + // 저장할 값 처리: 숫자만 추출 + const digitsOnly = input.replace(/\D/g, ""); + + return formatted + }; + + const initializeSigunData = useCallback((sidoCd: string) => { if (sidoCd === '0') { setSigunValue('0'); @@ -325,14 +338,23 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun { name: "telno", label: "전화번호", - component: (field) => ( + component: (field) => + + { + const formattedValue = formatPhoneNumber(field.value??''); // 초기 렌더링 시에도 포맷 적용 + + return ( { + const value = e.target.value.replace(/\D/g, ''); // 숫자만 저장 + field.onChange(value); + }} /> - ) + )} }, { diff --git a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx index 13e461910..4219602e6 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx @@ -41,8 +41,8 @@ const createFormSchema = (isBznmTotNoDisabled: boolean, isDuplicate: boolean ,up telno: z.string() .min(8, "전화번호는 8자 이상 입력해주세요") .max(11, "전화번호는 11자 이내로 입력해주세요") - .regex(/^[0-9-]+$/, "전화번호는 숫자와 하이픈(-)만 입력 가능합니다"), - rgtr: z.string().optional(), + .regex(/^[0-9]+$/, "전화번호는 숫자만 입력 가능합니다"), + rgtr: z.string().optional(), dmdAplyPswd : updateList?.dmdInfoPk // 업데이트일경우 ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 : z.string().optional() From ecc11720acbf2795439c46d69dad7af262213c61 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 10:30:38 +0900 Subject: [PATCH 075/259] =?UTF-8?q?fix:=20Gis.js=20import=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/Gis.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 39cfdbe44..e85b8d162 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -14,7 +14,6 @@ import GisMapToggle from './GisMapToggle'; import GisSelect from './GisSelect'; import GisToolBar from './GisToolBar'; import GisTree from './GisTree'; -import FacilityInfoPopup from './facilityInfoPopup'; import './lib/css/gis.common.css'; import GisApp from './lib/gis.core'; From f4b0af5edea5013b3b9204e69c4637b04be913f6 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 11:01:20 +0900 Subject: [PATCH 076/259] =?UTF-8?q?fix:=20mapSearchBar=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/htdflSttn/page.tsx | 21 +- apps/wr/app/map/mapSearchBar.tsx | 771 +++++++++--------- apps/wr/app/map/newWindowPopup.tsx | 8 +- .../business_components/src/ui/map/Gis.js | 200 ++--- 4 files changed, 503 insertions(+), 497 deletions(-) diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx index 937490fe2..e74d055d8 100644 --- a/apps/wr/app/map/htdflSttn/page.tsx +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -125,16 +125,17 @@ const Map = () => { isSearch={false} gisMaps={gisMaps} isMiniMap={true} - searchView={(props: any) => ( - - ) - } + searchView={undefined} + // searchView={(props: any) => ( + // + // ) + // } detailView={(props: any) => ( void; - btnClass?: string; - ref?: React.RefObject; - isAdmin?: boolean; - leftClassName?: string; - rightClassName?: string; - showQueryButton?: boolean; - showInitButton?: boolean; - showApplyButton?: boolean; - checkedLayers?: string[]; - checkedLayersData?: any[]; -} +// type SearchBaseType = { +// searchType: string; +// selectSidoData?: SelectDataType[] | []; +// selectSigunData?: SelectDataType[] | []; +// selectRegionData?: SelectDataType[] | []; +// selectUnitWaterShedData?: SelectDataType[] | []; +// selectMiddleRegionData?: SelectDataType[] | []; +// selectEnvPartData?: EnvPartSelectDataType[] | []; +// onFeatureSelect: () => void; +// btnClass?: string; +// ref?: React.RefObject; +// isAdmin?: boolean; +// leftClassName?: string; +// rightClassName?: string; +// showQueryButton?: boolean; +// showInitButton?: boolean; +// showApplyButton?: boolean; +// checkedLayers?: string[]; +// checkedLayersData?: any[]; +// } -const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; +// const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; -const YEARS = Array.from({ length: 100 }, (_, i) => `${2025 - i}`); +// const YEARS = Array.from({ length: 100 }, (_, i) => `${2025 - i}`); -interface SearchModalProps { - open: boolean; - onOpenChange: (open: boolean) => void; - onFeatureSelect: (row: any) => void; -} +// interface SearchModalProps { +// open: boolean; +// onOpenChange: (open: boolean) => void; +// onFeatureSelect: (row: any) => void; +// } -interface SelectedDataTypeWithSggNm { - text: string; - val: string; - sggNm: string; -} +// interface SelectedDataTypeWithSggNm { +// text: string; +// val: string; +// sggNm: string; +// } -export function MapSearchBar({ - searchType, - selectSidoData, - selectSigunData, - selectRegionData, - selectUnitWaterShedData, - selectMiddleRegionData, - selectEnvPartData, - btnClass, - onFeatureSelect, - isAdmin = false, - leftClassName, - rightClassName, - showQueryButton = true, - showInitButton = true, - showApplyButton = true, - checkedLayers = [], - checkedLayersData = [], -}: SearchBaseType) { +// export function MapSearchBar({ +// searchType, +// selectSidoData, +// selectSigunData, +// selectRegionData, +// selectUnitWaterShedData, +// selectMiddleRegionData, +// selectEnvPartData, +// btnClass, +// onFeatureSelect, +// isAdmin = false, +// leftClassName, +// rightClassName, +// showQueryButton = true, +// showInitButton = true, +// showApplyButton = true, +// checkedLayers = [], +// checkedLayersData = [], +// }: SearchBaseType) { - // 로딩바 - const [isLoading, setIsLoading] = useState(false); - // 상세 정보 조회를 위한 상태 추가 - const [popupFeature, setPopupFeature] = useState(null); - const [isChHead, setIsChHead] = useState(false); - const ref = useRef({} as ReturnType); +// // 로딩바 +// const [isLoading, setIsLoading] = useState(false); +// // 상세 정보 조회를 위한 상태 추가 +// const [popupFeature, setPopupFeature] = useState(null); +// const [isChHead, setIsChHead] = useState(false); +// const ref = useRef({} as ReturnType); - // zustand store에서 건물 검색 함수와 데이터 가져오기 - const { - code, - bdst, - findBdst, - wrMap, - // buildingSearchRes, - buildingNmSearch, - buildingNmSearchMultiple - } = useWrStore((state) => state); +// // zustand store에서 건물 검색 함수와 데이터 가져오기 +// const { +// code, +// bdst, +// findBdst, +// wrMap, +// buildingSearchRes, +// buildingNmSearch, +// buildingNmSearchMultiple +// } = useWrStore((state) => state); - const [selectedBuilding, setSelectedBuilding] = useState(null); - const [buildingSearchText, setBuildingSearchText] = useState(""); - const [buildingList, setBuildingList] = useState([]); +// const [selectedBuilding, setSelectedBuilding] = useState(null); +// const [buildingSearchText, setBuildingSearchText] = useState(""); +// const [buildingList, setBuildingList] = useState([]); - // 전체 목록 - const [partValue, setPartValue] = useState("A"); - const [sidoValue, setSidoValue] = useState("0"); - const [sigunValue, setSigunValue] = useState("0"); - const [regionValue, setRegionValue] = useState("0"); - const [untitWaterShedValue, setUntitWaterShedValue] = useState("0"); - const [middleRegionValue, setMiddleRegionValue] = useState("0"); - const [envPartValue, setEnvPartValue] = useState("0"); - const [resetTrigger, setResetTrigger] = useState(false); - const [sidoText, setSidoText] = useState("0"); - const [sigunText, setSigunText] = useState("0"); - // 공급처 후보지 조회 필터 목록 - const [selectedSido, setSelectedSido] = useState({ text: "전체", val: '0' }); - const [selectedSigun, setSelectedSigun] = useState({ text: "전체", val: '0' }); - const [selectedFclt, setSelectedFclt] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 - // 전체 시설 - let allFclt: SelectedDataTypeWithSggNm[] = [{ text: "전체", val: '0', sggNm: '전체' }]; - // 우리동네가뭄지도 필터 목록 - const [selectedDong, setSelectedDong] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 // 행정동 +// // 전체 목록 +// const [partValue, setPartValue] = useState("A"); +// const [sidoValue, setSidoValue] = useState("0"); +// const [sigunValue, setSigunValue] = useState("0"); +// const [regionValue, setRegionValue] = useState("0"); +// const [untitWaterShedValue, setUntitWaterShedValue] = useState("0"); +// const [middleRegionValue, setMiddleRegionValue] = useState("0"); +// const [envPartValue, setEnvPartValue] = useState("0"); +// const [resetTrigger, setResetTrigger] = useState(false); +// const [sidoText, setSidoText] = useState("0"); +// const [sigunText, setSigunText] = useState("0"); +// // 공급처 후보지 조회 필터 목록 +// const [selectedSido, setSelectedSido] = useState({ text: "전체", val: '0' }); +// const [selectedSigun, setSelectedSigun] = useState({ text: "전체", val: '0' }); +// const [selectedFclt, setSelectedFclt] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 +// // 전체 시설 +// let allFclt: SelectedDataTypeWithSggNm[] = [{ text: "전체", val: '0', sggNm: '전체' }]; +// const [selectedDong, setSelectedDong] = useState({ text: "전체", val: '0', sggNm: '전체' }); // 시설명 선택 상태 // 행정동 - const filteredSigunData = useMemo(() => { - if (!selectedSido || selectedSido.val === '0' || !selectedSido.val) return [{ text: "전체", val: '0' }]; - return [ - { text: "전체", val: '0' }, - ...code.sggCd.filter(item => item.val.substring(0, 2) === selectedSido.val.substring(0, 2)) - ]; - }, [selectedSido]); +// const filteredSigunData = useMemo(() => { +// if (!selectedSido || selectedSido.val === '0' || !selectedSido.val) return [{ text: "전체", val: '0' }]; +// return [ +// { text: "전체", val: '0' }, +// ...code.sggCd.filter((item: { val: string; }) => item.val.substring(0, 2) === selectedSido.val.substring(0, 2)) +// ]; +// }, [selectedSido]); - const filteredFcltData = useMemo(() => { - if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) return [{ text: "전체", val: '0', sggNm: '전체' }]; - return [ - { text: "전체", val: '0', sggNm: '전체' }, - ...allFclt.filter(item => item.sggNm === selectedSido.text) - ]; - }, [selectedSigun]); +// const filteredFcltData = useMemo(() => { +// if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) return [{ text: "전체", val: '0', sggNm: '전체' }]; +// return [ +// { text: "전체", val: '0', sggNm: '전체' }, +// ...allFclt.filter(item => item.sggNm === selectedSido.text) +// ]; +// }, [selectedSigun]); - const filteredDong = useMemo(() => { - if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) return [{ text: "전체", val: '0', sggNm: '전체' }]; - return [ - { text: "전체", val: '0', sggNm: '전체' }, - // ...code.dong.filter(item => item.sggNm === selectedSido.text) - ]; - }, [selectedSigun]); +// const filteredDong = useMemo(() => { +// if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) return [{ text: "전체", val: '0', sggNm: '전체' }]; +// return [ +// { text: "전체", val: '0', sggNm: '전체' }, +// // ...code.dong.filter(item => item.sggNm === selectedSido.text) +// ]; +// }, [selectedSigun]); - // 조회 함수 - const queryVal = () => { - // 46 : 하수처리시설 - // 47 : 하수재이용시설 - // 48 : 빗물이용시설 - // 49 : 중수도시설 - // 50 : 온배수시설 - console.log("조회버튼 클릭: ", checkedLayers); - if (checkedLayers && checkedLayers.includes('48')) { - // searchBuildings - } - } +// // 조회 함수 +// const queryVal = () => { +// // 46 : 하수처리시설 +// // 47 : 하수재이용시설 +// // 48 : 빗물이용시설 +// // 49 : 중수도시설 +// // 50 : 온배수시설 +// console.log("조회버튼 클릭: ", checkedLayers); +// if (checkedLayers && checkedLayers.includes('48')) { +// // searchBuildings +// } +// } - // 초기화 함수 - const initVal = () => { - setPartValue("A"); - setSidoValue("0"); - setSigunValue("0"); - setRegionValue("0"); - setUntitWaterShedValue("0"); - setMiddleRegionValue("0"); - setEnvPartValue("0"); - setSidoText("전체"); - setSigunText("전체"); - setSelectedSido({ text: "전체", val: '0' }); - setSelectedSigun({ text: "전체", val: '0' }); - setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); - setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); - setResetTrigger(true); - }; +// // 초기화 함수 +// const initVal = () => { +// setPartValue("A"); +// setSidoValue("0"); +// setSigunValue("0"); +// setRegionValue("0"); +// setUntitWaterShedValue("0"); +// setMiddleRegionValue("0"); +// setEnvPartValue("0"); +// setSidoText("전체"); +// setSigunText("전체"); +// setSelectedSido({ text: "전체", val: '0' }); +// setSelectedSigun({ text: "전체", val: '0' }); +// setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); +// setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); +// setResetTrigger(true); +// }; - // 적용 버튼 - const applyVal = () => { - onFeatureSelect(); - }; +// // 적용 버튼 +// const applyVal = () => { +// onFeatureSelect(); +// }; - useEffect(() => { - if (resetTrigger) { - setResetTrigger(false); - } - }, [resetTrigger]); +// useEffect(() => { +// if (resetTrigger) { +// setResetTrigger(false); +// } +// }, [resetTrigger]); - // 시설 조회 - useEffect(() => { - const fetchData = async () => { - setIsLoading(true); - if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) { - allFclt = ([{ text: "전체", val: '0', sggNm: '전체' }]); - setIsLoading(false); - return; - } +// // 시설 조회 +// useEffect(() => { +// const fetchData = async () => { +// setIsLoading(true); +// if (!selectedSigun || selectedSigun.val === '0' || !selectedSigun.val) { +// allFclt = ([{ text: "전체", val: '0', sggNm: '전체' }]); +// setIsLoading(false); +// return; +// } - try { - const queryParamsFacility = new URLSearchParams({ - lyrTypeNm: 'tb_il_swage_prcs_fclt', - page: '0', - size: '100000', - sort: 'string', - }); - const cqlFiltersFacility: string[] = []; - if (selectedSigun.text && selectedSigun.val !== '0') { - cqlFiltersFacility.push(`sgg_nm ILIKE '%${selectedSigun.text}%'`); - } - if (cqlFiltersFacility.length > 0) { - queryParamsFacility.append('cqlFiter', cqlFiltersFacility.join(' and ')); - } - console.log("BaseLayout API URL for Facilities:", `v1/fclts?${queryParamsFacility.toString()}`); +// try { +// const queryParamsFacility = new URLSearchParams({ +// lyrTypeNm: 'tb_il_swage_prcs_fclt', +// page: '0', +// size: '100000', +// sort: 'string', +// }); +// const cqlFiltersFacility: string[] = []; +// if (selectedSigun.text && selectedSigun.val !== '0') { +// cqlFiltersFacility.push(`sgg_nm ILIKE '%${selectedSigun.text}%'`); +// } +// if (cqlFiltersFacility.length > 0) { +// queryParamsFacility.append('cqlFiter', cqlFiltersFacility.join(' and ')); +// } +// console.log("BaseLayout API URL for Facilities:", `v1/fclts?${queryParamsFacility.toString()}`); - const facilityRes = await fetch(`${API_URL}/v1/fclts?${queryParamsFacility.toString()}`, { - method: "GET", - headers: { accept: "application/json" } - }).then(res => res.json()); +// const facilityRes = await fetch(`${API_URL}/v1/fclts?${queryParamsFacility.toString()}`, { +// method: "GET", +// headers: { accept: "application/json" } +// }).then(res => res.json()); - const facilities = (facilityRes.data || []).map((item: any) => ({ - text: item.swtrmtFcltNm, - val: item.fid, - sggNm: item.sggNm - })); - allFclt = (facilities); +// const facilities = (facilityRes.data || []).map((item: any) => ({ +// text: item.swtrmtFcltNm, +// val: item.fid, +// sggNm: item.sggNm +// })); +// allFclt = (facilities); - } catch (error) { - console.error("BaseLayout: 지역/시설 데이터 조회 중 오류 발생:", error); - allFclt = ([{ text: "전체", val: '0', sggNm: '전체' }]); - } finally { - setIsLoading(false); - } - }; +// } catch (error) { +// console.error("BaseLayout: 지역/시설 데이터 조회 중 오류 발생:", error); +// allFclt = ([{ text: "전체", val: '0', sggNm: '전체' }]); +// } finally { +// setIsLoading(false); +// } +// }; - fetchData(); - }, [selectedSigun]); +// fetchData(); +// }, [selectedSigun]); - useEffect(() => { - if (ref && ref.current) { - const customRef = ref.current; - customRef.partValue = partValue; - customRef.sidoValue = sidoValue; - customRef.sigunValue = sigunValue; - customRef.regionValue = regionValue; - customRef.unitWaterShedValue = untitWaterShedValue; - customRef.middleRegionValue = middleRegionValue; - customRef.envPartValue = envPartValue; - customRef.sidoText = selectedSido.text; - customRef.sigunText = selectedSigun.text; - } - }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, ref]); +// useEffect(() => { +// if (ref && ref.current) { +// const customRef = ref.current; +// customRef.partValue = partValue; +// customRef.sidoValue = sidoValue; +// customRef.sigunValue = sigunValue; +// customRef.regionValue = regionValue; +// customRef.unitWaterShedValue = untitWaterShedValue; +// customRef.middleRegionValue = middleRegionValue; +// customRef.envPartValue = envPartValue; +// customRef.sidoText = selectedSido.text; +// customRef.sigunText = selectedSigun.text; +// } +// }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, ref]); - // buildingSearchText가 변경될 때 API 호출 - useEffect(() => { - if (buildingSearchText && buildingSearchText.length > 1) { - if (checkedLayers && checkedLayers.length > 0) { - // 다중 레이어 검색 - // buildingNmSearchMultiple(checkedLayers, selectedSigun.val || "", buildingSearchText); - buildingNmSearch("RNB", selectedSigun.val, buildingSearchText); - } else { - // 단일 레이어 검색 - // buildingNmSearch(checkedLayers[0], selectedSigun.val, buildingSearchText); - } - } else { - // 검색 텍스트가 짧으면 리스트 초기화 - if (checkedLayers && checkedLayers.length > 0) { - // buildingNmSearchMultiple(checkedLayers, selectedSigun.val || "", ""); - } else { - buildingNmSearch("RNB", selectedSigun.val || "", ""); - } - } - }, [buildingSearchText]); +// // buildingSearchText가 변경될 때 API 호출 +// useEffect(() => { +// if (buildingSearchText && buildingSearchText.length > 1) { +// if (checkedLayers && checkedLayers.length > 0) { +// // 다중 레이어 검색 +// // buildingNmSearchMultiple(checkedLayers, selectedSigun.val || "", buildingSearchText); +// buildingNmSearch("RNB", selectedSigun.val, buildingSearchText); +// } else { +// // 단일 레이어 검색 +// // buildingNmSearch(checkedLayers[0], selectedSigun.val, buildingSearchText); +// } +// } else { +// // 검색 텍스트가 짧으면 리스트 초기화 +// if (checkedLayers && checkedLayers.length > 0) { +// // buildingNmSearchMultiple(checkedLayers, selectedSigun.val || "", ""); +// } else { +// buildingNmSearch("RNB", selectedSigun.val || "", ""); +// } +// } +// }, [buildingSearchText]); - return ( -
-
-
- {searchType == "공급처 후보지 조회" && ( - <> - { - const selected = code.cityCd.find(item => (item.val === val)); - setSelectedSido(selected || { text: "전체", val: '0' }); - setSelectedSigun({ text: "전체", val: '0' }); - }} - value={selectedSido.val} - selectClass={'w-32'} - /> - { - const selected = filteredSigunData.find(item => (item.val === val)); - setSelectedSigun(selected || { text: "전체", val: '0' }); - setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); - }} - value={selectedSigun.val} - selectClass={'w-32'} - /> -
- -
- { - setBuildingSearchText(searchNm || ""); - }} - setRtnData={function (rtnData: any): void { - // 선택된 건물 데이터 처리 - // if (rtnData && rtnData.bdstInfoPk) { - // setSelectedBuilding(rtnData); - // setBuildingSearchText(rtnData.bdstNm || ""); - // } - }} - searchList={wrMap.buildingSearchRes || []} - /> -
-
- - )} - {searchType == "우리동네가뭄지도보기" && ( - <> - { - const selected = code.cityCd.find(item => (item.val === val)); - setSelectedSido(selected || { text: "전체", val: '0' }); - setSelectedSigun({ text: "전체", val: '0' }); - }} - value={selectedSido.val} - selectClass={'w-44'} - /> - { - const selected = filteredSigunData.find(item => (item.val === val)); - setSelectedSigun(selected || { text: "전체", val: '0' }); - setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); - }} - value={selectedSigun.val} - selectClass={'w-32'} - /> - { - const selected = filteredDong.find(item => (item.val === val)); - setSelectedDong(selected || { text: "전체", val: '0', sggNm: '전체' }); - }} - value={selectedDong.val} - selectClass={'w-32'} - /> - - )} - {searchType == "지도보기" && ( -
-
{/* SearchFormLeft 래퍼 */} - -
- -
- -
-
- )} -
- {/* 버튼 부분 */} -
- {showQueryButton && } - {showInitButton && } - {showApplyButton && } -
-
-
- ) -} +// return ( +//
+//
+//
+// {searchType == "공급처 후보지 조회" && ( +// <> +// { +// const selected = code.cityCd.find((item: { val: string | number; }) => (item.val === val)); +// setSelectedSido(selected || { text: "전체", val: '0' }); +// setSelectedSigun({ text: "전체", val: '0' }); +// }} +// value={selectedSido.val} +// selectClass={'w-32'} +// /> +// { +// const selected = filteredSigunData.find(item => (item.val === val)); +// setSelectedSigun(selected || { text: "전체", val: '0' }); +// setSelectedFclt({ text: "전체", val: '0', sggNm: '전체' }); +// }} +// value={selectedSigun.val} +// selectClass={'w-32'} +// /> +//
+// +//
+// { +// setBuildingSearchText(searchNm || ""); +// }} +// setRtnData={function (rtnData: any): void { +// // 선택된 건물 데이터 처리 +// // if (rtnData && rtnData.bdstInfoPk) { +// // setSelectedBuilding(rtnData); +// // setBuildingSearchText(rtnData.bdstNm || ""); +// // } +// }} +// searchList={buildingSearchRes || []} +// /> +//
+//
+// +// )} +// {searchType == "우리동네가뭄지도보기" && ( +// <> +// { +// const selected = code.cityCd.find((item: { val: string | number; }) => (item.val === val)); +// setSelectedSido(selected || { text: "전체", val: '0' }); +// setSelectedSigun({ text: "전체", val: '0' }); +// }} +// value={selectedSido.val} +// selectClass={'w-44'} +// /> +// { +// const selected = filteredSigunData.find(item => (item.val === val)); +// setSelectedSigun(selected || { text: "전체", val: '0' }); +// setSelectedDong({ text: "전체", val: '0', sggNm: '전체' }); +// }} +// value={selectedSigun.val} +// selectClass={'w-32'} +// /> +// { +// const selected = filteredDong.find(item => (item.val === val)); +// setSelectedDong(selected || { text: "전체", val: '0', sggNm: '전체' }); +// }} +// value={selectedDong.val} +// selectClass={'w-32'} +// /> +// +// )} +// {searchType == "지도보기" && ( +//
+//
{/* SearchFormLeft 래퍼 */} +// +//
+// +//
+// +//
+//
+// )} +//
+// {/* 버튼 부분 */} +//
+// {showQueryButton && } +// {showInitButton && } +// {showApplyButton && } +//
+//
+//
+// ) +// } diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index e67b2b0fb..dfbb1dc24 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -48,7 +48,8 @@ const NewWindowPopup: React.FC = ({ onClose }) => { const [activeTab, setActiveTab] = useState(TABS[0]?.val ?? "0"); - const [showDetailView, setShowDetailView] = useState(false); // 상세정보 화면 표시 상태 추가 + // swcho : useState의 true, false 값 변경하여 목록, 상태 테스트 하였음 + const [showDetailView, setShowDetailView] = useState(true); // 상세정보 화면 표시 상태 추가 // onClose 함수를 useCallback으로 메모이제이션 const memoizedOnClose = useCallback(() => { @@ -183,14 +184,15 @@ const NewWindowPopup: React.FC = ({ layer.data?.lyrNm?.includes('하수처리') || layer.data?.lyrNm?.includes('재이용시설') ); + // swcho : true, false 값 변경하여 시설 변경하여 테스트하였음 // 재이용시설 const isPbnst = false; // 빗물이용시설 const isRain = false; // 중수도시설 - const isRswt = false; + const isRswt = true; // 온배수시설 - const isHtdfl = true; + const isHtdfl = false; return ( diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index e85b8d162..5ac98f27f 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -16,6 +16,7 @@ import GisToolBar from './GisToolBar'; import GisTree from './GisTree'; import './lib/css/gis.common.css'; import GisApp from './lib/gis.core'; +// import FacilityInfoPopup from './FacilityInfoPopup'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); @@ -47,8 +48,8 @@ function Gis({ const checkedLayerIds = useRef([]); // 팝업 데이터를 저장할 상태와 오버레이 참조를 저장할 ref 추가 - const [facilityInfoPopupData, setFacilityInfoPopupData] = useState([]); - const facilityOverlaysRef = useRef([]); + // const [facilityInfoPopupData, setFacilityInfoPopupData] = useState([]); + // const facilityOverlaysRef = useRef([]); // 체크된 레이어 상태 관리 const [checkedLayers, setCheckedLayers] = useState([]); const [checkedLayersData, setCheckedLayersData] = useState([]); @@ -225,119 +226,119 @@ function Gis({ } } - // 데이터 로드 및 팝업 생성 로직 - useEffect(() => { - if (!mapInstanceRef.current) return; // 맵이 생성되지 않았으면 실행 안 함 + // // 데이터 로드 및 팝업 생성 로직 + // useEffect(() => { + // if (!mapInstanceRef.current) return; // 맵이 생성되지 않았으면 실행 안 함 - // 1. 팝업 데이터 가져오기 (feature.js의 getData와 유사) - const fetchPopupData = async () => { - // 실제 API 호출 로직으로 대체해야 합니다. - // 예시: const response = await yourApiService.getFcltyWtCnt(); - // setFacilityInfoPopupData(response.data); + // // 1. 팝업 데이터 가져오기 (feature.js의 getData와 유사) + // const fetchPopupData = async () => { + // // 실제 API 호출 로직으로 대체해야 합니다. + // // 예시: const response = await yourApiService.getFcltyWtCnt(); + // // setFacilityInfoPopupData(response.data); - // 임시 목업 데이터 - const mockData = [ - { ftrIdn: 1, ftrCde: 'SA206', bplcNm: '처리장A', fcltyUseYn: 'Y', x: 127.005, y: 37.282, aCnt: 10, cCnt: 5, eCnt: 3, mCnt: 8, iCnt: 2 }, - { ftrIdn: 2, ftrCde: 'SA112', bplcNm: '처리장B', fcltyUseYn: 'N', x: 127.010, y: 37.285, aCnt: 8, cCnt: 4, eCnt: 2, mCnt: 6, iCnt: 1 } - ]; - setFacilityInfoPopupData(mockData); - }; + // // 임시 목업 데이터 + // const mockData = [ + // { ftrIdn: 1, ftrCde: 'SA206', bplcNm: '처리장A', fcltyUseYn: 'Y', x: 127.005, y: 37.282, aCnt: 10, cCnt: 5, eCnt: 3, mCnt: 8, iCnt: 2 }, + // { ftrIdn: 2, ftrCde: 'SA112', bplcNm: '처리장B', fcltyUseYn: 'N', x: 127.010, y: 37.285, aCnt: 8, cCnt: 4, eCnt: 2, mCnt: 6, iCnt: 1 } + // ]; + // setFacilityInfoPopupData(mockData); + // }; - fetchPopupData(); + // fetchPopupData(); - }, [mapInstanceRef.current]); // 맵 인스턴스가 생성된 후 한 번만 실행 + // }, [mapInstanceRef.current]); // 맵 인스턴스가 생성된 후 한 번만 실행 - // 데이터가 변경되면 오버레이를 생성/업데이트하는 로직 - useEffect(() => { - const map = mapInstanceRef.current; - if (!map || facilityInfoPopupData.length === 0) return; + // // 데이터가 변경되면 오버레이를 생성/업데이트하는 로직 + // useEffect(() => { + // const map = mapInstanceRef.current; + // if (!map || facilityInfoPopupData.length === 0) return; - // 기존 오버레이 정리 - facilityOverlaysRef.current.forEach(overlay => map.removeOverlay(overlay)); - facilityOverlaysRef.current = []; + // // 기존 오버레이 정리 + // facilityOverlaysRef.current.forEach(overlay => map.removeOverlay(overlay)); + // facilityOverlaysRef.current = []; - facilityInfoPopupData.forEach(data => { - const popupId = `${data.ftrIdn}_${data.ftrCde}`; + // facilityInfoPopupData.forEach(data => { + // const popupId = `${data.ftrIdn}_${data.ftrCde}`; - // 팝업을 담을 div 엘리먼트 생성 - const popupElement = document.createElement('div'); - popupElement.id = popupId; + // // 팝업을 담을 div 엘리먼트 생성 + // const popupElement = document.createElement('div'); + // popupElement.id = popupId; - // OpenLayers Overlay 생성 - const position = olProj.transform([Number(data.x), Number(data.y)], GisApp.FROM_PROJ, GisApp.TO_PROJ); - const overlay = new Overlay({ - element: popupElement, - position: position, - offset: [-75, -210], // 팝업 너비의 절반, 높이만큼 오프셋 조정 - positioning: 'bottom-center', - className: 'facility-popup-overlay' // 필요시 공통 클래스 추가 - }); + // // OpenLayers Overlay 생성 + // const position = olProj.transform([Number(data.x), Number(data.y)], GisApp.FROM_PROJ, GisApp.TO_PROJ); + // const overlay = new Overlay({ + // element: popupElement, + // position: position, + // offset: [-75, -210], // 팝업 너비의 절반, 높이만큼 오프셋 조정 + // positioning: 'bottom-center', + // className: 'facility-popup-overlay' // 필요시 공통 클래스 추가 + // }); - map.addOverlay(overlay); - facilityOverlaysRef.current.push(overlay); + // map.addOverlay(overlay); + // facilityOverlaysRef.current.push(overlay); - // React 컴포넌트를 popupElement에 렌더링 - const root = createRoot(popupElement); - root.render(); - }); + // // React 컴포넌트를 popupElement에 렌더링 + // const root = createRoot(popupElement); + // root.render(); + // }); - // 초기 가시성 업데이트 - updatePopupVisibility(); + // // 초기 가시성 업데이트 + // updatePopupVisibility(); - }, [facilityInfoPopupData]); // 팝업 데이터가 변경될 때마다 실행 + // }, [facilityInfoPopupData]); // 팝업 데이터가 변경될 때마다 실행 - // 레이어 가시성에 따라 팝업 가시성을 제어하는 함수 - const updatePopupVisibility = useCallback(() => { - const map = mapInstanceRef.current; - if (!map) return; + // // 레이어 가시성에 따라 팝업 가시성을 제어하는 함수 + // const updatePopupVisibility = useCallback(() => { + // const map = mapInstanceRef.current; + // if (!map) return; - const visibleLayers = new Set(); - map.getLayers().forEach(layer => { - if (layer.getVisible()) { - // feature.js의 로직처럼 typeName이나 ftrCde를 사용해 필터링 - const typeName = layer.get('typeName'); - if (typeName === 'VW_WTL_FCLTY_AS') { // 예시 레이어 이름 - visibleLayers.add(layer.get('ftrCde')); - } - } - }); + // const visibleLayers = new Set(); + // map.getLayers().forEach(layer => { + // if (layer.getVisible()) { + // // feature.js의 로직처럼 typeName이나 ftrCde를 사용해 필터링 + // const typeName = layer.get('typeName'); + // if (typeName === 'VW_WTL_FCLTY_AS') { // 예시 레이어 이름 + // visibleLayers.add(layer.get('ftrCde')); + // } + // } + // }); - facilityOverlaysRef.current.forEach(overlay => { - const element = overlay.getElement(); - const ftrCde = element.querySelector('table')?.classList[0]; // FacilityPopup의 클래스에서 ftrCde 가져오기 + // facilityOverlaysRef.current.forEach(overlay => { + // const element = overlay.getElement(); + // const ftrCde = element.querySelector('table')?.classList[0]; // FacilityPopup의 클래스에서 ftrCde 가져오기 - if (visibleLayers.has(ftrCde)) { - element.style.display = ''; - } else { - element.style.display = 'none'; - } - }); - }, []); + // if (visibleLayers.has(ftrCde)) { + // element.style.display = ''; + // } else { + // element.style.display = 'none'; + // } + // }); + // }, []); // GisTree에서 체크 상태가 변경될 때 이 함수를 호출하도록 연결해야 합니다. // 예시: GisTree 컴포넌트에 onCheck 콜백을 추가하고, 그 콜백에서 이 함수를 호출 - useEffect(() => { - // 레이어 가시성이 변경될 때마다 팝업 가시성 업데이트 - const map = mapInstanceRef.current; - if (!map) return; + // useEffect(() => { + // // 레이어 가시성이 변경될 때마다 팝업 가시성 업데이트 + // const map = mapInstanceRef.current; + // if (!map) return; - const handleLayerVisibilityChange = () => { - updatePopupVisibility(); - }; + // const handleLayerVisibilityChange = () => { + // updatePopupVisibility(); + // }; - map.getLayers().on('change:length', handleLayerVisibilityChange); - map.getLayers().forEach(layer => { - layer.on('change:visible', handleLayerVisibilityChange); - }); + // map.getLayers().on('change:length', handleLayerVisibilityChange); + // map.getLayers().forEach(layer => { + // layer.on('change:visible', handleLayerVisibilityChange); + // }); - return () => { - // 클린업 - map.getLayers().un('change:length', handleLayerVisibilityChange); - map.getLayers().forEach(layer => { - layer.un('change:visible', handleLayerVisibilityChange); - }); - }; - }, [updatePopupVisibility]); + // return () => { + // // 클린업 + // map.getLayers().un('change:length', handleLayerVisibilityChange); + // map.getLayers().forEach(layer => { + // layer.un('change:visible', handleLayerVisibilityChange); + // }); + // }; + // }, [updatePopupVisibility]); // 체크된 레이어 정보를 처리하는 함수 const handleCheckedLayersChange = useCallback((checkedIds, checkedNodesData) => { @@ -359,18 +360,21 @@ function Gis({ {/* */} - {/* isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} + {/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} {isOpen && featureData && !isSearchModalOpen && ( )} - + {/* SearchView가 존재할 때만 렌더링 */} + {SearchView && ( + + )} From ea20ceacb3de830ec0748ff008d9e65f443251d7 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 11:01:22 +0900 Subject: [PATCH 077/259] =?UTF-8?q?fix:=20mapSearchBar=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/store/map/index.tsx | 185 ++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 apps/wr/app/store/map/index.tsx diff --git a/apps/wr/app/store/map/index.tsx b/apps/wr/app/store/map/index.tsx new file mode 100644 index 000000000..6a1e76c9b --- /dev/null +++ b/apps/wr/app/store/map/index.tsx @@ -0,0 +1,185 @@ +import { getFetch } from "@/components/lib/api"; + +export type wrMapType = wrMapState & wrMapActions; + +export type wrMapState = { + wrMap: { + buildingSearchRes: any[] + } // 건물 검색 결과 데이터 +}; + +type wrMapActions = { + buildingNmSearch: ( + flg: string, + sigunCode: string, + searchNm: string | undefined + ) => void; + buildingNmSearchMultiple: ( + checkedLayers: string[], + sigunCode: string, + searchNm: string | undefined + ) => void; // 여러 레이어 동시 검색 함수 추가 +}; + +export const wrMapStateExport: wrMapState = { + wrMap: { + buildingSearchRes: [] + } +}; + +// 레이어 타입과 플래그 매핑 +const LAYER_FLAG_MAP: { [key: string]: string } = { + // '46': '???', // 하수처리시설 + // '47': '???', // 하수재이용시설 + '48': 'RNB', // 빗물이용시설 + '49': 'RST', // 중수도시설 + '50': 'HTB', // 온배수시설 +}; + +const findBdst = async (flg: string, sggCd: string, searchTxt: string | undefined) => { + return await getFetch('wr', `/reuseFc/building/${flg}/${sggCd}` + (searchTxt ? `/${searchTxt}` : '')) +} + +export const wrMapActionsExport: (set: any) => wrMapActions = ( + set: any +) => { + return { + buildingNmSearch: async ( + flg: string, + sigunCode: string, + searchNm: string | undefined + ) => { + try { + // if (!searchNm || searchNm.length < 2) { + // set((state: wrMapState) => ({ + // ...state, + // buildingSearchData: [] + // })); + // return; + // } + console.log("건축물 코드, 시군구 코드, 검색어: ", flg, sigunCode, searchNm); + + const response = await findBdst(flg, sigunCode, searchNm); + console.log("response: ", response); + + // API 응답을 SearchInputText 형식으로 변환 + const searchListFormatted = (response || []).map((building: any) => ({ + searchNm: building.bdstNm, + searchPk: String(building.bdstInfoPk), + dmdCoNm: building.bdstNm, + layerType: flg, + ...building + })); + + // findBdst와 유사한 API 호출 + // findBdst(flg, sigunCode || "", searchNm).then(() => { + // console.log("건물 검색 API 호출: ", sigunCode, searchNm, flg); + // // bdst.bdstBase를 SearchInputText 형식으로 변환 + // const searchListFormatted = (state.bdst.bdstBase || []).map((building: any) => ({ + // searchNm: building.bdstNm, + // searchPk: String(building.bdstInfoPk), + // dmdCoNm: building.bdstNm, + // layerType: flg, + // ...building + // })); + + // set((state: any) => ({ + // ...state, + // wrMap: { + // ...state.wrMap, + // buildingSearchData: searchListFormatted + // } + // })); + // }); + set((state: wrMapState) => ({ + ...state, + wrMap: { + ...state.wrMap, + buildingSearchRes: searchListFormatted + } + })); + } catch (error) { + console.error("건물 검색 중 오류:", error); + } + }, + + buildingNmSearchMultiple: async ( + checkedLayers: string[], + sigunCode: string, + searchNm: string | undefined + ) => { + try { + if (!searchNm || searchNm.length < 2) { + set((state: any) => ({ + ...state.wrMap, + buildingSearchData: [] + })); + return; + } + + // 체크된 레이어들에 대해 병렬로 API 호출 + const searchPromises = checkedLayers + .filter(layer => LAYER_FLAG_MAP[layer]) // 매핑된 레이어만 필터링 + .map(layer => { + const flg = LAYER_FLAG_MAP[layer]; + + return findBdst(flg, sigunCode, searchNm) + .then(response => { + console.log(`레이어 ${layer}(${flg}) API 응답:`, response); + + const searchListFormatted = (state.bdst.bdstBase || []).map((building: any) => ({ + searchNm: building.bdstNm, + searchPk: String(building.bdstInfoPk), + dmdCoNm: building.bdstNm, + layerType: flg, + ...building + })); + + return { + layerType: layer, + flg: flg, + data: bdstNames + }; + }) + .catch(error => { + console.error(`레이어 ${layer}(${flg}) 검색 중 오류:`, error); + return { layerType: layer, flg: flg, data: [] }; + }); + }); + + const results = await Promise.all(searchPromises); + console.log("다중 레이어 검색 결과:", results); + + // 모든 결과를 하나의 배열로 합치기 + const allSearchResults = results.reduce((acc, result) => { + const formatted = result.data.map((building: any) => ({ + searchNm: building.bdstNm, + searchPk: String(building.bdstInfoPk), + dmdCoNm: building.bdstNm, + layerType: result.layerType, + flg: result.flg, + ...building.originalData + })); + return [...acc, ...formatted]; + }, [] as any[]); + + console.log("최종 합쳐진 검색 결과:", { + totalCount: allSearchResults.length, + sampleData: allSearchResults.slice(0, 3) + }); + + set((state: any) => ({ + ...state.wrMap, + buildingSearchData: allSearchResults + })); + + } catch (error) { + console.error("다중 레이어 검색 중 오류:", error); + set((state: any) => ({ + ...state, + buildingSearchData: [] + })); + } + } + }; +}; \ No newline at end of file From 547244872d6320772dd8237e15ada51852cd5557 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 11:06:15 +0900 Subject: [PATCH 078/259] =?UTF-8?q?etc:=20=ED=95=98=EC=88=98=EC=9E=AC?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=EC=8B=9C=EC=84=A4=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A1=9C=20=ED=8C=9D=EC=97=85=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/newWindowPopup.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index dfbb1dc24..ebfcac1ca 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -186,11 +186,11 @@ const NewWindowPopup: React.FC = ({ // swcho : true, false 값 변경하여 시설 변경하여 테스트하였음 // 재이용시설 - const isPbnst = false; + const isPbnst = true; // 빗물이용시설 const isRain = false; // 중수도시설 - const isRswt = true; + const isRswt = false; // 온배수시설 const isHtdfl = false; From b0dfec9825022ffc2ab85ea10b8c1f75171d916e Mon Sep 17 00:00:00 2001 From: jyha00 Date: Tue, 1 Jul 2025 11:27:09 +0900 Subject: [PATCH 079/259] =?UTF-8?q?=EC=9A=B0=EB=A6=AC=EB=8F=99=EB=84=A4?= =?UTF-8?q?=EA=B0=80=EB=AD=84=20=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMng/drgtSttn/page.tsx | 84 ++++++---- apps/wr/app/store/matDmd/drgtSttn/index.tsx | 148 +++++++++++------- .../ui/modal/coMat/drgtDetailModal.tsx | 56 ++++--- 3 files changed, 183 insertions(+), 105 deletions(-) diff --git a/apps/wr/app/matMng/coMng/drgtSttn/page.tsx b/apps/wr/app/matMng/coMng/drgtSttn/page.tsx index d7c5170b2..2f07dd6de 100644 --- a/apps/wr/app/matMng/coMng/drgtSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/drgtSttn/page.tsx @@ -6,15 +6,15 @@ import { drgtHeadListExport } from "@/app/store/matDmd/drgtSttn/headList"; import { excelDownload, getCity } from "@/components/lib/func/commom"; import DrgtDetailModal from "@/components/ui/modal/coMat/drgtDetailModal"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; -import { ContentsDiv, DateMonthPicker, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, Title, UiModal, UiTable, type SelectDataType } from "@common/business_components/ui"; +import { ContentsDiv, DateMonthPicker, downloadExcel, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, Title, UiModal, UiTable, type SelectDataType } from "@common/business_components/ui"; import { MonthPicker } from "@common/business_components/ui/date_month_picker/mothPicker"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button, DatePicker, Label } from "@common/components/ui"; +import { Button, DatePicker, Label, ScrollArea } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; import { toast, Toaster } from "react-hot-toast"; export default function DrgtSttn() { - const { code, drgt, drgtSearch, drgtModalSearch } = useWrStore((state) => state); + const { code, drgt, drgtSearch, drgtModalSearch, drgtInit } = useWrStore((state) => state); const { drgtRes, drgtMoRes } = drgt; const [fromDate, setFromDate] = useState(); const [toDate, setToDate] = useState(); @@ -22,6 +22,8 @@ export default function DrgtSttn() { const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); const [tableData, setTableData] = useState(); const [selectedSgg, setSelectedSgg] = useState(''); + const [excelData, setExcelData] = useState(); + const [num, setNum] = useState(); const [drgtModal, setDrgtModal] = useState<{ isOpen: boolean; data: customDrgt | undefined; @@ -35,6 +37,39 @@ export default function DrgtSttn() { } } + const excelClick = () => { + downloadExcel({ + data: excelData ?? [], + fileName: "우리동네가뭄 현황", + sheetNameArray: ["Sheet1"], + headerRange: "A1:G1" + }) + } + + useEffect(() => { + if (!drgt.isInit) { + drgtInit(); + } + }, [drgt.isInit, drgtInit]); + + useEffect(() => { + const resData = Array.isArray(drgtRes) ? drgtRes : [drgtRes]; + const data = Array.isArray(resData) + ? resData.map((item: customDrgt) => { + return { + "시도": item.ctpvCd, + "시군구": item.sggNm, + "정상(횟수)": item.normal, + "관심(횟수)": item.attention, + "주의(횟수)": item.caution, + "관심+주의(횟수)": item.warning, + "가뭄순위": item.ranking, + } + }) : []; + setExcelData(data) + setTableData(drgtRes) + }, [drgtRes]) + useEffect(() => { if (drgtMoRes && drgtMoRes.length > 0) { setDrgtModal({ isOpen: true, data: drgtMoRes }); @@ -65,15 +100,6 @@ export default function DrgtSttn() { setObjSearch({ ...objSearch, sgg: String(val) }); }; - const excelClick = useCallback(() => { - excelDownload( - [[]], - "우리동네가뭄", - "sample_drgtSttn.xlsx", - "A1:H1" - ); - }, []); - useEffect(() => { if (fromDate === undefined && toDate === undefined) { const today = new Date(); @@ -101,7 +127,7 @@ export default function DrgtSttn() { onSelectValue={getSelCity} />
- +
- ~ + ~
@@ -148,7 +176,7 @@ export default function DrgtSttn() { -
+
- - + +
) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index c9106fb16..e80711f5c 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -126,7 +126,7 @@ export const getChartDataInftwtAnlsRslt = (arr: TInftwtAnlsRslt[]): { label: str })); return options; }; -export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 +export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string|undefined) => { // 침입수분석 결과 try { if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { console.warn("inftwtAnlsSn or pplMngNo is not provided"); @@ -148,7 +148,7 @@ export const getChartDataOilq = (arr: TOilqData[]): { label: string; val: number })); return options; }; -export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // 유량 +export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string|undefined) => { // 유량 try { if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { console.warn("inftwtAnlsSn or pplMngNo is not provided"); diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 7385d84cc..8f4d22bfa 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -12,9 +12,10 @@ type ModalOpenProp = { setIsModalOpen: (open: boolean) => void, closeModal: () => void, btnTxt?: string, + pplMngNo?: string, // 관로관리번호 } -const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { +const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 @@ -32,6 +33,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp { label: "5", val: 55 },], }); const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 + pplMngNo = "L13101003"; const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -103,25 +105,30 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp }, [inftwtAnlsSn]); const closePopup = () => { // 팝업 닫기 - selectInftwtAnlsRslt(inftwtAnlsSn, "L13101003").then((data) => {// 침입수분석 결과 조회 + + selectInftwtAnlsRslt(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수분석 결과 조회 const rsltData = getChartDataInftwtAnlsRslt(data ?? []); setChartData(prev => ({ ...prev, chartData1: rsltData // 침입수분석결과 })); }); - selectOilq(inftwtAnlsSn,"L13101003").then((data) => {// 유량 조회 + selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 const rsltData = getChartDataOilq(data ?? []); setChartData(prev => ({ ...prev, chartData2: rsltData // 유량 })); + }).catch((err) => { + console.error("selectOilq 에러:", err); + setChartData(prev => ({ + ...prev, + chartData2: [] // 유량 데이터 초기화 + })); }); setPopupOpen(false); }; - - const renderBody = () => ( <> {/* */} @@ -165,7 +172,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOp label='' selectArray={aplcnYms} value={aplcnYm} - onSelectValue={(val) => { + onSelectValue={(val) => {console.log("선택된 상수사용월:", val); setAplcnYm(String(val)); }} /> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 3b13a3df7..86be63ae4 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -12,9 +12,10 @@ type ModalOpenProp = { setIsModalOpen: (open: boolean) => void, closeModal: () => void, btnTxt?: string, + pplMngNo?: string, // 관로관리번호 } -const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { +const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 @@ -110,13 +111,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpe chartData1: rsltData // 강우유입수분석결과 })); }); - // selectOilq(rdiiAnlsSn,"L13101003").then((data) => {// 유량 조회 - // const rsltData = getChartDataOilq(data ?? []); - // setChartData(prev => ({ - // ...prev, - // chartData2: rsltData // 유량 - // })); - // }); + setPopupOpen(false); }; From 1978553a9d21ba2d57cd423ad6f28a74b75b2a88 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 11:46:03 +0900 Subject: [PATCH 081/259] =?UTF-8?q?feat:=20=EC=8B=9C=EC=84=A4=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=EC=A0=95=EB=B3=B4=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20API?= =?UTF-8?q?=20=ED=98=B8=EC=B6=9C=20=EB=B0=A9=EC=8B=9D=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EC=83=81=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=ED=91=9C=EC=B6=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/index.ts | 4 +- .../map/components/common/table.ts | 66 +++++++++---------- .../map/featureClickEventPopup.tsx | 5 +- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index feee420b3..44f070b36 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -19,9 +19,7 @@ type LayerContentMap = { // 레이어 이름과 컴포넌트를 매핑 // 레이어 선택시 변경되는 팝업 컨텐츠 동적으로 변경하도록 작업 const layerContentMap: LayerContentMap = { - // TODO: gis데이터 추가되면 추가 작업 필요 - //"하수처리시설": { component: SwtrmtFclt, }, - "하수처리시설": { component: MsSwagePpl, }, + "하수처리시설": { component: SwtrmtFclt, }, "하수처리구역": {}, "우수토실": { component: Ssc, }, "중점우수토실": { component: Ssc, }, // 중점우수토실 여부 설정 diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 54a75e27e..7b6c307cb 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,30 +1,30 @@ // 하수관로 export const MsSwagePplCol = [ - { id: 'avgGrdn', title: '평균구배' }, - { id: 'clarFvlc', title: '맑음유속' }, - { id: 'drtwMltvArea', title: '오수배수면적' }, - { id: 'exclnMltvArea', title: '우수배수면적' }, - { id: 'fcltMngNo', title: '시설관리번호' }, - // { id: 'fcltyShpCd', title: '시설물형태코드' }, + { id: 'avg_grdn', title: '평균구배' }, + { id: 'clar_fvlc', title: '맑음유속' }, + { id: 'drtw_mltv_area', title: '오수배수면적' }, + { id: 'excln_mltv_area', title: '우수배수면적' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, + // { id: 'fclty_shp_cd', title: '시설물형태코드' }, // { id: 'fid', title: 'FID' }, - // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, - { id: 'instMngNo', title: '기관관리번호' }, - { id: 'instlYmd', title: '설치일자' }, - { id: 'mapshtNo', title: '도엽번호' }, - // { id: 'mngInstCd', title: '관리기관코드' }, - // { id: 'mqltCd', title: '재질코드' }, - // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'inst_mng_no', title: '기관관리번호' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'mapsht_no', title: '도엽번호' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + // { id: 'mqlt_cd', title: '재질코드' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, { id: 'pdmt', title: '관경' }, { id: 'prlg', title: '연장' }, - { id: 'rnyssnFvlc', title: '우기유속' }, - { id: 'scendDpth', title: '종점깊이' }, - { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, - { id: 'tmptDpth', title: '시점깊이' }, - { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, - { id: 'trflnCnt', title: '차선수' }, - // { id: 'usgCd', title: '용도코드' }, - { id: 'vrtcLen', title: '세로길이' }, - { id: 'wdthLen', title: '가로길이' }, + { id: 'rnyssn_fvlc', title: '우기유속' }, + { id: 'scend_dpth', title: '종점깊이' }, + { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, + { id: 'tmpt_dpth', title: '시점깊이' }, + { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, + { id: 'trfln_cnt', title: '차선수' }, + // { id: 'usg_cd', title: '용도코드' }, + { id: 'vrtc_len', title: '세로길이' }, + { id: 'wdth_len', title: '가로길이' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] @@ -108,21 +108,21 @@ export const SewagePump = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, - { id: 'fcltMngNo', title: '시설관리번호' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'mapshtNo', title: '도엽번호' }, + { id: 'mapsht_no', title: '도엽번호' }, // { id: 'mngInstCd', title: '관리기관코드' }, - { id: 'instlYmd', title: '설치일자' }, - { id: 'swagePmstnNm', title: '하수펌프장명' }, - { id: 'pllnArea', title: '부지면적' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'swage_pmstn_nm', title: '하수펌프장명' }, + { id: 'plln_area', title: '부지면적' }, // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'dailyPrcsCpct', title: '일일처리용량' }, - { id: 'maxImpndCpct', title: '최대저수용량' }, - { id: 'altdVl', title: '표고' }, - { id: 'wtlvVl', title: '수위' }, - { id: 'exclnWpmpAblt', title: '우수양수능력' }, - { id: 'instMngNo', title: '기관관리번호' }, + { id: 'daily_prcs_cpct', title: '일일처리용량' }, + { id: 'max_impnd_cpct', title: '최대저수용량' }, + { id: 'altd_vl', title: '표고' }, + { id: 'wtlv_vl', title: '수위' }, + { id: 'excln_wpmp_ablt', title: '우수양수능력' }, + // { id: 'instMngNo', title: '기관관리번호' }, ] // 중점우수토실 측정지점 diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 68a23de87..99c16f063 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -68,7 +68,10 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const selectedLayerName = getSelectedLayers(); // 레이어 이름 가져오기 setLayerNm(selectedLayerName); // 상태 업데이트 const layerId = featureId.split('.')[0] - let data = await getData(`v1/fclts/${featureId}?lyrTypeNm=${layerId}`); + console.log('gis data', featureData.values_); + // let data = await getData(`v1/fclts/${featureId}?lyrTypeNm=${layerId}`); + let data = featureData.values_; + console.log('api data', data) setfetchData(data) switch (selectedLayerName) { case '하수처리시설': From d16645d0aa7b56319ab25832d52377f40bfede92 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Tue, 1 Jul 2025 16:34:43 +0900 Subject: [PATCH 082/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=EC=8B=A4=EC=A0=81=20=EB=93=B1=EB=A1=9D=20=ED=8C=9D?= =?UTF-8?q?=EC=97=85=20=ED=99=94=EB=A9=B4=20=EC=88=98=EC=A0=95,=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95,?= =?UTF-8?q?=20=ED=85=8C=EC=9D=B4=EB=B8=94=20merge=20=EC=B6=94=EA=B0=80,=20?= =?UTF-8?q?=EC=86=8C=EA=B3=84=20=EB=B0=8F=20=EC=B4=9D=ED=95=A9=EA=B3=84=20?= =?UTF-8?q?=EB=B0=B0=EA=B2=BD=EC=83=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncReg/pbnstPrfmncReg/page.tsx | 38 +++-- .../prfmncReg/pbnstPrfmncReg/headList.tsx | 27 ++-- apps/wr/components/lib/func/TableData.tsx | 151 ++++++++++++------ .../pbnPrfExcelModal/pbnPrfExcelModal.tsx | 123 +++++++------- apps/wr/public/sample_pbnstPrfmncReg.xlsx | Bin 13777 -> 13806 bytes 5 files changed, 208 insertions(+), 131 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index 6be50a8c5..10dd7ccb6 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -25,7 +25,7 @@ import { } from "@common/components/ui"; import { useState, useEffect, useCallback } from "react"; import { set } from "react-hook-form"; -import { Toaster } from "react-hot-toast"; +import toast, { Toaster } from "react-hot-toast"; import { headMakeprfmnc } from "../chkgdnReg/TableHead"; import { InputTableBody } from "@/components/lib/func/TableData"; import { @@ -51,8 +51,8 @@ export default function prfmncPrfmncReg() { }>({ isModal: false, data: {} as FcPrfType }); const [inputData, setInputData] = useState(); const [pbnstRuseFcltPk, setPbnstRuseFcltPk] = useState(); - const [pageNation , setPageNation] = useState(1); - + const [pageNation, setPageNation] = useState(1); + const [cellNum, setCellNum] = useState(); const [searchYear, setSearchYear] = useState( String(new Date().getFullYear()) ); @@ -76,7 +76,7 @@ export default function prfmncPrfmncReg() { ); prfmncHasuInit(String(pageNation), "41"); } - }, [inputData, searchYear, pbnstRuseFcltPk,prfmncHasuInit,pageNation]); + }, [inputData, searchYear, pbnstRuseFcltPk, prfmncHasuInit, pageNation]); @@ -88,10 +88,16 @@ export default function prfmncPrfmncReg() { isModal: false, data: prfmncRes[index] || ({} as FcPrfType), }); - const inUsageData = structuredClone(initValInUsage); - const outUsageData = structuredClone(initValOutUsage); - const inSubtotal = structuredClone(subTotalObj); - const outSubtotal = structuredClone(subTotalObj); + const inUsageData = structuredClone(initValInUsage).map(row => ({ + ...row, + 구분: "장내용수", + })); + const outUsageData = structuredClone(initValOutUsage).map(row => ({ + ...row, + 구분: "장외용수", + })); + const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" }; + const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" }; if (prfmncRes[index]?.prfList) { prfmncRes[index].prfList?.forEach((prfItem) => { const month = Number(prfItem?.ym?.slice(4)); // "MM" @@ -127,7 +133,7 @@ export default function prfmncPrfmncReg() { }); inUsageData.push(inSubtotal); outUsageData.push(outSubtotal); - const usageTotalObj: { [key: string]: any } = structuredClone(totalObj); + const usageTotalObj: { [key: string]: any } = { ...structuredClone(totalObj), 구분: "총합계", 용수명: "" }; for (const key in usageTotalObj) { if (["usage", "gubun", "edit"].includes(key)) continue; const val = @@ -162,7 +168,7 @@ export default function prfmncPrfmncReg() {
- + <Title title={"하수재이용 실적 등록"} /> <SearchDiv> <SearchFormLeft> <div className="col-span-2 flex flex-row space-x-2"> @@ -197,7 +203,7 @@ export default function prfmncPrfmncReg() { <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> <div className="space-y"> <div className="flex flex-row space-x-2"> - <Button size={"sm"} onClick={(e) => {}}> + <Button size={"sm"} onClick={(e) => { }}> 조회 </Button> <Button @@ -211,7 +217,12 @@ export default function prfmncPrfmncReg() { <Button size={"sm"} onClick={() => { - setIsExcelOPen({ ...isExcelOpen, isModal: true }); + if (cellNum === undefined) { + toast.error("하수처리재이용시설을 선택해주세요.") + return; + } else { + setIsExcelOPen({ ...isExcelOpen, isModal: true }); + } }} > 파일등록 @@ -238,6 +249,7 @@ export default function prfmncPrfmncReg() { headName={"하수재이용시설 목록"} cellClick={(index: number | undefined, headId: string) => { cellClick(index, headId); + setCellNum(index ?? 0); }} onPageChange={setPageNation} children={undefined} @@ -266,7 +278,7 @@ export default function prfmncPrfmncReg() { </div> </ContentsDiv> <UiModal - bodyClass={""} + bodyClass={"w-[30vw] max-w-none"} body={<PbnPrfExcelModal data={isExcelOpen.data}></PbnPrfExcelModal>} open={isExcelOpen.isModal} onOpenChange={() => { diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx index 544f07516..abde1778f 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/headList.tsx @@ -4,7 +4,7 @@ import type { TableUpperProps } from "../../common/type/header"; export const pbnPrfRegExcelZod = z.object({ ym: z.string().default(""), bscFctNm: z.string().default(""), - pbnstRuseFcltFk:z.string(), + pbnstRuseFcltFk: z.string(), pbnstRuseFcltNm: z.string().default(""), file: z.instanceof(File).optional(), }); @@ -18,20 +18,21 @@ export const pbnstPrfmncHeadListExport: TableUpperProps[] = [ ]; export const monthHeadListExport: TableUpperProps[] = [ + { id: "구분", title: "구분", mergeCell: true }, { id: "용수명", title: "용수명" }, { id: "total", title: "계" }, - { id: "1월", title: "1월" ,edit: true }, - { id: "2월", title: "2월" ,edit: true }, - { id: "3월", title: "3월" ,edit: true }, - { id: "4월", title: "4월" ,edit: true }, - { id: "5월", title: "5월" ,edit: true }, - { id: "6월", title: "6월" ,edit: true }, - { id: "7월", title: "7월" ,edit: true }, - { id: "8월", title: "8월" ,edit: true }, - { id: "9월", title: "9월" ,edit: true }, - { id: "10월", title: "10월" ,edit: true }, - { id: "11월", title: "11월" ,edit: true }, - { id: "12월", title: "12월" ,edit: true }, + { id: "1월", title: "1월", edit: true }, + { id: "2월", title: "2월", edit: true }, + { id: "3월", title: "3월", edit: true }, + { id: "4월", title: "4월", edit: true }, + { id: "5월", title: "5월", edit: true }, + { id: "6월", title: "6월", edit: true }, + { id: "7월", title: "7월", edit: true }, + { id: "8월", title: "8월", edit: true }, + { id: "9월", title: "9월", edit: true }, + { id: "10월", title: "10월", edit: true }, + { id: "11월", title: "11월", edit: true }, + { id: "12월", title: "12월", edit: true }, ]; diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index dbb3aa7a6..39c8b7739 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -174,8 +174,6 @@ export const chRowspanTable = ( ); }; - - export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean) => { return headList.forEach((head) => { if (head.edit !== undefined) @@ -187,63 +185,124 @@ export const headVisibleChange = (headList: TableUpperProps[], isEdit: boolean) }); } - const handleChange = ( rowIndex: number, field: any, value: string | number, - setInputData: (data:any) => void + setInputData: (data: any) => void ) => { - if(Number(value) < 0 ||! Number(value)){ - value = 0; - }else{ + if (Number(value) < 0 || !Number(value)) { + value = 0; + } else { value = Number(value); } - setInputData((prevData:any) => - prevData?.map((row:any, index: number) => { - if (index === rowIndex) { - return { - ...row, - [field ]: value, - }; - } - return row; - }) - ); + setInputData((prevData: any) => + prevData?.map((row: any, index: number) => { + if (index === rowIndex) { + return { + ...row, + [field]: value, + }; + } + return row; + }) + ); }; ; +export const InputTableBody = ( + chgRes: any[] | [], + headList: TableUpperProps[], + setInputData: (data: any[]) => void +) => { + // mergeCell 처리용 + const getRowSpan = (data: any[], key: string, rowIndex: number) => { + if (rowIndex > 0 && data[rowIndex][key] === data[rowIndex - 1][key]) { + return 0; // 이전과 같으면 셀을 그리지 않음 + } + let span = 1; + for (let i = rowIndex + 1; i < data.length; i++) { + if (data[i][key] === data[rowIndex][key]) span++; + else break; + } + return span; + }; - -export const InputTableBody = (chgRes: any[] | [] ,headList:TableUpperProps[], setInputData: (data: any[]) => void) => { - return ( + return ( <> - {chgRes.map((data, dataIndex) => ( - <TableRow key={dataIndex + "row"}> - {headList.map((head, headIndex) => ( - <TableCell key={head.id + headIndex} className="w-36" > - {head.edit ===true && data.edit !==false? - <Input - className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`} - onChange={(e) => - handleChange(dataIndex, head.id, e.target.value,setInputData) - } - value={data[head.id as keyof any] ?? ""} - /> : ( - <div - className={` - ${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} - !text-xl w-full h-10 - `} + {chgRes.map((data, dataIndex) => { + // 소계/총합계 행 판별 + const isSubTotal = data["용수명"] === "소계"; + const isTotal = data["구분"] === 0; + + const bgClass = isTotal + ? "bg-[#d5e1eb] font-bold" + : isSubTotal + ? "bg-[#e6eef5] font-semibold" + : ""; + + return ( + <TableRow key={dataIndex + "row"}> + {headList.map((head, headIndex) => { + // 총합계 행이면 "구분"에서 colSpan=2로 병합 + if ( + data["구분"] === 0 && + head.id === "구분" + ) { + return ( + <TableCell + key={head.id + headIndex} + colSpan={2} + className="font-bold text-center bg-[#d5e1eb]" > - {data[head.id as keyof any] ?? ""} - </div> - ) + 총합계 + </TableCell> + ); + } + // 총합계(합계) 행이면 "용수명" 컬럼은 렌더링하지 않음 + if ( + data["구분"] === 0 && + head.id === "용수명" + ) { + return null; + } + // mergeCell 처리 + if (head.mergeCell) { + const rowSpan = getRowSpan(chgRes, head.id, dataIndex); + if (rowSpan === 0) return null; + return ( + <TableCell key={head.id + headIndex} rowSpan={rowSpan} className={`w-36 align-middle text-center whitespace-nowrap ${bgClass}`}> + {data[head.id as keyof any] ?? ""} + </TableCell> + ); } - </TableCell> - ))} - </TableRow> - ))} + // 기본 셀 + return head.edit === true && data.edit !== false ? ( + <TableCell key={head.id + headIndex} className={`w-36 ${bgClass}`}> + <Input + className={`${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} !text-xl h-10 w-full`} + onChange={(e) => + handleChange(dataIndex, head.id, e.target.value, setInputData) + } + value={data[head.id as keyof any] ?? ""} + /> + </TableCell> + ) : ( + <TableCell key={head.id + headIndex} className={`w-36 ${bgClass}`}> + <div + className={` + ${head.id !== "utztnUsgCd" ? "text-right" : "text-center"} + !text-xl w-full h-10 + `} + > + {data[head.id as keyof any] ?? ""} + </div> + </TableCell> + ); + })} + </TableRow> + ); + })} </> ); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx index 28dc882c3..fb6ba9b22 100644 --- a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx @@ -52,6 +52,7 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { useEffect(() => { if (files) { + console.log("이런") const file = files[0]; if (form.getValues("ym").length < 1) { ToastFormUi({ @@ -62,11 +63,12 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { return; } - if (file) + if (file) { filePicked(file, 0).then((res) => { if (res !== undefined) - setExcelData(excelToPbnPrfData(res as unknown as JSON[], form.getValues("ym"),form.getValues('pbnstRuseFcltFk') ) as PrfType[]) + setExcelData(excelToPbnPrfData(res as unknown as JSON[], form.getValues("ym"), form.getValues('pbnstRuseFcltFk')) as PrfType[]) }); + } } }, [files]); @@ -75,82 +77,85 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { <div> <Form {...form}> <form onSubmit={form.handleSubmit(onSubmit)}> - <div> + <div className="flex justify-between items-center"> <Title title={"하수재이용 실적등록"}> -
-
-

- {"점검정보 입력"} -

- -
+

+ {"점검정보 입력"} +

-
+
( field.onChange(val)} /> )} /> - - ( - - - - )} - /> - ( - - - - )} - /> - - ( - - { - if (files) setFiles(files); - }} - fileTypes="xlsx" - maxFiles={1} - > - - )} - /> +
+
+ ( + + + + )} + /> +
+
+ ( + + + + )} + /> +
+
+
+ ( + + { + if (files) setFiles(files); + }} + fileTypes="xlsx" + maxFiles={1} + > + + )} + /> +
diff --git a/apps/wr/public/sample_pbnstPrfmncReg.xlsx b/apps/wr/public/sample_pbnstPrfmncReg.xlsx index 67f0d559e096443366eeff0f951b5648e422a972..1f2ff81aa24e1dce6ca8e8bce7fd7d9f54ed91ad 100644 GIT binary patch delta 5703 zcmZ8lWmFVUw;ejAyBRR0lvY|mTDofhhZboVQW~T|QbKa*l#Y?^4oT_f_ug7> z`QH6??^^qub$*<4?%sRS;l!av7z>L6jPM9T1_0JzQdm?_5~WD>eQTvfm64f=i$QTS#AMS_lT|vu?>V+=u_$x9fsEmQ}y= zw(*M&N=I&w6Nv&<0d|Wm7vI7BkioFehB0w?rwx$7N%Uw`5B3i+8fA*cJ&R4~IAuF; z*mv;&n6!n^(R84@i8}um%XUT_j`yr790TaZ_B#i%+F5%sIxr8Bv$nWQ%a>ZA1Z7h2 z1iN9(<&>|ZWuO<41vJ!o)dG5Zq(&M~s5}Gqrexf}3uK1k7y%D^nM4@ugUidW-EZ*B zc^|K_DI-MkJQR~>_=Tte+rrE)y@&qaPDL2;G1xbum(7XGa0NH|-78KSF&YN}jr4q# z7;#Vv&fQ1|M|5_Q+rm{3=qv&JVBXi^PV{9XDN_z)j)so`&fmSiQo*#(q%KDl_GAu6 zdeK?&Tn#Zi(tZi2-3@xhl~IsD^4+lqsUcn7xBRAdC`;!zMQp)PV#JvfSS4jUNlh9{ z(y$b&qOBpu1QQzituFN}>#26IXM)+8zYqgWvk)yMzDu7Be`2?n^h#w_V|FKGVvC>t z{=1tex2D&M4;!+~b0p&6!=7o4-f(m0GLc;X&OHD-WjQ3i@dzUPjBz^QT>0#muSuQ|gSQJ*2a>fFC|B=3zbEaoLrqjF@ zf?nTfC`^~)Qsp6kCGI1kD!SdB^d9QOaJUHS(TW?38j)Htd4!lhUhTT1Nj-g~vu0!U zbfQDI2O2VHhg`&Tz0cceIOM<*Ly{|3(U)oaocG*(@IZYRhbnWaXEZ^QlIBt)w9&kEGEV+l27 z#W|#0oN*^cVh#&2f_fL0Opp^crB1hB8iPcWZQ!K*dZUd>_X(%Pp}xv;1eO zWP(d^KU0(dmJV75?~Lxb>^^i&M^=_TUMFNHi?O`Uu)VOIc*XUMKiaV+C`~)tph5sd zTiV%QocvbYdny0-2T`yyU`^51@+i(Fz-;` zK+3x>GAqkq49fZ$eW`v~BWVc|dG@-xs)0C$g+GL}ozXW53#@*+kLE!S;Ic{bvpQI~ zwd|gHlv|$~Ulq1jHMgeOIHWA2bU$V|Z5fxc?cJ3Y+u099T!rAAlO4@$v@a7azW3~! zO9{^Z=8RiuKOa>boIk7|o<{}Gu@RgsYomnHSRKYn_feWsdL2-syfW)}%Ntz|@=kGR zB0P8{BD?Ovgt}Y#%AEkZ52kOykgzIGYCcrE%E`oe8__OVbpi``%VNDMbtTQa@i{vb z4wGx+Zm*ylhN+!?GL|Krdb$9j+CAG5h2Y;TzQz`f&J|`d;g$_t;CNF_T9#=srBl^1 z_;kO_tKVtXU@(>%rrNFMRcgwSNy{K$BE(Ydtf4%+Fw=LYh?5TG>7z8#@oV&>K#V<- zi?WQ+gftmlk&5l=L`NR&Jf++@Uwb`cl$YwW1nhLr8etP5R&&(wFs5Omu6HY6Pd&k+ zp6KgV2Vu*bL!MOlZC&7}Z?oo)kx%6(=yF9nKA%{^c`8c>_0}{qTLzt9;08R#;?*oJ zV91Pvu>;3HgLA;Ap8ln$m;TukpXH>|uYbT`AUxxR9!cSQUY~ z{-u&Q8X@bn%uBzBou}>TpHb=!3F2|EP=eO=^)LVcG1zbF*U%B*QO654KO_s~8trOF8^l?VrEp&b0*+ZspX)n5H(%03 zs{SR+6}4`*FUa*)L9B%lc~JgyJ*;DmYzfJv7b*^QVNg-Z>|BLJsp6rCQT86{E(igb zDy5|0kH(ms){%^ouB9SabxPcyg$EJz!!{UlWi~D1BsZ|rVOu-4+U)?mwM7^v>7Lh> zJ#(xeCrMU2?EP4ML|xK~iWs@^*C`^P-fKJ5YOWpDYB7`D`W4Kt>Y8U;iXzJb!jE(4IT)FX0*blDOup_+ zAM7JgVC8-SzK!VKr(77JbC@}8X&>jsLtY>4P916KXfV#)lg75~%UjZ?Vmp@(zLDPOL*cP1~TqAJnZ(FDPgG)VbEiOEZ zV@EDBBEG28G8P`6AXa=e7G-r7Z3PB)4ArUiV`6t31C^aCe4beRyccE3q`3rPgX`uc zvC-3G>n-Zk7@Ut`uD+0o{%zv!^?ey?jCv1`x&K_!@M8u>2sgZ*P}W^H>@1(-?&6_* ztWS!-C${jH_je+kBY`@sFm1y&ulHpb*A*tRB6xEX;@=@%buwP3rTixAF?a#E90t>- ztk;79;no~Zx*d%i(wC-vEs0+5icuIPN(ZTK)Z{!v0whYQa;@ld$|uu=0(3X)D+x=f z8d)mBl-?4sP7;zTT@%r3%P{58Y0E(6a%i<>EOY+8LrrP4Tb4V&Vfoc-(qXP|56PwM zzm!wUK^mqjMwxcXrTmnWN#dE&&%L!`fBwhmda+&d-9l&lD5-k?NBnKVX*$7-s6oiY zphWEG{2+2H*UTU=mTPXXmCJG;V zF-5xh`?%n6fbwO}Lvz;0a<1udg2azFi97tH;n04u8KP?9k$!mrYT@~s9*pdXX{^9( z&;*uTHfRdVGTXJB_@`%g3sj?7lrb3@|FE9K*XR;!%uNN4wT`~>3Q1|^a+U`1qodiSDqpgP1*uS@rJRnG<%dxj=6Dy>XbjlVZnk7+4$c& zYXQoRaOW#IM{RHhcZBq-Q>jz3Unk9K+f0gU`W)CoRv1X!P1jJ%q$}= z*|GH3d#dg@H_$s=jbpO(x-Odkm)c`&eNE}Sk}sLKDxA4Ic{qknF)kKLOwC&%;<@hF zfPfgHFMdR6tbvs5Io^}}c}w685EsT1?Db;I(W3bpTv^Po|wl%$p+0}F=d11uu8<&)mXC*!=j00#jf>9 zt1dA~18a=?A60$6=Yy1jFiyoa>{*k!QyNgqT{`-Zl|$t1tw+q z#;l*DeX%z>Z#y z^<^LWLBHa1ZcjerTMERetU3kV$gVU+(a5ecMdSNahMxGmDtXCQcVIvRrqi|I2b2L- z5kA&4M%=|5T13|*EYo{BpG!iO@z-_WLZaV41xI6A#+g9tUq@vnkB=$%&8kF`Lo%Ft z3{U8ss*jG>m${d<%mYAemio}!9r(CagK-Zp+W}WN=cR6K)&7-)B<$lVd>p4S+}Lq3 z*IX;Ubt_{u>0E44FZ+d|P};s0QR-0#t+NumW?_=k8`66BcE;81=d*E7JQrpFV($uk z`F7?ZckYy_%*;F6q>gFZ@|sxu6EKfWpt;WFqXM6>@R>(E2b!3t=qPASXv7uKJF)b< zXL&C5mwx}{?>ShB3b2+ zo&G;hnZ<6hh!K7;;mKfUaD)O0jS-A*N@X;Pnz?LEpSLi+iO;=MapQ{}p$S}U84f<^ zfnpF2eYc5dCXPDXauPkcpDX-ePCr_wLCOhQrQ<*&(twU6)9@4 zA&9ZiOVvWFc6p!7(tlXl0mhh#v@9ho*HApUWTQ_krAm~ria3Y+n3ii$3$2`-53@*} zUYsKy6=0d1-o|J7J^l&DLt!=}Yb)Rz=vp0b@Pe^tUIz9`_ZdOG+K8gJyBU14lnW2P zv5+jk-g?|gPC$|?zvzX42ucqf16JDGZ8Lk1{M*AwK(`D=4V@=I6B!rqq-NfW5zAuO z8yClVvQA`?8afiGile1>WqsV>)rV8HJv7WK<)=s=a0?+{Xm!ZbPd9Cb!K+E3OU*66 zzNO{n$w#vW)pWvCaDWu( zKmo0*D(TrK6kRA)DMT4h?-fa9fGC?^Y0WWDD93e)uB{H}jTTd*Z6WIA1i4$fG^n5j z7niE{*Z0BY_du#W+0##{s}zs6C{o;nqki;JJk(?h3dC+mwbcWzp}wu7EAs@HaAecx zL5Oaz#=E>?H1Y-Dp=Y4S(CA<7nk~0pXu45_Otg&%46|B!VE0U=($uUrv_2A$b9}e6 znW(86pnP4$7TNifN~Gp`-~y;WWT8Mo3j$8hNx?AL1)<}b#4;pLs*{*cF|6^u#A&i4 zns&{}WTQ!qt=>56Yw)7%?g(q2`quAgmfgXvpOv1`@#!R7FHWHEyUjKfIy0QZ$qEWs z>|KQgE_RL=MONDaPY;DL=#lAUDQHmSmCb1_2Q8!KC2ZLB*<;OVyha(L(Pl)Q&)E?~ zJwt~BzED@zTO>I-3V3FwfXIRJ8joApBC*7L%Q|nzc&^7TUK-#kYtx3w+DO|Iyi>QL7 z2Rmc4xjR6!tdh4TN#~tO8l2YkwTWmz9>`n zj5{Ni&Y0mkLpHM7onOJ2MOFqKm}>rJ3?iXPrHguAnK<>=x*5P6lg}bzc&ubS5X; z#`-BN6uhB=|H4Sa^;lc#Gudg&mSVilAoPl)-S#X}=gVne(km2e!ZNoCB@ak0?Mago zeNy=0Fs$D;FeG67I{eVnXch~EM3fy{uB#ZS;l zXQ*L80Qo?RM~LYH^wrPD+sPr@405nUU@`A-8sVlOVt@YP_Esdh4zIQOzJ7Cj7pe%& zVmZMZcG_?jn9io3Gmrj00aR)*&?GJ|uwHh_3o96&MdNR;|)(@_g;1Q*x+PK zmaHOX=B41P-9i=o*TeH-4Aqh4)RJjgQ4tuh+x41xip+{7vfD}C&iieb&ScGI<`Hb- zO6p96t^3k$`Cw&TDeSId_Q!1@AK6{dbLitp;sbWQ3zsi4nw-9xykY$jk026KBa9J5 z0#$C^#LNm};Y`iK7Dd&Vig?Sw=(p)NzS>49Mp><}E*T>1$Nq){9o3J)aLA)YZ8AXk zw`PJZS4tLHQ5cC+SDu@%O|2SR@V#SRk=WXN9x3E-k(Cd{pYFn`C-hmh@z zW5iB*L@hZdXWCIWjqg;Ff^U9pW!ILM=TQmry?Y{9)!?np)P8(7*J=?|7gnEcm)AIh z7`UI_JzSh0@d)vsg@mFBc^{;<4+iHt)wLjHudRAvIMg-CujRZZZbJABkF7me2=mGq z$`>SRMtme08)Wmgb%p3RE&H35IN(?;KA3IPYIc7S^^~7tIsq8M{GXMqR$*3rh=1Hu zMSj7T|7%x~0|0*wt$)re4glcm$m`+h=V%Sn79@pz=chulhfVNnAvwVq1+|U+}=} Zg@FIlFR(-*Qlvky5+P>vNWTBX{udqJuh;+p delta 5698 zcmY*dbx<5m(p?;~c#uVcy9IX*5PWfhh2V=U9$Yp^U?KRTf#B|o6Es+mV8J~=a0~8m zxvQ`4eqaAFHT9;atEXzF-}F0joN%lW#=+57!$tK$1ps~`WN;{9Q?j5A;A4cv(PDt$ z9jUO%!ZIn4q40b|Cw|_#mconwIfUhir!RCzZv2yZE;bo~*)tlw`!^a-p)SPvMX1j6xkSAY*C~on`ied3h;=C)^x@J)g}EVJ+0oD zz|t*U_HArH7``jaQhm!L1^@YH;&yrg4s+HN4ra_E2iskBZQ|W99fbRE!(nVPF^g-= zukuCn0a07}7sI@orMyD$yi5@GJ65hqJY&igOde*3EJ&qR5rwQe1;kcA*fJ^n@km`+ zv54C425@?YjTn035j&tS%!YP>rfB6GxR9rE+Z-%BW2>X4RrX_iG!o*i|y8s(kZS02|F z0f~#+-kx=NCqI$wS!=Qoop4HlJLRmG-W;oK+Qtqu3uw6w@V&Tz9>%tMeXk6&L&e4+ zpw}F#LOpH{gw#pOrEUca>l2V60omeN?aK{!X2V&~MiaB@<3_)gqD4wyEAO92;C{rH z%gHAb(s=fuGh~uBi$Xe@Vz*d;(w*Q6J!M$|@wX74Z<8zz>$r!zEmR zdSqvwqj*M)jCqZ#_5p3Ikyp(}bxyLjQ|i-~4yR;dB#HK@t97-Ty$luXrmrN)F-nsh zqy|)|;jbmvA(NlwMqrF;`*s0;{8H&xjAg>@TjB-=Ya5p-ig}`q?YF?h7=8#7hx^uk zil>fD9qv}~F{4wl4I^%usfBWChL3GW0|oN|o}1p4#a@=<6iO z@y=u$-W~1Ix}n|8PM!iocSJLi>d}fFp-P3dwcK8G-|mmC^1vPy+cR@B#~XY>JJUcW zRo5&c5bji_*IQ?@-;X4C*zPrv3wx@Zx*c z<6G8K^N{2B%8(3s=Z1$+zTJlmmW8pSRG9~#i_7&QrK>ui!WgVUqb2{Ph+JW6MoyU* ze4f!?by}K}-WbCo@mR6%-9bi51|{5tZ1xpGLc}b&$*x zMbPQT-@JOu{4xoK&%<0Wcf!VOH%gJm(K*Grz`6D#c!Rli6E!wMd|E%g80}(qE-6v< zdn~6Q4Ibn>2B59KedC$@DZMDA#N&3CW78w8`Xi2L5Y5`3+?|SUk`U={Nm*ro?s*(J z$gzLw+ahgfwok>F2uiH=mbF%2&6GH6BxQW_31dsIqZTNE$=Ad)X-{jQ%0pG-^f7O8 zE640yIFDA;>KcYFKh((7#RLFJG2YTn3u*|>)|k19F$`^wL&_cbOs zu!M#4GiEpk8)=9Gy5r{wh2m4&d$;(?H>ji#ADgMtGFoZ24uc3q{j#q^4U5>G*_63| zN{K=O4P3@jUrIFjMeT1K_KW(i4QJPqXsE{^*{|~T@>F7qgPG#xs>{mThoA{d zAroQ_9D%-Eab00fS=+A;9A?Yh@nw@Gj%zVw%ERoV%6$Qn3tWW=RFw@mFo4o^QjR_~uy}-Mg}>#Ijp7R67tfK)$K)wuOe7 z_;)+`t!}^&gruZ(K7{^29AridOcx6PkV4#3slf&@cd^lbV|+R`wGP}K_=%LfJ!M>d zZ>C~o)8_>>T+W)HU#vH@UED^V9J(CGndIwE4|=6Tqqr%kjtlrZ)Po*u&JB`Q%Z2DY zu_U48NMzOi^0;96dyUhAJu-<}jKMOtvx4x>%{rq))kLmz?GC;}vuc+ul}4fF2n*lH zIGAO_kdFJif|p|RGfOHe!YX)I?<(uwPWuf{sx57*+&tJ^DH;Eka6L(Ks=fUpCM51F zj+@=2m@esLz9dtT!Q>QJClhrisWzO)VcyF*U=@ybubQ?x-XWJ)LcgzHL*|VV^-pU{pEy=f6Q!yh zcbZo*-bEwUP9L)L*cC9p9*Ivm8AH3U?!8WN`F~(qB4`h8Q@Hnq(oB{+@bG`8mce*V zVN^AIo3BM;h)hiwi}wR&sDhI&&}V0Miv0VFR_D4d%su@3cRZ~ALfD@_uXQC^dSlM^ zcO8A%G#>|jYd9=iZ5Snl$f?#;*=?8?v5tlutiK+&i#ezhv1`aJjFE?q#Y4oLAl+Sl zTwu+Dvi4|}v=oij7x~=FJo#HXF!H+!66a;<3=1#+<9au`J=2akC-KSt%^P+3k>c3+ z39l=tixYV9mChnW;Jb6(XW=T4Nyg$OeM{xaO$M}Xk*pSAnVYTvrt(^77G2I1ZnEDn zFU%$cXVBEU-GsR=oae-Z&bNr|*YC0#0eKU3BHu+)d?7s zMkNV~ltvW^8bY<{uZ3p^$iCa?ELm8Z(Ri2Px@}8<#h*Ie(Pv<7fl1ml&8DG>>Fkw= zL@vAzD(^43YMj~8PPs<-qCFocw*X+2BZnH;t)zKZ&xg2R02)0e18y%U&C)zPSPYX4 zm2QIIY{UJwv{qe4N#T}T;q$OQ$)nh|mRK8@i|YA^)3s?2KJEKgnylxZ-LkB>p54l< z(VpF1tE#Sq7?vo*Cct>kv?^~HB@<;S zM8D#|;^6}d0h%->DsGLj50pCdwIL%JAd(xj95I*Y#cx8LF!#!_ZCJm`;*$wB)Z(A% zqS7HT{3i*Jiig&XqNq1*ur?FB)(!V$nB&|!8LA2B5AQE4x-MCGFg6+zpbVYB*kKe% zSQv!5DOdw#qFefftlfaYT(~}p*s%8U(+PvD*1unsV2CoC5X+6_a3MW=Bf;%la?rkR98$l{BU&0`TC zAtr;D^&x#oCH=<5ogJ8EoQP&jq*e(VyqK;d1pOH?hjIZOGDMx!x`@sL!w3#nztb0D z47`Y*8N^I1qW1Gx6Bd6nQ8g72gOI0_#5f^k(u&uTW59?cwJxI*z)0sDc%@*yU~lB+ z+jz#HFyw`=QorHNPd3{Ub=kO-`(5k2uuFbJq2R^-brd*1l#kZIqRkkmPBsM!e1V=jq_CTh|sMGKm8! zH?SZ0edS=|w()#Ntd-59iH8$OYW}WJ^o`3uN0%UJ(8|e1z}YVt|3c*&XOy_w8eO11 z)X`6YptbEb5Gxx51vbqIXIpB;wf;{3k$5V$Xz&Hk2+8QlMyeLHhYu+*H$2#plaR6s zYTJTA-6L?zIv=U%kJ>p^~|+3 z?!(>ZeP?W_Fq8FCQ4Ra8WG3H}dW-#)CCGK8e|K(r+76c}*Yto}5NzMH}C@ zwVnub67SluG9OR8d@jCKNX#Kc4trK9yB-yRKO(e^L0cmM)jI0*QPYe~(}8padiIl9 z=J<4d-m36qgtYZyd;A;Y0G=I#u8=6!6~3ewGu<5=cKKedj|ybA9=q8*pmA6xN`~ko z?Q;G>|Gw;ULCBM{EAgw7aSJ;L51`UqK>1{rPBbE|gieSj@nO0K%@D{3xE6Sfzj6fD z!e3Cw_}>B1C#g-D*n|K!n=KVz1gn}?4Kpk5PaVzQ^QTsO2M2z|JRzR^w9@SO~Tk#HVJueT*tDAgSI}08$MbxO_(Xf*m&?96z^45P` z8vV|%BqPT&YUc7 zUJEW4W$(P#z_KL+=1%B50b{4|JysAUL)zIJ9>KT5f94fmxS=3vm0V@pjI6UcvEj18 zZ#rwh6vz!4I7<*gK}5xL)}mUGv<0L6A&_<&)#X~betSiL>Fn0!Tiv*iyWfavzL-Go zYei|w6@8N0lPkpvn5aE_0t;9^5)v17qBG#6zF1L^BI&UN<+ zm8PDj%A&4ut`ifNL@Q_ZqqtQ>ikMqKhmjew`jKc?D|b|WJGofS?PpZi%iodG@ze3P()CE(L;Npyurb&d_w9lDKs@G!KG#u6Q>2&XTgd?qFPC+qXd_(-@0PnzU5R&?sI!IJJMt=4(JOUe5Y$ovkK; zJLT&!G+$=|+|gDZJvkjA(Z$yaRmxNnl`)sG^&Wh`doA9%kDvaMiF}K9uv{f}k-q2f zTY==a`63oA$=zJJVVo+dJ=TeJsnn$%Z3lNL#bXNC4_(!>cFmuV9IjVF&R2G$$92OG zm%H+{HHDJ)0W+)vng`NCF>2j{hD-Lg`Mul|PaH>>C!eFk;K*Z+BuH8@PY%ud3g#`` zjYrlr=Ak&ZObOPVkAY`yM`Lkd>EX7y&0T>&?T%Pb@gTS}d#t)MKgn~hZ#nygNH*1j zTS_xbg3TM=I->3!WE{ag^Xe1zgr$^5NmPnwXC(2AUKLOLu1!pf+om7|0V4Y6O_5*W zrF|j>Pvgq9X-Awj-Jsm^ix>|mi_|R=c1L+%OfoDq7|)_PE0*xvZ2otE;L=S;qPs+j zL`!@R2V(<9%-9Wl$3o@iEBbG4ZO@IwHxqwE&3R?0FU74qG8P$RZa2LYT({^ZWo`R_-CAQK|2tL4%|#Xx_PhA^oE zz7#}3sYl52lED6cNw70NFmtA4J`+U;{|wioqxaqL9b0Xq5PMOnxGNPRtjH`tf{E@+ zXVeF585oC(UuwofxRNtdlEZMFx^lFGeB$|&YgBuZt4QojKAcdid=4wc<*wAn=?~|Y z(|Rr%@qWGSXNa-)G_ZoLwHVk%M6YD{p)k`p$}y)}oB_7LAhsXBCzp!%K>(K-JAURD zFZM~?YzW!b7*@SztgqcSVm((hI~%(8Ts%4ev!N|Dc-4t!DWp@=cu9g?Ri2}49XGwPM;=Yo+A zUFY?)PrH1eO`^zfX^LxYLFS&`FW2W)&aGD+;90WX#+%Mw#%$4bH-7kY;!C)M?8@(z zC!!k>L@?j{KNM3denG1Ls#W9w03P6#JWLf{ApqF5rN1+-ADi4iE& zq=+113`Cg#2MR7?T7ZT6zfCFw008=D5WoV}Uw2AQEj1KWZoprO41oQ2nI7;zQU?4* z|7lhTQ$ab@6J|uVAOrRPYAFD~`cE&w1skG Date: Tue, 1 Jul 2025 17:18:59 +0900 Subject: [PATCH 083/259] =?UTF-8?q?feat:=20SN(=ED=95=98=EC=88=98=EA=B4=80?= =?UTF-8?q?=EB=A1=9C)=20GIS=20=EA=B3=B5=ED=86=B5=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/map/Gis.js | 19 +++++++++---------- .../src/ui/map/lib/gis.core.js | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 8b8acf1cb..fa1cf7ab4 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -1,20 +1,19 @@ -import './lib/css/gis.common.css'; -import React, { createContext, useContext, useEffect, useMemo, useRef, useState, useCallback } from 'react'; +import { Search } from 'lucide-react'; import OlMap from 'ol/Map'; import View from 'ol/View'; import { defaults as defaultControls, OverviewMap } from 'ol/control'; import { defaults } from 'ol/interaction'; import * as olProj from 'ol/proj'; -import proj4 from 'proj4'; import { register } from 'ol/proj/proj4'; -import GisApp from './lib/gis.core'; -import GisContent from './GisContent'; -import GisTree from './GisTree'; +import proj4 from 'proj4'; +import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; import GisLonLat from './GisLonLat'; +import GisMapToggle from './GisMapToggle'; import GisSelect from './GisSelect'; import GisToolBar from './GisToolBar'; -import GisMapToggle from './GisMapToggle'; -import { Search } from 'lucide-react'; +import GisTree from './GisTree'; +import './lib/css/gis.common.css'; +import GisApp from './lib/gis.core'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); @@ -122,7 +121,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa projection: GisApp.TO_PROJ, zoom: gisCore.defaults.zoom, center: olProj.transform( - [126.6757, 37.5585], + [127.4875, 37.4916], GisApp.FROM_PROJ, GisApp.TO_PROJ ), @@ -242,4 +241,4 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa ); } -export default React.memo(Gis); \ No newline at end of file +export default React.memo(Gis); diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index db58c898f..ddfcec3a1 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -94,7 +94,7 @@ GisApp.core.prototype = { target: '', centerX: 37.2806094, centerY: 127.0032502, - zoom: 12, + zoom: 15, minZoom: 6, maxZoom: 20, }, From e4350f71cd514fbc44ccd5ca69ca2100da20aaea Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 18:03:59 +0900 Subject: [PATCH 084/259] =?UTF-8?q?feat:=20-=20=EC=A4=91=EC=A0=90=EC=9A=B0?= =?UTF-8?q?=EC=88=98=ED=86=A0=EC=8B=A4=20=EC=83=81=EC=84=B8=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=9E=91=EC=97=85=20-=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EA=B4=80=EB=A1=9C=20=EC=B9=A8=EC=9E=85=EC=88=98=20?= =?UTF-8?q?=EB=B6=84=EC=84=9D,=20RDII=20=EB=B6=84=EC=84=9D=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD=20-=20?= =?UTF-8?q?=EC=8B=9C=EC=84=A4=20=EC=A0=95=EB=B3=B4=20API=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C=20=ED=95=98=EC=A7=80=20=EC=95=8A=EA=B3=A0=20GIS=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=97=90=EC=84=9C=20=EA=B0=80=EC=A0=B8?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/table.ts | 107 ++++----- .../components/popupComponent/MsSwagePpl.tsx | 96 ++++---- .../map/components/popupComponent/Ssc.tsx | 29 ++- .../map/featureClickEventPopup.tsx | 213 +++++++++++++++--- 4 files changed, 292 insertions(+), 153 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 7b6c307cb..f18d402ff 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -30,75 +30,76 @@ export const MsSwagePplCol = [ // 하수처리시설 export const SwtrmtFcltCol = [ - { id: 'swtrmtFcltNm', title: '하수처리시설명' }, - { id: 'fcltCpct', title: '시설용량' }, - { id: 'rgnExpln', title: '지역설명' }, - { id: 'cmcnYmd', title: '준공일자' }, - { id: 'oprtngStrtYmd', title: '가동개시일자' }, - { id: 'clsgYmd', title: '폐쇄일자' }, - // { id: 'prcsMsrcCd', title: '처리공법코드' }, - // { id: 'laeCd', title: '지자체코드' }, - { id: 'laeNm', title: '지자체명' }, - { id: 'ctpvNm', title: '시도명' }, - { id: 'sggNm', title: '시군구명' }, - // { id: 'sareaCd', title: '권역코드' }, - { id: 'sareaNm', title: '권역명' }, - { id: 'lrgeSareaNm', title: '대권역명' }, - { id: 'rvrNm', title: '하천명' }, + { id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, + { id: 'fclt_cpct', title: '시설용량' }, + { id: 'rgn_expln', title: '지역설명' }, + { id: 'cmcn_ymd', title: '준공일자' }, + { id: 'oprtng_strt_ymd', title: '가동개시일자' }, + { id: 'clsg_ymd', title: '폐쇄일자' }, + // { id: 'prcs_msrc_cd', title: '처리공법코드' }, + // { id: 'lae_cd', title: '지자체코드' }, + { id: 'lae_nm', title: '지자체명' }, + { id: 'ctpv_nm', title: '시도명' }, + { id: 'sgg_nm', title: '시군구명' }, + // { id: 'sarea_cd', title: '권역코드' }, + { id: 'sarea_nm', title: '권역명' }, + { id: 'lrge_sarea_nm', title: '대권역명' }, + { id: 'rvr_nm', title: '하천명' }, { id: 'addr', title: '주소' }, - { id: 'daddr', title: '상세주소' }, - { id: 'rdnmAddr', title: '도로명주소' }, - { id: 'dtlRdnmAddr', title: '상세도로명주소' }, - { id: 'dschgWtstNm', title: '방류수계명' }, - { id: 'pllnArea', title: '부지면적' }, - { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, - { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, - { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, + { id: 'dtl_addr', title: '상세주소' }, + { id: 'rdnm_addr', title: '도로명주소' }, + { id: 'dtl_rdnm_addr', title: '상세도로명주소' }, + { id: 'dschg_wtst_nm', title: '방류수계명' }, + { id: 'plln_area', title: '부지면적' }, + { id: 'mng_rprtv_bzenty_nm', title: '관리대행업제명' }, + { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수' }, + { id: 'prcs_zone_area_sum', title: '처리구역면적합계' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, - { id: 'rprsMsrcCn', title: '대표공법내용' }, - { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, - { id: 'sttyCrtrToc', title: '법정기준TOC' }, - { id: 'sttyCrtrSs', title: '법정기준SS' }, - { id: 'sttyCrtrTn', title: '법정기준총질소' }, - { id: 'sttyCrtrTph', title: '법정기준총인' }, - { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, - { id: 'bsnNm', title: '유역명' }, + { id: 'rprs_msrc_cn', title: '대표공법내용' }, + { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량' }, + { id: 'stty_crtr_toc', title: '법정기준TOC' }, + { id: 'stty_crtr_ss', title: '법정기준SS' }, + { id: 'stty_crtr_tn', title: '법정기준총질소' }, + { id: 'stty_crtr_tph', title: '법정기준총인' }, + { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수' }, + { id: 'bsn_nm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; // 하수처리구역 export const SwtrmtPrcsZoneCol = [ - { id: 'swtrmtZoneSn', title: '하수처리구역 일련번호' }, - { id: 'swtrmtZoneNm', title: '하수처리구역명' }, - // { id: 'swtrmtFcltCd', title: '하수처리시설코드' }, - // { id: 'ctpvCd', title: '시도코드' }, - { id: 'ctpvNm', title: '시도명' }, - // { id: 'sggCd', title: '시군구코드' }, - { id: 'sggNm', title: '시군구명' }, - { id: 'swtrmtFcltNm', title: '하수처리시설명' }, + // { id: 'swtrmtZoneSn', title: '하수처리구역 일련번호' }, + { id: 'swtrmt_zone_nm', title: '하수처리구역명' }, + // { id: 'swtrmt_fclt_cd', title: '하수처리시설코드' }, + // { id: 'ctpv_cd', title: '시도코드' }, + { id: 'ctpv_nm', title: '시도명' }, + // { id: 'sgg_cd', title: '시군구코드' }, + { id: 'sgg_nm', title: '시군구명' }, + { id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, ]; // 하수맨홀 export const MsSwageMhlCol = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, - // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, - { id: 'fcltMngNo', title: '시설관리번호' }, - // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'mapshtNo', title: '도엽번호' }, - // { id: 'mngInstCd', title: '관리기관코드' }, - { id: 'instlYmd', title: '설치일자' }, - { id: 'lastDrdgnYmd', title: '최종준설일자' }, - // { id: 'usgCd', title: '용도코드' }, - // { id: 'fcltyShpCd', title: '시설물형태코드' }, - // { id: 'mhlKndCd', title: '맨홀종류코드' }, - { id: 'swageMhDiam', title: '하수맨홀구경' }, - { id: 'wdthLen', title: '가로길이' }, - { id: 'vrtcLen', title: '세로길이' }, + // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'mapsht_no', title: '도엽번호' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'last_drdgn_ymd', title: '최종준설일자' }, + // { id: 'usg_cd', title: '용도코드' }, + // { id: 'fclty_shp_cd', title: '시설물형태코드' }, + // { id: 'mhl_knd_cd', title: '맨홀종류코드' }, + { id: 'swage_mh_diam', title: '하수맨홀구경' }, + { id: 'wdth_len', title: '가로길이' }, + { id: 'vrtc_len', title: '세로길이' }, // { id: 'mqltCd', title: '재질코드' }, - { id: 'altdVl', title: '표고' }, + // { id: 'ang_dir', title: '표고' }, + { id: 'altd_vl', title: '표고' }, { id: 'dpthlVl', title: '심도' }, // { id: 'instMngNo', title: '기관관리번호' } ]; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index c6d10aa3f..27aa8e289 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -3,9 +3,8 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React, { useState } from 'react' import InputSection from '../InputSection'; import { handleInputChange } from '../common'; -import { Button } from '@common/components/ui'; -import InfilChart from './chart/infilChart'; -import RdiiChart from './chart/rdiiChart'; + + // 하수관로 const inputColumn = [ { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, @@ -16,80 +15,63 @@ const inputColumn = [ { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; -const MsSwagePpl = ({ featureData }: { featureData: any }) => { // SwtrmtFclt - console.log("featureData", featureData); - const [isModalInfil, setIsModalInfil] = React.useState(false); - const [isModalRdii, setIsModalRdii] = React.useState(false); - const [btnTxt, setBtnTxt] = useState(""); - const pplMngNo= featureData?.pplMngNo || ""; // 관로관리번호 - const openModalRdii = (e: React.MouseEvent) => { - e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) - setIsModalRdii(true); - } - const openModalInfil = (e: React.MouseEvent) => { - e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) - setIsModalInfil(true); - }; - const closeModalInfil = () => { - setIsModalInfil(false); - }; - const closeModalRdii = () => { - setIsModalRdii(false);}; + +const MsSwagePpl = ({ featureData }: { featureData: any }) => { const [repairData, setRepairData] = useState([ { year: "2025", type: "개대체" }, { year: "2025", type: "보수" }, ]); + const [cleaningData, setCleaningData] = useState([ { year: "2025", type: "청소" }, { year: "2025", type: "준설" }, ]); + const [inspectionData, setInspectionData] = useState([ { year: "2025", type: "관로기술진단" }, { year: "2025", type: "관로기술진단" }, ]); + const dataMap = { repair: { data: repairData, setData: setRepairData }, cleaning: { data: cleaningData, setData: setCleaningData }, inspection: { data: inspectionData, setData: setInspectionData }, }; - const keysToExtract = [ - "swtrmt_zone_cd", - "mltv_dtdv_nm", - "fid", - "lyrTypeNm", - "reg_dt", - "mdfcn_dt", - "rgtr", - "mdfr", - ]; - // const filteredData = Object.entries(featureData) - // .filter(([key]) => keysToExtract.includes(key)) // 필요한 키만 필터링 - // .map(([key, value]) => ({ key, value: value ?? "N/A" })); // 테이블 데이터 형식으로 변환 + return (
- - handleInputChange(section, index, field, value, dataMap)} /> - handleInputChange(section, index, field, value, dataMap)} /> - handleInputChange(section, index, field, value, dataMap)} /> -
- - -
- - + + handleInputChange(section, index, field, value, dataMap)} + /> + handleInputChange(section, index, field, value, dataMap)} + /> + handleInputChange(section, index, field, value, dataMap)} + />
) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 762929e69..7e22ea03b 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -1,36 +1,41 @@ // 우수토실 import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; -import React from 'react'; +import React, { useState } from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; +import LoadingOverlay from '@/components/ui/LoadingBar'; const Ssc = ({ featureData, chkMainSsc, additionalData }: { featureData: any, chkMainSsc?: boolean, additionalData?: any }) => { + const [isModalOpen, setIsModalOpen] = useState(false); + const [isDataLoaded, setIsDataLoaded] = useState(false); + console.log('featureData data received:', featureData); // 추가 데이터 확인용 console.log('Additional data received:', additionalData); // 추가 데이터 확인용 - - const [isModalOpen, setIsModalOpen] = React.useState(false); const openModal = () => { setIsModalOpen(true); }; const closeModal = () => { setIsModalOpen(false); + if (!isDataLoaded) { + setTimeout(() => setIsDataLoaded(true), 100); + } }; // 데이터 전처리: 합쳐진 필드 추가 - const preprocessedData = featureData ? [{ - ...featureData, - flwmtr_combined: `${featureData.flwmtr_mesure_tp_etc || '-'} / ${featureData.flwmtr_knd || '-'}` - }] : []; + // const preprocessedData = featureData ? [{ + // ...featureData, + // flwmtr_combined: `${featureData.flwmtr_mesure_tp_etc || '-'} / ${featureData.flwmtr_knd || '-'}` + // }] : []; const renderModalBody = () => (
{/* 강우정보 테이블 */}
- ); + ) return (
@@ -102,7 +107,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { }} /> */} - {!chkMainSsc ? null : + {chkMainSsc && (

중점우수토실 운영정보

@@ -131,7 +136,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { // footerContent={renderFooterContent()} />
- } + )}
) } diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 99c16f063..2424f2f34 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -4,16 +4,15 @@ import Modal from "@/components/ui/modal"; import { VerticalTable } from "@/components/ui/verticalTable"; import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState, useCallback, useMemo } from "react"; import { getLayerContentComponent } from "./components/common"; import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol } from "./components/common/table"; +import InfilChart from './components/popupComponent/chart/infilChart'; +import RdiiChart from './components/popupComponent/chart/rdiiChart'; + // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; - // const featureId = featureData.getId(); // 피처의 id 가져오기 - const featureId = typeof featureData.getId === 'function' - ? featureData.getId() - : featureData.fid; const [layerNm, setLayerNm] = useState(""); // 레이어 이름 상태 const [tableData, setTableData] = useState(null); // 피처 데이터 const [mntrngsData, setMntrngsData] = useState(false); // 수량/수질 측정 정보 @@ -24,6 +23,68 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const contentRef = useRef(null); const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태 const [chkMainSsc, setChkMainSsc] = useState(false); // 중점우수토실 여부 + const [isLoading, setIsLoading] = useState(false); + // 🎯 추가 데이터 로딩 상태 분리 + const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); + const [additionalDataError, setAdditionalDataError] = useState(null); + // 🎯 InfilChart 및 RdiiChart 관련 상태 추가 + const [isModalInfil, setIsModalInfil] = useState(false); + const [isModalRdii, setIsModalRdii] = useState(false); + const [btnTxt, setBtnTxt] = useState(""); + + // 🎯 관로관리번호 추출 + const pplMngNo = featureData?.values_?.fclt_mng_no || ""; + // const featureId = featureData.getId(); // 피처의 id 가져오기 + + const featureId = typeof featureData.getId === 'function' + ? featureData.getId() + : featureData.fid; + console.log('featureId', featureId); + + // 🎯 추가 데이터 API 호출 함수 (독립적으로 실행) + const fetchAdditionalData = useCallback(async (adstDstrCd: string, manageNo: string) => { + if (!adstDstrCd || !manageNo) { + console.warn('추가 데이터 호출 실패: 필수 매개변수 누락', { adstDstrCd, manageNo }); + return []; + } + + setIsAdditionalDataLoading(true); + setAdditionalDataError(null); + + try { + console.log(`추가 데이터 API 호출 시작: v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); + + // 🎯 타임아웃 설정 (10초) + const timeoutPromise = new Promise((_, reject) => + setTimeout(() => reject(new Error('API 타임아웃')), 10000) + ); + + const apiPromise = getData(`v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); + + const response = await Promise.race([apiPromise, timeoutPromise]) as any; + + console.log('추가 데이터 API 호출 성공:', response); + return response?.content || []; + } catch (error) { + console.error('추가 데이터 로딩 실패:', error); + setAdditionalDataError(error instanceof Error ? error.message : '알 수 없는 오류'); + return []; + } finally { + setIsAdditionalDataLoading(false); + } + }, []); + + // 🎯 데이터 전처리 메모이제이션 + const processedData = useMemo(() => { + if (!featureData?.values_) return null; + + const data = featureData.values_; + return { + ...data, + discharge_pipe_spec: `직경: ${data.pipe_diameter || '-'} / 높이: ${data.pipe_hg || '-'} / 길이: ${data.pipe_lt || '-'}`, + flwmtr_combined: `${data.flwmtr_mesure_tp_etc || '-'} / ${data.flwmtr_knd || '-'}` + }; + }, [featureData?.values_]); // 피쳐데이터의 현재 레이어 이름 가져오는 함수 const getSelectedLayers = () => { @@ -37,7 +98,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureLayer = layer; // 피처가 속한 레이어 찾기 } }); - console.log("featureLayer.get('lyrTyNm');", featureLayer.get('lyrTyNm')); + // console.log("featureLayer.get('lyrTyNm');", featureLayer.get('lyrTyNm')); // SearchModal 클릭 이벤트와 Gis 클릭 이벤트 구분하기 if (featureLayer.get('lyrNm') === null) { if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; @@ -64,15 +125,17 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, useEffect(() => { const fetchData = async () => { - if (featureId) { + if (!featureId) return; + + try { const selectedLayerName = getSelectedLayers(); // 레이어 이름 가져오기 setLayerNm(selectedLayerName); // 상태 업데이트 - const layerId = featureId.split('.')[0] + console.log('gis data', featureData.values_); - // let data = await getData(`v1/fclts/${featureId}?lyrTypeNm=${layerId}`); let data = featureData.values_; - console.log('api data', data) setfetchData(data) + setTableData(data); + switch (selectedLayerName) { case '하수처리시설': setHeadlist(SwtrmtFcltCol); @@ -88,16 +151,23 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setButtonChk(false) setChkMainSsc(true) - // 데이터 전처리: 합쳐진 필드 추가 - data = data ? { - ...data, - discharge_pipe_spec: `직경: ${data.pipe_diameter || '-'} / 높이: ${data.pipe_hg || '-'} / 길이: ${data.pipe_lt || '-'}` - } : {}; + setfetchData([processedData]) + setTableData(processedData); + setIsLoading(false); // 기본 렌더링 완료 // 수량/수질측정 정보 데이터 호출 - const additionalResponse = await getData(`v1/onsemiro/swgRain/${data.adst_dstr_cd}/${data.manage_no}/mntrngs`); - setMntrngsData(additionalResponse.content); - break; + if (data?.adst_dstr_cd && data?.manage_no) { + fetchAdditionalData(data.adst_dstr_cd, data.manage_no) + .then(response => { + console.log('additionalResponse', response); + setMntrngsData(response || []); + }) + .catch(error => { + console.error('추가 데이터 로딩 실패:', error); + setMntrngsData(false); + }); + } + return; case '우수토실': setButtonChk(true) break; @@ -122,11 +192,33 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, default: break; } - setTableData(data); - }; - } + } catch (error) { + console.error('데이터 로딩 중 오류:', error); + } + }; + fetchData(); - }, [featureId]); + }, [featureId, processedData]); + + // 🎯 추가 데이터는 별도 useEffect로 비동기 로딩 + useEffect(() => { + if (layerNm === '중점우수토실' && featureData?.values_) { + const data = featureData.values_; + + if (data?.adst_dstr_cd && data?.manage_no) { + // 🎯 추가 데이터를 비동기로 로딩 (UI 블로킹 없음) + fetchAdditionalData(data.adst_dstr_cd, data.manage_no) + .then(response => { + console.log('추가 데이터 로딩 완료:', response); + setMntrngsData(response || []); + }) + .catch(error => { + console.error('추가 데이터 최종 로딩 실패:', error); + setMntrngsData(false); + }); + } + } + }, [layerNm, featureData?.values_, fetchAdditionalData]); // 저장 시 모달 띄우기 const handleSaveClick = () => { @@ -142,6 +234,25 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setIsModalOpen(false); // 모달 닫기 }; + // 🎯 모달 열기/닫기 함수들 + const openModalInfil = () => { + setBtnTxt("Infil"); + setIsModalInfil(true); + }; + + const closeModalInfil = () => { + setIsModalInfil(false); + }; + + const openModalRdii = () => { + setBtnTxt("RDII"); + setIsModalRdii(true); + }; + + const closeModalRdii = () => { + setIsModalRdii(false); + }; + const btnClickEvent = async () => { const bodyData: Record = {} if (buttonChk && contentRef.current) { @@ -174,21 +285,45 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, } } } + + // 레이어명에 따라 상세페이지 렌더링 const ContentComponent = layerNm ? getLayerContentComponent(layerNm) : null; + return ( } + body={} bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index 83d87d738..17ea1f2e7 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -9,7 +9,26 @@ const yn: SelectDataType[] = [ { val: 'Y', text: 'Y' }, { val: 'N', text: 'N' }, ] +const bdstFilterYn: SelectDataType[] = [ + { val: 'Y', text: 'Y' }, + { val: 'N', text: 'N' }, + { val: 'D', text: '확인불가' }, + { val: 'F', text: '미가동' }, +] +// 최우수(그린1)/우수(그린2), 우량(그린3), 일반(그린4), 확인불가 체크 +const bdstGrntchClass: SelectDataType[] = [ + { val: '최우수(그린1)', text: '최우수(그린1)' }, + { val: '우수(그린2)', text: '우수(그린2)' }, + { val: '우량(그린3)', text: '우량(그린3)' }, + { val: '일반(그린4)', text: '일반(그린4)' }, + { val: '확인불가', text: '확인불가' }, +] +const bdstIncenYn: SelectDataType[] = [ + { val: 'Y', text: 'Y' }, + { val: 'N', text: 'N' }, + { val: 'D', text: '확인불가' }, +] //처리장연계/자체+연계/자체처리 const erctUswtrPrcsMeth : SelectDataType[]= [ { val: '처리장연계', text: '처리장연계' }, @@ -204,6 +223,9 @@ export type comCodeState = { ruseBizMthdCd: SelectDataType[]; rusePrcsMthdCd: SelectDataType[]; erctUswtrPrcsMeth: SelectDataType[]; + bdstFilterYn: SelectDataType[]; + bdstIncenYn: SelectDataType[]; + bdstGrntchClass:SelectDataType[]; }; }; @@ -217,7 +239,7 @@ export const getSggCd = async (set: any) => { })); */ const sggCd = [ - { text: "전체", val: '0' }, + // { text: "전체", val: '0' }, ...sgg .map((item: any) => ({ text: item.gugun || '', @@ -356,7 +378,10 @@ export const comCodeStateExport: comCodeState = { ruseSeCd:ruseSeCd, ruseBizMthdCd: ruseBizMthdCd, rusePrcsMthdCd:rusePrcsMthdCd, - erctUswtrPrcsMeth:erctUswtrPrcsMeth + erctUswtrPrcsMeth:erctUswtrPrcsMeth, + bdstFilterYn:bdstFilterYn, + bdstIncenYn:bdstIncenYn, + bdstGrntchClass:bdstGrntchClass }, }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 372a4bd9a..9a6c73e4e 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -10,7 +10,7 @@ export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e' const rainyObjSchema = z.object({ bdstReuseFcltFk: z.number().nullish(), pntfColKnd: z.string().min(1, { message: validationMessages.requiredSelect("종류") }), - pntfColArea: z.number().positive({ message: validationMessages.required("면적(m³)") }), + pntfColArea: z.number().nullish() , dtfcltCpct: z.number().default(0), filtrTrtmfctYn: z.string().default("Y"), filtrTrtmfctCpct: z.number().nullish().default(0), @@ -162,29 +162,27 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( const test =await makeRstr(data); const res = await postFectch("/reuseFc/rainyInfo", test); - if(res.ok){ + if(res.status===200){ if(data.chgBuilding.length > 0){ - await res.json().then((resData: any) => { - const chPK = resData?.data?.bdstInfoPk - const makeCh= resData.data.chgBuilding.map((item: chgBuilding) => + + const chPK = res?.data?.bdstInfoPk + const makeCh= res.data.chgBuilding.map((item: chgBuilding) => ( { ...item, bdstInfoFk: chPK, }) ); - const chch= postFectch("/reuseFc/chgBuilding", makeCh); - return chch; - }).then((chch: any) => { - - console.log('chch ', chch) + const chch= await postFectch("/reuseFc/chgBuilding", makeCh); if(chch.status ===200) { - toast.success("등록이 완료되었습니다."); - + toast.success("건축물 등록이 완료되었습니다."); + }else{ + toast.error("건축물 증축/개축/중축 오류입니다."); } - }) }else{ - toast.success("등록이 완료되었습니다."); + toast.success("건축물 등록이 완료되었습니다."); } + }else{ + toast.error("건축물 등록이 완료되었습니다."); } const rainRes = await initFetch(code); set((state: rainFacState) => ({ @@ -197,7 +195,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( })); } catch (e) { console.log("e", e); - alert("등록 오류입니다."); + toast.error("등록시 오류가 발생하였습니다."); } finally { } }, @@ -205,9 +203,9 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( try { const chData =await makeMdfr(data); const res = await putFectch("/reuseFc/rainyInfo", chData); - console.log('rainUpdate', res); - if(res.ok){ - alert(" 수정이 완료되었습니다.") + if(res.status === 200){ + toast.success("수정이 완료되었습니다."); + } const rainRes = await initFetch(code); set((state: rainFacState) => ({ @@ -220,7 +218,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( })); } catch (e) { console.log("e", e); - alert("업데이트 오류입니다."); + toast.error("수정시 오류가 발생하였습니다."); } finally { } } diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx index 6e28c3e76..59d6633a2 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx @@ -17,19 +17,28 @@ export const baseReuseBuildingSchema = z.object({ instlCstSprtYn: z.string().default("Y"), instlCstSprtAmt: z.number().nullish(), grntchBdstCertYn: z.string().default("Y"), - grntchBdstCertYr: z.string().default("").refine( + grntchBdstCertYr: z + .string() + .max(4, { message: validationMessages.yearFormat }) + .refine( (year) => year.length === 0 || /^\d{4}$/.test(year), { message: validationMessages.yearFormat, } - ), + ) + .nullish(), grntchBdstCertNo: z.string().default(""), grntchBdstCertGrd: z.string().default(""), crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값 crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값 crgRdctAmt: z.number().default(0), // 안쓰는 값 ruseFcltFlg: z.string().default(""), - bdstUsgCd: z.number().min(1, { message: validationMessages.requiredSelect("건축물용도") }).default(0), + bdstUsgCd: z + .number() + .default(0) + .refine((val) => val === -1 || val >= 1, { + message: validationMessages.requiredSelect("건축물용도"), + }), lawTrgtYn: z.string().default("Y"), rgtr: z.string().nullish(), mdfr: z.string().nullish(), diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index e5dfc8c0c..8569d4eb3 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -9,12 +9,22 @@ import { import type { RefObject } from "react"; export const getCity = (val: string, sggCd: SelectDataType[]) => { - const data = sggCd - .filter((item) => String(item.val).substring(0, 2) === val) + + let data:any + if(val !=='0'){ + data = sggCd + .filter((item) => String(item.val).substring(0, 2) === val) + .map((item) => ({ + val: item.val, + text: item.text, // 한국어 텍스트 + })); + }else{ + data = sggCd .map((item) => ({ val: item.val, text: item.text, // 한국어 텍스트 })); + } data.unshift({ val: "0", text: "전체" }); return data; }; @@ -103,7 +113,18 @@ export const handleCommaNumberChange = ( ) => { const raw = e.target.value.replace(/,/g, ""); if (!/^\d*$/.test(raw)) return; - onChange(raw === "" ? "" : Number(raw)); + onChange(raw === "" ? "" : Number(raw)); +}; + + +// onchange 텍스트를 숫자로 and ,제거 +export const handleMinusNumberChange = ( + e: React.ChangeEvent, + onChange: (value: number | "") => void +) => { + const raw = e.target.value.replace(/,/g, ""); + if (!/^\d*$/.test(raw)) return; + onChange(raw === "" ? -1 : Number(raw)); }; // 숫자입력시 , 삽입 diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 0d00454e2..c1bf7e2ca 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -16,8 +16,7 @@ import { type SelectDataType, } from "@common/business_components"; import { Button, Checkbox, Input } from "@common/components"; -import { Check } from "lucide-react"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useState } from "react"; import { useFieldArray } from "react-hook-form"; export default function BdstReg({ form }: { form: any }) { @@ -37,12 +36,6 @@ export default function BdstReg({ form }: { form: any }) { bdstUsgCd: "", }); }; -// 잠깐 주석처리 - // const removeLastItem = () => { - // if (fields.length > 0) { - // remove(fields.length - 1); - // } - // }; const removeSelected = () => { const idxsToRemove = fields .map((item, idx) => selectedIds.includes(item.id) ? idx : -1) @@ -100,7 +93,7 @@ export default function BdstReg({ form }: { form: any }) { return ( <>

- 건축물 시설 정보 + 건축물 기본 정보

@@ -155,7 +148,7 @@ export default function BdstReg({ form }: { form: any }) { @@ -168,10 +161,10 @@ export default function BdstReg({ form }: { form: any }) { control={form.control} name="daddr" render={({ field }) => ( - + @@ -225,7 +218,7 @@ export default function BdstReg({ form }: { form: any }) { { handleCommaNumberChange(e, field.onChange); @@ -324,8 +317,8 @@ export default function BdstReg({ form }: { form: any }) { handleCommaNumberChange(e, f.onChange)} - value={formatCommaNumber(f.value)} + onChange={e => f.onChange} + value={f.value} className={selectClass} /> diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index 17983edf2..d2f9b79e6 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -30,7 +30,11 @@ import { Button, DataTable, Input, Label } from "@common/components"; import { useEffect, useRef, useState } from "react"; import { useFieldArray, useForm, type UseFormReturn } from "react-hook-form"; import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail"; -import { safeDate } from "@/components/lib/func/commom"; +import { + formatCommaNumber, + handleCommaNumberChange, + safeDate, +} from "@/components/lib/func/commom"; import SearchInputText from "@/components/ui/searchInput/searchInput"; import SdmInsertForm from "@common/business_components/ui/sdmInsertForm"; import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; @@ -82,54 +86,57 @@ export function PbnstBuseForm({ }>({ isMoal: false, data: {} as DemandCompType }); useEffect(() => { - const etc= isNaN(Number(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`))) + const etc = isNaN( + Number(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`)) + ); let total = (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`) ?? 0) + (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`) ?? 0) + - (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`) ?? 0) - - if( !etc ) { - total+=Number(form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`)) - } + (form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`) ?? 0); + + if (!etc) { + total += Number( + form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`) + ); + } form.setValue(`items.${indexMng}.fcBizs.${indexBiz}.totalMoney`, total); }, [ form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.gvsbs`), form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.lcep`), form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.cusrAlotm`), - form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`) + form.getValues(`items.${indexMng}.fcBizs.${indexBiz}.etc`), ]); + const fcOrgwts = form.watch(`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`); - const fcOrgwts = form.watch( `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`) - - useEffect(() =>{ - - console.log('fcOrgwts ', fcOrgwts) - if(fcOrgwts&&fcOrgwts?.length>0){ + useEffect(() => { + console.log("fcOrgwts ", fcOrgwts); + if (fcOrgwts && fcOrgwts?.length > 0) { const swtrmtFcltFkList = fcOrgwts.map((item) => item.swtrmtFcltFk); - console.log('swtrmtFcltFkList ', swtrmtFcltFkList) + console.log("swtrmtFcltFkList ", swtrmtFcltFkList); - if(swtrmtFcltFkList.length > 0){ - getFcOrgwts(swtrmtFcltFkList.filter((item): item is string => item != null), fcOrgwts?.length) + if (swtrmtFcltFkList.length > 0) { + getFcOrgwts( + swtrmtFcltFkList.filter((item): item is string => item != null), + fcOrgwts?.length + ); } } - },[fcOrgwts]) - - useEffect(() =>{ + }, [fcOrgwts]); + useEffect(() => { if (fcOrgwtsNmList && fcOrgwtsNmList.length > 0) { - - console.log('fcOrgwtsNmList ', fcOrgwtsNmList) - console.log('fcOrgwts ', fcOrgwts) + console.log("fcOrgwtsNmList ", fcOrgwtsNmList); + console.log("fcOrgwts ", fcOrgwts); fcOrgwts?.forEach((item, index) => { const orgwtNm = fcOrgwtsNmList.find( (orgwt) => orgwt.bscFctCd === item.swtrmtFcltFk )?.bscFctNm; - console.log('orgwtNm ', orgwtNm) + console.log("orgwtNm ", orgwtNm); if (orgwtNm) { form.setValue( `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts.${index}.ruseUtztnFcltNm`, @@ -137,10 +144,8 @@ export function PbnstBuseForm({ ); } }); - } - - },[fcOrgwtsNmList,fcOrgwts]) - + } + }, [fcOrgwtsNmList, fcOrgwts]); // fcBizs 데이터가 변경될 때마다 차수 선택 목록을 업데이트합니다. useEffect(() => { @@ -294,7 +299,6 @@ export function PbnstBuseForm({ setSumCpct(sum); }, [form.formState, indexMng, indexBiz]); - const pbnstBiz = form.watch(`items.${indexMng}.fcBizs`); return ( <> @@ -527,7 +531,9 @@ export function PbnstBuseForm({ ).map((field, index) => (
{ - f.onChange(Number(e.target.value)); + handleCommaNumberChange(e, f.onChange); }} + value={formatCommaNumber(f.value)} /> )} @@ -691,7 +697,6 @@ export function PbnstBuseForm({ )} />
-

))}
diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx index 6e13058ab..30fab689e 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx @@ -97,7 +97,7 @@ export default function MngRegFormDetail({ : [] } onSelectValue={field.onChange} - value={field.value.trim()} + value={field.value?.trim() ??""} readOnly={formHead.option === "readOnly"} /> ); diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index fc4ed566e..b893f9bf4 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -4,29 +4,38 @@ import { useWrStore } from "@/app/store"; import { rainZod, selectClass, - type customRainBdst + type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; import { formatCommaNumber, handleCommaNumberChange, + handleMinusNumberChange, } from "@/components/lib/func/commom"; import { DatePicker, FormUi } from "@common/business_components"; -import { Form, FormField, SelectBox } from "@common/business_components/ui"; -import { Button, Input } from "@common/components/ui"; +import { + Form, + FormField, + FormLabel, + SelectBox, +} from "@common/business_components/ui"; +import { Button, Checkbox, Input, Label } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; import BdstReg from "../bdstReg/bdstReg"; +import toast from "react-hot-toast"; export default function RainRegForm({ rainForm, isModal, - readonly = false + readonly = false, + setIsModal }: { rainForm: customRainBdst; isModal: boolean; + setIsModal?:(modal:boolean) => void readonly?: boolean; }) { const { code, rainBdstReg, rainBdstUpdate, rain } = useWrStore( @@ -38,6 +47,7 @@ export default function RainRegForm({ resolver: zodResolver(rainZod), defaultValues: defaultValues, }); + const instlCst = form.watch(`reuseBuilding.0.instlCst`); const [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn] = form.watch([ "reuseBuilding.0.grntchBdstCertYn", @@ -69,7 +79,7 @@ export default function RainRegForm({ ? item?.grntchBdstCertYr : "", // null → "" instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" - grntchBdstCertYn:item?.grntchBdstCertYn??"Y", + grntchBdstCertYn: item?.grntchBdstCertYn ?? "Y", rainyObj: { ...item?.rainyObj, filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", @@ -79,7 +89,6 @@ export default function RainRegForm({ }; useEffect(() => { - if (grntchBdstCertYn === "N") { form.setValue("reuseBuilding.0.grntchBdstCertYr", ""); form.setValue("reuseBuilding.0.grntchBdstCertNo", ""); @@ -90,15 +99,25 @@ export default function RainRegForm({ form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctCpct", 0); form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctPrs", ""); } + + if(grntchBdstCertYn === "D") { + form.setValue("reuseBuilding.0.grntchBdstCertYr", "0000"); + form.setValue("reuseBuilding.0.grntchBdstCertNo", "확인불가"); + form.setValue("reuseBuilding.0.grntchBdstCertGrd", "확인불가"); + }else if (instlCstSprtYn === "D") { + form.setValue("reuseBuilding.0.instlCstSprtAmt", -1); + } else if (filtrTrtmfctYn === "D") { + form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctCpct", -1); + form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctPrs", "확인불가"); + } + }, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn]); - - +const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) // form 값이 변경될 때마다 로그 출력 useEffect(() => { - const subscription = form.watch((value) => { - }); + const subscription = form.watch((value) => {}); return () => subscription.unsubscribe(); }, [form]); @@ -108,7 +127,15 @@ export default function RainRegForm({ const onSubmit = (values: z.infer) => { if (isModal) { - rainBdstReg(values, "41"); + const data = regCtpvCd?regCtpvCd:regSggcd?regSggcd:'noCd' + + if(data ==='noCd'){ + toast.error("시도/시군구 코드를 선택해야합니다."); + return + } + + rainBdstReg(values, data); + setIsModal(false) } else { rainBdstUpdate(values, "41"); } @@ -125,10 +152,14 @@ export default function RainRegForm({

- {isModal ? "건축물 운영정보" : "빗물이용시설 정보"} + {isModal ? "건축물 정보" : "빗물이용시설 정보"}

{!readonly && ( - )} @@ -142,12 +173,9 @@ export default function RainRegForm({ ) : ( <> )} -

- 기본정보 -

- -
-
+

기본정보

+
+
field.onChange(date), + onChange: (date: Date | undefined) => + field.onChange(date), }} selectClass={"w-full"} readOnly={readonly} @@ -170,48 +199,95 @@ export default function RainRegForm({ />
-
+
( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={readonly} - /> - - )} + name={`reuseBuilding.0.instlCst`} + render={({ field }) => { + const value = field.value; + const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 + return ( +
+ + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly ) return; + handleMinusNumberChange(e, field.onChange); + }} + /> + +
+ ); + }} />
-

- 빗물이용시설 정보 -

+

빗물이용시설 정보

-

집수면

+

집수면 및 저류조

-
-
+
+
+ + + { + const isUnknown = field.value === null || field.value === -1; // 또는 Number(value) === -1 + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly ) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} + /> + + ) + }} + /> +
+
( - + { } : field.onChange} + onSelectValue={readonly ? () => {} : field.onChange} value={field.value ?? rainFcltCd[0]?.val} readOnly={readonly} /> @@ -219,24 +295,40 @@ export default function RainRegForm({ )} />
-
+
( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={readonly} - /> - - )} + render={({ field }) => { + const value = field.value; + const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 + return ( +
+ + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly ) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} + /> + + +
+ ); + }} />
@@ -255,8 +347,8 @@ export default function RainRegForm({ className={""} selectClass={selectClass} label={""} - selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} + selectArray={code.bdstFilterYn} + onSelectValue={readonly ? () => {} : field.onChange} value={field.value ?? code.yn[0]?.val} readOnly={readonly} /> @@ -268,47 +360,68 @@ export default function RainRegForm({ ( + render={({ field }) => + + + { + const isUnknown = field.value === null || field.value === -1; // 또는 Number(value) === -1 + return( { - if (!readonly) handleCommaNumberChange(e, field.onChange); + value={ + isUnknown ? "확인불가" : formatCommaNumber(field.value) + } + onFocus={() => { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } }} - value={formatCommaNumber(field.value)} - readOnly={readonly } + onChange={(e) => { + if (readonly ) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} disabled={filtrTrtmfctYn !== "Y"} /> - )} + ) + }} />
( - - - - )} + render={({ field }) => { + const value = field.value; + const isUnknown = value === null || value === "-"; // 또는 Number(value) === -1 + + return ( +
+ + + + +
+ ); + }} />
-

- 인센티브 정보 -

+

인센티브 정보

설치비 지원

@@ -324,8 +437,8 @@ export default function RainRegForm({ className={""} selectClass={selectClass} label={""} - selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} + selectArray={code.bdstIncenYn} + onSelectValue={readonly ? () => {} : field.onChange} value={field.value ?? code.yn[0]?.val} readOnly={readonly} /> @@ -337,24 +450,38 @@ export default function RainRegForm({ ( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); + render={({ field }) => + { + const value = field.value; + const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } }} - value={formatCommaNumber(field.value)} - readOnly={instlCstSprtYn !== "Y"} - /> - - )} + onChange={(e) => { + if (readonly ) return; + handleMinusNumberChange(e, field.onChange); + }} + disabled={instlCstSprtYn !== "Y"} + /> + + )} + } />
-

녹색건축물 인증

@@ -369,8 +496,8 @@ export default function RainRegForm({ className={""} selectClass={selectClass} label={""} - selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} + selectArray={code.bdstIncenYn} + onSelectValue={readonly ? () => {} : field.onChange} value={field.value ?? code.yn[0]?.val} /> @@ -381,20 +508,38 @@ export default function RainRegForm({ ( - - { - if (!readonly) field.onChange(e); - }} - readOnly={grntchBdstCertYn !== "Y"} - /> - - )} + render={({ field }) => + { + const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1 + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + value={ + + isUnknown?'확인불가':field.value ?? ""} + onChange={(e) => { + if (readonly) return + + if (e.target.value === '확인불가') { + field.onChange('0000'); + }else{ + field.onChange(e.target.value); + } + }} + disabled={grntchBdstCertYn !== "Y"} + /> + + )} + } />
@@ -411,7 +556,7 @@ export default function RainRegForm({ onChange={(e) => { if (!readonly) field.onChange(e); }} - readOnly={grntchBdstCertYn !== "Y"} + disabled={grntchBdstCertYn !== "Y"} /> )} @@ -423,15 +568,14 @@ export default function RainRegForm({ name="reuseBuilding.0.grntchBdstCertGrd" render={({ field }) => ( - { - if (!readonly) field.onChange(e); - }} - readOnly={grntchBdstCertYn !== "Y"} + {} : field.onChange} + value={field.value ?? code.bdstGrntchClass[0]?.val} + readOnly={readonly} /> )} diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 205846bb4..6ab1b25c4 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -29,10 +29,11 @@ export type objSearchType = { interface BdstRegProps { moType: T; + isModal:boolean; setIsModal?: (open: boolean) => void; } -export function BdstReg({ moType,setIsModal }: BdstRegProps) { +export function BdstReg({ moType,setIsModal,isModal }: BdstRegProps) { const { rain, code, bdst,findBdst } = useWrStore((state) => { return state; }); @@ -45,13 +46,13 @@ export function BdstReg({ moType,setIsModal }: BdstRegProps const getSelCity = (val: string | number) => { const cityValue = String(val); // Ensure val is treated as a string const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); - getSgg(data[0]?.val || ""); + // getSgg(data[0]?.val || ""); setObjSearch({ city: cityValue, sgg: '' }); }; const getSgg = (val: string | number) => { - console.log(val); setObjSearch({...objSearch,sgg: String(val)}) }; @@ -85,10 +86,7 @@ export function BdstReg({ moType,setIsModal }: BdstRegProps if (data) { setRainBdstForm(data); } - - } - } useEffect(()=>{ @@ -122,7 +120,7 @@ export function BdstReg({ moType,setIsModal }: BdstRegProps
-

건축물 목록

+

건축물 목록 (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 정보에 추가하여 주시기 바랍니다.)

({ moType,setIsModal }: BdstRegProps
{ moType === 'RNB'? - + :moType==='RST' - ? {setIsModal}}> + ? {setIsModal}}> : } diff --git a/apps/wr/components/ui/searchInput/searchInput.tsx b/apps/wr/components/ui/searchInput/searchInput.tsx index 796c8c298..be63b9685 100644 --- a/apps/wr/components/ui/searchInput/searchInput.tsx +++ b/apps/wr/components/ui/searchInput/searchInput.tsx @@ -62,9 +62,6 @@ export default function SearchInputText({ document.removeEventListener("mousedown", handleClickOutside); }; }, []); -useEffect(() =>{ - console.log('searchList ', searchList) -},[searchList]) return (
From 83b3fad3af3d0b752372296ce627a18583e4bddc Mon Sep 17 00:00:00 2001 From: leedj312 Date: Tue, 1 Jul 2025 20:38:00 +0900 Subject: [PATCH 092/259] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=86=A0?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 56 +++++++++++-------- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 1 + 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 607b90886..b468fad03 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -21,11 +21,14 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components"; import { useEffect, useState } from "react"; +import { Toaster } from "react-hot-toast"; export default function Home() { - const { rain, code, initRain, rainSearch, getRainData } = useWrStore((state) => { - return state; - }); + const { rain, code, initRain, rainSearch, getRainData } = useWrStore( + (state) => { + return state; + } + ); const { rainRes } = rain; const [rainForm, setRainForm] = useState(); const [issNewReg, setIsNewReg] = useState(false); @@ -38,10 +41,9 @@ export default function Home() { }>({ isOpen: false, chgBuilding: [] }); useEffect(() => { - setIsNewReg( false) + setIsNewReg(false); if (!rain.isInit) { - initRain('41'); - + initRain("41"); } }, [rain.isInit, initRain]); @@ -130,35 +132,39 @@ export default function Home() {
{/* */} - { - cellClick(val, headId); - }} - onPageChange={setPageNation} - > - + { + cellClick(val, headId); + }} + onPageChange={setPageNation} + > {/* */}
- - +
} + body={ + + } bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { @@ -176,6 +182,8 @@ export default function Home() { setBdstChgProps({ ...bdstChgProps, isOpen: open }); }} /> + + ); diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 9a6c73e4e..d4cfebfca 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -173,6 +173,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( }) ); const chch= await postFectch("/reuseFc/chgBuilding", makeCh); + if(chch.status ===200) { toast.success("건축물 등록이 완료되었습니다."); }else{ From b3e5cb84d320d599d239fea31616dac5d33275f1 Mon Sep 17 00:00:00 2001 From: yschoi Date: Tue, 1 Jul 2025 21:57:33 +0900 Subject: [PATCH 093/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/network/client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/common/network/client.ts b/packages/common/network/client.ts index 1b82d31c6..ae67e137f 100644 --- a/packages/common/network/client.ts +++ b/packages/common/network/client.ts @@ -22,6 +22,9 @@ class Client { withCredentials: true, }); + + console.log("config", config); + this.axiosInstance.interceptors.request.use((config) => { const token = Cookies.get(CLAIM_NAME); const userId = Cookies.get(AUTH_USER_ID); From fbcaa5bc11d0f538b7b8258e292a730c5cbc8938 Mon Sep 17 00:00:00 2001 From: yschoi Date: Tue, 1 Jul 2025 22:39:32 +0900 Subject: [PATCH 094/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index fab02e36c..4fcc410d3 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -1,6 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 11302 -NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_PROXY_HOST = http://localhost:11302 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 From 143e7581fdf3aa0c98a34fecce27ea4737f48d70 Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 1 Jul 2025 22:47:07 +0900 Subject: [PATCH 095/259] =?UTF-8?q?feat:=20-=20=ED=95=98=EC=88=98=EA=B4=80?= =?UTF-8?q?=EB=A1=9C,=20=ED=95=98=EC=88=98=EB=A7=A8=ED=99=80,=20=ED=95=98?= =?UTF-8?q?=EC=88=98=ED=8E=8C=ED=94=84=EC=9E=A5,=20=EC=9A=B0=EC=88=98?= =?UTF-8?q?=ED=86=A0=EC=8B=A4=20=EA=B2=80=EC=83=89=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?-=20env.development=20=ED=94=84=EB=A1=9D=EC=8B=9C=20=ED=98=B8?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 2 +- apps/sn/app/(map-layout)/map/SearchModal.tsx | 317 +++++++++--------- .../map/components/common/table.ts | 148 ++++++++ 3 files changed, 310 insertions(+), 157 deletions(-) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index fab02e36c..684a129c5 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -1,6 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 11302 -NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_PROXY_HOST = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index ea6f6e923..23037fcd4 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -1,5 +1,5 @@ import FeatureClickEventPopup from './featureClickEventPopup'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import axios from 'axios'; import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, Input, Label } from '@common/components'; @@ -8,7 +8,7 @@ import { UITab2 } from '@common/business_components/ui/tab/index-2'; import { SelectBox2 } from '@common/business_components/ui/select/index-2'; import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol } from './components/common/table'; +import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbr2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -24,10 +24,11 @@ const BASIC_TYPES = [ { val: "tb_ms_swage_ppl", text: "하수관로" }, { val: "tb_il_swage_prcs_fclt", text: "하수처리시설" }, { val: "tb_ms_swage_prcs_zone", text: "하수처리구역" }, - { val: "tb_ms_swage_mh", text: "하수맨홀" }, - { val: "tb_ms_swage_psmtn_1", text: "오수펌프" }, - { val: "tb_ms_swage_psmtn_2", text: "빗물펌프" }, - { val: "tb_ms_otfl", text: "우수토실" }, + { val: "tb_ms_swage_mhl", text: "하수맨홀" }, + { val: "tb_ms_swage_pmstn", text: "하수펌프장" }, + // { val: "tb_ms_swage_psmtn_1", text: "오수펌프" }, + // { val: "tb_ms_swage_psmtn_2", text: "빗물펌프" }, + { val: "tb_ms_stofcbr", text: "우수토실" }, ]; // 운영정보 '구분' 선택 목록 const WORK_TYPES = [ @@ -165,13 +166,15 @@ const SearchModal: React.FC = ({ const todayDate = today.getDate().toString().padStart(2, "0"); // UiTable2에 넘길 headlist를 BASIC_TYPES 값에 따라 분기 처리 - let dynamicHeadlist = SwtrmtPrcsZoneCol; // default 값 + let dynamicHeadlist = MsSwagePplCol2; // default 값 if (activeTab === 'operation') dynamicHeadlist = operationTableHeadlist; // 운영정보 else if (activeTab === 'report') dynamicHeadlist = reportTableHeadlist; // 하수도정비기본계획보고서 - else if (basicType === 'tb_ms_swage_ppl') dynamicHeadlist = swagePplTableHeadlist; // 하수관로 - else if (basicType === 'tb_il_swage_prcs_fclt') dynamicHeadlist = SwtrmtFcltCol; // 하수처리시설 - else if (basicType === 'tb_ms_swage_prcs_zone') dynamicHeadlist = SwtrmtPrcsZoneCol; // 하수처리구역 - else if (basicType === 'tb_ms_swage_mh') dynamicHeadlist = swageMhTableHeadlist; // 하수맨홀 + else if (basicType === 'tb_ms_swage_ppl') dynamicHeadlist = MsSwagePplCol2; // 하수관로 + else if (basicType === 'tb_il_swage_prcs_fclt') dynamicHeadlist = SwtrmtFcltCol2; // 하수처리시설 + else if (basicType === 'tb_ms_swage_prcs_zone') dynamicHeadlist = SwtrmtPrcsZoneCol2; // 하수처리구역 + else if (basicType === 'tb_ms_swage_mhl') dynamicHeadlist = MsSwageMhlCol2; // 하수맨홀 + else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = SewagePump2; // 하수펌프장 + else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbr2; // 우수토실 // 조회 버튼 클릭 시 1페이지로 이동하도록 수정 const handleSearch = () => { @@ -189,7 +192,7 @@ const SearchModal: React.FC = ({ }; // 구분(basicType)이 바뀔 때마다 queryParams, filterParams 초기화 - React.useEffect(() => { + useEffect(() => { // filterParams 초기화 // setFilterParams({}); set시작1(""); @@ -219,7 +222,7 @@ const SearchModal: React.FC = ({ }, [activeTab, basicType]); // 페이지 변경 시마다 데이터 fetch - React.useEffect(() => { + useEffect(() => { // showTable이 true일 때만 fetch (최초 렌더 방지) if (showTable) { fetchFilteredData(); // 실제 API 사용 시 @@ -227,38 +230,82 @@ const SearchModal: React.FC = ({ } }, [curPage]); + // 검색 API 호출 함수 + const fetchFilteredData = async () => { + setIsLoading(true); // 로딩 시작 + try { + const queryParams = new URLSearchParams({ + lyrTypeNm: basicType, + page: `${curPage - 1}`, + size: '10', + sort: 'string', + }); + + let cqlFilters: string[] = []; + if (activeTab === 'basic') { + if (basicType === 'tb_ms_swage_prcs_zone') cqlFilters = zoneCqlFilters(); // 하수처리구역 + else if (basicType === 'tb_il_swage_prcs_fclt') cqlFilters = facilityCqlFilters(); // 하수처리시설 + else if (basicType === 'tb_ms_swage_ppl') cqlFilters = pplCqlFilters(); // 하수관로 + else if (basicType === 'tb_ms_swage_mhl') cqlFilters = mhCqlFilters(); // 하수맨홀 + else if (basicType === 'tb_ms_swage_pmstn') cqlFilters = psmtnCqlFilters(); // 하수펌프장 + else if (basicType === 'tb_ms_stofcbr') cqlFilters = otflCqlFilters(); // 우수토실 + } else if (activeTab === 'operation') { + cqlFilters = zoneCqlFilters(); + } else { + cqlFilters = reportCqlFilters(); + } + + if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); + + console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); + const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); + console.log('필터링된 API 결과(개수):', res.data.count); + console.log('필터링된 API 결과(데이터):', res.data.data); + + setTableData(res.data.data || []); + setTableCount(res.data.count || []); + console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 + setShowTable(true); + } catch (err) { + console.error('API ERROR:', err); + setTableData([]); + } finally { + setIsLoading(false); // 로딩 종료 + } + }; + // 하수관로용 CQL 필터 생성 const pplCqlFilters = () => { const cqlFilters: string[] = []; // 추후 작성 예정 - if (변수1) cqlFilters.push(`용도코드='${변수1}'`); - if (변수2) cqlFilters.push(`재질코드='${변수2}'`); - if (변수3) cqlFilters.push(`행정읍면동코드='${변수3}'`); - if (변수4) cqlFilters.push(`경과년도='${변수4}'`); - // 설치년도 범위 - const startDate = getDateString( - yearFilter.시작, - 가동개시_시작_월, - 가동개시_시작_일, - "19000101", - ); - const endDate = getDateString( - yearFilter.종료, - 가동개시_종료_월, - 가동개시_종료_일, - `${todayYear}${todayMonth}${todayDate}`, - ); - cqlFilters.push( - `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - ); - // 관경(mm) 범위 - if (시작1 && 종료1) cqlFilters.push(`관경 BETWEEN ${시작1} AND ${종료1}`); - else if (시작1) cqlFilters.push(`관경 >= ${시작1}`); - else if (종료1) cqlFilters.push(`관경 <= ${종료1}`); - // 연장(m) 범위 - if (시작2 && 종료2) cqlFilters.push(`연장 BETWEEN ${시작2} AND ${종료2}`); - else if (시작2) cqlFilters.push(`연장 >= ${시작2}`); - else if (종료2) cqlFilters.push(`연장 <= ${종료2}`); + // if (변수1) cqlFilters.push(`용도코드='${변수1}'`); + // if (변수2) cqlFilters.push(`재질코드='${변수2}'`); + // if (변수3) cqlFilters.push(`행정읍면동코드='${변수3}'`); + // if (변수4) cqlFilters.push(`경과년도='${변수4}'`); + // // 설치년도 범위 + // const startDate = getDateString( + // yearFilter.시작, + // 가동개시_시작_월, + // 가동개시_시작_일, + // "19000101", + // ); + // const endDate = getDateString( + // yearFilter.종료, + // 가동개시_종료_월, + // 가동개시_종료_일, + // `${todayYear}${todayMonth}${todayDate}`, + // ); + // cqlFilters.push( + // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, + // ); + // // 관경(mm) 범위 + // if (시작1 && 종료1) cqlFilters.push(`관경 BETWEEN ${시작1} AND ${종료1}`); + // else if (시작1) cqlFilters.push(`관경 >= ${시작1}`); + // else if (종료1) cqlFilters.push(`관경 <= ${종료1}`); + // // 연장(m) 범위 + // if (시작2 && 종료2) cqlFilters.push(`연장 BETWEEN ${시작2} AND ${종료2}`); + // else if (시작2) cqlFilters.push(`연장 >= ${시작2}`); + // else if (종료2) cqlFilters.push(`연장 <= ${종료2}`); return cqlFilters; }; @@ -302,28 +349,28 @@ const SearchModal: React.FC = ({ // 하수맨홀용 CQL 필터 생성 const mhCqlFilters = () => { const cqlFilters: string[] = []; - // 설치년도 범위 - const startDate = getDateString( - yearFilter.시작, - 가동개시_시작_월, - 가동개시_시작_일, - "19000101", - ); - const endDate = getDateString( - yearFilter.종료, - 가동개시_종료_월, - 가동개시_종료_일, - `${todayYear}${todayMonth}${todayDate}`, - ); - cqlFilters.push( - `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - ); - if (변수1) cqlFilters.push(`경과년도='${변수1}'`); - if (변수2) cqlFilters.push(`용도코드='${변수2}'`); - // 구경(mm) 범위 - if (시작1 && 종료1) cqlFilters.push(`구경 BETWEEN ${시작1} AND ${종료1}`); - else if (시작1) cqlFilters.push(`구경 >= ${시작1}`); - else if (종료1) cqlFilters.push(`구경 <= ${종료1}`); + // // 설치년도 범위 + // const startDate = getDateString( + // yearFilter.시작, + // 가동개시_시작_월, + // 가동개시_시작_일, + // "19000101", + // ); + // const endDate = getDateString( + // yearFilter.종료, + // 가동개시_종료_월, + // 가동개시_종료_일, + // `${todayYear}${todayMonth}${todayDate}`, + // ); + // cqlFilters.push( + // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, + // ); + // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); + // if (변수2) cqlFilters.push(`용도코드='${변수2}'`); + // // 구경(mm) 범위 + // if (시작1 && 종료1) cqlFilters.push(`구경 BETWEEN ${시작1} AND ${종료1}`); + // else if (시작1) cqlFilters.push(`구경 >= ${시작1}`); + // else if (종료1) cqlFilters.push(`구경 <= ${종료1}`); return cqlFilters; }; @@ -331,32 +378,32 @@ const SearchModal: React.FC = ({ const psmtnCqlFilters = () => { const cqlFilters: string[] = []; // 설치년도 범위 - const startDate = getDateString( - yearFilter.시작, - 가동개시_시작_월, - 가동개시_시작_일, - "19000101", - ); - const endDate = getDateString( - yearFilter.종료, - 가동개시_종료_월, - 가동개시_종료_일, - `${todayYear}${todayMonth}${todayDate}`, - ); - cqlFilters.push( - `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - ); - if (변수1) cqlFilters.push(`경과년도='${변수1}'`); - // 일일처리용량 범위 - if (시작1 && 종료1) - cqlFilters.push(`일일처리용량 BETWEEN ${시작1} AND ${종료1}`); - else if (시작1) cqlFilters.push(`일일처리용량 >= ${시작1}`); - else if (종료1) cqlFilters.push(`일일처리용량 <= ${종료1}`); - // 우수양수능력 범위 - if (시작2 && 종료2) - cqlFilters.push(`우수양수능력 BETWEEN ${시작2} AND ${종료2}`); - else if (시작2) cqlFilters.push(`우수양수능력 >= ${시작2}`); - else if (종료2) cqlFilters.push(`우수양수능력 <= ${종료2}`); + // const startDate = getDateString( + // yearFilter.시작, + // 가동개시_시작_월, + // 가동개시_시작_일, + // "19000101", + // ); + // const endDate = getDateString( + // yearFilter.종료, + // 가동개시_종료_월, + // 가동개시_종료_일, + // `${todayYear}${todayMonth}${todayDate}`, + // ); + // cqlFilters.push( + // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, + // ); + // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); + // // 일일처리용량 범위 + // if (시작1 && 종료1) + // cqlFilters.push(`일일처리용량 BETWEEN ${시작1} AND ${종료1}`); + // else if (시작1) cqlFilters.push(`일일처리용량 >= ${시작1}`); + // else if (종료1) cqlFilters.push(`일일처리용량 <= ${종료1}`); + // // 우수양수능력 범위 + // if (시작2 && 종료2) + // cqlFilters.push(`우수양수능력 BETWEEN ${시작2} AND ${종료2}`); + // else if (시작2) cqlFilters.push(`우수양수능력 >= ${시작2}`); + // else if (종료2) cqlFilters.push(`우수양수능력 <= ${종료2}`); return cqlFilters; }; @@ -364,28 +411,28 @@ const SearchModal: React.FC = ({ const otflCqlFilters = () => { const cqlFilters: string[] = []; // 설치년도 범위 - const startDate = getDateString( - yearFilter.시작, - 가동개시_시작_월, - 가동개시_시작_일, - "19000101", - ); - const endDate = getDateString( - yearFilter.종료, - 가동개시_종료_월, - 가동개시_종료_일, - `${todayYear}${todayMonth}${todayDate}`, - ); - cqlFilters.push( - `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - ); - if (변수1) cqlFilters.push(`경과년도='${변수1}'`); - if (변수2) cqlFilters.push(`하천명 ILIKE '%${변수1}%'`); - // 계획방류량 범위 - if (시작1 && 종료1) - cqlFilters.push(`계획방류량 BETWEEN ${시작1} AND ${종료1}`); - else if (시작1) cqlFilters.push(`계획방류량 >= ${시작1}`); - else if (종료1) cqlFilters.push(`계획방류량 <= ${종료1}`); + // const startDate = getDateString( + // yearFilter.시작, + // 가동개시_시작_월, + // 가동개시_시작_일, + // "19000101", + // ); + // const endDate = getDateString( + // yearFilter.종료, + // 가동개시_종료_월, + // 가동개시_종료_일, + // `${todayYear}${todayMonth}${todayDate}`, + // ); + // cqlFilters.push( + // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, + // ); + // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); + // if (변수2) cqlFilters.push(`하천명 ILIKE '%${변수1}%'`); + // // 계획방류량 범위 + // if (시작1 && 종료1) + // cqlFilters.push(`계획방류량 BETWEEN ${시작1} AND ${종료1}`); + // else if (시작1) cqlFilters.push(`계획방류량 >= ${시작1}`); + // else if (종료1) cqlFilters.push(`계획방류량 <= ${종료1}`); return cqlFilters; }; @@ -436,47 +483,6 @@ const SearchModal: React.FC = ({ return cqlFilters; }; - // 검색 API 호출 함수 - const fetchFilteredData = async () => { - setIsLoading(true); // 로딩 시작 - try { - const queryParams = new URLSearchParams({ - lyrTypeNm: basicType, - page: `${curPage - 1}`, - size: '10', - sort: 'string', - }); - - let cqlFilters: string[] = []; - if (activeTab === 'basic') { - if (basicType === 'tb_ms_swage_prcs_zone') cqlFilters = zoneCqlFilters(); - else if (basicType === 'tb_il_swage_prcs_fclt') cqlFilters = facilityCqlFilters(); - else if (basicType === 'tb_ms_swage_ppl') cqlFilters = pplCqlFilters(); - } else if (activeTab === 'operation') { - cqlFilters = zoneCqlFilters(); - } else { - cqlFilters = reportCqlFilters(); - } - - if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); - - console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); - const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); - console.log('필터링된 API 결과(개수):', res.data.count); - console.log('필터링된 API 결과(데이터):', res.data.data); - - setTableData(res.data.data || []); - setTableCount(res.data.count || []); - console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 - setShowTable(true); - } catch (err) { - console.error('API ERROR:', err); - setTableData([]); - } finally { - setIsLoading(false); // 로딩 종료 - } - }; - const renderBody = () => ( <> {/* 탭 영역 */} @@ -736,7 +742,7 @@ const SearchModal: React.FC = ({
)} {/* 분기처리: 하수맨홀 */} - {basicType === "tb_ms_swage_mh" && ( + {basicType === "tb_ms_swage_mhl" && (
{/* 설치년도 */} @@ -812,8 +818,7 @@ const SearchModal: React.FC = ({
)} {/* 분기처리: 하수펌프장 */} - {(basicType === "tb_ms_swage_psmtn_1" || - basicType === "tb_ms_swage_psmtn_2") && ( + {basicType === "tb_ms_swage_pmstn" && (
{/* 설치년도 */}
@@ -892,7 +897,7 @@ const SearchModal: React.FC = ({
)} {/* 분기처리: 우수토실? 토구? */} - {basicType === "tb_ms_otfl" && ( + {basicType === "tb_ms_stofcbr" && (
{/* 설치년도 */}
diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index f18d402ff..884f51192 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -27,6 +27,34 @@ export const MsSwagePplCol = [ { id: 'wdth_len', title: '가로길이' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] +export const MsSwagePplCol2 = [ + { id: 'avgGrdn', title: '평균구배' }, + { id: 'clarFvlc', title: '맑음유속' }, + { id: 'drtwMltvArea', title: '오수배수면적' }, + { id: 'exclnMltvArea', title: '우수배수면적' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + // { id: 'fid', title: 'FID' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'instMngNo', title: '기관관리번호' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + // { id: 'mqltCd', title: '재질코드' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'pdmt', title: '관경' }, + { id: 'prlg', title: '연장' }, + // { id: 'rnysnFvlc', title: '우기유속' }, + { id: 'scendDpth', title: '종점깊이' }, + { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, + { id: 'tmptDpth', title: '시점깊이' }, + { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, + { id: 'trflnCnt', title: '차선수' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'vrtcLen', title: '세로길이' }, + { id: 'wdthLen', title: '가로길이' }, + // { id: 'lyrTypeNm', title: '레이어타입명' }, +] // 하수처리시설 export const SwtrmtFcltCol = [ @@ -67,6 +95,44 @@ export const SwtrmtFcltCol = [ { id: 'bsn_nm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; +export const SwtrmtFcltCol2 = [ + { id: 'swtrmtFcltNm', title: '하수처리시설명' }, + { id: 'fcltCpct', title: '시설용량' }, + { id: 'rgnExpln', title: '지역설명' }, + { id: 'cmcnYmd', title: '준공일자' }, + { id: 'oprtngStrtYmd', title: '가동개시일자' }, + { id: 'clsgYmd', title: '폐쇄일자' }, + // { id: 'prcsMsrcCd', title: '처리공법코드' }, + // { id: 'laeCd', title: '지자체코드' }, + { id: 'laeNm', title: '지자체명' }, + { id: 'ctpvNm', title: '시도명' }, + { id: 'sggNm', title: '시군구명' }, + // { id: 'sareaCd', title: '권역코드' }, + { id: 'sareaNm', title: '권역명' }, + { id: 'lrgeSareaNm', title: '대권역명' }, + { id: 'rvrNm', title: '하천명' }, + { id: 'addr', title: '주소' }, + { id: 'dtlAddr', title: '상세주소' }, + { id: 'rdnmAddr', title: '도로명주소' }, + { id: 'dtlRdnmAddr', title: '상세도로명주소' }, + { id: 'dschgWtstNm', title: '방류수계명' }, + { id: 'pllnArea', title: '부지면적' }, + { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, + { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, + { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, + { id: 'xcrd', title: 'X좌표' }, + { id: 'ycrd', title: 'Y좌표' }, + // { id: 'oprtngSttsCd', title: '가동상태코드' }, + { id: 'rprsMsrcCn', title: '대표공법내용' }, + { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, + { id: 'sttyCrtrToc', title: '법정기준TOC' }, + { id: 'sttyCrtrSs', title: '법정기준SS' }, + { id: 'sttyCrtrTn', title: '법정기준총질소' }, + { id: 'sttyCrtrTph', title: '법정기준총인' }, + { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, + { id: 'bsnNm', title: '유역명' }, + // { id: 'obsrvnSptCd', title: '관측지점코드' }, +]; // 하수처리구역 export const SwtrmtPrcsZoneCol = [ @@ -79,6 +145,16 @@ export const SwtrmtPrcsZoneCol = [ { id: 'sgg_nm', title: '시군구명' }, { id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, ]; +export const SwtrmtPrcsZoneCol2 = [ + // { id: 'swtrmtZoneSn', title: '하수처리구역 일련번호' }, + { id: 'swtrmtZoneNm', title: '하수처리구역명' }, + // { id: 'swtrmt_fclt_cd', title: '하수처리시설코드' }, + // { id: 'ctpv_cd', title: '시도코드' }, + { id: 'ctpvNm', title: '시도명' }, + // { id: 'sgg_cd', title: '시군구코드' }, + { id: 'sggNm', title: '시군구명' }, + { id: 'swtrmtFcltNm', title: '하수처리시설명' }, +]; // 하수맨홀 export const MsSwageMhlCol = [ @@ -103,6 +179,28 @@ export const MsSwageMhlCol = [ { id: 'dpthlVl', title: '심도' }, // { id: 'instMngNo', title: '기관관리번호' } ]; +export const MsSwageMhlCol2 = [ + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + // { id: 'lastDrdgnYmd', title: '최종준설일자' }, + // { id: 'usgCd', title: '용도코드' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + // { id: 'mhlKndCd', title: '맨홀종류코드' }, + { id: 'swageMhDiam', title: '하수맨홀구경' }, + { id: 'wdthLen', title: '가로길이' }, + { id: 'vrtcLen', title: '세로길이' }, + // { id: 'mqltCd', title: '재질코드' }, + // { id: 'angDir', title: '표고' }, + { id: 'altdVl', title: '표고' }, + { id: 'dpthlVl', title: '심도' }, + // { id: 'instMngNo', title: '기관관리번호' } +]; // 하수펌프장 export const SewagePump = [ @@ -125,6 +223,56 @@ export const SewagePump = [ { id: 'excln_wpmp_ablt', title: '우수양수능력' }, // { id: 'instMngNo', title: '기관관리번호' }, ] +export const SewagePump2 = [ + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'swagePmstnNm', title: '하수펌프장명' }, + { id: 'pllnArea', title: '부지면적' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'dailyPrcsCpct', title: '일일처리용량' }, + // { id: 'max_impndCpct', title: '최대저수용량' }, + { id: 'altdVl', title: '표고' }, + { id: 'wtlvVl', title: '수위' }, + { id: 'exclnWpmpAblt', title: '우수양수능력' }, + // { id: 'instMngNo', title: '기관관리번호' }, +] + +// 우수토실 +export const stofcbr = [ + // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'pbadms_emd_cd', title: '시설관리번호' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'mapsht_no', title: '도엽번호' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + { id: 'instl_ymd', title: '설치일자' }, + // { id: 'fclty_shp_cd', title: '시설물형태코드' }, + { id: 'worflw_wall_hgt', title: '월류벽높이' }, + // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, + // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, + { id: 'swage_mhl_mng_no', title: '하수맨홀관리번호' }, + { id: 'drtn_angl', title: '방향각도' }, +] +export const stofcbr2 = [ + // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'pbadmsEmdCd', title: '시설관리번호' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + // { id: 'fclty_shp_cd', title: '시설물형태코드' }, + { id: 'worflwWallHgt', title: '월류벽높이' }, + // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, + // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, + { id: 'swageMhlMngNo', title: '하수맨홀관리번호' }, + { id: 'drtnAngl', title: '방향각도' }, +] // 중점우수토실 측정지점 export const untrtSwgRainCol1 = [ From 02b0750a5ca953c33cc70000cb4a6ccbae1b8ebe Mon Sep 17 00:00:00 2001 From: yschoi Date: Tue, 1 Jul 2025 23:05:50 +0900 Subject: [PATCH 096/259] =?UTF-8?q?env=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index 4fcc410d3..fab02e36c 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -1,6 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 11302 -NEXT_PUBLIC_PROXY_HOST = http://localhost:11302 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 From 0c0d718ea9e6c62a2d093a6a6f9299dae65cee9d Mon Sep 17 00:00:00 2001 From: yschoi Date: Tue, 1 Jul 2025 23:24:49 +0900 Subject: [PATCH 097/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/network/client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/common/network/client.ts b/packages/common/network/client.ts index ae67e137f..b1a9805c3 100644 --- a/packages/common/network/client.ts +++ b/packages/common/network/client.ts @@ -29,6 +29,9 @@ class Client { const token = Cookies.get(CLAIM_NAME); const userId = Cookies.get(AUTH_USER_ID); + console.log("token", token); + console.log("userId", userId); + if (!token || !userId) { throw new AxiosError( "The authentication token is invalid.", From cd7e0fe62160c21e546b472c0076c308ec0c7189 Mon Sep 17 00:00:00 2001 From: mind-one005 Date: Wed, 2 Jul 2025 00:21:42 +0900 Subject: [PATCH 098/259] =?UTF-8?q?=EA=B4=80=EB=A1=9C=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 16 ++++-- .../popupComponent/chart/infilChart.tsx | 52 ++++++++----------- .../popupComponent/chart/rdiiChart.tsx | 38 ++++++-------- 3 files changed, 48 insertions(+), 58 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index e80711f5c..56157bc0e 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -54,6 +54,7 @@ export type TRdiiAnlsRslt = { pplMngNo: string; anlsTm: string; predcOilq:number; + minq:number; } export type TOilqData = { inftwtAnlsSn: number; // 침입수분석 일련번호 @@ -121,12 +122,12 @@ export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 }; export const getChartDataInftwtAnlsRslt = (arr: TInftwtAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: anlsRslt.anlsTm, + label: anlsRslt.anlsTm.substring(4), val: anlsRslt.predcOilq, })); return options; }; -export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string|undefined) => { // 침입수분석 결과 +export const selectInftwtAnlsRslt = async(inftwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 try { if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { console.warn("inftwtAnlsSn or pplMngNo is not provided"); @@ -148,7 +149,7 @@ export const getChartDataOilq = (arr: TOilqData[]): { label: string; val: number })); return options; }; -export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string|undefined) => { // 유량 +export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // 유량 try { if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { console.warn("inftwtAnlsSn or pplMngNo is not provided"); @@ -187,11 +188,18 @@ export const selectRdiiAnls = async(aplcnYm:String) => { // 침입수분석 }; export const getChartDataRdiiAnlsRslt = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: anlsRslt.anlsTm, + label: anlsRslt.anlsTm.substring(4), val: anlsRslt.predcOilq, })); return options; }; +export const getChartDataRdiiAnlsRsltMinq = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { + const options = arr.map(anlsRslt => ({ + label: anlsRslt.anlsTm.substring(4), + val: anlsRslt.minq, + })); + return options; +}; export const selectRdiiAnlsRslt = async(rainInfwtAnlsSn:number, pplMngNo:string) => { // 침입수분석 결과 try { if ((rainInfwtAnlsSn === undefined || rainInfwtAnlsSn === 0) || !pplMngNo) { diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 8f4d22bfa..a8a7d0f85 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -4,7 +4,7 @@ import { SelectBox } from '@common/business_components/ui'; import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; -import type { TInftwtAnls } from './aplcnYms'; +import type { TInftwtAnls, TOilqData } from './aplcnYms'; import { useAplcnYms, getOptionsInftwtAnlsInfo, selectInftwtAnls } from './aplcnYms'; import { getChartDataInftwtAnlsRslt, selectInftwtAnlsRslt, selectOilq, getChartDataOilq } from './aplcnYms'; type ModalOpenProp = { @@ -14,6 +14,7 @@ type ModalOpenProp = { btnTxt?: string, pplMngNo?: string, // 관로관리번호 } +type DataType = {label: string; val: number}; const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); @@ -24,16 +25,12 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState([{ val: 0, text: '선택' }]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState(0); // 침입수분석 정보 선택시 사용 - const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ - chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], - chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], + const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ + chartData1: [], chartData2: [], }); const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 - pplMngNo = "L13101003"; + pplMngNo = "L"+pplMngNo; // "L13101003"; + console.log("pplMngNo", pplMngNo); const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -44,7 +41,6 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } setPopupOpen(true); // 팝업 열기 }; - //console.log("btnTxt", btnTxt); const chartForm = CHART_FORM.LINE; const chartConfig = { @@ -60,14 +56,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 - setChartData({ - chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], - chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], - }); // 차트 데이터 초기화 + setChartData({chartData1: [], chartData2: []}); // 차트 데이터 초기화 } }, [isModalOpen]); @@ -84,6 +73,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo .then((data) => { setInftwtAnlss(data ?? []); setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data)); + setInftwtAnls(null); // 오수전환율 이후 초기화 setInftwtAnlsSn(0); // 초기화 }) .catch((error) => { @@ -113,19 +103,19 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo chartData1: rsltData // 침입수분석결과 })); }); - selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 - const rsltData = getChartDataOilq(data ?? []); - setChartData(prev => ({ - ...prev, - chartData2: rsltData // 유량 - })); - }).catch((err) => { - console.error("selectOilq 에러:", err); - setChartData(prev => ({ - ...prev, - chartData2: [] // 유량 데이터 초기화 - })); - }); + // selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 + // const rsltData = getChartDataOilq(data ?? []); + // setChartData(prev => ({ + // ...prev, + // chartData2: rsltData // 유량 + // })); + // }).catch((err) => { + // console.error("selectOilq 에러:", err); + // setChartData(prev => ({ + // ...prev, + // chartData2: [] // 유량 데이터 초기화 + // })); + // }); setPopupOpen(false); }; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 86be63ae4..750a91dd6 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -5,7 +5,7 @@ import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; import type { TRdiiAnls, TRdiiAnlsRslt, TOilqData } from './aplcnYms'; -import { getChartDataRdiiAnlsRslt, selectRdiiAnlsRslt } from './aplcnYms'; +import { selectRdiiAnlsRslt, getChartDataRdiiAnlsRslt, getChartDataRdiiAnlsRsltMinq } from './aplcnYms'; import { getOptionsRdiiAnlsInfo, selectRdiiAnls, useAplcnYms } from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, @@ -14,7 +14,7 @@ type ModalOpenProp = { btnTxt?: string, pplMngNo?: string, // 관로관리번호 } - +type DataType = {label: string; val: number}; const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { const [popupOpen, setPopupOpen] = React.useState(true); const buttonRef = React.useRef(null); // 버튼 참조 @@ -24,16 +24,13 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } const [rdiiAnlsInfos, setRdiiAnlsInfos] = useState([{ val: 0, text: '선택' }]); // 강우유입수분석정보 options const [rdiiAnls, setRdiiAnls] = useState(null); // 강우유입수분석정보 const [rainInfwtAnlsSn, setRainInfwtAnlsSn] = useState(0); // 강우유입수분석 정보 선택시 사용 - const [chartData, setChartData] = useState<{ chartData1: { label: string; val: number }[]; chartData2: { label: string; val: number }[] }>({ - chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], - chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], + const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ + chartData1: [], chartData2: [], }); const aplcnYms = useAplcnYms('rdiiAnlsRslt'); // 상수사용월 데이터 가져오기 + pplMngNo = "L"+pplMngNo; // "L13101003"; + console.log("pplMngNo", pplMngNo); const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -48,8 +45,8 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } const chartForm = CHART_FORM.LINE; const chartConfig = { - chartData1: { label: '강우유입수예측유량', color: "red", }, - chartData2: { label: '실측유량', color: "orange", } + chartData1: { label: 'BSF', color: "orange", }, + chartData2: { label: '강우유입수예측유량', color: "red", }, } as ChartConfig; useEffect(() => { @@ -60,14 +57,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } setRdiiAnlsInfos([{ val: 0, text: '선택' }]); // 강우유입수분석정보 초기화 setRdiiAnls(null); // 강우유입수분석정보 초기화 setRainInfwtAnlsSn(0); // 강우유입수분석 일련번호 초기화 - setChartData({ - chartData1: [{ label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 },], - chartData2: [{ label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 },], - }); // 차트 데이터 초기화 + setChartData({chartData1: [], chartData2: []}); // 차트 데이터 초기화 } }, [isModalOpen]); @@ -84,6 +74,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } .then((data) => { setRdiiAnlss(data ?? []); setRdiiAnlsInfos(getOptionsRdiiAnlsInfo(data)); + setRdiiAnls(null); // 오수전환율 이후 초기화 setRainInfwtAnlsSn(0); // 초기화 }) .catch((error) => { @@ -104,11 +95,12 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } }, [rainInfwtAnlsSn]); const closePopup = () => { // 팝업 닫기 - selectRdiiAnlsRslt(rainInfwtAnlsSn, "L13101003").then((data) => {// 강우유입수분석 결과 조회 - const rsltData = getChartDataRdiiAnlsRslt(data ?? []); + selectRdiiAnlsRslt(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수분석 결과 조회 + const rsltData1 = getChartDataRdiiAnlsRsltMinq(data ?? []); + const rsltData2 = getChartDataRdiiAnlsRslt(data ?? []); setChartData(prev => ({ - ...prev, - chartData1: rsltData // 강우유입수분석결과 + chartData1: rsltData1, // BSF + chartData2: rsltData2 // 강우유입수분석결과 })); }); From e125b76bbefad3f9551ee0d102e3b7a1fc83655e Mon Sep 17 00:00:00 2001 From: yschoi Date: Wed, 2 Jul 2025 00:33:12 +0900 Subject: [PATCH 099/259] =?UTF-8?q?=EB=A9=94=EC=9D=B8=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/page.tsx | 9 +++++---- apps/sn/middleware.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/sn/app/page.tsx b/apps/sn/app/page.tsx index c6db7fabe..21d1c7b3f 100644 --- a/apps/sn/app/page.tsx +++ b/apps/sn/app/page.tsx @@ -1,9 +1,11 @@ +"use client"; +import { Button } from "@common/components"; +import Link from "next/link"; import { redirect } from "next/navigation"; export default function Home() { - redirect("/map"); + //redirect("/map"); - /* return (
@@ -39,12 +41,11 @@ export default function Home() { - +
); - */ } diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index 0980396b9..3ad5d5129 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -40,7 +40,7 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } - if (pathname.startsWith("/sewerage-service/api/v1/map/geometry")) { + if (pathname.startsWith("/sewerage-service")) { const queryParams = searchParams.toString(); const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service/api", "")}${queryParams ? `?${queryParams}` : "" }`; From 8a459f11109a099077aabcddd83419783eee5f61 Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 2 Jul 2025 09:59:12 +0900 Subject: [PATCH 100/259] =?UTF-8?q?=EC=9C=A0=EB=9F=89api=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EC=A3=BC=EC=86=8C=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 5 +-- .../popupComponent/chart/infilChart.tsx | 36 ++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 56157bc0e..2e0fd6965 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -95,7 +95,7 @@ export const useAplcnYms = (gubun:string) => { if (result) setData(result); }; fetch(gubun); - }, []); + }, [gubun]); return data; }; @@ -155,7 +155,7 @@ export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // console.warn("inftwtAnlsSn or pplMngNo is not provided"); return []; } - const result = await getData(`v1/inftwtAnlsRslt/oilqppl/${inftwtAnlsSn}/${pplMngNo}`); + const result = await getData(`v1/inftwtAnlsRslt/oilqPpl/${inftwtAnlsSn}/${pplMngNo}`); if (result && result.numberOfElements > 0) { console.log("selectOilq", result.content); return result.content; @@ -165,6 +165,7 @@ export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // } }; +//---------- export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number }[] => { const options = anlsArr.map(anls => ({ text: anls.anlsInfo, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index a8a7d0f85..8700f0eb3 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -26,7 +26,9 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const [inftwtAnls, setInftwtAnls] = useState(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ - chartData1: [], chartData2: [], + chartData1: [], chartData2: [{ label: "1", val: 15 }, + { label: "2", val: 35 }, + { label: "3", val: 55 },], }); const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 pplMngNo = "L"+pplMngNo; // "L13101003"; @@ -50,13 +52,15 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo useEffect(() => { if (isModalOpen === false) { - setPopupOpen(true); // 모달이 닫힐 때 팝업은 + setPopupOpen(true); // 모달이 닫힐 때 조회조건팝업은 열어두기 setAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 - setChartData({chartData1: [], chartData2: []}); // 차트 데이터 초기화 + setChartData({chartData1: [], chartData2: [{ label: "1", val: 15 }, + { label: "2", val: 35 }, + { label: "3", val: 55 },],}); // 차트 데이터 초기화 } }, [isModalOpen]); @@ -103,19 +107,19 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo chartData1: rsltData // 침입수분석결과 })); }); - // selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 - // const rsltData = getChartDataOilq(data ?? []); - // setChartData(prev => ({ - // ...prev, - // chartData2: rsltData // 유량 - // })); - // }).catch((err) => { - // console.error("selectOilq 에러:", err); - // setChartData(prev => ({ - // ...prev, - // chartData2: [] // 유량 데이터 초기화 - // })); - // }); + selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 + const rsltData = getChartDataOilq(data ?? []); + setChartData(prev => ({ + ...prev, + chartData2: rsltData // 유량 + })); + }).catch((err) => { + console.error("selectOilq 에러:", err); + setChartData(prev => ({ + ...prev, + chartData2: [] // 유량 데이터 초기화 + })); + }); setPopupOpen(false); }; From fe66bc4e881bac6f0aa8835a2d8bdbed9189201a Mon Sep 17 00:00:00 2001 From: JIeunhuh Date: Wed, 2 Jul 2025 11:22:40 +0900 Subject: [PATCH 101/259] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20=ED=8C=9D?= =?UTF-8?q?=EC=97=85=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=91=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/newWindowPopup.tsx | 34 +++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index ebfcac1ca..a9f1f0326 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -67,6 +67,7 @@ const NewWindowPopup: React.FC = ({ } = useWrStore((state) => state); const [bdstTable, setBdstTable] = useState(); const [pageNation, setPageNation] = useState(1); + const [pbnstRuseFcltPk, setPbnstRuseFcltPk] = useState(''); const [pbnDetaileData, setPbnDetaileData] = useState<{ isModal: boolean; data: customPbnst; @@ -108,8 +109,7 @@ const NewWindowPopup: React.FC = ({ } // 2. RuseMngTable에 필요한 tableData를 생성합니다. (단일 행 데이터) - const tableData = [featureData]; - console.log("tableData", tableData); + // 선택된 피쳐 데이터 속성값 // 물재이용시설 cellClick 이벤트 (상세정보) const pbnstCellClick = (index: number | undefined) => { @@ -118,20 +118,35 @@ const NewWindowPopup: React.FC = ({ pbnstSttn.pbnstSttnRes && pbnstSttn.pbnstSttnRes[index] ) { - const pbnstRuseFcltPk = pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk; - getPbnStnDetail(pbnstRuseFcltPk); + setPbnstRuseFcltPk(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk); + getPbnStnDetail(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk); } }; - useEffect(() => { - setBdstTable(pbnstSttn.pbnstSttnRes); - }, [pbnstSttn.pbnstSttnRes]); + // useEffect(() => { + // setBdstTable(pbnstSttn.pbnstSttnRes); + // }, [pbnstSttn.pbnstSttnRes]); useEffect(() => { - if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk) setShowDetailView(true); + if (featureData) { + const selectedVal = featureData.getProperties(); + const featureCd = selectedVal?.swtrmt_fclt_cd + '1'; + + if (featureCd && featureCd !== pbnstRuseFcltPk) { + setPbnstRuseFcltPk(featureCd); // 현재 호출된 featureCd 저장 + getPbnStnDetail(featureCd); + } + } + }, [featureData]); + useEffect(() => { + if (pbnstSttn.pbnstDetail) { + setPbnDetaileData({ + isModal: true, + data: pbnstSttn.pbnstDetail, + }); + } }, [pbnstSttn.pbnstDetail]); - // 빗물재이용시설 cellClick 이벤트 (상세정보) const rainCellClick = (index: number | undefined, headId: string) => { if ( @@ -221,7 +236,6 @@ const NewWindowPopup: React.FC = ({ data={pbnDetaileData.data || ({} as customPbnst)} titleVisible={false} /> - ) : ( // 재이용시설 목록 From 3cc0a6d74385b20db2de1f853e4bfb9b70e76265 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 2 Jul 2025 13:34:58 +0900 Subject: [PATCH 102/259] =?UTF-8?q?feat:=20=EC=9A=B0=EC=88=98=ED=86=A0?= =?UTF-8?q?=EC=8B=A4=20=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 47 ++++--------------- .../map/components/common/table.ts | 4 +- .../map/featureClickEventPopup.tsx | 8 +++- 3 files changed, 16 insertions(+), 43 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 23037fcd4..44ec1d17c 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -8,7 +8,7 @@ import { UITab2 } from '@common/business_components/ui/tab/index-2'; import { SelectBox2 } from '@common/business_components/ui/select/index-2'; import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; -import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbr2 } from './components/common/table'; +import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -38,38 +38,7 @@ const WORK_TYPES = [ ]; const YEARS = Array.from({ length: 100 }, (_, i) => `${2025 - i}`); -// 테이블 헤더 리스트 -// 하수관로 -const swagePplTableHeadlist = [ - { id: 'pipeNumber', title: '관로번호' }, - { id: 'gisManageNumber', title: '관리번호(GIS)' }, - { id: 'managingInstitution', title: '관리기관' }, - { id: 'drawingNumber', title: '도엽번호' }, - { id: 'installationLocation', title: '설치위치' }, - { id: 'usage', title: '용도' }, - { id: 'pipeDiameter', title: '관경' }, - { id: 'pipeLength', title: '관로연장' }, - { id: 'pipeType', title: '관종' }, - { id: 'burialDepth', title: '매설심도' }, - { id: 'constructionYear', title: '개보수 년도' }, - { id: 'installationSubject', title: '설치 주체' }, - { id: 'area', title: '구역' }, - { id: 'division', title: '분구' }, - { id: 'alignmentType', title: '지선/간선 구분' }, - { id: 'flowType', title: '흐름 방식' }, - { id: 'boxCount', title: '박스 열수' }, - { id: 'height', title: '높이' }, - { id: 'width', title: '폭' }, - { id: 'startManholeNumber', title: '시점 맨홀번호' }, - { id: 'endManholeNumber', title: '종점 맨홀번호' }, - { id: 'startElevation', title: '시점관저고' }, - { id: 'endElevation', title: '종점관저고' }, -] -// 하수맨홀 (추후 작성 예정) -const swageMhTableHeadlist = [ - { id: "swtrmtFcltCd", title: "하수처리시설코드" }, -]; // 운영정보 const operationTableHeadlist = [ { id: "no", title: "NO" }, @@ -98,12 +67,6 @@ const 처리구역List = [ { val: "b", text: "B" }, ]; -interface SearchModalProps { - open: boolean; - onOpenChange: (open: boolean) => void; - onFeatureSelect: (row: any) => void; -} - // 날짜 조합 함수 const getDateString = ( year: string, @@ -118,6 +81,12 @@ const getDateString = ( return `${y}${m}${d}`; }; +interface SearchModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; + onFeatureSelect: (row: any) => void; +} + const SearchModal: React.FC = ({ open, onOpenChange, @@ -174,7 +143,7 @@ const SearchModal: React.FC = ({ else if (basicType === 'tb_ms_swage_prcs_zone') dynamicHeadlist = SwtrmtPrcsZoneCol2; // 하수처리구역 else if (basicType === 'tb_ms_swage_mhl') dynamicHeadlist = MsSwageMhlCol2; // 하수맨홀 else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = SewagePump2; // 하수펌프장 - else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbr2; // 우수토실 + else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbrCol2; // 우수토실 // 조회 버튼 클릭 시 1페이지로 이동하도록 수정 const handleSearch = () => { diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 884f51192..1747106cc 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -245,7 +245,7 @@ export const SewagePump2 = [ ] // 우수토실 -export const stofcbr = [ +export const stofcbrCol = [ // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, { id: 'pbadms_emd_cd', title: '시설관리번호' }, // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, @@ -259,7 +259,7 @@ export const stofcbr = [ { id: 'swage_mhl_mng_no', title: '하수맨홀관리번호' }, { id: 'drtn_angl', title: '방향각도' }, ] -export const stofcbr2 = [ +export const stofcbrCol2 = [ // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, { id: 'pbadmsEmdCd', title: '시설관리번호' }, // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 2424f2f34..bf453f968 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState, useCallback, useMemo } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol, stofcbrCol } from "./components/common/table"; import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; @@ -103,6 +103,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, if (featureLayer.get('lyrNm') === null) { if (featureData.lyrTypeNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; else if (featureData.lyrTypeNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; + else if (featureData.lyrTypeNm === 'tb_ms_stofcbr') result = '우수토실'; else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (featureData.lyrTypeNm === 'tb_ms_swage_ppl') result = '하수관로'; else if (featureData.lyrTypeNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; @@ -112,6 +113,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const lyrTyNm = featureLayer.get('lyrTyNm'); if (lyrTyNm === 'tb_il_swage_prcs_fclt') result = '하수처리시설'; else if (lyrTyNm === 'tb_ms_swage_prcs_zone') result = '하수처리구역'; + else if (lyrTyNm === 'tb_ms_stofcbr') result = '우수토실'; else if (lyrTyNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (lyrTyNm === 'tb_ms_swage_ppl') result = '하수관로'; else if (lyrTyNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; @@ -169,7 +171,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, } return; case '우수토실': - setButtonChk(true) + setHeadlist(stofcbrCol) + setButtonChk(false) break; case '하수관로': setHeadlist(MsSwagePplCol) @@ -273,6 +276,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, }); if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' + else if (layerNm === '중점우수토실') bodyData['lyrTypeNm'] = 'om_dt_untrt_swg_rain' else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' From d1ed7dac62b5c0435cf71881d7264e82914fcc4d Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 2 Jul 2025 13:35:29 +0900 Subject: [PATCH 103/259] =?UTF-8?q?=EA=B7=B8=EB=9E=98=ED=94=84=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 32 ++++++++++++++++++- .../popupComponent/chart/infilChart.tsx | 21 ++++++------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 2e0fd6965..e8240aa5b 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -164,8 +164,38 @@ export const selectOilq = async(inftwtAnlsSn:number, pplMngNo:string) => { // console.error(error); } }; - +export const selectPplInftwtQty = async(inftwtAnlsSn:number, pplMngNo:string) => { // 침입수량 + try { + if ((inftwtAnlsSn === undefined || inftwtAnlsSn === 0) || !pplMngNo) { + console.warn("inftwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/inftwtAnlsRslt/pplinftwtQty/${inftwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectPplInftwtQty", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; //---------- +export const selectPplRdiiQty = async(rainInfwtAnlsSn:number, pplMngNo:string) => { // rdii값 + try { + if ((rainInfwtAnlsSn === undefined || rainInfwtAnlsSn === 0) || !pplMngNo) { + console.warn("rainInfwtAnlsSn or pplMngNo is not provided"); + return []; + } + const result = await getData(`v1/rdiiAnlsRslt/pplRdiiQty/${rainInfwtAnlsSn}/${pplMngNo}`); + if (result && result.numberOfElements > 0) { + console.log("selectPplInftwtQty", result.content); + return result.content; + } + } catch (error) { + console.error(error); + } +}; + export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number }[] => { const options = anlsArr.map(anls => ({ text: anls.anlsInfo, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 8700f0eb3..97b0309e2 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -5,8 +5,7 @@ import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; import type { TInftwtAnls, TOilqData } from './aplcnYms'; -import { useAplcnYms, getOptionsInftwtAnlsInfo, selectInftwtAnls } from './aplcnYms'; -import { getChartDataInftwtAnlsRslt, selectInftwtAnlsRslt, selectOilq, getChartDataOilq } from './aplcnYms'; +import * as fn from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, @@ -30,7 +29,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo { label: "2", val: 35 }, { label: "3", val: 55 },], }); - const aplcnYms = useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 + const aplcnYms = fn.useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 pplMngNo = "L"+pplMngNo; // "L13101003"; console.log("pplMngNo", pplMngNo); const openPopup = () => { @@ -46,8 +45,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const chartForm = CHART_FORM.LINE; const chartConfig = { - chartData1: { label: '침입수예측유량', color: "red", }, - chartData2: { label: '실측유량', color: "orange", } + chartData1: { label: '순오수량(m³/h)', color: "red", }, + chartData2: { label: '실측하수량(m³/h)', color: "orange", } } as ChartConfig; useEffect(() => { @@ -73,10 +72,10 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo return; } - selectInftwtAnls(aplcnYm) + fn.selectInftwtAnls(aplcnYm) .then((data) => { setInftwtAnlss(data ?? []); - setInftwtAnlsInfos(getOptionsInftwtAnlsInfo(data)); + setInftwtAnlsInfos(fn.getOptionsInftwtAnlsInfo(data)); setInftwtAnls(null); // 오수전환율 이후 초기화 setInftwtAnlsSn(0); // 초기화 }) @@ -100,15 +99,15 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const closePopup = () => { // 팝업 닫기 - selectInftwtAnlsRslt(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수분석 결과 조회 - const rsltData = getChartDataInftwtAnlsRslt(data ?? []); + fn.selectInftwtAnlsRslt(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수분석 결과 조회 + const rsltData = fn.getChartDataInftwtAnlsRslt(data ?? []); setChartData(prev => ({ ...prev, chartData1: rsltData // 침입수분석결과 })); }); - selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 - const rsltData = getChartDataOilq(data ?? []); + fn.selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 + const rsltData = fn.getChartDataOilq(data ?? []); setChartData(prev => ({ ...prev, chartData2: rsltData // 유량 From 13d58d1153848dff149329b75f01a837ccc1bfcf Mon Sep 17 00:00:00 2001 From: truthwing Date: Wed, 2 Jul 2025 14:19:38 +0900 Subject: [PATCH 104/259] =?UTF-8?q?=EB=B0=B0=ED=8F=AC=EC=8B=9C=20proxy=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index fb952385e..c7d32e005 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,6 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 3002 -NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 From f2167e69a3789dd922bc115ef9c5a53df788546c Mon Sep 17 00:00:00 2001 From: JIeunhuh Date: Wed, 2 Jul 2025 14:25:28 +0900 Subject: [PATCH 105/259] =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=96=B4=20=ED=94=BC?= =?UTF-8?q?=EC=B2=98=20=EC=84=A0=ED=83=9D=20=EC=8B=9C=20=ED=95=B4=EB=8B=B9?= =?UTF-8?q?=20=EC=8B=9C=EC=84=A4=EC=9D=98=20=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=8B=9C=EC=84=A4=20=ED=8C=9D=EC=97=85=20=ED=83=AD=EB=B3=84?= =?UTF-8?q?=EB=A1=9C=20=EB=82=98=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=9E=91?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/newWindowPopup.tsx | 55 +++++++++++++++++------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index a9f1f0326..e6438656d 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -2,12 +2,11 @@ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; import { excelDownload } from "@/components/lib/func/commom"; -import { Title, UiTable, UITab, ContentsDiv } from '@common/business_components'; +import { Title, UiTable, UITab } from '@common/business_components'; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import { Button } from "@common/components/ui"; import React, { useCallback, useState, useEffect } from 'react'; import NewWindowPortal from '@/app/map/newWindowPortal'; -import PbnstPrfmncSttnPopup from "@/app/map/pbnstPrfmncSttnPopup"; import { PbnstSttnModal } from "@/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal"; import type { WaterReuseFacility } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn/type"; import type { chgBuilding, customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; @@ -16,6 +15,7 @@ import RswtrPrfmncsSttnPopup from "@/app/map/rswtrPrfmncSttnPopup"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; import HtdflPrfmncSttnPopup from "@/app/map/htdflPrfmncSttnPopup"; import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; +import { getFetch } from "@/components/lib/api"; interface NewWindowPopupProps { featureData: any; @@ -24,13 +24,6 @@ interface NewWindowPopupProps { onClose: () => void; } -// 탭 -const TABS = [ - { val: "0", text: "재이용시설1" }, - { val: "1", text: "재이용시설2" }, - { val: "2", text: "재이용시설n" }, -]; - // 데이터의 속성(key)을 사용자에게 보여줄 한글 이름으로 변환하기 위한 맵 // 실제 데이터에 맞게 이 부분을 확장해야 합니다. const propertyNameMap: { [key: string]: string } = { @@ -47,7 +40,8 @@ const NewWindowPopup: React.FC = ({ checkedLayersData = [], onClose }) => { - const [activeTab, setActiveTab] = useState(TABS[0]?.val ?? "0"); + const [tabData, setTabData] = useState<{ id: string; name: string; data: any }[]>([]); + const [activeTab, setActiveTab] = useState('0'); // swcho : useState의 true, false 값 변경하여 목록, 상태 테스트 하였음 const [showDetailView, setShowDetailView] = useState(true); // 상세정보 화면 표시 상태 추가 @@ -108,9 +102,6 @@ const NewWindowPopup: React.FC = ({ return null; } - // 2. RuseMngTable에 필요한 tableData를 생성합니다. (단일 행 데이터) - // 선택된 피쳐 데이터 속성값 - // 물재이용시설 cellClick 이벤트 (상세정보) const pbnstCellClick = (index: number | undefined) => { if ( @@ -127,17 +118,34 @@ const NewWindowPopup: React.FC = ({ // setBdstTable(pbnstSttn.pbnstSttnRes); // }, [pbnstSttn.pbnstSttnRes]); + // 재이용시설 조회 + const fetchpbnstDetail = async (featureCd: string) => { + try { + const response = await getFetch("wr", `/reuseFc/pubFc/${featureCd}`); + // 중복 데이터 추가 방지 + setTabData((prev) => { + if (prev.some((tab) => tab.id === featureCd)) { + return prev; // 이미 존재하는 탭이면 추가하지 않음 + } + console.log('탭 idx',prev, prev.length) + return [...prev, { id: featureCd, name: `재이용시설 ${prev.length + 1}`, data: response }]; + }); + } catch (error) { + console.error("Error fetching data:", error); + } + }; useEffect(() => { if (featureData) { const selectedVal = featureData.getProperties(); - const featureCd = selectedVal?.swtrmt_fclt_cd + '1'; - + const featureCd = selectedVal?.swtrmt_fclt_cd; if (featureCd && featureCd !== pbnstRuseFcltPk) { setPbnstRuseFcltPk(featureCd); // 현재 호출된 featureCd 저장 - getPbnStnDetail(featureCd); + setActiveTab(featureCd) + fetchpbnstDetail(featureCd); // 상세정보 가져오기 } } }, [featureData]); + useEffect(() => { if (pbnstSttn.pbnstDetail) { setPbnDetaileData({ @@ -198,7 +206,8 @@ const NewWindowPopup: React.FC = ({ const hasWaterTreatmentLayer = checkedLayersData.some(layer => layer.data?.lyrNm?.includes('하수처리') || layer.data?.lyrNm?.includes('재이용시설') ); - + const actTabData = tabData.find((tab) => tab.id === activeTab); + // swcho : true, false 값 변경하여 시설 변경하여 테스트하였음 // 재이용시설 const isPbnst = true; @@ -223,17 +232,17 @@ const NewWindowPopup: React.FC = ({
({ - value: tab.val, - label: tab.text, - onClick: () => setActiveTab(tab.val), + defaultValue={activeTab} + tabList={tabData.map((tab) => ({ + value: tab.id, + label: tab.name, + onClick: () => setActiveTab(tab.id), }))} children={undefined} />
From f6f03a62cb233ac0000e76899675bfca7c2ae4de Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 2 Jul 2025 14:27:33 +0900 Subject: [PATCH 106/259] =?UTF-8?q?=EC=9A=B0=EB=A6=AC=EB=8F=99=EB=84=A4?= =?UTF-8?q?=EA=B0=80=EB=AD=84=20=EC=8B=9C=EB=8F=84=20=EC=8B=9C=EA=B5=B0?= =?UTF-8?q?=EA=B5=AC=20selectBox=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= =?UTF-8?q?,=20=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4=EC=A0=81=ED=98=84?= =?UTF-8?q?=ED=99=A9=20=EC=B0=A8=ED=8A=B8=20=EC=83=89=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMng/drgtSttn/page.tsx | 41 ++++-- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 122 +++++++++++------- 2 files changed, 105 insertions(+), 58 deletions(-) diff --git a/apps/wr/app/matMng/coMng/drgtSttn/page.tsx b/apps/wr/app/matMng/coMng/drgtSttn/page.tsx index 317e05dc6..55dbeb454 100644 --- a/apps/wr/app/matMng/coMng/drgtSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/drgtSttn/page.tsx @@ -53,8 +53,7 @@ export default function DrgtSttn() { useEffect(() => { let resData = Array.isArray(drgtRes) ? drgtRes : [drgtRes]; resData = resData.map((item) => { - console.log("item", item); - if(item.sggNm === '세종시'){ + if (item.sggNm === '세종시') { return { ...item, ctpvCd: '세종특별자치시', @@ -64,7 +63,7 @@ export default function DrgtSttn() { return { ...item, - ctpvCd: code.cityCd.find(ct => (ct.text == item.sggNm || (code.sggCd.find(sgg => sgg.text == item.sggNm)?.val.substring(0,2) == ct.val)))?.text, + ctpvCd: code.cityCd.find(ct => (ct.text == item.sggNm || (code.sggCd.find(sgg => sgg.text == item.sggNm)?.val.substring(0, 2) == ct.val)))?.text, sggNm: code.sggCd.find(sgg => sgg.text == item.sggNm)?.text } }) @@ -91,13 +90,24 @@ export default function DrgtSttn() { }, [drgtMoRes]); const getSelCity = (val: string | number) => { - const cityValue = String(val); // Ensure val is treated as a string - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: "" }); + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setSelectedSgg(''); + setObjSearch({ city: cityValue, sgg: '' }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setSelectedSgg(firstSggVal); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } }; const getSgg = (val: string | number) => { + setSelectedSgg(String(val)); setObjSearch({ ...objSearch, sgg: String(val) }); }; @@ -191,13 +201,24 @@ export default function DrgtSttn() { sggText = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? ''; } else { sggText = code.sggCd.filter((item) => item.val.substring(0, 2) === objSearch?.city).map((item) => item.text); - + } + if (sidoText === '전체') { sidoText = '' } + if (sidoText === '세종특별자치시') { sidoText = '세종시'; sggText = sidoText; } - drgtSearch(fromDate ?? "", toDate ?? "", [sidoText, ...sggText]) + + const searchArr = []; + if (sidoText) searchArr.push(sidoText); + if (Array.isArray(sggText)) { + searchArr.push(...sggText); + } else if (sggText) { + searchArr.push(sggText); + } + + drgtSearch(fromDate ?? "", toDate ?? "", searchArr) }} > 조회 @@ -246,7 +267,7 @@ export default function DrgtSttn() { setDrgtModal({ ...drgtModal, isOpen: !drgtModal.isOpen }); }} bodyClass={"w-[50vw] max-w-none h-[80vh]"} - body={} + body={} /> diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index a50c08071..f689eb745 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -8,9 +8,11 @@ import { excelDownload, yearOptions } from "@/components/lib/func/commom"; import SearchInputText from "@/components/ui/searchInput/searchInput"; import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button, Label } from "@common/components/ui"; +import { Button, Label, Table, TableBody, TableHeader } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import toast, { Toaster } from "react-hot-toast"; +import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead"; +import { InputTableBody } from "@/components/lib/func/TableData"; export default function PbnstPrfmncSttn() { const { @@ -34,9 +36,9 @@ export default function PbnstPrfmncSttn() { const [swtrmtFcltNm, setSwtrmtFcltNm] = useState(); const [pbnRuseNm, setPbnRuseNm] = useState(""); - const [searchYear, setSearchYear] = useState( - String(new Date().getFullYear()) - ); + const [searchYear, setSearchYear] = useState( + String(new Date().getFullYear()) + ); const [excelData, setExcelData] = useState([]); const excelClick = useCallback(() => { excelDownload( @@ -83,15 +85,20 @@ export default function PbnstPrfmncSttn() { type lineChartDataProps = { label: string, val: number, color: string }; const prfTableData = (prfList: PrfType[], year: string) => { - const inUsageData = structuredClone(initValInUsage); - const outUsageData = structuredClone(initValOutUsage); - - const inSubtotal = structuredClone(subTotalObj); - const outSubtotal = structuredClone(subTotalObj); + const inUsageData = structuredClone(initValInUsage).map(row => ({ + ...row, + 구분: "장내용수", + })); + const outUsageData = structuredClone(initValOutUsage).map(row => ({ + ...row, + 구분: "장외용수", + })); + const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" }; + const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" }; const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year) if (prfList && prfFilter.length > 0) { - + prfList?.forEach((prfItem) => { const month = Number(prfItem?.ym?.slice(4)); // "MM" const monthKey = `${month}월`; @@ -142,7 +149,7 @@ export default function PbnstPrfmncSttn() { setPrfData([]); } } - + const [chartId, setChartId] = useState(); useEffect(() => { // 누적 변수 초기화 @@ -198,8 +205,8 @@ export default function PbnstPrfmncSttn() { prfTableData([], year) rawData.forEach((item) => { // 실적 테이블 데이터 - if (chartId){ - if(item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltFk === chartId){ + if (chartId) { + if (item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltFk === chartId) { prfTableData(item.prfList, year); } item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltFk === chartId).forEach((element) => { @@ -265,40 +272,40 @@ export default function PbnstPrfmncSttn() { }); // 도넛차트 데이터 - dnData.push({ label: "세척수", val: wshwtr, fill: "red" }); - dnData.push({ label: "냉각수", val: coolUswtr, fill: "orange" }); - dnData.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }); - dnData.push({ label: "식수대", val: drwtUswtr, fill: "green" }); - dnData.push({ label: "희석용수", val: dltnUswtr, fill: "skyblue" }); - dnData.push({ label: "중수도", val: ithlRswtr, fill: "blue" }); - dnData.push({ label: "기타", val: ithlEtcUswtr, fill: "purple" }); - dnData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "red" }); - dnData.push({ label: "세척살수용수", val: resn, fill: "orange" }); - dnData.push({ label: "조경용수", val: lndwtr, fill: "yellow" }); - dnData.push({ label: "친수용수", val: hydUswtr, fill: "green" }); - dnData.push({ label: "지하수충전", val: ugwtChr, fill: "skyblue" }); - dnData.push({ label: "농업용수", val: farmUswtr, fill: "blue" }); - dnData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "purple" }); - dnData.push({ label: "공업용수", val: indstUswtr, fill: "black" }); + dnData.push({ label: "세척수", val: wshwtr, fill: "#F7CFD8" }); + dnData.push({ label: "냉각수", val: coolUswtr, fill: "#F4F8D3" }); + dnData.push({ label: "청소수", val: cleanUswtr, fill: "#A6D6D6" }); + dnData.push({ label: "식수대", val: drwtUswtr, fill: "#8E7DBE" }); + dnData.push({ label: "희석용수", val: dltnUswtr, fill: "#FF8383" }); + dnData.push({ label: "중수도", val: ithlRswtr, fill: "#FFF574" }); + dnData.push({ label: "기타", val: ithlEtcUswtr, fill: "#A1D6CB" }); + dnData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); + dnData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); + dnData.push({ label: "조경용수", val: lndwtr, fill: "#81BFDA" }); + dnData.push({ label: "친수용수", val: hydUswtr, fill: "#F5F0CD" }); + dnData.push({ label: "지하수충전", val: ugwtChr, fill: "#FADA7A" }); + dnData.push({ label: "농업용수", val: farmUswtr, fill: "#A6AEBF" }); + dnData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "#C5D3E8" }); + dnData.push({ label: "공업용수", val: indstUswtr, fill: "#D0E8C5" }); // 장내용수 도넛 - dnInData.push({ label: "세척수", val: wshwtr, fill: "yellow" }); - dnInData.push({ label: "냉각수", val: coolUswtr, fill: "green" }); - dnInData.push({ label: "청소수", val: cleanUswtr, fill: "yellow" }); - dnInData.push({ label: "식수대", val: drwtUswtr, fill: "green" }); - dnInData.push({ label: "희석용수", val: dltnUswtr, fill: "yellow" }); - dnInData.push({ label: "중수도", val: ithlRswtr, fill: "green" }); - dnInData.push({ label: "기타", val: ithlEtcUswtr, fill: "yellow" }); - dnInData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "green" }); - dnInData.push({ label: "세척살수용수", val: resn, fill: "yellow" }); + dnInData.push({ label: "세척수", val: wshwtr, fill: "#F7CFD8" }); + dnInData.push({ label: "냉각수", val: coolUswtr, fill: "#F4F8D3" }); + dnInData.push({ label: "청소수", val: cleanUswtr, fill: "#A6D6D6" }); + dnInData.push({ label: "식수대", val: drwtUswtr, fill: "#8E7DBE" }); + dnInData.push({ label: "희석용수", val: dltnUswtr, fill: "#FF8383" }); + dnInData.push({ label: "중수도", val: ithlRswtr, fill: "#FFF574" }); + dnInData.push({ label: "기타", val: ithlEtcUswtr, fill: "#A1D6CB" }); + dnInData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); + dnInData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); // 장외용수 도넛 - dnOutData.push({ label: "조경용수", val: lndwtr, fill: "yellow" }); - dnOutData.push({ label: "친수용수", val: hydUswtr, fill: "black" }); - dnOutData.push({ label: "지하수충전", val: ugwtChr, fill: "yellow" }); - dnOutData.push({ label: "농업용수", val: farmUswtr, fill: "black" }); - dnOutData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "yellow" }); - dnOutData.push({ label: "공업용수", val: indstUswtr, fill: "black" }); + dnOutData.push({ label: "조경용수", val: lndwtr, fill: "#81BFDA" }); + dnOutData.push({ label: "친수용수", val: hydUswtr, fill: "#F5F0CD" }); + dnOutData.push({ label: "지하수충전", val: ugwtChr, fill: "#FADA7A" }); + dnOutData.push({ label: "농업용수", val: farmUswtr, fill: "#A6AEBF" }); + dnOutData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "#C5D3E8" }); + dnOutData.push({ label: "공업용수", val: indstUswtr, fill: "#D0E8C5" }); // 라인차트 데이터 setInLineData({ @@ -466,7 +473,7 @@ export default function PbnstPrfmncSttn() { useEffect(() => { setbdstTable(prfmncRes); - if(prfmncRes?.[0]?.pbnstRuseFcltPk) setChartId(prfmncRes[0].pbnstRuseFcltPk) + if (prfmncRes?.[0]?.pbnstRuseFcltPk) setChartId(prfmncRes[0].pbnstRuseFcltPk) }, [prfmncRes]); @@ -619,12 +626,12 @@ export default function PbnstPrfmncSttn() {

하수재이용실적 현황

- -
+ {/* */} + {/*

{"하수처리수재이용 실적(m3) 등록결과"}

-
+
*/} -
+ + {/* + +
+

+ {"하수처리수재이용 실적(m3) 등록결과"} +

+
+ + + + {headMakeprfmnc(monthHeadList, [])} + + + {InputTableBody(prfData ?? [], monthHeadList, setPrfData)} + +
+
+
*/} + {/* */}
From c50c2685c1df40e19b1b0f32534f72eb23fcfe71 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 2 Jul 2025 14:30:18 +0900 Subject: [PATCH 107/259] =?UTF-8?q?=EC=9E=A0=EC=9E=AC=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=B2=98=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=88=98?= =?UTF-8?q?=EC=A0=95,=20=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wr/app/matMng/coMng/ldrmntCoSttn/page.tsx | 73 ++++++++++++------- .../app/store/matDmd/ldrmntCoSttn/excel.tsx | 26 ++----- .../app/store/matDmd/ldrmntCoSttn/index.tsx | 67 ++++++++++------- .../coReg/coRegExcel/coRegExcelModal.tsx | 24 +++--- 4 files changed, 104 insertions(+), 86 deletions(-) diff --git a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx index c5daee29c..eb43b29bf 100644 --- a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx @@ -44,7 +44,7 @@ export default function LdrmntCoSttn() { const [searchTxt, setSearchTxt] = useState(); const ref = useRef({} as ReturnType); const [excelData, setExcelData] = useState(); - + const [isExcelDownload, setIsExcelDownload] = useState(false); const excelClick = useCallback(() => { excelDownload( @@ -57,14 +57,22 @@ export default function LdrmntCoSttn() { }, []); const excelDownloadClick = () => { - downloadExcel({ - data: excelData ?? [], - fileName: "잠재수요처 관리", - sheetNameArray: ["Sheet1"], - headerRange: "A1:F1" - }) + ldrmntSearch(1, "10000", "0", ""); + setIsExcelDownload(true); } + useEffect(() => { + if (isExcelDownload && excelData && excelData.length > 0) { + downloadExcel({ + data: excelData, + fileName: "잠재수요처 관리", + sheetNameArray: ["Sheet1"], + headerRange: "A1:F1" + }); + setIsExcelDownload(false); + } + }, [excelData, isExcelDownload]); + const [isExcelOpen, setIsExcelOpen] = useState<{ isModal: boolean; }>({ isModal: false }); @@ -73,14 +81,21 @@ export default function LdrmntCoSttn() { if (index !== undefined) { setDetailModal({ isOpen: true, data: ldrmntRes[index] }); } - } const getSelCity = (val: string | number) => { - const cityValue = String(val); // Ensure val is treated as a string - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: '' }); + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setObjSearch({ city: cityValue, sgg: "" }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } }; const getSgg = (val: string | number) => { @@ -125,10 +140,9 @@ export default function LdrmntCoSttn() { setExcelData(data) }, [excelList]) - useEffect(() => { - let cityTxt = ''; - let sggTxt = ''; + let cityTxt = '' + let sggTxt = '' if (objSearch?.city.toString().length > 0) { cityTxt = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? ''; @@ -138,21 +152,23 @@ export default function LdrmntCoSttn() { sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? ''; } - let cityNm = ""; + if (cityTxt === '전체' || cityTxt === '') { + cityTxt = '0' + } + + let cityNm = "" if (sggTxt !== "0") { - cityNm = cityTxt + " " + sggTxt; + cityNm = cityTxt + " " + sggTxt } else { - cityNm = cityTxt; + cityNm = cityTxt } - if (cityNm) { - if (cityTxt === '') cityNm = "0"; - ldrmntSearch(pageNation, cityNm, searchTxt || ""); + ldrmntSearch(pageNation, '20', cityNm, searchTxt || ""); } else { - ldrmntSearch(pageNation, "", searchTxt || ""); + ldrmntSearch(pageNation, '20', '0', searchTxt || ""); } - }, [pageNation, objSearch, code, searchTxt, ldrmntSearch]) + }, [pageNation]); return ( <> @@ -175,6 +191,7 @@ export default function LdrmntCoSttn() { label="시군구" selectClass={""} selectArray={selectSgg || []} + value={objSearch.sgg} // value props 추가 onSelectValue={getSgg} /> -
+
- + onClick={() => { + initHtdfl(searchTxt || ""); + }} + > + 조회 + +
@@ -126,41 +127,49 @@ export default function Home() { pageSize={100} total={10} headName={"건축물 목록"} - cellClick={(val, headId) => { cellClick(val || undefined, headId); } } + cellClick={(val, headId) => { + cellClick(val || undefined, headId); + }} onPageChange={setPageNation} - > - + >
- - - - + + + +
- } - bodyClass="w-[68vw] max-w-none h-[90vh]" - open={issNewReg} - onOpenChange={(open) => { - setIsNewReg(open); - }} - /> - - + } + bodyClass="w-[68vw] max-w-none h-[90vh]" + open={issNewReg} + onOpenChange={(open) => { + setIsNewReg(open); + }} + /> + + {/* } + body={ + + } onOpenChange={(open) => { setBdstChgProps({ ...bdstChgProps, isOpen: open }); - } - } - /> + }} + /> */} ); diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx index d57c730ce..ea0dea649 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx @@ -151,7 +151,7 @@ export default function Home() {
} + body={} bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { diff --git a/apps/wr/app/store/common/code/basicCode.tsx b/apps/wr/app/store/common/code/basicCode.tsx new file mode 100644 index 000000000..56c59b502 --- /dev/null +++ b/apps/wr/app/store/common/code/basicCode.tsx @@ -0,0 +1,204 @@ +import type { SelectDataType } from "@common/business_components"; + +export const yn: SelectDataType[] = [ + { val: "Y", text: "Y" }, + { val: "N", text: "N" }, +]; +export const bdstFilterYn: SelectDataType[] = [ + { val: "Y", text: "Y" }, + { val: "N", text: "N" }, + { val: "D", text: "확인불가" }, + { val: "F", text: "미가동" }, +]; +// 최우수(그린1)/우수(그린2), 우량(그린3), 일반(그린4), 확인불가 체크 +export const bdstGrntchClass: SelectDataType[] = [ + { val: "최우수(그린1)", text: "최우수(그린1)" }, + { val: "우수(그린2)", text: "우수(그린2)" }, + { val: "우량(그린3)", text: "우량(그린3)" }, + { val: "일반(그린4)", text: "일반(그린4)" }, + { val: "확인불가", text: "확인불가" }, +]; +export const bdstIncenYn: SelectDataType[] = [ + { val: "Y", text: "Y" }, + { val: "N", text: "N" }, + { val: "D", text: "확인불가" }, +]; +//처리장연계/자체+연계/자체처리 +export const erctUswtrPrcsMeth: SelectDataType[] = [ + { val: "처리장연계", text: "처리장연계" }, + { val: "자체+연계", text: "자체+연계" }, + { val: "자체처리", text: "자체처리" }, +]; + +export const rusePrcsMthdCd: SelectDataType[] = [ + { val: "물리학적처리", text: "물리학적처리" }, + { val: "생물학적처리", text: "생물학적처리" }, +]; + +export const ruseSeCd: SelectDataType[] = [ + { val: "신규", text: "신규" }, + { val: "증설", text: "증설" }, + { val: "관로", text: "관로" }, + { val: "감량", text: "감량" }, + { val: "개량", text: "개량" }, +]; + +export const ruseBizMthdCd: SelectDataType[] = [ + { val: "재정", text: "재정" }, + { val: "민간투자", text: "민간투자" }, + { val: "자체", text: "자체" }, +]; + +//공통 건축물 용도 +export const bdstUsgCd: SelectDataType[] = [ + { val: "-1", text: "확인불가" }, + { val: "1", text: "운동장" }, + { val: "2", text: "체육관" }, + { val: "3", text: "공공업무시설" }, + { val: "4", text: "공공기관의청사" }, + { val: "5", text: "아파트" }, + { val: "6", text: "연립주택" }, + { val: "7", text: "다세대주택" }, + { val: "8", text: "기숙사" }, + { val: "9", text: "초등학교" }, + { val: "10", text: "중학교" }, + { val: "11", text: "고등학교" }, + { val: "12", text: "전문대학" }, + { val: "13", text: "대학및대학교" }, + { val: "14", text: "골프장" }, + { val: "15", text: "대규모점포" }, + { val: "16", text: "기타" }, +]; + +export const rswtBdstType: SelectDataType[] = [ + { text: "숙박업", val: "17" }, + { text: "목욕장업", val: "18" }, + { text: "공장", val: "19" }, + { text: "발전시설", val: "20" }, + { text: "관광단지개발사업", val: "21" }, + { text: "도시개발사업", val: "22" }, + { text: "산업단지개발사업", val: "23" }, + { text: "택지개발사업", val: "24" }, + { text: "대규모점포(대형마트)", val: "25" }, + { text: "대규모점포(전문점)", val: "26" }, + { text: "대규모점포(백화점)", val: "27" }, + { text: "대규모점포(쇼핑센터)", val: "28" }, + { text: "대규모점포(복합쇼핑몰)", val: "29" }, + { text: "물류시설", val: "30" }, + { text: "운수시설(여객자동차터미널)", val: "31" }, + { text: "운수시설(철도시설)", val: "32" }, + { text: "운수시설(공항시설)", val: "33" }, + { text: "운수시설(항만시설)", val: "34" }, + { text: "업무시설(공공업무시설)", val: "35" }, + { text: "업무시설(금융업소)", val: "36" }, + { text: "업무시설(사무소)", val: "37" }, + { text: "업무시설(결혼상담소 등 소개업소)", val: "38" }, + { text: "업무시설(출판사)", val: "39" }, + { text: "업무시설(신문사)", val: "40" }, + { text: "업무시설(오피스텔)", val: "41" }, + { text: "교정시설", val: "42" }, + { text: "방송국", val: "43" }, + { text: "전신전화국", val: "44" }, + { text: "기타", val: "45" }, +]; + +export const orgwtKndCd = [ + { text: "오수(변기 오수 제외)", val: "1" }, + { text: "오수", val: "2" }, + { text: "폐수", val: "3" }, + { text: "오수 및 폐수", val: "4" }, + { text: "기타", val: "5" }, +]; + +export const chBuCd = [ + { val: "증축", text: "증축" }, + { val: "개축", text: "개축" }, + { val: "재축", text: "재축" }, +]; + +export const dmdUszCd = [ + { val: "조경용수", text: "조경용수" }, + { val: "청소화장실용수", text: "청소화장실용수" }, + { val: "농업용수", text: "농업용수" }, + { val: "공업용수", text: "공업용수" }, + { val: "친수용수", text: "친수용수" }, + { val: "기타", text: "기타" }, +]; + +export const ruseMngMtd = [ + { val: "자체운영", text: "자체운영" }, + { val: "공기업", text: "공기업" }, + { val: "민간(대행)", text: "민간(대행)" }, +]; + +export const pplQulity = [ + { val: "도복장강관", text: "도복장강관" }, + { val: "PE관", text: "PE관" }, + { val: "스테인레스관", text: "스테인레스관" }, + { val: "덕타일주철관", text: "덕타일주철관" }, + { val: "유리섬유복합관", text: "유리섬유복합관" }, + { val: "기타", text: "기타" }, +]; +export const pplLenght = [ + { val: "D100", text: "D100" }, + { val: "D200", text: "D200" }, + { val: "D250", text: "D250" }, + { val: "D300", text: "D300" }, + { val: "D350", text: "D350" }, + { val: "D400", text: "D400" }, + { val: "D450", text: "D450" }, + { val: "D500", text: "D500" }, + { val: "D700", text: "D700" }, + { val: "D900", text: "D900" }, + { val: "D1000​", text: "D1000​" }, +]; + +export const rainFcltCd = [ + { val: "지붕", text: "지붕" }, + { val: "건물옥상", text: "건물옥상" }, + { val: "골프장 연못", text: "골프장 연못" }, + { val: "운동장 바닥", text: "운동장 바닥" }, + { val: "운동장 지붕", text: "운동장 지붕" }, + { val: "주차장", text: "주차장" }, + { val: "태양광패널", text: "태양광패널" }, + { val: "연못", text: "연못" }, + { val: "기타", text: "기타" }, + { val: "확인불가", text: "확인불가" }, +]; + +//물리화학적처리(스크린, 응집, 침전)/생물학적처리(활성슬러지법 등)/소독(염소, UV 등)/기타 +export const rswtPrscCdMthdCd = [ + { + val: "물리화학적처리(스크린,응집,침전)", + text: "물리화학적처리(스크린,응집,침전)", + }, + { + val: "생물학적처리(활성슬러지법 등)", + text: "생물학적처리(활성슬러지법 등)", + }, + { val: "소독(염소, UV 등)", text: "소독(염소, UV 등)" }, + { val: "기타", text: "기타" }, +]; + +export const htdPowerMthdCd= [ + { + val: "석탄화력발전", + text: "석탄화력발전", + }, +]; + +//(공업용수/양식장/농업용수) +export const htdUtztnUsgCd= [ + { + val: "공업용수", + text: "공업용수", + }, + { + val: "양식장", + text: "양식장", + }, + { + val: "농업용수", + text: "농업용수", + }, +]; diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index 17ea1f2e7..b3cf48603 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -1,236 +1,13 @@ import { getFetch } from "@/components/lib/api"; import type { EnvPartSelectDataType, SelectDataType } from "@common/business_components/ui"; - - - +import { bdstFilterYn, bdstGrntchClass, bdstIncenYn, bdstUsgCd, chBuCd, dmdUszCd, erctUswtrPrcsMeth, htdPowerMthdCd, htdUtztnUsgCd, orgwtKndCd, pplLenght, pplQulity, rainFcltCd, rswtPrscCdMthdCd, ruseBizMthdCd, ruseMngMtd, rusePrcsMthdCd, ruseSeCd, yn } from "./basicCode"; export const btnClass = "p-4 m-2 text-white rounded-sm text-lg font-medium " -const yn: SelectDataType[] = [ - { val: 'Y', text: 'Y' }, - { val: 'N', text: 'N' }, -] -const bdstFilterYn: SelectDataType[] = [ - { val: 'Y', text: 'Y' }, - { val: 'N', text: 'N' }, - { val: 'D', text: '확인불가' }, - { val: 'F', text: '미가동' }, -] -// 최우수(그린1)/우수(그린2), 우량(그린3), 일반(그린4), 확인불가 체크 -const bdstGrntchClass: SelectDataType[] = [ - { val: '최우수(그린1)', text: '최우수(그린1)' }, - { val: '우수(그린2)', text: '우수(그린2)' }, - { val: '우량(그린3)', text: '우량(그린3)' }, - { val: '일반(그린4)', text: '일반(그린4)' }, - { val: '확인불가', text: '확인불가' }, - -] -const bdstIncenYn: SelectDataType[] = [ - { val: 'Y', text: 'Y' }, - { val: 'N', text: 'N' }, - { val: 'D', text: '확인불가' }, -] -//처리장연계/자체+연계/자체처리 -const erctUswtrPrcsMeth : SelectDataType[]= [ - { val: '처리장연계', text: '처리장연계' }, - { val: '자체+연계', text: '자체+연계' }, - { val: '자체처리', text: '자체처리' }, -] - -const rusePrcsMthdCd : SelectDataType[] = [ - { val: '물리학적처리', text: '물리학적처리' }, - { val: '생물학적처리', text: '생물학적처리' }, -] - -const ruseSeCd : SelectDataType[] = [ - { val: '신규', text: '신규' }, - { val: '증설', text: '증설' }, - { val: '관로', text: '관로' }, - { val: '감량', text: '감량' }, - { val: '개량', text: '개량' }, -] - -const ruseBizMthdCd: SelectDataType[] = [ - { val: '재정', text: '재정' }, - { val: '민간투자', text: '민간투자' }, - { val: '자체', text: '자체' }, -] - -//공통 건축물 용도 -const bdstUsgCd: SelectDataType[] = [ - { val: '-1', text: "확인불가" }, - { val: '1', text: "운동장" }, - { val: '2', text: "체육관" }, - { val: '3', text: "공공업무시설" }, - { val: '4', text: "공공기관의청사" }, - { val: '5', text: "아파트" }, - { val: '6', text: "연립주택" }, - { val: '7', text: "다세대주택" }, - { val: '8', text: "기숙사" }, - { val: '9', text: "초등학교" }, - { val: '10', text: "중학교" }, - { val: '11', text: "고등학교" }, - { val: '12', text: "전문대학" }, - { val: '13', text: "대학및대학교" }, - { val: '14', text: "골프장" }, - { val: '15', text: "대규모점포" }, - { val: '16', text: "기타" }, -]; -//빗물 집수면 종류 용도 -// const rainFcltCd = [ -// { val: "1", text: "지붕" }, -// { val: "2", text: "건물옥상" }, -// { val: "3", text: "골프장 연못" }, -// { val: "4", text: "운동장 바닥" }, -// { val: "5", text: "운동장 지붕" }, -// { val: "6", text: "주차장" }, -// { val: "7", text: "태양광패널" }, -// { val: "8", text: "연못" }, -// { val: "9", text: "기타" }, -// { val: "10", text: "확인불가" }, -// ]; -// 중수도 필수 원수종류 -const rswtBdstType: SelectDataType[] = [ - { text: "숙박업", val: "17" }, - { text: "목욕장업", val: "18" }, - { text: "공장", val: "19" }, - { text: "발전시설", val: "20" }, - { text: "관광단지개발사업", val: "21" }, - { text: "도시개발사업", val: "22" }, - { text: "산업단지개발사업", val: "23" }, - { text: "택지개발사업", val: "24" }, - { text: "대규모점포(대형마트)", val: "25" }, - { text: "대규모점포(전문점)", val: "26" }, - { text: "대규모점포(백화점)", val: "27" }, - { text: "대규모점포(쇼핑센터)", val: "28" }, - { text: "대규모점포(복합쇼핑몰)", val: "29" }, - { text: "물류시설", val: "30" }, - { text: "운수시설(여객자동차터미널)", val: "31" }, - { text: "운수시설(철도시설)", val: "32" }, - { text: "운수시설(공항시설)", val: "33" }, - { text: "운수시설(항만시설)", val: "34" }, - { text: "업무시설(공공업무시설)", val: "35" }, - { text: "업무시설(금융업소)", val: "36" }, - { text: "업무시설(사무소)", val: "37" }, - { text: "업무시설(결혼상담소 등 소개업소)", val: "38" }, - { text: "업무시설(출판사)", val: "39" }, - { text: "업무시설(신문사)", val: "40" }, - { text: "업무시설(오피스텔)", val: "41" }, - { text: "교정시설", val: "42" }, - { text: "방송국", val: "43" }, - { text: "전신전화국", val: "44" }, - { text: "기타", val: "45" } -]; - -const orgwtKndCd = [ - { text: "오수(변기 오수 제외)", val: "1" }, - { text: "오수", val: "2" }, - { text: "폐수", val: "3" }, - { text: "오수 및 폐수", val: "4" }, - { text: "기타", val: "5" }, -]; - -const chBuCd = [ - { val: "증축", text: "증축" }, - { val: "개축", text: "개축" }, - { val: "재축", text: "재축" }, -] - - - -const dmdUszCd = [ - { val: "조경용수", text: "조경용수" }, - { val: "청소화장실용수", text: "청소화장실용수" }, - { val: "농업용수", text: "농업용수" }, - { val: "공업용수", text: "공업용수" }, - { val: "친수용수", text: "친수용수" }, - { val: "기타", text: "기타" }, - -] - -const ruseMngMtd = [ - { val: "자체운영", text: "자체운영" }, - { val: "공기업", text: "공기업" }, - { val: "민간(대행)", text: "민간(대행)" }, -] - - -const pplQulity = [ - { val: "도복장강관", text: "도복장강관" }, - { val: "PE관", text: "PE관" }, - { val: "스테인레스관", text: "스테인레스관" }, - { val: "덕타일주철관", text: "덕타일주철관" }, - { val: "유리섬유복합관", text: "유리섬유복합관" }, - { val: "기타", text: "기타" }, - -] -const pplLenght = [ - { val: "D100", text: "D100" }, - { val: "D200", text: "D200" }, - { val: "D250", text: "D250" }, - { val: "D300", text: "D300" }, - { val: "D350", text: "D350" }, - { val: "D400", text: "D400" }, - { val: "D450", text: "D450" }, - { val: "D500", text: "D500" }, - { val: "D700", text: "D700" }, - { val: "D900", text: "D900" }, - { val: "D1000​", text: "D1000​" }, - -] export const buildingType = { RST:"RST", RNB:"RNB", HTB:"HTB" } - -const rainFcltCd = [ - { val: "지붕", text: "지붕" }, - { val: "건물옥상", text: "건물옥상" }, - { val: "골프장 연못", text: "골프장 연못" }, - { val: "운동장 바닥", text: "운동장 바닥" }, - { val: "운동장 지붕", text: "운동장 지붕" }, - { val: "주차장", text: "주차장" }, - { val: "태양광패널", text: "태양광패널" }, - { val: "연못", text: "연못" }, - { val: "기타", text: "기타" }, - { val: "확인불가", text: "확인불가" }, -]; - -export type comCodeState = { - code: { - isInit: boolean; - chBuCd: SelectDataType[] - rainFcltCd: SelectDataType[]; - bdstUsgCd: SelectDataType[]; - cityCd: SelectDataType[]; - sggCd: SelectDataType[]; - rvbsnCd: SelectDataType[]; - mdmbsnCd: SelectDataType[]; - lgbsnCd: SelectDataType[]; - lclgvrnmntCd: EnvPartSelectDataType[]; - orgwtKndCd: SelectDataType[]; - yn: SelectDataType[]; - pplQulity: SelectDataType[]; - pplLenght: SelectDataType[]; - dmdUszCd:SelectDataType[] - buildingType: { - RST:string, - RNB:string, - HTB:string - } - ruseMngMtd:SelectDataType[] - ruseSeCd: SelectDataType[]; - ruseBizMthdCd: SelectDataType[]; - rusePrcsMthdCd: SelectDataType[]; - erctUswtrPrcsMeth: SelectDataType[]; - bdstFilterYn: SelectDataType[]; - bdstIncenYn: SelectDataType[]; - bdstGrntchClass:SelectDataType[]; - }; -}; - -export type comCodeType = comCodeState & comCodeActions; - export const getSggCd = async (set: any) => { const sgg = await getFetch("common", "/addr/sgg"); /* const sggCd = sgg.map((item: any) => ({ @@ -356,6 +133,47 @@ export const getEnvPartCd = async (set: any) => { + +export type comCodeState = { + code: { + isInit: boolean; + chBuCd: SelectDataType[] + rainFcltCd: SelectDataType[]; + bdstUsgCd: SelectDataType[]; + cityCd: SelectDataType[]; + sggCd: SelectDataType[]; + rvbsnCd: SelectDataType[]; + mdmbsnCd: SelectDataType[]; + lgbsnCd: SelectDataType[]; + lclgvrnmntCd: EnvPartSelectDataType[]; + orgwtKndCd: SelectDataType[]; + yn: SelectDataType[]; + pplQulity: SelectDataType[]; + pplLenght: SelectDataType[]; + dmdUszCd:SelectDataType[] + buildingType: { + RST:string, + RNB:string, + HTB:string + } + ruseMngMtd:SelectDataType[] + ruseSeCd: SelectDataType[]; + ruseBizMthdCd: SelectDataType[]; + rusePrcsMthdCd: SelectDataType[]; + erctUswtrPrcsMeth: SelectDataType[]; + bdstFilterYn: SelectDataType[]; + bdstIncenYn: SelectDataType[]; + bdstGrntchClass:SelectDataType[]; + rswtPrscCdMthdCd:SelectDataType[]; + htdPowerMthdCd:SelectDataType[] + htdUtztnUsgCd:SelectDataType[] + }; +}; + +export type comCodeType = comCodeState & comCodeActions; + + + export const comCodeStateExport: comCodeState = { code: { isInit: false, @@ -381,7 +199,10 @@ export const comCodeStateExport: comCodeState = { erctUswtrPrcsMeth:erctUswtrPrcsMeth, bdstFilterYn:bdstFilterYn, bdstIncenYn:bdstIncenYn, - bdstGrntchClass:bdstGrntchClass + bdstGrntchClass:bdstGrntchClass, + rswtPrscCdMthdCd:rswtPrscCdMthdCd, + htdPowerMthdCd:htdPowerMthdCd, + htdUtztnUsgCd:htdUtztnUsgCd, }, }; @@ -389,9 +210,6 @@ export type comCodeActions = { codeInit: () => void; }; - - - export const codeActionExport: (set: any) => comCodeActions = (set: any) => { return { codeInit: async () => { diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx index 931cd1305..418f4b45f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/bdstReg/index.tsx @@ -79,8 +79,9 @@ const isRswtBdst = (data: any): data is customRswtBdst =>{ data.reuseBuilding=chData; } - if(data?.chgBuilding.length>0){ - const chRgtr = data.chgBuilding.map((item) =>({...item, rgtr:TEST_UUID, mdfr: item.mdfr ?? null })) + + if('chgBuilding' in data && Array.isArray(data.chgBuilding) && data.chgBuilding.length > 0){ + const chRgtr = data.chgBuilding.map((item) =>({...item, rgtr:TEST_UUID, mdfr: item.mdfr ?? null })) data.chgBuilding =chRgtr; } return data; @@ -127,7 +128,7 @@ const isRswtBdst = (data: any): data is customRswtBdst =>{ data.reuseBuilding=chData; } - if(data?.chgBuilding.length>0){ + if('chgBuilding' in data && Array.isArray(data.chgBuilding) && data.chgBuilding.length > 0){ const chMdfr = data.chgBuilding.map((item) =>({...item, mdfr:TEST_UUID, archChgArea: item.archChgArea ?? '' })) data.chgBuilding =chMdfr; } diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/headList.tsx new file mode 100644 index 000000000..da1fa6f09 --- /dev/null +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/headList.tsx @@ -0,0 +1,10 @@ +import type { TableUpperProps } from "@/app/store/common/type/header"; + +export const htdTableHeadList: TableUpperProps[] = [ + { id: "cityText", title: "시도" }, + { id: "sggText", title: "시군구" }, + { id: "bdstNm", title: "발전소명" }, + { id: "daddr", title: "위치" }, + { id: "frstArchPrmsnDt", title: "준공년도" }, + { id: "archArea", title: "건축면적" }, +]; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index 314d5762b..f2875e232 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -6,9 +6,12 @@ import { makeMdfr, makeRstr } from "../bdstReg"; import { baseReuseBuildingSchema, chgBuildingSchema, + htdflReuseBuildingSchema, validationMessages, } from "../rainReg/type"; // Import baseReuseBuildingSchema, chgBuildingSchema, validationMessages import type { TableUpperProps } from "@/app/store/common/type/header"; +import { htdTableHeadList } from "./headList"; +import toast from "react-hot-toast"; const hdtflObjSchema = z.object({ htdflFcltPk: z.number().nullish(), @@ -21,8 +24,8 @@ const hdtflObjSchema = z.object({ .positive({ message: validationMessages.required("시설 용량") }), plwtYn: z.enum(["Y", "N"]).default("Y"), orgwtWtritSpt: z - .number() - .positive({ message: validationMessages.required("원수 취수량") }), + .string() + .min(1, { message: validationMessages.required("원수 취수 지점") }), orgwtOcrnProcs: z .string() .min(1, { message: validationMessages.required("원수 발생 공정") }), @@ -53,7 +56,9 @@ const hdtflObjSchema = z.object({ ph: z.number().default(0), // Measurements, 0 is fine as default clIonQnt: z.number().default(0), // Measurements, 0 is fine as default cdtnv: z.number().default(0), // Measurements, 0 is fine as default - emsnExitTp: z.number().default(0), // Measurements, 0 is fine as default + emsnExitTp: z.number() + .max(100, { message: "온도는 100이상이 될 수 없습니다." }) + .default(0), // Changed max to 100 based on message, // Measurements, 0 is fine as default rgtr: z.string().nullish().default(null), mdfr: z.string().nullish().default(null), }); @@ -77,16 +82,15 @@ export const hdtflZod = z.object({ mdfr: z.string().nullish().default(null), reuseBuilding: z .array( - baseReuseBuildingSchema.extend({ + htdflReuseBuildingSchema.extend({ htdflObj: hdtflObjSchema, }) ) .default([]), - chgBuilding: z.array(chgBuildingSchema).default([]), // Use imported chgBuildingSchema + //온배수는 건축물은 등록 하는것이 다름 + // chgBuilding: z.array(chgBuildingSchema).nullish(), // Use imported chgBuildingSchema }); - export type customHtdflBdst = z.infer; - export type htdflFacState = { htdfl: { isInit: boolean; @@ -104,18 +108,16 @@ type htdflFacSActions = { const htdflRes: customHtdflBdst[] = []; export type htdflFacType = htdflFacState & htdflFacSActions; - export const htdflFacStateExport: htdflFacState = { htdfl: { isInit: false, - upHeadList: upHeadList, + upHeadList: htdTableHeadList, htdflRes: htdflRes, }, }; const initFetch = async (code: string | number) => { - const rswtRes = await getFetch("wr", `/facilityList/1/20/${code}`); - + const rswtRes = await getFetch("wr", `/drain/facilityList/1/20/${code}`); return rswtRes; }; export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( @@ -128,8 +130,6 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( "wr", `/drain/facilityList/${pageNation}/20/${code}` ); - console.log(pageNation); - // 여기서 상태 업데이트 return set((state: htdflFacState) => ({ ...state, htdfl: { @@ -142,7 +142,6 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( console.log(e); } }, - initHtdfl: async (code: string) => { try { const htdflRes = await initFetch(code); @@ -162,10 +161,15 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( }, htdflBdstUpdate: async (data: customHtdflBdst, code: string | number) => { try { + + console.log('data ', data) + const chData = await makeMdfr(data); - const res = await putFectch("/drain/facility", data); + console.log('chData ', chData) + + const res = await putFectch("/drain/facility", chData); if (res.ok) { - alert(" 수정이 완료되었습니다."); + toast.success("온배수 건축물 수정이 완료되었습니다."); } const htdflRes = await initFetch(code); @@ -178,40 +182,18 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( }, })); } catch (errorUpdate) { - alert( - "업데이트 오류입니다. " + - (errorUpdate instanceof Error ? errorUpdate.message : "") - ); + toast.error("온배수 건축물 수정 오류입니다.."); } }, htdflBdstReg: async (data: customHtdflBdst, code: string | number) => { try { - const chData = await makeRstr(data); - const res = await postFectch("/drain/facility", data); - if (res.ok) { - if (data.chgBuilding.length > 0) { - await res - .json() - .then((resData: any) => { - const chPK = resData?.data?.bdstInfoPk; - - const makeCh = resData.data.chgBuilding.map( - (item: chgBuilding) => ({ - ...item, - bdstInfoFk: chPK, - }) - ); - const chch = postFectch("/reuseFc/chgBuilding", makeCh); - return chch; - }) - .then((chch: any) => { - if (chch.ok) { - alert("등록이 완료되었습니다."); - } - }); - } else { - alert("등록이 완료되었습니다."); - } + // data는 단일 객체이므로 .map을 사용할 수 없습니다. + // 등록 시에는 건축물 변경 이력이 없으므로 chgBuilding을 빈 배열로 설정하고, + // API가 배열을 기대하므로 단일 객체를 배열로 감싸줍니다. + const chData = makeRstr(data); + const res = await postFectch("/drain/facility", chData); + if (res.status ===200) { + toast.success("온배수 건축물 등록이 완료되었습니다."); } const htdflRes = await initFetch(code); set((state: htdflFacState) => ({ @@ -223,8 +205,9 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( }, })); } catch (errorReg) { - alert("등록 오류입니다."); + toast.error("온배수 건축물 등록 오류입니다.."); + } - }, + } }; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx index 59d6633a2..2d17b4601 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx @@ -25,8 +25,7 @@ export const baseReuseBuildingSchema = z.object({ { message: validationMessages.yearFormat, } - ) - .nullish(), + ), grntchBdstCertNo: z.string().default(""), grntchBdstCertGrd: z.string().default(""), crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값 @@ -52,3 +51,40 @@ export const chgBuildingSchema = z.object({ rgtr:z.string().nullish(), mdfr:z.string().nullish(), }); + + + +export const htdflReuseBuildingSchema = z.object({ + bdstRuseFcltPk: z.number().nullish(), + bdstInfoFk: z.number().nullish(), + instlCmptnDt: z.coerce.date().default(() => new Date()), + instlCst: z.number().nullish(), + operMngCd: z.string().optional().nullish(), + anlOperCst: z.number().default(0), + instlCstSprtYn: z.string().default("Y"), + instlCstSprtAmt: z.number().nullish(), + grntchBdstCertYn: z.string().default("Y"), + grntchBdstCertYr: z + .string() + .max(4, { message: validationMessages.yearFormat }) + .refine( + (year) => year.length === 0 || /^\d{4}$/.test(year), + { + message: validationMessages.yearFormat, + } + ) + .nullish(), + grntchBdstCertNo: z.string().default(""), + grntchBdstCertGrd: z.string().default(""), + crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값 + crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값 + crgRdctAmt: z.number().default(0), // 안쓰는 값 + ruseFcltFlg: z.string().default(""), + bdstUsgCd: z.number().default(0).nullish(), + lawTrgtYn: z.string().default("Y").nullish(), + rgtr: z.string().nullish(), + mdfr: z.string().nullish(), +}); + + + diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index c1bf7e2ca..8ae9ad4dd 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -16,10 +16,10 @@ import { type SelectDataType, } from "@common/business_components"; import { Button, Checkbox, Input } from "@common/components"; -import { useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useFieldArray } from "react-hook-form"; -export default function BdstReg({ form }: { form: any }) { +export default function BdstReg({ form, type }: { form: any; type?: string }) { const { code } = useWrStore((state) => { return state; }); @@ -37,16 +37,15 @@ export default function BdstReg({ form }: { form: any }) { }); }; const removeSelected = () => { - const idxsToRemove = fields - .map((item, idx) => selectedIds.includes(item.id) ? idx : -1) - .filter(index => index > -1) - .sort((prevIndex, nextIndex) => nextIndex - prevIndex); + const idxsToRemove = fields + .map((item, idx) => (selectedIds.includes(item.id) ? idx : -1)) + .filter((index) => index > -1) + .sort((prevIndex, nextIndex) => nextIndex - prevIndex); remove(idxsToRemove); setSelectedIds([]); }; - const [selectSgg, setSelectSgg] = useState(); const [objSearch, setObjSearch] = useState({ sgg: "", @@ -83,18 +82,14 @@ export default function BdstReg({ form }: { form: any }) { const [selectedIds, setSelectedIds] = useState([]); const toggleSelect = (id: string) => { - setSelectedIds(prev => - prev.includes(id) - ? prev.filter(x => x !== id) - : [...prev, id] + setSelectedIds((prev) => + prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id] ); }; return ( <> -

- 건축물 기본 정보 -

+

건축물 기본 정보

-
- ( - - { - field.onChange(Number(val)); - }} - value={field.value??code.bdstUsgCd[0]?.val} - /> - - )} - /> -
+
field.onChange(date), }} - selectClass={'w-full'} + selectClass={"w-full"} > )} />
-
- ( - - { - handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - /> - - )} - /> -
-
- ( - - { - field.onChange(val); - }} - value={field.value??code.yn[0]?.val } - /> - - )} - /> -
-

- 중축, 개축, 재축 -

-
- - -
- {fields.map((field, index) => ( -
-
- toggleSelect(field.id)} - /> -
-
- ( - - f.onChange(val)} - value={f.value ?? code.chBuCd[0]?.val} className={""} label={""} /> - - )} - /> -
-
- ( - - f.onChange(date), - }} - selectClass="w-full" + {type !== "HTB" ? ( + <> +
+
+ ( + + { + field.onChange(Number(val)); + }} + value={field.value ?? code.bdstUsgCd[0]?.val} + /> + + )} + /> +
+ +
+ ( + + { + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + /> + + )} + /> +
+
+ ( + + { + field.onChange(val); + }} + value={field.value ?? code.yn[0]?.val} + /> + + )} + /> +
+
+

중축, 개축, 재축

+
+ + +
+ {fields.map((field, index) => ( +
+
+ toggleSelect(field.id)} /> - - )} - /> -
-
- ( - - f.onChange} - value={f.value} - className={selectClass} +
+
+ ( + + f.onChange(val)} + value={f.value ?? code.chBuCd[0]?.val} + className={""} + label={""} + /> + + )} /> - - )} - /> -
-
- ))} -
+
+
+ ( + + f.onChange(date), + }} + selectClass="w-full" + /> + + )} + /> +
+
+ ( + + f.onChange} + value={f.value} + className={selectClass} + /> + + )} + /> +
+
+ ))} +
+ + ) : ( + <> + )} ); } diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index 70e62eb7f..5547f057b 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -23,15 +23,18 @@ import { handleCommaNumberChange, } from "@/components/lib/func/commom"; import { formH1Class } from "@/components/lib/class/comClass"; +import toast from "react-hot-toast"; export default function HtdflRegForm({ htdflForm, isModal, - readonly = false + readonly = false, + setIsModal, }: { htdflForm: customHtdflBdst; isModal: boolean; readonly?: boolean; + setIsModal?: (modal: boolean) => void; }) { const { code, htdflBdstUpdate, htdflBdstReg } = useWrStore((state) => state); @@ -41,16 +44,26 @@ export default function HtdflRegForm({ resolver: zodResolver(hdtflZod), defaultValues: defaultValues, }); + const [regCtpvCd, regSggcd] = form.watch(["ctpvCd", "sggCd"]); const onSubmit = (values: z.infer) => { if (isModal) { - htdflBdstReg(values, '41'); + const data = regCtpvCd ? regCtpvCd : regSggcd ? regSggcd : "noCd"; + + if (data === "noCd") { + toast.error("시도/시군구 코드를 선택해야합니다."); + return; + } + htdflBdstReg(values,data); + if (setIsModal) setIsModal(false); } else { - htdflBdstUpdate(values, '41'); + + console.log(' isModal ' ,isModal) + console.log(' values ' ,values) + htdflBdstUpdate(values, "41"); } }; - const cleanHtdflData = (raw: any): z.infer => { return { ...raw, @@ -80,9 +93,31 @@ export default function HtdflRegForm({ console.log("form errors:", form.formState.errors); }, [form.formState.errors]); + // form.reset은 비동기로 동작할 수 있어, useEffect 하나로 관리하여 의도치 않은 초기화를 방지합니다. useEffect(() => { - if (hdtflZod) form.reset(cleanHtdflData(htdflForm)); - }, [htdflForm]); + // Case 1: 수정 또는 '복사하여 등록' 등 데이터가 주입되는 경우 + if (htdflForm && Object.keys(htdflForm).length > 0) { + form.reset(cleanHtdflData(htdflForm)); + } + // Case 2: 데이터가 없는 순수 신규 등록 모드인 경우 + if(isModal) { + const firstYnValue = code.yn?.[0]?.val; + const firstHtdPowerMthdCd = code.htdPowerMthdCd?.[0]?.val; + const firstHtdUtztnUsgCd = code.htdUtztnUsgCd?.[0]?.val; + + if (firstHtdPowerMthdCd) { + form.setValue('reuseBuilding.0.htdflObj.etgtType', firstHtdPowerMthdCd, { shouldDirty: true }); + } + if (firstYnValue) { + form.setValue('reuseBuilding.0.htdflObj.plwtYn', firstYnValue as "Y" | "N", { shouldDirty: true }); + form.setValue('reuseBuilding.0.htdflObj.prcsProcsYn', firstYnValue as "Y" | "N", { shouldDirty: true }); + form.setValue('reuseBuilding.0.htdflObj.fmYn', firstYnValue as "Y" | "N", { shouldDirty: true }); + } + if (firstHtdUtztnUsgCd) { + form.setValue('reuseBuilding.0.htdflObj.utztnUsg', firstHtdUtztnUsgCd, { shouldDirty: true }); + } + } + }, [htdflForm, code, form]); return (
@@ -91,20 +126,30 @@ export default function HtdflRegForm({ {/*
*/}
-

온배수 시설 정보

+

+ 온배수 시설 등록 +

{!readonly && ( - )}
- {isModal && htdflForm != undefined ? : <>} + {isModal && htdflForm != undefined ? ( + + ) : ( + <> + )} {isModal ? ( -

- 온배수 시설 정보{" "} -

+
+

온배수 시설 정보

+
) : ( <> )} @@ -115,15 +160,14 @@ export default function HtdflRegForm({ control={form.control} name="reuseBuilding.0.htdflObj.etgtType" render={({ field }) => ( - - + {} : field.onChange} value={field.value ?? ""} - onChange={(e) => { - if (!readonly) field.onChange(e) - }} readOnly={readonly} /> @@ -136,13 +180,14 @@ export default function HtdflRegForm({ control={form.control} name="reuseBuilding.0.htdflObj.fclCpct" // 이름 이상함. render={({ field }) => ( - + { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -162,8 +207,8 @@ export default function HtdflRegForm({ label={""} selectClass={selectClass} selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} - value={field.value ?? code.yn[0]?.val} + onSelectValue={readonly ? () => {} : field.onChange} + value={field.value ?? ""} readOnly={readonly} /> @@ -172,9 +217,7 @@ export default function HtdflRegForm({
-

- 온배수 시설 운영현황 -

+

온배수 시설 운영현황

@@ -183,14 +226,14 @@ export default function HtdflRegForm({ control={form.control} name="reuseBuilding.0.htdflObj.orgwtWtritSpt" render={({ field }) => ( - + { - if (!readonly) field.onChange(Number(e.target.value)); + if (!readonly) field.onChange((e.target.value)); }} readOnly={readonly} /> @@ -206,11 +249,11 @@ export default function HtdflRegForm({ { - if (!readonly) field.onChange + if (!readonly) field.onChange(e.target.value); }} readOnly={readonly} /> @@ -223,13 +266,35 @@ export default function HtdflRegForm({ control={form.control} name="reuseBuilding.0.htdflObj.wtritEntrcTp" render={({ field }) => ( - + { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); + }} + value={formatCommaNumber(field.value)} + readOnly={readonly} + /> + + )} + /> +
+
+ ( + + { + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -249,7 +314,8 @@ export default function HtdflRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -263,14 +329,14 @@ export default function HtdflRegForm({ control={form.control} name="reuseBuilding.0.htdflObj.prcsProcsYn" render={({ field }) => ( - + { } : field.onChange} - value={field.value ?? code.yn[0]?.val} + onSelectValue={readonly ? () => {} : field.onChange} + value={field.value ?? ""} readOnly={readonly} /> @@ -288,7 +354,8 @@ export default function HtdflRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -308,8 +375,8 @@ export default function HtdflRegForm({ selectClass={selectClass} label={""} selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} - value={field.value ?? code.yn[0]?.val} + onSelectValue={readonly ? () => {} : field.onChange} + value={field.value ?? ""} readOnly={readonly} /> @@ -327,7 +394,8 @@ export default function HtdflRegForm({ placeholder="1,000,000" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -342,14 +410,13 @@ export default function HtdflRegForm({ name="reuseBuilding.0.htdflObj.utztnUsg" render={({ field }) => ( - {} : field.onChange} value={field.value ?? ""} - onChange={() => { - if (!readonly) field.onChange - }} readOnly={readonly} /> @@ -359,9 +426,7 @@ export default function HtdflRegForm({
-

- 요구수질 -

+

수질

@@ -376,7 +441,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -397,7 +463,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -420,7 +487,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -441,7 +509,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -464,7 +533,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -485,7 +555,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -508,7 +579,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -529,7 +601,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -552,7 +625,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -573,7 +647,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -596,7 +671,8 @@ export default function HtdflRegForm({ placeholder="10" type="text" onChange={(e) => { - if (!readonly) handleCommaNumberChange(e, field.onChange); + if (!readonly) + handleCommaNumberChange(e, field.onChange); }} value={formatCommaNumber(field.value)} readOnly={readonly} @@ -606,26 +682,6 @@ export default function HtdflRegForm({ />
-
- ( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={readonly} - /> - - )} - /> -
diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index d2f9b79e6..8ea07535d 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -194,6 +194,23 @@ export function PbnstBuseForm({ name: `items.${indexMng}.fcBizs.${indexBiz}.fcDemands`, }); + const demandsContainerRef = useRef(null); + const prevDemandsLengthRef = useRef(fcDemands.length); + + // 수요처 추가 시 새로 추가된 항목으로 스크롤하는 효과 + useEffect(() => { + // 수요처 항목이 추가되었는지 확인 (길이가 이전보다 길어졌는지) + if (fcDemands.length > prevDemandsLengthRef.current) { + // 컨테이너의 마지막 자식 요소(새로 추가된 수요처 폼)로 부드럽게 스크롤 + demandsContainerRef.current?.lastElementChild?.scrollIntoView({ + behavior: "smooth", + block: "end", + }); + } + // 다음 렌더링을 위해 현재 길이를 ref에 저장 + prevDemandsLengthRef.current = fcDemands.length; + }, [fcDemands.length]); + const { fields: fcOrgwtFiled } = useFieldArray({ control: form.control, name: `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`, @@ -351,7 +368,7 @@ export function PbnstBuseForm({ 합계 @@ -488,7 +505,8 @@ export function PbnstBuseForm({
- {( - form.getValues( - `items.${indexMng}.fcBizs.${indexBiz}.fcDemands` - ) || [] - ).map((field, index) => ( +
+ {fcDemands.map((field, index) => (
( - +
- ))} + ))} +
diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx index 30fab689e..fb50e1b89 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx @@ -14,6 +14,7 @@ import { Input } from "@common/components/ui"; export default function MngRegFormDetail({ formList, h1Title, + subTitle, form, moClass, sonClass, @@ -22,6 +23,7 @@ export default function MngRegFormDetail({ }: { formList: formDetailType[]; h1Title?: string; + subTitle?:string form: any; moClass?: string; indexBiz?: number; @@ -33,6 +35,8 @@ export default function MngRegFormDetail({ return ( <> {h1Title ?

{h1Title}

: <>} + {subTitle ?

{subTitle}

: <>} +
{formList?.map((formHead, index) => { const fieldId = diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index b893f9bf4..7333f6091 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -9,16 +9,10 @@ import { import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; import { formatCommaNumber, - handleCommaNumberChange, handleMinusNumberChange, } from "@/components/lib/func/commom"; import { DatePicker, FormUi } from "@common/business_components"; -import { - Form, - FormField, - FormLabel, - SelectBox, -} from "@common/business_components/ui"; +import { Form, FormField, SelectBox } from "@common/business_components/ui"; import { Button, Checkbox, Input, Label } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; @@ -31,11 +25,11 @@ export default function RainRegForm({ rainForm, isModal, readonly = false, - setIsModal + setIsModal, }: { rainForm: customRainBdst; isModal: boolean; - setIsModal?:(modal:boolean) => void + setIsModal?: (modal: boolean) => void; readonly?: boolean; }) { const { code, rainBdstReg, rainBdstUpdate, rain } = useWrStore( @@ -100,20 +94,19 @@ export default function RainRegForm({ form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctPrs", ""); } - if(grntchBdstCertYn === "D") { + if (grntchBdstCertYn === "D") { form.setValue("reuseBuilding.0.grntchBdstCertYr", "0000"); form.setValue("reuseBuilding.0.grntchBdstCertNo", "확인불가"); form.setValue("reuseBuilding.0.grntchBdstCertGrd", "확인불가"); - }else if (instlCstSprtYn === "D") { + } else if (instlCstSprtYn === "D") { form.setValue("reuseBuilding.0.instlCstSprtAmt", -1); } else if (filtrTrtmfctYn === "D") { form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctCpct", -1); form.setValue("reuseBuilding.0.rainyObj.filtrTrtmfctPrs", "확인불가"); } - }, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn]); -const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) + const [regCtpvCd, regSggcd] = form.watch(["ctpvCd", "sggCd"]); // form 값이 변경될 때마다 로그 출력 useEffect(() => { @@ -127,15 +120,15 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) const onSubmit = (values: z.infer) => { if (isModal) { - const data = regCtpvCd?regCtpvCd:regSggcd?regSggcd:'noCd' - - if(data ==='noCd'){ + const data = regCtpvCd ? regCtpvCd : regSggcd ? regSggcd : "noCd"; + + if (data === "noCd") { toast.error("시도/시군구 코드를 선택해야합니다."); - return + return; } rainBdstReg(values, data); - setIsModal(false) + if (setIsModal) setIsModal(false); } else { rainBdstUpdate(values, "41"); } @@ -207,29 +200,27 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) const value = field.value; const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 return ( -
- - + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 } - onFocus={() => { - // 입력 시 자동으로 확인불가 해제 - if (isUnknown && !readonly) { - field.onChange(""); // 초기화 - } - }} - onChange={(e) => { - if (readonly ) return; - handleMinusNumberChange(e, field.onChange); - }} - /> - -
+ }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + /> + ); }} /> @@ -246,34 +237,34 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) - - { - const isUnknown = field.value === null || field.value === -1; // 또는 Number(value) === -1 + render={({ field }) => { + const isUnknown = field.value === null || field.value === -1; // 또는 Number(value) === -1 return ( - - { - // 입력 시 자동으로 확인불가 해제 - if (isUnknown && !readonly) { - field.onChange(""); // 초기화 + + { - if (readonly ) return; - handleMinusNumberChange(e, field.onChange); - }} - readOnly={readonly} - /> - - ) - }} + onFocus={() => { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} + /> + + ); + }} />
@@ -319,13 +310,12 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) } }} onChange={(e) => { - if (readonly ) return; + if (readonly) return; handleMinusNumberChange(e, field.onChange); }} readOnly={readonly} /> -
); }} @@ -360,36 +350,35 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) - - - { + render={({ field }) => { const isUnknown = field.value === null || field.value === -1; // 또는 Number(value) === -1 - return( - - { - // 입력 시 자동으로 확인불가 해제 - if (isUnknown && !readonly) { - field.onChange(""); // 초기화 + return ( + + { - if (readonly ) return; - handleMinusNumberChange(e, field.onChange); - }} - readOnly={readonly} - disabled={filtrTrtmfctYn !== "Y"} - /> - - ) - }} + onFocus={() => { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} + disabled={filtrTrtmfctYn !== "Y"} + /> + + ); + }} />
@@ -404,7 +393,7 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd'])
-
); }} @@ -450,35 +438,34 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) - { + render={({ field }) => { const value = field.value; const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 - return ( - - { - // 입력 시 자동으로 확인불가 해제 - if (isUnknown && !readonly) { - field.onChange(""); // 초기화 + return ( + + { - if (readonly ) return; - handleMinusNumberChange(e, field.onChange); - }} - disabled={instlCstSprtYn !== "Y"} - /> - - )} - } + onFocus={() => { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + disabled={instlCstSprtYn !== "Y"} + /> + + ); + }} />
@@ -508,10 +495,10 @@ const [regCtpvCd , regSggcd] = form.watch(['ctpvCd','sggCd']) - { - const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1 - return ( + render={({ field }) => { + const isUnknown = + field.value === null || field.value === "0000"; // 또는 Number(value) === -1 + return ( { - if (readonly) return - - if (e.target.value === '확인불가') { - field.onChange('0000'); - }else{ + if (readonly) return; + if (e.target.value === "확인불가") { + field.onChange("0000"); + } else { field.onChange(e.target.value); } }} disabled={grntchBdstCertYn !== "Y"} + max={4} /> - )} - } + ); + }} />
( - - { - if (!readonly) field.onChange(e); - }} - disabled={grntchBdstCertYn !== "Y"} - /> - - )} + render={({ field }) => { + const isUnknown = + field.value === null || field.value === "0000"; // 또는 Number(value) === -1 + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + value={isUnknown ? "확인불가" : (field.value ?? "")} + onChange={(e) => { + if (readonly) return; + + if (e.target.value === "확인불가") { + field.onChange(""); + } else { + field.onChange(e.target.value); + } + }} + disabled={grntchBdstCertYn !== "Y"} + /> + + ); + }} />
diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index d820bddc1..ed0e51af6 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -10,6 +10,7 @@ import { formH1Class, formH2Class } from "@/components/lib/class/comClass"; import { formatCommaNumber, handleCommaNumberChange, + handleMinusNumberChange, } from "@/components/lib/func/commom"; import { DatePicker, @@ -21,7 +22,7 @@ import { import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect } from "react"; -import { useForm } from "react-hook-form"; +import { useForm, type UseFormReturn } from "react-hook-form"; import { z } from "zod"; import BdstReg from "../bdstReg/bdstReg"; @@ -29,7 +30,7 @@ export default function RswtrRegForm({ rswtForm, isModal, setIsModal, - readonly = false + readonly = false, }: { rswtForm: customRswtBdst; isModal: boolean; @@ -56,7 +57,7 @@ export default function RswtrRegForm({ const onSubmit = (values: z.infer) => { if (isModal) { rswtBdstReg(values, "41"); - if(setIsModal) setIsModal(false) + if (setIsModal) setIsModal(false); } else { rswtBdstUpdate(values, "41"); } @@ -73,21 +74,19 @@ export default function RswtrRegForm({ reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({ ...item, instlCmptnDt: item?.instlCmptnDt - ? new Date(item.instlCmptnDt) - : new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화 - operMngCd: item?.operMngCd ?? "", // null → "" - instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" - grntchBdstCertYn:item?.grntchBdstCertYn??"Y", - rswtrObj: { + ? new Date(item.instlCmptnDt) + : new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화 + operMngCd: item?.operMngCd ?? "", // null → "" + instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" + grntchBdstCertYn: item?.grntchBdstCertYn ?? "Y", + rswtrObj: { ...item?.rswtrObj, filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", - }, })), }; }; - useEffect(() => { console.log("form errors:", form.formState.errors); }, [form.formState.errors]); @@ -99,6 +98,16 @@ export default function RswtrRegForm({ } else if (instlCstSprtYn === "N") { form.setValue("reuseBuilding.0.instlCstSprtAmt", 0); } + + + if (grntchBdstCertYn === "D") { + form.setValue("reuseBuilding.0.grntchBdstCertYr", "0000"); + form.setValue("reuseBuilding.0.grntchBdstCertNo", "확인불가"); + form.setValue("reuseBuilding.0.grntchBdstCertGrd", "확인불가"); + } else if (instlCstSprtYn === "D") { + form.setValue("reuseBuilding.0.instlCstSprtAmt", -1); + } + }, [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctProcs, form]); useEffect(() => { @@ -116,7 +125,11 @@ export default function RswtrRegForm({ 건축물 운영정보 {!readonly && ( - )} @@ -155,68 +168,37 @@ export default function RswtrRegForm({ )} />
-
( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={readonly} - /> - - )} - /> -
-
-
-
- ( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={readonly} - /> - - )} - /> -
- -
- ( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={readonly} - /> - - )} + render={({ field }) => { + const value = field.value; + const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} + /> + + ); + }} />
@@ -229,20 +211,34 @@ export default function RswtrRegForm({ ( - - { - if (!readonly) field.onChange(Number(e.target.value)); - }} - readOnly={readonly} - /> - - )} + render={({ field }) => { + const value = field.value; + const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 + + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + readOnly={readonly} + /> + + ); + }} />
@@ -256,7 +252,7 @@ export default function RswtrRegForm({ label={""} selectClass={selectClass} selectArray={code.orgwtKndCd} - onSelectValue={readonly ? () => { } : field.onChange} + onSelectValue={readonly ? () => {} : field.onChange} value={field.value ?? code.orgwtKndCd[0]?.val} readOnly={readonly} /> @@ -270,14 +266,13 @@ export default function RswtrRegForm({ name="reuseBuilding.0.rswtrObj.filtrTrtmfctProcs" render={({ field }) => ( - { - if (!readonly) field.onChange - }} + {} : field.onChange} + value={field.value ?? code.rswtPrscCdMthdCd[0]?.val} readOnly={readonly} /> @@ -303,9 +298,9 @@ export default function RswtrRegForm({ className={""} selectClass={selectClass} label={""} - selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} - value={field.value ?? code.yn[0]?.val} + selectArray={code.bdstIncenYn} + onSelectValue={readonly ? () => {} : field.onChange} + value={field.value ?? code.bdstIncenYn[0]?.val} readOnly={readonly} /> @@ -313,23 +308,37 @@ export default function RswtrRegForm({ />
- ( - - { - if (!readonly) handleCommaNumberChange(e, field.onChange); - }} - value={formatCommaNumber(field.value)} - readOnly={instlCstSprtYn !== "Y"} - /> - - )} + render={({ field }) => { + const value = field.value; + const isUnknown = value === null || value === -1; // 또는 Number(value) === -1 + return ( + + { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } + }} + onChange={(e) => { + if (readonly) return; + handleMinusNumberChange(e, field.onChange); + }} + disabled={instlCstSprtYn !== "Y"} + /> + + ); + }} />
@@ -348,8 +357,8 @@ export default function RswtrRegForm({ className={""} selectClass={selectClass} label={""} - selectArray={code.yn} - onSelectValue={readonly ? () => { } : field.onChange} + selectArray={code.bdstIncenYn} + onSelectValue={readonly ? () => {} : field.onChange} value={field.value ?? code.yn[0]?.val} readOnly={readonly} /> @@ -361,41 +370,75 @@ export default function RswtrRegForm({ ( + render={({ field }) => + { + const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1 + return ( { - if (!readonly) field.onChange(e) + type="" + onFocus={() => { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } }} - readOnly={grntchBdstCertYn !== "Y"} + value={ + isUnknown?'확인불가':field.value ?? ""} + onChange={(e) => { + if (readonly) return + if (e.target.value === '확인불가') { + field.onChange('0000'); + }else{ + field.onChange(e.target.value); + } + }} + disabled={grntchBdstCertYn !== "Y"} + max={4} /> - )} + )}} />
( + render={({ field }) => + { + const isUnknown = field.value === null || field.value === "0000"; // 또는 Number(value) === -1 + return ( { - if (!readonly) field.onChange(e) + onFocus={() => { + // 입력 시 자동으로 확인불가 해제 + if (isUnknown && !readonly) { + field.onChange(""); // 초기화 + } }} - readOnly={grntchBdstCertYn !== "Y"} + value={ + isUnknown?'확인불가':field.value ?? ""} + onChange={(e) => { + if (readonly) return + + if (e.target.value === '확인불가') { + field.onChange(''); + }else{ + field.onChange(e.target.value); + } + }} + disabled={grntchBdstCertYn !== "Y"} + + + /> - )} + )}} />
@@ -404,15 +447,14 @@ export default function RswtrRegForm({ name="reuseBuilding.0.grntchBdstCertGrd" render={({ field }) => ( - { - if (!readonly) field.onChange(e) - }} - readOnly={grntchBdstCertYn !== "Y"} + {} : field.onChange} + value={field.value ?? code.bdstGrntchClass[0]?.val} + readOnly={readonly} /> )} diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 6ab1b25c4..bee445114 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -120,7 +120,12 @@ export function BdstReg({ moType,setIsModal,isModal }: BdstReg
-

건축물 목록 (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 정보에 추가하여 주시기 바랍니다.)

+

+ 건축물 목록 + + (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 정보에 추가하여 주시기 바랍니다.) + +

({ moType,setIsModal,isModal }: BdstReg :moType==='RST' ? {setIsModal}}> - : + :{setIsModal}}> }
diff --git a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx index acb923687..6f4832c68 100644 --- a/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx +++ b/apps/wr/components/ui/table/pbnstReg/ruseMngTableForm/ruseMngTableForm.tsx @@ -3,6 +3,10 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { customPbnst as OriginalCustomPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { + formatCommaNumber, + handleCommaNumberChange, +} from "@/components/lib/func/commom"; import { DatePicker, @@ -32,12 +36,24 @@ type RuseMngTableProps = { indexMng?: number; indexBiz?: number; form?: any; - formNm?:string + formNm?: string; }; const RuseMngTableForm = React.forwardRef( - ({ tableData, headList, upHeadList, code, onTableSet, indexMng, form,formNm,indexBiz }, ref) => { - + ( + { + tableData, + headList, + upHeadList, + code, + onTableSet, + indexMng, + form, + formNm, + indexBiz, + }, + ref + ) => { return ( <> @@ -73,26 +89,31 @@ const RuseMngTableForm = React.forwardRef( typeof indexMng === "number" && indexMng >= 0 && typeof indexBiz === "number" && - indexBiz >= 0? - `items.${indexMng}.fcBizs.${indexBiz}.${formNm}.${i}.${head.id}`: - typeof indexMng === "number" && indexMng >= 0? - `items.${indexMng}.${formNm}.${i}.${head.id}`: - `items.${indexMng}.${formNm}.${i}.${head.id}`} + indexBiz >= 0 + ? `items.${indexMng}.fcBizs.${indexBiz}.${formNm}.${i}.${head.id}` + : typeof indexMng === "number" && indexMng >= 0 + ? `items.${indexMng}.${formNm}.${i}.${head.id}` + : `items.${indexMng}.${formNm}.${i}.${head.id}` + } render={({ field }) => ( {head.edit === true ? ( { - field.onChange(txt.target.value); + if (head.type === "number") { + handleCommaNumberChange(txt, field.onChange); + } else { + field.onChange(txt.target.value); + } }} value={ head.type === "number" - ? (Number(field.value) ?? 0) + ? formatCommaNumber(field.value) : field.value || "" } - readOnly ={head.readonly ? true : false} + readOnly={head.readonly ? true : false} /> ) : head.type === "select" ? ( ( (item) => item.name === head.selectData )?.val ?? [] } - value={ - field.value || "" - } + value={field.value || ""} className={""} selectClass={selectClass} onSelectValue={(val) => { - - if(head.readonly === true){ - return - }else{ - + if (head.readonly === true) { + return; + } else { field.onChange(val); } }} - readOnly ={head.readonly ? true : false} + readOnly={head.readonly ? true : false} // Disabled prop removed as SelectBox does not support it > ) : head.type === "date" ? ( { - console.log("date", date); - field.onChange(date); // readonly 상태가 아닐 때만 값 변경 + field.onChange(date); // readonly 상태가 아닐 때만 값 변경 }, }} selectClass={"w-full"} - readOnly ={head.readonly ? true : false} + readOnly={head.readonly ? true : false} /> ) : head.type === "checkbox" ? ( { - field.onChange(checked); + field.onChange(checked); }} > ) : ( From 0f0ddb6c26d1317bcf041f52db1a3a0d5fc55bc5 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 2 Jul 2025 16:26:19 +0900 Subject: [PATCH 112/259] =?UTF-8?q?etc:=20.env.development=20NEXT=5FPUBLIC?= =?UTF-8?q?=5FPORT=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index d51017aff..3358454e7 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -1,5 +1,5 @@ NEXT_PUBLIC_SITE_ID = SN -NEXT_PUBLIC_PORT = 11302 +NEXT_PUBLIC_PORT = 3002 NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver From c7c868431fde9fa407dfeeb237128eef444ac634 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 2 Jul 2025 16:50:14 +0900 Subject: [PATCH 113/259] =?UTF-8?q?etc:=20.env.development=20=EB=A1=A4?= =?UTF-8?q?=EB=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.development | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sn/.env.development b/apps/sn/.env.development index 3358454e7..fab02e36c 100644 --- a/apps/sn/.env.development +++ b/apps/sn/.env.development @@ -1,6 +1,6 @@ NEXT_PUBLIC_SITE_ID = SN -NEXT_PUBLIC_PORT = 3002 -NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 +NEXT_PUBLIC_PORT = 11302 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 From 5d5b97d39f5eba6e453c3ba98f36cee9e6e14f2b Mon Sep 17 00:00:00 2001 From: YangJinSoo94 Date: Wed, 2 Jul 2025 17:26:10 +0900 Subject: [PATCH 114/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC,=20=ED=86=B5=EA=B3=84=20?= =?UTF-8?q?=EA=B2=B0=ED=95=A8=EC=A1=B0=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 16 ++++++++++---- apps/wr/app/stats/rainStat/page.tsx | 3 ++- apps/wr/app/stats/rswtStat/page.tsx | 2 +- .../wr/app/store/matDmd/ruseCaseMng/index.tsx | 22 +++++++++++-------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index 436b77736..517dab0c0 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -5,6 +5,7 @@ import { ruseUtzType } from "@/app/store/matDmd/ruseCaseMng/headList"; import { excelDownload, getCity } from "@/components/lib/func/commom"; import RuseCaseMngExcel from "@/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal"; import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; +import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import { ContentsDiv, filePickedBlobArray, @@ -20,11 +21,12 @@ import { } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; -import { useState } from "react"; +import { useEffect, useState } from "react"; +import { toast, Toaster } from "react-hot-toast"; export default function RuseCaseMng() { const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); - const { ruseCaseMngList } = ruseCaseMng; + const { ruseCaseMngList, status } = ruseCaseMng; const [selectSgg, setSelectSgg] = useState([]); const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); @@ -142,7 +144,7 @@ export default function RuseCaseMng() { } ]; // 버퍼에 있는 엑셀데이터 전달 후 json으로 변환 - await filePickedBlobArray(blobRet, '시설정보및운영현황황', sheetParameter); + await filePickedBlobArray(blobRet, '물재이용사례현황', sheetParameter); }); } @@ -157,6 +159,12 @@ export default function RuseCaseMng() { ); } + useEffect(() => { + if(status === 200){ + setIsExcelOpen({ isModal: false }); + } + }, [status]); + return ( <> @@ -239,7 +247,7 @@ export default function RuseCaseMng() { - + {/* 엑셀 등록 모달 */} item.cityText !== '없음') : []; + setBdstTable(tbData); }, [code, rainStatList]); diff --git a/apps/wr/app/stats/rswtStat/page.tsx b/apps/wr/app/stats/rswtStat/page.tsx index c0741433c..997e95ca5 100644 --- a/apps/wr/app/stats/rswtStat/page.tsx +++ b/apps/wr/app/stats/rswtStat/page.tsx @@ -46,7 +46,7 @@ export default function RswtStat() { ...item, ctpvCd: item.cityText }; - }) + }).filter((item: RswtStatProps) => item.cityText !== '없음') : []; setRswtTable(tbData); }, [code, rswtStatList]) diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx index 915740f79..76468d249 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx @@ -1,12 +1,12 @@ import { fetchType, getFetch, postFectch } from "@/components/lib/api"; import type { TableUpperProps } from "../../common/type/header"; import { ruseCaseHeadListExport } from "./headList"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; - +import { toast } from "react-hot-toast"; export type ruseCaseState = { ruseCaseMng: { ruseHeadList:TableUpperProps[]; ruseCaseMngList:ruseCaseMngExcelProps[]; + status: number; }; }; @@ -69,7 +69,6 @@ type ruseCaseActions = { }; export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { - const tailUrl = ((sigunguCd !== '전체' && sigunguCd !=='') ? `/${sigunguCd}` : (sidoCd != '전체' && sidoCd != '') ? `/${sidoCd}` : `/0`) + (usageCd? `/${usageCd}` : '/0') + (name? `/${name}` : ''); const resp = await getFetch(fetchType.WR,`/reuseFc/pubFcRuseCase${tailUrl}`); return resp; @@ -77,7 +76,7 @@ export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, export const fetchInsertRuseCaseMng = async (data: any) => { const response = await postFectch('/reuseFc/pubFcRuseCase', data, fetchType.WR); - return response.data; + return {data:response.data, status:response.status}; }; export type ruseCaseType = ruseCaseState & ruseCaseActions; @@ -86,6 +85,7 @@ export const ruseCaseStateExport: ruseCaseState = { ruseCaseMng: { ruseHeadList:ruseCaseHeadListExport, ruseCaseMngList:[], + status: 0, }, }; @@ -95,7 +95,6 @@ export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( return { selectRuseCaseMng: async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { const res = await fetchSearchRuseCaseMng(sidoCd, sigunguCd, usageCd, name); - console.log('res : ', res); set((state: ruseCaseState) => ({ ruseCaseMng: { ...state.ruseCaseMng, @@ -107,11 +106,16 @@ export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( insertRuseCaseMng: async (data: any) => { const response = await fetchInsertRuseCaseMng(data); if(response.status === 200){ - ToastFormUi({ - body: "잠재수요처 등록이 완료되었습니다. ", - title: "잠재수요처 등록", - }); + toast.success("물재이용사례 등록이 완료되었습니다. "); + }else{ + toast.error("물재이용사례 등록에 실패하였습니다. "); } + set((state: ruseCaseState) => ({ + ruseCaseMng: { + ...state.ruseCaseMng, + status: response.status, + }, + })); }, }; }; From 1fd522e49bfc3b7100ef827ffc8128d0c63b5fe0 Mon Sep 17 00:00:00 2001 From: JIeunhuh Date: Wed, 2 Jul 2025 17:38:44 +0900 Subject: [PATCH 115/259] =?UTF-8?q?=EC=8B=9C=EC=84=A4=ED=98=84=ED=99=A9=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EB=9D=84=EC=9A=B0=EB=8A=94=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=20=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/newWindowPopup.tsx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index e6438656d..dd2334e29 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -43,7 +43,7 @@ const NewWindowPopup: React.FC = ({ const [tabData, setTabData] = useState<{ id: string; name: string; data: any }[]>([]); const [activeTab, setActiveTab] = useState('0'); // swcho : useState의 true, false 값 변경하여 목록, 상태 테스트 하였음 - const [showDetailView, setShowDetailView] = useState(true); // 상세정보 화면 표시 상태 추가 + const [showDetailView, setShowDetailView] = useState(false); // 상세정보 화면 표시 상태 추가 // onClose 함수를 useCallback으로 메모이제이션 const memoizedOnClose = useCallback(() => { @@ -109,14 +109,33 @@ const NewWindowPopup: React.FC = ({ pbnstSttn.pbnstSttnRes && pbnstSttn.pbnstSttnRes[index] ) { + console.log(pbnstSttn.pbnstSttnRes[index]) setPbnstRuseFcltPk(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk); getPbnStnDetail(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk); + setShowDetailView(true); // 상세정보 화면 표시 상태 변경 } }; - // useEffect(() => { - // setBdstTable(pbnstSttn.pbnstSttnRes); - // }, [pbnstSttn.pbnstSttnRes]); + useEffect(() => { + if (!pbnstSttn.isInit) { + pbnSttnInit("1", "13",{ + partValue: "A", + sidoValue: "0", + sigunValue: "", + regionValue: "", + unitWaterShedValue: "", + middleRegionValue: "", + envPartValue: "", + sidoText: "", + sigunText: "" + }, String(new Date().getFullYear())); + } + }, [pbnstSttn.isInit, pbnSttnInit]); + + useEffect(() => { + setBdstTable(pbnstSttn.pbnstSttnRes); + }, [pbnstSttn.pbnstSttnRes]); + // 재이용시설 조회 const fetchpbnstDetail = async (featureCd: string) => { @@ -127,7 +146,6 @@ const NewWindowPopup: React.FC = ({ if (prev.some((tab) => tab.id === featureCd)) { return prev; // 이미 존재하는 탭이면 추가하지 않음 } - console.log('탭 idx',prev, prev.length) return [...prev, { id: featureCd, name: `재이용시설 ${prev.length + 1}`, data: response }]; }); } catch (error) { @@ -207,7 +225,7 @@ const NewWindowPopup: React.FC = ({ layer.data?.lyrNm?.includes('하수처리') || layer.data?.lyrNm?.includes('재이용시설') ); const actTabData = tabData.find((tab) => tab.id === activeTab); - + // swcho : true, false 값 변경하여 시설 변경하여 테스트하였음 // 재이용시설 const isPbnst = true; From 34a70ca21ac4752175c5384a2e3fc9c1c958878f Mon Sep 17 00:00:00 2001 From: JIeunhuh Date: Wed, 2 Jul 2025 18:10:24 +0900 Subject: [PATCH 116/259] =?UTF-8?q?settimeout=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/Gis.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 5ac98f27f..d0dde20d8 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -342,9 +342,11 @@ function Gis({ // 체크된 레이어 정보를 처리하는 함수 const handleCheckedLayersChange = useCallback((checkedIds, checkedNodesData) => { - setCheckedLayers(checkedIds); - setCheckedLayersData(checkedNodesData); - onCheckedLayersChange?.(checkedIds, checkedNodesData); + setTimeout(() => { + setCheckedLayers(checkedIds); + setCheckedLayersData(checkedNodesData); + onCheckedLayersChange?.(checkedIds, checkedNodesData); + }, 0); }, [onCheckedLayersChange]); return ( From 7641cb332f3c20d64433e678b4285791512a1141 Mon Sep 17 00:00:00 2001 From: JIeunhuh Date: Wed, 2 Jul 2025 18:47:01 +0900 Subject: [PATCH 117/259] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=ED=8C=9D=EC=97=85=20=ED=99=94=EB=A9=B4=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=EA=B5=AC=ED=98=84=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/newWindowPopup.tsx | 49 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index dd2334e29..e14a4447d 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -109,9 +109,9 @@ const NewWindowPopup: React.FC = ({ pbnstSttn.pbnstSttnRes && pbnstSttn.pbnstSttnRes[index] ) { - console.log(pbnstSttn.pbnstSttnRes[index]) setPbnstRuseFcltPk(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk); - getPbnStnDetail(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk); + fetchpbnstDetail(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk) + setActiveTab(pbnstSttn.pbnstSttnRes[index].pbnstRuseFcltPk) setShowDetailView(true); // 상세정보 화면 표시 상태 변경 } }; @@ -136,33 +136,36 @@ const NewWindowPopup: React.FC = ({ setBdstTable(pbnstSttn.pbnstSttnRes); }, [pbnstSttn.pbnstSttnRes]); - +// 재이용시설 상세정보 + const setTabDataFunc = (res:any, pk:string) => { + setTabData((prev) => { + if (prev.some((tab) => tab.id === pk)) { + return prev; // 이미 존재하는 탭이면 추가하지 않음 + } + return [...prev, { id: pk, name: `재이용시설 ${prev.length + 1}`, data: res }]; + }); + } // 재이용시설 조회 const fetchpbnstDetail = async (featureCd: string) => { try { const response = await getFetch("wr", `/reuseFc/pubFc/${featureCd}`); // 중복 데이터 추가 방지 - setTabData((prev) => { - if (prev.some((tab) => tab.id === featureCd)) { - return prev; // 이미 존재하는 탭이면 추가하지 않음 - } - return [...prev, { id: featureCd, name: `재이용시설 ${prev.length + 1}`, data: response }]; - }); + setTabDataFunc(response, featureCd); } catch (error) { console.error("Error fetching data:", error); } }; - useEffect(() => { - if (featureData) { - const selectedVal = featureData.getProperties(); - const featureCd = selectedVal?.swtrmt_fclt_cd; - if (featureCd && featureCd !== pbnstRuseFcltPk) { - setPbnstRuseFcltPk(featureCd); // 현재 호출된 featureCd 저장 - setActiveTab(featureCd) - fetchpbnstDetail(featureCd); // 상세정보 가져오기 - } - } - }, [featureData]); + // useEffect(() => { + // if (featureData) { + // const selectedVal = featureData.getProperties(); + // const featureCd = selectedVal?.swtrmt_fclt_cd; + // if (featureCd && featureCd !== pbnstRuseFcltPk) { + // setPbnstRuseFcltPk(featureCd); // 현재 호출된 featureCd 저장 + // setActiveTab(featureCd) + // fetchpbnstDetail(featureCd); // 상세정보 가져오기 + // } + // } + // }, [featureData]); useEffect(() => { if (pbnstSttn.pbnstDetail) { @@ -225,7 +228,7 @@ const NewWindowPopup: React.FC = ({ layer.data?.lyrNm?.includes('하수처리') || layer.data?.lyrNm?.includes('재이용시설') ); const actTabData = tabData.find((tab) => tab.id === activeTab); - + console.log('tavbData',actTabData) // swcho : true, false 값 변경하여 시설 변경하여 테스트하였음 // 재이용시설 const isPbnst = true; @@ -235,8 +238,6 @@ const NewWindowPopup: React.FC = ({ const isRswt = false; // 온배수시설 const isHtdfl = false; - - return (
{/* 체크된 레이어가 없는 경우 (재이용시설 목록) */} @@ -260,7 +261,7 @@ const NewWindowPopup: React.FC = ({ />
From b657ee97eb0ced68807f6816e0fc78faabcea479 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 2 Jul 2025 19:21:52 +0900 Subject: [PATCH 118/259] =?UTF-8?q?feat:=20UITable,=20UITable2=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=88=AB=EC=9E=90=20=EA=B0=80?= =?UTF-8?q?=EC=9A=B4=EB=8D=B0=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/table/index-2.tsx | 4 +--- packages/common/business_components/src/ui/table/index.tsx | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/common/business_components/src/ui/table/index-2.tsx b/packages/common/business_components/src/ui/table/index-2.tsx index b6a9750b0..5961ea396 100644 --- a/packages/common/business_components/src/ui/table/index-2.tsx +++ b/packages/common/business_components/src/ui/table/index-2.tsx @@ -110,9 +110,7 @@ export function UiTable2({ ? 'text-right' : head.align === 'center' ? 'text-center' - : typeof el[head.id] === 'number' - ? 'text-right' - : 'text-center' + : 'text-center' } ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : cellClick ? 'cursor-pointer' : ''} diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index cd25bc8db..bb90153c2 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -82,7 +82,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr boldArray.includes(index) ? : Date: Wed, 2 Jul 2025 20:14:13 +0900 Subject: [PATCH 119/259] =?UTF-8?q?feat:=20UiModal=20=EC=9D=B4=EC=A0=84=20?= =?UTF-8?q?=EB=8F=99=EC=9E=91=20=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EB=8A=94=20props=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/dialog_ui/index.tsx | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/packages/common/business_components/src/ui/dialog_ui/index.tsx b/packages/common/business_components/src/ui/dialog_ui/index.tsx index bbb27d327..df7fffd3a 100644 --- a/packages/common/business_components/src/ui/dialog_ui/index.tsx +++ b/packages/common/business_components/src/ui/dialog_ui/index.tsx @@ -1,7 +1,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader } from "@common/components"; import { cn } from "../../lib/utils"; -type ModalType = { +type ModalType = { bodyClass: string; body: React.ReactNode; open?: boolean; @@ -10,43 +10,45 @@ type ModalType = { noFooterYn?: 'N' | 'Y'; headerTitle?: string; footerContent?: React.ReactNode; + useDirectRender?: boolean; } -export function UiModal({ - bodyClass, - body, - open, +export function UiModal({ + bodyClass, + body, + open, onOpenChange, noHeaderYn = 'N', noFooterYn = 'N', headerTitle, - footerContent + footerContent, + useDirectRender = false }: ModalType) { - + return ( <> - + - {noHeaderYn === 'N' && ( - - - {headerTitle} - - - )} - {(open && body) ? -
{body}
:<> - - - - } - {noFooterYn === 'N' && ( - - {footerContent} - - )} -
-
+ {noHeaderYn === 'N' && ( + + + {headerTitle} + + + )} + {(open && body) ? + useDirectRender + ? body + :
{body}
+ : <> + } + {noFooterYn === 'N' && ( + + {footerContent} + + )} + +
); } From ed38451f84b9315f0c47486c68771d2f035dc554 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Wed, 2 Jul 2025 20:19:02 +0900 Subject: [PATCH 120/259] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EB=8C=80=EC=9E=A5=20?= =?UTF-8?q?=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 6 +- .../prfmncReg/chkgdnReg/rainChkgdn/excel.tsx | 20 +-- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 168 ++++++++++-------- .../chkgdnSttn/rainChkgdnSttn/headList.tsx | 2 +- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 3 +- apps/wr/components/lib/func/TableData.tsx | 3 +- .../ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx | 71 ++++---- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 23 ++- .../chkgdTable/rainChkgd/rainChkgdTable.tsx | 7 +- apps/wr/public/sample_rainy.xlsx | Bin 11216 -> 11262 bytes 10 files changed, 166 insertions(+), 137 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 53a7a31f3..88a0de300 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -20,7 +20,6 @@ import { SearchDiv, SearchFormLeft, SearchFormRight, - SearchInput, SelectBox, Title, UiModal, @@ -29,7 +28,6 @@ import ListDiv from "@common/business_components/ui/list_div"; import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; -import { shallow } from "zustand/shallow"; export default function Page() { const { @@ -135,8 +133,8 @@ export default function Page() { ); useEffect(() => { - rainChkgdn.isSttn = false; - rswtChkgdn.isSttn = false; + //rainChkgdn.isSttn = false; + //rswtChkgdn.isSttn = false; if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) { rainChkHeadChange({ rainChkgdn }, true); rswtChkHeadChange({ rswtChkgdn }, true); diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx index 5754c02fc..58e8d6bf0 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx @@ -94,15 +94,15 @@ export const excelToRainChkData = (excelData: any, year: string) => { } const makeGuidDetail = Array.from({ length: 12 }, (_, i) => { let month = `${i + 1}`; - const splyData = item[`보급_${month}월`]; + const splyData = item[`대체_${month}월`]; const ruseData = item[`빗물_${month}월`]; if (month.length < 2) month = "0" + month; return { utztnUsgCd: item["이용용도"], ym: year + month, chckYmd: checkYmd, - splyUswtrUtztnQnt: Number(splyData ?? 0), - ruseFcltUtztnQnt: Number(ruseData ?? 0), + splyUswtrUtztnQnt: Number(splyData) || 0, + ruseFcltUtztnQnt: Number(ruseData) || 0, flg: "RNB", }; }); @@ -120,13 +120,13 @@ export const excelToRainChkData = (excelData: any, year: string) => { rainyDetails: [ { utztnUsgCd: item["이용용도"] ?? "", - ph: Number(item["PH"] ?? 0), - trbt: Number(item["탁도"] ?? 0), - grssClfg: Number(item["총대장균군수"] ?? 0), - etc: item["기타"] ?? "", // 필드 누락 방지 - vltnDt: vltnDt ?? "", - vltnMttr: item["위반사항"] ?? "", - levyAmt: Number(item["과태료부과금액(천원)"] ?? 0), + ph: Number(item["PH"] || 0), + trbt: Number(item["탁도"] || 0), + grssClfg: Number(item["총대장균군수"] || 0), + etc: item["기타"] || "", // 필드 누락 방지 + vltnDt: vltnDt || "-", + vltnMttr: item["위반사항"] || "-", + levyAmt: Number(item["과태료부과금액(천원)"] || 0), rgtr: TEST_UUID, }, ], diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 4af27a51c..4c7f2d514 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -1,7 +1,5 @@ import { buildingType } from "@/app/store/common/code"; -import { - TEST_UUID, -} from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { deleteFectch, fetchType, @@ -22,6 +20,7 @@ import { type chHeadType, } from "./headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; +import toast from "react-hot-toast"; export type rainChkZodType = z.infer; const fcltDiv = [ @@ -52,7 +51,12 @@ export type rainChkgdnState = { }; type rainChkgdnActions = { - rainChkInit: (pageNo: string, cnt: string, sggCd: string, searchTxt: string) => void; + rainChkInit: ( + pageNo: string, + cnt: string, + sggCd: string, + searchTxt: string + ) => void; rainChkDetilUpdate(rainChk: rainChkZodType[]): Promise; rainChkGuidUpdate(rainChk: rainChkZodType): Promise; rainChkExcelDownload( @@ -98,11 +102,20 @@ const makeMdfrChk = (data: rainChkZodType[], type: string, toDo: string) => { return chData; }; -const initFetch = async (pageNo: string, cnt: string, txt: string | undefined, sgg: string | undefined) => { +const initFetch = async ( + pageNo: string, + cnt: string, + txt: string | undefined, + sgg: string | undefined +) => { const currentYear = new Date().getFullYear().toString(); const rainRes = await getFetch( "wr", - `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + (cnt ? `/${cnt}` : "/20") + (txt ? `/${txt}` : `/${currentYear}`) + (sgg ? `/${sgg}` : "/0") + `/reuseChk/rainy` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/20") + + (txt ? `/${txt}` : `/${currentYear}`) + + (sgg ? `/${sgg}` : "/0") ); return rainRes; }; @@ -131,32 +144,31 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => { try { const res = await postFectch("/reuseChk/rainy", excelData); - console.log("res", res); - console.log("res.ok", res.ok) - if (res.ok) { - ToastFormUi({ - body: "지도점검 등록이 완료되었습니다. ", - title: "지도점검 등록", - }); + if (res.status === 200) { + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch("1", "20", currentYear, "0"); + return set((state: rainChkgdnState) => ({ + ...state, + rainChkgdn: { + ...state.rainChkgdn, + rainChk: rainChkRes, + }, + })); + toast.success("지도점검 등록이 완료되었습니다."); + } else { + toast.error("지도점검 등록이 실패되었습니다."); } - const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "0"); - return set((state: rainChkgdnState) => ({ - ...state, - rainChkgdn: { - ...state.rainChkgdn, - rainChk: rainChkRes, - }, - })); } catch (error) { console.log(error); - ToastFormUi({ - body: "지도점검 등록이 실패되었습니다.", - title: "지도점검 등록", - }); + toast.error("지도점검 등록이 실패되었습니다."); } }, - rainChkInit: async (pageNo: string, cnt: string, searchTxt: string, sggCd: string) => { + rainChkInit: async ( + pageNo: string, + cnt: string, + searchTxt: string, + sggCd: string + ) => { try { const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); @@ -176,47 +188,49 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( const chData = await makeMdfrChk(rainChk, "rain", "rainDetil"); const res = await postFectch("/reuseChk/rainy", chData); - if (res.ok) { - ToastFormUi({ - body: "지도점검 보급수 및 밋물이용량 수정이 완료되었습니다. ", - title: "지도점검 수정", - }); + if (res.staus === 200) { + toast.success( + "지도점검 보급수 및 밋물이용량 수정이 완료되었습니다. " + ); + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch("1", "20", currentYear, "11"); + return set((state: rainChkgdnState) => ({ + ...state, + rainChkgdn: { + ...state.rainChkgdn, + rainChk: rainChkRes, + }, + })); + } else { + toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다."); } - const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch(currentYear, "0"); - return set((state: rainChkgdnState) => ({ - ...state, - rainChkgdn: { - ...state.rainChkgdn, - rainChk: rainChkRes, - }, - })); } catch (error) { console.log(error); - alert("수정에 실패하였습니다."); + toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다."); } }, rainChkGuidUpdate: async (rainChk: rainChkZodType) => { try { //const chData = await makeMdfrChk(rainChk, "guideDetails", "rainDetil"); const res = await putFectch("/reuseChk/rainy", rainChk); - if (res.ok) { - ToastFormUi({ - body: "지도점검 수질 및 과태료 수정이 완료되었습니다. ", - title: "지도점검 수정", - }); + if (res.status === 200) { + toast.success("지도점검 수질 및 과태료 수정이 완료되었습니다. "); + + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch("1", "20", currentYear, "11"); + return set((state: rainChkgdnState) => ({ + ...state, + rainChkgdn: { + ...state.rainChkgdn, + rainChk: rainChkRes, + }, + })); + }else{ + toast.error("지도점검 수질 및 과태료 수정 오류입니다."); + } - const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch(currentYear, "0"); - return set((state: rainChkgdnState) => ({ - ...state, - rainChkgdn: { - ...state.rainChkgdn, - rainChk: rainChkRes, - }, - })); } catch (error) { - console.log(error); + toast.error("지도점검 수질 및 과태료 수정 오류입니다."); } }, rainChkDelete: async (chkgdnPks: number[]) => { @@ -224,22 +238,23 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( const res = await deleteFectch(`/reuseChk/rainy`, chkgdnPks); if (res) { - ToastFormUi({ - body: "삭제가 완료되었습니다. ", - title: "지도점검 삭제", - }); + toast.success("삭제가 완료되었습니다. "); + + const currentYear = new Date().getFullYear().toString(); + const rainChkRes = await initFetch("1", "20", currentYear, "11"); + return set((state: rainChkgdnState) => ({ + ...state, + rainChkgdn: { + ...state.rainChkgdn, + rainChk: rainChkRes, + }, + })); + }else{ + toast.error("삭제시 오류가 발생하였습니다.. "); + } - const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch(currentYear, "0"); - return set((state: rainChkgdnState) => ({ - ...state, - rainChkgdn: { - ...state.rainChkgdn, - rainChk: rainChkRes, - }, - })); } catch (error) { - ToastFormUi({ body: "삭제를 실패했습니다.. ", title: "지도점검 삭제" }); + toast.error("삭제시 오류가 발생하였습니다.. "); } }, rainChkHeadChange: async (rainChkgdn: rainChkgdnState, isEdit: boolean) => { @@ -249,16 +264,13 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( const ruseHeadList = rainChkgdn.rainChkgdn.ruseHeadList; rainChkgdnHeadList.forEach((head) => { - if (head.edit !== undefined) - head.edit = isEdit; + if (head.edit !== undefined) head.edit = isEdit; }); splHeadList.forEach((head) => { - if (head.edit !== undefined) - head.edit = isEdit; + if (head.edit !== undefined) head.edit = isEdit; }); ruseHeadList.forEach((head) => { - if (head.edit !== undefined) - head.edit = isEdit; + if (head.edit !== undefined) head.edit = isEdit; }); return set((state: rainChkgdnState) => ({ @@ -267,7 +279,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( ...state.rainChkgdn, rainChkgdnHeadList: rainChkgdnHeadList, splHeadList: splHeadList, - ruseHeadList: ruseHeadList + ruseHeadList: ruseHeadList, }, })); } catch (error) { diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/headList.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/headList.tsx index f112db0bd..8c90e0829 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/headList.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/headList.tsx @@ -11,7 +11,7 @@ export const rainChkgdnHeadSttnExport: TableUpperProps[] = [ { id: "dtfcltCpct", title: "빗물저류조용량(m³)", mergeCell: true }, { id: "chckYmd", title: "점검일", mergeCell: true }, { id: "utztnUsgCd", title: "이용용도" }, - { id: "totalSplyUswtrUtztnQnt", title: "연간보급수이용량(m³)" }, + { id: "totalSplyUswtrUtztnQnt", title: "연간대체수이용량(m³)" }, { id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" }, { id: "ph", diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index ea3f58a40..2136dfebe 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -1,11 +1,10 @@ import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import { type TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { getFetch } from "@/components/lib/api"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import type { SelectDataType } from "@common/business_components/ui"; import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList"; import { rainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { buildingExcelRainSttn } from "./excel"; +import type { TableUpperProps } from "@/app/store/common/type/header"; const fcltDiv = [ { val: "RST", text: "중수도시설" }, diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index 9ac26827d..7a35e02c4 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -103,6 +103,7 @@ export const chRowspanTable = ( const key = head.id; const isMerged = head.mergeCell; const value = row[key]; + // 병합 대상이면 중복 렌더링 여부 판단 if (isMerged) { const renderedSet = renderedMap.get(key) ?? new Set(); @@ -152,7 +153,7 @@ export const chRowspanTable = ( onChange={(e) => { handleChange(rowIndex, head.id, e.target.value); }} - value={value ?? ""} + value={value || ""} disabled={!selectedIds.includes(row.chkgdnPk)} /> ) : ( diff --git a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx index 15badc59d..8828420b8 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx @@ -1,7 +1,7 @@ import { useWrStore } from "@/app/store"; import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import { excelToRainChkData } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel"; -import { chkgdRegExcel } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; +import { chkgdRegExcel } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { excelToRswtGuideData, @@ -18,24 +18,31 @@ import { SelectBox, Title, } from "@common/business_components/ui"; +import { Card } from "@common/business_components/ui/chart/lib/card"; import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; import type { z } from "zod"; export default function ChkgdExcel({ type }: { type: string }) { - const { - rswtChkgdn, - rainChkExcelDataUPload, - rswtChkExceDataUpload, - } = useWrStore((state) => { - return state; - }); - const [files, setFiles] = useState(null); + const { rswtChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload } = + useWrStore((state) => { + return state; + }); const [excelData, setExcelData] = useState< rswtChkZodType[] | rainChkZodType[] >(); + + const [file, setFile] = useState(null); + + const handleFileChange = (e: React.ChangeEvent) => { + const selectedFile = e.target.files?.[0]; + if (selectedFile) { + setFile(selectedFile); + } + }; const [excelRswtData, setExcelRswtData] = useState(); const currentYear = new Date().getFullYear(); @@ -49,7 +56,7 @@ export default function ChkgdExcel({ type }: { type: string }) { ); const defaultValues: z.infer = chkgdRegExcel.parse({ - chckYr: String(currentYear) + chckYr: String(currentYear), }); const form = useForm>({ @@ -58,14 +65,10 @@ export default function ChkgdExcel({ type }: { type: string }) { }); useEffect(() => { - if (files) { - const file = files[0]; + if (file) { if (form.getValues("chckYr").length < 1) { - ToastFormUi({ - body: "파일업로드 이전에 등록년도를 작성해주세요 ", - title: "지도점검 등록", - }); - setFiles(null); + toast.error("파일업로드 이전에 등록년도를 작성해주세요 "); + setFile(null); return; } if (file) @@ -87,7 +90,6 @@ export default function ChkgdExcel({ type }: { type: string }) { form.getValues("chckYr") ); - const keyGenerator = (item: rswtChkZodType) => `${item.bdstRuseFcltFk}|${item.chckYmd}|${item.utztnUsgCd}`; const totalData: rswtChkZodType[] = guideData.map((guide) => { @@ -98,12 +100,11 @@ export default function ChkgdExcel({ type }: { type: string }) { guide.utztnUsgCd === polution.utztnUsgCd ); - if (fusion) { return { ...guide, rswtrPollutions: fusion?.rswtrPollutions, - rswtrDetails:fusion?.rswtrDetails + rswtrDetails: fusion?.rswtrDetails, }; } else { return { @@ -118,19 +119,17 @@ export default function ChkgdExcel({ type }: { type: string }) { (item) => !guideKey.has(keyGenerator(item)) ); + const listTotalData: rswtChkZodType[] = [ + ...totalData, + ...onlypolution, + ]; - const listTotalData:rswtChkZodType[] =[ - ...totalData, - ...onlypolution - ] - - - setExcelRswtData(listTotalData); + setExcelRswtData(listTotalData); } }); } } - }, [files]); + }, [file]); function findMatchingItems( arrayA: T[], @@ -144,7 +143,6 @@ export default function ChkgdExcel({ type }: { type: string }) { (!condition || condition(item)) && bKeySet.has(keySelector(item)) ); } - const onSubmit = (values: z.infer) => { if (values.chckYr === "") { @@ -160,7 +158,6 @@ export default function ChkgdExcel({ type }: { type: string }) { }); return; } else { - rainChkExcelDataUPload(excelData as rainChkZodType[]); } } else if (type === "RST") { @@ -223,13 +220,13 @@ export default function ChkgdExcel({ type }: { type: string }) { name="file" render={({ field }) => ( - { - if (files) setFiles(files); - }} - fileTypes="xlsx" - > +
+ +
)} /> diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index 4e3d61008..965bc7275 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -39,7 +39,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { "4": [] as z.infer[], }); - const { rainChk, ruseHeadList, splHeadList } = rainChkgdn; const [updateData, setUpdateData] = useState(); const initStats = (): z.infer => ({ @@ -97,7 +96,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { target = { utztnUsgCd: code, ruseTotal: 0, splTotal: 0 }; acc.push(target); } - // 월별 값 누적 target[ruseMonthKey] = (target[ruseMonthKey] ?? 0) + ruseValue; target[splMonthKey] = (target[splMonthKey] ?? 0) + splValue; @@ -106,7 +104,18 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { target.splTotal += splValue; return acc; }, []); - setGuidData(result); + + if (result) { + // '기타' 항목을 배열의 맨 뒤로 정렬합니다. + result.sort((a: splRuseWaterType, b: splRuseWaterType) => { + if (a.utztnUsgCd === "기타") return 1; // a를 b 뒤로 보냅니다. + if (b.utztnUsgCd === "기타") return -1; // b를 a 뒤로 보냅니다. + return 0; // 순서를 유지합니다. + }); + } + + console.log("result ", result); + setGuidData(result as splRuseWaterType[]); if (obj.rswtrPollutions) { const resultPolution: Record = { @@ -159,6 +168,14 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { if (!resultPolution[nodeKey]) { resultPolution[nodeKey] = []; } + + // '기타' 항목을 배열의 맨 뒤로 정렬합니다. + resultPolution[nodeKey].sort((a: any, b: any) => { + if (a.utztnUsgCd === "기타") return 1; // a를 b 뒤로 보냅니다. + if (b.utztnUsgCd === "기타") return -1; // b를 a 뒤로 보냅니다. + return 0; // 순서를 유지합니다. + }); + resultPolution[nodeKey].push(average); }); diff --git a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx index 5166b461f..720a73ab4 100644 --- a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx @@ -70,10 +70,15 @@ export default function RainChkgdTable({ }, [makeTableData, handleClick]); + useEffect(() =>{ + + + },[rainChkgdn.rainChk]) useEffect(() => { setSelectedIds([])// 셀렉트 초기화를 위한 작업 if (rainChkData) { + const rainChg = rainChkData.map((item: any) => { const bud = tableData([item.building], { code }); return { @@ -82,6 +87,7 @@ export default function RainChkgdTable({ rowspan: item.rainyDetails?.length, }; }); + setMakeTableData(rainChkTableData(rainChg)); } }, [rainChkData, code]); @@ -106,7 +112,6 @@ export default function RainChkgdTable({ ); if (findRain != undefined) { - console.log(findRain) return { ...rd, ph: Number(findRain.ph), diff --git a/apps/wr/public/sample_rainy.xlsx b/apps/wr/public/sample_rainy.xlsx index 73a52d89c3472af48a29d34e8e4edd82fbfbeacc..ec7577c510bf5ffefdbf146c56ac3d6569ce5b0b 100644 GIT binary patch delta 5270 zcmZ9QWmuHmx5kI=ZlqzPK|+Ua31JYVVQ4|=?ifUn&Vd00B&9=g=#cI%X(WZAMnXV2 z_@3*3&Uw%CVgL4C&sz7jKkVzi_Fj_)e+-DU)G;tA0oVXsKymC=4G}&XdhAvm9op(Y zyheBVhjy6#|4;~<{U7S%KyZj+w~SHoh#fk70N~mJ)=5kSU3Gc%oD{0E1r=)!#Zmfk z!ci2jzO~C?1}J^5fUYZk2CVrK)ZZaDtYcza*r=;jn#W&QlAAwWMv}*`$GpK@HgS(3 z62L6!u)g|j+|R?ABf0gpZ7`}GAt^Ild}RzqIutBBq$5*xFJC|YOos&5t-W=rE|d{3 z7UV0|G*}CS7Od0>h{n}Pez3HYn>wy6^yVu^nMtfJuLv18tf|#m*KdMMY!P~O8?~+3 z$6hVUm1~Om`XbpQuc>D$jSI5NQkGl!+ifoD!5#>wcZT=y-MiiQ5-Sj64Ljo2G9!@w zt38^vDb2QkEv4PNucZ@16TbJzYH#r2Y$%E-7#a-S{EZ^u<~QXoHZ@8;hcE52d5o}7 zoahd>yEIfgfJq1Iagx0&ZNv~a3C>Gbg7(!pvis|6Z;sMij$KUR8kcN*Kx0Kqb9`Sg zH%2Ag8Fz=39CK?sc*H#mm8ft$eFCh3pAYFST_~Glk@g5}2jSY9MKI=RWMljoHd$`5 zE)?oVc%@_~=w^($@h1UvWG)zg@+9M)a|gj2W(T3$!wmRXwBm?4CX6sGmS`T7;^5kr zyeR4Z4llhc!JS&_W5+&dazBsW?xl1@^G2C^=#n|(ZeO&;uaYd&#Mw>B3gM3&Mu#1g ztG^LOTaus{^SpG?t!rBStjvv7PS9D&XA6CwMTuB_p=aoc8RmEAP8}mMH{b=9gMh4@ ze5#;u&%1oLu`(qR>iRg_8FRfo8n-9{AD$h}vD#Q?lL&&b-@jJEi7WJ$ZI?qjU%+I$ zKK4X%6fUoR3wNxF6mBec{CyZfQU#=IBRT_#vKA*Uie$#!l(dNe@9>ic=Ig5rwxBST zdfI6h<@5RZm^WFX8I@9?SoxH>u7TRop}Lo`1GvUDf^c1;L zo|4&5ot6DL+hw)?lGvgkxd4F6PqlHPEt~TJdMGtd19y}6J>nzzB5kJ zGXcB^Q30%OX@MaKPnu}4V=&$(u<6rL{p8z^%?9)C*M0tIM5kQMDX-fS3n;BWFaV{jCu@IMfTH4jqL=&mHJ@ zf~3BjjcY}24gfdTqVl1+CeGagy;JzC@3^W|Tm9V+caN1Re8Lo$FiSW&>GiZUDRT3( zxLyrK)v+0VsuFx7d@O%je=Ze3K$L*PS(FWdo}H-V%8Auo5{-*~9IF%SLLI=@M+tzZ z=WEn-P4C)Cq#S#f9^H|R16G(BWyYU>hB!QHT;?xu+FVSWTkM5SWq_MRv$WHHuFaF0 z`y>u*5_%JCR?JCc?}qCoNMdw5R|-A7ZXg~Uq>|e;VDeR(ZQz7qIE=z_u0`` z#n$&#&ZH^%!k7Ip_=pHu z&!!et9*yavT8pK^uN=Px2;g8Y4dZ~WFCHP}M<2CP#DBPNHnSS}XV!9;~&%g~aMhr#{zfaf=3(Q^Jm zQR!Zv_@6^|GDnky*)7%()t9J-_R7+Pizq;?w5VgFFJ|K2tGo(%?n_LuM+xy4o6nX% zKs2^5JR#78C9UCV~iTr0L$pFx6K)@uRvs?fkQjc7d&Zx>L!zB%*V@}%-_~cQE8S(T-J!Gu$My{ z*l0(i3hZZ5c()cZ!2;W^-!o3Toucus<)p-%BAqD6Wv(yBA6EG-fv1M=P~01w^qd?rYq@V-AG2>!g?| z1~zqm5q*%egyCJgLN|Zm?_uPOr$>@p(Y#gt#Ru+>xK*$B(6-&{djgGe!_B;y@+Ugm z{6qddvHhHPc>Hg9uNdFpmg_@BTKWl=Q3uJx@2{G2cLF0|CEx1lycMio#F1%#E0(cyJ7G@PaX+9UU`q}SIPprEL-LZ`zN{jy zTC1;?Wq@2cnUi{P4Tmmv_-j8}Sw@`PGSsr+q$fl*h6W+myDKrwiMs!MpR&)f={Vi* zli+q(xXkWZm>|BDWqg|(F`*DE>%C2GHzX-|lwy1cSf+51Pj-)fJA^8Hppc)3)2eMm8c}!yxmo8QeRIYL`qE1P%!= znL$Ulvc7QZ9`7uAVpSkKz)!CI@w|rxHJAv?()FZ~(}YhEua*fpnG7LkSGM(3wYtsA zQL<_q4CUu=Q`*U^3Ih_q#PH>Kfx3^7-+}(?+G*^@M3CBv2>@h~!|3T4pr$VLDwILh zv-e-VajLv%lcQgVvMAt5rn<IaRZVGlV!DXO-ng{SvGn&-lsOE~(qO3M%#()=I}Ia0x6tYU zbT(_N6nHW7tw8Ur`R>BN5~??cnf~z=`xd;&NfyTOwDB`X!4G$T6E(DR4+&VT{i#SD zcj+=6@J4y{6(xU0qQbkb=#EsI5C;A4?uIbvwGf}3 zyCGZWKCVFezTsZ%HxN8%<|hE>*6?JDBq-4Erv({&#F2El;{;_+`k=5=*E=BzdT*zKzNZp5t29|5!epj(CWl%ox<#u;P_f? zD3LUdn=!UP=H|q|@h53>)L7#4lwXNkbh%Nt^MdveOZxW5>22VTF2*rvT9gXKciXeR zp?2EK3zHTa6jP_RGqn3G_{q-zDe*&2Z{C>lApCe6r-t_v)tldkOj$Hw+O5_;>rR*v z&v3Yfef$|{PM>=xcTG?JNH2CAAnmX?9W=m}zKrNNi}-Y{$opp!@n^D3_U9}!KDMnz zH(ff2B_-F4?&mD3t0em+M|{X~fJkAU;sUxbsz>LoP|h9%)a-{zOng5WdVo=fo`XtwvPjq=g=^ zt~|2#N!y`$TTXFk?lK?48^c*@S87evM@bDPL`^Asd94=WmvqSSZQ}uL4$UX1S<0i< z%z^%$)zT}qhQ7%eVZU!y&TGE|cRdO+uiFk8F0@Q=SjE*yW+TdV;==;Zq^mL$RZipZ zr7Nx&SI;X%y|~2JwDZZ4jVe_i(DOJ)&?XmNN~;U-w_cD;;m`EptvCc>Qypfd=7w&5 zO`YJ-YONHxYsA357Ma`(fQ+9(g<6BY$83H&aF{tZ9+&sNd9r^^_=DfxTN^J>rhBeR zhleflbzIbN(mo3u9Hd+ls=*M)PdB66#n~c?bwo^NV}`_Sf~%+i(TMRY0ckI_3b=Bw zsO98Xa>aG;#gIZzu~a?C8R4JPYzAuJR_v;w-D8tC@3NBU%%9?=(_MU5K>TyG^1k0WDH_m{Oz z3JY>IMU|%|B~)n6cr8F7;4O@WeGoLbB<~q1GU7-*1W<@O%(K>YWha2gD_e%Y-Lb&F zVbt`^MDV|)2m5LuK1o0iwB!^6FGHoG?- z2-y{1+NuEdJc=}bN`^$`GV)PDSi4Ebuu@io#3Qp`SAACf)si}d-uZr>G-}`H7~j)S z88QaAI-S-gHw$5GMF-M9t{N;RHQ3gPPE2F+mV5&i8Z~MLHt-+Cu$=$DkyRJ+ZBwT2-E3^!}Qb~G|dV*Mjr`BKij`5@$ zp^6I8KaBOeKo37m=^;w^?znJ^g4IyNse}e&)vl)(5)+F=6W+k`Fb+FId927~XH<(9 z4N8yLgR67qi`Q1srrymnPe!QF$>pD{I>mr#AI$2LMPo=^zUm4ngz~555I!8Q5uKuG zoMe2&Mw#G}x&cj#HpFNWog@pY*kJ%5v^Z=u`Cu{w)z}VrEPf&gDgNC_f!)dyxvuX1 zZQ<3bw{pO`7;j@ys{#bIrQSil+#A=Pu7rlio~sRG{W? zmg4Z0n|ygQTS9LE8(SD|(o}d9YY#!b8=nbtIcII0w@sl<{&JIV+)W4;YeP|i z4ZB3@pxR_SJZ`_FFFx663p@Z6pR$Z$eEy6P>hKi3X1x!`yMFGm^&!cWT?peCb)3E~ zC;BhOsb^DD9~k*faJ_zU&rPK@v`TU~m*mFy^^g!VB$9eKfzO(Vs$DUT_U$=d#vPML z5#nM4gI)P-nx6IbMG>rp8A)+o#aJAlYyyTUx0;ngV*HifvQ%2PtS-n*o$0Ly7P!{5+$n!qL(XFACFF7X<8`^Ua!L70t7F)zQP`a!O|a>? zWo6>Emw8C={=+7u1@aeBfs2^~F{8VoWL9dZ6F@KdZs)r=KBHHuN&TAe37u3JcK^9w zS?#pe@B_}LH);YumGw&Xk&f(@z8ITnkK94&0*kw?>BRL8>@4_ri+SYZ3R&RUI;jP| zXGg!EJF1t9K9z4Q)%*0Rh^7Wyc|O~kE;^-J4&hm@!G??#$I@5`nJIYSt_Vv25=tI$XwU43Q= zji&%>S87bAcTXM0``j=m$T`e~Ys#}f&Q}=i%F1E7lDWA1I(a2j^zy%Luop>B6U_L- z+H{TgFMBYqQ)M^D_}h9becbrB#RjwF0{z8DE~&p*8d5&8-vERpFEESZPqKanJ+hX@dc zh2+97-Dg#E{Yh5(0uqhjfQ@NJ`Q0Y$pbp-fLi3Qu_bQ2LC~u*Na^ce_9g1~VOXWNI#45)*Sb zG|ZXglks1Bw6-^Vf_Oi^e=&8)urPMQvrHcVyxQt319&8%E5$p3=5ZG}E(C81UabyQ zitL5`uJ<-&v=}Uir;l9MevxK>nQ74LJC-xR(nzcNI@V>S*qqm$h&<#` ze$I^VrHFoxjbfacY(DDYmYzW`Cx`v(2~&s6+L|M?-14+n23JOZy5+Qfpjc~bDx)$w zn!QTM$Sa7FGzP{zDZ@`rDd3}ac z^U06e!djX$=Nt~)s$5a&Y*&4=Z4Fq{m*U?h@z%efjJTOMe}?Os%Jrd(LKZApYB#}K z401z%=>wID4t|@?#S}nHRS(7gT!?!zH@w+A^4b-bctF1NfdS8J0IqY~`rP^>S5Sb~ zcT<2vHb^~2@DFt_!nxINhzQkpe6mDqB>Auv$^+w_bE-d8*DK^L9S4^eXVo9pkCcuU zKH+x~bB44xeCW~04tT47raSPlxurt9apor$!dUM!!oRGrTmI^4IoHzy3o7NS%ylG| zE^c|*ruhKd;5>rKX#y{y=m%g-07t8-Qw0v55vo_XyD z(ce?<=@}A&OZv=#PvficI3s)yD-Z|FRY^AoXj$5$PH*@?b*sQ5X4+>@)Par2QhLdq zVCI-)ERnW>uqKXd)(0HfA+DU+H7VV;qg<_sFn{u?{40)qEuzL@gXnf2y6$^S12j61 zx7~eIAEou^VWv61tq5Fn>YBA<3M76n;`5H%Bq?j~;W~9HV?USuAwt_l?Ct0et#J`T z0nfMwUo^>;?(PF4v0QfPNNpgo&{!DX?b>$OfAC~t;M1Q_?`@Lt{&a6m6P zoN>8Qi`FZBXkU&-{c8iMx72=Ah!NdXe4??Oqps7REd1szlwBIb7iC>&u}6=~ zxx)OThl_CTnBtL!DU4Wf7K09qVI$~QkC5)K?0Ng0@WJYc1<%CG2Xl|as=Aj>Y81lh zBWyzm{i8o)QmMe*{04!sZ{_^VUf!`CV}CXDhy`LLPi?AvM$|{if>?#SzjfDL7NCgh zeWFyFiqypiAfHCQy!7nLD4jcR$ps0cWhjJg5=%N1oYF93dEcshqw<;&4kNEpwnBnF z%cu_GO$p?*0yU>02!C`eRWl*(lmO3>`YKaysD6k7PMC*sA2q<$QHfvbF{4kQPj9dq zUW4AftkcglXnK9rCt}pHK5dw3fNLB$LahG$clt3h+?u#e)Jv)EJQtd$J20K5pI*E` zrC4hm9!+RYF7ozSy2PJgt27YDu4q1&26}U|pT*QI-ZEKKsnEh|oP9>BjLVqi1?ITT zt3WynyGBfwabCc-5oDP%Um-7H-+jpRrdznyG^A>@)-+gPcz>38J!2lKKx;=Q@^*4M z9&SGN5~G`|))a^ux-GyT**ACqKiQ{#5G&Mr8ksKBic^df(^9PVC>T-s;korwvctPH z;odLHc1f?JF$N{S+>eYuMgwaSXmd&4yVV!;fR-|ne*r{PY!<6O_Iwv2KL;crKCkc) z^%r*r%i^g0!ec-Oo&-)%zqC(>yIPQ&y1_i>DEsB_jedr)Y}Zd2uP=k6&+tC5 z*U74+U`J;TCvs1#pRntf%>+PVa)PtCRl;82*^~A5St=}9Yt!f~W_P)y5%Lqt>yC1^ zS!rKEv;h{Pw2=ClE!LJcU5!wi`Wj6G1#UM-TZPFgS32sA$Gan5+{YZI1n2f6${Vh- ze4X#yhPuI;8`K>5RK_WqxlfSRnFTZN@h_fn@|Z(DM|tX_Or$t||8<0dDQW7%2L-<2 zmVC=9kDB`83-NipC<-x}1V`+BK1|z&U1+lAa03%hb)JgIL`mQros)=t)yr9xe|B_KvL%%MdQjWYbu*Q|@Hs2>!nFwJP zA5m6A6S4Pt&f4X(?W>%^Qos4W%4{!Yeq$RXao2HSX}le2?TNgV3~c^S>i1WnKD?70 z+6--e%H37%HAAL6lpg{ga)=3_%UDW;d2y>lljz?MQaL_6C|7E4 zAc+6Es$Mik+1L(W5a0Bv*6|9WZwom9To2^rU;UL=tohJ^vlKx=$F%GzFG2E5oGd$1Eq6AdmRW&$r9}7^$m&02b??n zntZ|H4t{(oxb0@*jaX)uYZ7fa&G7$wz3Wx%AEi(pTsjiHWI9(r**I{pl=vt~ceVAZ zT0!pG``6ZEE?i6gt+5>^1m!Z}_LK~_2I^q0DB(tiG05$G2m=ej9x$N`MyUS&u6AIU z5J7q~sXDOI{{~R|Nw}KTq%@%SIGXIi(zvMz_cxA~g;f84NXqlHh$aucR(6|13opb> zPFAz5t%q7GjfxK8m#*i#!;{HZMtq?2uE|@TL}b8prWX!Kn58%z9NveEW{!s#UBcDz z^AU&GZH`Y8|5S_9^iiDBW_)3ZTKa2A_6$gpTuk|t*R5opK`p^by!wWV|5_ua|K?xQ zs7c_GH{NS(5U7z11fm3iKt6DO4+l$kTN^!3cgL6Z9(+D7@OGmm#DW1O@UHF#SR2+U zneJDZ)4`Z|&Ru#|wPhKY!*xo*E+@3FJjKNNB|QqalpRdXE*M+~1wk4A>^bqwNArz;2l@O} zK(4#?s76oQK2Gow+ypxakbS zQeLjSFYgC~ac@%XFdZ-@84zTI-K%t_yzip_#C^zZ_03)<)K1s9)5P8HT!k|70vbeq ziqYxj+x4fT=kkokerIAINK-7xyY8)crxir+Ib8=?w(mQ@k^LAd67A-EvbhG;dSV zHBqK;&ibVjg^YD^f<$GH+;-u54lln(8UOY>J!fyuBjh7C<_6aanbERkthbbQyBs zM~e2~^mfzvH5LW$0uZrGqE~O_r5Rcges9hk*S5A?t>Yoe(yg+mECmg;eiu>*&StSg zOSzNgXRq9aYR(3Ha=S65G)R9%p0JJW{kfF>GMN{@N^dxzoNZJ}o;a=VAlaqYVwM^9 zDU<$nFB7kt1wTMRCMi5}E$=yyj?i8;zqt?ZoONTAqAkgZ1Yn`iWu##p3p0waz{b2g)? znsq|ma~nM?;HwJxdmXqm%u<8?3ua#7l@)#hkBtmrI^m*V`+BfX=Af@zo`EGzL@F*M zDJRK^$m&tkqS#;2sO_j?U^HVj0bg8Mnx``BWP4*QJ`sCL(+ToYNzH}T=gAS(D0jUM zDmHI9*RE(jZ;ZFK(E;bF6Py%U@wkO!qVBMOszyHopg;GHIx4jShX`f=Ua=HFe+FX%FLWCRe(^6GL*+0*P@f=#C`KmW_H%uk*53V{fAEgVEMkE`(0iz0HabA? z&de$d7u}}>$O7#nfTLZ;m6SrqhXmFpPeOE`^jvAZO6k>G6lzFT=**cJji!`;N*WZk zdA_^9=itquWq!@)j?no2(0YqfB`8Y9q!6BzTE=~G{O7n2zdcJ95Sy>Q$TQX(mZg0v zrdPM!2F6oFRXQqy-|5#O`85n^0A!DIJ7H#Np$!Wjl`mQ3ngEx&0c)Q?5xwLo`n7<2H{rRV=|{5Gq*mvqpa_eSq#h(k@-bXv-0|KKFh{Oxexdu+Al?xV^!+Xf_G2-(E#e$P@Ij z*{9Vo;IGZ`2vvIx@(d#84=CrOnJq)&SM^#PC3xzneC+9S>^a&CO$qfJ2&nYSOLAwP zKiiMYtGcq`n^0}Rsn`Ysrv+dKh(nyIg;03D6YOrO~EF>mFR(db8>P;WbrOVNnSV6`)Ynu`ZBzZQ}bc;IW==H&-0p~pWsFe zBJIqKvon&n&%5yy7Z=6h?+rZb5Lf`3f2f+kbaK+Br=!#ohzd;I{>vVP8~B}6%<+Mg z9m)FgebMOP8?`zT&ARCLpU}{j%alFZ;svO9G*R~uT(>qGPnxwCrbk}gscLPh;HfF9 z+Zu7H1jjYPF7UCie$t0lCeC3s(mIET_5a|_!Zt+*>&E#MkX0!|S!>952BOfaFfJte z#DoH_WX=qrh~d3kg6qAiZIY_QF1<5?>(i=jvZ}H0-d5}0j5wcc*LYgpfIQk#6t8;*68oC^E;5cv)OAW|wE()I-% zz>r>`ioq|e5<}y8A4#+B6r~%=Qk{xQ&|Y}$lWWp}VE_I#3&irQ>&E*k8l+r=pho}s zHAy8$Xn^*g!efZ;q+gC~C{dMi`Pix-2SQ&j1?4{Z;mGXbew}#d{J)*SWI>>Dl=s#H zxCv^5+4QmQR&R3;8}3$Ys01$YI}CEk+yR$c_6{oC(su~uR=vY8xBUMs;iw^e%(vF^ zzjM>==mf&J3m{B7lr@Cyu6Z6pkJ-tHs$inO^(LDCDxOTY3I~dwhlJ^076k&){?q^8 wd$>`mJY088t~~S@Qm9xSuDkl_ixj5t+lPd4L7@Bps?S1w;dzLw%XKII2Mo>8jQ{`u From 31140ea19046ab6e5d95cf223de149da7593fdfb Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 2 Jul 2025 20:19:48 +0900 Subject: [PATCH 121/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=EC=8B=9C=EC=84=A4=ED=98=84=ED=99=A9=20=EA=B2=B0?= =?UTF-8?q?=ED=95=A8=EB=8C=80=EC=9E=A5=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 149 ++++++++++++++++-- .../fcltSttn/rainSttn/headList.tsx | 8 +- .../ruseFcltMng/fcltSttn/rainSttn/index.tsx | 3 + .../sttn/pbnstSttnModal/pbnstSttnModal.tsx | 133 ++++++++-------- 4 files changed, 213 insertions(+), 80 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index f101be91b..7e068bcd0 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { excelDownload, + getCity, getCityOrSgg, tableData, } from "@/components/lib/func/commom"; @@ -11,10 +12,16 @@ import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal"; import { ContentsDiv, SearchBaseForm, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, Title, UiModal, UiTable, type ReturnType, + type SelectDataType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; @@ -26,6 +33,7 @@ import type { import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal"; import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; export default function RainSttn() { const { code, rainSttn, rainSttnSearch, rainSttnInit } = useWrStore( @@ -37,6 +45,8 @@ export default function RainSttn() { const [pageNation, setPageNation] = useState(1); const [isChHead, setIsChHead] = useState(false); const [bdstTable, setBdstTable] = useState(); + const [selectSgg, setSelectSgg] = useState() + const [objSearch, setObjSearch] = useState({ sgg: "", city: "" }); const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false }) const [bdstChgProps, setBdstChgProps] = useState<{ isOpen: boolean; @@ -56,6 +66,38 @@ export default function RainSttn() { } }; + const getSelCity = (val: string | number) => { + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setObjSearch({ city: cityValue, sgg: "" }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } + }; + + const getSgg = (val: string | number) => { + console.log("val", val) + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + + const getConValue = () => { + if (!objSearch.city || objSearch.city === "0") { + return "0"; + } + if (objSearch.sgg && objSearch.sgg !== "0") { + return objSearch.sgg; + } + return objSearch.city; + }; + + + useEffect(() => { if (!rainSttn.isInit) { rainSttnInit(codeData ?? "0"); @@ -63,19 +105,30 @@ export default function RainSttn() { }, [rainSttn.isInit, rainSttnInit]); useEffect(() => { - if (rainSttnRes.length > 0 && code.cityCd.length > 0) { - const data = tableData(rainSttnRes, { code }); - const chData = data - .map((item: any) => ({ + const data = tableData(rainSttnRes, { code }); + const chData = data + .map((item: any) => { + console.log("item", item); + console.log("왜안돼", item.reuseBuilding[0].rainyObj.dtfcltCpct) + return { ...item, ...item.reuseBuilding[0], ...item.reuseBuilding[0].rainyObj, + dtfcltCpct: item.reuseBuilding[0].rainyObj.dtfcltCpct === -1 + ? "확인불가" + : item.reuseBuilding[0].rainyObj.dtfcltCpct, + instlCst: item.reuseBuilding[0].instlCst === -1 + ? "확인불가" + : item.reuseBuilding[0].instlCst, + instlCstSprtAmt: item.reuseBuilding[0].instlCstSprtAmt === -1 + ? "확인불가" + : item.reuseBuilding[0].instlCstSprtAmt, chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", - })) - .filter((item: any) => item.rainyObj !== undefined); - - setBdstTable(chData); - } + }; + }) + .filter((item: any) => item.rainyObj !== undefined); + console.log("chData", chData) + setBdstTable(chData); }, [code, rainSttnRes, rainSttn.rainSttHeadList]); useEffect(() => { @@ -94,9 +147,14 @@ export default function RainSttn() { } }, [rainSttn.excelList]); + // const excelClick = useCallback(() => { + // if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd); + // }, [rainSttnSearch, codeData, code.cityCd, code.sggCd]); const excelClick = useCallback(() => { - if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd); - }, [rainSttnSearch, codeData, code.cityCd, code.sggCd]); + // 최신 검색 조건 반영 + const con = getConValue(); + rainSttnSearch(1, "10000", String(con), code.cityCd, code.sggCd); + }, [rainSttnSearch, objSearch, code.cityCd, code.sggCd]); return ( <> @@ -104,7 +162,70 @@ export default function RainSttn() {
- <SearchBaseForm + + + <SearchDiv> + <SearchFormLeft> + <div className="col-span-10 flex flex-row"> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd} + onSelectValue={getSelCity} + /> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl ml-4" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + value={objSearch.sgg} // value props 추가 + onSelectValue={getSgg} + /> + </div> + </SearchFormLeft> + <SearchFormRight + className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="flex flex-row space-x-2 items-center"> + <Button + size={"sm"} + onClick={() => { + const con = getConValue(); + rainSttnSearch(1, "20", String(con), code.cityCd, code.sggCd); + }} + > + 조회 + </Button> + <Button + size={"sm"} + className={`${btnClass} green`} + onClick={excelClick} + > + 다운로드 + </Button> + <Button + size={"sm"} + className={btnClass} + onClick={() => { + setIsChHead(true); + }} + > + 조회항목설정 + </Button> + </div> + </SearchFormRight> + </SearchDiv> + + + + + + + + + + + {/* <SearchBaseForm selectSidoData={code.cityCd} selectSigunData={code.sggCd} selectRegionData={code.rvbsnCd} @@ -137,14 +258,14 @@ export default function RainSttn() { btnClass={btnClass} ref={ref} isAdmin={false} - /> + /> */} </div> </div> <div className="grid grid-cols-6 gap-4 "> <div className="col-span-6"> <ListDiv> <UiTable - headName={[]} + headName={undefined} tableData={bdstTable || []} children={ <HeadMakeColSpan upHeadList={rainSttn.rainSttNodeList} /> diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx index 7db00678d..8dd2a4d6f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx @@ -31,8 +31,8 @@ export const rainSttHeadListExport: z.infer<typeof sttnHeadListType> = [ visible: true, }, { - id: "bdstUsgCd", - title: "건축물용도코드", + id: "bdsgUsgText", + title: "건축물용도", visible: true, }, { @@ -209,8 +209,8 @@ export const rainSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "bdstUsgCd", - title: "건축물용도코드", + id: "bdsgUsgText", + title: "건축물용도", upName: "bdnstInfo", visible: true, row: 2, diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx index 5aa54ee48..42d158d4e 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx @@ -153,10 +153,13 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( sidoCode: SelectDataType[], sggCode: SelectDataType[]) => { try { + let a = `/reuseFc/rainyInfoList/${page}/${total}/${con}` + console.log("주소", a) const rainSttnRes = await getFetch( fetchType.WR, `/reuseFc/rainyInfoList/${page}/${total}/${con}` ); + console.log("rainSttnRes", rainSttnRes) if (Number(total) > 9000) { const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode); set((state: rainSttnState) => { diff --git a/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx b/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx index f4a3735a5..cec8babd0 100644 --- a/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx +++ b/apps/wr/components/ui/modal/sttn/pbnstSttnModal/pbnstSttnModal.tsx @@ -13,6 +13,7 @@ import { type customPbnst, type fcBizType, } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; +import { formH1Class } from "@/components/lib/class/comClass"; import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm"; import { ScrollArea, Title, UiTable } from "@common/business_components/ui"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; @@ -31,7 +32,7 @@ import { z } from "zod"; export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titleVisible?: boolean }) { const { code, pbnstSttn, prfmnc } = useWrStore((state) => state); const [fcltTab, setFcltTab] = useState<string>("fclt"); - const [ruseTab, setRuseTab] = useState<string>("inoutTotal"); + const [ruseTab, setRuseTab] = useState<string>("totalPrf"); const [ruseBizData, setRuseBizData] = useState<{ data: any[]; head: TableUpperProps[]; @@ -229,7 +230,8 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl (item) => item.pbnstRuseFcltPk === data.pbnstRuseFcltPk )?.prfList; - if (prfList) {console.log("prfList", prfList); + if (prfList) { + console.log("prfList", prfList); getTablePrfData(prfList); } @@ -243,12 +245,12 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl form.reset({ items: [data] }) } - },[data, form]) + }, [data, form]) - useEffect(()=>{ + useEffect(() => { console.log("prfData", prfData); - },[prfData]) + }, [prfData]) return ( <> <div> @@ -264,72 +266,79 @@ export function PbnstSttnModal({ data, titleVisible }: { data: customPbnst; titl indexMng={indexMng} setIndexMng={setIndexMng} /> - <Tabs defaultValue="fclt" onValueChange={setFcltTab}> - <TabsList className=""> - <TabsTrigger className="!text-xl" value="fclt"> - 하수처리수 재이용시설 현황 - </TabsTrigger> - <TabsTrigger className="!text-xl" value="sply"> - 재이용 원수 취수 현황 - </TabsTrigger> - <TabsTrigger className="!text-xl" value="ppi"> - 재이용 공급관로 현황 - </TabsTrigger> - <TabsTrigger className="!text-xl" value="guarantee"> - 재이용 보증수질 현황 - </TabsTrigger> - <TabsTrigger className="!text-xl" value="dmdCo"> - 재이용 수요처 현황 - </TabsTrigger> - </TabsList> - <TabsContent className="max-h-full" value={fcltTab}> - <UiTable - headName={undefined} - tableData={ruseTableData || []} - headlist={ruseHeadList || []} - pageSize={0} - total={0} - cellClick={undefined} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }} - children={ - fcltTab === "fclt" ? ( - <HeadMakeColSpan upHeadList={pbnstSttn.ruseFcltNodeList} /> - ) : undefined - } - ></UiTable> - </TabsContent> - </Tabs> - - <Tabs onValueChange={setRuseTab}> - <TabsList className=""> - <TabsTrigger className="!text-xl" value="totalPrf"> - 장내외합계 - </TabsTrigger> - <TabsTrigger className="!text-xl" value="inPrf"> - 장내용수 - </TabsTrigger> - <TabsTrigger className="!text-xl" value="outPrf"> - 장외용수 - </TabsTrigger> - </TabsList> - <TabsContent className="max-h-full" value={ruseTab}> - {prfData && ( + <div className="px-6"> + <div className=""> + <h1 className={formH1Class}>하수재이용시설 현황</h1> + </div> + <Tabs defaultValue="fclt" onValueChange={setFcltTab}> + <TabsList className="mt-4"> + <TabsTrigger className="!text-xl" value="fclt"> + 하수처리수 재이용시설 현황 + </TabsTrigger> + <TabsTrigger className="!text-xl" value="sply"> + 재이용 원수 취수 현황 + </TabsTrigger> + <TabsTrigger className="!text-xl" value="ppi"> + 재이용 공급관로 현황 + </TabsTrigger> + <TabsTrigger className="!text-xl" value="guarantee"> + 재이용 보증수질 현황 + </TabsTrigger> + <TabsTrigger className="!text-xl" value="dmdCo"> + 재이용 수요처 현황 + </TabsTrigger> + </TabsList> + <TabsContent className="max-h-full" value={fcltTab}> <UiTable headName={undefined} - tableData={prfData[ruseTab as keyof typeof prfData] || []} - headlist={monthHeadList || []} + tableData={ruseTableData || []} + headlist={ruseHeadList || []} pageSize={0} total={0} cellClick={undefined} onPageChange={function (page: number): void { throw new Error("Function not implemented."); }} + children={ + fcltTab === "fclt" ? ( + <HeadMakeColSpan upHeadList={pbnstSttn.ruseFcltNodeList} /> + ) : undefined + } ></UiTable> - )} - </TabsContent> - </Tabs> + </TabsContent> + </Tabs> + <div className=""> + <h1 className={formH1Class}>하수재이용실적</h1> + </div> + <Tabs defaultValue="totalPrf" onValueChange={setRuseTab}> + <TabsList className="mt-4"> + <TabsTrigger className="!text-xl" value="totalPrf"> + 장내외합계 + </TabsTrigger> + <TabsTrigger className="!text-xl" value="inPrf"> + 장내용수 + </TabsTrigger> + <TabsTrigger className="!text-xl" value="outPrf"> + 장외용수 + </TabsTrigger> + </TabsList> + <TabsContent className="max-h-full" value={ruseTab}> + {prfData && ( + <UiTable + headName={undefined} + tableData={prfData[ruseTab as keyof typeof prfData] || []} + headlist={monthHeadList || []} + pageSize={0} + total={0} + cellClick={undefined} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }} + ></UiTable> + )} + </TabsContent> + </Tabs> + </div> </ScrollArea> </div> </> From 711412b82e6ae86722b0c9082508a9f3f09e2cc3 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 09:35:36 +0900 Subject: [PATCH 122/259] =?UTF-8?q?feat:=201=EC=B0=A8(=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=9D=BC)=20=EA=B0=90=EB=A6=AC=EC=A7=80=EC=A0=81=EC=82=AC?= =?UTF-8?q?=ED=95=AD=EB=8C=80=EC=9D=91=20-=20=ED=95=98=EC=88=98=EA=B4=80?= =?UTF-8?q?=EB=A1=9C,=20=ED=95=98=EC=88=98=EB=A7=A8=ED=99=80,=20=ED=95=98?= =?UTF-8?q?=EC=88=98=ED=8E=8C=ED=94=84=EC=9E=A5,=20=EC=9A=B0=EC=88=98?= =?UTF-8?q?=ED=86=A0=EC=8B=A4=20=EA=B2=80=EC=83=89=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?-=20UiTable=20number=20=EA=B0=92=20=EA=B0=80=EC=9A=B4=EB=8D=B0?= =?UTF-8?q?=20=EC=A0=95=EB=A0=AC=20-=20=EC=9D=BC=EB=A0=A8=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=BB=AC=EB=9F=BC=20=EC=82=AD=EC=A0=9C=20-=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=B2=AD,=20=EC=8B=9C=EB=8F=84,=20=EC=8B=9C?= =?UTF-8?q?=EA=B5=B0=EA=B5=AC=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?-=20=EA=B4=80=EB=A6=AC=EB=85=84=EB=8F=84=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20-=20=EC=98=A4=EC=88=98=EC=A0=84=ED=99=98=EC=9C=A8=200~1=20?= =?UTF-8?q?=EC=82=AC=EC=9D=B4=EC=9D=98=20=EA=B0=92=EB=A7=8C=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20=EA=B0=80=EB=8A=A5=ED=95=98=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 403 +++++++++--------- .../map/components/common/index.ts | 1 + .../components/popupComponent/MsSwagePpl.tsx | 8 +- .../components/popupComponent/sewagePump.tsx | 19 +- .../map/components/popupComponent/smh.tsx | 20 +- .../popupComponent/stormWaterPump.tsx | 17 +- .../map/featureClickEventPopup.tsx | 22 +- .../(with-base-layout)/ii/irsetting/page.tsx | 7 +- .../app/(with-base-layout)/ii/rdii/page.tsx | 29 +- .../(with-base-layout)/ii/rdiiResult/page.tsx | 6 +- .../app/(with-base-layout)/ii/result/page.tsx | 5 +- .../(with-base-layout)/oper/floodPre/page.tsx | 18 - .../(with-base-layout)/oper/oldPp/page.tsx | 18 - apps/sn/app/components/ui/verticalTable.tsx | 16 +- pnpm-lock.yaml | 19 +- 15 files changed, 324 insertions(+), 284 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 44ec1d17c..d3cac8956 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -115,7 +115,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [yearFilter, setYearFilter] = useState({ 시작: "", 종료: "", - 경과년도: "", + // 경과년도: "", }); const [가동개시_시작_월, set가동개시_시작_월] = useState(''); @@ -182,7 +182,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ setYearFilter({ 시작: "", 종료: "", - 경과년도: "", + // 경과년도: "", }); setShowTable(false); setTableCount(0); @@ -247,34 +247,34 @@ const SearchModal: React.FC<SearchModalProps> = ({ const pplCqlFilters = () => { const cqlFilters: string[] = []; // 추후 작성 예정 - // if (변수1) cqlFilters.push(`용도코드='${변수1}'`); - // if (변수2) cqlFilters.push(`재질코드='${변수2}'`); - // if (변수3) cqlFilters.push(`행정읍면동코드='${변수3}'`); + if (변수1) cqlFilters.push(`usg_cd='${변수1}'`); + if (변수2) cqlFilters.push(`mqlt_cd='${변수2}'`); + if (변수3) cqlFilters.push(`pbadms_emd_cd='${변수3}'`); // if (변수4) cqlFilters.push(`경과년도='${변수4}'`); - // // 설치년도 범위 - // const startDate = getDateString( - // yearFilter.시작, - // 가동개시_시작_월, - // 가동개시_시작_일, - // "19000101", - // ); - // const endDate = getDateString( - // yearFilter.종료, - // 가동개시_종료_월, - // 가동개시_종료_일, - // `${todayYear}${todayMonth}${todayDate}`, - // ); - // cqlFilters.push( - // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - // ); - // // 관경(mm) 범위 - // if (시작1 && 종료1) cqlFilters.push(`관경 BETWEEN ${시작1} AND ${종료1}`); - // else if (시작1) cqlFilters.push(`관경 >= ${시작1}`); - // else if (종료1) cqlFilters.push(`관경 <= ${종료1}`); - // // 연장(m) 범위 - // if (시작2 && 종료2) cqlFilters.push(`연장 BETWEEN ${시작2} AND ${종료2}`); - // else if (시작2) cqlFilters.push(`연장 >= ${시작2}`); - // else if (종료2) cqlFilters.push(`연장 <= ${종료2}`); + // 설치년도 범위 + const startDate = getDateString( + yearFilter.시작, + 가동개시_시작_월, + 가동개시_시작_일, + "19000101", + ); + const endDate = getDateString( + yearFilter.종료, + 가동개시_종료_월, + 가동개시_종료_일, + `${todayYear}${todayMonth}${todayDate}`, + ); + cqlFilters.push( + `instl_ymd >= '${startDate}' and instl_ymd <= '${endDate}'`, + ); + // 관경(mm) 범위 + if (시작1 && 종료1) cqlFilters.push(`pdmt BETWEEN ${시작1} AND ${종료1}`); + else if (시작1) cqlFilters.push(`pdmt >= ${시작1}`); + else if (종료1) cqlFilters.push(`pdmt <= ${종료1}`); + // 연장(m) 범위 + if (시작2 && 종료2) cqlFilters.push(`prlg BETWEEN ${시작2} AND ${종료2}`); + else if (시작2) cqlFilters.push(`prlg >= ${시작2}`); + else if (종료2) cqlFilters.push(`prlg <= ${종료2}`); return cqlFilters; }; @@ -319,27 +319,27 @@ const SearchModal: React.FC<SearchModalProps> = ({ const mhCqlFilters = () => { const cqlFilters: string[] = []; // // 설치년도 범위 - // const startDate = getDateString( - // yearFilter.시작, - // 가동개시_시작_월, - // 가동개시_시작_일, - // "19000101", - // ); - // const endDate = getDateString( - // yearFilter.종료, - // 가동개시_종료_월, - // 가동개시_종료_일, - // `${todayYear}${todayMonth}${todayDate}`, - // ); - // cqlFilters.push( - // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - // ); + const startDate = getDateString( + yearFilter.시작, + 가동개시_시작_월, + 가동개시_시작_일, + "19000101", + ); + const endDate = getDateString( + yearFilter.종료, + 가동개시_종료_월, + 가동개시_종료_일, + `${todayYear}${todayMonth}${todayDate}`, + ); + cqlFilters.push( + `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, + ); // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); - // if (변수2) cqlFilters.push(`용도코드='${변수2}'`); - // // 구경(mm) 범위 - // if (시작1 && 종료1) cqlFilters.push(`구경 BETWEEN ${시작1} AND ${종료1}`); - // else if (시작1) cqlFilters.push(`구경 >= ${시작1}`); - // else if (종료1) cqlFilters.push(`구경 <= ${종료1}`); + if (변수2) cqlFilters.push(`용도코드='${변수2}'`); + // 구경(mm) 범위 + if (시작1 && 종료1) cqlFilters.push(`구경 BETWEEN ${시작1} AND ${종료1}`); + else if (시작1) cqlFilters.push(`구경 >= ${시작1}`); + else if (종료1) cqlFilters.push(`구경 <= ${종료1}`); return cqlFilters; }; @@ -347,32 +347,32 @@ const SearchModal: React.FC<SearchModalProps> = ({ const psmtnCqlFilters = () => { const cqlFilters: string[] = []; // 설치년도 범위 - // const startDate = getDateString( - // yearFilter.시작, - // 가동개시_시작_월, - // 가동개시_시작_일, - // "19000101", - // ); - // const endDate = getDateString( - // yearFilter.종료, - // 가동개시_종료_월, - // 가동개시_종료_일, - // `${todayYear}${todayMonth}${todayDate}`, - // ); - // cqlFilters.push( - // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - // ); + const startDate = getDateString( + yearFilter.시작, + 가동개시_시작_월, + 가동개시_시작_일, + "19000101", + ); + const endDate = getDateString( + yearFilter.종료, + 가동개시_종료_월, + 가동개시_종료_일, + `${todayYear}${todayMonth}${todayDate}`, + ); + cqlFilters.push( + `instl_ymd >= '${startDate}' and instl_ymd <= '${endDate}'`, + ); // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); - // // 일일처리용량 범위 - // if (시작1 && 종료1) - // cqlFilters.push(`일일처리용량 BETWEEN ${시작1} AND ${종료1}`); - // else if (시작1) cqlFilters.push(`일일처리용량 >= ${시작1}`); - // else if (종료1) cqlFilters.push(`일일처리용량 <= ${종료1}`); - // // 우수양수능력 범위 - // if (시작2 && 종료2) - // cqlFilters.push(`우수양수능력 BETWEEN ${시작2} AND ${종료2}`); - // else if (시작2) cqlFilters.push(`우수양수능력 >= ${시작2}`); - // else if (종료2) cqlFilters.push(`우수양수능력 <= ${종료2}`); + // 일일처리용량 범위 + if (시작1 && 종료1) + cqlFilters.push(`daily_prcs_cpct BETWEEN ${시작1} AND ${종료1}`); + else if (시작1) cqlFilters.push(`daily_prcs_cpct >= ${시작1}`); + else if (종료1) cqlFilters.push(`daily_prcs_cpct <= ${종료1}`); + // 우수양수능력 범위 + if (시작2 && 종료2) + cqlFilters.push(`excln_wpmp_ablt BETWEEN ${시작2} AND ${종료2}`); + else if (시작2) cqlFilters.push(`excln_wpmp_ablt >= ${시작2}`); + else if (종료2) cqlFilters.push(`excln_wpmp_ablt <= ${종료2}`); return cqlFilters; }; @@ -380,24 +380,24 @@ const SearchModal: React.FC<SearchModalProps> = ({ const otflCqlFilters = () => { const cqlFilters: string[] = []; // 설치년도 범위 - // const startDate = getDateString( - // yearFilter.시작, - // 가동개시_시작_월, - // 가동개시_시작_일, - // "19000101", - // ); - // const endDate = getDateString( - // yearFilter.종료, - // 가동개시_종료_월, - // 가동개시_종료_일, - // `${todayYear}${todayMonth}${todayDate}`, - // ); - // cqlFilters.push( - // `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - // ); + const startDate = getDateString( + yearFilter.시작, + 가동개시_시작_월, + 가동개시_시작_일, + "19000101", + ); + const endDate = getDateString( + yearFilter.종료, + 가동개시_종료_월, + 가동개시_종료_일, + `${todayYear}${todayMonth}${todayDate}`, + ); + cqlFilters.push( + `instl_ymd >= '${startDate}' and instl_ymd <= '${endDate}'`, + ); // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); // if (변수2) cqlFilters.push(`하천명 ILIKE '%${변수1}%'`); - // // 계획방류량 범위 + // 계획방류량 범위 // if (시작1 && 종료1) // cqlFilters.push(`계획방류량 BETWEEN ${시작1} AND ${종료1}`); // else if (시작1) cqlFilters.push(`계획방류량 >= ${시작1}`); @@ -502,7 +502,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ /> {/* 경과년도 */} - <div className="flex items-center"> + {/* <div className="flex items-center"> <Label className="mr-2 w-auto text-xl text-gray-600"> 경과년도 </Label> @@ -516,7 +516,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ setYearFilter({ ...yearFilter, 경과년도: val }); }} /> - </div> + </div> */} {/* 용도코드 */} <Label className="mr-2 w-auto text-xl text-gray-600"> 용도코드 @@ -729,7 +729,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ endLabel="" /> {/* 경과년도 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> + {/* <Label className="mr-2 w-auto text-xl text-gray-600"> 경과년도 </Label> <Input @@ -741,9 +741,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ const val = e.target.value.replace(/[^0-9]/g, ""); setYearFilter({ ...yearFilter, 경과년도: val }); }} - /> - </div> - <div className='flex items-center mb-2'> + /> */} {/* 용도코드 */} <Label className="mr-2 w-auto text-xl text-gray-600"> 용도코드 @@ -788,85 +786,6 @@ const SearchModal: React.FC<SearchModalProps> = ({ )} {/* 분기처리: 하수펌프장 */} {basicType === "tb_ms_swage_pmstn" && ( - <div className="mb-3"> - {/* 설치년도 */} - <div className="flex items-center mb-2"> - <YearRangeSelectBox - start={yearFilter.시작} - end={yearFilter.종료} - onChange={range => setYearFilter({ ...yearFilter, 시작: range.start, 종료: range.end })} - startLabel="설치년도" - endLabel="" - /> - {/* 경과년도 */} - <Label className="w-auto text-xl text-gray-600 mr-2">경과년도</Label> - <Input - className='!text-xl w-[100px] placeholder:text-center mr-8' - placeholder="입력" - value={yearFilter.경과년도} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ''); - setYearFilter({ ...yearFilter, 경과년도: val }); - }} - /> - </div> - <div className="flex items-center mb-2"> - {/* 일일처리용량 - 오수맨홀 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> - 일일처리용량 - </Label> - <Input - className="w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={시작1} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set시작1(val); - }} - /> - <span className="mx-2 text-xl font-semibold">~</span> - <Input - className="mr-8 w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={종료1} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set종료1(val); - }} - /> - {/* 우수양수능력 - 우수맨홀 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> - 우수양수능력 - </Label> - <Input - className="w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={시작2} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set시작2(val); - }} - /> - <span className="mx-2 text-xl font-semibold">~</span> - <Input - className="mr-8 w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={종료2} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set종료2(val); - }} - /> - </div> - </div> - )} - {/* 분기처리: 우수토실? 토구? */} - {basicType === "tb_ms_stofcbr" && ( <div className="mb-3"> {/* 설치년도 */} <div className="flex items-center mb-2"> @@ -878,34 +797,20 @@ const SearchModal: React.FC<SearchModalProps> = ({ endLabel="" /> {/* 경과년도 */} - <Label className="w-auto text-xl text-gray-600 mr-2">경과년도</Label> - <Input - className='!text-xl w-[100px] placeholder:text-center mr-8' - placeholder="입력" - value={yearFilter.경과년도} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ''); - setYearFilter({ ...yearFilter, 경과년도: val }); - }} - /> - </div> - <div className="flex items-center mb-2"> - {/* 하천명 */} + {/* <Label className="w-auto text-xl text-gray-600 mr-2">경과년도</Label> + <Input + className='!text-xl w-[100px] placeholder:text-center mr-8' + placeholder="입력" + value={yearFilter.경과년도} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ''); + setYearFilter({ ...yearFilter, 경과년도: val }); + }} + /> */} + {/* 일일처리용량 - 오수맨홀 */} <Label className="mr-2 w-auto text-xl text-gray-600"> - 하천명 - </Label> - <Input - className="mr-8 w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={변수1} - onChange={(e) => { - set변수1(e.target.value); - }} - /> - {/* 계획방류량 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> - 계획방류량 + 일일처리용량 </Label> <Input className="w-[100px] !text-xl placeholder:text-center" @@ -928,6 +833,95 @@ const SearchModal: React.FC<SearchModalProps> = ({ set종료1(val); }} /> + {/* 우수양수능력 - 우수맨홀 */} + <Label className="mr-2 w-auto text-xl text-gray-600"> + 우수양수능력 + </Label> + <Input + className="w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={시작2} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set시작2(val); + }} + /> + <span className="mx-2 text-xl font-semibold">~</span> + <Input + className="mr-8 w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={종료2} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set종료2(val); + }} + /> + </div> + </div> + )} + {/* 분기처리: 우수토실? 토구? */} + {basicType === "tb_ms_stofcbr" && ( + <div className="mb-3"> + {/* 설치년도 */} + <div className="flex items-center mb-2"> + <YearRangeSelectBox + start={yearFilter.시작} + end={yearFilter.종료} + onChange={range => setYearFilter({ ...yearFilter, 시작: range.start, 종료: range.end })} + startLabel="설치년도" + endLabel="" + /> + {/* 경과년도 */} + {/* <Label className="w-auto text-xl text-gray-600 mr-2">경과년도</Label> + <Input + className='!text-xl w-[100px] placeholder:text-center mr-8' + placeholder="입력" + value={yearFilter.경과년도} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ''); + setYearFilter({ ...yearFilter, 경과년도: val }); + }} + /> */} + {/* 하천명 */} + {/* <Label className="mr-2 w-auto text-xl text-gray-600"> + 하천명 + </Label> + <Input + className="mr-8 w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={변수1} + onChange={(e) => { + set변수1(e.target.value); + }} + /> */} + {/* 계획방류량 */} + {/* <Label className="mr-2 w-auto text-xl text-gray-600"> + 계획방류량 + </Label> + <Input + className="w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={시작1} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set시작1(val); + }} + /> + <span className="mx-2 text-xl font-semibold">~</span> + <Input + className="mr-8 w-[100px] !text-xl placeholder:text-center" + placeholder="입력" + value={종료1} + onChange={(e) => { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set종료1(val); + }} + /> */} </div> </div> )} @@ -970,7 +964,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ /> <div className="flex items-center"> {/* 경과년도 */} - <Label className="mr-2 w-auto text-xl text-gray-600"> + {/* <Label className="mr-2 w-auto text-xl text-gray-600"> 경과년도 </Label> <Input @@ -982,7 +976,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ const val = e.target.value.replace(/[^0-9]/g, ""); setYearFilter({ ...yearFilter, 경과년도: val }); }} - /> + /> */} </div> </div> {/* 조회 버튼 중앙 정렬 */} @@ -1095,6 +1089,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ z-[101] `} body={renderBody()} + useDirectRender={true} /> ); }; diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index 44f070b36..51dd450e7 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -9,6 +9,7 @@ type LayerComponentProps = { featureData: any; chkMainSsc?: boolean; additionalData?: any; + onSaveClick?: () => void; }; type LayerContentMap = { [key: string]: { diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 27aa8e289..bf018340b 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -16,7 +16,7 @@ const inputColumn = [ { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; -const MsSwagePpl = ({ featureData }: { featureData: any }) => { +const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { const [repairData, setRepairData] = useState([ { year: "2025", type: "개대체" }, { year: "2025", type: "보수" }, @@ -40,7 +40,7 @@ const MsSwagePpl = ({ featureData }: { featureData: any }) => { return ( - <div> + <> <VerticalTable headName='자체 입력정보' tableData={[]} @@ -53,6 +53,8 @@ const MsSwagePpl = ({ featureData }: { featureData: any }) => { onPageChange={function (page: number): void { throw new Error("Function not implemented."); }} + showSaveButton={true} + onSaveClick={onSaveClick} /> <InputSection title="보수 및 갱신" @@ -72,7 +74,7 @@ const MsSwagePpl = ({ featureData }: { featureData: any }) => { sectionKey="inspection" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - </div> + </> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index 97ae09a10..4eaf1f18d 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -6,14 +6,23 @@ const inputColumn = [ { id: "freq", title: "설계빈도", type: "input" }, ] // 하수펌프장 -const sewagePump = () => { +const sewagePump = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( - <> - <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={0} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { + <VerticalTable + headName='자체 입력정보' + tableData={[]} + headlist={inputColumn} + pageSize={0} + total={0} + children={undefined} + cellClick={undefined} + isEditable={true} + onPageChange={function (page: number): void { throw new Error('Function not implemented.'); }} - /> - </> + showSaveButton={true} + onSaveClick={onSaveClick} + /> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx index c2463ddfb..46e76f244 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx @@ -8,13 +8,23 @@ const inputColumn = [ { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, { id: 'spec', title: '규격', type: 'input' }, ]; -const Smh = () => { +const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( - <div> - <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { + <VerticalTable + headName='자체 입력정보' + tableData={[]} + headlist={inputColumn} + pageSize={20} + total={0} + children={undefined} + cellClick={undefined} + isEditable={true} + onPageChange={function (page: number): void { throw new Error("Function not implemented."); - }}></VerticalTable> - </div> + }} + showSaveButton={true} + onSaveClick={onSaveClick} + /> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx index a82ee45b2..a73c344a5 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/stormWaterPump.tsx @@ -9,10 +9,19 @@ const StormWaterPump = ({ featureData }: { featureData: Record<string, any> }) = const validKey = inputColumn.map((item) => item.id); const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record<string, any>, [key, value]) => { obj[key] = value; return obj; }, {}); return ( - <div><VerticalTable headName='자체 입력정보' tableData={[filteredData]} headlist={inputColumn} pageSize={0} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error('Function not implemented.'); - }} /> - </div> + <VerticalTable + headName='자체 입력정보' + tableData={[filteredData]} + headlist={inputColumn} + pageSize={0} + total={0} + children={undefined} + cellClick={undefined} + isEditable={true} + onPageChange={function (page: number): void { + throw new Error('Function not implemented.'); + }} + /> ) } diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index bf453f968..a6dac412d 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -53,16 +53,16 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, try { console.log(`추가 데이터 API 호출 시작: v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - + // 🎯 타임아웃 설정 (10초) - const timeoutPromise = new Promise((_, reject) => + const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('API 타임아웃')), 10000) ); - + const apiPromise = getData(`v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - + const response = await Promise.race([apiPromise, timeoutPromise]) as any; - + console.log('추가 데이터 API 호출 성공:', response); return response?.content || []; } catch (error) { @@ -207,7 +207,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, useEffect(() => { if (layerNm === '중점우수토실' && featureData?.values_) { const data = featureData.values_; - + if (data?.adst_dstr_cd && data?.manage_no) { // 🎯 추가 데이터를 비동기로 로딩 (UI 블로킹 없음) fetchAdditionalData(data.adst_dstr_cd, data.manage_no) @@ -310,14 +310,14 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, color="white" onClick={openModalInfil} > - Infil + 침입수분석 </Button> <Button className="px-2 py-1 text-xl text-gray-600 border border-gray-600 rounded hover:bg-gray-700" color="white" onClick={openModalRdii} > - RDII + RDII분석 </Button> </> )} @@ -351,17 +351,13 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, total2={0} isEditable2={buttonChk} /> - <div className="w-full mx-5 flex items-center justify-end space-x-2"> - {buttonChk ? <Button onClick={handleSaveClick} className="px-4 mr-5 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700"> - 저장 - </Button> : null} - </div> <Modal isModalOpen={isModalOpen} title="자체입력정보 저장" setIsModalOpen={setIsModalOpen} closeModal={handleModalClose} saveModal={handleModalSave}><div className="text-lg">정보를 저장하시겠습니까?</div></Modal> {ContentComponent && <ContentComponent featureData={fetchData} chkMainSsc={chkMainSsc} additionalData={mntrngsData} + onSaveClick={handleSaveClick} /> } </div> diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 87a11d265..91d1361c9 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -335,10 +335,15 @@ const IrSetting = () => { // '.' 기호가 포함된 경우, 처음이나 끝에 오면 안 됨 if (newValue.includes('.') && newValue.startsWith('.')) return; // '.'이 처음에는 올 수 없음 + // 숫자 값으로 변환하여 범위 체크 (0 이상 1 이하) + const numericValue = parseFloat(newValue); + if (isNaN(numericValue) || numericValue < 0 || numericValue > 1) return; + setInput1(newValue); }} className="ml-5 h-[3.2rem] text-center text-xl w-[150px]" - placeholder="예: 0.75" /> + placeholder="예: 0.75" + /> </FormSection> <FormSection name='analysis information' diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 689c267ff..705b243c8 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -400,7 +400,34 @@ export default function RTKForm() { fileIdx={2} /> </div></FormSection> <FormSection name='rate' form={form} titleNm='○ 오수전환율'> - <Input {...form.register("rate")} className="h-12 text-center text-xl w-[225px] ml-5" /> + <Input + value={form.watch("rate")} // form의 rate 값을 가져옴 + onChange={(e) => { + const newValue = e.target.value; + + if (newValue === "") { + form.setValue("rate", newValue); // form의 rate 필드에 설정 + return; + } + + // 숫자와 '.'만 허용하고, '.'은 최대 하나인지 확인 + const isValidChars = /^[0-9]*\.?[0-9]*$/.test(newValue); + if (!isValidChars) return; // 유효하지 않은 문자 또는 여러 개의 '.' 포함 + + // '.' 기호가 처음에 오면 안 됨 + if (newValue.startsWith('.')) return; + + // 완성된 숫자인 경우에만 범위 체크 (입력 중인 경우 허용) + if (!newValue.endsWith('.')) { + const numericValue = parseFloat(newValue); + if (isNaN(numericValue) || numericValue < 0 || numericValue > 1) return; + } + + form.setValue("rate", newValue, { shouldValidate: true }); // form의 rate 필드에 설정 + }} + className="h-12 text-center text-xl w-[225px] ml-5" + placeholder="예: 0.75" + /> </FormSection> <FormSection name='date' form={form} titleNm='○ 상수사용량 적용기간'> {/* <DatePicker diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index 2fa22a8b2..bec7ffec6 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -24,12 +24,14 @@ const formSchema = z.object({ type ResultFormValues = z.infer<typeof formSchema> const tableColumn = [ - { id: 'rainInfwtAnlsSn', title: '분석번호' }, + { id: 'enoNm', title: '환경청' }, + { id: 'ctpvNm', title: '시도' }, + { id: 'sggNm', title: '시군구' }, { id: 'swageTmplntNm', title: '하수처리장' }, // { id: 'swtrmtZoneNm', title: '처리구역' }, { id: 'aplcnYm', title: '상수사용연월' }, { id: 'drtwSwtcRt', title: '오수 전환율' }, - { id: 'srcNm', title: 'RTX 계수 출처' }, + { id: 'srcNm', title: 'RTK 계수 출처' }, { id: 'cntbArea', title: 'RDII 기여면적' }, { id: 'anlsInfo', title: 'RDII 분석정보' }, { id: 'regDt', title: '분석일자' }, diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 67569cd9b..988521eca 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -24,8 +24,9 @@ const formSchema = z.object({ type ResultFormValues = z.infer<typeof formSchema> const tableColumn = [ - // { id: 'no', title: '번호' }, - { id: 'inftwtAnlsSn', title: '분석번호' }, + { id: 'enoNm', title: '환경청' }, + { id: 'ctpvNm', title: '시도' }, + { id: 'sggNm', title: '시군구' }, { id: 'swageTmplntNm', title: '하수처리장' }, // { id: 'swtrmtZoneNm', title: '처리구역' }, { id: 'aplcnYm', title: '적용연월' }, diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 11803b7e8..6ae0b3609 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -102,24 +102,6 @@ const Page = () => { selected={toDate} onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> </div> - <div className='flex items-center gap-2'> - <Label className="w-20 text-xl text-gray-600">관리년도</Label> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setManageYear(String(value))} - /> - <span>~</span> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setMngQu(String(value))} - /> - </div> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> <Input diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 392ed8af8..307452e2d 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -103,24 +103,6 @@ const Page = () => { <DatePicker mode={'single'} selected={toDate} onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> - <div className='flex items-center gap-2'> - <Label className="w-20 text-xl text-gray-600">관리년도</Label> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setManageYear(String(value))} - /> - <span>~</span> - <SelectBox - className="w-[90px] mr-3 ml-4" - selectClass="rounded-lg bg-white" - label="" - selectArray={yearOptions} - onSelectValue={(value: string | number) => setMngQu(String(value))} - /> - </div> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> <Input diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 0339a90b2..1455c9e4a 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -1,5 +1,5 @@ import UiPageNations from "@common/business_components/ui/table/uiPageNations"; -import { Table, TableBody, TableCell, TableRow } from "@common/components"; +import { Table, TableBody, TableCell, TableRow, Button } from "@common/components"; import { useEffect, useState } from "react"; type UiTableProps = { @@ -27,6 +27,8 @@ type UiTableProps = { resetPageNo2?: boolean; isEditable2?: boolean; showSecondTable?: boolean; + showSaveButton?: boolean; + onSaveClick?: () => void; }; type UiHeadProps = { @@ -62,6 +64,8 @@ export function VerticalTable({ resetPageNo2 = false, isEditable2 = false, showSecondTable = false, + showSaveButton = false, + onSaveClick, }: UiTableProps) { const [cur, setCur] = useState<number>(1); const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({}); @@ -93,8 +97,16 @@ export function VerticalTable({ return ( <> {headName ? ( - <div className="card-header"> + <div className="card-header flex items-center justify-between"> <h3 className="text-2xl mx-3 font-medium text-label">{headName}</h3> + {showSaveButton && onSaveClick && ( + <Button + onClick={onSaveClick} + className="px-4 mr-3 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" + > + 저장 + </Button> + )} </div> ) : null} <div className={`card !m-[1.2rem] !p-0r ${className}`}> diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68b534139..d9c68525b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -538,6 +538,9 @@ importers: date-fns: specifier: ^3.6.0 version: 3.6.0 + libphonenumber-js: + specifier: ^1.12.9 + version: 1.12.9 lucide-react: specifier: ^0.474.0 version: 0.474.0(react@18.3.1) @@ -2398,7 +2401,7 @@ packages: magic-string: 0.27.0 react-docgen-typescript: 2.2.2(typescript@5.6.3) typescript: 5.6.3 - vite: 6.2.0(@types/node@22.13.5) + vite: 6.2.0(@types/node@22.13.9) dev: true /@jridgewell/gen-mapping@0.3.8: @@ -2511,7 +2514,7 @@ packages: dnd-multi-backend: 8.1.2(dnd-core@16.0.1) framer-motion: 11.18.2(react-dom@18.3.1)(react@18.3.1) react: 18.3.1 - react-dnd: 16.0.1(@types/node@22.13.5)(@types/react@18.3.18)(react@18.3.1) + react-dnd: 16.0.1(@types/node@22.13.9)(@types/react@18.3.18)(react@18.3.1) react-dnd-html5-backend: 16.0.1 react-dnd-touch-backend: 16.0.1 react-dom: 18.3.1(react@18.3.1) @@ -3991,7 +3994,7 @@ packages: browser-assert: 1.2.1 storybook: 8.6.0(prettier@3.5.2) ts-dedent: 2.2.0 - vite: 6.2.0(@types/node@22.13.5) + vite: 6.2.0(@types/node@22.13.9) dev: true /@storybook/components@8.6.0(storybook@8.6.0): @@ -4123,7 +4126,7 @@ packages: resolve: 1.22.10 storybook: 8.6.0(prettier@3.5.2) tsconfig-paths: 4.2.0 - vite: 6.2.0(@types/node@22.13.5) + vite: 6.2.0(@types/node@22.13.9) transitivePeerDependencies: - rollup - supports-color @@ -4598,7 +4601,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.26.9) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 6.2.0(@types/node@22.13.5) + vite: 6.2.0(@types/node@22.13.9) transitivePeerDependencies: - supports-color dev: true @@ -7314,6 +7317,10 @@ packages: type-check: 0.4.0 dev: true + /libphonenumber-js@1.12.9: + resolution: {integrity: sha512-VWwAdNeJgN7jFOD+wN4qx83DTPMVPPAUyx9/TUkBXKLiNkuWWk6anV0439tgdtwaJDrEdqkvdN22iA6J4bUCZg==} + dev: false + /lie@3.3.0: resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==} dependencies: @@ -9780,7 +9787,7 @@ packages: debug: 4.4.0 globrex: 0.1.2 tsconfck: 3.1.5(typescript@5.6.3) - vite: 6.2.0(@types/node@22.13.5) + vite: 6.2.0(@types/node@22.13.9) transitivePeerDependencies: - supports-color - typescript From 915b6573579e3fcf3ad36859b1670cc5733cbd43 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Thu, 3 Jul 2025 09:41:38 +0900 Subject: [PATCH 123/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC=20=EC=96=91=EC=8B=9D?= =?UTF-8?q?=EC=97=90=20=EC=9E=91=EC=84=B1=EB=B0=A9=EB=B2=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/public/sample_ruseCaseMng.xlsx | Bin 19429 -> 20324 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/apps/wr/public/sample_ruseCaseMng.xlsx b/apps/wr/public/sample_ruseCaseMng.xlsx index 3a88e0623e067d483927ce6dfdc452c2dbb2ee19..96027d557fe2cfc60d3de10c313c49d78f984591 100644 GIT binary patch delta 12615 zcmbtaWmH^C)@|H^TX1(Lc+lYPu0euBfM7u`0TNsr2~Kc#ZzKc>gy7OR2?Y1x{&n)+ z%$qkeYyN!wqpMcc?R)F)z0W??tIm2V+>dNHVhv>kL;?^p2o(eZ(ST^8<wQK-K%nSa zVp@2hS7*@W6E{wW{*Hu9r(VPxX<c1JEYnyHyi)`fQ5vEMXJ2G=U?sv(N0<E>^;sfw z?WXg&3ee)PV~qwEQ{TGvf+8V^BU8XDC8~PR@0uQu-lnlE>#a!zT;I!=05qpU%;M8D zk%uPkl`TtcNv`I5VeAxrC1O(9Tap(O<(5^z3u?ctk$m<{hMFX;C>rEDedg)Bq94wE zU4lwQ{gFRx>Z=RCy#3iJ@RpW{HC69{M$yzT9ln8$2vgd23xPR?5XA4f5%RpB8<|$% z-80G`k2Kb73XJth^yQu#ki=m--JwcD+!v>t4#07Ak1+=okghc_{Zh+~0wLTvB7&o8 zE+HnQs?p4jNwrUxm@d~|Bppw8)W*-4BX(-YALhKmS@DcN_6;Dw-H3K8@Wk}lU5m@z ze9uNG85aSu^YVb}s#V|qHbaTDnNTbrG^9P-=wO`n8aY@J`F!~G*2E!+@2LsJ(}sH0 z5b=*3YwQ%a;15KE;A;h}`W^&g1RSN(qUYBzPUI0lAW{%299UD4v>p)!6%J@m9CqmC zeiVB6wlieB!!7Y%<BNzN%iE5o1r+XDyf9TKt5ONyoAjguftrHUv3z>I6P~XxZiG)) zDd;?xS(xj{5!>c7MjFx0F4XlesKXndv|V5kMk~}*a&ifb&N`~8TSFviONF#7(t1LY zbd1UQY{YYwQ~N(ld5~JMg;W99ZL)?NS6R_r{JH7&ky)BJ-W#O7fsY2ST%A|=Ok?6Y z1IfmYNiYT@Fu=L79Cg9=w`N3!@JPPdA56gCdp;u=%80v>>(du2w<2oaKKW|N+wAx$ zej0Ze<Fk&qNZ}J>E(VW!)<<yxJJ+>re8Upw?s^Y97$DHY0|MxmSi$88=zw2GZ-P5K z2y}=D0%5~Y@^Rwwc6E2Obai#)^l^5o&>41_;>PKuJH|>lgj~(-HN^-RdjdGg8oJ4a z9TlPEwskzav)x{8#xySNAe5@bR=DbEaYS(F#}u>3Z;2#v`>y>fg5cxhDx491yPo9e zh?R?Qgv8RMAx{-Ej+`?9E5eFBnT1g4nTpHD__e`FrnSn644KlH5YR*~eRET^3ABbB z-Ql_nG2&_31X5$mlp{2W)Xu>jWQ;0!)Sh6h!KoO9v;EnkgnjMNMx-v1!a}ee&Xna9 z<7VOZ82b6+mf#&#-ShXXN}&oZ-_DER7}UD+CL49q8R2s}PQoYv-Zt!9jFARj*7|@@ z_XS$2cIbu4iffK2iLJ>;8)b;}(9dWhPa-LDsTk9O#b=~oT+V5t1Eg2FYHXY@q1Zhi z=?;FR5^T;Z(&Q)CC=+}L`5clzc5-)3FTNvVFqUZap2a?)Cui@0%^dTbUB4vO1J0GL z3N9nB$eFjF%LZ2!_$u7ks%?)8_HFoiQ>f<}G)K5;V`*kfiqW<yh#S9+j>cPFX_l-@ zD`dRSB1QG(me@!`54=jt=Dc3{z$6WJTiQ$|Z`u%qo=wb|x}}vltGsk@Ilpzr?_4b% zw!(YVj&rdv>+x-OF^}Ht@i%MD7gzl3_Q457NgXP~xfcEXfJmKveCpZJrBFhnSfyW( zkjU!R)?|a!tVF=Y)!I^+YqNRRV&FrAH`6QxpU)7Y6OH~(RVM@4pMd--<Qj2r55tNq z>iYP7`-$}7kB?8${gy4c_uhudOC55PBX$@HVH5R)^!f8pbUt*^g*X#<0$FWeG94gO zNzO;+o^W$X*reniQsgR#8~4h*AjV*-U!jXm$yk+>i3|ccN`XHT5dxzw3j&Y3uxFp5 zvNrW_%O+Y0dpWc^CXzCbVIn2MAvDp%+srevMpVf(dxgPu92i(YoIheAoP!_-5i@%f z=Lt!)MQ&D#DeSF7ABb2Iua7^g-`<Ct-(aV77Pm`24^^}%-+1$ZmHFl1V-#)UyKBo5 zPhEyQHEu6aJZfXp4+=m4_vK}Npo~7HNDhq*;bYoxCr`QUTLUPa_d9<k5o!;Dk6CDF z0b$R0GIz#BWk!T7v;5UvN#x`&D9B4JL#<YZdBYDwM~OU!8SWQ9_=Jk7==-zl9xttZ zo(u{d89*peuHSF@GO-t0`2($eXGYq8?;SlY{%cUkjx}#LXIl)=SbXv7v#NaX^QahW zqqcE8e5%usw-TrJ1ufRN8ph70ipjJGqLd2`3p#{SYb+!^y_}7sNq#vi5L*+6i!N}L z;a%}4ap*F%7kja5s<UNECt$c_LvwSZrvD91TL5jK0hd_6;Fh{V{3kw={OIL1TR2~m zM{{EFl%Uac%<FN0ZT;<<RLmf<TZH_xx4{M=A2WO*aXgOY`>TzeX6P3Q;O_o>)7)S! zV$I5x!KKOPFb!Xh+Q#yuUfi@BNtFB%PleED*6bw$M7nqN<dj&=n;(X3EW8`Yj5++# z@C6tUzrV6Bm%e=RjSB^rp{HaUlle_Jo|z11&|B|d4!zZL!0)}=1&h^L^TNXyN$Ql? z!;i;~AI*Yy%n`EK9?g!{Zkm=i(-qO=T8^PCscJrc^dYwwN?b0y6$bkHs5axoi_Az} z+SaD2VvmA$^*fI=k63aeUdgk_G<X55*w-Cq(7jiXC9|6`r)J?d`7Od&{dN(OOy2Xi zX%l>shUhh9)Ib-?8{MbDUi+x88|j2tap8!=?8c}PUOqx@a$1cjlUk9+M}P4wy!gqv z@*w#=1+G#z7RBl3*|fxu$L}dpPUHQ8pJNHMR8El0jzy%MRfX2c_o@#}Wm|pM;N?dd zKwDMW@B1+`%8^a4u|Yff)E0d6!abyUU4}QRTlcx&qxyJYj=_oexbT|-0dm0Sp2?5$ za0c<r1+z9@r5LjG(f#YzV_iHIHBEgjUysZrs#d>lE=Q7d-frh1s!mRznV&b@a(5@_ ziD9D2a;{gU!m+)FE92Cr3r`dhvAmZKOiWrYU^bqh{dixS!cNUYV*UcNjA15G>ywdI zih<RE?3b}<AoP-OjElqe4bpP>6)A)H_B^*TUr65NOZ$6=?{OMJKX?!}*aV(gG^HLF zDR~mLU980{!hI=<c=MC@)dsO08fiF$<T|U2{p4T~Cv6~iNsu{(B3y=C8o&QjCl5QB z2-2BFD}gJ~mI~v_(;2xwqTU;oQR7do_Z{<%@d8v;>_Ccfp3V5%smR&N$bm-zo7ApO zMh__Oydg(><zGZ{YVBR(8&aQ5Ssj{0#_$RD`U<J!6CAPdlMSn01oNuP^vaWd-?mLj zl}qGe>-$QkGTFxriL4O3beDd9Ab9iE=^lNZ8Bh?YFV-rf%D}WOJy1lN0*O<)SH4O2 z&vwt_aR5N+Lw5rq^|@I&s*irooyNQ|C7DZ8y>Hv*AhC-W@u(zN?$Fj%Fv9=Z3(wms zQ4`hcschzo2A_%NcSyVp5jWDq(Mi(i-u}|789H?8;T0l{nnokI#4;z8K*2n!veM)s zJ5*>WC7IWX$FN%+^WK~4`<(a4P~S?D;G3+twliSg<IW3xdCknJ_$40aI7szPrm`1l zH~>yki2oiwOrfRKjLg=CV?h_lT<`Erv)-h<&iIxPc}@xKi1^4`DF$ATG;NU3Z5Thd zoWK*8tFpFkOhymm07NJ!UM3E&V}#mKVP&rC^psz2c2`1BTbA7u;X@zR<q!REh?uhm zTqnSI@Ft$3J>V!N?TnoXzK*(}J%P-S4$6X$K6G0@U7mA)e=%JBrMdq?@dZ4Hgrf$9 z#ey9>ug60lOpw%qf7)`r)|m8#+VdMpiv0^@5DC|0FJWM6UFNIo33p7)6zgclkx%)= zP(f$@j(fbA<4<AC3X3}|fl|y=pY$eonb-mEfgkbTnUBDzi2>jA4MS)30H0UxQ&0W) zoa{~43d$R?6AI5Nz)yx9a<VhCF#Y6)gzhwzVpnMSvzdNM|BRRuj}=wO#a<ii|28@) zVw{W)FFsm`Fw1*xR&FKQpdw91Nm?{>AY@v(Al%UK!KP_MWFIU)GnQCmj08T$T;ihv zTi+JiQ)uteVWSKhF|g4?Kha7Z$0}|ODs62)BywM3gFhe;fUgyCz~@*$fety6ZcNyQ zN*=bMdi>Xh%EQja=9LH6?}qo+&MGr$&}D%e=iMRFH5TIGxaDV04h3{AGAZp`$?<(P zZMuk>0ZqmJ*p*J{LA|VX933Xk9@qP{9G$?ElBZ25y9DXM#hRZ;9!Dhes&)f+?U3t% zw3AOdd4Mzml0@*D;QEdC72N(vBPbiUyCt}J`NEL=>0B@o=O@ZX`%`v}M|_Q{d#^F_ zNU^p#vl#}%3@~gi6$bW<9~(fGJ|VA%Ag{@Xzg6>@I5e7uJW(BL{?<?f3A<OyJ3y<| z&HDKn?n_$AT!7VBq_e!IL=p5^_FT^oBr`Vq@#nxk-KW0%u~h!*Rb7<=-f99}ocR&< zDWt9}n_c0!A^)vWS0of~o)>0LfF#O<w5)&|(R`Qe;@gjYMoQsZ?}8)=Cd$PsKJ233 zGngj61>Vs=S7BLY`MiFadFWEJmtjLVwff;?<@kt1XY#dDd-O&*6ICPqE5`CzvX_bM zG%Vx5na*c9AI%LS?C8a;gjlmsNa72R5#(>IdDBoF3|57A+Rfh$x>H#=_J;W4F6fQ2 z1te56qIn@S)(N69hFwG_arodiMcTn@s)+Bi^ls-Ws|~(1$A*uD0eF+%uS_G%Zm*p8 z>{ccmPn8mt`AMl<Ks2|t#pMn!V>V6;LU22H?Y@=Q#PG&?YG7lHC)eZ`D#}>J1splI zeshXi&KDmwdR-&QNRRv7Q3l8kHRij6|I+pQ?~1Y#PW>fzCo<Z2LDW-8S`dgE>_I^T z7<w4XC%#=_vb+xoKBS9?Vjg_%3xD$rM1Q^>lR_Oej#o-!4-xAM+*y4=#CrnKLzq0_ z4(<|9_I#u5y93W2Eb(w5(G?JI{Q3NN`{4V1&*1hDl!>e9f{IFfY3bqoyS2FE0~7)# zRv&G?$Z_csUv!noylo5+xjHnzKamIo?oYlSQ>mLbEo>5(e!80s19Odzt^lvkcDC12 z_nQ}rQ?XZ?FSdcJ+oQ|<bK$$qHP`CwP6-!RiGAdNo9msuv)v*66_>*U^)KiWVw75I z-%mCnaSIzgpI5q^4|9fS;})u$N4KwYIu`?g35OMNO09#1{WXcehkJ7>s?GpFoguK} z=Jmxbv}$WG%9RS(x$}BB^10cCp0+>uzIMCObUeIASnpa2@b~w5eR+G!o9w4+#+-9< zqkm{#sMK|PyUi&UvT6eyx7^)+FYvn7cJ@5J|1r%aacK6TZ|QuL>Eu%OIQZfE=qPR# z*b2CQ`BP-tXFhN#kUjf4YT*<ZrCR7e--Ti`RZa>HHayHFb5Is1R=ca-80<ECGcJjC zUN+qM-`qeq2YYgs_Lp4EvnL~cZhqc&+;pAN5>)r8=iEEE<cKrkPZYMdGc#UY9`Wm{ zJUsL@Lo9g;p-1OA5a6Nx=Ja;GXE0+jwJ%xhLAO0`a~pW@yg6O$WCMzXeUFbXiZ{bt zhqQcI&%P+xYO&n0C66q(``_K~uV)NBF+W0)9Vt|}){o5W^u0R2TZc5?;1zEJqDSeR z1t!<}LmkRo(~u|+?P{M`iIxJs;{!sahn<r)|Eq%*(o`+FJ2w6i^UuX+T%2o_NeT~2 z5m8a8w)e@xpDL3cLjc?4`)T)LF7=fziKmTRXShf!%H5}~fsrmGci$MqRp01UeL9si z{}E*sBQoqLEH=h^Sf2Xr&F-cSvFEWxR~egmF_oBv=}h0mwEkwmG`!Gh+pFg}2m0r8 zS3`ojOI~)0rkk>y+x*#7OCO8drlL@cHcn>)g{P;@M8}|aw_5;f+kpBKt3=&{x~B~> zHlOT$2lQG6>US)uY<4eUrLTXNW_acr8&Epp{`!#k`s%8d!l!7r-6waWt5m6!YM-vH zY4qIj=5}@Kt-+o!M1_TNt1*+}u5HU*e1U7zlH&dTvAnu$>hWA4Nlp$0$*pZ$WE9Fn z9uM|XnWtjTekyP}w*au+k9sN+V>ejE1-3@ry|6VpwlH6>b1=UiHw~@Y@W5Y~&NzQl zJ?q=a!^8GeY_eyjyOnc$wOjllu028sN@yxN#wx!OnYkOuNokiH<!}g`;_Xg|d!q%M z-eq$hoZPL7`{{Qi+-*6$lFG?Ix;xnV+A=0<B0B48mJBTHU{`HC(|0?T)IUDpFzPJ6 zAGb4YCw_6<DaOmk`Kp5m`!uZ`^Xb<(PTCdW48j{hwBvl<Hfyd$)xO#bb>g-cQ7G5J zMa|t0{re+tt5#OKmv<t`cBsU}Ogo4L(y>+Fo{HB!f~-oJG0KzP$)!3SQ%l52bA4Cs zwCNNDn!SN*(>_^(L-nDHScrG&@WSSTd0?Rb<%#UI47INBb)d0-=gVttH;Qek+Ji6p zRsJh&_`01;s;+WTq>XtBq^VW39n=0whZzr->#Ljk0KsHrff<AECVvd;uwS)(BxB{E z=rkFZy{>|ppQ16nz2XL|t=R;wqLHPc`wqhr`XJDndMcARGu!#axOzK^v9h3pv7Jw! zP}}sHH$+Rz=lxJ<+B@A*miCWyEa3Y=n@@cvQS>&8_tO~FN2+f(XiY|1l<>2s3!Zt9 z@@bD3*kn{QiIy9_{lRDQvwg=NX^2=iy~aI7H<g^PoK@A}>26tT@C$8SCKC_U`I8vu z(fTnUhu>a<3q4C0jOCd(X`pB{6~SrAV6Vj$nOvZH$B%U4I8kCopl76NG;QwF&S<Y^ z&Qfug{;Hh#?X(`)%QNq!X3=53W+vriE32Ub$jVdjn^|`?aO2-MVnQD(EppziV$qxE z^vp9*B!foeb<ek|5jc-8Hzoj-`fmiP@%sSX+@)QaaSLa2rbuMR2cz-6<!}1-9>Y(a zA{Co^?q4!-^!C9>m^XH+JVPbL<)gEc9pjX`!gbedz$aWnea#>=1Rdw<_C?lr8=xNH zW$(@y5`97N*+l*&ez#DtBH|?K3*4`C1~N6#7KGg*!7-wc=Bv4B2L>hAuhSjrv$jCO zW4i<cyM*_43A1(ykL?o->=V-MtCaT|Sb3&sYo};=rfJ>Ih9P&8MCO%BnT-nVjS7p6 z3bz4PRc7R!{vA1*qD=}WO$z><ix>K;nVpLqp3vrPuhpYYj^6D}uA9!7TwJLq!Fq`M zczZX+e=K>H>r0@Hi7a<`{iA%qlAzlYQ4lwp?!63mj0I7*Xs|5e5UL(-1>NjG{St~{ zr5-J`i9snRY+a4$fgKNp0}q=6kC+3GiUW^{1CNUXPmlvof&)*U15cd;PoL{z;hCy` zBdgmC?ePq)8<h4~FyJ!9{F$3jKuv0bk5fX6Q^KWxt7~<-P(Z6A7PJZ2Hd{Sv;^?h% zrn8e7i_RsKf*=+-=jV}0Rl{24nz*TQA!{6461hI+;9XP~+Q;(T5f-G~?7_Z>QK%`n z6|@HOH4(XbQKMaYD7Yu*YE!*p(!Ju+-^?pRzO3ewFc6VWd}ihuxBF(P>cmHSJicfb zo=~MeG-#587m-z^E(_S)G|0T@Aymi2)yBltpBxSG@Q$k94ukYDX`E*ZEeTRB7rdS2 zw?~XYO~-AZwM+fTXRq^$ZY%j$`zMC~6T(J6$B4b)a{LHDj{(bwp3;b((`f3suiHdf zuX5BiIlvrflq}?s;Ny_cvU9GNLTqa~s>N{7mQ9$vZz$#E%7B-;w5&AQyB*oVA7J*{ zXMxBP+JwtTYbQ4rnQIC^*`zrhldJ!$btCMC2{1ZR6A_BLD8n6Vf!EC!Y>0S*N`%W! zXCPY>Yk@CSNt6RrV$p8Qbr6!)jviEwy#hxw+5q&y_K5YU8@TMW268o#78Ko#!A2b7 z4@ML+U+Y!TV`gnL2-2~_h3sIBc=&r*Ls~m7U|*`ZdHFM|P-t7+f>rkbfsyuj($l`w z{ZL2Q8bTmr(rC&GwLc6(s#T79f^@!FC2_0Mf&=0FOONk4V<KG;JMi8EuueHDvRle? zooL#Y*l&!%ZiryiBHXXE@8xU4El9dqgFO*5P#qdCZyh~xct*Wg_$+hwwd_QwS94*_ zHMM0Ptm&0oC@k#vw2xRcQ=)fi>qugCn}V&U&J>-tYMwKBx51P(+|-DiShPhMqxNP_ z^)E(&+dW3sHr!Jsi$E`YLVesvtL!}`k7Zv{bgLq+p)%sC(7l)Cj<dk+<_*?G+(i|@ zopLz7g6>dTW?!}FEIyIhdxCgBEmFdcm9A;|fhHgt4?hN(bEa1=AD3!h&q&Y9m?hzT z8kW?Cn8DsFiE<W{BI(#0?11$?0mTnRqy<f+KtX@HpGTwDMQzEAXz3+KXb+iZvDXcY z0zv`W1iU>4PX;TWX?!+Lef2XBB;JoE(spvx&}S1;c8y!ec{~G%*66$lX(8;ADb#H7 z`~%4JS?(<A)oBbmOj_pqFO-u-9Gi{HL}VPQmfT8r@JqYACJU7)nii@`VB4Rs&h3OM zK!DokhznEG58Bm}zTX4PciS0prw&guI1Gzpjf=7~WDT^T>(K4Ju)aPn6pHahcY241 z{MjX+g#*lZMg@!lj$Q%p%<?ErF`A~<wGy^yQj01YKDv0vc(VBavbr;`tHjo2WG!P; zSLwq3w&izaKo7~ZF?8Ya?51QR^h^M`th=gNIr+{<>C4Rwr_Di#^>ph@ky_<>rRk2- zP}x#vW2yGg<RRi7@Q5C&H9g;#kQU-v6SeZ=<S;~vlv*{ONWnPVd0$AMIREuCC&$m4 z`j7el1dUpd+A1DxfWR7=7sW7$T}qGIF&<L^aM=IJP#;zlKBbqhWsa$3g{ftWxl_~r z+EK@$N-6+L$1g_dj$Z*&ARMb0A$^_gIUthHXj~+)K%|{tsaC1hrElfsEc|)H%bAyd z@o?TfpsLZv=}P&?1<E-xM!r0MoU7Jx8DI?E`v+W2UKNXdCD}L&^KMgwa+m-&6ek^b zfPVmU;ITD4FH+i@uTn(R%JGB)q}B+DMiBo&6Gw#7%Bsc>T2`ix($n9gcPbs7AMJVM z&hHwLAxv99=iLemW>OGrHUgT{_l%8S74=Qot<2|nRGRX3If6^ScQ(q}?v!rpLcH80 ze;m!k+IsKwxps!l#1^2bVibUJ*~xML<H2BJws3$KE-m=0<OVfHJi`FGHD(>0Vx?)P zwF?y4L8Gv<ZKhw+bEZV3qHwuwMy^sErL3c>kw*j5tJ1X0#PI|%IepLDdA!v$!)n@L zWxjBvSs;z{0Jb_8D3RXyd|yODk1<5l+%ho#!=>K)8b|qw&?2M>B1_|^GuxIr>c1!i zU$A2Tw>8An%X#J@CtU9sku^>kLgzI~n_=keoX}30LFXTrAVX$2b*mbce|S6dHqIT+ zPnAx0Hm--KEHn;Iz5I;}M@3#^loexGvzIS(Uy~Po%<52vNxh(y5w$Z-Q=?TDr`%cS z>`ZKa6}JNr)cS5LTCz&YMY5k7Kb~daku_Ew$S}A<a)z2LerjGQ7Zzy7!)03LrjGe3 zA}~f+&t@70bOOv$|COGLd4`{rszm}fe@K~Qv(4mBW;TtC4P+gOZMCsn_kYqyIqxfw z_6e4~g^`1#Y8);Mgwt9-K$1+OchG7pDK^_amB4L~K6?V++JCkf6wTuRKm1G1@>xg& zc-C)49PI>@zK;4keA;uZn_+t|;^;Yyp4H~)xl?VE6<NDeJ6$@Ia>mwQHmO%^W?bZA zoO0(SfdRI%-(XIC?ee*7H}yruwTtJ@ZDFgX#^Jt!=L#=yw!&))m$FUDym@465DDfD z^M37H)$jG1K4z(TX|8$tkAPe1wOap;np)g1)cz-E4H2naX>%kyG7jYny*wH*{H&fc z&a010mfKXx%fzdd_dPR&U@qW-AIHYv46M2*ehsitgF&a7DbhIay6Vn1?7V92(6Z92 zY<it7cw*&3GNjsmSvA&U>{smdc~bHpCSdPu*G4TyQ`GpO6`tgOn37x$<W5!L`FT@= zS@)D-xwb2Zwl{}1z_F|I^#dhfoYm%J*kxHE;_SK8XtUE~vvX1CYdYoT4Kd@XZaWa^ zcvd_DQPa<wo1G3YR=;aj(GS{vRoRTe^I#((pQX#zc>$%egR>9f`$JumZhDx%jH!67 zf>aLke};Z1Qi=Z{u*axY&@``_$;v<DvZ~`5-UhSs(&^%zNQFCoSnxw4PLegE0vv}( z_-^ufNOp`fU?4Sn^%?S)ZU*w{bx-|#Rb9K%tE*odLFK7ed8v0WHlM(kYaiSoIS;eP zU#s|~^?pPC|8Cr<f94fAa5WbI{Cfb<c*#OT=UhtkxjkpRMb!ODA)S+@zj3=+@QmHp zkJc@|+ZXv<ws7y&F?FR@Ei|b23$&+MR@1&K+j$<%yVg5hU8Y=~os%|Bvc*)MiItb- zL?0&I5;4>N$SqzXYIV<HcCh~{)4B)vhxn0O;YdPMB#Wq@#0w9=Tcg#%8-_SZPV9@Q z*WvPqPw9J{l=QbPcxGE$RdObz@47%WcOwy|&AlP9Z+2>KCe*U!w875oCBvPKHWj7C zdN(swLW7K>-78hv#VI!nXI)~0O*cI@VXmvknFaxZ%URY4zX1b&Ax2Locg9_YJxn+N z%Kx9%AUY^FMg7YcPUy){ynYks=$xegE1h^&#=LpeQbcs)y(;?Qmn&>+3;d={QNZ`- z?+h2<_^_|ow2Cc4;RaBSMofFJ1vttBs`%-Dq&I`&UkTR>`rD)aXSBgA>awsZeZ%gz zWy^8=Y1yR7=`gQapN2W6MrpU4Y?!vAex`M~g+sloGs&)(^Ya%*{0kIX$-@4QC$BP$ z4vcSH)$0I4z<ED>hBI!sAa3mpq5Zn*V;Fu2sf=nKk*4wZef<|KUDG^DP4n^lmal}m z2qQuT4)k{BJ4UiMqh&4x`#_s8V>*s%#0wdZJf!hNJJ|-td7Q#*;^yJzC~FAjP#{?f zrXc%M7lWq7n!VQNbFX^pcHh}7U=DSXrNqD{TovCN<%k<E0L1C-oZHwrHbn=<Md!vv z_r^sS)OSb?cZV@Mj;?`OqFiu2KS{aSx!^r+8LQy~la-H)@!}MMexk-JgL3<;iZI@S zokc0AraG5gUuCL-N*HzieNl+<L*C#^erCHlgX}PM(9SEkOT>6bH#Er<Xpl0f;^fp@ zFjSXb(k*u5$opWulq?k_8FR{^+b8cWH%;$=+ekQvC|Svgavpvi=>(rU6Z8bj(2;(C zF(|1H4a7I2<u@H_r^H8>j?WREBEy!)KmHE9%qNYb4UcLCU*K9NObh4b0A26|#|hKp zFv@7>k&I{BNj1<L;Z{ZnfaUlivHs)70a&H!xWf@dGRk>`<LP$NV0(T)Z0)kYK@C3P z_rppm``gX@1%Uq?QUq%WKEYC&j<!>4pf<v*44;u91A_(qu?ijJ_?V1vI3o099P=>2 z6hcA&@r(-CSdq?f_=XHd9>aK~ooWLO_^GfD@b9l7)0obi0U~6-aXy4&eKqF>>$j;P z4HYdQmW<gfIK%5~)g24KW*j<{LF0wMc^8RJ_f%lH_5;Tx(l<QG>OMwEq#?(Tj6pkl zX_7XCXd0P>BA1lZrq;LQK_yaCf0FPq+7xRK_l$53Z1xnN`KuUcJjw1~UqMp|l$}tn zU$fV&42m6&g&^iuY4gZ~O9iP|sm1p14v}{pVGpYst!YO#fw#zl{$wpt2wJTe`;Hbg zDR*|-D0yrO(gd3cG68=_D=!Ho+EwJWpu1EuR{CA<*G@Xcc&4<ZxCoX{T+-%U=5%Gn z_?LI4e21p4l}{iyP{K18*7x&=__?bpxv`#T8g7glV(w^?re=r-l;2!O5zPo}-(snQ zG6l*G(Jv2Cs2%Vc!{=e*vgrRUGjKB>p``#^Zn_r#zsic40W>;b0~ubPgQ40J!};{! z08U80IL}OAX$j$_Qxoi4BQ?hR0yI^6c2Ai*b>#=*ZCqgjdA5OW#ez(tASl!@ke3iF zvWopc&j~NU=A!&;f0vL93!IM}=fXZ-P@7YWGH9o6T@G6MUNGYTFX*fee9gy%50iEI zzo3SZi~JihtN(<IE_L4v_Ra!}3?R=r_f*i7&7>*3Myj*-ufb*5phJgxkk%%CkjnlA znq(FyC<o-u!3j6;lk_E8kY_fYq=78_KXEb#@rQ#u_(_29D#AI`_@91!MGnvS82%O} zNwh&Ivs11QQXtQrmIvw}k+VerM>4DJKms*aE#QI*QKNX|1{=Oa`|u70ZfZ%VUC*H_ z4ir0$^o=fes)OHk!xPP*$nj%cJL)0|T%8CTZLSdeD<8yfEt+@m|4<<?hbnpXrxzgp z(+idn6<9Jrl2#lxuJHebHS9qf$dW1yg_qv=lBP|IONbh&s@{TdQ#K2~hkanfSw@Gh z@Jd--Xw=#_0q`2d7$2E_QHJ)LGDH|<88FJwG#-%?iHO3zTr3HMo1z9k;b&&~yHzCN z1%>^nTjGQ(8F~i`08V2Vb8Sv-zo`6I`f7fOeogM|AN2hf#nb<P>3gpjr2qRgWMlti zpGyLG`1!Icp!3G(<Z|_-=g#90c0h7E8M4{c2|Gps7A5#74<2U4#h1huiRFnpSMHlA zmc{SAydO?ich65w!oX0jNs9h8*r~zk@k!4Gg=&uY?e)>^?UCxk?$G)9<azC7wa)!X zPfz`Q*i@EF4)Acldb5AAzjk^6O#axeqoO=)x)^O9wZFz@TA`xMp>jRUp7fVkDlGTk z3z)}hTrZcPqI{_Jd)9TE1NwE!1bm{K_nCs#!F|F9fe8LMob<4J?rvkP{mR|m#n$83 z!DNGhsrtMHL8p1$!%>m``x2WR!$(ur?*r(go}?Y5;8Z9va^z1td8?F-2SujI=zQ6^ zO~+s)EDPyf+N<_~UYtto5oDsf%*n2p;cTId`i@-qs@ok&yQhDRv<Dbyl%F4%0r7Ns z1gW3#C#>I-kp;|LgwjQlg8Qu|>*(LL#^rs&ME5=nC6HyfG*?9P&@M|S{pQOc&cJA; z)Rl?H;Ll4_4CW!^ngq8eDn-@0*(ecA|KI~89{Yb~vO<fXbMuwc>RHSWBTq}fJGAW` zn8u_jpbw2_ojucr)B=c&cz5DdtGYBv>CYG)XvGs5@#_jY$+11Kh4KPbXv7p_2PO(d z$hks&i1XjBB~oZ;)e3dKbt2#qV{?aRPqA?9z*G~>HLs6;R`qC}(urc6OZiPyascJ& z2_@H<K6!qP9~OqMx`Bu8?E8xsg9~keS;aRD>J6;AV;l{J3qF7*^mRF@a<3Obtvgz! z@ylFDtguNtz4C7Mr5E)?1@fFM*N!*dSI!Uo2$#nMVOazj>866Snljp)Kb9Ud2jpW6 zaV||^csV^^Tbwf~o<5Ou=lvN8taDH$FwaDLG4eN-)LV=l%4;rs8Ow4HN@qId#$G@w z;-yU(Z;sA|Jd+0G%Z2(>xy8FPx34W6m&7aEB7UBpX<*L}l{dC&XZZT=;l11r^Hy}l z+A4~<+suvB4V{VH%UhnX7e`1AxCwinlWw36-(<LPh!iqt|E}A0+n{Ky@y&SWb7ac> zN7RT=vT)H)<a1+t@6g`8>-$)VLd?c5elT8Ynud{bpxtQ(%ph(>)8>SJh#Awm^D+(T zk5%W*?(&y@mwjC*SrwfoThgjz!4)EL_w$Pb9Oilx98ktL60n6h-)pw3Ok6VzPek+X z@^SV8(kzcXmU7016Nmi%q?P&ccW&unIzTp8=`{i?((9BD!coaw_YQ2CZ#0OR0V{^} zQ5~s|%$Cxz057}d(wLKJK$MW9{0iQ;xQqu&h7Gj?7wO7`ftVTp{?Du9+*wZjT~0^U zX_mwNJ3sVQ#cID*Y<+gxx0Y!27&_W|3^5$3N>e*VW!?4p)-N6Nbjmkp%$VjdyPeIk zrTnPV477-{xB7g9Oy?%^WrtCV**a=N>l@X~unvCmG+?~HU7P(o*RmnUH{uZ-M?}7! z!JUJ<7}hsmMETE+BbOvwYppL2(@VUfiw+ok!h7v0-2FNbAw{M)5zQJhl`31C`0zFe z3mK3;1NJjK(f-x4^-)4R2TA7>DE9k$BaEzbWue_gAGGxKa@&WAypBQ#+zmGrrdwDs z-LI-oa4`ZFk|r+EfK2_71U(!Ony9WG%8k=^$QXz+@w6f6vKUT4vz|$i2RHwCrlFo4 zz0kg#ePtOQ5^jhemvylr=*p<7e^YecDVb50OoEOOEE?ZVn9Tm<)TH9h@dwFJfrTd< zjkMU~hA*R|T2;)h{GvO0Z<+`nk0um+FtM?-t;~B&)*13H?W1r3esiS@@ZMA1)Uxjq zg$+(V)MOQz9set@C@6p*e;khGGFm66jS?={s^kNlJtkHN&VvufR{!lBH!Fs%_MBO3 z7M5G8Q#X^F*P$vu8KerM%_sW%&#+6+lOw*W9ewu}LX@Q9VC||mb9$SHMYeS+$9a62 z)i3&877LpR!xsX*vRGsJCFOF0s6~n2sg1{dQTF#Xuh67SU_Kr!q+&o)WRBR9{VDM1 zep(_l1AX}UZC5W_PA?J-U*`vFMN#;l1UdfUw`BF2&yo<(o|`07*TPD@`RWg3so?-{ zZ7i%}_MIR7GL1X1yBDlxw|*IVE~y`6V1H31IAU$}eKtXicz=RM6AlxJFq|?1zQm_^ z!4HKof-`j;oxUyY3b?xx_39mLs#8RuAwA?3$SPomD-Lj3WVG7cEtZcnz|(9sF+8NU zdK$hbv)sj$(hbEKlT=~;)EAu`eg<Tolqi?zWXA6)u=tk{Xpspl62BdPxpQWNgmuNP z8Yk?8Yl3y9DTY`l?za5x;oXK=v;VPWM>(27<Y!Ok7(IpJq|q2G@oRW6lQE{=Q7v=0 z3(__3<HbRpBR4iZBSQm?8up|Z>dSq}%r_3HO*)J+ETox&x#MB<>ClEI5@o=w43$Hz zpOi4#UBRHT(zR`V1~+68xPN)KadUr{y6fGA#H1{7@TJzzBqPjyhNMJ@uL({J9W5;0 zF@$I}%CZ#xKC0DfE5a{R7q*AxS&?jexORIu-<*zf)$bBt5|(Txe0H_FhG9PaWnbZO znQebZ<mTCY4r^#e3>8*inT`sadt1SGxp!}b@@-HS-mxpK3&gMZ9H8&tv}^(J!eZG4 z*jjDZ<0?lBo171@6!=FqG#oq!EFu0!@jm#If|f`HEMc0v+c<e}asK+&Q2zVHf3Gix z-SMBFaj=>q2l>BOSpRbxgn<T5Riq*RtK1a?!u)F%)+@sRmnc!eN{dM0-SEIfO8f%< zUS0Ip<sPt<{%7&_f7BX*pDMA!HxYtul^DqXSzj{sM}5*?cL*g1uPL#T|N9={uM4il z!BdKi<i8CBrgu|Vl@sn?v%h-MU>0RDct2UNow6|bKjQ+1AI{&dyHNmlD3fAg!d}-2 LHo2<&Yxe&D6inE* delta 11787 zcma)?2Q*yk9`;9xlIXo9N|YdajS!tEqnGF*h~9hKTJ%0b5WRQ7=puq3I>YD^y$#Vj zAGznAbI-lsckgE{>)mVbJ!`-F_dL)0AKw3R2GUA05~+#;3Mvr@4TJ##foMVE0)azz zNFWgECsI0OpiHCJ?kgu=tM;a-)Mu^m?9h@D45}t7J^FR@4;~4x=<8O<pIrJfnX77k z!f0nuwHeZ5JP;-;pJvpN5L>cgKi5&FfBm2^y4-0`<mzRnbYNbYR&-5VBwrR8_U<m) z7!+NxVcLY<itdJvfrPL2KF?bFzS4$7X_%-aLo3T_34nYyxh2y3RR>vt*_F&h&?88V zjY582yQM{yn@5YjGR^s+CVS#ZG&9jBmB!k0YPrqtqeNK-pDf6QB&o$L%aDp}xv8;u zLNM_@aS`p)y!A)pcs$qiy@C6F$Fzsf>n&Nbru3zXI#;91=Yb<}QJPuG<JInsR?D#u z4pN*Cwt203^2@{7zU!K8E1h6odytv=9N9n3J0J}hTBph2ire#S4aRT|!LytL%{L+N z52>8Xk=HTz4z&bGf014!;>5rN1!F%>gOc5iN#iSoj<8Szu(l<gEGCbmsLo1faOTo; z#HoKI?cq>fBSWf)iE5fq7*Os9yhuzwxYeQwxn=|H2@+7I23F|2)!@N(D5rax8!`Tr z3kTh{<`ynSZ!Pl-BQ1~L;Q}Q~lfkPA1r8MZ5YOF#ZnqOYoJADEqjuJ!2m(|uLYv*^ z_v{A_22e0e5ao{oW$zIZY;SIrA|BwRIuka&Na%T*K_s|(`h<ZzG`E0G>acM%gx6}2 z)0NxGdD!;hcd*WUU+uF0d9eC+d0=gQJxwaJ`N~bB<jgTzW}qka$N@Q~oG`X0Xk;Bm z%X-=_eT=c+a%m3s9JFrFJ;z$1Dphz?!YASr;zASJBTEf1CpfR<q%>>p{&bPJ_|Dum zv;Va3aMygfw|jg6Qb|k<P@F8Ab0dR5VW=Pw?kx!q8xD7SCu<XXduw(NTbnWsaP0JN zQvy{!p+0!8!Z1o#a#_@%y0%ku4@j33!y?}l)~SnW-gq;~jg2}@m9&~(z85%{r}Xyn zW}!br{&v5dfa1_sUd%E5K2&*qY}LSCG2B%#U(xCwrbtjeP+wDTUm$CX^Sm4v6)6#H zv7=A!ow4$asQ=g%^S(Q`?fq2;tK$qd>?+tQs3OjA{o--uYl#sOTK>xRVI4-nr+k(7 zRVwar(WG?j+p^2gWD{TVIo#t3E!lQ7NW}O=sMg?&A}`mzbYy7R;YMJY8E70D)xo+h z;gDNCs85~U0@U@eeh%2ZC$8YhKM)+erseka`+f$oD~VjV=|s8OPa5z#M&UU|8{3DH zkJ=K8c6id+%B@q%tdFqdXy3edq2$dD>JG~7!3{j8PiTVRM48}_=stt}3O&Cm(GF_u z;cJq7^wXIE>$N(pdZ6IcOxXPS#TR`gmdAumVfD%+8}@+c6p#7^f?&IS!^xYLyV>m* zhpBnX>K5(Kx+1qrrn9M9yPt27WG@uHdC4nrNaUY?P-($ii`@I9<A-0|M@WHliE%Om zJ)t>nl!RVAp%Uojs7kBorUKKKI9|N*B}8s9bk&E4sF|1qpwuW)Hn;2u4ARTGZw*sX zy@R|~S@TzhT)Z|QRDBgcTq(Z1Fn0<mTB}6sFyze$Zgu3v@Q$<~uLuz+U9oy`c?@`y zUqv^sWmRy${bq}`gzh8th&GKUvUQH&tJg?)g;nK+_3^{IXaN@U6F4tXK%f)?5Qyj> zo^rM@b}}<ncX6_`d+U5>tlC!#%F`-Den!<d*&Bo}`WKVfA_G#xrp!$~_BvDsixG2A zbL$THNES<>uqe>bsf8Rcg)k6DbOhggtDo<<sZuv%&r;q(pkNZ64!RGy-~P6KF19xb z)FD;_<n@y-w>uk>%}|-?WS2&(GYzmld+#Ng5%E2h?!eR`xZF<7s#3o^c>6+HmHe_Y z?{w-z2_w@prSMKvuCk~;Iq|RdNy~|3T6=G-Qq&WeX{j_#0<$78ck<yEA%q={;bwIE z5qalRa56XP2*3az85h?hlVHu4#UA=x%bijeFmr0$SkjnJj-n;xd!+M{OQAY%Q08iz zHAxko@KQMerJDB@PT$^(!EX&6pL&&8dL2-KcQ!<{P?joToA=pjE$DBlvTojx2kH~o z5*G3H#M%xac9_w<?E5hfQM&P{PH58HgP|kASKzlPJ}ncOY0I_SVOr&wP2ta)l?{6a zf%yy>!oANC7IG5Pj2}1ZIM?)0s`C(GyLfcH7I9Nf)tAPBDYpFu=teP{4j&ey&7oU| zPfS>9Je$$JlhQZ883X%eb(0)>Uj@-w9t$rzy^cw9o``)(B(n4wVpppos>hTZ9cNb1 zt2!<j#p;w1+JQVy79jSEhhaT_beN0v3K&I#!Hqkr_=<?imB#E6H)46-eBdaYqOi5y zJQgH)oz+1)k^;)Db-a0Iof8?S6>d15Ce&M)?PhgVq4yBws`CxGrrp;qVnU+G1=vV| zimvjnF5!F9p${<HkJ#xrRAeixwc!3uA?B|y+7Wh<k%C07dCu)HgH3n<(-#NgMt}&* zIXH!)ewxB1RzG6T@0gH>2Qh){q`Cbxgv=Z3W8Pl5Udc8wr|L2Pj~Ioe*-*MT%2{iJ zse4az{TZe3srwG9K(c7P*-*=??@B$JmrlgggJYc*4V1{qdG6U-G;qrV9!twT(+UT) zuTZh0K&`|!^?N8s1a>{N5hQ%~!8Y2PvYnO>uAcZm=N64;*rbcKlXQO^Z%}?#8@W2d zcb-z~J@;eYJR&1{XE~|RFvY>Z=}q0v+X+OY*^7pk_DMCmGHoz_U3}bGkD^bZLTiNQ z2E8*(yVLG1r4D|rAP;JXsL;ln;Kg57;WsG1YZ*X*j8xM}JctGijngiMqk%xdVjvLq zAJKF1v@!dgxn+HE`x$<s&$yESo`y}RaRhz0(>BZrPS2;3MR}hd1<gj1rmq&PL0}MW zhrmJcn)~#{ZN~p0+BW)jlToetjd5%q5mz*&LbYkH0S@$KJghrbc~|7c9`xq*hWGae zL^2-$)H<t2WF>*f$x)7+(D6!+5M6Cex=qwK-H(x~$B83g=s~ffo3bt|*$3nj8UeI{ zJz8%Q2V-4DoZj}h=b&)QBF(164ZA-f>L`9RAh{g%c%t{@Fv-}(WuZNQMMm&=?rG4e z(y0v>Tz_%sVT9~thf7zt8u5aNpD^~z^(bL~pow=Tru6B6(xiOGmr^^C&ThMxbllnK zoJC5EgxfhYue`mK-Dh3s$?7Iw7UWa1aqWqVzB-l6l!;IvL4uAarD`xQ4laEvuLEo1 z^JXM)DQ>G>C^nv)wR(Tcce{DMkva~X`-rdmf-k>ZDIg*hz~k^Jt4FSOIM!5TIWtU) zK<Lrv8=s)-U{q#BLOe(I*vxy&W}K!cVqPF&YyNfF%0$u_bUsGPPKHOA#P>~*et3d^ zoW88}xL8XoT`*+5xjed<$pnm}nPOsF-#1Jxw!T#&3rGw{(i73@HhcQ0y}N3Ws?@_x z9WRP((8)t^HY1chIbd$Y&IbC6L2)t>PbGLPz8vT0kbfJMR3cVxfj|~2oxBHrBZy=I zRj;fQal)B<%>3r4ehherx2~@qMAwz!ZmS*h!73y|oH~k8+L$vqkif{OY&GixO4Y7J z^gaY1hY%P*nxu(HS>eHn@oF`MZ@V<l8D0$A)He=CFRlub<uV|@nY283D?bKeW%y#} zfB6Vi3xP2WeY`#%^P@-#Ri7$H9FY3T<xy8{&rpKqiwk}-xrV3wb~`!Y+2wP(#6T3m z_1I553;|1A=ub9iPf%mYJ{sxe^Een1-mDs6n#BTPnQ_G;-Cwg!t#IN9J5#13d&@KR zgypjOr8C?I8BYe5(d_%emt(&^3fLf9O|4c?A>GUW@sbG5x4UEPi!4%u-IKgYGo0)P z()2CR71QB1t}+Mbu7>_41JR1b{<ZlC&ySZIIjG>VQB0%b+Dp#%cr6iZOlkHN??)(F zoG2QAL4gb&gQH8Q&%z}=bDx}QU7j@P>QmCw)x7SdzA|xWr>>g(D~0a_);4y`k~{>9 z+G1_BAMcTPJYKa<^vSpGcsha=ve=P-R{Bm<;%A)w#1vyWK5|WKlz?VQ&2THV{W6XU zKNu@9Ih&_VOrc6_whg|^YnB3amNcaca$R^0ymF%<aQr1N_~7DO)%H43ZP1EZi%u3# zqtC7fC9yZ&uCs_e=Gys*6<lK4r=j|lU3ii-sTzk#JtG~@VR}$YcI`DT)~?&nskJCq z?{5XRLG%XqRbyLc)NJw^Y12YGc;%56IBP~`4-HgS!^2KrK6X1#S;>!I?vvrF3AAh? z1Iz^CkI;<l$oj9$+v0|dvZ+>Zd(G#I6PscOLTX?LxqC3si$_l70jWOES2|5#AYS<K zW8A?&KR<r1p0zOnG&eKTw{B-!1@)#`40ajT`M>PInzWW+2f_zE%hzAn3E*s=tqd3r z!dtCI9=qojI^rs-68F%hA<=aD1(`LJ0F^`!R^vumLNwu2z+V5M?Q`u~{ZwL9`czic z>Z|E6&lCI%-?bL~ORy*5<XMs4!V7q*`lQItJE3<FhwytA_m}mn$HXqv@}vT>WNmih z5}Mdvjl2U<?@6X;qQs`I=)Rv@tmN#`lJ{@>;#UZJ@;X00MIRq7jMOBrN;;L#2WXL` z_E?Eys~9imZax;ve>dDGbgcPqx|r*$;Z0)-i%Bsh2AkU#rZ(|egk{kEU*p9no`cAy z%r8A33RDYKs8bLn5xgzc7QMRKO*49LAH56dNAg&aeXuPaLDHwb{wr^gUYdRfRixtD zgDs!p<wK86<J4zJV&D3BKLs!3Kh*)!3P0*gqI~~mvG`Qj%h7jCYix^Sgp9){Os%s# zW05p?pVo%2)$gm5w;~RC%;t-58gg{M_tIguN1?JzvaL0;9Z3^>N=>>Kcsja6LeIv^ zjyHOzrmEi7MvYPDm+i4Ree(=?P9ORKvD6dPzt5RrgLN%jUZYt|^W#8Yz@P2S%U!6@ zH_1NU+Mn6RR*0Cf@uqZ11xj7>t+KHfo~GDrn9Z7;3Uk9?o?bPh)CsPx7yAxzWt!Cz zPHayJh;}~&XOsnJT%RBX-Q4}bfvHY^g{eRX0*OJ=sAvH_XG+<GcMAe0H$j2Btl^}p z2_5@rJEX`o;<I})3UOUz;jn}%k$I!G@%4TQb3a?`sv2C@(=>G*?2q5ov8ynyFBfhu zkB_>j(+bxvx<hf93OS52TPB5ld@fyXe$9kJrfRQ@c9jf;?ROu&nDh1Zne-7nvp(?I zUue5r11^EfwWTr9j5Zto8Pejf9S5Nhjv2&BreUks^{LqbV&`mS>106i+~|eq3*Y9M zf*YT6#Q4EU;lNzsT$a6&QF^PN@7d<e+*OC1&d<U^Nh@K$Yo8m(F`vuRi~50%x~KcK zXI}MS_|4_Y^+k==#qnO8)51>1_1?wF&H3pm!W&@O+q!~ZAdH%Gm^eQBUKXFsbS#a{ zRT_;QT(50(&B>OxUf?F)xZUh+?49i$9GkJ6l(eY4SUahlZ<BxTcXl@B>xI_UcfDwN zaMmG*I4qprU%cuqHS(Kpl{mN<$Q)YTi$u&-LI&Ui-H26n?#*Rs<1dx5u{TeGTZ0V? zQ-Pu9;;IKbOUKu-;5P?HTcMDNjWpB6o9zPTM}^FWE6=vyq*u1`AXYcJ3J2Dj7uxLX zsc*LJc7Tg&Fkzdo=k@%Rk(X)&e6>&+;1d|4hA?la85$BnZt<tG6x`e_&iH<67`65~ z8QP!T6}4^i5%hFEuWqPD7<IAw+?oO~5*V5}_T?Jrjf`y*wWn@llV2%@v9hMi<sa^5 zuH5(?udZyJ*mErCXPgC!K5=4~9&J-wJ{;()-{n|nol6!3-z){dU1(QE+jMsfyo%=y zKBjqfIbXIj<cGUgs+?<Q!dLp-yT=<6DK?CX9j}F6lmm|B_W4rh+VcAPEyBP-Wk0@M zKI)W6>0xEkb6?N%>#M0^-{ROOr-t_nfCF`xzIAktJ<IzIPQ(T1=X6F?)-X%MKIzBb z34DxNQE~M}3!91}(JwR&&V;Vk&o-*rlPW$7?Us^!$%f}YxNvE!9vU?IT)bH)sjw-; z;UrhNce#%CVm#kac$mAe`?wD%t~g!{_`I_wt34v^x2bg&e+87VHhW|-@9(xwylt9~ zMAzNlzaejK+8pXH0i3rLT$9GU+lGgRVi8|>4A#0(_-??O@>dqrBT(NuqnR~QS&mMV zp(!)@J+aD_?RB_x^1+nfGt#XuHnE~!EKN~E$9<=l+dV%-$29eYPf3Aj&vmVGg>##> zyrKDPy*;2pp~)lbq4!~*!M4Eju?X}FmSoL~(bye27rxB2$%^?}T%WGNgXnObsg0CJ zbvT2ra-_J&XTUPJv$0}*F+l6txz@72w#%MaslJByO>Xk5<l{z#_1xVP7st$9(vzv? z&FF1e?c4|FvrpIEW#0nd-mxz(w)-8F%xVD+e56egk?2hk?)FprB1f?@TZ^rnktc}w zY{%>^s7Kb&vhAd?p9}uk;8fXUn_L+6`w<53pLQ%Utw7T-pPukADQ_#=wSb*FyUP^` z?y;8ktjf*$#>QrA)rgM;OWw(Qvq@syeeP$Y>jF)tk?3chR9*n4{XW~l%2{*k*e(lu zjt8Lo*?qQE!FJwu_cmM`dqbofgn=3>XBP&0o*f&?U9NfPT}`Y;jr+b^N*ZSwyshMH zR<H;<OZ}#ZL#=~nt@hVT$&r~xSE`Dv3107))8V`&yt}Oh%&E1E2O9P*d78AI2nO5u zJcg9gkDhX}^nhi!S#NQ&3oHGa;V7Y;?wbo1`_=-E)Y^pO)L*0enu@L)eOU5xKaJT5 z%_+1*3V$KT<|&>tC1a90vn3=tUTAZ)d=(&0jdXan!~*uvswYkz%Ss7jWSj93`KbeD zr7!%M@K#fq_0@~Y(ct$rMNP|DI$D-rr*$+3h<Ue4gnk04)}tBrHr^TUuFK?tyj0iA zQeBD&)4$1&<|w(~v&uodRLkgXH!GPx7(rx?a;iqHMoX^0F7e6LoXZ;{;CXtjPs-|2 zYfA~!LszuMLZEdYWq0$;uC|Dzr)$`Oj)+oAxRB~AB|cj{ckri#<8s0-`RN8FBJ7Dl z*Bpz;;|d`9@}S{<t!Mg^3S@*KQv{mzg^()ms|$Dp`!QOZe46#VvASZ@!{gBBmbC20 zGmB&MCf4P$!(mzE;;eygnBQaLB6HG<)@6oS+jTz2_+bw6G(<?EIVKrn&g-vo<qEC} z1*Tzq!=IJm41Z10{xr}NH4-BUzl`oxUyXNKra?KNm2>z_f37s#mn1xZB>WvocsNOT zG)Z_oN%(t`;*`~<PNh-;Nj3rnHUf1v0_}yC8ByE4@sduR$WFb;PJ_tK1%cJguAhDI z3-Ycvk)39dooju*z<B3I-<+DeZ<-ww&hCuFN5AXp-5CrDeBQ?v(!=cSp8+A&k?1V# zz^fc!TeeFRHAt|JlSKw!U)F)JT`+J4gArfx@ds(n*w^^&+<}^?)}D12G^OM6%hPpI z8wXXhy^ERBi&@f(+0u(S(u=v$i+R$E`O=F8(u;-Ci$&6l#nOwLD}H)K;gwnpgSzzd zy7W7`^w$Nr3;POBa0+pcxd~#~2$I<dGC58FgeGAjhx@?KY5q9{s`<KilTcgKXpB_+ zS~`p5FSWKBE|1sW-;S8a@m|ECSc^|PipZoL9=3x~moV%ee~{vgeofLY94L+2hoOaE z_PA(#@t|^CytAd1kk4@l@6!<8srFV@wV;Je_`8rpE_p>>iiTH&l+iLiyaE&^d0S(E z6F0n2%A{~hU3KaOTl|zmm%3!9hGggX;lYpDxkc;qpLTngiLFdZCj+4Zmb7kQ3h~E* z=BVWu(+r$o3gS5ouiv9K{{NcV%G7i#RLZS=JiJr1lmMNL0GEw`lx-8JY7w;5yrt)h zLnK-*PX&D`41KBZ>do30SyS=0n84j&DB}BZ8BKFNL3p2?eZJ+QOV@nr3l5PM+XtVl z|I#$Ta^|-S@5Y9R*LZKqWxAdOZeiHbk;ytxw$le%qSj!n;y<N(B~umg`k{C^NhVN^ zL$?aaVz38nQ6U%w`2BPrWUInnlee=3x}rjLeXgNGVISV65m9^^;%DZ4i03$bJNV*p zjoc0<xwfNfkior`=L(LazF#y-X3-U;77MpV)mG+<lX~2k!y2rbH7dsDksg>Nlf1pZ zJ!Al!7CX?o8T<=BgFpBIw+H_l;GfzG&*Tq>`PM09Z}^7=-3>uu;kN@mrEPK&1w5a@ z$(uR8VdGe>q*E21pa1>OxwsY6xLG>t|N6ns*17Xm0H2r6LS{H3%K#ZTs7d<=yt65= zhQ2gsSPfRL2~oQ%ssMh}<A&(h1ns<mI;aO2B=}Dszml$s$<m4(YSTi;Kj`nyU(BF2 z$)x>NIU#Q5I2=Xr0DI$2;s*;}hfj?B6w#*^^`q6*GxFh`{Vo{XyX_{07dqf)oDZF5 zfpu1nI=TCN<22B5fQD~kHmwxe94kGyCf8+8OEq8g96F;cPC)~XBYCM8Hl>lh5qKE< z!IwCdH4bT&LV^dmkt6{}qEuP{FIwDAoRLO7j=YD;6sa0jC!kDxlsS3-FjYswmF{TV zu1=%4#;rNOL^5x6`eAa(i}-VE0fQ2laWf*~JEHmP>^Hr30Ji4x(PLqpSm;P7opk;L zI%rKGex=klmEgMBV7A$)6U^so;Fmt=_e%fLX&8TiO*ZFPG-58g9x)HH46GHKmauW| zZfqhOCp1ZW9@F%-=#MF)H6oD*%?2up70~d+J?lX>#jHlw3Cf#iH{yoRh*_0x*%rZG z!DmzeSHWDbEiX!x3#y{yrulDTe3M6R#nsfxa-Iv*`Tf3eWkT?2Sn>F0s6x7}4s@oT z-_^?VJl+2)Hegw|M7LRx+xZu^+g_T_wJ+yOlswE)WXlJi${((6nrJA8*&+lt@8_a@ zu*Mj`Sf*G;GsSXxz>Sm=*e|w9^B|6)=e{X6kf7V_)4QF`Oa~n=f@ufAUIoE)f`pz{ z&QrWkwN}YQ88^&T1F+SCuyZ;#{LRngCo>0&dXtI=>bhVSrRt?)yW<}W^aejQ8l)*= zpETF$XIk5m>s=GH%s?Y~cth*mgp1TU{1ztoy#JaUt2<W-Q)itUmFqiI0HvQV*c{af z+X;mmt?^!pzoNJ~jdR?+9s<*Q)o60%2A@qUpaC!~__Rv#rwVBHri0AU1e71`_?ZgA zwLCh&s>&MCpr&Ts7r=e+Sr2?%&L%WwVpVHzJJLA8p0WV#g*hxt=kOfC4oeK01!<f- zth;NTA1w+jNLtH|1{d6eu(3YG{|_n<UY0PM|2X>_)ocYeEKA<^?%A7Vs;;jTT5k_^ zeQ`9r4Xoc}QEclrYcx)*VzTf}?M~-7H}iLw{MOFimYZ+3zHWWCf~_nE8cF#07LDiU z&Py4|y>d=tI0T7>4p=5JMdrSj63{PBLZc8z+(SVR<sYON52ujYEVZ_Usl7F@mdu}T zng}Twid6a6$FaxXy{LJcwR)k}#YEC$T{}3VdWWxd<RG-JDq?~?CWUH#dL^4^W;&iX zg2UcvU>?;np!VJ5M2zci=j#1-F7V&2JMj%EUnqXsO6&dkrY<EErgJAr{hcHSO)x|F zG+7Z^^F$0QLo1v;{`PI5Q+HN{+S@*Zujt-+<5n5?^jDT!%ck9`kj$iGbF09U&#G*- zZuD#x(-QrFI1%l|LjLw2&V>`pU~|IpQt^BED%Q|Uqg3mMf2RqS67*Cosi-E<yu9<W zzmT#2n$fy7u((DGUN&6ZtW|ieJ5fwl`baOm$wsHmq)f=xbrWi~S!Xt7e^SHwEXh2^ zsd&w;tjW*vTgk3g;h<3}<-Mc%7|jzlK>dbojQDj*MSv3y5Rxy*?CepPyk=!nC_6go zJCp9KH}?-}U}3GDyE!5b|7W@q`1kf1c%Dn9zqEBt6GSWdB$Geb1g1h6*Q*bg9A9%S zZnY!qzKy)?qGNs@0M=JZXvFQmQ!@NcNw9uQK_mF%ExR<2VughRbH9GJH;v(>3&dU? z*1NDB4~l;#o~s-iOq$2kS<BC>P4nLpHL+#~5UPD>Wh>X_be-6Q>Gi=3`d~(VLd4ER zK(|&QyWT`4S*em<x|eNAlWoemucaZW>+D>Gc7JI_vr^@7@j=Cy=39O@*M*7Sw0;N~ zY$0x?n;KGmJ07unb%d@f_Rp0Y;qp<lqbLJ!W<#(vMD@ST3QcYSS>rQc>PE<<riWlu zdQV|3;8-FgWkAOVhi$66O6Ogt-X?vn^Gv>|>oar(EA?vR1J+SFI9(T^*SuJk3Ud~v zD1B|^*#w`oUo0t|?2HvE)$(C=w?Mq480Hn%rLm>0gF0$q=Xy!lSTB`P{OPP7>>jdz z#t!qJxzmO8u>(Lo4PhK}50)uTHApA0Ol(48JE8)!W=^H@^=8?wOUCi-SIk0nc<~2G zk>mO;s+l`%7c;Ign)O!*ui}GrL&t=26GPWIccJc*gU@5qYj*Hn7yvXIZu%7VO-3k* zZqn=RX|qWbF40r+{-f000yF&sSZ@gMKZw<D3HQptXw-}b268F3?BJdW(a<I-tBPg= z*>YAK4PXu-gjUkAqww650t~MEl*NC$FnlV=_zjFcO&A?$R!Z01v4`Ir)6eYSCO`Zf z-tBC1H0R--fc?9Q0Jmi%8e&5>-cj`8&QwvqEARiKtWB)S@#mn$-!2SkOjCkYk}w7} zX9MfpmT7B^%}Q%qth^3B=wut=8YbV}vY=dlSI=0Ls(T?PcN*^KUDzvE69dB=VHXD; zN@brZclDkFR;k0k%d2&_kU`WY=BMW0_2R$Vs60BzXtTsJ22Jyi6*Ib|LwB=WwYaeY zs%m&!FtFcK*l4&2LfyLL>h2f(W?}~?F)z@pnWNQA>G(ajmCw*yD1hD`d?LmIu|KJJ zE@&wFrF8eck04i(IE>y3A4-f6E!|cbXV}C)B1Xja>8tYnh>|Rk2|UiP(5$^F+mso( zE=+rqqnCp@l4v2r%cP6P7Oo{_odY{qtUGgyx2ZRtvhS$=8DiFr-Iqj}BqH!M&F+=k zT$N3;@sxW<^<IeC8i1|7HTKr}VpjqJXSn)V(+~6QgZcHrfIb(byf**3n^sj{#6Trv zjp6kxLzIve>DMs}%bH&*otUpR7V$Av9w9klf?$*5F4@DsXFP=}cE*l=9CjXIgPb+t z&x505P2a=lpEzBA5gk*52^we9B+OwRiLy|trO_oQ4?~-fVn$lthkWE?2KbZKeiHf% z8Gv3OE$iwd$F1=FAOLL%U(I0~6Jx4;%zbv5?(MnxjRB<c*jGVwZzNrnFI-p3R+=A4 zrL-?VB<C|-8mQ<F(F6r%H6~5I4KgSi3Nv(7;H6C^7zkUHdXU2~5@7*OBoNDpR{&LS z*DHWFtC!f3incWR)4&jA0S<94q)~w>s(8?I=oUgqHK<4qMrXy!jVY#?TqFzAHYM;c zL3&H2#z$aEASTU-6!uN3Ug~e}GXXK?iNKNIWk|&z2q%$J$RQp{g-mlxLWFsRaEksm z4M;GrH!fjGffP^9vyngxxmr41LI@6@H%@TLzW|zmB=Z6Pc}fmq%g=)&G5)W*Ln`=v zaI&rBc^{_|vV|o{vF7kW1O@#6;~Cwz=NL7>;pS4#Irl~qETn50AzFeSfL%DFlzI;N z$VUtDT6$gl@^C9YGkzqNSI0B+C>rb4OSi`^>GzYs^_VKzeRVUaMZ;!Gw#XXmFt21# zj>640z*7`he05tI^$H$*VemJM1pD7lg8PF(<5N5V-&qK<1X*2viHJ4zoIV5n6Kyr7 zKY26N<l{}&YRHG@gilhuLI3XNM3C@f?aJ3v_Q@csw1@7PVg`jKF%UaJY8ElC>5Bzy z82t8O`kBU_*bS&(geq4wRpLQiI@ukBpu*_Q4eNl#W>5}fmyZefJJ(y^dH8`5b)`+J z+3FqTN)PK5+3L&GRh7Z@LauY%(7Ec;2rsLa@#2G|;-lnM_mfK2%{dKD=mL{iSBluf zErP5?#VoI70{^BKj9HN{3mKR#PX_Nl%m4}6YAg`{TEG?iM~0_RzeE|}Y~vq66rK?S zHppUpf0syA9+VN^=a$x5qnh0pLTTVOJBQ*Bqa@vG)6|UqW74L%89j@ga(4%*NPX){ zM6CGW1Y~N}rVQG2K|1vYHIlgFirqqPM*kwDd;<E)vV#;+BN563QlcE^@TZUh=a8uC z#e+eKyH2lTiz+317(rIpf=h8wnLr!lm&|D(u{UgHgrE{k&A%zHhWsl^zix&B<T~Y$ z41$^UMOUbE+4IjafVRvaG0(^$R{{?qr$VgE|H)K_eFkw0#irpdTr0QX>MLkQ&0>cz z^RWSc0%`+U;r$uj&;J%)d;`{Me43RL3&nA^kzk8|^|NXO=+SHSwkvcbSn<+z5NH$T zd?OBW-E6v{@fSLp1MtMsg?2?TvXoj+s8Lni)%SFZuU;SvYLWWK`m3D)6D=ulhTE@R zNPYWs4%DbUn`L4Ci&euv@%@)%jvi#8sX~gRVOpk-K`VcF65n4JWl+$xJf6mz@Q(#0 zu@%$b>hHnJxwR;LGQv#&31-$Y2fl^o<W4ANz&|&Ks*-H$es_B5?lg~8Ya8Yh*K0<9 zMZ^iFSUNi>6Xe9U!|4CC63Ly=-!;PyIarfk%<<LwFVruNx##y(f{Gw00!+;R;h0AW zeQtMDDR=HrH{PM%xI+yQ<7WdRI_?Y*^M5tK|G)lmf79OpStS{Km%X}M54cWw+?t~J z=mnB|x-y9SHWDD$CXf$u53~W5rVp_G!T_4^lm{6zA{mMRQ#N%2&4@V;QQ&6(v}$S| zXz}#A-RCf#xj6hue|7l!0)G2{A4q8Tx229hHh30$zMeEM@OLy9F6>Ze82QZk%=-y? zUUAPE3(wsgOH<!&A?#Y5AO3`QBaZjduHnhITQvjfdq%~VYu(-D*J7ctbep<10NA_Q zxmdMyx@oiAcbSS+K1mBj%<+S7elA}ujU8|7_@%90Y`id7QQsY_U^BWpJ3Wk@BRpTZ zLA~3;x@T!VjwV?{C`pe5L?wtT2Xo@R+hx2)AAMe1Rh^19DK(HW+bI?GO>b<l`Ux9Y z&+P1k#Eq0|tNqPd>)Gl+-jo$b+K&fO<$CXP1?irEy7W{_S!9P+gj&P{Too}VYVSM2 zf}~3q_vw~W_b0yOTJn);2Vo1#>3nyMaT~OZ__Xpou3u(8yQRT48ZaFc1;684qAo-J zh*#Z7Kt<TkB@B`j!5_hAJ`ILt7LX$azOfJsbRy|ijRIP5qG|#DsPFyE)^O{#F|M7D zY^UNMXT9~5zg2AI*l~UPb@t}6$<u>E8{3+1HUfo(yPa9!i@tS)`wWk!nTHm|Ae?iH z|9W(WqSIEiagcb3;zcgCKMgW<$fKOh#N@6y-$of}i3DEyK2AA>1hs_W(nDLa%TfTt z{YlT#=?z|`LTn@^IDvc*^$EAnF>QqX9Zg7|5?)P;v;zvJT#TFF$J=&T!WsfO8YCd0 zU1^pRFJ$+<M`(}xgpMw4ty9#nT4%PV_Vl~vEk%Bk7~3hy+8Mn{HhWO)F#3<|9}k7( zIuqVyc%`M>z;}n<M2>;q)R35P&lB4S_3EH0U5qxkwpVD8hB7@>DAF%3b62TiqjzJ$ zeGw*oh(t&6l3cn$ql$v7Ur@OzL?$1=?2SqM-Yr85bsX^3B*$JeT;Tr^N4;{!6^b3m znk|ggEXGeisC&6EJh~ObVNh8Y;GZw}pq-*T&W^c_;-T+8v3aHdMcI!xs(5n*hqk;8 z?;C$CX+4Eja~8hVVNMhK1rKOI9cQ!6R#a506|@%5jn&~6wXl_adQm~(B6!al(B%D2 zYwTK=y<tsBAamvdoLn9ZjqQf68N~)d%*akwCPgX+n4Tf9HMS|6{gK`U`}VvSf3Tqk zRl&b$7k<cdf`zi@UsHzUAn4o=H%e9Vf{2`eRqPbLR-Bv6f}8HM0u^|MBu%13eY(<5 zHn80uEMRvsAh@U5O$}M=L-xA_4h+{bZoE#HoV<j4MOP22b5nj)w&`5o1A%UCP(UgQ zNXTrr-F^Sj%M7_tP(vz&C@DUA^jCK+2t;w)jP%z}|80vBWEYJBlBbAA_3tgHf8BP2 z0U1`LrTX`N!oO}Xd;l?5VuU;eQy@>`K%xm4AhuvUNGCBK)?fEb<3bj|3{*q^)*1EJ z4MijnY%n#|pBvLK5QyxrtG7q`4<R&4EdPi-BwmRac}^5kq$Gl@Edg0mdPeo9Z*N;3 b@&5KfxHLpqnF0q3gau-}y;%J6?&|*mOKXGP From 0cbd48354c69f4db3d0e32b1872acf6671113aec Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 09:56:17 +0900 Subject: [PATCH 124/259] =?UTF-8?q?feat:=20=ED=95=98=EC=88=98=EB=A7=A8?= =?UTF-8?q?=ED=99=80=20=EA=B2=80=EC=83=89=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index d3cac8956..e17b80724 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -332,14 +332,14 @@ const SearchModal: React.FC<SearchModalProps> = ({ `${todayYear}${todayMonth}${todayDate}`, ); cqlFilters.push( - `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, + `instl_ymd >= '${startDate}' and instl_ymd <= '${endDate}'`, ); // if (변수1) cqlFilters.push(`경과년도='${변수1}'`); - if (변수2) cqlFilters.push(`용도코드='${변수2}'`); + if (변수2) cqlFilters.push(`usg_cd='${변수2}'`); // 구경(mm) 범위 - if (시작1 && 종료1) cqlFilters.push(`구경 BETWEEN ${시작1} AND ${종료1}`); - else if (시작1) cqlFilters.push(`구경 >= ${시작1}`); - else if (종료1) cqlFilters.push(`구경 <= ${종료1}`); + if (시작1 && 종료1) cqlFilters.push(`swage_mh_diam BETWEEN ${시작1} AND ${종료1}`); + else if (시작1) cqlFilters.push(`swage_mh_diam >= ${시작1}`); + else if (종료1) cqlFilters.push(`swage_mh_diam <= ${종료1}`); return cqlFilters; }; From 1f2316d8b4bc5ba23fbff224833aef0b19ed82c3 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 3 Jul 2025 10:50:02 +0900 Subject: [PATCH 125/259] =?UTF-8?q?=EC=A4=91=EC=88=98=EB=8F=84/=EC=98=A8?= =?UTF-8?q?=EB=B0=B0=EC=88=98=EC=8B=9C=EC=84=A4=ED=98=84=ED=99=A9=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EC=A1=B0=EA=B1=B4=20=EB=B3=80=EA=B2=BD,=20-1?= =?UTF-8?q?=EA=B0=92=20=ED=99=95=EC=9D=B8=EB=B6=88=EA=B0=80=EB=A1=9C=20?= =?UTF-8?q?=ED=91=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltSttn/htdflSttn/page.tsx | 176 ++++++++++++------ .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 62 +----- .../ruseFcltMng/fcltSttn/rswtSttn/page.tsx | 155 ++++++++++----- .../ruseFcltMng/fcltSttn/htdflSttn/index.tsx | 16 +- 4 files changed, 242 insertions(+), 167 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index e43d5b04f..03b549270 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -8,6 +8,7 @@ import type { } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { excelDownload, + getCity, getCityOrSgg, tableData, } from "@/components/lib/func/commom"; @@ -16,16 +17,22 @@ import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDeta import { ContentsDiv, SearchBaseForm, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SelectBox, Title, UiModal, UiTable, type ReturnType, + type SelectDataType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; export default function HtdflSttn() { const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore( @@ -38,6 +45,8 @@ export default function HtdflSttn() { const [pageNation, setPageNation] = useState(1); const [isChHead, setIsChHead] = useState(false); const [bdstTable, setBdstTable] = useState<customRainBdst[]>(); + const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>() + const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); const [detailModal, setDetailModal] = useState<{ isOpen: boolean; data: customRainBdst | undefined; @@ -50,13 +59,44 @@ export default function HtdflSttn() { const codeData = getCityOrSgg(ref); const excelClick = useCallback(() => { - if (codeData) htdflSttnSearch(1, "10000", codeData); - }, [htdflSttnSearch, codeData]); + // 최신 검색 조건 반영 + const con = getConValue(); + htdflSttnSearch(1, "10000", String(con), code.cityCd, code.sggCd); + }, [htdflSttnSearch, objSearch, code.cityCd, code.sggCd]); useEffect(() => { - if (codeData != null) htdflSttnSearch(pageNation, "20", codeData); + if (codeData != null) htdflSttnSearch(pageNation, "20", codeData, code.cityCd, code.sggCd); }, [pageNation]); + const getSelCity = (val: string | number) => { + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setObjSearch({ city: cityValue, sgg: "" }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } + }; + + const getSgg = (val: string | number) => { + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + + const getConValue = () => { + if (!objSearch.city || objSearch.city === "0") { + return "0"; + } + if (objSearch.sgg && objSearch.sgg !== "0") { + return objSearch.sgg; + } + return objSearch.city; + }; + const cellClick = (index: number | undefined, headId: string) => { if ( headId !== "chBuildingYn" && @@ -67,20 +107,15 @@ export default function HtdflSttn() { } }; useEffect(() => { - const excelDown = async () => { - if (htdflSttn.excelList.length > 0) { - if (htdflSttn.excelList.length === 0) return; - const excelData = await tableData(htdflSttn.excelList, { code }); - const htdflExcel = excelHtdflSttnParsing(excelData, code.cityCd, code.sggCd); - excelDownload( - htdflExcel as [[]], - "온배수시설 현황", - "sample_htdflSttn.xlsx", - "A1:S3" - ); - } - }; - excelDown(); + if (htdflSttn.excelList.length > 0) { + if (htdflSttn.excelList.length === 0) return; + excelDownload( + htdflSttn.excelList, + "온배수시설 현황", + "sample_htdflSttn.xlsx", + "A1:S3" + ); + } }, [htdflSttn.excelList, code]); useEffect(() => { @@ -90,19 +125,16 @@ export default function HtdflSttn() { }, [htdflSttn.isInit, initHtdfl]); useEffect(() => { - if (htdflSttnRes.length > 0 && code.cityCd.length > 0) { - const data = tableData(htdflSttnRes, { code }); - const chData = data - .map((item: any) => ({ - ...item, - ...item.reuseBuilding[0], - ...item.reuseBuilding[0].htdflObj, - chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", - })) - .filter((item: any) => item.htdflObj !== undefined); - - setBdstTable(chData); - } + const data = tableData(htdflSttnRes, { code }); + const chData = data + .map((item: any) => ({ + ...item, + ...item.reuseBuilding[0], + ...item.reuseBuilding[0].htdflObj, + chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", + })) + .filter((item: any) => item.htdflObj !== undefined); + setBdstTable(chData); }, [code, htdflSttnRes, htdflSttn.htdflSttHeadList]); return ( @@ -111,43 +143,65 @@ export default function HtdflSttn() { <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"온배수 시설 현황"} /> - <SearchBaseForm - selectSidoData={code.cityCd} - selectSigunData={code.sggCd} - selectRegionData={code.rvbsnCd} - selectUnitWaterShedData={code.lgbsnCd} - selectMiddleRegionData={code.mdmbsnCd} - selectEnvPartData={code.lclgvrnmntCd} - rightChildren={<Button - className={btnClass} - onClick={() => { - setIsChHead(true); - } } - > - 조회항목설정 - </Button>} - leftChildren={undefined} - queryClick={function (returnType: ReturnType): void { - // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - let con; - if (returnType.sigunValue != "0") { - con = returnType.sigunValue; - } else { - con = returnType.sidoValue; - } - htdflSttnSearch(pageNation, "20", con); - } } - excelClick={excelClick} - initClick={function (): void { } } - btnClass={btnClass} - ref={ref} isAdmin={false} /> + + <SearchDiv> + <SearchFormLeft> + <div className="col-span-10 flex flex-row"> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd} + onSelectValue={getSelCity} + /> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl ml-4" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + value={objSearch.sgg} // value props 추가 + onSelectValue={getSgg} + /> + </div> + </SearchFormLeft> + <SearchFormRight + className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="flex flex-row space-x-2 items-center"> + <Button + size={"sm"} + onClick={() => { + const con = getConValue(); + htdflSttnSearch(1, "20", String(con), code.cityCd, code.sggCd); + }} + > + 조회 + </Button> + <Button + size={"sm"} + className={`${btnClass} green`} + onClick={excelClick} + > + 다운로드 + </Button> + <Button + size={"sm"} + className={btnClass} + onClick={() => { + setIsChHead(true); + }} + > + 조회항목설정 + </Button> + </div> + </SearchFormRight> + </SearchDiv> </div> </div> <div className="grid grid-cols-6 gap-4 "> <div className="col-span-6"> <ListDiv> <UiTable - headName={[]} + headName={undefined} tableData={bdstTable || []} children={ <HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} /> diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index 7e068bcd0..804e9d808 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -82,7 +82,6 @@ export default function RainSttn() { }; const getSgg = (val: string | number) => { - console.log("val", val) setObjSearch({ ...objSearch, sgg: String(val) }) }; @@ -96,8 +95,6 @@ export default function RainSttn() { return objSearch.city; }; - - useEffect(() => { if (!rainSttn.isInit) { rainSttnInit(codeData ?? "0"); @@ -108,8 +105,6 @@ export default function RainSttn() { const data = tableData(rainSttnRes, { code }); const chData = data .map((item: any) => { - console.log("item", item); - console.log("왜안돼", item.reuseBuilding[0].rainyObj.dtfcltCpct) return { ...item, ...item.reuseBuilding[0], @@ -124,10 +119,16 @@ export default function RainSttn() { ? "확인불가" : item.reuseBuilding[0].instlCstSprtAmt, chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", + pntfColArea: item.reuseBuilding[0].rainyObj.pntfColArea === -1 + ? "확인불가" + : item.reuseBuilding[0].rainyObj.pntfColArea, + filtrTrtmfctCpct: item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct === -1 + ? "확인불가" + : item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct, + archArea: Math.floor(item.archArea) === -1 ? "확인불가" : item.archArea, }; }) .filter((item: any) => item.rainyObj !== undefined); - console.log("chData", chData) setBdstTable(chData); }, [code, rainSttnRes, rainSttn.rainSttHeadList]); @@ -147,9 +148,6 @@ export default function RainSttn() { } }, [rainSttn.excelList]); - // const excelClick = useCallback(() => { - // if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd); - // }, [rainSttnSearch, codeData, code.cityCd, code.sggCd]); const excelClick = useCallback(() => { // 최신 검색 조건 반영 const con = getConValue(); @@ -162,8 +160,6 @@ export default function RainSttn() { <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"빗물재이용 시설 현황"} /> - - <SearchDiv> <SearchFormLeft> <div className="col-span-10 flex flex-row"> @@ -215,50 +211,6 @@ export default function RainSttn() { </div> </SearchFormRight> </SearchDiv> - - - - - - - - - - - {/* <SearchBaseForm - selectSidoData={code.cityCd} - selectSigunData={code.sggCd} - selectRegionData={code.rvbsnCd} - selectUnitWaterShedData={code.lgbsnCd} - selectMiddleRegionData={code.mdmbsnCd} - selectEnvPartData={code.lclgvrnmntCd} - rightChildren={ - <Button - className={btnClass} - onClick={() => { - setIsChHead(true); - }} - > - 조회항목설정 - </Button> - } - leftChildren={undefined} - queryClick={function (returnType: ReturnType): void { - // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - let con; - if (returnType.sigunValue != "0") { - con = returnType.sigunValue; - } else { - con = returnType.sidoValue; - } - rainSttnSearch(1, "20", con, code.cityCd, code.sggCd); - }} - excelClick={excelClick} - initClick={function (): void { }} - btnClass={btnClass} - ref={ref} - isAdmin={false} - /> */} </div> </div> <div className="grid grid-cols-6 gap-4 "> diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx index f9b3c6187..05ee774f1 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx @@ -5,19 +5,26 @@ import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; import { excelDownload, + getCity, getCityOrSgg, tableData, } from "@/components/lib/func/commom"; import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal"; import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal"; import { ContentsDiv, SearchBaseForm, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SelectBox, Title, UiModal, UiTable, type ReturnType, + type SelectDataType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; @@ -34,6 +41,8 @@ export default function RswtSttn() { const [isChHead, setIsChHead] = useState(false); const ref = useRef<ReturnType>({} as ReturnType); const [bdstTable, setBdstTable] = useState<customRswtBdst[]>(); + const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>() + const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false }) const [bdstChgProps, setBdstChgProps] = useState<{ isOpen: boolean; @@ -58,6 +67,35 @@ export default function RswtSttn() { } } + const getSelCity = (val: string | number) => { + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setObjSearch({ city: cityValue, sgg: "" }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } + }; + + const getSgg = (val: string | number) => { + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + + const getConValue = () => { + if (!objSearch.city || objSearch.city === "0") { + return "0"; + } + if (objSearch.sgg && objSearch.sgg !== "0") { + return objSearch.sgg; + } + return objSearch.city; + }; + useEffect(() => { if (!rswtSttn.isInit) { rswtSttnInit("0"); @@ -65,22 +103,25 @@ export default function RswtSttn() { }, [rswtSttn.isInit, rswtSttnInit]); useEffect(() => { - if (rswtSttnRes?.length > 0 && code.cityCd.length > 0) { - const data = tableData(rswtSttnRes, { code }); - const chData = data - .map((item: customRswtBdst) => ({ + const data = tableData(rswtSttnRes, { code }); + const chData = data + .map((item: customRswtBdst) => { + console.log("item", item) + return { ...item, ...item.reuseBuilding[0], ...item.reuseBuilding[0]?.rswtrObj, - chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N' - })) - .filter( - (item: customRswtBdst) => - item.reuseBuilding[0]?.rswtrObj !== undefined - ); + chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N', + instlCst: item.reuseBuilding[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCst, + instlCstSprtAmt: item.reuseBuilding[0]?.instlCstSprtAmt === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCstSprtAmt, + } + }) + .filter( + (item: customRswtBdst) => + item.reuseBuilding[0]?.rswtrObj !== undefined + ); - setBdstTable(chData); - } + setBdstTable(chData); }, [code, rswtSttnRes]); useEffect(() => { @@ -95,13 +136,11 @@ export default function RswtSttn() { } }, [rswtSttn.excelList]); - const excelClick = useCallback( - (returnType: ReturnType) => { - if (codeCityOrSgg) - rswtSttnSearch(1, "10000", codeCityOrSgg, code.cityCd, code.sggCd); - }, - [rswtSttnSearch, code.cityCd, code.sggCd, codeCityOrSgg] - ); + const excelClick = useCallback(() => { + // 최신 검색 조건 반영 + const con = getConValue(); + rswtSttnSearch(1, "10000", String(con), code.cityCd, code.sggCd); + }, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd]); useEffect(() => { if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg, code.cityCd, code.sggCd); @@ -113,38 +152,64 @@ export default function RswtSttn() { <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"중수도시설 현황"} /> - <SearchBaseForm - selectSidoData={code.cityCd} - selectSigunData={code.sggCd} - selectRegionData={code.rvbsnCd} - selectUnitWaterShedData={code.lgbsnCd} - selectMiddleRegionData={code.mdmbsnCd} - selectEnvPartData={code.lclgvrnmntCd} - rightChildren={<Button - className={btnClass} - onClick={() => { - setIsChHead(true); - } } - > - 조회항목설정 - </Button>} - leftChildren={undefined} - queryClick={function (returnType: ReturnType): void { - // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - if (codeCityOrSgg) - rswtSttnSearch(1, "20", codeCityOrSgg, code.cityCd, code.sggCd); - } } - excelClick={excelClick} - initClick={function (): void { } } - btnClass={btnClass} - ref={ref} isAdmin={false} /> + <SearchDiv> + <SearchFormLeft> + <div className="col-span-10 flex flex-row"> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd} + onSelectValue={getSelCity} + /> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl ml-4" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + value={objSearch.sgg} // value props 추가 + onSelectValue={getSgg} + /> + </div> + </SearchFormLeft> + <SearchFormRight + className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="flex flex-row space-x-2 items-center"> + <Button + size={"sm"} + onClick={() => { + const con = getConValue(); + rswtSttnSearch(1, "20", String(con), code.cityCd, code.sggCd); + }} + > + 조회 + </Button> + <Button + size={"sm"} + className={`${btnClass} green`} + onClick={excelClick} + > + 다운로드 + </Button> + <Button + size={"sm"} + className={btnClass} + onClick={() => { + setIsChHead(true); + }} + > + 조회항목설정 + </Button> + </div> + </SearchFormRight> + </SearchDiv> </div> </div> <div className="grid grid-cols-6 gap-4 "> <div className="col-span-6"> <ListDiv> <UiTable - headName={[]} + headName={undefined} tableData={bdstTable || []} children={ <HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} /> diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx index dccc8719c..ba81066be 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx @@ -5,6 +5,8 @@ import type { z } from "zod"; import { controlHeadView } from "../rainSttn"; import type { customHtdflBdst } from "../../fcltReg/htdflReg"; import { fetchType, getFetch } from "@/components/lib/api"; +import type { SelectDataType } from "@common/business_components"; +import { excelHtdflSttnParsing } from "./excel"; const htdflSttHeadList = htdflSttHeadListExport; const htdflSttNodeList = htdflSttNodeListExport; @@ -21,7 +23,8 @@ export type htdflSttnState = { }; type htdflSttnActions = { initHtdfl: (con: string) => void; - htdflSttnSearch: (page: number, total: string, con: string) => void; + htdflSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; htdflChSttnHead: ( headList: z.infer<typeof sttnHeadListType>, ) => void; @@ -67,22 +70,23 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = ( console.log(error); } }, - htdflSttnSearch: async (page: number, total: string, con: string) => { + htdflSttnSearch: async (page: number, total: string, con: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[] + ) => { try { const htdflSttnRes = await getFetch( fetchType.WR, `/drain/facilityList/${page}/${total}/${con}` ); if (Number(total) > 9000) { - - + const htdflExcel = excelHtdflSttnParsing(htdflSttnRes, sidoCode, sggCode); set((state: htdflSttnState) => { - return { ...state, htdflSttn: { ...state.htdflSttn, - excelList: htdflSttnRes, + excelList: htdflExcel, }, }; }); From af3c78ad1d6d7e6162c41022a6554787dde430e7 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 3 Jul 2025 11:45:31 +0900 Subject: [PATCH 126/259] =?UTF-8?q?=EB=A9=94=EC=9D=B8=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 1 + apps/sn/app/page.tsx | 87 ++++++++++++++++++++++---------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index fb952385e..26a9a0490 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,6 +1,7 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 3002 NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 +#NEXT_PUBLIC_PROXY_HOST = http://sn.hasu.or.kr:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 diff --git a/apps/sn/app/page.tsx b/apps/sn/app/page.tsx index 21d1c7b3f..d19bd5e79 100644 --- a/apps/sn/app/page.tsx +++ b/apps/sn/app/page.tsx @@ -1,51 +1,50 @@ -"use client"; import { Button } from "@common/components"; import Link from "next/link"; import { redirect } from "next/navigation"; export default function Home() { - //redirect("/map"); + redirect("/map"); - return ( - <div> - <div> - <h3 className="text-bold mx-4 gap-4 text-2xl">하수관망도</h3> - <div className="flex flex-row gap-4 p-4"> - <Link href={"/map"}> - <Button>하수관망도</Button> - </Link> - </div> - </div> - <div> - <h3 className="text-bold mx-4 gap-4 text-2xl">운영정보 관리</h3> - <div className="flex flex-row gap-4 p-4"> - <Link href={"/oper/floodPre"}> - <Button>도시침수 예방사업</Button> - </Link> - <Link href={"/oper/oldPp"}> - <Button>노후 하수관로 정비사업</Button> - </Link> - </div> - </div> - <div> - <h3 className="text-bold mx-4 gap-4 text-2xl"> - I/I 분석(기초정보 설정) - </h3> - <div className="flex flex-row gap-4 p-4"> - <Link href={"/ii/irsetting"}> - <Button>침입수 분석</Button> - </Link> - <Link href={"/ii/rdii"}> - <Button>RDII 분석</Button> - </Link> - <Link href={"/ii/result"}> - <Button>침입수 분석 결과</Button> - </Link> - <Link href={"/ii/rdiiResult"}> - <Button>RDII 분석 결과</Button> - </Link> - </div> - </div> - </div> - ); + // return ( + // <div> + // <div> + // <h3 className="text-bold mx-4 gap-4 text-2xl">하수관망도</h3> + // <div className="flex flex-row gap-4 p-4"> + // <Link href={"/map"}> + // <Button>하수관망도</Button> + // </Link> + // </div> + // </div> + // <div> + // <h3 className="text-bold mx-4 gap-4 text-2xl">운영정보 관리</h3> + // <div className="flex flex-row gap-4 p-4"> + // <Link href={"/oper/floodPre"}> + // <Button>도시침수 예방사업</Button> + // </Link> + // <Link href={"/oper/oldPp"}> + // <Button>노후 하수관로 정비사업</Button> + // </Link> + // </div> + // </div> + // <div> + // <h3 className="text-bold mx-4 gap-4 text-2xl"> + // I/I 분석(기초정보 설정) + // </h3> + // <div className="flex flex-row gap-4 p-4"> + // <Link href={"/ii/irsetting"}> + // <Button>침입수 분석</Button> + // </Link> + // <Link href={"/ii/rdii"}> + // <Button>RDII 분석</Button> + // </Link> + // <Link href={"/ii/result"}> + // <Button>침입수 분석 결과</Button> + // </Link> + // <Link href={"/ii/rdiiResult"}> + // <Button>RDII 분석 결과</Button> + // </Link> + // </div> + // </div> + // </div> + // ); } From d5ccab7212fadb9fc3177d6d063d87c6f554e131 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 13:55:05 +0900 Subject: [PATCH 127/259] =?UTF-8?q?feat:=20business=5Fcomponent=EC=97=90?= =?UTF-8?q?=20=EB=A1=9C=EB=94=A9=EB=B0=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/loadingBar/index.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 packages/common/business_components/src/ui/loadingBar/index.tsx diff --git a/packages/common/business_components/src/ui/loadingBar/index.tsx b/packages/common/business_components/src/ui/loadingBar/index.tsx new file mode 100644 index 000000000..37991d1d2 --- /dev/null +++ b/packages/common/business_components/src/ui/loadingBar/index.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import { LoadingWithAnimation } from '@common/components/ui/loading'; + +interface LoadingOverlayProps { + isLoading: boolean; +} + +const LoadingOverlay: React.FC<LoadingOverlayProps> = ({ isLoading }) => { + if (!isLoading) return null; + + return ( + <div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50"> + <div className="relative w-16 h-16"> + <LoadingWithAnimation color="primary" /> + </div> + </div> + ); +}; + +export default LoadingOverlay; \ No newline at end of file From 20d44c09ff1ddd95c6dc2353a9ed5e61461a7b19 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 14:04:16 +0900 Subject: [PATCH 128/259] =?UTF-8?q?feat:=20-=20=EC=98=A4=EC=88=98=EC=A0=84?= =?UTF-8?q?=ED=99=98=EC=9C=A8=200~1=20=EC=82=AC=EC=9D=B4=EA=B0=92=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EA=B5=AC=ED=98=84=20-=20=EC=98=A4?= =?UTF-8?q?=EC=88=98=EA=B4=80=EB=A7=9D=EB=8F=84=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=EC=8B=9C=20.inp=20=ED=99=95=EC=9E=A5?= =?UTF-8?q?=EC=9E=90=EB=A1=9C=EB=A7=8C=20=ED=95=9C=EC=A0=95=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(with-base-layout)/ii/irsetting/page.tsx | 19 +++++++++++++++++- .../app/(with-base-layout)/ii/rdii/page.tsx | 20 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 91d1361c9..edeb9e87b 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -137,6 +137,23 @@ const IrSetting = () => { // 침입수 분석 실행 버튼 클릭 핸들러 const handleAnalysisClick = async () => { setIsLoadingResult(true); // 로딩 상태 시작 + + // 오수전환율 값 0 ~ 1 사이인지 검증 + if (input1 === '' || input1 === null || input1 === undefined) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율을 입력해주세요.'); + return; + } + + const numericInput1 = parseFloat(input1); + if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + return; + } + console.log(uploadedFilesData); const file1 = uploadedFilesData[0]; // 오수관망도 const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 @@ -275,7 +292,7 @@ const IrSetting = () => { onFileSelect={(file, cd, id) => handleFileSelection(0, file, cd, id)} showButton={false} showPreview={true} - accept={""} + accept={".inp"} fileIdx={0} /> </FormSection> <FormSection name='suyeonga' form={form} titleNm='▷ 수용가-맨홀 매칭결과'> diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 705b243c8..3269f31b5 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -163,6 +163,24 @@ export default function RTKForm() { // 침입수 분석 실행 버튼 클릭 핸들러 const handleAnalysisClick = async () => { setIsLoadingResult(true); // 로딩 상태 시작 + + // 오수전환율 값 0 ~ 1 사이인지 검증 + const rateValue = form.getValues().rate; + if (rateValue === '' || rateValue === null || rateValue === undefined) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율을 입력해주세요.'); + return; + } + + const numericInput1 = parseFloat(rateValue); + if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + return; + } + const formData = form.getValues(); console.log(uploadedFilesData); const file1 = uploadedFilesData[0]; // 오수관망도 @@ -378,7 +396,7 @@ export default function RTKForm() { onFileSelect={(file, cd, id) => handleFileSelection(0, file, cd, id)} showButton={false} showPreview={true} - accept={""} + accept={".inp"} fileIdx={0} /> </div></FormSection> <FormSection name="regopm" form={form} titleNm="○ 수용가-맨홀 매칭결과"><div className="w-[350px]"> From 819a6508bf2aae04da7368b9a7760ae3796b6616 Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Thu, 3 Jul 2025 15:16:53 +0900 Subject: [PATCH 129/259] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=ED=98=84=ED=99=A9=20=ED=8E=98=EC=9D=B4=EC=A7=95=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/newWindowPopup.tsx | 354 +++++++++++++++-------------- 1 file changed, 188 insertions(+), 166 deletions(-) diff --git a/apps/wr/app/map/newWindowPopup.tsx b/apps/wr/app/map/newWindowPopup.tsx index e14a4447d..777c3dcf2 100644 --- a/apps/wr/app/map/newWindowPopup.tsx +++ b/apps/wr/app/map/newWindowPopup.tsx @@ -130,7 +130,7 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({ sigunText: "" }, String(new Date().getFullYear())); } - }, [pbnstSttn.isInit, pbnSttnInit]); + }, [pbnstSttn.isInit]); useEffect(() => { setBdstTable(pbnstSttn.pbnstSttnRes); @@ -155,6 +155,26 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({ console.error("Error fetching data:", error); } }; + // 재이용시설 페이징처리 관련 함수 + const onPageChangeHandler = useCallback((page: number) => { + pbnstSttnSearch( + String(page), + String(13), + { + partValue: "A", + sidoValue: "0", + sigunValue: "", + regionValue: "", + unitWaterShedValue: "", + middleRegionValue: "", + envPartValue: "", + sidoText: "", + sigunText: "", + }, + "", + String(new Date().getFullYear()) + ); + }, []); // useEffect(() => { // if (featureData) { // const selectedVal = featureData.getProperties(); @@ -238,179 +258,181 @@ const NewWindowPopup: React.FC<NewWindowPopupProps> = ({ const isRswt = false; // 온배수시설 const isHtdfl = false; - return ( - <div className="mt-4"> - {/* 체크된 레이어가 없는 경우 (재이용시설 목록) */} - {isPbnst && ( + if (isPbnst) { + if (showDetailView) { + // 재이용시설 상세 + return ( <> - {showDetailView ? ( - // 재이용시설 상세 - <> - <div className="flex justify-between items-center mb-4"> - <Title title='하수재이용시설 상세정보' /> - </div> - <div className="flex justify-between items-center mb-8"> - <UITab - defaultValue={activeTab} - tabList={tabData.map((tab) => ({ - value: tab.id, - label: tab.name, - onClick: () => setActiveTab(tab.id), - }))} - children={undefined} - /> - </div> - <PbnstSttnModal - data={actTabData?.data[0]|| ({} as customPbnst)} - titleVisible={false} - /> - </> - ) : ( - // 재이용시설 목록 - <> - <div className="flex justify-between items-center"> - <Title title='하수재이용시설 현황' /> - <div className="flex gap-2 mt-8"> - <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> - </div> - </div> - <UiTable - headName={[]} - tableData={bdstTable || []} - children={ - <HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} /> - } - headlist={pbnstSttn.pbnstSttHeadList} - pageSize={20} - total={100000} - cellClick={(index: number | undefined, headId: string) => { - pbnstCellClick(index); - }} - onPageChange={setPageNation} - /> - </> - )} + <div className="flex justify-between items-center mb-4"> + <Title title="하수재이용시설 상세정보" /> + </div> + <div className="flex justify-between items-center mb-8"> + <UITab + defaultValue={activeTab} + tabList={tabData.map((tab) => ({ + value: tab.id, + label: tab.name, + onClick: () => setActiveTab(tab.id), + }))} + children={undefined} + /> + </div> + <PbnstSttnModal + data={tabData.find((tab) => tab.id === activeTab)?.data[0] || ({} as customPbnst)} + titleVisible={false} + /> </> - )} - {/* 빗물이용시설 */} - {isRain && ( + ); + } else { + // 재이용시설 목록 + return ( <> - {showDetailView ? ( - // 빗물이용시설 상세 - <> - <div className="flex justify-between items-center mb-4"> - <Title title='빗물이용시설 상세정보' /> - </div> - <RainPrfmncSttnPopup rainForm={rainDetailModal.data as customRainBdst} isModal={false} /> - {/* TODO: 지도 점검 결과 현황 추가 할 것 */} - </> - ) : ( - // 빗물이용시설 목록 - <> - <div className="flex justify-between items-center"> - <Title title='빗물이용시설 현황' /> - <div className="flex gap-2 mt-8"> - <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> - </div> - </div> - <UiTable - headName={[]} - tableData={rainTable || []} - children={ - <HeadMakeColSpan upHeadList={rainSttn.rainSttNodeList} /> - } - headlist={rainSttn.rainSttHeadList} - pageSize={20} - total={100000} - cellClick={(index: number | undefined, headId: string) => { - rainCellClick(index ?? undefined, headId) - }} - onPageChange={setPageNation} - /> - </> - )} + <div className="flex justify-between items-center"> + <Title title="하수재이용시설 현황" /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}> + 엑셀다운로드 + </Button> + </div> + </div> + <UiTable + headName={[]} + tableData={bdstTable || []} + children={<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />} + headlist={pbnstSttn.pbnstSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + pbnstCellClick(index); + }} + onPageChange={onPageChangeHandler} + /> </> - )} - {/* 중수도시설 */} - {isRswt && ( + ); + } + } + + if (isRain) { + if (showDetailView) { + // 빗물이용시설 상세 + return ( <> - {showDetailView ? ( - // 재이용시설 상세 - <> - <div className="flex justify-between items-center mb-4"> - <Title title='중수도시설 상세정보' /> - </div> - <RswtrPrfmncsSttnPopup rswtForm={rswtrDetailModal.data as customRswtBdst} isModal={false} /> - {/* TODO: 지도 점검 결과 현황 추가 할 것 */} - </> - ) : ( - // 재이용시설 목록 - <> - <div className="flex justify-between items-center"> - <Title title='중수도시설 현황' /> - <div className="flex gap-2 mt-8"> - <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> - </div> - </div> - <UiTable - headName={[]} - tableData={rswtrTable || []} - children={ - <HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} /> - } - headlist={rswtSttn.rswtSttHeadList} - pageSize={20} - total={100000} - cellClick={(index: number | undefined, headId: string) => { - rswtCellClick(index, headId); - }} - onPageChange={setPageNation} - /> - </> - )} + <div className="flex justify-between items-center mb-4"> + <Title title="빗물이용시설 상세정보" /> + </div> + <RainPrfmncSttnPopup rainForm={rainDetailModal.data as customRainBdst} isModal={false} /> </> - )} - {/* 온배수시설 */} - {isHtdfl && ( + ); + } else { + // 빗물이용시설 목록 + return ( <> - {showDetailView ? ( - // 재이용시설 상세 - <> - <div className="flex justify-between items-center mb-4"> - <Title title='온배수시설 상세정보' /> - </div> - {/* <HtdflPrfmncSttnPopup htdflForm={htdflDetailModal.data as customHtdflBdst} isModal={false} /> */} - <HtdflPrfmncSttnPopup htdflForm={htdflDetailModal.data as customHtdflBdst} isModal={false} /> - </> - ) : ( - // 재이용시설 목록 - <> - <div className="flex justify-between items-center"> - <Title title='온배수시설 현황' /> - <div className="flex gap-2 mt-8"> - <Button className={btnClass} color="primary" onClick={excelClick}>엑셀다운로드</Button> - </div> - </div> - <UiTable - headName={[]} - tableData={bdstTable || []} - children={ - <HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} /> - } - headlist={htdflSttn.htdflSttHeadList} - pageSize={20} - total={100000} - cellClick={(index: number | undefined, headId: string) => { - htdflCellClick(index ?? undefined, headId); - }} - onPageChange={setPageNation} - /> - </> - )} + <div className="flex justify-between items-center"> + <Title title="빗물이용시설 현황" /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}> + 엑셀다운로드 + </Button> + </div> + </div> + <UiTable + headName={[]} + tableData={rainTable || []} + children={<HeadMakeColSpan upHeadList={rainSttn.rainSttNodeList} />} + headlist={rainSttn.rainSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + rainCellClick(index ?? undefined, headId); + }} + onPageChange={setPageNation} + /> </> - )} - </div> - ); + ); + } + } + + if (isRswt) { + if (showDetailView) { + // 중수도시설 상세 + return ( + <> + <div className="flex justify-between items-center mb-4"> + <Title title="중수도시설 상세정보" /> + </div> + <RswtrPrfmncsSttnPopup rswtForm={rswtrDetailModal.data as customRswtBdst} isModal={false} /> + </> + ); + } else { + // 중수도시설 목록 + return ( + <> + <div className="flex justify-between items-center"> + <Title title="중수도시설 현황" /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}> + 엑셀다운로드 + </Button> + </div> + </div> + <UiTable + headName={[]} + tableData={rswtrTable || []} + children={<HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} />} + headlist={rswtSttn.rswtSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + rswtCellClick(index, headId); + }} + onPageChange={setPageNation} + /> + </> + ); + } + } + + if (isHtdfl) { + if (showDetailView) { + // 온배수시설 상세 + return ( + <> + <div className="flex justify-between items-center mb-4"> + <Title title="온배수시설 상세정보" /> + </div> + <HtdflPrfmncSttnPopup htdflForm={htdflDetailModal.data as customHtdflBdst} isModal={false} /> + </> + ); + } else { + // 온배수시설 목록 + return ( + <> + <div className="flex justify-between items-center"> + <Title title="온배수시설 현황" /> + <div className="flex gap-2 mt-8"> + <Button className={btnClass} color="primary" onClick={excelClick}> + 엑셀다운로드 + </Button> + </div> + </div> + <UiTable + headName={[]} + tableData={htdflTable || []} + children={<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />} + headlist={htdflSttn.htdflSttHeadList} + pageSize={20} + total={100000} + cellClick={(index: number | undefined, headId: string) => { + htdflCellClick(index ?? undefined, headId); + }} + onPageChange={setPageNation} + /> + </> + ); + } + } + + return null; // 조건에 맞는 콘텐츠가 없을 경우 }; return ( From 6af38137fc83aacfe59dc9a04997f504ba8f0396 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 15:24:30 +0900 Subject: [PATCH 130/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98=20?= =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC,=20RDII=20=EB=B6=84?= =?UTF-8?q?=EC=84=9D=EA=B2=B0=EA=B3=BC=20=ED=99=94=EB=A9=B4=EC=97=90=20?= =?UTF-8?q?=EC=9D=BC=EB=A0=A8=EB=B2=88=ED=98=B8,=20=EB=B6=84=EC=84=9D=20?= =?UTF-8?q?=EC=84=B1=EA=B3=B5=EC=97=AC=EB=B6=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(with-base-layout)/ii/irsetting/page.tsx | 5 +++-- .../sn/app/(with-base-layout)/ii/rdii/page.tsx | 5 +++-- .../(with-base-layout)/ii/rdiiResult/page.tsx | 18 ++++++++++++++---- .../app/(with-base-layout)/ii/result/page.tsx | 18 ++++++++++++++---- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index edeb9e87b..79b326353 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -145,7 +145,7 @@ const IrSetting = () => { alert('오수전환율을 입력해주세요.'); return; } - + const numericInput1 = parseFloat(input1); if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { setIsLoadingResult(false); @@ -316,7 +316,8 @@ const IrSetting = () => { <FormSection name='inputdate' form={form} - titleNm='▷ 상수사용량 적용기간'> + titleNm='▷ 상수사용량 적용월'> + {/* 연월 선택 라이브러리로 수정 필요 */} <DatePicker mode={"single"} field={{ diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 3269f31b5..536d15399 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -38,7 +38,7 @@ const formSchema = z.object({ })), // osumap: z.instanceof(File).optional(), // 오수관망도 // matching: z.instanceof(File).optional(), // 수용가-맨홀 매칭결과 - aplcnYm: z.string(), // 상수사용량 적용기간 (YYYYMM 형식) + aplcnYm: z.string(), // 상수사용량 적용월 (YYYYMM 형식) rate: z.string(), // 오수전환율 // rain: z.instanceof(File).optional(), // 강우자료 analysisInfo: z.string().optional(), // 분석 정보 @@ -447,7 +447,8 @@ export default function RTKForm() { placeholder="예: 0.75" /> </FormSection> - <FormSection name='date' form={form} titleNm='○ 상수사용량 적용기간'> + <FormSection name='date' form={form} titleNm='○ 상수사용량 적용월'> + {/* 연월 선택 라이브러리로 수정 필요 */} {/* <DatePicker selected={form.watch("date")} onSelect={(date: Date | undefined) => { diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index bec7ffec6..f2390cc83 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -24,6 +24,7 @@ const formSchema = z.object({ type ResultFormValues = z.infer<typeof formSchema> const tableColumn = [ + { id: 'rowNumber', title: '일련번호' }, { id: 'enoNm', title: '환경청' }, { id: 'ctpvNm', title: '시도' }, { id: 'sggNm', title: '시군구' }, @@ -35,7 +36,8 @@ const tableColumn = [ { id: 'cntbArea', title: 'RDII 기여면적' }, { id: 'anlsInfo', title: 'RDII 분석정보' }, { id: 'regDt', title: '분석일자' }, - { id: 'rgtrNm', title: '분석자' } + { id: 'rgtrNm', title: '분석자' }, + { id: 'scsYn', title: '분석성공여부' } ] const Result = () => { @@ -101,10 +103,18 @@ const Result = () => { console.log("API: ", `v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); try { const data = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); - setTableData(data.content || []); - setTotalData(tableData.length); + // 일련번호를 추가한 데이터로 변환 + const dataWithRowNumber = (data.content || []).map((item: any, index: number) => ({ + ...item, + rowNumber: index + 1, // 1부터 시작하는 일련번호 추가 + scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경 + })); + // setTableData(data.content || []); + // setTotalData(tableData.length); + setTableData(dataWithRowNumber); + setTotalData(dataWithRowNumber.length); console.log("response:", data); - console.log("response data:", data.content || []); + console.log("response data:", dataWithRowNumber); setIsLoadingResult(false); } catch (error) { setIsLoadingResult(false); diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 988521eca..f5d779899 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -24,6 +24,7 @@ const formSchema = z.object({ type ResultFormValues = z.infer<typeof formSchema> const tableColumn = [ + { id: 'rowNumber', title: '일련번호' }, { id: 'enoNm', title: '환경청' }, { id: 'ctpvNm', title: '시도' }, { id: 'sggNm', title: '시군구' }, @@ -33,7 +34,8 @@ const tableColumn = [ { id: 'drtwSwtcRt', title: '오수 전환율' }, { id: 'anlsInfo', title: '침입수 분석정보' }, { id: 'regDt', title: '분석일자' }, - { id: 'rgtrNm', title: '분석자' } + { id: 'rgtrNm', title: '분석자' }, + { id: 'scsYn', title: '분석성공여부' } ] const Result = () => { @@ -99,10 +101,18 @@ const Result = () => { console.log("API: ", `v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); try { const data = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); - setTableData(data.content || []); - setTotalData(tableData.length); + // 일련번호를 추가한 데이터로 변환 + const dataWithRowNumber = (data.content || []).map((item: any, index: number) => ({ + ...item, + rowNumber: index + 1, // 1부터 시작하는 일련번호 추가 + scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경 + })); + // setTableData(data.content || []); + // setTotalData(tableData.length); + setTableData(dataWithRowNumber); + setTotalData(dataWithRowNumber.length); console.log("response:", data); - console.log("response data:", data.content || []); + console.log("response data:", dataWithRowNumber); setIsLoadingResult(false); } catch (error) { setIsLoadingResult(false); From b6d318c54655c44d08fac8f89672799029245263 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 16:18:16 +0900 Subject: [PATCH 131/259] =?UTF-8?q?downloadExcel=20import=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/ii/result/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index f5d779899..b35cd5f21 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -1,6 +1,6 @@ 'use client' import { deleteData, getData } from '@/components/lib/api' -import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' +import { UiTable, downloadExcel, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' import { zodResolver } from '@hookform/resolvers/zod' import { useState } from 'react' import { useForm } from 'react-hook-form' From 45a0ff043dc090b840edf734ca2f51b5a6e4d121 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 3 Jul 2025 16:32:23 +0900 Subject: [PATCH 132/259] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=ED=98=84=ED=99=A9=20=EC=9E=A5=EB=82=B4=EC=99=B8?= =?UTF-8?q?=EC=9A=A9=EC=88=98=20=EC=B4=9D=EC=8B=A4=EC=A0=81=20=EC=B0=A8?= =?UTF-8?q?=ED=8A=B8=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 121 +++++++++--------- .../prfmncSttn/pbnstPrfmncSttn/index.tsx | 34 ++--- 2 files changed, 77 insertions(+), 78 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index f689eb745..3e860d744 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -68,8 +68,6 @@ export default function PbnstPrfmncSttn() { chartData5: lineChartDataProps[]; chartData6: lineChartDataProps[]; chartData7: lineChartDataProps[]; - chartData8: lineChartDataProps[]; - chartData9: lineChartDataProps[]; }>(); const [outLineData, setOutLineData] = useState<{ chartData1: lineChartDataProps[]; @@ -78,6 +76,8 @@ export default function PbnstPrfmncSttn() { chartData4: lineChartDataProps[]; chartData5: lineChartDataProps[]; chartData6: lineChartDataProps[]; + chartData7: lineChartDataProps[]; + chartData8: lineChartDataProps[]; }>(); type dnChartForm = { label: string, val: number, fill?: string }; @@ -228,16 +228,18 @@ export default function PbnstPrfmncSttn() { indstUswtr += element.indstUswtr; // 월별 합계 - inUsageSum = element.wshwtr + inUsageSum = + element.wshwtr + element.coolUswtr + element.cleanUswtr + element.drwtUswtr + element.dltnUswtr + element.ithlRswtr + element.ithlEtcUswtr - + element.cleanToilUswtr - + element.resn; - outUsageSum = element.lndwtr + outUsageSum = + element.cleanToilUswtr + + element.resn + + element.lndwtr + element.hydUswtr + element.ugwtChr + element.farmUswtr @@ -258,9 +260,10 @@ export default function PbnstPrfmncSttn() { dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "purple" }); ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "green" }); ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "blue" }); + + cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "magenta" }); resnData.push({ label: `${month}월`, val: element.resn, color: "skyblue" }); - lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }); hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "orange" }); ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "yellow" }); @@ -271,22 +274,18 @@ export default function PbnstPrfmncSttn() { } }); + let dnTotalIn = 0; + let dnTotalOut = 0; + inUsageArr.forEach((item) => { + dnTotalIn += item + }) + outUsageArr.forEach((item) => { + dnTotalOut += item + }) + // 도넛차트 데이터 - dnData.push({ label: "세척수", val: wshwtr, fill: "#F7CFD8" }); - dnData.push({ label: "냉각수", val: coolUswtr, fill: "#F4F8D3" }); - dnData.push({ label: "청소수", val: cleanUswtr, fill: "#A6D6D6" }); - dnData.push({ label: "식수대", val: drwtUswtr, fill: "#8E7DBE" }); - dnData.push({ label: "희석용수", val: dltnUswtr, fill: "#FF8383" }); - dnData.push({ label: "중수도", val: ithlRswtr, fill: "#FFF574" }); - dnData.push({ label: "기타", val: ithlEtcUswtr, fill: "#A1D6CB" }); - dnData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); - dnData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); - dnData.push({ label: "조경용수", val: lndwtr, fill: "#81BFDA" }); - dnData.push({ label: "친수용수", val: hydUswtr, fill: "#F5F0CD" }); - dnData.push({ label: "지하수충전", val: ugwtChr, fill: "#FADA7A" }); - dnData.push({ label: "농업용수", val: farmUswtr, fill: "#A6AEBF" }); - dnData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "#C5D3E8" }); - dnData.push({ label: "공업용수", val: indstUswtr, fill: "#D0E8C5" }); + dnData.push({ label: "장내용수", val: dnTotalIn, fill: "#8DD8FF" }); + dnData.push({ label: "장외용수", val: dnTotalOut, fill: "#FFF085" }); // 장내용수 도넛 dnInData.push({ label: "세척수", val: wshwtr, fill: "#F7CFD8" }); @@ -296,10 +295,10 @@ export default function PbnstPrfmncSttn() { dnInData.push({ label: "희석용수", val: dltnUswtr, fill: "#FF8383" }); dnInData.push({ label: "중수도", val: ithlRswtr, fill: "#FFF574" }); dnInData.push({ label: "기타", val: ithlEtcUswtr, fill: "#A1D6CB" }); - dnInData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); - dnInData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); // 장외용수 도넛 + dnOutData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); + dnOutData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); dnOutData.push({ label: "조경용수", val: lndwtr, fill: "#81BFDA" }); dnOutData.push({ label: "친수용수", val: hydUswtr, fill: "#F5F0CD" }); dnOutData.push({ label: "지하수충전", val: ugwtChr, fill: "#FADA7A" }); @@ -315,17 +314,17 @@ export default function PbnstPrfmncSttn() { chartData4: drwtUswtrData, chartData5: dltnUswtrData, chartData6: ithlRswtrData, - chartData7: ithlEtcUswtrData, - chartData8: cleanToilUswtrData, - chartData9: resnData + chartData7: ithlEtcUswtrData }); setOutLineData({ - chartData1: lndwtrData, - chartData2: hydUswtrData, - chartData3: ugwtChrData, - chartData4: farmUswtrData, - chartData5: rvrKeepUswtrData, - chartData6: indstUswtrData, + chartData1: cleanToilUswtrData, + chartData2: resnData, + chartData3: lndwtrData, + chartData4: hydUswtrData, + chartData5: ugwtChrData, + chartData6: farmUswtrData, + chartData7: rvrKeepUswtrData, + chartData8: indstUswtrData, }); setBarData(barData); setChartData(dnData); @@ -408,15 +407,7 @@ export default function PbnstPrfmncSttn() { chartData7: { label: '기타', color: "blue", - }, - chartData8: { - label: '청소화장실용수', - color: "magenta", - }, - chartData9: { - label: '세척살수용수', - color: "skyblue", - }, + } } satisfies ChartConfig; setLnInChartConfig(newChartConfig); } @@ -427,26 +418,34 @@ export default function PbnstPrfmncSttn() { if (outLineData?.chartData1) { const newChartConfig = { chartData1: { - label: '조경용수', + label: '청소화장실용수', color: "red", }, chartData2: { + label: '세척살수용수', + color: "pink", + }, + chartData3: { + label: '조경용수', + color: "gray", + }, + chartData4: { label: '친수용수', color: "orange", }, - chartData3: { + chartData5: { label: '지하수충전', color: "yellow", }, - chartData4: { + chartData6: { label: '농업용수', color: "green", }, - chartData5: { + chartData7: { label: '하천등유지용수', color: "blue", }, - chartData6: { + chartData8: { label: '공업용수', color: "purple", }, @@ -615,7 +614,7 @@ export default function PbnstPrfmncSttn() { <h1 className="">장내·외 월별 하수재이용실적 현황</h1> <div className="flex"> <div className="w-1/3"> - <MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} /> + <MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} /> </div> <div className="w-1/3"> <MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적"} chartForm={CHART_FORM.LINE} /> @@ -627,25 +626,25 @@ export default function PbnstPrfmncSttn() { <h1 className="">하수재이용실적 현황</h1> <ListDiv className="col-span-8 pr-6 "> {/* <ScrollArea className="h-[60vh]"> */} - {/* <div className="card-header"> + {/* <div className="card-header"> <h3 className="text-2xl font-medium text-label"> {"하수처리수재이용 실적(m3) 등록결과"} </h3> </div> */} - <UiTable - headName={undefined} - tableData={prfData || []} - headlist={monthHeadList} - pageSize={0} - total={0} - cellClick={undefined} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}> - </UiTable> + <UiTable + headName={undefined} + tableData={prfData || []} + headlist={monthHeadList} + pageSize={0} + total={0} + cellClick={undefined} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }}> + </UiTable> - {/* <ListDiv className="col-span-8 pr-6 "> + {/* <ListDiv className="col-span-8 pr-6 "> <ScrollArea className="h-[60vh]"> <div className="card-header"> <h3 className="text-2xl font-medium text-label"> diff --git a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx index b513085ae..db8b6a717 100644 --- a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx @@ -148,7 +148,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions let usageSum = 0; let year = ""; const yearsData = [] - + res.data.forEach((item) => { if (item.prfList.length === 0) { const year = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출 @@ -161,26 +161,26 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions item.prfList.forEach((acc) => { year = acc.ym?.substring(0, 4) ?? ""; inUsageSum = - (acc.wshwtr ?? 0) + - (acc.coolUswtr ?? 0) + - (acc.cleanUswtr ?? 0) + - (acc.drwtUswtr ?? 0) + - (acc.dltnUswtr ?? 0) + - (acc.ithlRswtr ?? 0) + - (acc.ithlEtcUswtr ?? 0) + - (acc.cleanToilUswtr ?? 0) + - (acc.resn ?? 0); + (acc.wshwtr ?? 0) + //조경용수 + (acc.coolUswtr ?? 0) + //냉각수 + (acc.cleanUswtr ?? 0) + //청소수 + (acc.drwtUswtr ?? 0) + //식수대 + (acc.dltnUswtr ?? 0) + //희석용수 + (acc.ithlRswtr ?? 0) + //중수도 + (acc.ithlEtcUswtr ?? 0) //기타 outUsageSum = - (acc.lndwtr ?? 0) + - (acc.hydUswtr ?? 0) + - (acc.ugwtChr ?? 0) + - (acc.farmUswtr ?? 0) + - (acc.rvrKeepUswtr ?? 0) + - (acc.indstUswtr ?? 0); + (acc.cleanToilUswtr ?? 0) + //청소화장실용수 + (acc.resn ?? 0)+ //세척살수용도 + (acc.lndwtr ?? 0) + //조경용수 + (acc.hydUswtr ?? 0) + //친수용수 + (acc.ugwtChr ?? 0) + //지하수충전 + (acc.farmUswtr ?? 0) + //농업용수 + (acc.rvrKeepUswtr ?? 0) + //하천등유지용수 + (acc.indstUswtr ?? 0); //공업용수 const yearData = yearsData.find( (yearItem) => yearItem.year === year && - yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltPk + yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltFk ); if (yearData) { From da1795a519302df3f99ecf8273c15b72e5adf673 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 3 Jul 2025 16:35:24 +0900 Subject: [PATCH 133/259] =?UTF-8?q?=EC=B0=A8=ED=8A=B8=EB=B3=84=20=EB=B2=94?= =?UTF-8?q?=EB=A1=80=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/DoubleBar.tsx | 53 +++++++++++++++- .../src/ui/chart/DoughnutChart.tsx | 61 ++++++++++++++++++- .../src/ui/chart/LineChart.tsx | 54 +++++++++++++++- 3 files changed, 164 insertions(+), 4 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/DoubleBar.tsx b/packages/common/business_components/src/ui/chart/DoubleBar.tsx index 9627485aa..b201b3bf9 100644 --- a/packages/common/business_components/src/ui/chart/DoubleBar.tsx +++ b/packages/common/business_components/src/ui/chart/DoubleBar.tsx @@ -7,6 +7,7 @@ import { } from "./lib/chart"; import type { CSSProperties } from "react"; +/* const customStyles = { legendContainer: { display: "flex", @@ -17,6 +18,22 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", + justifyContent: "center", + alignItems: "center", + gap: "12px", + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", + } as CSSProperties, +}; type BarChartProps = { chartConfig: ChartConfig | undefined; @@ -60,7 +77,7 @@ const CustomTooltip = ({ }; // 커스텀 범례 (글씨 크기 키우기 + 스타일 추가) -const CustomLegend = (props: any) => { +/*const CustomLegend = (props: any) => { const { payload } = props; return ( <div style={customStyles.legendContainer}> @@ -72,6 +89,38 @@ const CustomLegend = (props: any) => { ))} </div> ); +};*/ +const CustomLegend = (props: any) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: any, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.color, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}>{entry.value}</span> + </div> + ))} + </div> + ); }; export default function DoubleBarChart({chartConfig=undefined, chartData=[], chartTitle='차트', chartClassName='w-full h-full', graphSize=40, yFieldText='', showLegend=false} : BarChartProps) { @@ -83,7 +132,7 @@ export default function DoubleBarChart({chartConfig=undefined, chartData=[], cha .map(key => item[key]) ).flat()); }; - console.log(chartData); + const barMaxValue = getMaxValue(chartData, 'barVal'); return ( <> diff --git a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx index 39dee3d9e..99395267a 100644 --- a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx +++ b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx @@ -48,6 +48,7 @@ type LegendProps = { }; /** 차트 기본 스타일 */ +/* const customStyles = { legendContainer: { display: "flex", @@ -58,6 +59,23 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +/** 차트 기본 스타일 (라인차트와 동일하게) */ +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", // 여러 줄로 자동 줄바꿈 + justifyContent: "center", + alignItems: "center", + gap: "12px", // 아이템 간 간격 + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", // 범례 영역 높이 통일 + } as CSSProperties, +}; // 커스텀 툴팁 const CustomTooltip = ({ active, payload, label }: { @@ -82,6 +100,7 @@ const CustomTooltip = ({ active, payload, label }: { }; // 커스텀 범례 +/* const CustomLegend = (props: LegendProps) => { const { payload } = props; if (!payload) return null; @@ -97,12 +116,52 @@ const CustomLegend = (props: LegendProps) => { </div> ); }; +*/ + +const CustomLegend = (props: LegendProps) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: LegendEntry, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.fill, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}> + {entry.payload?.label || entry.value} + </span> + </div> + ))} + </div> + ); +}; export default function DoughnutChart(props: { chartConfig: any; chartData: ChartDataItem[] | undefined; chartTitle: string }) { + const legendData = props.chartData?.map(item => ({ + value: item.label, + fill: props.chartConfig?.[item.label]?.fill || 'blue', + })) ?? []; return ( <Card className="flex flex-col"> <CardContent className="flex-1 pb-0"> @@ -130,9 +189,9 @@ export default function DoughnutChart(props: { nameKey="label" innerRadius={60} /> - <CustomLegend /> </PieChart> </ChartContainer> + <CustomLegend payload={legendData} /> </div> </CardContent> </Card> diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 4014702b6..28b4ceabf 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -18,6 +18,7 @@ type LineChartProps = { } /** 차트 기본 스타일 */ +/* const customStyles = { legendContainer: { display: "flex", @@ -28,6 +29,23 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +/** 차트 기본 스타일 */ +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", + justifyContent: "center", + alignItems: "center", + gap: "12px", + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", + } as CSSProperties, +}; type LegendEntry = { value: string; @@ -60,7 +78,7 @@ const CustomTooltip = ({ active, payload, label }: { active?: boolean; payload?: }; // 커스텀 범례 (글씨 크기 키우기 + 스타일 추가) -const CustomLegend = (props: LegendProps) => { +/*const CustomLegend = (props: LegendProps) => { const { payload } = props; if (!payload) return null; @@ -74,6 +92,40 @@ const CustomLegend = (props: LegendProps) => { ))} </div> ); +};*/ + +// 커스텀 범례 (도넛차트와 동일하게) +const CustomLegend = (props: LegendProps) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: LegendEntry, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.color, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}>{entry.value}</span> + </div> + ))} + </div> + ); }; type DataType = {label: string; val: string}; From 32271a86a02b7a45db9bbb41178311d59f7d8291 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 16:58:14 +0900 Subject: [PATCH 134/259] =?UTF-8?q?feat:=20DateMonthPicker=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EC=97=90=20startYear=20props=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20width,=20height=20=EB=86=92=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/date_month_picker/index.tsx | 3 ++ .../src/ui/date_month_picker/mothPicker.tsx | 28 +++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/common/business_components/src/ui/date_month_picker/index.tsx b/packages/common/business_components/src/ui/date_month_picker/index.tsx index d318b561f..1b97d9ce1 100644 --- a/packages/common/business_components/src/ui/date_month_picker/index.tsx +++ b/packages/common/business_components/src/ui/date_month_picker/index.tsx @@ -17,6 +17,7 @@ type MonthPickerProps = { field: { value: string; onChange: (date: string) => void }; // yyyyMM 문자열 selectClass?: string; readOnly?: boolean; + startYear?: number; // 시작 연도 props 추가 }; // yyyyMM → Date 객체 @@ -37,6 +38,7 @@ export const DateMonthPicker = ({ field, selectClass, readOnly = false, + startYear, }: MonthPickerProps) => { const [open, setOpen] = useState(false); @@ -75,6 +77,7 @@ export const DateMonthPicker = ({ <MonthPicker currentMonth={parsedDate} onMonthChange={handleSelect} + startYear={startYear} /> </PopoverContent> </Popover> diff --git a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx index acf17fba4..2b64ab439 100644 --- a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx +++ b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx @@ -28,35 +28,41 @@ export type MonthPickerProps = { newMonth: Date | undefined, shouldClosePopover?: boolean ) => void; + startYear?: number; }; -export function MonthPicker({ currentMonth, onMonthChange }: MonthPickerProps) { +export function MonthPicker({ currentMonth, onMonthChange, startYear }: MonthPickerProps) { const today = startOfToday(); -const currentYear = today.getFullYear(); + const currentYear = today.getFullYear(); const yearFromProp = format(currentMonth, "yyyy"); -const selectedYear = parseInt(yearFromProp); + const selectedYear = parseInt(yearFromProp); // 현재 월의 시작 날짜 const fullYearStart = parse(yearFromProp, "yyyy", new Date()); const yearEnd = selectedYear === currentYear ? today : endOfYear(fullYearStart); - - - const yearRange = Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + + + // startYear가 없으면 기존과 동일하게 (현재년도 - 20년부터 현재년도까지) + // startYear가 있으면 해당 년도부터 현재년도까지, 내림차순으로 정렬 + const yearRange = startYear + ? Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + : Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + const months = eachMonthOfInterval({ start: fullYearStart, end: yearEnd }); const getMonthButtonClass = (month: Date) => cn( "inline-flex h-9 w-16 items-center justify-center rounded-md p-0 text-sm font-normal ring-offset-white transition-colors hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-selected:opacity-100 dark:ring-offset-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:focus-visible:ring-slate-800", isEqual(month, currentMonth) && - "bg-slate-900 text-slate-50 hover:bg-slate-900 hover:text-slate-50 focus:bg-slate-900 focus:text-slate-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50 dark:hover:text-slate-900 dark:focus:bg-slate-50 dark:focus:text-slate-900", + "bg-slate-900 text-slate-50 hover:bg-slate-900 hover:text-slate-50 focus:bg-slate-900 focus:text-slate-50 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50 dark:hover:text-slate-900 dark:focus:bg-slate-50 dark:focus:text-slate-900", !isEqual(month, currentMonth) && - isEqual(month, getStartOfCurrentMonth()) && - "bg-slate-100 text-slate-900 dark:bg-slate-800 dark:text-slate-50" + isEqual(month, getStartOfCurrentMonth()) && + "bg-slate-100 text-slate-900 dark:bg-slate-800 dark:text-slate-50" ); return ( @@ -77,7 +83,7 @@ const selectedYear = parseInt(yearFromProp); onMonthChange(newDate, false); }} > - <SelectTrigger className="w-[120px] h-7"> + <SelectTrigger className="w-[140px] h-9 text-base"> <SelectValue placeholder="년도" /> </SelectTrigger> <SelectContent> @@ -112,7 +118,7 @@ const selectedYear = parseInt(yearFromProp); onClick={() => onMonthChange(month, true)} > <time dateTime={format(month, "yyyy-MM-dd")}> - {format(month, 'MMM', { locale: ko })} + {format(month, 'MMM', { locale: ko })} </time> </button> </div> From d936c71f7ee27e486f54d2518f93ba8cc496dc88 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Thu, 3 Jul 2025 17:04:19 +0900 Subject: [PATCH 135/259] =?UTF-8?q?y=EC=B6=95=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=ED=95=98=EB=8B=A8=EC=97=90=20=EC=9C=84=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/chart/BarChart.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 0802a72e4..62dd2333f 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -110,8 +110,7 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle=' axisLine={true} fontSize={12} fontWeight={500} - domain={[0, Math.ceil(barMaxValue * 1)]} - label={yFieldText ? { value: yFieldText, className:"text-[13px] font-bold", position: 'insideLeft', angle: -90, offset: 20 } : undefined} + label={yFieldText ? { value: yFieldText, className:"text-[13px] font-bold", position: 'insideBottom', angle: 0, offset: -24 } : undefined} /> <ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/> {chartData && chartData.length > 0 && ( From ed96df4b22edbf501eded10894134275b9593f59 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Thu, 3 Jul 2025 17:24:15 +0900 Subject: [PATCH 136/259] =?UTF-8?q?barChart=20=EA=B8=80=EC=94=A8=20?= =?UTF-8?q?=EA=B0=80=EC=9A=B4=EB=8D=B0=20=EC=A0=95=EB=A0=AC,=20yFieldText?= =?UTF-8?q?=20=EC=A0=9C=EB=8C=80=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/chart/BarChart.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 62dd2333f..a7282830d 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -88,12 +88,12 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle=' return ( <> {chartTitle && chartTitle !== "" && chartTitle !== "undefined" ? ( - <div className="!mt-3 text-[2.5rem] font-bold"> + <div className="!mt-3 text-[2.5rem] font-bold text-center"> {chartTitle} </div>): null} - <div className="flex justify-center"> - <ChartContainer config={chartConfig ?? {}} className={chartClassName + " !w-[90%]"}> - <BarChart accessibilityLayer data={chartData}> + <div className="flex justify-center h-full w-full"> + <ChartContainer config={chartConfig ?? {}} className={chartClassName + " !w-[88%]"}> + <BarChart accessibilityLayer data={chartData} margin={{ top: 5, right: 20, left: 30, bottom: 5 }}> <CartesianGrid vertical={false} /> <XAxis dataKey="label" @@ -110,7 +110,7 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle=' axisLine={true} fontSize={12} fontWeight={500} - label={yFieldText ? { value: yFieldText, className:"text-[13px] font-bold", position: 'insideBottom', angle: 0, offset: -24 } : undefined} + label={yFieldText ? { value: yFieldText, className:"text-[13px] font-bold", position: 'insideLeft', angle: -90, offset: -24, orientation: "left" } : undefined} /> <ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/> {chartData && chartData.length > 0 && ( From d56d4fc00dd50411570cc9d5bfd1dc6a675eb840 Mon Sep 17 00:00:00 2001 From: ljpark <ljpark@mind-one.co.kr> Date: Thu, 3 Jul 2025 17:33:37 +0900 Subject: [PATCH 137/259] =?UTF-8?q?=EA=B7=B8=EB=9E=98=ED=94=84=20POPUP?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 26 +++--- .../popupComponent/chart/infilChart.tsx | 53 +++++++---- .../popupComponent/chart/rdiiChart.tsx | 89 ++++++++++++------- apps/sn/package.json | 1 + pnpm-lock.yaml | 15 ++-- 5 files changed, 114 insertions(+), 70 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index e8240aa5b..7f4acf616 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -1,5 +1,7 @@ import {useState, useEffect} from 'react'; import { getData } from '@/components/lib/api'; +import moment from "moment"; + export type TInftwtAnls = { inftwtAnlsSn:number; aplcnYm: string; @@ -122,7 +124,7 @@ export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 }; export const getChartDataInftwtAnlsRslt = (arr: TInftwtAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: anlsRslt.anlsTm.substring(4), + label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("DD HH:mm"), val: anlsRslt.predcOilq, })); return options; @@ -170,11 +172,13 @@ export const selectPplInftwtQty = async(inftwtAnlsSn:number, pplMngNo:string) => console.warn("inftwtAnlsSn or pplMngNo is not provided"); return []; } - const result = await getData(`v1/inftwtAnlsRslt/pplinftwtQty/${inftwtAnlsSn}/${pplMngNo}`); - if (result && result.numberOfElements > 0) { - console.log("selectPplInftwtQty", result.content); - return result.content; - } + const result = await getData(`v1/inftwtAnlsRslt/pplInftwtQty/${inftwtAnlsSn}/${pplMngNo}`); + if (result.length > 0) { + console.log("selectPplInftwtQty", result); + return result[0].avg_day_flow; + } else { + return 0; // 데이터가 없을 경우 0 반환 + } } catch (error) { console.error(error); } @@ -187,9 +191,9 @@ export const selectPplRdiiQty = async(rainInfwtAnlsSn:number, pplMngNo:string) = return []; } const result = await getData(`v1/rdiiAnlsRslt/pplRdiiQty/${rainInfwtAnlsSn}/${pplMngNo}`); - if (result && result.numberOfElements > 0) { - console.log("selectPplInftwtQty", result.content); - return result.content; + if (result?.sustaintime > 0) { + console.log("selectPplRdiiQty", result); + return result; } } catch (error) { console.error(error); @@ -219,14 +223,14 @@ export const selectRdiiAnls = async(aplcnYm:String) => { // 침입수분석 }; export const getChartDataRdiiAnlsRslt = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: anlsRslt.anlsTm.substring(4), + label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("DD HH:mm"), val: anlsRslt.predcOilq, })); return options; }; export const getChartDataRdiiAnlsRsltMinq = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: anlsRslt.anlsTm.substring(4), + label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("DD HH:mm"), val: anlsRslt.minq, })); return options; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 97b0309e2..987728fe2 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -3,6 +3,7 @@ import { CHART_FORM, type ChartConfig, MainChart, UiModal } from "@common/busine import { SelectBox } from '@common/business_components/ui'; import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; +import moment from "moment"; import type { TInftwtAnls, TOilqData } from './aplcnYms'; import * as fn from './aplcnYms'; @@ -16,7 +17,7 @@ type ModalOpenProp = { type DataType = {label: string; val: number}; const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { - const [popupOpen, setPopupOpen] = React.useState(true); + const [popupOpen, setPopupOpen] = React.useState(false); // 조회조건팝업 const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState("0"); @@ -25,10 +26,9 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ - chartData1: [], chartData2: [{ label: "1", val: 15 }, - { label: "2", val: 35 }, - { label: "3", val: 55 },], + chartData1: [], chartData2: [], }); + const [inftwtQty, setInftwtQty] = useState<number>(0); // 침입수량 const aplcnYms = fn.useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 pplMngNo = "L"+pplMngNo; // "L13101003"; console.log("pplMngNo", pplMngNo); @@ -51,15 +51,14 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo useEffect(() => { if (isModalOpen === false) { - setPopupOpen(true); // 모달이 닫힐 때 조회조건팝업은 열어두기 + setPopupOpen(false); // 모달이 닫힐 때 조회조건팝업은 열어두기 setAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 - setChartData({chartData1: [], chartData2: [{ label: "1", val: 15 }, - { label: "2", val: 35 }, - { label: "3", val: 55 },],}); // 차트 데이터 초기화 + setChartData({chartData1: [], chartData2: [],}); // 차트 데이터 초기화 + setInftwtQty(0); // 침입수량 초기화 } }, [isModalOpen]); @@ -119,31 +118,45 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo chartData2: [] // 유량 데이터 초기화 })); }); + fn.selectPplInftwtQty(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수량 조회 + if (data > 0) { + setInftwtQty(data); + } + }); setPopupOpen(false); }; const renderBody = () => ( <> - {/* <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} > */} - {/* 분석 입력현황 조회 */} + <div className="text-black text-3xl font-bold mb-5">침입수분석결과</div> + <div className='grid grid-cols-4 gap-4'> <div className="grid grid-rows-4 gap-4 mb-4"> <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> 분석 입력현황 조회 </Button> - - {/* 침입수량 분석결과 */} - <div className="bg-white text-red-600 font-bold px-4 py-2 "> - 침입수량 분석결과 + {/* 상수사용량 적용연월 */} + <div className="bg-white px-4 py-2 "> + <span className="text-2xl text-red-600 font-bold">상수사용량 적용연월</span> <div className="flex items-center mt-2"> - <span className="text-black text-xl font-bold">120</span> - <span className="ml-2 text-black">m³/d</span> + <span className="text-black text-xl font-bold"> + {(aplcnYm!=="0") && moment(aplcnYm, "YYYYMM").format("YYYY-MM")} + </span> + </div> + </div> + {/* 침입수량 분석결과 */} + <div className="bg-white px-4 py-2 "> + <span className="text-2xl text-red-600 font-bold">침입수량 분석결과</span> + <div className="flex items-center mt-2"> + <span className="text-black text-xl font-bold">{inftwtQty}</span> + <span className="ml-2 text-black text-xl">m³/d</span> </div> </div> </div> {/* 차트 */} - <div className="w-[500px] h-[300px] bg-white p-4"> - <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} /> + <div className="w-[570px] h-[360px] bg-white text-2xl"> + <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} + yFieldText2="시간" yFieldText="유량"/> </div> </div> {popupOpen && ( @@ -243,15 +256,17 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo <UiModal open={isModalOpen} onOpenChange={setIsModalOpen} + headerTitle="" bodyClass={` h-[50vh] - w-[40vw] + w-[50vw] max-w-none max-h-none overflow-visible z-[50] `} body={renderBody()} + noFooterYn = 'Y' /> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 750a91dd6..79fc4ad1d 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -3,20 +3,21 @@ import { CHART_FORM, type ChartConfig, MainChart, UiModal } from "@common/busine import { SelectBox } from '@common/business_components/ui'; import { Button, Input, Label } from '@common/components'; import React, { useEffect, useState } from 'react'; +import moment from "moment"; import type { TRdiiAnls, TRdiiAnlsRslt, TOilqData } from './aplcnYms'; -import { selectRdiiAnlsRslt, getChartDataRdiiAnlsRslt, getChartDataRdiiAnlsRsltMinq } from './aplcnYms'; -import { getOptionsRdiiAnlsInfo, selectRdiiAnls, useAplcnYms } from './aplcnYms'; +import * as fn from './aplcnYms'; type ModalOpenProp = { isModalOpen: boolean, setIsModalOpen: (open: boolean) => void, closeModal: () => void, btnTxt?: string, - pplMngNo?: string, // 관로관리번호 + pplMngNo: string, // 관로관리번호 } type DataType = {label: string; val: number}; + const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { - const [popupOpen, setPopupOpen] = React.useState(true); + const [popupOpen, setPopupOpen] = React.useState(false); // 조회조건팝업 const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [aplcnYm, setAplcnYm] = useState(""); @@ -24,11 +25,12 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } const [rdiiAnlsInfos, setRdiiAnlsInfos] = useState<any[]>([{ val: 0, text: '선택' }]); // 강우유입수분석정보 options const [rdiiAnls, setRdiiAnls] = useState<TRdiiAnls | null>(null); // 강우유입수분석정보 const [rainInfwtAnlsSn, setRainInfwtAnlsSn] = useState<number>(0); // 강우유입수분석 정보 선택시 사용 - const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ - chartData1: [], chartData2: [], + const [chartData, setChartData] = useState<{ chartData1: DataType[]; }>({ + chartData1: [], //chartData2: [], }); - - const aplcnYms = useAplcnYms('rdiiAnlsRslt'); // 상수사용월 데이터 가져오기 + const [rdiiQty, setRdiiQty] = useState<number>(0); // 강우유입수량 + const [totalVolume, setTotalVolume] = useState<number>(0); // 총체적 m³/mm + const aplcnYms = fn.useAplcnYms('rdiiAnlsRslt'); // 상수사용월 데이터 가져오기 pplMngNo = "L"+pplMngNo; // "L13101003"; console.log("pplMngNo", pplMngNo); const openPopup = () => { @@ -41,23 +43,24 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } } setPopupOpen(true); // 팝업 열기 }; - //console.log("btnTxt", btnTxt); const chartForm = CHART_FORM.LINE; const chartConfig = { - chartData1: { label: 'BSF', color: "orange", }, - chartData2: { label: '강우유입수예측유량', color: "red", }, + chartData1: { label: 'RDII(m³/h)', color: "red", }, + //chartData2: { label: '순오수량(m³/h)', color: "orange", }, } as ChartConfig; useEffect(() => { if (isModalOpen === false) { - setPopupOpen(true); // 모달이 닫힐 때 팝업은 + setPopupOpen(false); // 모달이 닫힐 때 팝업은 setAplcnYm(""); // 상수사용월 초기화 setRdiiAnlss([]); // 강우유입수분석 초기화 setRdiiAnlsInfos([{ val: 0, text: '선택' }]); // 강우유입수분석정보 초기화 setRdiiAnls(null); // 강우유입수분석정보 초기화 setRainInfwtAnlsSn(0); // 강우유입수분석 일련번호 초기화 - setChartData({chartData1: [], chartData2: []}); // 차트 데이터 초기화 + setChartData({chartData1: [], }); // 차트 데이터 초기화 + setRdiiQty(0); // 강우유입수량 초기화 + setTotalVolume(0); // 총체적 m³/mm 초기화 } }, [isModalOpen]); @@ -69,11 +72,11 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } setRdiiAnlsInfos([]); return; } - - selectRdiiAnls(aplcnYm) + console.log(moment(aplcnYm).format("YYYY-MM")); + fn.selectRdiiAnls(aplcnYm) .then((data) => { - setRdiiAnlss(data ?? []); - setRdiiAnlsInfos(getOptionsRdiiAnlsInfo(data)); + setRdiiAnlss(data ?? []); // 선택한 월의 분석성공한 RDII분석데이터[] + setRdiiAnlsInfos(fn.getOptionsRdiiAnlsInfo(data)); setRdiiAnls(null); // 오수전환율 이후 초기화 setRainInfwtAnlsSn(0); // 초기화 }) @@ -95,41 +98,57 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } }, [rainInfwtAnlsSn]); const closePopup = () => { // 팝업 닫기 - selectRdiiAnlsRslt(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수분석 결과 조회 - const rsltData1 = getChartDataRdiiAnlsRsltMinq(data ?? []); - const rsltData2 = getChartDataRdiiAnlsRslt(data ?? []); + fn.selectRdiiAnlsRslt(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수분석 결과 조회 + const rsltData1 = fn.getChartDataRdiiAnlsRslt(data ?? []); + //const rsltData2 = fn.getChartDataRdiiAnlsRsltMinq(data ?? []); setChartData(prev => ({ - chartData1: rsltData1, // BSF - chartData2: rsltData2 // 강우유입수분석결과 + chartData1: rsltData1, // 순오수량(m³/h) + // chartData2: rsltData2 // RDII(m³/h) 강우유입수분석결과 })); }); - + fn.selectPplRdiiQty(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수량 조회 + setRdiiQty(Math.round(data.rdiih*24)); // cmd: m³/d 단위로 변환 + setTotalVolume(Math.round(data.rdiih * data.sustaintime)); // 총체적 m³/mm + }); setPopupOpen(false); }; - - const renderBody = () => ( <> - {/* 분석 입력현황 조회 */} + <div className="text-black text-3xl font-bold mb-5">RDII분석결과</div> + <div className='grid grid-cols-4 gap-4'> <div className="grid grid-rows-4 gap-4 mb-4"> <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> 분석 입력현황 조회 </Button> - - {/* 강우유입수량 분석결과 */} - <div className="bg-white text-red-600 font-bold px-4 py-2 "> - 강우유입수량 분석결과 + {/* 상수사용량 적용연월 */} + <div className="bg-white px-4 py-2 "> + <span className="text-2xl text-red-600 font-bold">상수사용량 적용연월</span> <div className="flex items-center mt-2"> - <span className="text-black text-xl font-bold">120</span> + <span className="text-black text-xl font-bold"> + {(aplcnYm!=="0") && moment(aplcnYm, "YYYYMM").format("YYYY-MM")} + </span> + </div> + </div> + + {/* 강우유입수량 분석결과 */} + <div className="bg-white px-4 py-2 "> + <span className="text-2xl text-red-600 font-bold">강우유입수량 분석결과</span> + <div className="flex items-center mt-2"> + <span className="text-black text-xl font-bold">{rdiiQty}</span> <span className="ml-2 text-black">m³/d</span> </div> + <div className="flex items-center mt-2"> + <span className="text-black text-xl font-bold">{totalVolume}</span> + <span className="ml-2 text-black">m³/mm</span> + </div> </div> </div> {/* 차트 */} - <div className="w-[500px] h-[300px] bg-white p-4"> - <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} /> + <div className="w-[570px] h-[360px] bg-white text-2xl"> + <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} + yFieldText2="시간" yFieldText="유량" /> </div> </div> {popupOpen && ( @@ -229,15 +248,17 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } <UiModal open={isModalOpen} onOpenChange={setIsModalOpen} + headerTitle="" bodyClass={` h-[50vh] - w-[40vw] + w-[50vw] max-w-none max-h-none overflow-visible z-[50] `} body={renderBody()} + noFooterYn = 'Y' /> ) } diff --git a/apps/sn/package.json b/apps/sn/package.json index fb8707352..95ec8f3e9 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -24,6 +24,7 @@ "chart.js": "^4.4.8", "dayjs": "^1.11.13", "js-cookie": "^3.0.5", + "moment": "^2.30.1", "next": "15.1.7", "react-chartjs-2": "^5.3.0", "react-dnd": "^16.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d9c68525b..ab4cf5db0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -347,6 +347,9 @@ importers: js-cookie: specifier: ^3.0.5 version: 3.0.5 + moment: + specifier: ^2.30.1 + version: 2.30.1 next: specifier: 15.1.7 version: 15.1.7(react-dom@18.3.1)(react@18.3.1) @@ -2401,7 +2404,7 @@ packages: magic-string: 0.27.0 react-docgen-typescript: 2.2.2(typescript@5.6.3) typescript: 5.6.3 - vite: 6.2.0(@types/node@22.13.9) + vite: 6.2.0(@types/node@22.13.5) dev: true /@jridgewell/gen-mapping@0.3.8: @@ -2514,7 +2517,7 @@ packages: dnd-multi-backend: 8.1.2(dnd-core@16.0.1) framer-motion: 11.18.2(react-dom@18.3.1)(react@18.3.1) react: 18.3.1 - react-dnd: 16.0.1(@types/node@22.13.9)(@types/react@18.3.18)(react@18.3.1) + react-dnd: 16.0.1(@types/node@22.13.5)(@types/react@18.3.18)(react@18.3.1) react-dnd-html5-backend: 16.0.1 react-dnd-touch-backend: 16.0.1 react-dom: 18.3.1(react@18.3.1) @@ -3994,7 +3997,7 @@ packages: browser-assert: 1.2.1 storybook: 8.6.0(prettier@3.5.2) ts-dedent: 2.2.0 - vite: 6.2.0(@types/node@22.13.9) + vite: 6.2.0(@types/node@22.13.5) dev: true /@storybook/components@8.6.0(storybook@8.6.0): @@ -4126,7 +4129,7 @@ packages: resolve: 1.22.10 storybook: 8.6.0(prettier@3.5.2) tsconfig-paths: 4.2.0 - vite: 6.2.0(@types/node@22.13.9) + vite: 6.2.0(@types/node@22.13.5) transitivePeerDependencies: - rollup - supports-color @@ -4601,7 +4604,7 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.26.9) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 6.2.0(@types/node@22.13.9) + vite: 6.2.0(@types/node@22.13.5) transitivePeerDependencies: - supports-color dev: true @@ -9787,7 +9790,7 @@ packages: debug: 4.4.0 globrex: 0.1.2 tsconfck: 3.1.5(typescript@5.6.3) - vite: 6.2.0(@types/node@22.13.9) + vite: 6.2.0(@types/node@22.13.5) transitivePeerDependencies: - supports-color - typescript From 03179ede64699cd3ccdfe56efb44ea48bcfe6cbf Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Thu, 3 Jul 2025 18:02:11 +0900 Subject: [PATCH 138/259] =?UTF-8?q?gistree=20=EB=A0=88=EC=9D=B4=EC=96=B4?= =?UTF-8?q?=20=EC=98=86=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/GisTree.js | 3 ++- .../business_components/src/ui/table/uiPageNations.tsx | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index 6a2e8face..9dbf2c42a 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -170,7 +170,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes image.src = canvas.toDataURL('image/png'); return image; }; - + if (!treeData || treeData.length === 0) return null; return ( @@ -203,6 +203,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes <input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer" /> {node.icon && <span>{node.icon}</span>} <span className="text-[1.3rem] font-medium text-label">{node.text}</span> + {depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{}} alt={node.text}></img></span>} </div> )} sort={(a, b) => { diff --git a/packages/common/business_components/src/ui/table/uiPageNations.tsx b/packages/common/business_components/src/ui/table/uiPageNations.tsx index 891fc4c81..a4ee3b4fc 100644 --- a/packages/common/business_components/src/ui/table/uiPageNations.tsx +++ b/packages/common/business_components/src/ui/table/uiPageNations.tsx @@ -40,7 +40,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationPrevious href="#" - onClick={() => { + onClick={(e) => { + e.preventDefault(); if (startPage > 1) handlePageChange(startPage - 1); }} /> @@ -53,7 +54,7 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationLink href="#" isActive={pageNum === pageProps.cur} - onClick={() => handlePageChange(pageNum)} + onClick={(e) => {e.preventDefault(); handlePageChange(pageNum)}} > {pageNum} </PaginationLink> @@ -65,7 +66,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationNext href="#" - onClick={() => { + onClick={(e) => { + e.preventDefault(); if (endPage < totalPages) handlePageChange(endPage + 1); }} /> From 39977e449155c253e1715ac1db9f873ea89b311b Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Thu, 3 Jul 2025 18:03:24 +0900 Subject: [PATCH 139/259] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../images/map/layericon/Layer_Select_BTN.png | Bin 0 -> 14434 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/wr/public/images/map/layericon/Layer_Select_BTN.png diff --git a/apps/wr/public/images/map/layericon/Layer_Select_BTN.png b/apps/wr/public/images/map/layericon/Layer_Select_BTN.png new file mode 100644 index 0000000000000000000000000000000000000000..1e810feafce85d43db278f048d541272f6d82253 GIT binary patch literal 14434 zcmbumbyyVNA2xh;X;3f#5hPSP1q75_P*A$NrMtTpP*jv|kdg)|iKV+k5D=u5l$K_R z<sJO~p67c1fA+eVWoFKtIp@ro^SSTOeeZiEg%{TeDG31p*QH-RR{;PH{R;>9xX{;u z=h!Lqh3z6Ct%eVMeDO`+LHh)bFST6&Anv&OgT=8CQ$Yvsx=L!fsydjvdKf#K0S^xk zPAhvG7ZYPgGfoF*i<E6)N&x79^mB1F&re&kUJZJZNte4jE_G+-Bp<@_pVV+8>6o8O zBHkdGgF_$OipR%)^5iSF<W1#{q6a}=-&0UyKPSEMnK+2>7TwJorY^9Xu#4IZy6^|| zf%K^Qq5ZRm;?gzJ+l~5e>z_o^QKh`4UW18(id?AmwY+sTX{dewZy&X|9AdgR4i3ME z`g6i6^tc{bMa#x4qt%jf`+mHnrj;5}#RCVdveby{HFf4Xk-F6_&Kx{zPW=Z$3ER_) z3TLY8e?!NQ30iVe(6~vD^|eK3XAIUyx}q8L!io6Cj|1Eg3>=TwL=)zh;|Fb)laH$n zr?3iwLko85K8t%*qs^!0;&wPHs2S|EJa70Nm%#I>3az8{j{DCAy^aR!0}3|q%)Hhk zCDv0i*GD*fO;npAYPXoyBnuW{g-C^_SEsq%CD~%q80!8Cm-$`UdS16j_th{P2U~-_ zLJlWym%U?7e;vM-!ZYOd4GtV}S?i9b7F$%P=X7Il%(wM$S(Ej%;JwVx-cs%6VT|)z zg@Nd$5#e5ieCr2FwZ?y@Q_em(qmy_VS=`vcdO>AeRo~$szeOMC6h5fy`s)a(EFQyz z%cPZJw<*D~C8l@k=gbHzA+G|7fLeqdyZio-f_AK*`NaIsk+If~&l&2XWCe}~dG}@Y zyrutC%TD)dF2umVm!)mF>Ior#V~;#yQ+XM&fq}`kV~>3<>EuK~a`1<W!25Cp^NVn> zs$)P@cyaXzJ(l@J!Rj`WsQRz;BKsw6%%B`Kk&?9QU&Jf_)()woIn<1?Vs^OclN>p~ zIWse1W#<1TdrPHTg~0UyC~2VFsg82}cFLM_h)vCMWC7>gNP0?dX|&D$SUEu0#o4>& zSNiPbHaewG_f=In7Kko5$nVS7)f#e4H0Oom<cFyo!Ve|Yi+3)#H>Rk}XRMBMiI=2v z(4)-<W=;O~7?YT^biw#0)nvumxj(-Gy?NIZ<0svDx68zG!zEdJhySK(qIsw6n#FI@ z?6Xm(3L~eOJMmSXHurT++E~okMr0Gyqq{v?$wjR)eowsgc3am1UnKU@;1mXu0j{%; zCv8{96!9Lb&gn(tQlb;+P5vr|5z{cJe<!BVO0~PgBKBgWi6!{u)Ry7bxXXn8A%(kG zeZk>0e@x;|qLdxEmi&K-irJ+ZZpvRWOupC)vug5czaW>st<p(n)sr)CI)cT?5s8M^ z))7E6j7^prl;M_yn5r@qFYm1;Rc2-fzP>54tzCWCgvy!Ze<BV48+_ew#zghPg4O@~ zyh*g7Szk%N{DgpE_L;>1H?A+p&-4=V+|PV7r4;YLH4z>?$81#`)P7>-BF%5tHOsH| z*Kd>_+)><*kjC`R>D-ks=vwL9cS(@5^F3}sS7)Qn;NbLo&h*J^_xdvpRrj)`Qm)Oe z5|iV`EGHG?W8IR!*uUB|Pd|JWzRV$HxtR8dn<h9rAFz)I-~x!|n!jWi))-nQwC=0< z{v4*ULH<-U@7c3W9})H61TCGTdu)1`mBiymYXaNon`f9xH}!!t08Xdhj82Wte&y0R zV6myUUD=x4cG@W)q5jY?DOqZ{!)~V8-SAe{P;d47CRRPBE556N1Z2=O)dfe;dJ2ol zkNB9(F&+D!`lC=Q-3{HUWS@ZRifpyt$7+4=2Qjo|LtBFmotCsf$zk5p%z`T>mC5SW zC!wEJybk?@x;{!;aL4aOzEsO-`OIlIX`YLA5ubh`2NdmFds={G(ia{?eXBV4iB7wl zbs;zDel}y?+THhiNBxG!Wnv2HY4qC7p^B}$=P*#d<??oRVbJ!4fXFQqxs7C6-7y=M zY^d_b^BooEnm4zPUuz$o`Z-jkV4;XW3#;EnTvM^OsOIlHtQq!c&lL{$fM4$ExsilO zfxQdT`;(5xSQJpTlG8i<^}VwsABQWw(wccC>J@K`z#MC9Z44*AqEC%W%i}OZ-b_Ro z0N!tU=<cf|G-aEajIfp}M>r%M9h+V1s(rtW{7}8UNjFNQafTZfEqz?P|MI9c(g_Y8 z>7>4&ROXy*uA{BZS{@;4+GTBIG)im_HH7`OEgiO7iKqSMf&s`e;!h5;Gy4xEP&V;+ zv_hI19hAsaZ~NaYKj6Iew#~XaE<X0R0TLWFR~<e}(l5^~Kz`S&#i0<IptFWM?y_CX z&sG`_MM(W&(X?mk`gj*0zxNF)Xl?1BlntW!(Np|Q{sW0wj6i>5o1$7W<?P$^W_6hz z91N#m*;nf_)H7OUd3ksbA8Fk3AZ)RHTQ<178e&TVkV*r4`w|LRTIBB6^tE}-7i+CP zAO}VGzfmUOU7a@SDsY;-wHzU>!zTBk$t%%4<W4cX?EG$57@Xg0`D2QmQ_B$m_~u=M z)j!Q#+KaKu!c4lTIAAr7HpN_4&iO|Jd|Ya}06aIw9F$vsR0Z}r8%3oD7Ttt=bCk$0 z6;3_1kqYtpv>X~xoVR@Z72Rm>jtX*0mG_RY_WXVe89s>%qkXR>xaJk={|EvDjato_ zXL^)`d>HKs{&!?HmDnvaxwy950=z3)0!BU%JP`0}a-+X!=Dt|`osNzFG`@t+0B)3g z@2~PZyjPtB0HI_aaBtL8puv&=QP~Y#tk#orMWvixwzZ`N!9d27``uqyVADF{P{mlH zuwUCBB&u)#LT!b}m%SShw>JinftX~GQh(p*BI<kw06zESRO3)y&MbtDN`At{2SA2# zg%XLxfg*fi7U7~sLj{l+Czmk01wcnUiyrO`r*jhs-ykU;zyQby`K$nY?R_nX1ptJ4 zjoN#s4_DZS?>W>{#P!Y@g0fo-HvkCI8T=_Qm9(4KZrQ*GogY&pJAxVgt0hzumT^u3 z@{0&<-%z;`BJ%(YxW(YvvaP7WRj-OF%}652m;(X0p(gpQ?Y%dp5%b4O0A6>RAfdsE zEuzG649CI+bo5tSU`FP49YH2T2NlqG<HWX2iom(r!PX3P`T(^NSm(Pc!qhTt;Q;ZY zbC$3Me$_mQ!oHu~q|n*_wOcX;PT|hk{J`uc0NyvPDO*^*?mY??0U)RIUn#Y^Zt%AF z-d|ffkip98Os>E{gJsGO14?9GE!D3u7_)ypW1YV$tgaDN;kb~BOHo#>6sI2t07dbS zWkT*ekPn@_p;Ti1MgJi*kaU%VreOCLGIRjysnUzxalkxNGsq8(GiyOx&A;19vWc4s z*~68B?%)GNCM(ZT=Pbb^^F;uR1`?s+rpurc^H2Zs!13NA0LWAVxg#r}JLG3tl7W>= zXiU}L*f|#Nl7dNWsL>MR;}6Y&9CTx)XY^39F{QBz5HuL5X2b_giRf57VWRG&E9iPZ z3fd?=+f~5&@{#}>AS0dMq|}9@Z`>n;j$6OOzM2SyT~Y`D)FdUlnmlblhZGVZy$k=> zXub}o7K*6R`4yXb55sB4Y1Rb(_;asl`RGb_@%u~BG%?c>W*DE^?f$*<@!jzTw20=< z+c=#7JX8(5<vGR&)R_Z~ekcT_lx}%7p?WP?hfv(w4=-0Q1(ZW9Fhg7#X=dIM=;6B# zy`{Ys=MvW+V~+EmRzHz90yh+HE?PiSCqH{=dwqz;a)s7)h=hAIHafutcg9yUW~(ss zyfklTT*Tz%q;|KSJ&`INZbn++-lD)ZB_MLmyb%mV(1Y2!7gajYD}9R0W+^bC%(3Wo zT|h1$r#0zX<W{^PMUwKop}Kq!KEe)vO~1D9uzNkX<VWgGuBv|Wx=wtj#({Tuir?Z# z)TvqC*4l=YXFbT+`^*3`h1@z^*6p{}yy7qQzHVut4GH50$vtb)_SUN&pPK5Mv%69F zKq`mO#IS)7At^)W<}sx!RIeMazn1HE>PoqSvyHxP(eMMMK#h+~&hI(t9@a6*+nJkF zHoqfFnZOec&&5vrUUmL9Z+n}IZCf3Ns3nUAv9;JLnpa2qMb1iO7lTM@`0I)?SOTl$ z(8u3?4o-a7^@k&VJWqw=kGHDk;jg<m{FPSmFPDqSx>n7wJhESRz4>HBq%jJDhZk%U ze**A}*ZU?sQROC<#hJFwn5WWw`V_09mp{LeC{p8qY$>=BZ(hS-UhPICoVJ&UNB+iM z^jb__^KAO<i$PrEtq<`)EeBggC@DZAS4w<;d-)UNBl#^>F-|8^aH>Z07f+U^yg3`L z^f0es){q4qUa-jgJ~$r^@_BC|DV>Haa>9+(yz?J@q^qErSNC@eO~3(Wk({u6mEIZ> zUwg6iY&i$nr^lk}vL?+^ZSuTW&4Zv!4kuT3u^5K`v$g^^!vpi&<BoKUYPT{^%BQb+ z4#|S};DTu^Xe}`jo=*_76)70P>^)GjFPxr6XANGKBncw<csdn>*Xc&96`LX&QrUiL zjNDPhgJnd#KDVNFqJ-kyuYuWwp#CkFG>3aNlg;%THqqNCb_{!1eKMon{WT!H7|dr& zc+mt94E~mJ&2VH|>aM$p?npLLevYf(z+(Wl$pxFf7Zr2#m&-JMp4n>a=4I9orq5j4 z-1I<8oD4VMJs+rgG&VAIUtqU)>4m?g!ftRgz2C{SJ1R+(%#mzMCph@qJPhf`>U_`f zYVNEc*69)$@y?&@Nsiat*K^5Q)#jhyH>x16-o8j?w-V3Cg^lU+Spz6iSvQ<}Tdr8+ ze#+jt_N`p<cQTbo|6xSreCf9vs>Yy=@W+eJ^9$K-%{vzwl6QY>Xt$?7m}Es#$jt3@ zrNZ+i2-S$F52sW9e4GM(U*P)o9fXJ)&N}#xNkLVo^-v<`>?l>UoqIK^WX{%{s{VjI zX}3ypE%B_K^J09K%kXq!<-8R=E=_%V#F#LH^VIGMA==x!M@_6=b9L}iF*Sw*C2yu^ z)mNZobnq&`1~b_-d2?}mW5#2_Ak{?7S$bb6%0X8sOUI=uq=|jS<AFVV*dds>>{I_% zcB2sOkUlMK|DDu>j1ZX#+9@eUzcXGRk8cJZ){B3SKiO@K-8>8%@f&Z?f-Bv=c>If9 z`IKv0+Q&^HVLFPfp_B}rg{R@%^N^?xE1Fo28b6e5=P}}q(DnDDz-LUYMxLdQr-#8; zglX%?q^|jk_&q;Z*NT4nWc_~0nE1hm!jA#F;~{T0GuHH!Zw33DBITHJ!?VIA-12jp z*w@_ldhyV)MzmV9>PDNg`qDUE^h>c_met_i#O8KXy}{4X>(Z9W3PbCh+fC0#G*$6} zUeS9AevxB{tiwmk-ml%2(a?8Z<1qX7Cy-_<UJ#Hn>EO^MkZwx<@z-e$3EfZN4t-eg zovAph9Q_BgL7_qJ_%rn9>?0iTF{nRHz2`42Dh5wud9nZt;q($%e<sa2Lq<2!jNZOh z{YR5gBux;Plxbc2Y7qumuTEq1sIrN%w2HZpk~q&)e<Id<*__FV$$$~*%!Oc#U5X&F zG<_FLX;3?gt(o8L8Z$8gLjPdeD9SQ?MmT*@doe330x*lYTxzUSD1GvbfSD5>Cz8LI zJY-)oXE2LoU5PLd-d0Fh!M45ia&avp&;PjQ1FpUNT@}NEeJO<5U1sF)m+wzxX18q^ zM3~&zA4(L%ZH`b<MY~PVIL8pO!+xRMI4Wap7e86vYD!z=EE8MRZmO4yzzusi&L`E2 z>Re`B*U6tbesbh{)~LkhbQ|eU>3I6nQs^TO{v<5CbJvizhM}KQw|+B$;ZIAJ-k$(_ z%*H_7G>wPy#_3r3L0mNbuFWkzSjI!vx8a@vCMP{O?uN&Tlkq%_y5=7Fg$@?$ggBZ( z{r-%TnH%z!_PgIpBhGSe%xZNvC+hy*Cq>LYA7CUR+jEnnJ`<z<<UlRGDkJFO=nznH z-Ibqz^3*wnf>oFfJAv!lQb4u&K4!7Wnj||sFI|24JlT@~(R}UkMbOa0x>kp&;Ak2- zYCPmE{2!}QU)WS&`R}dAb2W?S4M+ef$GR0Vb9nNO?O~G5o{j{Hp<l2d3m|_l7e0qU z;A*`!0o%7(m+9W0OB#-`o0hIZRJe9!MNC1}co}o7UvJW!fiXlHiaf-2s2(kTf10Ye zWU~bsQD22Ogkq3v#sx1q)=94bR@JXlo1Ww0W!j4l%<Kz;uTN4$Ov2r;_#1VgP<NYL z;g7Gx$Q+FAS-|!2TR`pQ*dj96m@<PY_|8<2;=N(7m%pn^?4<oyL~hqJ`7a>1FIZO! z62>Lm1mbP=dZY&39D0rbB55hp-%aw~r6*yAsDHs<p9#fy-~JXma#jJ0+oYiCIb4bA z=wZT+-X;f8<8-2y{l02904&c%h<|bnbgFdD)q1RwH_ck2tMCNF&;`L@*ii3xSM$0k z?z<6+2BTjZy*skhFA8e>JvSwfBF2mXf{-4#y_%d*ef#LkO|{!WW}|Ex@lElYd{~HA zo%Ep5{qGxWZ7gkm-P||axT6NLdXnk*RwE9F=UrwulW~<i$dVMo;=z|kc%K)9JcVa} z)gHYYu*eI~B9&vhModXXi1qHln7J7@H;xjoVm{g`2J=ZUT$w0EdA{U2<sH&<LXe@> z7X#>71IGp}hAQ4zTWaim4R~!8bkpEj?eg1e#5(HXo487n3|yD8+_#ZPYT-6Y;XE{T zOcPWO{eb8}feW60yx=t`JZsj_a&QL}#OA?~654Z~&2j?S;SclqOh?R5yO@RszsXVD z2eG&W2>I)24zgeEO$3r=wNG%x%S(RL?`29Y()BX4!rpyYM5@1k8YxI6JWoSS+2iiG z)(u<z+3%@e?I>;%Q885Q-hv_ltQ<OUrMRb&bwX>hM-ft4ySUPKa>5zl0_fhb0EbPd z(|fv~1S!CwQrvDtJ2IoSVv9hUSIphfB26yur4E~$9PE5j?((p=w6X+RT#?DWr1m&I z9ju;X?a0DMctHW^vD!fw%G55#Xii5KF7Y*g_K8~w>2;4C8kS-Vt$0qbT3DYKfhEF( zn%6SfW#+-F(}wiaj++7KJYKg5?g@iv#++~)Yz!wF?KLiZ*io^SIo1kVlCx>16X7jo zqWfg^iX*MTZ%?CUGq<N_DnDdXL(7YkrQ)Hk^hE8(S#dX|Ch@oO%rO`Y`FP-$K^xB2 ze=yzX5Z7Y*f%LqVzt!L73+-9^RR$j2c{9}|o%%?GUafRQudnzvdZ)g4yphT8eU>jQ zRt=|%gB4K3wQ@}xGF<Sv-2=$E=kh>h$N_@bm1$i~a5g+AHt>JQPM0W68P*lUQU}bJ zSU|~OHy5y~z+r&yG09`xF5#w+{|L>07(Dch!ss8<c^!)fff4I_)X>8Ge-V194>^J) zP3JH|`|9%i&`)n}A3iYxV4YF3#z|=9){|VQZ2tX!JgSoLqporuC{(&CTFLrR_dk|! z5APa4yd=AOcEwwio;ji5;ge4QU{H%Ik61*)0DdvN=+_lx_}AdVt9E8w3!xG)As;Qe zVja(|e1GB3KUO{d!8y<D;^S|x^I{}hj{p9OpMILGx7^60v&ff$ZInIcgRjJXuBt+L zx5*q8kYXTuVynK(4i1P=StL8QY?BzCM)ma)CTYf)>E@;s1Jii(=$YlD-gx)v7qs7N zm2*E#X)o$pd@_z8hiH=89Rd)-_vFvy=NEN5N@=tk=3KN#&1&Iq(m13?8RQ*SW=F$C zKl{1Ye-}Rd$h(<276?Nmb?Ra#atL(^bU;hUE9#4;%wlrUkw)zihQ9M<9;=^4zPUA% zc*$PJb6FN{VxB$s=VYjFAWwU-!UMcIb|W&$6n`HDYR^6t8S;NMQl#=?G?<0+a%OB7 zJ@|t5H<tqSH4uA~0MJXnrCE;=ds1|U6_cK6W_DPXrt%a&?rtf1&&q4OaWP+eD>bN@ z2ISX3G+$kYE^_YD-_S#%!lyXJ{XIX$hM{KbI8Vh6t(&RE(1OGDjA{)&H^C{k2O;Ch zRKguhI&+PB8f(#)$sc*w+Oo{u+~uKH3zJ~eNh{K*=hg8<8dwk7{XW?ike}joqi_AX ztZvBB@4BY^;(FtknmagPS=|?|^!3)u)W*x6^Wd~Kj?Tf}2-{G)1-@RFl>JN+bZpz4 zDLA}+iYG^Z#Z~oQ&{ja~V#g=Fxnn@_CH0H%a!0hO?#CTtPT-G2rhiRG2Ps0{Z0_Q7 zcHo%PN0}Pi)5aa2`Qg7QR4{~mtP2yO52M_8d9fv6Il1lSXA+y_+|Di}K9Z7!jRi8h z%4KNq^xDwG!oA@fmfsr7Y_7SRiPIqkKM3L|y@8gVB)<O3XCp@ii|?#W-{;nvU8b^2 z0ly+_F-NJ_e1I>8PYAEa6i3)SVVja=;$y3L={SV-mlIg@0?3_W!|QP~;4XBBF^#pu zSw8)Cvp7V8)6&Taf;RxOPUXyJR)$Eyr<;!gLY7jl*7A6Z39s?h(fc4ezwM{yw>)s8 zv!&zP<DoFC^gPGO@d6VtYyq*t#)q6ABND*td*+@zbofIRVGoyL6Y4kllcqAM43fMs z_j-@wD-CM+tCaJrL555|7<<1=Rr9t#SI>JQDUZLI{7dW2lNP-5*WrQ!GSyBQi~^A} z^d`9kh~mE#MqxF!GA%!jP^2O!vLgj~Q}c4}dMy**g-w-ihx${4(}{PASe1N++^Dt) zAsnSZXbtDKde!oJef4)TC3QcQ*rAkwmXGQktFPHiL45dti~<Ewo|_~GaR+9XCd|)u zO`=Hh7k_sJR86a&sNx{YAkKQfpIi>>^-af9F+X>zJxmO|8VB50-(vwR7j!VvrAQOs zVyC%TZTpnubM0uI0uu?z=V_~cDvWM3TgD0V)3yTso?Um3EMchPoSDLM5*k&2APE=l z5>T4Ec)dEC6s^;aspZ@u$Tu}s4?QVfiZ<np8KeGFZ9zSo6yvj4Q=w2kPv+<odn2W7 zY~ZCvYPhAD^@4*!{>1nG%AT9uu5+<PKAQI42`M^74R0yVl?6EjwrsSI(;kLzZ>9@U zWZx{N8p3iPeyU2qoCF<fkS$?bN=_CeA4Al18)!Clv5cbM2ITu#Msej4t6U=P60m~& zPYO(1>(LLzo>W%J8ESm&vug-%`l{Jut!Tz2*(kS?F1DF?v>|oEA(>7G%a4hCp~e{R zOqh{kmRE13ha+?<W5E2Jw_=kBVq}R*58sI5JX#Sm_YR~B)v}t|AwE;`u}G?xrpEjG zScGwfbADmxL%l<^t7N3-`j-b5zoEE5f%@*iQ!yJ8P%5hwD2@(W_E{g<egONUy(jwW zwdb`m1qtGNEO?o_(eQ2TCzSR_>tD~k5*`vBknL;c5yLuvKlw%3`$NpZtgv-xc}U*X zCd0#K6MWq9z$bf3#H0gnDZPDAVC`FV#xVNqd*SXy2_QMp(CH8}&jstbB)B2=n&U4I z1qWzi&nMq+ha)81zFl-><EeHd7oZH&sm@9GoP#@BBajM5rqxU!FFeyh&1mK`T#2n# zco@ZFu5CRS-*el~&E>d%z*Q?c<*h~_F<~dqgjs<J!s)a9>90UcFhar}JJ$Q}%LBnC zSCtLQBzu`gA%kTxvDokw|6PYgN-=015$hqdfA}Tw3<cfvkxp&1V$v*~mEOA2E4t;9 zoNDQ}B*c_wZ{8?Hl}Fgo+7u3Guf2RdV|}!%Jm+&HjfJY6_R-rLn_iNd_ZD!A3o3fo zZzgJUl&32|Sak~`aq3yvDoo-+=-0{e+QY<-*P0HJRwmdhJbEhgv8g>9h%UAXJf@Fj z(`ine*Ab`M+TG2bWI*uqp7sw)@UeIEcJe$op8(&aS9FL<cW|YOroEKc_2rfMp0SyO zekT6ryK5W;#d<osE#=YSe!@85!00G%3nq<6dvHI%&?ck4V!0`)e>|ojPLSUSC%3wn zmLFy4Arw|LBsxhWOMPqP0W3c%tr~8yMyu1-*Lq8OF!DHH>Qm33)MIU3<~5;yF2LLf zMTZi{;MaJ6GRp5U1b}yJM0@qGlHU38E5eNA_Fm7Y%8?(;4F);}6hYZZIoQ}c7TtTS zTzu#*aZ1Wyxxs{*H&hi=Bez>Av5=wfj@dYMoybhN?zn|Mn(;NxAL@`FB|%%B@kus^ zJR{zX=Mm#Kia~F-Dmy^g;UaS9i68G4Y002$%tSEk&JG{@=#QPJO@1NE?y8zi^jiHz zb;c`Pt~(7A`ntHbN8&6-Php5H^_*w-p?=A^JN&93W9)JJk`lowO>J^(;p;D=R|AI| zWgKt>pW{8pFxTX;bPF#gH;SBvT*K^e7=pI2rH0JT{r);;i6X`YcS|w)g3;}s*{dY| z1VLPIkw<7k+rMGmmBXgm{pdj^Dw+o4{W-Ji@J%BlV2-LJKoA^Blu+%Tw*}!&q#ZYh zH__IiFTc@LN;WoTfwE})3*&1LCA`_h+;`de^h^~CRkK!d>z-8fxy!NH+Y^A`kdy~~ zBi~IV)21y{x^E2ptXS9mcGs5sl7y~C@3%j``u>w&N{P7m+vN%ToN;R<OJ<nYIotw% zwwsrfU_4`KIe^6+t`vC3P}9X+Ya;uZe*ZV^!ujQdwEf-j89E0>pr%%dodE@#IzgW@ zw=7dA!S%2%k13ACV@#08P6?c9t9Lc;DZ=QI2{!n{<JZEM%+42b@#|Qu=js5sGkWC( zSn*y(2OlM*%{>8HsiB{6B9B-=E-d=Aja@g{$3>vmKS415!P4GwfLWQF{Q46Jp+RwH z#w+;9h-stY`!Y#(dP;;xuj{54E$xX!jR!F(4C4dCXj-a(fH_M$rqR;qgw1wC>I7Qn zZ@a}YZA~_y%=+?P`xjJEvML};!fNF)6!}K;*J)5w)?ayD3w|0SEtGb=8(5l6jEx8r zb~|U|4$(Lt_3HlF<`O}hm{h;DG4iaS|42ly)^xQpWiTP##djlwVuuW<>9e@Q^%l=L z2oHZm2yhuB3kXE5-R2Qd3F5)L<Vra3>-SA@iEzM7;Lw&gzwrJ5GMLytx)i10zN2`? ztJ9y<CTXz8BO_MlI86SMQuvRln7ZurS&yxl^mM_e^sZ-&eia*N%^@-W8U2D_n36;P z9hwA#25jK>yTQaZGrNKz)$iAPjDz;vZ0js4zOp>~j;yHm*It}Aqx_Q+31ak<jk)KX z{l0TgY46s^nv;Hjav(3kqgRF(?=I4_pZ1sTomj3zP}my^oa!w9w2PM7v&430#s6Q% z9a2Kb{+-jy4`f@|Gbe|^Awi&LYr{lzuH&E1K#GDU%q>Wg5r1=)U?dj4Vp>=G_m>O1 zb`1Z4_RJa!*y}bEC=Xwl-=qB`$CuD(`8e!~8MKAg;Ua0b0aCEAjYRYRVtaNtBmjhb zE`jAs{7dK;@*Js~Jfwrvp3e_VX#YtrHwd81`AF>uTiE{bjY=hx3`spD1oYPbAK7O? z6j$rNriJ~^J1h*TO&ndz5hl87MxQF)BMEvyQRSzwYr+4eLV5dWVPOA#t?kx>?UW=g zr-|FSo2@fK$08>kHS>eCl?peHagqM*PAytl)VPhcnAmO3ZSSJ&HI>!QTG?ne)Pm?I zJ;tOZ=Uz(h?WJ#@lhSSG|Ey?QgpCU{@A~`Xml**g^(zr(Y!o~*CO}Z0eOefLyfYB( zM(i}<U9fn!%T!?N!6c^_YQHuqud>v6t>TVfnVa8w3mDVv8Fe%X50HcXvcl}k(V`UU z_wReHQY0~wIgid=>QHhvN{^%*i4^;#vZcH2Dlcwti#!5<6gx$5Ek*Q%zi1^U<y~uZ zPIX^ZkWP=aQc+BwX62;aR%z+4$`U@C6wRv?D__l-dv|OPYhiu8&igQwzj8&phPa89 zjkU;rNA)dn|De6ARaOSpo{Xlr4iELbZ-&cOn#E}|nTIaO$Mx5J=8W=Fv?EF0WS7P& zXxGjuHyfT75SmSI*so-uVtjuW!J+;ePqp?I5}V=1%d@m`^p_M-nyeYx14`Zi<&w>* zB#YC1Zz~)imHpUne!Wv3$m~5Rw?6wcjzQR;8Vy7T+%3_o7DtWNS`Wqe7CY|H05#1q z><mH(@}@XRow;$Q#tMdKXr!Ckk5f!MWioaJ))}lDxqW;%$hHCD(LD1KA~S17uB|(| ztUldyc_h@23k8UPRMG!dyC?{oue%DRM~(@&EM)cPZ@FAO963@}5G%pJ3LrpPHIXE1 zz`pi(Y=4hH)^x)?B{kwBCLM;jd<V$`#+a<?2K4VHwu^{8o;8t85<nLkcig)6I~2{^ zsHX^1!bI55Pd0_m97A~=0=a>@)MqMqFi@cOiV*y+OsGC~hoC~V-(Ak6xyg+)0-z3Q zhI}STjUsO7M)rgh{>hDfS;MLQ6hfdFWka?&Ns$ZoWE5bggcI730J0!9bl?<S4OLzH z^I+^I_`_R7c_|Z;StZ5jA*3sv94Q#i<Fv*H0e&QD@>K@4VJ(GSSA%j4F6|+$bFc1q zUd0_5%tDKu{jF*d@JCtvM-UXP(^!6D`=4+ZrOA=I{(X#oGiP~m{HfhmxyN18qH9&C zz7EY0&4_2s<0t{k*mjmCx10&BB@SnSf-I`4y~@1VFn_#Nk{A>1x)wD^o49csmh!1` zH6!5|-xR!ijh&&uo_^2ruwiCzqx6%R?1zAxD!OR(O#Vs77{Q^jSkh7~pb{#8lVKf; zu+F`?-8eu)G(N`6$5+<!gJ68_gxJOyV3Qhcvb~zgTEqf$Wvu6p3=p<O67j~cEw(9n zOt0>Hj}NyDdnbK~6TJ7Uz}ZV^Kd|}RQ#F$QFNWUm14yb?>LRXNk-&83VLYET#drIh zAN!>Jm}5+6)->GQ6dW7ljkV|tevbQb_#K8$zE*I`q#E<v@ZM?Q%s0%p-^CjyZ#8r? z1$*BW=!_8p7RJ-brV78*9IsWj+R7LAS(Mkm5M8{Yjv0)#S`qqYZ8&GmN78g6a)cTa zKa45-2%#(`fy`<P1*?X(#&GVYc$A;jE>XPqDihC^@=r7lU)<?%zJHVRsJ*PvtnTs2 zUi2kJ=ZhfGR;QNy?8ww#mRo4a^iRu!J9U-H>%<Mjci@!O5r=oY=T7EQ%+Ca+O*WVy z@SImBi9Elbmr!(TRK;e@u3v>QM1LoZd6azZf!6g~<{t;87K?qpW<zr^XyJK3N6&&R zv*}a8!zJaO2_CB@l;4>)#@7s!*4Bqn>whGbl}79+=6GBYZyU=vg;9M&s0HaZJ+Pqg z>kPlOEgWKG%H1Bl=Y!i6PX5##VN%6Y@w!i28~y}SPJ$SGeX5X4<9loF@_K=x&(O>K za@G?4tE_08=e0--Yh<Lh)w=Sd?+I<DT&_n-;+Njy>)=$p#}D!9h~Fs>^gv8?#<zHk zJ3}Dbp@{5n$8d5{%azv5%H+V#t=q0Cpuw~=aw)ANpt8TL5=eY4bF#hQ;XkFo^ryJf zmsH<{)>c({m}%XFK2=_=(2bP&bU`>N(^R`&E$L>1`;j`yyY4RUg}t4;aM-)<(wEfY zVm(-4e)j!Sp>GJmBTB4d*{VvH=<KE$KD#khCi<ug)8B}q!@)7}j3)&s7jbyj+{afn z1CMtFnAF@wrV3v76IZ@4J9X_jOIUlgn5iS=^-cUJpdc9Gv>*>t%Z9+bqCcbSUZWTK z+2AOHewrXL9Vzdi-)81YZ^7apHUj^QkK_=vP(UT|bKJdG>6<b7iRJwvc*q@}UGYkD zy-z-3La!>BcZEcUY36M>tFXNc9BEBB85q$Dy`kUZN%%ba<!RkVO&I=k^!pTCmWJvu zubB|h*lv4I1|C_i8!0u^d;r})YenVXT(<Qws!6kqy%5qcJCT7>x14KBvqO6>f>>LA zgSMKr2CP;h(#0LWVQe<C-dZCf(E-ih?ex!^cdD9mi3_>Zm)Jka*y3D^oxG&64@fw8 zvwR1cTm-okOpy7xV+{Bp|4BGjNsOq@?oFQdl?|N#a(W!Fd>Mjl1wCz{8K%V{g0bO0 z%Y%o{7<si-W!tN8!H?k=%>?D<O^>u>M-=M)Iwy#J%;i6}okuFdJZ++b8o2=7@*d*y zeeGTUWIm9^VWpIHz5U=ASzNq0hi=tv;&J`iCWf--TDZF~+qAGzD_B8)xq}=O6|@L( z!>YyuaTKV95||N9hMM!FANk%hZaap_!I<<3?Y$M3sSoXZ!ZXFO%j;kGsskFQCVY2( zPGKXhi#kk@WG}N>Td8L2i>a1p?=_!?u2{|IC~>tP6d^cZ$m}x7v&81Chb6F{AER?R zN3kEU0)st&(Bf{#uQ?Q;<mIb;=F9ZN2!B$7SX8sFG$i>m__n%L+pY?xqzi^eF<TO8 zYF4<|8FLW=8Tv_8khPYNzMxeoIZr7#mgll{IOJnUO0qwhgWbNox9$#<7`~5#N0tdO zVxoUVQf4qI*%rCs47GZ9vWcOn)XSiqAyfTA5Bo+bT<I#h)jG#>xK&iBbVsFKnk~eR zOJ0dBYCrMwLu@m=a%CfOIro_w2NaTd+dqre;R7>r4%naFyI>qVKe$LbA~6%>M9W}Y zCrW8(tOtpA4d5+~Gi`d@0l5jsETHdFSw8va>DPLD1?m^@Sz*-i%r1>h9t5S+3t!qb zJ}`bz`IPs|w7LbC=I~aa>_++zdQ@u>vHfhKAPsmKhMmz>B5JvS#W>w9|17gl-K;TQ zJ!W&d6l1dAF}5QF&PS73f5m-*_Y`vDsd$JzDdU@%C5arH$6H7&84X$)FiW`)LkNo| z?<(3fy)w3ZQzGa%BcP9-W;k3c^sM*Ydp(|V6=PIiz=4@K97vC-?@$KR>IwB7bdN2c zA~m;@0?hY1R;Im{NPq?@2aH0Uz*PQ@mCXGTVaH!gUiDQu*&kH9Z?)_UZi$sn1<bry z87RY~%>gCR_JP$1D?;H1AsSzPz1^vPQ6gw$WXL<+n=Pc$&5KJUhbb739yix)DsppM zHv(g-Q7&i`vMqL?HXV0{Dv3D=74UCtlwCm^bNXauYpmC3EDA6RiP=212nfi%c<A;B zD7iyauV<O4<GB4oM^n0P{ra7g3Z5ztH>(%Yy0YF;BaD%kOcSZm7d?ZeP2QJ*y0^OE z;8G>3oXZ-Irf^9)>iBD^eq-~6`Utw8Oa6@3;bOWa`mk|QYoeZiQVy%!q%1@Xiao|Q zM!$^xm$8_OB8MouKM6vPCzG$fY_s!R&5%XsHW%!dg%HRnkq8UCDSM^B7seu>H2lLW zT#wJJ$v_Cmya<ty?+WtkY?s}35=;$4UO9U5Z2&V=WIg}NoyCF-y}AmYRh5Ci&G<j# z(GOKfvP}YDm;`cXdHyF0EU7Sbar~F&hiU}Y%u}RSd1c5NWftd&kAyA+ZvVNqoURN+ znd(MtGx=u_1|z<5{p=y_I%jC#UeOBccmLA;1y@Nbk?W60y8-}0OlS0j+~u6@hc;9| zP5;W&w0Na2NGx1!l{AzmAV=#B$k(J!ff^}+QCNkvKm;d4hV_wsr#_a_8&do$8&QV> z60$L|(_mo(I=WH>+OV+i-x21kBmZQD#7jIdrk-yFik6&OVj))(^M75+R1w4ZYq}i# z3Jx;9df)9R^t@L_`d1mB9J&kZ0}?IWh^Ob=5PLyfkMq77A{{OD&W2D`ATCSC4oMbj z&(q%c_(ojy?gl9VwB=I^TSQ)o8ETLsUksU=NVgC7N$H>#7e2E8ucCjWbYI<c^F#e@ zqk%3M1P>*{Q*5!Z0Ro|p-tBj4xw4=Is{j2T-%<zvG!aNqu?<!YgMu$3<PE#|wVH+- z>wiW#3@PFr?amh_sP|v;EnwJ1GmuUDs`;Me;k;1efy4u7KO+P(lW9f$#{#3-hil08 z?>}LM&W<THU_&VGrv{srE@agsvmNM@2+v`A&yQoY@<Dib&o4%vcmy)LeV<g*&RA$f z2R*tjq7QM<KJwSejgI|!*jCU(=!p;0HueXr@f_Dih97;Fhb5kUHVUh?yYYnsfCoI2 z`|VZarSKaL*AdT%OjR;$+NoE(4)lqj-ggr3H?WL;kO&J%QftI+aXAaNnWRS`ZH#^o z4~LY$!U1%zJ3qYTcP=2aJ@4NlDSrhirH|{je4bTX)Y{R0h0Jvl{e$lKlLq|5=Wabm z8kRyD?E=kSZNWSo*VJ*jN5lWsfjwmF-LkgRZSU16a*u5sdNKogBNs5;8M7%eQSN{C z$qL(#djhz&JeCZ8X38G$fgB;M60Ah)!OYoLU6AEAu_|P4WhB;UF>T{p;%_N=AeW5V zyUaxO&r$Ol0MNx=5sVdoxxBKU6+%_vRPn8W%s^@Ax^<qW{^T4ZLKb>oc(>j@)0H)z zD0EAiMc<#+)gHtCRV|?4+mdsJrGUje<Z3&R2m=&+`-@m8&mk`N<dfAFyAnE#6*AZ6 z1$y34ReFg-chK&wo+%7!PUFJ*w-Wp6qUo=T8_)E3^luAo{~<so>GKqNMMPDu`HvIt z`}%(Lgeoksv)?1AUA73ZpP1n!m|f}n%mh%)P3VWx%|tVsAw+Md@^G#kxXRk6o@dvj zxrnFo*N#y;GYu@3DecTgge^0(T!huczj|*;=N{X;4URN^?j`{(kE$Eo*F^0F=}p(> z<)hCg;&*axtDj>dRL1v8`<KLN!aP|~`vy*KKJ^a_umDg@=0{yn)}~TrT4|0p-^`rN zW1)xD_;v3d%V2`><rO!R4Mpv?M+P5OUI#6sw$N=jocH?~<niZfrpd%oMKJ=c)6`P; z30ipEgGjfXT9~+`H&)EWu4+wgGk_%U_*{K~%Bud7xXN#%m~>-)Ajoq1L93(;`&XV2 z$@%kKufVyCxICQk-ob#HA2T_;q23~p-*9qoD(B2qe}Cp+z<71%$3EY&MXAHA-q;39 z8Jy0`K0W;B`E!AK(|((`=KJsH0A1|WU~)B^{|V4@k9rk*kx;Q5xA*z=&kPT>>QB>{ zk^vLi^?hA!_l_ZVYlFLJQGgV!UUu6`bv~|;o1%XiTtwlff3#(|`P2JFq|X7lj4)R^ z>IA2c%0o8Pzp}Kqq-UAw{8e6{uE{(R7#6Ee6gaT14Hz)3CwHuuoRzW|HMAGo4TNtW zD!yR?(Fc1rQ?yZD18YdKq!RAq{Vqj{n#~nEJ165~9H7=!$>#gYV`O+*&%F#zyICQ~ zD73OFR4uAIc7bu5$L6me!_yhEyi^-8$C>vIG!=V{7OuUtEbeOY+t1U@`$YkXv}NtW z4x;1KQ$4)X;`XDn=V8&gq<4d*J@|904V=2!zUVLcCCm$jCFrAEd1Gb^Y4YISGpq$1 zYbYKOy2&hOL+1Cd0fL)QKjgZ!e64(xubnj2OYf*`jW$nmKAwOdiYQtS#n2QcSwO#L zHgTPro~27c2H{12!G_iLzDdAtwuZRIr8|&FWmeQ{qO#NN*=mX_V*QDC{CO&NTV@vC zt4p$zS`P)<%k3Tk?PBx36j_yx-SNy+maWT3o9VIgvFoYAN>R;lf1`uD&Bh}wH4jx@ zD2JB*sH|<$$eYAO$#Th36P+sK2%=Ta8Q|}Xb7=n9^Whr!OxSGET75<*jJOKv8eE*X zKw7+fbedQ-`JW|NwrU^^{@O)valPI5p|et%f{<*E65X%mJoP&L8W!-JXG{?)tm=y4 zzZ2I;lFq(~&HJBU6qtCatTpkEmIRzXO>OWpTVDf$-mwa67#-Nh;ZnU>{l2~aOX-|V z75?VdiQVmyetC`NhyJqY_W*H^@1*=NM#1OTV6%VYg@_v+8{3v6@0NS|lY^6C+r##U zL5RU088M|HBS$BGeQtBH<1N3<W`mjz4BvA2Kdx-<w~$Sa6(s*clj<uSiz%i2<MTnE ze`9;%`llGd$R7pIHOnUtWd-;q7@`f51>;BZJDBi5l}nym)r9_N_l2MvosCM8vFX&- zoX+XV$TKtdplpZ|!H|j3YGbUt4`N4dGy2*0wgnEIn``PO3noV8&vajWO-a*gp0@Ip z8u2eMfq6?ZksQ3)S=RPH5t)`hd3N<Xq_6s|vJP4e!9I&mVs>H$<D)XN@R0r{F8ebI zH5O;%hXoJse&{2)nS!yj>}TIM(f57}{V)nLKgQOe!Y+gROPtnBjvLH>F@1L+Q+_Yj z_I+}*tCOmy!f(kNB}bJTj`xR%Vf()4IyR0^i~OB}#nn00&$H*=$_rvU+|DTZfEll_ z+MOJ;QLL0~;(`O2bB>G{yvUCmG)ej<wffG-HYozVUrOt;Z+To8+xjjp4%unByl|Os zHPcP3jFPp<2`2)lI-OE?VrX2}3}WWj?Ds`>^gM<(7)4?QOA=X+ZoVm>Y>*tPHaEGA z>e|oo4K<B%8J$WxQxo7*>Ba;2Lpdd;L^B8Z&W7}6M9Z^ckGtFg{EmwlFB#l?p@97V d_A$!Fh@EA1-a2yU5WT8NT2kS8iG)$m{|5uK)Q|uG literal 0 HcmV?d00001 From 79ea2e56d57ed59d187e7f06f84cedf7d99e3360 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 18:05:46 +0900 Subject: [PATCH 140/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98=20?= =?UTF-8?q?=EB=B6=84=EC=84=9D,=20RDII=20=EB=B6=84=EC=84=9D,=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=97=B0=EC=9B=94?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-base-layout)/ii/BaseLayout.tsx | 48 +++++++++--- .../(with-base-layout)/ii/irsetting/page.tsx | 65 +++++++++------- .../app/(with-base-layout)/ii/rdii/page.tsx | 75 ++++++++----------- .../(with-base-layout)/ii/rdiiResult/page.tsx | 47 ++++++++---- .../app/(with-base-layout)/ii/result/page.tsx | 47 ++++++++---- 5 files changed, 174 insertions(+), 108 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index f9596613f..01503e829 100644 --- a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -2,7 +2,7 @@ import { getData } from '@/components/lib/api' import ContentLayout from '@/components/ui/contentLayout' import { GovSidoSigunguSearchForm } from '@/components/ui/govSidoSigunguSearchForm' -import { DatePicker, Form, SearchFormRight, SelectBox } from '@common/business_components/ui' +import { DatePicker, DateMonthPicker, Form, SearchFormRight, SelectBox } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { SelectBox2 } from '@common/business_components/ui/select/index-2' import { Button, Label } from '@common/components/ui' @@ -51,8 +51,10 @@ type BaseLayout = { onSwageTreatmentPlantChange?: (value: string | number) => void; selectedSwageProcessingZone?: string | number; onSwageProcessingZoneChange?: (value: string | number) => void; - aplcnYm?: Date - setAplcnYm?: (aplcnYm: Date | undefined) => void; + aplcnYmFrom?: string + setAplcnYmFrom?: (aplcnYmFrom: string) => void; + aplcnYmTo?: string + setAplcnYmTo?: (aplcnYmTo: string) => void; isLoading?: boolean; // Excel 다운로드 관련 props 추가 onExcelDownload?: () => void; @@ -89,8 +91,10 @@ const BaseLayout = ({ onSwageTreatmentPlantChange, selectedSwageProcessingZone, onSwageProcessingZoneChange, - aplcnYm, - setAplcnYm, + aplcnYmFrom, + setAplcnYmFrom, + aplcnYmTo, + setAplcnYmTo, isLoading, // Excel 다운로드 관련 props 추가 onExcelDownload, @@ -216,13 +220,37 @@ const BaseLayout = ({ {showDatePicker && ( // showDatePicker 값에 따라 DatePicker 렌더링 <> <Label className="ml-4 w-20 text-xl text-gray-600 whitespace-nowrap">분석기간</Label> - <DatePicker - mode={"single"} + <DateMonthPicker field={{ - value: aplcnYm ?? new Date(), - onChange: setAplcnYm ?? ((date: Date | undefined) => console.log("DatePicker onChange:", date)) + value: aplcnYmFrom || (() => { // aplcnYm이 없으면 현재 연월을 기본값으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), // yyyyMM 형식 + onChange: (value: string) => { + setAplcnYmFrom?.(value); // string 값을 직접 전달 + } }} - selectClass="ml-5 date-picker-trigger" /> + selectClass="ml-5 w-[100px]" + startYear={1900} // 시작 연도 설정 + /> + <span className="font-semibold text-xl mx-2">~</span> + <DateMonthPicker + field={{ + value: aplcnYmTo || (() => { // aplcnYm이 없으면 현재 연월을 기본값으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), // yyyyMM 형식 + onChange: (value: string) => { + setAplcnYmTo?.(value); // string 값을 직접 전달 + } + }} + selectClass="ml-5 w-[100px]" + startYear={1900} // 시작 연도 설정 + /> </> )} <GovSidoSigunguSearchForm diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 79b326353..edee9b4ce 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -2,7 +2,7 @@ import { postData } from '@/components/lib/api' import FileUploadForm from '@/components/ui/fileUploadForm' import FormSection from '@/components/ui/formSection' -import { DatePicker, filePicked } from '@common/business_components/ui' +import { DateMonthPicker, filePicked } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { Input } from '@common/components/ui' import { zodResolver } from '@hookform/resolvers/zod' @@ -59,7 +59,13 @@ const IrSetting = () => { initialFileInfo // 3: 유량자료 등록 ]); - const [selectedDate, setSelectedDate] = useState(new Date()); + // selectedDate를 yyyyMM 문자열 형식으로 변경 + const [selectedDate, setSelectedDate] = useState(() => { + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + }); const [input1, setInput1] = useState(''); const [input2, setInput2] = useState(''); const [select1, setSelect1] = useState('0'); // 환경청코드 @@ -87,7 +93,11 @@ const IrSetting = () => { initialFileInfo, initialFileInfo ]); - setSelectedDate(new Date()); // 날짜 선택 초기화 + // selectedDate를 현재 연월로 초기화 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + setSelectedDate(`${year}${month}`); setInput1(''); // 입력 필드 초기화 setInput2(''); // 입력 필드 초기화 setSelect1('0'); // 선택 필드 초기화 @@ -138,22 +148,6 @@ const IrSetting = () => { const handleAnalysisClick = async () => { setIsLoadingResult(true); // 로딩 상태 시작 - // 오수전환율 값 0 ~ 1 사이인지 검증 - if (input1 === '' || input1 === null || input1 === undefined) { - setIsLoadingResult(false); - console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); - alert('오수전환율을 입력해주세요.'); - return; - } - - const numericInput1 = parseFloat(input1); - if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { - setIsLoadingResult(false); - console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); - alert('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); - return; - } - console.log(uploadedFilesData); const file1 = uploadedFilesData[0]; // 오수관망도 const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 @@ -173,6 +167,22 @@ const IrSetting = () => { return; } + // 오수전환율 값 0 ~ 1 사이인지 검증 + if (input1 === '' || input1 === null || input1 === undefined) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율을 입력해주세요.'); + return; + } + + const numericInput1 = parseFloat(input1); + if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + return; + } + type MatchingResult = { anlsSn: number; mhlMngNo: string; rcptrNo: string; }; type TimePattern = { hrId: number; rt?: number | null | undefined; }; type FlowRate = { pplMngNo: string; mtrngDt: string; oilq?: number | null | undefined; }; @@ -236,7 +246,7 @@ const IrSetting = () => { swtrmtZoneCd: (select5 && select5 !== '0' && select5 !== 0) ? select5.toString().split('.').pop() || null // '.'으로 split해서 마지막 부분만 사용 : null, // 하수처리구역코드 (선택값) - aplcnYm: new Date(selectedDate).toISOString().substring(0, 7).replace("-", ""), // 적용연월 + aplcnYm: selectedDate, // 적용연월 drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환) anlsInfo: input2, // 분석정보 atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) @@ -318,18 +328,15 @@ const IrSetting = () => { form={form} titleNm='▷ 상수사용량 적용월'> {/* 연월 선택 라이브러리로 수정 필요 */} - <DatePicker - mode={"single"} + <DateMonthPicker field={{ - value: selectedDate, // 현재 페이지의 selectedDate 상태 사용 - onChange: (date: Date | undefined) => { - if (date) { - setSelectedDate(date); - form.setValue('inputdate', date, { shouldValidate: true }); - } + value: selectedDate, // yyyyMM 형식 + onChange: (value: string) => { + setSelectedDate(value); } }} - selectClass="ml-5 date-picker-trigger" // date-picker.css의 스타일 적용 + selectClass="ml-5 w-[150px]" + startYear={1900} // 시작 연도 설정 /> </FormSection> <FormSection diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 536d15399..801457772 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -4,7 +4,7 @@ import { postData } from '@/components/lib/api' import FileUploadForm from "@/components/ui/fileUploadForm" import FormSection from "@/components/ui/formSection" import BaseLayout from "../BaseLayout" -import { DatePicker, filePicked } from "@common/business_components/ui" +import { DateMonthPicker, filePicked } from "@common/business_components/ui" import { Input } from "@common/components/ui" import { zodResolver } from "@hookform/resolvers/zod" import { Label } from '@radix-ui/react-label' @@ -42,7 +42,7 @@ const formSchema = z.object({ rate: z.string(), // 오수전환율 // rain: z.instanceof(File).optional(), // 강우자료 analysisInfo: z.string().optional(), // 분석 정보 - date: z.date(), + date: z.string(), // Date 객체에서 string(yyyyMM 형식)으로 변경 // date: z.coerce.date(), }) // zod 스키마 타입 추론 @@ -72,7 +72,12 @@ const defaultFormValues: FormSchemaType = { rate: "0.8", // 문자열로 기본값 설정 // rainFile: undefined, analysisInfo: "test 분석정보", - date: new Date(), + date: (() => { // 현재 연월을 yyyyMM 형식으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), }; // 각 파일 업로드 폼의 데이터를 저장할 인터페이스 정의 @@ -108,7 +113,6 @@ export default function RTKForm() { const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장 (swageTmplntCd) const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역 (swtrmtZoneCd) - // form 인스턴스 생성 const form = useForm<FormSchemaType>({ resolver: zodResolver(formSchema), @@ -163,23 +167,6 @@ export default function RTKForm() { // 침입수 분석 실행 버튼 클릭 핸들러 const handleAnalysisClick = async () => { setIsLoadingResult(true); // 로딩 상태 시작 - - // 오수전환율 값 0 ~ 1 사이인지 검증 - const rateValue = form.getValues().rate; - if (rateValue === '' || rateValue === null || rateValue === undefined) { - setIsLoadingResult(false); - console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); - alert('오수전환율을 입력해주세요.'); - return; - } - - const numericInput1 = parseFloat(rateValue); - if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { - setIsLoadingResult(false); - console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); - alert('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); - return; - } const formData = form.getValues(); console.log(uploadedFilesData); @@ -198,6 +185,23 @@ export default function RTKForm() { return; } + // 오수전환율 값 0 ~ 1 사이인지 검증 + const rateValue = form.getValues().rate; + if (rateValue === '' || rateValue === null || rateValue === undefined) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율을 입력해주세요.'); + return; + } + + const numericInput1 = parseFloat(rateValue); + if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { + setIsLoadingResult(false); + console.error('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + alert('오수전환율은 0에서 1 사이의 값으로 입력해야 합니다.'); + return; + } + const filePickers = [ { file: file2, parser: excelToMatchingResultData }, { file: file3, parser: excelToRainData }, @@ -241,7 +245,7 @@ export default function RTKForm() { // 새로운 JSON 데이터 생성 const combinedAnalysisData = { enoCd: (select1 && select1 !== '0') ? select1.toString() : null, // 환경청코드 (선택값) - aplcnYm: new Date(formData.date).toISOString().substring(0, 7).replace("-", ""), // 적용연월 (YYYYMM 형식) + aplcnYm: formData.date, // 적용연월 (YYYYMM 형식) ctpvCd: (select2 && select2 !== '0') ? select2.toString() : null, // 시도코드 (선택값) sggCd: (select3.val && select3.val !== '0') ? select3.val.toString() : null, // 시군구코드 (선택값) swageTmplntCd: (select4 && select4 !== '0' && select4 !== 0) @@ -448,30 +452,15 @@ export default function RTKForm() { /> </FormSection> <FormSection name='date' form={form} titleNm='○ 상수사용량 적용월'> - {/* 연월 선택 라이브러리로 수정 필요 */} - {/* <DatePicker - selected={form.watch("date")} - onSelect={(date: Date | undefined) => { - if (date) { - form.setValue("date", date, { shouldValidate: true }); - } - }} - mode={"single"} - className="ml-5" - /> */} - <DatePicker - mode={"single"} // mode는 DayPickerSingleProps에서 오므로 그대로 사용 가능 + <DateMonthPicker field={{ - value: form.watch("date"), // react-hook-form의 "date" 필드 값 사용 - onChange: (date: Date | undefined) => { - if (date) { - form.setValue("date", date, { shouldValidate: true }); - } + value: form.watch("date"), // form의 date 값을 직접 사용 + onChange: (value: string) => { + form.setValue("date", value, { shouldValidate: true }); // form의 date 필드에 직접 설정 } }} - // className을 직접 사용하거나, DatePicker 내부에서 selectClass를 처리하도록 수정 필요 - // 여기서는 DatePicker의 selectClass prop을 사용하고, date-picker.css의 스타일을 적용 - selectClass="ml-5 date-picker-trigger" + selectClass="ml-5 w-[200px]" + startYear={1900} // 시작 연도 설정 /> </FormSection> <FormSection name='rate' form={form} titleNm='○ 분석 정보'> diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index f2390cc83..1cf78f6f2 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -18,7 +18,18 @@ const formSchema = z.object({ }).default({ val: '0', text: '전체' }), swageTmplntCd: z.string().default('0'), // 하수처리장 swtrmtZoneCd: z.string().default('0'), // 하수처리구역 - aplcnYm: z.date().default(new Date()), // 분석일자 (DatePicker와 연동) + aplcnYmFrom: z.string().default(() => { // Date에서 string(yyyyMM 형식)으로 변경 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + }), // 분석기간 시작연월 + aplcnYmTo: z.string().default(() => { // Date에서 string(yyyyMM 형식)으로 변경 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + }), // 분석기간 종료연월 }) type ResultFormValues = z.infer<typeof formSchema> @@ -49,7 +60,18 @@ const Result = () => { sggCd: { val: '0', text: '전체' }, swageTmplntCd: '0', swtrmtZoneCd: '0', - aplcnYm: new Date(), + aplcnYmFrom: (() => { // 현재 연월을 yyyyMM 형식으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), + aplcnYmTo: (() => { // 현재 연월을 yyyyMM 형식으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), } }) @@ -71,7 +93,8 @@ const Result = () => { if (customFormValues) { inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm, + "aplcnYmFrom": formValues.aplcnYmFrom, + "aplcnYmTo": formValues.aplcnYmTo, "enoCd": formValues.enoCd, "ctpvCd": formValues.ctpvCd, "sggCd": formValues.sggCd, @@ -79,7 +102,8 @@ const Result = () => { }; } else { inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm ? formValues.aplcnYm.toISOString().substring(0, 7).replace("-", "") : null, + "aplcnYmFrom": formValues.aplcnYmFrom && formValues.aplcnYmFrom !== '' ? formValues.aplcnYmFrom : null, + "aplcnYmTo": formValues.aplcnYmTo && formValues.aplcnYmTo !== '' ? formValues.aplcnYmTo : null, "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, @@ -208,7 +232,8 @@ const Result = () => { // 삭제 후 테이블 새로고침을 위해 재검색 const customFormValues: Partial<ResultFormValues> = { - aplcnYm: selectedRowData.aplcnYm || null, + aplcnYmFrom: selectedRowData.aplcnYmFrom || null, + aplcnYmTo: selectedRowData.aplcnYmTo || null, enoCd: selectedRowData.enoCd || null, ctpvCd: selectedRowData.ctpvCd || null, sggCd: selectedRowData.sggCd || null, @@ -251,14 +276,10 @@ const Result = () => { onSwageTreatmentPlantChange={(val) => form.setValue("swageTmplntCd", String(val))} selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} - aplcnYm={form.watch("aplcnYm")} - setAplcnYm={(val) => { - if (val instanceof Date) { - form.setValue("aplcnYm", val) - } else if (val) { - form.setValue("aplcnYm", new Date(val)) - } - }} + aplcnYmFrom={form.watch("aplcnYmFrom")} + setAplcnYmFrom={(val: string) => {form.setValue("aplcnYmFrom", val)}} + aplcnYmTo={form.watch("aplcnYmTo")} + setAplcnYmTo={(val: string) => {form.setValue("aplcnYmTo", val)}} isLoading={isLoadingResult} // Excel 다운로드 핸들러 추가 onExcelDownload={handleExcelDownload} diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index b35cd5f21..98440398a 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -18,7 +18,18 @@ const formSchema = z.object({ }).default({ val: '0', text: '전체' }), swageTmplntCd: z.string().default('0'), // 하수처리장 swtrmtZoneCd: z.string().default('0'), // 하수처리구역 - aplcnYm: z.date().default(new Date()), // 분석일자 (DatePicker와 연동) + aplcnYmFrom: z.string().default(() => { // Date에서 string(yyyyMM 형식)으로 변경 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + }), // 분석기간 시작연월 + aplcnYmTo: z.string().default(() => { // Date에서 string(yyyyMM 형식)으로 변경 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + }), // 분석기간 종료연월 }) type ResultFormValues = z.infer<typeof formSchema> @@ -47,7 +58,18 @@ const Result = () => { sggCd: { val: '0', text: '전체' }, swageTmplntCd: '0', swtrmtZoneCd: '0', - aplcnYm: new Date(), + aplcnYmFrom: (() => { // 현재 연월을 yyyyMM 형식으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), + aplcnYmTo: (() => { // 현재 연월을 yyyyMM 형식으로 설정 + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + return `${year}${month}`; + })(), } }) @@ -69,7 +91,8 @@ const Result = () => { if (customFormValues) { inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm, + "aplcnYmFrom": formValues.aplcnYmFrom, + "aplcnYmTo": formValues.aplcnYmTo, "enoCd": formValues.enoCd, "ctpvCd": formValues.ctpvCd, "sggCd": formValues.sggCd, @@ -77,7 +100,8 @@ const Result = () => { }; } else { inftwtAnlsSearchDto = { - "aplcnYm": formValues.aplcnYm ? formValues.aplcnYm.toISOString().substring(0, 7).replace("-", "") : null, + "aplcnYmFrom": formValues.aplcnYmFrom && formValues.aplcnYmFrom !== '' ? formValues.aplcnYmFrom : null, + "aplcnYmTo": formValues.aplcnYmTo && formValues.aplcnYmTo !== '' ? formValues.aplcnYmTo : null, "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, @@ -208,7 +232,8 @@ const Result = () => { // 삭제 후 테이블 새로고침을 위해 재검색 const customFormValues: Partial<ResultFormValues> = { - aplcnYm: selectedRowData.aplcnYm || null, + aplcnYmFrom: selectedRowData.aplcnYmFrom || null, + aplcnYmTo: selectedRowData.aplcnYmTo || null, enoCd: selectedRowData.enoCd || null, ctpvCd: selectedRowData.ctpvCd || null, sggCd: selectedRowData.sggCd || null, @@ -251,14 +276,10 @@ const Result = () => { onSwageTreatmentPlantChange={(val) => form.setValue("swageTmplntCd", String(val))} selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} - aplcnYm={form.watch("aplcnYm")} - setAplcnYm={(val) => { - if (val instanceof Date) { - form.setValue("aplcnYm", val) - } else if (val) { - form.setValue("aplcnYm", new Date(val)) - } - }} + aplcnYmFrom={form.watch("aplcnYmFrom")} + setAplcnYmFrom={(val: string) => {form.setValue("aplcnYmFrom", val)}} + aplcnYmTo={form.watch("aplcnYmTo")} + setAplcnYmTo={(val: string) => {form.setValue("aplcnYmTo", val)}} isLoading={isLoadingResult} // 로딩 상태 전달 // Excel 다운로드 핸들러 추가 onExcelDownload={handleExcelDownload} From c9138b72cacb72e09db39d32f072f6a7e5adfe3b Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Thu, 3 Jul 2025 18:56:25 +0900 Subject: [PATCH 141/259] =?UTF-8?q?=EC=B0=A8=ED=8A=B8=20=EC=A0=9C=EB=AA=A9?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/chart/BarChart.tsx | 6 ++++++ .../business_components/src/ui/chart/LineBarChart.tsx | 4 ++-- .../common/business_components/src/ui/chart/LineChart.tsx | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index a7282830d..994feb3b3 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -110,6 +110,12 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle=' axisLine={true} fontSize={12} fontWeight={500} + tickFormatter={(value) => { + // 소수점이 있는 경우 소수점을 유지하고 천단위 콤마 추가 + return value.toString().includes('.') + ? value.toLocaleString('en-US', { minimumFractionDigits: 0, maximumFractionDigits: 2 }) + : value.toLocaleString(); + }} label={yFieldText ? { value: yFieldText, className:"text-[13px] font-bold", position: 'insideLeft', angle: -90, offset: -24, orientation: "left" } : undefined} /> <ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/> diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index 8c7202104..11984cc14 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -127,7 +127,7 @@ export default function LineBarchart({ className="text-[12px] font-bold" tickCount={6} orientation="left" - domain={[0, Math.ceil(lineMaxValue * 1)]} + tickFormatter={(value) => value.toLocaleString()} label={{ value: yFieldText, angle: -90, position: 'insideLeft' }} />} {/* 오른쪽 Y축: barVal */} @@ -136,7 +136,7 @@ export default function LineBarchart({ className="text-[12px] font-bold" tickCount={6} orientation="right" - domain={[0, Math.ceil(barMaxValue * 1)]} + tickFormatter={(value) => value.toLocaleString()} label={{ value: yFieldText2, angle: -90, position: 'insideRight' }} reversed={true} />} diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 28b4ceabf..6c1b6e7bd 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -193,7 +193,7 @@ export default function Linechart({ > <CartesianGrid vertical={false} /> <XAxis dataKey="label" fontSize="8px" fontWeight="bold" /> - <YAxis yAxisId="left" className="text-[12px] font-bold" domain={[0, Math.ceil(lineMaxValue * 1.1)]} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> + <YAxis yAxisId="left" className="text-[12px] font-bold" tickFormatter={(value) => value.toLocaleString()} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> <Tooltip content={<CustomTooltip />} /> {showLegend && <Legend content={CustomLegend as ContentType}/>} {Object.keys(chartData).map((key) => { From b20948fcfe67039f4e02fa04e3945ad08dd93431 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 3 Jul 2025 19:46:11 +0900 Subject: [PATCH 142/259] =?UTF-8?q?=EC=9E=A0=EC=9E=AC=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=B2=98=20=EC=97=91=EC=85=80=20=EB=93=B1=EB=A1=9D=20=EC=8B=9C?= =?UTF-8?q?=20=EB=A1=9C=EB=94=A9=EB=B0=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wr/app/matMng/coMng/ldrmntCoSttn/page.tsx | 7 +- .../app/store/matDmd/ldrmntCoSttn/index.tsx | 64 +++++++++++++------ .../coReg/coRegExcel/coRegExcelModal.tsx | 39 +++++------ 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx index eb43b29bf..e33bcc265 100644 --- a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx @@ -28,8 +28,10 @@ import { type SelectDataType } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; import { Button } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; +import { Toaster } from "react-hot-toast"; export default function LdrmntCoSttn() { const { code, ldrmnt, ldrmntInit, ldrmntSearch, } = useWrStore( @@ -273,7 +275,7 @@ export default function LdrmntCoSttn() { <div className="overflow-x-auto"> <ListDiv className="min-w-max"> <UiTable - headName={[]} + headName={undefined} tableData={bdstTable || []} headlist={ldrmntHeadListExport} pageSize={20} @@ -299,8 +301,9 @@ export default function LdrmntCoSttn() { setIsExcelOpen({ isModal: !isExcelOpen.isModal }) }} bodyClass={"w-[40vw] max-w-none"} - body={<CoRegExcel />} + body={<CoRegExcel isModal={(isOpen) => setIsExcelOpen({ isModal: isOpen })} />} /> + <Toaster position="top-center"></Toaster> </div> diff --git a/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx b/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx index 6a5f18247..289ced6e1 100644 --- a/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx +++ b/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx @@ -20,6 +20,7 @@ export type ldrmntState = { excelList: ExcelType[]; isInit: boolean; ldrmntRes: customLdrmnt[]; + isLoading: boolean; }; }; @@ -35,6 +36,7 @@ type ldrmntActions = { ldrmntSearch: (page: number, sggCd: string, total: string, coNm: string) => void; ldrmntUpdate: (ldrmntRes: customLdrmnt) => void; ldrmntDelete: () => void; + loadingOpen: (isOpen: boolean) => void }; export type ldrmntType = ldrmntState & ldrmntActions; @@ -46,6 +48,7 @@ export const ldrmntStateExport: ldrmntState = { excelList: [], isInit: false, ldrmntRes: ldrmntRes, + isLoading: false, }, }; @@ -75,31 +78,30 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( console.log(e) } }, + loadingOpen: (isOpen) => { + return set((state: ldrmntState) => { + return { + ...state, + ldrmnt: { + ...state.ldrmnt, + isLoading: isOpen, + }, + }; + }); + }, ldrmntRegData: async (data) => { - try { - const response = await postFectch( - "/reuseFc/request/temp", - data, - fetchType.WR - ); + await deleteFectch( + `/reuseFc/request/temp`, + ); - console.log('response ', response) + const response = await postFectch( + "/reuseFc/request/temp", + data, + fetchType.WR + ); - if (response.status === 200) { - ToastFormUi({ - body: "잠재수요처 등록이 완료되었습니다. ", - title: "잠재수요처 등록", - }); + console.log('response ', response) - } - } catch (e) { - console.log(e) - ToastFormUi({ - body: "잠재수요처 등록이 실패하였습니다. ", - title: "잠재수요처 등록", - }); - - } }, ldrmntSearch: async (page: number, total: string, sggCd: string, coNm: string) => { let searchUrl = ""; @@ -111,6 +113,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( searchUrl = `/reuseFc/request/temp/${page}/${total}/${sggCd}`; } } + try { const ldrmntRes = await getFetch( fetchType.WR, @@ -178,11 +181,30 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( }, ldrmntDelete: async () => { try { + set((state: ldrmntState) => { + return { + ...state, + ldrmnt: { + ...state.ldrmnt, + isLoading: true, + }, + }; + }); const response = await deleteFectch( `/reuseFc/request/temp`, ); } catch (error) { + console.log("error", error) + set((state: ldrmntState) => { + return { + ...state, + ldrmnt: { + ...state.ldrmnt, + isLoading: false, + }, + }; + }); console.error("Error ldrmntDelete:", error); } }, diff --git a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx index 89f15a3cc..6f6afe186 100644 --- a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx +++ b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx @@ -4,32 +4,36 @@ import type { customLdrmnt } from "@/app/store/matDmd/ldrmntCoSttn"; import { names } from "@/app/store/matDmd/ldrmntCoSttn/excel"; import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui"; import { Form, FormField } from "@common/business_components/ui/form"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; import { Button, Progress } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; import type { z } from "zod"; -export default function CoRegExcel() { - - +export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => void }) { + const { ldrmnt,loadingOpen } = useWrStore((state) => state); + const { isLoading } = ldrmnt; const form = useForm<z.infer<typeof coRegExcel>>({ resolver: zodResolver(coRegExcel), }); const { ldrmntRegData, ldrmntDelete } = useWrStore((state) => state); const [excelData, setExcelData] = useState<customLdrmnt[]>(); - const [file, setFiles] = useState<File | undefined>(); + useEffect(() => { + console.log("ldrmnt", ldrmnt) + }, [ldrmnt]) + const onSubmit = (values: z.infer<typeof coRegExcel>) => { - ldrmntDelete(); + loadingOpen(true); if (file) { - filePicked(file, 0).then((res) => { - //TODO:loading + filePicked(file, 0).then(async (res) => { + try { let array: { [key: string]: string | number }[] = [] - let isError = false; if (Array.isArray(res)) { res.some((item, index) => { let object: { [key: string]: string | number } = {} @@ -43,26 +47,24 @@ export default function CoRegExcel() { } return false; }) - if (isError === true) - return true; + array.push(object) - if (index != 0 && index % 5000 == 0) { - ldrmntRegData(array); - array = [] - array.length = 0; - } return false; }) } - if (isError === false) - ldrmntRegData(array); + await ldrmntRegData(array); + isModal(false); + loadingOpen(false); + toast.success(`잠재수요처 등록이 완료되었습니다.`); } catch (e) { console.log(e) + loadingOpen(false); alert(e) return true; } - + }).catch((e)=>{ + console.log("file", e); }); }; } @@ -70,6 +72,7 @@ export default function CoRegExcel() { return ( <> <div> + <LoadingOverlay isLoading={isLoading}></LoadingOverlay> <Form {...form}> <form onSubmit={form.handleSubmit(onSubmit)}> <div> From 01ebab4a94be128d2919b44ef5d2bfe5b721759e Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Thu, 3 Jul 2025 20:21:01 +0900 Subject: [PATCH 143/259] =?UTF-8?q?=EB=A1=9C=EB=94=A9=EB=B0=94=20import=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/index.ts b/packages/common/business_components/src/ui/index.ts index fd1e6fe9e..06c641259 100644 --- a/packages/common/business_components/src/ui/index.ts +++ b/packages/common/business_components/src/ui/index.ts @@ -21,4 +21,5 @@ export * from "./table_div"; export * from "./title"; export * from "./sdmInsertForm"; export * from "./popover_ui"; -export * from "./date_month_picker"; \ No newline at end of file +export * from "./date_month_picker"; +export * from "./loadingBar"; \ No newline at end of file From 2cc8d5209ceda52f21c5037cef86a593ccdb9c66 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Thu, 3 Jul 2025 20:22:19 +0900 Subject: [PATCH 144/259] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EB=8C=80=EC=9E=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 18 +- apps/wr/app/matMng/coMng/coSttn/page.tsx | 9 +- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 190 +++++++++++++----- .../wr/app/store/matDmd/coMatRvw/headList.tsx | 4 +- apps/wr/app/store/matDmd/coMatRvw/index.tsx | 6 + apps/wr/app/store/matDmd/coMatRvw/type.tsx | 2 +- apps/wr/app/store/matDmd/coSttn/headList.tsx | 5 + apps/wr/app/store/matDmd/coSttn/index.tsx | 2 +- .../prfmncReg/chkgdnReg/rainChkgdn/excel.tsx | 6 +- .../chkgdnReg/rainChkgdn/headList.tsx | 16 +- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 164 +++++++++++---- .../chkgdnReg/rswrtChkgdn/headList.tsx | 20 +- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 182 ++++++++++++----- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 4 +- .../chkgdnSttn/rswtChkgdnSttn/headList.tsx | 2 +- .../fcltSttn/rainSttn/headList.tsx | 4 +- apps/wr/components/lib/api/index.ts | 23 +++ apps/wr/components/lib/func/TableData.tsx | 43 ++-- apps/wr/components/lib/func/commom.tsx | 42 ++-- .../ui/form/coMat/conCostForm/conCostForm.tsx | 6 +- .../ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx | 21 +- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 18 +- .../guideDetailTable/guideDetailTable.tsx | 5 +- .../chkgdTable/rainChkgd/rainChkgdTable.tsx | 25 ++- .../chkgdTable/rswtChkgd/rswtChkgdTable.tsx | 14 +- 25 files changed, 606 insertions(+), 225 deletions(-) diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index c1e601320..5d4592ad5 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -1,5 +1,4 @@ "use client"; - import { useWrStore } from "@/app/store"; import { DmdCoReqSchema, @@ -9,6 +8,7 @@ import { } from "@/app/store/matDmd/coMatRvw/type"; import { formH1Class, formTableName } from "@/components/lib/class/comClass"; import { + formatPhoneNumber, getCity, getdmdMatFlag, tableData, @@ -112,18 +112,20 @@ export default function CoMatRvw() { }, [form.watch("useUsgCd")]); useEffect(() => { - if (coMatRvwRes.length > 0) { + if (coMatRvwRes&&coMatRvwRes.length > 0) { const data = coMatRvwRes?.map((item, index) => { let flag = ""; - flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??""); + + flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg||undefined); + return { ...item, ctpvCd: item.demandCo?.ctpvCd, sggCd: item.demandCo?.sggCd, dmdCoNm: item.demandCo?.dmdCoNm, daddr: item.demandCo?.daddr, - telno: item.demandCo?.telno, - regDt: moment(item?.demandCo?.regDt).format("YYYY-MM-DD"), + telno: formatPhoneNumber(item.demandCo?.telno||'') , + splyFcltFlg: flag, }; }); @@ -181,7 +183,7 @@ export default function CoMatRvw() { <div className="col-span-7 w-full"> <div className="flex flex-row items-center"> <Label className="text-xl text-gray-600 mx-6"> - 하수 재이용년도 + 수요신청년도 </Label> <SelectBox className="h-full w-32 text-2xl" @@ -269,7 +271,7 @@ export default function CoMatRvw() { ></UiTable> </ListDiv> <hr /> - <ScrollArea className="h-[49vh]"> + {/* <ScrollArea className="h-[49vh]"> */} <ListDiv> <h3 className="mt-4 ml-2 text-2xl font-medium text-label"> 수요신청 상세현황 @@ -662,7 +664,7 @@ export default function CoMatRvw() { </Form> <ConCostForm form={form} type={"mat"} /> </ListDiv> - </ScrollArea> + {/* </ScrollArea> */} </div> </div> </ContentsDiv> diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index 181a5d82f..9b682a2aa 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -26,6 +26,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import SdmInsertForm from "@common/business_components/ui/sdmInsertForm"; import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import { Button } from "@common/components/ui"; +import moment from "moment"; import { useCallback, useEffect, useState } from "react"; import toast, { Toaster } from "react-hot-toast"; @@ -83,6 +84,10 @@ export default function CoSttn() { const data = tableData(coSttnRes, { code }); const chData = data.map((item: any) => ({ ...item, + regDt: moment(item.regDt).format("YYYY-MM-DD") + + + })); // .filter((item: any) => item !== undefined); setBdstTable(chData); @@ -182,7 +187,7 @@ export default function CoSttn() { onClick={() => { /* 저장 로직 */ if (!upadateData) { - <ToastFormUi body={"수요처 변경을 원하는 행을 선택해주세요"} title={"수요처관리"}></ToastFormUi>; + toast.error("수요처 변경을 원하는 행을 선택해주세요") }else{ setIsDmdModal({ ...isDmdModal, @@ -190,7 +195,7 @@ export default function CoSttn() { } }} > - 저장 + 수정 </Button> <Button size={"sm"} diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 88a0de300..033d3a23d 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -1,10 +1,14 @@ "use client"; import { useWrStore } from "@/app/store"; -import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import type { - rswtChkZodType, - rswtrChkDetailsZodType, +import { + commonCd, + rainPageSize, + type rainChkZodType, +} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { + rswtPageSize, + type rswtrChkDetailsZodType, } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { excelArrayDownload, @@ -15,6 +19,7 @@ import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel"; import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal"; import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable"; import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable"; +import { SearchInput } from "@common/business_components"; import { ContentsDiv, SearchDiv, @@ -25,9 +30,16 @@ import { UiModal, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; import { Button, Label } from "@common/components/ui"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@common/components/ui/tooltip"; import { useCallback, useEffect, useState } from "react"; -import { Toaster } from "react-hot-toast"; +import toast, { Toaster } from "react-hot-toast"; export default function Page() { const { @@ -39,8 +51,10 @@ export default function Page() { rainChkDelete, rainChkExcelDownload, rainChkHeadChange, + rainChkNmSearch, isRainSttn, rswtChkgdnInit, + rswtChkNmSearch, rswtChkPolInit, rswtChkDetilsUpdate, rswtChkDelete, @@ -57,39 +71,84 @@ export default function Page() { rswtrChkDetailsZodType[] >([]); const [deleteIdx, setDeleteIdx] = useState<number[]>([]); - const [pageNation, setPageNation] = useState(1); + const [rainPageNation, setRainPageNation] = useState(1); + const [rswtPageNation, setRswtPageNation] = useState(1); + const [fcltNm, setFcltNm] = useState<string>(""); const [selFcltDiv, setSelFcltDiv] = useState("RNB"); const [isModal, setIsModal] = useState({ open: false, data: {}, }); - const cellClick = () => { - if (searchYear) - if (selFcltDiv === "RNB") { - rainChkInit("1", "20", searchYear, "0"); - } else { - rswtChkgdnInit("1", "20", searchYear, "0"); - } - }; - const [searchYear, setSearchYear] = useState<string>( String(new Date().getFullYear()) ); + const cellClick = () => { + if (searchYear) + if (selFcltDiv === "RNB") { + if (fcltNm) { + rainChkNmSearch( + rainPageNation, + rainPageSize, + searchYear, + commonCd, + fcltNm + ); + } else { + rainChkInit(rainPageNation, rainPageSize, searchYear, commonCd); + } + } else { + if (fcltNm) { + rswtChkNmSearch( + rainPageNation, + rainPageSize, + searchYear, + commonCd, + fcltNm + ); + } else { + rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd); + } + } + }; + const rainPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRainPageNation(pageNo); + rainChkInit(pageNo, rainPageSize, searchYear, commonCd); + } + }; + const rswtPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRswtPageNation(pageNo); + rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd); + } + }; useEffect(() => { if (!rainChkgdn.isInit) { - rainChkInit("1", "20", new Date().getFullYear().toString(), "0"); + rainChkInit( + 1, + rainPageSize, + new Date().getFullYear().toString(), + commonCd + ); isRainSttn(false); setIsModal({ data: {}, open: false }); setIsRegExcel(false); } + }, [rainChkgdn.isInit, rainChkInit, rainPageSize]); + useEffect(() => { if (!rswtChkgdn.isInit) { - rswtChkgdnInit("1", "20", new Date().getFullYear().toString(), "0"); + rswtChkgdnInit( + 1, + rswtPageSize, + new Date().getFullYear().toString(), + commonCd + ); setIsModal({ data: {}, open: false }); setIsRegExcel(false); } - }, [rainChkgdn.isInit, rainChkInit]); + }, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize]); useEffect(() => { if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) { @@ -133,8 +192,8 @@ export default function Page() { ); useEffect(() => { - //rainChkgdn.isSttn = false; - //rswtChkgdn.isSttn = false; + rainChkgdn.isSttn = false; + rswtChkgdn.isSttn = false; if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) { rainChkHeadChange({ rainChkgdn }, true); rswtChkHeadChange({ rswtChkgdn }, true); @@ -152,9 +211,17 @@ export default function Page() { }; const chkUpdateTable = (selFcltDiv: string) => { if (selFcltDiv === "RNB") { - rainChkDetilUpdate(updateRainDetail); + if (updateRainDetail && updateRainDetail.length > 0) { + rainChkDetilUpdate(updateRainDetail); + } else { + toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); + } } else { - rswtChkDetilsUpdate(updateRswtDetail); + if (updateRswtDetail && updateRswtDetail.length > 0) { + rswtChkDetilsUpdate(updateRswtDetail); + } else { + toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); + } } }; @@ -176,10 +243,8 @@ export default function Page() { selectArray={yearOptions} value={searchYear} onSelectValue={(val: string | number) => { - setSearchYear(String(val)) - } - - } + setSearchYear(String(val)); + }} /> </div> <div className="col-span-2 flex flex-row space-x-2"> @@ -193,12 +258,22 @@ export default function Page() { selectArray={rainChkgdn.fcltDiv} onSelectValue={(val: string | number) => { if (val === "RST") rswtChkPolInit(); - setSelFcltDiv(String(val)) - } - } + setSelFcltDiv(String(val)); + }} value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val} /> </div> + <div className="col-span-2 flex flex-row space-x-2"> + <Label className="w-28 mt-2 text-xl text-gray-600"> + {"시설명"} + </Label> + <SearchInput + className={"w-full h-full text-2xl"} + label={""} + textValue={fcltNm || ""} + setText={setFcltNm} + /> + </div> </SearchFormLeft> <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> <div className="space-y"> @@ -219,14 +294,28 @@ export default function Page() { > 삭제 </Button> - <Button - size={"sm"} - onClick={() => { - chkUpdateTable(selFcltDiv); - }} - > - 저장 - </Button> + + <TooltipProvider> + <Tooltip> + <TooltipTrigger asChild> + <Button + size={"sm"} + onClick={() => { + chkUpdateTable(selFcltDiv); + }} + > + 저장 + </Button> + </TooltipTrigger> + <TooltipContent side="bottom" sideOffset={5}> + <h2 className="text-xl"> + 아래 테이블에 선택을 체크하면 입력셀이 활성화 됩니다. + </h2> + </TooltipContent> + </Tooltip> + </TooltipProvider> + + <Button size={"sm"} onClick={() => { @@ -253,8 +342,8 @@ export default function Page() { detailUp={setUpdateRainDetail} handleClick={handleClick} rainChkData={rainChkgdn.rainChk} - pageNation={pageNation} - onPageChange={setPageNation} + pageNation={rainPageNation} + onPageChange={rainPageChange} /> ) : ( <RswtChkgdTable @@ -262,8 +351,8 @@ export default function Page() { deleteRswtData={setDeleteIdx} handleRswtClick={handleClick} rswtChkData={rswtChkgdn.rswtChkRes} - pageNation={pageNation} - onPageChange={setPageNation} + pageNation={rswtPageNation} + onPageChange={rswtPageChange} /> )} </ListDiv> @@ -271,17 +360,28 @@ export default function Page() { </div> <UiModal open={isModal.open} - onOpenChange={() => { - setIsModal({ open: !open, data: {} }); + onOpenChange={(open: boolean) => { + setIsModal((prev) => ({ ...prev, open })); }} bodyClass={"w-[80vw] max-w-none"} - body={<ChkgdModal type={selFcltDiv} obj={isModal.data} />} + body={ + <ChkgdModal + type={selFcltDiv} + obj={isModal.data} + setIsModal={(open) => setIsModal((prev) => ({ ...prev, open }))} + /> + } ></UiModal> <UiModal open={isRegExcel} onOpenChange={setIsRegExcel} bodyClass={"w-[30vw] max-w-none"} - body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>} + body={ + <ChkgdExcel + type={selFcltDiv} + setIsRegExcel={setIsRegExcel} + ></ChkgdExcel> + } /> <Toaster position="top-center" /> </ContentsDiv> diff --git a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx index 7b43e4b00..6b783ea68 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx @@ -29,12 +29,12 @@ export const coRvwHeadListExport: CommonTableProps[]= [ visible: true, }, { - id: "regDt", //바꾸기 + id: "dmndTmng", //바꾸기 title: "신청일자", visible: true, }, { - id: "state", //바꾸기 + id: "splyFcltFlg", //바꾸기 title: "진행상태", visible: true, }, diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index 89836957b..21d4e0252 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -103,12 +103,18 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { data ); + if(isUpdate){ + toast.error("수요 매칭 검토 검토로 저장되었습니다."); + } + const coMatRvwRes = coMatInit( 1, 10, new Date().getFullYear().toString(), new Date().getFullYear().toString(), ); + + return set((state: coRvwState) => ({ ...state, coRvw: { diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 9f146c0fb..fb80ec415 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -53,7 +53,7 @@ import { z } from "zod"; rgtr: z.string().nullish(), mdfcnDt: z.coerce.date().nullish(), mdfr: z.string().nullish(), - dmdAplyPswd: z.string(), + dmdAplyPswd: z.string().nullish(), demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임 demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish()// 안쓰는 거임 }); diff --git a/apps/wr/app/store/matDmd/coSttn/headList.tsx b/apps/wr/app/store/matDmd/coSttn/headList.tsx index 80fed0d76..62c3002ac 100644 --- a/apps/wr/app/store/matDmd/coSttn/headList.tsx +++ b/apps/wr/app/store/matDmd/coSttn/headList.tsx @@ -44,6 +44,11 @@ export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [ title: "전화번호", visible: true, }, + { + id: "regDt", + title: "등록일자", + visible: true, + }, ]; export const coSttNodeListExport: CommonTableProps[] = [ diff --git a/apps/wr/app/store/matDmd/coSttn/index.tsx b/apps/wr/app/store/matDmd/coSttn/index.tsx index 0de37bbfc..5e8baf859 100644 --- a/apps/wr/app/store/matDmd/coSttn/index.tsx +++ b/apps/wr/app/store/matDmd/coSttn/index.tsx @@ -2,7 +2,7 @@ import type { CommonTableProps } from "@/app/store/common/type/header"; import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api"; import { coSttHeadListExport, coSttNodeListExport } from "./headList"; import { excelCoSttnParsing } from "./excel"; -import type { DemandCompType } from "@common/business_components/ui"; +import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; // 테이블 헤드 리스트 const coSttNodeList = coSttNodeListExport; diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx index 58e8d6bf0..77045f165 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx @@ -124,9 +124,9 @@ export const excelToRainChkData = (excelData: any, year: string) => { trbt: Number(item["탁도"] || 0), grssClfg: Number(item["총대장균군수"] || 0), etc: item["기타"] || "", // 필드 누락 방지 - vltnDt: vltnDt || "-", - vltnMttr: item["위반사항"] || "-", - levyAmt: Number(item["과태료부과금액(천원)"] || 0), + vltnDt: vltnDt || null, + vltnMttr: item["위반사항"] || "", + levyAmt: Number(item["과태료부과금액(천원)"] || null), rgtr: TEST_UUID, }, ], diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx index d7335e129..3cf1b5b11 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx @@ -114,10 +114,22 @@ export type splRuseWaterType = { ruse12: number; }; -export const rainHeadNmExport: chHeadType[] = [ +export const rainMainHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, +]; + +export const rainRuseHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, + { headNm: "ruseWater", text: "연간대체수 이용량(m³)", length: 13 }, + { headNm: "detailQulity", text: "분기", length: 11 }, +]; + + +export const rainSplHeadNmExport: chHeadType[] = [ { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, - { headNm: "ruseWater", text: "연간보급수 이용량(m³)", length: 13 }, { headNm: "detailQulity", text: "분기", length: 11 }, { headNm: "splWater", text: "연간빗물 이용량(m³)", length: 13 }, ]; diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 4c7f2d514..63d2d1d03 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -3,18 +3,20 @@ import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { deleteFectch, fetchType, + getCountFetch, getFetch, postFectch, putFectch, } from "@/components/lib/api"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import type { SelectDataType } from "@common/business_components/ui"; import { z } from "zod"; import { buildingToExcelType } from "./excel"; import { rainChkgdnHeadListExport, rainChkZod, - rainHeadNmExport, + rainMainHeadNmExport, + rainRuseHeadNmExport, + rainSplHeadNmExport, ruseHeadListExport, splHeadListExport, type chHeadType, @@ -22,38 +24,47 @@ import { import type { TableUpperProps } from "@/app/store/common/type/header"; import toast from "react-hot-toast"; +export const rainPageSize = 10; +export const commonCd = "41"; + export type rainChkZodType = z.infer<typeof rainChkZod>; const fcltDiv = [ { val: "RST", text: "중수도시설" }, { val: "RNB", text: "빗물이용시설" }, ]; -const rainHeadNm = rainHeadNmExport; +const rainRuseHeadNm = rainRuseHeadNmExport; +const rainSplHeadNm = rainSplHeadNmExport; const rainChkgdnHeadList = rainChkgdnHeadListExport; const ruseHeadList = ruseHeadListExport; const splHeadList = splHeadListExport; +const rainMainHeadNm = rainMainHeadNmExport const rainChk: rainChkZodType[] = []; export type rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList: TableUpperProps[]; + rainSplHeadNm:chHeadType[] + rainRuseHeadNm:chHeadType[] rainChk: rainChkZodType[]; - rainHeadNm: chHeadType[]; ruseHeadList: TableUpperProps[]; splHeadList: TableUpperProps[]; isInit: boolean; isModalClose: boolean; fcltDiv: SelectDataType[]; + rainMainHeadNm:chHeadType[] excelList: []; isSttn: boolean; + rainChkCount: number; + isLoading: boolean; }; }; type rainChkgdnActions = { rainChkInit: ( - pageNo: string, - cnt: string, + pageNo: number, + cnt: number, sggCd: string, searchTxt: string ) => void; @@ -66,6 +77,13 @@ type rainChkgdnActions = { rainChkExcelDataUPload(excelData: rainChkZodType[]): Promise<void>; rainChkDelete(chkgdnPks: number[]): Promise<void>; rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void; + rainChkNmSearch: ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => void; }; export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; @@ -73,7 +91,9 @@ export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; export const rainChkgdnStateExport: rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList: rainChkgdnHeadList, - rainHeadNm: rainHeadNm, + rainRuseHeadNm: rainRuseHeadNm, + rainSplHeadNm:rainSplHeadNm, + rainMainHeadNm:rainMainHeadNm, rainChk: rainChk, splHeadList: splHeadList, ruseHeadList: ruseHeadList, @@ -82,6 +102,8 @@ export const rainChkgdnStateExport: rainChkgdnState = { excelList: [], fcltDiv: fcltDiv, isSttn: false, + rainChkCount: 1, + isLoading: false, }, }; @@ -103,20 +125,24 @@ const makeMdfrChk = (data: rainChkZodType[], type: string, toDo: string) => { }; const initFetch = async ( - pageNo: string, - cnt: string, - txt: string | undefined, + pageNo: number, + cnt: number, + year: string | undefined, sgg: string | undefined ) => { const currentYear = new Date().getFullYear().toString(); - const rainRes = await getFetch( + + console.log("cnt ", cnt); + const rainRes = await getCountFetch( "wr", `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/20") + - (txt ? `/${txt}` : `/${currentYear}`) + + (cnt ? `/${cnt}` : "/10") + + (year ? `/${year}` : `/${currentYear}`) + (sgg ? `/${sgg}` : "/0") ); + + console.log(" rainRes ", rainRes); return rainRes; }; @@ -142,16 +168,24 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( })); }, rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => { + set((state: rainChkgdnType) => ( + { rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); try { const res = await postFectch("/reuseChk/rainy", excelData); if (res.status === 200) { const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "0"); - return set((state: rainChkgdnState) => ({ + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + commonCd + ); + set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); toast.success("지도점검 등록이 완료되었습니다."); @@ -161,22 +195,62 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( } catch (error) { console.log(error); toast.error("지도점검 등록이 실패되었습니다."); + } finally { + set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); } }, rainChkInit: async ( - pageNo: string, - cnt: string, - searchTxt: string, + pageNo: number, + cnt: number, + year: string, sggCd: string ) => { + set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); try { - const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); - + const rainChkRes = await initFetch(pageNo, cnt, year, sggCd); + set((state: rainChkgdnState) => ({ + ...state, + rainChkgdn: { + ...state.rainChkgdn, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, + isInit: true, // 무한 루프 방지를 위해 isInit을 true로 설정 + }, + })); + } catch (error) { + console.log(error); + // 에러가 발생하더라도 무한 루프에 빠지지 않도록 isInit을 true로 설정합니다. + set((state: rainChkgdnType) => ({ + rainChkgdn: { ...state.rainChkgdn, isInit: true }, + })); + } finally { + set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); + } + }, + rainChkNmSearch: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => { + try { + const currentYear = new Date().getFullYear(); + const rainChkRes = await getCountFetch( + "wr", + `/reuseChk/rainy` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/10") + + (year ? `/${year}` : `/${currentYear}`) + + (sggCd ? `/${sggCd}` : "/0") + + (txt ? `/${txt}` : "") + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); } catch (error) { @@ -187,26 +261,32 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( try { const chData = await makeMdfrChk(rainChk, "rain", "rainDetil"); - const res = await postFectch("/reuseChk/rainy", chData); - if (res.staus === 200) { + const res = await putFectch("/reuseChk/rainy/list", chData); + if (res) { toast.success( - "지도점검 보급수 및 밋물이용량 수정이 완료되었습니다. " + "지도점검 대체수 및 밋물이용량 수정이 완료되었습니다. " ); const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "11"); + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + "41" + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); } else { - toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다."); + toast.error("지도점검 대체수 및 밋물이용량 수정 오류입니다."); } } catch (error) { console.log(error); - toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다."); + toast.error("지도점검 대체수 및 밋물이용량 수정 오류입니다."); } }, rainChkGuidUpdate: async (rainChk: rainChkZodType) => { @@ -217,17 +297,22 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( toast.success("지도점검 수질 및 과태료 수정이 완료되었습니다. "); const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "11"); + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + "41" + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); - }else{ + } else { toast.error("지도점검 수질 및 과태료 수정 오류입니다."); - } } catch (error) { toast.error("지도점검 수질 및 과태료 수정 오류입니다."); @@ -241,17 +326,22 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( toast.success("삭제가 완료되었습니다. "); const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "11"); + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + "41" + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); - }else{ + } else { toast.error("삭제시 오류가 발생하였습니다.. "); - } } catch (error) { toast.error("삭제시 오류가 발생하였습니다.. "); diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx index 0e690dbb9..a7fea419d 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx @@ -109,6 +109,24 @@ export const rswtChkgdZod = z.object({ rswtrPollutions: z.array(rswtrPolutionsZode), }); + + +export const rswtRuseHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, + { headNm: "ruseWater", text: "연간중수 이용량(m³)", length: 13 }, + { headNm: "detailQulity", text: "분기", length: 11 }, +]; + +export const rswtSplHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, + { headNm: "detailQulity", text: "분기", length: 11 }, + { headNm: "splWater", text: "연간대체수 이용량(m³)", length: 13 }, +]; + + + export const rswtHeadNmExport: chHeadType[] = [ { headNm: "useQuilty", text: "연간 평균 이용수질", length: 10 }, { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, @@ -126,7 +144,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [ { id: "spwtPositn", title: "채수지점" ,mergeCell: true}, { id: "chckYmd", title: "점검일" ,mergeCell: true}, { id: "utztnUsgCd", title: "이용용도" }, - { id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" ,type: "number"}, + { id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)" ,type: "number"}, { id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)",type: "number"}, { diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index acc6ccaba..d40c1190c 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -1,6 +1,4 @@ -import { - TEST_UUID, -} from "@/app/store/ruseFcltMng/fcltReg/rainReg"; +import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import type { SelectDataType, SheetParameter, @@ -8,6 +6,7 @@ import type { import { deleteFectch, fetchType, + getCountFetch, getFetch, postFectch, putFectch, @@ -20,15 +19,24 @@ import { rswtDetailHeadListExport, rswtHeadNmExport, rswtrDetailsZod, + rswtRuseHeadNmExport, + rswtSplHeadNmExport, } from "./headList"; import { z } from "zod"; import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import { type chHeadType } from "../rainChkgdn/headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; +import toast from "react-hot-toast"; + +export const rswtPageSize = 10; const rswtChkHeadList = rswtChkHeadListExport; const rswtDetailHeadList = rswtDetailHeadListExport; const rswtHeadNm = rswtHeadNmExport; +const rswtRuseHeadNm =rswtRuseHeadNmExport +const rswtSplHeadNm =rswtSplHeadNmExport + + export type rswtChkZodType = z.infer<typeof rswtChkgdZod>; export type rswtrChkDetailsZodType = z.infer<typeof rswtrDetailsZod>; export type rswtChkgdnState = { @@ -40,13 +48,29 @@ export type rswtChkgdnState = { excelList: SheetParameter[]; rswtChkRes: rswtChkZodType[]; rswtChkPolGuide: rswtChkZodType[]; + rswtSplHeadNm:chHeadType[] + rswtRuseHeadNm:chHeadType[] isInit: boolean; - isSttn: boolean + isSttn: boolean; + isLoading:boolean; + rswtChkCount: number; }; }; type rswtChkgdnActions = { - rswtChkgdnInit: (pageNo: string, cnt: string, year: string, sggCd: string) => void; + rswtChkgdnInit: ( + pageNo: number, + cnt: number, + year: string, + sggCd: string + ) => void; + rswtChkNmSearch: ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => void; rswtrChkExcelDownload( sidoCode: SelectDataType[], sggCode: SelectDataType[] @@ -67,27 +91,41 @@ export const rswtChkgdnStateExport: rswtChkgdnState = { rswtChkHeadList: rswtChkHeadList, rswtDetailHeadList: rswtDetailHeadList, rswtHeadNm: rswtHeadNm, - excelList: [{ - data: [[]], headerNum: 0, headerRange: "A1:V3", - sheetName: "", - startCol: '1' - }], + rswtRuseHeadNm:rswtRuseHeadNm, + rswtSplHeadNm:rswtSplHeadNm, + + excelList: [ + { + data: [[]], + headerNum: 0, + headerRange: "A1:V3", + sheetName: "", + startCol: "1", + }, + ], rswtChkRes: [], rswtChkPolGuide: [], isInit: false, isSttn: false, + isLoading:false, + rswtChkCount: 1, }, }; -const initFetch = async (pageNo: string, cnt: string, year: string | undefined, sgg: string | undefined) => { +const initFetch = async ( + pageNo: number, + cnt: number, + year: string | undefined, + sgg: string | undefined +) => { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getFetch( + const rswtChkRes = await getCountFetch( "wr", `/reuseChk/reuseWater` + - (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/20") + - (year ? `/${year}` : `/${currentYear}`) + - (sgg ? `/${sgg}` : "/0") + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/20") + + (year ? `/${year}` : `/${currentYear}`) + + (sgg ? `/${sgg}` : "/0") ); return rswtChkRes; }; @@ -139,15 +177,59 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }, })); }, - rswtChkgdnInit: async (pageNo: string, cnt: string, year: string, sggCd: string) => { + rswtChkgdnInit: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string + ) => { + set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); try { const rswtChkRes = await initFetch(pageNo, cnt, year, sggCd); + set((state: rswtChkgdnState) => ({ + ...state, + rswtChkgdn: { + ...state.rswtChkgdn, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, + isInit: true, // 무한 루프를 방지하기 위해 isInit을 true로 설정 + }, + })); + } catch (error) { + console.log(error); + set((state: rswtChkgdnType) => ({ + rswtChkgdn: { ...state.rswtChkgdn, isInit: true }, + })); + } finally { + set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } })); + } + }, + rswtChkNmSearch: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => { + try { + const currentYear = new Date().getFullYear().toString(); + const rswtChkRes = await getCountFetch( + "wr", + `/reuseChk/reuseWater` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/20") + + (year ? `/${year}` : `/${currentYear}`) + + (sggCd ? `/${sggCd}` : "/0") + + (txt ? `/${txt}` : "") + ); + return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, isInit: false, }, })); @@ -157,6 +239,9 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }, rswtChkExceDataUpload: async (excelData: rswtChkZodType[]) => { try { + set((state: rswtChkgdnType) => ( + { rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); + console.log('excelData ', excelData) const res = await postFectch("/reuseChk/reuseWater", excelData); if (res.ok) { ToastFormUi({ @@ -165,65 +250,66 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }); } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { console.log(error); + }finally{ + set((state: rswtChkgdnType) => ( + { rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } })); } + }, rswtChkDetilsUpdate: async (rswtChk: rswtrChkDetailsZodType[]) => { try { const chData = await makeMdfrChk(rswtChk); - const res = await putFectch("/reuseChk/reuseWater", chData); if (res.ok) { - ToastFormUi({ - body: "지도점검 과태료 수정 수정이 완료되었습니다. ", - title: "지도점검 수정", - }); + toast.success("지도점검 과태료 수정이 완료되었습니다. ",) } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { console.log(error); - alert("수정에 실패하였습니다."); + toast.error("지도점검 과태료 수정 오류입니다. ",) + } }, rswtChkDelete: async (chkgdnPks: number[]) => { try { const res = await deleteFectch(`/reuseChk/reuseWater`, chkgdnPks); - if (res.ok) { - ToastFormUi({ - body: "삭제가 완료되었습니다. ", - title: "지도점검 삭제", - }); + if (res) { + toast.success("삭제가 완료되었습니다.") } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { - ToastFormUi({ body: "삭제를 실패했습니다.. ", title: "지도점검 삭제" }); + toast.error("삭제 오류입니다.") } }, rswtChkPolAndGuide: async (chkGdnPk: number) => { @@ -240,7 +326,11 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( rswtChkPolGuide: rswtChkPolGuide, }, })); - } catch (error) { } + } catch (error) { + + + + } }, rswtChkPolInit: () => { try { @@ -251,7 +341,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( rswtChkPolGuide: undefined, }, })); - } catch (error) { } + } catch (error) {} }, rwstPolAndGuideUpdate: async (rswtChk: rswtChkZodType[]) => { try { @@ -261,13 +351,10 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( chData[0] ); if (res.ok) { - ToastFormUi({ - body: "지도점검 연간 수질 및 보급수/중수도 수정이 완료되었습니다. ", - title: "지도점검 수정", - }); + toast.success("지도점검 연간 수질 및 대체수/중수도 수정이 완료되었습니다.") } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { @@ -277,10 +364,9 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( })); } catch (error) { console.log(error); - ToastFormUi({ - body: "지도점검 연간 수질 및 보급수/중수도 수정이 실패하였습니다.. ", - title: "지도점검 수정", - }); + + toast.error("지도점검 연간 수질 및 대체수/중수도 수정 오류입니다.") + } }, rswtChkHeadChange: async (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => { @@ -301,7 +387,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( rswtDetailHeadList: rswtDetailHeadList, }, })); - } catch (e) { } + } catch (e) {} }, }; }; diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index 2136dfebe..bbbb3a61e 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -2,7 +2,7 @@ import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn" import { getFetch } from "@/components/lib/api"; import type { SelectDataType } from "@common/business_components/ui"; import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList"; -import { rainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; +import { rainMainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { buildingExcelRainSttn } from "./excel"; import type { TableUpperProps } from "@/app/store/common/type/header"; @@ -15,7 +15,7 @@ const fcltDiv = [ const rainChkgdnHeadList = rainChkgdnHeadSttnExport; const ruseHeadList = ruseSttnHeadListExport; const splHeadList = splSttnHeadListExport; -const rainHeadNm = rainHeadNmExport +const rainHeadNm = rainMainHeadNmExport const rainChk: rainChkZodType[] = []; diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx index 91f6bf718..a505f1b0c 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/headList.tsx @@ -11,7 +11,7 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [ { id: "spwtPositn", title: "채수지점", mergeCell: true }, { id: "chckYmd", title: "점검일", mergeCell: true }, { id: "utztnUsgCd", title: "이용용도" }, - { id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)", type: "number" }, + { id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)", type: "number" }, { id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)", type: "number" }, { diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx index 8dd2a4d6f..ef662cc8c 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/headList.tsx @@ -426,7 +426,7 @@ export const rainSttNodeListExport: CommonTableProps[] = [ export const rainSttnDetailNodeListExport:CommonTableProps[] = [ { id: "totalSplyUswtrUtztnQnt", - title: "연간보급수이용량(m³)", + title: "연간대체수이용량(m³)", visible: true, row: 1, rowSpan: 2, @@ -511,7 +511,7 @@ export const rainSttnDetailNodeListExport:CommonTableProps[] = [ export const rainSttnDetailHeadListExport:CommonTableProps[] = [ { id: "totalSplyUswtrUtztnQnt", - title: "연간보급수이용량(m³)", + title: "연간대체수이용량(m³)", visible: true, row: 1, rowSpan: 1, diff --git a/apps/wr/components/lib/api/index.ts b/apps/wr/components/lib/api/index.ts index 452788eb0..69bc1bb68 100644 --- a/apps/wr/components/lib/api/index.ts +++ b/apps/wr/components/lib/api/index.ts @@ -46,6 +46,29 @@ export const getFetch = async (type: string, url: string) => { } }; + +export const getCountFetch = async (type: string, url: string) => { + const div = + type === fetchType.COMMON + ? DEV_URL_FO + : type === fetchType.LOCAL + ? LOCAL_URL + : type === fetchType.CS + ? '' + : DEV_URL_WR; + + const response = await fetch(div + url, { + method: "GET", + headers: { + accept: "application/json", + }, + }); + // JSON 응답 처리 + const res = await response.json(); + return res; + +}; + export const getFetchWithCount = async (type: string, url: string) => { const div = type === fetchType.COMMON diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index 7a35e02c4..5be5d9fb3 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -54,27 +54,30 @@ export const rainChkTableData = (chkData: rainChkZodType[]) => { export const rswtChkTableData = (chkData: rswtChkZodType[]) => { // 1. chkgdnFk + utztnUsgCd 기준 누계 정보 만들기 const makeRswtData: any[] = []; - chkData?.forEach((root) => { - root.rswtrDetails.forEach((detail) => { - let flatRswtChk = {}; - const findGuide = root.guideDetails.find( - (guide) => guide.utztnUsgCd === detail.utztnUsgCd - ); - const findPoluttion = root.rswtrPollutions.find( - (polution) => polution.utztnUsgCd === detail.utztnUsgCd - ); - const operMngCd = root?.reuseBuilding.operMngCd; - flatRswtChk = { - ...root, - ...detail, - ...findGuide, - ...findPoluttion, - ...flatRswtChk, - operMngCd: operMngCd, - }; - makeRswtData.push(flatRswtChk); + if(chkData&& chkData.length>0){ + + chkData?.forEach((root) => { + root.rswtrDetails.forEach((detail) => { + let flatRswtChk = {}; + const findGuide = root.guideDetails.find( + (guide) => guide.utztnUsgCd === detail.utztnUsgCd + ); + const findPoluttion = root.rswtrPollutions.find( + (polution) => polution.utztnUsgCd === detail.utztnUsgCd + ); + const operMngCd = root?.reuseBuilding.operMngCd; + flatRswtChk = { + ...root, + ...detail, + ...findGuide, + ...findPoluttion, + ...flatRswtChk, + operMngCd: operMngCd, + }; + makeRswtData.push(flatRswtChk); + }); }); - }); + } return makeRswtData; }; diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index 8569d4eb3..50e425722 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -165,18 +165,34 @@ export const yearOptions: { val: string; text: string }[] = Array.from( }) ); -export const getdmdMatFlag = (flag: string|undefined) => { - let flagMat = ""; - - if(flag === undefined || flag === null) { - flagMat = "신청"; - }else if(flag.trim() === "Sub") { - flagMat = "검토"; - - }else if(flag.trim() === "matched") { - flagMat = "매칭완료"; - }else { - flagMat = "신청"; +export const getdmdMatFlag = (flag: string | undefined | null): string => { + // 1. undefined나 null인 경우, '신청'을 반환합니다. + // (이 검사를 먼저 함으로써 아래에서 .trim()을 안전하게 사용할 수 있습니다.) + if (flag == null) { + return "신청"; } - return flagMat; + + // 2. 이제 flag가 문자열임이 보장되므로 .trim()을 호출해 앞뒤 공백을 제거합니다. + const trimmedFlag = flag.trim(); + + if (trimmedFlag === "Sub") { + return "검토"; + } else if (trimmedFlag === "matched") { + return "매칭완료"; + } + // 3. 그 외 모든 경우(빈 문자열 포함)는 '신청'으로 처리합니다. + return "신청"; }; + + + +export const formatPhoneNumber=(tel:string) => { + const onlyNums = tel.replace(/[^0-9]/g, ''); + if (onlyNums.length === 10) { + return onlyNums.replace(/(\d{2})(\d{4})(\d{4})/, '$1-$2-$3'); + } else if (onlyNums.length === 11) { + return onlyNums.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'); + } else { + return tel; // 유효하지 않으면 빈 문자열 + } +} \ No newline at end of file diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index b22f9474e..3d59d0a61 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -368,7 +368,7 @@ export default function ConCostForm({ childrenTriger={ <> <Label className="underline"> - 총사업비 (백만원) <i className="diveicon di-search" /> + 처리시설 총사업비(백만원) <i className="diveicon di-search" /> </Label> </> } @@ -405,7 +405,7 @@ export default function ConCostForm({ )} /> </div> - <div className="col-span-3 mt-4"> + {/* <div className="col-span-3 mt-4"> <div className="flex items-center justify-between"> <Label>공급처 선정</Label> <Button size={"sm"} onClick={(e) => {}} className="bg-none"> @@ -428,7 +428,7 @@ export default function ConCostForm({ </FormUi> )} /> - </div> + </div> */} <div className="col-span-4 mt-4"> <FormField control={form.control} diff --git a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx index 8828420b8..5aa67fd3a 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx @@ -7,11 +7,9 @@ import { excelToRswtGuideData, excelToRswtPolution, } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import { filePicked, filePickedArray, - FileUpload, Form, FormField, FormUi, @@ -26,7 +24,7 @@ import { useForm } from "react-hook-form"; import toast from "react-hot-toast"; import type { z } from "zod"; -export default function ChkgdExcel({ type }: { type: string }) { +export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setIsRegExcel:(open:boolean) =>void }) { const { rswtChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload } = useWrStore((state) => { return state; @@ -146,29 +144,28 @@ export default function ChkgdExcel({ type }: { type: string }) { const onSubmit = (values: z.infer<typeof chkgdRegExcel>) => { if (values.chckYr === "") { - ToastFormUi({ body: "등록년도를 작성해주세요", title: "지도점검 등록" }); + toast.error("등록년도를 작성해주세요"); return; } if (type === "RNB") { if (excelData === undefined || excelData?.length === 0) { - ToastFormUi({ - body: "빈 파일 및 파일 오류 입니다.", - title: "지도점검 등록", - }); + toast.error("빈 파일 및 파일 오류 입니다."); + return; } else { rainChkExcelDataUPload(excelData as rainChkZodType[]); + setIsRegExcel(false) } } else if (type === "RST") { if (excelRswtData === undefined || excelRswtData?.length === 0) { - ToastFormUi({ - body: "빈 파일 및 파일 오류 입니다.", - title: "중수지도점검 등록", - }); + toast.error("빈 파일 및 파일 오류 입니다."); + return; } else { rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]); + setIsRegExcel(false) + } } }; diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index 965bc7275..d62406e9f 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -10,7 +10,7 @@ import type { z } from "zod"; import React from "react"; import type { TableUpperProps } from "@/app/store/common/type/header"; -export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { +export default function ChkgdModal({ type, obj ,setIsModal }: { type: string; obj: any , setIsModal:(open:boolean)=>void}) { const { rainChkgdn, rswtChkgdn, @@ -79,6 +79,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { ]); useEffect(() => { + console.log('obj ', obj) + const result = obj.guideDetails?.reduce((acc: any, cur: any) => { const code = cur.utztnUsgCd; const month = cur.ym?.slice(4); // "MM" @@ -114,9 +116,10 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { }); } - console.log("result ", result); setGuidData(result as splRuseWaterType[]); + + console.log('obj ', obj) if (obj.rswtrPollutions) { const resultPolution: Record<string, any[]> = { "1": [], @@ -217,12 +220,14 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { obj.guideDetails = realGuideDetail; if (type === "RNB") { rainChkGuidUpdate(obj); + setIsModal(false) } else { const polution = Object.values(upPolutionData) .flat() .filter((item) => item.utztnUsgCd !== "평균"); obj.rswtrPollutions = polution; rwstPolAndGuideUpdate([obj]); + setIsModal(false) } }; @@ -262,12 +267,13 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { <ScrollArea className="h-[60vh]"> <div className="card-header"> <h3 className="text-2xl font-medium text-label"> - {`연간보급수이용량`} + {`연간대체수이용량`} </h3> </div> <GuideDetailsTable chgRes={guidData || []} - headList={headList.ruseHeadList} + headList={headList.splHeadList} + upheadList={type === "RNB"? rainChkgdn.rainSplHeadNm :rswtChkgdn.rswtSplHeadNm} type={""} setChGuidData={(data) => { setChGuidData(data); @@ -280,7 +286,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { </div> <GuideDetailsTable chgRes={guidData || []} - headList={headList.splHeadList} + headList={headList.ruseHeadList} + upheadList={type === "RNB"? rainChkgdn.rainRuseHeadNm :rswtChkgdn.rswtRuseHeadNm} type={""} setChGuidData={(data) => { setChGuidData(data); @@ -302,6 +309,7 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { <GuideDetailsTable chgRes={value} headList={headList?.rswtDetailHeadList} + upheadList={rswtChkgdn.rswtSplHeadNm} type={""} setChGuidData={(data) => { getPolutionData(data); diff --git a/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx b/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx index 94be4ebb6..2bf33e7c2 100644 --- a/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx @@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store"; import type { TableUpperProps } from "@/app/store/common/type/header"; import type { } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { InputTableBody } from "@/components/lib/func/TableData"; import { Input, @@ -18,11 +19,13 @@ import { useEffect, useState, type Dispatch, type SetStateAction } from "react" export function GuideDetailsTable({ chgRes, headList, + upheadList, type, setChGuidData, }: { chgRes: any[]; headList: TableUpperProps[]; + upheadList:chHeadType[] type: string; setChGuidData: (chgRes: any[]) => void; }) { @@ -44,7 +47,7 @@ export function GuideDetailsTable({ <> <div className={`card !m-[1.2rem] !p-0r `}> <Table variant="secondary"> - <TableHeader className="font-bold">{headMakeprfmnc(headList, rainChkgdn?.rainHeadNm)}</TableHeader> + <TableHeader className="font-bold">{headMakeprfmnc(headList, upheadList)}</TableHeader> <TableBody > {InputTableBody(inputData ?? [],headList, setInputData) } </TableBody> diff --git a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx index 720a73ab4..c6daac3b6 100644 --- a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx @@ -1,7 +1,7 @@ "use client"; import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; import { useWrStore } from "@/app/store"; -import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { rainPageSize, type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; import { tableData } from "@/components/lib/func/commom"; @@ -17,6 +17,7 @@ import { } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; import UiPageNations from "@common/business_components/ui/table/uiPageNations"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; export default function RainChkgdTable({ detailUp, handleClick = () => { }, @@ -70,16 +71,12 @@ export default function RainChkgdTable({ }, [makeTableData, handleClick]); - useEffect(() =>{ - - - },[rainChkgdn.rainChk]) useEffect(() => { setSelectedIds([])// 셀렉트 초기화를 위한 작업 - if (rainChkData) { + if (rainChkData&&rainChkData.length>0) { - const rainChg = rainChkData.map((item: any) => { + const rainChg = rainChkData?.map((item: any) => { const bud = tableData([item.building], { code }); return { ...item, @@ -89,6 +86,8 @@ export default function RainChkgdTable({ }); setMakeTableData(rainChkTableData(rainChg)); + }else{ + setMakeTableData([]); } }, [rainChkData, code]); @@ -167,7 +166,7 @@ export default function RainChkgdTable({ } else { setHeadList({ headList: rainChkgdn.rainChkgdnHeadList, - upHeadList: rainChkgdn.rainHeadNm + upHeadList: rainChkgdn.rainMainHeadNm }) } @@ -175,9 +174,15 @@ export default function RainChkgdTable({ }, [rainChkSttn.isSttn, rainChkgdn.rainChkgdnHeadList, rainChkSttn.rainChkgdnHeadList]); + useEffect(() =>{ + console.log('rainChkgdn.count ', rainChkgdn.rainChkCount) + },[rainChkgdn.rainChkCount]) + return ( <> + <LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay> <Table variant="secondary"> + <TableHeader className="font-bold"> {headMakeprfmnc( headList?.headList, @@ -197,9 +202,9 @@ export default function RainChkgdTable({ </TableBody> </Table> <UiPageNations - total={rainChkData?.length ?? 0} + total={rainChkgdn.rainChkCount||20} cur={pageNation} - pageSize={20} + pageSize={rainPageSize} onPageChange={onPageChange} /> </> diff --git a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx index 31891a595..5264dcdee 100644 --- a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx @@ -2,9 +2,10 @@ import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; import { useWrStore } from "@/app/store"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; -import type { - rswtChkZodType, - rswtrChkDetailsZodType, +import { + rswtPageSize, + type rswtChkZodType, + type rswtrChkDetailsZodType, } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import type { TableUpperProps } from "@/app/store/common/type/header"; import { tableData } from "@/components/lib/func/commom"; @@ -15,6 +16,7 @@ import { import { Table, TableBody, TableHeader } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; import UiPageNations from "@common/business_components/ui/table/uiPageNations"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; export default function RswtChkgdTable({ detaiRswtlUpdate, @@ -72,7 +74,6 @@ export default function RswtChkgdTable({ }, [rswtChkgdn.rswtChkPolGuide]); useEffect(() => { - console.log("makeTableData ", makeTableData) getRswtSttnExcel(makeTableData) const selectedData = makeTableData .map((item) => { @@ -133,6 +134,7 @@ export default function RswtChkgdTable({ return ( <> + <LoadingOverlay isLoading={rswtChkgdn.isLoading}></LoadingOverlay> <Table variant="secondary"> <TableHeader className="font-bold"> {headMakeprfmnc(headList?.headList, headList?.upHeadList)} @@ -150,9 +152,9 @@ export default function RswtChkgdTable({ </TableBody> </Table> <UiPageNations - total={rswtChkData?.length ?? 0} + total={rswtChkgdn.rswtChkCount} cur={pageNation} - pageSize={20} + pageSize={rswtPageSize} onPageChange={onPageChange} /> </> From 498b86ce76cf1556d5a3a2911a40f0d5eb35e052 Mon Sep 17 00:00:00 2001 From: ljpark <ljpark@mind-one.co.kr> Date: Thu, 3 Jul 2025 20:23:51 +0900 Subject: [PATCH 145/259] =?UTF-8?q?=EC=A0=81=EC=9A=A9=EC=97=B0=EC=9B=94=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/infilChart.tsx | 4 ++-- .../map/components/popupComponent/chart/rdiiChart.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 987728fe2..6f98705b1 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -20,7 +20,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo const [popupOpen, setPopupOpen] = React.useState(false); // 조회조건팝업 const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 - const [aplcnYm, setAplcnYm] = useState("0"); + const [aplcnYm, setAplcnYm] = useState(""); const [inftwtAnlss, setInftwtAnlss] = useState<TInftwtAnls[]>([]); const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택' }]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 @@ -140,7 +140,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo <span className="text-2xl text-red-600 font-bold">상수사용량 적용연월</span> <div className="flex items-center mt-2"> <span className="text-black text-xl font-bold"> - {(aplcnYm!=="0") && moment(aplcnYm, "YYYYMM").format("YYYY-MM")} + {(aplcnYm)? moment(aplcnYm, "YYYYMM").format("YYYY-MM"):""} </span> </div> </div> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 79fc4ad1d..96d07233f 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -127,7 +127,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } <span className="text-2xl text-red-600 font-bold">상수사용량 적용연월</span> <div className="flex items-center mt-2"> <span className="text-black text-xl font-bold"> - {(aplcnYm!=="0") && moment(aplcnYm, "YYYYMM").format("YYYY-MM")} + {(aplcnYm)? moment(aplcnYm, "YYYYMM").format("YYYY-MM"):""} </span> </div> </div> From b5d70a9534873cb289b0ea7a1299674d5b3cd5f8 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 20:31:40 +0900 Subject: [PATCH 146/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98?= =?UTF-8?q?=EB=B6=84=EC=84=9D,=20RDII=20=EB=B6=84=EC=84=9D=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-base-layout)/ii/rdii/page.tsx | 33 +++++++++++++++++-- .../(with-base-layout)/ii/rdiiResult/page.tsx | 15 +++++++-- .../app/(with-base-layout)/ii/result/page.tsx | 18 ++++++++-- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 801457772..0ce49c797 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -341,6 +341,35 @@ export default function RTKForm() { console.log('Page changed:', page) } + // 선택된 값을 처리하는 공통 함수 + const handleSelectValueChange = ( + val: string | number, + setter: (value: string | number) => void + ) => { + // val이 0이 아닐 경우 .을 기준으로 슬라이싱해서 두번째 값을 설정 + if (val && val !== '0' && val !== 0) { + const valString = String(val); + const parts = valString.split('.'); + if (parts.length > 1 && parts[1] !== undefined) { + setter(parts[1]); // 두 번째 값 (인덱스 1) + } else { + setter(val); // .이 없으면 원래 값 사용 + } + } else { + setter('0'); // val이 0이면 '0' 설정 + } + }; + + // 하수처리장 변경 핸들러 + const handleSwageTreatmentPlantChange = (val: string | number) => { + handleSelectValueChange(val, setSelect4); + }; + + // 하수처리구역 변경 핸들러 + const handleSwageProcessingZoneChange = (val: string | number) => { + handleSelectValueChange(val, setSelect5); + }; + return ( // <BaseLayout searchBox={{ title: '분석 대상지역 선택' }} titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} form={form} onSubmitEvent={() => { }} graphBtn={false} > <BaseLayout @@ -357,9 +386,9 @@ export default function RTKForm() { sigungu={select3} setSigungu={setSelect3} selectedSwageTreatmentPlant={select4} - onSwageTreatmentPlantChange={setSelect4} + onSwageTreatmentPlantChange={handleSwageTreatmentPlantChange} selectedSwageProcessingZone={select5} - onSwageProcessingZoneChange={setSelect5} + onSwageProcessingZoneChange={handleSwageProcessingZoneChange} isLoading={isLoadingResult} onAnalysis={handleAnalysisClick} > diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index 1cf78f6f2..12615c87c 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -91,6 +91,15 @@ const Result = () => { let inftwtAnlsSearchDto; + // swageTmplntCd 처리 로직 추가 + const processedSwageTmplntCd = formValues.swageTmplntCd && formValues.swageTmplntCd !== '0' + ? (() => { + const valString = String(formValues.swageTmplntCd); + const parts = valString.split('.'); + return parts.length > 1 ? parts[1] : valString; + })() + : null; + if (customFormValues) { inftwtAnlsSearchDto = { "aplcnYmFrom": formValues.aplcnYmFrom, @@ -98,7 +107,7 @@ const Result = () => { "enoCd": formValues.enoCd, "ctpvCd": formValues.ctpvCd, "sggCd": formValues.sggCd, - "swtrmtZoneCd": formValues.swtrmtZoneCd, + "swageTmplntCd": processedSwageTmplntCd, }; } else { inftwtAnlsSearchDto = { @@ -107,7 +116,7 @@ const Result = () => { "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, - "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, + "swageTmplntCd": processedSwageTmplntCd, }; } console.log("Search DTO:", inftwtAnlsSearchDto); @@ -237,7 +246,7 @@ const Result = () => { enoCd: selectedRowData.enoCd || null, ctpvCd: selectedRowData.ctpvCd || null, sggCd: selectedRowData.sggCd || null, - swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, + swageTmplntCd: selectedRowData.swageTmplntCd || null, }; await handleSearchButtonClick(customFormValues); diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 98440398a..73bc6ecf2 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -89,6 +89,15 @@ const Result = () => { let inftwtAnlsSearchDto; + // swageTmplntCd 처리 로직 추가 + const processedSwageTmplntCd = formValues.swageTmplntCd && formValues.swageTmplntCd !== '0' + ? (() => { + const valString = String(formValues.swageTmplntCd); + const parts = valString.split('.'); + return parts.length > 1 ? parts[1] : valString; + })() + : null; + if (customFormValues) { inftwtAnlsSearchDto = { "aplcnYmFrom": formValues.aplcnYmFrom, @@ -96,7 +105,8 @@ const Result = () => { "enoCd": formValues.enoCd, "ctpvCd": formValues.ctpvCd, "sggCd": formValues.sggCd, - "swtrmtZoneCd": formValues.swtrmtZoneCd, + "swageTmplntCd": processedSwageTmplntCd, + // "swtrmtZoneCd": formValues.swtrmtZoneCd, }; } else { inftwtAnlsSearchDto = { @@ -105,7 +115,8 @@ const Result = () => { "enoCd": formValues.enoCd === '0' ? null : formValues.enoCd, "ctpvCd": formValues.ctpvCd === '0' ? null : formValues.ctpvCd, "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, - "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, + "swageTmplntCd": processedSwageTmplntCd, + // "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, }; } console.log("Search DTO:", inftwtAnlsSearchDto); @@ -237,7 +248,8 @@ const Result = () => { enoCd: selectedRowData.enoCd || null, ctpvCd: selectedRowData.ctpvCd || null, sggCd: selectedRowData.sggCd || null, - swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, + swageTmplntCd: selectedRowData.swageTmplntCd || null, + // swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, }; await handleSearchButtonClick(customFormValues); From 26c36dd966b1a6b6222ec3ac2c52e0ec524020b0 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 20:46:06 +0900 Subject: [PATCH 147/259] =?UTF-8?q?feat:=20=ED=95=98=EC=88=98=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=EC=9E=A5=20=EC=B4=88=EA=B8=B0=EA=B0=92=20'=EC=A0=84?= =?UTF-8?q?=EC=B2=B4'=20->=20'=EC=84=A0=ED=83=9D'=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index 01503e829..86ae34f46 100644 --- a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -103,7 +103,7 @@ const BaseLayout = ({ selectedRowData }: BaseLayout) => { - const defaultOption: ApiSelectOption = { val: '0', text: '선택' }; + const defaultOption: ApiSelectOption = { val: '0', text: '전체' }; const [processingZoneOptions, setProcessingZoneOptions] = useState<ApiSelectOption[]>([]); const [treatmentFacilityOptions, setTreatmentFacilityOptions] = useState<ApiSelectOption[]>([]); From 7242dd54dbec86c890c99f1334badd8a366ace1e Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 3 Jul 2025 21:13:59 +0900 Subject: [PATCH 148/259] =?UTF-8?q?fix:=20RDII=20=EB=B6=84=EC=84=9D=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=95=98=EC=88=98=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=EC=9E=A5=20=EC=84=A0=ED=83=9D=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-base-layout)/ii/rdii/page.tsx | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 0ce49c797..f2ed4cf35 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -341,35 +341,6 @@ export default function RTKForm() { console.log('Page changed:', page) } - // 선택된 값을 처리하는 공통 함수 - const handleSelectValueChange = ( - val: string | number, - setter: (value: string | number) => void - ) => { - // val이 0이 아닐 경우 .을 기준으로 슬라이싱해서 두번째 값을 설정 - if (val && val !== '0' && val !== 0) { - const valString = String(val); - const parts = valString.split('.'); - if (parts.length > 1 && parts[1] !== undefined) { - setter(parts[1]); // 두 번째 값 (인덱스 1) - } else { - setter(val); // .이 없으면 원래 값 사용 - } - } else { - setter('0'); // val이 0이면 '0' 설정 - } - }; - - // 하수처리장 변경 핸들러 - const handleSwageTreatmentPlantChange = (val: string | number) => { - handleSelectValueChange(val, setSelect4); - }; - - // 하수처리구역 변경 핸들러 - const handleSwageProcessingZoneChange = (val: string | number) => { - handleSelectValueChange(val, setSelect5); - }; - return ( // <BaseLayout searchBox={{ title: '분석 대상지역 선택' }} titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} form={form} onSubmitEvent={() => { }} graphBtn={false} > <BaseLayout @@ -386,9 +357,9 @@ export default function RTKForm() { sigungu={select3} setSigungu={setSelect3} selectedSwageTreatmentPlant={select4} - onSwageTreatmentPlantChange={handleSwageTreatmentPlantChange} + onSwageTreatmentPlantChange={setSelect4} selectedSwageProcessingZone={select5} - onSwageProcessingZoneChange={handleSwageProcessingZoneChange} + onSwageProcessingZoneChange={setSelect4} isLoading={isLoadingResult} onAnalysis={handleAnalysisClick} > From a2c84248385e176eb3ca397fa6b9730cd7860645 Mon Sep 17 00:00:00 2001 From: ljpark <ljpark@mind-one.co.kr> Date: Fri, 4 Jul 2025 09:49:48 +0900 Subject: [PATCH 149/259] =?UTF-8?q?=EA=B7=B8=EB=9E=98=ED=94=84=20=ED=81=AC?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/infilChart.tsx | 4 ++-- .../map/components/popupComponent/chart/rdiiChart.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 6f98705b1..090e02f64 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -154,9 +154,9 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo </div> </div> {/* 차트 */} - <div className="w-[570px] h-[360px] bg-white text-2xl"> + <div className="w-[560px] h-[320px] bg-white text-2xl"> <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} - yFieldText2="시간" yFieldText="유량"/> + yFieldText2="시간" yFieldText="유량(m³/h)"/> </div> </div> {popupOpen && ( diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 96d07233f..930f83a6d 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -146,9 +146,9 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } </div> </div> {/* 차트 */} - <div className="w-[570px] h-[360px] bg-white text-2xl"> + <div className="w-[560px] h-[320px] bg-white text-2xl"> <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} - yFieldText2="시간" yFieldText="유량" /> + yFieldText2="시간" yFieldText="유량(m³/h)" /> </div> </div> {popupOpen && ( From be4bbdb3f102ab86868d42830f15f7e7803cb4f9 Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Fri, 4 Jul 2025 11:04:56 +0900 Subject: [PATCH 150/259] =?UTF-8?q?gistree=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=ED=81=B4=EB=A6=AD=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/map/Gis.js | 207 ++++++++++++++++-- .../business_components/src/ui/map/GisTree.js | 43 +++- 2 files changed, 219 insertions(+), 31 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index fa1cf7ab4..dd8135d1a 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -1,5 +1,6 @@ import { Search } from 'lucide-react'; import OlMap from 'ol/Map'; +import Overlay from 'ol/Overlay'; import View from 'ol/View'; import { defaults as defaultControls, OverviewMap } from 'ol/control'; import { defaults } from 'ol/interaction'; @@ -14,27 +15,53 @@ import GisToolBar from './GisToolBar'; import GisTree from './GisTree'; import './lib/css/gis.common.css'; import GisApp from './lib/gis.core'; +// import FacilityInfoPopup from './FacilityInfoPopup'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); -function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = false, isMiniMap = false, setIsOpen, setFeatureData, featureData, searchView : SearchView, detailView: DetailView, onFeatureSelect, setIsSearchModalOpen }) { +function Gis({ + isOpen, + gisMaps, + isSearchModalOpen, + treeData = [], + isSearch = false, + isMiniMap = false, + setIsOpen, + setFeatureData, + featureData, + searchView: SearchView, + detailView: DetailView, + onFeatureSelect, + setIsSearchModalOpen, + onCheckedLayersChange +}) { const mapRef = useRef(); const [mapObject, setMapObject] = useState({}); const [tabVisible, setTabVisible] = useState(true); + const [layerNm, setLayerNm] = useState('') // const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태 // const [featureData, setFeatureData] = useState(null) // 선택된 피쳐 데이터 // const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); // SearchModal 열림 상태 const gisCore = useMemo(() => new GisApp.core({ targetId: mapRef.current }), []); const mapInstanceRef = useRef(null); const checkedLayerIds = useRef([]); + const [viewMode, setViewMode] = useState("detail"); + + // 팝업 데이터를 저장할 상태와 오버레이 참조를 저장할 ref 추가 + // const [facilityInfoPopupData, setFacilityInfoPopupData] = useState([]); + // const facilityOverlaysRef = useRef([]); + // 체크된 레이어 상태 관리 + const [checkedLayers, setCheckedLayers] = useState([]); + const [checkedLayersData, setCheckedLayersData] = useState([]); + let gisMap = null; const closePopup = () => { setIsOpen(false); // 팝업 닫기 setFeatureData(null) }; - // SearchModal, GisContent 등에서 호출 + // Feature Click Event const handleFeatureSelect = useCallback((data) => { gisMap = mapInstanceRef.current; @@ -89,8 +116,10 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa setFeatureData(data); setIsOpen(true); setIsSearchModalOpen(false); + onFeatureSelect?.(data); // 선택된 피쳐 데이터 콜백 호출 }, [mapInstanceRef]); + // 지도 생성 및 초기화 useEffect(() => { if (!mapRef.current) return; if (mapInstanceRef.current) return; // 이미 생성된 맵이 있다면 중단 @@ -104,7 +133,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa ]); register(proj4); - //맵 생성 + // OpenLayers 지도 객체 생성 const map = new OlMap({ layers: [gisCore.baseLayers['base'], gisCore.baseLayers['satellite']], renderer: 'webgl', @@ -132,8 +161,8 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa gisMaps.current = map - //미니맵 - if(isMiniMap){ + // 미니맵 추가 + if (isMiniMap) { const overviewMap = new OverviewMap({ layers: [GisApp.Module.core.baseMiniMapLayers['base']], view: new View({ @@ -147,6 +176,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa map.addControl(overviewMap); } + // 스케일 컨트롤 및 베이스 레이어 설정 gisCore.__proto__.map = map; gisCore.scaleControl(); gisCore.changeBaseLayer('base'); @@ -154,16 +184,20 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa mapInstanceRef.current = map; // 생성 완료 플래그 설정 }, []); + // treeData 변경 시 레이어 코드 생성 useEffect(() => { if (!treeData || treeData.length === 0) return; + // 기존 오버레이 및 레이어 모두 삭제 gisCore.deleteAllOverlay(); gisCore.deleteAllLayer(); + // 트리 데이터를 레이어 코드 객체로 변환 const layerCode = gisCore.convertLayerInfosToLayerCode(treeData, 'lyrSn'); - GisApp.layerCode = layerCode; + GisApp.layerCode = layerCode; // 전역 레이어 코드 설정 //setTreeData(data); + // 편집 가능한 레이어 목록 생성 const layerItems = getLayerItems(layerCode); //setEditLayerItems(prev => [...layerItems]) }, [treeData]); @@ -193,31 +227,164 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa } } + // // 데이터 로드 및 팝업 생성 로직 + // useEffect(() => { + // if (!mapInstanceRef.current) return; // 맵이 생성되지 않았으면 실행 안 함 + + // // 1. 팝업 데이터 가져오기 (feature.js의 getData와 유사) + // const fetchPopupData = async () => { + // // 실제 API 호출 로직으로 대체해야 합니다. + // // 예시: const response = await yourApiService.getFcltyWtCnt(); + // // setFacilityInfoPopupData(response.data); + + // // 임시 목업 데이터 + // const mockData = [ + // { ftrIdn: 1, ftrCde: 'SA206', bplcNm: '처리장A', fcltyUseYn: 'Y', x: 127.005, y: 37.282, aCnt: 10, cCnt: 5, eCnt: 3, mCnt: 8, iCnt: 2 }, + // { ftrIdn: 2, ftrCde: 'SA112', bplcNm: '처리장B', fcltyUseYn: 'N', x: 127.010, y: 37.285, aCnt: 8, cCnt: 4, eCnt: 2, mCnt: 6, iCnt: 1 } + // ]; + // setFacilityInfoPopupData(mockData); + // }; + + // fetchPopupData(); + + // }, [mapInstanceRef.current]); // 맵 인스턴스가 생성된 후 한 번만 실행 + + // // 데이터가 변경되면 오버레이를 생성/업데이트하는 로직 + // useEffect(() => { + // const map = mapInstanceRef.current; + // if (!map || facilityInfoPopupData.length === 0) return; + + // // 기존 오버레이 정리 + // facilityOverlaysRef.current.forEach(overlay => map.removeOverlay(overlay)); + // facilityOverlaysRef.current = []; + + // facilityInfoPopupData.forEach(data => { + // const popupId = `${data.ftrIdn}_${data.ftrCde}`; + + // // 팝업을 담을 div 엘리먼트 생성 + // const popupElement = document.createElement('div'); + // popupElement.id = popupId; + + // // OpenLayers Overlay 생성 + // const position = olProj.transform([Number(data.x), Number(data.y)], GisApp.FROM_PROJ, GisApp.TO_PROJ); + // const overlay = new Overlay({ + // element: popupElement, + // position: position, + // offset: [-75, -210], // 팝업 너비의 절반, 높이만큼 오프셋 조정 + // positioning: 'bottom-center', + // className: 'facility-popup-overlay' // 필요시 공통 클래스 추가 + // }); + + // map.addOverlay(overlay); + // facilityOverlaysRef.current.push(overlay); + + // // React 컴포넌트를 popupElement에 렌더링 + // const root = createRoot(popupElement); + // root.render(<FacilityInfoPopup data={data} />); + // }); + + // // 초기 가시성 업데이트 + // updatePopupVisibility(); + + // }, [facilityInfoPopupData]); // 팝업 데이터가 변경될 때마다 실행 + + // // 레이어 가시성에 따라 팝업 가시성을 제어하는 함수 + // const updatePopupVisibility = useCallback(() => { + // const map = mapInstanceRef.current; + // if (!map) return; + + // const visibleLayers = new Set(); + // map.getLayers().forEach(layer => { + // if (layer.getVisible()) { + // // feature.js의 로직처럼 typeName이나 ftrCde를 사용해 필터링 + // const typeName = layer.get('typeName'); + // if (typeName === 'VW_WTL_FCLTY_AS') { // 예시 레이어 이름 + // visibleLayers.add(layer.get('ftrCde')); + // } + // } + // }); + + // facilityOverlaysRef.current.forEach(overlay => { + // const element = overlay.getElement(); + // const ftrCde = element.querySelector('table')?.classList[0]; // FacilityPopup의 클래스에서 ftrCde 가져오기 + + // if (visibleLayers.has(ftrCde)) { + // element.style.display = ''; + // } else { + // element.style.display = 'none'; + // } + // }); + // }, []); + + // GisTree에서 체크 상태가 변경될 때 이 함수를 호출하도록 연결해야 합니다. + // 예시: GisTree 컴포넌트에 onCheck 콜백을 추가하고, 그 콜백에서 이 함수를 호출 + // useEffect(() => { + // // 레이어 가시성이 변경될 때마다 팝업 가시성 업데이트 + // const map = mapInstanceRef.current; + // if (!map) return; + + // const handleLayerVisibilityChange = () => { + // updatePopupVisibility(); + // }; + + // map.getLayers().on('change:length', handleLayerVisibilityChange); + // map.getLayers().forEach(layer => { + // layer.on('change:visible', handleLayerVisibilityChange); + // }); + + // return () => { + // // 클린업 + // map.getLayers().un('change:length', handleLayerVisibilityChange); + // map.getLayers().forEach(layer => { + // layer.un('change:visible', handleLayerVisibilityChange); + // }); + // }; + // }, [updatePopupVisibility]); + + // 체크된 레이어 정보를 처리하는 함수 + const handleCheckedLayersChange = useCallback((checkedIds, checkedNodesData) => { + setTimeout(() => { + setCheckedLayers(checkedIds); + setCheckedLayersData(checkedNodesData); + onCheckedLayersChange?.(checkedIds, checkedNodesData); + }, 0); + }, [onCheckedLayersChange]); + return ( <> <GisContext.Provider value={{ gisCore, gisMap: mapInstanceRef.current, treeData, checkedLayerIds }}> <div className="h-[calc(100vh-10rem)] flex relative"> <div ref={mapRef} className="gis-map flex-1 relative" style={{ height: '100%', padding: 0 }} /> - <GisTree visible={tabVisible} setVisible={setTabVisible} /> - + <GisTree + visible={tabVisible} + setVisible={setTabVisible} + onCheckedChange={handleCheckedLayersChange} + onLayerIconClick={(nodeNm)=>{setLayerNm(nodeNm); setIsOpen(true); setViewMode("detail")}} + /> + {/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */} - - {/* isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} - {isOpen && featureData && !isSearchModalOpen && ( + + {/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} + {isOpen && !isSearchModalOpen && ( <DetailView featureData={featureData} + seletectedLayerNm={layerNm} + viewMode={viewMode} onClose={closePopup} // 닫기 콜백 전달 /> )} - <SearchView - open={isSearchModalOpen} - onOpenChange={setIsSearchModalOpen} - onFeatureSelect={onFeatureSelect} - /> - <GisLonLat/> - <GisToolBar/> - <GisMapToggle/> - <GisSelect onFeatureSelect={onFeatureSelect} /> + {/* SearchView가 존재할 때만 렌더링 */} + {SearchView && ( + <SearchView + open={isSearchModalOpen} + onOpenChange={setIsSearchModalOpen} + onFeatureSelect={handleFeatureSelect} + /> + )} + <GisLonLat /> + <GisToolBar /> + <GisMapToggle /> + <GisSelect onFeatureSelect={handleFeatureSelect} /> </div> {isSearch && ( diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index 9dbf2c42a..5b30dc7f4 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -1,15 +1,16 @@ -import GisApp from './lib/gis.core'; -import React, { useEffect, useState } from 'react'; -import { useGisContext } from './Gis'; -import { DndProvider } from "react-dnd"; import { - Tree, MultiBackend, + Tree, getBackendOptions } from "@minoru/react-dnd-treeview"; import { ChevronLeft, ChevronRight } from 'lucide-react'; +import React, { useEffect, useState } from 'react'; +import { DndProvider } from "react-dnd"; -export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible }) { +import { useGisContext } from './Gis'; +import GisApp from './lib/gis.core'; + +export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible, onCheckedChange, onLayerIconClick }) { const { gisCore, treeData } = useGisContext(); const [checked, setChecked] = useState([]); const [expanded, setExpanded] = useState([]); @@ -24,19 +25,31 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes } }, [treeData]); + // 트리 노드 체크 시 레이어 표시/숨김 useEffect(() => { if (nodes.length > 0) { + // 기본으로 체크된 노드들 찾기 const defaultChecked = getDefaultCheckedNodes(nodes); setChecked(defaultChecked); + console.log('defaultChecked : ', defaultChecked); + + // 기본으로 확장된 노드들 설정 const defaultExpanded = Array.from(new Set([ ...defaultChecked, ...defaultChecked.flatMap((id) => getAncestors(id, nodes)) ])); setExpanded(defaultExpanded); - gisCore.setLayerOnMap(defaultChecked, true); - } - }, [nodes]); + // 기본 체크된 레이어들을 지도에 표시 + gisCore.setLayerOnMap(defaultChecked, true); + + // 초기 체크된 레이어 정보를 상위로 전달 + const defaultCheckedNodesData = nodes.filter(node => defaultChecked.includes(node.id)); + onCheckedChange?.(defaultChecked, defaultCheckedNodesData); + } + }, [nodes]); // onCheckedChange를 의존성에 추가 + + // 초기 표시 여부가 'Y'인 레이어들 찾기 const getDefaultCheckedNodes = (nodes, values = []) => { for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; @@ -94,6 +107,11 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes const unchecked = allIds.filter((nid) => !newChecked.includes(nid)); gisCore.setLayerOnMap(newChecked, true); gisCore.setLayerOnMap(unchecked, false); + + // 체크된 노드 정보와 함께 노드 데이터를 상위로 전달 + const checkedNodesData = nodes.filter(node => newChecked.includes(node.id)); + onCheckedChange?.(newChecked, checkedNodesData); + return newChecked; }); }; @@ -170,7 +188,10 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes image.src = canvas.toDataURL('image/png'); return image; }; - + const handleLayerImgClick = (nodeNm) => { + console.log('click!', nodeNm) + onLayerIconClick(nodeNm) + } if (!treeData || treeData.length === 0) return null; return ( @@ -203,7 +224,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes <input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer" /> {node.icon && <span>{node.icon}</span>} <span className="text-[1.3rem] font-medium text-label">{node.text}</span> - {depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{}} alt={node.text}></img></span>} + {depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text)}} alt={node.text}></img></span>} </div> )} sort={(a, b) => { From f592ab31d86a86ce305ce8b4a65170340d03186a Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Fri, 4 Jul 2025 13:10:23 +0900 Subject: [PATCH 151/259] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EB=B0=8F=20=ED=98=84=ED=99=A9=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=95=20=EC=88=98=EC=A0=95,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 5 +- .../prfmncSttn/chkgdnSttn/page.tsx | 40 ++++++++++--- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 5 +- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 4 +- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 58 +++++++++++-------- .../chkgdnSttn/rswtChkgdnSttn/index.tsx | 32 +++++----- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 21 ++++--- .../chkgdTable/rainChkgd/rainChkgdTable.tsx | 14 ++--- .../chkgdTable/rswtChkgd/rswtChkgdTable.tsx | 4 +- 9 files changed, 107 insertions(+), 76 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 033d3a23d..328bb8b88 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -315,7 +315,7 @@ export default function Page() { </Tooltip> </TooltipProvider> - + <Button size={"sm"} onClick={() => { @@ -344,7 +344,7 @@ export default function Page() { rainChkData={rainChkgdn.rainChk} pageNation={rainPageNation} onPageChange={rainPageChange} - /> + pageCount={rainChkgdn.rainChkCount} /> ) : ( <RswtChkgdTable detaiRswtlUpdate={setUpdateRSwtDetail} @@ -353,6 +353,7 @@ export default function Page() { rswtChkData={rswtChkgdn.rswtChkRes} pageNation={rswtPageNation} onPageChange={rswtPageChange} + pageCount={rswtChkgdn.rswtChkCount} /> )} </ListDiv> diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index 8960f468d..60040833b 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -1,6 +1,8 @@ "use client"; import { useWrStore } from "@/app/store"; +import { commonCd, rainPageSize } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { rswtPageSize } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { excelDownload, yearOptions @@ -39,6 +41,8 @@ export default function Page() { }); const [selFcltDiv, setSelFcltDiv] = useState("RNB"); + const [rainPageNation, setRainPageNation] = useState(1); + const [rswtPageNation, setRswtPageNation] = useState(1); const [isModal, setIsModal] = useState({ open: false, data: {}, @@ -47,29 +51,43 @@ export default function Page() { const cellClick = () => { if (searchYear) { if (selFcltDiv === "RNB") { - rainChkSttnSearch(searchYear, "0"); + rainChkSttnSearch(rainPageNation, rainPageSize, searchYear, commonCd); } else { - rswtChkSttnSearch(searchYear, "0"); + rswtChkSttnSearch(rswtPageNation, rswtPageSize, searchYear, commonCd); } } }; + const rainPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRainPageNation(pageNo); + rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd); + } + }; + + const rswtPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRswtPageNation(pageNo); + rswtChkSttnInit(pageNo, rswtPageSize, searchYear, commonCd); + } + }; + useEffect(() => { if (!rainChkSttn.isInit) { isRainSttn(true) - rainChkSttnInit(new Date().getFullYear().toString(), "0"); + rainChkSttnInit(1, rainPageSize, new Date().getFullYear().toString(), commonCd); setIsModal({ data: {}, open: false }); } - }, [rainChkSttn.isInit, rainChkSttnInit]); + }, [rainChkSttn.isInit, rainChkSttnInit, rainPageSize]); useEffect(() => { - if (!rswtChkSttn.isInit) { setIsModal({ data: {}, open: false }); - rswtChkSttnInit(new Date().getFullYear().toString(), "0"); + rswtChkSttnInit(1, rswtPageSize, new Date().getFullYear().toString(), commonCd); isRswtSttn(true) } - }, [rswtChkSttn.isInit, rswtChkSttnInit]) + }, [rswtChkSttn.isInit, rswtChkSttnInit, rswtPageSize]) + const handleClick = useCallback( @@ -163,6 +181,9 @@ export default function Page() { detailUp={() => { }} handleClick={handleClick} rainChkData={rainChkSttn.rainChkRes} + pageNation={rainPageNation} + onPageChange={rainPageChange} + pageCount={rainChkSttn.rainChkCount} /> ) : ( <RswtChkgdTable @@ -170,6 +191,9 @@ export default function Page() { deleteRswtData={() => { }} handleRswtClick={handleClick} rswtChkData={rswtChkSttn.rswtChkRes} + pageNation={rswtPageNation} + onPageChange={rswtPageChange} + pageCount={rswtChkSttn.rswtChkCount} /> )} </ListDiv> @@ -181,7 +205,7 @@ export default function Page() { setIsModal({ open: !open, data: {} }); }} bodyClass={"w-[80vw] max-w-none"} - body={<ChkgdModal type={selFcltDiv} obj={isModal.data} />} + body={<ChkgdModal type={selFcltDiv} obj={isModal.data} setIsModal={() => { }} />} ></UiModal> <Toaster position="top-center" /> </ContentsDiv> diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 63d2d1d03..36dd0a815 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -24,7 +24,7 @@ import { import type { TableUpperProps } from "@/app/store/common/type/header"; import toast from "react-hot-toast"; -export const rainPageSize = 10; +export const rainPageSize = 5; export const commonCd = "41"; export type rainChkZodType = z.infer<typeof rainChkZod>; @@ -132,7 +132,6 @@ const initFetch = async ( ) => { const currentYear = new Date().getFullYear().toString(); - console.log("cnt ", cnt); const rainRes = await getCountFetch( "wr", `/reuseChk/rainy` + @@ -142,7 +141,6 @@ const initFetch = async ( (sgg ? `/${sgg}` : "/0") ); - console.log(" rainRes ", rainRes); return rainRes; }; @@ -193,7 +191,6 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( toast.error("지도점검 등록이 실패되었습니다."); } } catch (error) { - console.log(error); toast.error("지도점검 등록이 실패되었습니다."); } finally { set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index d40c1190c..6e0a805b6 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -28,7 +28,7 @@ import { type chHeadType } from "../rainChkgdn/headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; import toast from "react-hot-toast"; -export const rswtPageSize = 10; +export const rswtPageSize = 5; const rswtChkHeadList = rswtChkHeadListExport; const rswtDetailHeadList = rswtDetailHeadListExport; @@ -43,7 +43,6 @@ export type rswtChkgdnState = { rswtChkgdn: { rswtChkHeadList: TableUpperProps[]; rswtDetailHeadList: TableUpperProps[]; - rswtHeadNm: chHeadType[]; excelList: SheetParameter[]; rswtChkRes: rswtChkZodType[]; @@ -241,7 +240,6 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( try { set((state: rswtChkgdnType) => ( { rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); - console.log('excelData ', excelData) const res = await postFectch("/reuseChk/reuseWater", excelData); if (res.ok) { ToastFormUi({ diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index bbbb3a61e..895f096ef 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -1,8 +1,8 @@ import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import { getFetch } from "@/components/lib/api"; +import { getCountFetch, getFetch } from "@/components/lib/api"; import type { SelectDataType } from "@common/business_components/ui"; import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList"; -import { rainMainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; +import { rainMainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { buildingExcelRainSttn } from "./excel"; import type { TableUpperProps } from "@/app/store/common/type/header"; @@ -24,20 +24,21 @@ export type rainChkSttnState = { rainChkRes: rainChkZodType[]; fcltDiv: SelectDataType[]; rainChkgdnHeadList: TableUpperProps[]; - rainHeadNm:chHeadType[]; + rainHeadNm: chHeadType[]; ruseHeadList: TableUpperProps[]; splHeadList: TableUpperProps[]; - sttnExcelList:[] + sttnExcelList: [] isInit: boolean; - isSttn:boolean; + isSttn: boolean; + rainChkCount: number; }; }; type rainChkSttnActions = { - rainChkSttnInit: (searchTxt: string, sggCd: string) => void; - rainChkSttnSearch: (searchTxt: string, sggCd: string) => void; - isRainSttn:(isSttn:boolean) => void; - getRainSttnExcel:(excelList:rainChkZodType[]) => void; + rainChkSttnInit: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; + rainChkSttnSearch: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; + isRainSttn: (isSttn: boolean) => void; + getRainSttnExcel: (excelList: rainChkZodType[]) => void; }; export type rainChkSttnType = rainChkSttnState & rainChkSttnActions; @@ -49,18 +50,23 @@ export const rainChkSttnStateExport: rainChkSttnState = { rainChkgdnHeadList: rainChkgdnHeadList, ruseHeadList: ruseHeadList, splHeadList: splHeadList, - rainHeadNm:rainHeadNm, + rainHeadNm: rainHeadNm, isInit: false, - sttnExcelList:[], - isSttn:false, + sttnExcelList: [], + isSttn: false, + rainChkCount: 1, }, }; -const initFetch = async (txt: string | undefined, sgg: string | undefined) => { +const initFetch = async (pageNo: number, cnt: number, txt: string | undefined, sgg: string | undefined) => { const currentYear = new Date().getFullYear().toString(); - const rainRes = await getFetch( + const rainRes = await getCountFetch( "wr", - `/reuseChk/rainy/` + (txt ? `${txt}` : currentYear) + (sgg ? `/${sgg}` : "/0") + `/reuseChk/rainy` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/5") + + (txt ? `/${txt}` : `/${currentYear}`) + + (sgg ? `/${sgg}` : "/0") ); return rainRes; }; @@ -68,48 +74,50 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( set: any ) => { return { - rainChkSttnInit: async (searchTxt: string, sggCd: string) => { + rainChkSttnInit: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { try { - const rainChkRes = await initFetch(searchTxt, sggCd); + const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); return set((state: rainChkSttnState) => ({ ...state, rainChkSttn: { ...state.rainChkSttn, - rainChkRes:rainChkRes + rainChkRes: rainChkRes.data, + rainChkCount: rainChkRes.count, + isSttn: true }, })); } catch (error) { console.log(error); } }, - rainChkSttnSearch: async (searchTxt: string, sggCd: string) => { + rainChkSttnSearch: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { try { - const rainChkRes = await initFetch(searchTxt, sggCd); + const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); return set((state: rainChkSttnState) => ({ ...state, rainChkSttn: { ...state.rainChkSttn, - rainChkRes:rainChkRes + rainChkRes: rainChkRes }, })); } catch (error) { console.log(error); } - },isRainSttn :(isSttn:boolean) =>{ + }, isRainSttn: (isSttn: boolean) => { try { return set((state: rainChkSttnState) => ({ ...state, rainChkSttn: { ...state.rainChkSttn, - isSttn:isSttn + isSttn: isSttn }, })); } catch (error) { console.log(error); } - },getRainSttnExcel: async (excelList:rainChkZodType[]) => { + }, getRainSttnExcel: async (excelList: rainChkZodType[]) => { try { const excelData = buildingExcelRainSttn(excelList) @@ -118,7 +126,7 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( ...state, rainChkSttn: { ...state.rainChkSttn, - sttnExcelList:excelData + sttnExcelList: excelData }, })); } catch (error) { diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx index cd95ef1fc..519cd39b2 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx @@ -3,7 +3,7 @@ import { rswtChkSttnHeadListExport, rswtDetailSttnHeadListExport } from "./headL import type { TableUpperProps } from "@/app/store/common/type/header"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; -import { getFetch } from "@/components/lib/api"; +import { getCountFetch, getFetch } from "@/components/lib/api"; import { buildingExcelRswtSttn } from "./excel"; const rswtChkHeadList = rswtChkSttnHeadListExport; @@ -20,14 +20,15 @@ export type rswtChkSttnState = { rswtChkRes: rswtChkZodType[]; isInit: boolean; isSttn: boolean; + rswtChkCount: number; }; }; type rswtChkSttnActions = { - rswtChkSttnInit: (searchTxt: string, sggCd: string) => void; + rswtChkSttnInit: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; isRswtSttn: (isSttn: boolean) => void; getRswtSttnExcel: (excelList: rswtChkZodType[]) => void; - rswtChkSttnSearch: (searchTxt: string, sggCd: string) => void; + rswtChkSttnSearch: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; }; export type rswtChkSttnType = rswtChkSttnState & rswtChkSttnActions; @@ -41,15 +42,18 @@ export const rswtChkStateExport: rswtChkSttnState = { rswtChkRes: [], isInit: false, isSttn: false, + rswtChkCount: 1, }, }; -const initFetch = async (year: string | undefined, sgg: string | undefined) => { +const initFetch = async (pageNo: number, cnt: number, year: string | undefined, sgg: string | undefined) => { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getFetch( + const rswtChkRes = await getCountFetch( "wr", - `/reuseChk/reuseWater/` + - (year ? `${year}` : currentYear) + + `/reuseChk/reuseWater` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/20") + + (year ? `/${year}` : `/${currentYear}`) + (sgg ? `/${sgg}` : "/0") ); return rswtChkRes; @@ -60,14 +64,15 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( set: any ) => { return { - rswtChkSttnInit: async (searchTxt: string, sggCd: string) => { + rswtChkSttnInit: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { try { - const rswtChkRes = await initFetch(searchTxt, sggCd); + const rswtChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); return set((state: rswtChkSttnState) => ({ ...state, rswtChkSttn: { ...state.rswtChkSttn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, isInit: false, }, })); @@ -104,15 +109,16 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( console.log(error); } }, - rswtChkSttnSearch: async (searchTxt: string, sggCd: string) => { + rswtChkSttnSearch: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { try { - const rswtChkRes = await initFetch(searchTxt, sggCd); + const rswtChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); return set((state: rswtChkSttnState) => ({ ...state, rswtChkSttn: { ...state.rswtChkSttn, - rswtChkRes: rswtChkRes + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index d62406e9f..515c74490 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -1,16 +1,14 @@ import { useWrStore } from "@/app/store"; -import { ScrollArea, Title } from "@common/business_components/ui"; -import { Button } from "@common/components/ui"; -import { useEffect, useState } from "react"; -import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; -import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable"; +import type { TableUpperProps } from "@/app/store/common/type/header"; import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList"; +import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable"; +import { ScrollArea, Title } from "@common/business_components/ui"; +import { Button } from "@common/components/ui"; +import React, { useEffect, useState } from "react"; import type { z } from "zod"; -import React from "react"; -import type { TableUpperProps } from "@/app/store/common/type/header"; -export default function ChkgdModal({ type, obj ,setIsModal }: { type: string; obj: any , setIsModal:(open:boolean)=>void}) { +export default function ChkgdModal({ type, obj, setIsModal }: { type: string; obj: any, setIsModal: (open: boolean) => void }) { const { rainChkgdn, rswtChkgdn, @@ -253,7 +251,8 @@ export default function ChkgdModal({ type, obj ,setIsModal }: { type: string; ob </div> <div className="flex justify-between"> <h3 className="text-2xl font-bold text-gray-900 mt-2 ml-6"> - {`(${obj.bdstNm})`} + {type === "RNB" + ? `(${obj.bdstNm})` : `(${obj.building.bdstNm})`} </h3> {!rainChkSttn.isSttn ? ( <Button className="" onClick={allDataUpdate}> @@ -273,7 +272,7 @@ export default function ChkgdModal({ type, obj ,setIsModal }: { type: string; ob <GuideDetailsTable chgRes={guidData || []} headList={headList.splHeadList} - upheadList={type === "RNB"? rainChkgdn.rainSplHeadNm :rswtChkgdn.rswtSplHeadNm} + upheadList={type === "RNB" ? rainChkgdn.rainSplHeadNm : rswtChkgdn.rswtSplHeadNm} type={""} setChGuidData={(data) => { setChGuidData(data); @@ -287,7 +286,7 @@ export default function ChkgdModal({ type, obj ,setIsModal }: { type: string; ob <GuideDetailsTable chgRes={guidData || []} headList={headList.ruseHeadList} - upheadList={type === "RNB"? rainChkgdn.rainRuseHeadNm :rswtChkgdn.rswtRuseHeadNm} + upheadList={type === "RNB" ? rainChkgdn.rainRuseHeadNm : rswtChkgdn.rswtRuseHeadNm} type={""} setChGuidData={(data) => { setChGuidData(data); diff --git a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx index c6daac3b6..687b27611 100644 --- a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx @@ -25,6 +25,7 @@ export default function RainChkgdTable({ rainChkData, pageNation, onPageChange, + pageCount, }: { detailUp: (data: rainChkZodType[]) => void; handleClick?: (data: any) => void; @@ -32,6 +33,7 @@ export default function RainChkgdTable({ rainChkData?: rainChkZodType[]; pageNation: number; onPageChange: (page: number) => void; + pageCount: number; }) { const { code, rainChkgdn, rainChkSttn, getRainSttnExcel } = useWrStore((state) => state); const [makeTableData, setMakeTableData] = useState<any[]>([]); @@ -74,7 +76,7 @@ export default function RainChkgdTable({ useEffect(() => { setSelectedIds([])// 셀렉트 초기화를 위한 작업 - if (rainChkData&&rainChkData.length>0) { + if (rainChkData && rainChkData.length > 0) { const rainChg = rainChkData?.map((item: any) => { const bud = tableData([item.building], { code }); @@ -86,7 +88,7 @@ export default function RainChkgdTable({ }); setMakeTableData(rainChkTableData(rainChg)); - }else{ + } else { setMakeTableData([]); } }, [rainChkData, code]); @@ -170,14 +172,8 @@ export default function RainChkgdTable({ }) } - }, [rainChkSttn.isSttn, rainChkgdn.rainChkgdnHeadList, rainChkSttn.rainChkgdnHeadList]); - - useEffect(() =>{ - console.log('rainChkgdn.count ', rainChkgdn.rainChkCount) - },[rainChkgdn.rainChkCount]) - return ( <> <LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay> @@ -202,7 +198,7 @@ export default function RainChkgdTable({ </TableBody> </Table> <UiPageNations - total={rainChkgdn.rainChkCount||20} + total={pageCount} cur={pageNation} pageSize={rainPageSize} onPageChange={onPageChange} diff --git a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx index 5264dcdee..e71238706 100644 --- a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx @@ -25,6 +25,7 @@ export default function RswtChkgdTable({ rswtChkData, pageNation, onPageChange, + pageCount, }: { detaiRswtlUpdate: (data: rswtrChkDetailsZodType[]) => void; handleRswtClick?: (data: any) => void; @@ -32,6 +33,7 @@ export default function RswtChkgdTable({ rswtChkData: rswtChkZodType[]; pageNation: number; onPageChange: (page: number) => void; + pageCount: number; }) { const { code, rswtChkgdn, rswtChkSttn, rswtChkgdnInit, rswtChkPolAndGuide, getRswtSttnExcel } = useWrStore( (state) => state @@ -152,7 +154,7 @@ export default function RswtChkgdTable({ </TableBody> </Table> <UiPageNations - total={rswtChkgdn.rswtChkCount} + total={pageCount} cur={pageNation} pageSize={rswtPageSize} onPageChange={onPageChange} From f379425fa70a01650bc49f661afd7a9ecfbdab7d Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Fri, 4 Jul 2025 13:31:24 +0900 Subject: [PATCH 152/259] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EB=8C=80=EC=9E=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/htdflReg/page.tsx | 25 +++++++++++++--- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 4 +++ .../app/ruseFcltMng/fcltReg/rswtReg/page.tsx | 8 ++++- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 12 ++++---- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 6 ---- .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 30 ++++++++++++++----- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 2 +- .../ruseFcltMng/fcltReg/rainReg/type.tsx | 6 ++-- .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 24 +++++++-------- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 10 +++---- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 1 + .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 21 +++++++++---- 12 files changed, 97 insertions(+), 52 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index 33cfa3bba..3016314a2 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -23,7 +23,7 @@ import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; export default function Home() { - const { code, htdfl, initHtdfl, getHtdflBdstData } = useWrStore( + const { code, htdfl, initHtdflReg, getHtdflBdstData ,htdflNmSearch} = useWrStore( (state) => state ); const [searchTxt, setSearchTxt] = useState(""); @@ -42,18 +42,27 @@ export default function Home() { useEffect(() => { if (!htdfl.isInit) { + initHtdflReg('0') } - }, [htdfl.isInit, initHtdfl]); + }, [htdfl.isInit, initHtdflReg]); useEffect(() => { - if (code.sggCd.length > 0) { + if (htdflRes&&htdflRes.length>0) { + + console.log('htdflRes ', htdflRes) const htdflData = tableData(htdflRes, { code }).map( (item: customHtdflBdst) => { + let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' + return { ...item, + archArea:archArea + }; } ); setbdstTable(htdflData); + }else{ + setbdstTable([]); } }, [code, htdflRes]); @@ -104,7 +113,15 @@ export default function Home() { <Button size={"sm"} onClick={() => { - initHtdfl(searchTxt || ""); + console.log(' 조회가 없어11') + if(searchTxt&&searchTxt.length>0){ + htdflNmSearch(String(0),searchTxt) + }else{ + + console.log(' 조회가 없어') + initHtdflReg(String(0) ); + + } }} > 조회 diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index b468fad03..f954ce7f7 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -51,8 +51,12 @@ export default function Home() { if (code.sggCd.length > 0) { const rainData = tableData(rainRes, { code }).map( (item: customRainBdst) => { + + let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' + return { ...item, + archArea:archArea, bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", }; } diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx index ea0dea649..cd91a7fbc 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx @@ -20,6 +20,7 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components"; import { useEffect, useState } from "react"; +import { Toaster } from "react-hot-toast"; export default function Home() { const { code, rswt, initRswt, rswtBdstSearch, getRswtBdstData } = useWrStore( @@ -45,8 +46,12 @@ export default function Home() { if (code.sggCd.length > 0 && rswtRes?.length > 0) { const rswtData = tableData(rswtRes, { code })?.map( (item: customRswtBdst) => { + + let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' + return { ...item, + archArea:archArea, bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N", bdstUsgCd: item.reuseBuilding[0]?.bdstUsgCd, }; @@ -168,7 +173,8 @@ export default function Home() { setBdstChgProps({ ...bdstChgProps, isOpen: open }); }} /> - </ContentsDiv> + <Toaster position="top-center" /> + </ContentsDiv> </> ); } diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 63d2d1d03..c6683accb 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -205,7 +205,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( year: string, sggCd: string ) => { - set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); + // set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); try { const rainChkRes = await initFetch(pageNo, cnt, year, sggCd); set((state: rainChkgdnState) => ({ @@ -214,17 +214,17 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( ...state.rainChkgdn, rainChk: rainChkRes.data, rainChkCount: rainChkRes.count, - isInit: true, // 무한 루프 방지를 위해 isInit을 true로 설정 + isInit: false, // 무한 루프 방지를 위해 isInit을 true로 설정 }, })); } catch (error) { console.log(error); // 에러가 발생하더라도 무한 루프에 빠지지 않도록 isInit을 true로 설정합니다. - set((state: rainChkgdnType) => ({ - rainChkgdn: { ...state.rainChkgdn, isInit: true }, - })); + // set((state: rainChkgdnType) => ({ + // rainChkgdn: { ...state.rainChkgdn, isInit: true }, + // })); } finally { - set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); + // set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); } }, rainChkNmSearch: async ( diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index d40c1190c..6edee720b 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -183,7 +183,6 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( year: string, sggCd: string ) => { - set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); try { const rswtChkRes = await initFetch(pageNo, cnt, year, sggCd); @@ -198,11 +197,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( })); } catch (error) { console.log(error); - set((state: rswtChkgdnType) => ({ - rswtChkgdn: { ...state.rswtChkgdn, isInit: true }, - })); } finally { - set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } })); } }, rswtChkNmSearch: async ( @@ -230,7 +225,6 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( ...state.rswtChkgdn, rswtChkRes: rswtChkRes.data, rswtChkCount: rswtChkRes.count, - isInit: false, }, })); } catch (error) { diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index f2875e232..4e764d7ae 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -76,8 +76,7 @@ export const hdtflZod = z.object({ .date() .default(() => new Date()) .nullish(), - archArea: z.number().default(0), - archChgArea: z.number().nullish().default(0), + archArea: z.string().default(''), rgtr: z.string().nullish().default(null), mdfr: z.string().nullish().default(null), reuseBuilding: z @@ -99,7 +98,8 @@ export type htdflFacState = { }; }; type htdflFacSActions = { - initHtdfl: (code: string) => void; + initHtdflReg: (code: string) => void; + htdflNmSearch: (code: string, fcltNm:string) => void; htdflBdstUpdate: (data: customHtdflBdst, code: string | number) => void; htdflBdstReg: (data: customHtdflBdst, code: string | number) => void; getHtdflBdstData: (pageNation: number, code: string | number) => void; @@ -142,9 +142,11 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( console.log(e); } }, - initHtdfl: async (code: string) => { + initHtdflReg: async (code: string) => { try { const htdflRes = await initFetch(code); + + console.log('htdflRes ', htdflRes) set((state: htdflFacState) => { return { ...state, @@ -162,10 +164,8 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( htdflBdstUpdate: async (data: customHtdflBdst, code: string | number) => { try { - console.log('data ', data) const chData = await makeMdfr(data); - console.log('chData ', chData) const res = await putFectch("/drain/facility", chData); if (res.ok) { @@ -208,6 +208,22 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( toast.error("온배수 건축물 등록 오류입니다.."); } - } + },htdflNmSearch :async(code:string | number, fcltNm:string) =>{ + try { + const htdflRes = await getFetch("wr", `/drain/facilityList/1/20/${code}/${fcltNm}`); + set((state: htdflFacState) => { + return { + ...state, + htdfl: { + ...state.htdfl, + htdflRes: htdflRes, + isInit: false, + }, + }; + }); + } catch (error) { + console.log(error); + } + }, }; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index d4cfebfca..6ceb75531 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -34,7 +34,7 @@ export const rainZod = z.object({ bdstNm: z.string().default(""), frstArchPrmsnDt: z.date().default(() => new Date()), archChgPrmsnDt: z.coerce.date().nullish().default(null), - archArea: z.number().default(0), + archArea: z.string().default(''), archChgArea: z.number().default(0), rgtr:z.string().nullish(), mdfr:z.string().nullish(), diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx index 2d17b4601..32fea3ebb 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx @@ -25,9 +25,9 @@ export const baseReuseBuildingSchema = z.object({ { message: validationMessages.yearFormat, } - ), - grntchBdstCertNo: z.string().default(""), - grntchBdstCertGrd: z.string().default(""), + ).nullish(), + grntchBdstCertNo: z.string().default("").nullish(), + grntchBdstCertGrd: z.string().default("").nullish(), crgRdctYn: z.string().default("N").nullish(), /// 안쓰는 값 crgRdctBss: z.string().default("").nullish(), /// 안쓰는 값 crgRdctAmt: z.number().default(0), // 안쓰는 값 diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 178badd3b..165a65021 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -5,11 +5,12 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import { z } from "zod"; import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "../rainReg/type"; import { makeMdfr, makeRstr } from "../bdstReg"; +import toast from "react-hot-toast"; const rswtrObjSchema = z.object({ bdstRuseFcltFk: z.number().nullish(), - wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), - oblgTrgtWtrUsqty: z.number().nullish().default(0), + // wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), + //oblgTrgtWtrUsqty: z.number().nullish().default(0), orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }), filtrTrtmfctCpct: z.number({ required_error: validationMessages.required("처리시설 용량") }).positive({ message: validationMessages.required("처리시설 용량") }), filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }), @@ -36,8 +37,7 @@ export const rswtZod = z.object({ frstArchPrmsnDt: z.date().default(() => new Date()), archChgPrmsnDt: z.coerce.date().nullish().default(null), chBuildingYn: z.string().nullish(), - archArea: z.number().default(0), - archChgArea: z.number().default(0), + archArea: z.string().default(''), rgtr: z.string().nullish().default(null), mdfr: z.string().nullish().default(null), bdstUsgText: z.string().default(""), @@ -152,8 +152,8 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( try { const chData = await makeMdfr(data); const res = await putFectch("/reuseFc/waterreuseFc", chData); - if (res.ok) { - alert("등록이 완료되었습니다."); + if (res.status === 200) { + toast.success("중수도 시설 수정이 완료되었습니다."); const rswtRes = await initFetch(code); set((state: rswtFacState) => ({ ...state, @@ -165,10 +165,8 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( })); } } catch (errorUpdate) { - alert( - "업데이트 오류입니다. " + - (errorUpdate instanceof Error ? errorUpdate.message : "") - ); + toast.error("중수도 시설 수정 오류입니다."); + } finally { } }, @@ -193,11 +191,11 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( }) .then((chch: any) => { if (chch.ok) { - alert("등록이 완료되었습니다."); + toast.success("중수도 시설이 등록이 되었습니다."); } }); } else { - alert("등록이 완료되었습니다."); + toast.success("중수도 시설이 등록이 되었습니다."); } } const rainRes = await initFetch(code); @@ -211,7 +209,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( })); } catch (e) { console.log("e", e); - alert("등록 오류입니다."); + toast.success("중수도 시설이 등록 오류입니다."); } finally { } }, diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 8ae9ad4dd..04b36cbc5 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -89,7 +89,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { return ( <> - <h1 className={formH1Class}>건축물 기본 정보</h1> + <h1 className={formH1Class}> { type !== "HTB"?"건축물 기본 정보": '발전소 기본 정보'}</h1> <div className="grid grid-cols-6 gap-2 mt-4"> <div className="col-span-3"> <FormField @@ -140,10 +140,10 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { control={form.control} name="bdstNm" render={({ field }) => ( - <FormUi label="건축물명"> + <FormUi label={ type !== "HTB"?"건축물명": '발전소명'}> <Input className={selectClass} - placeholder="건축물 명 입력하세요" + placeholder= {type !== "HTB"?"건축물 명 입력하세요":'발전소명 입력하세요' } type="text" {...field} /> @@ -156,7 +156,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { control={form.control} name="daddr" render={({ field }) => ( - <FormUi label="건축물 주소"> + <FormUi label= { type !== "HTB"?"건축물 주소": '발전소 주소'} > <Input className={selectClass} placeholder="위치를 입력해주세요" @@ -173,7 +173,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { control={form.control} name="frstArchPrmsnDt" render={({ field }) => ( - <FormUi label="최초건축허가일"> + <FormUi label= { type !== "HTB"?"최초건축허가일": '준공년도'} > <DatePicker mode={"single"} field={{ diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index 7333f6091..0bf7cf786 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -54,6 +54,7 @@ export default function RainRegForm({ raw?.reuseBuilding && raw.reuseBuilding.length > 0 ? raw.reuseBuilding : [{}]; + return { ...raw, frstArchPrmsnDt: raw?.frstArchPrmsnDt diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index ed0e51af6..587cde3fb 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -59,10 +59,16 @@ export default function RswtrRegForm({ rswtBdstReg(values, "41"); if (setIsModal) setIsModal(false); } else { + + rswtBdstUpdate(values, "41"); } }; - const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => { + + const filtrTrtmfctCpct = form.watch('reuseBuilding.0.filtrTrtmfctCpct') + const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => { + + console.log('raw ', raw) return { ...raw, frstArchPrmsnDt: raw?.frstArchPrmsnDt @@ -82,11 +88,17 @@ export default function RswtrRegForm({ rswtrObj: { ...item?.rswtrObj, filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", + filtrTrtmfctCpct:item.rswtrObj.filtrTrtmfctCpct || 0, + filtrTrtmfctProcs:item.rswtrObj.filtrTrtmfctProcs||code.rswtPrscCdMthdCd[0]?.val, + orgwtKndCd:item?.rswtrObj.orgwtKndCd || code.orgwtKndCd[0]?.val , }, })), }; }; + useEffect(() =>{ + console.log(' formform ', form.watch()) + },[form.formState]) useEffect(() => { console.log("form errors:", form.formState.errors); }, [form.formState.errors]); @@ -253,7 +265,7 @@ export default function RswtrRegForm({ selectClass={selectClass} selectArray={code.orgwtKndCd} onSelectValue={readonly ? () => {} : field.onChange} - value={field.value ?? code.orgwtKndCd[0]?.val} + value={field.value || code.orgwtKndCd[0]?.val} readOnly={readonly} /> </FormUi> @@ -272,7 +284,7 @@ export default function RswtrRegForm({ label={""} selectArray={code.rswtPrscCdMthdCd} onSelectValue={readonly ? () => {} : field.onChange} - value={field.value ?? code.rswtPrscCdMthdCd[0]?.val} + value={field.value || code.rswtPrscCdMthdCd[0]?.val} readOnly={readonly} /> </FormUi> @@ -433,9 +445,6 @@ export default function RswtrRegForm({ } }} disabled={grntchBdstCertYn !== "Y"} - - - /> </FormUi> )}} From e579684b28a93d5451ccc3282e0ed0de91686ba4 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Fri, 4 Jul 2025 14:00:20 +0900 Subject: [PATCH 153/259] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=EC=A7=80=EB=8F=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- apps/wr/.env.development | 12 ++++++++++++ apps/wr/.env.local | 14 ++++++++++++++ apps/wr/.gitignore | 2 +- apps/wr/app/map/service/map.ts | 4 ++-- packages/common/business_components/package.json | 1 + .../common/business_components/src/ui/map/Gis.js | 2 ++ 7 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 apps/wr/.env.development create mode 100644 apps/wr/.env.local diff --git a/.gitignore b/.gitignore index d0bb49da9..6b685ea40 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,5 @@ apps/wr/.next/**/* apps/fo/.next/**/* # env -.env* +#.env* .qodo diff --git a/apps/wr/.env.development b/apps/wr/.env.development new file mode 100644 index 000000000..dccfb1453 --- /dev/null +++ b/apps/wr/.env.development @@ -0,0 +1,12 @@ +NEXT_PUBLIC_SITE_ID = WR +NEXT_PUBLIC_PORT = 11301 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301 +NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_TEMP_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_CLAIM_NAME = Authorization +NEXT_PUBLIC_AUTH_USER_ID = token-id +NEXT_PUBLIC_ACCESS_TOKEN = access-token +NEXT_PUBLIC_REFRESH_TOKEN = refresh-token + +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API diff --git a/apps/wr/.env.local b/apps/wr/.env.local new file mode 100644 index 000000000..858181f32 --- /dev/null +++ b/apps/wr/.env.local @@ -0,0 +1,14 @@ +NEXT_PUBLIC_SITE_ID = WR +NEXT_PUBLIC_PORT = 3001 +NEXT_PUBLIC_PROXY_HOST = http://localhost:3001 +NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_TEMP_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_CLAIM_NAME = Authorization +NEXT_PUBLIC_AUTH_USER_ID = token-id +NEXT_PUBLIC_ACCESS_TOKEN = access-token +NEXT_PUBLIC_REFRESH_TOKEN = refresh-token + +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +#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 # 박이정 diff --git a/apps/wr/.gitignore b/apps/wr/.gitignore index 5ef6a5207..8c5b2ee3a 100644 --- a/apps/wr/.gitignore +++ b/apps/wr/.gitignore @@ -31,7 +31,7 @@ yarn-error.log* .pnpm-debug.log* # env files (can opt-in for committing if needed) -.env* +#.env* # vercel .vercel diff --git a/apps/wr/app/map/service/map.ts b/apps/wr/app/map/service/map.ts index bf0c8a694..5002afef7 100644 --- a/apps/wr/app/map/service/map.ts +++ b/apps/wr/app/map/service/map.ts @@ -2,8 +2,8 @@ /** * 관망도 API */ -// const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map` -const API_URL = "http://con.mind-one.co.kr:11083/sewerage-service/api/v1/map"; + const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}/v1/map` +//const API_URL = "http://con.mind-one.co.kr:11083/sewerage-service/api/v1/map"; export type LyrStngProps = { lyr_sn: string diff --git a/packages/common/business_components/package.json b/packages/common/business_components/package.json index da6f8c344..2c0b6ea47 100644 --- a/packages/common/business_components/package.json +++ b/packages/common/business_components/package.json @@ -44,6 +44,7 @@ "recharts": "^2.15.1", "sonner": "^2.0.1", "tailwind-merge": "^3.0.1", + "tailwindcss-animate": "^1.0.7", "xlsx": "^0.18.5", "xlsx-populate": "^1.21.0", "zod": "^3.24.2" diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 6d46e77aa..6e13d70c5 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -209,11 +209,13 @@ function Gis({ isOpen, gisMaps, isSearchModalOpen, treeData = [], isSearch = fal onClose={closePopup} // 닫기 콜백 전달 /> )} + {SearchView &&( <SearchView open={isSearchModalOpen} onOpenChange={setIsSearchModalOpen} onFeatureSelect={onFeatureSelect} /> + )} <GisLonLat /> <GisToolBar /> <GisMapToggle /> From ea0c85b0c3d7fcf99ddca71da3fdb60910eaefe5 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Fri, 4 Jul 2025 14:30:02 +0900 Subject: [PATCH 154/259] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=ED=98=84=ED=99=A9=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=8B=9C=EC=84=A4=EB=AA=85=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 7 ++-- .../prfmncSttn/chkgdnSttn/page.tsx | 41 +++++++++++++++++-- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 3 +- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 28 ++++++++++--- .../chkgdnSttn/rswtChkgdnSttn/index.tsx | 22 ++++++++-- 5 files changed, 83 insertions(+), 18 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 328bb8b88..c5f7b198a 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -83,7 +83,7 @@ export default function Page() { String(new Date().getFullYear()) ); const cellClick = () => { - if (searchYear) + if (searchYear) { if (selFcltDiv === "RNB") { if (fcltNm) { rainChkNmSearch( @@ -99,8 +99,8 @@ export default function Page() { } else { if (fcltNm) { rswtChkNmSearch( - rainPageNation, - rainPageSize, + rswtPageNation, + rswtPageSize, searchYear, commonCd, fcltNm @@ -109,6 +109,7 @@ export default function Page() { rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd); } } + } }; const rainPageChange = (pageNo: number) => { if (pageNo > 0) { diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index 60040833b..592a6826e 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -15,6 +15,7 @@ import { SearchDiv, SearchFormLeft, SearchFormRight, + SearchInput, SelectBox, Title, UiModal @@ -30,9 +31,9 @@ export default function Page() { rainChkSttn, rswtChkSttn, rainChkSttnInit, - rainChkSttnSearch, - rswtChkSttnSearch, + rainChkSttnNmSearch, rswtChkSttnInit, + rswtChkNmSttnSearch, isRainSttn, isRswtSttn, rswtChkPolInit, @@ -43,6 +44,7 @@ export default function Page() { const [selFcltDiv, setSelFcltDiv] = useState("RNB"); const [rainPageNation, setRainPageNation] = useState(1); const [rswtPageNation, setRswtPageNation] = useState(1); + const [fcltNm, setFcltNm] = useState<string>(""); const [isModal, setIsModal] = useState({ open: false, data: {}, @@ -51,9 +53,29 @@ export default function Page() { const cellClick = () => { if (searchYear) { if (selFcltDiv === "RNB") { - rainChkSttnSearch(rainPageNation, rainPageSize, searchYear, commonCd); + if (fcltNm) { + rainChkSttnNmSearch( + rainPageNation, + rainPageSize, + searchYear, + commonCd, + fcltNm + ); + } else { + rainChkSttnInit(rainPageNation, rainPageSize, searchYear, commonCd); + } } else { - rswtChkSttnSearch(rswtPageNation, rswtPageSize, searchYear, commonCd); + if (fcltNm) { + rswtChkNmSttnSearch( + rswtPageNation, + rswtPageSize, + searchYear, + commonCd, + fcltNm + ); + } else { + rswtChkSttnInit(rswtPageNation, rswtPageSize, searchYear, commonCd); + } } } }; @@ -151,6 +173,17 @@ export default function Page() { value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val} /> </div> + <div className="col-span-2 flex flex-row space-x-2"> + <Label className="w-28 mt-2 text-xl text-gray-600"> + {"시설명"} + </Label> + <SearchInput + className={"w-full text-2xl"} + label={""} + textValue={fcltNm || ""} + setText={setFcltNm} + /> + </div> </SearchFormLeft> <SearchFormRight> <div className="space-y"> diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index 6e0a805b6..235b4f3e2 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -217,12 +217,11 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( "wr", `/reuseChk/reuseWater` + (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/20") + + (cnt ? `/${cnt}` : "/5") + (year ? `/${year}` : `/${currentYear}`) + (sggCd ? `/${sggCd}` : "/0") + (txt ? `/${txt}` : "") ); - return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index 895f096ef..43c3969e2 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -36,9 +36,9 @@ export type rainChkSttnState = { type rainChkSttnActions = { rainChkSttnInit: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; - rainChkSttnSearch: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; isRainSttn: (isSttn: boolean) => void; getRainSttnExcel: (excelList: rainChkZodType[]) => void; + rainChkSttnNmSearch: (pageNo: number, cnt: number, year: string, sggCd: string, txt: string) => void }; export type rainChkSttnType = rainChkSttnState & rainChkSttnActions; @@ -91,21 +91,37 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( console.log(error); } }, - rainChkSttnSearch: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { + rainChkSttnNmSearch: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => { try { - const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); - + const currentYear = new Date().getFullYear(); + const rainChkRes = await getCountFetch( + "wr", + `/reuseChk/rainy` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/5") + + (year ? `/${year}` : `/${currentYear}`) + + (sggCd ? `/${sggCd}` : "/0") + + (txt ? `/${txt}` : "") + ); return set((state: rainChkSttnState) => ({ ...state, rainChkSttn: { ...state.rainChkSttn, - rainChkRes: rainChkRes + rainChkRes: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); } catch (error) { console.log(error); } - }, isRainSttn: (isSttn: boolean) => { + }, + isRainSttn: (isSttn: boolean) => { try { return set((state: rainChkSttnState) => ({ ...state, diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx index 519cd39b2..f1d7a7d19 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx @@ -28,7 +28,7 @@ type rswtChkSttnActions = { rswtChkSttnInit: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; isRswtSttn: (isSttn: boolean) => void; getRswtSttnExcel: (excelList: rswtChkZodType[]) => void; - rswtChkSttnSearch: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; + rswtChkNmSttnSearch: (pageNo: number, cnt: number, year: string, sggCd: string, txt: string) => void; }; export type rswtChkSttnType = rswtChkSttnState & rswtChkSttnActions; @@ -109,9 +109,24 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( console.log(error); } }, - rswtChkSttnSearch: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { + rswtChkNmSttnSearch: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => { try { - const rswtChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); + const currentYear = new Date().getFullYear().toString(); + const rswtChkRes = await getCountFetch( + "wr", + `/reuseChk/reuseWater` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/20") + + (year ? `/${year}` : `/${currentYear}`) + + (sggCd ? `/${sggCd}` : "/0") + + (txt ? `/${txt}` : "") + ); return set((state: rswtChkSttnState) => ({ ...state, @@ -119,6 +134,7 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( ...state.rswtChkSttn, rswtChkRes: rswtChkRes.data, rswtChkCount: rswtChkRes.count, + isInit: false, }, })); } catch (error) { From 7bbab96c4be6404ef868c85c60b7b94ccd5cb506 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Fri, 4 Jul 2025 15:12:51 +0900 Subject: [PATCH 155/259] =?UTF-8?q?=EB=AC=BC=EC=9E=AC=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=EC=82=AC=EB=A1=80=EA=B4=80=EB=A6=AC=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5(=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80)=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx | 16 ++++++++----- .../wr/app/store/matDmd/ruseCaseMng/index.tsx | 23 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx index 517dab0c0..a81a85e19 100644 --- a/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseCaseMng/page.tsx @@ -26,7 +26,7 @@ import { toast, Toaster } from "react-hot-toast"; export default function RuseCaseMng() { const { code, ruseCaseMng, selectRuseCaseMng } = useWrStore((state) => state); - const { ruseCaseMngList, status } = ruseCaseMng; + const { ruseCaseMngList, status, count } = ruseCaseMng; const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>([]); const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); @@ -36,8 +36,10 @@ export default function RuseCaseMng() { const [name, setName] = useState<string>(""); // 물재이용사례 조회 - const searchRuseCaseMng = async () => { + const searchRuseCaseMng = async (pageNo: number, pageSize: number) => { const res = await selectRuseCaseMng( + pageNo, + pageSize, sidoCd ?? "", sigunguCd ?? "", selectUtz[0] ?? "", @@ -70,7 +72,7 @@ export default function RuseCaseMng() { // 다운로드 const download = () => { - searchRuseCaseMng(); + searchRuseCaseMng(1, 10000);; fetch(`/sample_ruseCaseMng.xlsx`, {}).then(async (response) => { if (!response.ok) { @@ -210,7 +212,7 @@ export default function RuseCaseMng() { <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2"> <div className="space-y"> <div className="flex flex-row space-x-2"> - <Button size={"sm"} onClick={() => { searchRuseCaseMng() }}> + <Button size={"sm"} onClick={() => { searchRuseCaseMng(1, 20) }}> 조회 </Button> <Button size={"sm"} onClick={() => { setIsExcelOpen({ isModal: true }); }}> @@ -238,9 +240,11 @@ export default function RuseCaseMng() { children={undefined} headlist={ruseCaseMng.ruseHeadList} pageSize={20} - total={100000} + total={count} cellClick={(index: number | undefined, headId: string) => {}} - onPageChange={() => {}} + onPageChange={(pageNo: number) => { + searchRuseCaseMng(pageNo, 10); + }} /> </div> </ListDiv> diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx index 76468d249..5a2ad235e 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/index.tsx @@ -1,4 +1,4 @@ -import { fetchType, getFetch, postFectch } from "@/components/lib/api"; +import { fetchType, getFetch, getFetchWithCount, postFectch } from "@/components/lib/api"; import type { TableUpperProps } from "../../common/type/header"; import { ruseCaseHeadListExport } from "./headList"; import { toast } from "react-hot-toast"; @@ -7,6 +7,7 @@ export type ruseCaseState = { ruseHeadList:TableUpperProps[]; ruseCaseMngList:ruseCaseMngExcelProps[]; status: number; + count: number; }; }; @@ -64,14 +65,14 @@ export interface ruseCaseMngExcelProps { } type ruseCaseActions = { - selectRuseCaseMng: (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => Promise<void>; + selectRuseCaseMng: (pageNo: number, pageSize: number, sidoCd: string, sigunguCd: string, usageCd : string, name: string) => Promise<void>; insertRuseCaseMng: (data: any) => Promise<void>; }; -export const fetchSearchRuseCaseMng = async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { - const tailUrl = ((sigunguCd !== '전체' && sigunguCd !=='') ? `/${sigunguCd}` : (sidoCd != '전체' && sidoCd != '') ? `/${sidoCd}` : `/0`) + (usageCd? `/${usageCd}` : '/0') + (name? `/${name}` : ''); - const resp = await getFetch(fetchType.WR,`/reuseFc/pubFcRuseCase${tailUrl}`); - return resp; +export const fetchSearchRuseCaseMng = async (pageNo: number, pageSize: number, sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { + const tailUrl = '/'+pageNo+'/'+pageSize+ ((sigunguCd !== '전체' && sigunguCd !=='') ? `/${sigunguCd}` : (sidoCd != '전체' && sidoCd != '') ? `/${sidoCd}` : `/0`) + (usageCd? `/${usageCd}` : '/0') + (name? `/${name}` : ''); + const resp = await getFetchWithCount(fetchType.WR,`/reuseFc/pubFcRuseCase${tailUrl}`); + return {data:resp.data, count:resp.count}; }; export const fetchInsertRuseCaseMng = async (data: any) => { @@ -86,6 +87,7 @@ export const ruseCaseStateExport: ruseCaseState = { ruseHeadList:ruseCaseHeadListExport, ruseCaseMngList:[], status: 0, + count: 0, }, }; @@ -93,12 +95,13 @@ export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( set: any ) => { return { - selectRuseCaseMng: async (sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { - const res = await fetchSearchRuseCaseMng(sidoCd, sigunguCd, usageCd, name); + selectRuseCaseMng: async (pageNo: number, pageSize: number, sidoCd: string, sigunguCd: string, usageCd : string, name: string) => { + const res = await fetchSearchRuseCaseMng(pageNo, pageSize, sidoCd, sigunguCd, usageCd, name); set((state: ruseCaseState) => ({ ruseCaseMng: { ...state.ruseCaseMng, - ruseCaseMngList: res, + ruseCaseMngList: res.data, + count: res.count, }, })); }, @@ -118,4 +121,4 @@ export const ruseCaseActionsExport: (set: any) => ruseCaseActions = ( })); }, }; -}; +}; \ No newline at end of file From cec35e67241df033c783397ac1c7321bb255e22a Mon Sep 17 00:00:00 2001 From: truthwing <truthplumage@gmail.com> Date: Fri, 4 Jul 2025 15:40:13 +0900 Subject: [PATCH 156/259] jyha product --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 159 +++++++++++++---- .../prfmncSttn/chkgdnSttn/page.tsx | 27 ++- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 163 ++++++++++++++---- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 151 ++++++++++------ .../chkgdnSttn/rainChkgdnSttn/index.tsx | 40 +++-- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 27 +-- .../chkgdTable/rainChkgd/rainChkgdTable.tsx | 29 ++-- .../chkgdTable/rswtChkgd/rswtChkgdTable.tsx | 21 ++- 8 files changed, 439 insertions(+), 178 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index d03ae70fe..0ac9145a5 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -1,10 +1,14 @@ "use client"; import { useWrStore } from "@/app/store"; -import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import type { - rswtChkZodType, - rswtrChkDetailsZodType, +import { + commonCd, + rainPageSize, + type rainChkZodType, +} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { + rswtPageSize, + type rswtrChkDetailsZodType, } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { excelArrayDownload, @@ -15,6 +19,7 @@ import ChkgdExcel from "@/components/ui/modal/chkgd/chkgdExcel/chkgdExcel"; import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal"; import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable"; import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable"; +import { SearchInput } from "@common/business_components"; import { ContentsDiv, SearchDiv, @@ -26,8 +31,14 @@ import { } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { Button, Label } from "@common/components/ui"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@common/components/ui/tooltip"; import { useCallback, useEffect, useState } from "react"; -import { Toaster } from "react-hot-toast"; +import toast, { Toaster } from "react-hot-toast"; export default function Page() { const { @@ -39,8 +50,10 @@ export default function Page() { rainChkDelete, rainChkExcelDownload, rainChkHeadChange, + rainChkNmSearch, isRainSttn, rswtChkgdnInit, + rswtChkNmSearch, rswtChkPolInit, rswtChkDetilsUpdate, rswtChkDelete, @@ -57,21 +70,36 @@ export default function Page() { rswtrChkDetailsZodType[] >([]); const [deleteIdx, setDeleteIdx] = useState<number[]>([]); - const [pageNation, setPageNation] = useState(1); + const [rainPageNation, setRainPageNation] = useState(1); + const [rswtPageNation, setRswtPageNation] = useState(1); + const [fcltNm, setFcltNm] = useState<string>(""); const [selFcltDiv, setSelFcltDiv] = useState("RNB"); const [isModal, setIsModal] = useState({ open: false, data: {}, }); + const [searchYear, setSearchYear] = useState<string>( + String(new Date().getFullYear()) + ); const cellClick = () => { - if (searchYear) { + if (searchYear) if (selFcltDiv === "RNB") { - rainChkInit("1", "20", searchYear, "0"); + if (fcltNm) { + rainChkNmSearch( + rainPageNation, + rainPageSize, + searchYear, + commonCd, + fcltNm + ); + } else { + rainChkInit(rainPageNation, rainPageSize, searchYear, commonCd); + } } else { if (fcltNm) { rswtChkNmSearch( - rswtPageNation, - rswtPageSize, + rainPageNation, + rainPageSize, searchYear, commonCd, fcltNm @@ -80,27 +108,46 @@ export default function Page() { rswtChkgdnInit(rswtPageNation, rswtPageSize, searchYear, commonCd); } } + }; + const rainPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRainPageNation(pageNo); + rainChkInit(pageNo, rainPageSize, searchYear, commonCd); + } + }; + const rswtPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRswtPageNation(pageNo); + rswtChkgdnInit(pageNo, rswtPageSize, searchYear, commonCd); } }; - const [searchYear, setSearchYear] = useState<string>( - String(new Date().getFullYear()) - ); - useEffect(() => { if (!rainChkgdn.isInit) { - rainChkInit("1", "20", new Date().getFullYear().toString(), "0"); + rainChkInit( + 1, + rainPageSize, + new Date().getFullYear().toString(), + commonCd + ); isRainSttn(false); setIsModal({ data: {}, open: false }); setIsRegExcel(false); } + }, [rainChkgdn.isInit, rainChkInit, rainPageSize]); + useEffect(() => { if (!rswtChkgdn.isInit) { - rswtChkgdnInit("1", "20", new Date().getFullYear().toString(), "0"); + rswtChkgdnInit( + 1, + rswtPageSize, + new Date().getFullYear().toString(), + commonCd + ); setIsModal({ data: {}, open: false }); setIsRegExcel(false); } - }, [rainChkgdn.isInit, rainChkInit]); + }, [rswtChkgdn.isInit, rswtChkgdnInit, rswtPageSize]); useEffect(() => { if (rswtChkgdn.excelList[0] && rswtChkgdn.excelList[0]?.data.length > 1) { @@ -144,8 +191,8 @@ export default function Page() { ); useEffect(() => { - //rainChkgdn.isSttn = false; - //rswtChkgdn.isSttn = false; + rainChkgdn.isSttn = false; + rswtChkgdn.isSttn = false; if (!rainChkgdn.isSttn && !rswtChkgdn.isSttn) { rainChkHeadChange({ rainChkgdn }, true); rswtChkHeadChange({ rswtChkgdn }, true); @@ -163,9 +210,17 @@ export default function Page() { }; const chkUpdateTable = (selFcltDiv: string) => { if (selFcltDiv === "RNB") { + if (updateRainDetail && updateRainDetail.length > 0) { rainChkDetilUpdate(updateRainDetail); } else { + toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); + } + } else { + if (updateRswtDetail && updateRswtDetail.length > 0) { rswtChkDetilsUpdate(updateRswtDetail); + } else { + toast.error("수정을 원하는 행을 선택하고 저장버튼을 눌러주세요 "); + } } }; @@ -187,10 +242,8 @@ export default function Page() { selectArray={yearOptions} value={searchYear} onSelectValue={(val: string | number) => { - setSearchYear(String(val)) - } - - } + setSearchYear(String(val)); + }} /> </div> <div className="col-span-2 flex flex-row space-x-2"> @@ -204,12 +257,22 @@ export default function Page() { selectArray={rainChkgdn.fcltDiv} onSelectValue={(val: string | number) => { if (val === "RST") rswtChkPolInit(); - setSelFcltDiv(String(val)) - } - } + setSelFcltDiv(String(val)); + }} value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val} /> </div> + <div className="col-span-2 flex flex-row space-x-2"> + <Label className="w-28 mt-2 text-xl text-gray-600"> + {"시설명"} + </Label> + <SearchInput + className={"w-full h-full text-2xl"} + label={""} + textValue={fcltNm || ""} + setText={setFcltNm} + /> + </div> </SearchFormLeft> <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> <div className="space-y"> @@ -230,6 +293,10 @@ export default function Page() { > 삭제 </Button> + + <TooltipProvider> + <Tooltip> + <TooltipTrigger asChild> <Button size={"sm"} onClick={() => { @@ -238,6 +305,16 @@ export default function Page() { > 저장 </Button> + </TooltipTrigger> + <TooltipContent side="bottom" sideOffset={5}> + <h2 className="text-xl"> + 아래 테이블에 선택을 체크하면 입력셀이 활성화 됩니다. + </h2> + </TooltipContent> + </Tooltip> + </TooltipProvider> + + <Button size={"sm"} onClick={() => { @@ -264,17 +341,18 @@ export default function Page() { detailUp={setUpdateRainDetail} handleClick={handleClick} rainChkData={rainChkgdn.rainChk} - pageNation={pageNation} - onPageChange={setPageNation} - /> + pageNation={rainPageNation} + onPageChange={rainPageChange} + pageCount={rainChkgdn.rainChkCount} /> ) : ( <RswtChkgdTable detaiRswtlUpdate={setUpdateRSwtDetail} deleteRswtData={setDeleteIdx} handleRswtClick={handleClick} rswtChkData={rswtChkgdn.rswtChkRes} - pageNation={pageNation} - onPageChange={setPageNation} + pageNation={rswtPageNation} + onPageChange={rswtPageChange} + pageCount={rswtChkgdn.rswtChkCount} /> )} </ListDiv> @@ -282,17 +360,28 @@ export default function Page() { </div> <UiModal open={isModal.open} - onOpenChange={() => { - setIsModal({ open: !open, data: {} }); + onOpenChange={(open: boolean) => { + setIsModal((prev) => ({ ...prev, open })); }} bodyClass={"w-[80vw] max-w-none"} - body={<ChkgdModal type={selFcltDiv} obj={isModal.data} />} + body={ + <ChkgdModal + type={selFcltDiv} + obj={isModal.data} + setIsModal={(open) => setIsModal((prev) => ({ ...prev, open }))} + /> + } ></UiModal> <UiModal open={isRegExcel} onOpenChange={setIsRegExcel} bodyClass={"w-[30vw] max-w-none"} - body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>} + body={ + <ChkgdExcel + type={selFcltDiv} + setIsRegExcel={setIsRegExcel} + ></ChkgdExcel> + } /> <Toaster position="top-center" /> </ContentsDiv> diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index a3dbd70b9..f8669bd2c 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -1,6 +1,8 @@ "use client"; import { useWrStore } from "@/app/store"; +import { commonCd, rainPageSize } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { rswtPageSize } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { excelDownload, yearOptions @@ -77,23 +79,36 @@ export default function Page() { } } }; +const rainPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRainPageNation(pageNo); + rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd); + } + }; + + const rswtPageChange = (pageNo: number) => { + if (pageNo > 0) { + setRswtPageNation(pageNo); + rswtChkSttnInit(pageNo, rswtPageSize, searchYear, commonCd); + } + }; useEffect(() => { if (!rainChkSttn.isInit) { isRainSttn(true) - rainChkSttnInit(new Date().getFullYear().toString(), "0"); + rainChkSttnInit(1, rainPageSize, new Date().getFullYear().toString(), commonCd); setIsModal({ data: {}, open: false }); } - }, [rainChkSttn.isInit, rainChkSttnInit]); + }, [rainChkSttn.isInit, rainChkSttnInit, rainPageSize]); useEffect(() => { - if (!rswtChkSttn.isInit) { setIsModal({ data: {}, open: false }); - rswtChkSttnInit(new Date().getFullYear().toString(), "0"); + rswtChkSttnInit(1, rswtPageSize, new Date().getFullYear().toString(), commonCd); isRswtSttn(true) } - }, [rswtChkSttn.isInit, rswtChkSttnInit]) + }, [rswtChkSttn.isInit, rswtChkSttnInit, rswtPageSize]) + const handleClick = useCallback( @@ -222,7 +237,7 @@ export default function Page() { setIsModal({ open: !open, data: {} }); }} bodyClass={"w-[80vw] max-w-none"} - body={<ChkgdModal type={selFcltDiv} obj={isModal.data} />} + body={<ChkgdModal type={selFcltDiv} obj={isModal.data} setIsModal={() => { }} />} ></UiModal> <Toaster position="top-center" /> </ContentsDiv> diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 4c7f2d514..e256b4ef4 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -1,26 +1,31 @@ import { buildingType } from "@/app/store/common/code"; +import type { TableUpperProps } from "@/app/store/common/type/header"; import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { deleteFectch, fetchType, + getCountFetch, getFetch, postFectch, putFectch, } from "@/components/lib/api"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import type { SelectDataType } from "@common/business_components/ui"; +import toast from "react-hot-toast"; import { z } from "zod"; import { buildingToExcelType } from "./excel"; import { rainChkgdnHeadListExport, rainChkZod, - rainHeadNmExport, + rainMainHeadNmExport, + rainRuseHeadNmExport, + rainSplHeadNmExport, ruseHeadListExport, splHeadListExport, type chHeadType, } from "./headList"; -import type { TableUpperProps } from "@/app/store/common/type/header"; -import toast from "react-hot-toast"; + +export const rainPageSize = 5; +export const commonCd = "41"; export type rainChkZodType = z.infer<typeof rainChkZod>; const fcltDiv = [ @@ -28,16 +33,20 @@ const fcltDiv = [ { val: "RNB", text: "빗물이용시설" }, ]; -const rainHeadNm = rainHeadNmExport; +const rainRuseHeadNm = rainRuseHeadNmExport; +const rainSplHeadNm = rainSplHeadNmExport; const rainChkgdnHeadList = rainChkgdnHeadListExport; const ruseHeadList = ruseHeadListExport; const splHeadList = splHeadListExport; +const rainMainHeadNm = rainMainHeadNmExport const rainChk: rainChkZodType[] = []; export type rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList: TableUpperProps[]; + rainSplHeadNm:chHeadType[] + rainRuseHeadNm:chHeadType[] rainChk: rainChkZodType[]; rainHeadNm: chHeadType[]; ruseHeadList: TableUpperProps[]; @@ -45,15 +54,18 @@ export type rainChkgdnState = { isInit: boolean; isModalClose: boolean; fcltDiv: SelectDataType[]; + rainMainHeadNm:chHeadType[] excelList: []; isSttn: boolean; + rainChkCount: number; + isLoading: boolean; }; }; type rainChkgdnActions = { rainChkInit: ( - pageNo: string, - cnt: string, + pageNo: number, + cnt: number, sggCd: string, searchTxt: string ) => void; @@ -66,6 +78,13 @@ type rainChkgdnActions = { rainChkExcelDataUPload(excelData: rainChkZodType[]): Promise<void>; rainChkDelete(chkgdnPks: number[]): Promise<void>; rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void; + rainChkNmSearch: ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => void; }; export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; @@ -73,7 +92,9 @@ export type rainChkgdnType = rainChkgdnState & rainChkgdnActions; export const rainChkgdnStateExport: rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList: rainChkgdnHeadList, - rainHeadNm: rainHeadNm, + rainRuseHeadNm: rainRuseHeadNm, + rainSplHeadNm:rainSplHeadNm, + rainMainHeadNm:rainMainHeadNm, rainChk: rainChk, splHeadList: splHeadList, ruseHeadList: ruseHeadList, @@ -82,6 +103,8 @@ export const rainChkgdnStateExport: rainChkgdnState = { excelList: [], fcltDiv: fcltDiv, isSttn: false, + rainChkCount: 1, + isLoading: false, }, }; @@ -103,20 +126,22 @@ const makeMdfrChk = (data: rainChkZodType[], type: string, toDo: string) => { }; const initFetch = async ( - pageNo: string, - cnt: string, - txt: string | undefined, + pageNo: number, + cnt: number, + year: string | undefined, sgg: string | undefined ) => { const currentYear = new Date().getFullYear().toString(); - const rainRes = await getFetch( + + const rainRes = await getCountFetch( "wr", `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/20") + - (txt ? `/${txt}` : `/${currentYear}`) + + (cnt ? `/${cnt}` : "/10") + + (year ? `/${year}` : `/${currentYear}`) + (sgg ? `/${sgg}` : "/0") ); + return rainRes; }; @@ -142,16 +167,24 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( })); }, rainChkExcelDataUPload: async (excelData: rainChkZodType[]) => { + set((state: rainChkgdnType) => ( + { rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); try { const res = await postFectch("/reuseChk/rainy", excelData); if (res.status === 200) { const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "0"); - return set((state: rainChkgdnState) => ({ + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + commonCd + ); + set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); toast.success("지도점검 등록이 완료되었습니다."); @@ -161,22 +194,62 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( } catch (error) { console.log(error); toast.error("지도점검 등록이 실패되었습니다."); + } finally { + set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); } }, rainChkInit: async ( - pageNo: string, - cnt: string, - searchTxt: string, + pageNo: number, + cnt: number, + year: string, sggCd: string ) => { + set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); try { - const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); - + const rainChkRes = await initFetch(pageNo, cnt, year, sggCd); + set((state: rainChkgdnState) => ({ + ...state, + rainChkgdn: { + ...state.rainChkgdn, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, + isInit: true, // 무한 루프 방지를 위해 isInit을 true로 설정 + }, + })); + } catch (error) { + console.log(error); + // 에러가 발생하더라도 무한 루프에 빠지지 않도록 isInit을 true로 설정합니다. + set((state: rainChkgdnType) => ({ + rainChkgdn: { ...state.rainChkgdn, isInit: true }, + })); + } finally { + set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); + } + }, + rainChkNmSearch: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => { + try { + const currentYear = new Date().getFullYear(); + const rainChkRes = await getCountFetch( + "wr", + `/reuseChk/rainy` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/10") + + (year ? `/${year}` : `/${currentYear}`) + + (sggCd ? `/${sggCd}` : "/0") + + (txt ? `/${txt}` : "") + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); } catch (error) { @@ -187,26 +260,32 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( try { const chData = await makeMdfrChk(rainChk, "rain", "rainDetil"); - const res = await postFectch("/reuseChk/rainy", chData); - if (res.staus === 200) { + const res = await putFectch("/reuseChk/rainy/list", chData); + if (res) { toast.success( - "지도점검 보급수 및 밋물이용량 수정이 완료되었습니다. " + "지도점검 대체수 및 밋물이용량 수정이 완료되었습니다. " ); const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "11"); + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + "41" + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); } else { - toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다."); + toast.error("지도점검 대체수 및 밋물이용량 수정 오류입니다."); } } catch (error) { console.log(error); - toast.error("지도점검 보급수 및 밋물이용량 수정 오류입니다."); + toast.error("지도점검 대체수 및 밋물이용량 수정 오류입니다."); } }, rainChkGuidUpdate: async (rainChk: rainChkZodType) => { @@ -217,15 +296,21 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( toast.success("지도점검 수질 및 과태료 수정이 완료되었습니다. "); const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "11"); + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + "41" + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); - }else{ + } else { toast.error("지도점검 수질 및 과태료 수정 오류입니다."); } @@ -241,15 +326,21 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( toast.success("삭제가 완료되었습니다. "); const currentYear = new Date().getFullYear().toString(); - const rainChkRes = await initFetch("1", "20", currentYear, "11"); + const rainChkRes = await initFetch( + 1, + rainPageSize, + currentYear, + "41" + ); return set((state: rainChkgdnState) => ({ ...state, rainChkgdn: { ...state.rainChkgdn, - rainChk: rainChkRes, + rainChk: rainChkRes.data, + rainChkCount: rainChkRes.count, }, })); - }else{ + } else { toast.error("삭제시 오류가 발생하였습니다.. "); } diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index 37e385ca2..52f46e259 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -1,18 +1,24 @@ +import { buildingType } from "@/app/store/common/code"; +import type { TableUpperProps } from "@/app/store/common/type/header"; import { TEST_UUID, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import type { - SelectDataType, - SheetParameter, -} from "@common/business_components"; import { deleteFectch, fetchType, + getCountFetch, getFetch, postFectch, putFectch, } from "@/components/lib/api"; -import { buildingType } from "@/app/store/common/code"; +import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; +import type { + SelectDataType, + SheetParameter, +} from "@common/business_components"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { type chHeadType } from "../rainChkgdn/headList"; import { rswtMakeExcelSample } from "./excel"; import { rswtChkgdZod, @@ -20,15 +26,19 @@ import { rswtDetailHeadListExport, rswtHeadNmExport, rswtrDetailsZod, + rswtRuseHeadNmExport, + rswtSplHeadNmExport, } from "./headList"; -import { z } from "zod"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; -import { type chHeadType } from "../rainChkgdn/headList"; -import type { TableUpperProps } from "@/app/store/common/type/header"; + +export const rswtPageSize = 5; const rswtChkHeadList = rswtChkHeadListExport; const rswtDetailHeadList = rswtDetailHeadListExport; const rswtHeadNm = rswtHeadNmExport; +const rswtRuseHeadNm =rswtRuseHeadNmExport +const rswtSplHeadNm =rswtSplHeadNmExport + + export type rswtChkZodType = z.infer<typeof rswtChkgdZod>; export type rswtrChkDetailsZodType = z.infer<typeof rswtrDetailsZod>; export type rswtChkgdnState = { @@ -40,13 +50,29 @@ export type rswtChkgdnState = { excelList: SheetParameter[]; rswtChkRes: rswtChkZodType[]; rswtChkPolGuide: rswtChkZodType[]; + rswtSplHeadNm:chHeadType[] + rswtRuseHeadNm:chHeadType[] isInit: boolean; - isSttn: boolean + isSttn: boolean; + isLoading:boolean; + rswtChkCount: number; }; }; type rswtChkgdnActions = { - rswtChkgdnInit: (pageNo: string, cnt: string, year: string, sggCd: string) => void; + rswtChkgdnInit: ( + pageNo: number, + cnt: number, + year: string, + sggCd: string + ) => void; + rswtChkNmSearch: ( + pageNo: number, + cnt: number, + year: string, + sggCd: string, + txt: string + ) => void; rswtrChkExcelDownload( sidoCode: SelectDataType[], sggCode: SelectDataType[] @@ -67,21 +93,35 @@ export const rswtChkgdnStateExport: rswtChkgdnState = { rswtChkHeadList: rswtChkHeadList, rswtDetailHeadList: rswtDetailHeadList, rswtHeadNm: rswtHeadNm, - excelList: [{ - data: [[]], headerNum: 0, headerRange: "A1:V3", + rswtRuseHeadNm:rswtRuseHeadNm, + rswtSplHeadNm:rswtSplHeadNm, + + excelList: [ + { + data: [[]], + headerNum: 0, + headerRange: "A1:V3", sheetName: "", - startCol: '1' - }], + startCol: "1", + }, + ], rswtChkRes: [], rswtChkPolGuide: [], isInit: false, isSttn: false, + isLoading:false, + rswtChkCount: 1, }, }; -const initFetch = async (pageNo: string, cnt: string, year: string | undefined, sgg: string | undefined) => { +const initFetch = async ( + pageNo: number, + cnt: number, + year: string | undefined, + sgg: string | undefined +) => { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getFetch( + const rswtChkRes = await getCountFetch( "wr", `/reuseChk/reuseWater` + (pageNo ? `/${pageNo}` : "/1") + @@ -139,7 +179,13 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }, })); }, - rswtChkgdnInit: async (pageNo: string, cnt: string, year: string, sggCd: string) => { + rswtChkgdnInit: async ( + pageNo: number, + cnt: number, + year: string, + sggCd: string + ) => { + set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); try { const rswtChkRes = await initFetch(pageNo, cnt, year, sggCd); @@ -174,16 +220,18 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( "wr", `/reuseChk/reuseWater` + (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/5") + + (cnt ? `/${cnt}` : "/20") + (year ? `/${year}` : `/${currentYear}`) + (sggCd ? `/${sggCd}` : "/0") + (txt ? `/${txt}` : "") ); + return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, isInit: false, }, })); @@ -193,6 +241,8 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }, rswtChkExceDataUpload: async (excelData: rswtChkZodType[]) => { try { + set((state: rswtChkgdnType) => ( + { rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); const res = await postFectch("/reuseChk/reuseWater", excelData); if (res.ok) { ToastFormUi({ @@ -201,65 +251,66 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }); } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { console.log(error); + }finally{ + set((state: rswtChkgdnType) => ( + { rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } })); } + }, rswtChkDetilsUpdate: async (rswtChk: rswtrChkDetailsZodType[]) => { try { const chData = await makeMdfrChk(rswtChk); - const res = await putFectch("/reuseChk/reuseWater", chData); if (res.ok) { - ToastFormUi({ - body: "지도점검 과태료 수정 수정이 완료되었습니다. ", - title: "지도점검 수정", - }); + toast.success("지도점검 과태료 수정이 완료되었습니다. ",) } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { console.log(error); - alert("수정에 실패하였습니다."); + toast.error("지도점검 과태료 수정 오류입니다. ",) + } }, rswtChkDelete: async (chkgdnPks: number[]) => { try { const res = await deleteFectch(`/reuseChk/reuseWater`, chkgdnPks); - if (res.ok) { - ToastFormUi({ - body: "삭제가 완료되었습니다. ", - title: "지도점검 삭제", - }); + if (res) { + toast.success("삭제가 완료되었습니다.") } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { ...state.rswtChkgdn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, }, })); } catch (error) { - ToastFormUi({ body: "삭제를 실패했습니다.. ", title: "지도점검 삭제" }); + toast.error("삭제 오류입니다.") } }, rswtChkPolAndGuide: async (chkGdnPk: number) => { @@ -276,7 +327,11 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( rswtChkPolGuide: rswtChkPolGuide, }, })); - } catch (error) { } + } catch (error) { + + + + } }, rswtChkPolInit: () => { try { @@ -287,7 +342,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( rswtChkPolGuide: undefined, }, })); - } catch (error) { } + } catch (error) {} }, rwstPolAndGuideUpdate: async (rswtChk: rswtChkZodType[]) => { try { @@ -297,13 +352,10 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( chData[0] ); if (res.ok) { - ToastFormUi({ - body: "지도점검 연간 수질 및 보급수/중수도 수정이 완료되었습니다. ", - title: "지도점검 수정", - }); + toast.success("지도점검 연간 수질 및 대체수/중수도 수정이 완료되었습니다.") } const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await initFetch("1", "20", currentYear, "0"); + const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0"); return set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { @@ -313,10 +365,9 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( })); } catch (error) { console.log(error); - ToastFormUi({ - body: "지도점검 연간 수질 및 보급수/중수도 수정이 실패하였습니다.. ", - title: "지도점검 수정", - }); + + toast.error("지도점검 연간 수질 및 대체수/중수도 수정 오류입니다.") + } }, rswtChkHeadChange: async (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => { @@ -337,7 +388,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( rswtDetailHeadList: rswtDetailHeadList, }, })); - } catch (e) { } + } catch (e) {} }, }; }; diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index 738354b04..e51c912d9 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -1,10 +1,10 @@ -import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import { getFetch } from "@/components/lib/api"; -import type { SelectDataType } from "@common/business_components/ui"; -import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList"; -import { rainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; -import { buildingExcelRainSttn } from "./excel"; import type { TableUpperProps } from "@/app/store/common/type/header"; +import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { rainMainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; +import { getCountFetch } from "@/components/lib/api"; +import type { SelectDataType } from "@common/business_components/ui"; +import { buildingExcelRainSttn } from "./excel"; +import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList"; const fcltDiv = [ { val: "RST", text: "중수도시설" }, @@ -15,7 +15,7 @@ const fcltDiv = [ const rainChkgdnHeadList = rainChkgdnHeadSttnExport; const ruseHeadList = ruseSttnHeadListExport; const splHeadList = splSttnHeadListExport; -const rainHeadNm = rainHeadNmExport +const rainHeadNm = rainMainHeadNmExport const rainChk: rainChkZodType[] = []; @@ -29,7 +29,8 @@ export type rainChkSttnState = { splHeadList: TableUpperProps[]; sttnExcelList:[] isInit: boolean; - isSttn:boolean; + isSttn: boolean; + rainChkCount: number; }; }; @@ -51,16 +52,21 @@ export const rainChkSttnStateExport: rainChkSttnState = { splHeadList: splHeadList, rainHeadNm:rainHeadNm, isInit: false, - sttnExcelList:[], - isSttn:false, + sttnExcelList: [], + isSttn: false, + rainChkCount: 1, }, }; -const initFetch = async (txt: string | undefined, sgg: string | undefined) => { +const initFetch = async (pageNo: number, cnt: number, txt: string | undefined, sgg: string | undefined) => { const currentYear = new Date().getFullYear().toString(); - const rainRes = await getFetch( + const rainRes = await getCountFetch( "wr", - `/reuseChk/rainy/` + (txt ? `${txt}` : currentYear) + (sgg ? `/${sgg}` : "/0") + `/reuseChk/rainy` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/5") + + (txt ? `/${txt}` : `/${currentYear}`) + + (sgg ? `/${sgg}` : "/0") ); return rainRes; }; @@ -68,15 +74,17 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( set: any ) => { return { - rainChkSttnInit: async (searchTxt: string, sggCd: string) => { + rainChkSttnInit: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { try { - const rainChkRes = await initFetch(searchTxt, sggCd); + const rainChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); return set((state: rainChkSttnState) => ({ ...state, rainChkSttn: { ...state.rainChkSttn, - rainChkRes:rainChkRes + rainChkRes: rainChkRes.data, + rainChkCount: rainChkRes.count, + isSttn: true }, })); } catch (error) { diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index 965bc7275..f3643a094 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -1,14 +1,12 @@ import { useWrStore } from "@/app/store"; -import { ScrollArea, Title } from "@common/business_components/ui"; -import { Button } from "@common/components/ui"; -import { useEffect, useState } from "react"; -import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; -import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable"; +import type { TableUpperProps } from "@/app/store/common/type/header"; import type { splRuseWaterType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { rswtrPolutionsZode } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList"; +import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable"; +import { ScrollArea, Title } from "@common/business_components/ui"; +import { Button } from "@common/components/ui"; +import React, { useEffect, useState } from "react"; import type { z } from "zod"; -import React from "react"; -import type { TableUpperProps } from "@/app/store/common/type/header"; export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { const { @@ -114,7 +112,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { }); } - console.log("result ", result); setGuidData(result as splRuseWaterType[]); if (obj.rswtrPollutions) { @@ -217,12 +214,14 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { obj.guideDetails = realGuideDetail; if (type === "RNB") { rainChkGuidUpdate(obj); + setIsModal(false) } else { const polution = Object.values(upPolutionData) .flat() .filter((item) => item.utztnUsgCd !== "평균"); obj.rswtrPollutions = polution; rwstPolAndGuideUpdate([obj]); + setIsModal(false) } }; @@ -248,7 +247,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { </div> <div className="flex justify-between"> <h3 className="text-2xl font-bold text-gray-900 mt-2 ml-6"> - {`(${obj.bdstNm})`} + {type === "RNB" + ? `(${obj.bdstNm})` : `(${obj.building.bdstNm})`} </h3> {!rainChkSttn.isSttn ? ( <Button className="" onClick={allDataUpdate}> @@ -262,12 +262,13 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { <ScrollArea className="h-[60vh]"> <div className="card-header"> <h3 className="text-2xl font-medium text-label"> - {`연간보급수이용량`} + {`연간대체수이용량`} </h3> </div> <GuideDetailsTable chgRes={guidData || []} - headList={headList.ruseHeadList} + headList={headList.splHeadList} + upheadList={type === "RNB" ? rainChkgdn.rainSplHeadNm : rswtChkgdn.rswtSplHeadNm} type={""} setChGuidData={(data) => { setChGuidData(data); @@ -280,7 +281,8 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { </div> <GuideDetailsTable chgRes={guidData || []} - headList={headList.splHeadList} + headList={headList.ruseHeadList} + upheadList={type === "RNB" ? rainChkgdn.rainRuseHeadNm : rswtChkgdn.rswtRuseHeadNm} type={""} setChGuidData={(data) => { setChGuidData(data); @@ -302,6 +304,7 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { <GuideDetailsTable chgRes={value} headList={headList?.rswtDetailHeadList} + upheadList={rswtChkgdn.rswtSplHeadNm} type={""} setChGuidData={(data) => { getPolutionData(data); diff --git a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx index 720a73ab4..2525cfd27 100644 --- a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx @@ -1,22 +1,22 @@ "use client"; import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; import { useWrStore } from "@/app/store"; -import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; -import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; +import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { tableData } from "@/components/lib/func/commom"; import { chRowspanTable, - headVisibleChange, rainChkTableData } from "@/components/lib/func/TableData"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; +import UiPageNations from "@common/business_components/ui/table/uiPageNations"; import { Table, TableBody, TableHeader, } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; -import UiPageNations from "@common/business_components/ui/table/uiPageNations"; export default function RainChkgdTable({ detailUp, handleClick = () => { }, @@ -24,6 +24,7 @@ export default function RainChkgdTable({ rainChkData, pageNation, onPageChange, + pageCount, }: { detailUp: (data: rainChkZodType[]) => void; handleClick?: (data: any) => void; @@ -31,6 +32,7 @@ export default function RainChkgdTable({ rainChkData?: rainChkZodType[]; pageNation: number; onPageChange: (page: number) => void; + pageCount: number; }) { const { code, rainChkgdn, rainChkSttn, getRainSttnExcel } = useWrStore((state) => state); const [makeTableData, setMakeTableData] = useState<any[]>([]); @@ -70,16 +72,12 @@ export default function RainChkgdTable({ }, [makeTableData, handleClick]); - useEffect(() =>{ - - - },[rainChkgdn.rainChk]) useEffect(() => { setSelectedIds([])// 셀렉트 초기화를 위한 작업 - if (rainChkData) { + if (rainChkData && rainChkData.length > 0) { - const rainChg = rainChkData.map((item: any) => { + const rainChg = rainChkData?.map((item: any) => { const bud = tableData([item.building], { code }); return { ...item, @@ -89,6 +87,8 @@ export default function RainChkgdTable({ }); setMakeTableData(rainChkTableData(rainChg)); + } else { + setMakeTableData([]); } }, [rainChkData, code]); @@ -167,16 +167,15 @@ export default function RainChkgdTable({ } else { setHeadList({ headList: rainChkgdn.rainChkgdnHeadList, - upHeadList: rainChkgdn.rainHeadNm + upHeadList: rainChkgdn.rainMainHeadNm }) } - }, [rainChkSttn.isSttn, rainChkgdn.rainChkgdnHeadList, rainChkSttn.rainChkgdnHeadList]); - return ( <> + <LoadingOverlay isLoading={rainChkgdn.isLoading}></LoadingOverlay> <Table variant="secondary"> <TableHeader className="font-bold"> {headMakeprfmnc( @@ -197,9 +196,9 @@ export default function RainChkgdTable({ </TableBody> </Table> <UiPageNations - total={rainChkData?.length ?? 0} + total={pageCount} cur={pageNation} - pageSize={20} + pageSize={rainPageSize} onPageChange={onPageChange} /> </> diff --git a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx index 31891a595..bc8581b75 100644 --- a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx @@ -1,20 +1,22 @@ "use client"; import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; import { useWrStore } from "@/app/store"; -import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; -import type { - rswtChkZodType, - rswtrChkDetailsZodType, -} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import type { TableUpperProps } from "@/app/store/common/type/header"; +import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; +import { + rswtPageSize, + type rswtChkZodType, + type rswtrChkDetailsZodType, +} from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { tableData } from "@/components/lib/func/commom"; import { chRowspanTable, rswtChkTableData, } from "@/components/lib/func/TableData"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; +import UiPageNations from "@common/business_components/ui/table/uiPageNations"; import { Table, TableBody, TableHeader } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; -import UiPageNations from "@common/business_components/ui/table/uiPageNations"; export default function RswtChkgdTable({ detaiRswtlUpdate, @@ -23,6 +25,7 @@ export default function RswtChkgdTable({ rswtChkData, pageNation, onPageChange, + pageCount, }: { detaiRswtlUpdate: (data: rswtrChkDetailsZodType[]) => void; handleRswtClick?: (data: any) => void; @@ -30,6 +33,7 @@ export default function RswtChkgdTable({ rswtChkData: rswtChkZodType[]; pageNation: number; onPageChange: (page: number) => void; + pageCount: number; }) { const { code, rswtChkgdn, rswtChkSttn, rswtChkgdnInit, rswtChkPolAndGuide, getRswtSttnExcel } = useWrStore( (state) => state @@ -133,6 +137,7 @@ export default function RswtChkgdTable({ return ( <> + <LoadingOverlay isLoading={rswtChkgdn.isLoading}></LoadingOverlay> <Table variant="secondary"> <TableHeader className="font-bold"> {headMakeprfmnc(headList?.headList, headList?.upHeadList)} @@ -150,9 +155,9 @@ export default function RswtChkgdTable({ </TableBody> </Table> <UiPageNations - total={rswtChkData?.length ?? 0} + total={pageCount} cur={pageNation} - pageSize={20} + pageSize={rswtPageSize} onPageChange={onPageChange} /> </> From 011b87784d2cc8e4f17e79acf91eea6c1c7d3775 Mon Sep 17 00:00:00 2001 From: truthwing <truthplumage@gmail.com> Date: Fri, 4 Jul 2025 16:12:08 +0900 Subject: [PATCH 157/259] djlee product --- .../prfmncReg/chkgdnReg/TableHead.tsx | 6 ++--- .../chkgdnReg/rainChkgdn/headList.tsx | 16 ++++++++++++-- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 6 ++--- .../chkgdnReg/rswrtChkgdn/headList.tsx | 22 +++++++++++++++++-- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 6 ++--- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 8 +++---- .../chkgdnSttn/rswtChkgdnSttn/index.tsx | 8 +++---- .../chkgdTable/rainChkgd/rainChkgdTable.tsx | 2 +- .../src/ui/loadingBar/index.tsx | 20 +++++++++++++++++ 9 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 packages/common/business_components/src/ui/loadingBar/index.tsx diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead.tsx index 10a0bf85f..28ba6c512 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead.tsx @@ -26,10 +26,10 @@ export const headMakeprfmnc = ( key={head.id} rowSpan={1} colSpan={ - makeHeadNm.find((ch) => ch.headNm === head.upName)?.length + makeHeadNm?.find((ch) => ch.headNm === head.upName)?.length } > - {makeHeadNm.find((ch) => ch.headNm === head.upName)?.text} + {makeHeadNm?.find((ch) => ch.headNm === head.upName)?.text} </TableHead> ) : null )} @@ -39,7 +39,7 @@ export const headMakeprfmnc = ( {upHeadList .filter((data) => data.visible != false) .map((head: TableUpperProps) => - makeHeadNm.find((ch) => ch.headNm === head.upName) ? ( + makeHeadNm?.find((ch) => ch.headNm === head.upName) ? ( <TableHead className={`border border-gray-600 px-2 py-1 `} key={head.id} diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx index d7335e129..3cf1b5b11 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList.tsx @@ -114,10 +114,22 @@ export type splRuseWaterType = { ruse12: number; }; -export const rainHeadNmExport: chHeadType[] = [ +export const rainMainHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, +]; + +export const rainRuseHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, + { headNm: "ruseWater", text: "연간대체수 이용량(m³)", length: 13 }, + { headNm: "detailQulity", text: "분기", length: 11 }, +]; + + +export const rainSplHeadNmExport: chHeadType[] = [ { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, - { headNm: "ruseWater", text: "연간보급수 이용량(m³)", length: 13 }, { headNm: "detailQulity", text: "분기", length: 11 }, { headNm: "splWater", text: "연간빗물 이용량(m³)", length: 13 }, ]; diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index e256b4ef4..36e8672f5 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -4,8 +4,8 @@ import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { deleteFectch, fetchType, - getCountFetch, getFetch, + getFetchWithCount, postFectch, putFectch, } from "@/components/lib/api"; @@ -133,7 +133,7 @@ const initFetch = async ( ) => { const currentYear = new Date().getFullYear().toString(); - const rainRes = await getCountFetch( + const rainRes = await getFetchWithCount( "wr", `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + @@ -235,7 +235,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( ) => { try { const currentYear = new Date().getFullYear(); - const rainChkRes = await getCountFetch( + const rainChkRes = await getFetchWithCount( "wr", `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx index 0e690dbb9..c9fc9f078 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList.tsx @@ -1,6 +1,6 @@ +import type { TableUpperProps } from "@/app/store/common/type/header"; import { z } from "zod"; import { guideDetail, type chHeadType } from "../rainChkgdn/headList"; -import type { TableUpperProps } from "@/app/store/common/type/header"; export type polutionType = { chkgdnDtlFk: number; @@ -109,6 +109,24 @@ export const rswtChkgdZod = z.object({ rswtrPollutions: z.array(rswtrPolutionsZode), }); + + +export const rswtRuseHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, + { headNm: "ruseWater", text: "연간중수 이용량(m³)", length: 13 }, + { headNm: "detailQulity", text: "분기", length: 11 }, +]; + +export const rswtSplHeadNmExport: chHeadType[] = [ + { headNm: "useQuilty", text: "이용수질(필요시)", length: 3 }, + { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, + { headNm: "detailQulity", text: "분기", length: 11 }, + { headNm: "splWater", text: "연간대체수 이용량(m³)", length: 13 }, +]; + + + export const rswtHeadNmExport: chHeadType[] = [ { headNm: "useQuilty", text: "연간 평균 이용수질", length: 10 }, { headNm: "feeHist", text: "과태료 부과내역", length: 3 }, @@ -126,7 +144,7 @@ export const rswtChkHeadListExport: TableUpperProps[] = [ { id: "spwtPositn", title: "채수지점" ,mergeCell: true}, { id: "chckYmd", title: "점검일" ,mergeCell: true}, { id: "utztnUsgCd", title: "이용용도" }, - { id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" ,type: "number"}, + { id: "splyUswtrUtztnQnt", title: "연간대체수이용량(m³)" ,type: "number"}, { id: "ruseFcltUtztnQnt", title: "연간중수도이용량(m³)",type: "number"}, { diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index 52f46e259..49e1c0906 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -6,8 +6,8 @@ import { import { deleteFectch, fetchType, - getCountFetch, getFetch, + getFetchWithCount, postFectch, putFectch, } from "@/components/lib/api"; @@ -121,7 +121,7 @@ const initFetch = async ( sgg: string | undefined ) => { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getCountFetch( + const rswtChkRes = await getFetchWithCount( "wr", `/reuseChk/reuseWater` + (pageNo ? `/${pageNo}` : "/1") + @@ -216,7 +216,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( ) => { try { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getCountFetch( + const rswtChkRes = await getFetchWithCount( "wr", `/reuseChk/reuseWater` + (pageNo ? `/${pageNo}` : "/1") + diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index e51c912d9..059433593 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -1,7 +1,7 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import { rainMainHeadNmExport, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; -import { getCountFetch } from "@/components/lib/api"; +import { getFetchWithCount } from "@/components/lib/api"; import type { SelectDataType } from "@common/business_components/ui"; import { buildingExcelRainSttn } from "./excel"; import { rainChkgdnHeadSttnExport, ruseSttnHeadListExport, splSttnHeadListExport } from "./headList"; @@ -17,8 +17,6 @@ const ruseHeadList = ruseSttnHeadListExport; const splHeadList = splSttnHeadListExport; const rainHeadNm = rainMainHeadNmExport -const rainChk: rainChkZodType[] = []; - export type rainChkSttnState = { rainChkSttn: { rainChkRes: rainChkZodType[]; @@ -60,7 +58,7 @@ export const rainChkSttnStateExport: rainChkSttnState = { const initFetch = async (pageNo: number, cnt: number, txt: string | undefined, sgg: string | undefined) => { const currentYear = new Date().getFullYear().toString(); - const rainRes = await getCountFetch( + const rainRes = await getFetchWithCount( "wr", `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + @@ -100,7 +98,7 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( ) => { try { const currentYear = new Date().getFullYear(); - const rainChkRes = await getCountFetch( + const rainChkRes = await getFetchWithCount( "wr", `/reuseChk/rainy` + (pageNo ? `/${pageNo}` : "/1") + diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx index 251ff1fa2..9db75de07 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx @@ -1,10 +1,10 @@ -import { rswtHeadNmExport } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList"; -import { rswtChkSttnHeadListExport, rswtDetailSttnHeadListExport } from "./headList"; import type { TableUpperProps } from "@/app/store/common/type/header"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; -import { getFetch } from "@/components/lib/api"; +import { rswtHeadNmExport } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/headList"; +import { getFetch, getFetchWithCount } from "@/components/lib/api"; import { buildingExcelRswtSttn } from "./excel"; +import { rswtChkSttnHeadListExport, rswtDetailSttnHeadListExport } from "./headList"; const rswtChkHeadList = rswtChkSttnHeadListExport; const rswtDetailHeadList = rswtDetailSttnHeadListExport; @@ -113,7 +113,7 @@ export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( ) => { try { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getCountFetch( + const rswtChkRes = await getFetchWithCount( "wr", `/reuseChk/reuseWater` + (pageNo ? `/${pageNo}` : "/1") + diff --git a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx index 2525cfd27..aba225687 100644 --- a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx @@ -2,7 +2,7 @@ import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead"; import { useWrStore } from "@/app/store"; import type { TableUpperProps } from "@/app/store/common/type/header"; -import { type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import { rainPageSize, type rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { tableData } from "@/components/lib/func/commom"; import { diff --git a/packages/common/business_components/src/ui/loadingBar/index.tsx b/packages/common/business_components/src/ui/loadingBar/index.tsx new file mode 100644 index 000000000..4d637dd25 --- /dev/null +++ b/packages/common/business_components/src/ui/loadingBar/index.tsx @@ -0,0 +1,20 @@ +import { LoadingWithAnimation } from '@common/components/ui/loading'; +import React from 'react'; + +interface LoadingOverlayProps { + isLoading: boolean; +} + +const LoadingOverlay: React.FC<LoadingOverlayProps> = ({ isLoading }) => { + if (!isLoading) return null; + + return ( + <div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50"> + <div className="relative w-16 h-16"> + <LoadingWithAnimation color="primary" /> + </div> + </div> + ); +}; + +export default LoadingOverlay; \ No newline at end of file From 5b62171b01d201329486c4dbc3c0bb01d87e8cb1 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Fri, 4 Jul 2025 17:26:10 +0900 Subject: [PATCH 158/259] =?UTF-8?q?feat:=20-=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=ED=99=95=EC=9E=A5=EC=9E=90=20=EA=B2=80=EC=A6=9D=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20-=20=ED=99=98=EA=B2=BD=EC=B2=AD,=20?= =?UTF-8?q?=EC=8B=9C=EB=8F=84,=20=EC=8B=9C=EA=B5=B0=EA=B5=AC,=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9=20-=20RDII?= =?UTF-8?q?=20=EB=B6=84=EC=84=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5=20=EC=84=A0=ED=83=9D=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-base-layout)/fileValidation.tsx | 48 ++++++ .../(with-base-layout)/ii/irsetting/page.tsx | 66 +++++-- .../app/(with-base-layout)/ii/rdii/page.tsx | 77 +++++---- .../selectionValidation.tsx | 161 ++++++++++++++++++ 4 files changed, 303 insertions(+), 49 deletions(-) create mode 100644 apps/sn/app/(with-base-layout)/fileValidation.tsx create mode 100644 apps/sn/app/(with-base-layout)/selectionValidation.tsx diff --git a/apps/sn/app/(with-base-layout)/fileValidation.tsx b/apps/sn/app/(with-base-layout)/fileValidation.tsx new file mode 100644 index 000000000..c0711a7d2 --- /dev/null +++ b/apps/sn/app/(with-base-layout)/fileValidation.tsx @@ -0,0 +1,48 @@ +/** + * 파일 확장자 검증 유틸리티 + */ + +// 파일 확장자 검증 함수 +export const validateFileExtension = (file: File, allowedExtensions: string[]): boolean => { + const fileName = file.name.toLowerCase(); + return allowedExtensions.some(ext => fileName.endsWith(ext.toLowerCase())); +}; + +// 파일 확장자 검증 결과 타입 +export interface FileValidationResult { + isValid: boolean; + errorMessage?: string; +} + +// 파일 검증 설정 타입 +export interface FileValidationConfig { + file: File; + allowedExtensions: string[]; + fileDescription: string; +} + +/** + * 여러 파일의 확장자를 한 번에 검증하는 함수 + * @param validationConfigs 검증할 파일들의 설정 배열 + * @returns 검증 결과. 실패 시 첫 번째 에러 메시지 반환 + */ +export const validateMultipleFiles = (validationConfigs: FileValidationConfig[]): FileValidationResult => { + for (const config of validationConfigs) { + if (!validateFileExtension(config.file, config.allowedExtensions)) { + const allowedExtStr = config.allowedExtensions.join(', '); + return { + isValid: false, + errorMessage: `${config.fileDescription} 파일은 ${allowedExtStr} 확장자만 업로드 가능합니다.` + }; + } + } + + return { isValid: true }; +}; + +// 자주 사용되는 확장자 상수 +export const FILE_EXTENSIONS = { + INP: ['.inp'], + EXCEL: ['.xls', '.xlsx', '.xlsm', '.xltx'], + ALL_OFFICE: ['.xls', '.xlsx', '.xlsm', '.xltx', '.doc', '.docx', '.ppt', '.pptx'] +}; \ No newline at end of file diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index edee9b4ce..0e7a5c331 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -6,11 +6,13 @@ import { DateMonthPicker, filePicked } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { Input } from '@common/components/ui' import { zodResolver } from '@hookform/resolvers/zod' -import { useState, useEffect } from 'react' +import { useState } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' import { excelToFlowRateData, excelToMatchingResultData, excelToTimePatternData } from '@/components/lib/utils' import BaseLayout from '../BaseLayout' +import { validateMultipleFiles, FILE_EXTENSIONS, type FileValidationConfig } from '../../fileValidation'; +import { validateBasicSelectionsWithAlert } from '../../selectionValidation'; const formSchema = z.object({ managenm: z.string(), @@ -148,6 +150,17 @@ const IrSetting = () => { const handleAnalysisClick = async () => { setIsLoadingResult(true); // 로딩 상태 시작 + // 기본 선택 항목들 검증 (환경청, 시도, 시군구, 하수처리장) + if (!validateBasicSelectionsWithAlert(select1, select2, select3, select4, { + requireEnv: true, + requireSido: true, + requireSigungu: true, + requireTreatmentPlant: true + })) { + setIsLoadingResult(false); + return; + } + console.log(uploadedFilesData); const file1 = uploadedFilesData[0]; // 오수관망도 const file2 = uploadedFilesData[1]; // 수용가-맨홀 매칭결과 @@ -167,6 +180,42 @@ const IrSetting = () => { return; } + // 파일 확장자 검증 (분리된 유틸리티 사용) + const validationConfigs: FileValidationConfig[] = [ + { + file: file1.file, + allowedExtensions: FILE_EXTENSIONS.INP, + fileDescription: '오수관망도' + }, + { + file: file2.file, + allowedExtensions: FILE_EXTENSIONS.EXCEL, + fileDescription: '수용가-맨홀 매칭결과' + }, + { + file: file3.file, + allowedExtensions: FILE_EXTENSIONS.EXCEL, + fileDescription: '오수량 시간패턴' + } + ]; + + // 유량자료 파일이 있는 경우 검증 목록에 추가 + if (file4?.file) { + validationConfigs.push({ + file: file4.file, + allowedExtensions: FILE_EXTENSIONS.EXCEL, + fileDescription: '유량자료' + }); + } + + // 파일 확장자 검증 실행 + const validationResult = validateMultipleFiles(validationConfigs); + if (!validationResult.isValid) { + setIsLoadingResult(false); + alert(validationResult.errorMessage); + return; + } + // 오수전환율 값 0 ~ 1 사이인지 검증 if (input1 === '' || input1 === null || input1 === undefined) { setIsLoadingResult(false); @@ -394,21 +443,6 @@ const IrSetting = () => { </div> </ListDiv> </div>]} - {/* <div className="flex items-center gap-4"> - <FormSection - name='region' form={form} titleNm='▷ 유량자료 등록'> - <FileUploadForm - key={`file-upload-3-${formResetKey}`} // 폼 초기화를 위한 key - onFileSelect={(file, cd, id) => handleFileSelection(3, file, cd, id)} - showButton={false} - showPreview={true} - accept={".xls, .xlsx, .xlsm, .xltx"} - fileIdx={3} /> - </FormSection> - <div className="flex justify-center mt-1"> - <Button size="sm" type="submit" onClick={handleAnalysisClick}>침입수분석 실행</Button> - </div> - </div> */} </BaseLayout> </> ) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index 0ce49c797..970c6d1a9 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -13,6 +13,8 @@ import { useFieldArray, useForm } from "react-hook-form" import { z } from "zod" import { excelToMatchingResultData, excelToRainData } from '@/components/lib/utils' import { EditableFormTable, type EditableTableHeadItem } from '../../../components/ui/EditableFormTable' +import { validateMultipleFiles, FILE_EXTENSIONS, type FileValidationConfig } from '../../fileValidation'; +import { validateBasicSelectionsWithAlert } from '../../selectionValidation'; // zod 스키마 정의 @@ -167,7 +169,18 @@ export default function RTKForm() { // 침입수 분석 실행 버튼 클릭 핸들러 const handleAnalysisClick = async () => { setIsLoadingResult(true); // 로딩 상태 시작 - + + // 기본 선택 항목들 검증 (환경청, 시도, 시군구, 하수처리장) + if (!validateBasicSelectionsWithAlert(select1, select2, select3, select4, { + requireEnv: true, + requireSido: true, + requireSigungu: true, + requireTreatmentPlant: true + })) { + setIsLoadingResult(false); + return; + } + const formData = form.getValues(); console.log(uploadedFilesData); const file1 = uploadedFilesData[0]; // 오수관망도 @@ -185,6 +198,33 @@ export default function RTKForm() { return; } + // 파일 확장자 검증 (분리된 유틸리티 사용) + const validationConfigs: FileValidationConfig[] = [ + { + file: file1.file, + allowedExtensions: FILE_EXTENSIONS.INP, + fileDescription: '오수관망도' + }, + { + file: file2.file, + allowedExtensions: FILE_EXTENSIONS.EXCEL, + fileDescription: '수용가-맨홀 매칭결과' + }, + { + file: file3.file, + allowedExtensions: FILE_EXTENSIONS.EXCEL, + fileDescription: '오수량 시간패턴' + } + ]; + + // 파일 확장자 검증 실행 + const validationResult = validateMultipleFiles(validationConfigs); + if (!validationResult.isValid) { + setIsLoadingResult(false); + alert(validationResult.errorMessage); + return; + } + // 오수전환율 값 0 ~ 1 사이인지 검증 const rateValue = form.getValues().rate; if (rateValue === '' || rateValue === null || rateValue === undefined) { @@ -193,7 +233,7 @@ export default function RTKForm() { alert('오수전환율을 입력해주세요.'); return; } - + const numericInput1 = parseFloat(rateValue); if (isNaN(numericInput1) || numericInput1 < 0 || numericInput1 > 1) { setIsLoadingResult(false); @@ -341,35 +381,6 @@ export default function RTKForm() { console.log('Page changed:', page) } - // 선택된 값을 처리하는 공통 함수 - const handleSelectValueChange = ( - val: string | number, - setter: (value: string | number) => void - ) => { - // val이 0이 아닐 경우 .을 기준으로 슬라이싱해서 두번째 값을 설정 - if (val && val !== '0' && val !== 0) { - const valString = String(val); - const parts = valString.split('.'); - if (parts.length > 1 && parts[1] !== undefined) { - setter(parts[1]); // 두 번째 값 (인덱스 1) - } else { - setter(val); // .이 없으면 원래 값 사용 - } - } else { - setter('0'); // val이 0이면 '0' 설정 - } - }; - - // 하수처리장 변경 핸들러 - const handleSwageTreatmentPlantChange = (val: string | number) => { - handleSelectValueChange(val, setSelect4); - }; - - // 하수처리구역 변경 핸들러 - const handleSwageProcessingZoneChange = (val: string | number) => { - handleSelectValueChange(val, setSelect5); - }; - return ( // <BaseLayout searchBox={{ title: '분석 대상지역 선택' }} titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력', secondCardTitle: '실측자료 등록' }} form={form} onSubmitEvent={() => { }} graphBtn={false} > <BaseLayout @@ -386,9 +397,9 @@ export default function RTKForm() { sigungu={select3} setSigungu={setSelect3} selectedSwageTreatmentPlant={select4} - onSwageTreatmentPlantChange={handleSwageTreatmentPlantChange} + onSwageTreatmentPlantChange={setSelect4} selectedSwageProcessingZone={select5} - onSwageProcessingZoneChange={handleSwageProcessingZoneChange} + onSwageProcessingZoneChange={setSelect5} isLoading={isLoadingResult} onAnalysis={handleAnalysisClick} > diff --git a/apps/sn/app/(with-base-layout)/selectionValidation.tsx b/apps/sn/app/(with-base-layout)/selectionValidation.tsx new file mode 100644 index 000000000..8cc506d0e --- /dev/null +++ b/apps/sn/app/(with-base-layout)/selectionValidation.tsx @@ -0,0 +1,161 @@ +/** + * 선택 항목 검증 유틸리티 + */ + +export interface ApiSelectOption { + text: string; + val: string; +} + +// 선택 항목 검증 설정 타입 +export interface SelectionValidationConfig { + value: string | number | ApiSelectOption; + description: string; + required: boolean; +} + +// 선택 항목 검증 결과 타입 +export interface SelectionValidationResult { + isValid: boolean; + errorMessage?: string; +} + +/** + * 단일 선택 항목이 유효한지 검증하는 함수 + * @param value 검증할 값 + * @param isRequired 필수 선택 여부 + * @returns 유효한지 여부 + */ +export const isValidSelection = ( + value: string | number | ApiSelectOption, + isRequired: boolean = true +): boolean => { + if (!isRequired) return true; + + if (typeof value === 'object' && value !== null) { + // ApiSelectOption 객체인 경우 + return value.val !== '0' && value.val !== '' && value.val !== null && value.val !== undefined; + } + + // 문자열 또는 숫자인 경우 + return value !== '0' && value !== 0 && value !== '' && value !== null && value !== undefined; +}; + +/** + * 여러 선택 항목을 한 번에 검증하는 함수 + * @param validationConfigs 검증할 선택 항목들의 설정 배열 + * @returns 검증 결과. 실패 시 첫 번째 에러 메시지 반환 + */ +export const validateMultipleSelections = ( + validationConfigs: SelectionValidationConfig[] +): SelectionValidationResult => { + for (const config of validationConfigs) { + if (!isValidSelection(config.value, config.required)) { + return { + isValid: false, + errorMessage: `${config.description}을(를) 선택해주세요.` + }; + } + } + + return { isValid: true }; +}; + +/** + * 여러 선택 항목을 한 번에 검증하고 alert 표시하는 함수 + * @param validationConfigs 검증할 선택 항목들의 설정 배열 + * @returns 검증 결과 + */ +export const validateMultipleSelectionsWithAlert = ( + validationConfigs: SelectionValidationConfig[] +): boolean => { + const result = validateMultipleSelections(validationConfigs); + if (!result.isValid && result.errorMessage) { + alert(result.errorMessage); + return false; + } + return true; +}; + +/** + * 기본 선택 항목들 검증 (환경청, 시도, 시군구, 하수처리장) + * @param select1 환경청코드 + * @param select2 시도코드 + * @param select3 시군구 객체 + * @param select4 하수처리장코드 + * @param options 각 항목의 필수 여부 설정 + * @returns 검증 결과 + */ +export const validateBasicSelections = ( + select1: string, + select2: string, + select3: ApiSelectOption, + select4: string | number, + options: { + requireEnv?: boolean; + requireSido?: boolean; + requireSigungu?: boolean; + requireTreatmentPlant?: boolean; + } = {} +): SelectionValidationResult => { + const { + requireEnv = true, + requireSido = true, + requireSigungu = true, + requireTreatmentPlant = true + } = options; + + const validationConfigs: SelectionValidationConfig[] = [ + { + value: select1, + description: '환경청', + required: requireEnv + }, + { + value: select2, + description: '시도', + required: requireSido + }, + { + value: select3, + description: '시군구', + required: requireSigungu + }, + { + value: select4, + description: '하수처리장', + required: requireTreatmentPlant + } + ]; + + return validateMultipleSelections(validationConfigs); +}; + +/** + * 기본 선택 항목들 검증 및 alert 표시 + * @param select1 환경청코드 + * @param select2 시도코드 + * @param select3 시군구 객체 + * @param select4 하수처리장코드 + * @param options 각 항목의 필수 여부 설정 + * @returns 검증 결과 + */ +export const validateBasicSelectionsWithAlert = ( + select1: string, + select2: string, + select3: ApiSelectOption, + select4: string | number, + options: { + requireEnv?: boolean; + requireSido?: boolean; + requireSigungu?: boolean; + requireTreatmentPlant?: boolean; + } = {} +): boolean => { + const result = validateBasicSelections(select1, select2, select3, select4, options); + if (!result.isValid && result.errorMessage) { + alert(result.errorMessage); + return false; + } + return true; +}; \ No newline at end of file From d02b17ba120ac53add4212148200719a97ab143c Mon Sep 17 00:00:00 2001 From: ljpark <ljpark@mind-one.co.kr> Date: Fri, 4 Jul 2025 17:30:50 +0900 Subject: [PATCH 159/259] =?UTF-8?q?dc-service=20=EC=A0=91=EC=86=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 5 +++-- .../components/popupComponent/chart/aplcnYms.ts | 16 ++++++++++++---- .../popupComponent/chart/infilChart.tsx | 6 +++--- .../popupComponent/chart/rdiiChart.tsx | 2 +- apps/sn/app/components/lib/api/index.ts | 14 ++++++++++++++ apps/sn/middleware.ts | 15 +++++++++++++++ 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 26a9a0490..3354fcc4c 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -2,9 +2,10 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 3002 NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 #NEXT_PUBLIC_PROXY_HOST = http://sn.hasu.or.kr:3002 -NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com/dc-service #자료관 데이터 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 7f4acf616..1cd0d6ded 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -1,5 +1,5 @@ import {useState, useEffect} from 'react'; -import { getData } from '@/components/lib/api'; +import { getData, getDcData } from '@/components/lib/api'; import moment from "moment"; export type TInftwtAnls = { @@ -64,6 +64,13 @@ export type TOilqData = { mtrngDt: string; // 계측일시 oilq: number; // 유량 } + +export const getDcTree = async () => { + const queryString = ''; + const result = await getDcData(`/api/v1/dc/tree${queryString ? `?${queryString}` : ''}`); + return result; +}; + const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] => { let yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); @@ -88,6 +95,7 @@ const selectAplcnYms = async(gubun:string) => { // 상수사용월 console.error(error); } }; + export const useAplcnYms = (gubun:string) => { const [data, setData] = useState<{ text: string; val: string }[]>([]); @@ -124,7 +132,7 @@ export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 }; export const getChartDataInftwtAnlsRslt = (arr: TInftwtAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("DD HH:mm"), + label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("HH시"), val: anlsRslt.predcOilq, })); return options; @@ -223,14 +231,14 @@ export const selectRdiiAnls = async(aplcnYm:String) => { // 침입수분석 }; export const getChartDataRdiiAnlsRslt = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("DD HH:mm"), + label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("MM-DD HH시"), val: anlsRslt.predcOilq, })); return options; }; export const getChartDataRdiiAnlsRsltMinq = (arr: TRdiiAnlsRslt[]): { label: string; val: number }[] => { const options = arr.map(anlsRslt => ({ - label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("DD HH:mm"), + label: moment(anlsRslt.anlsTm, "YYYYMMDDHHmmss").format("MM-DD HH시"), val: anlsRslt.minq, })); return options; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 090e02f64..8ad2a4362 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -30,8 +30,8 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }); const [inftwtQty, setInftwtQty] = useState<number>(0); // 침입수량 const aplcnYms = fn.useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 - pplMngNo = "L"+pplMngNo; // "L13101003"; - console.log("pplMngNo", pplMngNo); + const dcData = fn.getDcTree(); // 자료관 데이터 가져오기 + pplMngNo = "L"+pplMngNo; // inp파일에 하수관로와 맨홀의 번호가 같으면 분석 오류가 발행하여 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -51,7 +51,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo useEffect(() => { if (isModalOpen === false) { - setPopupOpen(false); // 모달이 닫힐 때 조회조건팝업은 열어두기 + setPopupOpen(true); // 모달이 닫힐 때 조회조건팝업은 열어두기 setAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 930f83a6d..ddaffcaf3 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -52,7 +52,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } useEffect(() => { if (isModalOpen === false) { - setPopupOpen(false); // 모달이 닫힐 때 팝업은 + setPopupOpen(true); // 모달이 닫힐 때 팝업은 setAplcnYm(""); // 상수사용월 초기화 setRdiiAnlss([]); // 강우유입수분석 초기화 setRdiiAnlsInfos([{ val: 0, text: '선택' }]); // 강우유입수분석정보 초기화 diff --git a/apps/sn/app/components/lib/api/index.ts b/apps/sn/app/components/lib/api/index.ts index beb527c65..1d711b18a 100644 --- a/apps/sn/app/components/lib/api/index.ts +++ b/apps/sn/app/components/lib/api/index.ts @@ -1,4 +1,5 @@ const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ''; +const DC_URL = process.env.NEXT_PUBLIC_RSONE_DC_URL || ''; export const postData = async (url: string, data: object): Promise<any> => { const options: RequestInit = { @@ -54,6 +55,19 @@ export const getData = async (url: string, data?: object): Promise<any> => { throw new Error('Failed to fetch data'); }; +export const getDcData = async (url: string, data?: object): Promise<any> => { + console.log(url); + console.log(`${DC_URL}${url}`); + const res = await fetch(`${DC_URL}${url}`, { + method: "GET", + }); + if (res.ok) { + const data = await res.json(); + return data; + } + throw new Error('Failed to fetch data'); +}; + export const deleteData = async (url: string, data?: object): Promise<any> => { const options: RequestInit = { method: "DELETE", diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index 3ad5d5129..546516261 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -1,4 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; +import path from "path"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; @@ -6,6 +7,7 @@ const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL || ""; const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || ""; +const RSONE_DC_URL = process.env.NEXT_PUBLIC_RSONE_DC_URL || ""; export function middleware(req: NextRequest) { console.log("Middleware 진입:", req.nextUrl.pathname); @@ -80,6 +82,17 @@ export function middleware(req: NextRequest) { }); } + if (pathname.startsWith("/dc-service")) { + const requestHeaders = new Headers(req.headers); + const newUrl = `${RSONE_DC_URL}${pathname}`; + + console.log( + `[Middleware] Rewriting from '/dc-service' path to: ${newUrl}`, + ); + return NextResponse.rewrite(new URL(newUrl), { + headers: requestHeaders, + }); + } return NextResponse.next(); } @@ -91,5 +104,7 @@ export const config = { "/user-service/:path*", "/cms-service/:path*", "/sewerage-service/api/v1/map/geometry/:path*", + "/dc-service/:path*", ], + }; From 76e9651a91cb67ebfdcb43adbd43b5d6a912fdda Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Fri, 4 Jul 2025 17:40:43 +0900 Subject: [PATCH 160/259] =?UTF-8?q?featureData=EC=97=86=EC=9D=84=EB=95=8C?= =?UTF-8?q?=EB=8F=84=20getProperties=EC=86=8D=EC=84=B1=20=EB=84=98?= =?UTF-8?q?=EA=B8=B0=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/map/Gis.js | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index dd8135d1a..ef5c21d5b 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -46,7 +46,7 @@ function Gis({ const gisCore = useMemo(() => new GisApp.core({ targetId: mapRef.current }), []); const mapInstanceRef = useRef(null); const checkedLayerIds = useRef([]); - const [viewMode, setViewMode] = useState("detail"); + // 팝업 데이터를 저장할 상태와 오버레이 참조를 저장할 ref 추가 // const [facilityInfoPopupData, setFacilityInfoPopupData] = useState([]); @@ -347,7 +347,7 @@ function Gis({ setCheckedLayers(checkedIds); setCheckedLayersData(checkedNodesData); onCheckedLayersChange?.(checkedIds, checkedNodesData); - }, 0); + }, 0); }, [onCheckedLayersChange]); return ( @@ -359,7 +359,12 @@ function Gis({ visible={tabVisible} setVisible={setTabVisible} onCheckedChange={handleCheckedLayersChange} - onLayerIconClick={(nodeNm)=>{setLayerNm(nodeNm); setIsOpen(true); setViewMode("detail")}} + onLayerIconClick={(nodeNm) => { + setLayerNm(nodeNm); setIsOpen(true); const dummyFeature = { + getProperties: () => ({}), // 최소 구조 + }; + onFeatureSelect(dummyFeature); + }} /> {/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */} @@ -367,20 +372,19 @@ function Gis({ {/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} {isOpen && !isSearchModalOpen && ( <DetailView - featureData={featureData} + featureData={featureData || { getProperties: () => ({}) }} seletectedLayerNm={layerNm} - viewMode={viewMode} onClose={closePopup} // 닫기 콜백 전달 /> )} {/* SearchView가 존재할 때만 렌더링 */} - {SearchView && ( - <SearchView - open={isSearchModalOpen} - onOpenChange={setIsSearchModalOpen} - onFeatureSelect={handleFeatureSelect} - /> - )} + {SearchView && ( + <SearchView + open={isSearchModalOpen} + onOpenChange={setIsSearchModalOpen} + onFeatureSelect={handleFeatureSelect} + /> + )} <GisLonLat /> <GisToolBar /> <GisMapToggle /> From 60c06bd50544069170f7bc50bc304cda1239ca69 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Fri, 4 Jul 2025 18:13:07 +0900 Subject: [PATCH 161/259] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=EB=93=B1=EB=A1=9D=20=EB=B0=8F=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=20merge=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/chkgdnSttn/page.tsx | 4 +- .../prfmncReg/chkgdnReg/rainChkgdn/index.tsx | 41 +++++++++---------- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 17 ++++---- .../chkgdnSttn/rainChkgdnSttn/index.tsx | 12 +++--- .../chkgdnSttn/rswtChkgdnSttn/index.tsx | 22 ++++++---- .../ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx | 21 ++++------ .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 2 +- .../guideDetailTable/guideDetailTable.tsx | 27 ++++++------ .../chkgdTable/rswtChkgd/rswtChkgdTable.tsx | 1 - 9 files changed, 77 insertions(+), 70 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx index f8669bd2c..a191de9ee 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/chkgdnSttn/page.tsx @@ -79,7 +79,8 @@ export default function Page() { } } }; -const rainPageChange = (pageNo: number) => { + + const rainPageChange = (pageNo: number) => { if (pageNo > 0) { setRainPageNation(pageNo); rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd); @@ -96,6 +97,7 @@ const rainPageChange = (pageNo: number) => { useEffect(() => { if (!rainChkSttn.isInit) { isRainSttn(true) + console.log("여기", rainPageSize) rainChkSttnInit(1, rainPageSize, new Date().getFullYear().toString(), commonCd); setIsModal({ data: {}, open: false }); } diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx index 36e8672f5..069f1f760 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/index.tsx @@ -45,16 +45,15 @@ const rainChk: rainChkZodType[] = []; export type rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList: TableUpperProps[]; - rainSplHeadNm:chHeadType[] - rainRuseHeadNm:chHeadType[] + rainSplHeadNm: chHeadType[] + rainRuseHeadNm: chHeadType[] rainChk: rainChkZodType[]; - rainHeadNm: chHeadType[]; ruseHeadList: TableUpperProps[]; splHeadList: TableUpperProps[]; isInit: boolean; isModalClose: boolean; fcltDiv: SelectDataType[]; - rainMainHeadNm:chHeadType[] + rainMainHeadNm: chHeadType[] excelList: []; isSttn: boolean; rainChkCount: number; @@ -93,8 +92,8 @@ export const rainChkgdnStateExport: rainChkgdnState = { rainChkgdn: { rainChkgdnHeadList: rainChkgdnHeadList, rainRuseHeadNm: rainRuseHeadNm, - rainSplHeadNm:rainSplHeadNm, - rainMainHeadNm:rainMainHeadNm, + rainSplHeadNm: rainSplHeadNm, + rainMainHeadNm: rainMainHeadNm, rainChk: rainChk, splHeadList: splHeadList, ruseHeadList: ruseHeadList, @@ -136,10 +135,10 @@ const initFetch = async ( const rainRes = await getFetchWithCount( "wr", `/reuseChk/rainy` + - (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/10") + - (year ? `/${year}` : `/${currentYear}`) + - (sgg ? `/${sgg}` : "/0") + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/10") + + (year ? `/${year}` : `/${currentYear}`) + + (sgg ? `/${sgg}` : "/0") ); return rainRes; @@ -204,7 +203,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( year: string, sggCd: string ) => { - set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); + // set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: true } })); try { const rainChkRes = await initFetch(pageNo, cnt, year, sggCd); set((state: rainChkgdnState) => ({ @@ -213,17 +212,17 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( ...state.rainChkgdn, rainChk: rainChkRes.data, rainChkCount: rainChkRes.count, - isInit: true, // 무한 루프 방지를 위해 isInit을 true로 설정 + isInit: false, // 무한 루프 방지를 위해 isInit을 true로 설정 }, })); } catch (error) { console.log(error); // 에러가 발생하더라도 무한 루프에 빠지지 않도록 isInit을 true로 설정합니다. - set((state: rainChkgdnType) => ({ - rainChkgdn: { ...state.rainChkgdn, isInit: true }, - })); + // set((state: rainChkgdnType) => ({ + // rainChkgdn: { ...state.rainChkgdn, isInit: true }, + // })); } finally { - set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); + // set((state: rainChkgdnType) => ({ rainChkgdn: { ...state.rainChkgdn, isLoading: false } })); } }, rainChkNmSearch: async ( @@ -238,11 +237,11 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = ( const rainChkRes = await getFetchWithCount( "wr", `/reuseChk/rainy` + - (pageNo ? `/${pageNo}` : "/1") + - (cnt ? `/${cnt}` : "/10") + - (year ? `/${year}` : `/${currentYear}`) + - (sggCd ? `/${sggCd}` : "/0") + - (txt ? `/${txt}` : "") + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/10") + + (year ? `/${year}` : `/${currentYear}`) + + (sggCd ? `/${sggCd}` : "/0") + + (txt ? `/${txt}` : "") ); return set((state: rainChkgdnState) => ({ ...state, diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index 49e1c0906..4f647da1e 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -185,10 +185,12 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( year: string, sggCd: string ) => { - set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); + // set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } })); try { const rswtChkRes = await initFetch(pageNo, cnt, year, sggCd); + console.log("rswtChkRes", rswtChkRes) + set((state: rswtChkgdnState) => ({ ...state, rswtChkgdn: { @@ -199,12 +201,12 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( }, })); } catch (error) { - console.log(error); - set((state: rswtChkgdnType) => ({ - rswtChkgdn: { ...state.rswtChkgdn, isInit: true }, - })); + // console.log(error); + // set((state: rswtChkgdnType) => ({ + // rswtChkgdn: { ...state.rswtChkgdn, isInit: true }, + // })); } finally { - set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } })); + // set((state: rswtChkgdnType) => ({ rswtChkgdn: { ...state.rswtChkgdn, isLoading: false } })); } }, rswtChkNmSearch: async ( @@ -215,6 +217,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( txt: string ) => { try { + console.log("여기") const currentYear = new Date().getFullYear().toString(); const rswtChkRes = await getFetchWithCount( "wr", @@ -232,7 +235,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( ...state.rswtChkgdn, rswtChkRes: rswtChkRes.data, rswtChkCount: rswtChkRes.count, - isInit: false, + // isInit: false, }, })); } catch (error) { diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx index 059433593..e99bdb7a8 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rainChkgdnSttn/index.tsx @@ -22,10 +22,10 @@ export type rainChkSttnState = { rainChkRes: rainChkZodType[]; fcltDiv: SelectDataType[]; rainChkgdnHeadList: TableUpperProps[]; - rainHeadNm:chHeadType[]; + rainHeadNm: chHeadType[]; ruseHeadList: TableUpperProps[]; splHeadList: TableUpperProps[]; - sttnExcelList:[] + sttnExcelList: [] isInit: boolean; isSttn: boolean; rainChkCount: number; @@ -48,7 +48,7 @@ export const rainChkSttnStateExport: rainChkSttnState = { rainChkgdnHeadList: rainChkgdnHeadList, ruseHeadList: ruseHeadList, splHeadList: splHeadList, - rainHeadNm:rainHeadNm, + rainHeadNm: rainHeadNm, isInit: false, sttnExcelList: [], isSttn: false, @@ -125,13 +125,13 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( ...state, rainChkSttn: { ...state.rainChkSttn, - isSttn:isSttn + isSttn: isSttn }, })); } catch (error) { console.log(error); } - },getRainSttnExcel: async (excelList:rainChkZodType[]) => { + }, getRainSttnExcel: async (excelList: rainChkZodType[]) => { try { const excelData = buildingExcelRainSttn(excelList) @@ -140,7 +140,7 @@ export const rainChkSttnActionsExport: (set: any) => rainChkSttnActions = ( ...state, rainChkSttn: { ...state.rainChkSttn, - sttnExcelList:excelData + sttnExcelList: excelData }, })); } catch (error) { diff --git a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx index 9db75de07..7891d73fb 100644 --- a/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/chkgdnSttn/rswtChkgdnSttn/index.tsx @@ -20,11 +20,12 @@ export type rswtChkSttnState = { rswtChkRes: rswtChkZodType[]; isInit: boolean; isSttn: boolean; + rswtChkCount: number; }; }; type rswtChkSttnActions = { - rswtChkSttnInit: (searchTxt: string, sggCd: string) => void; + rswtChkSttnInit: (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => void; isRswtSttn: (isSttn: boolean) => void; getRswtSttnExcel: (excelList: rswtChkZodType[]) => void; rswtChkNmSttnSearch: (pageNo: number, cnt: number, year: string, sggCd: string, txt: string) => void; @@ -41,33 +42,36 @@ export const rswtChkStateExport: rswtChkSttnState = { rswtChkRes: [], isInit: false, isSttn: false, + rswtChkCount: 1, }, }; -const initFetch = async (year: string | undefined, sgg: string | undefined) => { +const initFetch = async (pageNo: number, cnt: number, year: string | undefined, sgg: string | undefined) => { const currentYear = new Date().getFullYear().toString(); - const rswtChkRes = await getFetch( + const rswtChkRes = await getFetchWithCount( "wr", - `/reuseChk/reuseWater/` + - (year ? `${year}` : currentYear) + + `/reuseChk/reuseWater` + + (pageNo ? `/${pageNo}` : "/1") + + (cnt ? `/${cnt}` : "/20") + + (year ? `/${year}` : `/${currentYear}`) + (sgg ? `/${sgg}` : "/0") ); return rswtChkRes; }; - export const rswtChkSttnActionsExport: (set: any) => rswtChkSttnActions = ( set: any ) => { return { - rswtChkSttnInit: async (searchTxt: string, sggCd: string) => { + rswtChkSttnInit: async (pageNo: number, cnt: number, searchTxt: string, sggCd: string) => { try { - const rswtChkRes = await initFetch(searchTxt, sggCd); + const rswtChkRes = await initFetch(pageNo, cnt, searchTxt, sggCd); return set((state: rswtChkSttnState) => ({ ...state, rswtChkSttn: { ...state.rswtChkSttn, - rswtChkRes: rswtChkRes, + rswtChkRes: rswtChkRes.data, + rswtChkCount: rswtChkRes.count, isInit: false, }, })); diff --git a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx index 8828420b8..5aa67fd3a 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx @@ -7,11 +7,9 @@ import { excelToRswtGuideData, excelToRswtPolution, } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel"; -import { ToastFormUi } from "@/components/ui/toast/toastFromUi"; import { filePicked, filePickedArray, - FileUpload, Form, FormField, FormUi, @@ -26,7 +24,7 @@ import { useForm } from "react-hook-form"; import toast from "react-hot-toast"; import type { z } from "zod"; -export default function ChkgdExcel({ type }: { type: string }) { +export default function ChkgdExcel({ type,setIsRegExcel }: { type: string, setIsRegExcel:(open:boolean) =>void }) { const { rswtChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload } = useWrStore((state) => { return state; @@ -146,29 +144,28 @@ export default function ChkgdExcel({ type }: { type: string }) { const onSubmit = (values: z.infer<typeof chkgdRegExcel>) => { if (values.chckYr === "") { - ToastFormUi({ body: "등록년도를 작성해주세요", title: "지도점검 등록" }); + toast.error("등록년도를 작성해주세요"); return; } if (type === "RNB") { if (excelData === undefined || excelData?.length === 0) { - ToastFormUi({ - body: "빈 파일 및 파일 오류 입니다.", - title: "지도점검 등록", - }); + toast.error("빈 파일 및 파일 오류 입니다."); + return; } else { rainChkExcelDataUPload(excelData as rainChkZodType[]); + setIsRegExcel(false) } } else if (type === "RST") { if (excelRswtData === undefined || excelRswtData?.length === 0) { - ToastFormUi({ - body: "빈 파일 및 파일 오류 입니다.", - title: "중수지도점검 등록", - }); + toast.error("빈 파일 및 파일 오류 입니다."); + return; } else { rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]); + setIsRegExcel(false) + } } }; diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index f3643a094..edbd9e570 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -8,7 +8,7 @@ import { Button } from "@common/components/ui"; import React, { useEffect, useState } from "react"; import type { z } from "zod"; -export default function ChkgdModal({ type, obj }: { type: string; obj: any }) { +export default function ChkgdModal({ type, obj, setIsModal }: { type: string; obj: any, setIsModal: (open: boolean) => void }) { const { rainChkgdn, rswtChkgdn, diff --git a/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx b/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx index 94be4ebb6..627537dcb 100644 --- a/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable.tsx @@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store"; import type { TableUpperProps } from "@/app/store/common/type/header"; import type { } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList"; import { InputTableBody } from "@/components/lib/func/TableData"; import { Input, @@ -13,16 +14,18 @@ import { TableHeader, TableRow, } from "@common/components/ui"; -import { useEffect, useState, type Dispatch, type SetStateAction } from "react"; +import { useEffect, useState, type Dispatch, type SetStateAction } from "react"; export function GuideDetailsTable({ chgRes, headList, + upheadList, type, setChGuidData, }: { chgRes: any[]; - headList: TableUpperProps[]; + headList: TableUpperProps[]; + upheadList: chHeadType[]; type: string; setChGuidData: (chgRes: any[]) => void; }) { @@ -35,21 +38,21 @@ export function GuideDetailsTable({ useEffect(() => { - setChGuidData(inputData??[] ); + setChGuidData(inputData ?? []); }, [inputData]); - + return ( <> - <div className={`card !m-[1.2rem] !p-0r `}> - <Table variant="secondary"> - <TableHeader className="font-bold">{headMakeprfmnc(headList, rainChkgdn?.rainHeadNm)}</TableHeader> - <TableBody > - {InputTableBody(inputData ?? [],headList, setInputData) } - </TableBody> - </Table> - </div> + <div className={`card !m-[1.2rem] !p-0r `}> + <Table variant="secondary"> + <TableHeader className="font-bold">{headMakeprfmnc(headList, upheadList)}</TableHeader> + <TableBody > + {InputTableBody(inputData ?? [], headList, setInputData)} + </TableBody> + </Table> + </div> </> ); } diff --git a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx index bc8581b75..7a43df3d8 100644 --- a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx @@ -76,7 +76,6 @@ export default function RswtChkgdTable({ }, [rswtChkgdn.rswtChkPolGuide]); useEffect(() => { - console.log("makeTableData ", makeTableData) getRswtSttnExcel(makeTableData) const selectedData = makeTableData .map((item) => { From f4f3d2a3e9b662f1ef1478848078088a1f5116a8 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Fri, 4 Jul 2025 18:36:54 +0900 Subject: [PATCH 162/259] =?UTF-8?q?=EB=AF=B8=EB=8B=88=EB=A7=B5=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/map/htdflSttn/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/wr/app/map/htdflSttn/page.tsx b/apps/wr/app/map/htdflSttn/page.tsx index e74d055d8..7b804b7cd 100644 --- a/apps/wr/app/map/htdflSttn/page.tsx +++ b/apps/wr/app/map/htdflSttn/page.tsx @@ -124,7 +124,7 @@ const Map = () => { treeData={treeData} isSearch={false} gisMaps={gisMaps} - isMiniMap={true} + isMiniMap={false} searchView={undefined} // searchView={(props: any) => ( // <MapSearchBar From 7c34c87aafb0aea6b7d2537c607d71d258f3ccae Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Fri, 4 Jul 2025 19:29:10 +0900 Subject: [PATCH 163/259] =?UTF-8?q?=EC=98=A8=EB=B0=B0=EC=88=98=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/htdflReg/page.tsx | 28 +++++++--- .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 53 ++++++++++++++----- .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 2 +- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 10 ++-- .../ui/form/fcltReg/htdflReg/htdflRegForm.tsx | 2 - .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 19 ++++++- .../fcltReg/bdstRegModal/bdstRegModal.tsx | 2 +- 7 files changed, 86 insertions(+), 30 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index 33cfa3bba..9b3688e61 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -21,9 +21,10 @@ import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal"; import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg"; import { BdstReg } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; +import { Toaster } from "react-hot-toast"; export default function Home() { - const { code, htdfl, initHtdfl, getHtdflBdstData } = useWrStore( + const { code, htdfl, initHtdflReg, getHtdflBdstData ,htdflNmSearch} = useWrStore( (state) => state ); const [searchTxt, setSearchTxt] = useState(""); @@ -42,18 +43,27 @@ export default function Home() { useEffect(() => { if (!htdfl.isInit) { + initHtdflReg('41') } - }, [htdfl.isInit, initHtdfl]); + }, [htdfl.isInit, initHtdflReg]); useEffect(() => { - if (code.sggCd.length > 0) { + if (htdflRes&&htdflRes.length>0) { + + console.log('htdflRes ', htdflRes) const htdflData = tableData(htdflRes, { code }).map( (item: customHtdflBdst) => { + let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' + return { ...item, + archArea:archArea + }; } ); setbdstTable(htdflData); + }else{ + setbdstTable([]); } }, [code, htdflRes]); @@ -79,7 +89,7 @@ export default function Home() { // setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding }); // }; useEffect(() => { - getHtdflBdstData(pageNation, "0"); + getHtdflBdstData(pageNation, "41"); }, [pageNation]); return ( @@ -104,7 +114,12 @@ export default function Home() { <Button size={"sm"} onClick={() => { - initHtdfl(searchTxt || ""); + if(searchTxt&&searchTxt.length>0){ + htdflNmSearch(String(41),searchTxt) + }else{ + initHtdflReg(String(41) ); + + } }} > 조회 @@ -160,7 +175,8 @@ export default function Home() { }} /> - {/* <UiModal +<Toaster position="top-center" /> +{/* <UiModal bodyClass={""} open={bdstChgProps.isOpen} body={ diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index f2875e232..317f68e10 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -76,7 +76,7 @@ export const hdtflZod = z.object({ .date() .default(() => new Date()) .nullish(), - archArea: z.number().default(0), + archArea: z.string().default(''), archChgArea: z.number().nullish().default(0), rgtr: z.string().nullish().default(null), mdfr: z.string().nullish().default(null), @@ -99,7 +99,8 @@ export type htdflFacState = { }; }; type htdflFacSActions = { - initHtdfl: (code: string) => void; + initHtdflReg: (code: string) => void; + htdflNmSearch: (code: string | number, fcltNm:string) => void; htdflBdstUpdate: (data: customHtdflBdst, code: string | number) => void; htdflBdstReg: (data: customHtdflBdst, code: string | number) => void; getHtdflBdstData: (pageNation: number, code: string | number) => void; @@ -116,8 +117,16 @@ export const htdflFacStateExport: htdflFacState = { }, }; -const initFetch = async (code: string | number) => { - const rswtRes = await getFetch("wr", `/drain/facilityList/1/20/${code}`); +const initFetch = async (code: string) => { + + + console.log(' initFetch code ', code) + let url = `/drain/facilityList/1/20` + + url+=`/${code}` + + + const rswtRes = await getFetch("wr", url); return rswtRes; }; export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( @@ -142,9 +151,9 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( console.log(e); } }, - initHtdfl: async (code: string) => { + initHtdflReg: async (code: string) => { try { - const htdflRes = await initFetch(code); + const htdflRes = await initFetch( String(code)); set((state: htdflFacState) => { return { ...state, @@ -162,17 +171,18 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( htdflBdstUpdate: async (data: customHtdflBdst, code: string | number) => { try { - console.log('data ', data) const chData = await makeMdfr(data); - console.log('chData ', chData) - const res = await putFectch("/drain/facility", chData); - if (res.ok) { + + if (res.status) { toast.success("온배수 건축물 수정이 완료되었습니다."); } - const htdflRes = await initFetch(code); + const htdflRes = await getFetch( + "wr", + `/drain/facilityList/1/20/${code}` + ); set((state: htdflFacState) => ({ ...state, htdfl: { @@ -195,7 +205,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( if (res.status ===200) { toast.success("온배수 건축물 등록이 완료되었습니다."); } - const htdflRes = await initFetch(code); + const htdflRes = await initFetch(String(code)); set((state: htdflFacState) => ({ ...state, htdfl: { @@ -208,6 +218,23 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( toast.error("온배수 건축물 등록 오류입니다.."); } - } + },htdflNmSearch :async(code:string | number, fcltNm:string) =>{ + try { + + const htdflRes = await getFetch("wr", `/drain/facilityList/1/20/${code}/${fcltNm}`); + set((state: htdflFacState) => { + return { + ...state, + htdfl: { + ...state.htdfl, + htdflRes: htdflRes, + isInit: false, + }, + }; + }); + } catch (error) { + console.log(error); + } + }, }; }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 178badd3b..df9c3b543 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -11,7 +11,7 @@ import { makeMdfr, makeRstr } from "../bdstReg"; wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), oblgTrgtWtrUsqty: z.number().nullish().default(0), orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }), - filtrTrtmfctCpct: z.number({ required_error: validationMessages.required("처리시설 용량") }).positive({ message: validationMessages.required("처리시설 용량") }), + filtrTrtmfctCpct: z.number({ required_error: validationMessages.required("처리시설 용량") }), filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }), filtrTrtmfctUsgCd: z.string().default("").nullish(), rswtrUsqty: z.number().default(0), diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 8ae9ad4dd..04b36cbc5 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -89,7 +89,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { return ( <> - <h1 className={formH1Class}>건축물 기본 정보</h1> + <h1 className={formH1Class}> { type !== "HTB"?"건축물 기본 정보": '발전소 기본 정보'}</h1> <div className="grid grid-cols-6 gap-2 mt-4"> <div className="col-span-3"> <FormField @@ -140,10 +140,10 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { control={form.control} name="bdstNm" render={({ field }) => ( - <FormUi label="건축물명"> + <FormUi label={ type !== "HTB"?"건축물명": '발전소명'}> <Input className={selectClass} - placeholder="건축물 명 입력하세요" + placeholder= {type !== "HTB"?"건축물 명 입력하세요":'발전소명 입력하세요' } type="text" {...field} /> @@ -156,7 +156,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { control={form.control} name="daddr" render={({ field }) => ( - <FormUi label="건축물 주소"> + <FormUi label= { type !== "HTB"?"건축물 주소": '발전소 주소'} > <Input className={selectClass} placeholder="위치를 입력해주세요" @@ -173,7 +173,7 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { control={form.control} name="frstArchPrmsnDt" render={({ field }) => ( - <FormUi label="최초건축허가일"> + <FormUi label= { type !== "HTB"?"최초건축허가일": '준공년도'} > <DatePicker mode={"single"} field={{ diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index 5547f057b..83051672d 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -58,8 +58,6 @@ export default function HtdflRegForm({ if (setIsModal) setIsModal(false); } else { - console.log(' isModal ' ,isModal) - console.log(' values ' ,values) htdflBdstUpdate(values, "41"); } }; diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index ed0e51af6..8c71d77a9 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -62,7 +62,11 @@ export default function RswtrRegForm({ rswtBdstUpdate(values, "41"); } }; - const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => { + + const filtrTrtmfctCpct = form.watch('reuseBuilding.0.rswtrObj.filtrTrtmfctCpct') + const cleanRswtData = (raw: any): z.infer<typeof rswtZod> => { + + console.log('raw ', raw) return { ...raw, frstArchPrmsnDt: raw?.frstArchPrmsnDt @@ -82,11 +86,20 @@ export default function RswtrRegForm({ rswtrObj: { ...item?.rswtrObj, filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", + filtrTrtmfctCpct: item?.rswtrObj?.filtrTrtmfctCpct ?? null, + filtrTrtmfctProcs: item?.rswtrObj?.filtrTrtmfctProcs || code.rswtPrscCdMthdCd[0]?.val, + orgwtKndCd: item?.rswtrObj?.orgwtKndCd || code.orgwtKndCd[0]?.val, }, })), }; }; - + // useEffect(() =>{ + // console.log(' formform ', form.watch()) + // },[form.formState]) + useEffect(() =>{ + console.log(' filtrTrtmfctCpct ', filtrTrtmfctCpct) + },[filtrTrtmfctCpct]) + useEffect(() => { console.log("form errors:", form.formState.errors); }, [form.formState.errors]); @@ -227,6 +240,8 @@ export default function RswtrRegForm({ onFocus={() => { // 입력 시 자동으로 확인불가 해제 if (isUnknown && !readonly) { + + console.log('value') field.onChange(""); // 초기화 } }} diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index bee445114..4abe29d4e 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -148,7 +148,7 @@ export function BdstReg<T extends MoType>({ moType,setIsModal,isModal }: BdstReg <RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={isModal} setIsModal={setIsModal} /> :moType==='RST' ? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={isModal} setIsModal={(open) =>{setIsModal}}></RswtrRegForm> - :<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true} setIsModal={(open) =>{setIsModal}}></HtdflRegForm> + :<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true} setIsModal={(open) =>{setIsModal && setIsModal(open)}}></HtdflRegForm> } </div> From 970bfc6c8211ae3d515fda837829f3dc4305c0c6 Mon Sep 17 00:00:00 2001 From: ljpark <ljpark@mind-one.co.kr> Date: Fri, 4 Jul 2025 19:36:05 +0900 Subject: [PATCH 164/259] =?UTF-8?q?=EC=9E=90=EB=A3=8C=EA=B4=80=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 2 +- .../map/components/popupComponent/chart/infilChart.tsx | 4 ++-- apps/sn/app/components/lib/api/index.ts | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 3354fcc4c..109b519ea 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -5,7 +5,7 @@ NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 -NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com/dc-service #자료관 데이터 +NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com #자료관 데이터 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 8ad2a4362..46c94eaf6 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -30,7 +30,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }); const [inftwtQty, setInftwtQty] = useState<number>(0); // 침입수량 const aplcnYms = fn.useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 - const dcData = fn.getDcTree(); // 자료관 데이터 가져오기 + pplMngNo = "L"+pplMngNo; // inp파일에 하수관로와 맨홀의 번호가 같으면 분석 오류가 발행하여 const openPopup = () => { if (buttonRef.current) { @@ -70,7 +70,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo setInftwtAnlsInfos([{ val: 0, text: '선택' }]); return; } - + const dcData = fn.getDcTree(); // 자료관 데이터 가져오기 fn.selectInftwtAnls(aplcnYm) .then((data) => { setInftwtAnlss(data ?? []); diff --git a/apps/sn/app/components/lib/api/index.ts b/apps/sn/app/components/lib/api/index.ts index 1d711b18a..11267a573 100644 --- a/apps/sn/app/components/lib/api/index.ts +++ b/apps/sn/app/components/lib/api/index.ts @@ -1,5 +1,4 @@ const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ''; -const DC_URL = process.env.NEXT_PUBLIC_RSONE_DC_URL || ''; export const postData = async (url: string, data: object): Promise<any> => { const options: RequestInit = { @@ -57,8 +56,7 @@ export const getData = async (url: string, data?: object): Promise<any> => { export const getDcData = async (url: string, data?: object): Promise<any> => { console.log(url); - console.log(`${DC_URL}${url}`); - const res = await fetch(`${DC_URL}${url}`, { + const res = await fetch('/dc-service'+url, { method: "GET", }); if (res.ok) { From 76a511a5e0bdef23705be53a9467498d8be697b5 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Fri, 4 Jul 2025 20:06:07 +0900 Subject: [PATCH 165/259] =?UTF-8?q?=EC=A4=91=EC=88=98=EB=8F=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 3 +++ .../app/ruseFcltMng/fcltReg/rswtReg/page.tsx | 18 ++++++++++++++++-- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 4 ++-- .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 14 +++++++------- .../fcltReg/bdstRegModal/bdstRegModal.tsx | 2 +- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index b468fad03..8ecc1221f 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -51,8 +51,11 @@ export default function Home() { if (code.sggCd.length > 0) { const rainData = tableData(rainRes, { code }).map( (item: customRainBdst) => { + let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' return { ...item, + archArea:archArea, + bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", }; } diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx index ea0dea649..94224d40d 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rswtReg/page.tsx @@ -20,6 +20,7 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button } from "@common/components"; import { useEffect, useState } from "react"; +import { Toaster } from "react-hot-toast"; export default function Home() { const { code, rswt, initRswt, rswtBdstSearch, getRswtBdstData } = useWrStore( @@ -45,8 +46,13 @@ export default function Home() { if (code.sggCd.length > 0 && rswtRes?.length > 0) { const rswtData = tableData(rswtRes, { code })?.map( (item: customRswtBdst) => { + let archArea = + item?.archArea.split(".")[0] !== "-1" + ? item?.archArea.split(".")[0] + : "확인불가"; return { ...item, + archArea: archArea, bdstChgYn: item.chgBuilding[0]?.bdstChgNm != null ? "Y" : "N", bdstUsgCd: item.reuseBuilding[0]?.bdstUsgCd, }; @@ -151,7 +157,13 @@ export default function Home() { </div> <UiModal - body={<BdstReg moType="RST" setIsModal={setIsNewReg} isModal={issNewReg}></BdstReg>} + body={ + <BdstReg + moType="RST" + setIsModal={setIsNewReg} + isModal={issNewReg} + ></BdstReg> + } bodyClass="w-[68vw] max-w-none h-[90vh]" open={issNewReg} onOpenChange={(open) => { @@ -162,12 +174,14 @@ export default function Home() { bodyClass={""} open={bdstChgProps.isOpen} body={ - <BdstChgModal chgBuilding={bdstChgProps.chgBuilding} ></BdstChgModal> + <BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal> } onOpenChange={(open) => { setBdstChgProps({ ...bdstChgProps, isOpen: open }); }} /> + + <Toaster position="top-center" /> </ContentsDiv> </> ); diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 04b36cbc5..31e8dbacb 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -223,9 +223,9 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { placeholder="면적을 입력하세요" type="text" onChange={(e) => { - handleCommaNumberChange(e, field.onChange); + field.onChange(e.target.value) }} - value={formatCommaNumber(field.value)} + value={field.value} /> </FormUi> )} diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index 8c71d77a9..0fbffbf59 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -81,11 +81,11 @@ export default function RswtrRegForm({ ? new Date(item.instlCmptnDt) : new Date(), // item?.instlCmptnDt가 유효하지 않으면 현재 날짜로 초기화 operMngCd: item?.operMngCd ?? "", // null → "" - instlCstSprtYn: item?.instlCstSprtYn ?? "Y", // null → "Y" - grntchBdstCertYn: item?.grntchBdstCertYn ?? "Y", + instlCstSprtYn: item?.instlCstSprtYn || code.yn[0]?.val, // null → "Y" + grntchBdstCertYn: item?.grntchBdstCertYn|| code.yn[0]?.val, rswtrObj: { ...item?.rswtrObj, - filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn ?? "Y", + filtrTrtmfctYn: item?.rainyObj?.filtrTrtmfctYn || code.yn[0]?.val, filtrTrtmfctCpct: item?.rswtrObj?.filtrTrtmfctCpct ?? null, filtrTrtmfctProcs: item?.rswtrObj?.filtrTrtmfctProcs || code.rswtPrscCdMthdCd[0]?.val, orgwtKndCd: item?.rswtrObj?.orgwtKndCd || code.orgwtKndCd[0]?.val, @@ -349,7 +349,7 @@ export default function RswtrRegForm({ if (readonly) return; handleMinusNumberChange(e, field.onChange); }} - disabled={instlCstSprtYn !== "Y"} + disabled={instlCstSprtYn === "N"||instlCstSprtYn === "D"} /> </FormUi> ); @@ -374,7 +374,7 @@ export default function RswtrRegForm({ label={""} selectArray={code.bdstIncenYn} onSelectValue={readonly ? () => {} : field.onChange} - value={field.value ?? code.yn[0]?.val} + value={field.value || code.yn[0]?.val} readOnly={readonly} /> </FormUi> @@ -410,7 +410,7 @@ export default function RswtrRegForm({ field.onChange(e.target.value); } }} - disabled={grntchBdstCertYn !== "Y"} + disabled={grntchBdstCertYn == "N" || grntchBdstCertYn == "D"} max={4} /> </FormUi> @@ -447,7 +447,7 @@ export default function RswtrRegForm({ field.onChange(e.target.value); } }} - disabled={grntchBdstCertYn !== "Y"} + disabled={grntchBdstCertYn == "N" || grntchBdstCertYn == "D"} diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 4abe29d4e..c534c38af 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -147,7 +147,7 @@ export function BdstReg<T extends MoType>({ moType,setIsModal,isModal }: BdstReg { moType === 'RNB'? <RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={isModal} setIsModal={setIsModal} /> :moType==='RST' - ? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={isModal} setIsModal={(open) =>{setIsModal}}></RswtrRegForm> + ? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={isModal} setIsModal={(open) =>{setIsModal && setIsModal(open)}}></RswtrRegForm> :<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true} setIsModal={(open) =>{setIsModal && setIsModal(open)}}></HtdflRegForm> } From 1d9111ee4c98291f7f7fd8329b6a92e62e2949d6 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Fri, 4 Jul 2025 20:10:52 +0900 Subject: [PATCH 166/259] =?UTF-8?q?=EB=B9=97=EB=AC=BC/=EC=A4=91=EC=88=98?= =?UTF-8?q?=EB=8F=84/=EC=98=A8=EB=B0=B0=EC=88=98=EC=8B=9C=EC=84=A4?= =?UTF-8?q?=ED=98=84=ED=99=A9=20=EC=A1=B0=ED=9A=8C=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20=ED=8E=98=EC=9D=B4=EC=A7=95=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC,=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltSttn/htdflSttn/page.tsx | 195 ++++++++++++------ .../ruseFcltMng/fcltSttn/rainSttn/page.tsx | 86 +++----- .../ruseFcltMng/fcltSttn/rswtSttn/page.tsx | 178 +++++++++++----- .../ruseFcltMng/fcltSttn/htdflSttn/index.tsx | 41 +++- .../ruseFcltMng/fcltSttn/rainSttn/index.tsx | 99 +++++---- .../ruseFcltMng/fcltSttn/rswtSttn/index.tsx | 28 ++- 6 files changed, 385 insertions(+), 242 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx index e43d5b04f..959367202 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/htdflSttn/page.tsx @@ -8,6 +8,7 @@ import type { } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { excelDownload, + getCity, getCityOrSgg, tableData, } from "@/components/lib/func/commom"; @@ -16,16 +17,23 @@ import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDeta import { ContentsDiv, SearchBaseForm, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, Title, UiModal, UiTable, type ReturnType, + type SelectDataType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button } from "@common/components/ui"; +import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; export default function HtdflSttn() { const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore( @@ -38,6 +46,8 @@ export default function HtdflSttn() { const [pageNation, setPageNation] = useState(1); const [isChHead, setIsChHead] = useState(false); const [bdstTable, setBdstTable] = useState<customRainBdst[]>(); + const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>() + const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); const [detailModal, setDetailModal] = useState<{ isOpen: boolean; data: customRainBdst | undefined; @@ -46,17 +56,47 @@ export default function HtdflSttn() { isOpen: boolean; chBuilding: chgBuilding[]; }>({ isOpen: false, chBuilding: [] }); - - const codeData = getCityOrSgg(ref); + const [fcltNm, setFcltNm] = useState<string>(""); const excelClick = useCallback(() => { - if (codeData) htdflSttnSearch(1, "10000", codeData); - }, [htdflSttnSearch, codeData]); + // 최신 검색 조건 반영 + const con = getConValue(); + htdflSttnSearch(1, "10000", String(con), fcltNm, code.cityCd, code.sggCd); + }, [htdflSttnSearch, objSearch, code.cityCd, code.sggCd]); useEffect(() => { - if (codeData != null) htdflSttnSearch(pageNation, "20", codeData); + htdflSttnSearch(pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd); }, [pageNation]); + const getSelCity = (val: string | number) => { + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setObjSearch({ city: cityValue, sgg: "" }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } + }; + + const getSgg = (val: string | number) => { + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + + const getConValue = () => { + if (!objSearch.city || objSearch.city === "0") { + return "0"; + } + if (objSearch.sgg && objSearch.sgg !== "0") { + return objSearch.sgg; + } + return objSearch.city; + }; + const cellClick = (index: number | undefined, headId: string) => { if ( headId !== "chBuildingYn" && @@ -67,42 +107,34 @@ export default function HtdflSttn() { } }; useEffect(() => { - const excelDown = async () => { - if (htdflSttn.excelList.length > 0) { - if (htdflSttn.excelList.length === 0) return; - const excelData = await tableData(htdflSttn.excelList, { code }); - const htdflExcel = excelHtdflSttnParsing(excelData, code.cityCd, code.sggCd); - excelDownload( - htdflExcel as [[]], - "온배수시설 현황", - "sample_htdflSttn.xlsx", - "A1:S3" - ); - } - }; - excelDown(); + if (htdflSttn.excelList.length > 0) { + if (htdflSttn.excelList.length === 0) return; + excelDownload( + htdflSttn.excelList, + "온배수시설 현황", + "sample_htdflSttn.xlsx", + "A1:S3" + ); + } }, [htdflSttn.excelList, code]); useEffect(() => { if (!htdflSttn.isInit) { - initHtdfl(codeData ?? "0"); + initHtdfl(1, "20", "0", fcltNm, code.cityCd, code.sggCd); } }, [htdflSttn.isInit, initHtdfl]); useEffect(() => { - if (htdflSttnRes.length > 0 && code.cityCd.length > 0) { - const data = tableData(htdflSttnRes, { code }); - const chData = data - .map((item: any) => ({ - ...item, - ...item.reuseBuilding[0], - ...item.reuseBuilding[0].htdflObj, - chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", - })) - .filter((item: any) => item.htdflObj !== undefined); - - setBdstTable(chData); - } + const data = tableData(htdflSttnRes, { code }); + const chData = data + .map((item: any) => ({ + ...item, + ...item.reuseBuilding[0], + ...item.reuseBuilding[0].htdflObj, + chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", + })) + .filter((item: any) => item.htdflObj !== undefined); + setBdstTable(chData); }, [code, htdflSttnRes, htdflSttn.htdflSttHeadList]); return ( @@ -111,43 +143,76 @@ export default function HtdflSttn() { <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"온배수 시설 현황"} /> - <SearchBaseForm - selectSidoData={code.cityCd} - selectSigunData={code.sggCd} - selectRegionData={code.rvbsnCd} - selectUnitWaterShedData={code.lgbsnCd} - selectMiddleRegionData={code.mdmbsnCd} - selectEnvPartData={code.lclgvrnmntCd} - rightChildren={<Button - className={btnClass} - onClick={() => { - setIsChHead(true); - } } - > - 조회항목설정 - </Button>} - leftChildren={undefined} - queryClick={function (returnType: ReturnType): void { - // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - let con; - if (returnType.sigunValue != "0") { - con = returnType.sigunValue; - } else { - con = returnType.sidoValue; - } - htdflSttnSearch(pageNation, "20", con); - } } - excelClick={excelClick} - initClick={function (): void { } } - btnClass={btnClass} - ref={ref} isAdmin={false} /> + + <SearchDiv> + <SearchFormLeft> + <div className="col-span-10 flex flex-row"> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd} + onSelectValue={getSelCity} + /> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl ml-4" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + value={objSearch.sgg} // value props 추가 + onSelectValue={getSgg} + /> + <div className="col-span-2 flex flex-row space-x-2"> + <Label className="w-28 mt-2 text-xl text-gray-600"> + {"시설명"} + </Label> + <SearchInput + className={"w-full h-full text-2xl"} + label={""} + textValue={fcltNm || ""} + setText={setFcltNm} + /> + </div> + </div> + </SearchFormLeft> + <SearchFormRight + className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="flex flex-row space-x-2 items-center"> + <Button + size={"sm"} + onClick={() => { + const con = getConValue(); + htdflSttnSearch(pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd); + }} + > + 조회 + </Button> + <Button + size={"sm"} + className={`${btnClass} green`} + onClick={excelClick} + > + 다운로드 + </Button> + <Button + size={"sm"} + className={btnClass} + onClick={() => { + setIsChHead(true); + }} + > + 조회항목설정 + </Button> + </div> + </SearchFormRight> + </SearchDiv> </div> </div> <div className="grid grid-cols-6 gap-4 "> <div className="col-span-6"> <ListDiv> <UiTable - headName={[]} + headName={undefined} tableData={bdstTable || []} children={ <HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} /> diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx index 7e068bcd0..0b6dffe07 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rainSttn/page.tsx @@ -24,7 +24,7 @@ import { type SelectDataType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button } from "@common/components/ui"; +import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import type { chgBuilding, @@ -52,8 +52,7 @@ export default function RainSttn() { isOpen: boolean; chBuilding: chgBuilding[]; }>({ isOpen: false, chBuilding: [] }); - - const codeData = getCityOrSgg(ref); + const [fcltNm, setFcltNm] = useState<string>(""); const cellClick = (index: number | undefined, headId: string) => { @@ -82,7 +81,6 @@ export default function RainSttn() { }; const getSgg = (val: string | number) => { - console.log("val", val) setObjSearch({ ...objSearch, sgg: String(val) }) }; @@ -96,11 +94,9 @@ export default function RainSttn() { return objSearch.city; }; - - useEffect(() => { if (!rainSttn.isInit) { - rainSttnInit(codeData ?? "0"); + rainSttnInit(1, "20", "0", fcltNm, code.cityCd, code.sggCd); } }, [rainSttn.isInit, rainSttnInit]); @@ -108,8 +104,6 @@ export default function RainSttn() { const data = tableData(rainSttnRes, { code }); const chData = data .map((item: any) => { - console.log("item", item); - console.log("왜안돼", item.reuseBuilding[0].rainyObj.dtfcltCpct) return { ...item, ...item.reuseBuilding[0], @@ -124,15 +118,21 @@ export default function RainSttn() { ? "확인불가" : item.reuseBuilding[0].instlCstSprtAmt, chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? "Y" : "N", + pntfColArea: item.reuseBuilding[0].rainyObj.pntfColArea === -1 + ? "확인불가" + : item.reuseBuilding[0].rainyObj.pntfColArea, + filtrTrtmfctCpct: item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct === -1 + ? "확인불가" + : item.reuseBuilding[0].rainyObj.filtrTrtmfctCpct, + archArea: Math.floor(item.archArea) === -1 ? "확인불가" : item.archArea, }; }) .filter((item: any) => item.rainyObj !== undefined); - console.log("chData", chData) setBdstTable(chData); }, [code, rainSttnRes, rainSttn.rainSttHeadList]); useEffect(() => { - if (codeData != null) rainSttnSearch(pageNation, "20", codeData, code.cityCd, code.sggCd); + rainSttnSearch(pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd); }, [pageNation]); useEffect(() => { @@ -147,13 +147,10 @@ export default function RainSttn() { } }, [rainSttn.excelList]); - // const excelClick = useCallback(() => { - // if (codeData) rainSttnSearch(1, "10000", codeData, code.cityCd, code.sggCd); - // }, [rainSttnSearch, codeData, code.cityCd, code.sggCd]); const excelClick = useCallback(() => { // 최신 검색 조건 반영 const con = getConValue(); - rainSttnSearch(1, "10000", String(con), code.cityCd, code.sggCd); + rainSttnSearch(1, "10000", String(con), fcltNm, code.cityCd, code.sggCd); }, [rainSttnSearch, objSearch, code.cityCd, code.sggCd]); return ( @@ -162,8 +159,6 @@ export default function RainSttn() { <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"빗물재이용 시설 현황"} /> - - <SearchDiv> <SearchFormLeft> <div className="col-span-10 flex flex-row"> @@ -182,6 +177,17 @@ export default function RainSttn() { value={objSearch.sgg} // value props 추가 onSelectValue={getSgg} /> + <div className="col-span-2 flex flex-row space-x-2"> + <Label className="w-28 mt-2 text-xl text-gray-600"> + {"시설명"} + </Label> + <SearchInput + className={"w-full h-full text-2xl"} + label={""} + textValue={fcltNm || ""} + setText={setFcltNm} + /> + </div> </div> </SearchFormLeft> <SearchFormRight @@ -191,7 +197,7 @@ export default function RainSttn() { size={"sm"} onClick={() => { const con = getConValue(); - rainSttnSearch(1, "20", String(con), code.cityCd, code.sggCd); + rainSttnSearch(pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd); }} > 조회 @@ -215,50 +221,6 @@ export default function RainSttn() { </div> </SearchFormRight> </SearchDiv> - - - - - - - - - - - {/* <SearchBaseForm - selectSidoData={code.cityCd} - selectSigunData={code.sggCd} - selectRegionData={code.rvbsnCd} - selectUnitWaterShedData={code.lgbsnCd} - selectMiddleRegionData={code.mdmbsnCd} - selectEnvPartData={code.lclgvrnmntCd} - rightChildren={ - <Button - className={btnClass} - onClick={() => { - setIsChHead(true); - }} - > - 조회항목설정 - </Button> - } - leftChildren={undefined} - queryClick={function (returnType: ReturnType): void { - // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - let con; - if (returnType.sigunValue != "0") { - con = returnType.sigunValue; - } else { - con = returnType.sidoValue; - } - rainSttnSearch(1, "20", con, code.cityCd, code.sggCd); - }} - excelClick={excelClick} - initClick={function (): void { }} - btnClass={btnClass} - ref={ref} - isAdmin={false} - /> */} </div> </div> <div className="grid grid-cols-6 gap-4 "> diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx index f9b3c6187..ee7a344f8 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/rswtSttn/page.tsx @@ -5,23 +5,31 @@ import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; import { excelDownload, + getCity, getCityOrSgg, tableData, } from "@/components/lib/func/commom"; import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal"; +import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal"; import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal"; import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal"; import { ContentsDiv, SearchBaseForm, + SearchDiv, + SearchFormLeft, + SearchFormRight, + SearchInput, + SelectBox, Title, UiModal, UiTable, type ReturnType, + type SelectDataType, } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan"; -import { Button } from "@common/components/ui"; +import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; export default function RswtSttn() { @@ -34,13 +42,14 @@ export default function RswtSttn() { const [isChHead, setIsChHead] = useState(false); const ref = useRef<ReturnType>({} as ReturnType); const [bdstTable, setBdstTable] = useState<customRswtBdst[]>(); + const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>() + const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" }); const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false }) const [bdstChgProps, setBdstChgProps] = useState<{ isOpen: boolean; chBuilding: chgBuilding[]; }>({ isOpen: false, chBuilding: [] }); - - const codeCityOrSgg = getCityOrSgg(ref); + const [fcltNm, setFcltNm] = useState<string>(""); const cellClick = (index: number | undefined, headId: string) => { @@ -50,37 +59,67 @@ export default function RswtSttn() { if ( bdstTable[index] && bdstTable[index]?.chBuildingYn === 'Y' - ) { - setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding }); } } } + const getSelCity = (val: string | number) => { + const cityValue = String(val); + + if (cityValue === "0") { + setSelectSgg([]); + setObjSearch({ city: cityValue, sgg: "" }); + } else { + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + + const firstSggVal = data.find(item => item.val === "0")?.val || (data[0]?.val ?? ""); + setObjSearch({ city: cityValue, sgg: firstSggVal }); + } + }; + + const getSgg = (val: string | number) => { + setObjSearch({ ...objSearch, sgg: String(val) }) + }; + + const getConValue = () => { + if (!objSearch.city || objSearch.city === "0") { + return "0"; + } + if (objSearch.sgg && objSearch.sgg !== "0") { + return objSearch.sgg; + } + return objSearch.city; + }; + useEffect(() => { if (!rswtSttn.isInit) { - rswtSttnInit("0"); + rswtSttnInit(1, "20", "0", fcltNm, code.cityCd, code.sggCd); } }, [rswtSttn.isInit, rswtSttnInit]); useEffect(() => { - if (rswtSttnRes?.length > 0 && code.cityCd.length > 0) { - const data = tableData(rswtSttnRes, { code }); - const chData = data - .map((item: customRswtBdst) => ({ + const data = tableData(rswtSttnRes, { code }); + const chData = data + .map((item: customRswtBdst) => { + return { ...item, ...item.reuseBuilding[0], ...item.reuseBuilding[0]?.rswtrObj, - chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N' - })) - .filter( - (item: customRswtBdst) => - item.reuseBuilding[0]?.rswtrObj !== undefined - ); + chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N', + instlCst: item.reuseBuilding[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCst, + instlCstSprtAmt: item.reuseBuilding[0]?.instlCstSprtAmt === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCstSprtAmt, + archArea : item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' + } + }) + .filter( + (item: customRswtBdst) => + item.reuseBuilding[0]?.rswtrObj !== undefined + ); - setBdstTable(chData); - } + setBdstTable(chData); }, [code, rswtSttnRes]); useEffect(() => { @@ -95,16 +134,14 @@ export default function RswtSttn() { } }, [rswtSttn.excelList]); - const excelClick = useCallback( - (returnType: ReturnType) => { - if (codeCityOrSgg) - rswtSttnSearch(1, "10000", codeCityOrSgg, code.cityCd, code.sggCd); - }, - [rswtSttnSearch, code.cityCd, code.sggCd, codeCityOrSgg] - ); + const excelClick = useCallback(() => { + // 최신 검색 조건 반영 + const con = getConValue(); + rswtSttnSearch(1, "10000", String(con), fcltNm, code.cityCd, code.sggCd); + }, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd]); useEffect(() => { - if (codeCityOrSgg != null) rswtSttnSearch(pageNation, "20", codeCityOrSgg, code.cityCd, code.sggCd); + rswtSttnSearch(pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd); }, [pageNation]); return ( @@ -113,38 +150,75 @@ export default function RswtSttn() { <div className="grid grid-cols-4 gap-4 "> <div className="col-span-4"> <Title title={"중수도시설 현황"} /> - <SearchBaseForm - selectSidoData={code.cityCd} - selectSigunData={code.sggCd} - selectRegionData={code.rvbsnCd} - selectUnitWaterShedData={code.lgbsnCd} - selectMiddleRegionData={code.mdmbsnCd} - selectEnvPartData={code.lclgvrnmntCd} - rightChildren={<Button - className={btnClass} - onClick={() => { - setIsChHead(true); - } } - > - 조회항목설정 - </Button>} - leftChildren={undefined} - queryClick={function (returnType: ReturnType): void { - // '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}' - if (codeCityOrSgg) - rswtSttnSearch(1, "20", codeCityOrSgg, code.cityCd, code.sggCd); - } } - excelClick={excelClick} - initClick={function (): void { } } - btnClass={btnClass} - ref={ref} isAdmin={false} /> + <SearchDiv> + <SearchFormLeft> + <div className="col-span-10 flex flex-row"> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl" + label="시도" + selectClass={""} + selectArray={code.cityCd} + onSelectValue={getSelCity} + /> + <SelectBox + className="col-span-2 w-1/6 h-full text-2xl ml-4" + label="시군구" + selectClass={""} + selectArray={selectSgg || []} + value={objSearch.sgg} // value props 추가 + onSelectValue={getSgg} + /> + <div className="col-span-2 flex flex-row space-x-2"> + <Label className="w-28 mt-2 text-xl text-gray-600"> + {"시설명"} + </Label> + <SearchInput + className={"w-full h-full text-2xl"} + label={""} + textValue={fcltNm || ""} + setText={setFcltNm} + /> + </div> + </div> + </SearchFormLeft> + <SearchFormRight + className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> + <div className="flex flex-row space-x-2 items-center"> + <Button + size={"sm"} + onClick={() => { + const con = getConValue(); + rswtSttnSearch(pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd); + }} + > + 조회 + </Button> + <Button + size={"sm"} + className={`${btnClass} green`} + onClick={excelClick} + > + 다운로드 + </Button> + <Button + size={"sm"} + className={btnClass} + onClick={() => { + setIsChHead(true); + }} + > + 조회항목설정 + </Button> + </div> + </SearchFormRight> + </SearchDiv> </div> </div> <div className="grid grid-cols-6 gap-4 "> <div className="col-span-6"> <ListDiv> <UiTable - headName={[]} + headName={undefined} tableData={bdstTable || []} children={ <HeadMakeColSpan upHeadList={rswtSttn.rswtSttNodeList} /> diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx index dccc8719c..eb37d0d73 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx @@ -5,6 +5,7 @@ import type { z } from "zod"; import { controlHeadView } from "../rainSttn"; import type { customHtdflBdst } from "../../fcltReg/htdflReg"; import { fetchType, getFetch } from "@/components/lib/api"; +import type { SelectDataType } from "@common/business_components/ui"; const htdflSttHeadList = htdflSttHeadListExport; const htdflSttNodeList = htdflSttNodeListExport; @@ -20,8 +21,12 @@ export type htdflSttnState = { }; }; type htdflSttnActions = { - initHtdfl: (con: string) => void; - htdflSttnSearch: (page: number, total: string, con: string) => void; + initHtdfl: (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; + htdflSttnSearch: (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; htdflChSttnHead: ( headList: z.infer<typeof sttnHeadListType>, ) => void; @@ -38,10 +43,17 @@ export const htdflSttnStateExport: htdflSttnState = { isInit: false, }, }; -const initFetch = async (code: string | number) => { +const initFetch = async (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { const htdflRes = await getFetch( "wr", - `/drain/facilityList/1/20/${code}`) + `/drain/facilityList` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") + ); return htdflRes; }; @@ -50,9 +62,11 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = ( set: any ) => { return { - initHtdfl: async (code: string | number) => { + initHtdfl: async (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { - const htdflSttnRes = await initFetch(code); + const htdflSttnRes = await initFetch(page, total, con, txt, sidoCode, sggCode); set((state: htdflSttnState) => { return { ...state, @@ -67,17 +81,22 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = ( console.log(error); } }, - htdflSttnSearch: async (page: number, total: string, con: string) => { + htdflSttnSearch: async (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { + console.log("page", page) const htdflSttnRes = await getFetch( fetchType.WR, - `/drain/facilityList/${page}/${total}/${con}` + `/drain/facilityList` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); + if (Number(total) > 9000) { - - set((state: htdflSttnState) => { - return { ...state, htdflSttn: { diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx index 42d158d4e..eb2c08d37 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx @@ -1,4 +1,4 @@ -import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; +import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import { fetchType, getFetch } from "@/components/lib/api"; import { type customRainBdst, @@ -16,34 +16,34 @@ import type { CommonTableProps } from "@/app/store/common/type/header"; import type { SelectDataType } from "@common/business_components/ui"; // 테이블 헤드 리스트 -const rainSttHeadList = rainSttHeadListExport; +const rainSttHeadList = rainSttHeadListExport; const rainSttNodeList = rainSttNodeListExport; const rainSttnDetailNodeList = rainSttnDetailNodeListExport; const rainSttnDetailHeadList = rainSttnDetailHeadListExport; const rainSttnRes: customRainBdst[] = []; -const rainChkRes : rainChkZodType ={} as rainChkZodType +const rainChkRes: rainChkZodType = {} as rainChkZodType -const visibleHeadList = (falseHeads:CommonTableProps[], orgNodeList:CommonTableProps[])=>{ +const visibleHeadList = (falseHeads: CommonTableProps[], orgNodeList: CommonTableProps[]) => { const visibleHeads = orgNodeList.map((node) => { - const copyNode = {...node} - falseHeads.forEach((head)=>{ - if(copyNode.id ===head.id) - copyNode.visible = head.visible + const copyNode = { ...node } + falseHeads.forEach((head) => { + if (copyNode.id === head.id) + copyNode.visible = head.visible }) return copyNode; }) return visibleHeads } -const getColspanReductionMap = (falseHeads:CommonTableProps[], orgList:CommonTableProps[]):Record<string, number> => { - const reduceMap:Record<string, number> = {}; +const getColspanReductionMap = (falseHeads: CommonTableProps[], orgList: CommonTableProps[]): Record<string, number> => { + const reduceMap: Record<string, number> = {}; falseHeads.forEach(head => { const node = orgList.find(n => n.id === head.id); if (node?.upName) { reduceMap[node.upName] = (reduceMap[node.upName] || 0) + 1; - if (node.row&& node.row >= 3) { + if (node.row && node.row >= 3) { const upperUpName = orgList.find(n => n.id === node.upName)?.upName; if (upperUpName) { reduceMap[upperUpName] = (reduceMap[upperUpName] || 0) + 1; @@ -78,35 +78,37 @@ const applyColspanReduction = ( }); }; // 일단 헤더가 3개 이상인경우 visible 처리를 위해서 공통함수로 작업 -export const controlHeadView = (headList:CommonTableProps[], orgNodeList:CommonTableProps[] ) =>{ +export const controlHeadView = (headList: CommonTableProps[], orgNodeList: CommonTableProps[]) => { const falseHeads = headList.filter((item) => item.visible == false); const viewHeadList = visibleHeadList(falseHeads, orgNodeList) - const reduceMap= getColspanReductionMap( falseHeads,viewHeadList) - return applyColspanReduction(viewHeadList,reduceMap); + const reduceMap = getColspanReductionMap(falseHeads, viewHeadList) + return applyColspanReduction(viewHeadList, reduceMap); } - - export type rainSttnState = { rainSttn: { rainSttnRes: customRainBdst[]; rainSttHeadList: CommonTableProps[]; rainSttNodeList: CommonTableProps[]; - rainSttnDetailHeadList:CommonTableProps[] - rainSttnDetailNodeList:CommonTableProps[] - rainChkRes:rainChkZodType + rainSttnDetailHeadList: CommonTableProps[] + rainSttnDetailNodeList: CommonTableProps[] + rainChkRes: rainChkZodType excelList: []; isInit: boolean; }; }; type rainSttnActions = { - rainSttnInit:(con:string) => void - rainSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], sggCode: SelectDataType[]) => void; + rainSttnInit: (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void + rainSttnSearch: (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; rainChSttnHead: ( headList: z.infer<typeof sttnHeadListType>, ) => void; - rainSttnChkSearch:(rusePk:string) => void; + rainSttnChkSearch: (rusePk: string) => void; }; export type rainSttnType = rainSttnState & rainSttnActions; @@ -115,10 +117,10 @@ export const rainSttnStateExport: rainSttnState = { rainSttn: { rainSttHeadList: rainSttHeadList, rainSttNodeList: rainSttNodeList, - rainSttnDetailHeadList:rainSttnDetailHeadList, - rainSttnDetailNodeList:rainSttnDetailNodeList, + rainSttnDetailHeadList: rainSttnDetailHeadList, + rainSttnDetailNodeList: rainSttnDetailNodeList, rainSttnRes: rainSttnRes, - rainChkRes:rainChkRes, + rainChkRes: rainChkRes, excelList: [], isInit: false, }, @@ -128,12 +130,18 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( set: any ) => { return { - rainSttnInit: async( con:string)=>{ - try{ + rainSttnInit: async (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { + try { - const rainSttnRes = await getFetch( + const rainSttnRes = await getFetch( fetchType.WR, - `/reuseFc/rainyInfoList/1/20/${con}` + `/reuseFc/rainyInfoList` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); set((state: rainSttnState) => { return { @@ -145,21 +153,22 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( }, }; }); - }catch(e){ + } catch (e) { console.log(e) } }, - rainSttnSearch: async (page: number, total: string, con: string, - sidoCode: SelectDataType[], - sggCode: SelectDataType[]) => { + rainSttnSearch: async (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { - let a = `/reuseFc/rainyInfoList/${page}/${total}/${con}` - console.log("주소", a) const rainSttnRes = await getFetch( fetchType.WR, - `/reuseFc/rainyInfoList/${page}/${total}/${con}` + `/reuseFc/rainyInfoList` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); - console.log("rainSttnRes", rainSttnRes) if (Number(total) > 9000) { const rainExcel = excelRainSttnParsing(rainSttnRes, sidoCode, sggCode); set((state: rainSttnState) => { @@ -189,7 +198,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( rainChSttnHead: async ( headList: z.infer<typeof sttnHeadListType> ) => { - const changeNodeList= controlHeadView(headList,rainSttNodeList) + const changeNodeList = controlHeadView(headList, rainSttNodeList) return set((state: rainSttnState) => ({ rainSttn: { @@ -199,21 +208,21 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( }, })); }, - rainSttnChkSearch: async( - rusePk:string - )=>{ + rainSttnChkSearch: async ( + rusePk: string + ) => { const rainChkRes = await getFetch( fetchType.WR, `/reuseChk/rainy/${rusePk}` ); - - return set((state: rainSttnState) =>({ + + return set((state: rainSttnState) => ({ rainSttn: { ...state.rainSttn, - rainChkRes:rainChkRes + rainChkRes: rainChkRes }, - }) ) + })) } }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx index 301cd965e..8fbe2c26d 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx @@ -28,9 +28,12 @@ export type rswtSttnState = { }; type rswtSttnActions = { - rswtSttnInit: (con: string) => void; - rswtSttnSearch: (page: number, total: string, con: string, sidoCode: SelectDataType[], - sggCode: SelectDataType[]) => void; + rswtSttnInit: (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; + rswtSttnSearch: (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => void; rswtChSttnHead: ( headList: z.infer<typeof sttnHeadListType>, ) => void; @@ -54,12 +57,18 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( set: any ) => { return { - rswtSttnInit: async (con: string) => { + rswtSttnInit: async (page: number, total: string, con: string, txt: string, + sidoCode: SelectDataType[], + sggCode: SelectDataType[]) => { try { const rswtSttnRes = await getFetch( fetchType.WR, - `/reuseFc/waterreuseFc/1/20/${con}` + `/reuseFc/waterreuseFc` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); set((state: rswtSttnState) => { return { @@ -75,13 +84,18 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( console.log(e) } }, - rswtSttnSearch: async (page: number, total: string, con: string, + rswtSttnSearch: async (page: number, total: string, con: string, txt: string, sidoCode: SelectDataType[], sggCode: SelectDataType[]) => { try { + console.log("헐", page) const rswtSttnRes = await getFetch( fetchType.WR, - `/reuseFc/waterreuseFc/${page}/${total}/${con}` + `/reuseFc/waterreuseFc` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "") ); if (Number(total) > 9000) { const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode); From db74c07df89d5bea899af9b1379eadc306f6996c Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Fri, 4 Jul 2025 22:26:55 +0900 Subject: [PATCH 167/259] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EB=8C=80=EC=9E=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 33 ++++--- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 90 +++++++++++++------ .../ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx | 38 ++++++++ .../prfmncReg/pbnstPrfmncReg/page.tsx | 39 +++++--- .../wr/app/store/matDmd/coMatRvw/headList.tsx | 4 +- apps/wr/components/lib/func/commom.tsx | 33 ++++--- .../ui/form/coMat/conCostForm/conCostForm.tsx | 11 ++- .../pbnPrfExcelModal/pbnPrfExcelModal.tsx | 49 ++++++---- .../fcltReg/pbnstRegModal/pbnstRegModal.tsx | 81 ++++++++++++++--- 9 files changed, 282 insertions(+), 96 deletions(-) create mode 100644 apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index c1e601320..46aeacbf3 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -9,6 +9,7 @@ import { } from "@/app/store/matDmd/coMatRvw/type"; import { formH1Class, formTableName } from "@/components/lib/class/comClass"; import { + formatPhoneNumber, getCity, getdmdMatFlag, tableData, @@ -33,7 +34,7 @@ import { import ListDiv from "@common/business_components/ui/list_div"; import { Button, Input, Label } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; -import { useForm } from "react-hook-form"; +import { useForm, useWatch } from "react-hook-form"; import toast, { Toaster } from "react-hot-toast"; import { z } from "zod"; import moment from "moment"; @@ -68,6 +69,7 @@ export default function CoMatRvw() { const [selectData, setSelectData] = useState<DmdCoReqType>( {} as DmdCoReqType ); + const [selectionVersion, setSelectionVersion] = useState(0); const getSearch = ( startYear: number, @@ -91,39 +93,46 @@ export default function CoMatRvw() { const form = useForm<z.infer<typeof DmdCoReqSchema>>({ resolver: zodResolver(DmdCoReqSchema), + shouldUnregister: true }); + const TableCellClick = (index: number) => { console.log(coMatRvwRes); if (coMatRvwRes && coMatRvwRes[index]) { - setSelectData(coMatRvwRes[index]); + setSelectionVersion((v) => v + 1); // 행을 클릭할 때마다 버전을 1씩 증가 } }; + const useUsgCdWatch = useWatch({ control: form.control, name: "useUsgCd" }); useEffect(() => { - if (form?.getValues("useUsgCd")) { + + console.log(' useUsgCdWatch page ' ,useUsgCdWatch) + if (useUsgCdWatch) { form.setValue( "demandCst.usgPrcsProcs", usageProcData?.find( - (item) => item.usage === (form?.getValues("useUsgCd") as string) + (item) => item.usage === useUsgCdWatch )?.process ?? "" ); } - }, [form.watch("useUsgCd")]); + }, [useUsgCdWatch, form,selectionVersion]); useEffect(() => { if (coMatRvwRes.length > 0) { const data = coMatRvwRes?.map((item, index) => { let flag = ""; - flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ??""); + + flag = getdmdMatFlag(item?.demandMatching?.splyFcltFlg ||undefined); + return { ...item, ctpvCd: item.demandCo?.ctpvCd, sggCd: item.demandCo?.sggCd, dmdCoNm: item.demandCo?.dmdCoNm, daddr: item.demandCo?.daddr, - telno: item.demandCo?.telno, - regDt: moment(item?.demandCo?.regDt).format("YYYY-MM-DD"), + telno: formatPhoneNumber(item?.demandCo?.telno||''), + dmndTmng: item?.dmndTmng, splyFcltFlg: flag, }; }); @@ -151,8 +160,8 @@ export default function CoMatRvw() { useEffect(() => { if (selectData) { - console.log(selectData); form.reset(selectData); + setSelectionVersion((v) => v + 1); // 강제로 바뀌었다고 알리기 } }, [selectData, form]); return ( @@ -269,7 +278,7 @@ export default function CoMatRvw() { ></UiTable> </ListDiv> <hr /> - <ScrollArea className="h-[49vh]"> + {/* <ScrollArea className="h-[49vh]"> */} <ListDiv> <h3 className="mt-4 ml-2 text-2xl font-medium text-label"> 수요신청 상세현황 @@ -660,9 +669,9 @@ export default function CoMatRvw() { </div> </div> </Form> - <ConCostForm form={form} type={"mat"} /> + <ConCostForm form={form} type={"mat"} selectionVersion={selectionVersion} /> </ListDiv> - </ScrollArea> + {/* </ScrollArea> */} </div> </div> </ContentsDiv> diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 174f268d0..8d7e32c66 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -35,6 +35,10 @@ import { useFieldArray, useForm, type FieldErrors } from "react-hook-form"; // F import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; +import { createDefaultPbnstItem } from "./utilsZod"; + + + export default function PublicReuseFaciltyInsert() { const { code, @@ -100,7 +104,7 @@ export default function PublicReuseFaciltyInsert() { fcOpers: fclt.fcOpers, }; }); - await pbnstRuseFcltUpdate(pbnst as customPbnst[]); + await pbnstRuseFcltUpdate(pbnst as customPbnst[]) await pbnstRuseBizUpdate(bizs); }; @@ -115,21 +119,43 @@ export default function PublicReuseFaciltyInsert() { path: (string | number)[] = [] ): { message: string; path: (string | number)[] }[] => { if (!errorObject) return []; - - return Object.keys(errorObject).flatMap((key) => { - const value = errorObject[key]; - const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; - const newPath = [...path, currentKey]; - if (value && typeof value === "object") { - if (typeof value.message === "string") { - return [{ message: value.message, path: newPath }]; // 에러 메시지와 경로 반환 - } - return findAllErrors(value, newPath); + + // Zod에서 배열 에러는 바로 배열로 전달됨 (예: items: [ {}, {...}, ... ]) + if (Array.isArray(errorObject)) { + return errorObject.flatMap((entry, index) => + findAllErrors(entry, [...path, index]) + ); + } + + if (typeof errorObject === "object") { + const entries: { message: string; path: (string | number)[] }[] = []; + + if (typeof errorObject.message === "string") { + entries.push({ message: errorObject.message, path }); } - return []; - }); + + if (Array.isArray(errorObject._errors)) { + for (const msg of errorObject._errors) { + entries.push({ message: msg, path }); + } + } + + const keys = Object.keys(errorObject).filter( + (k) => k !== "message" && k !== "_errors" + ); + + for (const key of keys) { + entries.push(...findAllErrors(errorObject[key], [...path, key])); + } + + return entries; + } + + return []; }; const errorList = findAllErrors(errors); + + console.log(' errors ', errors) if (errorList.length > 0) { errorList.forEach((errorInfo) => { const { message, path } = errorInfo; @@ -160,6 +186,9 @@ export default function PublicReuseFaciltyInsert() { }); } }; + useEffect(() => { + console.log("form errors:", form.formState.errors); + }, [form.formState.errors]); useEffect(() => { if (code.sggCd.length && pbnstHasuRes.length > 0) { @@ -184,6 +213,7 @@ export default function PublicReuseFaciltyInsert() { useEffect(() => { if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) { + form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) }); } else { form.reset({ items: [] }); @@ -204,21 +234,23 @@ export default function PublicReuseFaciltyInsert() { if (pbnstRes && pbnstRes.length > 0) { const lastPbnst = pbnstRes[pbnstRes.length - 1]; if (lastPbnst && selecTableRow) { - append( - pbnstRegZod.parse({ - pbnstRuseFcltPk: - String(selecTableRow.bscFctCd) + String(pbnstRes.length + 1), - ruseUtztnFcltNm: "", - fcBizs: [ - fcBizSchema.parse({ - pbnstRuseFcltFk: - String(lastPbnst.pbnstRuseFcltPk) + - String(pbnstRes.length + 1), - cycl: 1, - }), - ] as fcBizType[], - }) - ); + // append( + // pbnstRegZod.parse({ + // pbnstRuseFcltPk: + // String(selecTableRow.bscFctCd) + String(pbnstRes.length + 1), + // ruseUtztnFcltNm: null, + // fcBizs: [ + // fcBizSchema.parse({ + // pbnstRuseFcltFk: + // String(lastPbnst.pbnstRuseFcltPk) + + // String(pbnstRes.length + 1), + // cycl: 1, + // }), + // ] as fcBizType[], + // }) + // ); + append(createDefaultPbnstItem(selecTableRow, pbnstRes.length)); + setIsRuseReg({ isModal: true }); } } else { @@ -396,7 +428,7 @@ export default function PublicReuseFaciltyInsert() { form={form} // form prop 전달 setPbnstInsert={(data) => { if (data) { - pbnstInsert(data); // pbnstInsert 함수 호출 + // pbnstInsert(data); // pbnstInsert 함수 호출 setIsRuseReg({ isModal: false }); } }} diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx new file mode 100644 index 000000000..14224fce2 --- /dev/null +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx @@ -0,0 +1,38 @@ +import type { fcBizType, pubHasuType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type"; + +export function createDefaultPbnstItem( + selecTableRow: pubHasuType, + index: number + ) { + const pk = String(selecTableRow.bscFctCd) + String(index + 1); + + return { + pbnstRuseFcltPk: pk, + swtrmtFcltFk: "", + ruseUtztnFcltNm: "", // 필수 입력이므로 빈 문자열로 + fcltCpct: 0, + ruseCpct: 0, + splyExtraCpct: 0, + regDt: null, + rgtr: "test", + mdfcnDt: null, + mdfr: "test", + fcFiles: [], + fcBizs: [ + createDefaultBiz(pk, 1), // 첫 차수 + ], + fcOpers: [], + }; + } + + + export function createDefaultBiz( + pbnstRuseFcltFk: string, + cycl: number + ): fcBizType { + return { + pbnstRuseFcltFk, + cycl, + // 필요한 값 있으면 여기에 추가 + } as fcBizType; + } \ No newline at end of file diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index 10dd7ccb6..f86367a17 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -37,6 +37,7 @@ import { type PrfType, } from "@/app/store/prfmncReg/pbnstPrfmncReg/type"; import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel"; +import data from "@common/components/ui/icon-finder/data"; export default function prfmncPrfmncReg() { const { code, prfmnc, prfmncHasuInit, prfmnRegData } = useWrStore( @@ -78,9 +79,6 @@ export default function prfmncPrfmncReg() { } }, [inputData, searchYear, pbnstRuseFcltPk, prfmncHasuInit, pageNation]); - - - const cellClick = useCallback( (index: number | undefined, headId: string) => { if (index !== undefined) { @@ -88,16 +86,22 @@ export default function prfmncPrfmncReg() { isModal: false, data: prfmncRes[index] || ({} as FcPrfType), }); - const inUsageData = structuredClone(initValInUsage).map(row => ({ + const inUsageData = structuredClone(initValInUsage).map((row) => ({ ...row, 구분: "장내용수", })); - const outUsageData = structuredClone(initValOutUsage).map(row => ({ + const outUsageData = structuredClone(initValOutUsage).map((row) => ({ ...row, 구분: "장외용수", })); - const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" }; - const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" }; + const inSubtotal = { + ...structuredClone(subTotalObj), + 구분: "장내용수", + }; + const outSubtotal = { + ...structuredClone(subTotalObj), + 구분: "장외용수", + }; if (prfmncRes[index]?.prfList) { prfmncRes[index].prfList?.forEach((prfItem) => { const month = Number(prfItem?.ym?.slice(4)); // "MM" @@ -133,7 +137,11 @@ export default function prfmncPrfmncReg() { }); inUsageData.push(inSubtotal); outUsageData.push(outSubtotal); - const usageTotalObj: { [key: string]: any } = { ...structuredClone(totalObj), 구분: "총합계", 용수명: "" }; + const usageTotalObj: { [key: string]: any } = { + ...structuredClone(totalObj), + 구분: "총합계", + 용수명: "", + }; for (const key in usageTotalObj) { if (["usage", "gubun", "edit"].includes(key)) continue; const val = @@ -156,7 +164,7 @@ export default function prfmncPrfmncReg() { useEffect(() => { if (!prfmnc.isInit) { - prfmncHasuInit('1', "41"); + prfmncHasuInit("1", "41"); } }, [prfmnc.isInit, prfmncHasuInit]); useEffect(() => { @@ -203,7 +211,7 @@ export default function prfmncPrfmncReg() { <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> <div className="space-y"> <div className="flex flex-row space-x-2"> - <Button size={"sm"} onClick={(e) => { }}> + <Button size={"sm"} onClick={(e) => {}}> 조회 </Button> <Button @@ -218,7 +226,7 @@ export default function prfmncPrfmncReg() { size={"sm"} onClick={() => { if (cellNum === undefined) { - toast.error("하수처리재이용시설을 선택해주세요.") + toast.error("하수처리재이용시설을 선택해주세요."); return; } else { setIsExcelOPen({ ...isExcelOpen, isModal: true }); @@ -279,7 +287,14 @@ export default function prfmncPrfmncReg() { </ContentsDiv> <UiModal bodyClass={"w-[30vw] max-w-none"} - body={<PbnPrfExcelModal data={isExcelOpen.data}></PbnPrfExcelModal>} + body={ + <PbnPrfExcelModal + data={isExcelOpen.data} + setIsExcelOPen={(open) => { + setIsExcelOPen({ ...isExcelOpen, isModal: open }) + }} + ></PbnPrfExcelModal> + } open={isExcelOpen.isModal} onOpenChange={() => { setIsExcelOPen({ isModal: false, data: {} as FcPrfType }); diff --git a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx index 7b43e4b00..6b783ea68 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx @@ -29,12 +29,12 @@ export const coRvwHeadListExport: CommonTableProps[]= [ visible: true, }, { - id: "regDt", //바꾸기 + id: "dmndTmng", //바꾸기 title: "신청일자", visible: true, }, { - id: "state", //바꾸기 + id: "splyFcltFlg", //바꾸기 title: "진행상태", visible: true, }, diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index 8569d4eb3..6b253bdba 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -165,18 +165,29 @@ export const yearOptions: { val: string; text: string }[] = Array.from( }) ); -export const getdmdMatFlag = (flag: string|undefined) => { - let flagMat = ""; +export const getdmdMatFlag = (flag: string | undefined | null) => { + const cleanFlag = (flag ?? "").trim(); - if(flag === undefined || flag === null) { - flagMat = "신청"; - }else if(flag.trim() === "Sub") { - flagMat = "검토"; - }else if(flag.trim() === "matched") { - flagMat = "매칭완료"; - }else { - flagMat = "신청"; + console.log('cleanFlag ', cleanFlag) + switch (cleanFlag) { + case "Sub": + return "검토"; + case "matched": + return "매칭완료"; + default: + return "신청"; } - return flagMat; }; + + +export const formatPhoneNumber=(tel:string) => { + const onlyNums = tel.replace(/[^0-9]/g, ''); + if (onlyNums.length === 10) { + return onlyNums.replace(/(\d{2})(\d{4})(\d{4})/, '$1-$2-$3'); + } else if (onlyNums.length === 11) { + return onlyNums.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'); + } else { + return tel; // 유효하지 않으면 빈 문자열 + } +} \ No newline at end of file diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index b22f9474e..aaa7c46b9 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -31,9 +31,11 @@ import toast from "react-hot-toast"; export default function ConCostForm({ form, type, + selectionVersion, }: { form: UseFormReturn<DmdCoReqType>; type: string; + selectionVersion: number; }) { const { constCostRes, @@ -70,7 +72,14 @@ export default function ConCostForm({ const dmndQtyWatch = form.watch("dmndQty"); const totalConstCost = form.watch("totalConstCost"); const cstrnCst = form.watch("demandCst.cstrnCst"); + const useUsgCdWatch = form.watch("useUsgCd"); + useEffect(() =>{ + console.log('usgPrcsProcsWatch ', usgPrcsProcsWatch) + + console.log('useUsgCdWatch ' , useUsgCdWatch) + + },[usgPrcsProcsWatch, useUsgCdWatch, selectionVersion]) const calculateConstCost = useCallback(() => { const usgPrcsProcs = usgPrcsProcsWatch; const dmndQtyYear = dmndQtyWatch * 365; @@ -255,7 +264,7 @@ export default function ConCostForm({ placeholder="" type="text" onChange={field.onChange} - value={form.getValues("demandCst.usgPrcsProcs") ?? ""} + value={field.value ?? ""} className="mt-2" /> </FormUi> diff --git a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx index fb6ba9b22..25fe5d273 100644 --- a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx @@ -18,12 +18,13 @@ import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; import type { z } from "zod"; -export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { +export default function PbnPrfExcelModal({ data ,setIsExcelOPen }: { data: FcPrfType ,setIsExcelOPen:(open:boolean )=>void }) { const { prfmnRegData } = useWrStore((state) => state); - const [files, setFiles] = useState<File[] | null>(null); + const [file, setFile] = useState<File | null>(null); const [excelData, setExcelData] = useState<PrfType[]>(); const form = useForm<z.infer<typeof pbnPrfRegExcelZod>>({ resolver: zodResolver(pbnPrfRegExcelZod), @@ -31,10 +32,18 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { ym: String(new Date().getFullYear()), }, }); + + const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => { + const selectedFile = e.target.files?.[0]; + if (selectedFile) { + setFile(selectedFile); + } + }; const onSubmit = (values: z.infer<typeof pbnPrfRegExcelZod>) => { if (excelData) { prfmnRegData(excelData as unknown as PrfType); + setIsExcelOPen(false) } @@ -46,31 +55,24 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { form.setValue("pbnstRuseFcltNm", data.ruseUtztnFcltNm); }, [data]); - useEffect(() => { - console.log("excelData", excelData); - }, [excelData]); useEffect(() => { - if (files) { - console.log("이런") - const file = files[0]; + if (file) { + const isFile = file if (form.getValues("ym").length < 1) { - ToastFormUi({ - body: "파일업로드 이전에 등록년도를 작성해주세요 ", - title: "지도점검 등록", - }); - setFiles(null); + toast.error("파일업로드 이전에 등록년도를 작성해주세요 " ); + setFile(null); return; } - if (file) { - filePicked(file, 0).then((res) => { + if (isFile) { + filePicked(isFile, 0).then((res) => { if (res !== undefined) setExcelData(excelToPbnPrfData(res as unknown as JSON[], form.getValues("ym"), form.getValues('pbnstRuseFcltFk')) as PrfType[]) }); } } - }, [files]); + }, [file]); return ( <> @@ -144,14 +146,25 @@ export default function PbnPrfExcelModal({ data }: { data: FcPrfType }) { name="file" render={({ field }) => ( <FormUi label="점검결과 파일"> - <FileUpload + {/* <FileUpload files={files || []} setFiles={(files: File[] | null) => { if (files) setFiles(files); }} fileTypes="xlsx" maxFiles={1} - ></FileUpload> + + + + ></FileUpload> */} + +<div className="space-y-4 p-4"> + <Input + type="file" + onChange={handleFileChange} + accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" + /> + </div> </FormUi> )} /> diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index cc0eb80bf..a7987577b 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -1,6 +1,7 @@ "use client"; import { useWrStore } from "@/app/store"; import { + pbnstRegZod, type customPbnst, type PbnstRegArrrayType, type pubHasuType, @@ -16,17 +17,23 @@ import { } from "@common/components/ui"; import { useEffect, useState } from "react"; import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm"; -import { useFieldArray, type UseFormReturn } from "react-hook-form"; +import { + useFieldArray, + type FieldErrors, + type UseFormReturn, +} from "react-hook-form"; import { writeRgtrAndMdfr } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg"; +import toast from "react-hot-toast"; +import type { z } from "zod"; export function PbnstRegModal({ form, - setPbnstInsert + setPbnstInsert, }: { form: UseFormReturn<{ items: PbnstRegArrrayType }>; - setPbnstInsert: (data: customPbnst) => void + setPbnstInsert: (data: customPbnst) => void; }) { - const { pbnstInsert } = useWrStore((state) => { + const { pbnstInsert } = useWrStore((state) => { return state; }); const [pbnstBdstForm, setPbnstBdstForm] = useState<customPbnst>( @@ -35,13 +42,65 @@ export function PbnstRegModal({ const [currentTab, setCurrentTab] = useState<string>("mng"); const [indexMng, setIndexMng] = useState<number>(0); const [indexBiz, setIndexBiz] = useState<number>(0); - const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { - const item = valuse.items[indexMng]; - const data = item ? writeRgtrAndMdfr([item]) : []; + const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { + const item = valuse.items[indexMng]; + const data = item ? writeRgtrAndMdfr([item]) : []; + if (data && data[0]) { + setPbnstInsert(data[0]); + } + }; + const onInvalid = ( + errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }> + ) => { + // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. + const findAllErrors = ( + errorObject: any, + path: (string | number)[] = [] + ): { message: string; path: (string | number)[] }[] => { + if (!errorObject) return []; - if (data && data[0]) { - // pbnstInsert(data[0]); - setPbnstInsert(data[0]) + return Object.keys(errorObject).flatMap((key) => { + const value = errorObject[key]; + const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; + const newPath = [...path, currentKey]; + if (value && typeof value === "object") { + if (typeof value.message === "string") { + return [{ message: value.message, path: newPath }]; // 에러 메시지와 경로 반환 + } + return findAllErrors(value, newPath); + } + return []; + }); + }; + const errorList = findAllErrors(errors); + if (errorList.length > 0) { + errorList.forEach((errorInfo) => { + const { message, path } = errorInfo; + let prefix = ""; + const itemsIndex = path.indexOf("items"); + + if (itemsIndex > -1 && path.length > itemsIndex + 1) { + const itemIdx = path[itemsIndex + 1] as number; + const facilityName = form.getValues( + `items.${itemIdx}.ruseUtztnFcltNm` + ); + if (facilityName) { + prefix += `[${facilityName}] `; + } + + const fcBizsIndex = path.indexOf("fcBizs"); + if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + const bizIdx = path[fcBizsIndex + 1] as number; + const cycle = form.getValues( + `items.${itemIdx}.fcBizs.${bizIdx}.cycl` + ); + if (cycle) { + prefix += `[${cycle}차수] `; + } + } + } + toast.error(`${prefix}${message}`); + }); } }; @@ -76,7 +135,7 @@ export function PbnstRegModal({ 차수별정보 </TabsTrigger> <Button - onClick={form.handleSubmit(onSubmit)} + onClick={form.handleSubmit(onSubmit, onInvalid)} size={"sm"} className="!justify-end" > From 5fd8c6e6a62d056d29682a81143ab43649f5e3a8 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Fri, 4 Jul 2025 22:27:55 +0900 Subject: [PATCH 168/259] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EB=8C=80=EC=9E=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltReg/pbnstReg/index.tsx | 12 ++++ .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 15 +++-- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 2 +- .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 60 +++++++++---------- 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index ea7eee5c8..e4bedff60 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -54,6 +54,7 @@ export type pubFacState = { pbnsUpdateIndex: pbnstInsertIndex; fcOrgwtsNmList:pubHasuType[]; dmdComList: any[]; + apiMessage:string; }; }; type pubFacActions = { @@ -94,6 +95,7 @@ export const pubFacStateExport: pubFacState = { pbnsUpdateIndex: {} as pbnstInsertIndex, fcOrgwtsNmList:[], dmdComList: [], + apiMessage:'' }, }; @@ -269,8 +271,13 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { ruseRes ); + if(response){ + + toast.success(` 하수재이용 시설 정보가 수정되었습니다.`); + } } catch (error) { console.error("Error pbnstRuseFcltUpdate:", error); + toast.error(` 하수재이용 시설 정보가 수정오류입니다.`); } } ,pbnstRuseBizUpdate : async(ruseRes:fcBizType[])=>{ try { @@ -280,6 +287,10 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { `/reuseFc/pubFcBiz`, ruseRes ); + + if(response){ + toast.success(` 하수재이용 시설 사업이 수정되었습니다.`); + } const pbnstRes = await hasuListFetch("11", "11"); return set((state: pubFacState) => ({ @@ -292,6 +303,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { })); } catch (error) { console.error("Error pbnstRuseFcltUpdate:", error); + toast.error(` 하수재이용 시설 사업이 수정이 실패되엇습니다..`); } } , getBizCycle: async (pbnstObj: customPbnst) => { diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index b908750fd..a111b6c10 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -236,10 +236,17 @@ export const fcBizSchema = z.object({ export const pbnstRegZod = z.object({ pbnstRuseFcltPk: z.string().default(""), swtrmtFcltFk: z.string().default(""), - ruseUtztnFcltNm: z.string().default(""), - fcltCpct: zNumDefaultZero, - ruseCpct: zNumDefaultZero, - splyExtraCpct: zNumDefaultZero, + ruseUtztnFcltNm: z + .preprocess( + (v) => (v != null ? String(v).trim() : ""), + z.string() + ) + .refine((val) => val.length > 0, { + message: "시설 이름을 입력하세요", + }), + fcltCpct: z.number(), + ruseCpct: z.number(), + splyExtraCpct: z.number(), regDt: zDateDefaultNow, rgtr: z.string().default("test"), mdfcnDt: zDateDefaultNow, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index d4cfebfca..6ceb75531 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -34,7 +34,7 @@ export const rainZod = z.object({ bdstNm: z.string().default(""), frstArchPrmsnDt: z.date().default(() => new Date()), archChgPrmsnDt: z.coerce.date().nullish().default(null), - archArea: z.number().default(0), + archArea: z.string().default(''), archChgArea: z.number().default(0), rgtr:z.string().nullish(), mdfr:z.string().nullish(), diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index df9c3b543..d39412d8d 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -5,11 +5,12 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import { z } from "zod"; import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "../rainReg/type"; import { makeMdfr, makeRstr } from "../bdstReg"; +import toast from "react-hot-toast"; const rswtrObjSchema = z.object({ bdstRuseFcltFk: z.number().nullish(), - wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), - oblgTrgtWtrUsqty: z.number().nullish().default(0), + //wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }), + //oblgTrgtWtrUsqty: z.number().nullish().default(0), orgwtKndCd: z.string({ required_error: validationMessages.requiredSelect("원수 종류") }).min(1, { message: validationMessages.requiredSelect("원수 종류") }), filtrTrtmfctCpct: z.number({ required_error: validationMessages.required("처리시설 용량") }), filtrTrtmfctProcs: z.string({ required_error: validationMessages.required("주요처리공정") }).min(1, { message: validationMessages.required("주요처리공정") }), @@ -36,7 +37,7 @@ export const rswtZod = z.object({ frstArchPrmsnDt: z.date().default(() => new Date()), archChgPrmsnDt: z.coerce.date().nullish().default(null), chBuildingYn: z.string().nullish(), - archArea: z.number().default(0), + archArea: z.string().default(''), archChgArea: z.number().default(0), rgtr: z.string().nullish().default(null), mdfr: z.string().nullish().default(null), @@ -152,8 +153,8 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( try { const chData = await makeMdfr(data); const res = await putFectch("/reuseFc/waterreuseFc", chData); - if (res.ok) { - alert("등록이 완료되었습니다."); + if (res.status ===200) { + toast.success("중수도 건축물 수정이 완료되었습니다."); const rswtRes = await initFetch(code); set((state: rswtFacState) => ({ ...state, @@ -165,10 +166,8 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( })); } } catch (errorUpdate) { - alert( - "업데이트 오류입니다. " + - (errorUpdate instanceof Error ? errorUpdate.message : "") - ); + toast.error("중수도 건축물 수정 오류입니다. "); + } finally { } }, @@ -176,29 +175,28 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( try { const chData = await makeRstr(data); const res = await postFectch("/reuseFc/waterreuseFc", chData); - if (res.ok) { - if (data.chgBuilding.length > 0) { - await res - .json() - .then((resData: any) => { - const chPK = resData?.data?.bdstInfoPk; - const makeCh = resData.data.chgBuilding.map( - (item: chgBuilding) => ({ - ...item, - bdstInfoFk: chPK, - }) - ); - const chch = postFectch("/reuseFc/chgBuilding", makeCh); - return chch; - }) - .then((chch: any) => { - if (chch.ok) { - alert("등록이 완료되었습니다."); - } - }); + if (res.status===200) { + if(data.chgBuilding.length > 0){ + + const chPK = res?.data?.bdstInfoPk + const makeCh= res.data.chgBuilding.map((item: chgBuilding) => + ( { + ...item, + bdstInfoFk: chPK, + }) + ); + const chch= await postFectch("/reuseFc/chgBuilding", makeCh); + + if(chch.status ===200) { + toast.success("건축물 등록이 완료되었습니다."); + }else{ + toast.error("건축물 증축/개축/중축 오류입니다."); + } } else { - alert("등록이 완료되었습니다."); + toast.success("건축물 등록이 완료되었습니다."); } + }else{ + toast.error("건축물 등록이 완료되었습니다."); } const rainRes = await initFetch(code); set((state: rswtFacState) => ({ @@ -211,7 +209,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( })); } catch (e) { console.log("e", e); - alert("등록 오류입니다."); + toast.error("등록시 오류가 발생하였습니다."); } finally { } }, From 5a681420465af0ffe153b9fce121484947c53b9c Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Fri, 4 Jul 2025 22:35:45 +0900 Subject: [PATCH 169/259] =?UTF-8?q?=EC=9B=90=EC=88=98,=EC=B7=A8=EC=88=98?= =?UTF-8?q?=20=EB=AA=A8=EB=8B=AC=EC=B0=BD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fcltReg/pbnstReg/buseReg/bugRegForm.tsx | 10 +- .../fcOrgwtsRegModal/fcOrgwtsRegModal.tsx | 99 ++++++++++++------- 2 files changed, 71 insertions(+), 38 deletions(-) diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx index 8ea07535d..a1d433f2d 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm.tsx @@ -111,9 +111,9 @@ export function PbnstBuseForm({ const fcOrgwts = form.watch(`items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts`); useEffect(() => { - console.log("fcOrgwts ", fcOrgwts); + console.log("fcOrgwts", fcOrgwts); if (fcOrgwts && fcOrgwts?.length > 0) { - const swtrmtFcltFkList = fcOrgwts.map((item) => item.swtrmtFcltFk); + const swtrmtFcltFkList = fcOrgwts?.map((item) => item.swtrmtFcltFk); console.log("swtrmtFcltFkList ", swtrmtFcltFkList); @@ -128,8 +128,6 @@ export function PbnstBuseForm({ useEffect(() => { if (fcOrgwtsNmList && fcOrgwtsNmList.length > 0) { - console.log("fcOrgwtsNmList ", fcOrgwtsNmList); - console.log("fcOrgwts ", fcOrgwts); fcOrgwts?.forEach((item, index) => { const orgwtNm = fcOrgwtsNmList.find( @@ -421,6 +419,7 @@ export function PbnstBuseForm({ </div> <RuseMngTable key={`fcOrgwts-${indexMng}-${indexBiz}`} // 이게 핵심! + tableData={ form.getValues( `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts` @@ -724,6 +723,9 @@ export function PbnstBuseForm({ bodyClass={"w-[70vw] max-w-none max-h-[90vh] overflow-y-auto"} body={ <FcOrgwtsRegModal + initTableData={form.getValues( + `items.${indexMng}.fcBizs.${indexBiz}.fcOrgwts` + ) ?? []} closeModal={() => { setIsFcOrgwts(false); }} diff --git a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx index 9c8f2cdd6..69ec1afcc 100644 --- a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx @@ -14,13 +14,16 @@ import { Button } from "@common/business_components/ui/table/lib/button"; import { Input } from "@common/components/ui"; import { ArrowLeft, ArrowRight } from "lucide-react"; import { useEffect, useRef, useState } from "react"; +import toast from "react-hot-toast"; export default function FcOrgwtsRegModal({ onRightSet, closeModal, + initTableData, }: { onRightSet?: (rightData: fcOrgwtType[]) => void; closeModal?: (val: boolean) => void; + initTableData?: any[]; }) { const { code, pbnst, getSwtrmtFcltNm, searchFclts } = useWrStore( (state) => state @@ -31,6 +34,30 @@ export default function FcOrgwtsRegModal({ const leftRef = useRef<pubHasuType[] | null>([] as pubHasuType[]); const [rightData, setRightData] = useState<pubHasuType[]>(); const [inputVal, setInputVal] = useState<string>(""); + const saveData = () => { + if (rightData && rightData?.length > 0) { + if (onRightSet) + onRightSet( + (rightData as pubHasuType[])?.map((item) => { + return { + ...item, + swtrmtFcltFk: item.bscFctCd, // 임시값, 실제 데이터에 맞게 수정 + orgwtWtritQnt: Number(item.fctCpc), // 임시값, 실제 데이터에 맞게 수정 + tmsYn: "N", // 임시값, 실제 데이터에 맞게 수정 + dschgFmYn: "N", // 임시값, 실제 데이터에 맞게 수정 + dtlPstnExpln: item.addr, // 임시값, 실제 데이터에 맞게 수정 + choose: false, // 임시값, 실제 데이터에 맞게 수정 + } + // 필요한 경우 다른 속성들도 추가 + }) as unknown as fcOrgwtType[] + ); + + closeModal?.(false) + } + else { + toast.error("취수하수처리장 목록을 선택해주세요.") + } + } useEffect(() => { if (Array.isArray(searchFclts)) { @@ -48,46 +75,50 @@ export default function FcOrgwtsRegModal({ }, [searchFclts]); useEffect(() => { if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) { - setbdstTable(tableData(pbnstHasuRes, { code })); - - console.log("bdstTable ", bdstTable); + const data = pbnstHasuRes.filter((item) => !initTableData?.find((initItem) => initItem.ruseUtztnFcltNm === item.bscFctNm)) + leftRef.current?.filter((item) => !initTableData?.find((initItem) => initItem.ruseUtztnFcltNm === item.bscFctNm)); + setbdstTable(tableData(data, { code })); } - }, [code, pbnstHasuRes]); + }, [code, pbnstHasuRes, initTableData]); + useEffect(() => { - console.log("rightData ", rightData); - if (onRightSet) - onRightSet( - (rightData as pubHasuType[])?.map((item) => ({ - swtrmtFcltFk: item.bscFctCd, // 임시값, 실제 데이터에 맞게 수정 - orgwtWtritQnt: Number(item.fctCpc), // 임시값, 실제 데이터에 맞게 수정 - tmsYn: "N", // 임시값, 실제 데이터에 맞게 수정 - dschgFmYn: "N", // 임시값, 실제 데이터에 맞게 수정 - dtlPstnExpln: item.addr, // 임시값, 실제 데이터에 맞게 수정 - choose: false, // 임시값, 실제 데이터에 맞게 수정 - // 필요한 경우 다른 속성들도 추가 - })) as unknown as fcOrgwtType[] - ); - }, [rightData]); + if (initTableData && Array.isArray(initTableData)) { + setRightData(initTableData.map(item => ({ + ...item, + choose: item.choose, + sido: item.dtlPstnExpln?.split(" ")[0] || "", + gugun: item.dtlPstnExpln?.split(" ")[1] || "", + bscFctNm: item.ruseUtztnFcltNm, + addr: item.dtlPstnExpln, + orgwtWtritQnt: String(item.orgwtWtritQnt), + fctCpc: String(item.orgwtWtritQnt), + swtrmtFcltFk: item.swtrmtFcltFk, + }))); + rightRef.current = initTableData.map(item => ({ ...item })); + } + }, []); return ( <div className="flex flex-col h-[80vh]"> <div className="shrink-0 p-4 border-b z-10 bg-white"> <div className="flex items-center"> <Title title="취수하수처리장 추가" /> - {/* <Button size="sm" onClick={() => closeModal?.(false)}>저장</Button> */} + <div className="flex items-center gap-2 mt-8"> - <Label className="text-xl text-gray-600">시설명</Label> - <Input - className="w-48 text-xl" - type="text" - value={inputVal} - onChange={(e) => setInputVal(e.target.value)} - /> - <Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}> - 조회 - </Button> + + <Label className="text-xl text-gray-600">시설명</Label> + <Input + className="w-48 text-xl" + type="text" + value={inputVal} + onChange={(e) => setInputVal(e.target.value)} + /> + <Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}> + 조회 + </Button> + <Button size="sm" onClick={saveData}>저장</Button> </div> </div> </div> @@ -107,10 +138,10 @@ export default function FcOrgwtsRegModal({ {/* 테이블 영역 */} <div className="flex flex-row gap-4 flex-grow p-4 overflow-x-auto"> - {/* 왼쪽 테이블 */} + {/* 왼쪽 테이블 */} - <div className="w-5/12 min-w-[400px]"> - <Label className="text-2xl text-gray-600 mb-2 block text-right"> + <div className="w-5/12 min-w-[400px]"> + <Label className="text-2xl text-gray-600 mb-2 block text-right"> 공공하수처리시설 목록 </Label> <RuseMngTable @@ -123,7 +154,7 @@ export default function FcOrgwtsRegModal({ {/* 중간 이동 버튼 */} <div className="flex flex-col justify-center items-center gap-4 w-[200px] min-w-[120px]"> - <ArrowRight + <ArrowRight onClick={() => { const checked = leftRef.current?.filter((item) => item.choose); const unchecked = leftRef.current?.filter((item) => !item.choose); @@ -159,7 +190,7 @@ export default function FcOrgwtsRegModal({ {/* 오른쪽 테이블 */} <div className="w-5/12 min-w-[400px]"> - <Label className="text-2xl text-gray-600 mb-2 block text-right"> + <Label className="text-2xl text-gray-600 mb-2 block text-right"> 취수하수처리장 목록 </Label> <RuseMngTable From 80b356f66b304ab9946fe77635607ce245a959fa Mon Sep 17 00:00:00 2001 From: hsson <hsson@mind-one.co.kr> Date: Sat, 5 Jul 2025 22:37:03 +0900 Subject: [PATCH 170/259] =?UTF-8?q?React.memo=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/popupComponent/MsSwagePpl.tsx | 1 - .../popupComponent/chart/infilChart.tsx | 14 +++--- .../popupComponent/chart/rdiiChart.tsx | 14 +++--- .../popupComponent/chartModalStore.ts | 16 +++++++ .../map/featureClickEventPopup.tsx | 47 +++---------------- 5 files changed, 35 insertions(+), 57 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/components/popupComponent/chartModalStore.ts diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index bf018340b..46537a7dd 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -4,7 +4,6 @@ import React, { useState } from 'react' import InputSection from '../InputSection'; import { handleInputChange } from '../common'; - // 하수관로 const inputColumn = [ { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 46c94eaf6..ac89a9403 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -7,16 +7,14 @@ import moment from "moment"; import type { TInftwtAnls, TOilqData } from './aplcnYms'; import * as fn from './aplcnYms'; +import { useInfilChartModalStore } from '../chartModalStore'; // 모달 상태 관리 스토어 type ModalOpenProp = { - isModalOpen: boolean, - setIsModalOpen: (open: boolean) => void, - closeModal: () => void, - btnTxt?: string, pplMngNo?: string, // 관로관리번호 } type DataType = {label: string; val: number}; -const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { +const InfilChart = ({ pplMngNo }: ModalOpenProp) => { + const { isOpen: isModalOpen, setIsOpen: setIsModalOpen } = useInfilChartModalStore(); // 모달 상태 관리 스토어 const [popupOpen, setPopupOpen] = React.useState(false); // 조회조건팝업 const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 @@ -130,7 +128,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo <> <div className="text-black text-3xl font-bold mb-5">침입수분석결과</div> - <div className='grid grid-cols-4 gap-4'> + <div className='grid grid-cols-[1fr_3fr] gap-4'> <div className="grid grid-rows-4 gap-4 mb-4"> <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> 분석 입력현황 조회 @@ -154,7 +152,7 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo </div> </div> {/* 차트 */} - <div className="w-[560px] h-[320px] bg-white text-2xl"> + <div className="bg-white text-3xl"> <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} yFieldText2="시간" yFieldText="유량(m³/h)"/> </div> @@ -271,4 +269,4 @@ const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo ) } -export default InfilChart \ No newline at end of file +export default React.memo(InfilChart); \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index ddaffcaf3..653b568b5 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -7,16 +7,14 @@ import moment from "moment"; import type { TRdiiAnls, TRdiiAnlsRslt, TOilqData } from './aplcnYms'; import * as fn from './aplcnYms'; +import { useRdiiChartModalStore } from '../chartModalStore'; // 모달 상태 관리 스토어 type ModalOpenProp = { - isModalOpen: boolean, - setIsModalOpen: (open: boolean) => void, - closeModal: () => void, - btnTxt?: string, pplMngNo: string, // 관로관리번호 } type DataType = {label: string; val: number}; -const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo }: ModalOpenProp) => { +const RdiiChart = ({ pplMngNo }: ModalOpenProp) => { + const { isOpen: isModalOpen, setIsOpen: setIsModalOpen } = useRdiiChartModalStore(); // 모달 상태 관리 스토어 const [popupOpen, setPopupOpen] = React.useState(false); // 조회조건팝업 const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 @@ -117,7 +115,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } <> <div className="text-black text-3xl font-bold mb-5">RDII분석결과</div> - <div className='grid grid-cols-4 gap-4'> + <div className='grid grid-cols-[1fr_3fr] gap-4'> <div className="grid grid-rows-4 gap-4 mb-4"> <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> 분석 입력현황 조회 @@ -146,7 +144,7 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } </div> </div> {/* 차트 */} - <div className="w-[560px] h-[320px] bg-white text-2xl"> + <div className="bg-white text-2xl"> <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} yFieldText2="시간" yFieldText="유량(m³/h)" /> </div> @@ -263,4 +261,4 @@ const RdiiChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal, pplMngNo } ) } -export default RdiiChart \ No newline at end of file +export default React.memo(RdiiChart); \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chartModalStore.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chartModalStore.ts new file mode 100644 index 000000000..c84fa48a7 --- /dev/null +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chartModalStore.ts @@ -0,0 +1,16 @@ +import { create } from 'zustand'; + +interface ModalStore { + isOpen: boolean; + setIsOpen: (open: boolean) => void; +} + +export const useInfilChartModalStore = create<ModalStore>((set) => ({ + isOpen: false, + setIsOpen: (open: boolean) => set({ isOpen: open }), +})); + +export const useRdiiChartModalStore = create<ModalStore>((set) => ({ + isOpen: false, + setIsOpen: (open: boolean) => set({ isOpen: open }), +})); \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index a6dac412d..16c4f99a8 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -9,6 +9,7 @@ import { getLayerContentComponent } from "./components/common"; import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol, stofcbrCol } from "./components/common/table"; import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; +import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore"; // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { @@ -28,9 +29,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); const [additionalDataError, setAdditionalDataError] = useState<string | null>(null); // 🎯 InfilChart 및 RdiiChart 관련 상태 추가 - const [isModalInfil, setIsModalInfil] = useState(false); - const [isModalRdii, setIsModalRdii] = useState(false); - const [btnTxt, setBtnTxt] = useState<string>(""); + const { setIsOpen:setIsModalInfil } = useInfilChartModalStore(); + const { setIsOpen:setIsModalRdii } = useRdiiChartModalStore(); // 🎯 관로관리번호 추출 const pplMngNo = featureData?.values_?.fclt_mng_no || ""; @@ -237,25 +237,6 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setIsModalOpen(false); // 모달 닫기 }; - // 🎯 모달 열기/닫기 함수들 - const openModalInfil = () => { - setBtnTxt("Infil"); - setIsModalInfil(true); - }; - - const closeModalInfil = () => { - setIsModalInfil(false); - }; - - const openModalRdii = () => { - setBtnTxt("RDII"); - setIsModalRdii(true); - }; - - const closeModalRdii = () => { - setIsModalRdii(false); - }; - const btnClickEvent = async () => { const bodyData: Record<string, any> = {} if (buttonChk && contentRef.current) { @@ -305,17 +286,15 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 하수관로일 때만 Infil/RDII 버튼 표시 */} {layerNm === '하수관로' && ( <> - <Button + <Button onClick={() => setIsModalInfil(true)} className="px-2 py-1 text-xl text-blue-600 border border-blue-600 rounded hover:bg-gray-700" color="white" - onClick={openModalInfil} > 침입수분석 </Button> - <Button + <Button onClick={() => setIsModalRdii(true)} className="px-2 py-1 text-xl text-gray-600 border border-gray-600 rounded hover:bg-gray-700" color="white" - onClick={openModalRdii} > RDII분석 </Button> @@ -363,20 +342,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, </div> {/* 🎯 InfilChart 및 RdiiChart 컴포넌트 추가 */} - <InfilChart - btnTxt={btnTxt} - isModalOpen={isModalInfil} - setIsModalOpen={setIsModalInfil} - closeModal={closeModalInfil} - pplMngNo={pplMngNo} - /> - <RdiiChart - btnTxt={btnTxt} - isModalOpen={isModalRdii} - setIsModalOpen={setIsModalRdii} - closeModal={closeModalRdii} - pplMngNo={pplMngNo} - /> + <InfilChart pplMngNo={pplMngNo} /> + <RdiiChart pplMngNo={pplMngNo} /> </div> ) } From 7d56ba0243f84e6f83c571f2fcd4097399300aa3 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 00:46:43 +0900 Subject: [PATCH 171/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 91 +++++++++---------- .../ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx | 8 +- .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 21 +++-- .../fcltReg/pbnstRegModal/pbnstRegModal.tsx | 11 +++ 4 files changed, 68 insertions(+), 63 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 8d7e32c66..0c3ad9dce 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -70,6 +70,8 @@ export default function PublicReuseFaciltyInsert() { // defaultValues: { items: pbnstRegArrayZod.parse([]) }, mode: "onChange", }); + const { isDirty } = form.formState; + const { fields: items, append, @@ -87,7 +89,11 @@ export default function PublicReuseFaciltyInsert() { }, [pbnst.isInit, pubHasuInit]); const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { - const data = writeRgtrAndMdfr(valuse.items); + + if (!isDirty) { + toast.error("변경사항이 없습니다."); // 변경사항이 없으면 메시지 표시 + return; + } const data = writeRgtrAndMdfr(valuse.items); let bizs = [] as fcBizType[]; data.forEach((fclt) => { bizs = [...bizs, ...fclt.fcBizs]; @@ -110,78 +116,58 @@ export default function PublicReuseFaciltyInsert() { }; // 폼 유효성 검사 실패 시 호출될 함수 - const onInvalid = ( - errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }> - ) => { - // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. + const onInvalid = (errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>) => { + console.log("errors:", errors); + const findAllErrors = ( errorObject: any, path: (string | number)[] = [] ): { message: string; path: (string | number)[] }[] => { if (!errorObject) return []; - - // Zod에서 배열 에러는 바로 배열로 전달됨 (예: items: [ {}, {...}, ... ]) - if (Array.isArray(errorObject)) { - return errorObject.flatMap((entry, index) => - findAllErrors(entry, [...path, index]) - ); - } - - if (typeof errorObject === "object") { - const entries: { message: string; path: (string | number)[] }[] = []; - - if (typeof errorObject.message === "string") { - entries.push({ message: errorObject.message, path }); - } - - if (Array.isArray(errorObject._errors)) { - for (const msg of errorObject._errors) { - entries.push({ message: msg, path }); + + return Object.keys(errorObject).flatMap((key) => { + const value = errorObject[key]; + const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; + const newPath = [...path, currentKey]; + + if (value && typeof value === "object") { + if (value.message) { + return [{ message: value.message, path: newPath }]; } + + return findAllErrors(value, newPath); } - - const keys = Object.keys(errorObject).filter( - (k) => k !== "message" && k !== "_errors" - ); - - for (const key of keys) { - entries.push(...findAllErrors(errorObject[key], [...path, key])); - } - - return entries; - } - - return []; + return []; + }); }; + const errorList = findAllErrors(errors); - - console.log(' errors ', errors) + if (errorList.length > 0) { errorList.forEach((errorInfo) => { const { message, path } = errorInfo; let prefix = ""; + const itemsIndex = path.indexOf("items"); - + if (itemsIndex > -1 && path.length > itemsIndex + 1) { const itemIdx = path[itemsIndex + 1] as number; - const facilityName = form.getValues( - `items.${itemIdx}.ruseUtztnFcltNm` - ); + const facilityName = form.getValues(`items.${itemIdx}.ruseUtztnFcltNm`); if (facilityName) { prefix += `[${facilityName}] `; } - + const fcBizsIndex = path.indexOf("fcBizs"); if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { const bizIdx = path[fcBizsIndex + 1] as number; - const cycle = form.getValues( - `items.${itemIdx}.fcBizs.${bizIdx}.cycl` - ); + const cycle = form.getValues(`items.${itemIdx}.fcBizs.${bizIdx}.cycl`); if (cycle) { prefix += `[${cycle}차수] `; } } } + + // 최종 오류 메시지 출력 toast.error(`${prefix}${message}`); }); } @@ -214,7 +200,14 @@ export default function PublicReuseFaciltyInsert() { useEffect(() => { if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) { - form.reset({ items: pbnstRegArrayZod.parse(pbnst.pbnstRes) }); + // form.reset({ + // items: pbnstRegArrayZod.parse(pbnst.pbnstRes), + // }); + + form.reset({ items: pbnst.pbnstRes }); + + //form.reset({ items: pbnst.pbnstRes }); + } else { form.reset({ items: [] }); } @@ -249,7 +242,7 @@ export default function PublicReuseFaciltyInsert() { // ] as fcBizType[], // }) // ); - append(createDefaultPbnstItem(selecTableRow, pbnstRes.length)); + append(createDefaultPbnstItem(selecTableRow, pbnstRes.length)); setIsRuseReg({ isModal: true }); } @@ -428,7 +421,7 @@ export default function PublicReuseFaciltyInsert() { form={form} // form prop 전달 setPbnstInsert={(data) => { if (data) { - // pbnstInsert(data); // pbnstInsert 함수 호출 + pbnstInsert(data); // pbnstInsert 함수 호출 setIsRuseReg({ isModal: false }); } }} diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx index 14224fce2..3433a62c5 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/utilsZod.tsx @@ -10,12 +10,12 @@ export function createDefaultPbnstItem( pbnstRuseFcltPk: pk, swtrmtFcltFk: "", ruseUtztnFcltNm: "", // 필수 입력이므로 빈 문자열로 - fcltCpct: 0, - ruseCpct: 0, - splyExtraCpct: 0, + fcltCpct: 0, + ruseCpct: 0, + splyExtraCpct: 0, regDt: null, rgtr: "test", - mdfcnDt: null, + mdfcnDt: null, mdfr: "test", fcFiles: [], fcBizs: [ diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index a111b6c10..2ef1c6d2f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -238,22 +238,23 @@ export const pbnstRegZod = z.object({ swtrmtFcltFk: z.string().default(""), ruseUtztnFcltNm: z .preprocess( - (v) => (v != null ? String(v).trim() : ""), - z.string() - ) - .refine((val) => val.length > 0, { - message: "시설 이름을 입력하세요", - }), - fcltCpct: z.number(), - ruseCpct: z.number(), - splyExtraCpct: z.number(), + (v) => (v !== null && v !== undefined ? String(v).trim() : ""), // null/undefined → "", 공백 제거 + z.string().min(1, "시설 이름을 입력하세요")), + fcltCpct: zNumDefaultZero, + ruseCpct: zNumDefaultZero, + splyExtraCpct: zNumDefaultZero, regDt: zDateDefaultNow, rgtr: z.string().default("test"), mdfcnDt: zDateDefaultNow, mdfr: z.string().default("test"), fcFiles: z.array(fcFileSchema).default([]).nullish(), fcBizs: z.array(fcBizSchema).default([]), - fcOpers: z.array(fcOperSchema).default([]).nullish(), + fcOpers: z + .array(fcOperSchema) + .refine((val) => val.length >= 1, { + message: "재이용시설의 운영정보를 최소 하나를 등록해주세요", + }) + .default([]), // 기본값 설정 }); export const pbnstRegArrayZod = z.array(pbnstRegZod); diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index a7987577b..34bc71a46 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -42,6 +42,8 @@ export function PbnstRegModal({ const [currentTab, setCurrentTab] = useState<string>("mng"); const [indexMng, setIndexMng] = useState<number>(0); const [indexBiz, setIndexBiz] = useState<number>(0); + + const onSubmit = async (valuse: { items: PbnstRegArrrayType }) => { const item = valuse.items[indexMng]; const data = item ? writeRgtrAndMdfr([item]) : []; @@ -53,6 +55,8 @@ export function PbnstRegModal({ errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }> ) => { // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. + + const findAllErrors = ( errorObject: any, path: (string | number)[] = [] @@ -72,13 +76,18 @@ export function PbnstRegModal({ return []; }); }; + + const errorList = findAllErrors(errors); + + if (errorList.length > 0) { errorList.forEach((errorInfo) => { const { message, path } = errorInfo; let prefix = ""; const itemsIndex = path.indexOf("items"); + if (itemsIndex > -1 && path.length > itemsIndex + 1) { const itemIdx = path[itemsIndex + 1] as number; const facilityName = form.getValues( @@ -99,6 +108,8 @@ export function PbnstRegModal({ } } } + + toast.error(`${prefix}${message}`); }); } From c5f7d6290862204309f9b28d6a7bbdaec129d990 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 14:31:10 +0900 Subject: [PATCH 172/259] =?UTF-8?q?=EC=82=AD=EC=A0=9C=EB=90=9C=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=EC=9D=84=20=EC=88=98=EC=A0=95=ED=95=98=EA=B3=A0=20?= =?UTF-8?q?=EC=8B=A4=EC=A0=81=20=EC=98=A4=EB=A5=98=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 4 +- apps/wr/app/matMng/coMng/coSttn/page.tsx | 11 ++- .../prfmncReg/pbnstPrfmncReg/page.tsx | 37 +++++++--- .../wr/app/store/matDmd/coMatRvw/headList.tsx | 4 +- apps/wr/app/store/matDmd/coMatRvw/index.tsx | 4 +- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 74 ++++++++----------- apps/wr/app/store/matDmd/coSttn/headList.tsx | 5 ++ apps/wr/app/store/matDmd/coSttn/index.tsx | 2 +- .../store/prfmncReg/pbnstPrfmncReg/index.tsx | 23 ++++-- apps/wr/components/lib/func/TableData.tsx | 48 ++++++------ .../ui/form/coMat/conCostForm/conCostForm.tsx | 20 ++--- .../pbnPrfExcelModal/pbnPrfExcelModal.tsx | 6 +- 12 files changed, 136 insertions(+), 102 deletions(-) diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index 46aeacbf3..acfdb6585 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -119,7 +119,7 @@ export default function CoMatRvw() { }, [useUsgCdWatch, form,selectionVersion]); useEffect(() => { - if (coMatRvwRes.length > 0) { + if (coMatRvwRes&&coMatRvwRes.length > 0) { const data = coMatRvwRes?.map((item, index) => { let flag = ""; @@ -190,7 +190,7 @@ export default function CoMatRvw() { <div className="col-span-7 w-full"> <div className="flex flex-row items-center"> <Label className="text-xl text-gray-600 mx-6"> - 하수 재이용년도 + 수요신청년도 </Label> <SelectBox className="h-full w-32 text-2xl" diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index 181a5d82f..e2c8b8195 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -5,6 +5,7 @@ import { btnClass } from "@/app/store/common/code"; import { fetchType, getFetch } from "@/components/lib/api"; import { excelDownload, + formatPhoneNumber, getCity, tableData } from "@/components/lib/func/commom"; @@ -26,6 +27,7 @@ import ListDiv from "@common/business_components/ui/list_div"; import SdmInsertForm from "@common/business_components/ui/sdmInsertForm"; import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; import { Button } from "@common/components/ui"; +import moment from "moment"; import { useCallback, useEffect, useState } from "react"; import toast, { Toaster } from "react-hot-toast"; @@ -83,6 +85,9 @@ export default function CoSttn() { const data = tableData(coSttnRes, { code }); const chData = data.map((item: any) => ({ ...item, + telno:formatPhoneNumber(item.telno||undefined), + regDt: moment(item.regDt).format("YYYY-MM-DD") + })); // .filter((item: any) => item !== undefined); setBdstTable(chData); @@ -162,7 +167,7 @@ export default function CoSttn() { </SearchFormLeft> <SearchFormRight className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 "> <div className="flex flex-row space-x-2"> - <Button size={"sm"} onClick={searchClick}> + <Button className="mt-2" size={"sm"} onClick={searchClick}> 조회 </Button> <Button @@ -182,7 +187,7 @@ export default function CoSttn() { onClick={() => { /* 저장 로직 */ if (!upadateData) { - <ToastFormUi body={"수요처 변경을 원하는 행을 선택해주세요"} title={"수요처관리"}></ToastFormUi>; + toast.error("수요처 변경을 원하는 행을 선택해주세요") }else{ setIsDmdModal({ ...isDmdModal, @@ -190,7 +195,7 @@ export default function CoSttn() { } }} > - 저장 + 수정 </Button> <Button size={"sm"} diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx index f86367a17..c54725ff2 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/pbnstPrfmncReg/page.tsx @@ -53,10 +53,11 @@ export default function prfmncPrfmncReg() { const [inputData, setInputData] = useState<any[]>(); const [pbnstRuseFcltPk, setPbnstRuseFcltPk] = useState<string>(); const [pageNation, setPageNation] = useState<number>(1); - const [cellNum, setCellNum] = useState<number>(); + const [cellNum, setCellNum] = useState<number>(1); const [searchYear, setSearchYear] = useState<string>( String(new Date().getFullYear()) ); + const excelClick = useCallback(() => { excelDownload( [[]], @@ -66,21 +67,22 @@ export default function prfmncPrfmncReg() { ); }, [prfmnc.excelList]); - const onSave = useCallback(() => { + const onSave = useCallback( + async() => { if (pbnstRuseFcltPk) { - prfmnRegData( + await prfmnRegData(pageNation,'41', excelToPbnPrfData( inputData as unknown as JSON[], searchYear, pbnstRuseFcltPk ) as unknown as PrfType ); - prfmncHasuInit(String(pageNation), "41"); + // cellClick(cellNum) } - }, [inputData, searchYear, pbnstRuseFcltPk, prfmncHasuInit, pageNation]); + }, [inputData, searchYear, pbnstRuseFcltPk, pageNation,cellNum]); const cellClick = useCallback( - (index: number | undefined, headId: string) => { + (index: number | undefined) => { if (index !== undefined) { setIsExcelOPen({ isModal: false, @@ -152,7 +154,6 @@ export default function prfmncPrfmncReg() { } const tableData = [...inUsageData, ...outUsageData, usageTotalObj]; setPbnstRuseFcltPk(prfmncRes[index].pbnstRuseFcltPk); - setInputData(tableData); } else { setInputData([]); @@ -164,12 +165,17 @@ export default function prfmncPrfmncReg() { useEffect(() => { if (!prfmnc.isInit) { - prfmncHasuInit("1", "41"); + prfmncHasuInit(1, "41"); } }, [prfmnc.isInit, prfmncHasuInit]); useEffect(() => { setbdstTable(prfmncRes); - }, [prfmncRes]); + + // cellNum이 0일 경우(첫 번째 행)도 유효한 인덱스이므로 undefined 여부만 체크합니다. + if (cellNum !== undefined) { + cellClick(cellNum); + } + }, [prfmncRes, cellNum, cellClick]); return ( <> @@ -250,13 +256,14 @@ export default function prfmncPrfmncReg() { <ListDiv className="min-h-0"> <ScrollArea className="h-[60vh]"> <UiTable + key={'leftTable'} tableData={bdstTable || []} headlist={pbnstPrfmncHeadList} pageSize={10} total={10000} headName={"하수재이용시설 목록"} cellClick={(index: number | undefined, headId: string) => { - cellClick(index, headId); + cellClick(index); setCellNum(index ?? 0); }} onPageChange={setPageNation} @@ -277,7 +284,7 @@ export default function prfmncPrfmncReg() { <TableHeader className="font-bold"> {headMakeprfmnc(monthHeadList, [])} </TableHeader> - <TableBody> + <TableBody key={prfmnc.pageKey+'pageKey'}> {InputTableBody(inputData ?? [], monthHeadList, setInputData)} </TableBody> </Table> @@ -292,7 +299,15 @@ export default function prfmncPrfmncReg() { data={isExcelOpen.data} setIsExcelOPen={(open) => { setIsExcelOPen({ ...isExcelOpen, isModal: open }) + }} + setModalExcelData={ async(excelData ) =>{ + await prfmnRegData(pageNation,'41', + excelData, + ); + // 데이터 저장 후 UI 업데이트는 useEffect가 감지하여 처리하므로 여기서는 호출하지 않습니다. + } + } ></PbnPrfExcelModal> } open={isExcelOpen.isModal} diff --git a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx index 6b783ea68..6d9bf8862 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/headList.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/headList.tsx @@ -29,12 +29,12 @@ export const coRvwHeadListExport: CommonTableProps[]= [ visible: true, }, { - id: "dmndTmng", //바꾸기 + id: "dmndTmng", title: "신청일자", visible: true, }, { - id: "splyFcltFlg", //바꾸기 + id: "splyFcltFlg", title: "진행상태", visible: true, }, diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index 89836957b..4140905cf 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -102,7 +102,9 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { `/reuseFc/request/cst/${splyCd}/${dmdCd}`, data ); - + if(isUpdate){ + toast.error("수요 매칭 검토 검토로 저장되었습니다."); + } const coMatRvwRes = coMatInit( 1, 10, diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 9f146c0fb..979e24d55 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -1,24 +1,24 @@ import { z } from "zod"; const DemandInfoSchema = z.object({ - dmdInfoSn: z.number(), - dmdInfoFk: z.string(), - dmndTmng: z.coerce.date(), - dmndQty: z.number(), - wntUntprc: z.number(), - grssClfg: z.number(), - combResdch: z.number(), - trbt: z.number(), + dmdInfoSn: z.number().nullish(), + dmdInfoFk: z.string().nullish(), + dmndTmng: z.coerce.date().nullish(), + dmndQty: z.number().nullish(), + wntUntprc: z.number().nullish(), + grssClfg: z.number().nullish(), + combResdch: z.number().nullish(), + trbt: z.number().nullish(), blgcOxygDmndQnt: z.number(), - smll: z.number(), + smll: z.number().nullish(), crmty: z.number().nullish(), - tn: z.number(), - tph: z.number(), + tn: z.number().nullish(), + tph: z.number().nullish(), ph: z.number(), - clIonQnt: z.number(), - cdtnv: z.number(), - rmrk: z.string(), - useUsgCd: z.string(), + clIonQnt: z.number().nullish(), + cdtnv: z.number().nullish(), + rmrk: z.string().nullish(), + useUsgCd: z.string().nullish(), mtchnCmptnYmd: z.string().nullish(), rvwCmptnYmd: z.string().nullish() }); @@ -38,28 +38,28 @@ import { z } from "zod"; }); const DemandCoSchema = z.object({ - dmdInfoPk: z.string(), - dmdCoNm: z.string(), - ctpvCd: z.string(), - sggCd: z.string(), - daddr: z.string(), - splyBgngDay: z.coerce.date(), - splyEndDay: z.coerce.date(), - splyCpct: z.number(), + dmdInfoPk: z.string().nullish(), + dmdCoNm: z.string().nullish(), + ctpvCd: z.string().nullish(), + sggCd: z.string().nullish(), + daddr: z.string().nullish(), + splyBgngDay: z.coerce.date().nullish(), + splyEndDay: z.coerce.date().nullish(), + splyCpct: z.number().nullish(), splyFmYn: z.string().nullish(), - telno: z.string(), + telno: z.string().nullish(), useUsgCd: z.string().nullish(), regDt: z.coerce.date().nullish(), rgtr: z.string().nullish(), mdfcnDt: z.coerce.date().nullish(), mdfr: z.string().nullish(), - dmdAplyPswd: z.string(), + dmdAplyPswd: z.string().nullish(), demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임 demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish()// 안쓰는 거임 }); const DemandCstSchema = z.object({ - dmdInfoSn: z.number(), + dmdInfoSn: z.number().nullish(), usgPrcsProcs: z.string().nullish(), cstrnCst: z.number(), fcltSbsdCstrnCst: z.number(), @@ -69,9 +69,9 @@ import { z } from "zod"; export const DmdCoReqSchema = z.object({ cityText:z.string().nullish(), sggText:z.string().nullish(), - dmdInfoSn: z.number(), - dmdInfoFk: z.string(), - dmndTmng: z.coerce.date(), + dmdInfoSn: z.number().nullish(), + dmdInfoFk: z.string().nullish(), + dmndTmng: z.coerce.date().nullish(), dmndQty: z.number(), wntUntprc: z.number().nullish(), grssClfg: z.number().nullish(), @@ -139,23 +139,7 @@ export type RvwHistTableType = { } -export type RvwHistTableType = { - cityText:string, - sggText:string, - dmdCoNm:string, - daddr:string, - telno:string, - regDt:string, - rvwCmptnYmd:string, - mtchnCmptnYmd:string, - ruseUtztnFcltNm:string, - dmndQty:string, - useUsgCd:string, - splyFcltFlg:string - completeYn:boolean - dmdInfoSn :string -} diff --git a/apps/wr/app/store/matDmd/coSttn/headList.tsx b/apps/wr/app/store/matDmd/coSttn/headList.tsx index 80fed0d76..62c3002ac 100644 --- a/apps/wr/app/store/matDmd/coSttn/headList.tsx +++ b/apps/wr/app/store/matDmd/coSttn/headList.tsx @@ -44,6 +44,11 @@ export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [ title: "전화번호", visible: true, }, + { + id: "regDt", + title: "등록일자", + visible: true, + }, ]; export const coSttNodeListExport: CommonTableProps[] = [ diff --git a/apps/wr/app/store/matDmd/coSttn/index.tsx b/apps/wr/app/store/matDmd/coSttn/index.tsx index 0de37bbfc..5e8baf859 100644 --- a/apps/wr/app/store/matDmd/coSttn/index.tsx +++ b/apps/wr/app/store/matDmd/coSttn/index.tsx @@ -2,7 +2,7 @@ import type { CommonTableProps } from "@/app/store/common/type/header"; import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api"; import { coSttHeadListExport, coSttNodeListExport } from "./headList"; import { excelCoSttnParsing } from "./excel"; -import type { DemandCompType } from "@common/business_components/ui"; +import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form"; // 테이블 헤드 리스트 const coSttNodeList = coSttNodeListExport; diff --git a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx index 82f2ed59c..387f56eb7 100644 --- a/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx +++ b/apps/wr/app/store/prfmncReg/pbnstPrfmncReg/index.tsx @@ -16,6 +16,7 @@ export type pbnstPrfmncState = { monthHeadList: TableUpperProps[]; prfmncRes: FcPrfType[]; excelList: Number[]; + pageKey:number }; }; @@ -26,21 +27,22 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = { monthHeadList: monthHeadList, prfmncRes: [], excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + pageKey:1 }, }; export type pbnstPrfmncType = pbnstPrfmncState & pbnstPrfmncActions; type pbnstPrfmncActions = { - prfmncHasuInit: (page: string, sggOrCity: string) => void; - prfmnRegData: (data: PrfType) => void; + prfmncHasuInit: (page: number, sggOrCity: string) => void; + prfmnRegData: (page:number,sggOrCity:string, data: PrfType) => void; }; const checkWrRegList = async () => { const wrRegList = await getFetch("wr", `/reuseFc/pubDetailList`); return wrRegList; }; -const hasuListFetch = async (page: string, sggOrCity: string) => { +const hasuListFetch = async (page: number, sggOrCity: string) => { const checkWrRegListRes = await checkWrRegList(); const rainRes = await postFectch( `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity ? sggOrCity : "11"}/0/1/SW`, @@ -74,7 +76,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( set: any ) => { return { - prfmncHasuInit: async (page: string, sggOrCity: string) => { + prfmncHasuInit: async (page: number, sggOrCity: string) => { try { const prfmncRes = await hasuListFetch(page, sggOrCity); return set((state: pbnstPrfmncState) => ({ @@ -89,7 +91,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( console.log(errorHasu); } }, - prfmnRegData: async (data: PrfType) => { + prfmnRegData: async (page:number,sggOrCity:string,data: PrfType) => { try { const ressponse = await postFectch( "/reuseFc/pubFcPrf", @@ -100,6 +102,17 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = ( if (ressponse.status === 200) { toast.success("하수재이용 시설 실적 등록이 완료되었습니다."); + const prfmncRes = await hasuListFetch(page, sggOrCity); + return set((state: pbnstPrfmncState) => ({ + ...state, + prfmnc: { + ...state.prfmnc, + prfmncRes: prfmncRes, + isInit: false, + pageKey: state.prfmnc.pageKey + 1 + }, + })); + } } catch (e) { console.log(e); diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index 7a35e02c4..8bed17187 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -2,6 +2,7 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; import type { rainChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn"; import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn"; import { Checkbox, Input, TableCell, TableRow } from "@common/components/ui"; +import { useEffect } from "react"; export const rainChkTableData = (chkData: rainChkZodType[]) => { // 1. chkgdnFk + utztnUsgCd 기준 누계 정보 만들기 @@ -54,27 +55,32 @@ export const rainChkTableData = (chkData: rainChkZodType[]) => { export const rswtChkTableData = (chkData: rswtChkZodType[]) => { // 1. chkgdnFk + utztnUsgCd 기준 누계 정보 만들기 const makeRswtData: any[] = []; - chkData?.forEach((root) => { - root.rswtrDetails.forEach((detail) => { - let flatRswtChk = {}; - const findGuide = root.guideDetails.find( - (guide) => guide.utztnUsgCd === detail.utztnUsgCd - ); - const findPoluttion = root.rswtrPollutions.find( - (polution) => polution.utztnUsgCd === detail.utztnUsgCd - ); - const operMngCd = root?.reuseBuilding.operMngCd; - flatRswtChk = { - ...root, - ...detail, - ...findGuide, - ...findPoluttion, - ...flatRswtChk, - operMngCd: operMngCd, - }; - makeRswtData.push(flatRswtChk); + + + if(chkData&&chkData.length>0){ + + chkData?.forEach((root) => { + root.rswtrDetails.forEach((detail) => { + let flatRswtChk = {}; + const findGuide = root.guideDetails.find( + (guide) => guide.utztnUsgCd === detail.utztnUsgCd + ); + const findPoluttion = root.rswtrPollutions.find( + (polution) => polution.utztnUsgCd === detail.utztnUsgCd + ); + const operMngCd = root?.reuseBuilding.operMngCd; + flatRswtChk = { + ...root, + ...detail, + ...findGuide, + ...findPoluttion, + ...flatRswtChk, + operMngCd: operMngCd, + }; + makeRswtData.push(flatRswtChk); + }); }); - }); + } return makeRswtData; }; @@ -93,6 +99,7 @@ export const chRowspanTable = ( let order = 0 // rowspan된 셀 렌더링 여부 추적용 const renderedMap = new Map<string, Set<number>>(); + return ( <> {makeTableData.map((row, rowIndex) => ( @@ -228,7 +235,6 @@ export const InputTableBody = ( } return span; }; - return ( <> {chgRes.map((data, dataIndex) => { diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index aaa7c46b9..2653f4be9 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -138,7 +138,7 @@ export default function ConCostForm({ if (type === "mat") { const data: DedMatUpdateType = { dmdInfoSn: form.getValues("dmdInfoSn"), - usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs"), + usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs")|| "", cstrnCst: form.getValues("demandCst.cstrnCst"), fcltSbsdCstrnCst: form.getValues("demandCst.fcltSbsdCstrnCst"), prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"), @@ -294,7 +294,9 @@ export default function ConCostForm({ <div className="col-span-12 w-full"> <h1 className={formH1Class}>공사비 입력사항</h1> </div> - <div className="col-span-3 mt-4"> + + + <div className="col-span-2 mt-4"> <div className="flex items-center justify-between"> <PopoverUi childrenTriger={ @@ -333,7 +335,7 @@ export default function ConCostForm({ )} /> </div> - <div className="col-span-3 mt-4"> + <div className="col-span-2 mt-4"> <div className="flex items-center justify-between"> <PopoverUi childrenTriger={ @@ -372,12 +374,12 @@ export default function ConCostForm({ )} /> </div> - <div className="col-span-3 mt-4"> + <div className="col-span-2 mt-4"> <PopoverUi childrenTriger={ <> <Label className="underline"> - 총사업비 (백만원) <i className="diveicon di-search" /> + 처리시설 총사업비(백만원) <i className="diveicon di-search" /> </Label> </> } @@ -414,7 +416,7 @@ export default function ConCostForm({ )} /> </div> - <div className="col-span-3 mt-4"> + {/* <div className="col-span-3 mt-4"> <div className="flex items-center justify-between"> <Label>공급처 선정</Label> <Button size={"sm"} onClick={(e) => {}} className="bg-none"> @@ -437,8 +439,8 @@ export default function ConCostForm({ </FormUi> )} /> - </div> - <div className="col-span-4 mt-4"> + </div> */} + <div className="col-span-3 mt-4"> <FormField control={form.control} name="demandCst.cstrnCst" @@ -457,7 +459,7 @@ export default function ConCostForm({ )} /> </div> - <div className="col-span-4 mt-4 mb-3"> + <div className="col-span-3 mt-4 mb-3"> <Label className="text-xl"> 처리시설 + 공급관로 총사업비(백만원) </Label> diff --git a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx index 25fe5d273..b4b87663e 100644 --- a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx @@ -21,7 +21,7 @@ import { useForm } from "react-hook-form"; import toast from "react-hot-toast"; import type { z } from "zod"; -export default function PbnPrfExcelModal({ data ,setIsExcelOPen }: { data: FcPrfType ,setIsExcelOPen:(open:boolean )=>void }) { +export default function PbnPrfExcelModal({ data ,setIsExcelOPen ,setModalExcelData}: { data: FcPrfType ,setIsExcelOPen:(open:boolean )=>void,setModalExcelData:(excelData :PrfType)=>void }) { const { prfmnRegData } = useWrStore((state) => state); const [file, setFile] = useState<File | null>(null); @@ -42,7 +42,9 @@ export default function PbnPrfExcelModal({ data ,setIsExcelOPen }: { data: FcPrf const onSubmit = (values: z.infer<typeof pbnPrfRegExcelZod>) => { if (excelData) { - prfmnRegData(excelData as unknown as PrfType); + // prfmnRegData(1,'41', excelData as unknown as PrfType); + + setModalExcelData(excelData as unknown as PrfType) setIsExcelOPen(false) } From 103c5d3cb1102d6994ad2a842e42d245fac511e9 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 16:15:08 +0900 Subject: [PATCH 173/259] =?UTF-8?q?=EC=88=98=EC=9A=94=EB=A7=A4=EC=B9=AD?= =?UTF-8?q?=EA=B2=80=ED=86=A0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 18 +- apps/wr/app/matMng/coMng/coSttn/page.tsx | 37 ++- apps/wr/app/store/common/searchCode/index.ts | 19 +- apps/wr/app/store/matDmd/coMatRvw/index.tsx | 69 +++-- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 268 +++++++++--------- .../ui/form/coMat/conCostForm/conCostForm.tsx | 45 ++- 6 files changed, 248 insertions(+), 208 deletions(-) diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index acfdb6585..0bb06770a 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -93,12 +93,12 @@ export default function CoMatRvw() { const form = useForm<z.infer<typeof DmdCoReqSchema>>({ resolver: zodResolver(DmdCoReqSchema), - shouldUnregister: true + shouldUnregister: false, + // defaultValues: DmdCoReqSchema.parse({}) }); const TableCellClick = (index: number) => { - console.log(coMatRvwRes); if (coMatRvwRes && coMatRvwRes[index]) { setSelectData(coMatRvwRes[index]); setSelectionVersion((v) => v + 1); // 행을 클릭할 때마다 버전을 1씩 증가 @@ -107,7 +107,6 @@ export default function CoMatRvw() { const useUsgCdWatch = useWatch({ control: form.control, name: "useUsgCd" }); useEffect(() => { - console.log(' useUsgCdWatch page ' ,useUsgCdWatch) if (useUsgCdWatch) { form.setValue( "demandCst.usgPrcsProcs", @@ -160,7 +159,15 @@ export default function CoMatRvw() { useEffect(() => { if (selectData) { - form.reset(selectData); + + try { + DmdCoReqSchema.parse(selectData); + } catch (e) { + if (e instanceof z.ZodError) { + console.log(e.flatten()); + } + } + form.reset( selectData); setSelectionVersion((v) => v + 1); // 강제로 바뀌었다고 알리기 } }, [selectData, form]); @@ -168,6 +175,7 @@ export default function CoMatRvw() { <> <ContentsDiv> <div className="grid grid-cols-4 gap-4"> + <div className="col-span-4"> <Title title={"수요매칭검토"} /> <SearchDiv> @@ -288,7 +296,7 @@ export default function CoMatRvw() { <div className="col-span-3 mt-4"> <FormField control={form.control} - name="demandCo.regDt" + name="dmndTmng" render={({ field }) => ( <FormUi label="요구시기"> <Input diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index e2c8b8195..e828f4226 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -61,17 +61,29 @@ export default function CoSttn() { const [seartchTxt, setSearchTxt] = useState<string>(); const [upadateData, setUpdateData] = useState<DemandCompType>(); - const getSelCity = (val: string | number) => { - const cityValue = String(val); // Ensure val is treated as a string - const data = getCity(cityValue, code.sggCd); - setSelectSgg(data); - setObjSearch({ city: cityValue, sgg: "" }); - }; + const getSelCity = useCallback((val: string | number) => { + const cityValue = String(val); + const data = getCity(cityValue, code.sggCd); + setSelectSgg(data); + // 시/도를 변경하면 시/군/구는 '전체'("0")로 초기화합니다. + setObjSearch({ city: cityValue, sgg: "0" }); + }, [code.sggCd]); - const getSgg = (val: string | number) => { - setObjSearch({ ...objSearch, sgg: String(val) }); - }; + const getSgg = useCallback((val: string | number) => { + setObjSearch((prev) => ({ ...prev, sgg: String(val) })); + }, []); + useEffect(() => { + // code.cityCd 데이터가 로드되었고, 아직 시/도 선택이 안된 초기 상태일 때 실행 + if (code.cityCd && code.cityCd.length > 0 && !objSearch.city) { + const firstCityVal = code.cityCd[0]?.val; + if (firstCityVal) { + // 첫 번째 시/도 값으로 상태를 초기화합니다. + getSelCity(firstCityVal); + } + } + }, [code.cityCd, objSearch.city, getSelCity]); + useEffect(() => { if (!coSttn.isInit) { coSttnInit("1", "13", "0"); @@ -124,8 +136,11 @@ export default function CoSttn() { const searchClick = () => { const con = (objSearch.sgg && objSearch.sgg !== "0") ? objSearch.sgg : objSearch.city; + if (con) { if (seartchTxt && seartchTxt?.length > 0) { + + console.log(' seartchTxt ', seartchTxt) coSttnTxtSearch("1", "13", String(con), seartchTxt ?? ""); } else { coSttnSearch("1", "13", String(con)); @@ -147,13 +162,15 @@ export default function CoSttn() { selectClass={""} selectArray={code.cityCd || []} onSelectValue={getSelCity} + value={objSearch.city} /> <SelectBox className="col-span-2 w-1/6 h-full text-2xl" label="시군구" selectClass={""} - selectArray={selectSgg?selectSgg : [{text:"전체",val:"0"}]} + selectArray={selectSgg || []} onSelectValue={getSgg} + value={objSearch.sgg} /> <SearchInput className={"!text-3xl"} diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts index 51ebda8a5..893e6ee10 100644 --- a/apps/wr/app/store/common/searchCode/index.ts +++ b/apps/wr/app/store/common/searchCode/index.ts @@ -94,10 +94,13 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { `/reuseFc/request/${searchNm}/${cnt}` ); - console.log(coList); - set((state: comFcltState) => { - return (state.demandCompList = [...coList]); - }); + + if(coList&&coList.length>0){ + + set((state: comFcltState) => { + return (state.demandCompList = [...coList]); + }); + } }, regDemandCompany: async (data: DemandCompType) => { try { @@ -112,9 +115,10 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { } else { message = "fail"; } + + set((state: comFcltState) => { - state.dmdIsSucees = message; - return state; + return state.dmdIsSucees = message; }); } catch (err) { console.log(err); @@ -132,8 +136,7 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { } set((state: comFcltState) => { - state.dmdIsSucees = message; - return state; + return state.dmdIsSucees = message; }); } catch (err) { console.log(err); diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index 4140905cf..a1a7c187d 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -1,13 +1,18 @@ -import { constCostHeadListExport, coRvwHeadListExport, coRvwNodeListExport, rateFeeHeadListExport } from "./headList"; +import { + constCostHeadListExport, + coRvwHeadListExport, + coRvwNodeListExport, + rateFeeHeadListExport, +} from "./headList"; import type { CommonTableProps } from "../../common/type/header"; import type { DedMatUpdateType, DmdCoReqType } from "./type"; import { fetchType, getFetch, putFectch } from "@/components/lib/api"; -import toast from "react-hot-toast/headless"; +import toast from "react-hot-toast"; const coRvwHeadList = coRvwHeadListExport; const coRvwNodeList = coRvwNodeListExport; -const rateFeeHeadList =rateFeeHeadListExport; -const constCostHeadList=constCostHeadListExport +const rateFeeHeadList = rateFeeHeadListExport; +const constCostHeadList = constCostHeadListExport; export type coRvwState = { coRvw: { isInit: boolean; @@ -25,8 +30,8 @@ export const coRvwStateExport: coRvwState = { coMatRvwRes: [], coRvwHeadList: coRvwHeadList, coRvwNodeList: coRvwNodeList, - rateFeeHeadList:rateFeeHeadList, - constCostHeadList:constCostHeadList + rateFeeHeadList: rateFeeHeadList, + constCostHeadList: constCostHeadList, }, }; @@ -37,7 +42,7 @@ type coRvwActions = { pageNo: number, pageCnt: number, startYear: string, - endYear: string, + endYear: string ) => void; coMatRvwUpdate: ( splyCd: string, @@ -50,7 +55,7 @@ type coRvwActions = { startYear: string, endYear: string, sggCd: string, - dmdCoNm: string, + dmdCoNm: string ) => void; coMatRvwInqua: ( pageNo: number, @@ -65,7 +70,7 @@ const coMatInit = async ( pageNo: number, pageCnt: number, startYear: string, - endYear: string, + endYear: string ) => { const url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; const coMatRvwRes = await getFetch(fetchType.WR, url); @@ -79,7 +84,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { pageNo: number, pageCnt: number, startYear: string, - endYear: string, + endYear: string ) => { const coMatRvwRes = await coMatInit(pageNo, pageCnt, startYear, endYear); @@ -98,27 +103,29 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { data: DedMatUpdateType ) => { try { - const isUpdate = await putFectch( + const response = await putFectch( `/reuseFc/request/cst/${splyCd}/${dmdCd}`, data ); - if(isUpdate){ - toast.error("수요 매칭 검토 검토로 저장되었습니다."); + if (response.status === 200) { + toast.success("매칭 검토로 저장되었습니다."); + const coMatRvwRes = await coMatInit( + 1, + 10, + new Date().getFullYear().toString(), + new Date().getFullYear().toString() + ); + return set((state: coRvwState) => ({ + ...state, + coRvw: { + ...state.coRvw, + coMatRvwRes: coMatRvwRes, + init: false, + }, + })); + } else { + toast.error("매칭 검토 저장에 실패했습니다."); } - const coMatRvwRes = coMatInit( - 1, - 10, - new Date().getFullYear().toString(), - new Date().getFullYear().toString(), - ); - return set((state: coRvwState) => ({ - ...state, - coRvw: { - ...state.coRvw, - init: false, - coMatRvwRes: coMatRvwRes, - }, - })); } catch (e) { toast.error("매칭 검토 저장 오류입니다."); } @@ -129,7 +136,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { startYear: string, endYear: string, sggCd: string, - dmdCoNm: string, + dmdCoNm: string ) => { let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; @@ -144,7 +151,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { url += `/0`; } - console.log(' url ', url) + console.log(" url ", url); const coMatRvwRes = await getFetch(fetchType.WR, url); return set((state: coRvwState) => ({ @@ -166,7 +173,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; if (sggCd.length > 0) { url += `/${sggCd}/0`; - }else if(sggCd ==='0'){ + } else if (sggCd === "0") { url += `/0/0`; } const coMatRvwRes = await getFetch(fetchType.WR, url); @@ -180,6 +187,6 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { } catch (e) { console.log(" error ", e); } - } + }, }; }; diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 979e24d55..9b2e65cc4 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -1,157 +1,147 @@ import { z } from "zod"; - const DemandInfoSchema = z.object({ - dmdInfoSn: z.number().nullish(), - dmdInfoFk: z.string().nullish(), - dmndTmng: z.coerce.date().nullish(), - dmndQty: z.number().nullish(), - wntUntprc: z.number().nullish(), - grssClfg: z.number().nullish(), - combResdch: z.number().nullish(), - trbt: z.number().nullish(), - blgcOxygDmndQnt: z.number(), - smll: z.number().nullish(), - crmty: z.number().nullish(), - tn: z.number().nullish(), - tph: z.number().nullish(), - ph: z.number(), - clIonQnt: z.number().nullish(), - cdtnv: z.number().nullish(), - rmrk: z.string().nullish(), - useUsgCd: z.string().nullish(), - mtchnCmptnYmd: z.string().nullish(), - rvwCmptnYmd: z.string().nullish() - }); - - const DemandMatchingSchema = z.object({ - dmdInfoFk: z.string().nullish(), - splyFcltFk: z.string().nullish(), - splyFcltFlg: z.string().nullish(), - pbnstRuseFcltBizFk: z.number().nullish(), - splyBgngDay: z.coerce.date().nullish(), - splyEndDay: z.coerce.date().nullish(), - splyCpct: z.number().nullish(), - splyFmYn: z.string().nullish(), - useUsgCd: z.string().nullish(), - dmdInfoSn: z.number().nullish(), - splyCndtList:z.array(z.string().nullish() ).nullish() - }); - - const DemandCoSchema = z.object({ - dmdInfoPk: z.string().nullish(), - dmdCoNm: z.string().nullish(), - ctpvCd: z.string().nullish(), - sggCd: z.string().nullish(), - daddr: z.string().nullish(), - splyBgngDay: z.coerce.date().nullish(), - splyEndDay: z.coerce.date().nullish(), - splyCpct: z.number().nullish(), - splyFmYn: z.string().nullish(), - telno: z.string().nullish(), - useUsgCd: z.string().nullish(), - regDt: z.coerce.date().nullish(), - rgtr: z.string().nullish(), - mdfcnDt: z.coerce.date().nullish(), - mdfr: z.string().nullish(), - dmdAplyPswd: z.string().nullish(), - demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임 - demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish()// 안쓰는 거임 - }); - - const DemandCstSchema = z.object({ - dmdInfoSn: z.number().nullish(), - usgPrcsProcs: z.string().nullish(), - cstrnCst: z.number(), - fcltSbsdCstrnCst: z.number(), - prcsFcltCpctCstrnCst: z.number() - }); - - export const DmdCoReqSchema = z.object({ - cityText:z.string().nullish(), - sggText:z.string().nullish(), - dmdInfoSn: z.number().nullish(), - dmdInfoFk: z.string().nullish(), - dmndTmng: z.coerce.date().nullish(), - dmndQty: z.number(), - wntUntprc: z.number().nullish(), - grssClfg: z.number().nullish(), - combResdch: z.number().nullish(), - trbt: z.number().nullish(), - blgcOxygDmndQnt: z.number(), - smll: z.number().nullish(), - crmty: z.number().nullish(), - tn: z.number().nullish(), - tph: z.number().nullish(), - ph: z.number().nullish(), - clIonQnt: z.number().nullish(), - cdtnv: z.number(), - rmrk: z.string().nullish(), - useUsgCd: z.string().nullish(), - mtchnCmptnYmd: z.string().nullish(), - rvwCmptnYmd: z.string().nullish(), - demandCo: DemandCoSchema.nullish(), - demandMatching: DemandMatchingSchema.nullish(), - demandCst: DemandCstSchema, - ruseUtztnFcltNm:z.string().nullish(), - totalConstCost:z.number().nullish(), +const DemandInfoSchema = z.object({ + dmdInfoSn: z.number(), + dmdInfoFk: z.string().nullish(), + dmndTmng: z.coerce.date().nullish(), + dmndQty: z.number().nullish(), + wntUntprc: z.number().nullish(), + grssClfg: z.number().nullish(), + combResdch: z.number().nullish(), + trbt: z.number().nullish(), + blgcOxygDmndQnt: z.number(), + smll: z.number().nullish(), + crmty: z.number().nullish(), + tn: z.number().nullish(), + tph: z.number().nullish(), + ph: z.number(), + clIonQnt: z.number().nullish(), + cdtnv: z.number().nullish(), + rmrk: z.string().nullish(), + useUsgCd: z.string().nullish(), + mtchnCmptnYmd: z.string().nullish(), + rvwCmptnYmd: z.string().nullish(), +}); - }); +const DemandMatchingSchema = z.object({ + dmdInfoFk: z.string().nullish(), + splyFcltFk: z.string().nullish(), + splyFcltFlg: z.string().nullish(), + pbnstRuseFcltBizFk: z.number().nullish(), + splyBgngDay: z.coerce.date().nullish(), + splyEndDay: z.coerce.date().nullish(), + splyCpct: z.number().nullish(), + splyFmYn: z.string().nullish(), + useUsgCd: z.string().nullish(), + dmdInfoSn: z.number().nullish(), + splyCndtList: z.array(z.string().nullish()).nullish(), +}); +const DemandCoSchema = z.object({ + dmdInfoPk: z.string().nullish(), + dmdCoNm: z.string().nullish(), + ctpvCd: z.string().nullish(), + sggCd: z.string().nullish(), + daddr: z.string().nullish(), + splyBgngDay: z.coerce.date().nullish(), + splyEndDay: z.coerce.date().nullish(), + splyCpct: z.number().nullish(), + splyFmYn: z.string().nullish(), + telno: z.string().nullish(), + useUsgCd: z.string().nullish(), + regDt: z.coerce.date().nullish(), + rgtr: z.string().nullish(), + mdfcnDt: z.coerce.date().nullish(), + mdfr: z.string().nullish(), + dmdAplyPswd: z.string().nullish(), + demandInfo: z.array(DemandInfoSchema.nullish()).nullish(), // 안쓰는 거임 + demandMatchings: z.array(DemandMatchingSchema.nullish()).nullish(), // 안쓰는 거임 +}); + +const DemandCstSchema = z.object({ + dmdInfoSn: z.number().nullish(), + usgPrcsProcs: z.string().nullish(), + cstrnCst: z.number().default(0), + fcltSbsdCstrnCst: z.number().default(0), + prcsFcltCpctCstrnCst: z.number().default(0), +}); + +export const DmdCoReqSchema = z.object({ + cityText: z.string().nullish(), + sggText: z.string().nullish(), + dmdInfoSn: z.number().default(0), + dmdInfoFk: z.string().default(''), + dmndTmng: z.coerce.date().nullish(), + dmndQty: z.number().nullish(), // null 또는 undefined 허용 + blgcOxygDmndQnt: z.number().nullish(), + wntUntprc: z.number().nullish(), + grssClfg: z.number().nullish(), + combResdch: z.number().nullish(), + trbt: z.number().nullish(), + smll: z.number().nullish(), + crmty: z.number().nullish(), + tn: z.number().nullish(), + tph: z.number().nullish(), + ph: z.number().nullish(), + clIonQnt: z.number().nullish(), + cdtnv: z.number().nullish(), + rmrk: z.string().nullish(), + useUsgCd: z.string().nullish(), + mtchnCmptnYmd: z.string().nullish(), + rvwCmptnYmd: z.string().nullish(), + demandCo: DemandCoSchema.nullish(), + demandMatching: DemandMatchingSchema.nullish(), + demandCst: DemandCstSchema.nullish(), + ruseUtztnFcltNm: z.string().nullish(), + totalConstCost: z.number().nullish(), +}); export type DmdCoReqType = z.infer<typeof DmdCoReqSchema>; export type DmdMatTableType = { - cityText:string, - sggText:string, - dmdCoNm:string, - daddr:string, - telno:string, - regDt:string, - splyFcltFlg:string -} + cityText: string; + sggText: string; + dmdCoNm: string; + daddr: string; + telno: string; + regDt: string; + splyFcltFlg: string; +}; - -export type DedMatUpdateType = -{ +export type DedMatUpdateType = { dmdInfoSn: number; usgPrcsProcs: string; cstrnCst: number; fcltSbsdCstrnCst: number; prcsFcltCpctCstrnCst: number; rgtr: string; -} - +}; export type RvwHistTableType = { - cityText:string, - sggText:string, - dmdCoNm:string, - daddr:string, - telno:string, - regDt:string, - rvwCmptnYmd:string, - mtchnCmptnYmd:string, - ruseUtztnFcltNm:string, - dmndQty:string, - useUsgCd:string, - splyFcltFlg:string - completeYn:boolean - dmdInfoSn :string + cityText: string; + sggText: string; + dmdCoNm: string; + daddr: string; + telno: string; + regDt: string; + rvwCmptnYmd: string; + mtchnCmptnYmd: string; + ruseUtztnFcltNm: string; + dmndQty: string; + useUsgCd: string; + splyFcltFlg: string; + completeYn: boolean; + dmdInfoSn: string; +}; -} - - - - - -export type conCostFeeType= { - yr: string, - fctCpc: string, - fctCd: string, - stdCost: string -} +export type conCostFeeType = { + yr: string; + fctCpc: string; + fctCd: string; + stdCost: string; +}; export type rateFeeType = { - yr: string, - incExpCd: string, - stdCost: number, - rt: number -} \ No newline at end of file + yr: string; + incExpCd: string; + stdCost: number; + rt: number; +}; diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index 2653f4be9..f50474d79 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -74,14 +74,19 @@ export default function ConCostForm({ const cstrnCst = form.watch("demandCst.cstrnCst"); const useUsgCdWatch = form.watch("useUsgCd"); - useEffect(() =>{ - console.log('usgPrcsProcsWatch ', usgPrcsProcsWatch) + - console.log('useUsgCdWatch ' , useUsgCdWatch) - - },[usgPrcsProcsWatch, useUsgCdWatch, selectionVersion]) const calculateConstCost = useCallback(() => { const usgPrcsProcs = usgPrcsProcsWatch; + if(!dmndQtyWatch){ + toast.error('요구수량(M3/d)을 확인해주세요 계산할수 없습니다. ') + return + } + if(usgPrcsProcs === null || usgPrcsProcs === undefined){ + toast.error('용도에 따른 처리공정을 확인할수 없습니다. 용도를 확인해주세요. ') + return + } + const dmndQtyYear = dmndQtyWatch * 365; if (usgPrcsProcs && usgPrcsProcs?.length > 0) { const firstProc = getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; @@ -131,20 +136,23 @@ export default function ConCostForm({ }, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]); const onSubmit = (value: DmdCoReqType) => { - if( !form.getValues('demandCst.prcsFcltCpctCstrnCst') ){ + if(value.demandCst&& !value.demandCst.prcsFcltCpctCstrnCst ){ toast.error('공사비 계산 진행 후 저장을 눌러주새요') return } if (type === "mat") { - const data: DedMatUpdateType = { - dmdInfoSn: form.getValues("dmdInfoSn"), - usgPrcsProcs: form.getValues("demandCst.usgPrcsProcs")|| "", - cstrnCst: form.getValues("demandCst.cstrnCst"), - fcltSbsdCstrnCst: form.getValues("demandCst.fcltSbsdCstrnCst"), - prcsFcltCpctCstrnCst: form.getValues("demandCst.prcsFcltCpctCstrnCst"), - rgtr: TEST_UUID, - }; - coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + + if(value.demandCst ){ + const data: DedMatUpdateType = { + dmdInfoSn: value.dmdInfoSn, + usgPrcsProcs: value.demandCst.usgPrcsProcs|| "", + cstrnCst: value.demandCst.cstrnCst ||0, + fcltSbsdCstrnCst: value.demandCst.fcltSbsdCstrnCst ||0, + prcsFcltCpctCstrnCst: value.demandCst.prcsFcltCpctCstrnCst ||0, + rgtr: TEST_UUID, + }; + coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + } } else if (type === "hist") { delete value.totalConstCost @@ -159,6 +167,13 @@ export default function ConCostForm({ console.log(" form ", form.formState.errors); }, [form.formState]); + + useEffect(() => { + form.register("dmdInfoSn"); + form.register("dmdInfoFk"); + form.register("ruseUtztnFcltNm"); + }, []); + return ( <> <hr className="mt-8" /> From ad7b78688f79da1cc4ba77990ef7620f5caf8648 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 16:34:47 +0900 Subject: [PATCH 174/259] =?UTF-8?q?[=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=EC=8B=9C=EC=84=A4=20=EB=93=B1=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95]=20onVild=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0?= =?UTF-8?q?=EB=A1=9C=20=EB=AA=A8=EB=8B=AC=EC=97=90=EA=B2=8C=20=EB=84=98?= =?UTF-8?q?=EA=B2=A8=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ruseFcltMng/fcltReg/pbnstReg/page.tsx | 8 +- .../ruseFcltMng/fcltReg/pbnstReg/type.tsx | 2 +- .../fcltReg/pbnstRegModal/pbnstRegModal.tsx | 104 +++++++++--------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx index 0c3ad9dce..9f243627c 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/pbnstReg/page.tsx @@ -200,14 +200,10 @@ export default function PublicReuseFaciltyInsert() { useEffect(() => { if (pbnst.pbnstRes && pbnst.pbnstRes?.length > 0) { - // form.reset({ - // items: pbnstRegArrayZod.parse(pbnst.pbnstRes), - // }); + form.reset({ items: pbnst.pbnstRes }); - //form.reset({ items: pbnst.pbnstRes }); - } else { form.reset({ items: [] }); } @@ -425,6 +421,8 @@ export default function PublicReuseFaciltyInsert() { setIsRuseReg({ isModal: false }); } }} + + onInvalid ={onInvalid} ></PbnstRegModal> } bodyClass="w-[68vw] max-w-none h-[90vh]" diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx index 2ef1c6d2f..ad3496a54 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/type.tsx @@ -163,7 +163,7 @@ export const fcBizSchema = z.object({ etc: z.string().default(""), totalMoney: zNumNullish.default(0), rprcsFcltCpct: zNumDefaultZero, - majorPrcsMsrcCd: z.string().default(""), + majorPrcsMsrcCd: z.string().nullish(), addr: z.string().default(""), rprcsMthdCd: z.string().default(""), inoutYn: z.enum(["Y", "N"]).default("Y"), diff --git a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx index 34bc71a46..846e427c6 100644 --- a/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/pbnstRegModal/pbnstRegModal.tsx @@ -29,9 +29,11 @@ import type { z } from "zod"; export function PbnstRegModal({ form, setPbnstInsert, + onInvalid }: { form: UseFormReturn<{ items: PbnstRegArrrayType }>; setPbnstInsert: (data: customPbnst) => void; + onInvalid:(errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }>) => void }) { const { pbnstInsert } = useWrStore((state) => { return state; @@ -51,69 +53,69 @@ export function PbnstRegModal({ setPbnstInsert(data[0]); } }; - const onInvalid = ( - errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }> - ) => { - // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. + // const onInvalid = ( + // errors: FieldErrors<{ items: z.infer<typeof pbnstRegZod>[] }> + // ) => { + // // 재귀 함수를 사용해 중첩된 에러 객체에서 모든 에러 메시지와 경로를 찾습니다. - const findAllErrors = ( - errorObject: any, - path: (string | number)[] = [] - ): { message: string; path: (string | number)[] }[] => { - if (!errorObject) return []; + // const findAllErrors = ( + // errorObject: any, + // path: (string | number)[] = [] + // ): { message: string; path: (string | number)[] }[] => { + // if (!errorObject) return []; - return Object.keys(errorObject).flatMap((key) => { - const value = errorObject[key]; - const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; - const newPath = [...path, currentKey]; - if (value && typeof value === "object") { - if (typeof value.message === "string") { - return [{ message: value.message, path: newPath }]; // 에러 메시지와 경로 반환 - } - return findAllErrors(value, newPath); - } - return []; - }); - }; + // return Object.keys(errorObject).flatMap((key) => { + // const value = errorObject[key]; + // const currentKey = !isNaN(parseInt(key)) ? parseInt(key) : key; + // const newPath = [...path, currentKey]; + // if (value && typeof value === "object") { + // if (typeof value.message === "string") { + // return [{ message: value.message, path: newPath }]; // 에러 메시지와 경로 반환 + // } + // return findAllErrors(value, newPath); + // } + // return []; + // }); + // }; - const errorList = findAllErrors(errors); + // const errorList = findAllErrors(errors); - if (errorList.length > 0) { - errorList.forEach((errorInfo) => { - const { message, path } = errorInfo; - let prefix = ""; - const itemsIndex = path.indexOf("items"); + // if (errorList.length > 0) { + // errorList.forEach((errorInfo) => { + // const { message, path } = errorInfo; + // let prefix = ""; + // const itemsIndex = path.indexOf("items"); - if (itemsIndex > -1 && path.length > itemsIndex + 1) { - const itemIdx = path[itemsIndex + 1] as number; - const facilityName = form.getValues( - `items.${itemIdx}.ruseUtztnFcltNm` - ); - if (facilityName) { - prefix += `[${facilityName}] `; - } + // if (itemsIndex > -1 && path.length > itemsIndex + 1) { + // const itemIdx = path[itemsIndex + 1] as number; + // const facilityName = form.getValues( + // `items.${itemIdx}.ruseUtztnFcltNm` + // ); + // if (facilityName) { + // prefix += `[${facilityName}] `; + // } - const fcBizsIndex = path.indexOf("fcBizs"); - if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { - const bizIdx = path[fcBizsIndex + 1] as number; - const cycle = form.getValues( - `items.${itemIdx}.fcBizs.${bizIdx}.cycl` - ); - if (cycle) { - prefix += `[${cycle}차수] `; - } - } - } + // const fcBizsIndex = path.indexOf("fcBizs"); + // if (fcBizsIndex > -1 && path.length > fcBizsIndex + 1) { + // const bizIdx = path[fcBizsIndex + 1] as number; + // const cycle = form.getValues( + // `items.${itemIdx}.fcBizs.${bizIdx}.cycl` + // ); + // if (cycle) { + // prefix += `[${cycle}차수] `; + // } + // } + // } - toast.error(`${prefix}${message}`); - }); - } - }; + // toast.error(`${prefix}${message}`); + // }); + // } + // }; const handleTabChange = (value: string) => { setCurrentTab(value); From 59a517583201fffc28426cd3350220583955c2f4 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 17:20:21 +0900 Subject: [PATCH 175/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=EC=8B=9C=EC=84=A4=20=EC=85=80=EB=A0=89=ED=8A=B8?= =?UTF-8?q?=EB=B0=95=EC=8A=A4=20=EC=84=A0=ED=83=9D=EB=90=98=EA=B2=8C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx index fb50e1b89..234efa7c7 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegFormDetail/mngRegFormDetail.tsx @@ -101,7 +101,7 @@ export default function MngRegFormDetail({ : [] } onSelectValue={field.onChange} - value={field.value?.trim() ??""} + value={field.value?.trim() ?? (Array.isArray(potentialOptions) && potentialOptions[0]?.val )} readOnly={formHead.option === "readOnly"} /> ); From d2c7bbb78bed1d6c094f007d7aa3eb18f5a2412a Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 18:30:07 +0900 Subject: [PATCH 176/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=EC=8B=9C=EC=84=A4=20=EB=93=B1=EB=A1=9D=20=EC=9B=90?= =?UTF-8?q?=EC=88=98=EC=B7=A8=EC=88=98=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/store/common/searchCode/index.ts | 1 + .../fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts index 893e6ee10..656bc33d9 100644 --- a/apps/wr/app/store/common/searchCode/index.ts +++ b/apps/wr/app/store/common/searchCode/index.ts @@ -70,6 +70,7 @@ export type comFcltState = { export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => { return { getSwtrmtFcltNm: async (searchNm: string) => { + const fcltNm = await getFetch( "common", `/prcsFclt/info/1/11/${searchNm}` diff --git a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx index 69ec1afcc..5b1a6f0f6 100644 --- a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx @@ -115,7 +115,19 @@ export default function FcOrgwtsRegModal({ value={inputVal} onChange={(e) => setInputVal(e.target.value)} /> - <Button size="sm" onClick={() => getSwtrmtFcltNm(inputVal)}> + <Button size="sm" onClick={() => { + + if(inputVal){ + + getSwtrmtFcltNm(inputVal) + }else{ + const filterData = pbnstHasuRes.filter((item) => ! rightData?.find(( right) => right.bscFctNm ===item.bscFctNm)) + setbdstTable(tableData(filterData, { code })); + + } + } + + }> 조회 </Button> <Button size="sm" onClick={saveData}>저장</Button> From e332162984c445ceca02129d692be4ebcd2cc10b Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 22:44:31 +0900 Subject: [PATCH 177/259] =?UTF-8?q?=EC=88=98=EC=9A=94=EB=A7=A4=EC=B9=AD=20?= =?UTF-8?q?=EA=B2=80=ED=86=A0=20=EB=B0=8F=20=EC=9D=B4=EB=A0=A5=20=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMat/coMatRvw/page.tsx | 4 +- .../wr/app/matMng/coMat/ruseRvwHstry/page.tsx | 98 ++++++++----- apps/wr/app/store/matDmd/coMatRvw/index.tsx | 28 ++-- apps/wr/app/store/matDmd/coMatRvw/type.tsx | 5 +- .../store/matDmd/ruseRvwHstry/headList.tsx | 2 +- .../app/store/matDmd/ruseRvwHstry/index.tsx | 39 +++-- apps/wr/components/lib/func/commom.tsx | 5 +- .../ui/form/coMat/conCostForm/conCostForm.tsx | 133 +++++++++++------- 8 files changed, 191 insertions(+), 123 deletions(-) diff --git a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx index 0bb06770a..15bff0b32 100644 --- a/apps/wr/app/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/matMng/coMat/coMatRvw/page.tsx @@ -46,7 +46,7 @@ import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/b export default function CoMatRvw() { const { code, coRvw, coMatRvwInit, coMatRvwSearch, coMatRvwInqua } = useWrStore((state) => state); - const { coMatRvwRes } = coRvw; + const { coMatRvwRes,coMatRvwCount } = coRvw; //init, sub, match const initRef = useRef<boolean>(false); const { coRvwHeadList } = coRvw; @@ -276,7 +276,7 @@ export default function CoMatRvw() { tableData={dmdMatData || []} headlist={coRvwHeadList} pageSize={20} - total={100000} + total={coMatRvwCount} cellClick={(index: number | undefined, headId: string) => { if (index !== undefined && index >= 0) { TableCellClick(index); diff --git a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx index 2d339b869..d0a6bcb93 100644 --- a/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx +++ b/apps/wr/app/matMng/coMat/ruseRvwHstry/page.tsx @@ -7,6 +7,7 @@ import { type RvwHistTableType, } from "@/app/store/matDmd/coMatRvw/type"; import { + formatPhoneNumber, getCity, getdmdMatFlag, yearOptions, @@ -43,7 +44,7 @@ export default function RuseRvwHstry() { ruseRvwInqua, ruseRvwComplete, } = useWrStore((state) => state); - const { rvwHistRes, ruseHistHeadList } = ruseHist; + const { rvwHistRes, ruseHistHeadList,rvwHistCount } = ruseHist; const [pageNation, setPageNatiion] = useState<number>(1); const [dmdCoNm, setDmdCoNm] = useState<string>(""); @@ -69,6 +70,36 @@ export default function RuseRvwHstry() { setObjSearch({ city: cityValue, sgg: "0" }); }; + useEffect(() =>{ + getButtonSearch() + },[pageNation]) + + const getButtonSearch=()=>{ + if (fromDate && toDate) { + const fromNum = Number(fromDate); + const toNum = Number(toDate); + if (fromNum > toNum) { + toast.error( + "시작년도가 종료년도 이후로 설정할 수 없습니다." + ); + } else { + let con: string | number = ""; + if (String(objSearch.city).length > 0) { + con = String(objSearch.city); + } + if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") { + con = String(objSearch.sgg); + } + getSearch( + fromNum, + toNum, + con, + dmdCoNm, + ruseUtztnFcltNm + ); + } + } + } const getSgg = (val: string | number) => { console.log(val); setObjSearch({ ...objSearch, sgg: String(val) }); @@ -163,23 +194,29 @@ export default function RuseRvwHstry() { const data = rvwHistRes?.map((item, index) => { let flag = ""; flag = getdmdMatFlag(item.demandMatching?.splyFcltFlg ?? ""); - + const formatDate = (dateStr: string | null | undefined) => { + // null, undefined, 빈 문자열인 경우 '없음'을 반환합니다. + if (!dateStr) return "없음"; + // "YYYYMMDD" 형식으로 날짜를 파싱합니다. + const d = moment(dateStr, "YYYYMMDD"); + // 파싱된 날짜가 유효한 경우에만 포맷하고, 그렇지 않으면 '없음'을 반환합니다. + return d.isValid() ? d.format("YYYY-MM-DD") : "없음"; + }; + return { ...item, ctpvCd: item.demandCo?.ctpvCd, sggCd: item.demandCo?.sggCd, dmdCoNm: item.demandCo?.dmdCoNm, daddr: item.demandCo?.daddr, - telno: item.demandCo?.telno, - regDt: item?.demandCo?.regDt - ? moment(item?.demandCo?.regDt).format("YYYY-MM-DD") - : "없음", - rvwCmptnYmd: item?.rvwCmptnYmd - ? moment(item?.rvwCmptnYmd).format("YYYY-MM-DD") - : "없음", - mtchnCmptnYmd: item?.mtchnCmptnYmd - ? moment(item?.mtchnCmptnYmd).format("YYYY-MM-DD") + telno: formatPhoneNumber(item.demandCo?.telno ||''), + dmndTmng: item?.dmndTmng + ? moment(item?.dmndTmng).format("YYYY-MM-DD") : "없음", + + rvwCmptnYmd: formatDate(item.demandMatching?.rvwCmptnYmd), + mtchnCmptnYmd: formatDate(item.demandMatching?.mtchnCmptnYmd), + ruseUtztnFcltNm: item.ruseUtztnFcltNm, dmndQty: item.dmndQty, splyFcltFlg: flag, @@ -272,30 +309,7 @@ export default function RuseRvwHstry() { <Button size={"sm"} onClick={(e) => { - if (fromDate && toDate) { - const fromNum = Number(fromDate); - const toNum = Number(toDate); - if (fromNum > toNum) { - toast.error( - "시작년도가 종료년도 이후로 설정할 수 없습니다." - ); - } else { - let con: string | number = ""; - if (String(objSearch.city).length > 0) { - con = String(objSearch.city); - } - if (String(objSearch.sgg).length > 0 && objSearch.sgg !== "0") { - con = String(objSearch.sgg); - } - getSearch( - fromNum, - toNum, - con, - dmdCoNm, - ruseUtztnFcltNm - ); - } - } + getButtonSearch() }} > 조회 @@ -318,17 +332,23 @@ export default function RuseRvwHstry() { tableData={rvwHistData || []} headlist={ruseHistHeadList} pageSize={20} - total={100000} + total={rvwHistCount} cellClick={(index: number | undefined, headId: string) => { TableCellClick(index); }} - onPageChange={setPageNatiion} + onPageChange={ + (page)=>{ + setPageNatiion(page) + + } + + } ></UiTable> - <hr /> + {/* <hr /> <h3 className="mt-4 ml-2 text-2xl font-medium text-label"> 수요신청 상세현황 </h3> - <ConCostForm form={form} type={"hist"} /> + <ConCostForm form={form} type={"hist"} selectionVersion={0} /> */} </ListDiv> </div> </div> diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index a1a7c187d..e683b548e 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -6,7 +6,7 @@ import { } from "./headList"; import type { CommonTableProps } from "../../common/type/header"; import type { DedMatUpdateType, DmdCoReqType } from "./type"; -import { fetchType, getFetch, putFectch } from "@/components/lib/api"; +import { fetchType, getFetch, getFetchWithCount, putFectch } from "@/components/lib/api"; import toast from "react-hot-toast"; const coRvwHeadList = coRvwHeadListExport; @@ -21,6 +21,7 @@ export type coRvwState = { coRvwNodeList: CommonTableProps[]; rateFeeHeadList: CommonTableProps[]; constCostHeadList: CommonTableProps[]; + coMatRvwCount:number; }; }; @@ -32,6 +33,7 @@ export const coRvwStateExport: coRvwState = { coRvwNodeList: coRvwNodeList, rateFeeHeadList: rateFeeHeadList, constCostHeadList: constCostHeadList, + coMatRvwCount:1 }, }; @@ -72,8 +74,8 @@ const coMatInit = async ( startYear: string, endYear: string ) => { - const url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; - const coMatRvwRes = await getFetch(fetchType.WR, url); + const url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + const coMatRvwRes = await getFetchWithCount(fetchType.WR, url); return coMatRvwRes; }; @@ -93,7 +95,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { coRvw: { ...state.coRvw, init: false, - coMatRvwRes: coMatRvwRes, + coMatRvwRes: coMatRvwRes.data, + coMatRvwCount:coMatRvwRes.count }, })); }, @@ -119,7 +122,8 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { ...state, coRvw: { ...state.coRvw, - coMatRvwRes: coMatRvwRes, + coMatRvwRes: coMatRvwRes.data, + coMatRvwCount:coMatRvwRes.count, init: false, }, })); @@ -138,7 +142,7 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { sggCd: string, dmdCoNm: string ) => { - let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; if (sggCd.length > 0) { url += `/${sggCd}`; @@ -152,13 +156,14 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { } console.log(" url ", url); - const coMatRvwRes = await getFetch(fetchType.WR, url); + const coMatRvwRes = await getFetchWithCount(fetchType.WR, url); return set((state: coRvwState) => ({ ...state, coRvw: { ...state.coRvw, - coMatRvwRes: coMatRvwRes, + coMatRvwRes: coMatRvwRes.data, + coMatRvwCount:coMatRvwRes.count, }, })); }, @@ -170,18 +175,19 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { sggCd: string ) => { try { - let url = `/reuseFc/request/infoList/sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + let url = `/reuseFc/request/infoList/Sub/${pageNo}/${pageCnt}/${startYear}/${endYear}`; if (sggCd.length > 0) { url += `/${sggCd}/0`; } else if (sggCd === "0") { url += `/0/0`; } - const coMatRvwRes = await getFetch(fetchType.WR, url); + const coMatRvwRes = await getFetchWithCount(fetchType.WR, url); return set((state: coRvwState) => ({ ...state, coRvw: { ...state.coRvw, - coMatRvwRes: coMatRvwRes, + coMatRvwRes: coMatRvwRes.data, + coMatRvwCount:coMatRvwRes.count, }, })); } catch (e) { diff --git a/apps/wr/app/store/matDmd/coMatRvw/type.tsx b/apps/wr/app/store/matDmd/coMatRvw/type.tsx index 9b2e65cc4..2121c49fe 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/type.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/type.tsx @@ -19,8 +19,6 @@ const DemandInfoSchema = z.object({ cdtnv: z.number().nullish(), rmrk: z.string().nullish(), useUsgCd: z.string().nullish(), - mtchnCmptnYmd: z.string().nullish(), - rvwCmptnYmd: z.string().nullish(), }); const DemandMatchingSchema = z.object({ @@ -35,6 +33,8 @@ const DemandMatchingSchema = z.object({ useUsgCd: z.string().nullish(), dmdInfoSn: z.number().nullish(), splyCndtList: z.array(z.string().nullish()).nullish(), + mtchnCmptnYmd: z.string().nullish(), + rvwCmptnYmd: z.string().nullish(), }); const DemandCoSchema = z.object({ @@ -114,6 +114,7 @@ export type DedMatUpdateType = { fcltSbsdCstrnCst: number; prcsFcltCpctCstrnCst: number; rgtr: string; + flg?:string; }; export type RvwHistTableType = { diff --git a/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx b/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx index 90c793c2f..a90f5831b 100644 --- a/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx +++ b/apps/wr/app/store/matDmd/ruseRvwHstry/headList.tsx @@ -28,7 +28,7 @@ export const ruseHstryHeadListExport:TableUpperProps[]= [ visible: true, }, { - id: "regDt", //바꾸기 + id: "dmndTmng", //바꾸기 title: "신청일자", visible: true, }, diff --git a/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx b/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx index 3338bc467..cfd991b4d 100644 --- a/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx +++ b/apps/wr/app/store/matDmd/ruseRvwHstry/index.tsx @@ -5,7 +5,7 @@ import type { TableUpperProps, } from "../../common/type/header"; import { ruseHstryHeadListExport } from "./headList"; -import { fetchType, getFetch, postFectch, putFectch } from "@/components/lib/api"; +import { fetchType, getFetch, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api"; import type { DmdCoReqType } from "../coMatRvw/type"; import toast from "react-hot-toast"; import { TEST_UUID } from "../../ruseFcltMng/fcltReg/rainReg"; @@ -16,6 +16,7 @@ export type ruseHstryState = { ruseHist: { isInit: boolean; rvwHistRes: DmdCoReqType[]; + rvwHistCount:number; ruseHistHeadList: TableUpperProps[]; }; }; @@ -25,6 +26,7 @@ export const ruseHstryStateExport: ruseHstryState = { isInit: false, rvwHistRes: [], ruseHistHeadList: ruseHistHeadList, + rvwHistCount:1, }, }; @@ -79,14 +81,14 @@ const irvwHistInit = async ( startYear: string, endYear: string, ) => { - let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`; // console.log("sggCd ", sggCd); // if (sggCd) { // url += `/${sggCd}`; // } - const rvwHistRes = await getFetch(fetchType.WR, url); + const rvwHistRes = await getFetchWithCount(fetchType.WR, url); return rvwHistRes; }; @@ -115,7 +117,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( ruseHist: { ...state.ruseHist, init: false, - rvwHistRes: rvwHistRes, + rvwHistRes: rvwHistRes.data, + rvwHistCount:rvwHistRes.count }, })); }, @@ -140,8 +143,8 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( ruseHist: { ...state.ruseHist, init: false, - rvwHistRes: rvwHistRes, - }, + rvwHistRes: rvwHistRes.data, + rvwHistCount:rvwHistRes.count }, })); } } catch (e) { @@ -158,7 +161,7 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( dmdCoNm: string, ruseUtztnFcltNm: string ) => { - let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`; if (sggCd.length > 0) { url += `/${sggCd}`; @@ -175,14 +178,14 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( } else { url += `/0`; } - const rvwHistRes = await getFetch(fetchType.WR, url); + const rvwHistRes = await getFetchWithCount(fetchType.WR, url); return set((state: ruseHstryState) => ({ ...state, ruseHist: { ...state.ruseHist, - rvwHistRes: rvwHistRes, - }, + rvwHistRes: rvwHistRes.data, + rvwHistCount:rvwHistRes.count }, })); }, ruseRvwInqua: async ( @@ -193,16 +196,17 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( sggCd: string ) => { try { - let url = `/reuseFc/request/infoList/matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`; + let url = `/reuseFc/request/infoList/Matched/${pageNo}/${pageCnt}/${startYear}/${endYear}`; if (sggCd.length > 0) { url += `/${sggCd}/0`; } - const rvwHistRes = await getFetch(fetchType.WR, url); + const rvwHistRes = await getFetchWithCount(fetchType.WR, url); return set((state: ruseHstryState) => ({ ...state, ruseHist: { ...state.ruseHist, - rvwHistRes: rvwHistRes, + rvwHistRes: rvwHistRes.data, + rvwHistCount:rvwHistRes.count }, })); } catch (e) { @@ -224,6 +228,15 @@ export const ruseHstryActionsExport: (set: any) => ruseHstryActions = ( new Date().getFullYear().toString(), new Date().getFullYear().toString(), ); + + return set((state: ruseHstryState) => ({ + ...state, + ruseHist: { + ...state.ruseHist, + rvwHistRes: rvwHistRes.data, + rvwHistCount:rvwHistRes.count + }, + })); } } catch (e) { console.log(" error ", e); diff --git a/apps/wr/components/lib/func/commom.tsx b/apps/wr/components/lib/func/commom.tsx index 6b253bdba..7d8c2ffcc 100644 --- a/apps/wr/components/lib/func/commom.tsx +++ b/apps/wr/components/lib/func/commom.tsx @@ -169,12 +169,13 @@ export const getdmdMatFlag = (flag: string | undefined | null) => { const cleanFlag = (flag ?? "").trim(); - console.log('cleanFlag ', cleanFlag) switch (cleanFlag) { case "Sub": return "검토"; - case "matched": + case "Matched": return "매칭완료"; + case "Checked": + return '검토완료'; default: return "신청"; } diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index f50474d79..bb70cb7ec 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -22,8 +22,7 @@ import { UiTable, } from "@common/business_components/ui"; import PopoverUi from "@common/business_components/ui/popover_ui"; -import { Button, Input, Label } from "@common/components/ui"; -import type { read } from "fs"; +import { Button, Checkbox, Input, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import { type UseFormReturn } from "react-hook-form"; import toast from "react-hot-toast"; @@ -48,6 +47,8 @@ export default function ConCostForm({ const ref = useRef<boolean>(false); + const [checkFinish, setCheckFinish] = useState<boolean>(false); + useEffect(() => { if (!ref.current) { const currentYear = new Date().getFullYear(); @@ -57,6 +58,13 @@ export default function ConCostForm({ } }, [ref, getConstCostFee, getRateFee]); + + useEffect(() => { + // 다른 행을 선택하면(selectionVersion 변경) 체크박스 상태를 초기화합니다. + setCheckFinish(false); + }, [selectionVersion]); + + const zipDowonLoad = () => { fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => { const blobRet = await response.blob(); @@ -74,36 +82,38 @@ export default function ConCostForm({ const cstrnCst = form.watch("demandCst.cstrnCst"); const useUsgCdWatch = form.watch("useUsgCd"); - - const calculateConstCost = useCallback(() => { const usgPrcsProcs = usgPrcsProcsWatch; - if(!dmndQtyWatch){ - toast.error('요구수량(M3/d)을 확인해주세요 계산할수 없습니다. ') - return + if (!dmndQtyWatch) { + toast.error("요구수량(M3/d)을 확인해주세요 계산할수 없습니다. "); + return; + } + if (usgPrcsProcs === null || usgPrcsProcs === undefined) { + toast.error( + "용도에 따른 처리공정을 확인할수 없습니다. 용도를 확인해주세요. " + ); + return; } - if(usgPrcsProcs === null || usgPrcsProcs === undefined){ - toast.error('용도에 따른 처리공정을 확인할수 없습니다. 용도를 확인해주세요. ') - return - } const dmndQtyYear = dmndQtyWatch * 365; if (usgPrcsProcs && usgPrcsProcs?.length > 0) { - const firstProc = getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; - const secondProc = getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || ""; + const firstProc = + getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; + const secondProc = + getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || ""; const { lower: firstLower, upper: firstUpper } = findBounds( constCostRes, firstProc || "", - 'fctCd', - 'fctCpc', + "fctCd", + "fctCpc", Number(dmndQtyYear) ); const { lower: secondLower, upper: secondUpper } = findBounds( constCostRes, secondProc || "", - 'fctCd', - 'fctCpc', + "fctCd", + "fctCpc", Number(dmndQtyYear) ); @@ -122,52 +132,56 @@ export default function ConCostForm({ const groupCodes = ["BD", "CE", "SE", "WD"]; const groupedBounds: { [key: string]: { lower?: any; upper?: any } } = {}; for (const code of groupCodes) { - - groupedBounds[code] = findBounds(rateFeeRes, code, 'incExpCd', 'stdCost',result); + groupedBounds[code] = findBounds( + rateFeeRes, + code, + "incExpCd", + "stdCost", + result + ); } const resultRate = transformAndInterpolate(groupedBounds, result); - const fcltSbsdCstrnCst = (result* (resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD) / 100); + const fcltSbsdCstrnCst = + (result * + (resultRate.BD + resultRate.CE + resultRate.SE + resultRate.WD)) / + 100; const realResult = result + fcltSbsdCstrnCst; - form.setValue("demandCst.prcsFcltCpctCstrnCst", Math.round(result) ); - form.setValue("demandCst.fcltSbsdCstrnCst", Math.round(fcltSbsdCstrnCst)) ; - form.setValue("totalConstCost", Math.round(realResult)); + form.setValue("demandCst.prcsFcltCpctCstrnCst", Math.round(result)); + form.setValue("demandCst.fcltSbsdCstrnCst", Math.round(fcltSbsdCstrnCst)); + form.setValue("totalConstCost", Math.round(realResult)); } }, [constCostRes, rateFeeRes, usgPrcsProcsWatch, dmndQtyWatch]); const onSubmit = (value: DmdCoReqType) => { - - if(value.demandCst&& !value.demandCst.prcsFcltCpctCstrnCst ){ - toast.error('공사비 계산 진행 후 저장을 눌러주새요') - return + if (value.demandCst && !value.demandCst.prcsFcltCpctCstrnCst) { + toast.error("공사비 계산 진행 후 저장을 눌러주새요"); + return; } if (type === "mat") { - - if(value.demandCst ){ + if (value.demandCst) { const data: DedMatUpdateType = { dmdInfoSn: value.dmdInfoSn, - usgPrcsProcs: value.demandCst.usgPrcsProcs|| "", - cstrnCst: value.demandCst.cstrnCst ||0, - fcltSbsdCstrnCst: value.demandCst.fcltSbsdCstrnCst ||0, - prcsFcltCpctCstrnCst: value.demandCst.prcsFcltCpctCstrnCst ||0, + usgPrcsProcs: value.demandCst.usgPrcsProcs || "", + cstrnCst: value.demandCst.cstrnCst || 0, + fcltSbsdCstrnCst: value.demandCst.fcltSbsdCstrnCst || 0, + prcsFcltCpctCstrnCst: value.demandCst.prcsFcltCpctCstrnCst || 0, + flg: checkFinish?'Checked':'Sub', rgtr: TEST_UUID, }; - coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); } } else if (type === "hist") { - - delete value.totalConstCost - delete value.ruseUtztnFcltNm - + delete value.totalConstCost; + delete value.ruseUtztnFcltNm; ruseRvwCalUpdate(value); } }; useEffect(() => { - console.log(" form ", form.formState.errors); + console.log(" form ", form.formState.errors); }, [form.formState]); - useEffect(() => { form.register("dmdInfoSn"); form.register("dmdInfoFk"); @@ -187,18 +201,30 @@ export default function ConCostForm({ <Button className="mx-3" size={"sm"} onClick={calculateConstCost}> 계산 </Button> - <Button className="mr-3" size={"sm"} onClick={form.handleSubmit(onSubmit)}> + <Button + className="mr-3" + size={"sm"} + onClick={form.handleSubmit(onSubmit)} + > 저장 </Button> - <Label>관로 표준공사비 산정 프로그램</Label> - <Button - color="green" - size={"sm"} - onClick={zipDowonLoad} - className="bg-none ml-6" - > - 다운로드 - </Button> + <Label>검토완료</Label> + <Checkbox + className="ml-3 mr-6" + checked={checkFinish} + onCheckedChange={(checked) => + // 'indeterminate' 상태를 무시하고 순수 boolean 값으로만 상태를 업데이트합니다. + setCheckFinish(checked === true)} + ></Checkbox> + <Label>관로 표준공사비 산정 프로그램</Label> + <Button + color="green" + size={"sm"} + onClick={zipDowonLoad} + className="bg-none ml-6" + > + 다운로드 + </Button> </div> <div className="col-span-12 w-full"> <h1 className={formH1Class}>기본사항</h1> @@ -310,14 +336,14 @@ export default function ConCostForm({ <h1 className={formH1Class}>공사비 입력사항</h1> </div> - <div className="col-span-2 mt-4"> <div className="flex items-center justify-between"> <PopoverUi childrenTriger={ <> <Label className="underline"> - 처리시설용량에 따른 공사비(백만원) <i className="diveicon di-search" /> + 처리시설용량에 따른 공사비(백만원){" "} + <i className="diveicon di-search" /> </Label> </> } @@ -394,7 +420,8 @@ export default function ConCostForm({ childrenTriger={ <> <Label className="underline"> - 처리시설 총사업비(백만원) <i className="diveicon di-search" /> + 처리시설 총사업비(백만원){" "} + <i className="diveicon di-search" /> </Label> </> } From fb8812303baa27bf0f38fb3b60da43a8ab716e25 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Sun, 6 Jul 2025 23:01:04 +0900 Subject: [PATCH 178/259] =?UTF-8?q?=EA=B2=80=ED=86=A0=EC=99=84=EB=A3=8C=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/store/matDmd/coMatRvw/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/wr/app/store/matDmd/coMatRvw/index.tsx b/apps/wr/app/store/matDmd/coMatRvw/index.tsx index e683b548e..21239fce3 100644 --- a/apps/wr/app/store/matDmd/coMatRvw/index.tsx +++ b/apps/wr/app/store/matDmd/coMatRvw/index.tsx @@ -111,7 +111,14 @@ export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => { data ); if (response.status === 200) { + + if(data.flg ==='Sub'){ + toast.success("매칭 검토로 저장되었습니다."); + }else{ + toast.success("매칭 검토완료로 저장되었습니다."); + } + const coMatRvwRes = await coMatInit( 1, 10, From c79b4ca18d59746941c70b6f0122d24393086fd7 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Mon, 7 Jul 2025 09:19:37 +0900 Subject: [PATCH 179/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=9E=AC=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=EC=8B=A4=EC=A0=81=20=ED=98=84=ED=99=A9=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 121 +++++++++--------- .../prfmncSttn/pbnstPrfmncSttn/index.tsx | 34 ++--- 2 files changed, 77 insertions(+), 78 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index f689eb745..3e860d744 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -68,8 +68,6 @@ export default function PbnstPrfmncSttn() { chartData5: lineChartDataProps[]; chartData6: lineChartDataProps[]; chartData7: lineChartDataProps[]; - chartData8: lineChartDataProps[]; - chartData9: lineChartDataProps[]; }>(); const [outLineData, setOutLineData] = useState<{ chartData1: lineChartDataProps[]; @@ -78,6 +76,8 @@ export default function PbnstPrfmncSttn() { chartData4: lineChartDataProps[]; chartData5: lineChartDataProps[]; chartData6: lineChartDataProps[]; + chartData7: lineChartDataProps[]; + chartData8: lineChartDataProps[]; }>(); type dnChartForm = { label: string, val: number, fill?: string }; @@ -228,16 +228,18 @@ export default function PbnstPrfmncSttn() { indstUswtr += element.indstUswtr; // 월별 합계 - inUsageSum = element.wshwtr + inUsageSum = + element.wshwtr + element.coolUswtr + element.cleanUswtr + element.drwtUswtr + element.dltnUswtr + element.ithlRswtr + element.ithlEtcUswtr - + element.cleanToilUswtr - + element.resn; - outUsageSum = element.lndwtr + outUsageSum = + element.cleanToilUswtr + + element.resn + + element.lndwtr + element.hydUswtr + element.ugwtChr + element.farmUswtr @@ -258,9 +260,10 @@ export default function PbnstPrfmncSttn() { dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "purple" }); ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "green" }); ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "blue" }); + + cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "magenta" }); resnData.push({ label: `${month}월`, val: element.resn, color: "skyblue" }); - lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }); hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "orange" }); ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "yellow" }); @@ -271,22 +274,18 @@ export default function PbnstPrfmncSttn() { } }); + let dnTotalIn = 0; + let dnTotalOut = 0; + inUsageArr.forEach((item) => { + dnTotalIn += item + }) + outUsageArr.forEach((item) => { + dnTotalOut += item + }) + // 도넛차트 데이터 - dnData.push({ label: "세척수", val: wshwtr, fill: "#F7CFD8" }); - dnData.push({ label: "냉각수", val: coolUswtr, fill: "#F4F8D3" }); - dnData.push({ label: "청소수", val: cleanUswtr, fill: "#A6D6D6" }); - dnData.push({ label: "식수대", val: drwtUswtr, fill: "#8E7DBE" }); - dnData.push({ label: "희석용수", val: dltnUswtr, fill: "#FF8383" }); - dnData.push({ label: "중수도", val: ithlRswtr, fill: "#FFF574" }); - dnData.push({ label: "기타", val: ithlEtcUswtr, fill: "#A1D6CB" }); - dnData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); - dnData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); - dnData.push({ label: "조경용수", val: lndwtr, fill: "#81BFDA" }); - dnData.push({ label: "친수용수", val: hydUswtr, fill: "#F5F0CD" }); - dnData.push({ label: "지하수충전", val: ugwtChr, fill: "#FADA7A" }); - dnData.push({ label: "농업용수", val: farmUswtr, fill: "#A6AEBF" }); - dnData.push({ label: "하천등유지용수", val: rvrKeepUswtr, fill: "#C5D3E8" }); - dnData.push({ label: "공업용수", val: indstUswtr, fill: "#D0E8C5" }); + dnData.push({ label: "장내용수", val: dnTotalIn, fill: "#8DD8FF" }); + dnData.push({ label: "장외용수", val: dnTotalOut, fill: "#FFF085" }); // 장내용수 도넛 dnInData.push({ label: "세척수", val: wshwtr, fill: "#F7CFD8" }); @@ -296,10 +295,10 @@ export default function PbnstPrfmncSttn() { dnInData.push({ label: "희석용수", val: dltnUswtr, fill: "#FF8383" }); dnInData.push({ label: "중수도", val: ithlRswtr, fill: "#FFF574" }); dnInData.push({ label: "기타", val: ithlEtcUswtr, fill: "#A1D6CB" }); - dnInData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); - dnInData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); // 장외용수 도넛 + dnOutData.push({ label: "청소화장실용수", val: cleanToilUswtr, fill: "#A19AD3" }); + dnOutData.push({ label: "세척살수용수", val: resn, fill: "#B1F0F7" }); dnOutData.push({ label: "조경용수", val: lndwtr, fill: "#81BFDA" }); dnOutData.push({ label: "친수용수", val: hydUswtr, fill: "#F5F0CD" }); dnOutData.push({ label: "지하수충전", val: ugwtChr, fill: "#FADA7A" }); @@ -315,17 +314,17 @@ export default function PbnstPrfmncSttn() { chartData4: drwtUswtrData, chartData5: dltnUswtrData, chartData6: ithlRswtrData, - chartData7: ithlEtcUswtrData, - chartData8: cleanToilUswtrData, - chartData9: resnData + chartData7: ithlEtcUswtrData }); setOutLineData({ - chartData1: lndwtrData, - chartData2: hydUswtrData, - chartData3: ugwtChrData, - chartData4: farmUswtrData, - chartData5: rvrKeepUswtrData, - chartData6: indstUswtrData, + chartData1: cleanToilUswtrData, + chartData2: resnData, + chartData3: lndwtrData, + chartData4: hydUswtrData, + chartData5: ugwtChrData, + chartData6: farmUswtrData, + chartData7: rvrKeepUswtrData, + chartData8: indstUswtrData, }); setBarData(barData); setChartData(dnData); @@ -408,15 +407,7 @@ export default function PbnstPrfmncSttn() { chartData7: { label: '기타', color: "blue", - }, - chartData8: { - label: '청소화장실용수', - color: "magenta", - }, - chartData9: { - label: '세척살수용수', - color: "skyblue", - }, + } } satisfies ChartConfig; setLnInChartConfig(newChartConfig); } @@ -427,26 +418,34 @@ export default function PbnstPrfmncSttn() { if (outLineData?.chartData1) { const newChartConfig = { chartData1: { - label: '조경용수', + label: '청소화장실용수', color: "red", }, chartData2: { + label: '세척살수용수', + color: "pink", + }, + chartData3: { + label: '조경용수', + color: "gray", + }, + chartData4: { label: '친수용수', color: "orange", }, - chartData3: { + chartData5: { label: '지하수충전', color: "yellow", }, - chartData4: { + chartData6: { label: '농업용수', color: "green", }, - chartData5: { + chartData7: { label: '하천등유지용수', color: "blue", }, - chartData6: { + chartData8: { label: '공업용수', color: "purple", }, @@ -615,7 +614,7 @@ export default function PbnstPrfmncSttn() { <h1 className="">장내·외 월별 하수재이용실적 현황</h1> <div className="flex"> <div className="w-1/3"> - <MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} /> + <MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} /> </div> <div className="w-1/3"> <MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적"} chartForm={CHART_FORM.LINE} /> @@ -627,25 +626,25 @@ export default function PbnstPrfmncSttn() { <h1 className="">하수재이용실적 현황</h1> <ListDiv className="col-span-8 pr-6 "> {/* <ScrollArea className="h-[60vh]"> */} - {/* <div className="card-header"> + {/* <div className="card-header"> <h3 className="text-2xl font-medium text-label"> {"하수처리수재이용 실적(m3) 등록결과"} </h3> </div> */} - <UiTable - headName={undefined} - tableData={prfData || []} - headlist={monthHeadList} - pageSize={0} - total={0} - cellClick={undefined} - onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}> - </UiTable> + <UiTable + headName={undefined} + tableData={prfData || []} + headlist={monthHeadList} + pageSize={0} + total={0} + cellClick={undefined} + onPageChange={function (page: number): void { + throw new Error("Function not implemented."); + }}> + </UiTable> - {/* <ListDiv className="col-span-8 pr-6 "> + {/* <ListDiv className="col-span-8 pr-6 "> <ScrollArea className="h-[60vh]"> <div className="card-header"> <h3 className="text-2xl font-medium text-label"> diff --git a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx index b513085ae..db8b6a717 100644 --- a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx @@ -148,7 +148,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions let usageSum = 0; let year = ""; const yearsData = [] - + res.data.forEach((item) => { if (item.prfList.length === 0) { const year = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출 @@ -161,26 +161,26 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions item.prfList.forEach((acc) => { year = acc.ym?.substring(0, 4) ?? ""; inUsageSum = - (acc.wshwtr ?? 0) + - (acc.coolUswtr ?? 0) + - (acc.cleanUswtr ?? 0) + - (acc.drwtUswtr ?? 0) + - (acc.dltnUswtr ?? 0) + - (acc.ithlRswtr ?? 0) + - (acc.ithlEtcUswtr ?? 0) + - (acc.cleanToilUswtr ?? 0) + - (acc.resn ?? 0); + (acc.wshwtr ?? 0) + //조경용수 + (acc.coolUswtr ?? 0) + //냉각수 + (acc.cleanUswtr ?? 0) + //청소수 + (acc.drwtUswtr ?? 0) + //식수대 + (acc.dltnUswtr ?? 0) + //희석용수 + (acc.ithlRswtr ?? 0) + //중수도 + (acc.ithlEtcUswtr ?? 0) //기타 outUsageSum = - (acc.lndwtr ?? 0) + - (acc.hydUswtr ?? 0) + - (acc.ugwtChr ?? 0) + - (acc.farmUswtr ?? 0) + - (acc.rvrKeepUswtr ?? 0) + - (acc.indstUswtr ?? 0); + (acc.cleanToilUswtr ?? 0) + //청소화장실용수 + (acc.resn ?? 0)+ //세척살수용도 + (acc.lndwtr ?? 0) + //조경용수 + (acc.hydUswtr ?? 0) + //친수용수 + (acc.ugwtChr ?? 0) + //지하수충전 + (acc.farmUswtr ?? 0) + //농업용수 + (acc.rvrKeepUswtr ?? 0) + //하천등유지용수 + (acc.indstUswtr ?? 0); //공업용수 const yearData = yearsData.find( (yearItem) => yearItem.year === year && - yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltPk + yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltFk ); if (yearData) { From c5d2cc53a4883aacb6fdd5349c134d4fe9aba25e Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Mon, 7 Jul 2025 09:26:37 +0900 Subject: [PATCH 180/259] =?UTF-8?q?=EA=B2=80=ED=86=A0=EC=99=84=EB=A3=8C=20?= =?UTF-8?q?=EC=8B=9C=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=ED=91=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/form/coMat/conCostForm/conCostForm.tsx | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx index bb70cb7ec..ee06893c9 100644 --- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx +++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx @@ -65,6 +65,31 @@ export default function ConCostForm({ }, [selectionVersion]); + const confrirmToast = () => { + + if (checkFinish) { + toast((t) => ( + <span className="flex flex-col items-center"> + 검토완료 변경시 공사비는 변경할수 없습니다. + <br /> + 진행하시겠습니까? + <Button + onClick={() => { + toast.dismiss(t.id); + + + }} + > + 확인 + </Button> + <Button onClick={() => toast.dismiss(t.id)}>취소</Button> + </span> + )); + } else { + + } + }; + const zipDowonLoad = () => { fetch(`/2024_constarctFeeProgram.zip`, {}).then(async (response) => { const blobRet = await response.blob(); @@ -168,12 +193,36 @@ export default function ConCostForm({ flg: checkFinish?'Checked':'Sub', rgtr: TEST_UUID, }; - coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + if (checkFinish) { + toast((t) => ( + <span className="flex flex-col items-center text-2xl" > + 검토완료 변경시 공사비는 변경할수 없습니다. + <br /> + 진행하시겠습니까? + <div className="flex gap-2 mt-2"> + <Button + size='sm' + + onClick={() => { + toast.dismiss(t.id); + coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + }} + > + 확인 + </Button> + <Button + size='sm' + onClick={() => toast.dismiss(t.id)}>취소</Button> + </div> + </span> + )); + } else { + coMatRvwUpdate("11000SW001R1", form.getValues("dmdInfoFk"), data); + } } } else if (type === "hist") { delete value.totalConstCost; delete value.ruseUtztnFcltNm; - ruseRvwCalUpdate(value); } }; From abda62eebb642e6a9f611ee954f6d630f23b3610 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Mon, 7 Jul 2025 09:28:45 +0900 Subject: [PATCH 181/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/chart/DoubleBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/chart/DoubleBar.tsx b/packages/common/business_components/src/ui/chart/DoubleBar.tsx index b201b3bf9..c52937967 100644 --- a/packages/common/business_components/src/ui/chart/DoubleBar.tsx +++ b/packages/common/business_components/src/ui/chart/DoubleBar.tsx @@ -89,7 +89,7 @@ const CustomTooltip = ({ ))} </div> ); -};*/ +};*/ const CustomLegend = (props: any) => { const { payload } = props; if (!payload) return null; From ab13d1436142fe892bfc20362385bed6ae75474f Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Mon, 7 Jul 2025 09:32:43 +0900 Subject: [PATCH 182/259] =?UTF-8?q?=EB=8D=94=EB=B8=94=EB=B0=94=20=EC=B0=A8?= =?UTF-8?q?=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/chart/DoubleBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/chart/DoubleBar.tsx b/packages/common/business_components/src/ui/chart/DoubleBar.tsx index c52937967..b201b3bf9 100644 --- a/packages/common/business_components/src/ui/chart/DoubleBar.tsx +++ b/packages/common/business_components/src/ui/chart/DoubleBar.tsx @@ -89,7 +89,7 @@ const CustomTooltip = ({ ))} </div> ); -};*/ +};*/ const CustomLegend = (props: any) => { const { payload } = props; if (!payload) return null; From 11f1c75ac4f5379dbb20245084530bfd094ea282 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Mon, 7 Jul 2025 10:14:11 +0900 Subject: [PATCH 183/259] =?UTF-8?q?searchview=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/map/Gis.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index fa1cf7ab4..6e13d70c5 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -18,7 +18,7 @@ import GisApp from './lib/gis.core'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); -function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = false, isMiniMap = false, setIsOpen, setFeatureData, featureData, searchView : SearchView, detailView: DetailView, onFeatureSelect, setIsSearchModalOpen }) { +function Gis({ isOpen, gisMaps, isSearchModalOpen, treeData = [], isSearch = false, isMiniMap = false, setIsOpen, setFeatureData, featureData, searchView: SearchView, detailView: DetailView, onFeatureSelect, setIsSearchModalOpen }) { const mapRef = useRef(); const [mapObject, setMapObject] = useState({}); const [tabVisible, setTabVisible] = useState(true); @@ -133,7 +133,7 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa gisMaps.current = map //미니맵 - if(isMiniMap){ + if (isMiniMap) { const overviewMap = new OverviewMap({ layers: [GisApp.Module.core.baseMiniMapLayers['base']], view: new View({ @@ -199,9 +199,9 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa <div className="h-[calc(100vh-10rem)] flex relative"> <div ref={mapRef} className="gis-map flex-1 relative" style={{ height: '100%', padding: 0 }} /> <GisTree visible={tabVisible} setVisible={setTabVisible} /> - + {/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */} - + {/* isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} {isOpen && featureData && !isSearchModalOpen && ( <DetailView @@ -209,14 +209,16 @@ function Gis({ isOpen , gisMaps, isSearchModalOpen, treeData = [], isSearch = fa onClose={closePopup} // 닫기 콜백 전달 /> )} + {SearchView &&( <SearchView open={isSearchModalOpen} onOpenChange={setIsSearchModalOpen} onFeatureSelect={onFeatureSelect} /> - <GisLonLat/> - <GisToolBar/> - <GisMapToggle/> + )} + <GisLonLat /> + <GisToolBar /> + <GisMapToggle /> <GisSelect onFeatureSelect={onFeatureSelect} /> </div> From cbb41bb200d06ff29dbe440f0fcc7d5e94a6ae93 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Mon, 7 Jul 2025 10:15:09 +0900 Subject: [PATCH 184/259] =?UTF-8?q?=EC=97=91=EC=85=80=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EB=B3=80=EC=88=98=EB=AA=85=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx b/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx index ebbaa8b7a..bb0c18d6a 100644 --- a/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx +++ b/apps/wr/app/store/matDmd/ruseCaseMng/excel.tsx @@ -11,7 +11,7 @@ type nameMap = { export const reUseCaseNames: nameMap = { "사업명": "ruseBizNm", "사업시작일": "bizBgngDate", - "사업종료일": "bizEndtDate", + "사업종료일": "bizEndDate", "공급처_시설종류": "splyFcltKnd", "공급처명": "splyFcltNm", "공급처_시설용량(㎥/일)": "splyFcltCpct", From 051c158e22777b2cb9c48c10b4f39e7687f9d71d Mon Sep 17 00:00:00 2001 From: truthwing <truthplumage@gmail.com> Date: Mon, 7 Jul 2025 10:24:11 +0900 Subject: [PATCH 185/259] =?UTF-8?q?=EB=8F=84=EB=84=9B=20=EB=B0=8F=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B8=20=EC=B0=A8=ED=8A=B8=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/DoughnutChart.tsx | 61 ++++++++++++++++++- .../src/ui/chart/LineChart.tsx | 58 +++++++++++++++++- 2 files changed, 115 insertions(+), 4 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx index 39dee3d9e..99395267a 100644 --- a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx +++ b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx @@ -48,6 +48,7 @@ type LegendProps = { }; /** 차트 기본 스타일 */ +/* const customStyles = { legendContainer: { display: "flex", @@ -58,6 +59,23 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +/** 차트 기본 스타일 (라인차트와 동일하게) */ +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", // 여러 줄로 자동 줄바꿈 + justifyContent: "center", + alignItems: "center", + gap: "12px", // 아이템 간 간격 + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", // 범례 영역 높이 통일 + } as CSSProperties, +}; // 커스텀 툴팁 const CustomTooltip = ({ active, payload, label }: { @@ -82,6 +100,7 @@ const CustomTooltip = ({ active, payload, label }: { }; // 커스텀 범례 +/* const CustomLegend = (props: LegendProps) => { const { payload } = props; if (!payload) return null; @@ -97,12 +116,52 @@ const CustomLegend = (props: LegendProps) => { </div> ); }; +*/ + +const CustomLegend = (props: LegendProps) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: LegendEntry, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.fill, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}> + {entry.payload?.label || entry.value} + </span> + </div> + ))} + </div> + ); +}; export default function DoughnutChart(props: { chartConfig: any; chartData: ChartDataItem[] | undefined; chartTitle: string }) { + const legendData = props.chartData?.map(item => ({ + value: item.label, + fill: props.chartConfig?.[item.label]?.fill || 'blue', + })) ?? []; return ( <Card className="flex flex-col"> <CardContent className="flex-1 pb-0"> @@ -130,9 +189,9 @@ export default function DoughnutChart(props: { nameKey="label" innerRadius={60} /> - <CustomLegend /> </PieChart> </ChartContainer> + <CustomLegend payload={legendData} /> </div> </CardContent> </Card> diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 4014702b6..23570912d 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -1,11 +1,11 @@ "use client" import type { CSSProperties } from "react"; import { CartesianGrid, Legend, Line, LineChart, Tooltip, XAxis, YAxis } from "recharts"; +import type { ContentType } from "recharts/types/component/DefaultLegendContent"; import { ChartContainer, type ChartConfig } from "./lib/chart"; -import type { ContentType } from "recharts/types/component/DefaultLegendContent"; type LineChartProps = { chartConfig: ChartConfig | undefined; @@ -18,6 +18,7 @@ type LineChartProps = { } /** 차트 기본 스타일 */ +/* const customStyles = { legendContainer: { display: "flex", @@ -28,6 +29,23 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +/** 차트 기본 스타일 */ +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", + justifyContent: "center", + alignItems: "center", + gap: "12px", + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", + } as CSSProperties, +}; type LegendEntry = { value: string; @@ -60,7 +78,7 @@ const CustomTooltip = ({ active, payload, label }: { active?: boolean; payload?: }; // 커스텀 범례 (글씨 크기 키우기 + 스타일 추가) -const CustomLegend = (props: LegendProps) => { +/*const CustomLegend = (props: LegendProps) => { const { payload } = props; if (!payload) return null; @@ -74,6 +92,40 @@ const CustomLegend = (props: LegendProps) => { ))} </div> ); +};*/ + +// 커스텀 범례 (도넛차트와 동일하게) +const CustomLegend = (props: LegendProps) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: LegendEntry, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.color, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}>{entry.value}</span> + </div> + ))} + </div> + ); }; type DataType = {label: string; val: string}; @@ -141,7 +193,7 @@ export default function Linechart({ > <CartesianGrid vertical={false} /> <XAxis dataKey="label" fontSize="8px" fontWeight="bold" /> - <YAxis yAxisId="left" className="text-[12px] font-bold" domain={[0, Math.ceil(lineMaxValue * 1.1)]} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> + <YAxis yAxisId="left" className="text-[12px] font-bold" tickFormatter={(value) => value.toLocaleString()} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> <Tooltip content={<CustomTooltip />} /> {showLegend && <Legend content={CustomLegend as ContentType}/>} {Object.keys(chartData).map((key) => { From d842ac599e9f16b786e05ab692d8067a8d94a8ff Mon Sep 17 00:00:00 2001 From: truthwing <truthplumage@gmail.com> Date: Mon, 7 Jul 2025 10:32:35 +0900 Subject: [PATCH 186/259] =?UTF-8?q?=EB=8F=84=EB=84=9B=20=EB=9D=BC=EC=9D=B8?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20=EB=B3=B5=EA=B5=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/DoughnutChart.tsx | 61 ++++++++++++++++++- .../src/ui/chart/LineChart.tsx | 56 ++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx index 39dee3d9e..99395267a 100644 --- a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx +++ b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx @@ -48,6 +48,7 @@ type LegendProps = { }; /** 차트 기본 스타일 */ +/* const customStyles = { legendContainer: { display: "flex", @@ -58,6 +59,23 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +/** 차트 기본 스타일 (라인차트와 동일하게) */ +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", // 여러 줄로 자동 줄바꿈 + justifyContent: "center", + alignItems: "center", + gap: "12px", // 아이템 간 간격 + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", // 범례 영역 높이 통일 + } as CSSProperties, +}; // 커스텀 툴팁 const CustomTooltip = ({ active, payload, label }: { @@ -82,6 +100,7 @@ const CustomTooltip = ({ active, payload, label }: { }; // 커스텀 범례 +/* const CustomLegend = (props: LegendProps) => { const { payload } = props; if (!payload) return null; @@ -97,12 +116,52 @@ const CustomLegend = (props: LegendProps) => { </div> ); }; +*/ + +const CustomLegend = (props: LegendProps) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: LegendEntry, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.fill, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}> + {entry.payload?.label || entry.value} + </span> + </div> + ))} + </div> + ); +}; export default function DoughnutChart(props: { chartConfig: any; chartData: ChartDataItem[] | undefined; chartTitle: string }) { + const legendData = props.chartData?.map(item => ({ + value: item.label, + fill: props.chartConfig?.[item.label]?.fill || 'blue', + })) ?? []; return ( <Card className="flex flex-col"> <CardContent className="flex-1 pb-0"> @@ -130,9 +189,9 @@ export default function DoughnutChart(props: { nameKey="label" innerRadius={60} /> - <CustomLegend /> </PieChart> </ChartContainer> + <CustomLegend payload={legendData} /> </div> </CardContent> </Card> diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 74d17f784..23570912d 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -18,6 +18,7 @@ type LineChartProps = { } /** 차트 기본 스타일 */ +/* const customStyles = { legendContainer: { display: "flex", @@ -28,6 +29,23 @@ const customStyles = { marginTop: "10px", } as CSSProperties, }; +*/ + +/** 차트 기본 스타일 */ +const customStyles = { + legendContainer: { + display: "flex", + flexWrap: "wrap", + justifyContent: "center", + alignItems: "center", + gap: "12px", + fontSize: "13px", + fontWeight: "normal", + marginTop: "16px", + marginBottom: "8px", + minHeight: "32px", + } as CSSProperties, +}; type LegendEntry = { value: string; @@ -60,7 +78,7 @@ const CustomTooltip = ({ active, payload, label }: { active?: boolean; payload?: }; // 커스텀 범례 (글씨 크기 키우기 + 스타일 추가) -const CustomLegend = (props: LegendProps) => { +/*const CustomLegend = (props: LegendProps) => { const { payload } = props; if (!payload) return null; @@ -74,6 +92,40 @@ const CustomLegend = (props: LegendProps) => { ))} </div> ); +};*/ + +// 커스텀 범례 (도넛차트와 동일하게) +const CustomLegend = (props: LegendProps) => { + const { payload } = props; + if (!payload) return null; + + return ( + <div style={customStyles.legendContainer}> + {payload.map((entry: LegendEntry, index: number) => ( + <div + key={`legend-${index}`} + className="flex items-center" + style={{ + minWidth: "90px", + margin: "2px 0", + }} + > + <div + style={{ + width: "14px", + height: "14px", + backgroundColor: entry.color, + borderRadius: "3px", + marginRight: "8px", + minWidth: "14px", + minHeight: "14px", + }} + ></div> + <span style={{ fontSize: "13px", whiteSpace: "nowrap" }}>{entry.value}</span> + </div> + ))} + </div> + ); }; type DataType = {label: string; val: string}; @@ -141,7 +193,7 @@ export default function Linechart({ > <CartesianGrid vertical={false} /> <XAxis dataKey="label" fontSize="8px" fontWeight="bold" /> - <YAxis yAxisId="left" className="text-[12px] font-bold" domain={[0, Math.ceil(lineMaxValue * 1.1)]} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> + <YAxis yAxisId="left" className="text-[12px] font-bold" tickFormatter={(value) => value.toLocaleString()} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> <Tooltip content={<CustomTooltip />} /> {showLegend && <Legend content={CustomLegend as ContentType}/>} {Object.keys(chartData).map((key) => { From 8b20d7e88e4fc5abe10e1dbc2ce915d456222642 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 13:29:45 +0900 Subject: [PATCH 187/259] =?UTF-8?q?feat:=20SELECTBOX=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20hidden=20props=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EB=A1=9C=20placeholder=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/select/index.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/common/business_components/src/ui/select/index.tsx b/packages/common/business_components/src/ui/select/index.tsx index 6fa78ccf2..c4e1264c4 100644 --- a/packages/common/business_components/src/ui/select/index.tsx +++ b/packages/common/business_components/src/ui/select/index.tsx @@ -5,7 +5,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ". /** 차트 기본 스타일 */ interface SelectBox1 { text:string, - val:string|number + val:string|number, + hidden?: boolean } const SelectBox = React.forwardRef< @@ -20,17 +21,27 @@ const SelectBox = React.forwardRef< readOnly?: boolean // readOnly 속성 추가 } >(({ label, className, selectClass, selectArray, onSelectValue, value, readOnly = false }, ref)=>{ - const placeHolder = selectArray?.[0]?.text ?? ""; + // 첫 번째 항목을 placeholder로 사용하고 드롭다운 목록에서는 제외 + const firstItem = selectArray[0]; + const placeHolder = firstItem?.text ?? ""; + + // 첫 번째 항목(placeholder)을 제외한 나머지 항목만 드롭다운에 표시 + const visibleItems = selectArray.filter((_, index) => index !== 0); + + // 현재 값이 첫 번째 항목(placeholder)인 경우 undefined로 설정하여 placeholder가 표시되도록 함 + const currentValue = value !== undefined && String(value) === String(firstItem?.val) + ? undefined + : (value !== undefined ? String(value) : undefined); return ( <div className={className+" flex items-center"} ref={ref}> {label && <Label className="whitespace-nowrap w-20 text-xl text-gray-600">{label}</Label>} - <Select onValueChange={onSelectValue} value={value !== undefined ? String(value) : undefined}> + <Select onValueChange={onSelectValue} value={currentValue} disabled={readOnly}> <SelectTrigger className={selectClass?selectClass:"flex-1 p-2 border rounded"}> <SelectValue placeholder={placeHolder} /> </SelectTrigger> <SelectContent> - {selectArray.map((selectArray) => ( + {visibleItems.map((selectArray) => ( <SelectItem key={selectArray.val} value={String(selectArray.val)}>{selectArray.text}</SelectItem> ))} </SelectContent> From a7035b774e3fc7a24118bee2660ea34d0b585a88 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 14:43:13 +0900 Subject: [PATCH 188/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98?= =?UTF-8?q?=EB=B6=84=EC=84=9D,=20RDII=20=EB=B6=84=EC=84=9D=20=EC=97=B0?= =?UTF-8?q?=EB=8F=84=20=EC=A1=B0=ED=9A=8C=20=EC=BF=BC=EB=A6=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/aplcnYms.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 1cd0d6ded..26d597abf 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -120,7 +120,7 @@ export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string export const selectInftwtAnls = async(aplcnYm:String) => { // 침입수분석 try { - const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const queryString = aplcnYm ? `aplcnYmFrom=${aplcnYm}&aplcnYmTo=${aplcnYm}` : ''; const result = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); if (result && result.numberOfElements > 0) { console.log("selectInftwtAnls", result.content); @@ -219,7 +219,7 @@ export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; va export const selectRdiiAnls = async(aplcnYm:String) => { // 침입수분석 try { - const queryString = aplcnYm ? `aplcnYm=${aplcnYm}` : ''; + const queryString = aplcnYm ? `aplcnYmFrom=${aplcnYm}&aplcnYmTo=${aplcnYm}` : ''; const result = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); if (result && result.numberOfElements > 0) { console.log("selectRdiiAnls", result.content); From 921592a12181119d33726dc1a45a988280691abb Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 14:51:39 +0900 Subject: [PATCH 189/259] =?UTF-8?q?feat:=20DateMonthPicker=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20startYerar=20props=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/date_month_picker/index.tsx | 3 +++ .../src/ui/date_month_picker/mothPicker.tsx | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/date_month_picker/index.tsx b/packages/common/business_components/src/ui/date_month_picker/index.tsx index d318b561f..1b97d9ce1 100644 --- a/packages/common/business_components/src/ui/date_month_picker/index.tsx +++ b/packages/common/business_components/src/ui/date_month_picker/index.tsx @@ -17,6 +17,7 @@ type MonthPickerProps = { field: { value: string; onChange: (date: string) => void }; // yyyyMM 문자열 selectClass?: string; readOnly?: boolean; + startYear?: number; // 시작 연도 props 추가 }; // yyyyMM → Date 객체 @@ -37,6 +38,7 @@ export const DateMonthPicker = ({ field, selectClass, readOnly = false, + startYear, }: MonthPickerProps) => { const [open, setOpen] = useState(false); @@ -75,6 +77,7 @@ export const DateMonthPicker = ({ <MonthPicker currentMonth={parsedDate} onMonthChange={handleSelect} + startYear={startYear} /> </PopoverContent> </Popover> diff --git a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx index acf17fba4..6afbde5e6 100644 --- a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx +++ b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx @@ -28,9 +28,10 @@ export type MonthPickerProps = { newMonth: Date | undefined, shouldClosePopover?: boolean ) => void; + startYear?: number; }; -export function MonthPicker({ currentMonth, onMonthChange }: MonthPickerProps) { +export function MonthPicker({ currentMonth, onMonthChange, startYear }: MonthPickerProps) { const today = startOfToday(); const currentYear = today.getFullYear(); @@ -46,7 +47,12 @@ const selectedYear = parseInt(yearFromProp); - const yearRange = Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + // startYear가 없으면 기존과 동일하게 (현재년도 - 20년부터 현재년도까지) + // startYear가 있으면 해당 년도부터 현재년도까지, 내림차순으로 정렬 + const yearRange = startYear + ? Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + : Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + const months = eachMonthOfInterval({ start: fullYearStart, end: yearEnd }); const getMonthButtonClass = (month: Date) => @@ -77,7 +83,7 @@ const selectedYear = parseInt(yearFromProp); onMonthChange(newDate, false); }} > - <SelectTrigger className="w-[120px] h-7"> + <SelectTrigger className="w-[140px] h-9 text-base"> <SelectValue placeholder="년도" /> </SelectTrigger> <SelectContent> From f7c8518e5786e23e1eded4634e5f50dd42dc60ee Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 16:20:32 +0900 Subject: [PATCH 190/259] =?UTF-8?q?feat:=20=EC=9D=B4=EC=A0=84=20Commit=20?= =?UTF-8?q?=EB=82=B4=EC=97=AD=20=EC=9E=AC=EC=9E=91=EC=97=85=20-=20UITable,?= =?UTF-8?q?=20UITable2=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=20=EA=B0=80=EC=9A=B4=EB=8D=B0=20=EC=A0=95=EB=A0=AC=20?= =?UTF-8?q?-=20UiModal=20=EC=9D=B4=EC=A0=84=20=EB=8F=99=EC=9E=91=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EB=8A=94=20props=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/dialog_ui/index.tsx | 58 ++++----- .../src/ui/table/index-2.tsx | 6 +- .../src/ui/table/index.tsx | 116 +++++++++--------- 3 files changed, 89 insertions(+), 91 deletions(-) diff --git a/packages/common/business_components/src/ui/dialog_ui/index.tsx b/packages/common/business_components/src/ui/dialog_ui/index.tsx index bbb27d327..df7fffd3a 100644 --- a/packages/common/business_components/src/ui/dialog_ui/index.tsx +++ b/packages/common/business_components/src/ui/dialog_ui/index.tsx @@ -1,7 +1,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader } from "@common/components"; import { cn } from "../../lib/utils"; -type ModalType = { +type ModalType = { bodyClass: string; body: React.ReactNode; open?: boolean; @@ -10,43 +10,45 @@ type ModalType = { noFooterYn?: 'N' | 'Y'; headerTitle?: string; footerContent?: React.ReactNode; + useDirectRender?: boolean; } -export function UiModal({ - bodyClass, - body, - open, +export function UiModal({ + bodyClass, + body, + open, onOpenChange, noHeaderYn = 'N', noFooterYn = 'N', headerTitle, - footerContent + footerContent, + useDirectRender = false }: ModalType) { - + return ( <> - <Dialog open={open} onOpenChange={onOpenChange}> + <Dialog open={open} onOpenChange={onOpenChange}> <DialogContent className={bodyClass}> - {noHeaderYn === 'N' && ( - <DialogHeader> - <DialogDescription> - {headerTitle} - </DialogDescription> - </DialogHeader> - )} - {(open && body) ? - <div> {body}</div>:<></> - - - - } - {noFooterYn === 'N' && ( - <DialogFooter className="sm:justify-start"> - {footerContent} - </DialogFooter> - )} - </DialogContent> - </Dialog> + {noHeaderYn === 'N' && ( + <DialogHeader> + <DialogDescription> + {headerTitle} + </DialogDescription> + </DialogHeader> + )} + {(open && body) ? + useDirectRender + ? body + : <div>{body}</div> + : <></> + } + {noFooterYn === 'N' && ( + <DialogFooter className="sm:justify-start"> + {footerContent} + </DialogFooter> + )} + </DialogContent> + </Dialog> </> ); } diff --git a/packages/common/business_components/src/ui/table/index-2.tsx b/packages/common/business_components/src/ui/table/index-2.tsx index b6a9750b0..9756d2dfa 100644 --- a/packages/common/business_components/src/ui/table/index-2.tsx +++ b/packages/common/business_components/src/ui/table/index-2.tsx @@ -110,9 +110,7 @@ export function UiTable2({ ? 'text-right' : head.align === 'center' ? 'text-center' - : typeof el[head.id] === 'number' - ? 'text-right' - : 'text-center' + : 'text-center' } ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : cellClick ? 'cursor-pointer' : ''} @@ -141,7 +139,7 @@ export function UiTable2({ </div> {/* 페이지네이션 하단 고정 */} - { ( + {( <div className="sticky left-0 right-0 bottom-0 bg-white z-20 mt-5"> <UiPageNations total={total} diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index cd25bc8db..fe720abc0 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -9,28 +9,28 @@ import { boolean } from "zod"; type UiTableProps = { headName: React.ReactNode | undefined; - tableData: { [key: string]:any}[]; + tableData: { [key: string]: any }[]; headlist: UiHeadProps[]; pageSize: number; total: number; - cellClick : ((index:number|undefined, headId:string)=>void )| undefined; + cellClick: ((index: number | undefined, headId: string) => void) | undefined; onPageChange: (page: number) => void; className?: string; resetPageNo?: boolean; children?: React.ReactNode | undefined; boldArray?: number[]; resetSelection?: boolean; - index?:number; + index?: number; } type UiHeadProps = { id: string; title: string; align?: string; - visible?:boolean; + visible?: boolean; } -export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false, index=-1 }: UiTableProps) { +export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false, index = -1 }: UiTableProps) { const [cur, setCur] = useState<number>(1); const [idx, setIdx] = useState<number>(index); const [isCheck, seIsCheck] = useState<boolean>(false); @@ -54,77 +54,75 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr onPageChange(page); } - const handleCellClick = (index: number,headId:string )=> { + const handleCellClick = (index: number, headId: string) => { if (cellClick) { - cellClick(index,headId); + cellClick(index, headId); setIdx(index); } }; - + return ( <> {headName ? <div className="card-header"> <h3 className="text-2xl font-medium text-label">{headName}</h3> - </div> : <></>} + </div> : <></>} <div className={`card !m-[1.2rem] !p-0r ${className}`}> <Table variant="secondary"> <TableHeader className="font-bold"> {children ? children : <HeadMakeColSpan upHeadList={headlist} />} </TableHeader> <TableBody className='text-center'> - {tableData.length > 0 ? tableData?.map((el: { [key: string]: any}, index) => ( + {tableData.length > 0 ? tableData?.map((el: { [key: string]: any }, index) => ( <TableRow key={`row-${index}`}> {headlist - .filter((item) => item.visible != false) - .map((head) => ( - head.id && head.id.length > 1 && ( - boldArray.includes(index) - ? - <TableCell - className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : typeof el[head.id] === 'number' ? 'text-right' : 'text-center'} ${ - cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' - } !font-bold`} - onClick={() => handleCellClick(index, head.id)} - key={`cell-${head.id}-${index}`} - > - {typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.') - ? String(el[head.id]).split('.').map((part, index) => - index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part - ).join('.') - : String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} - </TableCell> - : - <TableCell - className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : typeof el[head.id] === 'number' ? 'text-right' : 'text-center'} ${ - cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' - }`} - onClick={() => handleCellClick(index, head.id)} - key={`cell-${head.id}-${index}`} - > - {typeof el[head.id] === 'boolean' - ?<Checkbox - checked={el[head.id] === true} - onCheckedChange={(checked) => { - el[head.id]= checked; - }} - > - <Check className="h-6 w-6 text-primary" /> - </Checkbox> - : - typeof el[head.id] !== 'number'? - String(el[head.id] ?? ''): - String(el[head.id]).includes('.') - ? String(el[head.id]).split('.').map((part, index) => - index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part - ).join('.') - : - String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} - </TableCell> - ) - ))} + .filter((item) => item.visible != false) + .map((head) => ( + head.id && head.id.length > 1 && ( + boldArray.includes(index) + ? + <TableCell + className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : + cellClick ? 'cursor-pointer' : '' + } !font-bold`} + onClick={() => handleCellClick(index, head.id)} + key={`cell-${head.id}-${index}`} + > + {typeof el[head.id] !== 'number' ? String(el[head.id] ?? '') : String(el[head.id]).includes('.') + ? String(el[head.id]).split('.').map((part, index) => + index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part + ).join('.') + : String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} + </TableCell> + : + <TableCell + className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : + cellClick ? 'cursor-pointer' : '' + }`} + onClick={() => handleCellClick(index, head.id)} + key={`cell-${head.id}-${index}`} + > + {typeof el[head.id] === 'boolean' + ? <Checkbox + checked={el[head.id] === true} + onCheckedChange={(checked) => { + el[head.id] = checked; + }} + > + <Check className="h-6 w-6 text-primary" /> + </Checkbox> + : + typeof el[head.id] !== 'number' ? + String(el[head.id] ?? '') : + String(el[head.id]).includes('.') + ? String(el[head.id]).split('.').map((part, index) => + index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part + ).join('.') + : + String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} + </TableCell> + ) + ))} </TableRow> )) : <></>} </TableBody> From 2703c34528fe95306d4b1b5b4db084f70fab0154 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Mon, 7 Jul 2025 17:01:05 +0900 Subject: [PATCH 191/259] =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=20=EB=AF=B8=EB=93=A4=EC=9B=A8=EC=96=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B6=84=EA=B8=B0=20=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 6 +- apps/sn/middleware.ts | 68 +++++++++++-------- .../src/ui/map/lib/gis.core.js | 3 - .../src/ui/map/lib/gis.layer.js | 32 ++++----- packages/common/network/client.ts | 5 -- 5 files changed, 54 insertions(+), 60 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 109b519ea..d56c5fb58 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -4,13 +4,13 @@ NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 #NEXT_PUBLIC_PROXY_HOST = http://sn.hasu.or.kr:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver -NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com #자료관 데이터 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API -#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API +NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 차장님 API diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index 546516261..b5a8e7981 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -16,41 +16,52 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/server")) { const queryParams = searchParams.toString(); - const newUrl = `${SERVER_API_URL}${pathname.replace("/server", "")}${queryParams ? `?${queryParams}` : "" - }`; + const newUrl = `${SERVER_API_URL}${pathname.replace("/server", "")}${queryParams ? `?${queryParams}` : ""}`; console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); } - - if (pathname.startsWith("/geoserver")) { - const queryParams = searchParams.toString(); - + else if (pathname.startsWith("/geoserver")) { + let queryParams = searchParams.toString(); const typename = searchParams.get("TYPENAME"); - let newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : "" - }`; + let newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : ""}`; + if ( - typename == "hasudo:tb_ms_swage_ppl" || //관로 - typename == "hasudo:tb_ms_swage_mhl" || //맨홀 - typename == "hasudo:tb_ms_swage_pmstn" || //펌프장 - typename == "hasudo:tb_ms_stofcbr" //우수토실 + typename == "hasudo:tb_il_swage_prcs_fclt" //하수처리시설 + || typename == "hasudo:tb_ms_swage_prcs_zone" //하수처리구역 + || typename == "hasudo:tb_ms_sbmrg_dngr_map" //침수위험지도 + || typename == "hasudo:tb_ms_flood_dngr_map" //도시침수지도 ) { - newUrl = `${LX_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : "" - }`; + newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : ""}`; } + else if ( + typename == "hasudo:tb_ms_swage_ppl" //관로 + || typename == "hasudo:tb_ms_swage_mhl" //맨홀 + || typename == "hasudo:tb_ms_swage_pmstn" //펌프장 + || typename == "hasudo:tb_ms_stofcbr" //우수토실 + ) { + newUrl = `${LX_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : ""}`; + } + else if ( + typename == "hasudo:om_dt_untrt_swg_rain" //중점우수토실 + || typename == "hasudo:om_wqlt_station" //관측소 + || typename == "hasudo:tb_wr_bdst_ruse_fclt" //재이용시설 + || typename == "hasudo:tb_wr_rnwtr_utztn_fclt" //빗물이용시설 + || typename == "hasudo:tb_wr_rswtr_fclt" //중수도시설 + || typename == "hasudo:tb_wr_htdfl_fclt" //온배수시설 + || typename == "hasudo:tb_wr_ruse_fclt_dmd_co" //수요처 + || typename == "hasudo:tb_wr_tmpr_dmd_co" //잠재수요처 + ){ + const url = req.nextUrl.clone(); + url.searchParams.set('TYPENAME', typename.replace("hasudo:","")); + queryParams = url.searchParams.toString(); + newUrl = `${SEWERAGE_API_URL}/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`; + } + console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); } - - if (pathname.startsWith("/sewerage-service")) { - const queryParams = searchParams.toString(); - const newUrl = `${SEWERAGE_API_URL}${pathname.replace("/sewerage-service/api", "")}${queryParams ? `?${queryParams}` : "" - }`; - console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); - return NextResponse.rewrite(new URL(newUrl)); - } - - if ( + else if ( pathname.startsWith("/attach-service") || pathname.startsWith("/cms-service") ) { @@ -69,8 +80,7 @@ export function middleware(req: NextRequest) { headers: requestHeaders, }); } - - if (pathname.startsWith("/user-service")) { + else if (pathname.startsWith("/user-service")) { const requestHeaders = new Headers(req.headers); const newUrl = `${SERVER_API_URL}${pathname}`; @@ -81,8 +91,7 @@ export function middleware(req: NextRequest) { headers: requestHeaders, }); } - - if (pathname.startsWith("/dc-service")) { + else if (pathname.startsWith("/dc-service")) { const requestHeaders = new Headers(req.headers); const newUrl = `${RSONE_DC_URL}${pathname}`; @@ -103,8 +112,7 @@ export const config = { "/attach-service/:path*", "/user-service/:path*", "/cms-service/:path*", - "/sewerage-service/api/v1/map/geometry/:path*", "/dc-service/:path*", ], - + }; diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index ddfcec3a1..b1b02a732 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -31,8 +31,6 @@ const GisApp = {}; //레이어 정보 GisApp.layerInfos = []; //기본정보 -//GisApp.GEOSERVER_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/ows'; -//GisApp.GEOSERVER_WMS_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/wms'; GisApp.GEOSERVER_URL = '/geoserver/hasudo/ows'; GisApp.SN_GEOSERVER_URL = '/sewerage-service/api/v1/map/geometry'; GisApp.GEOSERVER_WMS_URL = '/geoserver/hasudo/wms'; @@ -56,7 +54,6 @@ GisApp.OPENSTREET_URL = '//tile.openstreetmap.org/{z}/{x}/{y}.png'; GisApp.BASE_MAP_TYPES = []; GisApp.FROM_PROJ = 'EPSG:4326'; -// GisApp.TO_PROJ = 'EPSG:3857'; GisApp.TO_PROJ = 'EPSG:5179'; //ngii 좌표계 GisApp.TO_DATA_PROJ = 'EPSG:4326'; GisApp.CONTEXT_LAYER_PATH = '/images/map/layericon/'; diff --git a/packages/common/business_components/src/ui/map/lib/gis.layer.js b/packages/common/business_components/src/ui/map/lib/gis.layer.js index 097c90ba5..7790aa5dc 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.layer.js +++ b/packages/common/business_components/src/ui/map/lib/gis.layer.js @@ -77,19 +77,6 @@ GisOlLayer.prototype = { let lyrTyNm = options.lyrTyNm; let typename = this.storageNm + lyrTyNm; - if(options.lyrTyNm == "om_dt_untrt_swg_rain" //중점우수토실 - || options.lyrTyNm == "om_wqlt_station" //관측소 - || options.lyrTyNm == "tb_wr_bdst_ruse_fclt" //재이용시설 - || options.lyrTyNm == "tb_wr_rnwtr_utztn_fclt" //빗물이용시설 - || options.lyrTyNm == "tb_wr_rswtr_fclt" //중수도시설 - || options.lyrTyNm == "tb_wr_htdfl_fclt" //온배수시설 - || options.lyrTyNm == "tb_wr_tmpr_dmd_co" //잠재수요처 - ) - { - url = GisApp.SN_GEOSERVER_URL; - typename = lyrTyNm; - } - const params = {}; params['TYPENAME'] = typename; params['SERVICE'] = 'WFS'; @@ -97,16 +84,23 @@ GisOlLayer.prototype = { params['REQUEST'] = 'GetFeature'; params['SRS'] = toProj; params['OUTPUTFORMAT'] = 'application/json'; - if (options?.flterSql && options?.flterSql?.trim() !== 'null') { - params['CQL_FILTER'] = options?.flterSql; - } - const strParams = new URLSearchParams(params).toString(); + let source = new VectorSource({ format: new GeoJSON(), url: function (extent) { + + const [minX, minY, maxX, maxY] = extent; + const bboxFilter = `BBOX(geom, ${minX}, ${minY}, ${maxX}, ${maxY}, '${toProj}')`; + const filter = options?.flterSql && options.flterSql && options.flterSql.trim() !== '' + ? `(${options.flterSql}) AND ${bboxFilter}` + : bboxFilter; + + params['CQL_FILTER'] = filter; + + const strParams = new URLSearchParams(params).toString(); return url + '?' + strParams; }, - strategy: all, + strategy: bbox, }); return source; }, @@ -212,7 +206,7 @@ GisOlLayer.prototype = { return null; } let vectorSource = new VectorSource({ - strategy: all, + strategy: bbox, }); if (feature) { if (Object.prototype.toString.call(feature).slice(8, -1).indexOf('Object') > -1) { diff --git a/packages/common/network/client.ts b/packages/common/network/client.ts index b1a9805c3..587fcf541 100644 --- a/packages/common/network/client.ts +++ b/packages/common/network/client.ts @@ -23,15 +23,10 @@ class Client { }); - console.log("config", config); - this.axiosInstance.interceptors.request.use((config) => { const token = Cookies.get(CLAIM_NAME); const userId = Cookies.get(AUTH_USER_ID); - console.log("token", token); - console.log("userId", userId); - if (!token || !userId) { throw new AxiosError( "The authentication token is invalid.", From 2ec22b41eb0599d107fb6ad36bae772fae8b4b3b Mon Sep 17 00:00:00 2001 From: hsson <hsson@mind-one.co.kr> Date: Mon, 7 Jul 2025 19:18:21 +0900 Subject: [PATCH 192/259] =?UTF-8?q?=EA=B7=B8=EB=9E=98=ED=94=84=20Modal=20?= =?UTF-8?q?=EC=95=88=EC=97=90=20=EC=9E=88=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/infilChart.tsx | 4 ++-- .../map/components/popupComponent/chart/rdiiChart.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index ac89a9403..12963ef9c 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -129,7 +129,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { <div className="text-black text-3xl font-bold mb-5">침입수분석결과</div> <div className='grid grid-cols-[1fr_3fr] gap-4'> - <div className="grid grid-rows-4 gap-4 mb-4"> + <div className="h-[90%] grid grid-rows-4 gap-4 mb-4"> <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> 분석 입력현황 조회 </Button> @@ -152,7 +152,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { </div> </div> {/* 차트 */} - <div className="bg-white text-3xl"> + <div className="h-[90%] bg-white text-3xl"> <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} yFieldText2="시간" yFieldText="유량(m³/h)"/> </div> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 653b568b5..22f0d8876 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -144,7 +144,7 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => { </div> </div> {/* 차트 */} - <div className="bg-white text-2xl"> + <div className="h-[90%] bg-white text-2xl"> <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} yFieldText2="시간" yFieldText="유량(m³/h)" /> </div> From 4503181684a3ec1feb20df7a1db7531d525fdf52 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 19:48:35 +0900 Subject: [PATCH 193/259] =?UTF-8?q?fix:=20SELECTBOX=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20hidden=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/select/index.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/common/business_components/src/ui/select/index.tsx b/packages/common/business_components/src/ui/select/index.tsx index c4e1264c4..8843aa04e 100644 --- a/packages/common/business_components/src/ui/select/index.tsx +++ b/packages/common/business_components/src/ui/select/index.tsx @@ -1,3 +1,5 @@ +// selectBox + import { Label } from "@common/components"; import React from "react"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./lib/selectBox"; @@ -21,15 +23,17 @@ const SelectBox = React.forwardRef< readOnly?: boolean // readOnly 속성 추가 } >(({ label, className, selectClass, selectArray, onSelectValue, value, readOnly = false }, ref)=>{ - // 첫 번째 항목을 placeholder로 사용하고 드롭다운 목록에서는 제외 - const firstItem = selectArray[0]; - const placeHolder = firstItem?.text ?? ""; + // hidden이 true인 첫 번째 항목을 placeholder로 사용 + const hiddenItem = selectArray.find(item => item.hidden); + const placeHolder = hiddenItem?.text ?? "선택"; - // 첫 번째 항목(placeholder)을 제외한 나머지 항목만 드롭다운에 표시 - const visibleItems = selectArray.filter((_, index) => index !== 0); + // hidden이 true인 항목만 드롭다운에서 제외 + const visibleItems = selectArray.filter(item => !item.hidden); - // 현재 값이 첫 번째 항목(placeholder)인 경우 undefined로 설정하여 placeholder가 표시되도록 함 - const currentValue = value !== undefined && String(value) === String(firstItem?.val) + // 현재 값이 hidden 항목이거나 빈 값인 경우 undefined로 설정하여 placeholder가 표시되도록 함 + const currentValue = value !== undefined && + hiddenItem && + (String(value) === String(hiddenItem.val) || value === "" || value === "0" || value === 0) ? undefined : (value !== undefined ? String(value) : undefined); From bb9db3c92793f9259cf0f9b9347ca935b73689bd Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Mon, 7 Jul 2025 20:00:16 +0900 Subject: [PATCH 194/259] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=EA=B3=A0=EC=B9=A8=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/table/uiPageNations.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/table/uiPageNations.tsx b/packages/common/business_components/src/ui/table/uiPageNations.tsx index 891fc4c81..ca1f8e0c0 100644 --- a/packages/common/business_components/src/ui/table/uiPageNations.tsx +++ b/packages/common/business_components/src/ui/table/uiPageNations.tsx @@ -40,7 +40,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationPrevious href="#" - onClick={() => { + onClick={(e) => { + e.preventDefault(); if (startPage > 1) handlePageChange(startPage - 1); }} /> @@ -53,7 +54,9 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationLink href="#" isActive={pageNum === pageProps.cur} - onClick={() => handlePageChange(pageNum)} + onClick={(e) => { + e.preventDefault(); + handlePageChange(pageNum)}} > {pageNum} </PaginationLink> @@ -65,7 +68,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationNext href="#" - onClick={() => { + onClick={(e) => { + e.preventDefault(); if (endPage < totalPages) handlePageChange(endPage + 1); }} /> From b1096ed9df49fd87b090f85376fab45ed2406bb7 Mon Sep 17 00:00:00 2001 From: jyha00 <jyha@mind-one.co.kr> Date: Mon, 7 Jul 2025 20:32:27 +0900 Subject: [PATCH 195/259] =?UTF-8?q?=EC=8B=9C=EB=8F=84=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EC=8B=9C=20=EC=8B=9C=EA=B5=B0=EA=B5=AC=20=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=EB=A1=9C=20=EB=82=98=EC=98=A4=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/search_form_left/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/search_form_left/index.tsx b/packages/common/business_components/src/ui/search_form_left/index.tsx index e7858df2a..4f36c078c 100644 --- a/packages/common/business_components/src/ui/search_form_left/index.tsx +++ b/packages/common/business_components/src/ui/search_form_left/index.tsx @@ -199,7 +199,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel setRtnSidoText(selectedSido?.text || ''); } initializeSigunData(val); - onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); + onSelectValue('0', 'sigun'); break; case 'sigun': if (setRtnSigunValue) { From 2dd80be17fd19419f2748d6dd54634e91eb1a576 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 20:53:37 +0900 Subject: [PATCH 196/259] =?UTF-8?q?feat:=20-=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=ED=99=95=EC=9E=A5=EC=9E=90=20=EA=B2=80=EC=A6=9D=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20-=20=ED=99=98=EA=B2=BD=EC=B2=AD,=20?= =?UTF-8?q?=EC=8B=9C=EB=8F=84,=20=EC=8B=9C=EA=B5=B0=EA=B5=AC,=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9=20-=20RDII?= =?UTF-8?q?=20=EB=B6=84=EC=84=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EC=B2=98=EB=A6=AC=EC=9E=A5=20=EC=84=A0=ED=83=9D=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/map/Gis.js | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 617f17165..ef5c21d5b 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -20,7 +20,22 @@ import GisApp from './lib/gis.core'; export const GisContext = createContext({ gisCore: null, gisMap: null, treeData: null, checkedLayerIds: null }); export const useGisContext = () => useContext(GisContext); -function Gis({ isOpen, gisMaps, isSearchModalOpen, treeData = [], isSearch = false, isMiniMap = false, setIsOpen, setFeatureData, featureData, searchView: SearchView, detailView: DetailView, onFeatureSelect, setIsSearchModalOpen }) { +function Gis({ + isOpen, + gisMaps, + isSearchModalOpen, + treeData = [], + isSearch = false, + isMiniMap = false, + setIsOpen, + setFeatureData, + featureData, + searchView: SearchView, + detailView: DetailView, + onFeatureSelect, + setIsSearchModalOpen, + onCheckedLayersChange +}) { const mapRef = useRef(); const [mapObject, setMapObject] = useState({}); const [tabVisible, setTabVisible] = useState(true); @@ -146,7 +161,7 @@ function Gis({ isOpen, gisMaps, isSearchModalOpen, treeData = [], isSearch = fal gisMaps.current = map - //미니맵 + // 미니맵 추가 if (isMiniMap) { const overviewMap = new OverviewMap({ layers: [GisApp.Module.core.baseMiniMapLayers['base']], @@ -340,29 +355,40 @@ function Gis({ isOpen, gisMaps, isSearchModalOpen, treeData = [], isSearch = fal <GisContext.Provider value={{ gisCore, gisMap: mapInstanceRef.current, treeData, checkedLayerIds }}> <div className="h-[calc(100vh-10rem)] flex relative"> <div ref={mapRef} className="gis-map flex-1 relative" style={{ height: '100%', padding: 0 }} /> - <GisTree visible={tabVisible} setVisible={setTabVisible} /> + <GisTree + visible={tabVisible} + setVisible={setTabVisible} + onCheckedChange={handleCheckedLayersChange} + onLayerIconClick={(nodeNm) => { + setLayerNm(nodeNm); setIsOpen(true); const dummyFeature = { + getProperties: () => ({}), // 최소 구조 + }; + onFeatureSelect(dummyFeature); + }} + /> {/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */} - {/* isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} - {isOpen && featureData && !isSearchModalOpen && ( + {/* DetailView가 존재할 때만 렌더링 isSearchModalOpen이 true면 visible=false로 팝업 숨김 */} + {isOpen && !isSearchModalOpen && ( <DetailView featureData={featureData || { getProperties: () => ({}) }} seletectedLayerNm={layerNm} onClose={closePopup} // 닫기 콜백 전달 /> )} - {SearchView &&( - <SearchView - open={isSearchModalOpen} - onOpenChange={setIsSearchModalOpen} - onFeatureSelect={onFeatureSelect} - /> + {/* SearchView가 존재할 때만 렌더링 */} + {SearchView && ( + <SearchView + open={isSearchModalOpen} + onOpenChange={setIsSearchModalOpen} + onFeatureSelect={handleFeatureSelect} + /> )} <GisLonLat /> <GisToolBar /> <GisMapToggle /> - <GisSelect onFeatureSelect={onFeatureSelect} /> + <GisSelect onFeatureSelect={handleFeatureSelect} /> </div> {isSearch && ( From b396a14a5d1579800acabdaa724eff44f5db8b75 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 20:59:07 +0900 Subject: [PATCH 197/259] =?UTF-8?q?feat:=20stash=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popupComponent/chart/aplcnYms.ts | 8 +- .../popupComponent/chart/infilChart.tsx | 113 ++++++++++-------- apps/sn/app/components/lib/utils/date.ts | 20 ++++ .../app/components/ui/operFileUploadForm.tsx | 8 +- 4 files changed, 89 insertions(+), 60 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 26d597abf..5ac5ee0a8 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -71,7 +71,7 @@ export const getDcTree = async () => { return result; }; -const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] => { +const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string, hidden?: boolean }[] => { let yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); const month = dateStr.slice(4, 6); @@ -80,7 +80,7 @@ const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string }[] = val: dateStr }; }); - yyyymms1.unshift({ val: '0', text: '선택' }); + yyyymms1.unshift({ val: '0', text: '선택', hidden: true }); return yyyymms1; }; const selectAplcnYms = async(gubun:string) => { // 상수사용월 @@ -109,12 +109,12 @@ export const useAplcnYms = (gubun:string) => { return data; }; -export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string; val: number }[] => { +export const getOptionsInftwtAnlsInfo = (anlsArr: TInftwtAnls[]): { text: string; val: number, hidden?: boolean }[] => { const options = anlsArr.map(anls => ({ text: anls.anlsInfo, val: anls.inftwtAnlsSn, })); - options.unshift({ val: 0, text: '선택' }); + options.unshift({ val: 0, text: '선택', hidden: true }); return options; }; diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index ac89a9403..cbaa5dafb 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -11,25 +11,25 @@ import { useInfilChartModalStore } from '../chartModalStore'; // 모달 상태 type ModalOpenProp = { pplMngNo?: string, // 관로관리번호 } -type DataType = {label: string; val: number}; +type DataType = { label: string; val: number }; const InfilChart = ({ pplMngNo }: ModalOpenProp) => { const { isOpen: isModalOpen, setIsOpen: setIsModalOpen } = useInfilChartModalStore(); // 모달 상태 관리 스토어 const [popupOpen, setPopupOpen] = React.useState(false); // 조회조건팝업 const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 - const [aplcnYm, setAplcnYm] = useState(""); + const [selectedAplcnYm, setSelectedAplcnYm] = useState(""); const [inftwtAnlss, setInftwtAnlss] = useState<TInftwtAnls[]>([]); - const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택' }]); // 침입수분석정보 options + const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택', hidden: true }]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 - const [inftwtAnlsSn, setInftwtAnlsSn] = useState<number>(0); // 침입수분석 정보 선택시 사용 + const [selectedInftwtAnls, setSelectedInftwtAnls] = useState<number>(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ chartData1: [], chartData2: [], }); const [inftwtQty, setInftwtQty] = useState<number>(0); // 침입수량 const aplcnYms = fn.useAplcnYms('inftwtAnlsRslt'); // 상수사용월 데이터 가져오기 - - pplMngNo = "L"+pplMngNo; // inp파일에 하수관로와 맨홀의 번호가 같으면 분석 오류가 발행하여 + + pplMngNo = "L" + pplMngNo; // inp파일에 하수관로와 맨홀의 번호가 같으면 분석 오류가 발행하여 const openPopup = () => { if (buttonRef.current) { const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 @@ -50,60 +50,73 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { useEffect(() => { if (isModalOpen === false) { setPopupOpen(true); // 모달이 닫힐 때 조회조건팝업은 열어두기 - setAplcnYm(""); // 상수사용월 초기화 + setSelectedAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 - setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 + setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 - setInftwtAnlsSn(0); // 침입수분석 일련번호 초기화 - setChartData({chartData1: [], chartData2: [],}); // 차트 데이터 초기화 + setSelectedInftwtAnls(0); // 침입수분석 일련번호 초기화 + setChartData({ chartData1: [], chartData2: [], }); // 차트 데이터 초기화 setInftwtQty(0); // 침입수량 초기화 } }, [isModalOpen]); - // 상수사용월 변경시 분석 정보 리스트 가져오기 - useEffect(() => { - // aplcnYm이 비어있거나 "0"이면 API 호출하지 않음 - if (!aplcnYm || aplcnYm === "0" || aplcnYm === "") { - setInftwtAnlsSn(0); // 초기화 - setInftwtAnlsInfos([{ val: 0, text: '선택' }]); + // 상수사용월 변경 핸들러 + const handleAplcnYmChange = async (val: string | number) => { + const selectedValue = String(val); + console.log("선택된 상수사용월:", selectedValue); + + setSelectedAplcnYm(selectedValue); + + // 즉시 관련 상태 초기화 + setInftwtAnls(null); + + // 빈 값이면 초기화만 하고 종료 + if (!selectedValue || selectedValue === "0" || selectedValue === "") { + setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); return; } - const dcData = fn.getDcTree(); // 자료관 데이터 가져오기 - fn.selectInftwtAnls(aplcnYm) - .then((data) => { - setInftwtAnlss(data ?? []); - setInftwtAnlsInfos(fn.getOptionsInftwtAnlsInfo(data)); - setInftwtAnls(null); // 오수전환율 이후 초기화 - setInftwtAnlsSn(0); // 초기화 - }) - .catch((error) => { - console.error("selectInftwtAnls 에러:", error); - setInftwtAnlss([]); - setInftwtAnlsInfos([{ val: 0, text: '선택' }]); - }); - - }, [aplcnYm]); - // 값 표시 - useEffect(() => { + // API 호출 + try { + const dcData = fn.getDcTree(); + const data = await fn.selectInftwtAnls(selectedValue); + setInftwtAnlss(data ?? []); + setInftwtAnlsInfos(fn.getOptionsInftwtAnlsInfo(data)); + } catch (error) { + console.error("selectInftwtAnls 에러:", error); + setInftwtAnlss([]); + setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); + } + setSelectedInftwtAnls(0); + }; + + // 분석정보 변경 핸들러 + const handleInftwtAnlsSnChange = (val: string | number) => { + const selectedValue = Number(val); + setSelectedInftwtAnls(selectedValue); + // 선택된 침입수분석 정보에 대한 처리 로직 - if (inftwtAnlsSn === 0) return; - const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === inftwtAnlsSn); + if (selectedValue === 0) { + setInftwtAnls(null); + return; + } + + const selectedAnls = inftwtAnlss.find(anls => anls.inftwtAnlsSn === selectedValue); if (selectedAnls) { setInftwtAnls(selectedAnls); } - }, [inftwtAnlsSn]); + }; const closePopup = () => { // 팝업 닫기 - - fn.selectInftwtAnlsRslt(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수분석 결과 조회 + + fn.selectInftwtAnlsRslt(selectedInftwtAnls, pplMngNo).then((data) => {// 침입수분석 결과 조회 const rsltData = fn.getChartDataInftwtAnlsRslt(data ?? []); setChartData(prev => ({ ...prev, chartData1: rsltData // 침입수분석결과 })); }); - fn.selectOilq(inftwtAnlsSn, pplMngNo).then((data) => {// 유량 조회 + fn.selectOilq(selectedInftwtAnls, pplMngNo).then((data) => {// 유량 조회 const rsltData = fn.getChartDataOilq(data ?? []); setChartData(prev => ({ ...prev, @@ -116,7 +129,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { chartData2: [] // 유량 데이터 초기화 })); }); - fn.selectPplInftwtQty(inftwtAnlsSn, pplMngNo).then((data) => {// 침입수량 조회 + fn.selectPplInftwtQty(selectedInftwtAnls, pplMngNo).then((data) => {// 침입수량 조회 if (data > 0) { setInftwtQty(data); } @@ -138,7 +151,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { <span className="text-2xl text-red-600 font-bold">상수사용량 적용연월</span> <div className="flex items-center mt-2"> <span className="text-black text-xl font-bold"> - {(aplcnYm)? moment(aplcnYm, "YYYYMM").format("YYYY-MM"):""} + {(selectedAplcnYm) ? moment(selectedAplcnYm, "YYYYMM").format("YYYY-MM") : ""} </span> </div> </div> @@ -153,8 +166,8 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { </div> {/* 차트 */} <div className="bg-white text-3xl"> - <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} - yFieldText2="시간" yFieldText="유량(m³/h)"/> + <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} + yFieldText2="시간" yFieldText="유량(m³/h)" /> </div> </div> {popupOpen && ( @@ -175,10 +188,8 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { selectClass="rounded-lg bg-white" label='' selectArray={aplcnYms} - value={aplcnYm} - onSelectValue={(val) => {console.log("선택된 상수사용월:", val); - setAplcnYm(String(val)); - }} + value={selectedAplcnYm} + onSelectValue={handleAplcnYmChange} /> </div> <div className='flex items-center justify-between'> @@ -188,10 +199,8 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { selectClass="rounded-lg bg-white" label='' selectArray={inftwtAnlsInfos} - value={inftwtAnlsSn} - onSelectValue={(val) => { - setInftwtAnlsSn(Number(val)); - }} + value={selectedInftwtAnls} + onSelectValue={handleInftwtAnlsSnChange} /> </div> <div className='flex items-center justify-between'> @@ -264,7 +273,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { z-[50] `} body={renderBody()} - noFooterYn = 'Y' + noFooterYn='Y' /> ) } diff --git a/apps/sn/app/components/lib/utils/date.ts b/apps/sn/app/components/lib/utils/date.ts index fe717301f..f26944ce7 100644 --- a/apps/sn/app/components/lib/utils/date.ts +++ b/apps/sn/app/components/lib/utils/date.ts @@ -12,6 +12,26 @@ export const yearOptions = Array.from({ length: 10 }, (_, i) => { return { text: `${year}년`, val: year.toString() }; }); +// 현재 날짜를 기준으로 현재 분기까지의 분기 옵션 생성 +export const getQuarterOptions = (): { text: string; val: string }[] => { + const currentDate = new Date(); + const currentMonth = currentDate.getMonth() + 1; // 0부터 시작하므로 +1 + + // 현재 월을 기준으로 현재 분기 계산 + const currentQuarter = Math.ceil(currentMonth / 3); + + // 현재 분기까지의 분기 옵션 생성 + const quarterOptions = []; + for (let i = 1; i <= currentQuarter; i++) { + quarterOptions.push({ + text: `${i}분기`, + val: i.toString() + }); + } + + return quarterOptions; +}; + // ["202506", "202505", "202502", "202405"] 을 SelectBox의 옵션으로 변환 export const convertToTextValArray = (yyyymms: string[]): { text: string; val: string }[] => { return yyyymms.map(dateStr => { diff --git a/apps/sn/app/components/ui/operFileUploadForm.tsx b/apps/sn/app/components/ui/operFileUploadForm.tsx index 42d824e1b..1e7ed727a 100644 --- a/apps/sn/app/components/ui/operFileUploadForm.tsx +++ b/apps/sn/app/components/ui/operFileUploadForm.tsx @@ -2,16 +2,16 @@ import { SelectBox } from '@common/business_components/ui'; import React, { useState } from 'react' import FileUploadForm from './fileUploadForm'; -import { yearOptions } from '@/components/lib/utils'; +import { yearOptions, getQuarterOptions } from '@/components/lib/utils'; const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (files: string, year: string, quarter: string, code: string, id: string) => void }) => { const [atflCd, setAtflCd] = useState<string | null>(null); const [atflId, setAtflId] = useState<string | null>(null); + const quaterOptions = getQuarterOptions(); - const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }] const [selectedYear, setSelectedYear] = useState<string>(yearOptions[0]?.val || ''); - const [selectedQuarter, setSelectedQuarter] = useState<string>(quater[0]?.val || ''); + const [selectedQuarter, setSelectedQuarter] = useState<string>(quaterOptions[0]?.val || ''); return ( <div> @@ -31,7 +31,7 @@ const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (fil className="w-50" selectClass="rounded-lg bg-white" label="분기" - selectArray={quater} + selectArray={quaterOptions} onSelectValue={(value: string | number) => setSelectedQuarter(String(value))} /> <FileUploadForm From 3c73ba71258eac9c83e92e2be35a9425f08dc12d Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 7 Jul 2025 21:12:57 +0900 Subject: [PATCH 198/259] =?UTF-8?q?feat:=20=EB=8F=84=EC=8B=9C=EC=B9=A8?= =?UTF-8?q?=EC=88=98=EC=98=88=EB=B0=A9=EC=82=AC=EC=97=85,=20=EB=85=B8?= =?UTF-8?q?=ED=9B=84=ED=95=98=EC=88=98=EA=B4=80=EB=A1=9C=20=EC=A0=95?= =?UTF-8?q?=EB=B9=84=EC=82=AC=EC=97=85=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=20=EC=A1=B0=EA=B1=B4=20=EC=B2=B4=ED=81=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/components/lib/utils/date.ts | 38 ++++++++++++------- .../app/components/ui/operFileUploadForm.tsx | 26 ++++++++++--- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/apps/sn/app/components/lib/utils/date.ts b/apps/sn/app/components/lib/utils/date.ts index f26944ce7..9c9106ec2 100644 --- a/apps/sn/app/components/lib/utils/date.ts +++ b/apps/sn/app/components/lib/utils/date.ts @@ -13,23 +13,35 @@ export const yearOptions = Array.from({ length: 10 }, (_, i) => { }); // 현재 날짜를 기준으로 현재 분기까지의 분기 옵션 생성 -export const getQuarterOptions = (): { text: string; val: string }[] => { +export const getQuarterOptions = (selectedYear?: string): { text: string; val: string }[] => { const currentDate = new Date(); + const currentYear = currentDate.getFullYear().toString(); const currentMonth = currentDate.getMonth() + 1; // 0부터 시작하므로 +1 - // 현재 월을 기준으로 현재 분기 계산 - const currentQuarter = Math.ceil(currentMonth / 3); - - // 현재 분기까지의 분기 옵션 생성 - const quarterOptions = []; - for (let i = 1; i <= currentQuarter; i++) { - quarterOptions.push({ - text: `${i}분기`, - val: i.toString() - }); + // 현재 년도인 경우에만 현재 날짜까지의 분기 표시 + if (selectedYear === currentYear) { + // 현재 월을 기준으로 현재 분기 계산 + const currentQuarter = Math.ceil(currentMonth / 3); + + // 현재 분기까지의 분기 옵션 생성 + const quarterOptions = []; + for (let i = 1; i <= currentQuarter; i++) { + quarterOptions.push({ + text: `${i}분기`, + val: i.toString() + }); + } + + return quarterOptions; + } else { + // 이전 년도인 경우 모든 분기 표시 + return [ + { text: "1분기", val: "1" }, + { text: "2분기", val: "2" }, + { text: "3분기", val: "3" }, + { text: "4분기", val: "4" } + ]; } - - return quarterOptions; }; // ["202506", "202505", "202502", "202405"] 을 SelectBox의 옵션으로 변환 diff --git a/apps/sn/app/components/ui/operFileUploadForm.tsx b/apps/sn/app/components/ui/operFileUploadForm.tsx index 1e7ed727a..3c37673d2 100644 --- a/apps/sn/app/components/ui/operFileUploadForm.tsx +++ b/apps/sn/app/components/ui/operFileUploadForm.tsx @@ -1,6 +1,6 @@ "use client" import { SelectBox } from '@common/business_components/ui'; -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import FileUploadForm from './fileUploadForm'; import { yearOptions, getQuarterOptions } from '@/components/lib/utils'; @@ -8,11 +8,24 @@ const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (fil const [atflCd, setAtflCd] = useState<string | null>(null); const [atflId, setAtflId] = useState<string | null>(null); - const quaterOptions = getQuarterOptions(); - const [selectedYear, setSelectedYear] = useState<string>(yearOptions[0]?.val || ''); + const [quaterOptions, setQuaterOptions] = useState(() => getQuarterOptions(selectedYear)); const [selectedQuarter, setSelectedQuarter] = useState<string>(quaterOptions[0]?.val || ''); + // 년도가 변경될 때 분기 옵션 업데이트 + useEffect(() => { + const updatedQuarterOptions = getQuarterOptions(selectedYear); + setQuaterOptions(updatedQuarterOptions); + // 분기 옵션이 변경되면 첫 번째 옵션으로 자동 선택 + setSelectedQuarter(updatedQuarterOptions[0]?.val || ''); + }, [selectedYear]); + + // 년도 변경 핸들러 + const handleYearChange = (value: string | number) => { + const yearValue = String(value); + setSelectedYear(yearValue); + }; + return ( <div> <div className='card-header'> @@ -26,13 +39,16 @@ const operFileUploadForm = ({ title, onSubmit }: { title: string, onSubmit: (fil selectClass="rounded-lg bg-white" label="년도" selectArray={yearOptions} - onSelectValue={(value: string | number) => setSelectedYear(String(value))} - /><SelectBox + onSelectValue={handleYearChange} + value={selectedYear} + /> + <SelectBox className="w-50" selectClass="rounded-lg bg-white" label="분기" selectArray={quaterOptions} onSelectValue={(value: string | number) => setSelectedQuarter(String(value))} + value={selectedQuarter} /> <FileUploadForm onSubmit={(files, year, quarter, code, id) => { From 2592a52c103a6b6bc465aa1d807dcb2171b874c0 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 09:31:20 +0900 Subject: [PATCH 199/259] Merge remote-tracking branch 'origin/iipbs/sn/dev' into iipbs/sn/ii --- pnpm-lock.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 142279c5e..555292098 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -580,6 +580,9 @@ importers: tailwind-merge: specifier: ^3.0.1 version: 3.0.2 + tailwindcss-animate: + specifier: ^1.0.7 + version: 1.0.7(tailwindcss@3.4.17) xlsx: specifier: ^0.18.5 version: 0.18.5 @@ -2533,7 +2536,7 @@ packages: dnd-multi-backend: 8.1.2(dnd-core@16.0.1) framer-motion: 11.18.2(react-dom@18.3.1)(react@18.3.1) react: 18.3.1 - react-dnd: 16.0.1(@types/node@22.13.5)(@types/react@18.3.18)(react@18.3.1) + react-dnd: 16.0.1(@types/node@22.13.9)(@types/react@18.3.18)(react@18.3.1) react-dnd-html5-backend: 16.0.1 react-dnd-touch-backend: 16.0.1 react-dom: 18.3.1(react@18.3.1) From 1a6af2168b8a5de50810737c88dabcff515ab7f5 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Tue, 8 Jul 2025 09:48:51 +0900 Subject: [PATCH 200/259] =?UTF-8?q?=EC=82=AC=EC=97=85=EC=B2=B4=20=ED=9E=8C?= =?UTF-8?q?=ED=8A=B8=EB=B0=95=EC=8A=A4=20=EC=9C=84=EB=A1=9C=EB=9C=A8?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/sdmInsertForm/sdmNameBox.tsx | 152 ++++++++++-------- 1 file changed, 87 insertions(+), 65 deletions(-) diff --git a/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx b/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx index 3c8fd7192..059d63d90 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx @@ -1,14 +1,14 @@ -import React, { useCallback, useEffect, useRef, useState } from 'react'; -import type { DemandCompType } from './form'; +import React, { useCallback, useEffect, useRef, useState } from "react"; +import type { DemandCompType } from "./form"; export type thisProps = { label: string | undefined; initValue: string | undefined; - dataList : DemandCompType[]; - rtnValue : (searchText: string, pageCnt: number) => void; - rtnData : (item: DemandCompType) => void; - rtnText : (text: string) => void; -} + dataList: DemandCompType[]; + rtnValue: (searchText: string, pageCnt: number) => void; + rtnData: (item: DemandCompType) => void; + rtnText: (text: string) => void; +}; /** * 수요처 검색 컴포넌트 @@ -18,88 +18,110 @@ export type thisProps = { * @param dataList 검색할 때 넘기는 데이터 리스트 * @param rtnData 검색 결과 반환 함수 */ -export const SdmSearchForm = ({label=undefined, initValue=undefined, rtnValue=()=>{}, dataList=[], rtnData=()=>{}, rtnText=()=>{} } :thisProps) => { - +export const SdmSearchForm = ({ + label = undefined, + initValue = undefined, + rtnValue = () => {}, + dataList = [], + rtnData = () => {}, + rtnText = () => {}, +}: thisProps) => { const [isOpen, setIsOpen] = useState(false); - const [textValue, setTextValue] = useState(initValue || ''); + const [textValue, setTextValue] = useState(initValue || ""); const wrapperRef = useRef<HTMLDivElement>(null); - const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { - const value = e.target.value; - setTextValue(value); - rtnValue(value, 10); - rtnText(value); - if (value) { - setIsOpen(true); - } else { - setIsOpen(false); - } - }, [rtnValue, rtnText]); + const handleInputChange = useCallback( + (e: React.ChangeEvent<HTMLInputElement>) => { + const value = e.target.value; + setTextValue(value); + rtnValue(value, 10); + rtnText(value); + if (value) { + setIsOpen(true); + } else { + setIsOpen(false); + } + }, + [rtnValue, rtnText], + ); - const handleSuggestionClick = useCallback((item: DemandCompType) => { - setTextValue(item.dmdCoNm); - rtnData(item); - setIsOpen(false); - }, [rtnData]); + const handleSuggestionClick = useCallback( + (item: DemandCompType) => { + setTextValue(item.dmdCoNm); + rtnData(item); + setIsOpen(false); + }, + [rtnData], + ); useEffect(() => { const handleClickOutside = (event: MouseEvent) => { - if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) { + if ( + wrapperRef.current && + !wrapperRef.current.contains(event.target as Node) + ) { setIsOpen(false); } }; - document.addEventListener('mousedown', handleClickOutside); + document.addEventListener("mousedown", handleClickOutside); return () => { - document.removeEventListener('mousedown', handleClickOutside); + document.removeEventListener("mousedown", handleClickOutside); }; }, []); useEffect(() => { - if(initValue&& initValue?.length>0){ - setTextValue(initValue) + if (initValue && initValue?.length > 0) { + setTextValue(initValue); } - },[initValue]) - + }, [initValue]); + return ( - <div ref={wrapperRef}> + <div className="relative" ref={wrapperRef}> <input type="text" value={textValue} onChange={handleInputChange} /* onFocus={() => setIsOpen(true)} */ - className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + className="h-[3.2rem] w-full rounded-md border border-gray-300 pl-3 !text-xl text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder={`${label}을(를) 입력하세요`} /> {isOpen && ( - <div className=" z-1 w-full mt-2 bg-white border border-gray-300 rounded-md shadow-lg h-90 overflow-auto"> + <div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg"> <div className="max-h-72"> - {dataList && dataList.length > 0 ? dataList.map((item : DemandCompType, index : number) => ( - <div - key={index} - className="!text-xl w-full text-left px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto" - onClick={() => handleSuggestionClick(item)} - role="button" - tabIndex={0} - onKeyDown={(e) => { - if (e.key === 'Enter' || e.key === ' ') { - handleSuggestionClick(item); - } - }} - > - {item.dmdInfoPk.substring(10,14) !== '0000' ? ( - <> - <span className="text-gray-500">사업자번호 : </span> {item.dmdInfoPk.substring(0,10)}  - <span className="text-gray-500">종사업자번호 : </span> {item.dmdInfoPk.substring(10,14)}  - </> - ) : ( - <> - <span className="text-gray-500">사업자번호 : </span> {item.dmdInfoPk.substring(0,10)}  - </> - )} - <span className="float-right">{item.dmdCoNm}</span> - </div> - )) : ( - <div className="!text-xl w-full px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto"> + {dataList && dataList.length > 0 ? ( + dataList.map((item: DemandCompType, index: number) => ( + <div + key={index} + className="w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl hover:bg-gray-100" + onClick={() => handleSuggestionClick(item)} + role="button" + tabIndex={0} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + handleSuggestionClick(item); + } + }} + > + {item.dmdInfoPk.substring(10, 14) !== "0000" ? ( + <> + <span className="text-gray-500">사업자번호 : </span>{" "} + {item.dmdInfoPk.substring(0, 10)}  + <span className="text-gray-500"> + 종사업자번호 :{" "} + </span>{" "} + {item.dmdInfoPk.substring(10, 14)}  + </> + ) : ( + <> + <span className="text-gray-500">사업자번호 : </span>{" "} + {item.dmdInfoPk.substring(0, 10)}  + </> + )} + <span className="float-right">{item.dmdCoNm}</span> + </div> + )) + ) : ( + <div className="w-full cursor-pointer overflow-auto px-5 py-3 !text-xl hover:bg-gray-100"> 검색 결과가 없습니다. </div> )} @@ -107,5 +129,5 @@ export const SdmSearchForm = ({label=undefined, initValue=undefined, rtnValue=() </div> )} </div> - ) -} \ No newline at end of file + ); +}; From 61411158d1d91f8778ed3819fb0a678137080c50 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 11:20:48 +0900 Subject: [PATCH 201/259] =?UTF-8?q?feat:=20-=20=EC=B9=A8=EC=9E=85=EC=88=98?= =?UTF-8?q?=20=EB=B6=84=EC=84=9D,=20RDII=20=EB=B6=84=EC=84=9D=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20-=20=EC=85=80=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=9C=A0=EC=A7=80=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C,=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(with-base-layout)/oper/floodPre/page.tsx | 47 +++++++++++++++---- .../(with-base-layout)/oper/oldPp/page.tsx | 44 ++++++++++++++--- 2 files changed, 77 insertions(+), 14 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 6ae0b3609..3578ff967 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -27,16 +27,16 @@ const Page = () => { const [curPage, setCurPage] = useState(1) //현재 페이지 const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + + // 조회 const fetchData = async () => { setIsLoading(true) - searchCmmnCd('SITEKNDCD') + // searchCmmnCd('SITEKNDCD') try { const { data, total } = await searchData('v1/sbmrgPrevnt', { fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, toRegDt: formatDate(toDate), - atflNm: pjNm, + sbmrgPrevntBizNm: pjNm, rgtrNm: usr, page: curPage - 1, size: '10' @@ -45,12 +45,18 @@ const Page = () => { setTotalData(total) } catch (error) { console.error('Error fetching data:', error) } - finally { setIsLoading(false); } + finally { + setFileNm(''); + setAtflId(''); + setSbmrgPrevntBizSn(''); + setIsLoading(false); + } } useEffect(() => { setCurPage(1) fetchData() }, []) + // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -59,6 +65,7 @@ const Page = () => { } handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) } + // 선택 파일 삭제 const isDeleteFile = async () => { if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) { @@ -96,11 +103,19 @@ const Page = () => { <Label className="w-20 text-xl text-gray-600">등록기간</Label> <DatePicker mode={'single'} selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + /> <span>~</span> <DatePicker mode={'single'} selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + /> </div> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> @@ -132,7 +147,23 @@ const Page = () => { <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile} >삭제</Button> </div> </div> - <UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> + <UiTable + headName='' + tableData={tableData} + headlist={tableHeadlist} + pageSize={10} + total={totalData} + cellClick={(index) => { + if (index != null) { + const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; + const id = tableData[index]?.atflId ?? ''; + setFileNm(fileName); + setAtflId(id); + setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); + } + }} + onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + /> </ListDiv> <ListDiv className="mt-4"> <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 307452e2d..c4bac35b7 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -25,14 +25,13 @@ const Page = () => { const [curPage, setCurPage] = useState(1) const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + // 데이터 조회 const fetchData = async () => { setIsLoading(true) try { const { data, total } = await searchData('v1/dcrpPpl', { fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, toRegDt: formatDate(toDate), dcrpPplMtncBizNm: pjNm, rgtrNm: usr, @@ -44,12 +43,18 @@ const Page = () => { console.log(data, total) } catch (error) { console.error('Error fetching data:', error) - } finally { setIsLoading(false) } + } finally { + setFileNm(''); + setAtflId(''); + setDcrpPplMtncBizSn(''); + setIsLoading(false) + } } useEffect(() => { setCurPage(1) fetchData() }, []) + // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -59,6 +64,7 @@ const Page = () => { handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) return true } + // 파일 삭제 const isDeleteFile = async () => { if (dcrpPplMtncBizSn === '' || dcrpPplMtncBizSn === undefined) { @@ -76,6 +82,7 @@ const Page = () => { } } } + // 파일 등록 const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => { const data = await postData('v1/dcrpPpl', { @@ -88,6 +95,8 @@ const Page = () => { }) if (data) { alert('파일이 등록되었습니다.'); fetchData() } } + + return ( <> <LoadingOverlay isLoading={isLoading ?? false} /> @@ -98,11 +107,17 @@ const Page = () => { <Label className="w-20 text-xl text-gray-600">등록기간</Label> <DatePicker mode={'single'} selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} /> <span>~</span> <DatePicker mode={'single'} selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} /> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> <Input @@ -134,7 +149,24 @@ const Page = () => { <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> </div> </div> - <UiTable headName='' tableData={tableData} headlist={tableHeadlistOldPp} pageSize={10} total={totalData} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn) } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> + <UiTable + headName='' + tableData={tableData} + headlist={tableHeadlistOldPp} + pageSize={10} + total={totalData} + children={undefined} + cellClick={(index) => { + if (index != null) { + const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; + const id = tableData[index]?.atflId ?? ''; + setFileNm(fileName); + setAtflId(id); + setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn); + } + }} + onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + /> </ListDiv> <ListDiv className="mt-4"> <OperFileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> From c1d741dd498e44be8887cca2d536caada510fea8 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 11:23:01 +0900 Subject: [PATCH 202/259] =?UTF-8?q?feat:=20table=20Data=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=8B=9C=20=EC=85=80=20=ED=81=B4=EB=A6=AD=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/table/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index fe720abc0..01bb18ba2 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -49,6 +49,12 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr } }, [resetSelection]); + // 테이블 데이터가 변경될 때마다 선택된 행 초기화하는 useEffect 추가 + useEffect(() => { + // 새로운 데이터가 로드되면 선택 상태 초기화 + setIdx(-1); + }, [tableData]); + const handlePageChange = (page: number) => { setCur(page); onPageChange(page); @@ -83,7 +89,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr ? <TableCell className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' + cellClick ? 'cursor-pointer' : '' } !font-bold`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} @@ -97,7 +103,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr : <TableCell className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' + cellClick ? 'cursor-pointer' : '' }`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} From c2ee97901ae584d7c181eb58aada3b9f9e4e03ad Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Tue, 8 Jul 2025 11:26:30 +0900 Subject: [PATCH 203/259] =?UTF-8?q?=EA=B0=95=EC=9A=B0=EB=9F=89=EB=8B=B9=20?= =?UTF-8?q?rdii?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/rdiiChart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 22f0d8876..840281988 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -106,7 +106,7 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => { }); fn.selectPplRdiiQty(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수량 조회 setRdiiQty(Math.round(data.rdiih*24)); // cmd: m³/d 단위로 변환 - setTotalVolume(Math.round(data.rdiih * data.sustaintime)); // 총체적 m³/mm + setTotalVolume(Math.round(data.rdiih * data.sustaintime / data.raintotal)); // 총체적 m³/mm }); setPopupOpen(false); }; From 25f04e565a2b087c62f59544a2aa0e2d083adb9b Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 8 Jul 2025 11:28:19 +0900 Subject: [PATCH 204/259] =?UTF-8?q?=EB=B9=88=EB=A0=88=EC=9D=B4=EC=96=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/map/lib/gis.core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/map/lib/gis.core.js b/packages/common/business_components/src/ui/map/lib/gis.core.js index b1b02a732..1a6b74c96 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.core.js +++ b/packages/common/business_components/src/ui/map/lib/gis.core.js @@ -561,15 +561,17 @@ GisApp.core.prototype = { */ setLayerOnMap: function (layerIds, visible, addQurryFlter) { for (let i in layerIds) { + let id = layerIds[i]; let layer = this.getLayerById(id); if (layer) { layer.setVisible(visible); } else if (visible) { const layerCode = GisApp.layerCode[id]; + if(!layerCode.lyrTyNm) continue; const queryFlter = layerCode?.flterSql || '' + ' ' + (addQurryFlter || ''); layerCode['flterSql'] = queryFlter; - //layer = this.addWmsLayer(layerCode); + //layer = this.addWmsLayer(layerCode); layer = this.addWfsLayer(layerCode); } } From 5ed4e0d48d3dceb8bc0e321428d632fd84308fa2 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Tue, 8 Jul 2025 11:40:18 +0900 Subject: [PATCH 205/259] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EC=A1=B0=EC=B9=98=20?= =?UTF-8?q?-=20=EC=88=98=EC=9A=94=EC=B2=98=EC=A0=95=EB=B3=B4=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D,=20=EB=B0=94=EC=B0=A8=ED=8A=B8=20=EC=83=89=EC=83=81?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/BarChart.tsx | 2 +- .../src/ui/sdmInsertForm/form.tsx | 104 +++++++++++++----- .../src/ui/sdmInsertForm/index.tsx | 15 ++- 3 files changed, 90 insertions(+), 31 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 0802a72e4..02d3a7c60 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -75,7 +75,7 @@ const CustomLegend = (props: any) => { }; export default function Chart({chartConfig=undefined, chartData=[], chartTitle='차트', chartClassName='w-full h-full', graphSize=40, yFieldText='', showLegend=false} : BarChartProps) { - const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4", "#FFEEAD", "#D4A5A5"]; + const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#FED16A", "#FFEEAD", "#D4A5A5"]; const getMaxValue = (data: any[], keyPrefix: string) => { return Math.max(...data.map(item => Object.keys(item) diff --git a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx index 2d7d2bf90..a42dea012 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx @@ -1,4 +1,5 @@ -import { FormField } from "../form"; +import React from 'react'; +import { FormField } from "../form"; import { SelectBox } from "../select"; import { Input } from "@common/components"; import { FormUi } from "../form_ui"; @@ -55,6 +56,7 @@ interface FormSchema { bznmTotNo?: string; rgtr?: string; dmdAplyPswd?: string; + dmdAplyPswdConfirm?: string; } interface SdmRegFormProps { @@ -85,12 +87,27 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const formatter = new AsYouType("KR"); const formatted = formatter.input(input); - // 저장할 값 처리: 숫자만 추출 - const digitsOnly = input.replace(/\D/g, ""); - return formatted }; + // 사업자등록번호 포맷팅 함수 (3-2-5 형식) + const formatBusinessNumber = (value: string) => { + // 숫자만 추출 + const digitsOnly = value.replace(/\D/g, ""); + + // 10자리까지만 처리 + const limitedDigits = digitsOnly.slice(0, 10); + + // 3-2-5 형식으로 포맷팅 + if (limitedDigits.length <= 3) { + return limitedDigits; + } else if (limitedDigits.length <= 5) { + return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3)}`; + } else { + return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3, 5)}-${limitedDigits.slice(5)}`; + } + }; + const initializeSigunData = useCallback((sidoCd: string) => { if (sidoCd === '0') { @@ -179,12 +196,15 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const value = e.target.value; if(noType === 'dmdInfoPk') { - if(orgBznmNo.substring(0,10) === value) { + // 숫자만 추출하여 저장 (포맷팅 제거) + const digitsOnly = value.replace(/\D/g, ""); + + if(orgBznmNo.substring(0,10) === digitsOnly) { setIsDuplicate(true); } else { setIsDuplicate(false); } - field?.onChange(value); + field?.onChange(digitsOnly); } else { if(orgBznmNo.substring(10,14) === value) { setIsDuplicate(true); @@ -296,7 +316,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun type="text" className="!text-xl text-gray-600" onChange={(e) => bznNoChange(e, 'dmdInfoPk', field)} - value={field.value} + value={formatBusinessNumber(field.value || '')} readOnly={!!updateList?.dmdInfoPk} /> ) @@ -368,32 +388,60 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun {...field} /> ) + }, + { + name: "dmdAplyPswdConfirm", + label: "패스워드확인", + component: (field) => ( + <Input + placeholder="패스워드를 입력하세요" + type="password" + className="!text-xl text-gray-600" + {...field} + /> + ) } ] return ( <> - {formFields.filter((item)=> - {if(updateList?.dmdInfoPk){ - return item.name !== 'dmdAplyPswd' - }else{ - return item - } - }) - .map(({ name, label, component }) => ( - <FormField - key={String(name)} - control={form.control} - name={name} - render={({ field }) => ( - name === 'bznmTotNo' ? component(field) : ( - <FormUi label={label}> - {component(field)} - </FormUi> - ) - )} - /> - ))} + {formFields + .filter(({ name }) => !(updateList?.dmdInfoPk && (name === "dmdAplyPswd" || name === "dmdAplyPswdConfirm"))) + .map(({ name, label, component }) => { + const error = form.formState.errors[name]; + const inputId = `${name}-input`; + const errorId = `${name}-error`; + const isRequired = ["ctpvCd", "sggCd", "dmdCoNm", "dmdInfoPk", "daddr", "telno", "dmdAplyPswd", "dmdAplyPswdConfirm"].includes(name); + + return ( + <FormField + key={String(name)} + control={form.control} + name={name} + render={({ field }) => ( + <div className="mb-4"> + <label htmlFor={inputId} className="block text-gray-800 font-medium"> + {label} + {isRequired && <span className="text-red-500 ml-1">*</span>} + </label> + + {React.cloneElement(component(field), { + id: inputId, + "aria-required": isRequired, + "aria-invalid": !!error, + "aria-describedby": error ? errorId : undefined + })} + + {error?.message && ( + <p id={errorId} role="alert" className="text-red-500 text-sm mt-1"> + {error.message} + </p> + )} + </div> + )} + /> + ); + })} </> ); } \ No newline at end of file diff --git a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx index 4219602e6..c564b63dd 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx @@ -47,7 +47,17 @@ const createFormSchema = (isBznmTotNoDisabled: boolean, isDuplicate: boolean ,up ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 : z.string().optional() .refine((val) => !val || (val.length >= 8 && val.length <= 16), "패스워드는 8자 이상 16자 이내로 입력해주세요"), - + dmdAplyPswdConfirm: z.string() + .min(1, "패스워드확인을 입력해주세요"), +}).refine((data) => { + // 패스워드 확인 검증 + if (data.dmdAplyPswd && data.dmdAplyPswdConfirm) { + return data.dmdAplyPswd === data.dmdAplyPswdConfirm; + } + return true; +}, { + message: "패스워드가 일치하지 않습니다", + path: ["dmdAplyPswdConfirm"], // 에러를 패스워드 확인 필드에 표시 }); type FormSchema = z.infer<ReturnType<typeof createFormSchema>>; @@ -62,6 +72,7 @@ const defaultValues: FormSchema = { telno: '', rgtr: '', dmdAplyPswd: '', + dmdAplyPswdConfirm: '', }; /** @@ -149,7 +160,7 @@ export default function SdmInsertForm({selectSidoData, selectSigunData, dataList console.log(' formData ', formData) /* await insertSdmData(formData); */ - rtnInputData(formData as DemandCompType); + rtnInputData(formData as unknown as DemandCompType); //router.push(`/pages/sdmMng/sdmInfoInsert?${queryParams.toString()}`); From 208c2fd32173030ccd6d95f491318c5c1d15aacf Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Tue, 8 Jul 2025 12:41:42 +0900 Subject: [PATCH 206/259] =?UTF-8?q?=EA=B0=95=EC=9A=B0=EC=9C=A0=EC=9E=85?= =?UTF-8?q?=EC=88=98=20=EB=B6=84=EC=84=9D=EC=A0=95=EB=B3=B4=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EB=AA=A9=EB=A1=9D=EC=97=90=EC=84=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/aplcnYms.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 5ac5ee0a8..9e7f3fe50 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -72,7 +72,7 @@ export const getDcTree = async () => { }; const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string, hidden?: boolean }[] => { - let yyyymms1 = yyyymms.map(dateStr => { + const yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); const month = dateStr.slice(4, 6); return { @@ -208,12 +208,12 @@ export const selectPplRdiiQty = async(rainInfwtAnlsSn:number, pplMngNo:string) = } }; -export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number }[] => { +export const getOptionsRdiiAnlsInfo = (anlsArr: TRdiiAnls[]): { text: string; val: number, hidden?: boolean }[] => { const options = anlsArr.map(anls => ({ text: anls.anlsInfo, val: anls.rainInfwtAnlsSn, })); - options.unshift({ val: 0, text: '선택' }); + options.unshift({ val: 0, text: '선택', hidden: true }); return options; }; From a6fb951aa6d1d8203fab6f8dabe67aef89171763 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Tue, 8 Jul 2025 12:58:20 +0900 Subject: [PATCH 207/259] chart height --- .../map/components/popupComponent/chart/infilChart.tsx | 2 +- .../map/components/popupComponent/chart/rdiiChart.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index df9ac29a0..fe08f34f0 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -265,7 +265,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { onOpenChange={setIsModalOpen} headerTitle="" bodyClass={` - h-[50vh] + min-h-[50vh] w-[50vw] max-w-none max-h-none diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx index 840281988..33b65ace0 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/rdiiChart.tsx @@ -106,7 +106,9 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => { }); fn.selectPplRdiiQty(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수량 조회 setRdiiQty(Math.round(data.rdiih*24)); // cmd: m³/d 단위로 변환 - setTotalVolume(Math.round(data.rdiih * data.sustaintime / data.raintotal)); // 총체적 m³/mm + if (data.raintotal && data.rainTotal !== 0) { + setTotalVolume(Math.round(data.rdiih * data.sustaintime / data.raintotal)); // 총체적 m³/mm + } }); setPopupOpen(false); }; @@ -248,7 +250,7 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => { onOpenChange={setIsModalOpen} headerTitle="" bodyClass={` - h-[50vh] + min-h-[50vh] w-[50vw] max-w-none max-h-none From 0afd2310de8296a5ee25989af2114e49d0b5cd43 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 13:44:13 +0900 Subject: [PATCH 208/259] =?UTF-8?q?fix:=20fileUploadForm.tsx=20=EA=B0=99?= =?UTF-8?q?=EC=9D=80=20=ED=8C=8C=EC=9D=BC=20=EC=97=B0=EC=86=8D=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=93=B1=EB=A1=9D=EC=8B=9C=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EB=AA=85=EC=9D=B4=20=ED=91=9C=EC=8B=9C=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/components/ui/fileUploadForm.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/sn/app/components/ui/fileUploadForm.tsx b/apps/sn/app/components/ui/fileUploadForm.tsx index 3cd663e01..fb626348e 100644 --- a/apps/sn/app/components/ui/fileUploadForm.tsx +++ b/apps/sn/app/components/ui/fileUploadForm.tsx @@ -29,6 +29,8 @@ const FileUploadForm = ({ const [files, setFiles] = useState<FileList | null>(null); const [upload, setUpload] = useState<Upload | null>(null); const uniqueId = useId(); // 각 FileUploadForm 인스턴스에 대한 고유 ID 생성 + // FileUploader 컴포넌트를 강제로 재마운트하기 위한 key 상태 추가 + const [uploaderKey, setUploaderKey] = useState(0); const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }]; // 현재 년도부터 10년 전까지의 년도 옵션 생성 @@ -64,6 +66,7 @@ const FileUploadForm = ({ <div className='flex items-center gap-2'> {/* FileUploader와 Button을 정렬하는 메인 flex 컨테이너 */} <div className="w-[300px] mr-4"> {/* FileUploader의 너비와 오른쪽 여백을 제어하는 컨테이너 */} <FileUploader + key={uploaderKey} // key 추가: 변경 시 컴포넌트 재마운트됨 id={uniqueId} className="!h-auto !max-w-none flex-row items-center gap-2" accept={accept} @@ -133,6 +136,8 @@ const FileUploadForm = ({ onSubmit(fileNm, selectedYear, selectedQuarter, internalAtflCd || '', internalAtflId || ''); setFiles(null); // 파일 업로드 후 파일 목록 초기화 setFileName(''); // 파일명 초기화 + // 파일 업로드 후 FileUploader 컴포넌트를 재마운트하기 위해 key 값 변경 + setUploaderKey(prev => prev + 1); } }} > From 29a7c5d1c57b8ed5b6986462c774904b94a4b806 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 8 Jul 2025 13:52:12 +0900 Subject: [PATCH 209/259] =?UTF-8?q?=EB=AF=B8=EB=93=A4=EC=9B=A8=EC=96=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/middleware.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index b5a8e7981..725586530 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -20,7 +20,8 @@ export function middleware(req: NextRequest) { console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); } - else if (pathname.startsWith("/geoserver")) { + + if (pathname.startsWith("/geoserver")) { let queryParams = searchParams.toString(); const typename = searchParams.get("TYPENAME"); @@ -61,7 +62,8 @@ export function middleware(req: NextRequest) { console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); } - else if ( + + if ( pathname.startsWith("/attach-service") || pathname.startsWith("/cms-service") ) { @@ -80,7 +82,8 @@ export function middleware(req: NextRequest) { headers: requestHeaders, }); } - else if (pathname.startsWith("/user-service")) { + + if (pathname.startsWith("/user-service")) { const requestHeaders = new Headers(req.headers); const newUrl = `${SERVER_API_URL}${pathname}`; @@ -91,7 +94,8 @@ export function middleware(req: NextRequest) { headers: requestHeaders, }); } - else if (pathname.startsWith("/dc-service")) { + + if (pathname.startsWith("/dc-service")) { const requestHeaders = new Headers(req.headers); const newUrl = `${RSONE_DC_URL}${pathname}`; From 52a5650ca593c82790d8d34d5f38293797f41739 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 19:20:04 +0900 Subject: [PATCH 210/259] =?UTF-8?q?feat:=20DatePicker=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20zIndex=20props=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/src/ui/date-picker/index.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/common/components/src/ui/date-picker/index.tsx b/packages/common/components/src/ui/date-picker/index.tsx index ee5d37872..67265df0e 100644 --- a/packages/common/components/src/ui/date-picker/index.tsx +++ b/packages/common/components/src/ui/date-picker/index.tsx @@ -2,7 +2,7 @@ import "./date-picker.css"; import { format } from "date-fns"; import { CalendarIcon } from "lucide-react"; -import type { DayPickerSingleProps } from "react-day-picker"; +import type { DayPicker } from "react-day-picker"; import { cn } from "../../lib/utils"; import { Button } from "../button"; @@ -12,12 +12,15 @@ import { Popover, PopoverContent, PopoverTrigger } from "../popover"; type DatePickerProps = { placeholder?: string; disabled?: boolean; -} & DayPickerSingleProps; + selected?: Date; + zIndex?: number; // z-index prop 추가 +} & React.ComponentProps<typeof DayPicker>; export function DatePicker({ className, placeholder = "날짜 선택", disabled, + zIndex, // zIndex prop 받기 ...props }: DatePickerProps) { return ( @@ -36,8 +39,13 @@ export function DatePicker({ )} </Button> </PopoverTrigger> - <PopoverContent className="w-auto p-0"> - <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} /> + <PopoverContent + className={cn( + "w-auto p-0", + zIndex ? `z-[${zIndex}]` : "" // zIndex가 있으면 적용, 없으면 기본값 + )} + > + <Calendar classNames={{ cell: "rounded-md" }} {...props} /> </PopoverContent> </Popover> ); From 4224375b3a5aa1e3213b96ccfc3fff067a9ce06a Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 19:31:51 +0900 Subject: [PATCH 211/259] =?UTF-8?q?feat:=20DatePicker=20zIndex=20props=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/components/src/ui/date-picker/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/common/components/src/ui/date-picker/index.tsx b/packages/common/components/src/ui/date-picker/index.tsx index 67265df0e..85c584e5f 100644 --- a/packages/common/components/src/ui/date-picker/index.tsx +++ b/packages/common/components/src/ui/date-picker/index.tsx @@ -40,10 +40,8 @@ export function DatePicker({ </Button> </PopoverTrigger> <PopoverContent - className={cn( - "w-auto p-0", - zIndex ? `z-[${zIndex}]` : "" // zIndex가 있으면 적용, 없으면 기본값 - )} + className="w-auto p-0" + style={{ zIndex: zIndex || 'auto' }} > <Calendar classNames={{ cell: "rounded-md" }} {...props} /> </PopoverContent> From 166fc81f7ebde920bc1e394f904f06aff2907183 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Tue, 8 Jul 2025 19:38:00 +0900 Subject: [PATCH 212/259] =?UTF-8?q?feat:=20=EA=B0=90=EB=A6=AC=EC=A7=80?= =?UTF-8?q?=EC=A0=81=EC=82=AC=ED=95=AD=20=EB=8C=80=EC=9D=91=20-=20?= =?UTF-8?q?=EB=85=B8=ED=9B=84=20=ED=95=98=EC=88=98=EA=B4=80=EB=A1=9C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?-=20=EB=B6=84=EA=B8=B0=20=EC=A1=B0=EA=B1=B4=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=20-=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95=20-=20?= =?UTF-8?q?=EC=85=80=20=ED=81=B4=EB=A6=AD=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20-=20=EC=9E=90=EC=B2=B4=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20=EC=A0=95=EB=B3=B4=20=EC=9E=85=EB=A0=A5=20=EB=90=98?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95=20-=20=EB=8B=A8=EC=9C=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20-=20=ED=95=98=EC=88=98=EB=A7=A8=ED=99=80?= =?UTF-8?q?=20=EB=9A=9C=EA=BB=91=EC=9E=AC=EC=A7=88=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=ED=91=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 35 ++- .../map/components/InputSection.tsx | 8 +- .../map/components/common/table.ts | 285 ++++++++++++------ .../components/popupComponent/MsSwagePpl.tsx | 2 +- .../map/components/popupComponent/Ssc.tsx | 17 +- .../components/popupComponent/sewagePump.tsx | 13 +- .../map/components/popupComponent/smh.tsx | 3 +- .../map/featureClickEventPopup.tsx | 47 ++- apps/sn/app/components/ui/verticalTable.tsx | 2 +- 9 files changed, 291 insertions(+), 121 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index e17b80724..73cc5fc8e 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -2,13 +2,13 @@ import FeatureClickEventPopup from './featureClickEventPopup'; import React, { useEffect, useState } from 'react'; import axios from 'axios'; import { UiModal, UiTable } from '@common/business_components/ui'; -import { Button, Input, Label } from '@common/components'; +import { Button, DatePicker, Input, Label } from '@common/components'; import { UiTable2 } from '@common/business_components/ui/table/index-2'; import { UITab2 } from '@common/business_components/ui/tab/index-2'; import { SelectBox2 } from '@common/business_components/ui/select/index-2'; import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; -import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbrCol2 } from './components/common/table'; +import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -122,6 +122,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [가동개시_종료_월, set가동개시_종료_월] = useState(''); const [가동개시_시작_일, set가동개시_시작_일] = useState(''); const [가동개시_종료_일, set가동개시_종료_일] = useState(''); + const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) + const [toDate, setToDate] = useState(new Date()) // 로딩바 const [isLoading, setIsLoading] = useState(false); @@ -142,7 +144,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ else if (basicType === 'tb_il_swage_prcs_fclt') dynamicHeadlist = SwtrmtFcltCol2; // 하수처리시설 else if (basicType === 'tb_ms_swage_prcs_zone') dynamicHeadlist = SwtrmtPrcsZoneCol2; // 하수처리구역 else if (basicType === 'tb_ms_swage_mhl') dynamicHeadlist = MsSwageMhlCol2; // 하수맨홀 - else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = SewagePump2; // 하수펌프장 + else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = ExclnSewagePumpCol2; // 하수펌프장 else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbrCol2; // 우수토실 // 조회 버튼 클릭 시 1페이지로 이동하도록 수정 @@ -948,8 +950,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ value={workType} /> - {/* 설치년도 */} - <YearRangeSelectBox + {/* 수행기간 */} + {/* <YearRangeSelectBox start={yearFilter.시작} end={yearFilter.종료} onChange={(range) => @@ -959,8 +961,29 @@ const SearchModal: React.FC<SearchModalProps> = ({ 종료: range.end, }) } - startLabel="설치년도" + startLabel="수행기간" endLabel="" + /> */} + <DatePicker + className='mr-4' + mode={'single'} + selected={fromDate} + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + zIndex={102} + /> + <span>~</span> + <DatePicker + className='ml-4' + mode={'single'} + selected={toDate} + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + zIndex={102} /> <div className="flex items-center"> {/* 경과년도 */} diff --git a/apps/sn/app/(map-layout)/map/components/InputSection.tsx b/apps/sn/app/(map-layout)/map/components/InputSection.tsx index fe8897703..209361293 100644 --- a/apps/sn/app/(map-layout)/map/components/InputSection.tsx +++ b/apps/sn/app/(map-layout)/map/components/InputSection.tsx @@ -20,14 +20,14 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on <Table variant="secondary" className="w-full"> <TableHeader> <TableRow> - <TableHead className="border border-gray-300 px-2 py-2 text-sm">년도</TableHead> - <TableHead className="border border-gray-300 px-2 py-2 text-sm">구분</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm w-[80px]">년도</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm w-auto">구분</TableHead> </TableRow> </TableHeader> <TableBody> {data.map((row, index) => ( <TableRow key={index}> - <TableCell className="border border-gray-300 px-2 py-2 text-sm"> + <TableCell className="border border-gray-300 px-2 py-2 text-sm w-[80px]"> <input type="text" value={row.year} @@ -35,7 +35,7 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal" /> </TableCell> - <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal"> + <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal w-auto"> {row.type} </TableCell> </TableRow> diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 1747106cc..f114cf97b 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,65 +1,65 @@ // 하수관로 export const MsSwagePplCol = [ - { id: 'avg_grdn', title: '평균구배' }, - { id: 'clar_fvlc', title: '맑음유속' }, - { id: 'drtw_mltv_area', title: '오수배수면적' }, - { id: 'excln_mltv_area', title: '우수배수면적' }, { id: 'fclt_mng_no', title: '시설관리번호' }, - // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - // { id: 'fid', title: 'FID' }, - // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, { id: 'inst_mng_no', title: '기관관리번호' }, { id: 'instl_ymd', title: '설치일자' }, { id: 'mapsht_no', title: '도엽번호' }, - // { id: 'mng_inst_cd', title: '관리기관코드' }, - // { id: 'mqlt_cd', title: '재질코드' }, - // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, - { id: 'pdmt', title: '관경' }, - { id: 'prlg', title: '연장' }, - { id: 'rnyssn_fvlc', title: '우기유속' }, - { id: 'scend_dpth', title: '종점깊이' }, - { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, - { id: 'tmpt_dpth', title: '시점깊이' }, + { id: 'pdmt', title: '관경(mm)' }, + { id: 'prlg', title: '연장(m)' }, + { id: 'usg_cd', title: '용도코드' }, + { id: 'mqlt_cd', title: '재질코드' }, + { id: 'avg_grdn', title: '평균구배(m/m)' }, + { id: 'drtw_mltv_area', title: '오수배수면적(m²)' }, + { id: 'excln_mltv_area', title: '우수배수면적(m²)' }, + { id: 'tmpt_dpth', title: '시점깊이(m)' }, { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, + { id: 'scend_dpth', title: '종점깊이(m)' }, + { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, { id: 'trfln_cnt', title: '차선수' }, - // { id: 'usg_cd', title: '용도코드' }, - { id: 'vrtc_len', title: '세로길이' }, - { id: 'wdth_len', title: '가로길이' }, + { id: 'vrtc_len', title: '세로길이(m)' }, + { id: 'wdth_len', title: '가로길이(m)' }, + // { id: 'rnyssn_fvlc', title: '우기 시 유속(m/s)' }, + // { id: 'clar_fvlc', title: '건기 시 유속(m/s)' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + // { id: 'fclty_shp_cd', title: '시설물형태코드' }, + // { id: 'fid', title: 'FID' }, + // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] export const MsSwagePplCol2 = [ - { id: 'avgGrdn', title: '평균구배' }, - { id: 'clarFvlc', title: '맑음유속' }, - { id: 'drtwMltvArea', title: '오수배수면적' }, - { id: 'exclnMltvArea', title: '우수배수면적' }, { id: 'fcltMngNo', title: '시설관리번호' }, - // { id: 'fcltyShpCd', title: '시설물형태코드' }, - // { id: 'fid', title: 'FID' }, - // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, { id: 'instMngNo', title: '기관관리번호' }, { id: 'instlYmd', title: '설치일자' }, { id: 'mapshtNo', title: '도엽번호' }, + { id: 'pdmt', title: '관경(mm)' }, + { id: 'prlg', title: '연장(m)' }, + { id: 'avgGrdn', title: '평균구배(m/m)' }, + { id: 'rnysnFvlc', title: '우기 시 유속(m/s)' }, + { id: 'clarFvlc', title: '건기 시 유속(m/s)' }, + { id: 'drtwMltvArea', title: '오수배수면적(m²)' }, + { id: 'exclnMltvArea', title: '우수배수면적(m²)' }, + { id: 'tmptDpth', title: '시점깊이(m)' }, + { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, + { id: 'scendDpth', title: '종점깊이(m)' }, + { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, + { id: 'trflnCnt', title: '차선수' }, + { id: 'vrtcLen', title: '세로길이(m)' }, + { id: 'wdthLen', title: '가로길이(m)' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + // { id: 'fid', title: 'FID' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, // { id: 'mngInstCd', title: '관리기관코드' }, // { id: 'mqltCd', title: '재질코드' }, // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'pdmt', title: '관경' }, - { id: 'prlg', title: '연장' }, - // { id: 'rnysnFvlc', title: '우기유속' }, - { id: 'scendDpth', title: '종점깊이' }, - { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, - { id: 'tmptDpth', title: '시점깊이' }, - { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, - { id: 'trflnCnt', title: '차선수' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'vrtcLen', title: '세로길이' }, - { id: 'wdthLen', title: '가로길이' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] // 하수처리시설 export const SwtrmtFcltCol = [ { id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, - { id: 'fclt_cpct', title: '시설용량' }, + { id: 'fclt_cpct', title: '시설용량(㎥/d)' }, { id: 'rgn_expln', title: '지역설명' }, { id: 'cmcn_ymd', title: '준공일자' }, { id: 'oprtng_strt_ymd', title: '가동개시일자' }, @@ -78,26 +78,26 @@ export const SwtrmtFcltCol = [ { id: 'rdnm_addr', title: '도로명주소' }, { id: 'dtl_rdnm_addr', title: '상세도로명주소' }, { id: 'dschg_wtst_nm', title: '방류수계명' }, - { id: 'plln_area', title: '부지면적' }, + { id: 'plln_area', title: '부지면적(m²)' }, { id: 'mng_rprtv_bzenty_nm', title: '관리대행업제명' }, - { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수' }, - { id: 'prcs_zone_area_sum', title: '처리구역면적합계' }, + { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수(인)' }, + { id: 'prcs_zone_area_sum', title: '처리구역면적합계(m²)' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprs_msrc_cn', title: '대표공법내용' }, - { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량' }, - { id: 'stty_crtr_toc', title: '법정기준TOC' }, - { id: 'stty_crtr_ss', title: '법정기준SS' }, - { id: 'stty_crtr_tn', title: '법정기준총질소' }, - { id: 'stty_crtr_tph', title: '법정기준총인' }, - { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수' }, + { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량(mg/L)' }, + { id: 'stty_crtr_toc', title: '법정기준TOC((mg/L))' }, + { id: 'stty_crtr_ss', title: '법정기준SS(mg/L)' }, + { id: 'stty_crtr_tn', title: '법정기준총질소(mg/L)' }, + { id: 'stty_crtr_tph', title: '법정기준총인(mg/L)' }, + { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수(군수/100mL)' }, { id: 'bsn_nm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; export const SwtrmtFcltCol2 = [ { id: 'swtrmtFcltNm', title: '하수처리시설명' }, - { id: 'fcltCpct', title: '시설용량' }, + { id: 'fcltCpct', title: '시설용량(㎥/d)' }, { id: 'rgnExpln', title: '지역설명' }, { id: 'cmcnYmd', title: '준공일자' }, { id: 'oprtngStrtYmd', title: '가동개시일자' }, @@ -116,20 +116,20 @@ export const SwtrmtFcltCol2 = [ { id: 'rdnmAddr', title: '도로명주소' }, { id: 'dtlRdnmAddr', title: '상세도로명주소' }, { id: 'dschgWtstNm', title: '방류수계명' }, - { id: 'pllnArea', title: '부지면적' }, + { id: 'pllnArea', title: '부지면적(m²)' }, { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, - { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, - { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, + { id: 'swtrmtPpltnCnt', title: '하수처리인구수(인)' }, + { id: 'prcsZoneAreaSum', title: '처리구역면적합계(m²)' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprsMsrcCn', title: '대표공법내용' }, - { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, - { id: 'sttyCrtrToc', title: '법정기준TOC' }, - { id: 'sttyCrtrSs', title: '법정기준SS' }, - { id: 'sttyCrtrTn', title: '법정기준총질소' }, - { id: 'sttyCrtrTph', title: '법정기준총인' }, - { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, + { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량(mg/L)' }, + { id: 'sttyCrtrToc', title: '법정기준TOC(mg/L)' }, + { id: 'sttyCrtrSs', title: '법정기준SS(mg/L)' }, + { id: 'sttyCrtrTn', title: '법정기준총질소(mg/L)' }, + { id: 'sttyCrtrTph', title: '법정기준총인(mg/L)' }, + { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수(군수/100mL)' }, { id: 'bsnNm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; @@ -170,14 +170,14 @@ export const MsSwageMhlCol = [ // { id: 'usg_cd', title: '용도코드' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, // { id: 'mhl_knd_cd', title: '맨홀종류코드' }, - { id: 'swage_mh_diam', title: '하수맨홀구경' }, - { id: 'wdth_len', title: '가로길이' }, - { id: 'vrtc_len', title: '세로길이' }, - // { id: 'mqltCd', title: '재질코드' }, + { id: 'swage_mh_diam', title: '하수맨홀구경(mm)' }, + { id: 'mqlt_cd', title: '재질코드' }, + { id: 'wdth_len', title: '가로길이(m)' }, + { id: 'vrtc_len', title: '세로길이(m)' }, // { id: 'ang_dir', title: '표고' }, - { id: 'altd_vl', title: '표고' }, - { id: 'dpthlVl', title: '심도' }, - // { id: 'instMngNo', title: '기관관리번호' } + { id: 'altd_vl', title: '표고(EL.m)' }, + { id: 'dpthlVl', title: '심도(m)' }, + // { id: 'inst_mng_no', title: '기관관리번호' } ]; export const MsSwageMhlCol2 = [ // { id: 'fid', title: 'FID' }, @@ -192,18 +192,81 @@ export const MsSwageMhlCol2 = [ // { id: 'usgCd', title: '용도코드' }, // { id: 'fcltyShpCd', title: '시설물형태코드' }, // { id: 'mhlKndCd', title: '맨홀종류코드' }, - { id: 'swageMhDiam', title: '하수맨홀구경' }, - { id: 'wdthLen', title: '가로길이' }, - { id: 'vrtcLen', title: '세로길이' }, - // { id: 'mqltCd', title: '재질코드' }, + { id: 'swageMhDiam', title: '하수맨홀구경(mm)' }, + { id: 'mqltCd', title: '재질코드' }, + { id: 'wdthLen', title: '가로길이(m)' }, + { id: 'vrtcLen', title: '세로길이(m)' }, // { id: 'angDir', title: '표고' }, - { id: 'altdVl', title: '표고' }, - { id: 'dpthlVl', title: '심도' }, + { id: 'altdVl', title: '표고(EL.m)' }, + { id: 'dpthlVl', title: '심도(m)' }, // { id: 'instMngNo', title: '기관관리번호' } ]; +// 하수맨홀 뚜껑재질 코드표 +export const MS_SWAGE_MHL_CODES = [ + { val: "SBC000", text: "미분류" }, + { val: "SBC001", text: "주철" }, + { val: "SBC002", text: "철판" }, + { val: "SBC003", text: "콘크리트" }, + { val: "SBC004", text: "그레이팅" }, + { val: "SBC091", text: "칼라" }, + { val: "SBC092", text: "S.G" }, + { val: "SBC999", text: "기타" }, + { val: "SBC900", text: "각주철" }, + { val: "SBC901", text: "강재" }, + { val: "SBC902", text: "나무" }, + { val: "SBC903", text: "나무,널판지,합판" }, + { val: "SBC904", text: "대리석" }, + { val: "SBC905", text: "뚜껑없음" }, + { val: "SBC906", text: "보도용콘크리트" }, + { val: "SBC907", text: "스틸(ST)" }, + { val: "SBC908", text: "신형 CON" }, + { val: "SBC909", text: "알루미늄" }, + { val: "SBC910", text: "염화비닐(PE)" }, + { val: "SBC911", text: "인조석" }, + { val: "SBC912", text: "인조석(주철)" }, + { val: "SBC913", text: "인조CONC" }, + { val: "SBC914", text: "철, 철근" }, + { val: "SBC915", text: "칼라콘크리트" }, + { val: "SBC916", text: "플라스틱" }, + { val: "SBC917", text: "PVC" }, + { val: "SBC918", text: "SP" }, + { val: "SBC919", text: "SS" }, + { val: "SBC920", text: "닥타일주철" }, + { val: "SBC921", text: "철근G" }, + { val: "SBC922", text: "폴리에틸렌(PE)" }, + { val: "SBC923", text: "회주철" } +]; +// 하수맨홀 용도 코드표 +export const MS_SWAGE_MHL_USE_CODES = [ + { val: "SMU000", text: "미분류" }, + { val: "SMU001", text: "우수" }, + { val: "SMU002", text: "오수" }, + { val: "SMU003", text: "집수" }, + { val: "SMU004", text: "합류" }, + { val: "SMU005", text: "차집" }, + { val: "SMU999", text: "기타" }, + { val: "SMU900", text: "1호" }, + { val: "SMU901", text: "2호" }, + { val: "SMU902", text: "3호" }, + { val: "SMU903", text: "4호" }, + { val: "SMU904", text: "5호" }, + { val: "SMU905", text: "6호" }, + { val: "SMU906", text: "7호" }, + { val: "SMU907", text: "8호" }, + { val: "SMU908", text: "구거용맨홀" }, + { val: "SMU909", text: "부관부착맨홀" }, + { val: "SMU910", text: "조립식맨홀" }, + { val: "SMU911", text: "특1호" }, + { val: "SMU912", text: "특2호" }, + { val: "SMU913", text: "특3호" }, + { val: "SMU914", text: "특4호" }, + { val: "SMU915", text: "특5호" }, + { val: "SMU916", text: "하수맨홀용도" }, + { val: "SMU917", text: "현장타설관거용" } +]; -// 하수펌프장 -export const SewagePump = [ +// 우수펌프장 +export const ExclnSewagePumpCol = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, @@ -213,17 +276,17 @@ export const SewagePump = [ // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instl_ymd', title: '설치일자' }, { id: 'swage_pmstn_nm', title: '하수펌프장명' }, - { id: 'plln_area', title: '부지면적' }, - // { id: 'opngSttsCd', title: '개통상태코드' }, + { id: 'plln_area', title: '부지면적(m²)' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'daily_prcs_cpct', title: '일일처리용량' }, - { id: 'max_impnd_cpct', title: '최대저수용량' }, - { id: 'altd_vl', title: '표고' }, - { id: 'wtlv_vl', title: '수위' }, - { id: 'excln_wpmp_ablt', title: '우수양수능력' }, + { id: 'daily_prcs_cpct', title: '일일처리용량(㎥)' }, + { id: 'max_impnd_cpct', title: '최대저수용량(㎥)' }, + { id: 'altd_vl', title: '표고(EL.m)' }, + { id: 'wtlv_vl', title: '수위(m)' }, + { id: 'excln_wpmp_ablt', title: '우수양수능력(m²/d)' }, // { id: 'instMngNo', title: '기관관리번호' }, ] -export const SewagePump2 = [ +export const ExclnSewagePumpCol2 = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, @@ -233,14 +296,56 @@ export const SewagePump2 = [ // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, { id: 'swagePmstnNm', title: '하수펌프장명' }, - { id: 'pllnArea', title: '부지면적' }, + { id: 'pllnArea', title: '부지면적(m²)' }, // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'dailyPrcsCpct', title: '일일처리용량' }, - // { id: 'max_impndCpct', title: '최대저수용량' }, - { id: 'altdVl', title: '표고' }, - { id: 'wtlvVl', title: '수위' }, - { id: 'exclnWpmpAblt', title: '우수양수능력' }, + { id: 'dailyPrcsCpct', title: '일일처리용량(㎥)' }, + { id: 'max_impndCpct', title: '최대저수용량(㎥)' }, + { id: 'altdVl', title: '표고(EL.m)' }, + { id: 'wtlvVl', title: '수위(m)' }, + { id: 'exclnWpmpAblt', title: '우수양수능력(m²/d)' }, + // { id: 'instMngNo', title: '기관관리번호' }, +] + +// 오수펌프장 +export const DrtwSewagePumpCol1 = [ + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapsht_no', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'swage_pmstn_nm', title: '하수펌프장명' }, + { id: 'plln_area', title: '부지면적(m²)' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'daily_prcs_cpct', title: '일일처리용량(㎥)' }, + { id: 'max_impnd_cpct', title: '최대저수용량(㎥)' }, + { id: 'altd_vl', title: '표고(EL.m)' }, + { id: 'wtlv_vl', title: '수위(m)' }, + { id: 'excln_wpmp_ablt', title: '오수양수능력(m²/d)' }, + // { id: 'instMngNo', title: '기관관리번호' }, +] +export const DrtwSewagePumpCol2 = [ + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'swagePmstnNm', title: '하수펌프장명' }, + { id: 'pllnArea', title: '부지면적(m²)' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'dailyPrcsCpct', title: '일일처리용량(㎥)' }, + { id: 'max_impndCpct', title: '최대저수용량(㎥)' }, + { id: 'altdVl', title: '표고(EL.m)' }, + { id: 'wtlvVl', title: '수위(m)' }, + { id: 'exclnWpmpAblt', title: '오수양수능력(m²/d)' }, // { id: 'instMngNo', title: '기관관리번호' }, ] @@ -253,11 +358,11 @@ export const stofcbrCol = [ // { id: 'mng_inst_cd', title: '관리기관코드' }, { id: 'instl_ymd', title: '설치일자' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'worflw_wall_hgt', title: '월류벽높이' }, + { id: 'worflw_wall_hgt', title: '월류벽높이(m)' }, // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, { id: 'swage_mhl_mng_no', title: '하수맨홀관리번호' }, - { id: 'drtn_angl', title: '방향각도' }, + { id: 'drtn_angl', title: '방향각도(°)' }, ] export const stofcbrCol2 = [ // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, @@ -267,11 +372,11 @@ export const stofcbrCol2 = [ // { id: 'mng_inst_cd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'worflwWallHgt', title: '월류벽높이' }, + { id: 'worflwWallHgt', title: '월류벽높이(m)' }, // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, { id: 'swageMhlMngNo', title: '하수맨홀관리번호' }, - { id: 'drtnAngl', title: '방향각도' }, + { id: 'drtnAngl', title: '방향각도(°)' }, ] // 중점우수토실 측정지점 @@ -287,7 +392,7 @@ export const untrtSwgRainCol1 = [ // 중점우수토실 측정지점 시설현황 export const untrtSwgRainCol2 = [ { id: 'flwmtr_mesure_tp_etc', title: '구분' }, - { id: 'discharge_pipe_spec', title: '방류관로 규격' }, + { id: 'discharge_pipe_spec', title: '방류관로 규격(m)' }, { id: 'swr_ppl_eqp_ar', title: '배수구역 면적(m²)' }, { id: 'swr_trt_popl', title: '하수처리 인구(인)' }, { id: 'screen_instl_at', title: '스크린설치 여부' }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 46537a7dd..26b3a60aa 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -7,7 +7,7 @@ import { handleInputChange } from '../common'; // 하수관로 const inputColumn = [ { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, { id: "basu", title: "배수구역", type: "input" }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 7e22ea03b..31aef5172 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -3,12 +3,19 @@ import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; import React, { useState } from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; +import { VerticalTable } from '@/components/ui/verticalTable'; import LoadingOverlay from '@/components/ui/LoadingBar'; -const Ssc = ({ featureData, chkMainSsc, additionalData }: { +const inputColumn = [ + { id: "place", title: "중점여부", type: "select", options: ["중점우수토실", "우수토실"] }, + { id: "guyeok", title: "처리구역", type: "input" }, +]; + +const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { featureData: any, chkMainSsc?: boolean, - additionalData?: any + additionalData?: any, + onSaveClick?: () => void }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [isDataLoaded, setIsDataLoaded] = useState(false); @@ -93,7 +100,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { return ( <div> - {/* <VerticalTable + <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} @@ -105,7 +112,9 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { onPageChange={function (page: number): void { throw new Error('Function not implemented.'); }} - /> */} + showSaveButton={true} + onSaveClick={onSaveClick} + /> {chkMainSsc && ( <div> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index 4eaf1f18d..f0c4d21b3 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -1,17 +1,22 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' -const inputColumn = [ - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, +const exclnInputColumn = [ + { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "freq", title: "설계빈도", type: "input" }, + { id: "freq", title: "설계빈도(년)", type: "input" }, ] +const drtwInputColumn = [ + { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, + { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, +] + // 하수펌프장 const sewagePump = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( <VerticalTable headName='자체 입력정보' tableData={[]} - headlist={inputColumn} + headlist={exclnInputColumn} pageSize={0} total={0} children={undefined} diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx index 46e76f244..7f2251063 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx @@ -2,11 +2,10 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "guyeok", title: "처리구역", type: "input" }, { id: "basu", title: "배수구역", type: "input" }, { id: "bungu", title: "배수분구", type: "input" }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, - { id: 'spec', title: '규격', type: 'input' }, ]; const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 16c4f99a8..72831902f 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState, useCallback, useMemo } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol, stofcbrCol } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, ExclnSewagePumpCol, MsSwageMhlCol, stofcbrCol, MS_SWAGE_MHL_CODES } from "./components/common/table"; import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore"; @@ -29,8 +29,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); const [additionalDataError, setAdditionalDataError] = useState<string | null>(null); // 🎯 InfilChart 및 RdiiChart 관련 상태 추가 - const { setIsOpen:setIsModalInfil } = useInfilChartModalStore(); - const { setIsOpen:setIsModalRdii } = useRdiiChartModalStore(); + const { setIsOpen: setIsModalInfil } = useInfilChartModalStore(); + const { setIsOpen: setIsModalRdii } = useRdiiChartModalStore(); // 🎯 관로관리번호 추출 const pplMngNo = featureData?.values_?.fclt_mng_no || ""; @@ -135,8 +135,27 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, console.log('gis data', featureData.values_); let data = featureData.values_; - setfetchData(data) - setTableData(data); + + // 하수맨홀인 경우 용도코드를 텍스트로 변환 + if (selectedLayerName === '하수맨홀' && data) { + const processedData = { ...data }; + + // mqlt_cd 값 변환 (재질코드) + if (processedData.mqlt_cd) { + const materialCodeItem = MS_SWAGE_MHL_CODES.find( + code => code.val === processedData.mqlt_cd.trim() + ); + if (materialCodeItem) { + processedData.mqlt_cd = `${materialCodeItem.text}`; + } + } + + setfetchData(processedData); + setTableData(processedData); + } else { + setfetchData(data); + setTableData(data); + } switch (selectedLayerName) { case '하수처리시설': @@ -173,6 +192,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, case '우수토실': setHeadlist(stofcbrCol) setButtonChk(false) + setChkMainSsc(false) break; case '하수관로': setHeadlist(MsSwagePplCol) @@ -185,7 +205,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, // setButtonChk(true) // break; case '하수펌프장': - setHeadlist(SewagePump) + setHeadlist(ExclnSewagePumpCol) setButtonChk(true) break; case '하수맨홀': @@ -237,32 +257,41 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setIsModalOpen(false); // 모달 닫기 }; + // 저장 버튼 이벤트 const btnClickEvent = async () => { const bodyData: Record<string, any> = {} + if (buttonChk && contentRef.current) { const inputElements = contentRef.current.querySelectorAll('input'); const selectElements = contentRef.current.querySelectorAll('select'); + // 카멜케이스 변환 함수 const toCamelCase = (str: string) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()); + // select 태그의 값 가져오기 selectElements.forEach((select) => { const camelCaseId = toCamelCase(select.id); bodyData[camelCaseId] = select.value; }); + // input 태그의 값 가져오기 inputElements.forEach((input) => { const camelCaseId = toCamelCase(input.id); bodyData[camelCaseId] = input.value; }); + if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' else if (layerNm === '중점우수토실') bodyData['lyrTypeNm'] = 'om_dt_untrt_swg_rain' else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' + bodyData['fid'] = featureId + const data = await putData(`v1/fclts/${featureId}`, bodyData); + if (data.status == 200) { alert('저장되었습니다') setTableData(data) @@ -286,13 +315,13 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 하수관로일 때만 Infil/RDII 버튼 표시 */} {layerNm === '하수관로' && ( <> - <Button onClick={() => setIsModalInfil(true)} + <Button onClick={() => setIsModalInfil(true)} className="px-2 py-1 text-xl text-blue-600 border border-blue-600 rounded hover:bg-gray-700" color="white" > 침입수분석 </Button> - <Button onClick={() => setIsModalRdii(true)} + <Button onClick={() => setIsModalRdii(true)} className="px-2 py-1 text-xl text-gray-600 border border-gray-600 rounded hover:bg-gray-700" color="white" > @@ -343,7 +372,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 InfilChart 및 RdiiChart 컴포넌트 추가 */} <InfilChart pplMngNo={pplMngNo} /> - <RdiiChart pplMngNo={pplMngNo} /> + <RdiiChart pplMngNo={pplMngNo} /> </div> ) } diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 1455c9e4a..19e302c30 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -141,7 +141,7 @@ export function VerticalTable({ <input id={head.id} type="text" - value={""} + value={String(formData[head.id] ?? "")} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" /> From bb593385209b3ff2b403c1630406f86fdff01a5f Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 8 Jul 2025 22:01:11 +0900 Subject: [PATCH 213/259] =?UTF-8?q?env=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 4 ++-- apps/sn/middleware.ts | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index dfb172cf0..35c1476f5 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,9 +1,9 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 3002 -NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_PROXY_HOST = http://localhost:3002 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver -NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com #자료관 데이터 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index b5a8e7981..d69ef5513 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -15,12 +15,18 @@ export function middleware(req: NextRequest) { const searchParams = req.nextUrl.searchParams; if (pathname.startsWith("/server")) { - const queryParams = searchParams.toString(); - const newUrl = `${SERVER_API_URL}${pathname.replace("/server", "")}${queryParams ? `?${queryParams}` : ""}`; - console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`); + + const decodedParams = Array.from(searchParams.entries()) + .map(([key, value]) => `${key}=${decodeURIComponent(value)}`) + .join("&"); + + const newUrl = `${SERVER_API_URL}${pathname.replace("/server", "")}${ + decodedParams ? `?${decodedParams}` : "" + }`; return NextResponse.rewrite(new URL(newUrl)); } - else if (pathname.startsWith("/geoserver")) { + + if (pathname.startsWith("/geoserver")) { let queryParams = searchParams.toString(); const typename = searchParams.get("TYPENAME"); @@ -61,7 +67,8 @@ export function middleware(req: NextRequest) { console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`); return NextResponse.rewrite(new URL(newUrl)); } - else if ( + + if ( pathname.startsWith("/attach-service") || pathname.startsWith("/cms-service") ) { @@ -80,7 +87,8 @@ export function middleware(req: NextRequest) { headers: requestHeaders, }); } - else if (pathname.startsWith("/user-service")) { + + if (pathname.startsWith("/user-service")) { const requestHeaders = new Headers(req.headers); const newUrl = `${SERVER_API_URL}${pathname}`; @@ -91,7 +99,8 @@ export function middleware(req: NextRequest) { headers: requestHeaders, }); } - else if (pathname.startsWith("/dc-service")) { + + if (pathname.startsWith("/dc-service")) { const requestHeaders = new Headers(req.headers); const newUrl = `${RSONE_DC_URL}${pathname}`; From bf241073b02582908ff7a2f3cbb21a1be307d25a Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Wed, 9 Jul 2025 01:36:19 +0900 Subject: [PATCH 214/259] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=8B=9C=20=EC=98=88=EC=99=B8=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80(=ED=8C=A8=EC=8A=A4=EC=9B=8C=EB=93=9C=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=EB=9E=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/sdmInsertForm/form.tsx | 1 + .../common/business_components/src/ui/sdmInsertForm/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx index a42dea012..e58592837 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx @@ -234,6 +234,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun }, [updateList,form]); useEffect(() => { + console.log( 'form.formState.errors ', form.formState.errors) },[form.formState.errors]) const formFields: Array<{ diff --git a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx index c564b63dd..9b46cc653 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx @@ -47,7 +47,9 @@ const createFormSchema = (isBznmTotNoDisabled: boolean, isDuplicate: boolean ,up ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 : z.string().optional() .refine((val) => !val || (val.length >= 8 && val.length <= 16), "패스워드는 8자 이상 16자 이내로 입력해주세요"), - dmdAplyPswdConfirm: z.string() + dmdAplyPswdConfirm: updateList?.dmdInfoPk // 업데이트일경우 + ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 + :z.string() .min(1, "패스워드확인을 입력해주세요"), }).refine((data) => { // 패스워드 확인 검증 From 4745c87ab0c3ea541d706012d6cbed9b24f3a98d Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Wed, 9 Jul 2025 01:44:17 +0900 Subject: [PATCH 215/259] =?UTF-8?q?=EC=88=98=EC=9A=94=EC=B2=98=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=5F=20rgtr=20nullsh=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/sdmInsertForm/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx index 9b46cc653..35c609f9e 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx @@ -42,7 +42,7 @@ const createFormSchema = (isBznmTotNoDisabled: boolean, isDuplicate: boolean ,up .min(8, "전화번호는 8자 이상 입력해주세요") .max(11, "전화번호는 11자 이내로 입력해주세요") .regex(/^[0-9]+$/, "전화번호는 숫자만 입력 가능합니다"), - rgtr: z.string().optional(), + rgtr: z.string().nullish(), dmdAplyPswd : updateList?.dmdInfoPk // 업데이트일경우 ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 : z.string().optional() From 4109ff73bb69dc26ace0aa4f4dce235cb455b69f Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Wed, 9 Jul 2025 08:55:02 +0900 Subject: [PATCH 216/259] =?UTF-8?q?=ED=95=98=EC=88=98=EB=8F=84=EC=A0=95?= =?UTF-8?q?=EB=B9=84=EA=B8=B0=EB=B3=B8=EA=B3=84=ED=9A=8D=20=EC=A7=84?= =?UTF-8?q?=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 5 +- apps/sn/app/(map-layout)/map/SearchModal.tsx | 66 ++++++---- .../popupComponent/chart/aplcnYms.ts | 6 - .../popupComponent/chart/infilChart.tsx | 8 +- .../map/components/searchModalReportApi.ts | 122 ++++++++++++++++++ 5 files changed, 167 insertions(+), 40 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts diff --git a/apps/sn/.env.local b/apps/sn/.env.local index dfb172cf0..69c944d7e 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -1,6 +1,7 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 3002 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_ADDR_URL = http://con.mind-one.co.kr:11082 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 @@ -11,5 +12,5 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API -#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API -#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 차장님 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.222:8883/sewerage-service/api # 박이정 차장님 API diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index e17b80724..28c93bafa 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -10,6 +10,8 @@ import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; +import { GovSidoSigunguSearchForm } from '@/components/ui/govSidoSigunguSearchForm'; +import { useDcTree } from './components/searchModalReportApi'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -99,9 +101,9 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [tableCount, setTableCount] = useState<number>(0); const [curPage, setCurPage] = useState(1); const [basicType, setBasicType] = useState(BASIC_TYPES[0]?.val ?? ""); - const [시도, set시도] = useState(0); - const [시군구, set시군구] = useState(0); - const [처리구역, set처리구역] = useState(""); + const [ctpvCd, setCtpvCd] = useState(0); + const [sigungu, setSigungu] = useState(0); + const [swageProcessingZone, set처리구역] = useState(""); // 날짜 상태 선언 const [시작1, set시작1] = useState(""); const [시작2, set시작2] = useState(""); @@ -176,8 +178,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ set가동개시_종료_월(""); set가동개시_시작_일(""); set가동개시_종료_일(""); - set시도(0); - set시군구(0); + setCtpvCd(0); + setSigungu(0); set처리구역(""); setYearFilter({ 시작: "", @@ -226,14 +228,21 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); - console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); - const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); - console.log('필터링된 API 결과(개수):', res.data.count); - console.log('필터링된 API 결과(데이터):', res.data.data); + if (activeTab === 'report') { + const data = flattenFolders(dcData); + console.log('dcTree:', data); + setTableData(data || []); + setTableCount(data.length || []); + } else { + console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); + const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); + console.log('필터링된 API 결과(개수):', res.data.count); + console.log('필터링된 API 결과(데이터):', res.data.data); + setTableData(res.data.data || []); + setTableCount(res.data.count || []); + console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 + } - setTableData(res.data.data || []); - setTableCount(res.data.count || []); - console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 setShowTable(true); } catch (err) { console.error('API ERROR:', err); @@ -309,8 +318,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ // 하수처리구역용 CQL 필터 생성 const zoneCqlFilters = () => { const cqlFilters: string[] = []; - if (시도) cqlFilters.push(`ctpv_cd='${시도}'`); - if (시군구) cqlFilters.push(`sgg_cd='${시군구}'`); + if (ctpvCd) cqlFilters.push(`ctpv_cd='${ctpvCd}'`); + if (sigungu) cqlFilters.push(`sgg_cd='${sigungu}'`); if (변수1) cqlFilters.push(`swtrmt_zone_nm ILIKE '%${변수1}%'`); if (변수2) cqlFilters.push(`swtrmt_fclt_nm ILIKE '%${변수2}%'`); return cqlFilters; @@ -430,9 +439,9 @@ const SearchModal: React.FC<SearchModalProps> = ({ const reportCqlFilters = () => { const cqlFilters: string[] = []; // 설치년도 범위 - if (시도) cqlFilters.push(`ctpv_cd='${시도}'`); - if (시군구) cqlFilters.push(`sgg_cd='${시군구}'`); - if (처리구역) cqlFilters.push(`처리구역='${처리구역}'`); + if (ctpvCd) cqlFilters.push(`ctpv_cd='${ctpvCd}'`); + if (sigungu) cqlFilters.push(`sgg_cd='${sigungu}'`); + if (swageProcessingZone) cqlFilters.push(`swageProcessingZone='${swageProcessingZone}'`); if (변수1) cqlFilters.push(`처리구역코드='${변수1}'`); const startDate = getDateString( yearFilter.시작, @@ -677,13 +686,13 @@ const SearchModal: React.FC<SearchModalProps> = ({ <div className="mb-3"> <div className="mb-2 flex items-center"> <SidoSigunguSelectBox - sido={시도} - sigungu={시군구} + sido={ctpvCd} + sigungu={sigungu} onSidoChange={(sidoId) => { - set시도(sidoId); - set시군구(0); + setCtpvCd(sidoId); + setSigungu(0); }} - onSigunguChange={set시군구} + onSigunguChange={setSigungu} /> <Label className="mr-2 w-auto text-xl text-gray-600"> 하수처리구역명 @@ -991,13 +1000,13 @@ const SearchModal: React.FC<SearchModalProps> = ({ {/* 시도, 시군구, 하수처리구역 한 줄 */} <div className="mb-6 flex items-center"> <SidoSigunguSelectBox - sido={시도} - sigungu={시군구} + sido={ctpvCd} + sigungu={sigungu} onSidoChange={(sidoId) => { - set시도(sidoId); - set시군구(0); + setCtpvCd(sidoId); + setSigungu(0); }} - onSigunguChange={set시군구} + onSigunguChange={setSigungu} /> </div> <div className="flex justify-between items-center mb-6"> @@ -1008,7 +1017,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ label="하수처리구역" selectArray={처리구역List.map(opt => ({ val: opt.val, text: opt.text }))} onSelectValue={val => set처리구역(String(val))} - value={처리구역} + value={swageProcessingZone} /> <Input className='!text-xl w-[100px] placeholder:text-center mr-8' @@ -1028,6 +1037,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ endLabel="" /> </div> + {/* 조회 버튼 중앙 정렬 */} <div className="absolute bottom-4 right-4 mr-2"> <Button className="text-base py-2" onClick={handleSearch}>조회</Button> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts index 9e7f3fe50..81daed0ed 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/aplcnYms.ts @@ -65,12 +65,6 @@ export type TOilqData = { oilq: number; // 유량 } -export const getDcTree = async () => { - const queryString = ''; - const result = await getDcData(`/api/v1/dc/tree${queryString ? `?${queryString}` : ''}`); - return result; -}; - const getOptionsAplcnYm = (yyyymms: string[]): { text: string; val: string, hidden?: boolean }[] => { const yyyymms1 = yyyymms.map(dateStr => { const year = dateStr.slice(0, 4); diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index fe08f34f0..fa1e707e7 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -20,7 +20,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [selectedAplcnYm, setSelectedAplcnYm] = useState(""); const [inftwtAnlss, setInftwtAnlss] = useState<TInftwtAnls[]>([]); - const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택', hidden: true }]); // 침입수분석정보 options + const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택' }]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 const [selectedInftwtAnls, setSelectedInftwtAnls] = useState<number>(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ @@ -52,7 +52,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { setPopupOpen(true); // 모달이 닫힐 때 조회조건팝업은 열어두기 setSelectedAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 - setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); // 침입수분석정보 초기화 + setInftwtAnlsInfos([{ val: 0, text: '선택'}]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 setSelectedInftwtAnls(0); // 침입수분석 일련번호 초기화 setChartData({ chartData1: [], chartData2: [], }); // 차트 데이터 초기화 @@ -72,7 +72,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { // 빈 값이면 초기화만 하고 종료 if (!selectedValue || selectedValue === "0" || selectedValue === "") { - setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); return; } @@ -85,7 +85,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { } catch (error) { console.error("selectInftwtAnls 에러:", error); setInftwtAnlss([]); - setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); + setInftwtAnlsInfos([{ val: 0, text: '선택'}]); } setSelectedInftwtAnls(0); }; diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts new file mode 100644 index 000000000..304cdee95 --- /dev/null +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -0,0 +1,122 @@ +import {useState, useEffect} from 'react'; +import { getDcData } from '@/components/lib/api'; +import moment from "moment"; + +const ADDR_URL = process.env.NEXT_PUBLIC_ADDR_URL; +export type SelectDataType = { + val: string; + text: string; + sido?: string; // 시도 코드 +}; + +type Folder = { + fldrSn: string; + upFldrSn: string; + fldrNm: string; + sort_seq: number; + children: Folder[]; +}; + +type FlattenedFolder = { + [key: string]: string; +}; + +// 시군구 데이터 +const getSggCd = async (): Promise<SelectDataType[]> => { + try { + const response = await fetch(`${ADDR_URL}/api/v1/addr/sgg`, { method: "GET", headers: { accept: "application/json" } }); + if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`); + const res = await response.json(); + const sgg = res.data; + const sggCd = sgg.map((item: any) => ({ + val: item.adstDstrCd, + sido: item.sido, + text: item.gugun, + })); + sggCd.unshift({ val: '0', text: '전체' }); // "전체" 옵션 추가 + return sggCd; + } catch (error) { + console.error('시군구 데이터를 가져오는데 실패했습니다:', error); + return [{ val: '0', text: '전체', sido: '0' }]; + } +}; + +export const useSggCd = () => { + const [data, setData] = useState<SelectDataType[]>([]); + + useEffect(() => { + const fetch = async () => { + const result = await getSggCd(); + if (result) { + setData(result); + } + }; + fetch(); + }, []); + + return data; +}; + +const isYear = (value: string): boolean => { + return /^[0-9]{4}년$/.test(value); +}; + +function flattenFolders(data: Folder[]): FlattenedFolder[] { + const result: FlattenedFolder[] = []; + const sggCd = await getSggCd(); + function traverse( + node: Folder, + path: { [key: string]: string }, + level: number + ) { + if (level === 2) { + if (!sggCd.some(item => item.text === node.fldrNm)) { + } + if (isYear(node.fldrNm)) { + level++; + } + } + const newPath = { + ...path, + //[`level${level}_fldrSn`]: node.fldrSn, + [`level${level}`]: node.fldrNm, + }; + + if (node.children.length === 0) { + result.push(newPath); + } else { + node.children.forEach((child) => { + traverse(child, newPath, level + 1); + }); + } + } + + data.forEach((root) => traverse(root, {}, 0)); + + return result; +} + +export const useDcTree = () => { + const [data, setData] = useState<FlattenedFolder[]>([]); + + useEffect(() => { + const fetch = async () => { + const result = await getDcData(`/api/v1/dc/tree`); + if (result) { + const flattenedData = flattenFolders(result); + setData(flattenedData); + } + }; + fetch(); + }, []); + + return data; +}; + +export const getDcTree = async () => { + const queryString = ''; + const result = await getDcData(`/api/v1/dc/tree${queryString ? `?${queryString}` : ''}`); + return result; +}; + + From 6573981505c70541c238344b7fc17e065109dddd Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Wed, 9 Jul 2025 09:06:38 +0900 Subject: [PATCH 217/259] =?UTF-8?q?=EC=B9=A8=EC=9E=85=EC=88=98=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=EC=8B=9C=20=EC=84=A0=ED=83=9D=20=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/popupComponent/chart/infilChart.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index fe08f34f0..984391a95 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -20,7 +20,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 const [selectedAplcnYm, setSelectedAplcnYm] = useState(""); const [inftwtAnlss, setInftwtAnlss] = useState<TInftwtAnls[]>([]); - const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택', hidden: true }]); // 침입수분석정보 options + const [inftwtAnlsInfos, setInftwtAnlsInfos] = useState<any[]>([{ val: 0, text: '선택' }]); // 침입수분석정보 options const [inftwtAnls, setInftwtAnls] = useState<TInftwtAnls | null>(null); // 침입수분석정보 const [selectedInftwtAnls, setSelectedInftwtAnls] = useState<number>(0); // 침입수분석 정보 선택시 사용 const [chartData, setChartData] = useState<{ chartData1: DataType[]; chartData2: DataType[] }>({ @@ -52,7 +52,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { setPopupOpen(true); // 모달이 닫힐 때 조회조건팝업은 열어두기 setSelectedAplcnYm(""); // 상수사용월 초기화 setInftwtAnlss([]); // 침입수분석 초기화 - setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); // 침입수분석정보 초기화 + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); // 침입수분석정보 초기화 setInftwtAnls(null); // 침입수분석정보 초기화 setSelectedInftwtAnls(0); // 침입수분석 일련번호 초기화 setChartData({ chartData1: [], chartData2: [], }); // 차트 데이터 초기화 @@ -72,7 +72,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { // 빈 값이면 초기화만 하고 종료 if (!selectedValue || selectedValue === "0" || selectedValue === "") { - setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); return; } @@ -85,7 +85,7 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { } catch (error) { console.error("selectInftwtAnls 에러:", error); setInftwtAnlss([]); - setInftwtAnlsInfos([{ val: 0, text: '선택', hidden: true }]); + setInftwtAnlsInfos([{ val: 0, text: '선택' }]); } setSelectedInftwtAnls(0); }; From 2aa202ace3dcf4a573a5b498f91b047170edb226 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 9 Jul 2025 11:30:12 +0900 Subject: [PATCH 218/259] Revert "Merge branch 'iipbs/sn/ii' into iipbs/sn/main" This reverts commit 63012618a26413f7f53ec7e8062a6dd8d43d956e, reversing changes made to 6573981505c70541c238344b7fc17e065109dddd. --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 35 +-- .../map/components/InputSection.tsx | 8 +- .../map/components/common/table.ts | 289 ++++++------------ .../components/popupComponent/MsSwagePpl.tsx | 2 +- .../map/components/popupComponent/Ssc.tsx | 17 +- .../components/popupComponent/sewagePump.tsx | 13 +- .../map/components/popupComponent/smh.tsx | 3 +- .../map/featureClickEventPopup.tsx | 47 +-- .../(with-base-layout)/oper/floodPre/page.tsx | 47 +-- .../(with-base-layout)/oper/oldPp/page.tsx | 44 +-- apps/sn/app/components/ui/fileUploadForm.tsx | 5 - apps/sn/app/components/ui/verticalTable.tsx | 2 +- .../src/ui/chart/BarChart.tsx | 2 +- .../src/ui/sdmInsertForm/form.tsx | 104 ++----- .../src/ui/sdmInsertForm/index.tsx | 15 +- .../src/ui/sdmInsertForm/sdmNameBox.tsx | 152 ++++----- .../src/ui/search_form_left/index.tsx | 2 +- .../src/ui/table/index.tsx | 10 +- .../src/ui/table/uiPageNations.tsx | 10 +- .../components/src/ui/date-picker/index.tsx | 7 +- 20 files changed, 240 insertions(+), 574 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 73cc5fc8e..e17b80724 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -2,13 +2,13 @@ import FeatureClickEventPopup from './featureClickEventPopup'; import React, { useEffect, useState } from 'react'; import axios from 'axios'; import { UiModal, UiTable } from '@common/business_components/ui'; -import { Button, DatePicker, Input, Label } from '@common/components'; +import { Button, Input, Label } from '@common/components'; import { UiTable2 } from '@common/business_components/ui/table/index-2'; import { UITab2 } from '@common/business_components/ui/tab/index-2'; import { SelectBox2 } from '@common/business_components/ui/select/index-2'; import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; -import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; +import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -122,8 +122,6 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [가동개시_종료_월, set가동개시_종료_월] = useState(''); const [가동개시_시작_일, set가동개시_시작_일] = useState(''); const [가동개시_종료_일, set가동개시_종료_일] = useState(''); - const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) - const [toDate, setToDate] = useState(new Date()) // 로딩바 const [isLoading, setIsLoading] = useState(false); @@ -144,7 +142,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ else if (basicType === 'tb_il_swage_prcs_fclt') dynamicHeadlist = SwtrmtFcltCol2; // 하수처리시설 else if (basicType === 'tb_ms_swage_prcs_zone') dynamicHeadlist = SwtrmtPrcsZoneCol2; // 하수처리구역 else if (basicType === 'tb_ms_swage_mhl') dynamicHeadlist = MsSwageMhlCol2; // 하수맨홀 - else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = ExclnSewagePumpCol2; // 하수펌프장 + else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = SewagePump2; // 하수펌프장 else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbrCol2; // 우수토실 // 조회 버튼 클릭 시 1페이지로 이동하도록 수정 @@ -950,8 +948,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ value={workType} /> - {/* 수행기간 */} - {/* <YearRangeSelectBox + {/* 설치년도 */} + <YearRangeSelectBox start={yearFilter.시작} end={yearFilter.종료} onChange={(range) => @@ -961,29 +959,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ 종료: range.end, }) } - startLabel="수행기간" + startLabel="설치년도" endLabel="" - /> */} - <DatePicker - className='mr-4' - mode={'single'} - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} - zIndex={102} - /> - <span>~</span> - <DatePicker - className='ml-4' - mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} - zIndex={102} /> <div className="flex items-center"> {/* 경과년도 */} diff --git a/apps/sn/app/(map-layout)/map/components/InputSection.tsx b/apps/sn/app/(map-layout)/map/components/InputSection.tsx index 209361293..fe8897703 100644 --- a/apps/sn/app/(map-layout)/map/components/InputSection.tsx +++ b/apps/sn/app/(map-layout)/map/components/InputSection.tsx @@ -20,14 +20,14 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on <Table variant="secondary" className="w-full"> <TableHeader> <TableRow> - <TableHead className="border border-gray-300 px-2 py-2 text-sm w-[80px]">년도</TableHead> - <TableHead className="border border-gray-300 px-2 py-2 text-sm w-auto">구분</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm">년도</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm">구분</TableHead> </TableRow> </TableHeader> <TableBody> {data.map((row, index) => ( <TableRow key={index}> - <TableCell className="border border-gray-300 px-2 py-2 text-sm w-[80px]"> + <TableCell className="border border-gray-300 px-2 py-2 text-sm"> <input type="text" value={row.year} @@ -35,7 +35,7 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal" /> </TableCell> - <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal w-auto"> + <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal"> {row.type} </TableCell> </TableRow> diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index f114cf97b..1747106cc 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,65 +1,65 @@ // 하수관로 export const MsSwagePplCol = [ + { id: 'avg_grdn', title: '평균구배' }, + { id: 'clar_fvlc', title: '맑음유속' }, + { id: 'drtw_mltv_area', title: '오수배수면적' }, + { id: 'excln_mltv_area', title: '우수배수면적' }, { id: 'fclt_mng_no', title: '시설관리번호' }, - { id: 'inst_mng_no', title: '기관관리번호' }, - { id: 'instl_ymd', title: '설치일자' }, - { id: 'mapsht_no', title: '도엽번호' }, - { id: 'pdmt', title: '관경(mm)' }, - { id: 'prlg', title: '연장(m)' }, - { id: 'usg_cd', title: '용도코드' }, - { id: 'mqlt_cd', title: '재질코드' }, - { id: 'avg_grdn', title: '평균구배(m/m)' }, - { id: 'drtw_mltv_area', title: '오수배수면적(m²)' }, - { id: 'excln_mltv_area', title: '우수배수면적(m²)' }, - { id: 'tmpt_dpth', title: '시점깊이(m)' }, - { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, - { id: 'scend_dpth', title: '종점깊이(m)' }, - { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, - { id: 'trfln_cnt', title: '차선수' }, - { id: 'vrtc_len', title: '세로길이(m)' }, - { id: 'wdth_len', title: '가로길이(m)' }, - // { id: 'rnyssn_fvlc', title: '우기 시 유속(m/s)' }, - // { id: 'clar_fvlc', title: '건기 시 유속(m/s)' }, - // { id: 'mng_inst_cd', title: '관리기관코드' }, - // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, // { id: 'fid', title: 'FID' }, // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, + { id: 'inst_mng_no', title: '기관관리번호' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'mapsht_no', title: '도엽번호' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + // { id: 'mqlt_cd', title: '재질코드' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + { id: 'pdmt', title: '관경' }, + { id: 'prlg', title: '연장' }, + { id: 'rnyssn_fvlc', title: '우기유속' }, + { id: 'scend_dpth', title: '종점깊이' }, + { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, + { id: 'tmpt_dpth', title: '시점깊이' }, + { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, + { id: 'trfln_cnt', title: '차선수' }, + // { id: 'usg_cd', title: '용도코드' }, + { id: 'vrtc_len', title: '세로길이' }, + { id: 'wdth_len', title: '가로길이' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] export const MsSwagePplCol2 = [ + { id: 'avgGrdn', title: '평균구배' }, + { id: 'clarFvlc', title: '맑음유속' }, + { id: 'drtwMltvArea', title: '오수배수면적' }, + { id: 'exclnMltvArea', title: '우수배수면적' }, { id: 'fcltMngNo', title: '시설관리번호' }, - { id: 'instMngNo', title: '기관관리번호' }, - { id: 'instlYmd', title: '설치일자' }, - { id: 'mapshtNo', title: '도엽번호' }, - { id: 'pdmt', title: '관경(mm)' }, - { id: 'prlg', title: '연장(m)' }, - { id: 'avgGrdn', title: '평균구배(m/m)' }, - { id: 'rnysnFvlc', title: '우기 시 유속(m/s)' }, - { id: 'clarFvlc', title: '건기 시 유속(m/s)' }, - { id: 'drtwMltvArea', title: '오수배수면적(m²)' }, - { id: 'exclnMltvArea', title: '우수배수면적(m²)' }, - { id: 'tmptDpth', title: '시점깊이(m)' }, - { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, - { id: 'scendDpth', title: '종점깊이(m)' }, - { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, - { id: 'trflnCnt', title: '차선수' }, - { id: 'vrtcLen', title: '세로길이(m)' }, - { id: 'wdthLen', title: '가로길이(m)' }, // { id: 'fcltyShpCd', title: '시설물형태코드' }, // { id: 'fid', title: 'FID' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'instMngNo', title: '기관관리번호' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'mapshtNo', title: '도엽번호' }, // { id: 'mngInstCd', title: '관리기관코드' }, // { id: 'mqltCd', title: '재질코드' }, // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'pdmt', title: '관경' }, + { id: 'prlg', title: '연장' }, + // { id: 'rnysnFvlc', title: '우기유속' }, + { id: 'scendDpth', title: '종점깊이' }, + { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, + { id: 'tmptDpth', title: '시점깊이' }, + { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, + { id: 'trflnCnt', title: '차선수' }, // { id: 'usgCd', title: '용도코드' }, + { id: 'vrtcLen', title: '세로길이' }, + { id: 'wdthLen', title: '가로길이' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] // 하수처리시설 export const SwtrmtFcltCol = [ { id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, - { id: 'fclt_cpct', title: '시설용량(㎥/d)' }, + { id: 'fclt_cpct', title: '시설용량' }, { id: 'rgn_expln', title: '지역설명' }, { id: 'cmcn_ymd', title: '준공일자' }, { id: 'oprtng_strt_ymd', title: '가동개시일자' }, @@ -78,26 +78,26 @@ export const SwtrmtFcltCol = [ { id: 'rdnm_addr', title: '도로명주소' }, { id: 'dtl_rdnm_addr', title: '상세도로명주소' }, { id: 'dschg_wtst_nm', title: '방류수계명' }, - { id: 'plln_area', title: '부지면적(m²)' }, + { id: 'plln_area', title: '부지면적' }, { id: 'mng_rprtv_bzenty_nm', title: '관리대행업제명' }, - { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수(인)' }, - { id: 'prcs_zone_area_sum', title: '처리구역면적합계(m²)' }, + { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수' }, + { id: 'prcs_zone_area_sum', title: '처리구역면적합계' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprs_msrc_cn', title: '대표공법내용' }, - { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량(mg/L)' }, - { id: 'stty_crtr_toc', title: '법정기준TOC((mg/L))' }, - { id: 'stty_crtr_ss', title: '법정기준SS(mg/L)' }, - { id: 'stty_crtr_tn', title: '법정기준총질소(mg/L)' }, - { id: 'stty_crtr_tph', title: '법정기준총인(mg/L)' }, - { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수(군수/100mL)' }, + { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량' }, + { id: 'stty_crtr_toc', title: '법정기준TOC' }, + { id: 'stty_crtr_ss', title: '법정기준SS' }, + { id: 'stty_crtr_tn', title: '법정기준총질소' }, + { id: 'stty_crtr_tph', title: '법정기준총인' }, + { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수' }, { id: 'bsn_nm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; export const SwtrmtFcltCol2 = [ { id: 'swtrmtFcltNm', title: '하수처리시설명' }, - { id: 'fcltCpct', title: '시설용량(㎥/d)' }, + { id: 'fcltCpct', title: '시설용량' }, { id: 'rgnExpln', title: '지역설명' }, { id: 'cmcnYmd', title: '준공일자' }, { id: 'oprtngStrtYmd', title: '가동개시일자' }, @@ -116,20 +116,20 @@ export const SwtrmtFcltCol2 = [ { id: 'rdnmAddr', title: '도로명주소' }, { id: 'dtlRdnmAddr', title: '상세도로명주소' }, { id: 'dschgWtstNm', title: '방류수계명' }, - { id: 'pllnArea', title: '부지면적(m²)' }, + { id: 'pllnArea', title: '부지면적' }, { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, - { id: 'swtrmtPpltnCnt', title: '하수처리인구수(인)' }, - { id: 'prcsZoneAreaSum', title: '처리구역면적합계(m²)' }, + { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, + { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprsMsrcCn', title: '대표공법내용' }, - { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량(mg/L)' }, - { id: 'sttyCrtrToc', title: '법정기준TOC(mg/L)' }, - { id: 'sttyCrtrSs', title: '법정기준SS(mg/L)' }, - { id: 'sttyCrtrTn', title: '법정기준총질소(mg/L)' }, - { id: 'sttyCrtrTph', title: '법정기준총인(mg/L)' }, - { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수(군수/100mL)' }, + { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, + { id: 'sttyCrtrToc', title: '법정기준TOC' }, + { id: 'sttyCrtrSs', title: '법정기준SS' }, + { id: 'sttyCrtrTn', title: '법정기준총질소' }, + { id: 'sttyCrtrTph', title: '법정기준총인' }, + { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, { id: 'bsnNm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; @@ -170,14 +170,14 @@ export const MsSwageMhlCol = [ // { id: 'usg_cd', title: '용도코드' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, // { id: 'mhl_knd_cd', title: '맨홀종류코드' }, - { id: 'swage_mh_diam', title: '하수맨홀구경(mm)' }, - { id: 'mqlt_cd', title: '재질코드' }, - { id: 'wdth_len', title: '가로길이(m)' }, - { id: 'vrtc_len', title: '세로길이(m)' }, + { id: 'swage_mh_diam', title: '하수맨홀구경' }, + { id: 'wdth_len', title: '가로길이' }, + { id: 'vrtc_len', title: '세로길이' }, + // { id: 'mqltCd', title: '재질코드' }, // { id: 'ang_dir', title: '표고' }, - { id: 'altd_vl', title: '표고(EL.m)' }, - { id: 'dpthlVl', title: '심도(m)' }, - // { id: 'inst_mng_no', title: '기관관리번호' } + { id: 'altd_vl', title: '표고' }, + { id: 'dpthlVl', title: '심도' }, + // { id: 'instMngNo', title: '기관관리번호' } ]; export const MsSwageMhlCol2 = [ // { id: 'fid', title: 'FID' }, @@ -192,81 +192,18 @@ export const MsSwageMhlCol2 = [ // { id: 'usgCd', title: '용도코드' }, // { id: 'fcltyShpCd', title: '시설물형태코드' }, // { id: 'mhlKndCd', title: '맨홀종류코드' }, - { id: 'swageMhDiam', title: '하수맨홀구경(mm)' }, - { id: 'mqltCd', title: '재질코드' }, - { id: 'wdthLen', title: '가로길이(m)' }, - { id: 'vrtcLen', title: '세로길이(m)' }, + { id: 'swageMhDiam', title: '하수맨홀구경' }, + { id: 'wdthLen', title: '가로길이' }, + { id: 'vrtcLen', title: '세로길이' }, + // { id: 'mqltCd', title: '재질코드' }, // { id: 'angDir', title: '표고' }, - { id: 'altdVl', title: '표고(EL.m)' }, - { id: 'dpthlVl', title: '심도(m)' }, + { id: 'altdVl', title: '표고' }, + { id: 'dpthlVl', title: '심도' }, // { id: 'instMngNo', title: '기관관리번호' } ]; -// 하수맨홀 뚜껑재질 코드표 -export const MS_SWAGE_MHL_CODES = [ - { val: "SBC000", text: "미분류" }, - { val: "SBC001", text: "주철" }, - { val: "SBC002", text: "철판" }, - { val: "SBC003", text: "콘크리트" }, - { val: "SBC004", text: "그레이팅" }, - { val: "SBC091", text: "칼라" }, - { val: "SBC092", text: "S.G" }, - { val: "SBC999", text: "기타" }, - { val: "SBC900", text: "각주철" }, - { val: "SBC901", text: "강재" }, - { val: "SBC902", text: "나무" }, - { val: "SBC903", text: "나무,널판지,합판" }, - { val: "SBC904", text: "대리석" }, - { val: "SBC905", text: "뚜껑없음" }, - { val: "SBC906", text: "보도용콘크리트" }, - { val: "SBC907", text: "스틸(ST)" }, - { val: "SBC908", text: "신형 CON" }, - { val: "SBC909", text: "알루미늄" }, - { val: "SBC910", text: "염화비닐(PE)" }, - { val: "SBC911", text: "인조석" }, - { val: "SBC912", text: "인조석(주철)" }, - { val: "SBC913", text: "인조CONC" }, - { val: "SBC914", text: "철, 철근" }, - { val: "SBC915", text: "칼라콘크리트" }, - { val: "SBC916", text: "플라스틱" }, - { val: "SBC917", text: "PVC" }, - { val: "SBC918", text: "SP" }, - { val: "SBC919", text: "SS" }, - { val: "SBC920", text: "닥타일주철" }, - { val: "SBC921", text: "철근G" }, - { val: "SBC922", text: "폴리에틸렌(PE)" }, - { val: "SBC923", text: "회주철" } -]; -// 하수맨홀 용도 코드표 -export const MS_SWAGE_MHL_USE_CODES = [ - { val: "SMU000", text: "미분류" }, - { val: "SMU001", text: "우수" }, - { val: "SMU002", text: "오수" }, - { val: "SMU003", text: "집수" }, - { val: "SMU004", text: "합류" }, - { val: "SMU005", text: "차집" }, - { val: "SMU999", text: "기타" }, - { val: "SMU900", text: "1호" }, - { val: "SMU901", text: "2호" }, - { val: "SMU902", text: "3호" }, - { val: "SMU903", text: "4호" }, - { val: "SMU904", text: "5호" }, - { val: "SMU905", text: "6호" }, - { val: "SMU906", text: "7호" }, - { val: "SMU907", text: "8호" }, - { val: "SMU908", text: "구거용맨홀" }, - { val: "SMU909", text: "부관부착맨홀" }, - { val: "SMU910", text: "조립식맨홀" }, - { val: "SMU911", text: "특1호" }, - { val: "SMU912", text: "특2호" }, - { val: "SMU913", text: "특3호" }, - { val: "SMU914", text: "특4호" }, - { val: "SMU915", text: "특5호" }, - { val: "SMU916", text: "하수맨홀용도" }, - { val: "SMU917", text: "현장타설관거용" } -]; -// 우수펌프장 -export const ExclnSewagePumpCol = [ +// 하수펌프장 +export const SewagePump = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, @@ -276,17 +213,17 @@ export const ExclnSewagePumpCol = [ // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instl_ymd', title: '설치일자' }, { id: 'swage_pmstn_nm', title: '하수펌프장명' }, - { id: 'plln_area', title: '부지면적(m²)' }, - // { id: 'opngSttsCd', title: '개통상태코드' }, + { id: 'plln_area', title: '부지면적' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'daily_prcs_cpct', title: '일일처리용량(㎥)' }, - { id: 'max_impnd_cpct', title: '최대저수용량(㎥)' }, - { id: 'altd_vl', title: '표고(EL.m)' }, - { id: 'wtlv_vl', title: '수위(m)' }, - { id: 'excln_wpmp_ablt', title: '우수양수능력(m²/d)' }, + { id: 'daily_prcs_cpct', title: '일일처리용량' }, + { id: 'max_impnd_cpct', title: '최대저수용량' }, + { id: 'altd_vl', title: '표고' }, + { id: 'wtlv_vl', title: '수위' }, + { id: 'excln_wpmp_ablt', title: '우수양수능력' }, // { id: 'instMngNo', title: '기관관리번호' }, ] -export const ExclnSewagePumpCol2 = [ +export const SewagePump2 = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, @@ -296,56 +233,14 @@ export const ExclnSewagePumpCol2 = [ // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, { id: 'swagePmstnNm', title: '하수펌프장명' }, - { id: 'pllnArea', title: '부지면적(m²)' }, + { id: 'pllnArea', title: '부지면적' }, // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'dailyPrcsCpct', title: '일일처리용량(㎥)' }, - { id: 'max_impndCpct', title: '최대저수용량(㎥)' }, - { id: 'altdVl', title: '표고(EL.m)' }, - { id: 'wtlvVl', title: '수위(m)' }, - { id: 'exclnWpmpAblt', title: '우수양수능력(m²/d)' }, - // { id: 'instMngNo', title: '기관관리번호' }, -] - -// 오수펌프장 -export const DrtwSewagePumpCol1 = [ - // { id: 'fid', title: 'FID' }, - // { id: 'geom', title: 'geometry' }, - // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, - { id: 'fclt_mng_no', title: '시설관리번호' }, - // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'mapsht_no', title: '도엽번호' }, - // { id: 'mngInstCd', title: '관리기관코드' }, - { id: 'instl_ymd', title: '설치일자' }, - { id: 'swage_pmstn_nm', title: '하수펌프장명' }, - { id: 'plln_area', title: '부지면적(m²)' }, - // { id: 'opngSttsCd', title: '개통상태코드' }, - // { id: 'usgCd', title: '용도코드' }, - { id: 'daily_prcs_cpct', title: '일일처리용량(㎥)' }, - { id: 'max_impnd_cpct', title: '최대저수용량(㎥)' }, - { id: 'altd_vl', title: '표고(EL.m)' }, - { id: 'wtlv_vl', title: '수위(m)' }, - { id: 'excln_wpmp_ablt', title: '오수양수능력(m²/d)' }, - // { id: 'instMngNo', title: '기관관리번호' }, -] -export const DrtwSewagePumpCol2 = [ - // { id: 'fid', title: 'FID' }, - // { id: 'geom', title: 'geometry' }, - // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, - { id: 'fcltMngNo', title: '시설관리번호' }, - // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'mapshtNo', title: '도엽번호' }, - // { id: 'mngInstCd', title: '관리기관코드' }, - { id: 'instlYmd', title: '설치일자' }, - { id: 'swagePmstnNm', title: '하수펌프장명' }, - { id: 'pllnArea', title: '부지면적(m²)' }, - // { id: 'opngSttsCd', title: '개통상태코드' }, - // { id: 'usgCd', title: '용도코드' }, - { id: 'dailyPrcsCpct', title: '일일처리용량(㎥)' }, - { id: 'max_impndCpct', title: '최대저수용량(㎥)' }, - { id: 'altdVl', title: '표고(EL.m)' }, - { id: 'wtlvVl', title: '수위(m)' }, - { id: 'exclnWpmpAblt', title: '오수양수능력(m²/d)' }, + { id: 'dailyPrcsCpct', title: '일일처리용량' }, + // { id: 'max_impndCpct', title: '최대저수용량' }, + { id: 'altdVl', title: '표고' }, + { id: 'wtlvVl', title: '수위' }, + { id: 'exclnWpmpAblt', title: '우수양수능력' }, // { id: 'instMngNo', title: '기관관리번호' }, ] @@ -358,11 +253,11 @@ export const stofcbrCol = [ // { id: 'mng_inst_cd', title: '관리기관코드' }, { id: 'instl_ymd', title: '설치일자' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'worflw_wall_hgt', title: '월류벽높이(m)' }, + { id: 'worflw_wall_hgt', title: '월류벽높이' }, // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, { id: 'swage_mhl_mng_no', title: '하수맨홀관리번호' }, - { id: 'drtn_angl', title: '방향각도(°)' }, + { id: 'drtn_angl', title: '방향각도' }, ] export const stofcbrCol2 = [ // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, @@ -372,11 +267,11 @@ export const stofcbrCol2 = [ // { id: 'mng_inst_cd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'worflwWallHgt', title: '월류벽높이(m)' }, + { id: 'worflwWallHgt', title: '월류벽높이' }, // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, { id: 'swageMhlMngNo', title: '하수맨홀관리번호' }, - { id: 'drtnAngl', title: '방향각도(°)' }, + { id: 'drtnAngl', title: '방향각도' }, ] // 중점우수토실 측정지점 @@ -392,7 +287,7 @@ export const untrtSwgRainCol1 = [ // 중점우수토실 측정지점 시설현황 export const untrtSwgRainCol2 = [ { id: 'flwmtr_mesure_tp_etc', title: '구분' }, - { id: 'discharge_pipe_spec', title: '방류관로 규격(m)' }, + { id: 'discharge_pipe_spec', title: '방류관로 규격' }, { id: 'swr_ppl_eqp_ar', title: '배수구역 면적(m²)' }, { id: 'swr_trt_popl', title: '하수처리 인구(인)' }, { id: 'screen_instl_at', title: '스크린설치 여부' }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 26b3a60aa..46537a7dd 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -7,7 +7,7 @@ import { handleInputChange } from '../common'; // 하수관로 const inputColumn = [ { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, + { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, { id: "basu", title: "배수구역", type: "input" }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 31aef5172..7e22ea03b 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -3,19 +3,12 @@ import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; import React, { useState } from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; -import { VerticalTable } from '@/components/ui/verticalTable'; import LoadingOverlay from '@/components/ui/LoadingBar'; -const inputColumn = [ - { id: "place", title: "중점여부", type: "select", options: ["중점우수토실", "우수토실"] }, - { id: "guyeok", title: "처리구역", type: "input" }, -]; - -const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { +const Ssc = ({ featureData, chkMainSsc, additionalData }: { featureData: any, chkMainSsc?: boolean, - additionalData?: any, - onSaveClick?: () => void + additionalData?: any }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [isDataLoaded, setIsDataLoaded] = useState(false); @@ -100,7 +93,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { return ( <div> - <VerticalTable + {/* <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} @@ -112,9 +105,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { onPageChange={function (page: number): void { throw new Error('Function not implemented.'); }} - showSaveButton={true} - onSaveClick={onSaveClick} - /> + /> */} {chkMainSsc && ( <div> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index f0c4d21b3..4eaf1f18d 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -1,22 +1,17 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' -const exclnInputColumn = [ - { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, +const inputColumn = [ + { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "freq", title: "설계빈도(년)", type: "input" }, + { id: "freq", title: "설계빈도", type: "input" }, ] -const drtwInputColumn = [ - { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, -] - // 하수펌프장 const sewagePump = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( <VerticalTable headName='자체 입력정보' tableData={[]} - headlist={exclnInputColumn} + headlist={inputColumn} pageSize={0} total={0} children={undefined} diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx index 7f2251063..46e76f244 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx @@ -2,10 +2,11 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "input" }, + { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, { id: "basu", title: "배수구역", type: "input" }, { id: "bungu", title: "배수분구", type: "input" }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, + { id: 'spec', title: '규격', type: 'input' }, ]; const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 72831902f..16c4f99a8 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState, useCallback, useMemo } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, ExclnSewagePumpCol, MsSwageMhlCol, stofcbrCol, MS_SWAGE_MHL_CODES } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol, stofcbrCol } from "./components/common/table"; import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore"; @@ -29,8 +29,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); const [additionalDataError, setAdditionalDataError] = useState<string | null>(null); // 🎯 InfilChart 및 RdiiChart 관련 상태 추가 - const { setIsOpen: setIsModalInfil } = useInfilChartModalStore(); - const { setIsOpen: setIsModalRdii } = useRdiiChartModalStore(); + const { setIsOpen:setIsModalInfil } = useInfilChartModalStore(); + const { setIsOpen:setIsModalRdii } = useRdiiChartModalStore(); // 🎯 관로관리번호 추출 const pplMngNo = featureData?.values_?.fclt_mng_no || ""; @@ -135,27 +135,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, console.log('gis data', featureData.values_); let data = featureData.values_; - - // 하수맨홀인 경우 용도코드를 텍스트로 변환 - if (selectedLayerName === '하수맨홀' && data) { - const processedData = { ...data }; - - // mqlt_cd 값 변환 (재질코드) - if (processedData.mqlt_cd) { - const materialCodeItem = MS_SWAGE_MHL_CODES.find( - code => code.val === processedData.mqlt_cd.trim() - ); - if (materialCodeItem) { - processedData.mqlt_cd = `${materialCodeItem.text}`; - } - } - - setfetchData(processedData); - setTableData(processedData); - } else { - setfetchData(data); - setTableData(data); - } + setfetchData(data) + setTableData(data); switch (selectedLayerName) { case '하수처리시설': @@ -192,7 +173,6 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, case '우수토실': setHeadlist(stofcbrCol) setButtonChk(false) - setChkMainSsc(false) break; case '하수관로': setHeadlist(MsSwagePplCol) @@ -205,7 +185,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, // setButtonChk(true) // break; case '하수펌프장': - setHeadlist(ExclnSewagePumpCol) + setHeadlist(SewagePump) setButtonChk(true) break; case '하수맨홀': @@ -257,41 +237,32 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setIsModalOpen(false); // 모달 닫기 }; - // 저장 버튼 이벤트 const btnClickEvent = async () => { const bodyData: Record<string, any> = {} - if (buttonChk && contentRef.current) { const inputElements = contentRef.current.querySelectorAll('input'); const selectElements = contentRef.current.querySelectorAll('select'); - // 카멜케이스 변환 함수 const toCamelCase = (str: string) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()); - // select 태그의 값 가져오기 selectElements.forEach((select) => { const camelCaseId = toCamelCase(select.id); bodyData[camelCaseId] = select.value; }); - // input 태그의 값 가져오기 inputElements.forEach((input) => { const camelCaseId = toCamelCase(input.id); bodyData[camelCaseId] = input.value; }); - if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' else if (layerNm === '중점우수토실') bodyData['lyrTypeNm'] = 'om_dt_untrt_swg_rain' else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' - bodyData['fid'] = featureId - const data = await putData(`v1/fclts/${featureId}`, bodyData); - if (data.status == 200) { alert('저장되었습니다') setTableData(data) @@ -315,13 +286,13 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 하수관로일 때만 Infil/RDII 버튼 표시 */} {layerNm === '하수관로' && ( <> - <Button onClick={() => setIsModalInfil(true)} + <Button onClick={() => setIsModalInfil(true)} className="px-2 py-1 text-xl text-blue-600 border border-blue-600 rounded hover:bg-gray-700" color="white" > 침입수분석 </Button> - <Button onClick={() => setIsModalRdii(true)} + <Button onClick={() => setIsModalRdii(true)} className="px-2 py-1 text-xl text-gray-600 border border-gray-600 rounded hover:bg-gray-700" color="white" > @@ -372,7 +343,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 InfilChart 및 RdiiChart 컴포넌트 추가 */} <InfilChart pplMngNo={pplMngNo} /> - <RdiiChart pplMngNo={pplMngNo} /> + <RdiiChart pplMngNo={pplMngNo} /> </div> ) } diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 3578ff967..6ae0b3609 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -27,16 +27,16 @@ const Page = () => { const [curPage, setCurPage] = useState(1) //현재 페이지 const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 - - // 조회 const fetchData = async () => { setIsLoading(true) - // searchCmmnCd('SITEKNDCD') + searchCmmnCd('SITEKNDCD') try { const { data, total } = await searchData('v1/sbmrgPrevnt', { fromRegDt: formatDate(fromDate), + fromMngYr: manageYear, + toMngYr: mngQu, toRegDt: formatDate(toDate), - sbmrgPrevntBizNm: pjNm, + atflNm: pjNm, rgtrNm: usr, page: curPage - 1, size: '10' @@ -45,18 +45,12 @@ const Page = () => { setTotalData(total) } catch (error) { console.error('Error fetching data:', error) } - finally { - setFileNm(''); - setAtflId(''); - setSbmrgPrevntBizSn(''); - setIsLoading(false); - } + finally { setIsLoading(false); } } useEffect(() => { setCurPage(1) fetchData() }, []) - // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -65,7 +59,6 @@ const Page = () => { } handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) } - // 선택 파일 삭제 const isDeleteFile = async () => { if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) { @@ -103,19 +96,11 @@ const Page = () => { <Label className="w-20 text-xl text-gray-600">등록기간</Label> <DatePicker mode={'single'} selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} - /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> <span>~</span> <DatePicker mode={'single'} selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} - /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> </div> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> @@ -147,23 +132,7 @@ const Page = () => { <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile} >삭제</Button> </div> </div> - <UiTable - headName='' - tableData={tableData} - headlist={tableHeadlist} - pageSize={10} - total={totalData} - cellClick={(index) => { - if (index != null) { - const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; - const id = tableData[index]?.atflId ?? ''; - setFileNm(fileName); - setAtflId(id); - setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); - } - }} - onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} - /> + <UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> </ListDiv> <ListDiv className="mt-4"> <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index c4bac35b7..307452e2d 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -25,13 +25,14 @@ const Page = () => { const [curPage, setCurPage] = useState(1) const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 - // 데이터 조회 const fetchData = async () => { setIsLoading(true) try { const { data, total } = await searchData('v1/dcrpPpl', { fromRegDt: formatDate(fromDate), + fromMngYr: manageYear, + toMngYr: mngQu, toRegDt: formatDate(toDate), dcrpPplMtncBizNm: pjNm, rgtrNm: usr, @@ -43,18 +44,12 @@ const Page = () => { console.log(data, total) } catch (error) { console.error('Error fetching data:', error) - } finally { - setFileNm(''); - setAtflId(''); - setDcrpPplMtncBizSn(''); - setIsLoading(false) - } + } finally { setIsLoading(false) } } useEffect(() => { setCurPage(1) fetchData() }, []) - // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -64,7 +59,6 @@ const Page = () => { handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) return true } - // 파일 삭제 const isDeleteFile = async () => { if (dcrpPplMtncBizSn === '' || dcrpPplMtncBizSn === undefined) { @@ -82,7 +76,6 @@ const Page = () => { } } } - // 파일 등록 const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => { const data = await postData('v1/dcrpPpl', { @@ -95,8 +88,6 @@ const Page = () => { }) if (data) { alert('파일이 등록되었습니다.'); fetchData() } } - - return ( <> <LoadingOverlay isLoading={isLoading ?? false} /> @@ -107,17 +98,11 @@ const Page = () => { <Label className="w-20 text-xl text-gray-600">등록기간</Label> <DatePicker mode={'single'} selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> <span>~</span> <DatePicker mode={'single'} selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> <Input @@ -149,24 +134,7 @@ const Page = () => { <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> </div> </div> - <UiTable - headName='' - tableData={tableData} - headlist={tableHeadlistOldPp} - pageSize={10} - total={totalData} - children={undefined} - cellClick={(index) => { - if (index != null) { - const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; - const id = tableData[index]?.atflId ?? ''; - setFileNm(fileName); - setAtflId(id); - setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn); - } - }} - onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} - /> + <UiTable headName='' tableData={tableData} headlist={tableHeadlistOldPp} pageSize={10} total={totalData} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn) } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> </ListDiv> <ListDiv className="mt-4"> <OperFileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> diff --git a/apps/sn/app/components/ui/fileUploadForm.tsx b/apps/sn/app/components/ui/fileUploadForm.tsx index fb626348e..3cd663e01 100644 --- a/apps/sn/app/components/ui/fileUploadForm.tsx +++ b/apps/sn/app/components/ui/fileUploadForm.tsx @@ -29,8 +29,6 @@ const FileUploadForm = ({ const [files, setFiles] = useState<FileList | null>(null); const [upload, setUpload] = useState<Upload | null>(null); const uniqueId = useId(); // 각 FileUploadForm 인스턴스에 대한 고유 ID 생성 - // FileUploader 컴포넌트를 강제로 재마운트하기 위한 key 상태 추가 - const [uploaderKey, setUploaderKey] = useState(0); const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }]; // 현재 년도부터 10년 전까지의 년도 옵션 생성 @@ -66,7 +64,6 @@ const FileUploadForm = ({ <div className='flex items-center gap-2'> {/* FileUploader와 Button을 정렬하는 메인 flex 컨테이너 */} <div className="w-[300px] mr-4"> {/* FileUploader의 너비와 오른쪽 여백을 제어하는 컨테이너 */} <FileUploader - key={uploaderKey} // key 추가: 변경 시 컴포넌트 재마운트됨 id={uniqueId} className="!h-auto !max-w-none flex-row items-center gap-2" accept={accept} @@ -136,8 +133,6 @@ const FileUploadForm = ({ onSubmit(fileNm, selectedYear, selectedQuarter, internalAtflCd || '', internalAtflId || ''); setFiles(null); // 파일 업로드 후 파일 목록 초기화 setFileName(''); // 파일명 초기화 - // 파일 업로드 후 FileUploader 컴포넌트를 재마운트하기 위해 key 값 변경 - setUploaderKey(prev => prev + 1); } }} > diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 19e302c30..1455c9e4a 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -141,7 +141,7 @@ export function VerticalTable({ <input id={head.id} type="text" - value={String(formData[head.id] ?? "")} + value={""} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" /> diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 02d3a7c60..0802a72e4 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -75,7 +75,7 @@ const CustomLegend = (props: any) => { }; export default function Chart({chartConfig=undefined, chartData=[], chartTitle='차트', chartClassName='w-full h-full', graphSize=40, yFieldText='', showLegend=false} : BarChartProps) { - const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#FED16A", "#FFEEAD", "#D4A5A5"]; + const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4", "#FFEEAD", "#D4A5A5"]; const getMaxValue = (data: any[], keyPrefix: string) => { return Math.max(...data.map(item => Object.keys(item) diff --git a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx index a42dea012..2d7d2bf90 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { FormField } from "../form"; +import { FormField } from "../form"; import { SelectBox } from "../select"; import { Input } from "@common/components"; import { FormUi } from "../form_ui"; @@ -56,7 +55,6 @@ interface FormSchema { bznmTotNo?: string; rgtr?: string; dmdAplyPswd?: string; - dmdAplyPswdConfirm?: string; } interface SdmRegFormProps { @@ -87,25 +85,10 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const formatter = new AsYouType("KR"); const formatted = formatter.input(input); - return formatted - }; + // 저장할 값 처리: 숫자만 추출 + const digitsOnly = input.replace(/\D/g, ""); - // 사업자등록번호 포맷팅 함수 (3-2-5 형식) - const formatBusinessNumber = (value: string) => { - // 숫자만 추출 - const digitsOnly = value.replace(/\D/g, ""); - - // 10자리까지만 처리 - const limitedDigits = digitsOnly.slice(0, 10); - - // 3-2-5 형식으로 포맷팅 - if (limitedDigits.length <= 3) { - return limitedDigits; - } else if (limitedDigits.length <= 5) { - return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3)}`; - } else { - return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3, 5)}-${limitedDigits.slice(5)}`; - } + return formatted }; @@ -196,15 +179,12 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const value = e.target.value; if(noType === 'dmdInfoPk') { - // 숫자만 추출하여 저장 (포맷팅 제거) - const digitsOnly = value.replace(/\D/g, ""); - - if(orgBznmNo.substring(0,10) === digitsOnly) { + if(orgBznmNo.substring(0,10) === value) { setIsDuplicate(true); } else { setIsDuplicate(false); } - field?.onChange(digitsOnly); + field?.onChange(value); } else { if(orgBznmNo.substring(10,14) === value) { setIsDuplicate(true); @@ -316,7 +296,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun type="text" className="!text-xl text-gray-600" onChange={(e) => bznNoChange(e, 'dmdInfoPk', field)} - value={formatBusinessNumber(field.value || '')} + value={field.value} readOnly={!!updateList?.dmdInfoPk} /> ) @@ -388,60 +368,32 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun {...field} /> ) - }, - { - name: "dmdAplyPswdConfirm", - label: "패스워드확인", - component: (field) => ( - <Input - placeholder="패스워드를 입력하세요" - type="password" - className="!text-xl text-gray-600" - {...field} - /> - ) } ] return ( <> - {formFields - .filter(({ name }) => !(updateList?.dmdInfoPk && (name === "dmdAplyPswd" || name === "dmdAplyPswdConfirm"))) - .map(({ name, label, component }) => { - const error = form.formState.errors[name]; - const inputId = `${name}-input`; - const errorId = `${name}-error`; - const isRequired = ["ctpvCd", "sggCd", "dmdCoNm", "dmdInfoPk", "daddr", "telno", "dmdAplyPswd", "dmdAplyPswdConfirm"].includes(name); - - return ( - <FormField - key={String(name)} - control={form.control} - name={name} - render={({ field }) => ( - <div className="mb-4"> - <label htmlFor={inputId} className="block text-gray-800 font-medium"> - {label} - {isRequired && <span className="text-red-500 ml-1">*</span>} - </label> - - {React.cloneElement(component(field), { - id: inputId, - "aria-required": isRequired, - "aria-invalid": !!error, - "aria-describedby": error ? errorId : undefined - })} - - {error?.message && ( - <p id={errorId} role="alert" className="text-red-500 text-sm mt-1"> - {error.message} - </p> - )} - </div> - )} - /> - ); - })} + {formFields.filter((item)=> + {if(updateList?.dmdInfoPk){ + return item.name !== 'dmdAplyPswd' + }else{ + return item + } + }) + .map(({ name, label, component }) => ( + <FormField + key={String(name)} + control={form.control} + name={name} + render={({ field }) => ( + name === 'bznmTotNo' ? component(field) : ( + <FormUi label={label}> + {component(field)} + </FormUi> + ) + )} + /> + ))} </> ); } \ No newline at end of file diff --git a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx index c564b63dd..4219602e6 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx @@ -47,17 +47,7 @@ const createFormSchema = (isBznmTotNoDisabled: boolean, isDuplicate: boolean ,up ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 : z.string().optional() .refine((val) => !val || (val.length >= 8 && val.length <= 16), "패스워드는 8자 이상 16자 이내로 입력해주세요"), - dmdAplyPswdConfirm: z.string() - .min(1, "패스워드확인을 입력해주세요"), -}).refine((data) => { - // 패스워드 확인 검증 - if (data.dmdAplyPswd && data.dmdAplyPswdConfirm) { - return data.dmdAplyPswd === data.dmdAplyPswdConfirm; - } - return true; -}, { - message: "패스워드가 일치하지 않습니다", - path: ["dmdAplyPswdConfirm"], // 에러를 패스워드 확인 필드에 표시 + }); type FormSchema = z.infer<ReturnType<typeof createFormSchema>>; @@ -72,7 +62,6 @@ const defaultValues: FormSchema = { telno: '', rgtr: '', dmdAplyPswd: '', - dmdAplyPswdConfirm: '', }; /** @@ -160,7 +149,7 @@ export default function SdmInsertForm({selectSidoData, selectSigunData, dataList console.log(' formData ', formData) /* await insertSdmData(formData); */ - rtnInputData(formData as unknown as DemandCompType); + rtnInputData(formData as DemandCompType); //router.push(`/pages/sdmMng/sdmInfoInsert?${queryParams.toString()}`); diff --git a/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx b/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx index 059d63d90..3c8fd7192 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx @@ -1,14 +1,14 @@ -import React, { useCallback, useEffect, useRef, useState } from "react"; -import type { DemandCompType } from "./form"; +import React, { useCallback, useEffect, useRef, useState } from 'react'; +import type { DemandCompType } from './form'; export type thisProps = { label: string | undefined; initValue: string | undefined; - dataList: DemandCompType[]; - rtnValue: (searchText: string, pageCnt: number) => void; - rtnData: (item: DemandCompType) => void; - rtnText: (text: string) => void; -}; + dataList : DemandCompType[]; + rtnValue : (searchText: string, pageCnt: number) => void; + rtnData : (item: DemandCompType) => void; + rtnText : (text: string) => void; +} /** * 수요처 검색 컴포넌트 @@ -18,110 +18,88 @@ export type thisProps = { * @param dataList 검색할 때 넘기는 데이터 리스트 * @param rtnData 검색 결과 반환 함수 */ -export const SdmSearchForm = ({ - label = undefined, - initValue = undefined, - rtnValue = () => {}, - dataList = [], - rtnData = () => {}, - rtnText = () => {}, -}: thisProps) => { +export const SdmSearchForm = ({label=undefined, initValue=undefined, rtnValue=()=>{}, dataList=[], rtnData=()=>{}, rtnText=()=>{} } :thisProps) => { + const [isOpen, setIsOpen] = useState(false); - const [textValue, setTextValue] = useState(initValue || ""); + const [textValue, setTextValue] = useState(initValue || ''); const wrapperRef = useRef<HTMLDivElement>(null); - const handleInputChange = useCallback( - (e: React.ChangeEvent<HTMLInputElement>) => { - const value = e.target.value; - setTextValue(value); - rtnValue(value, 10); - rtnText(value); - if (value) { - setIsOpen(true); - } else { - setIsOpen(false); - } - }, - [rtnValue, rtnText], - ); - - const handleSuggestionClick = useCallback( - (item: DemandCompType) => { - setTextValue(item.dmdCoNm); - rtnData(item); + const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { + const value = e.target.value; + setTextValue(value); + rtnValue(value, 10); + rtnText(value); + if (value) { + setIsOpen(true); + } else { setIsOpen(false); - }, - [rtnData], - ); + } + }, [rtnValue, rtnText]); + + const handleSuggestionClick = useCallback((item: DemandCompType) => { + setTextValue(item.dmdCoNm); + rtnData(item); + setIsOpen(false); + }, [rtnData]); useEffect(() => { const handleClickOutside = (event: MouseEvent) => { - if ( - wrapperRef.current && - !wrapperRef.current.contains(event.target as Node) - ) { + if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) { setIsOpen(false); } }; - document.addEventListener("mousedown", handleClickOutside); + document.addEventListener('mousedown', handleClickOutside); return () => { - document.removeEventListener("mousedown", handleClickOutside); + document.removeEventListener('mousedown', handleClickOutside); }; }, []); useEffect(() => { - if (initValue && initValue?.length > 0) { - setTextValue(initValue); + if(initValue&& initValue?.length>0){ + setTextValue(initValue) } - }, [initValue]); - + },[initValue]) + return ( - <div className="relative" ref={wrapperRef}> + <div ref={wrapperRef}> <input type="text" value={textValue} onChange={handleInputChange} /* onFocus={() => setIsOpen(true)} */ - className="h-[3.2rem] w-full rounded-md border border-gray-300 pl-3 !text-xl text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500" + className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder={`${label}을(를) 입력하세요`} /> {isOpen && ( - <div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg"> + <div className=" z-1 w-full mt-2 bg-white border border-gray-300 rounded-md shadow-lg h-90 overflow-auto"> <div className="max-h-72"> - {dataList && dataList.length > 0 ? ( - dataList.map((item: DemandCompType, index: number) => ( - <div - key={index} - className="w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl hover:bg-gray-100" - onClick={() => handleSuggestionClick(item)} - role="button" - tabIndex={0} - onKeyDown={(e) => { - if (e.key === "Enter" || e.key === " ") { - handleSuggestionClick(item); - } - }} - > - {item.dmdInfoPk.substring(10, 14) !== "0000" ? ( - <> - <span className="text-gray-500">사업자번호 : </span>{" "} - {item.dmdInfoPk.substring(0, 10)}  - <span className="text-gray-500"> - 종사업자번호 :{" "} - </span>{" "} - {item.dmdInfoPk.substring(10, 14)}  - </> - ) : ( - <> - <span className="text-gray-500">사업자번호 : </span>{" "} - {item.dmdInfoPk.substring(0, 10)}  - </> - )} - <span className="float-right">{item.dmdCoNm}</span> - </div> - )) - ) : ( - <div className="w-full cursor-pointer overflow-auto px-5 py-3 !text-xl hover:bg-gray-100"> + {dataList && dataList.length > 0 ? dataList.map((item : DemandCompType, index : number) => ( + <div + key={index} + className="!text-xl w-full text-left px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto" + onClick={() => handleSuggestionClick(item)} + role="button" + tabIndex={0} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + handleSuggestionClick(item); + } + }} + > + {item.dmdInfoPk.substring(10,14) !== '0000' ? ( + <> + <span className="text-gray-500">사업자번호 : </span> {item.dmdInfoPk.substring(0,10)}  + <span className="text-gray-500">종사업자번호 : </span> {item.dmdInfoPk.substring(10,14)}  + </> + ) : ( + <> + <span className="text-gray-500">사업자번호 : </span> {item.dmdInfoPk.substring(0,10)}  + </> + )} + <span className="float-right">{item.dmdCoNm}</span> + </div> + )) : ( + <div className="!text-xl w-full px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto"> 검색 결과가 없습니다. </div> )} @@ -129,5 +107,5 @@ export const SdmSearchForm = ({ </div> )} </div> - ); -}; + ) +} \ No newline at end of file diff --git a/packages/common/business_components/src/ui/search_form_left/index.tsx b/packages/common/business_components/src/ui/search_form_left/index.tsx index 4f36c078c..e7858df2a 100644 --- a/packages/common/business_components/src/ui/search_form_left/index.tsx +++ b/packages/common/business_components/src/ui/search_form_left/index.tsx @@ -199,7 +199,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel setRtnSidoText(selectedSido?.text || ''); } initializeSigunData(val); - onSelectValue('0', 'sigun'); + onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); break; case 'sigun': if (setRtnSigunValue) { diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index 01bb18ba2..fe720abc0 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -49,12 +49,6 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr } }, [resetSelection]); - // 테이블 데이터가 변경될 때마다 선택된 행 초기화하는 useEffect 추가 - useEffect(() => { - // 새로운 데이터가 로드되면 선택 상태 초기화 - setIdx(-1); - }, [tableData]); - const handlePageChange = (page: number) => { setCur(page); onPageChange(page); @@ -89,7 +83,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr ? <TableCell className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' + cellClick ? 'cursor-pointer' : '' } !font-bold`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} @@ -103,7 +97,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr : <TableCell className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' + cellClick ? 'cursor-pointer' : '' }`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} diff --git a/packages/common/business_components/src/ui/table/uiPageNations.tsx b/packages/common/business_components/src/ui/table/uiPageNations.tsx index ca1f8e0c0..891fc4c81 100644 --- a/packages/common/business_components/src/ui/table/uiPageNations.tsx +++ b/packages/common/business_components/src/ui/table/uiPageNations.tsx @@ -40,8 +40,7 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationPrevious href="#" - onClick={(e) => { - e.preventDefault(); + onClick={() => { if (startPage > 1) handlePageChange(startPage - 1); }} /> @@ -54,9 +53,7 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationLink href="#" isActive={pageNum === pageProps.cur} - onClick={(e) => { - e.preventDefault(); - handlePageChange(pageNum)}} + onClick={() => handlePageChange(pageNum)} > {pageNum} </PaginationLink> @@ -68,8 +65,7 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationNext href="#" - onClick={(e) => { - e.preventDefault(); + onClick={() => { if (endPage < totalPages) handlePageChange(endPage + 1); }} /> diff --git a/packages/common/components/src/ui/date-picker/index.tsx b/packages/common/components/src/ui/date-picker/index.tsx index 85c584e5f..919e22435 100644 --- a/packages/common/components/src/ui/date-picker/index.tsx +++ b/packages/common/components/src/ui/date-picker/index.tsx @@ -13,14 +13,12 @@ type DatePickerProps = { placeholder?: string; disabled?: boolean; selected?: Date; - zIndex?: number; // z-index prop 추가 } & React.ComponentProps<typeof DayPicker>; export function DatePicker({ className, placeholder = "날짜 선택", disabled, - zIndex, // zIndex prop 받기 ...props }: DatePickerProps) { return ( @@ -39,10 +37,7 @@ export function DatePicker({ )} </Button> </PopoverTrigger> - <PopoverContent - className="w-auto p-0" - style={{ zIndex: zIndex || 'auto' }} - > + <PopoverContent className="w-auto p-0"> <Calendar classNames={{ cell: "rounded-md" }} {...props} /> </PopoverContent> </Popover> From fc1aa4fe061fe26826292695cddbf8220861b8c1 Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Wed, 9 Jul 2025 11:45:53 +0900 Subject: [PATCH 219/259] =?UTF-8?q?=ED=98=84=ED=99=A9=20=EC=98=A4=ED=94=88?= =?UTF-8?q?=20=EC=8B=9C=20=EB=A0=88=EC=9D=B4=EC=96=B4=EB=AA=85=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20featureid=20=EA=B5=AC=EB=B6=84=20=EC=9E=91?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/map/Gis.js | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index ef5c21d5b..880c116cd 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -46,7 +46,7 @@ function Gis({ const gisCore = useMemo(() => new GisApp.core({ targetId: mapRef.current }), []); const mapInstanceRef = useRef(null); const checkedLayerIds = useRef([]); - + const layerNmRef = useRef('') // 팝업 데이터를 저장할 상태와 오버레이 참조를 저장할 ref 추가 // const [facilityInfoPopupData, setFacilityInfoPopupData] = useState([]); @@ -84,12 +84,32 @@ function Gis({ foundFeature = data; } else { // 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용 - const featureId = data.fid || data.ftrIdn || data.id; + let featureId + const layerName = layerNmRef.current + if (layerName === '하수재이용시설') { + featureId = data.searchPk; + } else if (layerName === '빗물이용시설') { + featureId = data.bdstInfoPk; + } else if (layerName === '하수처리시설') { + featureId = data.bscFctCd; + } else if (layerName === '중수도시설' || layerName == '온배수시설') { + featureId = data.bdstRuseFcltPk; + } else { + console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm); + featureId = data.fid || data.id || data.ftrIdn; + } gisMap.getLayers().getArray().forEach(layer => { const source = layer.getSource?.(); - if (source?.getFeatureById) { - const feature = source.getFeatureById(String(featureId).trim()); - if (feature) foundFeature = feature; + if (source?.getFeatures) { + const allFeatures = source.getFeatures(); + for (const f of allFeatures) { + const id = String(f.getId()); + // console.log('id', id, featureId) + if (id && id.split('.')[1] === String(featureId)) { + foundFeature = f; + break; + } + } } }); } @@ -360,6 +380,7 @@ function Gis({ setVisible={setTabVisible} onCheckedChange={handleCheckedLayersChange} onLayerIconClick={(nodeNm) => { + layerNmRef.current = nodeNm setLayerNm(nodeNm); setIsOpen(true); const dummyFeature = { getProperties: () => ({}), // 최소 구조 }; @@ -375,6 +396,7 @@ function Gis({ featureData={featureData || { getProperties: () => ({}) }} seletectedLayerNm={layerNm} onClose={closePopup} // 닫기 콜백 전달 + onFeatureSelect={handleFeatureSelect} /> )} {/* SearchView가 존재할 때만 렌더링 */} From e4426d61b3872617209259dfe9688accd0cbbcff Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 9 Jul 2025 11:55:08 +0900 Subject: [PATCH 220/259] Reapply "Merge branch 'iipbs/sn/ii' into iipbs/sn/main" This reverts commit 2aa202ace3dcf4a573a5b498f91b047170edb226. --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 35 ++- .../map/components/InputSection.tsx | 8 +- .../map/components/common/table.ts | 285 ++++++++++++------ .../components/popupComponent/MsSwagePpl.tsx | 2 +- .../map/components/popupComponent/Ssc.tsx | 17 +- .../components/popupComponent/sewagePump.tsx | 13 +- .../map/components/popupComponent/smh.tsx | 3 +- .../map/featureClickEventPopup.tsx | 47 ++- .../(with-base-layout)/oper/floodPre/page.tsx | 47 ++- .../(with-base-layout)/oper/oldPp/page.tsx | 44 ++- apps/sn/app/components/ui/fileUploadForm.tsx | 5 + apps/sn/app/components/ui/verticalTable.tsx | 2 +- .../src/ui/chart/BarChart.tsx | 2 +- .../src/ui/sdmInsertForm/form.tsx | 104 +++++-- .../src/ui/sdmInsertForm/index.tsx | 15 +- .../src/ui/sdmInsertForm/sdmNameBox.tsx | 152 ++++++---- .../src/ui/search_form_left/index.tsx | 2 +- .../src/ui/table/index.tsx | 10 +- .../src/ui/table/uiPageNations.tsx | 10 +- .../components/src/ui/date-picker/index.tsx | 7 +- 20 files changed, 572 insertions(+), 238 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index e17b80724..73cc5fc8e 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -2,13 +2,13 @@ import FeatureClickEventPopup from './featureClickEventPopup'; import React, { useEffect, useState } from 'react'; import axios from 'axios'; import { UiModal, UiTable } from '@common/business_components/ui'; -import { Button, Input, Label } from '@common/components'; +import { Button, DatePicker, Input, Label } from '@common/components'; import { UiTable2 } from '@common/business_components/ui/table/index-2'; import { UITab2 } from '@common/business_components/ui/tab/index-2'; import { SelectBox2 } from '@common/business_components/ui/select/index-2'; import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; -import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbrCol2 } from './components/common/table'; +import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -122,6 +122,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [가동개시_종료_월, set가동개시_종료_월] = useState(''); const [가동개시_시작_일, set가동개시_시작_일] = useState(''); const [가동개시_종료_일, set가동개시_종료_일] = useState(''); + const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) + const [toDate, setToDate] = useState(new Date()) // 로딩바 const [isLoading, setIsLoading] = useState(false); @@ -142,7 +144,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ else if (basicType === 'tb_il_swage_prcs_fclt') dynamicHeadlist = SwtrmtFcltCol2; // 하수처리시설 else if (basicType === 'tb_ms_swage_prcs_zone') dynamicHeadlist = SwtrmtPrcsZoneCol2; // 하수처리구역 else if (basicType === 'tb_ms_swage_mhl') dynamicHeadlist = MsSwageMhlCol2; // 하수맨홀 - else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = SewagePump2; // 하수펌프장 + else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = ExclnSewagePumpCol2; // 하수펌프장 else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbrCol2; // 우수토실 // 조회 버튼 클릭 시 1페이지로 이동하도록 수정 @@ -948,8 +950,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ value={workType} /> - {/* 설치년도 */} - <YearRangeSelectBox + {/* 수행기간 */} + {/* <YearRangeSelectBox start={yearFilter.시작} end={yearFilter.종료} onChange={(range) => @@ -959,8 +961,29 @@ const SearchModal: React.FC<SearchModalProps> = ({ 종료: range.end, }) } - startLabel="설치년도" + startLabel="수행기간" endLabel="" + /> */} + <DatePicker + className='mr-4' + mode={'single'} + selected={fromDate} + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + zIndex={102} + /> + <span>~</span> + <DatePicker + className='ml-4' + mode={'single'} + selected={toDate} + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + zIndex={102} /> <div className="flex items-center"> {/* 경과년도 */} diff --git a/apps/sn/app/(map-layout)/map/components/InputSection.tsx b/apps/sn/app/(map-layout)/map/components/InputSection.tsx index fe8897703..209361293 100644 --- a/apps/sn/app/(map-layout)/map/components/InputSection.tsx +++ b/apps/sn/app/(map-layout)/map/components/InputSection.tsx @@ -20,14 +20,14 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on <Table variant="secondary" className="w-full"> <TableHeader> <TableRow> - <TableHead className="border border-gray-300 px-2 py-2 text-sm">년도</TableHead> - <TableHead className="border border-gray-300 px-2 py-2 text-sm">구분</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm w-[80px]">년도</TableHead> + <TableHead className="border border-gray-300 px-2 py-2 text-sm w-auto">구분</TableHead> </TableRow> </TableHeader> <TableBody> {data.map((row, index) => ( <TableRow key={index}> - <TableCell className="border border-gray-300 px-2 py-2 text-sm"> + <TableCell className="border border-gray-300 px-2 py-2 text-sm w-[80px]"> <input type="text" value={row.year} @@ -35,7 +35,7 @@ const InputSection: React.FC<InputSectionProps> = ({ title, data, sectionKey, on className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal" /> </TableCell> - <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal"> + <TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal w-auto"> {row.type} </TableCell> </TableRow> diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 1747106cc..f114cf97b 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -1,65 +1,65 @@ // 하수관로 export const MsSwagePplCol = [ - { id: 'avg_grdn', title: '평균구배' }, - { id: 'clar_fvlc', title: '맑음유속' }, - { id: 'drtw_mltv_area', title: '오수배수면적' }, - { id: 'excln_mltv_area', title: '우수배수면적' }, { id: 'fclt_mng_no', title: '시설관리번호' }, - // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - // { id: 'fid', title: 'FID' }, - // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, { id: 'inst_mng_no', title: '기관관리번호' }, { id: 'instl_ymd', title: '설치일자' }, { id: 'mapsht_no', title: '도엽번호' }, - // { id: 'mng_inst_cd', title: '관리기관코드' }, - // { id: 'mqlt_cd', title: '재질코드' }, - // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, - { id: 'pdmt', title: '관경' }, - { id: 'prlg', title: '연장' }, - { id: 'rnyssn_fvlc', title: '우기유속' }, - { id: 'scend_dpth', title: '종점깊이' }, - { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, - { id: 'tmpt_dpth', title: '시점깊이' }, + { id: 'pdmt', title: '관경(mm)' }, + { id: 'prlg', title: '연장(m)' }, + { id: 'usg_cd', title: '용도코드' }, + { id: 'mqlt_cd', title: '재질코드' }, + { id: 'avg_grdn', title: '평균구배(m/m)' }, + { id: 'drtw_mltv_area', title: '오수배수면적(m²)' }, + { id: 'excln_mltv_area', title: '우수배수면적(m²)' }, + { id: 'tmpt_dpth', title: '시점깊이(m)' }, { id: 'tmpt_mhl_mng_no', title: '시점맨홀관리번호' }, + { id: 'scend_dpth', title: '종점깊이(m)' }, + { id: 'scend_mhl_mng_no', title: '종점맨홀관리번호' }, { id: 'trfln_cnt', title: '차선수' }, - // { id: 'usg_cd', title: '용도코드' }, - { id: 'vrtc_len', title: '세로길이' }, - { id: 'wdth_len', title: '가로길이' }, + { id: 'vrtc_len', title: '세로길이(m)' }, + { id: 'wdth_len', title: '가로길이(m)' }, + // { id: 'rnyssn_fvlc', title: '우기 시 유속(m/s)' }, + // { id: 'clar_fvlc', title: '건기 시 유속(m/s)' }, + // { id: 'mng_inst_cd', title: '관리기관코드' }, + // { id: 'pbadms_emd_cd', title: '행정읍면동코드' }, + // { id: 'fclty_shp_cd', title: '시설물형태코드' }, + // { id: 'fid', title: 'FID' }, + // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] export const MsSwagePplCol2 = [ - { id: 'avgGrdn', title: '평균구배' }, - { id: 'clarFvlc', title: '맑음유속' }, - { id: 'drtwMltvArea', title: '오수배수면적' }, - { id: 'exclnMltvArea', title: '우수배수면적' }, { id: 'fcltMngNo', title: '시설관리번호' }, - // { id: 'fcltyShpCd', title: '시설물형태코드' }, - // { id: 'fid', title: 'FID' }, - // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, { id: 'instMngNo', title: '기관관리번호' }, { id: 'instlYmd', title: '설치일자' }, { id: 'mapshtNo', title: '도엽번호' }, + { id: 'pdmt', title: '관경(mm)' }, + { id: 'prlg', title: '연장(m)' }, + { id: 'avgGrdn', title: '평균구배(m/m)' }, + { id: 'rnysnFvlc', title: '우기 시 유속(m/s)' }, + { id: 'clarFvlc', title: '건기 시 유속(m/s)' }, + { id: 'drtwMltvArea', title: '오수배수면적(m²)' }, + { id: 'exclnMltvArea', title: '우수배수면적(m²)' }, + { id: 'tmptDpth', title: '시점깊이(m)' }, + { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, + { id: 'scendDpth', title: '종점깊이(m)' }, + { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, + { id: 'trflnCnt', title: '차선수' }, + { id: 'vrtcLen', title: '세로길이(m)' }, + { id: 'wdthLen', title: '가로길이(m)' }, + // { id: 'fcltyShpCd', title: '시설물형태코드' }, + // { id: 'fid', title: 'FID' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, // { id: 'mngInstCd', title: '관리기관코드' }, // { id: 'mqltCd', title: '재질코드' }, // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, - { id: 'pdmt', title: '관경' }, - { id: 'prlg', title: '연장' }, - // { id: 'rnysnFvlc', title: '우기유속' }, - { id: 'scendDpth', title: '종점깊이' }, - { id: 'scendMhlMngNo', title: '종점맨홀관리번호' }, - { id: 'tmptDpth', title: '시점깊이' }, - { id: 'tmptMhlMngNo', title: '시점맨홀관리번호' }, - { id: 'trflnCnt', title: '차선수' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'vrtcLen', title: '세로길이' }, - { id: 'wdthLen', title: '가로길이' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] // 하수처리시설 export const SwtrmtFcltCol = [ { id: 'swtrmt_fclt_nm', title: '하수처리시설명' }, - { id: 'fclt_cpct', title: '시설용량' }, + { id: 'fclt_cpct', title: '시설용량(㎥/d)' }, { id: 'rgn_expln', title: '지역설명' }, { id: 'cmcn_ymd', title: '준공일자' }, { id: 'oprtng_strt_ymd', title: '가동개시일자' }, @@ -78,26 +78,26 @@ export const SwtrmtFcltCol = [ { id: 'rdnm_addr', title: '도로명주소' }, { id: 'dtl_rdnm_addr', title: '상세도로명주소' }, { id: 'dschg_wtst_nm', title: '방류수계명' }, - { id: 'plln_area', title: '부지면적' }, + { id: 'plln_area', title: '부지면적(m²)' }, { id: 'mng_rprtv_bzenty_nm', title: '관리대행업제명' }, - { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수' }, - { id: 'prcs_zone_area_sum', title: '처리구역면적합계' }, + { id: 'swtrmt_ppltn_cnt', title: '하수처리인구수(인)' }, + { id: 'prcs_zone_area_sum', title: '처리구역면적합계(m²)' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprs_msrc_cn', title: '대표공법내용' }, - { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량' }, - { id: 'stty_crtr_toc', title: '법정기준TOC' }, - { id: 'stty_crtr_ss', title: '법정기준SS' }, - { id: 'stty_crtr_tn', title: '법정기준총질소' }, - { id: 'stty_crtr_tph', title: '법정기준총인' }, - { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수' }, + { id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량(mg/L)' }, + { id: 'stty_crtr_toc', title: '법정기준TOC((mg/L))' }, + { id: 'stty_crtr_ss', title: '법정기준SS(mg/L)' }, + { id: 'stty_crtr_tn', title: '법정기준총질소(mg/L)' }, + { id: 'stty_crtr_tph', title: '법정기준총인(mg/L)' }, + { id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수(군수/100mL)' }, { id: 'bsn_nm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; export const SwtrmtFcltCol2 = [ { id: 'swtrmtFcltNm', title: '하수처리시설명' }, - { id: 'fcltCpct', title: '시설용량' }, + { id: 'fcltCpct', title: '시설용량(㎥/d)' }, { id: 'rgnExpln', title: '지역설명' }, { id: 'cmcnYmd', title: '준공일자' }, { id: 'oprtngStrtYmd', title: '가동개시일자' }, @@ -116,20 +116,20 @@ export const SwtrmtFcltCol2 = [ { id: 'rdnmAddr', title: '도로명주소' }, { id: 'dtlRdnmAddr', title: '상세도로명주소' }, { id: 'dschgWtstNm', title: '방류수계명' }, - { id: 'pllnArea', title: '부지면적' }, + { id: 'pllnArea', title: '부지면적(m²)' }, { id: 'mngRprtvBzentyNm', title: '관리대행업제명' }, - { id: 'swtrmtPpltnCnt', title: '하수처리인구수' }, - { id: 'prcsZoneAreaSum', title: '처리구역면적합계' }, + { id: 'swtrmtPpltnCnt', title: '하수처리인구수(인)' }, + { id: 'prcsZoneAreaSum', title: '처리구역면적합계(m²)' }, { id: 'xcrd', title: 'X좌표' }, { id: 'ycrd', title: 'Y좌표' }, // { id: 'oprtngSttsCd', title: '가동상태코드' }, { id: 'rprsMsrcCn', title: '대표공법내용' }, - { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량' }, - { id: 'sttyCrtrToc', title: '법정기준TOC' }, - { id: 'sttyCrtrSs', title: '법정기준SS' }, - { id: 'sttyCrtrTn', title: '법정기준총질소' }, - { id: 'sttyCrtrTph', title: '법정기준총인' }, - { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수' }, + { id: 'sttyCrtrBod', title: '법정기준생물화학적산소요구량(mg/L)' }, + { id: 'sttyCrtrToc', title: '법정기준TOC(mg/L)' }, + { id: 'sttyCrtrSs', title: '법정기준SS(mg/L)' }, + { id: 'sttyCrtrTn', title: '법정기준총질소(mg/L)' }, + { id: 'sttyCrtrTph', title: '법정기준총인(mg/L)' }, + { id: 'sttyCrtrClbclCnt', title: '법정기준대장균수(군수/100mL)' }, { id: 'bsnNm', title: '유역명' }, // { id: 'obsrvnSptCd', title: '관측지점코드' }, ]; @@ -170,14 +170,14 @@ export const MsSwageMhlCol = [ // { id: 'usg_cd', title: '용도코드' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, // { id: 'mhl_knd_cd', title: '맨홀종류코드' }, - { id: 'swage_mh_diam', title: '하수맨홀구경' }, - { id: 'wdth_len', title: '가로길이' }, - { id: 'vrtc_len', title: '세로길이' }, - // { id: 'mqltCd', title: '재질코드' }, + { id: 'swage_mh_diam', title: '하수맨홀구경(mm)' }, + { id: 'mqlt_cd', title: '재질코드' }, + { id: 'wdth_len', title: '가로길이(m)' }, + { id: 'vrtc_len', title: '세로길이(m)' }, // { id: 'ang_dir', title: '표고' }, - { id: 'altd_vl', title: '표고' }, - { id: 'dpthlVl', title: '심도' }, - // { id: 'instMngNo', title: '기관관리번호' } + { id: 'altd_vl', title: '표고(EL.m)' }, + { id: 'dpthlVl', title: '심도(m)' }, + // { id: 'inst_mng_no', title: '기관관리번호' } ]; export const MsSwageMhlCol2 = [ // { id: 'fid', title: 'FID' }, @@ -192,18 +192,81 @@ export const MsSwageMhlCol2 = [ // { id: 'usgCd', title: '용도코드' }, // { id: 'fcltyShpCd', title: '시설물형태코드' }, // { id: 'mhlKndCd', title: '맨홀종류코드' }, - { id: 'swageMhDiam', title: '하수맨홀구경' }, - { id: 'wdthLen', title: '가로길이' }, - { id: 'vrtcLen', title: '세로길이' }, - // { id: 'mqltCd', title: '재질코드' }, + { id: 'swageMhDiam', title: '하수맨홀구경(mm)' }, + { id: 'mqltCd', title: '재질코드' }, + { id: 'wdthLen', title: '가로길이(m)' }, + { id: 'vrtcLen', title: '세로길이(m)' }, // { id: 'angDir', title: '표고' }, - { id: 'altdVl', title: '표고' }, - { id: 'dpthlVl', title: '심도' }, + { id: 'altdVl', title: '표고(EL.m)' }, + { id: 'dpthlVl', title: '심도(m)' }, // { id: 'instMngNo', title: '기관관리번호' } ]; +// 하수맨홀 뚜껑재질 코드표 +export const MS_SWAGE_MHL_CODES = [ + { val: "SBC000", text: "미분류" }, + { val: "SBC001", text: "주철" }, + { val: "SBC002", text: "철판" }, + { val: "SBC003", text: "콘크리트" }, + { val: "SBC004", text: "그레이팅" }, + { val: "SBC091", text: "칼라" }, + { val: "SBC092", text: "S.G" }, + { val: "SBC999", text: "기타" }, + { val: "SBC900", text: "각주철" }, + { val: "SBC901", text: "강재" }, + { val: "SBC902", text: "나무" }, + { val: "SBC903", text: "나무,널판지,합판" }, + { val: "SBC904", text: "대리석" }, + { val: "SBC905", text: "뚜껑없음" }, + { val: "SBC906", text: "보도용콘크리트" }, + { val: "SBC907", text: "스틸(ST)" }, + { val: "SBC908", text: "신형 CON" }, + { val: "SBC909", text: "알루미늄" }, + { val: "SBC910", text: "염화비닐(PE)" }, + { val: "SBC911", text: "인조석" }, + { val: "SBC912", text: "인조석(주철)" }, + { val: "SBC913", text: "인조CONC" }, + { val: "SBC914", text: "철, 철근" }, + { val: "SBC915", text: "칼라콘크리트" }, + { val: "SBC916", text: "플라스틱" }, + { val: "SBC917", text: "PVC" }, + { val: "SBC918", text: "SP" }, + { val: "SBC919", text: "SS" }, + { val: "SBC920", text: "닥타일주철" }, + { val: "SBC921", text: "철근G" }, + { val: "SBC922", text: "폴리에틸렌(PE)" }, + { val: "SBC923", text: "회주철" } +]; +// 하수맨홀 용도 코드표 +export const MS_SWAGE_MHL_USE_CODES = [ + { val: "SMU000", text: "미분류" }, + { val: "SMU001", text: "우수" }, + { val: "SMU002", text: "오수" }, + { val: "SMU003", text: "집수" }, + { val: "SMU004", text: "합류" }, + { val: "SMU005", text: "차집" }, + { val: "SMU999", text: "기타" }, + { val: "SMU900", text: "1호" }, + { val: "SMU901", text: "2호" }, + { val: "SMU902", text: "3호" }, + { val: "SMU903", text: "4호" }, + { val: "SMU904", text: "5호" }, + { val: "SMU905", text: "6호" }, + { val: "SMU906", text: "7호" }, + { val: "SMU907", text: "8호" }, + { val: "SMU908", text: "구거용맨홀" }, + { val: "SMU909", text: "부관부착맨홀" }, + { val: "SMU910", text: "조립식맨홀" }, + { val: "SMU911", text: "특1호" }, + { val: "SMU912", text: "특2호" }, + { val: "SMU913", text: "특3호" }, + { val: "SMU914", text: "특4호" }, + { val: "SMU915", text: "특5호" }, + { val: "SMU916", text: "하수맨홀용도" }, + { val: "SMU917", text: "현장타설관거용" } +]; -// 하수펌프장 -export const SewagePump = [ +// 우수펌프장 +export const ExclnSewagePumpCol = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, @@ -213,17 +276,17 @@ export const SewagePump = [ // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instl_ymd', title: '설치일자' }, { id: 'swage_pmstn_nm', title: '하수펌프장명' }, - { id: 'plln_area', title: '부지면적' }, - // { id: 'opngSttsCd', title: '개통상태코드' }, + { id: 'plln_area', title: '부지면적(m²)' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'daily_prcs_cpct', title: '일일처리용량' }, - { id: 'max_impnd_cpct', title: '최대저수용량' }, - { id: 'altd_vl', title: '표고' }, - { id: 'wtlv_vl', title: '수위' }, - { id: 'excln_wpmp_ablt', title: '우수양수능력' }, + { id: 'daily_prcs_cpct', title: '일일처리용량(㎥)' }, + { id: 'max_impnd_cpct', title: '최대저수용량(㎥)' }, + { id: 'altd_vl', title: '표고(EL.m)' }, + { id: 'wtlv_vl', title: '수위(m)' }, + { id: 'excln_wpmp_ablt', title: '우수양수능력(m²/d)' }, // { id: 'instMngNo', title: '기관관리번호' }, ] -export const SewagePump2 = [ +export const ExclnSewagePumpCol2 = [ // { id: 'fid', title: 'FID' }, // { id: 'geom', title: 'geometry' }, // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, @@ -233,14 +296,56 @@ export const SewagePump2 = [ // { id: 'mngInstCd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, { id: 'swagePmstnNm', title: '하수펌프장명' }, - { id: 'pllnArea', title: '부지면적' }, + { id: 'pllnArea', title: '부지면적(m²)' }, // { id: 'opngSttsCd', title: '개통상태코드' }, // { id: 'usgCd', title: '용도코드' }, - { id: 'dailyPrcsCpct', title: '일일처리용량' }, - // { id: 'max_impndCpct', title: '최대저수용량' }, - { id: 'altdVl', title: '표고' }, - { id: 'wtlvVl', title: '수위' }, - { id: 'exclnWpmpAblt', title: '우수양수능력' }, + { id: 'dailyPrcsCpct', title: '일일처리용량(㎥)' }, + { id: 'max_impndCpct', title: '최대저수용량(㎥)' }, + { id: 'altdVl', title: '표고(EL.m)' }, + { id: 'wtlvVl', title: '수위(m)' }, + { id: 'exclnWpmpAblt', title: '우수양수능력(m²/d)' }, + // { id: 'instMngNo', title: '기관관리번호' }, +] + +// 오수펌프장 +export const DrtwSewagePumpCol1 = [ + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fclt_mng_no', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapsht_no', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instl_ymd', title: '설치일자' }, + { id: 'swage_pmstn_nm', title: '하수펌프장명' }, + { id: 'plln_area', title: '부지면적(m²)' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'daily_prcs_cpct', title: '일일처리용량(㎥)' }, + { id: 'max_impnd_cpct', title: '최대저수용량(㎥)' }, + { id: 'altd_vl', title: '표고(EL.m)' }, + { id: 'wtlv_vl', title: '수위(m)' }, + { id: 'excln_wpmp_ablt', title: '오수양수능력(m²/d)' }, + // { id: 'instMngNo', title: '기관관리번호' }, +] +export const DrtwSewagePumpCol2 = [ + // { id: 'fid', title: 'FID' }, + // { id: 'geom', title: 'geometry' }, + // { id: 'ftreSmbolCd', title: '지형지물부호코드' }, + { id: 'fcltMngNo', title: '시설관리번호' }, + // { id: 'pbadmsEmdCd', title: '행정읍면동코드' }, + { id: 'mapshtNo', title: '도엽번호' }, + // { id: 'mngInstCd', title: '관리기관코드' }, + { id: 'instlYmd', title: '설치일자' }, + { id: 'swagePmstnNm', title: '하수펌프장명' }, + { id: 'pllnArea', title: '부지면적(m²)' }, + // { id: 'opngSttsCd', title: '개통상태코드' }, + // { id: 'usgCd', title: '용도코드' }, + { id: 'dailyPrcsCpct', title: '일일처리용량(㎥)' }, + { id: 'max_impndCpct', title: '최대저수용량(㎥)' }, + { id: 'altdVl', title: '표고(EL.m)' }, + { id: 'wtlvVl', title: '수위(m)' }, + { id: 'exclnWpmpAblt', title: '오수양수능력(m²/d)' }, // { id: 'instMngNo', title: '기관관리번호' }, ] @@ -253,11 +358,11 @@ export const stofcbrCol = [ // { id: 'mng_inst_cd', title: '관리기관코드' }, { id: 'instl_ymd', title: '설치일자' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'worflw_wall_hgt', title: '월류벽높이' }, + { id: 'worflw_wall_hgt', title: '월류벽높이(m)' }, // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, { id: 'swage_mhl_mng_no', title: '하수맨홀관리번호' }, - { id: 'drtn_angl', title: '방향각도' }, + { id: 'drtn_angl', title: '방향각도(°)' }, ] export const stofcbrCol2 = [ // { id: 'ftre_smbol_cd', title: '지형지물부호코드' }, @@ -267,11 +372,11 @@ export const stofcbrCol2 = [ // { id: 'mng_inst_cd', title: '관리기관코드' }, { id: 'instlYmd', title: '설치일자' }, // { id: 'fclty_shp_cd', title: '시설물형태코드' }, - { id: 'worflwWallHgt', title: '월류벽높이' }, + { id: 'worflwWallHgt', title: '월류벽높이(m)' }, // { id: 'mhl_exst_yn_cd', title: '맨홀존재여부코드' }, // { id: 'swage_mhl_ftre_smbol_cd', title: '하수맨홀지형지물부호코드' }, { id: 'swageMhlMngNo', title: '하수맨홀관리번호' }, - { id: 'drtnAngl', title: '방향각도' }, + { id: 'drtnAngl', title: '방향각도(°)' }, ] // 중점우수토실 측정지점 @@ -287,7 +392,7 @@ export const untrtSwgRainCol1 = [ // 중점우수토실 측정지점 시설현황 export const untrtSwgRainCol2 = [ { id: 'flwmtr_mesure_tp_etc', title: '구분' }, - { id: 'discharge_pipe_spec', title: '방류관로 규격' }, + { id: 'discharge_pipe_spec', title: '방류관로 규격(m)' }, { id: 'swr_ppl_eqp_ar', title: '배수구역 면적(m²)' }, { id: 'swr_trt_popl', title: '하수처리 인구(인)' }, { id: 'screen_instl_at', title: '스크린설치 여부' }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 46537a7dd..26b3a60aa 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -7,7 +7,7 @@ import { handleInputChange } from '../common'; // 하수관로 const inputColumn = [ { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, { id: "basu", title: "배수구역", type: "input" }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 7e22ea03b..31aef5172 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -3,12 +3,19 @@ import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; import React, { useState } from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; +import { VerticalTable } from '@/components/ui/verticalTable'; import LoadingOverlay from '@/components/ui/LoadingBar'; -const Ssc = ({ featureData, chkMainSsc, additionalData }: { +const inputColumn = [ + { id: "place", title: "중점여부", type: "select", options: ["중점우수토실", "우수토실"] }, + { id: "guyeok", title: "처리구역", type: "input" }, +]; + +const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { featureData: any, chkMainSsc?: boolean, - additionalData?: any + additionalData?: any, + onSaveClick?: () => void }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [isDataLoaded, setIsDataLoaded] = useState(false); @@ -93,7 +100,7 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { return ( <div> - {/* <VerticalTable + <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} @@ -105,7 +112,9 @@ const Ssc = ({ featureData, chkMainSsc, additionalData }: { onPageChange={function (page: number): void { throw new Error('Function not implemented.'); }} - /> */} + showSaveButton={true} + onSaveClick={onSaveClick} + /> {chkMainSsc && ( <div> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index 4eaf1f18d..f0c4d21b3 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -1,17 +1,22 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' -const inputColumn = [ - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, +const exclnInputColumn = [ + { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "freq", title: "설계빈도", type: "input" }, + { id: "freq", title: "설계빈도(년)", type: "input" }, ] +const drtwInputColumn = [ + { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, + { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, +] + // 하수펌프장 const sewagePump = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( <VerticalTable headName='자체 입력정보' tableData={[]} - headlist={inputColumn} + headlist={exclnInputColumn} pageSize={0} total={0} children={undefined} diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx index 46e76f244..7f2251063 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx @@ -2,11 +2,10 @@ import { VerticalTable } from '@/components/ui/verticalTable'; import React from 'react' const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, + { id: "guyeok", title: "처리구역", type: "input" }, { id: "basu", title: "배수구역", type: "input" }, { id: "bungu", title: "배수분구", type: "input" }, { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, - { id: 'spec', title: '규격', type: 'input' }, ]; const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { return ( diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 16c4f99a8..72831902f 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -6,7 +6,7 @@ import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState, useCallback, useMemo } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, SewagePump, MsSwageMhlCol, stofcbrCol } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, ExclnSewagePumpCol, MsSwageMhlCol, stofcbrCol, MS_SWAGE_MHL_CODES } from "./components/common/table"; import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore"; @@ -29,8 +29,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); const [additionalDataError, setAdditionalDataError] = useState<string | null>(null); // 🎯 InfilChart 및 RdiiChart 관련 상태 추가 - const { setIsOpen:setIsModalInfil } = useInfilChartModalStore(); - const { setIsOpen:setIsModalRdii } = useRdiiChartModalStore(); + const { setIsOpen: setIsModalInfil } = useInfilChartModalStore(); + const { setIsOpen: setIsModalRdii } = useRdiiChartModalStore(); // 🎯 관로관리번호 추출 const pplMngNo = featureData?.values_?.fclt_mng_no || ""; @@ -135,8 +135,27 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, console.log('gis data', featureData.values_); let data = featureData.values_; - setfetchData(data) - setTableData(data); + + // 하수맨홀인 경우 용도코드를 텍스트로 변환 + if (selectedLayerName === '하수맨홀' && data) { + const processedData = { ...data }; + + // mqlt_cd 값 변환 (재질코드) + if (processedData.mqlt_cd) { + const materialCodeItem = MS_SWAGE_MHL_CODES.find( + code => code.val === processedData.mqlt_cd.trim() + ); + if (materialCodeItem) { + processedData.mqlt_cd = `${materialCodeItem.text}`; + } + } + + setfetchData(processedData); + setTableData(processedData); + } else { + setfetchData(data); + setTableData(data); + } switch (selectedLayerName) { case '하수처리시설': @@ -173,6 +192,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, case '우수토실': setHeadlist(stofcbrCol) setButtonChk(false) + setChkMainSsc(false) break; case '하수관로': setHeadlist(MsSwagePplCol) @@ -185,7 +205,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, // setButtonChk(true) // break; case '하수펌프장': - setHeadlist(SewagePump) + setHeadlist(ExclnSewagePumpCol) setButtonChk(true) break; case '하수맨홀': @@ -237,32 +257,41 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setIsModalOpen(false); // 모달 닫기 }; + // 저장 버튼 이벤트 const btnClickEvent = async () => { const bodyData: Record<string, any> = {} + if (buttonChk && contentRef.current) { const inputElements = contentRef.current.querySelectorAll('input'); const selectElements = contentRef.current.querySelectorAll('select'); + // 카멜케이스 변환 함수 const toCamelCase = (str: string) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase()); + // select 태그의 값 가져오기 selectElements.forEach((select) => { const camelCaseId = toCamelCase(select.id); bodyData[camelCaseId] = select.value; }); + // input 태그의 값 가져오기 inputElements.forEach((input) => { const camelCaseId = toCamelCase(input.id); bodyData[camelCaseId] = input.value; }); + if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' else if (layerNm === '중점우수토실') bodyData['lyrTypeNm'] = 'om_dt_untrt_swg_rain' else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' + bodyData['fid'] = featureId + const data = await putData(`v1/fclts/${featureId}`, bodyData); + if (data.status == 200) { alert('저장되었습니다') setTableData(data) @@ -286,13 +315,13 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 하수관로일 때만 Infil/RDII 버튼 표시 */} {layerNm === '하수관로' && ( <> - <Button onClick={() => setIsModalInfil(true)} + <Button onClick={() => setIsModalInfil(true)} className="px-2 py-1 text-xl text-blue-600 border border-blue-600 rounded hover:bg-gray-700" color="white" > 침입수분석 </Button> - <Button onClick={() => setIsModalRdii(true)} + <Button onClick={() => setIsModalRdii(true)} className="px-2 py-1 text-xl text-gray-600 border border-gray-600 rounded hover:bg-gray-700" color="white" > @@ -343,7 +372,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {/* 🎯 InfilChart 및 RdiiChart 컴포넌트 추가 */} <InfilChart pplMngNo={pplMngNo} /> - <RdiiChart pplMngNo={pplMngNo} /> + <RdiiChart pplMngNo={pplMngNo} /> </div> ) } diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 6ae0b3609..3578ff967 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -27,16 +27,16 @@ const Page = () => { const [curPage, setCurPage] = useState(1) //현재 페이지 const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + + // 조회 const fetchData = async () => { setIsLoading(true) - searchCmmnCd('SITEKNDCD') + // searchCmmnCd('SITEKNDCD') try { const { data, total } = await searchData('v1/sbmrgPrevnt', { fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, toRegDt: formatDate(toDate), - atflNm: pjNm, + sbmrgPrevntBizNm: pjNm, rgtrNm: usr, page: curPage - 1, size: '10' @@ -45,12 +45,18 @@ const Page = () => { setTotalData(total) } catch (error) { console.error('Error fetching data:', error) } - finally { setIsLoading(false); } + finally { + setFileNm(''); + setAtflId(''); + setSbmrgPrevntBizSn(''); + setIsLoading(false); + } } useEffect(() => { setCurPage(1) fetchData() }, []) + // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -59,6 +65,7 @@ const Page = () => { } handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) } + // 선택 파일 삭제 const isDeleteFile = async () => { if (sbmrgPrevntBizSn === '' || sbmrgPrevntBizSn === undefined) { @@ -96,11 +103,19 @@ const Page = () => { <Label className="w-20 text-xl text-gray-600">등록기간</Label> <DatePicker mode={'single'} selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + /> <span>~</span> <DatePicker mode={'single'} selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} + /> </div> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> @@ -132,7 +147,23 @@ const Page = () => { <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile} >삭제</Button> </div> </div> - <UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={totalData} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> + <UiTable + headName='' + tableData={tableData} + headlist={tableHeadlist} + pageSize={10} + total={totalData} + cellClick={(index) => { + if (index != null) { + const fileName = tableData[index]?.sbmrgPrevntBizNm ?? ""; + const id = tableData[index]?.atflId ?? ''; + setFileNm(fileName); + setAtflId(id); + setSbmrgPrevntBizSn(tableData[index]?.sbmrgPrevntBizSn); + } + }} + onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + /> </ListDiv> <ListDiv className="mt-4"> <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 307452e2d..c4bac35b7 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -25,14 +25,13 @@ const Page = () => { const [curPage, setCurPage] = useState(1) const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + // 데이터 조회 const fetchData = async () => { setIsLoading(true) try { const { data, total } = await searchData('v1/dcrpPpl', { fromRegDt: formatDate(fromDate), - fromMngYr: manageYear, - toMngYr: mngQu, toRegDt: formatDate(toDate), dcrpPplMtncBizNm: pjNm, rgtrNm: usr, @@ -44,12 +43,18 @@ const Page = () => { console.log(data, total) } catch (error) { console.error('Error fetching data:', error) - } finally { setIsLoading(false) } + } finally { + setFileNm(''); + setAtflId(''); + setDcrpPplMtncBizSn(''); + setIsLoading(false) + } } useEffect(() => { setCurPage(1) fetchData() }, []) + // 파일 다운로드 const isChckFile = () => { if (fileNm === '' || fileNm === undefined) { @@ -59,6 +64,7 @@ const Page = () => { handleDownload(`/attach-service/api/v1/download/${atflId}`, fileNm) return true } + // 파일 삭제 const isDeleteFile = async () => { if (dcrpPplMtncBizSn === '' || dcrpPplMtncBizSn === undefined) { @@ -76,6 +82,7 @@ const Page = () => { } } } + // 파일 등록 const registFile = async (fileNm: string, year: string, quater: string, cd: string, id: string) => { const data = await postData('v1/dcrpPpl', { @@ -88,6 +95,8 @@ const Page = () => { }) if (data) { alert('파일이 등록되었습니다.'); fetchData() } } + + return ( <> <LoadingOverlay isLoading={isLoading ?? false} /> @@ -98,11 +107,17 @@ const Page = () => { <Label className="w-20 text-xl text-gray-600">등록기간</Label> <DatePicker mode={'single'} selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} /> <span>~</span> <DatePicker mode={'single'} selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} /> + onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} + modifiers={{ + disabled: { after: new Date() } + }} /> <div className='flex items-center'> <Label className="w-20 text-xl text-gray-600">등록자</Label> <Input @@ -134,7 +149,24 @@ const Page = () => { <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" onClick={isDeleteFile}>삭제</Button> </div> </div> - <UiTable headName='' tableData={tableData} headlist={tableHeadlistOldPp} pageSize={10} total={totalData} children={undefined} cellClick={(index) => { if (index != null) { const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; setFileNm(fileName); const id = tableData[index]?.atflId ?? ''; setAtflId(id); setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn) } }} onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}></UiTable> + <UiTable + headName='' + tableData={tableData} + headlist={tableHeadlistOldPp} + pageSize={10} + total={totalData} + children={undefined} + cellClick={(index) => { + if (index != null) { + const fileName = tableData[index]?.dcrpPplMtncBizNm ?? ""; + const id = tableData[index]?.atflId ?? ''; + setFileNm(fileName); + setAtflId(id); + setDcrpPplMtncBizSn(tableData[index]?.dcrpPplMtncBizSn); + } + }} + onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} + /> </ListDiv> <ListDiv className="mt-4"> <OperFileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> diff --git a/apps/sn/app/components/ui/fileUploadForm.tsx b/apps/sn/app/components/ui/fileUploadForm.tsx index 3cd663e01..fb626348e 100644 --- a/apps/sn/app/components/ui/fileUploadForm.tsx +++ b/apps/sn/app/components/ui/fileUploadForm.tsx @@ -29,6 +29,8 @@ const FileUploadForm = ({ const [files, setFiles] = useState<FileList | null>(null); const [upload, setUpload] = useState<Upload | null>(null); const uniqueId = useId(); // 각 FileUploadForm 인스턴스에 대한 고유 ID 생성 + // FileUploader 컴포넌트를 강제로 재마운트하기 위한 key 상태 추가 + const [uploaderKey, setUploaderKey] = useState(0); const quater = [{ text: '1분기', val: '1' }, { text: '2분기', val: '2' }, { text: '3분기', val: '3' }, { text: '4분기', val: '4' }]; // 현재 년도부터 10년 전까지의 년도 옵션 생성 @@ -64,6 +66,7 @@ const FileUploadForm = ({ <div className='flex items-center gap-2'> {/* FileUploader와 Button을 정렬하는 메인 flex 컨테이너 */} <div className="w-[300px] mr-4"> {/* FileUploader의 너비와 오른쪽 여백을 제어하는 컨테이너 */} <FileUploader + key={uploaderKey} // key 추가: 변경 시 컴포넌트 재마운트됨 id={uniqueId} className="!h-auto !max-w-none flex-row items-center gap-2" accept={accept} @@ -133,6 +136,8 @@ const FileUploadForm = ({ onSubmit(fileNm, selectedYear, selectedQuarter, internalAtflCd || '', internalAtflId || ''); setFiles(null); // 파일 업로드 후 파일 목록 초기화 setFileName(''); // 파일명 초기화 + // 파일 업로드 후 FileUploader 컴포넌트를 재마운트하기 위해 key 값 변경 + setUploaderKey(prev => prev + 1); } }} > diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 1455c9e4a..19e302c30 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -141,7 +141,7 @@ export function VerticalTable({ <input id={head.id} type="text" - value={""} + value={String(formData[head.id] ?? "")} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" /> diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 0802a72e4..02d3a7c60 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -75,7 +75,7 @@ const CustomLegend = (props: any) => { }; export default function Chart({chartConfig=undefined, chartData=[], chartTitle='차트', chartClassName='w-full h-full', graphSize=40, yFieldText='', showLegend=false} : BarChartProps) { - const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4", "#FFEEAD", "#D4A5A5"]; + const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#FED16A", "#FFEEAD", "#D4A5A5"]; const getMaxValue = (data: any[], keyPrefix: string) => { return Math.max(...data.map(item => Object.keys(item) diff --git a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx index 2d7d2bf90..a42dea012 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/form.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/form.tsx @@ -1,4 +1,5 @@ -import { FormField } from "../form"; +import React from 'react'; +import { FormField } from "../form"; import { SelectBox } from "../select"; import { Input } from "@common/components"; import { FormUi } from "../form_ui"; @@ -55,6 +56,7 @@ interface FormSchema { bznmTotNo?: string; rgtr?: string; dmdAplyPswd?: string; + dmdAplyPswdConfirm?: string; } interface SdmRegFormProps { @@ -85,12 +87,27 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const formatter = new AsYouType("KR"); const formatted = formatter.input(input); - // 저장할 값 처리: 숫자만 추출 - const digitsOnly = input.replace(/\D/g, ""); - return formatted }; + // 사업자등록번호 포맷팅 함수 (3-2-5 형식) + const formatBusinessNumber = (value: string) => { + // 숫자만 추출 + const digitsOnly = value.replace(/\D/g, ""); + + // 10자리까지만 처리 + const limitedDigits = digitsOnly.slice(0, 10); + + // 3-2-5 형식으로 포맷팅 + if (limitedDigits.length <= 3) { + return limitedDigits; + } else if (limitedDigits.length <= 5) { + return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3)}`; + } else { + return `${limitedDigits.slice(0, 3)}-${limitedDigits.slice(3, 5)}-${limitedDigits.slice(5)}`; + } + }; + const initializeSigunData = useCallback((sidoCd: string) => { if (sidoCd === '0') { @@ -179,12 +196,15 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun const value = e.target.value; if(noType === 'dmdInfoPk') { - if(orgBznmNo.substring(0,10) === value) { + // 숫자만 추출하여 저장 (포맷팅 제거) + const digitsOnly = value.replace(/\D/g, ""); + + if(orgBznmNo.substring(0,10) === digitsOnly) { setIsDuplicate(true); } else { setIsDuplicate(false); } - field?.onChange(value); + field?.onChange(digitsOnly); } else { if(orgBznmNo.substring(10,14) === value) { setIsDuplicate(true); @@ -296,7 +316,7 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun type="text" className="!text-xl text-gray-600" onChange={(e) => bznNoChange(e, 'dmdInfoPk', field)} - value={field.value} + value={formatBusinessNumber(field.value || '')} readOnly={!!updateList?.dmdInfoPk} /> ) @@ -368,32 +388,60 @@ export function SdmRegForm({ form, onCheckboxChange, selectSidoData, selectSigun {...field} /> ) + }, + { + name: "dmdAplyPswdConfirm", + label: "패스워드확인", + component: (field) => ( + <Input + placeholder="패스워드를 입력하세요" + type="password" + className="!text-xl text-gray-600" + {...field} + /> + ) } ] return ( <> - {formFields.filter((item)=> - {if(updateList?.dmdInfoPk){ - return item.name !== 'dmdAplyPswd' - }else{ - return item - } - }) - .map(({ name, label, component }) => ( - <FormField - key={String(name)} - control={form.control} - name={name} - render={({ field }) => ( - name === 'bznmTotNo' ? component(field) : ( - <FormUi label={label}> - {component(field)} - </FormUi> - ) - )} - /> - ))} + {formFields + .filter(({ name }) => !(updateList?.dmdInfoPk && (name === "dmdAplyPswd" || name === "dmdAplyPswdConfirm"))) + .map(({ name, label, component }) => { + const error = form.formState.errors[name]; + const inputId = `${name}-input`; + const errorId = `${name}-error`; + const isRequired = ["ctpvCd", "sggCd", "dmdCoNm", "dmdInfoPk", "daddr", "telno", "dmdAplyPswd", "dmdAplyPswdConfirm"].includes(name); + + return ( + <FormField + key={String(name)} + control={form.control} + name={name} + render={({ field }) => ( + <div className="mb-4"> + <label htmlFor={inputId} className="block text-gray-800 font-medium"> + {label} + {isRequired && <span className="text-red-500 ml-1">*</span>} + </label> + + {React.cloneElement(component(field), { + id: inputId, + "aria-required": isRequired, + "aria-invalid": !!error, + "aria-describedby": error ? errorId : undefined + })} + + {error?.message && ( + <p id={errorId} role="alert" className="text-red-500 text-sm mt-1"> + {error.message} + </p> + )} + </div> + )} + /> + ); + })} </> ); } \ No newline at end of file diff --git a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx index 4219602e6..c564b63dd 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/index.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/index.tsx @@ -47,7 +47,17 @@ const createFormSchema = (isBznmTotNoDisabled: boolean, isDuplicate: boolean ,up ? z.string().optional() // 패스워드는 선택 사항이며 길이 제한 없음 : z.string().optional() .refine((val) => !val || (val.length >= 8 && val.length <= 16), "패스워드는 8자 이상 16자 이내로 입력해주세요"), - + dmdAplyPswdConfirm: z.string() + .min(1, "패스워드확인을 입력해주세요"), +}).refine((data) => { + // 패스워드 확인 검증 + if (data.dmdAplyPswd && data.dmdAplyPswdConfirm) { + return data.dmdAplyPswd === data.dmdAplyPswdConfirm; + } + return true; +}, { + message: "패스워드가 일치하지 않습니다", + path: ["dmdAplyPswdConfirm"], // 에러를 패스워드 확인 필드에 표시 }); type FormSchema = z.infer<ReturnType<typeof createFormSchema>>; @@ -62,6 +72,7 @@ const defaultValues: FormSchema = { telno: '', rgtr: '', dmdAplyPswd: '', + dmdAplyPswdConfirm: '', }; /** @@ -149,7 +160,7 @@ export default function SdmInsertForm({selectSidoData, selectSigunData, dataList console.log(' formData ', formData) /* await insertSdmData(formData); */ - rtnInputData(formData as DemandCompType); + rtnInputData(formData as unknown as DemandCompType); //router.push(`/pages/sdmMng/sdmInfoInsert?${queryParams.toString()}`); diff --git a/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx b/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx index 3c8fd7192..059d63d90 100644 --- a/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx +++ b/packages/common/business_components/src/ui/sdmInsertForm/sdmNameBox.tsx @@ -1,14 +1,14 @@ -import React, { useCallback, useEffect, useRef, useState } from 'react'; -import type { DemandCompType } from './form'; +import React, { useCallback, useEffect, useRef, useState } from "react"; +import type { DemandCompType } from "./form"; export type thisProps = { label: string | undefined; initValue: string | undefined; - dataList : DemandCompType[]; - rtnValue : (searchText: string, pageCnt: number) => void; - rtnData : (item: DemandCompType) => void; - rtnText : (text: string) => void; -} + dataList: DemandCompType[]; + rtnValue: (searchText: string, pageCnt: number) => void; + rtnData: (item: DemandCompType) => void; + rtnText: (text: string) => void; +}; /** * 수요처 검색 컴포넌트 @@ -18,88 +18,110 @@ export type thisProps = { * @param dataList 검색할 때 넘기는 데이터 리스트 * @param rtnData 검색 결과 반환 함수 */ -export const SdmSearchForm = ({label=undefined, initValue=undefined, rtnValue=()=>{}, dataList=[], rtnData=()=>{}, rtnText=()=>{} } :thisProps) => { - +export const SdmSearchForm = ({ + label = undefined, + initValue = undefined, + rtnValue = () => {}, + dataList = [], + rtnData = () => {}, + rtnText = () => {}, +}: thisProps) => { const [isOpen, setIsOpen] = useState(false); - const [textValue, setTextValue] = useState(initValue || ''); + const [textValue, setTextValue] = useState(initValue || ""); const wrapperRef = useRef<HTMLDivElement>(null); - const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { - const value = e.target.value; - setTextValue(value); - rtnValue(value, 10); - rtnText(value); - if (value) { - setIsOpen(true); - } else { - setIsOpen(false); - } - }, [rtnValue, rtnText]); + const handleInputChange = useCallback( + (e: React.ChangeEvent<HTMLInputElement>) => { + const value = e.target.value; + setTextValue(value); + rtnValue(value, 10); + rtnText(value); + if (value) { + setIsOpen(true); + } else { + setIsOpen(false); + } + }, + [rtnValue, rtnText], + ); - const handleSuggestionClick = useCallback((item: DemandCompType) => { - setTextValue(item.dmdCoNm); - rtnData(item); - setIsOpen(false); - }, [rtnData]); + const handleSuggestionClick = useCallback( + (item: DemandCompType) => { + setTextValue(item.dmdCoNm); + rtnData(item); + setIsOpen(false); + }, + [rtnData], + ); useEffect(() => { const handleClickOutside = (event: MouseEvent) => { - if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) { + if ( + wrapperRef.current && + !wrapperRef.current.contains(event.target as Node) + ) { setIsOpen(false); } }; - document.addEventListener('mousedown', handleClickOutside); + document.addEventListener("mousedown", handleClickOutside); return () => { - document.removeEventListener('mousedown', handleClickOutside); + document.removeEventListener("mousedown", handleClickOutside); }; }, []); useEffect(() => { - if(initValue&& initValue?.length>0){ - setTextValue(initValue) + if (initValue && initValue?.length > 0) { + setTextValue(initValue); } - },[initValue]) - + }, [initValue]); + return ( - <div ref={wrapperRef}> + <div className="relative" ref={wrapperRef}> <input type="text" value={textValue} onChange={handleInputChange} /* onFocus={() => setIsOpen(true)} */ - className="w-full h-[3.2rem] !text-xl pl-3 text-gray-600 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + className="h-[3.2rem] w-full rounded-md border border-gray-300 pl-3 !text-xl text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder={`${label}을(를) 입력하세요`} /> {isOpen && ( - <div className=" z-1 w-full mt-2 bg-white border border-gray-300 rounded-md shadow-lg h-90 overflow-auto"> + <div className="absolute top-full left-0 z-50 mb-2 max-h-72 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg"> <div className="max-h-72"> - {dataList && dataList.length > 0 ? dataList.map((item : DemandCompType, index : number) => ( - <div - key={index} - className="!text-xl w-full text-left px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto" - onClick={() => handleSuggestionClick(item)} - role="button" - tabIndex={0} - onKeyDown={(e) => { - if (e.key === 'Enter' || e.key === ' ') { - handleSuggestionClick(item); - } - }} - > - {item.dmdInfoPk.substring(10,14) !== '0000' ? ( - <> - <span className="text-gray-500">사업자번호 : </span> {item.dmdInfoPk.substring(0,10)}  - <span className="text-gray-500">종사업자번호 : </span> {item.dmdInfoPk.substring(10,14)}  - </> - ) : ( - <> - <span className="text-gray-500">사업자번호 : </span> {item.dmdInfoPk.substring(0,10)}  - </> - )} - <span className="float-right">{item.dmdCoNm}</span> - </div> - )) : ( - <div className="!text-xl w-full px-5 py-3 hover:bg-gray-100 cursor-pointer overflow-auto"> + {dataList && dataList.length > 0 ? ( + dataList.map((item: DemandCompType, index: number) => ( + <div + key={index} + className="w-full cursor-pointer overflow-auto px-5 py-3 text-left !text-xl hover:bg-gray-100" + onClick={() => handleSuggestionClick(item)} + role="button" + tabIndex={0} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + handleSuggestionClick(item); + } + }} + > + {item.dmdInfoPk.substring(10, 14) !== "0000" ? ( + <> + <span className="text-gray-500">사업자번호 : </span>{" "} + {item.dmdInfoPk.substring(0, 10)}  + <span className="text-gray-500"> + 종사업자번호 :{" "} + </span>{" "} + {item.dmdInfoPk.substring(10, 14)}  + </> + ) : ( + <> + <span className="text-gray-500">사업자번호 : </span>{" "} + {item.dmdInfoPk.substring(0, 10)}  + </> + )} + <span className="float-right">{item.dmdCoNm}</span> + </div> + )) + ) : ( + <div className="w-full cursor-pointer overflow-auto px-5 py-3 !text-xl hover:bg-gray-100"> 검색 결과가 없습니다. </div> )} @@ -107,5 +129,5 @@ export const SdmSearchForm = ({label=undefined, initValue=undefined, rtnValue=() </div> )} </div> - ) -} \ No newline at end of file + ); +}; diff --git a/packages/common/business_components/src/ui/search_form_left/index.tsx b/packages/common/business_components/src/ui/search_form_left/index.tsx index e7858df2a..4f36c078c 100644 --- a/packages/common/business_components/src/ui/search_form_left/index.tsx +++ b/packages/common/business_components/src/ui/search_form_left/index.tsx @@ -199,7 +199,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel setRtnSidoText(selectedSido?.text || ''); } initializeSigunData(val); - onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); + onSelectValue('0', 'sigun'); break; case 'sigun': if (setRtnSigunValue) { diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index fe720abc0..01bb18ba2 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -49,6 +49,12 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr } }, [resetSelection]); + // 테이블 데이터가 변경될 때마다 선택된 행 초기화하는 useEffect 추가 + useEffect(() => { + // 새로운 데이터가 로드되면 선택 상태 초기화 + setIdx(-1); + }, [tableData]); + const handlePageChange = (page: number) => { setCur(page); onPageChange(page); @@ -83,7 +89,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr ? <TableCell className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' + cellClick ? 'cursor-pointer' : '' } !font-bold`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} @@ -97,7 +103,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr : <TableCell className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : - cellClick ? 'cursor-pointer' : '' + cellClick ? 'cursor-pointer' : '' }`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} diff --git a/packages/common/business_components/src/ui/table/uiPageNations.tsx b/packages/common/business_components/src/ui/table/uiPageNations.tsx index 891fc4c81..ca1f8e0c0 100644 --- a/packages/common/business_components/src/ui/table/uiPageNations.tsx +++ b/packages/common/business_components/src/ui/table/uiPageNations.tsx @@ -40,7 +40,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationPrevious href="#" - onClick={() => { + onClick={(e) => { + e.preventDefault(); if (startPage > 1) handlePageChange(startPage - 1); }} /> @@ -53,7 +54,9 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationLink href="#" isActive={pageNum === pageProps.cur} - onClick={() => handlePageChange(pageNum)} + onClick={(e) => { + e.preventDefault(); + handlePageChange(pageNum)}} > {pageNum} </PaginationLink> @@ -65,7 +68,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP <PaginationItem> <PaginationNext href="#" - onClick={() => { + onClick={(e) => { + e.preventDefault(); if (endPage < totalPages) handlePageChange(endPage + 1); }} /> diff --git a/packages/common/components/src/ui/date-picker/index.tsx b/packages/common/components/src/ui/date-picker/index.tsx index 919e22435..85c584e5f 100644 --- a/packages/common/components/src/ui/date-picker/index.tsx +++ b/packages/common/components/src/ui/date-picker/index.tsx @@ -13,12 +13,14 @@ type DatePickerProps = { placeholder?: string; disabled?: boolean; selected?: Date; + zIndex?: number; // z-index prop 추가 } & React.ComponentProps<typeof DayPicker>; export function DatePicker({ className, placeholder = "날짜 선택", disabled, + zIndex, // zIndex prop 받기 ...props }: DatePickerProps) { return ( @@ -37,7 +39,10 @@ export function DatePicker({ )} </Button> </PopoverTrigger> - <PopoverContent className="w-auto p-0"> + <PopoverContent + className="w-auto p-0" + style={{ zIndex: zIndex || 'auto' }} + > <Calendar classNames={{ cell: "rounded-md" }} {...props} /> </PopoverContent> </Popover> From de4f8d618ff5837d2cb0a31d293754aad72aae6b Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 9 Jul 2025 12:12:15 +0900 Subject: [PATCH 221/259] =?UTF-8?q?feat:=20=EB=85=B8=ED=9B=84=20=ED=95=98?= =?UTF-8?q?=EC=88=98=EA=B4=80=EB=A1=9C,=20=EC=B9=A8=EC=9E=85=EC=88=98=20?= =?UTF-8?q?=EB=B6=84=EC=84=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=BC?= =?UTF-8?q?=EB=A0=A8=EB=B2=88=ED=98=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx | 8 +++++++- apps/sn/app/(with-base-layout)/oper/index.ts | 6 ++++-- apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx | 9 +++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 3578ff967..9479a5395 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -41,7 +41,12 @@ const Page = () => { page: curPage - 1, size: '10' }) - setTableData(data) + // 일련번호를 추가한 데이터로 변환 (전체 데이터 기준으로 일련번호 계산) + const dataWithRowNumber = (data || []).map((item: any, index: number) => ({ + ...item, + rowNumber: (curPage - 1) * 10 + index + 1, // 페이지 기준 일련번호 계산 + })); + setTableData(dataWithRowNumber) setTotalData(total) } catch (error) { console.error('Error fetching data:', error) } @@ -52,6 +57,7 @@ const Page = () => { setIsLoading(false); } } + useEffect(() => { setCurPage(1) fetchData() diff --git a/apps/sn/app/(with-base-layout)/oper/index.ts b/apps/sn/app/(with-base-layout)/oper/index.ts index e4be8bcf6..b9dd98685 100644 --- a/apps/sn/app/(with-base-layout)/oper/index.ts +++ b/apps/sn/app/(with-base-layout)/oper/index.ts @@ -1,5 +1,6 @@ export const tableHeadlist = [ - { id: 'sbmrgPrevntBizSn', title: '일련번호' }, + { id: 'rowNumber', title: '일련번호' }, + // { id: 'sbmrgPrevntBizSn', title: '일련번호' }, { id: 'sbmrgPrevntBizNm', title: '파일명' }, { id: 'mngYr', title: '년도' }, { id: 'mngQu', title: '분기' }, @@ -8,7 +9,8 @@ export const tableHeadlist = [ ] export const tableHeadlistOldPp = [ - { id: 'dcrpPplMtncBizSn', title: '일련번호' }, + { id: 'rowNumber', title: '일련번호' }, + // { id: 'dcrpPplMtncBizSn', title: '일련번호' }, { id: 'dcrpPplMtncBizNm', title: '파일명' }, { id: 'mngYr', title: '년도' }, { id: 'mngQu', title: '분기' }, diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index c4bac35b7..5236e1c17 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -38,9 +38,13 @@ const Page = () => { page: curPage - 1, size: '10' }) - setTableData(data) + // 일련번호를 추가한 데이터로 변환 (전체 데이터 기준으로 일련번호 계산) + const dataWithRowNumber = (data || []).map((item: any, index: number) => ({ + ...item, + rowNumber: (curPage - 1) * 10 + index + 1, // 페이지 기준 일련번호 계산 + })); + setTableData(dataWithRowNumber) setTotalData(total) - console.log(data, total) } catch (error) { console.error('Error fetching data:', error) } finally { @@ -50,6 +54,7 @@ const Page = () => { setIsLoading(false) } } + useEffect(() => { setCurPage(1) fetchData() From 90fda952ad0efb22e8c0018cb7d8291118f51d8c Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Wed, 9 Jul 2025 13:27:34 +0900 Subject: [PATCH 222/259] =?UTF-8?q?=EC=8B=9C=EC=84=A4=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=20=EC=8B=9C=20=ED=98=84=ED=99=A9=EB=AA=A9=EB=A1=9D=20=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=83=9D=EC=84=B1=EC=97=AC?= =?UTF-8?q?=EB=B6=80=20props=EB=A1=9C=20=EB=84=98=EA=B8=B0=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/Gis.js | 2 ++ .../common/business_components/src/ui/map/GisTree.js | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index 880c116cd..bad4d313c 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -30,6 +30,7 @@ function Gis({ setIsOpen, setFeatureData, featureData, + imgVisble = false, searchView: SearchView, detailView: DetailView, onFeatureSelect, @@ -386,6 +387,7 @@ function Gis({ }; onFeatureSelect(dummyFeature); }} + imageVisible={imgVisble} /> {/* <GisContent onFeatureSelect={handleFeatureSelect} isSearch={isSearch} isSearchModalOpen={isSearchModalOpen} setIsSearchModalOpen={setIsSearchModalOpen} /> */} diff --git a/packages/common/business_components/src/ui/map/GisTree.js b/packages/common/business_components/src/ui/map/GisTree.js index 5b30dc7f4..8a2db3ae2 100644 --- a/packages/common/business_components/src/ui/map/GisTree.js +++ b/packages/common/business_components/src/ui/map/GisTree.js @@ -10,7 +10,7 @@ import { DndProvider } from "react-dnd"; import { useGisContext } from './Gis'; import GisApp from './lib/gis.core'; -export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible, onCheckedChange, onLayerIconClick }) { +export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes = () => { }, visible, setVisible, onCheckedChange, onLayerIconClick,imageVisible=false }) { const { gisCore, treeData } = useGisContext(); const [checked, setChecked] = useState([]); const [expanded, setExpanded] = useState([]); @@ -188,9 +188,9 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes image.src = canvas.toDataURL('image/png'); return image; }; - const handleLayerImgClick = (nodeNm) => { - console.log('click!', nodeNm) - onLayerIconClick(nodeNm) + const handleLayerImgClick = (nodeNm, nodeId) => { + if(!checked.includes(nodeId)) alert('시설을 선택해주세요') + else onLayerIconClick(nodeNm) } if (!treeData || treeData.length === 0) return null; @@ -224,7 +224,7 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes <input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer" /> {node.icon && <span>{node.icon}</span>} <span className="text-[1.3rem] font-medium text-label">{node.text}</span> - {depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text)}} alt={node.text}></img></span>} + {imageVisible ? depth > 0 && <span><img className="cursor-pointer w-5 h-5" src='/images/map/layericon/Layer_Select_BTN.png' onClick={()=>{handleLayerImgClick(node.text, node.id)}} alt={node.text}></img></span> : null} </div> )} sort={(a, b) => { From 17f6e640a6b06abec655af339d28fa7375d2f42b Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 9 Jul 2025 15:29:36 +0900 Subject: [PATCH 223/259] =?UTF-8?q?Revert=20"feat:=20DatePicker=20zIndex?= =?UTF-8?q?=20props=20=EB=8B=A4=EC=8B=9C=20=EC=A0=81=EC=9A=A9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4224375b3a5aa1e3213b96ccfc3fff067a9ce06a. --- packages/common/components/src/ui/date-picker/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/common/components/src/ui/date-picker/index.tsx b/packages/common/components/src/ui/date-picker/index.tsx index 85c584e5f..67265df0e 100644 --- a/packages/common/components/src/ui/date-picker/index.tsx +++ b/packages/common/components/src/ui/date-picker/index.tsx @@ -40,8 +40,10 @@ export function DatePicker({ </Button> </PopoverTrigger> <PopoverContent - className="w-auto p-0" - style={{ zIndex: zIndex || 'auto' }} + className={cn( + "w-auto p-0", + zIndex ? `z-[${zIndex}]` : "" // zIndex가 있으면 적용, 없으면 기본값 + )} > <Calendar classNames={{ cell: "rounded-md" }} {...props} /> </PopoverContent> From b3a69bf2ef34331c10436669de505fa9e7caf4b6 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Wed, 9 Jul 2025 15:29:57 +0900 Subject: [PATCH 224/259] =?UTF-8?q?Revert=20"feat:=20DatePicker=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20zIndex=20props=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 52a5650ca593c82790d8d34d5f38293797f41739. --- .../components/src/ui/date-picker/index.tsx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/common/components/src/ui/date-picker/index.tsx b/packages/common/components/src/ui/date-picker/index.tsx index 67265df0e..ee5d37872 100644 --- a/packages/common/components/src/ui/date-picker/index.tsx +++ b/packages/common/components/src/ui/date-picker/index.tsx @@ -2,7 +2,7 @@ import "./date-picker.css"; import { format } from "date-fns"; import { CalendarIcon } from "lucide-react"; -import type { DayPicker } from "react-day-picker"; +import type { DayPickerSingleProps } from "react-day-picker"; import { cn } from "../../lib/utils"; import { Button } from "../button"; @@ -12,15 +12,12 @@ import { Popover, PopoverContent, PopoverTrigger } from "../popover"; type DatePickerProps = { placeholder?: string; disabled?: boolean; - selected?: Date; - zIndex?: number; // z-index prop 추가 -} & React.ComponentProps<typeof DayPicker>; +} & DayPickerSingleProps; export function DatePicker({ className, placeholder = "날짜 선택", disabled, - zIndex, // zIndex prop 받기 ...props }: DatePickerProps) { return ( @@ -39,13 +36,8 @@ export function DatePicker({ )} </Button> </PopoverTrigger> - <PopoverContent - className={cn( - "w-auto p-0", - zIndex ? `z-[${zIndex}]` : "" // zIndex가 있으면 적용, 없으면 기본값 - )} - > - <Calendar classNames={{ cell: "rounded-md" }} {...props} /> + <PopoverContent className="w-auto p-0"> + <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} /> </PopoverContent> </Popover> ); From f4d6b3415ba34f9e3dc245e462479c5400702618 Mon Sep 17 00:00:00 2001 From: JIeunhuh <entks301@naver.com> Date: Wed, 9 Jul 2025 17:41:15 +0900 Subject: [PATCH 225/259] =?UTF-8?q?=EC=A4=91=EC=88=98=EB=8F=84=EC=8B=9C?= =?UTF-8?q?=EC=84=A4=20=EC=A1=B0=EA=B1=B4=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/map/Gis.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/map/Gis.js b/packages/common/business_components/src/ui/map/Gis.js index bad4d313c..3a7bec1b8 100644 --- a/packages/common/business_components/src/ui/map/Gis.js +++ b/packages/common/business_components/src/ui/map/Gis.js @@ -89,11 +89,11 @@ function Gis({ const layerName = layerNmRef.current if (layerName === '하수재이용시설') { featureId = data.searchPk; - } else if (layerName === '빗물이용시설') { + } else if (layerName === '빗물이용시설'|| layerName == '중수도시설') { featureId = data.bdstInfoPk; } else if (layerName === '하수처리시설') { featureId = data.bscFctCd; - } else if (layerName === '중수도시설' || layerName == '온배수시설') { + } else if (layerName === '온배수시설' ) { featureId = data.bdstRuseFcltPk; } else { console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm); From e9ff6bbeb5a02657f5099ce69fcf51ce336fa420 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Wed, 9 Jul 2025 18:26:15 +0900 Subject: [PATCH 226/259] =?UTF-8?q?=EB=B0=94=EC=B0=A8=ED=8A=B8=20=ED=81=AC?= =?UTF-8?q?=EA=B8=B0=EB=B9=84=EC=9C=A8=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/BarChart.tsx | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 02d3a7c60..ddd0ac272 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -74,17 +74,25 @@ const CustomLegend = (props: any) => { ); }; +// chartData의 모든 값 중 최대값 구하기 +const getGlobalMax = (data: Record<string, number>[]) => { + if (!data || data.length === 0) return 0; + return Math.max( + ...data.flatMap(item => + Object.entries(item) + .filter(([key]) => key !== 'label') + .map(([, value]) => value as number) + ) + ); +}; + export default function Chart({chartConfig=undefined, chartData=[], chartTitle='차트', chartClassName='w-full h-full', graphSize=40, yFieldText='', showLegend=false} : BarChartProps) { const colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#FED16A", "#FFEEAD", "#D4A5A5"]; - const getMaxValue = (data: any[], keyPrefix: string) => { - return Math.max(...data.map(item => - Object.keys(item) - .filter(key => key.includes(keyPrefix)) - .map(key => item[key]) - ).flat()); - }; - - const barMaxValue = getMaxValue(chartData, 'barVal'); + const globalMax = getGlobalMax(chartData); + const tickCount = 5; + // interval을 globalMax / tickCount로 계산 + const interval = globalMax / tickCount; + const ticks = Array.from({ length: tickCount + 1 }, (_, i) => Math.round(interval * i)); return ( <> {chartTitle && chartTitle !== "" && chartTitle !== "undefined" ? ( @@ -93,8 +101,8 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle=' </div>): null} <div className="flex justify-center"> <ChartContainer config={chartConfig ?? {}} className={chartClassName + " !w-[90%]"}> - <BarChart accessibilityLayer data={chartData}> - <CartesianGrid vertical={false} /> + <BarChart accessibilityLayer data={chartData} className="!h-[88%]"> + <CartesianGrid vertical={false} className="!h-[85%]" /> <XAxis dataKey="label" tickLine={true} @@ -106,12 +114,12 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle=' <YAxis tickLine={true} tickMargin={10} - tickCount={6} axisLine={true} fontSize={12} fontWeight={500} - domain={[0, Math.ceil(barMaxValue * 1)]} - label={yFieldText ? { value: yFieldText, className:"text-[13px] font-bold", position: 'insideLeft', angle: -90, offset: 20 } : undefined} + domain={[0, globalMax]} + ticks={ticks} + label={yFieldText ? { value: yFieldText, className:"text-[15px] font-bold", position: 'insideLeft', angle: -90, offset: -30 } : undefined} /> <ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/> {chartData && chartData.length > 0 && ( From 58e0322bfeb9933313f37d14c71c97b76c74e4fb Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Wed, 9 Jul 2025 19:33:40 +0900 Subject: [PATCH 227/259] =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=EC=8B=9C=20?= =?UTF-8?q?=ED=96=89=EC=A0=95=EB=B3=84=20A=EB=A1=9C=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20(304=EB=9D=BC=EC=9D=B8)=20=EA=B1=B4=EB=93=A4=EC=A7=80?= =?UTF-8?q?=EB=A7=88=EC=84=B8=EC=9A=94=20...=E3=85=A0=E3=85=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/search_form_left/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/search_form_left/index.tsx b/packages/common/business_components/src/ui/search_form_left/index.tsx index 4f36c078c..a891ec207 100644 --- a/packages/common/business_components/src/ui/search_form_left/index.tsx +++ b/packages/common/business_components/src/ui/search_form_left/index.tsx @@ -301,7 +301,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel resetAllValues(); // 리셋 후 트리거를 false로 설정 if (setRtnPartValue) { - setRtnPartValue('0'); + setRtnPartValue('A'); } } }, [resetTrigger]); From 3ec986dfbeb8a0a834fcdcd620815e3819e352df Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Wed, 9 Jul 2025 19:52:42 +0900 Subject: [PATCH 228/259] =?UTF-8?q?datepickerrange=20=EC=83=9D=EC=84=B1(?= =?UTF-8?q?=EC=86=90=EB=8C=80=EC=A7=80=EB=A7=88=EC=84=B8=EC=9A=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/date_picker_range/index.tsx | 46 +++++++++++++++++++ .../business_components/src/ui/index.ts | 3 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 packages/common/business_components/src/ui/date_picker_range/index.tsx diff --git a/packages/common/business_components/src/ui/date_picker_range/index.tsx b/packages/common/business_components/src/ui/date_picker_range/index.tsx new file mode 100644 index 000000000..3a6ab1ae0 --- /dev/null +++ b/packages/common/business_components/src/ui/date_picker_range/index.tsx @@ -0,0 +1,46 @@ +import "./date-picker.css"; + +import { format } from "date-fns"; +import { CalendarIcon } from "lucide-react"; +import type { DayPickerSingleProps } from "react-day-picker"; + +import { cn } from "../../lib/utils"; +import { Button } from "@common/components/ui"; +import { Calendar } from "@common/components/ui"; +import { Popover, PopoverContent, PopoverTrigger } from "@common/components/ui"; + +type DatePickerRangeProps = { + placeholder?: string; + disabled?: boolean | ((date: Date) => boolean); +} & DayPickerSingleProps; + +export function DatePickerRange({ + className, + placeholder = "날짜 선택", + disabled, + ...props +}: DatePickerRangeProps) { + return ( + <Popover> + <PopoverTrigger asChild> + <Button + variant="outline" + className={cn("date-picker-trigger", className)} + disabled={typeof disabled === "boolean" ? disabled : false} + > + <CalendarIcon className="!size-[1.6rem]" /> + {props.selected ? ( + format(props.selected, "yyyy-MM-dd") + ) : ( + <span>{placeholder}</span> + )} + </Button> + </PopoverTrigger> + <PopoverContent className="w-auto p-0"> + <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} + disabled={typeof disabled === "function" ? disabled : undefined} + /> + </PopoverContent> + </Popover> + ); +} diff --git a/packages/common/business_components/src/ui/index.ts b/packages/common/business_components/src/ui/index.ts index fd1e6fe9e..eab3a7eab 100644 --- a/packages/common/business_components/src/ui/index.ts +++ b/packages/common/business_components/src/ui/index.ts @@ -21,4 +21,5 @@ export * from "./table_div"; export * from "./title"; export * from "./sdmInsertForm"; export * from "./popover_ui"; -export * from "./date_month_picker"; \ No newline at end of file +export * from "./date_month_picker"; +export * from "./date_picker_range" \ No newline at end of file From 9ab0302e0893eab8bd3872a0b03d1981eba000e8 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 <jschrome782@gmail.com> Date: Wed, 9 Jul 2025 20:00:01 +0900 Subject: [PATCH 229/259] =?UTF-8?q?=EB=8B=AC=EB=A0=A5=20=EB=A7=8C=EB=93=A0?= =?UTF-8?q?=EA=B1=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/date_picker_range/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/date_picker_range/index.tsx b/packages/common/business_components/src/ui/date_picker_range/index.tsx index 3a6ab1ae0..70565230a 100644 --- a/packages/common/business_components/src/ui/date_picker_range/index.tsx +++ b/packages/common/business_components/src/ui/date_picker_range/index.tsx @@ -1,4 +1,4 @@ -import "./date-picker.css"; +import "../date_picker/date-picker.css"; import { format } from "date-fns"; import { CalendarIcon } from "lucide-react"; From 88d05c4a86ceaad5b3bcc9afcd0e34b59d579410 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Wed, 9 Jul 2025 21:02:41 +0900 Subject: [PATCH 230/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=EC=A4=91=20rson=20ap?= =?UTF-8?q?i=20=EB=B0=94=EB=80=9C=20=E3=85=A0=E3=85=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 17 +- .../map/components/searchModalReportApi.ts | 153 ++++++++++-------- 2 files changed, 96 insertions(+), 74 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 28c93bafa..a666b2b6c 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -11,7 +11,7 @@ import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, SewagePump2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; import { GovSidoSigunguSearchForm } from '@/components/ui/govSidoSigunguSearchForm'; -import { useDcTree } from './components/searchModalReportApi'; +import { getDcTree, buildTreeTopDown, sidoList } from './components/searchModalReportApi'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -53,11 +53,10 @@ const operationTableHeadlist = [ // 하수도정비 기본계획 보고서 const reportTableHeadlist = [ { id: "no", title: "NO" }, - { id: "approvalYear", title: "승인년도" }, { id: "sido", title: "시도" }, { id: "sigungu", title: "시군구" }, - { id: "treatmentPlant", title: "하수처리장" }, - { id: "treatmentZone", title: "하수처리구역" }, + { id: "approvalYear", title: "승인년도" }, + { id: "treatmentPlantZone", title: "처리장,구역" }, { id: "reportCount", title: "보고서(00건)" }, { id: "planMapCount", title: "하수도대장 평면도(00건)" }, { id: "regDate", title: "등록일자" }, @@ -201,6 +200,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ } }, [curPage]); + // 검색 API 호출 함수 const fetchFilteredData = async () => { setIsLoading(true); // 로딩 시작 @@ -229,10 +229,11 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); if (activeTab === 'report') { - const data = flattenFolders(dcData); - console.log('dcTree:', data); - setTableData(data || []); - setTableCount(data.length || []); + const reportOriginData = await getDcTree('경기도'); + const reportData = buildTreeTopDown(reportOriginData, '경기도'); + console.log('dcTree:', reportData); + setTableData(reportData || []); + setTableCount(reportData.length || 0); } else { console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index 304cdee95..e78ff2def 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -1,26 +1,45 @@ import {useState, useEffect} from 'react'; import { getDcData } from '@/components/lib/api'; -import moment from "moment"; const ADDR_URL = process.env.NEXT_PUBLIC_ADDR_URL; -export type SelectDataType = { - val: string; - text: string; - sido?: string; // 시도 코드 -}; +type Node = { + clsfSystmSn: string; + upClsfSystmSn: string; + clsfSystmNm: string; + sortSeq: string; + droppAble: boolean; +} -type Folder = { - fldrSn: string; - upFldrSn: string; - fldrNm: string; - sort_seq: number; - children: Folder[]; -}; +type OutputNode = { + sido: string; + sigungu: string; + approvalYear: string; + level4: string; + treatmentPlantZone: string; + level6: string; + level6_clsfSystmSn: string; + no? : number; +} -type FlattenedFolder = { - [key: string]: string; -}; +type SelectDataType = { + text: string; + val: string; + sigungu?: string; // 시도 코드 (선택 사항) +} +export const sidoList: { id: number, name: string }[] = [ + { id: 0, name: '전체' }, + { id: 26, name: '부산광역시' }, + { id: 28, name: '인천광역시' }, + { id: 30, name: '대전광역시' }, + { id: 41, name: '경기도' }, + { id: 42, name: '강원도' }, + { id: 44, name: '충청남도' }, + { id: 45, name: '전라북도' }, + { id: 46, name: '전라남도' }, + { id: 47, name: '경상북도' }, + { id: 48, name: '경상남도' }, +]; // 시군구 데이터 const getSggCd = async (): Promise<SelectDataType[]> => { try { @@ -30,14 +49,14 @@ const getSggCd = async (): Promise<SelectDataType[]> => { const sgg = res.data; const sggCd = sgg.map((item: any) => ({ val: item.adstDstrCd, - sido: item.sido, + sigungu: item.sigungu, text: item.gugun, })); sggCd.unshift({ val: '0', text: '전체' }); // "전체" 옵션 추가 return sggCd; } catch (error) { console.error('시군구 데이터를 가져오는데 실패했습니다:', error); - return [{ val: '0', text: '전체', sido: '0' }]; + return [{ val: '0', text: '전체', sigungu: '0' }]; } }; @@ -61,61 +80,63 @@ const isYear = (value: string): boolean => { return /^[0-9]{4}년$/.test(value); }; -function flattenFolders(data: Folder[]): FlattenedFolder[] { - const result: FlattenedFolder[] = []; - const sggCd = await getSggCd(); - function traverse( - node: Folder, - path: { [key: string]: string }, - level: number - ) { - if (level === 2) { - if (!sggCd.some(item => item.text === node.fldrNm)) { - } - if (isYear(node.fldrNm)) { - level++; - } - } - const newPath = { - ...path, - //[`level${level}_fldrSn`]: node.fldrSn, - [`level${level}`]: node.fldrNm, - }; +export function buildTreeTopDown(treeData: Node[], topNodeNm : string): OutputNode[] { + const level6Names = ["보고서", "요약보고서", "부록", "기타"]; + const childrenMap = new Map<string, Node[]>(); - if (node.children.length === 0) { - result.push(newPath); - } else { - node.children.forEach((child) => { - traverse(child, newPath, level + 1); - }); + // 1. 부모 → 자식 연결 테이블 구성 + treeData.forEach((node) => { + if (!childrenMap.has(node.upClsfSystmSn)) { + childrenMap.set(node.upClsfSystmSn, []); } + childrenMap.get(node.upClsfSystmSn)!.push(node); + }); + const result: OutputNode[] = []; + + // 2. Top-down recursive 탐색 함수 + function traverse(path: string[], currentSn: string) { + const children = childrenMap.get(currentSn) || []; + + for (const child of children) { + const newPath = [...path, child.clsfSystmNm]; + if (level6Names.includes(child.clsfSystmNm)) { + const sido = newPath[0] || ""; + let [sigungu="", approvalYear="", level4="", treatmentPlantZone = ""] = newPath.slice(1, 5); + if (isYear(sigungu)) { + treatmentPlantZone = level4; level4 = approvalYear; approvalYear = sigungu; sigungu = ""; + } + if (level6Names.includes(treatmentPlantZone)) treatmentPlantZone = ""; + result.push({ + sido, + sigungu, + approvalYear, + level4, + treatmentPlantZone, + level6: child.clsfSystmNm, + level6_clsfSystmSn: child.clsfSystmSn, + }); + } else { + traverse(newPath, child.clsfSystmSn); + } + } // for } - data.forEach((root) => traverse(root, {}, 0)); + // 3. topNodeNm에서 시작 + const topNode = treeData.find((n) => n.clsfSystmNm === topNodeNm); + if (topNode) { + traverse([topNode.clsfSystmNm], topNode.clsfSystmSn); + } + const numberedResult = result.map((item, index) => ({ + ...item, + no: index + 1, + })); - return result; + return numberedResult; } -export const useDcTree = () => { - const [data, setData] = useState<FlattenedFolder[]>([]); - - useEffect(() => { - const fetch = async () => { - const result = await getDcData(`/api/v1/dc/tree`); - if (result) { - const flattenedData = flattenFolders(result); - setData(flattenedData); - } - }; - fetch(); - }, []); - - return data; -}; - -export const getDcTree = async () => { - const queryString = ''; - const result = await getDcData(`/api/v1/dc/tree${queryString ? `?${queryString}` : ''}`); +export const getDcTree = async (clsfSystmNm:string) => { + const queryString = 'clsfSystmNm='+clsfSystmNm; + const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`); return result; }; From cce216ad9bac561a711d8f40a98b130fbf672d48 Mon Sep 17 00:00:00 2001 From: leedj312 <dlehd467@gmail.com> Date: Thu, 10 Jul 2025 11:20:58 +0900 Subject: [PATCH 231/259] =?UTF-8?q?readOnly=20disabled=20=EA=B0=80=20?= =?UTF-8?q?=EC=95=84=EB=8B=8C=20readOnly=EB=A1=9C=20=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/date_picker/index.tsx | 134 +++++++++++------- .../src/ui/select/index.tsx | 128 +++++++++++------ 2 files changed, 173 insertions(+), 89 deletions(-) diff --git a/packages/common/business_components/src/ui/date_picker/index.tsx b/packages/common/business_components/src/ui/date_picker/index.tsx index 9df32b3b5..722b82a3c 100644 --- a/packages/common/business_components/src/ui/date_picker/index.tsx +++ b/packages/common/business_components/src/ui/date_picker/index.tsx @@ -6,62 +6,100 @@ import { format } from "date-fns"; import { CalendarIcon } from "lucide-react"; import type { DayPickerSingleProps } from "react-day-picker"; -import { Button, Calendar, Popover, PopoverContent, PopoverTrigger } from "@common/components/ui"; +import { + Button, + Calendar, + Popover, + PopoverContent, + PopoverTrigger, +} from "@common/components/ui"; import { cn } from "../../lib/utils"; import { FormControl } from "../form"; import { ko } from "date-fns/locale"; import { useState } from "react"; -type DatePickerProps = DayPickerSingleProps & { field: { value: Date; onChange: (date: Date | undefined) => void }, selectClass: string | undefined, readOnly?: boolean }; +type DatePickerProps = DayPickerSingleProps & { + field: { value: Date; onChange: (date: Date | undefined) => void }; + selectClass: string | undefined; + readOnly?: boolean; +}; +export function DatePicker({ + field, + selectClass, + readOnly = false, + ...props +}: DatePickerProps) { + const [open, setOpen] = useState(false); -export function DatePicker({ field, selectClass, readOnly = false, ...props }: DatePickerProps) { - const [open, setOpen] = useState(false); + const handleSelect = (date: Date | undefined) => { + if (!readOnly) { + // readOnly가 아닐 때만 변경 허용 + field.onChange(date); // React Hook Form 업데이트 + setOpen(false); + } + }; - const handleSelect = (date: Date | undefined) => { - if (!readOnly) { // readOnly가 아닐 때만 변경 허용 - field.onChange(date); // React Hook Form 업데이트 - setOpen(false); - } - }; + return ( + <Popover + open={open && !readOnly} + onOpenChange={readOnly ? undefined : setOpen} + > + <PopoverTrigger asChild> + <FormControl> + <Button + color="white" + variant={"outline"} + className={ + !selectClass + ? cn( + "w-[240px] pl-3 text-left font-normal", + !field?.value && "text-muted-foreground", - return ( - <Popover open={open && !readOnly} onOpenChange={readOnly ? undefined : setOpen}> - <PopoverTrigger asChild> - <FormControl> - <Button - color="white" - variant={"outline"} - disabled={readOnly} // readOnly일 때 버튼 비활성화 - className={!selectClass ? cn( - "w-[240px] pl-3 text-left font-normal", - !field?.value && "text-muted-foreground", - readOnly && "opacity-60 cursor-not-allowed" // readOnly 스타일 추가 - ) : cn(selectClass, readOnly && "opacity-60 cursor-not-allowed")} - > - {field?.value ? ( - format( - field.value instanceof Date && !isNaN(field.value.getTime()) - ? field.value - : new Date() + //감리 지적사항으로 삭제 예정 리드온리는 리드온리 로만 보일수 있도록 수정 + // disabled={readOnly} // readOnly일 때 버튼 비활성화 + //readOnly && "opacity-60 cursor-not-allowed" 감리 지적사항으로 + ) + : cn( + selectClass, + // , readOnly && "opacity-60 cursor-not-allowed" + ) + } + > + {field?.value ? ( + format( + field.value instanceof Date && !isNaN(field.value.getTime()) + ? field.value + : new Date(), - , "PPP", { locale: ko }) - ) : ( - <span>Pick a date</span> - )} - <CalendarIcon className="h-4" /> - </Button> - </FormControl> - </PopoverTrigger> - <PopoverContent className="w-auto p-0" align="start"> - <Calendar - mode="single" - selected={field?.value} - onSelect={handleSelect} - initialFocus - locale={ko} - /> - </PopoverContent> - </Popover> - ); + "PPP", + { locale: ko }, + ) + ) : ( + <span>날짜를 선택해주세요 </span> + )} + <CalendarIcon className="h-4" /> + </Button> + </FormControl> + </PopoverTrigger> + <PopoverContent className="w-auto p-0" align="start"> + <Calendar + className="w-full" + + //-- 데이트 피커가 드롭박스 형태로 년월을 선택할수 있도록 하는 Props 로 활성화 되면 드롭박스로 선택 + + // captionLayout="dropdown-buttons" + // fromYear={2000} + // toYear={new Date().getFullYear()} + toDate={new Date()} // 금일까지만 표시됨 (금일 이후는 안보임) + showOutsideDays={false} // 금월 까지만 표출되도록 + mode="single" + selected={field?.value} + onSelect={handleSelect} + initialFocus + locale={ko} + /> + </PopoverContent> + </Popover> + ); } diff --git a/packages/common/business_components/src/ui/select/index.tsx b/packages/common/business_components/src/ui/select/index.tsx index 8843aa04e..d09e3023a 100644 --- a/packages/common/business_components/src/ui/select/index.tsx +++ b/packages/common/business_components/src/ui/select/index.tsx @@ -1,57 +1,103 @@ // selectBox import { Label } from "@common/components"; -import React from "react"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./lib/selectBox"; +import React, { useEffect, useState } from "react"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "./lib/selectBox"; /** 차트 기본 스타일 */ interface SelectBox1 { - text:string, - val:string|number, - hidden?: boolean + text: string; + val: string | number; + hidden?: boolean; } const SelectBox = React.forwardRef< HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & { - label:string, - selectClass:string|undefined, - className:string, - selectArray:SelectBox1[], - onSelectValue:(val:string|number)=>void, - value?: string|number, - readOnly?: boolean // readOnly 속성 추가 + label: string; + selectClass: string | undefined; + className: string; + selectArray: SelectBox1[]; + onSelectValue: (val: string | number) => void; + value?: string | number; + readOnly?: boolean; // readOnly 속성 추가 } ->(({ label, className, selectClass, selectArray, onSelectValue, value, readOnly = false }, ref)=>{ - // hidden이 true인 첫 번째 항목을 placeholder로 사용 - const hiddenItem = selectArray.find(item => item.hidden); - const placeHolder = hiddenItem?.text ?? "선택"; - - // hidden이 true인 항목만 드롭다운에서 제외 - const visibleItems = selectArray.filter(item => !item.hidden); +>( + ( + { + label, + className, + selectClass, + selectArray, + onSelectValue, + value, + readOnly = false, + }, + ref, + ) => { + // hidden이 true인 첫 번째 항목을 placeholder로 사용 + const hiddenItem = selectArray.find((item) => item.hidden); + const placeHolder = hiddenItem?.text ?? "선택"; + const [isOpen, setIsOpen] = useState(false); + // hidden이 true인 항목만 드롭다운에서 제외 + const visibleItems = selectArray.filter((item) => !item.hidden); - // 현재 값이 hidden 항목이거나 빈 값인 경우 undefined로 설정하여 placeholder가 표시되도록 함 - const currentValue = value !== undefined && - hiddenItem && - (String(value) === String(hiddenItem.val) || value === "" || value === "0" || value === 0) - ? undefined - : (value !== undefined ? String(value) : undefined); + // 현재 값이 hidden 항목이거나 빈 값인 경우 undefined로 설정하여 placeholder가 표시되도록 함 + const currentValue = + value !== undefined && + hiddenItem && + (String(value) === String(hiddenItem.val) || + value === "" || + value === "0" || + value === 0) + ? undefined + : value !== undefined + ? String(value) + : undefined; - return ( - <div className={className+" flex items-center"} ref={ref}> - {label && <Label className="whitespace-nowrap w-20 text-xl text-gray-600">{label}</Label>} - <Select onValueChange={onSelectValue} value={currentValue} disabled={readOnly}> - <SelectTrigger className={selectClass?selectClass:"flex-1 p-2 border rounded"}> - <SelectValue placeholder={placeHolder} /> - </SelectTrigger> - <SelectContent> - {visibleItems.map((selectArray) => ( - <SelectItem key={selectArray.val} value={String(selectArray.val)}>{selectArray.text}</SelectItem> - ))} - </SelectContent> - </Select> - </div> - ) -}) + return ( + <div className={className + " flex items-center"} ref={ref}> + {label && ( + <Label className="w-20 whitespace-nowrap text-xl text-gray-600"> + {label} + </Label> + )} + <Select + open={isOpen} + onOpenChange={(open) => { + if (readOnly === true) { + // readOnly 일경우 Select 선택안하게 하기 + setIsOpen(false); + } else { + setIsOpen(open); + } + }} + onValueChange={onSelectValue} + value={currentValue} + // disabled={readOnly} //물재이용 감리 지적사항으로 일단 주석처리 + > + <SelectTrigger + className={selectClass ? selectClass : "flex-1 rounded border p-2"} + > + <SelectValue placeholder={placeHolder} /> + </SelectTrigger> + <SelectContent> + {visibleItems.map((selectArray) => ( + <SelectItem key={selectArray.val} value={String(selectArray.val)}> + {selectArray.text} + </SelectItem> + ))} + </SelectContent> + </Select> + </div> + ); + }, +); export { SelectBox }; From 1ec26b3de2970617ef332c5b0a63960f59b137bf Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 13:13:07 +0900 Subject: [PATCH 232/259] =?UTF-8?q?=EC=BF=A0=ED=82=A4=20=EC=9C=A0=ED=8B=B8?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/components/lib/utils/fileDeleteUtil.tsx | 2 +- apps/sn/app/components/lib/utils/fileUploadUtil.tsx | 2 +- apps/sn/app/components/lib/utils/index.tsx | 1 - apps/sn/src/entities/auth/lib/auth-wrapper.tsx | 2 +- apps/sn/src/entities/auth/lib/token-manager.ts | 2 +- apps/sn/src/entities/menu/lib/menu-wrapper.tsx | 2 +- apps/sn/src/shared/api/client.ts | 3 +++ .../lib/utils/cookie.tsx => src/shared/lib/cookie.ts} | 0 apps/sn/src/shared/lib/index.ts | 1 + 9 files changed, 9 insertions(+), 6 deletions(-) rename apps/sn/{app/components/lib/utils/cookie.tsx => src/shared/lib/cookie.ts} (100%) diff --git a/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx b/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx index f487034d1..4cadd12e8 100644 --- a/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx +++ b/apps/sn/app/components/lib/utils/fileDeleteUtil.tsx @@ -1,4 +1,4 @@ -import { getCookie } from "@/components/lib/utils"; +import { getCookie } from "@/shared/lib"; import { ENDPOINT } from "../api/attachment/attachment-service"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; diff --git a/apps/sn/app/components/lib/utils/fileUploadUtil.tsx b/apps/sn/app/components/lib/utils/fileUploadUtil.tsx index 195a96b0d..3bfb35f00 100644 --- a/apps/sn/app/components/lib/utils/fileUploadUtil.tsx +++ b/apps/sn/app/components/lib/utils/fileUploadUtil.tsx @@ -1,5 +1,5 @@ import { Upload, type HttpResponse } from "tus-js-client"; -import { getCookie, setCookie } from "@/components/lib/utils"; +import { getCookie, setCookie } from "@/shared/lib"; import { ENDPOINT } from "../api/attachment/attachment-service"; const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; diff --git a/apps/sn/app/components/lib/utils/index.tsx b/apps/sn/app/components/lib/utils/index.tsx index 9a41c2740..272ca7ada 100644 --- a/apps/sn/app/components/lib/utils/index.tsx +++ b/apps/sn/app/components/lib/utils/index.tsx @@ -1,4 +1,3 @@ -export * from "./cookie"; export * from "./fileUploadUtil"; export * from "./fileDownload"; export * from './date' diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index c09ca55c6..4c4ce3645 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -6,7 +6,7 @@ import { client } from "@/shared/api"; import type { IUserInfo } from "@/shared/store"; import { useUserStore } from "@/shared/lib"; import { ENDPOINT, AUTH_USER_ID } from "@/shared/config"; -import { getCookie } from "@/components/lib/utils"; +import { getCookie } from "@/shared/lib"; import axios from "axios"; import { LoginApi } from "../api/login-service"; import { tokenManager } from "../lib/token-manager"; diff --git a/apps/sn/src/entities/auth/lib/token-manager.ts b/apps/sn/src/entities/auth/lib/token-manager.ts index bf3d68265..6387f06e5 100644 --- a/apps/sn/src/entities/auth/lib/token-manager.ts +++ b/apps/sn/src/entities/auth/lib/token-manager.ts @@ -1,5 +1,5 @@ import { AUTH_USER_ID, CLAIM_NAME } from "@/shared/config"; -import { getCookie, setCookie, removeCookie } from "@/components/lib/utils"; +import { getCookie, setCookie, removeCookie } from "@/shared/lib";; export class TokenManager { private static instance: TokenManager; diff --git a/apps/sn/src/entities/menu/lib/menu-wrapper.tsx b/apps/sn/src/entities/menu/lib/menu-wrapper.tsx index e00d3696e..79a29a09c 100644 --- a/apps/sn/src/entities/menu/lib/menu-wrapper.tsx +++ b/apps/sn/src/entities/menu/lib/menu-wrapper.tsx @@ -4,7 +4,7 @@ import { useEffect } from "react"; import { usePathname, useRouter } from "next/navigation"; import { MenuAuthorityApi } from "@/entities/menu-authority/@x/menu"; import { useAlertStore, useMenuStore } from "@/shared/lib"; -import { getCookie } from "@/components/lib/utils"; +import { getCookie } from "@/shared/lib";; import { SITE_ID } from "@/shared/config"; import { MenuApi } from "../api/menu-service"; import { getCurrentMenu } from "./utils"; diff --git a/apps/sn/src/shared/api/client.ts b/apps/sn/src/shared/api/client.ts index 709bb44a5..cf37e6671 100644 --- a/apps/sn/src/shared/api/client.ts +++ b/apps/sn/src/shared/api/client.ts @@ -1,6 +1,9 @@ import { Client } from "@common/network"; import { BASE_URL } from "../config/api"; import { SITE_ID } from "../config/env"; +import { setCookie } from "../lib"; + +setCookie("site-id-key", SITE_ID); export const client = Client.getInstance({ baseURL: BASE_URL, diff --git a/apps/sn/app/components/lib/utils/cookie.tsx b/apps/sn/src/shared/lib/cookie.ts similarity index 100% rename from apps/sn/app/components/lib/utils/cookie.tsx rename to apps/sn/src/shared/lib/cookie.ts diff --git a/apps/sn/src/shared/lib/index.ts b/apps/sn/src/shared/lib/index.ts index bca6d2476..b8b4c52c0 100644 --- a/apps/sn/src/shared/lib/index.ts +++ b/apps/sn/src/shared/lib/index.ts @@ -3,3 +3,4 @@ export { useAlertStore } from "./use-alert-store"; export { useMenuStore } from "./use-menu-store"; export { useUserStore } from "./use-user-store"; export { usePrompt } from "./use-prompt"; +export { getCookie, setCookie, removeCookie } from "./cookie"; From 2bf1f4ac7089fcf7ca87a0661908584908d3395f Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 14:26:35 +0900 Subject: [PATCH 233/259] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=A9=94=EC=9D=B8=EC=97=90=EC=84=9C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/page.tsx | 71 +++++++------------ apps/sn/package.json | 3 +- .../sn/src/entities/auth/lib/auth-wrapper.tsx | 35 ++------- 3 files changed, 31 insertions(+), 78 deletions(-) diff --git a/apps/sn/app/page.tsx b/apps/sn/app/page.tsx index d19bd5e79..9bfdbb656 100644 --- a/apps/sn/app/page.tsx +++ b/apps/sn/app/page.tsx @@ -1,50 +1,29 @@ -import { Button } from "@common/components"; -import Link from "next/link"; -import { redirect } from "next/navigation"; +"use client"; +import { LoginApi } from "@/entities/auth"; +import { useEffect } from "react"; +import { getCookie } from "@/shared/lib"; +import { AUTH_USER_ID } from "@/shared/config"; +import { useRouter } from "next/navigation"; export default function Home() { - redirect("/map"); + const router = useRouter(); + const userId = "admin1gmail"; + const password = "test1234!"; + const checkToken = getCookie(AUTH_USER_ID); - // return ( - // <div> - // <div> - // <h3 className="text-bold mx-4 gap-4 text-2xl">하수관망도</h3> - // <div className="flex flex-row gap-4 p-4"> - // <Link href={"/map"}> - // <Button>하수관망도</Button> - // </Link> - // </div> - // </div> - // <div> - // <h3 className="text-bold mx-4 gap-4 text-2xl">운영정보 관리</h3> - // <div className="flex flex-row gap-4 p-4"> - // <Link href={"/oper/floodPre"}> - // <Button>도시침수 예방사업</Button> - // </Link> - // <Link href={"/oper/oldPp"}> - // <Button>노후 하수관로 정비사업</Button> - // </Link> - // </div> - // </div> - // <div> - // <h3 className="text-bold mx-4 gap-4 text-2xl"> - // I/I 분석(기초정보 설정) - // </h3> - // <div className="flex flex-row gap-4 p-4"> - // <Link href={"/ii/irsetting"}> - // <Button>침입수 분석</Button> - // </Link> - // <Link href={"/ii/rdii"}> - // <Button>RDII 분석</Button> - // </Link> - // <Link href={"/ii/result"}> - // <Button>침입수 분석 결과</Button> - // </Link> - // <Link href={"/ii/rdiiResult"}> - // <Button>RDII 분석 결과</Button> - // </Link> - // </div> - // </div> - // </div> - // ); + useEffect(() => { + if (!checkToken) { + async function doLogin() { + try { + await LoginApi.login({ userId, password }); + window.location.href = "/map"; + } catch (err) { + console.error("로그인 실패", err); + } + } + doLogin(); + } else { + router.push("/map"); + } + }, []); } diff --git a/apps/sn/package.json b/apps/sn/package.json index 95ec8f3e9..85e600dbb 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev -p 3002", "build": "next build", - "start": "next start", + "start": "next start -p 3002", "lint": "next lint" }, "dependencies": { @@ -18,7 +18,6 @@ "@radix-ui/react-label": "^2.1.2", "@radix-ui/react-slot": "^1.1.2", "@tanstack/react-query": "^5.67.1", - "@tanstack/react-query-devtools": "^5.75.5", "@tanstack/react-table": "^8.21.2", "axios": "^1.8.1", "chart.js": "^4.4.8", diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index 4c4ce3645..f0710e249 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -7,9 +7,7 @@ import type { IUserInfo } from "@/shared/store"; import { useUserStore } from "@/shared/lib"; import { ENDPOINT, AUTH_USER_ID } from "@/shared/config"; import { getCookie } from "@/shared/lib"; -import axios from "axios"; import { LoginApi } from "../api/login-service"; -import { tokenManager } from "../lib/token-manager"; const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; @@ -18,32 +16,14 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const { userInfo, setUserInfo } = useUserStore((state) => state); async function authCheck() { - const checkToken = getCookie(AUTH_USER_ID); - - - if (!checkToken) { - //TODO 나중에 수정해야.... - const userId = "admin1gmail"; - const password = "test1234!"; - await LoginApi.login({ userId, password }); - // window.location.href = "http://dev.onasys.co.kr/auth/login"; - // throw new Error("Missing required authentication tokens"); + const userId = getCookie(AUTH_USER_ID); + if (!userId) { + throw new Error("Missing required authentication tokens"); } - const accessToken = tokenManager.getToken(CLAIM_NAME); - const tokenId = tokenManager.getToken(AUTH_USER_ID); - - const response = await axios.get<IUserInfo>( + const response = await client.get<IUserInfo>( `${ENDPOINT.USER_SERVICE.USERS}/info/me`, - { - withCredentials: true, - headers: { - [CLAIM_NAME]: accessToken, - [AUTH_USER_ID]: tokenId ?? "", - }, - }, ); - if (!userInfo) setUserInfo(response.data); } @@ -60,12 +40,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - - // TODO 운영에 반영 할때 수정해야..... - // 현재 경로가 로그인 페이지가 아닐 때만 redirect - // if (!pathname.startsWith("/auth/login")) { - // window.location.href = "http://dev.onasys.co.kr/auth/login"; - // } + router.push("/"); } } })(); From b25c60082a5d1a8c435db5e61bfbea4f94f79c9c Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 15:01:41 +0900 Subject: [PATCH 234/259] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/sn/package.json b/apps/sn/package.json index 85e600dbb..edf69f3f9 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -52,3 +52,6 @@ "typescript": "^5" } } + + + From 4a4ec40787b47d085a042c5a40bb115456ff6ade Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 15:28:38 +0900 Subject: [PATCH 235/259] =?UTF-8?q?=EA=B0=9C=EB=B0=9C=20=EB=B0=B0=ED=8F=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/package.json b/apps/sn/package.json index edf69f3f9..83e13a8ed 100644 --- a/apps/sn/package.json +++ b/apps/sn/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev -p 3002", "build": "next build", - "start": "next start -p 3002", + "start:sn": "next start -p 3002", "lint": "next lint" }, "dependencies": { From b75caf4f7baf01314fd3628e1b80cb30e06254c8 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 10 Jul 2025 15:34:37 +0900 Subject: [PATCH 236/259] =?UTF-8?q?feat:=20DatePickerRange=EC=97=90=20z-in?= =?UTF-8?q?dex=20props=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/date_picker_range/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/date_picker_range/index.tsx b/packages/common/business_components/src/ui/date_picker_range/index.tsx index 70565230a..91bbb84f1 100644 --- a/packages/common/business_components/src/ui/date_picker_range/index.tsx +++ b/packages/common/business_components/src/ui/date_picker_range/index.tsx @@ -12,12 +12,14 @@ import { Popover, PopoverContent, PopoverTrigger } from "@common/components/ui"; type DatePickerRangeProps = { placeholder?: string; disabled?: boolean | ((date: Date) => boolean); + zIndex?: number; // z-index prop 추가 } & DayPickerSingleProps; export function DatePickerRange({ className, placeholder = "날짜 선택", disabled, + zIndex, ...props }: DatePickerRangeProps) { return ( @@ -36,8 +38,8 @@ export function DatePickerRange({ )} </Button> </PopoverTrigger> - <PopoverContent className="w-auto p-0"> - <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} + <PopoverContent className={cn("w-auto p-0", zIndex ? `!z-[${zIndex}]` : "")}> + <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} disabled={typeof disabled === "function" ? disabled : undefined} /> </PopoverContent> From c394fd4de2de3b3a7c0d2f2b07c8238fd0d13f4b Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 10 Jul 2025 15:47:36 +0900 Subject: [PATCH 237/259] =?UTF-8?q?Revert=20"feat:=20DatePickerRange?= =?UTF-8?q?=EC=97=90=20z-index=20props=20=EC=B6=94=EA=B0=80"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b75caf4f7baf01314fd3628e1b80cb30e06254c8. --- .../business_components/src/ui/date_picker_range/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/common/business_components/src/ui/date_picker_range/index.tsx b/packages/common/business_components/src/ui/date_picker_range/index.tsx index 91bbb84f1..70565230a 100644 --- a/packages/common/business_components/src/ui/date_picker_range/index.tsx +++ b/packages/common/business_components/src/ui/date_picker_range/index.tsx @@ -12,14 +12,12 @@ import { Popover, PopoverContent, PopoverTrigger } from "@common/components/ui"; type DatePickerRangeProps = { placeholder?: string; disabled?: boolean | ((date: Date) => boolean); - zIndex?: number; // z-index prop 추가 } & DayPickerSingleProps; export function DatePickerRange({ className, placeholder = "날짜 선택", disabled, - zIndex, ...props }: DatePickerRangeProps) { return ( @@ -38,8 +36,8 @@ export function DatePickerRange({ )} </Button> </PopoverTrigger> - <PopoverContent className={cn("w-auto p-0", zIndex ? `!z-[${zIndex}]` : "")}> - <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} + <PopoverContent className="w-auto p-0"> + <Calendar initialFocus classNames={{ cell: "rounded-md" }} {...props} disabled={typeof disabled === "function" ? disabled : undefined} /> </PopoverContent> From 4f0a445da2d2cdd1d74fb97c7051774bee1da1f2 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 16:52:49 +0900 Subject: [PATCH 238/259] =?UTF-8?q?=EB=B9=8C=EB=93=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/entities/auth/lib/auth-wrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index f0710e249..75744f66e 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -40,7 +40,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - router.push("/"); + //router.push("/"); } } })(); From 1a24cb7fee10dcfa997e98e190ad9cab93488933 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Thu, 10 Jul 2025 16:55:08 +0900 Subject: [PATCH 239/259] =?UTF-8?q?=ED=95=98=EC=88=98=EC=A0=95=EB=B9=84?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=EA=B3=84=ED=9A=8D=20=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 44 ++-- .../popupComponent/chart/infilChart.tsx | 1 - .../map/components/searchModalReportApi.ts | 223 ++++++++++-------- 3 files changed, 150 insertions(+), 118 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 885507430..6492325c3 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -10,11 +10,16 @@ import { YearRangeSelectBox } from '@/components/ui/YearRangeSelectBox'; import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; -import { GovSidoSigunguSearchForm } from '@/components/ui/govSidoSigunguSearchForm'; -import { getDcTree, buildTreeTopDown, sidoList } from './components/searchModalReportApi'; +//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; +import { getDcTree,flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; +type SelectDataType = { + text: string; + val: string; + sido?: string; // 시도 코드 (선택 사항) +} // 탭 const TABS = [ { val: "basic", text: "기본정보" }, @@ -56,9 +61,9 @@ const reportTableHeadlist = [ { id: "sido", title: "시도" }, { id: "sigungu", title: "시군구" }, { id: "approvalYear", title: "승인년도" }, - { id: "treatmentPlantZone", title: "처리장,구역" }, - { id: "reportCount", title: "보고서(00건)" }, - { id: "planMapCount", title: "하수도대장 평면도(00건)" }, + { id: "plantZoneGugun", title: "구분" }, + { id: "reportGubun", title: "보고서구분" }, + { id: "fileName", title: "파일명" }, { id: "regDate", title: "등록일자" }, ]; @@ -100,8 +105,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [tableCount, setTableCount] = useState<number>(0); const [curPage, setCurPage] = useState(1); const [basicType, setBasicType] = useState(BASIC_TYPES[0]?.val ?? ""); - const [ctpvCd, setCtpvCd] = useState(0); - const [sigungu, setSigungu] = useState(0); + const [ctpvCd, setCtpvCd] = useState(0); + const [sigungu, setSigungu] = useState(0); const [swageProcessingZone, set처리구역] = useState(""); // 날짜 상태 선언 const [시작1, set시작1] = useState(""); @@ -131,6 +136,14 @@ const SearchModal: React.FC<SearchModalProps> = ({ // 상세 정보 조회를 위한 상태 추가 const [popupFeature, setPopupFeature] = useState<any>(null); + const sidos = useCityCd(); + const siguns = useSggCd(); + // const reportOriginData = getDcTree('경기도').then(data => { + // console.log('reportOriginData:', data); + // return data; + // }); + //const reportData = flattenFolders(reportOriginData); + // 오늘 날짜 구하기 const today = new Date(); const todayYear = today.getFullYear().toString(); @@ -148,6 +161,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = ExclnSewagePumpCol2; // 하수펌프장 else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbrCol2; // 우수토실 + // 조회 버튼 클릭 시 1페이지로 이동하도록 수정 const handleSearch = () => { setCurPage(1); // 페이지를 1로 초기화 @@ -232,8 +246,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (activeTab === 'report') { const reportOriginData = await getDcTree('경기도'); - const reportData = buildTreeTopDown(reportOriginData, '경기도'); - console.log('dcTree:', reportData); + const reportData = flattenFolders(reportOriginData); + console.log('report count:', reportData.length); setTableData(reportData || []); setTableCount(reportData.length || 0); } else { @@ -1023,15 +1037,9 @@ const SearchModal: React.FC<SearchModalProps> = ({ <div className="relative flex flex-col border rounded-lg p-6 mb-4 w-full h-[23vh]"> {/* 시도, 시군구, 하수처리구역 한 줄 */} <div className="mb-6 flex items-center"> - <SidoSigunguSelectBox - sido={ctpvCd} - sigungu={sigungu} - onSidoChange={(sidoId) => { - setCtpvCd(sidoId); - setSigungu(0); - }} - onSigunguChange={setSigungu} - /> + <div className={`flex items-center justify-center mr-8`}> + + </div> </div> <div className="flex justify-between items-center mb-6"> <div className="flex items-center gap-4"> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx index 984391a95..ed39d9548 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/chart/infilChart.tsx @@ -78,7 +78,6 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => { // API 호출 try { - const dcData = fn.getDcTree(); const data = await fn.selectInftwtAnls(selectedValue); setInftwtAnlss(data ?? []); setInftwtAnlsInfos(fn.getOptionsInftwtAnlsInfo(data)); diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index e78ff2def..0f2305ef5 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -1,64 +1,64 @@ import {useState, useEffect} from 'react'; import { getDcData } from '@/components/lib/api'; +import { json } from 'stream/consumers'; const ADDR_URL = process.env.NEXT_PUBLIC_ADDR_URL; -type Node = { - clsfSystmSn: string; - upClsfSystmSn: string; - clsfSystmNm: string; - sortSeq: string; - droppAble: boolean; -} -type OutputNode = { - sido: string; - sigungu: string; - approvalYear: string; - level4: string; - treatmentPlantZone: string; - level6: string; - level6_clsfSystmSn: string; - no? : number; -} +type Folder = { + clsfSystmSn: string; + upClsfSystmSn: string; + clsfSystmNm: string; + children: Folder[]; + }; + +type FlattenedFolder = { + [key: string]: string|number; +}; type SelectDataType = { text: string; val: string; - sigungu?: string; // 시도 코드 (선택 사항) + sido?: string; // 시도 코드 (선택 사항) } -export const sidoList: { id: number, name: string }[] = [ - { id: 0, name: '전체' }, - { id: 26, name: '부산광역시' }, - { id: 28, name: '인천광역시' }, - { id: 30, name: '대전광역시' }, - { id: 41, name: '경기도' }, - { id: 42, name: '강원도' }, - { id: 44, name: '충청남도' }, - { id: 45, name: '전라북도' }, - { id: 46, name: '전라남도' }, - { id: 47, name: '경상북도' }, - { id: 48, name: '경상남도' }, -]; -// 시군구 데이터 -const getSggCd = async (): Promise<SelectDataType[]> => { - try { - const response = await fetch(`${ADDR_URL}/api/v1/addr/sgg`, { method: "GET", headers: { accept: "application/json" } }); - if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`); - const res = await response.json(); - const sgg = res.data; - const sggCd = sgg.map((item: any) => ({ + // 시군구 데이터 +export const getSggCd = async (): Promise<SelectDataType[]> => { + try { + const response = await fetch(`${ADDR_URL}/api/v1/addr/sgg`, { method: "GET", headers: { accept: "application/json" } }); + if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`); + const res = await response.json(); + const sgg = res.data; + const sggCd = sgg.map((item: any) => ({ val: item.adstDstrCd, - sigungu: item.sigungu, + sido: item.sido, text: item.gugun, - })); - sggCd.unshift({ val: '0', text: '전체' }); // "전체" 옵션 추가 - return sggCd; - } catch (error) { - console.error('시군구 데이터를 가져오는데 실패했습니다:', error); - return [{ val: '0', text: '전체', sigungu: '0' }]; - } -}; + })); + sggCd.unshift({ val: '0', text: '전체' }); // "전체" 옵션 추가 + return sggCd; + } catch (error) { + console.error('시군구 데이터를 가져오는데 실패했습니다:', error); + return [{ val: '0', text: '전체', sido: '0' }]; + } + }; + + // 시도 데이터 +export const getCityCd = async (): Promise<SelectDataType[]> => { + try { + const response = await fetch(`${ADDR_URL}/api/v1/addr/city`, { method: "GET", headers: { accept: "application/json" } }); + if (!response.ok) throw new Error(`시도 데이터 오류: ${response.status}`); + const res = await response.json(); + const city = res.data; + const cityCd = city.map((item: any) => ({ + val: item.adstDstrCd, + text: item.sido, + })); + cityCd.unshift({ val: '0', text: '전체' }); + return cityCd; + } catch (error) { + console.error('시도 데이터를 가져오는데 실패했습니다:', error); + return [{ val: '0', text: '전체', sido: '0' }]; + } + }; export const useSggCd = () => { const [data, setData] = useState<SelectDataType[]>([]); @@ -75,69 +75,94 @@ export const useSggCd = () => { return data; }; +export const useCityCd = () => { + const [data, setData] = useState<SelectDataType[]>([]); + + useEffect(() => { + const fetch = async () => { + const result = await getSggCd(); + if (result) { + setData(result); + } + }; + fetch(); + }, []); + + return data; +}; const isYear = (value: string): boolean => { return /^[0-9]{4}년$/.test(value); }; -export function buildTreeTopDown(treeData: Node[], topNodeNm : string): OutputNode[] { - const level6Names = ["보고서", "요약보고서", "부록", "기타"]; - const childrenMap = new Map<string, Node[]>(); + export function flattenFolders(data: Folder[]): FlattenedFolder[] { + const result: FlattenedFolder[] = []; + const exceptNodeNm = ["부분","통합","전체"]; + const addNodeNm = ["보고서","요약보고서","부록","기타"]; // level5 + const columnNms: { [key: number]: string } = { 0: "root", 1:"sido", 2:"sigungu", 3:"approvalYear" + ,4:"plantZoneGugun", 5:"reportGubun", 7:"fileName", 8:"regDate" }; - // 1. 부모 → 자식 연결 테이블 구성 - treeData.forEach((node) => { - if (!childrenMap.has(node.upClsfSystmSn)) { - childrenMap.set(node.upClsfSystmSn, []); - } - childrenMap.get(node.upClsfSystmSn)!.push(node); - }); - const result: OutputNode[] = []; - - // 2. Top-down recursive 탐색 함수 - function traverse(path: string[], currentSn: string) { - const children = childrenMap.get(currentSn) || []; - - for (const child of children) { - const newPath = [...path, child.clsfSystmNm]; - if (level6Names.includes(child.clsfSystmNm)) { - const sido = newPath[0] || ""; - let [sigungu="", approvalYear="", level4="", treatmentPlantZone = ""] = newPath.slice(1, 5); - if (isYear(sigungu)) { - treatmentPlantZone = level4; level4 = approvalYear; approvalYear = sigungu; sigungu = ""; - } - if (level6Names.includes(treatmentPlantZone)) treatmentPlantZone = ""; - result.push({ - sido, - sigungu, - approvalYear, - level4, - treatmentPlantZone, - level6: child.clsfSystmNm, - level6_clsfSystmSn: child.clsfSystmSn, - }); - } else { - traverse(newPath, child.clsfSystmSn); + function traverse( + node: Folder, + path: { [key: string]: string| number }, + level: number + ) { + if (level === 2 && isYear(node.clsfSystmNm)) { + level++; } - } // for + if (level === 4 && addNodeNm.includes(node.clsfSystmNm)) { + level++; // 레벨을 증가시켜 하위값에 추가되도록 함. + } + + const newPath = { + ...path, + [`${columnNms[level]}`]: node.clsfSystmNm, + }; + + if (node.children.length === 0) { + newPath.no = result.length + 1; + newPath.clsfSystmSn = node.clsfSystmSn; // 파일 조회를 위한 고유번호 + result.push(newPath); + } else { + if (level === 4) { + if (exceptNodeNm.includes(node.clsfSystmNm)) { + level--; // 제외할 노드 이름인 경우, 현재의 레벨에 하위값이 써지도록 함. + } + } + node.children.forEach((child) => { + traverse(child, newPath, level + 1); + }); + } + } + + data.forEach((root) => traverse(root, {}, 0)); + console.log(result.slice(0, 10)); + return result; } - // 3. topNodeNm에서 시작 - const topNode = treeData.find((n) => n.clsfSystmNm === topNodeNm); - if (topNode) { - traverse([topNode.clsfSystmNm], topNode.clsfSystmSn); - } - const numberedResult = result.map((item, index) => ({ - ...item, - no: index + 1, - })); - - return numberedResult; -} export const getDcTree = async (clsfSystmNm:string) => { - const queryString = 'clsfSystmNm='+clsfSystmNm; - const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`); + const cityName = encodeURIComponent(clsfSystmNm); + const queryString = 'clsfSystmNm='+cityName; + console.log("getDcTree queryString:", queryString); + //const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`); + const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm); return result; }; +export const useDcTree = (clsfSystmNm:string) => { + const [data, setData] = useState<SelectDataType[]>([]); + + useEffect(() => { + const fetch = async () => { + const result = await getDcTree(clsfSystmNm); + if (result) { + setData(result); + } + }; + fetch(); + }, [clsfSystmNm]); + + return data; +}; From 0bf2484e8d6b889d1734a6a78ea590d0fa4d9883 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 17:13:48 +0900 Subject: [PATCH 240/259] =?UTF-8?q?=EC=9A=B4=EC=98=81=ED=99=98=EA=B2=BD=20?= =?UTF-8?q?env=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.production | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 apps/sn/.env.production diff --git a/apps/sn/.env.production b/apps/sn/.env.production new file mode 100644 index 000000000..fab02e36c --- /dev/null +++ b/apps/sn/.env.production @@ -0,0 +1,12 @@ +NEXT_PUBLIC_SITE_ID = SN +NEXT_PUBLIC_PORT = 11302 +NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver +NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_CLAIM_NAME = Authorization +NEXT_PUBLIC_AUTH_USER_ID = token-id +NEXT_PUBLIC_ACCESS_TOKEN = access-token +NEXT_PUBLIC_REFRESH_TOKEN = refresh-token + +NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API From ed368160a2d27a7c1e41568309f1650b464a1c80 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 17:18:00 +0900 Subject: [PATCH 241/259] =?UTF-8?q?=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/entities/auth/lib/auth-wrapper.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index 75744f66e..8b43459d9 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -40,6 +40,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); + //TODO 권한체크 실패시 로직 들어가야 함. //router.push("/"); } } From 01427314b120cfeb470b31058cebc762dd41f2ea Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Thu, 10 Jul 2025 17:49:53 +0900 Subject: [PATCH 242/259] =?UTF-8?q?=EC=8B=9C=EA=B5=B0=EA=B5=AC=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 6492325c3..c9130eb9e 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -1037,9 +1037,22 @@ const SearchModal: React.FC<SearchModalProps> = ({ <div className="relative flex flex-col border rounded-lg p-6 mb-4 w-full h-[23vh]"> {/* 시도, 시군구, 하수처리구역 한 줄 */} <div className="mb-6 flex items-center"> - <div className={`flex items-center justify-center mr-8`}> - - </div> + <SelectBox2 + className="w-[150px] mr-8" + selectClass="rounded-lg bg-white" + label="시도" + selectArray={sidos} + value={ctpvCd} + onSelectValue={val => setCtpvCd(Number(val))} + /> + <SelectBox2 + className="w-48" + selectClass="w-48 rounded-lg bg-white truncate" + label="시군구" + selectArray={siguns} + value={sigungu} + onSelectValue={val => setSigungu(Number(val))} + /> </div> <div className="flex justify-between items-center mb-6"> <div className="flex items-center gap-4"> From 4294f3c87865d0dda05b30069024397ab9b32f29 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Thu, 10 Jul 2025 21:02:23 +0900 Subject: [PATCH 243/259] =?UTF-8?q?=EA=B6=8C=ED=95=9C=20=EC=97=86=EC=9D=84?= =?UTF-8?q?=EB=95=8C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=90=98=EA=B2=8C=20?= =?UTF-8?q?=ED=99=88=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/src/entities/auth/lib/auth-wrapper.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx index 8b43459d9..f0710e249 100644 --- a/apps/sn/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/sn/src/entities/auth/lib/auth-wrapper.tsx @@ -40,8 +40,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => { } catch (refreshError) { console.error("Token refresh failed:", refreshError); setUserInfo(null); - //TODO 권한체크 실패시 로직 들어가야 함. - //router.push("/"); + router.push("/"); } } })(); From 55b3155dbf045028da25d6ec9ddf2449d22a70e3 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Thu, 10 Jul 2025 21:02:29 +0900 Subject: [PATCH 244/259] =?UTF-8?q?=EC=8B=9C=EA=B5=B0=EA=B5=AC=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 69 +++++++++---------- apps/sn/app/(map-layout)/map/commonStore.ts | 25 +++++++ .../map/components/searchModalReportApi.ts | 2 +- 3 files changed, 58 insertions(+), 38 deletions(-) create mode 100644 apps/sn/app/(map-layout)/map/commonStore.ts diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index c9130eb9e..e14b7cb8b 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -12,14 +12,10 @@ import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, Exc import LoadingOverlay from '@/components/ui/LoadingBar'; //import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; import { getDcTree,flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; +import { useCityCdStore, type SelectDataType } from './commonStore'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; -type SelectDataType = { - text: string; - val: string; - sido?: string; // 시도 코드 (선택 사항) -} // 탭 const TABS = [ { val: "basic", text: "기본정보" }, @@ -105,8 +101,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [tableCount, setTableCount] = useState<number>(0); const [curPage, setCurPage] = useState(1); const [basicType, setBasicType] = useState(BASIC_TYPES[0]?.val ?? ""); - const [ctpvCd, setCtpvCd] = useState(0); - const [sigungu, setSigungu] = useState(0); + const [ctpvCd, setCtpvCd] = useState('0'); + const [sigungu, setSigungu] = useState('0'); const [swageProcessingZone, set처리구역] = useState(""); // 날짜 상태 선언 const [시작1, set시작1] = useState(""); @@ -130,19 +126,16 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [가동개시_종료_일, set가동개시_종료_일] = useState(''); const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) const [toDate, setToDate] = useState(new Date()) + const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]); // 로딩바 const [isLoading, setIsLoading] = useState(false); // 상세 정보 조회를 위한 상태 추가 const [popupFeature, setPopupFeature] = useState<any>(null); + //const { cityCd: ctpvCd, setCityCd:setCtpvCd, sidos, setSidos, siguns, setSiguns } = useCityCdStore(); const sidos = useCityCd(); const siguns = useSggCd(); - // const reportOriginData = getDcTree('경기도').then(data => { - // console.log('reportOriginData:', data); - // return data; - // }); - //const reportData = flattenFolders(reportOriginData); // 오늘 날짜 구하기 const today = new Date(); @@ -177,7 +170,16 @@ const SearchModal: React.FC<SearchModalProps> = ({ } }; - // 구분(basicType)이 바뀔 때마다 queryParams, filterParams 초기화 + const handleCtpvCdChange = (val: string|number) => { + const sidoOption = sidos.find((n) => n.val === val); + setCtpvCd(String(val)); + if (val !== '0' && sidoOption) { + const filterSiguns = siguns.filter(item => item.sido === sidoOption.text); + filterSiguns.unshift({ val: '0', text: '전체', sido: '0' }); + setFilteredSiguns(filterSiguns); + } + } + useEffect(() => { // filterParams 초기화 // setFilterParams({}); @@ -193,8 +195,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ set가동개시_종료_월(""); set가동개시_시작_일(""); set가동개시_종료_일(""); - setCtpvCd(0); - setSigungu(0); + setCtpvCd('0'); + setSigungu('0'); set처리구역(""); setYearFilter({ 시작: "", @@ -247,9 +249,18 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (activeTab === 'report') { const reportOriginData = await getDcTree('경기도'); const reportData = flattenFolders(reportOriginData); + let filterReportData = reportData; + if (ctpvCd !== "0") { + const sidoOption = sidos.find((n) => n.val === ctpvCd); + filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text); + } + if (sigungu !== "0") { + const sigunguOption = filteredSiguns.find((n) => n.val === sigungu); + filterReportData = filterReportData.filter(item => item.sido === sigunguOption?.text); + } console.log('report count:', reportData.length); - setTableData(reportData || []); - setTableCount(reportData.length || 0); + setTableData(filterReportData || []); + setTableCount(filterReportData.length || 0); } else { console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); @@ -458,23 +469,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ // 설치년도 범위 if (ctpvCd) cqlFilters.push(`ctpv_cd='${ctpvCd}'`); if (sigungu) cqlFilters.push(`sgg_cd='${sigungu}'`); - if (swageProcessingZone) cqlFilters.push(`swageProcessingZone='${swageProcessingZone}'`); - if (변수1) cqlFilters.push(`처리구역코드='${변수1}'`); - const startDate = getDateString( - yearFilter.시작, - 가동개시_시작_월, - 가동개시_시작_일, - "19000101", - ); - const endDate = getDateString( - yearFilter.종료, - 가동개시_종료_월, - 가동개시_종료_일, - `${todayYear}${todayMonth}${todayDate}`, - ); - cqlFilters.push( - `설치시작년도 >= '${startDate}' and 설치시작년도 <= '${endDate}'`, - ); + return cqlFilters; }; @@ -1043,15 +1038,15 @@ const SearchModal: React.FC<SearchModalProps> = ({ label="시도" selectArray={sidos} value={ctpvCd} - onSelectValue={val => setCtpvCd(Number(val))} + onSelectValue={handleCtpvCdChange} /> <SelectBox2 className="w-48" selectClass="w-48 rounded-lg bg-white truncate" label="시군구" - selectArray={siguns} + selectArray={filteredSiguns} value={sigungu} - onSelectValue={val => setSigungu(Number(val))} + onSelectValue={val => setSigungu(String(val))} /> </div> <div className="flex justify-between items-center mb-6"> diff --git a/apps/sn/app/(map-layout)/map/commonStore.ts b/apps/sn/app/(map-layout)/map/commonStore.ts new file mode 100644 index 000000000..ff903e1e7 --- /dev/null +++ b/apps/sn/app/(map-layout)/map/commonStore.ts @@ -0,0 +1,25 @@ +import { create } from 'zustand'; + +export type SelectDataType = { + text: string; + val: string; + sido?: string; // 시도 코드 (선택 사항) +} + +interface CityCdStore { + cityCd: string; + setCityCd: (cityCd: string) => void; + sidos: SelectDataType[]; + setSidos: (sidos: SelectDataType[]) => void; + siguns : SelectDataType[]; + setSiguns: (siguns: SelectDataType[]) => void; +} + +export const useCityCdStore = create<CityCdStore>((set) => ({ + cityCd: '', + setCityCd: (cityCd: string) => set({ cityCd }), + sidos: [], + setSidos: (sidos: SelectDataType[]) => set({ sidos }), + siguns: [], + setSiguns: (siguns: SelectDataType[]) => set({ siguns }), +})); diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index 0f2305ef5..6d1494aab 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -80,7 +80,7 @@ export const useCityCd = () => { useEffect(() => { const fetch = async () => { - const result = await getSggCd(); + const result = await getCityCd(); if (result) { setData(result); } From 757dc97bda6c86424a6102aadcca1c61b9a9fac7 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Thu, 10 Jul 2025 21:11:01 +0900 Subject: [PATCH 245/259] =?UTF-8?q?feat:=20=ED=95=98=EC=88=98=ED=8E=8C?= =?UTF-8?q?=ED=94=84=EC=9E=A5,=20=ED=95=98=EC=88=98=EB=A7=A8=ED=99=80,=20?= =?UTF-8?q?=ED=95=98=EC=88=98=EA=B4=80=EB=A1=9C,=20=EC=9A=B0=EC=88=98?= =?UTF-8?q?=ED=86=A0=EC=8B=A4=20=EC=9E=90=EC=B2=B4=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=A0=80=EC=9E=A5=20=EB=B0=8F=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.local | 2 +- apps/sn/app/(map-layout)/map/SearchModal.tsx | 69 +++--- .../map/components/common/index.ts | 4 +- .../map/components/common/table.ts | 219 +++++++++++++++++- .../components/popupComponent/MsSwagePpl.tsx | 46 ++-- .../map/components/popupComponent/Ssc.tsx | 72 +++--- .../components/popupComponent/sewagePump.tsx | 41 +++- .../map/components/popupComponent/smh.tsx | 37 ++- .../map/featureClickEventPopup.tsx | 156 ++++++++++--- apps/sn/app/components/lib/api/index.ts | 2 + apps/sn/app/components/ui/verticalTable.tsx | 30 ++- 11 files changed, 542 insertions(+), 136 deletions(-) diff --git a/apps/sn/.env.local b/apps/sn/.env.local index 35c1476f5..d0be4b904 100644 --- a/apps/sn/.env.local +++ b/apps/sn/.env.local @@ -12,4 +12,4 @@ NEXT_PUBLIC_REFRESH_TOKEN = refresh-token NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API #NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성 부장님 API -#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정 차장님 API +#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.222:8883/sewerage-service/api # 박이정 차장님 API diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 73cc5fc8e..a549ece0b 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -1,8 +1,8 @@ import FeatureClickEventPopup from './featureClickEventPopup'; import React, { useEffect, useState } from 'react'; import axios from 'axios'; -import { UiModal, UiTable } from '@common/business_components/ui'; -import { Button, DatePicker, Input, Label } from '@common/components'; +import { UiModal, UiTable, DatePickerRange } from '@common/business_components/ui'; +import { Button, Input, Label } from '@common/components'; import { UiTable2 } from '@common/business_components/ui/table/index-2'; import { UITab2 } from '@common/business_components/ui/tab/index-2'; import { SelectBox2 } from '@common/business_components/ui/select/index-2'; @@ -136,6 +136,21 @@ const SearchModal: React.FC<SearchModalProps> = ({ const todayMonth = (today.getMonth() + 1).toString().padStart(2, "0"); const todayDate = today.getDate().toString().padStart(2, "0"); + const isDateInRanges = (date: Date) => { + const standYear = parseInt(fromDate.getFullYear().toString()); + const dateRanges = []; + dateRanges.push({ + start: new Date(standYear, 0, 1), + end: new Date(standYear, 11, 31) + }); + + return dateRanges.some(range => { + const start = new Date(range.start); + const end = new Date(range.end); + return date >= start && date <= end; + }); + }; + // UiTable2에 넘길 headlist를 BASIC_TYPES 값에 따라 분기 처리 let dynamicHeadlist = MsSwagePplCol2; // default 값 if (activeTab === 'operation') dynamicHeadlist = operationTableHeadlist; // 운영정보 @@ -964,43 +979,23 @@ const SearchModal: React.FC<SearchModalProps> = ({ startLabel="수행기간" endLabel="" /> */} - <DatePicker - className='mr-4' - mode={'single'} - selected={fromDate} - onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} - zIndex={102} + <DatePickerRange + mode="single" //고정 + selected={fromDate} // 처음에 선택할 날짜 - 타입은 date타입 + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} // 선택했을 때 이벤트 (주로 set) + className="w-full p-1 border rounded bg-white" // 스타일 + disabled={(date) => !isDateInRanges(date)} // 선택못하게 하는 날짜 - 없으면 안넣어도 됨 + defaultMonth={fromDate} // 처음에 시작할 날짜 selected랑 같이 같은 날짜 넣으면 됨 /> - <span>~</span> - <DatePicker - className='ml-4' - mode={'single'} - selected={toDate} - onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} - modifiers={{ - disabled: { after: new Date() } - }} - zIndex={102} + <span className='text-xl m-4'>~</span> + <DatePickerRange + mode="single" //고정 + selected={toDate} // 처음에 선택할 날짜 - 타입은 date타입 + onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} // 선택했을 때 이벤트 (주로 set) + className="w-full p-1 border rounded bg-white" // 스타일 + disabled={(date) => !isDateInRanges(date)} // 선택못하게 하는 날짜 - 없으면 안넣어도 됨 + defaultMonth={toDate} // 처음에 시작할 날짜 selected랑 같이 같은 날짜 넣으면 됨 /> - <div className="flex items-center"> - {/* 경과년도 */} - {/* <Label className="mr-2 w-auto text-xl text-gray-600"> - 경과년도 - </Label> - <Input - className="mr-8 w-[100px] !text-xl placeholder:text-center" - placeholder="입력" - value={yearFilter.경과년도} - onChange={(e) => { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - setYearFilter({ ...yearFilter, 경과년도: val }); - }} - /> */} - </div> </div> {/* 조회 버튼 중앙 정렬 */} <div className="absolute bottom-4 right-4 mr-2"> diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index 51dd450e7..e71e8ba3f 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -7,9 +7,11 @@ import SwtrmtFclt from "../popupComponent/SwtrmtFclt"; type LayerComponentProps = { featureData: any; - chkMainSsc?: boolean; + isMainSsc?: boolean; + isDrtwSewagePump?: boolean; additionalData?: any; onSaveClick?: () => void; + onFormDataChange?: (data: any) => void; // 추가 }; type LayerContentMap = { [key: string]: { diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index f114cf97b..87be5bf6e 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -55,6 +55,213 @@ export const MsSwagePplCol2 = [ // { id: 'usgCd', title: '용도코드' }, // { id: 'lyrTypeNm', title: '레이어타입명' }, ] +// 하수관로 용도 코드표 +export const MS_SWAGE_PPL_USE_CODES = [ + { val: "SBA000", text: "미분류" }, + { val: "SBA001", text: "합류관" }, + { val: "SBA002", text: "차집관" }, + { val: "SBA003", text: "우수관" }, + { val: "SBA004", text: "오수관" }, + { val: "SBA999", text: "기타" }, + { val: "그 외", text: "미분류" }, +]; +// 하수관로 재질 코드표 +export const MS_SWAGE_PPL_CODES = [ + { val: "MOP000", text: "미분류" }, + { val: "MOP001", text: "닥타일주철관(DCIP)" }, + { val: "MOP002", text: "강관(SP)" }, + { val: "MOP003", text: "아연도강관(GS)" }, + { val: "MOP004", text: "염화비닐관(PVC)" }, + { val: "MOP005", text: "폴리에틸렌관(PE)" }, + { val: "MOP006", text: "스테인레스관(SSP)" }, + { val: "MOP007", text: "동관(COP)" }, + { val: "MOP008", text: "P.S.콘크리트관(PC)" }, + { val: "MOP009", text: "석면시멘트관(AS)" }, + { val: "MOP010", text: "회주철관(CIP)" }, + { val: "MOP011", text: "연관(LP)" }, + { val: "MOP012", text: "흉관(HP)" }, + { val: "MOP013", text: "철근콘크리트관(RC)" }, + { val: "MOP014", text: "강관(ST)" }, + { val: "MOP015", text: "주철관(CI)" }, + { val: "MOP016", text: "화학제품류관(PV)" }, + { val: "MOP017", text: "도관(VC)" }, + { val: "MOP018", text: "석축(SE)" }, + { val: "MOP019", text: "도복장 강관(SP)" }, + { val: "MOP020", text: "흉관(EP)" }, + { val: "MOP021", text: "아연도강관(GP)" }, + { val: "MOP022", text: "청동관(BR)" }, + { val: "MOP023", text: "고무몰딩(RM)" }, + { val: "MOP024", text: "주강(CS)" }, + { val: "MOP025", text: "VR관" }, + { val: "MOP026", text: "HDPE관" }, + { val: "MOP027", text: "시멘트라이닝주철관(C)" }, + { val: "MOP028", text: "수도용 PE관(PE)" }, + { val: "MOP029", text: "석면시멘트관(AC)" }, + { val: "MOP030", text: "폴리에틸렌분체라이닝강관(PEP)" }, + { val: "MOP031", text: "에폭시코팅강관(EPS)" }, + { val: "MOP032", text: "HI-3P" }, + { val: "MOP033", text: "철근콘크리트박스(RCB)" }, + { val: "MOP034", text: "콘크리트중선함(CD)" }, + { val: "MOP035", text: "후랙시불전선함(FP)" }, + { val: "MOP036", text: "전선함(FD)" }, + { val: "MOP038", text: "이중보온관" }, + { val: "MOP039", text: "폴리에틸렌피복강관(PLP)" }, + { val: "MOP041", text: "FRP" }, + { val: "MOP042", text: "강재" }, + { val: "MOP999", text: "기타" }, + { val: "MOP800", text: "2중벽PE관" }, + { val: "MOP801", text: "3중벽PE관" }, + { val: "MOP802", text: "가스배관용 강관" }, + { val: "MOP803", text: "강관(피복 Double, 용접접합)" }, + { val: "MOP804", text: "강관(피복 Single, 용접접합)" }, + { val: "MOP805", text: "강관(CP)" }, + { val: "MOP806", text: "강철" }, + { val: "MOP807", text: "강화플라스틱복합관" }, + { val: "MOP808", text: "경질염화비닐관(HI-VP)" }, + { val: "MOP809", text: "고강성PVC이중벽관" }, + { val: "MOP810", text: "고광도PVC이중벽관" }, + { val: "MOP811", text: "고밀도폴리에틸렌관(THP)" }, + { val: "MOP812", text: "고밀도폴리에틸렌파상형이중벽관" }, + { val: "MOP813", text: "공장제 박스관거" }, + { val: "MOP814", text: "관로없음(알케이블)" }, + { val: "MOP815", text: "나선형강관" }, + { val: "MOP816", text: "내충격수도관" }, + { val: "MOP817", text: "내충격용하수도용경질염화비닐관(HI-VG)" }, + { val: "MOP818", text: "내충격HI-VG2관" }, + { val: "MOP819", text: "내충격PVC하수관" }, + { val: "MOP820", text: "녹석(돌산호과 일종)" }, + { val: "MOP821", text: "동관(구리관, 용접)" }, + { val: "MOP822", text: "둥근잔돌" }, + { val: "MOP823", text: "무근콘크리트" }, + { val: "MOP824", text: "백관" }, + { val: "MOP825", text: "복합철판파형관" }, + { val: "MOP826", text: "분체라이닝관" }, + { val: "MOP827", text: "석축박스" }, + { val: "MOP828", text: "석축철콘" }, + { val: "MOP829", text: "수도용경질염화비관" }, + { val: "MOP830", text: "수도용경질염화비닐이음관" }, + { val: "MOP831", text: "수도용엑포시수지분체내외면코팅강관" }, + { val: "MOP832", text: "수지파형강관(PCS)" }, + { val: "MOP833", text: "수지CSP" }, + { val: "MOP834", text: "스테인레스 주름관" }, + { val: "MOP835", text: "스테인레스관(STS)" }, + { val: "MOP836", text: "스테인레스스틸파이프관" }, + { val: "MOP837", text: "아스콘" }, + { val: "MOP838", text: "아스팔트" }, + { val: "MOP839", text: "아스팔트도복장강관(ASP)" }, + { val: "MOP840", text: "아연" }, + { val: "MOP841", text: "아연도금(백관)" }, + { val: "MOP842", text: "알루미늄" }, + { val: "MOP843", text: "알루미늄합금" }, + { val: "MOP844", text: "압력배관용 탄소강관" }, + { val: "MOP845", text: "양철관" }, + { val: "MOP846", text: "양철주름관(CSP)" }, + { val: "MOP847", text: "연합인슈강판" }, + { val: "MOP848", text: "와사관(GSP)" }, + { val: "MOP849", text: "원심력철근콘크리트" }, + { val: "MOP850", text: "유리섬유관(GRP)" }, + { val: "MOP851", text: "유리섬유복합관(GRP)" }, + { val: "MOP852", text: "이음매없는동및동합금관" }, + { val: "MOP853", text: "일반배관용스테인리스강관" }, + { val: "MOP854", text: "전압 콘크리트관" }, + { val: "MOP855", text: "주름관" }, + { val: "MOP856", text: "주름주철파형강관" }, + { val: "MOP857", text: "지중 저압케이블 입상관" }, + { val: "MOP858", text: "진동및전압철근콘크리트관" }, + { val: "MOP859", text: "철근콘크리트" }, + { val: "MOP860", text: "철근콘크리트 블록" }, + { val: "MOP861", text: "철근콘크리트조립흙막이" }, + { val: "MOP862", text: "철판매입관" }, + { val: "MOP863", text: "청동" }, + { val: "MOP864", text: "코아식프리스트레스트콘크리트관" }, + { val: "MOP865", text: "콘크리트" }, + { val: "MOP866", text: "콘크리트 폴륨관" }, + { val: "MOP867", text: "콘크리트블록" }, + { val: "MOP868", text: "탄소강" }, + { val: "MOP869", text: "탄소강(카본스틸)" }, + { val: "MOP870", text: "탄소주강" }, + { val: "MOP871", text: "트러후" }, + { val: "MOP872", text: "파선형강관(RCF)" }, + { val: "MOP873", text: "파형강관(CSP)" }, + { val: "MOP874", text: "파형관" }, + { val: "MOP875", text: "파형플라스틱관" }, + { val: "MOP876", text: "폴리머관" }, + { val: "MOP877", text: "폴리에스테르수지콘크리트관" }, + { val: "MOP878", text: "폴리에틸렌 전선관" }, + { val: "MOP879", text: "폴리에틸렌 피복강관" }, + { val: "MOP880", text: "폴리에틸렌관 1호관" }, + { val: "MOP881", text: "폴리에틸렌관 2호관" }, + { val: "MOP882", text: "폴리에틸렌관(2중벽)" }, + { val: "MOP883", text: "폴리에틸렌관(3중벽)" }, + { val: "MOP884", text: "폴리에틸렌분체라이닝" }, + { val: "MOP885", text: "폴리에틸렌이중벽하수관" }, + { val: "MOP886", text: "폴리탄산에스테르" }, + { val: "MOP887", text: "프리스트레스트콘크리트실린더관" }, + { val: "MOP888", text: "플라스틱" }, + { val: "MOP889", text: "플라스틱주름관" }, + { val: "MOP890", text: "하수도용고강성경질염화비닐이중벽주름관" }, + { val: "MOP891", text: "현장타설관" }, + { val: "MOP892", text: "현장타설철근콘크리트관" }, + { val: "MOP893", text: "흑관" }, + { val: "MOP894", text: "흙" }, + { val: "MOP895", text: "AP" }, + { val: "MOP896", text: "API관" }, + { val: "MOP897", text: "ASP" }, + { val: "MOP898", text: "CMCIP" }, + { val: "MOP899", text: "CSP" }, + { val: "MOP900", text: "DRP" }, + { val: "MOP901", text: "DSP" }, + { val: "MOP902", text: "DTC관" }, + { val: "MOP903", text: "ELP" }, + { val: "MOP904", text: "EPP" }, + { val: "MOP905", text: "FC관" }, + { val: "MOP906", text: "H" }, + { val: "MOP907", text: "H6" }, + { val: "MOP908", text: "HCP" }, + { val: "MOP909", text: "HI_2P관" }, + { val: "MOP910", text: "HI-KP" }, + { val: "MOP911", text: "HL" }, + { val: "MOP912", text: "IP" }, + { val: "MOP913", text: "KCGP" }, + { val: "MOP914", text: "KP관" }, + { val: "MOP915", text: "P2S관" }, + { val: "MOP916", text: "PC박스(PCB)" }, + { val: "MOP917", text: "PCS" }, + { val: "MOP918", text: "PDP" }, + { val: "MOP919", text: "PE이중벽관" }, + { val: "MOP920", text: "PE적측벽1종관" }, + { val: "MOP921", text: "PFP관" }, + { val: "MOP922", text: "PG관" }, + { val: "MOP923", text: "PIP관(이중보온관)" }, + { val: "MOP924", text: "PLCSP" }, + { val: "MOP925", text: "PS" }, + { val: "MOP926", text: "PUB" }, + { val: "MOP927", text: "PVB" }, + { val: "MOP928", text: "PVC이중벽관(PVC2)" }, + { val: "MOP929", text: "PVC-DC" }, + { val: "MOP930", text: "PVC-DV" }, + { val: "MOP931", text: "SBK" }, + { val: "MOP932", text: "SCP" }, + { val: "MOP933", text: "SEB" }, + { val: "MOP934", text: "SIS관(이중보온관)" }, + { val: "MOP935", text: "SMC" }, + { val: "MOP936", text: "STW" }, + { val: "MOP937", text: "SUS" }, + { val: "MOP938", text: "THP나선관" }, + { val: "MOP939", text: "U관" }, + { val: "MOP940", text: "VG2" }, + { val: "MOP941", text: "WSP(와사피)" }, + { val: "MOP942", text: "Steel Grating" }, + { val: "MOP943", text: "모래" }, + { val: "MOP944", text: "인조석" }, + { val: "MOP945", text: "SPOL" }, + { val: "MOP946", text: "PCF관(강판보강 PE 나선형관)" }, + { val: "MOP947", text: "PVC3(PVC3중벽관)" }, + { val: "MOP948", text: "PE다중벽관" }, + { val: "MOP977", text: "전주용입상관" }, + { val: "MOP978", text: "MD관" }, + { val: "그 외", text: "미분류" }, +]; // 하수처리시설 export const SwtrmtFcltCol = [ @@ -306,7 +513,6 @@ export const ExclnSewagePumpCol2 = [ { id: 'exclnWpmpAblt', title: '우수양수능력(m²/d)' }, // { id: 'instMngNo', title: '기관관리번호' }, ] - // 오수펌프장 export const DrtwSewagePumpCol1 = [ // { id: 'fid', title: 'FID' }, @@ -348,6 +554,17 @@ export const DrtwSewagePumpCol2 = [ { id: 'exclnWpmpAblt', title: '오수양수능력(m²/d)' }, // { id: 'instMngNo', title: '기관관리번호' }, ] +// 펌프장 용도 코드표 +export const DRTW_SEWAGE_PUMP_USE_CODES = [ + { val: "SBE000", text: "미분류" }, + { val: "SBE001", text: "빗물펌프장" }, + { val: "SBE002", text: "오수펌프장" }, + { val: "SBE003", text: "처리장내펌프장" }, + { val: "SBE900", text: "오수배제" }, + { val: "SBE901", text: "우수배제" }, + { val: "SBE999", text: "기타" }, + { val: "그 외", text: "미분류" }, +]; // 우수토실 export const stofcbrCol = [ diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx index 26b3a60aa..38b0c25d6 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/MsSwagePpl.tsx @@ -1,18 +1,18 @@ 'use client' import { VerticalTable } from '@/components/ui/verticalTable'; -import React, { useState } from 'react' +import React, { useState, useEffect } from 'react' import InputSection from '../InputSection'; import { handleInputChange } from '../common'; // 하수관로 const inputColumn = [ - { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, - { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, + { id: "instlMbdyCd", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, + { id: "swtrmtZoneCd", title: "처리구역", type: "input" }, + { id: "mltvZoneNm", title: "배수구역", type: "input" }, + { id: "mltvDtdvNm", title: "배수분구", type: "input" }, + { id: "lineCd", title: "지선/간선", type: "select", options: ["지선", "간선"] }, + { id: "floCd", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, + { id: "layCd", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { @@ -20,29 +20,48 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic { year: "2025", type: "개대체" }, { year: "2025", type: "보수" }, ]); - const [cleaningData, setCleaningData] = useState([ { year: "2025", type: "청소" }, { year: "2025", type: "준설" }, ]); - const [inspectionData, setInspectionData] = useState([ { year: "2025", type: "관로기술진단" }, { year: "2025", type: "관로기술진단" }, ]); - const dataMap = { repair: { data: repairData, setData: setRepairData }, cleaning: { data: cleaningData, setData: setCleaningData }, inspection: { data: inspectionData, setData: setInspectionData }, }; + const [formData, setFormData] = useState<any>({}); + + // featureData가 변경될 때 formData 초기화 + useEffect(() => { + if (featureData) { + setFormData(featureData); + } + }, [featureData]); + + // 폼 데이터가 변경될 때 호출될 핸들러 + const handleFormDataChange = (newFormData: any) => { + setFormData(newFormData); + }; + + // 저장 버튼 클릭 시 최신 formData를 부모에게 전달 + const handleSaveClick = () => { + if (onSaveClick) { + // 저장 전에 formData를 부모 컴포넌트의 handleSaveClick에 전달 + onSaveClick(); + } + }; + return ( <> <VerticalTable headName='자체 입력정보' - tableData={[]} + tableData={featureData ? [formData] : []} headlist={inputColumn} pageSize={20} total={0} @@ -53,7 +72,8 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic throw new Error("Function not implemented."); }} showSaveButton={true} - onSaveClick={onSaveClick} + onSaveClick={handleSaveClick} + onFormDataChange={handleFormDataChange} // 폼 데이터 변경 콜백 추가 /> <InputSection title="보수 및 갱신" diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 31aef5172..2c5a9beab 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -1,29 +1,32 @@ // 우수토실 import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; import { VerticalTable } from '@/components/ui/verticalTable'; import LoadingOverlay from '@/components/ui/LoadingBar'; const inputColumn = [ - { id: "place", title: "중점여부", type: "select", options: ["중점우수토실", "우수토실"] }, - { id: "guyeok", title: "처리구역", type: "input" }, + { id: "prrtymngYn", title: "중점여부", type: "select", options: ["중점우수토실", "우수토실"] }, + { id: "swtrmtZoneCd", title: "처리구역", type: "input" }, ]; -const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { +const Ssc = ({ featureData, isMainSsc, additionalData, onSaveClick }: { featureData: any, - chkMainSsc?: boolean, + isMainSsc?: boolean, additionalData?: any, onSaveClick?: () => void }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [isDataLoaded, setIsDataLoaded] = useState(false); + const [formData, setFormData] = useState<any>({}); console.log('featureData data received:', featureData); // 추가 데이터 확인용 console.log('Additional data received:', additionalData); // 추가 데이터 확인용 + const openModal = () => { setIsModalOpen(true); }; + const closeModal = () => { setIsModalOpen(false); if (!isDataLoaded) { @@ -31,11 +34,25 @@ const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { } }; - // 데이터 전처리: 합쳐진 필드 추가 - // const preprocessedData = featureData ? [{ - // ...featureData, - // flwmtr_combined: `${featureData.flwmtr_mesure_tp_etc || '-'} / ${featureData.flwmtr_knd || '-'}` - // }] : []; + // featureData가 변경될 때 formData 초기화 + useEffect(() => { + if (featureData) { + setFormData(featureData); + } + }, [featureData]); + + // 폼 데이터가 변경될 때 호출될 핸들러 + const handleFormDataChange = (newFormData: any) => { + setFormData(newFormData); + }; + + // 저장 버튼 클릭 시 최신 formData를 부모에게 전달 + const handleSaveClick = () => { + if (onSaveClick) { + // 저장 전에 formData를 부모 컴포넌트의 handleSaveClick에 전달 + onSaveClick(); + } + }; const renderModalBody = () => ( <div className='grid grid-cols-1 gap-4 p-4'> @@ -100,23 +117,26 @@ const Ssc = ({ featureData, chkMainSsc, additionalData, onSaveClick }: { return ( <div> - <VerticalTable - headName='자체 입력정보' - tableData={[]} - headlist={inputColumn} - pageSize={0} - total={0} - children={undefined} - cellClick={undefined} - isEditable={true} - onPageChange={function (page: number): void { - throw new Error('Function not implemented.'); - }} - showSaveButton={true} - onSaveClick={onSaveClick} - /> + {!isMainSsc && ( + <VerticalTable + headName='자체 입력정보' + tableData={featureData ? [formData] : []} + headlist={inputColumn} + pageSize={0} + total={0} + children={undefined} + cellClick={undefined} + isEditable={true} + onPageChange={function (page: number): void { + throw new Error('Function not implemented.'); + }} + showSaveButton={true} + onSaveClick={handleSaveClick} + onFormDataChange={handleFormDataChange} // 폼 데이터 변경 콜백 추가 + /> + )} - {chkMainSsc && ( + {isMainSsc && ( <div> <div className="card-header"> <h3 className="text-2xl mx-3 font-medium text-label">중점우수토실 운영정보</h3> diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index f0c4d21b3..0da4ab31e 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -1,22 +1,46 @@ import { VerticalTable } from '@/components/ui/verticalTable'; -import React from 'react' +import React, { useState, useEffect } from 'react' +// 빗물펌프 자체 입력 정보 const exclnInputColumn = [ - { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "freq", title: "설계빈도(년)", type: "input" }, + { id: "swtrmtZoneCd", title: "배수구역", type: "input" }, + { id: "mltvDtdvNm", title: "배수분구", type: "input" }, + { id: "dsgnFrqnc", title: "설계빈도(년)", type: "input" }, ] +// 오수펌프 자체 입력 정보 const drtwInputColumn = [ { id: "swtrmt_zone_cd", title: "배수구역", type: "input" }, { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, ] // 하수펌프장 -const sewagePump = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { +const sewagePump = ({ featureData, isDrtwSewagePump, onSaveClick }: { featureData: any, isDrtwSewagePump: boolean, onSaveClick?: () => void }) => { + const [formData, setFormData] = useState<any>({}); + + // featureData가 변경될 때 formData 초기화 + useEffect(() => { + if (featureData) { + setFormData(featureData); + } + }, [featureData]); + + // 폼 데이터가 변경될 때 호출될 핸들러 + const handleFormDataChange = (newFormData: any) => { + setFormData(newFormData); + }; + + // 저장 버튼 클릭 시 최신 formData를 부모에게 전달 + const handleSaveClick = () => { + if (onSaveClick) { + // 저장 전에 formData를 부모 컴포넌트의 handleSaveClick에 전달 + onSaveClick(); + } + }; + return ( <VerticalTable headName='자체 입력정보' - tableData={[]} - headlist={exclnInputColumn} + tableData={featureData ? [formData] : []} + headlist={isDrtwSewagePump ? drtwInputColumn : exclnInputColumn} pageSize={0} total={0} children={undefined} @@ -26,7 +50,8 @@ const sewagePump = ({ featureData, onSaveClick }: { featureData: any, onSaveClic throw new Error('Function not implemented.'); }} showSaveButton={true} - onSaveClick={onSaveClick} + onSaveClick={handleSaveClick} + onFormDataChange={handleFormDataChange} // 폼 데이터 변경 콜백 추가 /> ) } diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx index 7f2251063..e2a2cc747 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/smh.tsx @@ -1,17 +1,39 @@ // 하수맨홀 import { VerticalTable } from '@/components/ui/verticalTable'; -import React from 'react' +import React, { useState, useEffect } from 'react' const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "input" }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "bungu", title: "배수분구", type: "input" }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, + { id: "swtrmtZoneCd", title: "처리구역", type: "input" }, + { id: "mltvZoneNm", title: "배수구역", type: "input" }, + { id: "mltvDtdvNm", title: "배수분구", type: "input" }, + { id: "layCd", title: "매설위치", type: "select", options: ["도로", "하상"] }, ]; const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () => void }) => { + const [formData, setFormData] = useState<any>({}); + + // featureData가 변경될 때 formData 초기화 + useEffect(() => { + if (featureData) { + setFormData(featureData); + } + }, [featureData]); + + // 폼 데이터가 변경될 때 호출될 핸들러 + const handleFormDataChange = (newFormData: any) => { + setFormData(newFormData); + }; + + // 저장 버튼 클릭 시 최신 formData를 부모에게 전달 + const handleSaveClick = () => { + if (onSaveClick) { + // 저장 전에 formData를 부모 컴포넌트의 handleSaveClick에 전달 + onSaveClick(); + } + }; + return ( <VerticalTable headName='자체 입력정보' - tableData={[]} + tableData={featureData ? [formData] : []} headlist={inputColumn} pageSize={20} total={0} @@ -22,7 +44,8 @@ const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: () throw new Error("Function not implemented."); }} showSaveButton={true} - onSaveClick={onSaveClick} + onSaveClick={handleSaveClick} + onFormDataChange={handleFormDataChange} // 폼 데이터 변경 콜백 추가 /> ) } diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 72831902f..95cab06c7 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -1,15 +1,16 @@ 'use client' -import { getData, putData } from "@/components/lib/api"; +import { getData, postData } from "@/components/lib/api"; import Modal from "@/components/ui/modal"; import { VerticalTable } from "@/components/ui/verticalTable"; import { useGisContext } from "@common/business_components/ui/map/Gis"; import { Button } from "@common/components/ui"; import { useEffect, useRef, useState, useCallback, useMemo } from "react"; import { getLayerContentComponent } from "./components/common"; -import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, ExclnSewagePumpCol, MsSwageMhlCol, stofcbrCol, MS_SWAGE_MHL_CODES } from "./components/common/table"; +import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, MsSwagePplCol, ExclnSewagePumpCol, MsSwageMhlCol, stofcbrCol, MS_SWAGE_MHL_CODES, DRTW_SEWAGE_PUMP_USE_CODES } from "./components/common/table"; import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore"; +import { set } from "react-hook-form"; // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { @@ -23,7 +24,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const [fetchData, setfetchData] = useState<any>(); // api 호출여부 const contentRef = useRef<HTMLDivElement>(null); const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태 - const [chkMainSsc, setChkMainSsc] = useState(false); // 중점우수토실 여부 + const [isMainSsc, setIsMainSsc] = useState(false); // 중점우수토실 여부 + const [isDrtwSewagePump, setIsDrtwSewagePump] = useState(false); // 오수펌프장 여부 const [isLoading, setIsLoading] = useState(false); // 🎯 추가 데이터 로딩 상태 분리 const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); @@ -54,17 +56,10 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, try { console.log(`추가 데이터 API 호출 시작: v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - // 🎯 타임아웃 설정 (10초) - const timeoutPromise = new Promise((_, reject) => - setTimeout(() => reject(new Error('API 타임아웃')), 10000) - ); + const result = getData(`v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - const apiPromise = getData(`v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - - const response = await Promise.race([apiPromise, timeoutPromise]) as any; - - console.log('추가 데이터 API 호출 성공:', response); - return response?.content || []; + console.log('추가 데이터 API 호출 성공:', result); + return result || []; } catch (error) { console.error('추가 데이터 로딩 실패:', error); setAdditionalDataError(error instanceof Error ? error.message : '알 수 없는 오류'); @@ -106,7 +101,16 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, else if (featureData.lyrTypeNm === 'tb_ms_stofcbr') result = '우수토실'; else if (featureData.lyrTypeNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (featureData.lyrTypeNm === 'tb_ms_swage_ppl') result = '하수관로'; - else if (featureData.lyrTypeNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; + else if (featureData.lyrTypeNm === 'tb_ms_swage_pmstn') { + const drtwPumpCode = DRTW_SEWAGE_PUMP_USE_CODES.find(code => code.text === '오수펌프장'); + console.log('값 비교', featureData.values_.usg_cd.trim(), drtwPumpCode?.val); + if (drtwPumpCode && featureData.values_.usg_cd.trim() === drtwPumpCode.val) { + setIsDrtwSewagePump(true); + } else { + setIsDrtwSewagePump(false); + } + result = '하수펌프장'; + } else if (featureData.lyrTypeNm === 'tb_ms_swage_mhl') result = '하수맨홀'; } else { @@ -116,7 +120,16 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, else if (lyrTyNm === 'tb_ms_stofcbr') result = '우수토실'; else if (lyrTyNm === 'om_dt_untrt_swg_rain') result = '중점우수토실'; else if (lyrTyNm === 'tb_ms_swage_ppl') result = '하수관로'; - else if (lyrTyNm === 'tb_ms_swage_pmstn') result = '하수펌프장'; + else if (lyrTyNm === 'tb_ms_swage_pmstn') { + const drtwPumpCode = DRTW_SEWAGE_PUMP_USE_CODES.find(code => code.text === '오수펌프장'); + console.log('값 비교', featureData.values_.usg_cd.trim(), drtwPumpCode?.val); + if (drtwPumpCode && featureData.values_.usg_cd.trim() === drtwPumpCode.val) { + setIsDrtwSewagePump(true); + } else { + setIsDrtwSewagePump(false); + } + result = '하수펌프장'; + } else if (lyrTyNm === 'tb_ms_swage_mhl') result = '하수맨홀'; else result = featureLayer.get('lyrNm'); } @@ -170,7 +183,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setHeadlist(untrtSwgRainCol1) setHeadlist2(untrtSwgRainCol2) setButtonChk(false) - setChkMainSsc(true) + setIsMainSsc(true) setfetchData([processedData]) setTableData(processedData); @@ -188,11 +201,11 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setMntrngsData(false); }); } - return; + break; case '우수토실': setHeadlist(stofcbrCol) - setButtonChk(false) - setChkMainSsc(false) + setButtonChk(true) + setIsMainSsc(false) break; case '하수관로': setHeadlist(MsSwagePplCol) @@ -215,6 +228,59 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, default: break; } + + // API 엔드포인트 선택 + let apiEndpoint = ''; + let getFeatureId = featureId.toString().split('.').pop() || null; + if (selectedLayerName === '하수관로') apiEndpoint = `v1/fcltppl/${getFeatureId}`; + else if (selectedLayerName === '우수토실') apiEndpoint = `v1/fcltstofcbr/${getFeatureId}`; + else if (selectedLayerName === '오수펌프' || selectedLayerName === '빗물펌프') apiEndpoint = `v1/fcltpump/${getFeatureId}`; + else if (selectedLayerName === '하수맨홀') apiEndpoint = `v1/fcltmhl/${getFeatureId}`; + + // API에서 상세 데이터 가져오기 + if (apiEndpoint) { + try { + console.log(`API 호출: ${apiEndpoint}`); + const result = await getData(apiEndpoint); + + if (result) { + console.log('API 데이터 로드 성공:', result); + + // 하수맨홀인 경우 용도코드를 텍스트로 변환 + if (selectedLayerName === '하수맨홀') { + const processedData = { ...result }; + + // mqlt_cd 값 변환 (재질코드) + if (processedData.mqlt_cd) { + const materialCodeItem = MS_SWAGE_MHL_CODES.find( + code => code.val === processedData.mqlt_cd.trim() + ); + if (materialCodeItem) { + processedData.mqlt_cd = `${materialCodeItem.text}`; + } + } + + setfetchData(processedData); + } // 🎯 우수토실인 경우 prrtymngYn 값 변환 + else if (selectedLayerName === '우수토실' && data) { + const processedData = { ...result, ...data }; + + // prrtymngYn 값 변환 + if (processedData.prrtymngYn === 'Y') processedData.prrtymngYn = '중점우수토실'; + else if (processedData.prrtymngYn === 'N') processedData.prrtymngYn = '우수토실'; + + console.log('processedData', processedData); + + setfetchData(processedData); + } else { + setfetchData(result); + } + } + } catch (apiError) { + console.error('API 데이터 로딩 중 오류:', apiError); + } + } + console.log('mntrngsData', mntrngsData); } catch (error) { console.error('데이터 로딩 중 오류:', error); } @@ -275,27 +341,50 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, bodyData[camelCaseId] = select.value; }); - // input 태그의 값 가져오기 + // // input 태그의 값 가져오기 inputElements.forEach((input) => { const camelCaseId = toCamelCase(input.id); bodyData[camelCaseId] = input.value; }); - if (layerNm === '하수관로') bodyData['lyrTypeNm'] = 'tb_ms_swage_ppl' - else if (layerNm === '우수토실') bodyData['lyrTypeNm'] = 'tb_ms_stofcbr' - else if (layerNm === '중점우수토실') bodyData['lyrTypeNm'] = 'om_dt_untrt_swg_rain' - else if (layerNm === '오수펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' - else if (layerNm === '빗물펌프') bodyData['lyrTypeNm'] = 'tb_ms_swage_pmstn' - else if (layerNm === '하수맨홀') bodyData['lyrTypeNm'] = 'tb_ms_swage_mnhl' + // 레이어명에 따라 API 엔드포인트 분기처리 + let apiEndpoint = ''; + let result = null; - bodyData['fid'] = featureId + if (layerNm === '하수관로') apiEndpoint = 'v1/fcltppl'; + else if (layerNm === '우수토실') apiEndpoint = 'v1/fcltstofcbr'; + else if (layerNm === '하수펌프장') apiEndpoint = 'v1/fcltpump'; + else if (layerNm === '하수맨홀') apiEndpoint = 'v1/fcltmhl'; - const data = await putData(`v1/fclts/${featureId}`, bodyData); + bodyData['fid'] = featureId.toString().split('.').pop() || null; + // 빈 키 제거 + if (bodyData[""] !== undefined) delete bodyData[""]; - if (data.status == 200) { - alert('저장되었습니다') - setTableData(data) - setfetchData(data) + // 🎯 우수토실일 경우 prrtymngYn 값 변환 + if (layerNm === '우수토실' && bodyData.prrtymngYn) { + if (bodyData.prrtymngYn === '중점우수토실') { + bodyData.prrtymngYn = 'Y'; + } else if (bodyData.prrtymngYn === '우수토실') { + bodyData.prrtymngYn = 'N'; + } + } + console.log('bodyData', bodyData); + console.log('apiEndpoint', apiEndpoint); + + try { + result = await postData(apiEndpoint, bodyData); + console.log('result', result); + + if (result) { + alert('저장되었습니다'); + setfetchData(result.data || result); + } else { + alert('저장에 실패했습니다'); + console.error('API 응답 오류:', result); + } + } catch (error) { + alert('저장 중 오류가 발생했습니다'); + console.error('API 요청 오류:', error); } } } @@ -363,7 +452,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, {ContentComponent && <ContentComponent featureData={fetchData} - chkMainSsc={chkMainSsc} + isMainSsc={isMainSsc} + isDrtwSewagePump={isDrtwSewagePump} additionalData={mntrngsData} onSaveClick={handleSaveClick} /> diff --git a/apps/sn/app/components/lib/api/index.ts b/apps/sn/app/components/lib/api/index.ts index e4a750ff3..55d111074 100644 --- a/apps/sn/app/components/lib/api/index.ts +++ b/apps/sn/app/components/lib/api/index.ts @@ -9,6 +9,8 @@ export const postData = async (url: string, data: object): Promise<any> => { body: JSON.stringify(data), }; const res = await fetch(`${BASE_URL}/${url}`, options); + console.log('res', res); + console.log('res.status', res.status); if (res.ok) { const resData = await res.json(); return resData; diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 19e302c30..2f8143409 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -29,6 +29,7 @@ type UiTableProps = { showSecondTable?: boolean; showSaveButton?: boolean; onSaveClick?: () => void; + onFormDataChange?: (formData: { [key: string]: string | number | boolean }) => void; // 추가 }; type UiHeadProps = { @@ -66,6 +67,7 @@ export function VerticalTable({ showSecondTable = false, showSaveButton = false, onSaveClick, + onFormDataChange, }: UiTableProps) { const [cur, setCur] = useState<number>(1); const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({}); @@ -78,17 +80,27 @@ export function VerticalTable({ useEffect(() => { if (tableData.length > 0 && tableData[0]) { - setFormData(tableData[0] as { [key: string]: string | number | boolean }); + // 깊은 복사를 통해 새로운 객체 생성 + const newData = JSON.parse(JSON.stringify(tableData[0])); + setFormData(newData); + console.log("Form data initialized:", newData); // 디버깅용 } }, [tableData]); const handleInputChange = (id: string, value: string | number | boolean) => { - setFormData((prev) => ({ - ...prev, + console.log(`Input change: ${id} = ${value}`); // 디버깅용 + const newFormData = { + ...formData, [id]: value, - })); - }; + }; + console.log("New form data:", newFormData); // 디버깅용 + setFormData(newFormData); + // 폼 데이터가 변경될 때마다 부모에게 알림 + if (onFormDataChange) { + onFormDataChange(newFormData); + } + }; const handlePageChange = (page: number) => { setCur(page); onPageChange(page); @@ -100,8 +112,8 @@ export function VerticalTable({ <div className="card-header flex items-center justify-between"> <h3 className="text-2xl mx-3 font-medium text-label">{headName}</h3> {showSaveButton && onSaveClick && ( - <Button - onClick={onSaveClick} + <Button + onClick={onSaveClick} className="px-4 mr-3 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" > 저장 @@ -174,7 +186,7 @@ export function VerticalTable({ head.type === "select" ? ( <select id={head.id} - value={String(formData[head.id]) ?? "-"} + value={formData[head.id] !== undefined ? String(formData[head.id]) : ""} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0" > @@ -188,7 +200,7 @@ export function VerticalTable({ <input id={head.id} type="text" - value={String(formData[head.id]) ?? ""} + value={formData[head.id] !== undefined ? String(formData[head.id]) : ""} onChange={(e) => handleInputChange(head.id, e.target.value)} className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1" /> From 9050895b0f714a2bf462e3d8c472345d42870a1c Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Thu, 10 Jul 2025 21:13:50 +0900 Subject: [PATCH 246/259] =?UTF-8?q?searchModal=20=EC=9E=AC=EC=98=A4?= =?UTF-8?q?=ED=94=88=EC=8B=9C=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index e14b7cb8b..fafb4bcf4 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -207,7 +207,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ setTableCount(0); setTableData([]); // queryParams는 fetchFilteredData 내에서 매번 새로 생성되므로 별도 상태 초기화는 필요 없음 - }, [activeTab, basicType]); + }, [activeTab, basicType, open]); // 페이지 변경 시마다 데이터 fetch useEffect(() => { From cb3705d616942bca674757d46209b995ad1070dd Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Fri, 11 Jul 2025 09:12:47 +0900 Subject: [PATCH 247/259] =?UTF-8?q?=EA=B2=80=EC=83=89=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 46 ++++++++++---------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index fafb4bcf4..d36ac6d18 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -63,12 +63,6 @@ const reportTableHeadlist = [ { id: "regDate", title: "등록일자" }, ]; -const 처리구역List = [ - { val: "0", text: "선택" }, - { val: "a", text: "A" }, - { val: "b", text: "B" }, -]; - // 날짜 조합 함수 const getDateString = ( year: string, @@ -103,7 +97,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ const [basicType, setBasicType] = useState(BASIC_TYPES[0]?.val ?? ""); const [ctpvCd, setCtpvCd] = useState('0'); const [sigungu, setSigungu] = useState('0'); - const [swageProcessingZone, set처리구역] = useState(""); + //const [swageProcessingZone, set처리구역] = useState(""); + const [gubun, setGubun] = useState(""); // 하수정비기본계획 report // 날짜 상태 선언 const [시작1, set시작1] = useState(""); const [시작2, set시작2] = useState(""); @@ -197,7 +192,6 @@ const SearchModal: React.FC<SearchModalProps> = ({ set가동개시_종료_일(""); setCtpvCd('0'); setSigungu('0'); - set처리구역(""); setYearFilter({ 시작: "", 종료: "", @@ -256,11 +250,26 @@ const SearchModal: React.FC<SearchModalProps> = ({ } if (sigungu !== "0") { const sigunguOption = filteredSiguns.find((n) => n.val === sigungu); - filterReportData = filterReportData.filter(item => item.sido === sigunguOption?.text); + filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text); } - console.log('report count:', reportData.length); - setTableData(filterReportData || []); + if (yearFilter.시작 != "" && yearFilter.종료 == "") + filterReportData = filterReportData.filter(item => (item.approvalYear)? item.approvalYear >= yearFilter.시작+"년" : null); + if (yearFilter.시작 == "" && yearFilter.종료 != "") + filterReportData = filterReportData.filter(item => (item.approvalYear)? item.approvalYear <= yearFilter.종료+"년" : null); + if (yearFilter.시작 != "" && yearFilter.종료 != "") { + filterReportData = filterReportData.filter(item => { + return (item.approvalYear)? item.approvalYear >= yearFilter.시작+"년" && item.approvalYear <= yearFilter.종료+"년": null; + }); + } + if (gubun !== "") { + filterReportData = filterReportData.filter(item => (item.plantZoneGugun)? String(item.plantZoneGugun).includes(String(gubun)) : null); + } + console.log('report count:', filterReportData.length); setTableCount(filterReportData.length || 0); + filterReportData = filterReportData.slice((curPage-1)*10, curPage*10); // paging + filterReportData = filterReportData?.map((item, index)=>({...item, no:(curPage-1)*10+index+1})); + setTableData(filterReportData || []); + } else { console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); @@ -1051,22 +1060,15 @@ const SearchModal: React.FC<SearchModalProps> = ({ </div> <div className="flex justify-between items-center mb-6"> <div className="flex items-center gap-4"> - <SelectBox2 - className="w-auto mr-2" - selectClass="rounded-lg bg-white text-xl" - label="하수처리구역" - selectArray={처리구역List.map(opt => ({ val: opt.val, text: opt.text }))} - onSelectValue={val => set처리구역(String(val))} - value={swageProcessingZone} - /> + <label className="inline-block w-auto whitespace-nowrap text-xl text-gray-600 mr-2">구분</label> <Input className='!text-xl w-[100px] placeholder:text-center mr-8' placeholder="입력" - value={변수1} + value={gubun} onChange={(e) => { // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ''); - set변수1(val); + const val = e.target.value; + setGubun(val); }} /> <YearRangeSelectBox From 3ce6a6295bbc255c8238acd5e4ae9cb13cd908ab Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Fri, 11 Jul 2025 09:51:38 +0900 Subject: [PATCH 248/259] =?UTF-8?q?ADDR=5FURL=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.production | 1 + apps/sn/app/(map-layout)/map/SearchModal.tsx | 6 +++--- .../map/components/searchModalReportApi.ts | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/sn/.env.production b/apps/sn/.env.production index fab02e36c..f0f27d674 100644 --- a/apps/sn/.env.production +++ b/apps/sn/.env.production @@ -1,6 +1,7 @@ NEXT_PUBLIC_SITE_ID = SN NEXT_PUBLIC_PORT = 11302 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 +NEXT_PUBLIC_ADDR_URL = http://con.mind-one.co.kr:11082 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 6f706ab2d..35c5a445a 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -11,7 +11,7 @@ import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; //import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; -import { getDcTree,flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; +import { getDcTree,useDcTree,flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; import { useCityCdStore, type SelectDataType } from './commonStore'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -128,9 +128,9 @@ const SearchModal: React.FC<SearchModalProps> = ({ // 상세 정보 조회를 위한 상태 추가 const [popupFeature, setPopupFeature] = useState<any>(null); - //const { cityCd: ctpvCd, setCityCd:setCtpvCd, sidos, setSidos, siguns, setSiguns } = useCityCdStore(); const sidos = useCityCd(); const siguns = useSggCd(); + const reportOriginData = useDcTree(""); // 오늘 날짜 구하기 const today = new Date(); @@ -256,7 +256,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (cqlFilters.length > 0) queryParams.append('cqlFiter', cqlFilters.join(' and ')); if (activeTab === 'report') { - const reportOriginData = await getDcTree('경기도'); + //const reportOriginData = await getDcTree('경기도'); const reportData = flattenFolders(reportOriginData); let filterReportData = reportData; if (ctpvCd !== "0") { diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index 6d1494aab..e4af3a127 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -164,5 +164,18 @@ export const useDcTree = (clsfSystmNm:string) => { return data; }; - - +export const getDcFile = async (clsfSystmSn:string) => { + const queryString = 'clsfSystmNm='+clsfSystmSn; + console.log("getDcTree queryString:", queryString); + const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`); + return result; +}; +export const addDcFileName = async(data: any) => { + const updated = await Promise.all( + data.map(async (item) => { + const fileName = await getDcFile(item.systmSn); + return { ...item, fileName }; + }) + ); + return updated; +} From 7c74fe346fd639ff2d44b50cfe82ba64fbc60fef Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Fri, 11 Jul 2025 09:53:07 +0900 Subject: [PATCH 249/259] =?UTF-8?q?RSONE=5FDC=5FURL=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.production | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sn/.env.production b/apps/sn/.env.production index f0f27d674..9300c5ae3 100644 --- a/apps/sn/.env.production +++ b/apps/sn/.env.production @@ -5,6 +5,7 @@ NEXT_PUBLIC_ADDR_URL = http://con.mind-one.co.kr:11082 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com #자료관 데이터 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token From 89e6d0e2360840d65152e7bfe6835db547c36be6 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Fri, 11 Jul 2025 12:03:13 +0900 Subject: [PATCH 250/259] =?UTF-8?q?middleware=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 22 +++++++++++-------- .../map/components/searchModalReportApi.ts | 4 ++-- apps/sn/middleware.ts | 7 ++++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 35c5a445a..82e1485fc 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -11,7 +11,7 @@ import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; //import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; -import { getDcTree,useDcTree,flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; +import { getDcTree,useDcTree,flattenFolders, useSggCd, useCityCd,getDcFile } from './components/searchModalReportApi'; import { useCityCdStore, type SelectDataType } from './commonStore'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -180,14 +180,17 @@ const SearchModal: React.FC<SearchModalProps> = ({ } }; - const handleCtpvCdChange = (val: string|number) => { + const handleCtpvCdChange = (val: string|number) => { // 하수도정비기본계획.시도 const sidoOption = sidos.find((n) => n.val === val); setCtpvCd(String(val)); - if (val !== '0' && sidoOption) { - const filterSiguns = siguns.filter(item => item.sido === sidoOption.text); + if (val !== '0') { + const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text); filterSiguns.unshift({ val: '0', text: '전체', sido: '0' }); setFilteredSiguns(filterSiguns); } + setSigungu("0"); + setGubun(""); + setYearFilter({시작: "",종료: "",}); } useEffect(() => { @@ -259,15 +262,15 @@ const SearchModal: React.FC<SearchModalProps> = ({ //const reportOriginData = await getDcTree('경기도'); const reportData = flattenFolders(reportOriginData); let filterReportData = reportData; - if (ctpvCd !== "0") { + if (ctpvCd !== "0") { // 시도검색 const sidoOption = sidos.find((n) => n.val === ctpvCd); filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text); } - if (sigungu !== "0") { + if (sigungu !== "0") { // 시군구검색 const sigunguOption = filteredSiguns.find((n) => n.val === sigungu); filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text); } - if (yearFilter.시작 != "" && yearFilter.종료 == "") + if (yearFilter.시작 != "" && yearFilter.종료 == "") //승인년도검색 filterReportData = filterReportData.filter(item => (item.approvalYear)? item.approvalYear >= yearFilter.시작+"년" : null); if (yearFilter.시작 == "" && yearFilter.종료 != "") filterReportData = filterReportData.filter(item => (item.approvalYear)? item.approvalYear <= yearFilter.종료+"년" : null); @@ -276,7 +279,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ return (item.approvalYear)? item.approvalYear >= yearFilter.시작+"년" && item.approvalYear <= yearFilter.종료+"년": null; }); } - if (gubun !== "") { + if (gubun !== "") { // 구분검색 filterReportData = filterReportData.filter(item => (item.plantZoneGugun)? String(item.plantZoneGugun).includes(String(gubun)) : null); } console.log('report count:', filterReportData.length); @@ -284,7 +287,8 @@ const SearchModal: React.FC<SearchModalProps> = ({ filterReportData = filterReportData.slice((curPage-1)*10, curPage*10); // paging filterReportData = filterReportData?.map((item, index)=>({...item, no:(curPage-1)*10+index+1})); setTableData(filterReportData || []); - + const fileList = await getDcFile("CLS20250530000041"); + console.log(fileList); } else { console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index e4af3a127..93c0b6b13 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -71,8 +71,8 @@ export const useSggCd = () => { } }; fetch(); + console.log("useSggCd호출"); }, []); - return data; }; export const useCityCd = () => { @@ -86,8 +86,8 @@ export const useCityCd = () => { } }; fetch(); + console.log("useCityCd호출"); }, []); - return data; }; diff --git a/apps/sn/middleware.ts b/apps/sn/middleware.ts index d69ef5513..8fe638ebe 100644 --- a/apps/sn/middleware.ts +++ b/apps/sn/middleware.ts @@ -102,8 +102,11 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/dc-service")) { const requestHeaders = new Headers(req.headers); - const newUrl = `${RSONE_DC_URL}${pathname}`; - + const decodedParams = Array.from(searchParams.entries()) + .map(([key, value]) => `${key}=${decodeURIComponent(value)}`) + .join("&"); + + const newUrl = `${RSONE_DC_URL}${pathname}${decodedParams ? `?${decodedParams}` : ""}`; console.log( `[Middleware] Rewriting from '/dc-service' path to: ${newUrl}`, ); From 71ec5588ef704fc76e1432c4f324017533967f76 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Fri, 11 Jul 2025 17:02:05 +0900 Subject: [PATCH 251/259] =?UTF-8?q?=EC=A4=91=EB=B3=B5=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/popupComponent/MsSwagePpl.tsx | 87 ----------- .../components/popupComponent/SwtrmtFclt.tsx | 49 ------ .../popupComponent/chart/infilChart.tsx | 140 ------------------ .../components/popupComponent/sewagePump.tsx | 18 --- .../app/map/components/popupComponent/smh.tsx | 21 --- .../popupComponent/stormWaterPump.tsx | 19 --- 6 files changed, 334 deletions(-) delete mode 100644 apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx delete mode 100644 apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx delete mode 100644 apps/sn/app/map/components/popupComponent/chart/infilChart.tsx delete mode 100644 apps/sn/app/map/components/popupComponent/sewagePump.tsx delete mode 100644 apps/sn/app/map/components/popupComponent/smh.tsx delete mode 100644 apps/sn/app/map/components/popupComponent/stormWaterPump.tsx diff --git a/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx b/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx deleted file mode 100644 index 1fc0cef80..000000000 --- a/apps/sn/app/map/components/popupComponent/MsSwagePpl.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { VerticalTable } from '../../../components/ui/verticalTable'; -import React, { useState } from 'react' -import InputSection from '../InputSection'; -import { handleInputChange } from '../common'; -import { Button } from '@common/components/ui'; -import InfilChart from './chart/infilChart'; -// 하수관로 -// TODO: RDII 버튼인가 그거 팝업 두개 구현 필요 -const inputColumn = [ - { id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] }, - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] }, - { id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, -]; -const SwtrmtFclt = ({ featureData }: { featureData: any }) => { - console.log("featureData", featureData); - const [isModalOpen, setIsModalOpen] = React.useState(false); - const [btnTxt, setBtnTxt] = useState<string>(""); - const openModal = (e: React.MouseEvent<HTMLButtonElement>) => { - e.currentTarget.textContent && setBtnTxt(e.currentTarget.textContent) - setIsModalOpen(true); - }; - const closeModal = () => { - setIsModalOpen(false); - }; - const [repairData, setRepairData] = useState([ - { year: "2025", type: "개대체" }, - { year: "2025", type: "보수" }, - ]); - const [cleaningData, setCleaningData] = useState([ - { year: "2025", type: "청소" }, - { year: "2025", type: "준설" }, - ]); - const [inspectionData, setInspectionData] = useState([ - { year: "2025", type: "관로기술진단" }, - { year: "2025", type: "관로기술진단" }, - ]); - const dataMap = { - repair: { data: repairData, setData: setRepairData }, - cleaning: { data: cleaningData, setData: setCleaningData }, - inspection: { data: inspectionData, setData: setInspectionData }, - }; - const keysToExtract = [ - "swtrmt_zone_cd", - "mltv_dtdv_nm", - "fid", - "lyrTypeNm", - "reg_dt", - "mdfcn_dt", - "rgtr", - "mdfr", - ]; - // const filteredData = Object.entries(featureData) - // .filter(([key]) => keysToExtract.includes(key)) // 필요한 키만 필터링 - // .map(([key, value]) => ({ key, value: value ?? "N/A" })); // 테이블 데이터 형식으로 변환 - - return ( - <div> - <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}></VerticalTable> - <InputSection title="보수 및 갱신" data={repairData} sectionKey="repair" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - <InputSection title="청소 및 준설" data={cleaningData} sectionKey="cleaning" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - <InputSection title="점검 및 진단" data={inspectionData} sectionKey="inspection" onInputChange={(section, index, field, value) => handleInputChange(section, index, field, value, dataMap)} /> - <div className="absolute bottom-0 left-0 w-full flex justify-start space-x-2 p-4"> - <Button - className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700" - onClick={openModal} - > - Infil - </Button> - <Button - className="px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700" - onClick={openModal} - > - RDII - </Button> - </div> - <InfilChart btnTxt={btnTxt} isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal} /> - </div> - ) -} - -export default SwtrmtFclt \ No newline at end of file diff --git a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx b/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx deleted file mode 100644 index 0d1c3ef2e..000000000 --- a/apps/sn/app/map/components/popupComponent/SwtrmtFclt.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import Modal from '../../../components/ui/modal'; -import { VerticalTable } from '../../../components/ui/verticalTable'; -import { UiTable } from '@common/business_components/ui'; -import { Button, TableCell } from '@common/components/ui'; -import React, { useState } from 'react' - -// 하수처리시설 -const headList = [ - { id: "title", title: "하수도정비 기본계획보고서" }, - { id: "cad", title: "하수도대장 평면도" },] -const modalHeadList = [ - { id: "no", title: "번호" }, - { id: "year", title: "승인연도" }, - { id: "cad", title: '평면도'}, - { id: "fileNm", title: "파일명" }, - { id: "date", title: "입력시간" }, -] - -const SwtrmtFclt = () => { - const [isModalOpen, setIsModalOpen] = useState(false); - const [modalTitle, setModalTitle] = useState<string>(''); - const openModal = (title:string) => { - setIsModalOpen(true); - setModalTitle(title) - }; - const closeModal = () => { - setIsModalOpen(false); - }; - return ( - <div> - <VerticalTable children={{ - title: <Button onClick={() => openModal('하수도정비 기본계획보고서')}>보고서</Button>, - cad: <Button onClick={() => openModal('하수도대장 평면도')}>평면도</Button>, - }} headName='디지털 자료관 연계정보' tableData={[]} headlist={headList} pageSize={20} total={0} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}></VerticalTable> - <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> - <div className='grid grid-col-2'> - <UiTable headName={modalTitle} tableData={[]} headlist={modalHeadList} pageSize={20} total={0} cellClick={undefined} children={undefined} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - } - }></UiTable> - </div> - </Modal> - </div> - ) -} - -export default SwtrmtFclt \ No newline at end of file diff --git a/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx b/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx deleted file mode 100644 index 06c5b5fec..000000000 --- a/apps/sn/app/map/components/popupComponent/chart/infilChart.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import React, { useState } from 'react' -import { type ChartConfig, MainChart, CHART_FORM } from "@common/business_components"; -import Modal from '../../../../components/ui/modal'; -import { Button } from '@common/components/ui'; -type ModalOpenProp = { - isModalOpen: boolean, - setIsModalOpen: (open: boolean) => void, - closeModal: () => void, - btnTxt?: string, -} -const InfilChart = ({ btnTxt, isModalOpen, setIsModalOpen, closeModal }: ModalOpenProp) => { - const [popupOpen, setPopupOpen] = React.useState(false); - const buttonRef = React.useRef<HTMLButtonElement>(null); // 버튼 참조 - const [popupPosition, setPopupPosition] = useState<{ top: number; left: number }>({ top: 0, left: 0 }); // 팝업 위치 - const openPopup = () => { - if (buttonRef.current) { - const rect = buttonRef.current.getBoundingClientRect(); // 버튼 위치 계산 - setPopupPosition({ - top: rect.bottom + window.scrollY, // 버튼 아래쪽 - left: rect.left + window.scrollX, // 버튼 왼쪽 - }); - } - setPopupOpen(true); // 팝업 열기 - }; - console.log("btnTxt", btnTxt); - const closePopup = () => {setPopupOpen(false);}; // 팝업 닫기 - const chartForm = CHART_FORM.LINE; - const chartData = { - chartData1: [ - { label: "1", val: 20 }, - { label: "3", val: 40 }, - { label: "5", val: 60 }, - ], - chartData2: [ - { label: "1", val: 15 }, - { label: "3", val: 35 }, - { label: "5", val: 55 }, - ], - } - const chartConfig = Object.values(chartData).flat().reduce((config, element) => { - config[element.label] = { - label: element.label, - color: "hsl(var(--chart-1))", - }; - return config; - }, {} as Record<string, { label: string; color: string }>) satisfies ChartConfig; - const getCurrentDate = () => { - const today = new Date(); - const year = today.getFullYear(); - const month = String(today.getMonth() + 1).padStart(2, "0"); // 월은 0부터 시작하므로 +1 - return `${year}-${month}`; - }; - return ( - <Modal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} closeModal={closeModal}> - {/* 분석 입력현황 조회 */} - <div className='grid grid-cols-4 gap-4'> - <div className="grid grid-rows-4 gap-4 mb-4"> - <Button className="bg-white text-white w-[130px] font-bold px-4 mt-2 py-2" onClick={openPopup}> - 분석 입력현황 조회 - </Button> - - {/* 침입수량 분석결과 */} - <div className="bg-white text-red-600 font-bold px-4 py-2 "> - 침입수량 분석결과 - <div className="flex items-center mt-2"> - <span className="text-black text-xl font-bold">120</span> - <span className="ml-2 text-black">m³/d</span> - </div> - </div> - </div> - {/* 차트 */} - <div className="w-[500px] h-[300px] bg-white p-4"> - <MainChart chartConfig={chartConfig} chartForm={chartForm} chartData={chartData} chartTitle={'관로유량'} /> - </div> - </div> - {popupOpen && ( - <div - className="absolute bg-gray-100 border border-gray-300 w-[320px] shadow-lg p-4 rounded" - style={{ - top: popupPosition.top, - left: popupPosition.left, - zIndex: 1000, - }} - > - <div className="text-lg font-bold mb-2">분석 입력현황</div> - <div className="grid grid-cols-2 gap-2"> - <div>상수사용량 정보:</div> - <div> - <input type='month' defaultValue={getCurrentDate()} className="border border-gray-300 rounded px-2 py-1"/> - </div> - <div>오수 전환율:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>0.85</option> - <option>0.90</option> - </select> - </div> - <div>수용가-맨홀 매칭:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>매칭(양평).shp</option> - <option>매칭(서울).shp</option> - </select> - </div> - <div>관망도 자료:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>양평.inp</option> - <option>서울.inp</option> - </select> - </div> - {btnTxt === 'RDII' ? <><div>강우 자료:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>R20240815.xlsx</option> - </select> - </div> - <div>RTX 계수 출처:</div> - <div> - <select className="border border-gray-300 rounded px-2 py-1"> - <option>2015년 하수도정비기본계획</option> - </select> - </div> - </> : null} - </div> - <div className="flex justify-end mt-4 space-x-2"> - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> - 저장 - </button> - <button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}> - 종료 - </button> - </div> - </div> - )} - </Modal> - ) -} - -export default InfilChart \ No newline at end of file diff --git a/apps/sn/app/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/map/components/popupComponent/sewagePump.tsx deleted file mode 100644 index 79103a40e..000000000 --- a/apps/sn/app/map/components/popupComponent/sewagePump.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { VerticalTable } from '../../../components/ui/verticalTable'; -import React from 'react' -const inputColumn = [ - { id: "swtrmt_zone_cd", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, - { id: "freq", title: "설계빈도", type: "input" }, -] -// 오수펌프 -const sewagePump = ({ featureData }: { featureData: any }) => { - return ( - <div><VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={0} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error('Function not implemented.'); - }} /> - </div> - ) -} - -export default sewagePump diff --git a/apps/sn/app/map/components/popupComponent/smh.tsx b/apps/sn/app/map/components/popupComponent/smh.tsx deleted file mode 100644 index 39920232b..000000000 --- a/apps/sn/app/map/components/popupComponent/smh.tsx +++ /dev/null @@ -1,21 +0,0 @@ -// 하수맨홀 -import { VerticalTable } from '../../../components/ui/verticalTable'; -import React from 'react' -const inputColumn = [ - { id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] }, - { id: "basu", title: "배수구역", type: "input" }, - { id: "bungu", title: "배수분구", type: "input" }, - { id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] }, - {id:'spec', title:'규격', type:'input'}, -]; -const Smh = () => { - return ( - <div> - <VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error("Function not implemented."); - }}></VerticalTable> - </div> - ) -} - -export default Smh; \ No newline at end of file diff --git a/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx b/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx deleted file mode 100644 index 172022f31..000000000 --- a/apps/sn/app/map/components/popupComponent/stormWaterPump.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { VerticalTable } from '../../../components/ui/verticalTable'; -import React from 'react' -const inputColumn = [ - { id: "swtrmt_zone_cd", title: "처리구역", type: "input" }, - { id: "mltv_dtdv_nm", title: "배수분구", type: "input" }, -] -// 빗물펌프 -const StormWaterPump = ({ featureData }: { featureData: Record<string, any> }) => { - const validKey = inputColumn.map((item) => item.id); - const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record<string, any>, [key, value]) => {obj[key] = value; return obj;}, {}); - return ( - <div><VerticalTable headName='자체 입력정보' tableData={[filteredData]} headlist={inputColumn} pageSize={0} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void { - throw new Error('Function not implemented.'); - }} /> - </div> - ) -} - -export default StormWaterPump \ No newline at end of file From 5763db71fe32b83b589e0efce6c8d05258d8e734 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Fri, 11 Jul 2025 17:54:07 +0900 Subject: [PATCH 252/259] =?UTF-8?q?feat:=20-=20=EC=97=B0=EC=9B=94=EC=9D=BC?= =?UTF-8?q?,=20=EC=88=AB=EC=9E=90=20=ED=8F=AC=EB=A7=B7=20=EB=B3=80?= =?UTF-8?q?=ED=99=98=20=EA=B5=AC=ED=98=84=20-=20=EC=9A=B4=EC=98=81?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=ED=8C=8C=EC=9D=BC=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?Modal=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/components/common/table.ts | 38 ++++++++ .../components/popupComponent/sewagePump.tsx | 2 +- .../map/featureClickEventPopup.tsx | 32 +++---- .../(with-base-layout)/ii/rdiiResult/page.tsx | 35 ++++--- .../app/(with-base-layout)/ii/result/page.tsx | 36 ++++--- .../(with-base-layout)/oper/floodPre/page.tsx | 47 +++++++-- .../(with-base-layout)/oper/oldPp/page.tsx | 38 ++++++-- apps/sn/app/components/lib/utils/date.ts | 53 ++++++++++ .../lib/utils/formatDisplayValue.tsx | 96 +++++++++++++++++++ apps/sn/app/components/lib/utils/index.tsx | 1 + 10 files changed, 318 insertions(+), 60 deletions(-) create mode 100644 apps/sn/app/components/lib/utils/formatDisplayValue.tsx diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 87be5bf6e..045b8db59 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -648,4 +648,42 @@ export const untrtSwgRainCol5 = [ { id: 'mesureBod', title: 'BOD(mg/L)' }, { id: 'mesureToc', title: 'TOC(mg/L)' }, { id: 'mesureLoad', title: '오염부하량(kg)' } +]; + +// 🎯 날짜 필드들 (yyyymmdd -> yyyy년 mm월 dd일) +export const dateFields = [ + 'instl_ymd', 'last_drdgn_ymd', 'cmcn_ymd', 'oprtng_strt_ymd', 'clsg_ymd', + 'mesure_begin_dt', 'mesure_end_dt', 'qltwtr_begin_dt', 'qltwtr_end_dt', + 'rain_begin_dt', 'rain_end_dt', 'mesureDt', + // 🎯 camelCase 버전 추가 + 'instlYmd', 'lastDrdgnYmd', 'cmcnYmd', 'oprtngStrtYmd', 'clsgYmd', + 'mesureBeginDt', 'mesureEndDt', 'qltwtrBeginDt', 'qltwtrEndDt', + 'rainBeginDt', 'rainEndDt' +]; + +// 🎯 연월 필드들 (yyyymm -> yyyy년 m월) +export const yearMonthFields = ['aplcnYm',]; + +// 🎯 날짜시간 필드들 (yyyy-mm-dd hh:mm:ss -> yyyy년 m월 d일 hh:mm) +export const dateTimeFields = ['regDt',]; + +// 🎯 숫자 필드들 (천 단위 구분자) +export const numberFields = [ + 'pdmt', 'prlg', 'avg_grdn', 'drtw_mltv_area', 'excln_mltv_area', 'tmpt_dpth', 'scend_dpth', 'trfln_cnt', 'vrtc_len', 'wdth_len', + 'fclt_cpct', 'plln_area', 'prcs_zone_area_sum', 'swtrmt_ppltn_cnt', 'stty_crtr_bod', 'stty_crtr_toc', 'stty_crtr_ss', 'stty_crtr_tn', 'stty_crtr_tph', 'stty_crtr_clbcl_cnt', + 'swage_mh_diam', 'wdth_len', 'vrtc_len', 'altd_vl', 'dpthlVl', + 'plln_area', 'daily_prcs_cpct', 'max_impnd_cpct', 'altd_vl', 'wtlv_vl', 'excln_wpmp_ablt', + 'worflw_wall_hgt', + 'swr_ppl_eqp_ar', 'swr_trt_popl', 'weir_hg', 'weir_lt', + 'precdng_dry', 'rain_fall', 'cntnc_time', 'rain_in', + 'mesure_intrvl', 'qltwtr_co', 'mesureQy', 'mesureBod', 'mesureToc', 'mesureLoad', + // 🎯 camelCase 버전 추가 + 'avgGrdn', 'drtwMltvArea', 'exclnMltvArea', 'tmptDpth', 'scendDpth', 'trflnCnt', 'vrtcLen', 'wdthLen', + 'fcltCpct', 'pllnArea', 'prcsZoneAreaSum', 'swtrmtPpltnCnt', 'sttyCltrBod', 'sttyCltrToc', 'sttyCltrSs', 'sttyCltrTn', 'sttyCltrTph', 'sttyCltrClbclCnt', + 'swageMhDiam', 'altdVl', 'dpthlVl', + 'dailyPrcsCpct', 'maxImpndCpct', 'wtlvVl', 'exclnWpmpAblt', + 'worflwWallHgt', + 'swrPplEqpAr', 'swrTrtPopl', 'weirHg', 'weirLt', + 'precdngDry', 'rainFall', 'cntncTime', 'rainIn', + 'mesureIntrvl', 'qltwtrCo', 'rnysnFvlc', 'clarFvlc' ]; \ No newline at end of file diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx index 0da4ab31e..d8f004cac 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/sewagePump.tsx @@ -13,7 +13,7 @@ const drtwInputColumn = [ ] // 하수펌프장 -const sewagePump = ({ featureData, isDrtwSewagePump, onSaveClick }: { featureData: any, isDrtwSewagePump: boolean, onSaveClick?: () => void }) => { +const sewagePump = ({ featureData, isDrtwSewagePump, onSaveClick }: { featureData: any, isDrtwSewagePump?: boolean, onSaveClick?: () => void }) => { const [formData, setFormData] = useState<any>({}); // featureData가 변경될 때 formData 초기화 diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index 95cab06c7..a3dfdce87 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -10,7 +10,8 @@ import { SwtrmtFcltCol, SwtrmtPrcsZoneCol, untrtSwgRainCol1, untrtSwgRainCol2, M import InfilChart from './components/popupComponent/chart/infilChart'; import RdiiChart from './components/popupComponent/chart/rdiiChart'; import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore"; -import { set } from "react-hook-form"; +import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue'; + // TODO: const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => { @@ -151,25 +152,21 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, // 하수맨홀인 경우 용도코드를 텍스트로 변환 if (selectedLayerName === '하수맨홀' && data) { - const processedData = { ...data }; - // mqlt_cd 값 변환 (재질코드) - if (processedData.mqlt_cd) { + if (data.mqlt_cd) { const materialCodeItem = MS_SWAGE_MHL_CODES.find( - code => code.val === processedData.mqlt_cd.trim() + code => code.val === data.mqlt_cd.trim() ); - if (materialCodeItem) { - processedData.mqlt_cd = `${materialCodeItem.text}`; - } + if (materialCodeItem) data.mqlt_cd = `${materialCodeItem.text}`; } - - setfetchData(processedData); - setTableData(processedData); - } else { - setfetchData(data); - setTableData(data); } + // 🎯 기본 데이터 포맷팅 + let formattedData = formatDisplayData(data); + + setfetchData(formattedData); + setTableData(formattedData); + switch (selectedLayerName) { case '하수처리시설': setHeadlist(SwtrmtFcltCol); @@ -185,8 +182,11 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setButtonChk(false) setIsMainSsc(true) - setfetchData([processedData]) - setTableData(processedData); + // 🎯 processedData도 포맷팅하여 설정 + const processedFormattedData = formatDisplayData(processedData); + + setfetchData([processedFormattedData]) + setTableData(processedFormattedData); setIsLoading(false); // 기본 렌더링 완료 // 수량/수질측정 정보 데이터 호출 diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index 12615c87c..dbb0fb7ca 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -7,6 +7,7 @@ import { useForm } from 'react-hook-form' import { z } from 'zod' import BaseLayout from '../BaseLayout' import { handleDelete } from '@/components/lib/utils' +import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue'; const formSchema = z.object({ @@ -92,12 +93,12 @@ const Result = () => { let inftwtAnlsSearchDto; // swageTmplntCd 처리 로직 추가 - const processedSwageTmplntCd = formValues.swageTmplntCd && formValues.swageTmplntCd !== '0' + const processedSwageTmplntCd = formValues.swageTmplntCd && formValues.swageTmplntCd !== '0' ? (() => { - const valString = String(formValues.swageTmplntCd); - const parts = valString.split('.'); - return parts.length > 1 ? parts[1] : valString; - })() + const valString = String(formValues.swageTmplntCd); + const parts = valString.split('.'); + return parts.length > 1 ? parts[1] : valString; + })() : null; if (customFormValues) { @@ -136,12 +137,20 @@ const Result = () => { console.log("API: ", `v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); try { const data = await getData(`v1/rdiiAnls${queryString ? `?${queryString}` : ''}`); - // 일련번호를 추가한 데이터로 변환 - const dataWithRowNumber = (data.content || []).map((item: any, index: number) => ({ - ...item, - rowNumber: index + 1, // 1부터 시작하는 일련번호 추가 - scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경 - })); + + // 🎯 각 아이템을 개별적으로 포맷팅하면서 일련번호 추가 + const dataWithRowNumber = (data.content || []).map((item: any, index: number) => { + // 🎯 먼저 각 아이템을 포맷팅 + const formattedItem = formatDisplayData(item); + + // 추가 처리 및 일련번호 추가 + return { + ...formattedItem, + rowNumber: index + 1, // 1부터 시작하는 일련번호 추가 + scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경 + }; + }); + // setTableData(data.content || []); // setTotalData(tableData.length); setTableData(dataWithRowNumber); @@ -286,9 +295,9 @@ const Result = () => { selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} aplcnYmFrom={form.watch("aplcnYmFrom")} - setAplcnYmFrom={(val: string) => {form.setValue("aplcnYmFrom", val)}} + setAplcnYmFrom={(val: string) => { form.setValue("aplcnYmFrom", val) }} aplcnYmTo={form.watch("aplcnYmTo")} - setAplcnYmTo={(val: string) => {form.setValue("aplcnYmTo", val)}} + setAplcnYmTo={(val: string) => { form.setValue("aplcnYmTo", val) }} isLoading={isLoadingResult} // Excel 다운로드 핸들러 추가 onExcelDownload={handleExcelDownload} diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 73bc6ecf2..3bdc35c8c 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -7,6 +7,7 @@ import { useForm } from 'react-hook-form' import { z } from 'zod' import BaseLayout from '../BaseLayout' import { handleDelete } from '@/components/lib/utils' +import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue'; const formSchema = z.object({ @@ -90,12 +91,12 @@ const Result = () => { let inftwtAnlsSearchDto; // swageTmplntCd 처리 로직 추가 - const processedSwageTmplntCd = formValues.swageTmplntCd && formValues.swageTmplntCd !== '0' + const processedSwageTmplntCd = formValues.swageTmplntCd && formValues.swageTmplntCd !== '0' ? (() => { - const valString = String(formValues.swageTmplntCd); - const parts = valString.split('.'); - return parts.length > 1 ? parts[1] : valString; - })() + const valString = String(formValues.swageTmplntCd); + const parts = valString.split('.'); + return parts.length > 1 ? parts[1] : valString; + })() : null; if (customFormValues) { @@ -136,12 +137,19 @@ const Result = () => { console.log("API: ", `v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); try { const data = await getData(`v1/inftwtAnls${queryString ? `?${queryString}` : ''}`); - // 일련번호를 추가한 데이터로 변환 - const dataWithRowNumber = (data.content || []).map((item: any, index: number) => ({ - ...item, - rowNumber: index + 1, // 1부터 시작하는 일련번호 추가 - scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경 - })); + + // 🎯 각 아이템을 개별적으로 포맷팅하면서 일련번호 추가 + const dataWithRowNumber = (data.content || []).map((item: any, index: number) => { + // 🎯 먼저 각 아이템을 포맷팅 + const formattedItem = formatDisplayData(item); + + // 추가 처리 및 일련번호 추가 + return { + ...formattedItem, + rowNumber: index + 1, // 1부터 시작하는 일련번호 추가 + scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경 + }; + }); // setTableData(data.content || []); // setTotalData(tableData.length); setTableData(dataWithRowNumber); @@ -248,7 +256,7 @@ const Result = () => { enoCd: selectedRowData.enoCd || null, ctpvCd: selectedRowData.ctpvCd || null, sggCd: selectedRowData.sggCd || null, - swageTmplntCd: selectedRowData.swageTmplntCd || null, + swageTmplntCd: selectedRowData.swageTmplntCd || null, // swtrmtZoneCd: selectedRowData.swtrmtZoneCd || null, }; await handleSearchButtonClick(customFormValues); @@ -289,9 +297,9 @@ const Result = () => { selectedSwageProcessingZone={form.watch("swtrmtZoneCd")} onSwageProcessingZoneChange={(val) => form.setValue("swtrmtZoneCd", String(val))} aplcnYmFrom={form.watch("aplcnYmFrom")} - setAplcnYmFrom={(val: string) => {form.setValue("aplcnYmFrom", val)}} + setAplcnYmFrom={(val: string) => { form.setValue("aplcnYmFrom", val) }} aplcnYmTo={form.watch("aplcnYmTo")} - setAplcnYmTo={(val: string) => {form.setValue("aplcnYmTo", val)}} + setAplcnYmTo={(val: string) => { form.setValue("aplcnYmTo", val) }} isLoading={isLoadingResult} // 로딩 상태 전달 // Excel 다운로드 핸들러 추가 onExcelDownload={handleExcelDownload} diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 9479a5395..55a3e65f1 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -1,9 +1,9 @@ 'use client' import { deleteData, postData } from '@/components/lib/api' -import { searchCmmnCd, searchData } from '@/components/lib/common/apiHelpers' -import { formatDate, handleDownload, yearOptions } from '@/components/lib/utils' +import { searchData } from '@/components/lib/common/apiHelpers' +import { formatDate, handleDownload } from '@/components/lib/utils' import LoadingOverlay from '@/components/ui/LoadingBar' -import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' +import { SearchDiv, SearchFormLeft, SearchFormRight, UiTable, UiModal } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { Button, DatePicker, Input, Label } from '@common/components/ui' import { useEffect, useState } from 'react' @@ -15,8 +15,6 @@ const Page = () => { // 조회조건 const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }) const [toDate, setToDate] = useState(new Date()) - const [manageYear, setManageYear] = useState(yearOptions[0]?.val || ''); - const [mngQu, setMngQu] = useState(yearOptions[0]?.val || ''); const [usr, setUsr] = useState('') const [pjNm, setpjNm] = useState('') // 파일업로드 관련 상태 @@ -27,6 +25,7 @@ const Page = () => { const [curPage, setCurPage] = useState(1) //현재 페이지 const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + const [isModalOpen, setIsModalOpen] = useState(false) // 모달 상태 // 조회 const fetchData = async () => { @@ -87,6 +86,7 @@ const Page = () => { } } } + // 현황 등록 const registFile = async (fileName: string, year: string, quater: string, cd: string, id: string) => { const data = await postData('v1/sbmrgPrevnt', { @@ -97,8 +97,19 @@ const Page = () => { atflId: id, sbmrgPrevntBizNm: fileName }) - if (data) { alert('파일이 등록되었습니다.'); fetchData() } + if (data) { + alert('파일이 등록되었습니다.'); + setIsModalOpen(false); + fetchData(); + } } + + // 등록 버튼 클릭 핸들러 + const handleRegisterClick = () => { + setIsModalOpen(true); + } + + return ( <> <LoadingOverlay isLoading={isLoading ?? false} /> @@ -142,7 +153,10 @@ const Page = () => { </div> </SearchFormLeft> <SearchFormRight> - <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={async () => await fetchData()} >조회</Button> + <div className='flex items-center gap-5'> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={async () => await fetchData()} >조회</Button> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={handleRegisterClick} >등록</Button> + </div> </SearchFormRight> </SearchDiv> <ListDiv className="mt-4"> @@ -171,9 +185,22 @@ const Page = () => { onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} /> </ListDiv> - <ListDiv className="mt-4"> - <OperFileUploadForm title='도시침수 예방사업 사업추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> - </ListDiv> + {/* 파일 업로드 모달 */} + <UiModal + open={isModalOpen} + onOpenChange={setIsModalOpen} + bodyClass="w-auto max-w-[90vw] min-w-[600px] h-auto" + noHeaderYn="N" + noFooterYn="Y" + body={ + <OperFileUploadForm + title='도시침수 예방사업 사업추진현황 등록' + onSubmit={async (file, year, quater, cd, id) => { + await registFile(file, year, quater, cd, id) + }} + /> + } + /> </> ) } diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 5236e1c17..2b360ba98 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -3,7 +3,7 @@ import { deleteData, postData } from '@/components/lib/api' import { searchData } from '@/components/lib/common/apiHelpers' import { formatDate, handleDownload, yearOptions } from '@/components/lib/utils' import LoadingOverlay from '@/components/ui/LoadingBar' -import { SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, UiTable } from '@common/business_components/ui' +import { SearchDiv, SearchFormLeft, SearchFormRight, UiTable, UiModal } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { Button, DatePicker, Input, Label } from '@common/components/ui' import { useEffect, useState } from 'react' @@ -25,6 +25,7 @@ const Page = () => { const [curPage, setCurPage] = useState(1) const [totalData, setTotalData] = useState(0) //총 데이터 수 const [isLoading, setIsLoading] = useState(true) //로딩 상태 + const [isModalOpen, setIsModalOpen] = useState(false) // 모달 상태 // 데이터 조회 const fetchData = async () => { @@ -98,7 +99,16 @@ const Page = () => { atflId: id, dcrpPplMtncBizNm: fileNm }) - if (data) { alert('파일이 등록되었습니다.'); fetchData() } + if (data) { + alert('파일이 등록되었습니다.'); + setIsModalOpen(false); + fetchData(); + } + } + + // 등록 버튼 클릭 핸들러 + const handleRegisterClick = () => { + setIsModalOpen(true); } @@ -143,7 +153,10 @@ const Page = () => { </div> </SearchFormLeft> <SearchFormRight> - <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 mr-2" size="sm" onClick={async () => { await fetchData() }}>조회</Button> + <div className='flex items-center gap-5'> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={async () => await fetchData()} >조회</Button> + <Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={handleRegisterClick} >등록</Button> + </div> </SearchFormRight> </SearchDiv> <ListDiv className="mt-4"> @@ -173,9 +186,22 @@ const Page = () => { onPageChange={async (page: number) => { setCurPage(page); await fetchData() }} /> </ListDiv> - <ListDiv className="mt-4"> - <OperFileUploadForm title='노후 하수관로 정비사업 주진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} /> - </ListDiv> + {/* 파일 업로드 모달 */} + <UiModal + open={isModalOpen} + onOpenChange={setIsModalOpen} + bodyClass="w-auto max-w-[90vw] min-w-[600px] h-auto" + noHeaderYn="N" + noFooterYn="Y" + body={ + <OperFileUploadForm + title='노후 하수관로 정비사업 사업추진현황 등록' + onSubmit={async (file, year, quater, cd, id) => { + await registFile(file, year, quater, cd, id) + }} + /> + } + /> </> ) } diff --git a/apps/sn/app/components/lib/utils/date.ts b/apps/sn/app/components/lib/utils/date.ts index 9c9106ec2..a401ad738 100644 --- a/apps/sn/app/components/lib/utils/date.ts +++ b/apps/sn/app/components/lib/utils/date.ts @@ -54,4 +54,57 @@ export const convertToTextValArray = (yyyymms: string[]): { text: string; val: s val: dateStr }; }); +}; + +// 🎯 날짜 유효성 검사 함수 (8자리 또는 6자리 지원) +export const isValidDateString = (dateStr: string): boolean => { + // 숫자만 추출 + const cleanStr = dateStr.replace(/\D/g, ''); + + // 8자리 (yyyymmdd) 또는 6자리 (yyyymm) 확인 + if (cleanStr.length === 8) { + // 연도, 월, 일 추출 + const year = parseInt(cleanStr.substring(0, 4)); + const month = parseInt(cleanStr.substring(4, 6)); + const day = parseInt(cleanStr.substring(6, 8)); + + // 기본 범위 검사 + if (year < 1900 || year > 2200) return false; + if (month < 1 || month > 12) return false; + if (day < 1 || day > 31) return false; + + // Date 객체로 실제 유효한 날짜인지 검사 + const date = new Date(year, month - 1, day); + return date.getFullYear() === year && + date.getMonth() === month - 1 && + date.getDate() === day; + } + else if (cleanStr.length === 6) { + // 연도, 월 추출 + const year = parseInt(cleanStr.substring(0, 4)); + const month = parseInt(cleanStr.substring(4, 6)); + + // 기본 범위 검사 + if (year < 1900 || year > 2200) return false; + if (month < 1 || month > 12) return false; + + return true; + } + + return false; +}; + +// 🎯 날짜 포맷팅 함수 +export const formatDateString = (dateStr: string): string => { + const cleanStr = dateStr.replace(/\D/g, ''); // 숫자만 추출 + + if (!isValidDateString(cleanStr)) { + return dateStr; // 유효하지 않은 날짜면 원본 반환 + } + + const year = cleanStr.substring(0, 4); + const month = parseInt(cleanStr.substring(4, 6)); // parseInt로 앞의 0 제거 + const day = parseInt(cleanStr.substring(6, 8)); // parseInt로 앞의 0 제거 + + return `${year}년 ${month}월 ${day}일`; }; \ No newline at end of file diff --git a/apps/sn/app/components/lib/utils/formatDisplayValue.tsx b/apps/sn/app/components/lib/utils/formatDisplayValue.tsx new file mode 100644 index 000000000..858453291 --- /dev/null +++ b/apps/sn/app/components/lib/utils/formatDisplayValue.tsx @@ -0,0 +1,96 @@ +import { dateFields, numberFields, yearMonthFields, dateTimeFields } from "../../../(map-layout)/map/components/common/table"; +import { isValidDateString, formatDateString } from "./date"; + +// 🎯 데이터 객체 전체를 포맷팅하는 함수 +export const formatDisplayData = (data: { [key: string]: any }): { [key: string]: string } => { + if (!data) return {}; + + const formattedData: { [key: string]: string } = {}; + + Object.keys(data).forEach(fieldId => { + const value = data[fieldId]; + + if (value === null || value === undefined || value === "") { + formattedData[fieldId] = "-"; + return; + } + + // 🎯 연월 포맷팅 (yyyymm -> yyyy년 m월) + if (yearMonthFields.includes(fieldId)) { + const dateStr = String(value).trim(); + if (/^\d{6}$/.test(dateStr)) { + const year = dateStr.substring(0, 4); + const month = parseInt(dateStr.substring(4, 6)); + formattedData[fieldId] = `${year}년 ${month}월`; + } else { + formattedData[fieldId] = String(value); + } + return; + } + + // 🎯 날짜시간 포맷팅 (yyyy-mm-dd hh:mm:ss -> yyyy년 m월 d일 hh:mm) + if (dateTimeFields.includes(fieldId)) { + const dateTimeStr = String(value).trim(); + // yyyy-mm-dd hh:mm:ss 형식 확인 + const dateTimeRegex = /^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})$/; + const match = dateTimeStr.match(dateTimeRegex); + + if (match && match.length >= 6) { + const year = match[1]; + const month = match[2]; + const day = match[3]; + const hour = match[4]; + const minute = match[5]; + const second = match[6]; + + // 🎯 undefined 체크 후 parseInt 적용 + if (year && month && day && hour && minute) { + const formattedMonth = parseInt(month); + const formattedDay = parseInt(day); + formattedData[fieldId] = `${year}년 ${formattedMonth}월 ${formattedDay}일 ${hour}시 ${minute}분 ${second}초`; + } else { + formattedData[fieldId] = String(value); + } + } else { + formattedData[fieldId] = String(value); + } + return; + } + + // 🎯 기존 날짜 포맷팅 (yyyymmdd -> yyyy년 m월 d일) + if (dateFields.includes(fieldId)) { + const dateStr = String(value).trim(); + + // 숫자 타입이거나 숫자로만 구성된 문자열인지 확인 + if (/^\d+$/.test(dateStr)) { + formattedData[fieldId] = formatDateString(dateStr); + } else { + formattedData[fieldId] = String(value); + } + return; + } + + // 🎯 숫자 필드는 천 단위 구분자 추가 + if (numberFields.includes(fieldId)) { + const numValue = Number(value); + if (!isNaN(numValue) && isFinite(numValue)) { + formattedData[fieldId] = numValue.toLocaleString('ko-KR'); + } else { + formattedData[fieldId] = String(value); + } + return; + } + + // 나머지는 문자열로 처리 + formattedData[fieldId] = String(value); + }); + + return formattedData; +}; + +// 🎯 단일 값만 포맷팅하는 함수 (기존 호환성을 위해 유지) +export const formatDisplayValue = (value: any, fieldId: string): string => { + const tempData = { [fieldId]: value }; + const formatted = formatDisplayData(tempData); + return formatted[fieldId] || String(value); +}; \ No newline at end of file diff --git a/apps/sn/app/components/lib/utils/index.tsx b/apps/sn/app/components/lib/utils/index.tsx index 272ca7ada..8bc8cf9be 100644 --- a/apps/sn/app/components/lib/utils/index.tsx +++ b/apps/sn/app/components/lib/utils/index.tsx @@ -4,3 +4,4 @@ export * from './date' export * from './excelToJson' export * from './fileDeleteUtil' export * from './fileDownload' +export * from './formatDisplayValue' From 8a874dd11438207dc5ae80c16fdc3ce40b325690 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Fri, 11 Jul 2025 18:01:40 +0900 Subject: [PATCH 253/259] =?UTF-8?q?feat:=20=EC=B9=A8=EC=9E=85=EC=88=98=20?= =?UTF-8?q?=EB=B6=84=EC=84=9D=EA=B2=B0=EA=B3=BC,=20RDII=20=EB=B6=84?= =?UTF-8?q?=EC=84=9D=EA=B2=B0=EA=B3=BC=20=EB=A7=88=EC=9A=B4=ED=8A=B8=20?= =?UTF-8?q?=EC=8B=9C=EC=97=90=20=EC=A1=B0=ED=9A=8C=EB=90=98=EA=B2=8C?= =?UTF-8?q?=EB=81=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx | 7 ++++++- apps/sn/app/(with-base-layout)/ii/result/page.tsx | 8 +++++++- apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx | 2 +- apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx | 4 +--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index dbb0fb7ca..2af9cfc19 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -2,7 +2,7 @@ import { deleteData, getData } from '@/components/lib/api' import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' import { zodResolver } from '@hookform/resolvers/zod' -import { useState } from 'react' +import { useState, useEffect } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' import BaseLayout from '../BaseLayout' @@ -84,6 +84,11 @@ const Result = () => { const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); const [resetSelection, setResetSelection] = useState<boolean>(false); + useEffect(() => { + // setCurPage(1); + handleSearchButtonClick(); + }, []) + const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { setIsLoadingResult(true); diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 3bdc35c8c..ab8d397e0 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -2,7 +2,7 @@ import { deleteData, getData } from '@/components/lib/api' import { UiTable, downloadExcel, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' import { zodResolver } from '@hookform/resolvers/zod' -import { useState } from 'react' +import { useState, useEffect } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' import BaseLayout from '../BaseLayout' @@ -82,6 +82,10 @@ const Result = () => { const [selectedRowIndex, setSelectedRowIndex] = useState<number | undefined>(undefined); const [resetSelection, setResetSelection] = useState<boolean>(false); + useEffect(() => { + // setCurPage(1); + handleSearchButtonClick(); + }, []) const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => { setIsLoadingResult(true); @@ -278,6 +282,8 @@ const Result = () => { } }; + + return ( <BaseLayout selectBox={{ title: '분석 대상지역 선택', searchChk: true, onSearchClick: handleSearchButtonClick }} diff --git a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx index 55a3e65f1..c67c34482 100644 --- a/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/floodPre/page.tsx @@ -194,7 +194,7 @@ const Page = () => { noFooterYn="Y" body={ <OperFileUploadForm - title='도시침수 예방사업 사업추진현황 등록' + title='도시침수 예방사업 추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} diff --git a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx index 2b360ba98..fb1725f55 100644 --- a/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx +++ b/apps/sn/app/(with-base-layout)/oper/oldPp/page.tsx @@ -14,8 +14,6 @@ import OperFileUploadForm from '../../../components/ui/operFileUploadForm' const Page = () => { const [fromDate, setFromDate] = useState<Date>(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date }); const [toDate, setToDate] = useState<Date>(new Date()); - const [manageYear, setManageYear] = useState(yearOptions[0]?.val || ''); - const [mngQu, setMngQu] = useState(yearOptions[0]?.val || ''); const [usr, setUsr] = useState('') const [pjNm, setpjNm] = useState('') const [fileNm, setFileNm] = useState('') @@ -195,7 +193,7 @@ const Page = () => { noFooterYn="Y" body={ <OperFileUploadForm - title='노후 하수관로 정비사업 사업추진현황 등록' + title='노후 하수관로 정비사업 추진현황 등록' onSubmit={async (file, year, quater, cd, id) => { await registFile(file, year, quater, cd, id) }} From b66b3a9b557734ef7ddbddf3185cae0572ca0da4 Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Mon, 14 Jul 2025 12:52:45 +0900 Subject: [PATCH 254/259] =?UTF-8?q?=EC=9D=BC=EB=8B=A8=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 33 ++- .../map/components/searchModalReportApi.ts | 255 ++++++++++-------- 2 files changed, 171 insertions(+), 117 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 82e1485fc..610803a4f 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -11,7 +11,7 @@ import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; //import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; -import { getDcTree,useDcTree,flattenFolders, useSggCd, useCityCd,getDcFile } from './components/searchModalReportApi'; +import { getDcTree,useDcTree,flattenFolders, useSggCd, useCityCd,getDcFile,addFileName,getDcFileDownload } from './components/searchModalReportApi'; import { useCityCdStore, type SelectDataType } from './commonStore'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -130,7 +130,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ const sidos = useCityCd(); const siguns = useSggCd(); - const reportOriginData = useDcTree(""); + const reportOriginData = useDcTree(""); //:Folder[] // 오늘 날짜 구하기 const today = new Date(); @@ -179,6 +179,26 @@ const SearchModal: React.FC<SearchModalProps> = ({ onOpenChange(false); // SearchModal 닫기 } }; + // 하수도정비기본계획.table cellClick + const handleReportCellClick = (index: number, headId?: string) => { + console.log(index); + const reportData = tableData[index]; + console.log(reportData); + const fileName = reportData.fileName; + if (reportData.filePath) { + console.log(reportData.filePath); + getDcFileDownload(reportData.filePath).then((data) => { + const url = window.URL.createObjectURL(data); + const link = document.createElement('a'); + link.href = url; + link.download = fileName; // 원하는 파일명 지정 + document.body.appendChild(link); + link.click(); + link.remove(); + window.URL.revokeObjectURL(url); + }); + } + }; const handleCtpvCdChange = (val: string|number) => { // 하수도정비기본계획.시도 const sidoOption = sidos.find((n) => n.val === val); @@ -286,9 +306,12 @@ const SearchModal: React.FC<SearchModalProps> = ({ setTableCount(filterReportData.length || 0); filterReportData = filterReportData.slice((curPage-1)*10, curPage*10); // paging filterReportData = filterReportData?.map((item, index)=>({...item, no:(curPage-1)*10+index+1})); + //const fileList = await getDcFile("CLS20250530000041"); + addFileName(filterReportData).then(data => { + filterReportData = data; + setTableData(filterReportData || []); + }); setTableData(filterReportData || []); - const fileList = await getDcFile("CLS20250530000041"); - console.log(fileList); } else { console.log('API URL:', `${API_URL}/v1/fclts?${queryParams.toString()}`); const res = await axios.get(`${API_URL}/v1/fclts?${queryParams.toString()}`); @@ -1117,7 +1140,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ pageSize={tableData.length < 10 ? tableData.length : 10} total={tableCount} children={undefined} - cellClick={handleCellClick} + cellClick={(activeTab!=='report')?handleCellClick:handleReportCellClick} onPageChange={setCurPage} resetPageNo={false} cur={curPage} diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index 93c0b6b13..f26f6cbb2 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -1,18 +1,17 @@ import {useState, useEffect} from 'react'; import { getDcData } from '@/components/lib/api'; -import { json } from 'stream/consumers'; const ADDR_URL = process.env.NEXT_PUBLIC_ADDR_URL; -type Folder = { +export type Folder = { clsfSystmSn: string; upClsfSystmSn: string; clsfSystmNm: string; children: Folder[]; }; -type FlattenedFolder = { - [key: string]: string|number; +export type FlattenedFolder = { + [key: string]: string|number|undefined; }; type SelectDataType = { @@ -21,27 +20,126 @@ type SelectDataType = { sido?: string; // 시도 코드 (선택 사항) } - // 시군구 데이터 -export const getSggCd = async (): Promise<SelectDataType[]> => { - try { - const response = await fetch(`${ADDR_URL}/api/v1/addr/sgg`, { method: "GET", headers: { accept: "application/json" } }); - if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`); - const res = await response.json(); - const sgg = res.data; - const sggCd = sgg.map((item: any) => ({ - val: item.adstDstrCd, - sido: item.sido, - text: item.gugun, - })); - sggCd.unshift({ val: '0', text: '전체' }); // "전체" 옵션 추가 - return sggCd; - } catch (error) { - console.error('시군구 데이터를 가져오는데 실패했습니다:', error); - return [{ val: '0', text: '전체', sido: '0' }]; - } - }; +type ReportDataFile = { + no : number; + fileTitle : string; + regDt : string; + fileSn : string; + filePath : string; +} +const isYear = (value: string): boolean => { + return /^[0-9]{4}년$/.test(value); +}; - // 시도 데이터 +export function flattenFolders(data: Folder[]): FlattenedFolder[] { + const result: FlattenedFolder[] = []; + const exceptNodeNm = ["부분","통합","전체"]; + const addNodeNm = ["보고서","요약보고서","부록","기타"]; // level5 + const columnNms: { [key: number]: string } = { 0: "root", 1:"sido", 2:"sigungu", 3:"approvalYear" + ,4:"plantZoneGugun", 5:"reportGubun", 7:"fileName", 8:"regDate" }; + + function traverse( + node: Folder, + path: { [key: string]: string| number }, + level: number + ) { + if (level === 2 && isYear(node.clsfSystmNm)) { + level++; + } + if (level === 4 && addNodeNm.includes(node.clsfSystmNm)) { + level++; // 레벨을 증가시켜 하위값에 추가되도록 함. + } + + const newPath = { + ...path, + [`${columnNms[level]}`]: node.clsfSystmNm, + }; + + if (node.children.length === 0) { + newPath.no = result.length + 1; + newPath.clsfSystmSn = node.clsfSystmSn; // 파일 조회를 위한 고유번호 + result.push(newPath); + } else { + if (level === 4) { + if (exceptNodeNm.includes(node.clsfSystmNm)) { + level--; // 제외할 노드 이름인 경우, 현재의 레벨에 하위값이 써지도록 함. + } + } + node.children.forEach((child) => { + traverse(child, newPath, level + 1); + }); + } + } + + data.forEach((root) => traverse(root, {}, 0)); + console.log(result.slice(0, 10)); + return result; +} + +export const getDcTree = async (clsfSystmNm:string) => { + //const cityName = encodeURIComponent(clsfSystmNm); + const queryString = 'clsfSystmNm='+clsfSystmNm; + console.log("getDcTree queryString:", queryString); + //const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`); + const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm); + return result; +}; +export const useDcTree = (clsfSystmNm:string) => { + const [data, setData] = useState([]); + + useEffect(() => { + const fetch = async () => { + const result = await getDcTree(clsfSystmNm); + if (result) { + setData(result); + } + }; + fetch(); + console.log("useDcTree호출"); + }, [clsfSystmNm]); + + return data; +}; +export const getDcFile = async (clsfSystmSn:string) => { + const queryString = 'clsfSystmSn='+clsfSystmSn; + const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`); + return result; +}; +export const getDcFileprcs = async (fileSn:string) => { + const queryString = 'fileSn='+fileSn; + console.log("getDcTree queryString:", queryString); + const result = await getDcData(`/api/v1/dc/fileprcs${queryString ? `?${queryString}` : ''}`); + return result; +}; + +export const addFileName = async (data:FlattenedFolder[]) => { + const fileReportData = await Promise.all( + data.map(async (item) => { + const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn)); + const f = filenameArr[0]; + const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:""}; + if (f !== undefined && f.fileSn !== "") { + const fprcs = await getDcFileprcs(f?.fileSn); + if (fprcs.length>0) + result.filePath = fprcs[0].filePath; + } + return result; + }) + ); + return fileReportData; +} +export const getDcFileDownload = async (filePath:string) => { + const queryString = 'filePath='+ encodeURIComponent(filePath); + const response = await fetch(`/dc-service/api/v1/dc/file/download?${queryString}`, { + method: 'GET', + }); + if (!response.ok) { + throw new Error(`File download failed: ${response.status}`); + } + const blob = await response.blob(); // PDF, image 등은 blob으로 받아야 함 + return blob; +}; +// 시도 데이터 export const getCityCd = async (): Promise<SelectDataType[]> => { try { const response = await fetch(`${ADDR_URL}/api/v1/addr/city`, { method: "GET", headers: { accept: "application/json" } }); @@ -75,6 +173,27 @@ export const useSggCd = () => { }, []); return data; }; + +// 시군구 데이터 +export const getSggCd = async (): Promise<SelectDataType[]> => { + try { + const response = await fetch(`${ADDR_URL}/api/v1/addr/sgg`, { method: "GET", headers: { accept: "application/json" } }); + if (!response.ok) throw new Error(`시군구 데이터 오류: ${response.status}`); + const res = await response.json(); + const sgg = res.data; + const sggCd = sgg.map((item: any) => ({ + val: item.adstDstrCd, + sido: item.sido, + text: item.gugun, + })); + sggCd.unshift({ val: '0', text: '전체' }); // "전체" 옵션 추가 + return sggCd; + } catch (error) { + console.error('시군구 데이터를 가져오는데 실패했습니다:', error); + return [{ val: '0', text: '전체', sido: '0' }]; + } +}; + export const useCityCd = () => { const [data, setData] = useState<SelectDataType[]>([]); @@ -91,91 +210,3 @@ export const useCityCd = () => { return data; }; -const isYear = (value: string): boolean => { - return /^[0-9]{4}년$/.test(value); -}; - - export function flattenFolders(data: Folder[]): FlattenedFolder[] { - const result: FlattenedFolder[] = []; - const exceptNodeNm = ["부분","통합","전체"]; - const addNodeNm = ["보고서","요약보고서","부록","기타"]; // level5 - const columnNms: { [key: number]: string } = { 0: "root", 1:"sido", 2:"sigungu", 3:"approvalYear" - ,4:"plantZoneGugun", 5:"reportGubun", 7:"fileName", 8:"regDate" }; - - function traverse( - node: Folder, - path: { [key: string]: string| number }, - level: number - ) { - if (level === 2 && isYear(node.clsfSystmNm)) { - level++; - } - if (level === 4 && addNodeNm.includes(node.clsfSystmNm)) { - level++; // 레벨을 증가시켜 하위값에 추가되도록 함. - } - - const newPath = { - ...path, - [`${columnNms[level]}`]: node.clsfSystmNm, - }; - - if (node.children.length === 0) { - newPath.no = result.length + 1; - newPath.clsfSystmSn = node.clsfSystmSn; // 파일 조회를 위한 고유번호 - result.push(newPath); - } else { - if (level === 4) { - if (exceptNodeNm.includes(node.clsfSystmNm)) { - level--; // 제외할 노드 이름인 경우, 현재의 레벨에 하위값이 써지도록 함. - } - } - node.children.forEach((child) => { - traverse(child, newPath, level + 1); - }); - } - } - - data.forEach((root) => traverse(root, {}, 0)); - console.log(result.slice(0, 10)); - return result; - } - - -export const getDcTree = async (clsfSystmNm:string) => { - const cityName = encodeURIComponent(clsfSystmNm); - const queryString = 'clsfSystmNm='+cityName; - console.log("getDcTree queryString:", queryString); - //const result = await getDcData(`/api/v1/dc/clsf${queryString ? `?${queryString}` : ''}`); - const result = await getDcData("/api/v1/dc/clsf?clsfSystmNm=" + clsfSystmNm); - return result; -}; -export const useDcTree = (clsfSystmNm:string) => { - const [data, setData] = useState<SelectDataType[]>([]); - - useEffect(() => { - const fetch = async () => { - const result = await getDcTree(clsfSystmNm); - if (result) { - setData(result); - } - }; - fetch(); - }, [clsfSystmNm]); - - return data; -}; -export const getDcFile = async (clsfSystmSn:string) => { - const queryString = 'clsfSystmNm='+clsfSystmSn; - console.log("getDcTree queryString:", queryString); - const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`); - return result; -}; -export const addDcFileName = async(data: any) => { - const updated = await Promise.all( - data.map(async (item) => { - const fileName = await getDcFile(item.systmSn); - return { ...item, fileName }; - }) - ); - return updated; -} From 892249b04805c98ca3bc5f32b4ca77b172c1106d Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Mon, 14 Jul 2025 13:04:34 +0900 Subject: [PATCH 255/259] =?UTF-8?q?=EB=A7=88=EC=A7=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 35c5a445a..d77543201 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -979,7 +979,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ )} {/* 운영정보 탭 */} {activeTab === 'operation' && ( - <div className="relative flex flex-col border rounded-lg p-6 mb-4 w-full h-[23vh]"> + <div className="relative flex flex-col border rounded-lg p-6 mt-4 w-full h-[23vh]"> <div className="flex items-center mb-6"> <SelectBox2 className="w-60 mr-8" @@ -1033,7 +1033,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ )} {/* 하수도정비기본계획보고서 탭 */} {activeTab === 'report' && ( - <div className="relative flex flex-col border rounded-lg p-6 mb-4 w-full h-[23vh]"> + <div className="relative flex flex-col border rounded-lg p-6 mt-4 w-full h-[23vh]"> {/* 시도, 시군구, 하수처리구역 한 줄 */} <div className="mb-6 flex items-center"> <SelectBox2 From 748aa5f21d97dba5b190e7d81d74120c4c17b5fd Mon Sep 17 00:00:00 2001 From: ljpark <mind-one005@mind-one.co.kr> Date: Mon, 14 Jul 2025 14:44:49 +0900 Subject: [PATCH 256/259] =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=86=8D=EB=8F=84=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 19 ++----- .../map/components/searchModalReportApi.ts | 49 +++++++++++++------ 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 821907b87..4cace8cc0 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -11,7 +11,7 @@ import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox'; import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table'; import LoadingOverlay from '@/components/ui/LoadingBar'; //import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi'; -import { getDcTree,useDcTree,flattenFolders, useSggCd, useCityCd,getDcFile,addFileName,getDcFileDownload } from './components/searchModalReportApi'; +import { useDcTree,flattenFolders, useSggCd, useCityCd, addFileName, getFileDownload } from './components/searchModalReportApi'; import { useCityCdStore, type SelectDataType } from './commonStore'; const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`; @@ -180,23 +180,12 @@ const SearchModal: React.FC<SearchModalProps> = ({ } }; // 하수도정비기본계획.table cellClick - const handleReportCellClick = (index: number, headId?: string) => { + const handleReportCellClick = (index: number) => { console.log(index); const reportData = tableData[index]; - console.log(reportData); const fileName = reportData.fileName; - if (reportData.filePath) { - console.log(reportData.filePath); - getDcFileDownload(reportData.filePath).then((data) => { - const url = window.URL.createObjectURL(data); - const link = document.createElement('a'); - link.href = url; - link.download = fileName; // 원하는 파일명 지정 - document.body.appendChild(link); - link.click(); - link.remove(); - window.URL.revokeObjectURL(url); - }); + if (reportData.fileSn !== "") { + getFileDownload(reportData.fileSn, fileName); } }; diff --git a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts index f26f6cbb2..9d1ae43e0 100644 --- a/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts +++ b/apps/sn/app/(map-layout)/map/components/searchModalReportApi.ts @@ -105,6 +105,22 @@ export const getDcFile = async (clsfSystmSn:string) => { const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`); return result; }; +export const addFileName = async (data:FlattenedFolder[]) => { + const fileReportData = await Promise.all( + data.map(async (item) => { + const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn)); + const f = filenameArr[0]; + const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:""}; + // if (f !== undefined && f.fileSn !== "") { + // const fprcs = await getDcFileprcs(f?.fileSn); + // if (fprcs.length>0) + // result.filePath = fprcs[0].filePath; + // } + return result; + }) + ); + return fileReportData; +} export const getDcFileprcs = async (fileSn:string) => { const queryString = 'fileSn='+fileSn; console.log("getDcTree queryString:", queryString); @@ -112,22 +128,6 @@ export const getDcFileprcs = async (fileSn:string) => { return result; }; -export const addFileName = async (data:FlattenedFolder[]) => { - const fileReportData = await Promise.all( - data.map(async (item) => { - const filenameArr:ReportDataFile[] = await getDcFile(String(item.clsfSystmSn)); - const f = filenameArr[0]; - const result = {...item, fileName:f?.fileTitle, regDate:f?.regDt, fileSn:f?.fileSn, filePath:""}; - if (f !== undefined && f.fileSn !== "") { - const fprcs = await getDcFileprcs(f?.fileSn); - if (fprcs.length>0) - result.filePath = fprcs[0].filePath; - } - return result; - }) - ); - return fileReportData; -} export const getDcFileDownload = async (filePath:string) => { const queryString = 'filePath='+ encodeURIComponent(filePath); const response = await fetch(`/dc-service/api/v1/dc/file/download?${queryString}`, { @@ -139,6 +139,23 @@ export const getDcFileDownload = async (filePath:string) => { const blob = await response.blob(); // PDF, image 등은 blob으로 받아야 함 return blob; }; +export const fileDownload = (data:Blob, fileName:string) => { // Blob데이터 임시link로 연결 + const url = window.URL.createObjectURL(data); + const link = document.createElement('a'); + link.href = url; + link.download = fileName; // 원하는 파일명 지정 + document.body.appendChild(link); + link.click(); + link.remove(); + window.URL.revokeObjectURL(url); +} +export const getFileDownload = async (fileSn:string, fileName:string) => { + const fileprcsData = await getDcFileprcs(fileSn); // filePath 조회 + if (fileprcsData?.length === 0 ) { alert("filePath 조회 오류"); } + if (fileprcsData[0].filePath === "") alert("filePath 정보 없으므로 다운로드 불가"); + const blobData = await getDcFileDownload(fileprcsData[0].filePath); // 실제 다운로드 API + fileDownload(blobData, fileName); +} // 시도 데이터 export const getCityCd = async (): Promise<SelectDataType[]> => { try { From ab492fc842a8053b669b4bef0ba6208094208f31 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 14 Jul 2025 20:46:44 +0900 Subject: [PATCH 257/259] =?UTF-8?q?feat:=20=EC=A4=91=EC=A0=90=EC=9A=B0?= =?UTF-8?q?=EC=88=98=ED=86=A0=EC=8B=A4=20=EC=83=81=EC=84=B8=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20API=20=EB=B3=80=EA=B2=BD=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/(map-layout)/map/SearchModal.tsx | 12 +- .../map/components/common/index.ts | 2 +- .../map/components/common/table.ts | 30 ++--- .../map/components/popupComponent/Ssc.tsx | 101 +++++++++++--- .../map/featureClickEventPopup.tsx | 125 ++++++++++-------- apps/sn/app/components/ui/verticalTable.tsx | 11 +- 6 files changed, 179 insertions(+), 102 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/SearchModal.tsx b/apps/sn/app/(map-layout)/map/SearchModal.tsx index 35c5a445a..96e81da93 100644 --- a/apps/sn/app/(map-layout)/map/SearchModal.tsx +++ b/apps/sn/app/(map-layout)/map/SearchModal.tsx @@ -125,8 +125,6 @@ const SearchModal: React.FC<SearchModalProps> = ({ // 로딩바 const [isLoading, setIsLoading] = useState(false); - // 상세 정보 조회를 위한 상태 추가 - const [popupFeature, setPopupFeature] = useState<any>(null); const sidos = useCityCd(); const siguns = useSggCd(); @@ -173,7 +171,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ }; // cellClick 함수 타입 지정 - const handleCellClick = (index?: number, headId?: string) => { + const handleCellClick = (index?: number) => { if (typeof index === "number") { onFeatureSelect(tableData[index % 10]); // 10은 page size 하드 코딩한 숫자 onOpenChange(false); // SearchModal 닫기 @@ -339,6 +337,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ return cqlFilters; }; + // 하수처리시설용 CQL 필터 생성 const facilityCqlFilters = () => { const cqlFilters: string[] = []; @@ -367,6 +366,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (변수1) cqlFilters.push(`swtrmt_fclt_nm ILIKE '%${변수1}%'`); return cqlFilters; }; + // 하수처리구역용 CQL 필터 생성 const zoneCqlFilters = () => { const cqlFilters: string[] = []; @@ -376,6 +376,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ if (변수2) cqlFilters.push(`swtrmt_fclt_nm ILIKE '%${변수2}%'`); return cqlFilters; }; + // 하수맨홀용 CQL 필터 생성 const mhCqlFilters = () => { const cqlFilters: string[] = []; @@ -404,6 +405,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ return cqlFilters; }; + // 하수펌프장용 CQL 필터 생성 const psmtnCqlFilters = () => { const cqlFilters: string[] = []; @@ -437,6 +439,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ return cqlFilters; }; + // 우수토실용 CQL 필터 생성 const otflCqlFilters = () => { const cqlFilters: string[] = []; @@ -466,6 +469,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ return cqlFilters; }; + // 운영정보용 CQL 필터 생성 const operationCqlFilters = () => { const cqlFilters: string[] = []; @@ -487,6 +491,7 @@ const SearchModal: React.FC<SearchModalProps> = ({ ); return cqlFilters; }; + // 하수도정비기본계획보고서용 CQL 필터 생성 const reportCqlFilters = () => { const cqlFilters: string[] = []; @@ -1092,7 +1097,6 @@ const SearchModal: React.FC<SearchModalProps> = ({ <UiTable2 headName={ (() => { - const resultCount = tableData.length; const label = activeTab === "basic" ? BASIC_TYPES.find((type) => type.val === basicType)?.text diff --git a/apps/sn/app/(map-layout)/map/components/common/index.ts b/apps/sn/app/(map-layout)/map/components/common/index.ts index e71e8ba3f..055c7062a 100644 --- a/apps/sn/app/(map-layout)/map/components/common/index.ts +++ b/apps/sn/app/(map-layout)/map/components/common/index.ts @@ -9,7 +9,7 @@ type LayerComponentProps = { featureData: any; isMainSsc?: boolean; isDrtwSewagePump?: boolean; - additionalData?: any; + rainMeasureData?: any; onSaveClick?: () => void; onFormDataChange?: (data: any) => void; // 추가 }; diff --git a/apps/sn/app/(map-layout)/map/components/common/table.ts b/apps/sn/app/(map-layout)/map/components/common/table.ts index 045b8db59..0b89ad652 100644 --- a/apps/sn/app/(map-layout)/map/components/common/table.ts +++ b/apps/sn/app/(map-layout)/map/components/common/table.ts @@ -619,25 +619,25 @@ export const untrtSwgRainCol2 = [ // 중점우수토실 강우정보 (id값 틀릴 수 있음) export const untrtSwgRainCol3 = [ - { id: 'rain_begin_dt', title: '강우시작일시' }, - { id: 'rain_end_dt', title: '강우종료일시' }, - { id: 'precdng_dry', title: '선행건기(h)' }, - { id: 'rain_info', title: '강우정보' }, - { id: 'rain_fall', title: '누적강우량(mm)' }, - { id: 'cntnc_time', title: '지속시간(h)' }, - { id: 'rain_in', title: '강우강도(mm/h)' } + { id: 'rainBeginDt', title: '강우시작일시' }, + { id: 'rainEndDt', title: '강우종료일시' }, + { id: 'precdngDry', title: '선행건기(h)' }, + { id: 'rainInfo', title: '강우정보' }, + { id: 'rainFall', title: '누적강우량(mm)' }, + { id: 'cntncTime', title: '지속시간(h)' }, + { id: 'rainIn', title: '강우강도(mm/h)' } ]; // 중점우수토실 측정정보 (id값 틀릴 수 있음) export const untrtSwgRainCol4 = [ - { id: 'mesure_begin_dt', title: '측정시작일시' }, - { id: 'mesure_end_dt', title: '측정종료일시' }, - { id: 'mesure_intrvl', title: '측정간격(분)' }, - { id: 'mesure_mhrls_instl_lc', title: '측정기기 설치위치' }, - { id: 'flwmtr_combined', title: '유량계 종류 및 모델명' }, // 합쳐진 컬럼 - { id: 'qltwtr_begin_dt', title: '채수시작일시' }, - { id: 'qltwtr_end_dt', title: '채수종료일시' }, - { id: 'qltwtr_co', title: '채수횟수' } + { id: 'mesureBeginDt', title: '측정시작일시' }, + { id: 'mesureEndDt', title: '측정종료일시' }, + { id: 'mesureIntrvl', title: '측정간격(분)' }, + { id: 'mesureMhrlsInstlLc', title: '측정기기 설치위치' }, + { id: 'flwmtrCombined', title: '유량계 종류 및 모델명' }, // 합쳐진 컬럼 + { id: 'qltwtrBeginDt', title: '채수시작일시' }, + { id: 'qltwtrEndDt', title: '채수종료일시' }, + { id: 'qltwtrCo', title: '채수횟수' } ]; // 중점우수토실 수량/수질측정 정보 diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 2c5a9beab..76c6d806e 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -1,27 +1,31 @@ // 우수토실 import { UiModal, UiTable } from '@common/business_components/ui'; import { Button, TableHead, TableRow } from '@common/components/ui'; -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { untrtSwgRainCol3, untrtSwgRainCol4, untrtSwgRainCol5 } from '../common/table'; import { VerticalTable } from '@/components/ui/verticalTable'; -import LoadingOverlay from '@/components/ui/LoadingBar'; +import { getData } from "@/components/lib/api"; +import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue'; const inputColumn = [ { id: "prrtymngYn", title: "중점여부", type: "select", options: ["중점우수토실", "우수토실"] }, { id: "swtrmtZoneCd", title: "처리구역", type: "input" }, ]; -const Ssc = ({ featureData, isMainSsc, additionalData, onSaveClick }: { +const Ssc = ({ featureData, isMainSsc, rainMeasureData, onSaveClick }: { featureData: any, isMainSsc?: boolean, - additionalData?: any, + rainMeasureData?: any, onSaveClick?: () => void }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [isDataLoaded, setIsDataLoaded] = useState(false); const [formData, setFormData] = useState<any>({}); - console.log('featureData data received:', featureData); // 추가 데이터 확인용 - console.log('Additional data received:', additionalData); // 추가 데이터 확인용 + const [mntrngsData, setMntrngsData] = useState<any[]>(); // 수량/수질 측정 정보 + const [selectedRowIndex, setSelectedRowIndex] = useState<number>(-1); + + // console.log('featureData data received:', featureData); // 추가 데이터 확인용 + // console.log('rainMeasureData received:', rainMeasureData); // 추가 데이터 확인용 const openModal = () => { setIsModalOpen(true); @@ -54,17 +58,75 @@ const Ssc = ({ featureData, isMainSsc, additionalData, onSaveClick }: { } }; + // 테이블 셀 클릭 핸들러 추가 + const handleCellClick = async (index: number | undefined, headId: string) => { + if (index !== undefined && rainMeasureData) { + const data = await fetchMntrngsData(rainMeasureData[index].adstDstrCd, rainMeasureData[index].manageNo); + + setMntrngsData(data); + setSelectedRowIndex(index); + } + }; + + // 🎯 추가 데이터 API 호출 함수 (독립적으로 실행) + const fetchMntrngsData = useCallback(async (adstDstrCd: string, manageNo: string) => { + if (!adstDstrCd || !manageNo) { + console.warn('추가 데이터 호출 실패: 필수 매개변수 누락', { adstDstrCd, manageNo }); + return []; + } + + try { + const queryParams = new URLSearchParams({ + pageable: `{}`, + }); + + console.log(`SSC 추가 데이터 API 호출 시작: v1/onsemiro/swgRain?${queryParams.toString()}`); + + const result = await getData(`v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs?${queryParams.toString()}`); + + console.log('SSC 추가 데이터 API 호출 성공:', result); + + // 🎯 result가 페이지네이션 객체인 경우 content 배열 추출 + let dataArray: any[] = []; + if (result && typeof result === 'object' && 'content' in result && Array.isArray(result.content)) { + dataArray = result.content; + } else if (Array.isArray(result)) { + dataArray = result; + } else { + console.warn('예상치 못한 API 응답 형식:', result); + return []; + } + + // 🎯 각 아이템을 전처리하여 반환 + const processedDataArray = dataArray.map((data: any) => { + // 🎯 formatDisplayData로 기본 포맷팅 적용 + const formattedItem = formatDisplayData(data); + + // 🎯 추가 데이터 조합 + return { + ...formattedItem, + }; + }); + + console.log('processedDataArray', processedDataArray); + + return processedDataArray; + } catch (error) { + console.error('추가 데이터 로딩 실패:', error); + return []; + } + }, []); + const renderModalBody = () => ( <div className='grid grid-cols-1 gap-4 p-4'> {/* 강우정보 테이블 */} <UiTable headName='강우정보' - tableData={featureData} + tableData={Array.isArray(rainMeasureData) ? rainMeasureData : []} headlist={untrtSwgRainCol3} pageSize={10} - total={0} - children={undefined} - cellClick={undefined} + total={Array.isArray(rainMeasureData) ? rainMeasureData.length : 0} + cellClick={handleCellClick} onPageChange={function (page: number): void { console.log('Rain data page change:', page); }} @@ -73,14 +135,17 @@ const Ssc = ({ featureData, isMainSsc, additionalData, onSaveClick }: { {/* 측정정보 테이블 */} <UiTable headName='측정정보' - tableData={featureData} + tableData={Array.isArray(rainMeasureData) ? rainMeasureData : []} headlist={untrtSwgRainCol4} pageSize={10} - total={0} - cellClick={undefined} + total={Array.isArray(rainMeasureData) ? rainMeasureData.length : 0} + cellClick={handleCellClick} + // onPageChange={setCurPage} onPageChange={function (page: number): void { - console.log('Measure data page change:', page); + console.log('Rain data page change:', page); }} + resetPageNo={false} + // index={curPage} > {/* 커스텀 헤더 */} <TableRow> @@ -102,11 +167,10 @@ const Ssc = ({ featureData, isMainSsc, additionalData, onSaveClick }: { {/* 수량/수질측정 정보 테이블 */} <UiTable headName='수량/수질측정 정보' - tableData={additionalData} + tableData={Array.isArray(mntrngsData) ? mntrngsData : []} headlist={untrtSwgRainCol5} pageSize={10} - total={additionalData.length} - children={undefined} + total={Array.isArray(mntrngsData) ? mntrngsData.length : 0} cellClick={undefined} onPageChange={function (page: number): void { console.log('Quality data page change:', page); @@ -124,10 +188,9 @@ const Ssc = ({ featureData, isMainSsc, additionalData, onSaveClick }: { headlist={inputColumn} pageSize={0} total={0} - children={undefined} cellClick={undefined} isEditable={true} - onPageChange={function (page: number): void { + onPageChange={function (): void { throw new Error('Function not implemented.'); }} showSaveButton={true} diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index a3dfdce87..f3ff800f9 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -18,6 +18,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject<number[]>; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; const [layerNm, setLayerNm] = useState<string>(""); // 레이어 이름 상태 const [tableData, setTableData] = useState<any>(null); // 피처 데이터 + const [rainMeasureData, setRainMeasureData] = useState(false); // 강우/측정 측정 정보 const [mntrngsData, setMntrngsData] = useState(false); // 수량/수질 측정 정보 const [headlist, setHeadlist] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 const [headlist2, setHeadlist2] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 @@ -27,13 +28,10 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태 const [isMainSsc, setIsMainSsc] = useState(false); // 중점우수토실 여부 const [isDrtwSewagePump, setIsDrtwSewagePump] = useState(false); // 오수펌프장 여부 - const [isLoading, setIsLoading] = useState(false); - // 🎯 추가 데이터 로딩 상태 분리 - const [isAdditionalDataLoading, setIsAdditionalDataLoading] = useState(false); - const [additionalDataError, setAdditionalDataError] = useState<string | null>(null); // 🎯 InfilChart 및 RdiiChart 관련 상태 추가 const { setIsOpen: setIsModalInfil } = useInfilChartModalStore(); const { setIsOpen: setIsModalRdii } = useRdiiChartModalStore(); + const [curPage, setCurPage] = useState(1); // 현재 페이지 상태 // 🎯 관로관리번호 추출 const pplMngNo = featureData?.values_?.fclt_mng_no || ""; @@ -44,41 +42,13 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, : featureData.fid; console.log('featureId', featureId); - // 🎯 추가 데이터 API 호출 함수 (독립적으로 실행) - const fetchAdditionalData = useCallback(async (adstDstrCd: string, manageNo: string) => { - if (!adstDstrCd || !manageNo) { - console.warn('추가 데이터 호출 실패: 필수 매개변수 누락', { adstDstrCd, manageNo }); - return []; - } - - setIsAdditionalDataLoading(true); - setAdditionalDataError(null); - - try { - console.log(`추가 데이터 API 호출 시작: v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - - const result = getData(`v1/onsemiro/swgRain/${adstDstrCd}/${manageNo}/mntrngs`); - - console.log('추가 데이터 API 호출 성공:', result); - return result || []; - } catch (error) { - console.error('추가 데이터 로딩 실패:', error); - setAdditionalDataError(error instanceof Error ? error.message : '알 수 없는 오류'); - return []; - } finally { - setIsAdditionalDataLoading(false); - } - }, []); - // 🎯 데이터 전처리 메모이제이션 const processedData = useMemo(() => { if (!featureData?.values_) return null; - const data = featureData.values_; return { - ...data, - discharge_pipe_spec: `직경: ${data.pipe_diameter || '-'} / 높이: ${data.pipe_hg || '-'} / 길이: ${data.pipe_lt || '-'}`, - flwmtr_combined: `${data.flwmtr_mesure_tp_etc || '-'} / ${data.flwmtr_knd || '-'}` + ...featureData.values_, + discharge_pipe_spec: `직경: ${featureData.values_.pipe_diameter || '-'} / 높이: ${featureData.values_.pipe_hg || '-'} / 길이: ${featureData.values_.pipe_lt || '-'}` }; }, [featureData?.values_]); @@ -86,7 +56,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const getSelectedLayers = () => { let result = null; const layers = gisMap.getLayers().getArray(); // gisMap에서 모든 레이어 가져오기 - let featureLayer: { get: (key: string) => any } = { get: (key: string) => null }; // 피처가 속한 레이어를 찾기 위한 변수 + let featureLayer: { get: (key: string) => any }; // 피처가 속한 레이어를 찾기 위한 변수 layers.forEach((layer: any) => { const source = layer.getSource(); if (source && source.hasFeature && featureData @@ -148,7 +118,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setLayerNm(selectedLayerName); // 상태 업데이트 console.log('gis data', featureData.values_); - let data = featureData.values_; + const data = featureData.values_; // 하수맨홀인 경우 용도코드를 텍스트로 변환 if (selectedLayerName === '하수맨홀' && data) { @@ -162,7 +132,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, } // 🎯 기본 데이터 포맷팅 - let formattedData = formatDisplayData(data); + const formattedData = formatDisplayData(data); setfetchData(formattedData); setTableData(formattedData); @@ -187,18 +157,18 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setfetchData([processedFormattedData]) setTableData(processedFormattedData); - setIsLoading(false); // 기본 렌더링 완료 + // setIsLoading(false); // 기본 렌더링 완료 - // 수량/수질측정 정보 데이터 호출 - if (data?.adst_dstr_cd && data?.manage_no) { - fetchAdditionalData(data.adst_dstr_cd, data.manage_no) + // 강우/측정 정보 데이터 호출 + if (data?.chmbr_xcnts && data?.chmbr_ydnts) { + fetchRainMeasureData(data.chmbr_xcnts, data.chmbr_ydnts) .then(response => { console.log('additionalResponse', response); - setMntrngsData(response || []); + setRainMeasureData(response || []); }) .catch(error => { console.error('추가 데이터 로딩 실패:', error); - setMntrngsData(false); + setRainMeasureData(false); }); } break; @@ -231,7 +201,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, // API 엔드포인트 선택 let apiEndpoint = ''; - let getFeatureId = featureId.toString().split('.').pop() || null; + const getFeatureId = featureId.toString().split('.').pop() || null; if (selectedLayerName === '하수관로') apiEndpoint = `v1/fcltppl/${getFeatureId}`; else if (selectedLayerName === '우수토실') apiEndpoint = `v1/fcltstofcbr/${getFeatureId}`; else if (selectedLayerName === '오수펌프' || selectedLayerName === '빗물펌프') apiEndpoint = `v1/fcltpump/${getFeatureId}`; @@ -289,25 +259,75 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, fetchData(); }, [featureId, processedData]); + // 🎯 추가 데이터 API 호출 함수 (독립적으로 실행) + const fetchRainMeasureData = useCallback(async (chmbrXcnts: string, chmbrYdnts: string) => { + if (!chmbrXcnts || !chmbrYdnts) { + console.warn('추가 데이터 호출 실패: 필수 매개변수 누락', { chmbrXcnts, chmbrYdnts }); + return []; + } + + try { + const queryParams = new URLSearchParams({ + chmbrXcnts: chmbrXcnts, + chmbrYdnts: chmbrYdnts, + pageable: `{}`, + }); + + console.log(`추가 데이터 API 호출 시작: v1/onsemiro/getSwgRainsByGeomety?${queryParams.toString()}`); + + const result = await getData(`v1/onsemiro/getSwgRainsByGeomety?${queryParams.toString()}`); + + console.log('추가 데이터 API 호출 성공:', result); + + // 🎯 result가 페이지네이션 객체인 경우 content 배열 추출 + let dataArray: any[] = []; + if (result && typeof result === 'object' && 'content' in result && Array.isArray(result.content)) { + dataArray = result.content; + } else if (Array.isArray(result)) { + dataArray = result; + } else { + console.warn('예상치 못한 API 응답 형식:', result); + return []; + } + + // 🎯 각 아이템을 전처리하여 반환 + const processedDataArray = dataArray.map((data: any) => { + // 🎯 formatDisplayData로 기본 포맷팅 적용 + const formattedItem = formatDisplayData(data); + + // 🎯 추가 데이터 조합 + return { + ...formattedItem, + flwmtrCombined: `${data.flwmtrMesureTpEtc || '-'} / ${data.flwmtrKnd || '-'}`, + }; + }); + + return processedDataArray; + } catch (error) { + console.error('추가 데이터 로딩 실패:', error); + return []; + } + }, []); + // 🎯 추가 데이터는 별도 useEffect로 비동기 로딩 useEffect(() => { if (layerNm === '중점우수토실' && featureData?.values_) { const data = featureData.values_; - if (data?.adst_dstr_cd && data?.manage_no) { + if (data?.chmbr_xcnts && data?.chmbr_ydnts) { // 🎯 추가 데이터를 비동기로 로딩 (UI 블로킹 없음) - fetchAdditionalData(data.adst_dstr_cd, data.manage_no) + fetchRainMeasureData(data.chmbr_xcnts, data.chmbr_ydnts) .then(response => { console.log('추가 데이터 로딩 완료:', response); - setMntrngsData(response || []); + setRainMeasureData(response || []); }) .catch(error => { console.error('추가 데이터 최종 로딩 실패:', error); - setMntrngsData(false); + setRainMeasureData(false); }); } } - }, [layerNm, featureData?.values_, fetchAdditionalData]); + }, [layerNm, featureData?.values_, fetchRainMeasureData]); // 저장 시 모달 띄우기 const handleSaveClick = () => { @@ -434,9 +454,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, headlist={headlist} pageSize={20} total={0} - children={undefined} cellClick={undefined} - onPageChange={function (page: number): void { + onPageChange={function (): void { throw new Error("Function not implemented."); }} // 두 번째 테이블 조건부 props @@ -451,10 +470,10 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, <Modal isModalOpen={isModalOpen} title="자체입력정보 저장" setIsModalOpen={setIsModalOpen} closeModal={handleModalClose} saveModal={handleModalSave}><div className="text-lg">정보를 저장하시겠습니까?</div></Modal> {ContentComponent && <ContentComponent - featureData={fetchData} + featureData={tableData} isMainSsc={isMainSsc} isDrtwSewagePump={isDrtwSewagePump} - additionalData={mntrngsData} + rainMeasureData={rainMeasureData} onSaveClick={handleSaveClick} /> } diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index 2f8143409..abdad03bb 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -9,7 +9,7 @@ type UiTableProps = { headlist: UiHeadProps[]; pageSize: number; total: number; - children: Record<string, React.ReactNode> | undefined; + children?: Record<string, React.ReactNode> | undefined; cellClick: ((index: number | undefined, headId: string) => void) | undefined; onPageChange: (page: number) => void; className?: string; @@ -48,21 +48,12 @@ export function VerticalTable({ pageSize, total, children, - cellClick, onPageChange, className = "", resetPageNo = false, isEditable = false, tableName2, - tableData2, headlist2, - pageSize2, - total2, - children2, - cellClick2, - onPageChange2, - className2 = "", - resetPageNo2 = false, isEditable2 = false, showSecondTable = false, showSaveButton = false, From 980fffcd1936f93b7aad6635dd9d0a54d412d474 Mon Sep 17 00:00:00 2001 From: swcho <swcho@mind-one.co.kr> Date: Mon, 14 Jul 2025 20:54:11 +0900 Subject: [PATCH 258/259] =?UTF-8?q?feat:=20=EB=8B=A4=EB=A5=B8=20=EC=A4=91?= =?UTF-8?q?=EC=A0=90=20=EC=9A=B0=EC=88=98=ED=86=A0=EC=8B=A4=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=EC=8B=9C=20=EC=88=98=EB=9F=89/=EC=88=98=EC=A7=88?= =?UTF-8?q?=EC=B8=A1=EC=A0=95=20=EC=A0=95=EB=B3=B4=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(map-layout)/map/components/popupComponent/Ssc.tsx | 3 ++- apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx index 76c6d806e..8eb1b23bf 100644 --- a/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx +++ b/apps/sn/app/(map-layout)/map/components/popupComponent/Ssc.tsx @@ -21,7 +21,7 @@ const Ssc = ({ featureData, isMainSsc, rainMeasureData, onSaveClick }: { const [isModalOpen, setIsModalOpen] = useState(false); const [isDataLoaded, setIsDataLoaded] = useState(false); const [formData, setFormData] = useState<any>({}); - const [mntrngsData, setMntrngsData] = useState<any[]>(); // 수량/수질 측정 정보 + const [mntrngsData, setMntrngsData] = useState<any[]>([]); // 수량/수질 측정 정보 const [selectedRowIndex, setSelectedRowIndex] = useState<number>(-1); // console.log('featureData data received:', featureData); // 추가 데이터 확인용 @@ -42,6 +42,7 @@ const Ssc = ({ featureData, isMainSsc, rainMeasureData, onSaveClick }: { useEffect(() => { if (featureData) { setFormData(featureData); + setMntrngsData([]); } }, [featureData]); diff --git a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx index f3ff800f9..e2cfa0115 100644 --- a/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx +++ b/apps/sn/app/(map-layout)/map/featureClickEventPopup.tsx @@ -18,8 +18,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject<number[]>; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; }; const [layerNm, setLayerNm] = useState<string>(""); // 레이어 이름 상태 const [tableData, setTableData] = useState<any>(null); // 피처 데이터 - const [rainMeasureData, setRainMeasureData] = useState(false); // 강우/측정 측정 정보 - const [mntrngsData, setMntrngsData] = useState(false); // 수량/수질 측정 정보 + const [rainMeasureData, setRainMeasureData] = useState<any[]>([]); // 강우/측정 측정 정보 const [headlist, setHeadlist] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 const [headlist2, setHeadlist2] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태 const [buttonChk, setButtonChk] = useState(true) @@ -151,7 +150,6 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, setHeadlist2(untrtSwgRainCol2) setButtonChk(false) setIsMainSsc(true) - // 🎯 processedData도 포맷팅하여 설정 const processedFormattedData = formatDisplayData(processedData); @@ -250,7 +248,6 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, console.error('API 데이터 로딩 중 오류:', apiError); } } - console.log('mntrngsData', mntrngsData); } catch (error) { console.error('데이터 로딩 중 오류:', error); } From 80d0c5ee0138e06ae150dc8914e13d239545bea2 Mon Sep 17 00:00:00 2001 From: yschoi <yschoi> Date: Tue, 15 Jul 2025 10:40:33 +0900 Subject: [PATCH 259/259] =?UTF-8?q?=EC=9A=B4=EC=98=81=20=ED=99=98=EA=B2=B0?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/.env.production | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sn/.env.production b/apps/sn/.env.production index 9300c5ae3..0e7f34cb7 100644 --- a/apps/sn/.env.production +++ b/apps/sn/.env.production @@ -3,8 +3,8 @@ NEXT_PUBLIC_PORT = 11302 NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302 NEXT_PUBLIC_ADDR_URL = http://con.mind-one.co.kr:11082 NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver -NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함 +NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver +NEXT_PUBLIC_LX_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver_swl NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com #자료관 데이터 NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id