优化使用体验

This commit is contained in:
2025-08-11 10:40:56 +08:00
parent 21c01d51d5
commit 360b5a846d
8 changed files with 172 additions and 89 deletions
@@ -1,4 +1,3 @@
import { Modal } from '../ui/Modal';
import { Table } from '../ui/Table';
import { Button } from '../ui/Button';
@@ -91,47 +90,6 @@ export function DocumentListModal({
};
// 渲染问题摘要
const renderIssues = (file: TaskDocument) => {
// 如果文件有问题信息
if (file.issues && file.issues.length > 0) {
// 最多显示2个问题
const displayIssues = file.issues.slice(0, 2);
return (
<div className="text-sm">
{displayIssues.map((issue, index) => (
<div key={index} className="mb-1">
<i className={`ri-circle-fill mr-1 ${
issue.severity === 'error' ? 'text-red-400' :
issue.severity === 'warning' ? 'text-yellow-400' :
'text-blue-400'
}`}></i>
{issue.message}
</div>
))}
{file.issues.length > 2 && (
<div className="text-secondary mt-1">
{file.issues.length - 2} ...
</div>
)}
</div>
);
}
// 如果没有问题信息,根据状态显示
if (file.evaluations_status === 1) {
return (
<div className="text-sm text-success">
<i className="ri-check-double-line mr-1"></i>
</div>
);
}
// 其他状态显示占位符
return <div className="text-sm text-secondary">-</div>;
};
// 获取文件大小的友好显示
const formatFileSize = (bytes: number) => {
@@ -252,12 +210,8 @@ export function DocumentListModal({
render: (_: unknown, file: TaskDocument) => (
<div className="text-left">
{file.final_score ? (
<span className={`font-medium ${
file.final_score >= 90 ? 'text-green-600' :
file.final_score >= 70 ? 'text-yellow-600' :
'text-red-600'
}`}>
{file.final_score}
<span>
{file.score_summary}
</span>
) : (
<span className="text-gray-400">-</span>
@@ -265,18 +219,27 @@ export function DocumentListModal({
</div>
)
},
{
title: "评查分数百分化",
key: "scorePercent",
width: "10%",
render: (_: unknown, file: TaskDocument) => {
const value: number | null | undefined = file.score_percent as number | null | undefined;
if (value === null || value === undefined || Number.isNaN(value)) {
return <span className="text-gray-400">-</span>;
}
const numericValue = typeof value === 'string' ? Number(value) : value;
const normalized = numericValue <= 1 ? numericValue * 100 : numericValue;
const display = `${Number(normalized.toFixed(1))}%`;
return <span>{display}</span>;
}
},
{
title: '审核状态',
key: 'auditStatus',
width: '8%',
render: (_: unknown, file: TaskDocument) => renderAuditStatus(file)
},
{
title: "问题摘要",
key: "issues",
width: "20%",
render: (_: unknown, file: TaskDocument) => renderIssues(file)
},
{
title: "操作",
key: "operation",