优化显示提出意见时显示的已获得分数

This commit is contained in:
2025-07-25 17:23:00 +08:00
parent 27b3574cef
commit 9a366d042a
4 changed files with 33 additions and 22 deletions
@@ -118,7 +118,8 @@ export interface ReviewPoint {
failMessage?: string;
passMessage?: string;
score?: number; // 评查点满分
finalScore?: number; // 评查点获得分数
finalScore?: number | null; // 评查点最终获得分数
machineScore?: number; // 评查点机器获得分数
evaluationConfig?: {
rules?: Array<{
type: string;
@@ -445,15 +446,15 @@ export function ReviewPointsList({
const fetcher = useFetcher();
// 归一化 reviewPoints,确保每个点都有 id 字段
const [normalizedReviewPoints, setNormalizedReviewPoints] = useState<ReviewPoint[]>([]);
console.log('normalizedReviewPoints', normalizedReviewPoints);
useEffect(() => {
const norm = reviewPoints.map(point => ({
...point,
id: String(point.id || point.evaluationPointId || point.pointId || '') // 保证 id 为字符串且不为 undefined
}));
setNormalizedReviewPoints(norm);
}, [reviewPoints]);
// const [normalizedReviewPoints, setNormalizedReviewPoints] = useState<ReviewPoint[]>([]);
// console.log('normalizedReviewPoints', normalizedReviewPoints);
// useEffect(() => {
// const norm = reviewPoints.map(point => ({
// ...point,
// id: String(point.id || point.evaluationPointId || point.pointId || '') // 保证 id 为字符串且不为 undefined
// }));
// setNormalizedReviewPoints(norm);
// }, [reviewPoints]);
// 同步外部scoringProposals到本地状态
useEffect(() => {
@@ -2573,7 +2574,8 @@ export function ReviewPointsList({
<label htmlFor="deduction-score" className="block text-sm font-medium text-gray-700 mb-2">
(+/-)
<span className="text-red-500 ml-1">*</span>
<span className="text-xs text-gray-500 ml-1"> {selectedReviewPoint?.score} , {selectedReviewPoint?.finalScore} </span>
{/* 已获得分数需要判断finalScore是否为null,为null时应该用machineScore(说明该评查点没有修改过分数),否则用finalScore */}
<span className="text-xs text-gray-500 ml-1"> {selectedReviewPoint?.score} , {selectedReviewPoint?.finalScore !== null ? selectedReviewPoint?.finalScore : selectedReviewPoint?.machineScore} </span>
</label>
<input
id="deduction-score"