diff --git a/apps/st/src/components/module/VerificationResultHistoryDialog.tsx b/apps/st/src/components/module/VerificationResultHistoryDialog.tsx index b8ec4a44b..958ccf40d 100644 --- a/apps/st/src/components/module/VerificationResultHistoryDialog.tsx +++ b/apps/st/src/components/module/VerificationResultHistoryDialog.tsx @@ -141,6 +141,7 @@ const verificationResultColumnInfo: ColumnInfo = { columns: [ { name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false }, { name: "admdstNm", fieldName: "admdstNm", header: { text: "행정구역" }, editable: false }, + { name: "fcltNm", fieldName: "fcltNm", header: { text: "시설명" }, editable: false }, { name: "vrfcTrgtNm", fieldName: "vrfcTrgtNm", header: { text: "검증대상" }, editable: false }, { name: "rsnExpln", fieldName: "rsnExpln", header: { text: "사유" }, editable: false }, { name: "nowVlCn", fieldName: "nowVlCn", header: { text: "입력값" }, editable: false }, @@ -157,6 +158,7 @@ const verificationResultColumnInfo: ColumnInfo = { columnLayout: [ "ctpvNm", "admdstNm", + "fcltNm", "vrfcTrgtNm", "rsnExpln", "nowVlCn", @@ -178,7 +180,7 @@ export interface VerificationResultHistoryDialogProps { queryContext?: { sewerBzmnCd: string; ctpvNm: string; - sggNm: string; + sggNm?: string; statsYr: string; statsCd: string; } | null; @@ -378,8 +380,9 @@ export function VerificationResultHistoryDialog({ return { vrfcSn: item.vrfcSn, __checked: isChecked ? 1 : 0, - ctpvNm: item.ctpvNm, + ctpvNm: item.ctpvNm ?? "-", admdstNm: item.admdstNm ?? item.sggNm ?? "-", + fcltNm: item.fcltNm ?? "-", vrfcTrgtNm: item.vrfcTrgtNm, rsnExpln: item.rsnExpln, nowVlCn: item.nowVlCn ?? "-", @@ -562,7 +565,7 @@ export function VerificationResultHistoryDialog({ - {`${title} - ${queryContext?.statsYr} ${queryContext?.ctpvNm} ${queryContext?.sggNm}`} + {`${title} - ${queryContext?.statsYr} ${queryContext?.ctpvNm} ${queryContext?.sggNm ? queryContext?.sggNm : ''}`}
{errorMessage && ( diff --git a/apps/st/src/components/statistics/verification/generalVerification/DetailComponent.tsx b/apps/st/src/components/statistics/verification/generalVerification/DetailComponent.tsx index 97953a441..4f0d3781b 100644 --- a/apps/st/src/components/statistics/verification/generalVerification/DetailComponent.tsx +++ b/apps/st/src/components/statistics/verification/generalVerification/DetailComponent.tsx @@ -632,6 +632,7 @@ const DetailComponent = ({ selectedVrfcRow }: DetailComponentProps) => { kornArtopnEqtnCn: string; engArtopnEqtnCn: string; refStatsCd: string | null; + refStatsNm: string | null; }) => { setRuleBlocks((prev) => { const i = prev.findIndex( @@ -650,11 +651,12 @@ const DetailComponent = ({ selectedVrfcRow }: DetailComponentProps) => { kornArtopnEqtnCn: payload.kornArtopnEqtnCn, engArtopnEqtnCn: payload.engArtopnEqtnCn, refStatsCd: payload.refStatsCd, + refStatsNm: payload.refStatsNm, } : { vrfcDtlSn: null, refStatsCd: payload.refStatsCd, - refStatsNm: null, + refStatsNm: payload.refStatsNm, kornArtopnEqtnCn: payload.kornArtopnEqtnCn, engArtopnEqtnCn: payload.engArtopnEqtnCn, cmprOpert: null, @@ -1034,6 +1036,7 @@ const DetailComponent = ({ selectedVrfcRow }: DetailComponentProps) => { ); } }} + vrfcClsfCd={detailInfo?.commonInfo.vrfcClsfCd} />
); diff --git a/apps/st/src/components/statistics/verification/generalVerification/FomulaDialog.tsx b/apps/st/src/components/statistics/verification/generalVerification/FomulaDialog.tsx index 956eb6f7a..1fbe87806 100644 --- a/apps/st/src/components/statistics/verification/generalVerification/FomulaDialog.tsx +++ b/apps/st/src/components/statistics/verification/generalVerification/FomulaDialog.tsx @@ -1,9 +1,12 @@ import { useEffect, useRef, useState } from "react"; +import { useQuery } from "@tanstack/react-query"; + import { useAlertStore } from "@/shared/lib"; -import { CodeSelect } from "@/entities/code"; +import { ENDPOINT } from "@/shared/config"; +import { CodeApi } from "@/entities/code"; import { generalverificationApiService } from "@/entities/statistics/api/general-verification-service"; -import type { SelectedVerifyColumnListResponseData,VerifyColumnListResponseData, VerifyDetailResponseDto } from "@/entities/statistics/model/general-verification-interface"; +import type { SelectedVerifyColumnListResponseData, VerifyColumnListResponseData, VerifyDetailResponseDto } from "@/entities/statistics/model/general-verification-interface"; import { Button, Checkbox, @@ -14,6 +17,11 @@ import { DialogHeader, DialogTitle, Input, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, Skeleton, Textarea, } from "@common/components"; @@ -21,8 +29,10 @@ import { export interface FomulaDialogConfirmPayload { kornArtopnEqtnCn: string; engArtopnEqtnCn: string; - /** 참조 통계코드 (선택 안 했으면 null) */ + /** 참조 통계코드 (수식에 참조 컬럼이 없으면 null) */ refStatsCd: string | null; + /** 참조 통계명 (수식에 참조 컬럼이 없으면 null) */ + refStatsNm: string | null; } interface FomulaDialogProps { @@ -63,6 +73,11 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, allo const isUserDirectInputMode = allowLikeDirectInput && userDirectInput; const { setMessage: alert } = useAlertStore((state) => state); + const { data: statsItemCodes } = useQuery({ + queryKey: [ENDPOINT.CMS_SERVICE.CODE, "STITEM"], + queryFn: () => CodeApi.getCode("STITEM"), + enabled: open, + }); /** 다이얼로그에서 쓰는 기호 → 제출용 value. 백엔드 규격에 맞게 수정 가능 */ const OPERATOR_SYMBOL_TO_VALUE: Record = { @@ -375,6 +390,7 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, allo const handleChangeRefStatsCd = (next: string) => { if (!open) return; + if (trgtStatsCd && next === trgtStatsCd) return; // 현재 refStatsCdLocal에 해당하는 참조 컬럼이 수식에 포함돼 있으면 변경을 막고 안내만 표시 const currentRefCols = refColList ?? []; @@ -404,6 +420,26 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, allo /** 참조 컬럼: 선택한 참조 통계로 조회한 목록이 있으면 사용, 없으면 getVerifyColumnList 결과 사용 */ const refColList = selectedColumnInfo?.targetColumnInfo?.colList ?? columnInfo?.refColumnInfo?.colList ?? []; + const formulaUsesRefColumn = (): boolean => { + const engSet = new Set(refColList.map((c) => c.engColNm).filter(Boolean)); + if (engSet.size === 0) return false; + return formulaValueSegments.some((seg) => engSet.has(seg)); + }; + + const resolveRefStatsForConfirm = (isEmptyFormula: boolean): { + refStatsCd: string | null; + refStatsNm: string | null; + } => { + if (isEmptyFormula || !formulaUsesRefColumn() || !refStatsCdLocal) { + return { refStatsCd: null, refStatsNm: null }; + } + const refStatsNm = + statsItemCodes?.find((item) => item.lwpoCd === refStatsCdLocal)?.lwpoCdNm + ?? data?.refStatsNm + ?? null; + return { refStatsCd: refStatsCdLocal, refStatsNm }; + }; + const handleOpenChange = (nextOpen: boolean) => { if (!nextOpen) { setFormulaDisplaySegments([]); @@ -528,11 +564,10 @@ const FomulaDialog = ({ open, onOpenChange, data, trgtStatsCd, trgtStatsNm, allo )}