From 4610f671b11f8b79268656f9ebd11e25595b4fe3 Mon Sep 17 00:00:00 2001 From: swcho Date: Thu, 18 Sep 2025 18:15:46 +0900 Subject: [PATCH] =?UTF-8?q?fix,=20refactor:=20-=20=ED=95=98=EC=88=98?= =?UTF-8?q?=EB=8F=84=EC=A0=95=EB=B9=84=EA=B8=B0=EB=B3=B8=EA=B3=84=ED=9A=8D?= =?UTF-8?q?=EB=B3=B4=EA=B3=A0=EC=84=9C=20=EB=AA=A8=EB=8B=AC=20=ED=91=9C?= =?UTF-8?q?=EC=B6=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95=20-=20impor?= =?UTF-8?q?t=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 --- .../map/searchModal/reportTab.tsx | 23 +++++++++++++++---- .../map/searchModal/useBasicTab.ts | 6 ++--- .../map/searchModal/useReportTab.ts | 2 +- apps/sn/app/store/useReportTabStore.ts | 10 +++++++- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/searchModal/reportTab.tsx b/apps/sn/app/(map-layout)/map/searchModal/reportTab.tsx index e57a1a222..0817cc422 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/reportTab.tsx +++ b/apps/sn/app/(map-layout)/map/searchModal/reportTab.tsx @@ -23,6 +23,7 @@ import LoadingOverlay from '@/components/ui/LoadingBar'; import useReportTab from './useReportTab'; import useStore from '@/store/useStore'; import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox'; +import useSearchModalStore from '@/store/useSearchModalStore'; import { useReportTabStore } from '@/store/useReportTabStore'; import ReportFilesModal from './reportFilesModal'; // 파일목록모달 @@ -47,19 +48,31 @@ interface ReportTabProps { const ReportTab: React.FC = ({ open, isSearch = true, ctpvNm, sggNm }) => { - const [isLoading, setIsLoading] = useState(false); + // const [isLoading, setIsLoading] = useState(false); const [isResetPage, setIsResetPage] = useState(false); const [isResetSelection, setIsResetSelection] = useState(false); const [showTable, setShowTable] = useState(false); - const [tableData, setTableData] = useState([]); - const [tableCount, setTableCount] = useState(0); - const [curPage, setCurPage] = useState(1); - const [yearFilter, setYearFilter] = useState({ start: "", end: "" }); + // const [tableData, setTableData] = useState([]); + // const [tableCount, setTableCount] = useState(0); + // const [curPage, setCurPage] = useState(1); + // const [yearFilter, setYearFilter] = useState({ start: "", end: "" }); const [ctpvCd, setCtpvCd] = useState('0'); const [sggCd, setSggCd] = useState('0'); const [reportGubun, setReportGubun] = useState("0"); const [clsfSystmSn, setClsfSystmSn] = useState(''); // 자료관 기본계획 일련번호 + const { + tableData, + tableCount, + isLoading, + yearFilter, + curPage, + setTableData, + setTableCount, + setIsLoading, + setYearFilter, + setCurPage + } = useSearchModalStore(); const { ctpv, sgg } = useStore(); const { isOpen: isReportFilesModalOpen, diff --git a/apps/sn/app/(map-layout)/map/searchModal/useBasicTab.ts b/apps/sn/app/(map-layout)/map/searchModal/useBasicTab.ts index 3c7c9409d..9177ddee5 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/useBasicTab.ts +++ b/apps/sn/app/(map-layout)/map/searchModal/useBasicTab.ts @@ -12,9 +12,7 @@ * 🔗 사용 API * - 시설물 조회: GET /v1/fclts (sewerage-service) */ -import { useEffect, useState } from 'react'; import { downloadExcelWithKoreanHeaders } from '@common/business_components/ui'; -import axios from 'axios'; import { MS_SWAGE_PPL_USE_CODES, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES, MsSwagePplExcelCol, SwtrmtFcltExcelCol, SwtrmtPrcsZoneExcelCol, MsSwageMhlExcelCol, ExclnSewagePumpExcelCol, stofcbrExcelCol @@ -22,11 +20,11 @@ import { import { getData } from "@/components/lib/api"; import { BASIC_TYPES } from './basicTab'; import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue'; -import useStore from '../../../store/useStore'; +import useStore from '@/store/useStore'; import GisApp from "@common/business_components/ui/map/lib/gis.core"; import { confirmToast } from '@/components/ui/toast' import { toast } from "react-hot-toast"; -import useSearchModalStore from '../../../store/useSearchModalStore'; +import useSearchModalStore from '@/store/useSearchModalStore'; import { swagePplCqlFilters } from './swagePpl'; import { swagePrcsFcltCqlFilters } from './swagePrcsFclt'; import { swagePrcsZoneCqlFilters } from './swagePrcsZone'; diff --git a/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts b/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts index 0ebb6fd13..0eea86286 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts +++ b/apps/sn/app/(map-layout)/map/searchModal/useReportTab.ts @@ -16,7 +16,7 @@ import { getDcData } from '@/components/lib/api'; import { fileDownload } from '@/utils'; import { useReportTabStore } from '@/store/useReportTabStore'; -import useSearchModalStore from '@/app/store/useSearchModalStore'; +import useSearchModalStore from '@/store/useSearchModalStore'; export type Folder = { clsfSystmSn: string; diff --git a/apps/sn/app/store/useReportTabStore.ts b/apps/sn/app/store/useReportTabStore.ts index f0ac88002..1c72db6ee 100644 --- a/apps/sn/app/store/useReportTabStore.ts +++ b/apps/sn/app/store/useReportTabStore.ts @@ -44,7 +44,15 @@ export const useReportTabStore = create((set, get) => ({ } }, fetchDcFiles: async (clsfSystmNm: string) => { - const { getDcFiles } = useReportTab(); + const getDcFiles = async (clsfSystmSn: string): Promise => { + if (!clsfSystmSn) { + console.error("clsfSystmSn is required to get files."); + return []; + } + const queryString = 'clsfSystmSn=' + clsfSystmSn; + const result = await getDcData(`/api/v1/dc/file${queryString ? `?${queryString}` : ''}`); + return result; + }; const { dcFiles } = get(); try { const result = await getDcFiles(clsfSystmNm);