修改文档列表
This commit is contained in:
@@ -5,12 +5,11 @@ import { Card } from "~/components/ui/Card";
|
||||
import { Button } from "~/components/ui/Button";
|
||||
import { Table } from "~/components/ui/Table";
|
||||
import { Pagination } from "~/components/ui/Pagination";
|
||||
import { StatusBadge } from "~/components/ui/StatusBadge";
|
||||
import { FileTypeTag } from "~/components/ui/FileTypeTag";
|
||||
import { FileTag } from "~/components/ui/FileTag";
|
||||
import { FilterPanel, FilterSelect, SearchFilter, DateRangeFilter } from "~/components/ui/FilterPanel";
|
||||
import documentsIndexStyles from "~/styles/pages/documents_index.css?url";
|
||||
import { getDocuments, deleteDocument, type DocumentUI, getFileDownloadUrl } from "~/api/files/documents";
|
||||
import { getDocuments, deleteDocument, type DocumentUI } from "~/api/files/documents";
|
||||
import { getDocumentTypes } from "~/api/document-types/document-types";
|
||||
|
||||
// 导入样式
|
||||
@@ -122,6 +121,24 @@ const documentStatusOptions = [
|
||||
{ value: "fail", label: "不通过" },
|
||||
];
|
||||
|
||||
// 文件处理状态选项
|
||||
const fileProcessingStatusOptions = [
|
||||
{ value: "Waiting", label: "上传中", icon: "ri-loader-line" },
|
||||
{ value: "Cutting", label: "切分中", icon: "ri-loader-line" },
|
||||
{ value: "Extractioning", label: "抽取中", icon: "ri-loader-line" },
|
||||
{ value: "Evaluationing", label: "评查中", icon: "ri-loader-line" },
|
||||
{ value: "Processed", label: "已完成", icon: "ri-check-line" },
|
||||
];
|
||||
|
||||
// 审核状态选项及样式
|
||||
const auditStatusMapping: Record<string, { label: string; color: string; icon: string }> = {
|
||||
"-1": { label: "不通过", color: "red", icon: "ri-close-line" },
|
||||
"0": { label: "待审核", color: "blue", icon: "ri-time-line" },
|
||||
"1": { label: "通过", color: "green", icon: "ri-check-line" },
|
||||
"2": { label: "警告", color: "yellow", icon: "ri-alert-line" },
|
||||
"3": { label: "审核中", color: "purple", icon: "ri-search-line" },
|
||||
};
|
||||
|
||||
// 格式化文件大小
|
||||
const formatFileSize = (bytes: number) => {
|
||||
if (bytes === 0) return "0 Bytes";
|
||||
@@ -417,12 +434,34 @@ export default function DocumentsIndex() {
|
||||
width: "100px",
|
||||
render: (_: unknown, record: DocumentUI) => formatFileSize(record.size)
|
||||
},
|
||||
{
|
||||
title: "文件状态",
|
||||
key: "fileStatus",
|
||||
render: (_: unknown, record: DocumentUI) => {
|
||||
const status = fileProcessingStatusOptions.find(s => s.value === record.fileStatus) ||
|
||||
fileProcessingStatusOptions[0];
|
||||
const isSpinning = record.fileStatus !== "Processed";
|
||||
return (
|
||||
<div className="flex items-center">
|
||||
<i className={`${status.icon} ${isSpinning ? "animate-spin" : ""} mr-1`}></i>
|
||||
<span>{status.label}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "审核状态",
|
||||
key: "status",
|
||||
render: (_: unknown, record: DocumentUI) => (
|
||||
<StatusBadge status={record.status} showIcon={false} />
|
||||
)
|
||||
key: "auditStatus",
|
||||
render: (_: unknown, record: DocumentUI) => {
|
||||
const statusKey = record.auditStatus.toString();
|
||||
const statusInfo = auditStatusMapping[statusKey] || auditStatusMapping["0"];
|
||||
return (
|
||||
<div className={`inline-flex items-center px-2 py-1 rounded-full text-xs bg-${statusInfo.color}-100 text-${statusInfo.color}-800`}>
|
||||
<i className={`${statusInfo.icon} mr-1`}></i>
|
||||
<span>{statusInfo.label}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "问题数量",
|
||||
@@ -443,7 +482,7 @@ export default function DocumentsIndex() {
|
||||
width: "280px",
|
||||
render: (_: unknown, record: DocumentUI) => (
|
||||
<div className="operations-cell">
|
||||
{record.status === "waiting" ? (
|
||||
{record.auditStatus === 0 ? (
|
||||
<Link
|
||||
to={`/documents/${record.id}/review`}
|
||||
className="mr-1 hover:underline"
|
||||
@@ -451,7 +490,7 @@ export default function DocumentsIndex() {
|
||||
<i className="ri-play-circle-line"></i>
|
||||
开始审核
|
||||
</Link>
|
||||
) : record.status === "processing" ? (
|
||||
) : record.auditStatus === 3 ? (
|
||||
<Link
|
||||
to={`/documents/${record.id}/progress`}
|
||||
className="mr-1 hover:underline"
|
||||
@@ -505,7 +544,7 @@ export default function DocumentsIndex() {
|
||||
<Button
|
||||
type="primary"
|
||||
icon="ri-upload-line"
|
||||
to="/documents/upload"
|
||||
to="/files/upload"
|
||||
className="hover:text-white"
|
||||
>
|
||||
上传文档
|
||||
|
||||
Reference in New Issue
Block a user