From 680da9b323db8b8d7cf27c674ab0016ec87bfe81 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 4 Nov 2025 07:48:00 +0000 Subject: (임수민) 구매 점검 테스트 요청사항 수정 (11/02) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/evaluation/table/evaluation-columns.tsx | 54 ++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'lib/evaluation/table/evaluation-columns.tsx') diff --git a/lib/evaluation/table/evaluation-columns.tsx b/lib/evaluation/table/evaluation-columns.tsx index b68aa70d..56029e08 100644 --- a/lib/evaluation/table/evaluation-columns.tsx +++ b/lib/evaluation/table/evaluation-columns.tsx @@ -133,7 +133,7 @@ const getDepartmentStatusBadge = (status: string | null) => { }; // 등급별 색상 -const getGradeBadgeVariant = (grade: string | null) => { +const getGradeBadgeVariant = (grade: string | null): "default" | "secondary" | "outline" | "destructive" => { if (!grade) return "outline"; switch (grade) { case "S": return "default"; @@ -264,7 +264,7 @@ export function getPeriodicEvaluationsColumns({ accessorKey: "vendorName", header: ({ column }) => , cell: ({ row }) => ( -
+
{row.original.vendorName}
), @@ -381,7 +381,7 @@ export function getPeriodicEvaluationsColumns({ return finalGrade ? ( {finalGrade} @@ -803,18 +803,56 @@ export function getPeriodicEvaluationsColumns({ }, { - accessorKey: "evaluationGrade", + id: "evaluationGrade", header: ({ column }) => , cell: ({ row }) => { - const grade = row.getValue("evaluationGrade"); + // 확정된 등급이 있으면 우선 표시 + const finalGrade = row.original.finalGrade; const isAggregated = viewMode === "aggregated" && (row.original as PeriodicEvaluationAggregatedView).evaluationCount > 1; - return grade ? ( + if (finalGrade) { + return ( + + {finalGrade}등급 + + ); + } + + // 확정된 등급이 없으면 평가점수 기반으로 등급 계산 + const processScore = Number(row.getValue("processScore") || 0); + const priceScore = Number(row.getValue("priceScore") || 0); + const deliveryScore = Number(row.getValue("deliveryScore") || 0); + const selfEvaluationScore = Number(row.getValue("selfEvaluationScore") || 0); + const participationBonus = Number(row.getValue("participationBonus") || 0); + const qualityDeduction = Number(row.getValue("qualityDeduction") || 0); + + const totalScore = processScore + priceScore + deliveryScore + selfEvaluationScore; + const evaluationScore = totalScore + participationBonus - qualityDeduction; + + // 점수 기반으로 등급 계산 + // A: 95 이상, B: 90-95 미만, C: 60-90 미만, D: 60 미만 + let calculatedGrade: string | null = null; + if (evaluationScore > 0) { + if (evaluationScore >= 95) { + calculatedGrade = "A"; + } else if (evaluationScore >= 90) { + calculatedGrade = "B"; + } else if (evaluationScore >= 60) { + calculatedGrade = "C"; + } else { + calculatedGrade = "D"; + } + } + + return calculatedGrade ? ( - {grade} + {calculatedGrade}등급 ) : ( - -- cgit v1.2.3