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
import { APPROVE_TYPE, ApproveType, TimeUnitType } from '../../consts';
 
/** 获取条件节点默认的名称 */
export function getDefaultConditionNodeName(
  index: number,
  defaultFlow: boolean | undefined,
): string {
  if (defaultFlow) {
    return '其它情况';
  }
  return `条件${index + 1}`;
}
 
/** 获取包容分支条件节点默认的名称 */
export function getDefaultInclusiveConditionNodeName(
  index: number,
  defaultFlow: boolean | undefined,
): string {
  if (defaultFlow) {
    return '其它情况';
  }
  return `包容条件${index + 1}`;
}
 
/** 转换时间单位字符串为枚举值 */
export function convertTimeUnit(strTimeUnit: string) {
  if (strTimeUnit === 'M') {
    return TimeUnitType.MINUTE;
  }
  if (strTimeUnit === 'H') {
    return TimeUnitType.HOUR;
  }
  if (strTimeUnit === 'D') {
    return TimeUnitType.DAY;
  }
  return TimeUnitType.HOUR;
}
 
/** 根据审批类型获取对应的文本描述 */
export function getApproveTypeText(approveType: ApproveType): string {
  let approveTypeText = '';
  APPROVE_TYPE.forEach((item) => {
    if (item.value === approveType) {
      approveTypeText = item.label;
    }
  });
  return approveTypeText;
}