删除所有console.log输出,优化评查结果的表格的显示,添加新的页码获取逻辑

This commit is contained in:
2025-06-02 18:55:00 +08:00
parent 820baa5b22
commit b02978508d
71 changed files with 862 additions and 572 deletions
+10 -10
View File
@@ -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;