From 8fa00797c8dd4035999c4de4474eed697b7f5f97 Mon Sep 17 00:00:00 2001 From: rsone001 Date: Fri, 20 Feb 2026 16:10:39 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20tab=20key=20=EC=A7=80=EC=A0=95?= =?UTF-8?q?=EB=90=9C=20=EC=BD=94=EB=93=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 --- .../statistics/review/SewagePipeMaintainRvw.tsx | 16 +++++++--------- .../statistics/review/SewagePipeRvw.tsx | 16 ++++++++-------- .../statistics/review/SewageReservoirPumpRvw.tsx | 13 +++++-------- .../column/review/SewagePipeMaintainRvwColumn.ts | 4 ++-- .../util/column/review/SewagePipeRvwColumn.ts | 8 ++++---- .../review/SewageReservoirPumpRvwColumn.ts | 4 ++-- 6 files changed, 28 insertions(+), 33 deletions(-) diff --git a/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx b/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx index f2da6cce4..272ae04f1 100644 --- a/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx +++ b/apps/st/src/components/statistics/review/SewagePipeMaintainRvw.tsx @@ -19,7 +19,7 @@ const SewagePipeMaintainRvw = () => { const { setMessage: alert } = useAlertStore((state) => state); const [rowDataMap, setRowDataMap] = useState[]>>(new Map()); const [isLoading, setIsLoading] = useState(false); - const [activeTab, setActiveTab] = useState('a'); + const [activeTab, setActiveTab] = useState('ST00030001'); const searchParamRef = useRef(null); @@ -36,7 +36,7 @@ const SewagePipeMaintainRvw = () => { const handleReset = () => { setRowDataMap(new Map()); - setActiveTab('a'); + setActiveTab('ST00030001'); searchParamRef.current = null; }; @@ -46,7 +46,7 @@ const SewagePipeMaintainRvw = () => { return; } - setActiveTab('a'); + setActiveTab('ST00030001'); setRowDataMap(new Map()); try { @@ -65,12 +65,11 @@ const SewagePipeMaintainRvw = () => { if (response?.status === 'success' && response.data) { const newRowDataMap = new Map[]>(); - // API 응답이 배열을 직접 반환하는 경우와 객체로 감싸진 경우 모두 처리 const listData = Array.isArray(response.data) ? response.data : (response.data.mtcStatusList || []); - newRowDataMap.set('a', toGridRows(listData as object[])); + newRowDataMap.set('ST00030001', toGridRows(listData as object[])); setRowDataMap(newRowDataMap); } else { alert(response?.message || "데이터가 없습니다."); @@ -85,7 +84,7 @@ const SewagePipeMaintainRvw = () => { const handleActiveTabChange = async (tabKey: string) => { setActiveTab(tabKey); - const existingAData = rowDataMap.get('a'); + const existingAData = rowDataMap.get('ST00030001'); const activeTabData = rowDataMap.get(tabKey); const hasAData = Array.isArray(existingAData) && existingAData.length > 0; @@ -97,9 +96,9 @@ const SewagePipeMaintainRvw = () => { let response; - if (tabKey === 'a') { + if (tabKey === 'ST00030001') { response = await statisticsManagementApi.getSewerPipeMtcList(searchParamRef.current); - }else if (tabKey === 'b') { + }else if (tabKey === 'ST00030002') { response = await statisticsManagementApi.getSewerPipeDrdgList(searchParamRef.current); } @@ -107,7 +106,6 @@ const SewagePipeMaintainRvw = () => { setRowDataMap(prev => { const next = new Map(prev); - // API 응답이 배열을 직접 반환하는 경우와 객체로 감싸진 경우 모두 처리 const listData = Array.isArray(response.data) ? response.data : (response.data.mtcStatusList || []); diff --git a/apps/st/src/components/statistics/review/SewagePipeRvw.tsx b/apps/st/src/components/statistics/review/SewagePipeRvw.tsx index ac7033e53..94b79dfb0 100644 --- a/apps/st/src/components/statistics/review/SewagePipeRvw.tsx +++ b/apps/st/src/components/statistics/review/SewagePipeRvw.tsx @@ -19,7 +19,7 @@ const SewagePipeRvw = () => { const { setMessage: alert } = useAlertStore((state) => state); const [rowDataMap, setRowDataMap] = useState[]>>(new Map()); const [isLoading, setIsLoading] = useState(false); - const [activeTab, setActiveTab] = useState('a'); + const [activeTab, setActiveTab] = useState('ST00020001'); const searchParamRef = useRef(null); @@ -36,7 +36,7 @@ const SewagePipeRvw = () => { const handleReset = () => { setRowDataMap(new Map()); - setActiveTab('a'); + setActiveTab('ST00020001'); }; const handleSearch = async (values: SearchFormValues) => { @@ -45,7 +45,7 @@ const SewagePipeRvw = () => { return; } - setActiveTab('a'); + setActiveTab('ST00020001'); setRowDataMap(new Map()); @@ -64,7 +64,7 @@ const SewagePipeRvw = () => { if (response?.status === 'success' && response.data) { const newRowDataMap = new Map[]>(); - newRowDataMap.set('a', toGridRows(response.data as object[])); + newRowDataMap.set('ST00020001', toGridRows(response.data as object[])); setRowDataMap(newRowDataMap); } else { alert(response?.message || "데이터가 없습니다."); @@ -79,7 +79,7 @@ const SewagePipeRvw = () => { const handleActiveTabChange = async (tabKey: string) => { setActiveTab(tabKey); - const existingAData = rowDataMap.get('a'); + const existingAData = rowDataMap.get('ST00020001'); const activeTabData = rowDataMap.get(tabKey); const hasAData = Array.isArray(existingAData) && existingAData.length > 0; @@ -92,11 +92,11 @@ const SewagePipeRvw = () => { let response; - if (tabKey === 'b') { + if (tabKey === 'ST00020002') { response = await statisticsManagementApi.getSewagePipeFacilityList(searchParamRef.current); - }else if(tabKey === 'c'){ + }else if(tabKey === 'ST00020003'){ response = await statisticsManagementApi.getSewagePipeTypeList(searchParamRef.current); - }else if(tabKey === 'd'){ + }else if(tabKey === 'ST00020004'){ response = await statisticsManagementApi.getSewagePipeDiamList(searchParamRef.current); } diff --git a/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx b/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx index 3b7645a4e..346edb0cd 100644 --- a/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx +++ b/apps/st/src/components/statistics/review/SewageReservoirPumpRvw.tsx @@ -23,7 +23,7 @@ const SewageReservoirPumpRvw = () => { const { setMessage: alert } = useAlertStore((state) => state); const [rowDataMap, setRowDataMap] = useState[]>>(new Map()); const [isLoading, setIsLoading] = useState(false); - const [activeTab, setActiveTab] = useState('a'); + const [activeTab, setActiveTab] = useState('ST00040001'); const searchParamRef = useRef(null); @@ -40,18 +40,17 @@ const SewageReservoirPumpRvw = () => { const handleReset = () => { setRowDataMap(new Map()); - setActiveTab('a'); + setActiveTab('ST00040001'); searchParamRef.current = null; }; - // 조회 버튼 클릭 시: Tab A(하수저류시설) 데이터 로드 const handleSearch = async (values: SearchFormValues) => { if (!values.sido || values.sido === 'ALL') { alert('시도를 선택해주세요.'); return; } - setActiveTab('a'); + setActiveTab('ST00040001'); setRowDataMap(new Map()); try { @@ -71,7 +70,7 @@ const SewageReservoirPumpRvw = () => { if (response?.status === 'success' && response.data) { const newRowDataMap = new Map[]>(); - newRowDataMap.set('a', toGridRows(response.data as object[])); + newRowDataMap.set('ST00040001', toGridRows(response.data as object[])); setRowDataMap(newRowDataMap); } else { alert(response?.message || "데이터가 없습니다."); @@ -83,20 +82,18 @@ const SewageReservoirPumpRvw = () => { } }; - // 탭 전환 시: 데이터가 없는 경우 지연 로딩 (Tab B: 빗물펌프장) const handleActiveTabChange = async (tabKey: string) => { setActiveTab(tabKey); const activeTabData = rowDataMap.get(tabKey); const hasActiveTabData = Array.isArray(activeTabData) && activeTabData.length > 0; - // 메인 데이터(Tab A)가 있고, 현재 탭 데이터가 없을 때만 API 호출 if (searchParamRef.current && !hasActiveTabData) { try { setIsLoading(true); let response; - if (tabKey === 'b') { + if (tabKey === 'ST00040002') { response = await statisticsManagementApi.getPumpStationList(searchParamRef.current); } diff --git a/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts b/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts index f0ca4e7bc..aaf2bed67 100644 --- a/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts +++ b/apps/st/src/components/util/column/review/SewagePipeMaintainRvwColumn.ts @@ -5,7 +5,7 @@ import type { GridView, DataColumn, ColumnFooter } from "@/components/type/DataG // 하수도 통계 관리 03. 하수관로 유지 관리 const rawMaintainList = [ { - tabKey: 'a', + tabKey: 'ST00030001', tabLabel: '개보수', rowStartNum: 4, fixedColumns: 2, @@ -152,7 +152,7 @@ const rawMaintainList = [ ] }, { - tabKey: 'b', + tabKey: 'ST00030002', tabLabel: '관로준설', rowStartNum: 4, fixedColumns: 2, diff --git a/apps/st/src/components/util/column/review/SewagePipeRvwColumn.ts b/apps/st/src/components/util/column/review/SewagePipeRvwColumn.ts index 4cc605836..93f52068f 100644 --- a/apps/st/src/components/util/column/review/SewagePipeRvwColumn.ts +++ b/apps/st/src/components/util/column/review/SewagePipeRvwColumn.ts @@ -6,7 +6,7 @@ import type { GridView, DataColumn, ColumnFooter } from "@/components/type/DataG // 하수도 통계 관리 02. 하수관로 const rawList = [ { - tabKey: 'a', + tabKey: 'ST00020001', tabLabel: '지역별 시설현황', rowStartNum: 4, fixedColumns: 2, @@ -185,7 +185,7 @@ const rawList = [ ] }, { - tabKey: 'b', + tabKey: 'ST00020002', tabLabel: '시설별 설치현황', rowStartNum: 4, fixedColumns: 3, @@ -348,7 +348,7 @@ const rawList = [ ] }, { - tabKey: 'c', + tabKey: 'ST00020003', tabLabel: '관종별 현황', rowStartNum: 2, fixedColumns: 3, @@ -472,7 +472,7 @@ const rawList = [ ] }, { - tabKey: 'd', + tabKey: 'ST00020004', tabLabel: '관경별 현황', rowStartNum: 2, fixedColumns: 3, diff --git a/apps/st/src/components/util/column/review/SewageReservoirPumpRvwColumn.ts b/apps/st/src/components/util/column/review/SewageReservoirPumpRvwColumn.ts index ded536777..415d2896f 100644 --- a/apps/st/src/components/util/column/review/SewageReservoirPumpRvwColumn.ts +++ b/apps/st/src/components/util/column/review/SewageReservoirPumpRvwColumn.ts @@ -10,7 +10,7 @@ import type { GridView, DataColumn, ColumnFooter } from "@/components/type/DataG // 하수도 통계 관리 04. 하수저류 시설 및 빗물 펌프장 const rawReservoirList = [ { - tabKey: 'a', + tabKey: 'ST00040001', tabLabel: '하수저류시설현황', rowStartNum: 3, fixedColumns: 2, @@ -176,7 +176,7 @@ const rawReservoirList = [ ] }, { - tabKey: 'b', + tabKey: 'ST00040002', tabLabel: '빗물펌프장', rowStartNum: 3, fixedColumns: 2,