[ST] - fix: input 2-3 검증 cell 스타일 로직 수정
This commit is contained in:
@@ -1992,42 +1992,6 @@ useEffect(() => {
|
||||
footerVerificationResult,
|
||||
]);
|
||||
|
||||
/** footerVerificationResult만 바뀐 경우에도 총계 스타일 즉시 재적용/초기화 */
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView as
|
||||
| {
|
||||
columnByName?: (name: string) => {
|
||||
footer?: { styleName?: string } | Array<{ styleName?: string }>;
|
||||
} | null;
|
||||
refresh?: () => void;
|
||||
}
|
||||
| undefined;
|
||||
if (!gridView?.columnByName) return;
|
||||
|
||||
columns.forEach((col) => {
|
||||
if (!col.footer) return;
|
||||
try {
|
||||
const column = gridView.columnByName?.(col.name);
|
||||
if (!column?.footer) return;
|
||||
const styleName =
|
||||
resolveFooterVerificationStyleName(
|
||||
col,
|
||||
footerVerificationResult,
|
||||
) ?? "";
|
||||
if (Array.isArray(column.footer)) {
|
||||
column.footer.forEach((item) => {
|
||||
item.styleName = styleName;
|
||||
});
|
||||
} else {
|
||||
column.footer.styleName = styleName;
|
||||
}
|
||||
} catch {
|
||||
console.error('총계 스타일 재적용/초기화 error');
|
||||
}
|
||||
});
|
||||
gridView.refresh?.();
|
||||
}, [footerVerificationResult, columns]);
|
||||
|
||||
// 행·셀 클릭 이벤트 (검증 오류 툴팁은 hover만 — onShowTooltip / 빈 셀 오버레이)
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
|
||||
@@ -81,7 +81,10 @@ import {
|
||||
patchVerificationFailedByTab,
|
||||
} from "@/components/util/input/verification-failed-flag";
|
||||
import { nullableTrimmedString } from "@/components/util/input/nullableString";
|
||||
import type { VerificationResultLikeMap } from "@/components/util/input/verification-result-display";
|
||||
import {
|
||||
getVerificationErrorsForField,
|
||||
type VerificationResultLikeMap,
|
||||
} from "@/components/util/input/verification-result-display";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
@@ -219,18 +222,33 @@ const applyPipeTypeStatusEditableColumns = (
|
||||
});
|
||||
};
|
||||
|
||||
/** 2-3 관종별: verificationResult.prlgWhol → 총계 계(pipeByPrstWhol) */
|
||||
const PIPE_TYPE_TOTAL_WHOL_ALIASES = ["pipeWholPrlg", "prlgWhol"] as const;
|
||||
|
||||
/** 2-3 관종별: 총계 검증 키(pipeWholPrlg/prlgWhol) → 총계 계(pipeByPrstWhol) */
|
||||
function remapPipeTypePrlgWholVerification(
|
||||
result?: SeweragePipeInputVerificationResult | null,
|
||||
): SeweragePipeInputVerificationResult | null | undefined {
|
||||
if (!result) return result;
|
||||
const fromAlias = result.prlgWhol;
|
||||
if (!Array.isArray(fromAlias) || fromAlias.length === 0) return result;
|
||||
const existing = result.pipeByPrstWhol;
|
||||
if (Array.isArray(existing) && existing.length > 0) return result;
|
||||
const fromAlias = result.pipeWholPrlg ?? result.prlgWhol;
|
||||
if (!Array.isArray(fromAlias) || fromAlias.length === 0) return result;
|
||||
return { ...result, pipeByPrstWhol: fromAlias };
|
||||
}
|
||||
|
||||
function getSewagePipeRowVerificationErrors(
|
||||
verification: SeweragePipeInputVerificationResult | undefined,
|
||||
fieldName: string,
|
||||
tabKey: string,
|
||||
) {
|
||||
if (!verification) return undefined;
|
||||
const aliases =
|
||||
tabKey === PIPE_TYPE_STATUS_TAB_KEY && fieldName === "pipeByPrstWhol"
|
||||
? PIPE_TYPE_TOTAL_WHOL_ALIASES
|
||||
: undefined;
|
||||
return getVerificationErrorsForField(verification, fieldName, aliases);
|
||||
}
|
||||
|
||||
/** 관종별 신 응답(yearlyStatList) -> 그리드 y{year}* 필드로 정규화 */
|
||||
function normalizePipeTypeStatusRow(
|
||||
row: SeweragePipeInputPipeTypeStatusItem,
|
||||
@@ -2202,8 +2220,11 @@ const SewagePipeInp = () => {
|
||||
}
|
||||
cellStyleCallback={({ row, fieldName }) => {
|
||||
const verification = (row as GridRowWithVerification).verificationResult;
|
||||
if (!verification) return;
|
||||
const errors = verification[fieldName];
|
||||
const errors = getSewagePipeRowVerificationErrors(
|
||||
verification,
|
||||
fieldName,
|
||||
tabKey,
|
||||
);
|
||||
if (Array.isArray(errors) && errors.length > 0) {
|
||||
const hasImr = errors.some((e) => e.vrfcCd === "IMR" || e.vrfcCd === "HB");
|
||||
return hasImr ? "rg-cell-verify-error-imr" : "rg-cell-verify-error";
|
||||
@@ -2214,8 +2235,11 @@ const SewagePipeInp = () => {
|
||||
}
|
||||
cellTooltipCallback={({ row, fieldName }) => {
|
||||
const verification = (row as GridRowWithVerification).verificationResult;
|
||||
if (!verification) return;
|
||||
const errors = verification[fieldName];
|
||||
const errors = getSewagePipeRowVerificationErrors(
|
||||
verification,
|
||||
fieldName,
|
||||
tabKey,
|
||||
);
|
||||
if (Array.isArray(errors) && errors.length > 0) {
|
||||
return errors
|
||||
.map((e) => {
|
||||
|
||||
Reference in New Issue
Block a user