gaoluyang
2026-06-24 c0cb161bb52ce0fbdce5c66ec391d107c75e2452
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { requestClient } from '#/api/request';
 
export namespace BpmModelApi {
  /** 流程模型 */
  export interface Model {
    id: number;
    key: string;
    name: string;
    icon?: string;
    description: string;
    category: string;
    formName: string;
    formType: number;
    formId: number;
    formCustomCreatePath: string;
    formCustomViewPath: string;
    processDefinition: ProcessDefinition;
    status: number;
    remark: string;
    createTime: string;
    bpmnXml: string;
    startUsers?: UserInfo[];
  }
 
  /** 流程定义 */
  export interface ProcessDefinition {
    id: string;
    key?: string;
    version: number;
    deploymentTime: number;
    suspensionState: number;
    formType?: number;
    formCustomCreatePath?: string;
    formCustomViewPath?: string;
    formFields?: string[];
  }
 
  /** 用户信息 */
  export interface UserInfo {
    id: number;
    nickname: string;
    avatar?: string;
    deptId?: number;
    deptName?: string;
  }
}
 
/** 模型分类信息 */
export interface ModelCategoryInfo {
  id: number;
  name: string;
  modelList: BpmModelApi.Model[];
}
 
/** 获取流程模型列表 */
export async function getModelList(name?: string) {
  return requestClient.get<BpmModelApi.Model[]>('/bpm/model/list', {
    params: { name },
  });
}
 
/** 获取流程模型详情 */
export async function getModel(id: string) {
  return requestClient.get<BpmModelApi.Model>(`/bpm/model/get?id=${id}`);
}
 
/** 更新流程模型 */
export async function updateModel(data: BpmModelApi.Model) {
  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.Model) {
  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.Model) {
  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}`);
}