新增提示Toast组件

This commit is contained in:
2025-04-21 09:22:13 +08:00
parent 01d93522b8
commit 5c2c367856
36 changed files with 2609 additions and 478 deletions
+8 -17
View File
@@ -4,6 +4,7 @@ import { getDocumentTypes } from '../document-types/document-types';
import type { DocumentTypeUI } from '../document-types/document-types';
import weekday from 'dayjs/plugin/weekday';
import updateLocale from 'dayjs/plugin/updateLocale';
import { formatDate } from '../../utils';
// 配置 dayjs
dayjs.extend(weekday);
@@ -110,21 +111,6 @@ interface DocumentReviewResult {
issueCount: number;
}
/**
* 格式化日期
* @param dateString 日期字符串
* @returns 格式化后的日期字符串
*/
function formatDate(dateString: string): string {
if (!dateString) return '';
try {
return dayjs(dateString).format('YYYY-MM-DD');
} catch (error) {
console.error('日期格式化失败:', error);
return dateString;
}
}
/**
* 从不同格式的 API 响应中提取数据
* @param responseData API 响应数据
@@ -409,6 +395,7 @@ export async function getReviewFiles(searchParams: DocumentSearchParams = {}): P
let hasFailResult = false;
let totalScore = 0;
let totalPoints = 0;
let totalPassPoints = 0;
// 存储该文档的问题消息
const issuesList: Array<{severity: 'info' | 'warning' | 'error' | 'critical', message: string}> = [];
@@ -425,7 +412,7 @@ export async function getReviewFiles(searchParams: DocumentSearchParams = {}): P
}
// 检查是否有不通过的结果
if (resultValue === false) {
if (!resultValue) {
hasFailResult = true;
// 收集问题消息
@@ -435,6 +422,8 @@ export async function getReviewFiles(searchParams: DocumentSearchParams = {}): P
message: evaluatedResults.message as string
});
}
}else{
totalPassPoints++;
}
// 计算总分
@@ -467,7 +456,9 @@ export async function getReviewFiles(searchParams: DocumentSearchParams = {}): P
// 如果没有评查点,默认为通过
if (totalPoints > 0) {
// 通过分数线为80分
status = totalScore >= 80 ? 1 : -1; // 通过或不通过
// status = totalScore >= 80 ? 1 : -1; // 通过或不通过
// 通过率为80%
status = parseFloat((totalPassPoints/totalPoints).toFixed(1)) >= 0.8 ? 1 : -1; // 通过或不通过
}
}