From 90ebabd5bd69d6ba57f4fa9d95e17dc8bf45fa86 Mon Sep 17 00:00:00 2001 From: bicochan Date: Thu, 5 Mar 2026 17:47:59 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[st]=20feat:=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EB=8C=80=EC=83=81=20=EB=AA=A9=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 --- .../verification/HbStatisticsVerification.tsx | 205 ++++++++++-------- .../verification-target-management-service.ts | 13 ++ ...erification-target-management-interface.ts | 8 + 3 files changed, 141 insertions(+), 85 deletions(-) diff --git a/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx b/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx index e89bc81e8..f8bca9890 100644 --- a/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx +++ b/apps/st/src/components/statistics/verification/HbStatisticsVerification.tsx @@ -49,7 +49,9 @@ import type { } from "@/entities/statistics/model/analysis-history-interface"; import { ENDPOINT } from "@/shared/config"; import { useAlertStore } from "@/shared/lib"; -import { CodeApi } from "@/entities/code"; +import { verificationTargetManagementApi } from "@/entities/statistics/api/verification-target-management-service"; +import type { VerificationTargetCodeResponse } from "@/entities/statistics/model/verification-target-management-interface"; +import { CodeSelect } from "@/entities/code"; type DateRangeValue = { from?: Date; @@ -78,7 +80,7 @@ function getDefaultHistoryDateRange(): DateRangeValue { } function getVerificationYearOptions(): string[] { - const currentYear = new Date().getFullYear(); + const currentYear = dayjs().year(); const startYear = 2017; const endYear = currentYear - 1; if (endYear < startYear) return []; @@ -116,6 +118,7 @@ const HbStatisticsVerification = () => { open: false, anlsSn: null, }); + const [selectedStatsCd, setSelectedStatsCd] = useState(""); const defaultHistoryDateRange = useMemo( () => getDefaultHistoryDateRange(), @@ -133,14 +136,22 @@ const HbStatisticsVerification = () => { pageSize: 10, }); - const { data: statsItemList } = useQuery({ - queryKey: [ENDPOINT.CMS_SERVICE.CODE, "STITEM"], - queryFn: async () => { - const response = await CodeApi.getCode("STITEM"); - return response; - }, + const { data: verificationTargetCodes } = useQuery< + VerificationTargetCodeResponse[] + >({ + queryKey: [ENDPOINT.STATVERIFY_SERVICE.VRFCTGT_MNG, "codes"], + queryFn: () => + verificationTargetManagementApi.getVerificationTargetCodes(), }); + const filteredVerificationTargetCodes = useMemo(() => { + return verificationTargetCodes?.filter((item) => + selectedStatsCd + ? item.vrfcTrgtSn.startsWith(selectedStatsCd) + : true, + ); + }, [verificationTargetCodes, selectedStatsCd]); + const { data: analysisHistory } = useQuery({ queryKey: [ ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST, @@ -329,26 +340,50 @@ const HbStatisticsVerification = () => {
{/* 검증 종류 선택 */}
-
- - 검증 방식 - - - setVerifyType(value as VerifyType) - } - className="flex items-center gap-4" - > - - - +
+
+ + +
+
+ + + setVerifyType(value as VerifyType) + } + className="flex items-center gap-4" + > + + + +
+
+
{verifyType === "SELECT" && - statsItemList && - statsItemList.length > 0 && ( -
- {statsItemList.map((item) => ( + filteredVerificationTargetCodes && + filteredVerificationTargetCodes.length > 0 ? ( +
+ {filteredVerificationTargetCodes.map( + (item) => (
handleTargetToggle( - item.lwpoCd, + item.vrfcTrgtSn, ) } />
- ))} -
- )} + ), + )} +
+ ) : ( +
+

+ 검증 대상이 없습니다. +

+
+ )}
{/* //검증 대상 */} @@ -482,35 +544,6 @@ const HbStatisticsVerification = () => { className="flex-1" />
- -
- - -
{/* //검증 변수 */} @@ -519,21 +552,23 @@ const HbStatisticsVerification = () => {
-

+

검증 이력

-
- - 검증일시 - - - setHistoryDateRange((value as any) ?? undefined) - } - className="max-w-[26rem]" - /> +
+
+ + 검증일시 + + + setHistoryDateRange((value as any) ?? undefined) + } + className="max-w-[26rem]" + /> +
-
+
-
-

+
+

검증 이력

@@ -625,57 +640,58 @@ const HbStatisticsVerification = () => { {item.vrfcTrgtNm} + + + 시도 + + + 시군구 + + + 행정구역 + + + 시설명 + + + 입력값 + + - {Array.from({ - length: Math.ceil( - item.outlierDataList - .length / 4, + {item.outlierDataList.map( + (data) => ( + + + {data.sido ?? "-"} + + + {data.gugun ?? "-"} + + + {data.adstDong ?? + "-"} + + + {/* 시설명: DTO에 해당 필드 없음 */} + - + + + {data.cryrVl != null + ? String( + data.cryrVl, + ) + : "-"} + + ), - }).map((_, rowIdx) => ( - - {item.outlierDataList - .slice( - rowIdx * 4, - rowIdx * 4 + 4, - ) - .map((data) => ( - - {`${data.sido ?? ""}${data.adstDong ? ` ${data.adstDong}` : ""}`.trim() || - "-"} - - ))} - {/* 빈 셀 추가 */} - {item.outlierDataList.slice( - rowIdx * 4, - rowIdx * 4 + 4, - ).length < 4 && - Array.from({ - length: - 4 - - item.outlierDataList.slice( - rowIdx * 4, - rowIdx * 4 + - 4, - ).length, - }).map((_, idx) => ( - - ))} - - ))} + )} ),