feat(pwl): 接入生成报告接口功能
This commit is contained in:
38
src/api/ai/auditReport/index.ts
Normal file
38
src/api/ai/auditReport/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { AuditReport, AuditReportParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
import {User} from "@/api/system/user/model";
|
||||
|
||||
|
||||
/**
|
||||
* 生成审计报告-单一模块
|
||||
*/
|
||||
export async function generateAuditReport(data: AuditReport) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/ai/auditReport/generate',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成并下载审计报告
|
||||
*/
|
||||
export async function downloadAuditReport(req: AuditReport) {
|
||||
const res = await request.post(
|
||||
MODULES_API_URL + '/ai/auditReport/download',
|
||||
req,
|
||||
{
|
||||
responseType: 'blob' // 处理二进制流响应
|
||||
}
|
||||
);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('文件下载失败'));
|
||||
}
|
||||
Reference in New Issue
Block a user