提交 | 用户 | 时间
|
314507
|
1 |
/** |
H |
2 |
* todo |
|
3 |
*/ |
|
4 |
export const arrToStr = (arr?: [{ name: string }]) => { |
|
5 |
if (arr) { |
|
6 |
return arr |
|
7 |
.map((item) => { |
|
8 |
return item.name |
|
9 |
}) |
|
10 |
.toString() |
|
11 |
} |
|
12 |
} |
|
13 |
|
|
14 |
export const setApproverStr = (nodeConfig: any) => { |
|
15 |
if (nodeConfig.settype == 1) { |
|
16 |
if (nodeConfig.nodeUserList.length == 1) { |
|
17 |
return nodeConfig.nodeUserList[0].name |
|
18 |
} else if (nodeConfig.nodeUserList.length > 1) { |
|
19 |
if (nodeConfig.examineMode == 1) { |
|
20 |
return arrToStr(nodeConfig.nodeUserList) |
|
21 |
} else if (nodeConfig.examineMode == 2) { |
|
22 |
return nodeConfig.nodeUserList.length + '人会签' |
|
23 |
} |
|
24 |
} |
|
25 |
} else if (nodeConfig.settype == 2) { |
|
26 |
const level = |
|
27 |
nodeConfig.directorLevel == 1 ? '直接主管' : '第' + nodeConfig.directorLevel + '级主管' |
|
28 |
if (nodeConfig.examineMode == 1) { |
|
29 |
return level |
|
30 |
} else if (nodeConfig.examineMode == 2) { |
|
31 |
return level + '会签' |
|
32 |
} |
|
33 |
} else if (nodeConfig.settype == 4) { |
|
34 |
if (nodeConfig.selectRange == 1) { |
|
35 |
return '发起人自选' |
|
36 |
} else { |
|
37 |
if (nodeConfig.nodeUserList.length > 0) { |
|
38 |
if (nodeConfig.selectRange == 2) { |
|
39 |
return '发起人自选' |
|
40 |
} else { |
|
41 |
return '发起人从' + nodeConfig.nodeUserList[0].name + '中自选' |
|
42 |
} |
|
43 |
} else { |
|
44 |
return '' |
|
45 |
} |
|
46 |
} |
|
47 |
} else if (nodeConfig.settype == 5) { |
|
48 |
return '发起人自己' |
|
49 |
} else if (nodeConfig.settype == 7) { |
|
50 |
return '从直接主管到通讯录中级别最高的第' + nodeConfig.examineEndDirectorLevel + '个层级主管' |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
export const copyerStr = (nodeConfig: any) => { |
|
55 |
if (nodeConfig.nodeUserList.length != 0) { |
|
56 |
return arrToStr(nodeConfig.nodeUserList) |
|
57 |
} else { |
|
58 |
if (nodeConfig.ccSelfSelectFlag == 1) { |
|
59 |
return '发起人自选' |
|
60 |
} |
|
61 |
} |
|
62 |
} |
|
63 |
export const conditionStr = (nodeConfig, index) => { |
|
64 |
const { conditionList, nodeUserList } = nodeConfig.conditionNodes[index] |
|
65 |
if (conditionList.length == 0) { |
|
66 |
return index == nodeConfig.conditionNodes.length - 1 && |
|
67 |
nodeConfig.conditionNodes[0].conditionList.length != 0 |
|
68 |
? '其他条件进入此流程' |
|
69 |
: '请设置条件' |
|
70 |
} else { |
|
71 |
let str = '' |
|
72 |
for (let i = 0; i < conditionList.length; i++) { |
|
73 |
const { |
|
74 |
columnId, |
|
75 |
columnType, |
|
76 |
showType, |
|
77 |
showName, |
|
78 |
optType, |
|
79 |
zdy1, |
|
80 |
opt1, |
|
81 |
zdy2, |
|
82 |
opt2, |
|
83 |
fixedDownBoxValue |
|
84 |
} = conditionList[i] |
|
85 |
if (columnId == 0) { |
|
86 |
if (nodeUserList.length != 0) { |
|
87 |
str += '发起人属于:' |
|
88 |
str += |
|
89 |
nodeUserList |
|
90 |
.map((item) => { |
|
91 |
return item.name |
|
92 |
}) |
|
93 |
.join('或') + ' 并且 ' |
|
94 |
} |
|
95 |
} |
|
96 |
if (columnType == 'String' && showType == '3') { |
|
97 |
if (zdy1) { |
|
98 |
str += showName + '属于:' + dealStr(zdy1, JSON.parse(fixedDownBoxValue)) + ' 并且 ' |
|
99 |
} |
|
100 |
} |
|
101 |
if (columnType == 'Double') { |
|
102 |
if (optType != 6 && zdy1) { |
|
103 |
const optTypeStr = ['', '<', '>', '≤', '=', '≥'][optType] |
|
104 |
str += `${showName} ${optTypeStr} ${zdy1} 并且 ` |
|
105 |
} else if (optType == 6 && zdy1 && zdy2) { |
|
106 |
str += `${zdy1} ${opt1} ${showName} ${opt2} ${zdy2} 并且 ` |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
110 |
return str ? str.substring(0, str.length - 4) : '请设置条件' |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
export const dealStr = (str: string, obj) => { |
|
115 |
const arr = [] |
|
116 |
const list = str.split(',') |
|
117 |
for (const elem in obj) { |
|
118 |
list.map((item) => { |
|
119 |
if (item == elem) { |
|
120 |
arr.push(obj[elem].value) |
|
121 |
} |
|
122 |
}) |
|
123 |
} |
|
124 |
return arr.join('或') |
|
125 |
} |
|
126 |
|
|
127 |
export const removeEle = (arr, elem, key = 'id') => { |
|
128 |
let includesIndex |
|
129 |
arr.map((item, index) => { |
|
130 |
if (item[key] == elem[key]) { |
|
131 |
includesIndex = index |
|
132 |
} |
|
133 |
}) |
|
134 |
arr.splice(includesIndex, 1) |
|
135 |
} |
|
136 |
|
|
137 |
export const bgColors = ['87, 106, 149', '255, 148, 62', '50, 150, 250'] |
|
138 |
export const placeholderList = ['发起人', '审核人', '抄送人'] |
|
139 |
export const setTypes = [ |
|
140 |
{ value: 1, label: '指定成员' }, |
|
141 |
{ value: 2, label: '主管' }, |
|
142 |
{ value: 4, label: '发起人自选' }, |
|
143 |
{ value: 5, label: '发起人自己' }, |
|
144 |
{ value: 7, label: '连续多级主管' } |
|
145 |
] |
|
146 |
|
|
147 |
export const selectModes = [ |
|
148 |
{ value: 1, label: '选一个人' }, |
|
149 |
{ value: 2, label: '选多个人' } |
|
150 |
] |
|
151 |
|
|
152 |
export const selectRanges = [ |
|
153 |
{ value: 1, label: '全公司' }, |
|
154 |
{ value: 2, label: '指定成员' }, |
|
155 |
{ value: 3, label: '指定角色' } |
|
156 |
] |
|
157 |
|
|
158 |
export const optTypes = [ |
|
159 |
{ value: '1', label: '小于' }, |
|
160 |
{ value: '2', label: '大于' }, |
|
161 |
{ value: '3', label: '小于等于' }, |
|
162 |
{ value: '4', label: '等于' }, |
|
163 |
{ value: '5', label: '大于等于' }, |
|
164 |
{ value: '6', label: '介于两个数之间' } |
|
165 |
] |