lw-cdp-ui 1.1.21 → 1.1.23

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.
@@ -25,7 +25,6 @@
25
25
  </template>
26
26
 
27
27
  </div>
28
-
29
28
  </template>
30
29
 
31
30
  <script>
@@ -49,6 +48,7 @@ import nodeEdit from './nodeEdit/index.vue'
49
48
 
50
49
  // 参数配置
51
50
  import configNodesList from './config/nodesList'
51
+ import nodeDatas from './nodesData/index.js'
52
52
  export default {
53
53
  components: {
54
54
  lfControl,
@@ -96,6 +96,13 @@ export default {
96
96
  type: Boolean,
97
97
  default: false
98
98
  },
99
+ /**
100
+ * 需要展示的节点分组 不传默认展示所有内置节点
101
+ */
102
+ showNodeGroup: {
103
+ type: Array,
104
+ default: []
105
+ },
99
106
  /**
100
107
  * apiNodes - 接口返回的节点数组,用于与内容节点合并。
101
108
  * @type {Array<Object>}
@@ -217,6 +224,13 @@ export default {
217
224
  } else {
218
225
  baseList = Object.values(list)
219
226
  }
227
+
228
+ if (this.showNodeGroup.length > 0) {
229
+ baseList = baseList.filter(item => {
230
+ return this.showNodeGroup.includes(item.title)
231
+ })
232
+ }
233
+
220
234
  return baseList
221
235
  }
222
236
  },
@@ -323,28 +337,7 @@ export default {
323
337
  },
324
338
  },
325
339
  ], // 全局右键菜单
326
- graphMenu: [
327
- // {
328
- // text: '全局直线',
329
- // callback() {
330
- // // 切换边类型
331
- // _this.logicFlow.setDefaultEdgeType("line")
332
- // },
333
- // },
334
- // {
335
- // text: '全局曲线',
336
- // callback() {
337
- // // 切换边类型
338
- // _this.logicFlow.setDefaultEdgeType("bezier")
339
- // },
340
- // },
341
- // {
342
- // text: '全局折线',
343
- // callback() {
344
- // _this.logicFlow.setDefaultEdgeType("polyline")
345
- // },
346
- // },
347
- ]
340
+ graphMenu: []
348
341
  });
349
342
  },
350
343
  /**
@@ -409,6 +402,22 @@ export default {
409
402
  message: data.msg
410
403
  })
411
404
  })
405
+
406
+
407
+ this.changeEdge()
408
+ },
409
+ /**
410
+ * 改变连线时处理上下级节点数据
411
+ * 本扩展暂无使用 本意是直接提供接口说要的数据结构
412
+ * 但是存在触发限制(可能存在连线后用户有修改了数据导致关联指向数据不完整) 暂停开发
413
+ * 所以本组件只提供原始的流程图数据输出 结构数据开发人员自行处理
414
+ */
415
+ changeEdge() {
416
+ this.logicFlow.on('edge:add', ({ data: edge }) => {
417
+ })
418
+ this.logicFlow.on('edge:delete', ({ data: edge }) => {
419
+ })
420
+
412
421
  },
413
422
  // 关闭属性抽屉
414
423
  nodeEditClose() {
@@ -416,9 +425,63 @@ export default {
416
425
  },
417
426
  // 打开属性抽屉
418
427
  nodeEditOpen(data) {
428
+ // 去除为空校验结果
429
+ delete data.properties.error
430
+ this.logicFlow.setProperties(data.id, {
431
+ error: false
432
+ });
433
+
419
434
  this.clickNode = data
420
435
  this.drawerShow = true
436
+
421
437
  },
438
+ /**
439
+ * 节点必传字段校验
440
+ * 用于父组件校验使用
441
+ * @returns {Promise<boolean>} 验证是否通过 true 通过
442
+ */
443
+ async validate() {
444
+ let { nodes } = this.logicFlow.getGraphData();
445
+ let errorNodes = {};
446
+
447
+ for (const node of nodes) {
448
+ let { formConfig } = nodeDatas[node.type];
449
+ let { formItems } = formConfig;
450
+ let { data } = node.properties;
451
+
452
+ if (formItems?.length > 0) {
453
+ for (const item of formItems) {
454
+ let value = data ? data[item?.name] : data;
455
+ let isHideHandle = false;
456
+ // 处理 hideHandle 字段逻辑
457
+ if (data && typeof item?.hideHandle === 'string') {
458
+ isHideHandle = eval(item.hideHandle.replace(/\$/g, "data"));
459
+ } else if (data && typeof item?.hideHandle === 'boolean') {
460
+ isHideHandle = item.hideHandle;
461
+ }
462
+
463
+ // 校验规则,如果不符合则记录错误
464
+ if (!isHideHandle && item?.rules && !value) {
465
+ this.logicFlow.setProperties(node.id, {
466
+ data: data,
467
+ error: true,
468
+ });
469
+ errorNodes[node.id] = true;
470
+ break;
471
+ }
472
+ }
473
+ }
474
+
475
+ // 如果节点没有错误,清除错误状态
476
+ if (!errorNodes[node.id]) {
477
+ this.logicFlow.setProperties(node.id, {
478
+ data: data,
479
+ error: false,
480
+ });
481
+ }
482
+ }
483
+ return Object.keys(errorNodes).length === 0;
484
+ }
422
485
 
423
486
  },
424
487
  }
@@ -516,6 +579,12 @@ export default {
516
579
  i {
517
580
  font-size: 20px;
518
581
  }
582
+ .text {
583
+ width: 100%;
584
+ white-space: nowrap;
585
+ overflow: hidden;
586
+ text-overflow: ellipsis;
587
+ }
519
588
  }
520
589
  // 自定义节点样式
521
590
  :deep(.lw-flow-node-custom) {
@@ -553,4 +622,21 @@ export default {
553
622
  line-height: 14px;
554
623
  }
555
624
  }
625
+ :deep(.lw-flow-node-error) {
626
+ &::after {
627
+ content: "必填字段不能为空";
628
+ position: absolute;
629
+ bottom: 0;
630
+ right: 0;
631
+ width: 100px;
632
+ height: 20px;
633
+ font-size: 10px;
634
+ color: #fff;
635
+ z-index: 9;
636
+ display: flex;
637
+ align-items: center;
638
+ justify-content: center;
639
+ background-color: rgba($color: #e61010, $alpha: 0.8);
640
+ }
641
+ }
556
642
  </style>
@@ -2,10 +2,38 @@
2
2
  <lw-form ref="dataFormRef"
3
3
  :config="config"
4
4
  v-model="dataForm">
5
- <!-- 定时器 表单部分 -->
5
+ <!-- 定时器 表单自定义部分 -->
6
6
  <template #dateCron>
7
7
  <lwCronSelect v-model="dataForm.cron" />
8
8
  </template>
9
+
10
+ <!-- et2l 表单自定义部分 -->
11
+ <template #KeyableSource>
12
+ <lwTableForm :config="joiner.configKeyableSource"
13
+ v-model="dataForm.from" />
14
+ </template>
15
+ <template #MapAction>
16
+ <lwTableForm :config="joiner.configMapAction"
17
+ v-model="dataForm.with">
18
+ <template #sourceField="{row}">
19
+ <el-input v-if="row.type == 'direct'"
20
+ size="small"
21
+ v-model="row.sourceField"
22
+ placeholder="来源字段" />
23
+ <el-select v-else
24
+ v-model="row.sourceField"
25
+ multiple
26
+ filterable
27
+ allow-create
28
+ size="small"
29
+ default-first-option
30
+ :reserve-keyword="false"
31
+ placeholder="来源字段"
32
+ style="width: 100%">
33
+ </el-select>
34
+ </template>
35
+ </lwTableForm>
36
+ </template>
9
37
  <span></span>
10
38
  </lw-form>
11
39
  </template>
@@ -16,7 +44,8 @@ export default {
16
44
  name: 'basicSettings',
17
45
  data() {
18
46
  return {
19
- dataForm: {}
47
+ dataForm: {},
48
+ ...nodeDatas
20
49
  }
21
50
  },
22
51
  props: {
@@ -36,7 +36,6 @@
36
36
  <script>
37
37
  import basicSettings from './basicSettings.vue'
38
38
  import styleSettings from './styleSettings.vue'
39
-
40
39
  export default {
41
40
  name: 'drawerForm',
42
41
  components: {
@@ -129,7 +129,7 @@ export default {
129
129
  {
130
130
  label: '文本大小',
131
131
  name: 'fontSize',
132
- value: 14,
132
+ value: '',
133
133
  component: 'number',
134
134
  options: {
135
135
  placeholder: '请选择',
@@ -72,6 +72,14 @@ export default function registerCustom(lf, node) {
72
72
  el.style.justifyContent = properties?.style?.textAlign || ''
73
73
  el.style.textDecoration = properties?.style?.textDecoration || ''
74
74
  el.style.fontStyle = properties?.style?.fontStyle || ''
75
+
76
+ // 检验不通过提示
77
+ if (properties.error) {
78
+ el.classList.add('lw-flow-node-error')
79
+ } else {
80
+ el.classList.remove('lw-flow-node-error')
81
+ }
82
+
75
83
  const html = `<div class="top-name" style="border-color: ${node.themeColor};">
76
84
  <i class="iconfont ${node.icon}"></i> ${properties?.data?.name || node.name}</div>
77
85
  <div class="bottom-content" style="border-color: ${node.themeColor};">
@@ -72,7 +72,15 @@ export default function registerEt2l(lf, node) {
72
72
  el.style.justifyContent = properties?.style?.textAlign || ''
73
73
  el.style.textDecoration = properties?.style?.textDecoration || ''
74
74
  el.style.fontStyle = properties?.style?.fontStyle || ''
75
- const html = `<i class="iconfont ${node.icon}"></i> ${properties?.data?.name || node.name}`
75
+
76
+ // 检验不通过提示
77
+ if (properties.error) {
78
+ el.classList.add('lw-flow-node-error')
79
+ } else {
80
+ el.classList.remove('lw-flow-node-error')
81
+ }
82
+
83
+ const html = `<i class="iconfont ${node.icon}"></i> <span class="text" title="${properties?.data?.name || node.name}">${properties?.data?.name || node.name}</span>`
76
84
 
77
85
  // 暂无显示需求
78
86
  // if (properties?.data.mode) {
@@ -99,27 +107,9 @@ export default function registerEt2l(lf, node) {
99
107
  this.width = 120
100
108
  this.height = 40
101
109
  this.text.editable = false
102
-
103
- console.log('---------------1', 12312)
104
110
  }
105
111
  initNodeData(data) {
106
112
  super.initNodeData(data)
107
-
108
- // const circleOnlyAsTarget = {
109
- // message: '目标节点只允许一个上级连接',
110
- // validate: (sourceNode, targetNode, sourceAnchor, targetAnchor) => {
111
- // let { edges } = targetNode.graphModel
112
- // let { id } = targetNode
113
- // let number = [...edges].filter((item) => {
114
- // let { targetNodeId } = { ...item }
115
- // return targetNodeId == id
116
- // })
117
- // console.log(number)
118
- // return number.length < 1
119
- // }
120
- // }
121
- // this.targetRules.push(circleOnlyAsTarget)
122
-
123
113
  // 目标节点校验
124
114
  nodeDatas[node.type]?.targetRules?.forEach((item) => {
125
115
  this.targetRules.push(item)
@@ -1,11 +1,11 @@
1
1
  /**
2
- * ET2L节点 COLAP 配置数据
2
+ * ET2L数据折叠节点 COLAP 配置数据
3
3
  */
4
4
 
5
5
  export default {
6
6
  // 暂无显示需求
7
7
  nodeHtml: [],
8
- // 节点校验
8
+ // 目标节点校验
9
9
  targetRules: [
10
10
  {
11
11
  message: '目标节点只允许一个上级连接',
@@ -1,11 +1,11 @@
1
1
  /**
2
- * ET2L节点 EXPAND 配置数据
2
+ * ET2L数据折叠节点 EXPAND 配置数据
3
3
  */
4
4
 
5
5
  export default {
6
6
  // 暂无显示需求
7
7
  nodeHtml: [],
8
- // 节点校验
8
+ // 目标节点校验
9
9
  targetRules: [
10
10
  {
11
11
  message: '目标节点只允许一个上级连接',
@@ -48,26 +48,16 @@ export default {
48
48
  rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
49
49
  },
50
50
  {
51
- label: '折叠字段',
51
+ label: '展开字段名称',
52
52
  name: 'with',
53
53
  value: '',
54
54
  component: 'input',
55
55
  options: {
56
- placeholder: '请输入折叠字段名称'
56
+ placeholder: '请输入展开字段名称'
57
57
  },
58
58
  span: 24,
59
59
  rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
60
60
  },
61
- {
62
- label: '折叠排序方式',
63
- name: 'sort',
64
- value: '',
65
- component: 'input',
66
- options: {
67
- placeholder: '请输入 例如:batchId, updateTime DESC'
68
- },
69
- span: 24
70
- },
71
61
  {
72
62
  label: '描述信息',
73
63
  name: 'desp',
@@ -1,11 +1,11 @@
1
1
  /**
2
- * ET2L节点 FILTER 配置数据
2
+ * ET2L数据过滤节点 FILTER 配置数据
3
3
  */
4
4
 
5
5
  export default {
6
6
  // 暂无显示需求
7
7
  nodeHtml: [],
8
- // 节点校验
8
+ // 目标节点校验
9
9
  targetRules: [
10
10
  {
11
11
  message: '目标节点只允许一个上级连接',
@@ -1,11 +1,11 @@
1
1
  /**
2
- * ET2L节点 JOINER 配置数据
2
+ * ET2L数据合并节点 JOINER 配置数据
3
3
  */
4
4
 
5
5
  export default {
6
6
  // 暂无显示需求
7
7
  nodeHtml: [],
8
- // 节点校验
8
+ // 目标节点校验
9
9
  targetRules: [],
10
10
  // 表单内容
11
11
  formConfig: {
@@ -26,76 +26,171 @@ export default {
26
26
  {
27
27
  label: '连接模式',
28
28
  name: 'mode',
29
- value: 'normal',
30
- component: 'select',
29
+ value: '',
30
+ component: 'input',
31
31
  span: 24,
32
32
  options: {
33
- items: [
34
- {
35
- label: '标准模式',
36
- value: 'normal'
37
- },
38
- {
39
- label: '折叠模式',
40
- value: 'collap'
41
- },
42
- {
43
- label: '展开模式',
44
- value: 'expand'
45
- },
46
- {
47
- label: 'SQL模式',
48
- value: 'sql'
49
- }
50
- ]
33
+ placeholder: '请输入连接模式'
51
34
  }
52
35
  },
53
36
  {
54
37
  label: '数据来源',
55
38
  name: 'from',
56
- value: '',
57
- component: 'input',
58
- options: {
59
- placeholder: '请输入来源名称'
60
- },
39
+ value: [],
40
+ component: 'KeyableSource',
61
41
  span: 24,
62
- rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
42
+ rules: [{ required: true, message: '不能为空', trigger: 'change' }]
63
43
  },
64
44
  {
65
45
  label: '映射动作',
66
46
  name: 'with',
67
47
  value: [],
68
- component: 'input',
48
+ component: 'MapAction',
69
49
  options: {
70
50
  placeholder: '请选择映射动作'
71
51
  },
72
- tips: '启用自动映射时允许为空',
73
52
  span: 24,
74
- hideHandle: '$.auto',
75
53
  rules: [{ required: true, message: '不能为空', trigger: 'change' }]
76
54
  },
77
55
  {
78
- label: '映射动作',
56
+ label: '描述信息',
57
+ name: 'desp',
58
+ value: '',
59
+ component: 'input',
60
+ options: {
61
+ type: 'textarea',
62
+ placeholder: '请输入'
63
+ },
64
+ span: 24
65
+ }
66
+ ]
67
+ },
68
+ // 表单自定义内容
69
+ configKeyableSource: {
70
+ treeProps: {
71
+ children: 'fields'
72
+ },
73
+ rowKey: 'id',
74
+ formItems: [
75
+ {
76
+ label: '来源名称',
77
+ name: 'name',
78
+ value: '',
79
+ minWidth: '80',
80
+ component: 'input',
81
+ options: {
82
+ placeholder: '请输入'
83
+ },
84
+ rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
85
+ },
86
+ {
87
+ label: '名称简写',
88
+ name: 'abbr',
89
+ value: '',
90
+ minWidth: '80',
91
+ component: 'input',
92
+ options: {
93
+ placeholder: '请输入'
94
+ }
95
+ },
96
+ {
97
+ label: '关联字段',
79
98
  name: 'with',
80
- value: [],
99
+ value: '',
100
+ minWidth: '80',
81
101
  component: 'input',
82
102
  options: {
83
- placeholder: '请选择映射动作'
103
+ placeholder: '请输入'
84
104
  },
85
- tips: '启用自动映射时允许为空',
86
- span: 24,
87
- hideHandle: '!$.auto'
105
+ rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
88
106
  },
89
107
  {
90
- label: '描述信息',
91
- name: 'desp',
108
+ label: '自动映射',
109
+ name: 'auto',
110
+ value: false,
111
+ minWidth: '75',
112
+ component: 'switch'
113
+ },
114
+ {
115
+ label: '操作',
116
+ component: 'operation',
117
+ width: '60',
118
+ fixed: 'right',
119
+ options: {
120
+ addDelete: [
121
+ {
122
+ icon: '',
123
+ type: 'delete',
124
+ label: '删除'
125
+ }
126
+ ]
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ configMapAction: {
132
+ treeProps: {
133
+ children: 'fields'
134
+ },
135
+ rowKey: 'id',
136
+ formItems: [
137
+ {
138
+ label: '映射类型',
139
+ name: 'type',
140
+ value: '',
141
+ minWidth: '80',
142
+ component: 'select',
143
+ options: {
144
+ placeholder: '请选择',
145
+ items: [
146
+ {
147
+ label: '任意映射',
148
+ value: 'any_of'
149
+ },
150
+ {
151
+ label: '直接映射',
152
+ value: 'direct'
153
+ }
154
+ ]
155
+ },
156
+ rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
157
+ },
158
+ {
159
+ label: '目标字段',
160
+ name: 'targetField',
92
161
  value: '',
162
+ minWidth: '80',
93
163
  component: 'input',
94
164
  options: {
95
- type: 'textarea',
96
165
  placeholder: '请输入'
97
166
  },
98
- span: 24
167
+ rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
168
+ },
169
+ {
170
+ label: '来源字段',
171
+ name: 'sourceField',
172
+ value: '',
173
+ minWidth: '80',
174
+ component: 'sourceField',
175
+ options: {
176
+ placeholder: '请输入'
177
+ },
178
+ rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
179
+ },
180
+ {
181
+ label: '操作',
182
+ component: 'operation',
183
+ width: '60',
184
+ fixed: 'right',
185
+ options: {
186
+ addDelete: [
187
+ {
188
+ icon: '',
189
+ type: 'delete',
190
+ label: '删除'
191
+ }
192
+ ]
193
+ }
99
194
  }
100
195
  ]
101
196
  }
@@ -1,11 +1,11 @@
1
1
  /**
2
- * ET2L节点 MAPPER 配置数据
2
+ * ET2L数据映射节点 MAPPER 配置数据
3
3
  */
4
4
 
5
5
  export default {
6
6
  // 暂无显示需求
7
7
  nodeHtml: [],
8
- // 节点校验
8
+ // 目标节点校验
9
9
  targetRules: [
10
10
  {
11
11
  message: '目标节点只允许一个上级连接',
@@ -63,7 +63,7 @@ export default {
63
63
  label: '映射动作',
64
64
  name: 'with',
65
65
  value: [],
66
- component: 'input',
66
+ component: 'MapAction',
67
67
  options: {
68
68
  placeholder: '请选择映射动作'
69
69
  },
@@ -76,7 +76,7 @@ export default {
76
76
  label: '映射动作',
77
77
  name: 'with',
78
78
  value: [],
79
- component: 'input',
79
+ component: 'MapAction',
80
80
  options: {
81
81
  placeholder: '请选择映射动作'
82
82
  },
@@ -1,11 +1,11 @@
1
1
  /**
2
- * ET2L节点 REDUCE 配置数据
2
+ * ET2L数据聚合节点 REDUCE 配置数据
3
3
  */
4
4
 
5
5
  export default {
6
6
  // 暂无显示需求
7
7
  nodeHtml: [],
8
- // 节点校验
8
+ // 目标节点校验
9
9
  targetRules: [],
10
10
  // 表单内容
11
11
  formConfig: {
@@ -26,24 +26,21 @@ export default {
26
26
  {
27
27
  label: '数据来源',
28
28
  name: 'from',
29
- value: '',
30
- component: 'input',
31
- options: {
32
- placeholder: '请输入数据表名'
33
- },
29
+ value: [],
30
+ component: 'KeyableSource',
34
31
  span: 24,
35
- rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
32
+ rules: [{ required: true, message: '不能为空', trigger: 'change' }]
36
33
  },
37
34
  {
38
35
  label: '映射动作',
39
36
  name: 'with',
40
- value: '',
41
- component: 'input',
37
+ value: [],
38
+ component: 'MapAction',
42
39
  options: {
43
- placeholder: '请输入折叠字段名称'
40
+ placeholder: '请选择映射动作'
44
41
  },
45
42
  span: 24,
46
- rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
43
+ rules: [{ required: true, message: '不能为空', trigger: 'change' }]
47
44
  },
48
45
  {
49
46
  label: '描述信息',