feat:项目管理-审计内容3-新增历史记录功能
This commit is contained in:
129
src/api/ai/aiHistory/index.ts
Normal file
129
src/api/ai/aiHistory/index.ts
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { AiHistory, AiHistoryParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function pageAiHistory(params: AiHistoryParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<AiHistory>>>(
|
||||||
|
`${MODULES_API_URL}/ai/history/page`,
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询AI审计历史记录表列表
|
||||||
|
*/
|
||||||
|
export async function listAiHistory(params?: AiHistoryParam) {
|
||||||
|
const res = await request.get<ApiResult<AiHistory[]>>(
|
||||||
|
`${MODULES_API_URL}/ai/history`,
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function getAiHistory(id: number) {
|
||||||
|
const res = await request.get<ApiResult<AiHistory>>(
|
||||||
|
`${MODULES_API_URL}/ai/history/${id}`
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function addAiHistory(data: AiHistory) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
`${MODULES_API_URL}/ai/history`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function updateAiHistory(data: AiHistory) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
`${MODULES_API_URL}/ai/history`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function removeAiHistory(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
`${MODULES_API_URL}/ai/history/${id}`
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量添加AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function addAiHistoryBatch(data: AiHistory[]) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
`${MODULES_API_URL}/ai/history/batch`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function updateAiHistoryBatch(data: { list: AiHistory[] }) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
`${MODULES_API_URL}/ai/history/batch`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export async function removeAiHistoryBatch(ids: number[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
`${MODULES_API_URL}/ai/history/batch`,
|
||||||
|
{ data: ids }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
41
src/api/ai/aiHistory/model/index.ts
Normal file
41
src/api/ai/aiHistory/model/index.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI审计历史记录表
|
||||||
|
*/
|
||||||
|
export interface AiHistory {
|
||||||
|
// 主键ID
|
||||||
|
id?: number;
|
||||||
|
// 请求哈希值
|
||||||
|
requestHash?: string;
|
||||||
|
// 接口名称
|
||||||
|
interfaceName?: string;
|
||||||
|
// 用户ID
|
||||||
|
userId?: number;
|
||||||
|
// 用户名
|
||||||
|
username?: string;
|
||||||
|
// 状态, 0正常, 1冻结
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AI审计历史记录表搜索条件
|
||||||
|
*/
|
||||||
|
export interface AiHistoryParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
requestHash?: string;
|
||||||
|
interfaceName?: string;
|
||||||
|
userId?: number;
|
||||||
|
username?: string;
|
||||||
|
status?: number;
|
||||||
|
deleted?: number;
|
||||||
|
tenantId?: number;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user