feat: 1. 完善评查点分组的删除逻辑,会涉及文档类型绑定的一级分组,分组绑定的评查点规则。新增一个评查点分组换绑的。
2. 修复交叉评查的任务中的文档列表的历史文档的查看跳转路径。 3. 修复评查点新增中评查点类型只能显示当前文档类型绑定的这几个一级分组。评查点类型=一级分组。 4. 修复文档列表关于pdf的下载失败的问题。
This commit is contained in:
@@ -45,6 +45,39 @@ interface ApiResponse<T> {
|
||||
data: T;
|
||||
}
|
||||
|
||||
/** 文档类型信息(用于删除换绑) */
|
||||
export interface DocTypeInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 删除分组响应 */
|
||||
export interface DeleteGroupResponse {
|
||||
success: boolean;
|
||||
message?: string;
|
||||
deleted_count?: number;
|
||||
deleted_groups?: number;
|
||||
deleted_points?: number;
|
||||
/** 是否需要换绑(仅删除一级分组时) */
|
||||
need_rebind?: boolean;
|
||||
/** 关联的评查点数量 */
|
||||
points_count?: number;
|
||||
/** 只绑定当前分组的文档类型(换绑时替换) */
|
||||
single_bound_doc_types?: DocTypeInfo[];
|
||||
/** 绑定多个分组的文档类型(换绑时移除) */
|
||||
multi_bound_doc_types?: DocTypeInfo[];
|
||||
error?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 换绑响应 */
|
||||
export interface RebindResponse {
|
||||
success: boolean;
|
||||
message: string;
|
||||
rebind_count: number;
|
||||
doc_types_updated: number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -520,13 +553,18 @@ export async function updateEvaluationPointGroup(
|
||||
export async function deleteEvaluationPointGroup(
|
||||
id: string,
|
||||
token?: string
|
||||
): Promise<{success: boolean; message?: string; deleted_groups?: number; deleted_points?: number; error?: never} | {success: false; error: string; status?: number}> {
|
||||
): Promise<DeleteGroupResponse> {
|
||||
try {
|
||||
const response = await apiRequest<{
|
||||
success: boolean;
|
||||
message: string;
|
||||
deleted_groups: number;
|
||||
deleted_points: number;
|
||||
deleted_count?: number;
|
||||
deleted_groups?: number;
|
||||
deleted_points?: number;
|
||||
need_rebind?: boolean;
|
||||
points_count?: number;
|
||||
single_bound_doc_types?: DocTypeInfo[];
|
||||
multi_bound_doc_types?: DocTypeInfo[];
|
||||
}>(
|
||||
`/api/v3/evaluation-point-groups/${id}`,
|
||||
{
|
||||
@@ -543,8 +581,13 @@ export async function deleteEvaluationPointGroup(
|
||||
return {
|
||||
success: response.data.success,
|
||||
message: response.data.message,
|
||||
deleted_groups: response.data.deleted_groups,
|
||||
deleted_points: response.data.deleted_points
|
||||
deleted_count: response.data.deleted_count || 0,
|
||||
deleted_groups: response.data.deleted_groups || 0,
|
||||
deleted_points: response.data.deleted_points || 0,
|
||||
need_rebind: response.data.need_rebind || false,
|
||||
points_count: response.data.points_count || 0,
|
||||
single_bound_doc_types: response.data.single_bound_doc_types || [],
|
||||
multi_bound_doc_types: response.data.multi_bound_doc_types || []
|
||||
};
|
||||
}
|
||||
|
||||
@@ -559,6 +602,55 @@ export async function deleteEvaluationPointGroup(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 7.1 换绑一级分组(FastAPI v3)
|
||||
* @param oldGroupId 要删除的一级分组ID
|
||||
* @param newParentId 新的一级分组ID
|
||||
* @param token JWT token
|
||||
* @returns 换绑结果
|
||||
*/
|
||||
export async function rebindEvaluationPointGroup(
|
||||
oldGroupId: string,
|
||||
newParentId: string,
|
||||
token?: string
|
||||
): Promise<{success: boolean; message?: string; rebind_count?: number; doc_types_updated?: number; error?: never} | {success: false; error: string; status?: number}> {
|
||||
try {
|
||||
const response = await apiRequest<RebindResponse>(
|
||||
`/api/v3/evaluation-point-groups/${oldGroupId}/rebind`,
|
||||
{
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ new_parent_id: Number(newParentId) }),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(token ? { 'Authorization': `Bearer ${token}` } : {})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (response.error) {
|
||||
return { success: false, error: response.error, status: response.status };
|
||||
}
|
||||
|
||||
if (response.data) {
|
||||
return {
|
||||
success: response.data.success,
|
||||
message: response.data.message,
|
||||
rebind_count: response.data.rebind_count,
|
||||
doc_types_updated: response.data.doc_types_updated
|
||||
};
|
||||
}
|
||||
|
||||
return { success: false, error: '换绑失败:返回数据格式不正确', status: 500 };
|
||||
} catch (error) {
|
||||
console.error('❌ 换绑分组出错:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : '换绑分组失败',
|
||||
status: 500
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 8. 批量更新分组启用状态(FastAPI v3)
|
||||
* @param ids 分组ID列表
|
||||
|
||||
@@ -314,7 +314,7 @@ export async function getRulesList(params: RulesQueryParams): Promise<{data: Rul
|
||||
area: point.area || ''
|
||||
};
|
||||
});
|
||||
console.log('✅ [getRulesList] 成功映射评查点列表数据', response.data.data[0]);
|
||||
// console.log('✅ [getRulesList] 成功映射评查点列表数据', response.data.data[0]);
|
||||
|
||||
return {
|
||||
data: {
|
||||
@@ -486,6 +486,8 @@ export async function deleteRule(id: string, token?: string): Promise<{data: {su
|
||||
*/
|
||||
export interface RuleType {
|
||||
id: string;
|
||||
pid?: string;
|
||||
code?: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
isEnabled: boolean;
|
||||
@@ -703,6 +705,7 @@ export async function getRuleGroupsByType(typeId: string, token?: string): Promi
|
||||
if(response.data && 'code' in response.data && response.data.data){
|
||||
if(Array.isArray(response.data.data) && response.data.data.length > 0){
|
||||
// 将API返回的数据映射到前端模型
|
||||
// console.log("评查点类型列表",response.data);
|
||||
const ruleGroups = response.data.data.map(item => ({
|
||||
id: item.id.toString(),
|
||||
name: item.name,
|
||||
|
||||
Reference in New Issue
Block a user