feat: align frontend document and rule management flows

This commit is contained in:
wren
2026-05-06 09:40:37 +08:00
parent 8a5044b024
commit c54f84382b
41 changed files with 4239 additions and 2903 deletions
+25 -7
View File
@@ -65,6 +65,8 @@ export interface DocumentUI {
documentNumber: string;
type: string;
typeName: string;
groupId?: number | null;
groupName?: string | null;
size: number;
auditStatus: number; // -1: 不通过, 0: 待审核, 1: 通过, 2: 警告, 3: 审核中
fileStatus: string; // Waiting, Cutting, Extractioning, Failed, Evaluationing, Processed
@@ -106,6 +108,8 @@ export interface DocumentVersionUI {
documentNumber: string;
type: string;
typeName: string;
groupId?: number | null;
groupName?: string | null;
size: number;
auditStatus: number;
fileStatus: string;
@@ -152,6 +156,9 @@ interface LeauditListItem {
previousVersionId?: number | null;
typeId?: number | null;
typeCode?: string | null;
typeName?: string | null;
groupId?: number | null;
groupName?: string | null;
region: string;
normalizedName?: string | null;
fileId?: number | null;
@@ -168,6 +175,9 @@ interface LeauditListItem {
passedCount?: number | null;
failedCount?: number | null;
skippedCount?: number | null;
documentNumber?: string | null;
auditStatus?: number | null;
isTestDocument?: boolean | null;
updatedAt?: string | null;
hasHistory?: boolean;
totalVersions?: number;
@@ -279,7 +289,9 @@ function mapHistoryVersionToUI(history: LeauditHistoryVersion, source: LeauditLi
name: history.fileName || source.fileName || source.normalizedName || '未命名文档',
documentNumber: buildDocumentNumber(history),
type: source.typeId?.toString() || '',
typeName: typeNameFromCode(source.typeCode),
typeName: source.typeName || typeNameFromCode(source.typeCode),
groupId: source.groupId ?? null,
groupName: source.groupName ?? null,
size: 0,
auditStatus: mapLeauditDocToAuditStatus({
processingStatus: history.processingStatus,
@@ -316,7 +328,9 @@ function mapLeauditDocumentToUI(doc: LeauditListItem | LeauditDocumentDetail): D
name: doc.fileName || doc.normalizedName || '未命名文档',
documentNumber: ('documentNumber' in doc && doc.documentNumber) ? doc.documentNumber : buildDocumentNumber(doc),
type: doc.typeId?.toString() || '',
typeName: typeNameFromCode(doc.typeCode),
typeName: doc.typeName || typeNameFromCode(doc.typeCode),
groupId: doc.groupId ?? null,
groupName: doc.groupName ?? null,
size: doc.fileSize || 0,
auditStatus: ('auditStatus' in doc && doc.auditStatus !== null && doc.auditStatus !== undefined)
? doc.auditStatus
@@ -778,6 +792,7 @@ export async function getDocumentsListFromAPI(searchParams: {
name?: string;
documentNumber?: string;
documentTypeIds?: number[]; // 文档类型ID数组
entryModuleId?: number;
auditStatus?: string;
fileStatus?: string;
dateFrom?: string;
@@ -795,6 +810,7 @@ export async function getDocumentsListFromAPI(searchParams: {
name,
documentNumber,
documentTypeIds,
entryModuleId,
auditStatus,
fileStatus,
dateFrom,
@@ -824,11 +840,13 @@ export async function getDocumentsListFromAPI(searchParams: {
params.type_ids = documentTypeIds.join(',');
}
// 下面几个旧筛选项暂未完全对齐:
// - documentNumber
// - auditStatus
void documentNumber;
void auditStatus;
if (entryModuleId && entryModuleId > 0) {
params.entry_module_id = entryModuleId;
}
if (documentNumber) params.documentNumber = documentNumber;
if (auditStatus !== undefined && auditStatus !== "") {
params.auditStatus = Number(auditStatus);
}
if (dateFrom) params.dateFrom = dateFrom;
if (dateTo) params.dateTo = dateTo;