删除所有console.log输出,优化评查结果的表格的显示,添加新的页码获取逻辑
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user