刘光辉
5 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
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
import { defHttp } from '#/api/request';
 
export interface DevApprovalState {
  enabled: boolean;
  nodeName?: string;
  operatorId?: string;
  problems: string[];
  status: 'ADVANCED' | 'BLOCKED' | 'PASSED' | 'READY';
}
 
export function inspectDevApproval(taskId: string) {
  return defHttp.get<{ data: DevApprovalState }>({ url: `/api/workflow/devApproval/${encodeURIComponent(taskId)}` }, { errorMessageMode: 'none' });
}
 
export interface DevApprovalProgress {
  completed: number;
  message?: string;
  nodeName?: string;
  runId?: string;
  status: 'BLOCKED' | 'FAILED' | 'IDLE' | 'PASSED' | 'RUNNING' | 'STOPPED' | 'STOPPING';
}
 
export function startDevApprovalRun(taskId: string, signId: string) {
  return defHttp.post<{ data: DevApprovalProgress }>(
    { url: `/api/workflow/devApproval/${encodeURIComponent(taskId)}/run`, data: { signId } },
    { errorMessageMode: 'none' },
  );
}
 
export function getDevApprovalRun(taskId: string) {
  return defHttp.get<{ data: DevApprovalProgress }>({ url: `/api/workflow/devApproval/${encodeURIComponent(taskId)}/run` }, { errorMessageMode: 'none' });
}
 
export function stopDevApprovalRun(taskId: string, runId: string) {
  return defHttp.post<{ data: DevApprovalProgress }>(
    { url: `/api/workflow/devApproval/${encodeURIComponent(taskId)}/run/stop`, data: { runId } },
    { errorMessageMode: 'none' },
  );
}