@hzab/flowlong-designer 0.1.5 → 0.1.7
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
|
@@ -80,7 +80,8 @@
|
|
|
80
80
|
background-color: rgb(202, 202, 202);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
.auto-judge
|
|
83
|
+
.auto-judge,
|
|
84
|
+
.auto-judge-disable {
|
|
84
85
|
position: relative;
|
|
85
86
|
width: 220px;
|
|
86
87
|
min-height: 72px;
|
|
@@ -91,7 +92,8 @@
|
|
|
91
92
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
.auto-judge::before
|
|
95
|
+
.auto-judge::before,
|
|
96
|
+
.auto-judge-disable::before {
|
|
95
97
|
content: "";
|
|
96
98
|
position: absolute;
|
|
97
99
|
top: -12px;
|
|
@@ -101,18 +103,21 @@
|
|
|
101
103
|
border-style: solid;
|
|
102
104
|
border-width: 8px 6px 4px;
|
|
103
105
|
border-color: rgb(202, 202, 202) transparent transparent;
|
|
104
|
-
background:
|
|
106
|
+
background: #fff;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
.auto-judge .title
|
|
109
|
+
.auto-judge .title,
|
|
110
|
+
.auto-judge-disable .title {
|
|
108
111
|
line-height: 16px;
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
.auto-judge .title .node-title
|
|
114
|
+
.auto-judge .title .node-title,
|
|
115
|
+
.auto-judge-disable .title .node-title {
|
|
112
116
|
color: #15bc83;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
.auto-judge .title .delete-btn
|
|
119
|
+
.auto-judge .title .delete-btn,
|
|
120
|
+
.auto-judge-disable .title .delete-btn {
|
|
116
121
|
font-size: 15px;
|
|
117
122
|
position: absolute;
|
|
118
123
|
top: 15px;
|
|
@@ -121,19 +126,22 @@
|
|
|
121
126
|
display: none;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
.auto-judge .title .priority-title
|
|
129
|
+
.auto-judge .title .priority-title,
|
|
130
|
+
.auto-judge-disable .title .priority-title {
|
|
125
131
|
position: absolute;
|
|
126
132
|
top: 15px;
|
|
127
133
|
right: 15px;
|
|
128
134
|
color: #999;
|
|
129
135
|
}
|
|
130
136
|
|
|
131
|
-
.auto-judge .content
|
|
137
|
+
.auto-judge .content,
|
|
138
|
+
.auto-judge-disable .content {
|
|
132
139
|
position: relative;
|
|
133
140
|
padding-top: 15px;
|
|
134
141
|
}
|
|
135
142
|
|
|
136
|
-
.auto-judge .content .placeholder
|
|
143
|
+
.auto-judge .content .placeholder,
|
|
144
|
+
.auto-judge-disable .content .placeholder {
|
|
137
145
|
color: #999;
|
|
138
146
|
}
|
|
139
147
|
|
|
@@ -157,7 +165,8 @@
|
|
|
157
165
|
}
|
|
158
166
|
}
|
|
159
167
|
|
|
160
|
-
.auto-judge .sort-left
|
|
168
|
+
.auto-judge .sort-left,
|
|
169
|
+
.auto-judge-disable .sort-left {
|
|
161
170
|
position: absolute;
|
|
162
171
|
top: 0;
|
|
163
172
|
bottom: 0;
|
|
@@ -169,7 +178,8 @@
|
|
|
169
178
|
flex-direction: column;
|
|
170
179
|
}
|
|
171
180
|
|
|
172
|
-
.auto-judge .sort-right
|
|
181
|
+
.auto-judge .sort-right,
|
|
182
|
+
.auto-judge-disable .sort-right {
|
|
173
183
|
position: absolute;
|
|
174
184
|
top: 0;
|
|
175
185
|
bottom: 0;
|
|
@@ -186,7 +196,8 @@
|
|
|
186
196
|
background: #eee;
|
|
187
197
|
}
|
|
188
198
|
|
|
189
|
-
.auto-judge:after
|
|
199
|
+
.auto-judge:after,
|
|
200
|
+
.auto-judge-disable:after {
|
|
190
201
|
pointer-events: none;
|
|
191
202
|
content: "";
|
|
192
203
|
position: absolute;
|
|
@@ -204,6 +215,10 @@
|
|
|
204
215
|
box-shadow: 0 0 6px 0 rgba(50, 150, 250, 0.3);
|
|
205
216
|
}
|
|
206
217
|
|
|
218
|
+
.auto-judge-disable {
|
|
219
|
+
cursor: not-allowed;
|
|
220
|
+
}
|
|
221
|
+
|
|
207
222
|
.top-left-cover-line,
|
|
208
223
|
.top-right-cover-line {
|
|
209
224
|
position: absolute;
|
|
@@ -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"];
|
|
@@ -52,19 +63,33 @@ export const Branch = (props) => {
|
|
|
52
63
|
const curIdxRef = useRef(-1);
|
|
53
64
|
|
|
54
65
|
const nodeTitleRef = useRef();
|
|
55
|
-
|
|
66
|
+
/** 数组位置互换*/
|
|
67
|
+
function swapLastTwo(arr) {
|
|
68
|
+
if (arr.length >= 2) {
|
|
69
|
+
const temp = arr[arr.length - 1];
|
|
70
|
+
arr[arr.length - 1] = arr[arr.length - 2];
|
|
71
|
+
arr[arr.length - 2] = temp;
|
|
72
|
+
}
|
|
73
|
+
return arr;
|
|
74
|
+
}
|
|
56
75
|
function onTermAdd() {
|
|
57
76
|
if (!nodeConfig.conditionNodes) {
|
|
58
77
|
nodeConfig.conditionNodes = [];
|
|
59
78
|
}
|
|
60
79
|
let len = nodeConfig.conditionNodes?.length + 1;
|
|
61
80
|
nodeConfig.conditionNodes?.push({
|
|
62
|
-
nodeName: "条件" + len,
|
|
81
|
+
// nodeName: "条件" + len,
|
|
63
82
|
type: 3,
|
|
64
83
|
priorityLevel: len,
|
|
65
84
|
conditionMode: 1,
|
|
66
85
|
conditionList: [],
|
|
67
86
|
});
|
|
87
|
+
nodeConfig.conditionNodes = swapLastTwo(nodeConfig.conditionNodes);
|
|
88
|
+
|
|
89
|
+
nodeConfig.conditionNodes.forEach((el, index) => {
|
|
90
|
+
el.priorityLevel = index;
|
|
91
|
+
el.nodeName = el.nodeName ? el.nodeName : "条件" + index;
|
|
92
|
+
});
|
|
68
93
|
onChange && onChange({ ...nodeConfig });
|
|
69
94
|
}
|
|
70
95
|
function onShow(idx) {
|
|
@@ -110,16 +135,19 @@ export const Branch = (props) => {
|
|
|
110
135
|
onChange({ ...nodeConfig });
|
|
111
136
|
}
|
|
112
137
|
}
|
|
138
|
+
console.log(nodeConfig, "nodeConfignodeConfig");
|
|
139
|
+
|
|
113
140
|
function toText(nodeConfig, idx) {
|
|
114
141
|
var { conditionList } = nodeConfig.conditionNodes[idx];
|
|
115
142
|
if (conditionList && conditionList.length == 1) {
|
|
116
143
|
const text = conditionList
|
|
117
144
|
.map((conditionGroup) =>
|
|
118
145
|
conditionGroup.map((item) => {
|
|
146
|
+
const el = operatorOptions?.find((el) => el?.value === item?.operator);
|
|
119
147
|
if (["dept", "useId"].includes(item?.field)) {
|
|
120
|
-
return `${item.label}${
|
|
148
|
+
return `${item.label}${el?.label}${item?.deptUserLabel}`;
|
|
121
149
|
}
|
|
122
|
-
return `${item.label}${
|
|
150
|
+
return `${item.label}${el?.label}${item.value}`;
|
|
123
151
|
}),
|
|
124
152
|
)
|
|
125
153
|
.join(" 和 ");
|
|
@@ -191,6 +219,61 @@ export const Branch = (props) => {
|
|
|
191
219
|
setForm((f) => ({ ...f }));
|
|
192
220
|
}
|
|
193
221
|
|
|
222
|
+
//条件节点数据联动
|
|
223
|
+
const conditionDataLinkage = (condition) => {
|
|
224
|
+
/**值 */
|
|
225
|
+
let fieldValue = null;
|
|
226
|
+
/**条件字段下拉数据 */
|
|
227
|
+
let conditionOption = [
|
|
228
|
+
{ label: "天", value: "day" },
|
|
229
|
+
{ label: "小时", value: "hour" },
|
|
230
|
+
];
|
|
231
|
+
/**
|
|
232
|
+
* 操作符选项列表
|
|
233
|
+
*/
|
|
234
|
+
let operatorOptions = [
|
|
235
|
+
{ label: "等于", value: "==" },
|
|
236
|
+
{ label: "不等于", value: "!=" },
|
|
237
|
+
{ label: "大于", value: ">" },
|
|
238
|
+
{ label: "大于等于", value: ">=" },
|
|
239
|
+
{ label: "小于", value: "<" },
|
|
240
|
+
{ label: "小于等于", value: "<=" },
|
|
241
|
+
{ label: "包含", value: "include" },
|
|
242
|
+
{ label: "不包含", value: "notinclude" },
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
if (timeType.includes(condition?.field)) {
|
|
246
|
+
fieldValue = condition?.value;
|
|
247
|
+
}
|
|
248
|
+
if (deptUserType.includes(condition?.field)) {
|
|
249
|
+
fieldValue = {
|
|
250
|
+
value: condition?.value,
|
|
251
|
+
deptUserLabel: condition?.deptUserLabel,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
if (condition?.field === "dept") {
|
|
255
|
+
operatorOptions = [{ label: "包含", value: "include" }];
|
|
256
|
+
}
|
|
257
|
+
if (condition?.field === "useId") {
|
|
258
|
+
operatorOptions = [
|
|
259
|
+
{ label: "等于", value: "==" },
|
|
260
|
+
{ label: "包含", value: "include" },
|
|
261
|
+
{ label: "不包含", value: "notinclude" },
|
|
262
|
+
];
|
|
263
|
+
}
|
|
264
|
+
if (condition?.label === "发起人") {
|
|
265
|
+
conditionOption = [
|
|
266
|
+
{ label: "部门", value: "dept" },
|
|
267
|
+
{ label: "用户id", value: "useId" },
|
|
268
|
+
];
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
fieldValue,
|
|
272
|
+
conditionOption,
|
|
273
|
+
operatorOptions,
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
|
|
194
277
|
return (
|
|
195
278
|
<div className="branch-wrap">
|
|
196
279
|
<div className="branch-box-wrap">
|
|
@@ -199,22 +282,28 @@ export const Branch = (props) => {
|
|
|
199
282
|
添加条件
|
|
200
283
|
</Button>
|
|
201
284
|
{nodeConfig?.conditionNodes?.map((item, idx) => {
|
|
285
|
+
const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1;
|
|
286
|
+
|
|
202
287
|
return (
|
|
203
288
|
<div className="col-box" key={idx}>
|
|
204
289
|
<div className="condition-node">
|
|
205
290
|
<div className="condition-node-box">
|
|
206
291
|
<div
|
|
207
|
-
className="auto-judge"
|
|
292
|
+
className={conditionDisable ? "auto-judge-disable" : "auto-judge"}
|
|
208
293
|
onClick={() => {
|
|
209
|
-
|
|
294
|
+
if (!conditionDisable) {
|
|
295
|
+
onShow(idx);
|
|
296
|
+
}
|
|
210
297
|
}}
|
|
211
298
|
>
|
|
212
|
-
{idx != 0 ? (
|
|
299
|
+
{idx != 0 && !conditionDisable ? (
|
|
213
300
|
<div
|
|
214
301
|
className="sort-left"
|
|
215
302
|
onClick={(e) => {
|
|
216
|
-
|
|
217
|
-
|
|
303
|
+
if (!conditionDisable) {
|
|
304
|
+
e.stopPropagation();
|
|
305
|
+
arrTransfer(idx, -1);
|
|
306
|
+
}
|
|
218
307
|
}}
|
|
219
308
|
>
|
|
220
309
|
<LeftOutlined />
|
|
@@ -223,14 +312,15 @@ export const Branch = (props) => {
|
|
|
223
312
|
<div className="title">
|
|
224
313
|
<span className="node-title">{item.nodeName}</span>
|
|
225
314
|
<span className="priority-title">优先级{item.priorityLevel}</span>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
315
|
+
{!conditionDisable && (
|
|
316
|
+
<DeleteOutlined
|
|
317
|
+
className="delete-btn"
|
|
318
|
+
onClick={(e) => {
|
|
319
|
+
e.stopPropagation();
|
|
320
|
+
onTermDel(idx);
|
|
321
|
+
}}
|
|
322
|
+
/>
|
|
323
|
+
)}
|
|
234
324
|
</div>
|
|
235
325
|
<div className="content">
|
|
236
326
|
{toText(nodeConfig, idx) ? (
|
|
@@ -239,7 +329,7 @@ export const Branch = (props) => {
|
|
|
239
329
|
<span className="placeholder">请设置条件</span>
|
|
240
330
|
)}
|
|
241
331
|
</div>
|
|
242
|
-
{idx != nodeConfig.conditionNodes?.length - 1 ? (
|
|
332
|
+
{idx != nodeConfig.conditionNodes?.length - 1 && idx < nodeConfig.conditionNodes?.length - 2 ? (
|
|
243
333
|
<div
|
|
244
334
|
className="sort-right"
|
|
245
335
|
onClick={(e) => {
|
|
@@ -350,17 +440,7 @@ export const Branch = (props) => {
|
|
|
350
440
|
<div>值</div>
|
|
351
441
|
</div>
|
|
352
442
|
{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
|
-
}
|
|
443
|
+
const { fieldValue, conditionOption, operatorOptions } = conditionDataLinkage(condition);
|
|
364
444
|
return (
|
|
365
445
|
<div className="condition-content" key={idx}>
|
|
366
446
|
<div className="condition-relation">
|
|
@@ -371,16 +451,24 @@ export const Branch = (props) => {
|
|
|
371
451
|
</div>
|
|
372
452
|
<div className="condition-content">
|
|
373
453
|
<div className="condition-content-box">
|
|
374
|
-
<
|
|
454
|
+
<Select
|
|
375
455
|
value={condition.label}
|
|
456
|
+
options={descOption}
|
|
457
|
+
className="condition-content-box-item"
|
|
376
458
|
onChange={(e) => {
|
|
377
|
-
condition.label = e
|
|
459
|
+
condition.label = e;
|
|
460
|
+
if (e === "时长") {
|
|
461
|
+
condition.field = "day";
|
|
462
|
+
}
|
|
463
|
+
if (e === "发起人") {
|
|
464
|
+
condition.field = "dept";
|
|
465
|
+
}
|
|
466
|
+
condition.value = null;
|
|
467
|
+
condition.operator = null;
|
|
378
468
|
// 更新数据
|
|
379
469
|
setForm((f) => ({ ...f }));
|
|
380
470
|
}}
|
|
381
|
-
|
|
382
|
-
className="condition-content-box-item"
|
|
383
|
-
/>
|
|
471
|
+
></Select>
|
|
384
472
|
<Select
|
|
385
473
|
options={conditionOption}
|
|
386
474
|
value={condition.field}
|