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 = ({ // 검색 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 = ({ {/* 분기처리: 하수펌프장 */} {(basicType === "tb_ms_swage_psmtn_1" || basicType === "tb_ms_swage_psmtn_2") && ( -
- {/* 설치년도 */} -
- setYearFilter({ ...yearFilter, 시작: range.start, 종료: range.end })} - startLabel="설치년도" - endLabel="" - /> - {/* 경과년도 */} - - { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ''); - setYearFilter({ ...yearFilter, 경과년도: val }); - }} - /> +
+ {/* 설치년도 */} +
+ setYearFilter({ ...yearFilter, 시작: range.start, 종료: range.end })} + startLabel="설치년도" + endLabel="" + /> + {/* 경과년도 */} + + { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ''); + setYearFilter({ ...yearFilter, 경과년도: val }); + }} + /> +
+
+ {/* 일일처리용량 - 오수맨홀 */} + + { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set시작1(val); + }} + /> + ~ + { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set종료1(val); + }} + /> + {/* 우수양수능력 - 우수맨홀 */} + + { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set시작2(val); + }} + /> + ~ + { + // 숫자만 입력 허용 + const val = e.target.value.replace(/[^0-9]/g, ""); + set종료2(val); + }} + /> +
-
- {/* 일일처리용량 - 오수맨홀 */} - - { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set시작1(val); - }} - /> - ~ - { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set종료1(val); - }} - /> - {/* 우수양수능력 - 우수맨홀 */} - - { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set시작2(val); - }} - /> - ~ - { - // 숫자만 입력 허용 - const val = e.target.value.replace(/[^0-9]/g, ""); - set종료2(val); - }} - /> -
-
- )} + )} {/* 분기처리: 우수토실? 토구? */} {basicType === "tb_ms_otfl" && (
@@ -981,20 +981,20 @@ const SearchModal: React.FC = ({ /> {/* 설치년도 */} - - setYearFilter({ - ...yearFilter, - 시작: range.start, - 종료: range.end, - }) - } - startLabel="설치년도" - endLabel="" - /> -
+ + setYearFilter({ + ...yearFilter, + 시작: range.start, + 종료: range.end, + }) + } + startLabel="설치년도" + endLabel="" + /> +
{/* 경과년도 */}
-
- {/* 조회 버튼 중앙 정렬 */} -
-
+
+ {/* 조회 버튼 중앙 정렬 */} +
+ +
)} {/* 하수도정비기본계획보고서 탭 */} @@ -1026,9 +1026,9 @@ const SearchModal: React.FC = ({ sido={시도} sigungu={시군구} onSidoChange={(sidoId) => { - set시도(sidoId); - set시군구(0); - }} + set시도(sidoId); + set시군구(0); + }} onSigunguChange={set시군구} /> @@ -1071,28 +1071,28 @@ const SearchModal: React.FC = ({ {/* 📋 결과 리스트 */}
- {/* 테이블 영역 (가로/세로 스크롤 가능) */} -
- - { - 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})건 - - ); - })() - } + {/* 테이블 영역 (가로/세로 스크롤 가능) */} +
+ + { + 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 = ({ resetPageNo={false} cur={curPage} /> +
-
); 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 = ({ title, data, sectionKey, onInputChange }) => { - return ( -
- {/* 섹션 제목 */} -
-

{title}

-
- {/* 테이블 */} -
- - - - 년도 - 구분 - - - - {data.map((row, index) => ( - - - 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" - /> - - - {row.type} - - - ))} - -
-
-
- ); + return ( +
+ {/* 섹션 제목 */} +
+

{title}

+
+ {/* 테이블 */} +
+ + + + 년도 + 구분 + + + + {data.map((row, index) => ( + + + 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" + /> + + + {row.type} + + + ))} + +
+
+
+ ); }; 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; - props?: any; - }; + [key: string]: { + component?: React.FC; + 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 | 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>; - }; - } + index: number, + field: string, + value: string, + dataMap: { + [key: string]: { + data: { year: string; type: string }[]; + setData: React.Dispatch>; + }; + } ) => { - 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(""); - const openModal = (e: React.MouseEvent) => { - 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(""); + const openModal = (e: React.MouseEvent) => { + 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 ( -
- - handleInputChange(section, index, field, value, dataMap)} /> - handleInputChange(section, index, field, value, dataMap)} /> - handleInputChange(section, index, field, value, dataMap)} /> -
- - -
- -
- ) + return ( +
+ + handleInputChange(section, index, field, value, dataMap)} /> + handleInputChange(section, index, field, value, dataMap)} /> + handleInputChange(section, index, field, value, dataMap)} /> +
+ + +
+ +
+ ) } 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()} /> } 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(''); - 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."); - }}> - -
- -
-
+ 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."); + }}> + +
+
- ) +
+
+ ) } 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(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(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) 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 ( - - {/* 분석 입력현황 조회 */} -
-
- + 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}`; + }; + return ( + + {/* 분석 입력현황 조회 */} +
+
+ - {/* 침입수량 분석결과 */} -
- 침입수량 분석결과 -
- 120 - m³/d -
-
-
- {/* 차트 */} -
- -
+ {/* 침입수량 분석결과 */} +
+ 침입수량 분석결과 +
+ 120 + m³/d
- {popupOpen && ( -
-
분석 입력현황
-
-
상수사용량 정보:
-
- -
-
오수 전환율:
-
- -
-
수용가-맨홀 매칭:
-
- -
-
관망도 자료:
-
- -
- {btnTxt === 'RDII' ? <>
강우 자료:
-
- -
-
RTX 계수 출처:
-
- -
- : null} -
-
- - -
-
- )} - - ) +
+
+ {/* 차트 */} +
+ +
+
+ {popupOpen && ( +
+
분석 입력현황
+
+
상수사용량 정보:
+
+ +
+
오수 전환율:
+
+ +
+
수용가-맨홀 매칭:
+
+ +
+
관망도 자료:
+
+ +
+ {btnTxt === 'RDII' ? <>
강우 자료:
+
+ +
+
RTX 계수 출처:
+
+ +
+ : null} +
+
+ + +
+
+ )} + + ) } 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 (
-
+ throw new Error('Function not implemented.'); + }} /> +
) } 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 ( -
- + -
+ }}> +
) } 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 }) => { const validKey = inputColumn.map((item) => item.id); - const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record, [key, value]) => {obj[key] = value; return obj;}, {}); + const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record, [key, value]) => { obj[key] = value; return obj; }, {}); return (
-
+ 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 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; 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 { 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 '하수처리시설': - 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 = {} - 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 ( -