[st] - feat: 01.제출 후 예외사유 제출 / 02. 작업 중

This commit is contained in:
2026-05-07 15:33:04 +09:00
parent 9f9c6f30cb
commit 638c99ac90
22 changed files with 1504 additions and 351 deletions
@@ -41,7 +41,10 @@ function buildFieldsFromColumns(columns: { fieldName: string; valueType?: ValueT
if (col.computed) {
const hasFields = "fields" in col.computed && col.computed.fields.length > 0;
const hasNumeratorDenominator = "numeratorFields" in col.computed && col.computed.numeratorFields.length > 0 && col.computed.denominatorFields.length > 0;
if (hasFields || hasNumeratorDenominator) {
const hasMaxOfFieldAndSum = "baseField" in col.computed && "sumFields" in col.computed && col.computed.sumFields.length > 0;
const hasDifferenceOfSums = "minuendFields" in col.computed && "subtrahendFields" in col.computed && col.computed.minuendFields.length > 0;
const hasSumOfMaxGroups = "groups" in col.computed && Array.isArray(col.computed.groups) && col.computed.groups.length > 0;
if (hasFields || hasNumeratorDenominator || hasMaxOfFieldAndSum || hasDifferenceOfSums || hasSumOfMaxGroups) {
field.valueCallback = getComputedValueCallback(col.computed) as (prod: unknown, dataRow: number, fieldName: string, fieldNames: string[], values: unknown[]) => number;
}
}
+17 -1
View File
@@ -292,7 +292,19 @@ function buildFieldsFromColumns(
"numeratorFields" in col.computed &&
col.computed.numeratorFields.length > 0 &&
col.computed.denominatorFields.length > 0;
if (hasFields || hasNumeratorDenominator) {
const hasMaxOfFieldAndSum =
"baseField" in col.computed &&
"sumFields" in col.computed &&
col.computed.sumFields.length > 0;
const hasDifferenceOfSums =
"minuendFields" in col.computed &&
"subtrahendFields" in col.computed &&
col.computed.minuendFields.length > 0;
const hasSumOfMaxGroups =
"groups" in col.computed &&
Array.isArray(col.computed.groups) &&
col.computed.groups.length > 0;
if (hasFields || hasNumeratorDenominator || hasMaxOfFieldAndSum || hasDifferenceOfSums || hasSumOfMaxGroups) {
field.valueCallback = getComputedValueCallback(
col.computed,
) as (
@@ -1215,6 +1227,10 @@ const DataGrid = ({
)
: <span className="animate-pulse">검증중</span>}
</span>
<span>
반려사유:{" "}
{statusInfo.rjctOpnnCn ? statusInfo.rjctOpnnCn : "-"}
</span>
<span>
제출일:{" "}
{statusInfo.laeSbmsnYmd
@@ -215,7 +215,10 @@ function buildFieldsFromColumns(columns: { fieldName: string; valueType?: ValueT
if (col.computed) {
const hasFields = "fields" in col.computed && col.computed.fields.length > 0;
const hasNumeratorDenominator = "numeratorFields" in col.computed && col.computed.numeratorFields.length > 0 && col.computed.denominatorFields.length > 0;
if (hasFields || hasNumeratorDenominator) {
const hasMaxOfFieldAndSum = "baseField" in col.computed && "sumFields" in col.computed && col.computed.sumFields.length > 0;
const hasDifferenceOfSums = "minuendFields" in col.computed && "subtrahendFields" in col.computed && col.computed.minuendFields.length > 0;
const hasSumOfMaxGroups = "groups" in col.computed && Array.isArray(col.computed.groups) && col.computed.groups.length > 0;
if (hasFields || hasNumeratorDenominator || hasMaxOfFieldAndSum || hasDifferenceOfSums || hasSumOfMaxGroups) {
field.valueCallback = getComputedValueCallback(col.computed) as (prod: unknown, dataRow: number, fieldName: string, fieldNames: string[], values: unknown[]) => number;
}
}
@@ -24,6 +24,7 @@ import {
import DataGrid from "@/components/module/DataGrid";
import { VerificationResultHistoryPagination } from "@/components/module/VerificationResultHistoryPagination";
import type { CellEditedCallbackParams, ColumnInfo } from "@/components/type/DataGrid.type";
import { getUserInfo } from "../../../../../packages/common/components/src/api";
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
import type { VerificationResultListRequest, VerificationResultReportItem } from "@/entities/statistics/model/statistics-interface";
import { useAlertStore } from "@/shared/lib";
@@ -146,20 +147,15 @@ export function VerificationResultDialog({
const normalGridRef = useRef<RealGridReact | null>(null);
const imrGridRef = useRef<RealGridReact | null>(null);
/** 메인 입력 화면처럼 편집 값은 그리드에 두고, 제출 시에만 스냅샷 조회 → Enter 시 rows 재주입 충돌 방지 */
const getNormalGridDataRef = useRef<(() => VerificationResultGridRow[]) | null>(null);
const getImrGridDataRef = useRef<(() => VerificationResultGridRow[]) | null>(null);
const alert = useAlertStore((state) => state.setMessage);
const onNormalPrcsOpnnExplnEdited = useCallback((params: CellEditedCallbackParams) => {
if (params.fieldName !== "prcsOpnnExpln") return;
const text = String(params.newValue ?? "");
const hasValue = text.trim().length > 0;
/** DataGrid는 onCellEdited 시 React rowData를 갱신하지 않아, 제출용 상태를 여기서 맞춤 */
setNormalRows((prev) => {
const next = [...prev];
const row = next[params.itemIndex];
if (!row) return prev;
next[params.itemIndex] = { ...row, prcsOpnnExpln: text };
return next;
});
setRowCheckByItemIndex(normalGridRef, params.itemIndex, hasValue);
setNormalCheckedIndices((prev) => {
const next = new Set(prev);
@@ -173,13 +169,6 @@ export function VerificationResultDialog({
if (params.fieldName !== "prcsOpnnExpln") return;
const text = String(params.newValue ?? "");
const hasValue = text.trim().length > 0;
setImrRows((prev) => {
const next = [...prev];
const row = next[params.itemIndex];
if (!row) return prev;
next[params.itemIndex] = { ...row, prcsOpnnExpln: text };
return next;
});
setRowCheckByItemIndex(imrGridRef, params.itemIndex, hasValue);
setImrCheckedIndices((prev) => {
const next = new Set(prev);
@@ -358,25 +347,60 @@ export function VerificationResultDialog({
return () => cancelAnimationFrame(id);
}, [imrRows, imrLoading]);
const handleExceptionSubmitClick = useCallback(() => {
const handleExceptionSubmitClick = useCallback(async () => {
const nvGrid = getNormalGridDataRef.current?.() ?? [];
const imGrid = getImrGridDataRef.current?.() ?? [];
const payload: VerificationExceptionSubmitItem[] = [];
const pushIfHasExpln = (row: VerificationResultGridRow | undefined) => {
if (!row) return;
const prcsOpnnExpln = String(row.prcsOpnnExpln ?? "").trim();
if (!prcsOpnnExpln) return;
payload.push({
vrfcSn: Number(row.vrfcSn),
prcsOpnnExpln,
const pushChecked = (
indices: Set<number>,
gridRows: VerificationResultGridRow[],
idRows: VerificationResultGridRow[],
) => {
indices.forEach((idx) => {
const prcsOpnnExpln = String(gridRows[idx]?.prcsOpnnExpln ?? "").trim();
if (!prcsOpnnExpln) return;
const vrfcSn = Number(idRows[idx]?.vrfcSn);
if (!Number.isFinite(vrfcSn)) return;
payload.push({ vrfcSn, prcsOpnnExpln });
});
};
normalCheckedIndices.forEach((idx) => pushIfHasExpln(normalRows[idx]));
imrCheckedIndices.forEach((idx) => pushIfHasExpln(imrRows[idx]));
pushChecked(normalCheckedIndices, nvGrid, normalRows);
pushChecked(imrCheckedIndices, imGrid, imrRows);
if (payload.length === 0) {
alert("작성된 예외 제출 항목이 없습니다.");
return;
}
console.log(payload);
}, [alert, imrCheckedIndices, imrRows, normalCheckedIndices, normalRows]);
if (!stableQueryContext) {
alert("조회 조건이 없어 예외 제출을 할 수 없습니다.");
return;
}
try {
const userInfo = await getUserInfo();
const response = await statisticsApi.SubmitVerifyException({
sewerBzmnCd: stableQueryContext.sewerBzmnCd,
statsYr: stableQueryContext.statsYr,
statsCd: stableQueryContext.statsCd,
userId: userInfo.userUnqId,
exceptionList: payload,
});
if (response.status === "success") {
alert("예외 제출 처리되었습니다.");
onOpenChange(false);
} else {
alert(response.message ?? "예외 제출 처리 중 오류가 발생했습니다.");
}
} catch {
alert("예외 제출 처리 중 오류가 발생했습니다.");
}
}, [
alert,
imrCheckedIndices,
imrRows,
loadInitial,
normalCheckedIndices,
normalRows,
stableQueryContext,
]);
const renderGrid = (
rows: VerificationResultGridRow[],
@@ -386,6 +410,7 @@ export function VerificationResultDialog({
onPageIndexChange: (page: number) => void,
loading: boolean,
gridRef: MutableRefObject<RealGridReact | null>,
getGridDataRef: MutableRefObject<(() => VerificationResultGridRow[]) | null>,
onPrcsOpnnExplnCellEdited: (params: CellEditedCallbackParams) => void,
setCheckedIndices: Dispatch<SetStateAction<Set<number>>>,
) => {
@@ -404,6 +429,7 @@ export function VerificationResultDialog({
showHeaderCheckbox
enableSort={false}
getGridRef={gridRef}
getGridDataRef={getGridDataRef}
onCellEdited={onPrcsOpnnExplnCellEdited}
onItemChecked={(itemIndex, checked) => {
setCheckedIndices((prev) => {
@@ -467,6 +493,7 @@ export function VerificationResultDialog({
handleNormalPageChange,
normalLoading,
normalGridRef,
getNormalGridDataRef,
onNormalPrcsOpnnExplnEdited,
setNormalCheckedIndices,
)}
@@ -481,6 +508,7 @@ export function VerificationResultDialog({
handleImrPageChange,
imrLoading,
imrGridRef,
getImrGridDataRef,
onImrPrcsOpnnExplnEdited,
setImrCheckedIndices,
)}