@hzab/flowlong-designer 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Drawer, Button, Input, Select } from "antd";
|
|
3
3
|
import { LeftOutlined, DeleteOutlined, RightOutlined, EditOutlined } from "@ant-design/icons";
|
|
4
4
|
|
|
@@ -21,11 +21,22 @@ export const operatorOptions = [
|
|
|
21
21
|
{ label: "不包含", value: "notinclude" },
|
|
22
22
|
];
|
|
23
23
|
/**条件字段下拉数据 */
|
|
24
|
-
const conditionOption = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
// const conditionOption = [
|
|
25
|
+
// { label: "天", value: "day" },
|
|
26
|
+
// { label: "小时", value: "hour" },
|
|
27
|
+
// { label: "部门", value: "dept" },
|
|
28
|
+
// { label: "用户id", value: "useId" },
|
|
29
|
+
// ];
|
|
30
|
+
/**描述下拉字段 */
|
|
31
|
+
const descOption = [
|
|
32
|
+
{
|
|
33
|
+
label: "请假天数",
|
|
34
|
+
value: "请假天数",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "发起人",
|
|
38
|
+
value: "发起人",
|
|
39
|
+
},
|
|
29
40
|
];
|
|
30
41
|
/** 时间类型 */
|
|
31
42
|
const timeType = ["day", "hour"];
|
|
@@ -116,10 +127,11 @@ export const Branch = (props) => {
|
|
|
116
127
|
const text = conditionList
|
|
117
128
|
.map((conditionGroup) =>
|
|
118
129
|
conditionGroup.map((item) => {
|
|
130
|
+
const el = operatorOptions?.find((el) => el?.value === item?.operator);
|
|
119
131
|
if (["dept", "useId"].includes(item?.field)) {
|
|
120
|
-
return `${item.label}${
|
|
132
|
+
return `${item.label}${el?.label}${item?.deptUserLabel}`;
|
|
121
133
|
}
|
|
122
|
-
return `${item.label}${
|
|
134
|
+
return `${item.label}${el?.label}${item.value}`;
|
|
123
135
|
}),
|
|
124
136
|
)
|
|
125
137
|
.join(" 和 ");
|
|
@@ -191,6 +203,61 @@ export const Branch = (props) => {
|
|
|
191
203
|
setForm((f) => ({ ...f }));
|
|
192
204
|
}
|
|
193
205
|
|
|
206
|
+
//条件节点数据联动
|
|
207
|
+
const conditionDataLinkage = (condition) => {
|
|
208
|
+
/**值 */
|
|
209
|
+
let fieldValue = null;
|
|
210
|
+
/**条件字段下拉数据 */
|
|
211
|
+
let conditionOption = [
|
|
212
|
+
{ label: "天", value: "day" },
|
|
213
|
+
{ label: "小时", value: "hour" },
|
|
214
|
+
];
|
|
215
|
+
/**
|
|
216
|
+
* 操作符选项列表
|
|
217
|
+
*/
|
|
218
|
+
let operatorOptions = [
|
|
219
|
+
{ label: "等于", value: "==" },
|
|
220
|
+
{ label: "不等于", value: "!=" },
|
|
221
|
+
{ label: "大于", value: ">" },
|
|
222
|
+
{ label: "大于等于", value: ">=" },
|
|
223
|
+
{ label: "小于", value: "<" },
|
|
224
|
+
{ label: "小于等于", value: "<=" },
|
|
225
|
+
{ label: "包含", value: "include" },
|
|
226
|
+
{ label: "不包含", value: "notinclude" },
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
if (timeType.includes(condition?.field)) {
|
|
230
|
+
fieldValue = condition?.value;
|
|
231
|
+
}
|
|
232
|
+
if (deptUserType.includes(condition?.field)) {
|
|
233
|
+
fieldValue = {
|
|
234
|
+
value: condition?.value,
|
|
235
|
+
deptUserLabel: condition?.deptUserLabel,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
if (condition?.field === "dept") {
|
|
239
|
+
operatorOptions = [{ label: "包含", value: "include" }];
|
|
240
|
+
}
|
|
241
|
+
if (condition?.field === "useId") {
|
|
242
|
+
operatorOptions = [
|
|
243
|
+
{ label: "等于", value: "==" },
|
|
244
|
+
{ label: "包含", value: "include" },
|
|
245
|
+
{ label: "不包含", value: "notinclude" },
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
if (condition?.label === "发起人") {
|
|
249
|
+
conditionOption = [
|
|
250
|
+
{ label: "部门", value: "dept" },
|
|
251
|
+
{ label: "用户id", value: "useId" },
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
fieldValue,
|
|
256
|
+
conditionOption,
|
|
257
|
+
operatorOptions,
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
194
261
|
return (
|
|
195
262
|
<div className="branch-wrap">
|
|
196
263
|
<div className="branch-box-wrap">
|
|
@@ -350,17 +417,7 @@ export const Branch = (props) => {
|
|
|
350
417
|
<div>值</div>
|
|
351
418
|
</div>
|
|
352
419
|
{conditionGroup?.map((condition, idx) => {
|
|
353
|
-
|
|
354
|
-
let fieldValue = null;
|
|
355
|
-
if (timeType.includes(condition?.field)) {
|
|
356
|
-
fieldValue = condition?.value;
|
|
357
|
-
}
|
|
358
|
-
if (deptUserType.includes(condition?.field)) {
|
|
359
|
-
fieldValue = {
|
|
360
|
-
value: condition?.value,
|
|
361
|
-
deptUserLabel: condition?.deptUserLabel,
|
|
362
|
-
};
|
|
363
|
-
}
|
|
420
|
+
const { fieldValue, conditionOption, operatorOptions } = conditionDataLinkage(condition);
|
|
364
421
|
return (
|
|
365
422
|
<div className="condition-content" key={idx}>
|
|
366
423
|
<div className="condition-relation">
|
|
@@ -371,16 +428,24 @@ export const Branch = (props) => {
|
|
|
371
428
|
</div>
|
|
372
429
|
<div className="condition-content">
|
|
373
430
|
<div className="condition-content-box">
|
|
374
|
-
<
|
|
431
|
+
<Select
|
|
375
432
|
value={condition.label}
|
|
433
|
+
options={descOption}
|
|
434
|
+
className="condition-content-box-item"
|
|
376
435
|
onChange={(e) => {
|
|
377
|
-
condition.label = e
|
|
436
|
+
condition.label = e;
|
|
437
|
+
if (e === "请假天数") {
|
|
438
|
+
condition.field = "day";
|
|
439
|
+
}
|
|
440
|
+
if (e === "发起人") {
|
|
441
|
+
condition.field = "dept";
|
|
442
|
+
}
|
|
443
|
+
condition.value = null;
|
|
444
|
+
condition.operator = null;
|
|
378
445
|
// 更新数据
|
|
379
446
|
setForm((f) => ({ ...f }));
|
|
380
447
|
}}
|
|
381
|
-
|
|
382
|
-
className="condition-content-box-item"
|
|
383
|
-
/>
|
|
448
|
+
></Select>
|
|
384
449
|
<Select
|
|
385
450
|
options={conditionOption}
|
|
386
451
|
value={condition.field}
|