@hzab/flowlong-designer 0.1.6 → 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
@@ -1,3 +1,8 @@
1
+ # @hzab/flowlong-designer@0.1.7
2
+
3
+ fix:请假天数文案改为时长
4
+ fix:条件节点-其他条件进入此流程不可编辑
5
+
1
6
  # @hzab/flowlong-designer@0.1.6
2
7
 
3
8
  fix:条件节点-描述字段改下拉框
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/flowlong-designer",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "自定义审批流配置组件",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -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: rgb(239, 239, 239);
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;
@@ -30,8 +30,8 @@ export const operatorOptions = [
30
30
  /**描述下拉字段 */
31
31
  const descOption = [
32
32
  {
33
- label: "请假天数",
34
- value: "请假天数",
33
+ label: "时长",
34
+ value: "时长",
35
35
  },
36
36
  {
37
37
  label: "发起人",
@@ -63,19 +63,33 @@ export const Branch = (props) => {
63
63
  const curIdxRef = useRef(-1);
64
64
 
65
65
  const nodeTitleRef = useRef();
66
-
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
+ }
67
75
  function onTermAdd() {
68
76
  if (!nodeConfig.conditionNodes) {
69
77
  nodeConfig.conditionNodes = [];
70
78
  }
71
79
  let len = nodeConfig.conditionNodes?.length + 1;
72
80
  nodeConfig.conditionNodes?.push({
73
- nodeName: "条件" + len,
81
+ // nodeName: "条件" + len,
74
82
  type: 3,
75
83
  priorityLevel: len,
76
84
  conditionMode: 1,
77
85
  conditionList: [],
78
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
+ });
79
93
  onChange && onChange({ ...nodeConfig });
80
94
  }
81
95
  function onShow(idx) {
@@ -121,6 +135,8 @@ export const Branch = (props) => {
121
135
  onChange({ ...nodeConfig });
122
136
  }
123
137
  }
138
+ console.log(nodeConfig, "nodeConfignodeConfig");
139
+
124
140
  function toText(nodeConfig, idx) {
125
141
  var { conditionList } = nodeConfig.conditionNodes[idx];
126
142
  if (conditionList && conditionList.length == 1) {
@@ -266,22 +282,28 @@ export const Branch = (props) => {
266
282
  添加条件
267
283
  </Button>
268
284
  {nodeConfig?.conditionNodes?.map((item, idx) => {
285
+ const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1;
286
+
269
287
  return (
270
288
  <div className="col-box" key={idx}>
271
289
  <div className="condition-node">
272
290
  <div className="condition-node-box">
273
291
  <div
274
- className="auto-judge"
292
+ className={conditionDisable ? "auto-judge-disable" : "auto-judge"}
275
293
  onClick={() => {
276
- onShow(idx);
294
+ if (!conditionDisable) {
295
+ onShow(idx);
296
+ }
277
297
  }}
278
298
  >
279
- {idx != 0 ? (
299
+ {idx != 0 && !conditionDisable ? (
280
300
  <div
281
301
  className="sort-left"
282
302
  onClick={(e) => {
283
- e.stopPropagation();
284
- arrTransfer(idx, -1);
303
+ if (!conditionDisable) {
304
+ e.stopPropagation();
305
+ arrTransfer(idx, -1);
306
+ }
285
307
  }}
286
308
  >
287
309
  <LeftOutlined />
@@ -290,14 +312,15 @@ export const Branch = (props) => {
290
312
  <div className="title">
291
313
  <span className="node-title">{item.nodeName}</span>
292
314
  <span className="priority-title">优先级{item.priorityLevel}</span>
293
-
294
- <DeleteOutlined
295
- className="delete-btn"
296
- onClick={(e) => {
297
- e.stopPropagation();
298
- onTermDel(idx);
299
- }}
300
- />
315
+ {!conditionDisable && (
316
+ <DeleteOutlined
317
+ className="delete-btn"
318
+ onClick={(e) => {
319
+ e.stopPropagation();
320
+ onTermDel(idx);
321
+ }}
322
+ />
323
+ )}
301
324
  </div>
302
325
  <div className="content">
303
326
  {toText(nodeConfig, idx) ? (
@@ -306,7 +329,7 @@ export const Branch = (props) => {
306
329
  <span className="placeholder">请设置条件</span>
307
330
  )}
308
331
  </div>
309
- {idx != nodeConfig.conditionNodes?.length - 1 ? (
332
+ {idx != nodeConfig.conditionNodes?.length - 1 && idx < nodeConfig.conditionNodes?.length - 2 ? (
310
333
  <div
311
334
  className="sort-right"
312
335
  onClick={(e) => {
@@ -434,7 +457,7 @@ export const Branch = (props) => {
434
457
  className="condition-content-box-item"
435
458
  onChange={(e) => {
436
459
  condition.label = e;
437
- if (e === "请假天数") {
460
+ if (e === "时长") {
438
461
  condition.field = "day";
439
462
  }
440
463
  if (e === "发起人") {