完善审计报告生成页面
This commit is contained in:
@@ -183,4 +183,117 @@ export async function generateAuditReportWithEvidences(projectId: number, eviden
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('文件下载失败'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目 ID、选中的取证单和章节内容生成审计报告并下载
|
||||
* @param projectId 项目 ID
|
||||
* @param evidenceIds 勾选的取证单 ID 列表
|
||||
* @param chapters 章节内容数组(包含 formCommit 和 reportContent)
|
||||
* @param evaluate 总体评价
|
||||
* @param suggestion 审计建议
|
||||
*/
|
||||
export async function generateAuditReportWithContent(
|
||||
projectId: number,
|
||||
evidenceIds: number[],
|
||||
chapters: Array<{
|
||||
formCommit: number;
|
||||
reportContent: string;
|
||||
}>,
|
||||
evaluate?: string,
|
||||
suggestion?: string
|
||||
) {
|
||||
const res = await request.post(
|
||||
MODULES_API_URL + '/ai/auditReport/generateWithContent',
|
||||
{
|
||||
evidenceIds,
|
||||
chapters,
|
||||
evaluate,
|
||||
suggestion
|
||||
},
|
||||
{
|
||||
params: { projectId },
|
||||
responseType: 'blob' // 处理二进制流响应
|
||||
}
|
||||
);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('文件下载失败'));
|
||||
}
|
||||
|
||||
/**
|
||||
* AI 生成默认话术
|
||||
*/
|
||||
export async function generateDefaultText(params: {
|
||||
projectId?: number;
|
||||
formCommit: number;
|
||||
chapterTitle?: string;
|
||||
evidenceIds?: number[]; // 新增:选中的取证单 ID 列表
|
||||
}) {
|
||||
const res = await request.post<ApiResult<string>>(
|
||||
MODULES_API_URL + '/ai/auditReport/generateDefaultText',
|
||||
{
|
||||
projectId: params.projectId,
|
||||
formCommit: params.formCommit,
|
||||
chapterTitle: params.chapterTitle,
|
||||
evidenceIds: params.evidenceIds
|
||||
}
|
||||
);
|
||||
|
||||
if (res.data.code === 0) {
|
||||
// 后端返回的数据在 message 字段中
|
||||
return res.data.message || res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* AI 分析用户自定义输入
|
||||
*/
|
||||
export async function analyzeUserInput(params: {
|
||||
formCommit: number;
|
||||
userQuestion: string;
|
||||
chapterContent?: string;
|
||||
}) {
|
||||
const res = await request.post<ApiResult<string>>(
|
||||
MODULES_API_URL + '/ai/auditReport/analyzeUserInput',
|
||||
null,
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据取证单生成审计建议
|
||||
*/
|
||||
export async function generateAuditSuggestion(params: {
|
||||
projectId: number;
|
||||
evidenceIds: number[];
|
||||
}) {
|
||||
const res = await request.post<ApiResult<string>>(
|
||||
MODULES_API_URL + '/ai/auditReport/generateAuditSuggestion',
|
||||
{ evidenceIds: params.evidenceIds },
|
||||
{
|
||||
params: {
|
||||
projectId: params.projectId
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (res.data.code === 0) {
|
||||
// 后端返回的数据在 message 字段中
|
||||
return res.data.message || res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user