删除所有console.log输出,优化评查结果的表格的显示,添加新的页码获取逻辑
This commit is contained in:
@@ -98,7 +98,7 @@ function buildUrl(endpoint: string, params?: QueryParams): string {
|
||||
* 获取模拟响应数据
|
||||
*/
|
||||
function getMockResponse<T>(endpoint: string): ApiResponse<T> {
|
||||
console.log(`[开发模式] 使用模拟数据: ${endpoint}`);
|
||||
// console.log(`[开发模式] 使用模拟数据: ${endpoint}`);
|
||||
|
||||
// 移除开头的斜杠以便于匹配
|
||||
const path = endpoint.startsWith('/') ? endpoint.substring(1) : endpoint;
|
||||
@@ -176,7 +176,7 @@ export async function apiRequest<T>(
|
||||
|
||||
// 针对 PostgREST 的额外处理
|
||||
if (endpoint.includes('evaluation_point_groups') && (options.method === 'POST' || options.method === 'PATCH')) {
|
||||
console.log('使用 PostgREST 特定配置处理请求');
|
||||
// console.log('使用 PostgREST 特定配置处理请求');
|
||||
// 确保请求体是有效的 JSON 对象
|
||||
if (options.body && typeof options.body === 'string') {
|
||||
try {
|
||||
@@ -188,15 +188,15 @@ export async function apiRequest<T>(
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`📦 axios-client.ts->请求URL: ${decodeUrlForDisplay(url)}`);
|
||||
console.log(`axios-client.ts->发送 ${options.method || 'GET'} 请求到: ${decodeUrlForDisplay(url)}`);
|
||||
// console.log(`📦 axios-client.ts->请求URL: ${decodeUrlForDisplay(url)}`);
|
||||
// console.log(`axios-client.ts->发送 ${options.method || 'GET'} 请求到: ${decodeUrlForDisplay(url)}`);
|
||||
|
||||
// 处理body参数,转换为data
|
||||
if (options.body) {
|
||||
console.log(`axios-client.ts->请求体: \n${options.body}`);
|
||||
// console.log(`axios-client.ts->请求体: \n${options.body}`);
|
||||
options.data = options.body;
|
||||
} else if (options.data) {
|
||||
console.log(`axios-client.ts->请求体: \n${typeof options.data === 'string' ? options.data : JSON.stringify(options.data)}`);
|
||||
// console.log(`axios-client.ts->请求体: \n${typeof options.data === 'string' ? options.data : JSON.stringify(options.data)}`);
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
@@ -344,7 +344,7 @@ export async function downloadFile(path: string): Promise<Blob> {
|
||||
const downloadUrl = `${DOCUMENT_URL}${path}`;
|
||||
|
||||
try {
|
||||
console.log(`📦 axios-client.ts->下载文件: ${decodeUrlForDisplay(downloadUrl)}`);
|
||||
// console.log(`📦 axios-client.ts->下载文件: ${decodeUrlForDisplay(downloadUrl)}`);
|
||||
const response = await axios.get(downloadUrl, {
|
||||
responseType: 'blob'
|
||||
});
|
||||
|
||||
+6
-6
@@ -90,7 +90,7 @@ const fetchWithTimeout = async (url: string, options: RequestInit, timeout = 500
|
||||
const id = setTimeout(() => controller.abort(), timeout);
|
||||
|
||||
try {
|
||||
console.log(`📦 client.ts->请求URL: ${decodeUrlForDisplay(url)}`);
|
||||
// console.log(`📦 client.ts->请求URL: ${decodeUrlForDisplay(url)}`);
|
||||
const response = await fetch(url, {
|
||||
...options,
|
||||
signal: controller.signal
|
||||
@@ -114,7 +114,7 @@ const fetchWithTimeout = async (url: string, options: RequestInit, timeout = 500
|
||||
* 获取模拟响应数据
|
||||
*/
|
||||
function getMockResponse<T>(endpoint: string): ApiResponse<T> {
|
||||
console.log(`[开发模式] 使用模拟数据: ${endpoint}`);
|
||||
// console.log(`[开发模式] 使用模拟数据: ${endpoint}`);
|
||||
|
||||
// 移除开头的斜杠以便于匹配
|
||||
const path = endpoint.startsWith('/') ? endpoint.substring(1) : endpoint;
|
||||
@@ -185,7 +185,7 @@ export async function apiRequest<T>(
|
||||
|
||||
// 针对 PostgREST 的额外处理
|
||||
if (endpoint.includes('evaluation_point_groups') && (options.method === 'POST' || options.method === 'PATCH')) {
|
||||
console.log('使用 PostgREST 特定配置处理请求');
|
||||
// console.log('使用 PostgREST 特定配置处理请求');
|
||||
// 确保请求体是有效的 JSON 对象
|
||||
if (options.body && typeof options.body === 'string') {
|
||||
try {
|
||||
@@ -197,9 +197,9 @@ export async function apiRequest<T>(
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`client.ts->发送 ${options.method || 'GET'} 请求到: ${decodeUrlForDisplay(url)}`);
|
||||
// console.log(`client.ts->发送 ${options.method || 'GET'} 请求到: ${decodeUrlForDisplay(url)}`);
|
||||
if (options.body) {
|
||||
console.log(`client.ts->请求体: \n${options.body}`);
|
||||
// console.log(`client.ts->请求体: \n${options.body}`);
|
||||
}
|
||||
|
||||
// 发送请求,10秒超时
|
||||
@@ -226,7 +226,7 @@ export async function apiRequest<T>(
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析响应失败:', e);
|
||||
console.log('原始响应:', responseText);
|
||||
// console.log('原始响应:', responseText);
|
||||
}
|
||||
|
||||
// 收集响应头信息
|
||||
|
||||
@@ -213,7 +213,7 @@ export async function getContractTemplates(searchParams: TemplateSearchParams =
|
||||
if (categoryResponse.data) {
|
||||
const categories = extractApiData<ContractCategory[]>(categoryResponse.data) || [];
|
||||
matchingCategoryIds = categories.map(cat => cat.id);
|
||||
console.log('匹配的分类ID:', matchingCategoryIds);
|
||||
// console.log('匹配的分类ID:', matchingCategoryIds);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询分类失败:', error);
|
||||
@@ -229,8 +229,8 @@ export async function getContractTemplates(searchParams: TemplateSearchParams =
|
||||
];
|
||||
|
||||
params.or = `(${searchConditions.join(',')})`;
|
||||
console.log('搜索关键词:', cleanKeyword);
|
||||
console.log('搜索条件:', params.or);
|
||||
// console.log('搜索关键词:', cleanKeyword);
|
||||
// console.log('搜索条件:', params.or);
|
||||
}
|
||||
|
||||
// 如果有分类名称,需要先获取分类ID
|
||||
|
||||
@@ -251,7 +251,7 @@ export async function getDocumentTypes(searchParams: DocumentTypeSearchParams =
|
||||
|
||||
params.filter = filter;
|
||||
|
||||
console.log('获取文档类型列表,参数:', params);
|
||||
// console.log('获取文档类型列表,参数:', params);
|
||||
const response = await postgrestGet<DocumentType[]>('document_types', params);
|
||||
|
||||
if (response.error) {
|
||||
@@ -286,7 +286,7 @@ export async function getDocumentTypes(searchParams: DocumentTypeSearchParams =
|
||||
groupIds = [];
|
||||
}
|
||||
|
||||
console.log(`文档类型 ${type.id} 的分组IDs:`, groupIds);
|
||||
// console.log(`文档类型 ${type.id} 的分组IDs:`, groupIds);
|
||||
|
||||
// 获取这些ID对应的分组信息
|
||||
const groupsResponse = await getEvaluationPointGroupsByIds(groupIds);
|
||||
@@ -486,7 +486,7 @@ export async function getDocumentType(id: string): Promise<{
|
||||
groupIds = [];
|
||||
}
|
||||
|
||||
console.log(`文档类型 ${id} 的分组IDs:`, groupIds);
|
||||
// console.log(`文档类型 ${id} 的分组IDs:`, groupIds);
|
||||
|
||||
const groupsResponse = await getEvaluationPointGroupsByIds(groupIds);
|
||||
|
||||
@@ -606,7 +606,7 @@ export async function createDocumentType(documentType: DocumentTypeCreateDTO): P
|
||||
return { error: response.error, status: response.status };
|
||||
}
|
||||
|
||||
console.log('创建文档类型响应数据:', JSON.stringify(response.data, null, 2));
|
||||
// console.log('创建文档类型响应数据:', JSON.stringify(response.data, null, 2));
|
||||
|
||||
// 处理响应数据
|
||||
const newDocumentType = extractApiData<DocumentType>(response.data);
|
||||
@@ -712,7 +712,7 @@ export async function updateDocumentType(id: string, documentType: DocumentTypeU
|
||||
prompt_config: promptConfig
|
||||
};
|
||||
|
||||
console.log('更新文档类型请求数据:', JSON.stringify(apiDocumentType, null, 2));
|
||||
// console.log('更新文档类型请求数据:', JSON.stringify(apiDocumentType, null, 2));
|
||||
// throw new Error('测试错误');
|
||||
// 发送更新请求
|
||||
const response = await postgrestPut<DocumentType, typeof apiDocumentType>(
|
||||
@@ -726,7 +726,7 @@ export async function updateDocumentType(id: string, documentType: DocumentTypeU
|
||||
return { error: response.error, status: response.status };
|
||||
}
|
||||
|
||||
console.log('更新文档类型响应数据:', JSON.stringify(response.data, null, 2));
|
||||
// console.log('更新文档类型响应数据:', JSON.stringify(response.data, null, 2));
|
||||
|
||||
// 处理响应数据
|
||||
const updatedDocumentType = extractApiData<DocumentType>(response.data);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { postgrestGet, type PostgrestParams, postgrestPut, postgrestPost } from "../postgrest-client";
|
||||
import {getDocument} from "~/api/files/documents";
|
||||
import dayjs from "dayjs";
|
||||
import { formatDate } from "~/utils";
|
||||
|
||||
/**
|
||||
@@ -344,22 +345,22 @@ export async function getReviewPoints(fileId: string) {
|
||||
evaluatedPointResultsLog: evaluatedPointResultsLog || {}
|
||||
// evaluatedPointResultsLog: {
|
||||
// rules:[
|
||||
// {
|
||||
// "id": "0",
|
||||
// "type": "consistency",
|
||||
// "res": true,
|
||||
// "config": {
|
||||
// "logic": "all",
|
||||
// "pairs": [
|
||||
// {
|
||||
// "sourceField": {"证据先行登记保存批准书-负责人意见并签名-时间": {page: 1,value: ''}},
|
||||
// "targetField": {"证据先行登记保存批准书-负责人意见并签名-签名": {page: 2,value: '有无判断类型'}},
|
||||
// "compareMethod": "exact",
|
||||
// "res": true
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "id": "0",
|
||||
// "type": "consistency",
|
||||
// "res": true,
|
||||
// "config": {
|
||||
// "logic": "all",
|
||||
// "pairs": [
|
||||
// {
|
||||
// "sourceField": {"证据先行登记保存批准书-负责人意见并签名-时间": {page: 1,value: ''}},
|
||||
// "targetField": {"证据先行登记保存批准书-负责人意见并签名-签名": {page: 2,value: '有无判断类型'}},
|
||||
// "compareMethod": "exact",
|
||||
// "res": true
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// "id": "1",
|
||||
// "type": "consistency",
|
||||
@@ -611,7 +612,7 @@ export async function getReviewPoints(fileId: string) {
|
||||
|
||||
// 构建评查信息对象
|
||||
const reviewInfo = {
|
||||
reviewTime: formatDate(latestUpdatedAt),
|
||||
reviewTime: dayjs.utc(latestUpdatedAt).format('YYYY-MM-DD HH:mm:ss'),
|
||||
reviewModel: 'DeepSeek',
|
||||
ruleGroup: uniqueGroups.join('、'),
|
||||
result: issueCount > 0 ? 'warning' : 'success',
|
||||
@@ -661,7 +662,7 @@ export async function updateReviewResult(resultId: string, editAuditStatusId: st
|
||||
|
||||
// 判断是否是重新审核操作
|
||||
const isReview = result === 'review';
|
||||
console.log('isReview-------', result);
|
||||
// console.log('isReview-------', result);
|
||||
|
||||
// 构建要更新的数据,保留原有字段
|
||||
const updatedEvaluatedResults = {
|
||||
@@ -689,8 +690,8 @@ export async function updateReviewResult(resultId: string, editAuditStatusId: st
|
||||
// 确定edit_audit_status的值:
|
||||
// 如果是重新审核操作,值为0;否则值为1
|
||||
const editAuditStatusValue = isReview ? 0 : 1;
|
||||
console.log('editAuditStatusValue-------', editAuditStatusValue);
|
||||
console.log('editAuditStatusId-------', editAuditStatusId);
|
||||
// console.log('editAuditStatusValue-------', editAuditStatusValue);
|
||||
// console.log('editAuditStatusId-------', editAuditStatusId);
|
||||
if (editAuditStatusId && editAuditStatusId !== '') {
|
||||
// 更新现有审核状态记录
|
||||
const auditStatusResponse = await postgrestPut(
|
||||
|
||||
@@ -442,7 +442,7 @@ export async function createRuleGroup(groupData: RuleGroupCreateUpdateDto): Prom
|
||||
is_enabled: groupData.is_enabled
|
||||
};
|
||||
|
||||
console.log('创建评查点分组请求数据:', JSON.stringify(apiGroup, null, 2));
|
||||
// console.log('创建评查点分组请求数据:', JSON.stringify(apiGroup, null, 2));
|
||||
|
||||
// 直接发送到 PostgreSQL 表
|
||||
const response = await postgrestPost<ApiResponse<ApiRuleGroup> | ApiRuleGroup, ApiRuleGroup>(
|
||||
@@ -455,7 +455,7 @@ export async function createRuleGroup(groupData: RuleGroupCreateUpdateDto): Prom
|
||||
return { error: response.error, status: response.status };
|
||||
}
|
||||
|
||||
console.log('创建评查点分组响应数据:', JSON.stringify(response.data, null, 2));
|
||||
// console.log('创建评查点分组响应数据:', JSON.stringify(response.data, null, 2));
|
||||
|
||||
// 处理响应数据 - 适配不同的API响应格式
|
||||
const apiResponse = extractApiData<ApiRuleGroup>(response.data);
|
||||
|
||||
@@ -313,7 +313,7 @@ export async function getReviewFiles(searchParams: DocumentSearchParams = {}): P
|
||||
// }
|
||||
|
||||
params.filter = filter;
|
||||
console.log('params-----',params);
|
||||
// console.log('params-----',params);
|
||||
|
||||
// 发送API请求获取文档列表
|
||||
const response = await postgrestGet<Document[]>('documents', params);
|
||||
|
||||
@@ -141,7 +141,7 @@ function mapApiRuleToFrontendModel(apiRule: ApiRule): Rule {
|
||||
priority: priorityMap[apiRule.risk] || 'medium',
|
||||
description: apiRule.description || '',
|
||||
isActive: apiRule.is_enabled === undefined ? false : apiRule.is_enabled,
|
||||
createdAt: apiRule.created_at ,
|
||||
createdAt: apiRule.created_at,
|
||||
updatedAt: apiRule.updated_at
|
||||
};
|
||||
}
|
||||
@@ -365,7 +365,7 @@ export async function getRulesList(params: RulesQueryParams): Promise<{data: Rul
|
||||
|
||||
|
||||
// 将API返回的数据映射到前端模型,并附加分组名称
|
||||
console.log("groupsMap",groupsMap);
|
||||
// console.log("groupsMap",groupsMap);
|
||||
const mappedRules = filteredRules.map(apiRule => {
|
||||
// 创建修改版的apiRule,添加从分组映射获取的名称
|
||||
const enhancedApiRule = {
|
||||
@@ -620,7 +620,7 @@ export async function updateRule(id: string, ruleData: Partial<Omit<Rule, 'id' |
|
||||
*/
|
||||
export async function deleteRule(id: string): Promise<{data: Rule; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
console.log(`开始删除评查点, ID: ${id}`);
|
||||
// console.log(`开始删除评查点, ID: ${id}`);
|
||||
|
||||
// 使用 PostgREST 语法,通过查询参数指定要删除的行
|
||||
const postgrestParams: PostgrestParams = {
|
||||
@@ -635,7 +635,7 @@ export async function deleteRule(id: string): Promise<{data: Rule; error?: never
|
||||
// 使用postgrestDelete删除评查点
|
||||
const response = await postgrestDelete('evaluation_points', postgrestParams);
|
||||
|
||||
console.log('删除请求响应:', JSON.stringify(response, null, 2));
|
||||
// console.log('删除请求响应:', JSON.stringify(response, null, 2));
|
||||
|
||||
// 检查是否有错误响应
|
||||
if (response.error) {
|
||||
@@ -842,7 +842,7 @@ export async function getRuleTypes(): Promise<{data: RuleType[]; error?: never}
|
||||
return { error: '9000接口返回数据格式不正确', status: 500 };
|
||||
}
|
||||
}else if(Array.isArray(response.data) && response.data.length > 0){
|
||||
console.log("评查点类型列表",response.data);
|
||||
// console.log("评查点类型列表",response.data);
|
||||
const ruleTypes = response.data.map(item => ({
|
||||
id: item.id.toString(),
|
||||
pid: item.pid.toString(),
|
||||
@@ -924,7 +924,7 @@ export async function getRuleGroupsByType(typeId: string): Promise<{data: RuleGr
|
||||
return { error: '9000接口返回数据格式不正确', status: 500 };
|
||||
}
|
||||
}else if(Array.isArray(response.data) && response.data.length > 0){
|
||||
console.log("评查点类型列表",response.data);
|
||||
// console.log("评查点类型列表",response.data);
|
||||
const ruleGroups = response.data.map(item => ({
|
||||
id: item.id.toString(),
|
||||
name: item.name,
|
||||
@@ -1080,7 +1080,7 @@ export async function getEvaluationPoint(id: number): Promise<{
|
||||
status?: number;
|
||||
}> {
|
||||
try {
|
||||
console.log(`获取评查点数据,ID: ${id}`);
|
||||
// console.log(`获取评查点数据,ID: ${id}`);
|
||||
|
||||
// 使用 postgrestGet 替代直接调用 fetch
|
||||
const postgrestParams: PostgrestParams = {
|
||||
@@ -1140,7 +1140,7 @@ export async function getEvaluationPointGroups(): Promise<{
|
||||
status?: number;
|
||||
}> {
|
||||
try {
|
||||
console.log("获取评查点组数据");
|
||||
// console.log("获取评查点组数据");
|
||||
|
||||
// 使用 postgrestGet 替代直接调用 fetch
|
||||
const postgrestParams: PostgrestParams = {
|
||||
@@ -1256,7 +1256,7 @@ export async function saveEvaluationPoint(evaluationPoint: EvaluationPointInput,
|
||||
status?: number;
|
||||
}> {
|
||||
try {
|
||||
console.log(`${isEditMode ? '更新' : '创建'}评查点数据`);
|
||||
// console.log(`${isEditMode ? '更新' : '创建'}评查点数据`);
|
||||
|
||||
// 创建一个符合数据库模式的数据副本
|
||||
const cleanedData = {
|
||||
@@ -1393,7 +1393,7 @@ export async function saveEvaluationPoint(evaluationPoint: EvaluationPointInput,
|
||||
});
|
||||
}
|
||||
|
||||
console.log("准备发送到API的数据大小:", JSON.stringify(cleanedData).length, "字节");
|
||||
// console.log("准备发送到API的数据大小:", JSON.stringify(cleanedData).length, "字节");
|
||||
|
||||
// 使用 postgrest-client 替代直接 fetch 调用
|
||||
let response;
|
||||
|
||||
@@ -448,7 +448,7 @@ export async function updateDocument(id: string, document: Partial<DocumentUI> &
|
||||
apiDocument.remark = document.remark;
|
||||
}
|
||||
|
||||
console.log('更新文档API数据:', apiDocument);
|
||||
// console.log('更新文档API数据:', apiDocument);
|
||||
|
||||
const response = await postgrestPut<Document, Partial<Document>>(
|
||||
'documents',
|
||||
|
||||
@@ -131,7 +131,7 @@ export async function uploadDocumentToServer(
|
||||
isTestDocument: boolean = false
|
||||
): Promise<{data: FileUploadResponse; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
console.log('【调试】开始上传文档:', { fileName, fileSize: binaryData.byteLength });
|
||||
// console.log('【调试】开始上传文档:', { fileName, fileSize: binaryData.byteLength });
|
||||
|
||||
// 创建FormData对象
|
||||
const formData = new FormData();
|
||||
@@ -139,7 +139,7 @@ export async function uploadDocumentToServer(
|
||||
// 将二进制数据转换为Blob并添加到FormData
|
||||
const blob = new Blob([binaryData], { type: fileType });
|
||||
formData.append('file', blob, fileName);
|
||||
console.log('【调试】Blob已创建,文件大小:', blob.size);
|
||||
// console.log('【调试】Blob已创建,文件大小:', blob.size);
|
||||
|
||||
// 将信息添加到一个JSON对象中
|
||||
const uploadInfo = {
|
||||
@@ -152,14 +152,14 @@ export async function uploadDocumentToServer(
|
||||
|
||||
// 添加JSON字符串到FormData
|
||||
formData.append('upload_info', JSON.stringify(uploadInfo));
|
||||
console.log('【调试】FormData准备完成:', JSON.stringify(uploadInfo));
|
||||
// console.log('【调试】FormData准备完成:', JSON.stringify(uploadInfo));
|
||||
|
||||
console.log('【调试】准备发送请求到服务器:', 'http://172.16.0.58:8008/admin/documents/upload');
|
||||
// console.log('【调试】准备发送请求到服务器:', 'http://172.16.0.58:8008/admin/documents/upload');
|
||||
|
||||
// 发送请求
|
||||
// const response = await fetch(`${API_BASE_URL}/admin/documents/upload`, {
|
||||
try {
|
||||
console.log('【调试】开始fetch请求...');
|
||||
// console.log('【调试】开始fetch请求...');
|
||||
const response = await fetch('http://172.16.0.58:8008/admin/documents/upload', {
|
||||
// const response = await fetch('http://172.16.0.55:8000/admin/documents/upload', {
|
||||
// const response = await fetch('http://172.16.0.119:8000/admin/documents/upload', {
|
||||
@@ -170,7 +170,7 @@ export async function uploadDocumentToServer(
|
||||
body: formData
|
||||
});
|
||||
|
||||
console.log('【调试】收到服务器响应:', { status: response.status, statusText: response.statusText });
|
||||
// console.log('【调试】收到服务器响应:', { status: response.status, statusText: response.statusText });
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
@@ -181,11 +181,11 @@ export async function uploadDocumentToServer(
|
||||
};
|
||||
}
|
||||
|
||||
console.log('【调试】开始解析JSON响应');
|
||||
// console.log('【调试】开始解析JSON响应');
|
||||
let responseData;
|
||||
try {
|
||||
responseData = await response.json();
|
||||
console.log('【调试】JSON响应解析成功:', responseData);
|
||||
// console.log('【调试】JSON响应解析成功:', responseData);
|
||||
} catch (jsonError) {
|
||||
console.error('【调试】JSON解析失败:', jsonError);
|
||||
return {
|
||||
@@ -195,14 +195,14 @@ export async function uploadDocumentToServer(
|
||||
}
|
||||
|
||||
const extractedData = extractApiData<FileUploadResponse>(responseData);
|
||||
console.log('【调试】提取的数据:', extractedData);
|
||||
// console.log('【调试】提取的数据:', extractedData);
|
||||
|
||||
if (!extractedData) {
|
||||
console.error('【调试】无法提取数据');
|
||||
return { error: '处理上传响应失败', status: 500 };
|
||||
}
|
||||
|
||||
console.log('【调试】上传成功,返回数据');
|
||||
// console.log('【调试】上传成功,返回数据');
|
||||
return { data: extractedData };
|
||||
} catch (fetchError) {
|
||||
console.error('【调试】fetch请求失败:', fetchError);
|
||||
@@ -227,7 +227,7 @@ export async function uploadDocumentToServer(
|
||||
export async function getTodayDocuments(): Promise<{data: Document[]; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
const today = dayjs().startOf('day').format('YYYY-MM-DD');
|
||||
console.log('查询当天文档,日期范围:', today);
|
||||
// console.log('查询当天文档,日期范围:', today);
|
||||
|
||||
const params: PostgrestParams = {
|
||||
select: `
|
||||
|
||||
@@ -225,7 +225,7 @@ export async function getHomeData(): Promise<HomeStatistics> {
|
||||
? parseFloat(((lastMonthTotal / lastMonthReviewed) * 100).toFixed(1))
|
||||
: 0;
|
||||
|
||||
console.log('上个月-------', lastMonthPassRate);
|
||||
// console.log('上个月-------', lastMonthPassRate);
|
||||
|
||||
// 计算通过率同比增长
|
||||
let passRateGrowthValue = 0;
|
||||
@@ -242,8 +242,8 @@ export async function getHomeData(): Promise<HomeStatistics> {
|
||||
passRateGrowthIsUp = true;
|
||||
}
|
||||
|
||||
console.log('上月通过率-------', lastMonthPassRate);
|
||||
console.log('本月通过率-------', monthlyPassRate);
|
||||
// console.log('上月通过率-------', lastMonthPassRate);
|
||||
// console.log('本月通过率-------', monthlyPassRate);
|
||||
|
||||
// 4. 检查出的问题总数(从评估结果表中统计)
|
||||
const thisMonthIssuesParams: PostgrestParams = {
|
||||
|
||||
+16
-16
@@ -55,22 +55,22 @@ function logPostgrestQuery(endpoint: string, params?: QueryParams, method: strin
|
||||
// 确保 endpoint 格式正确
|
||||
const normalizedEndpoint = endpoint.startsWith('/') ? endpoint.substring(1) : endpoint;
|
||||
|
||||
console.log('\n📦 PostgREST 查询日志 ======================start=============');
|
||||
console.log(`📦 HTTP 方法: ${method}`);
|
||||
console.log(`📦 API 端点: ${decodeUrlForDisplay(`${baseUrl}/${normalizedEndpoint}`)}`);
|
||||
// console.log('\n📦 PostgREST 查询日志 ======================start=============');
|
||||
// console.log(`📦 HTTP 方法: ${method}`);
|
||||
// console.log(`📦 API 端点: ${decodeUrlForDisplay(`${baseUrl}/${normalizedEndpoint}`)}`);
|
||||
|
||||
if (params && Object.keys(params).length > 0) {
|
||||
console.log('📦 查询参数:');
|
||||
// if (params && Object.keys(params).length > 0) {
|
||||
// console.log('📦 查询参数:');
|
||||
|
||||
// 以可读格式单独打印每个参数
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
console.log(` - ${key}: ${JSON.stringify(value)}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
// // 以可读格式单独打印每个参数
|
||||
// Object.entries(params).forEach(([key, value]) => {
|
||||
// if (value !== undefined) {
|
||||
// console.log(` - ${key}: ${JSON.stringify(value)}`);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
console.log('PostgREST 查询日志=============================end============\n');
|
||||
// console.log('PostgREST 查询日志=============================end============\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,8 +305,8 @@ export async function postgrestPost<T, D = Record<string, unknown>>(endpoint: st
|
||||
|
||||
// 确保数据是合法的JSON对象
|
||||
const requestBody = JSON.stringify(processedData);
|
||||
console.log(`准备发送 PostgreSQL 插入请求到: ${apiEndpoint}`);
|
||||
console.log(`请求体: ${requestBody}`);
|
||||
// console.log(`准备发送 PostgreSQL 插入请求到: ${apiEndpoint}`);
|
||||
// console.log(`请求体: ${requestBody}`);
|
||||
|
||||
try {
|
||||
const response = await apiRequest<T>(
|
||||
@@ -327,7 +327,7 @@ export async function postgrestPost<T, D = Record<string, unknown>>(endpoint: st
|
||||
throw new Error(response.error);
|
||||
}
|
||||
|
||||
console.log(`POST请求成功,响应: `, response.data);
|
||||
// console.log(`POST请求成功,响应: `, response.data);
|
||||
return { data: response.data as T };
|
||||
} catch (error) {
|
||||
// 捕获并处理 API 请求错误
|
||||
|
||||
@@ -121,7 +121,7 @@ export async function getPromptTemplates(searchParams: PromptSearchParams = {}):
|
||||
status?: number;
|
||||
}> {
|
||||
try {
|
||||
console.log('获取提示词模板列表,参数:', searchParams);
|
||||
// console.log('获取提示词模板列表,参数:', searchParams);
|
||||
|
||||
const page = searchParams.page || 1;
|
||||
const pageSize = searchParams.pageSize || 10;
|
||||
@@ -177,7 +177,7 @@ export async function getPromptTemplates(searchParams: PromptSearchParams = {}):
|
||||
params.filter = filter;
|
||||
|
||||
// 发送API请求
|
||||
console.log('API请求参数:', params);
|
||||
// console.log('API请求参数:', params);
|
||||
const response = await postgrestGet<PromptTemplate[]>('prompt_templates', params);
|
||||
|
||||
if (response.error) {
|
||||
@@ -320,7 +320,7 @@ export async function createPromptTemplate(template: Partial<PromptTemplateUI>):
|
||||
};
|
||||
|
||||
if(apiTemplate){
|
||||
console.log('apiTemplate', apiTemplate);
|
||||
// console.log('apiTemplate', apiTemplate);
|
||||
// throw new Error('测试错误');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user