@@ -1,5 +1,7 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { BpmModelApi } from '#/api/bpm/model';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmCategoryApi {
|
||||
@@ -11,6 +13,13 @@ export namespace BpmCategoryApi {
|
||||
status: number;
|
||||
sort: number; // 分类排序
|
||||
}
|
||||
|
||||
/** 模型分类信息 */
|
||||
export interface ModelCategoryInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
modelList: BpmModelApi.ModelVO[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询流程分类分页 */
|
||||
@@ -30,15 +39,30 @@ export async function getCategory(id: number) {
|
||||
|
||||
/** 新增流程分类 */
|
||||
export async function createCategory(data: BpmCategoryApi.CategoryVO) {
|
||||
return requestClient.post('/bpm/category/create', data);
|
||||
return requestClient.post<number>('/bpm/category/create', data);
|
||||
}
|
||||
|
||||
/** 修改流程分类 */
|
||||
export async function updateCategory(data: BpmCategoryApi.CategoryVO) {
|
||||
return requestClient.put('/bpm/category/update', data);
|
||||
return requestClient.put<boolean>('/bpm/category/update', data);
|
||||
}
|
||||
|
||||
/** 删除流程分类 */
|
||||
export async function deleteCategory(id: number) {
|
||||
return requestClient.delete(`/bpm/category/delete?id=${id}`);
|
||||
return requestClient.delete<boolean>(`/bpm/category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 查询流程分类列表 */
|
||||
export async function getCategorySimpleList() {
|
||||
return requestClient.get<BpmCategoryApi.CategoryVO[]>(
|
||||
`/bpm/category/simple-list`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量修改流程分类的排序 */
|
||||
export async function updateCategorySortBatch(ids: number[]) {
|
||||
const params = ids.join(',');
|
||||
return requestClient.put<boolean>(
|
||||
`/bpm/category/update-sort-batch?ids=${params}`,
|
||||
);
|
||||
}
|
||||
|
||||
107
apps/web-antd/src/api/bpm/model/index.ts
Normal file
107
apps/web-antd/src/api/bpm/model/index.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace BpmModelApi {
|
||||
/** 用户信息 TODO 这个是不是可以抽取出来定义在公共模块 */
|
||||
export interface UserInfo {
|
||||
id: number;
|
||||
nickname: string;
|
||||
avatar?: string;
|
||||
deptId?: number;
|
||||
deptName?: string;
|
||||
}
|
||||
/** 流程定义 VO */
|
||||
export interface ProcessDefinitionVO {
|
||||
id: string;
|
||||
version: number;
|
||||
deploymentTime: number;
|
||||
suspensionState: number;
|
||||
formType?: number;
|
||||
}
|
||||
|
||||
/** 流程模型 VO */
|
||||
export interface ModelVO {
|
||||
id: number;
|
||||
key: string;
|
||||
name: string;
|
||||
icon?: string;
|
||||
description: string;
|
||||
category: string;
|
||||
formName: string;
|
||||
formType: number;
|
||||
formId: number;
|
||||
formCustomCreatePath: string;
|
||||
formCustomViewPath: string;
|
||||
processDefinition: ProcessDefinitionVO;
|
||||
status: number;
|
||||
remark: string;
|
||||
createTime: string;
|
||||
bpmnXml: string;
|
||||
startUsers?: UserInfo[];
|
||||
}
|
||||
|
||||
/** 模型分类信息 */
|
||||
export interface ModelCategoryInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
modelList: ModelVO[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取流程模型列表 */
|
||||
export async function getModelList(name: string | undefined) {
|
||||
return requestClient.get<BpmModelApi.ModelVO[]>('/bpm/model/list', {
|
||||
params: { name },
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取流程模型详情 */
|
||||
export async function getModel(id: string) {
|
||||
return requestClient.get<BpmModelApi.ModelVO>(`/bpm/model/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 更新流程模型 */
|
||||
export async function updateModel(data: BpmModelApi.ModelVO) {
|
||||
return requestClient.put('/bpm/model/update', data);
|
||||
}
|
||||
|
||||
/** 批量修改流程模型排序 */
|
||||
export async function updateModelSortBatch(ids: number[]) {
|
||||
const params = ids.join(',');
|
||||
return requestClient.put<boolean>(
|
||||
`/bpm/model/update-sort-batch?ids=${params}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新流程模型的 BPMN XML */
|
||||
export async function updateModelBpmn(data: BpmModelApi.ModelVO) {
|
||||
return requestClient.put('/bpm/model/update-bpmn', data);
|
||||
}
|
||||
|
||||
/** 更新流程模型状态 */
|
||||
export async function updateModelState(id: number, state: number) {
|
||||
const data = {
|
||||
id,
|
||||
state,
|
||||
};
|
||||
return requestClient.put('/bpm/model/update-state', data);
|
||||
}
|
||||
|
||||
/** 创建流程模型 */
|
||||
export async function createModel(data: BpmModelApi.ModelVO) {
|
||||
return requestClient.post('/bpm/model/create', data);
|
||||
}
|
||||
|
||||
/** 删除流程模型 */
|
||||
export async function deleteModel(id: number) {
|
||||
return requestClient.delete(`/bpm/model/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 部署流程模型 */
|
||||
export async function deployModel(id: number) {
|
||||
return requestClient.post(`/bpm/model/deploy?id=${id}`);
|
||||
}
|
||||
|
||||
/** 清理流程模型 */
|
||||
export async function cleanModel(id: number) {
|
||||
return requestClient.delete(`/bpm/model/clean?id=${id}`);
|
||||
}
|
||||
Reference in New Issue
Block a user