修改文档列表
This commit is contained in:
@@ -67,6 +67,8 @@ export interface Document {
|
||||
is_test_document: boolean;
|
||||
evaluation_level: string;
|
||||
status: 'pass' | 'warning' | 'waiting' | 'processing' | 'fail';
|
||||
file_status: 'Waiting' | 'Cutting' | 'Extractioning' | 'Evaluationing' | 'Processed';
|
||||
audit_status: number; // -1: 不通过, 0: 待审核, 1: 通过, 2: 警告, 3: 审核中
|
||||
ocr_result: unknown;
|
||||
extracted_results: unknown;
|
||||
summary: unknown;
|
||||
@@ -85,7 +87,8 @@ export interface DocumentUI {
|
||||
type: string;
|
||||
typeName: string;
|
||||
size: number;
|
||||
status: string;
|
||||
auditStatus: number; // -1: 不通过, 0: 待审核, 1: 通过, 2: 警告, 3: 审核中
|
||||
fileStatus: string; // Waiting, Cutting, Extractioning, Evaluationing, Processed
|
||||
issues: number | null;
|
||||
uploadTime: string;
|
||||
fileType: string;
|
||||
@@ -119,7 +122,8 @@ async function convertToUIDocument(doc: Document): Promise<DocumentUI> {
|
||||
type: doc.type_id.toString(),
|
||||
typeName: docType?.name || '未知类型',
|
||||
size: doc.file_size,
|
||||
status: doc.status,
|
||||
auditStatus: doc.audit_status,
|
||||
fileStatus: doc.file_status || 'Processed', // 默认为已处理
|
||||
issues: 0, // 固定为0
|
||||
uploadTime: formatDate(doc.updated_at),
|
||||
fileType: getFileExtension(doc.name),
|
||||
@@ -332,13 +336,6 @@ export async function getFileDownloadUrl(filePath: string): Promise<{
|
||||
return { error: '文件路径不能为空', status: 400 };
|
||||
}
|
||||
|
||||
// 构建API请求参数
|
||||
const params: PostgrestParams = {
|
||||
filter: {
|
||||
'path': `eq.${filePath}`
|
||||
}
|
||||
};
|
||||
|
||||
// 这里应该调用获取文件下载链接的API
|
||||
// 假设后端有这样的端点:/api/files/generate-download-url?path=xxx
|
||||
// 实际项目中需要根据你的后端API调整
|
||||
@@ -387,8 +384,8 @@ export async function updateDocument(id: string, document: Partial<DocumentUI> &
|
||||
apiDocument.type_id = parseInt(document.type);
|
||||
}
|
||||
|
||||
if (document.status !== undefined) {
|
||||
apiDocument.status = document.status as 'pass' | 'warning' | 'waiting' | 'processing' | 'fail';
|
||||
if (document.auditStatus !== undefined) {
|
||||
apiDocument.audit_status = document.auditStatus;
|
||||
}
|
||||
|
||||
if (document.isTest !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user