@hzab/flowlong-designer 0.1.3 → 0.1.5
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 +10 -0
- package/package.json +1 -1
- package/src/components/NodeWrap/Nodes/AddNode/index.tsx +1 -1
- package/src/components/NodeWrap/Nodes/Approver/index.less +17 -2
- package/src/components/NodeWrap/Nodes/Branch/components/Field/index.tsx +0 -1
- package/src/components/NodeWrap/Nodes/Branch/components/GroupUserSelectorModal/index.tsx +45 -12
- package/src/components/NodeWrap/Nodes/Branch/index.tsx +33 -9
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
position: relative;
|
|
10
10
|
z-index: 1;
|
|
11
11
|
}
|
|
12
|
+
|
|
12
13
|
.node-wrap-box {
|
|
13
14
|
display: inline-flex;
|
|
14
15
|
flex-direction: column;
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
cursor: pointer;
|
|
22
23
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
.node-wrap-box::before {
|
|
25
27
|
content: "";
|
|
26
28
|
position: absolute;
|
|
@@ -32,9 +34,11 @@
|
|
|
32
34
|
border-width: 8px 6px 4px;
|
|
33
35
|
border-color: rgb(202, 202, 202) transparent transparent;
|
|
34
36
|
}
|
|
37
|
+
|
|
35
38
|
.node-wrap-box.start-node:before {
|
|
36
39
|
content: none;
|
|
37
40
|
}
|
|
41
|
+
|
|
38
42
|
.node-wrap-box .title {
|
|
39
43
|
height: 24px;
|
|
40
44
|
line-height: 24px;
|
|
@@ -46,9 +50,11 @@
|
|
|
46
50
|
display: flex;
|
|
47
51
|
align-items: center;
|
|
48
52
|
}
|
|
53
|
+
|
|
49
54
|
.node-wrap-box .title .icon {
|
|
50
55
|
margin-right: 5px;
|
|
51
56
|
}
|
|
57
|
+
|
|
52
58
|
.node-wrap-box .title .node-close-btn {
|
|
53
59
|
font-size: 15px;
|
|
54
60
|
position: absolute;
|
|
@@ -57,16 +63,25 @@
|
|
|
57
63
|
right: 10px;
|
|
58
64
|
display: none;
|
|
59
65
|
}
|
|
66
|
+
|
|
67
|
+
.node-wrap-box:hover {
|
|
68
|
+
.title .node-close-btn {
|
|
69
|
+
display: block;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
.node-wrap-box .content {
|
|
61
74
|
position: relative;
|
|
62
75
|
padding: 15px;
|
|
63
76
|
}
|
|
77
|
+
|
|
64
78
|
.node-wrap-box .content .placeholder {
|
|
65
79
|
color: #999;
|
|
66
80
|
}
|
|
67
81
|
}
|
|
82
|
+
|
|
68
83
|
.approver-drawer-footer {
|
|
69
|
-
.ant-btn
|
|
84
|
+
.ant-btn+.ant-btn {
|
|
70
85
|
margin-left: 12px;
|
|
71
86
|
}
|
|
72
|
-
}
|
|
87
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import DataModel from "@hzab/data-model";
|
|
2
2
|
import GroupUserSelector from "@hzab/group-user-selector";
|
|
3
3
|
import { Input, Modal } from "antd";
|
|
4
|
-
import { useMemo, useRef, useState } from "react";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import "./index.less";
|
|
6
6
|
const fieldMap = {
|
|
7
7
|
dept: "deptList",
|
|
@@ -40,28 +40,61 @@ const GroupUserSelectorModal = (props) => {
|
|
|
40
40
|
return userModel;
|
|
41
41
|
}
|
|
42
42
|
}, [type]);
|
|
43
|
+
|
|
43
44
|
const onOk = () => {
|
|
44
|
-
|
|
45
|
+
let onOkValue = {
|
|
46
|
+
value: null,
|
|
47
|
+
deptUserLabel: null,
|
|
48
|
+
};
|
|
49
|
+
if (type === "dept") {
|
|
50
|
+
onOkValue = {
|
|
51
|
+
value: groupUserSelectorRef.current?.selectedList?.map((item) => item?.value)?.join(","),
|
|
52
|
+
deptUserLabel: groupUserSelectorRef.current?.selectedList?.map((item) => item?.label)?.join(","),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (type === "useId") {
|
|
56
|
+
onOkValue = {
|
|
57
|
+
value: groupUserSelectorRef.current?.selectedList?.map((item) => item?.userId)?.join(","),
|
|
58
|
+
deptUserLabel: groupUserSelectorRef.current?.selectedList?.map((item) => item?.name)?.join(","),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
onChange(onOkValue);
|
|
45
62
|
setOpen(false);
|
|
46
63
|
};
|
|
47
64
|
|
|
48
|
-
const inputValue = useMemo(() => {
|
|
49
|
-
if (type === "dept" && value) {
|
|
50
|
-
return value?.map((item) => item?.label)?.join(",");
|
|
51
|
-
}
|
|
52
|
-
if (type === "useId" && value) {
|
|
53
|
-
return value?.map((item) => item?.name)?.join(",");
|
|
54
|
-
}
|
|
55
|
-
}, [value, type]);
|
|
56
65
|
const userListConfig = {
|
|
57
66
|
searchQueryKey: "userName",
|
|
58
67
|
labelKey: "name",
|
|
59
68
|
valueKey: "id",
|
|
60
69
|
};
|
|
70
|
+
/**选择组件回显 */
|
|
71
|
+
const groupUserSelectorValue = useMemo(() => {
|
|
72
|
+
const deptUserLabelArr = value?.deptUserLabel?.split(",") || [];
|
|
73
|
+
let valueArr = value?.value?.split(",");
|
|
74
|
+
if (type === "useId") {
|
|
75
|
+
valueArr = value?.value?.split(",")?.map((el) => Number(el)) || [];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!value) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
if (type === "useId") {
|
|
82
|
+
return deptUserLabelArr?.map((item, index) => ({
|
|
83
|
+
name: item,
|
|
84
|
+
id: valueArr?.length && valueArr[index],
|
|
85
|
+
isUser: true,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
return deptUserLabelArr?.map((item, index) => ({
|
|
89
|
+
label: item,
|
|
90
|
+
value: valueArr?.length && valueArr[index],
|
|
91
|
+
}));
|
|
92
|
+
}, [value, type]);
|
|
93
|
+
|
|
61
94
|
return (
|
|
62
95
|
<div>
|
|
63
96
|
<Input
|
|
64
|
-
value={
|
|
97
|
+
value={value?.deptUserLabel || null}
|
|
65
98
|
readOnly
|
|
66
99
|
onClick={() => {
|
|
67
100
|
setOpen(true);
|
|
@@ -84,7 +117,7 @@ const GroupUserSelectorModal = (props) => {
|
|
|
84
117
|
>
|
|
85
118
|
<div className="groupUserSelectorModal">
|
|
86
119
|
<GroupUserSelector
|
|
87
|
-
value={
|
|
120
|
+
value={groupUserSelectorValue || []}
|
|
88
121
|
ref={groupUserSelectorRef}
|
|
89
122
|
model={model}
|
|
90
123
|
{...(type === "useId" ? userListConfig : {})}
|
|
@@ -27,7 +27,10 @@ const conditionOption = [
|
|
|
27
27
|
{ label: "部门", value: "dept" },
|
|
28
28
|
{ label: "用户id", value: "useId" },
|
|
29
29
|
];
|
|
30
|
-
|
|
30
|
+
/** 时间类型 */
|
|
31
|
+
const timeType = ["day", "hour"];
|
|
32
|
+
/** 部门或用户 */
|
|
33
|
+
const deptUserType = ["dept", "useId"];
|
|
31
34
|
export const Branch = (props) => {
|
|
32
35
|
const { modelValue: nodeConfig, onChange, ItemSlot } = props;
|
|
33
36
|
const [form, setForm] = useState({
|
|
@@ -91,6 +94,9 @@ export const Branch = (props) => {
|
|
|
91
94
|
|
|
92
95
|
function onTermDel(idx) {
|
|
93
96
|
nodeConfig.conditionNodes?.splice(idx, 1);
|
|
97
|
+
nodeConfig.conditionNodes?.forEach((item, index) => {
|
|
98
|
+
item.priorityLevel = index + 1;
|
|
99
|
+
});
|
|
94
100
|
if (nodeConfig.conditionNodes?.length == 1) {
|
|
95
101
|
if (nodeConfig.childNode) {
|
|
96
102
|
if (nodeConfig.conditionNodes[0].childNode) {
|
|
@@ -100,6 +106,8 @@ export const Branch = (props) => {
|
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
onChange && onChange(nodeConfig.conditionNodes[0].childNode);
|
|
109
|
+
} else {
|
|
110
|
+
onChange({ ...nodeConfig });
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
function toText(nodeConfig, idx) {
|
|
@@ -108,11 +116,8 @@ export const Branch = (props) => {
|
|
|
108
116
|
const text = conditionList
|
|
109
117
|
.map((conditionGroup) =>
|
|
110
118
|
conditionGroup.map((item) => {
|
|
111
|
-
if (item?.field
|
|
112
|
-
return `${item.label}${item.operator}${item
|
|
113
|
-
}
|
|
114
|
-
if (item?.field === "useId") {
|
|
115
|
-
return `${item.label}${item.operator}${item.values?.map((el) => el?.userName)}`;
|
|
119
|
+
if (["dept", "useId"].includes(item?.field)) {
|
|
120
|
+
return `${item.label}${item.operator}${item?.deptUserLabel}`;
|
|
116
121
|
}
|
|
117
122
|
return `${item.label}${item.operator}${item.value}`;
|
|
118
123
|
}),
|
|
@@ -345,6 +350,17 @@ export const Branch = (props) => {
|
|
|
345
350
|
<div>值</div>
|
|
346
351
|
</div>
|
|
347
352
|
{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
|
+
}
|
|
348
364
|
return (
|
|
349
365
|
<div className="condition-content" key={idx}>
|
|
350
366
|
<div className="condition-relation">
|
|
@@ -371,6 +387,9 @@ export const Branch = (props) => {
|
|
|
371
387
|
onChange={(e) => {
|
|
372
388
|
condition.field = e;
|
|
373
389
|
condition.value = null;
|
|
390
|
+
if (deptUserType.includes(condition?.field)) {
|
|
391
|
+
condition.deptUserLabel = null;
|
|
392
|
+
}
|
|
374
393
|
// 更新数据
|
|
375
394
|
setForm((f) => ({ ...f }));
|
|
376
395
|
}}
|
|
@@ -389,11 +408,16 @@ export const Branch = (props) => {
|
|
|
389
408
|
className="condition-content-box-item"
|
|
390
409
|
></Select>
|
|
391
410
|
<Field
|
|
392
|
-
value={
|
|
411
|
+
value={fieldValue}
|
|
393
412
|
type={condition.field}
|
|
394
413
|
onChange={(e) => {
|
|
395
|
-
|
|
396
|
-
|
|
414
|
+
if (timeType.includes(condition?.field)) {
|
|
415
|
+
condition.value = e;
|
|
416
|
+
}
|
|
417
|
+
if (deptUserType?.includes(condition?.field)) {
|
|
418
|
+
condition.value = e?.value;
|
|
419
|
+
condition.deptUserLabel = e?.deptUserLabel;
|
|
420
|
+
}
|
|
397
421
|
// 更新数据
|
|
398
422
|
setForm((f) => ({ ...f }));
|
|
399
423
|
}}
|