liu
昨天 b725cca0ff60728be04ef2ddb4cde5fcdf80bf8e
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
import { requestClient } from '#/api/request';
 
export namespace BpmAutoApproveApi {
  /** 流程免审批配置 */
  export interface AutoApproveConfig {
    id: number;
    /** 流程定义的 Key */
    processDefinitionKey: string;
    /** 是否免审批:true-提交后系统自动通过,false-正常人工审批 */
    autoApprove: boolean;
    /** 备注 */
    remark?: string;
    createTime: string;
  }
}
 
/** 获取全部流程免审批配置 */
export async function getAutoApproveList() {
  return requestClient.get<BpmAutoApproveApi.AutoApproveConfig[]>(
    '/bpm/process-auto-approve/list',
  );
}
 
/** 获得全局免审批总开关状态 */
export async function getGlobalAutoApprove() {
  return requestClient.get<boolean>('/bpm/process-auto-approve/global');
}
 
/** 设置全局免审批总开关:开启后所有流程一律免审批 */
export async function updateGlobalAutoApprove(
  autoApprove: boolean,
  remark?: string,
) {
  const params = new URLSearchParams({ autoApprove: String(autoApprove) });
  if (remark) {
    params.append('remark', remark);
  }
  return requestClient.put<boolean>(
    `/bpm/process-auto-approve/update-global?${params.toString()}`,
  );
}
 
/** 按流程定义的 Key 设置免审批开关(不存在则新增、存在则更新) */
export async function updateAutoApproveByKey(
  processDefinitionKey: string,
  autoApprove: boolean,
  remark?: string,
) {
  const params = new URLSearchParams({
    processDefinitionKey,
    autoApprove: String(autoApprove),
  });
  if (remark) {
    params.append('remark', remark);
  }
  return requestClient.put<boolean>(
    `/bpm/process-auto-approve/update-by-key?${params.toString()}`,
  );
}