[st] chore: 검증 이력 그리드 컬럼 수정
This commit is contained in:
@@ -34,10 +34,7 @@ import type {
|
||||
AnalysisRequestPayload,
|
||||
AnalysisResponseDto,
|
||||
} from "@/entities/statistics/model/analysis-interface";
|
||||
import type {
|
||||
StAnlsMstResponse,
|
||||
StAnlsOutlierListResponse,
|
||||
} from "@/entities/statistics/model/analysis-history-interface";
|
||||
import type { StAnlsOutlierListResponse } from "@/entities/statistics/model/analysis-history-interface";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { CodeApi } from "@/entities/code";
|
||||
@@ -72,31 +69,6 @@ function toNumber(value: string): number {
|
||||
return Number.isNaN(parsed) ? 0 : parsed;
|
||||
}
|
||||
|
||||
function mapHistoryToRow(
|
||||
item: StAnlsMstResponse,
|
||||
): Record<string, string | number> {
|
||||
const executedAt = item.anlsBgngDt ?? "";
|
||||
const endedAt = item.anlsEndDt ?? "";
|
||||
const verificationYear =
|
||||
executedAt && executedAt.length >= 4 ? executedAt.slice(0, 4) : "";
|
||||
|
||||
return {
|
||||
executedAt,
|
||||
progressStatus: item.anlsSttsNm ?? "",
|
||||
endedAt,
|
||||
verificationYear,
|
||||
mu: 0,
|
||||
percentile: 0,
|
||||
a: 0,
|
||||
c: 0,
|
||||
target: "",
|
||||
normalCount: item.nmlDataNocs ?? 0,
|
||||
excludedCount: item.exclDataNocs ?? 0,
|
||||
abnormalCount: item.otlrDataNocs ?? 0,
|
||||
anlsSn: item.anlsSn,
|
||||
};
|
||||
}
|
||||
|
||||
const HbStatisticsVerification = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const queryClient = useQueryClient();
|
||||
@@ -140,13 +112,11 @@ const HbStatisticsVerification = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const historyRowData: Record<string, string | number>[] = useMemo(
|
||||
() =>
|
||||
(analysisHistory?.content ?? []).map((item) =>
|
||||
mapHistoryToRow(item as StAnlsMstResponse),
|
||||
),
|
||||
[analysisHistory],
|
||||
);
|
||||
const historyRowData =
|
||||
(analysisHistory?.content ?? []) as unknown as Record<
|
||||
string,
|
||||
string | number
|
||||
>[];
|
||||
|
||||
const { data: outlierList, isLoading: isLoadingOutlier } = useQuery({
|
||||
queryKey: [
|
||||
@@ -243,7 +213,7 @@ const HbStatisticsVerification = () => {
|
||||
}
|
||||
|
||||
function handleHistoryRowClick(row: Record<string, string | number>) {
|
||||
const abnormalCount = Number(row.abnormalCount ?? 0);
|
||||
const abnormalCount = Number(row.otlrDataNocs ?? 0);
|
||||
const anlsSn = Number(row.anlsSn ?? 0);
|
||||
if (!anlsSn || abnormalCount <= 0) return;
|
||||
setOutlierDialog({ open: true, anlsSn });
|
||||
@@ -460,8 +430,8 @@ const HbStatisticsVerification = () => {
|
||||
showHeaderCheckbox={false}
|
||||
onRowClick={handleHistoryRowClick}
|
||||
cellStyleCallback={({ row, fieldName }) => {
|
||||
if (fieldName === "abnormalCount") {
|
||||
const abnormal = Number(row.abnormalCount ?? 0);
|
||||
if (fieldName === "otlrDataNocs") {
|
||||
const abnormal = Number(row.otlrDataNocs ?? 0);
|
||||
if (abnormal > 0) return "rg-cell-verify-error";
|
||||
}
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user