lw-cdp-ui 1.2.44 → 1.2.46

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.
@@ -21,11 +21,22 @@
21
21
  :drawerShow="drawerShow"
22
22
  :nodeData="clickNode"
23
23
  :nodesDataConfig="nodesDataConfig"
24
- :tableFieldsList="tableFieldsList"
25
- @onClose="nodeEditClose"
26
- @changedFieldValue="changedFieldValue"/>
24
+ :soltList="soltList"
25
+ @onClose="nodeEditClose">
26
+ <template v-slot:[soltName]="{itemCur, formCur}"
27
+ v-for="soltName in soltList">
28
+ <slot :name="soltName"
29
+ :itemCur="itemCur"
30
+ :formCur="formCur">
31
+ <el-tag type="danger">[{{ soltName }}]
32
+ 没有这个默认组件也未自定义插槽内容</el-tag>
33
+ </slot>
34
+ </template>
35
+ <template #mySolt>
36
+ sssssssssssssssss
37
+ </template>
38
+ </nodeEdit>
27
39
  </template>
28
-
29
40
  </div>
30
41
  </template>
31
42
 
@@ -85,41 +96,31 @@ export default {
85
96
  return {}
86
97
  }
87
98
  },
88
- /**
89
- * 节点数据 在没有 modelValue时 用以自动创建节点 默认使用modelValue
90
- */
99
+ // 节点数据 在没有 modelValue时 用以自动创建节点 默认使用modelValue
91
100
  nodes: {
92
101
  type: Array,
93
102
  default: () => {
94
103
  return []
95
104
  }
96
105
  },
97
- /**
98
- * 节点配置
99
- */
100
- // configNodesList: {
101
- // type: Object,
102
- // default: () => {
103
- // return configNodesList
104
- // }
105
- // },
106
- /**
107
- * 是否显示默认节点
108
- */
106
+ // 节点插槽列表
107
+ soltList: {
108
+ type: Array,
109
+ default: () => {
110
+ return []
111
+ }
112
+ },
113
+ // 是否显示默认节点
109
114
  showDefaultNode: {
110
115
  type: Boolean,
111
116
  default: true
112
117
  },
113
- /**
114
- * 是否仅查看
115
- */
118
+ // 是否仅查看
116
119
  isView: {
117
120
  type: Boolean,
118
121
  default: false
119
122
  },
120
- /**
121
- * 需要展示的节点分组 不传默认展示所有内置节点
122
- */
123
+ // 需要展示的节点分组 不传默认展示所有内置节点
123
124
  showNodeGroup: {
124
125
  type: Array,
125
126
  default: []
@@ -140,12 +141,7 @@ export default {
140
141
  }
141
142
  }
142
143
  */
143
- nodesDataConfig: {
144
- type: Object,
145
- default: {}
146
- },
147
- // 用于接受更改数据表后,对应的表字段信息,此值属于定制化设置所需字段时使用
148
- tableFieldsList:{
144
+ nodesDataConfig: {
149
145
  type: Object,
150
146
  default: {}
151
147
  },
@@ -566,7 +562,7 @@ export default {
566
562
  this.logicFlow.setProperties(data.id, {
567
563
  error: false
568
564
  });
569
-
565
+
570
566
  this.clickNode = data
571
567
  this.drawerShow = true
572
568
 
@@ -584,7 +580,7 @@ export default {
584
580
  let { formConfig } = nodeDatas[node.type];
585
581
  let { formItems } = formConfig;
586
582
  let { data } = node.properties;
587
-
583
+
588
584
  if (formItems?.length > 0) {
589
585
  for (const item of formItems) {
590
586
  let value = data ? data[item?.name] : data;
@@ -624,14 +620,9 @@ export default {
624
620
  }
625
621
  }
626
622
  return Object.keys(errorNodes).length === 0;
627
- },
628
-
629
- changedFieldValue(val){
630
- this.$emit('changedFieldValue',val)
631
623
  }
632
- },
633
624
 
634
-
625
+ },
635
626
  }
636
627
  </script>
637
628
 
@@ -1,8 +1,7 @@
1
1
  <template>
2
2
  <lw-form-mini ref="dataFormRef"
3
3
  :config="config"
4
- v-model="dataForm"
5
- @changedFieldValue="changedFieldValue">
4
+ v-model="dataForm">
6
5
  <!-- 定时器 表单自定义部分 -->
7
6
  <template #dateCron>
8
7
  <lwCronSelect v-model="dataForm.cron" />
@@ -35,40 +34,16 @@
35
34
  </template>
36
35
  </lwTableForm>
37
36
  </template>
38
- <!-- 所需字段 自定义设置 -->
39
- <template #cols>
40
- <div style="width: 100%;display: flex;">
41
- <el-input v-model="dataForm.cols" placeholder="来源字段" />
42
- <el-button type="primary" style="margin-left:5px ;" @click="openFieldChoice">选择字段</el-button>
43
- </div>
37
+
38
+ <template v-slot:[soltName]="{itemCur, formCur}"
39
+ v-for="soltName in soltList">
40
+ <slot :name="soltName"
41
+ :itemCur="itemCur"
42
+ :formCur="formCur"></slot>
44
43
  </template>
44
+
45
45
  <span></span>
46
46
  </lw-form-mini>
47
-
48
- <!-- 字段选择弹框 -->
49
- <el-dialog
50
- v-model="dialogVisible"
51
- title="字段选择"
52
- width="500"
53
- :before-close="handleClose"
54
- >
55
- <el-table :data="tableFieldsList?.from || []"
56
- row-key="name"
57
- @selection-change="handleSelectionChange">
58
- <el-table-column type="selection" width="55" />
59
- <el-table-column property="name" label="id" width="150" />
60
- <el-table-column property="aliasName" label="名称" width="200" />
61
- <el-table-column property="type" label="类型" />
62
- </el-table>
63
- <template #footer>
64
- <div class="dialog-footer">
65
- <el-button @click="cancel">取消</el-button>
66
- <el-button type="primary" @click="confirm">
67
- 确认
68
- </el-button>
69
- </div>
70
- </template>
71
- </el-dialog>
72
47
  </template>
73
48
 
74
49
  <script>
@@ -76,14 +51,6 @@ import nodeDatas from '../nodesData/index.js'
76
51
  export default {
77
52
  name: "BasicSettings",
78
53
  props: {
79
- nodeData: {
80
- type: Object,
81
- default: () => { }
82
- },
83
- tableFieldsList: {
84
- type: Object,
85
- default: () => { }
86
- },
87
54
  modelValue: {
88
55
  type: Object,
89
56
  default: () => ({}),
@@ -92,40 +59,14 @@ export default {
92
59
  type: Object,
93
60
  default: () => ({}),
94
61
  },
62
+ soltList: { type: Array, default: () => { return [] } },
95
63
  },
96
64
  data() {
97
65
  return {
98
66
  ...nodeDatas,
99
67
  dataForm: {},
100
- dialogVisible:false,
101
- multipleSelection:[]
102
68
  };
103
69
  },
104
- methods:{
105
- changedFieldValue(val){
106
- this.$emit('changedFieldValue',val)
107
- },
108
- openFieldChoice(){
109
- this.dialogVisible = true
110
- },
111
- handleSelectionChange(val){
112
- this.multipleSelection = val
113
- },
114
- cancel(){
115
- this.dialogVisible = false
116
- this.multipleSelection = this.dataForm.cols.split(',')
117
- },
118
- confirm(){
119
- this.dialogVisible = false
120
- if(!this.dataForm.cols)this.dataForm.cols = ''
121
- const idsInMultipleSelection = []
122
- this.multipleSelection.map(it=>{
123
- idsInMultipleSelection.push(it.name)
124
- })
125
- this.dataForm.cols = `${this.dataForm.cols}${this.dataForm.cols===''?'':','}${[...new Set(idsInMultipleSelection)].join(',')}`
126
- this.dataForm.cols = [...new Set(this.dataForm.cols.split(','))].join(',')
127
- }
128
- },
129
70
  watch: {
130
71
  modelValue: {
131
72
  handler(val) {
@@ -4,22 +4,13 @@
4
4
  direction="rtl"
5
5
  :append-to-body="true"
6
6
  :size="600"
7
- :before-close="close"
8
- >
7
+ :before-close="close">
9
8
  <div v-if="isShow"
10
9
  class="drawer-form">
11
10
  <el-collapse v-model="activeName"
12
11
  accordion>
13
12
  <el-collapse-item title="基础信息"
14
13
  name="basicInfo">
15
- <!-- 基础信息 -->
16
- <basicSettings ref="dataFormRef"
17
- v-model="dataForm.properties.data"
18
- :config="basicConfig"
19
- @changedFieldValue="changedFieldValue"/>
20
- </el-collapse-item>
21
- <el-collapse-item title="节点信息"
22
- name="nodeInfo">
23
14
  <!-- 说明:
24
15
  此处如果对应的节点没有特别的处理直接使用 basicSettings 就可
25
16
  如果这个节点有特别的操作 请自定义节点组件 以防默认组件过于庞大-->
@@ -45,14 +36,19 @@
45
36
  <template v-else>
46
37
  <basicSettings ref="dataFormRef"
47
38
  v-model="dataForm.properties.data"
48
- :config="config"
49
- :nodeData="nodeData"
50
- :tableFieldsList="tableFieldsList"
51
- @changedFieldValue="changedFieldValue"/>
39
+ :soltList="soltList"
40
+ :config="config">
41
+ <template v-slot:[soltName]="{itemCur, formCur}"
42
+ v-for="soltName in soltList">
43
+ <slot :name="soltName"
44
+ :itemCur="itemCur"
45
+ :formCur="formCur"></slot>
46
+ </template>
47
+
48
+ </basicSettings>
52
49
  </template>
53
50
 
54
51
  </el-collapse-item>
55
-
56
52
  <el-collapse-item title="样式设置"
57
53
  name="styleSettings">
58
54
  <!-- 基础设置 -->
@@ -65,6 +61,7 @@
65
61
  </el-collapse-item>
66
62
  </el-collapse>
67
63
  </div>
64
+
68
65
  <template #footer>
69
66
  <el-button @click="close">取 消</el-button>
70
67
  <el-button type="primary"
@@ -94,12 +91,12 @@ export default {
94
91
  props: {
95
92
  nodeData: { type: Object, default: () => { } },
96
93
  nodesDataConfig: { type: Object, default: () => { } },
97
- tableFieldsList: { type: Object, default: () => { } },
98
94
  lf: {
99
95
  type: Object,
100
96
  default: () => { }
101
97
  },
102
- drawerShow: { type: Boolean, default: false }
98
+ drawerShow: { type: Boolean, default: false },
99
+ soltList: { type: Array, default: () => { return [] } },
103
100
  },
104
101
  watch: {
105
102
  drawerShow: {
@@ -123,8 +120,7 @@ export default {
123
120
  style: {},
124
121
  }
125
122
  },
126
- isShow: false,
127
-
123
+ isShow: false
128
124
  }
129
125
  },
130
126
  computed: {
@@ -238,183 +234,7 @@ export default {
238
234
 
239
235
  // 取出对应节点的表单配置
240
236
  let nodeConfig = nodeDatasMerge[this.nodeData.type]?.formConfig || {};
241
- // 深拷贝,避免直接修改全局配置
242
- nodeConfig = JSON.parse(JSON.stringify(nodeConfig));
243
237
 
244
- if (nodeConfig?.labelWidth) {
245
- config.labelWidth = nodeConfig.labelWidth;
246
- }
247
- if (nodeConfig?.labelPosition) {
248
- config.labelPosition = nodeConfig.labelPosition;
249
- }
250
-
251
- // 处理需要接口的内容
252
- if (!this.$store.state[`lwFlow_${this.nodeData.type}`]) {
253
- this.$store.state[`lwFlow_${this.nodeData.type}`] = {};
254
- }
255
- nodeConfig?.formItems?.forEach(async item => {
256
- if (item?.options?.items) {
257
- if (item.api) {
258
- let items = await item.api(this.$http);
259
- item.options.items = items || [];
260
- }
261
- // 全局化选项内容 用于回显数据
262
- if (item?.options?.name) {
263
- this.$store.state[`lwFlow_${this.nodeData.type}`][`${item.name}.${item.options.name}`] =
264
- item?.options?.items || '';
265
- } else {
266
- this.$store.state[`lwFlow_${this.nodeData.type}`][item.name] =
267
- item?.options?.items || '';
268
- }
269
- }
270
- });
271
-
272
- if (nodeConfig?.formItems) {
273
- config.formItems = nodeConfig.formItems;
274
- }
275
- return config;
276
- },
277
- basicConfig() {
278
-
279
- /**
280
- * 深度合并两个对象
281
- * @param {Object} target 基础对象
282
- * @param {Object} source 覆盖的对象
283
- * @returns {Object} 合并后的对象
284
- */
285
- function deepMerge(target, source) {
286
- // 如果 target 不是对象,则直接返回 source(注意:这里假设 source 一定有意义)
287
- if (typeof target !== 'object' || target === null) {
288
- return source;
289
- }
290
-
291
- // 遍历 source 的每个属性
292
- for (const key in source) {
293
- if (source.hasOwnProperty(key)) {
294
- const sourceValue = source[key];
295
- const targetValue = target[key];
296
-
297
- // 特殊处理 formItems 数组
298
- if (key === 'formItems' && Array.isArray(sourceValue)) {
299
- target[key] = mergeFormItems(targetValue, sourceValue);
300
- } else if (Array.isArray(sourceValue)) {
301
- // 非 formItems 数组直接覆盖(也可根据需要扩展其他数组的合并规则)
302
- target[key] = sourceValue.slice();
303
- } else if (typeof sourceValue === 'object' && sourceValue !== null) {
304
- // 如果 target 中对应属性不是对象,则先置为空对象
305
- if (typeof targetValue !== 'object' || targetValue === null) {
306
- target[key] = {};
307
- }
308
- // 递归合并对象
309
- target[key] = deepMerge(target[key], sourceValue);
310
- } else {
311
- // 基本数据类型直接覆盖
312
- target[key] = sourceValue;
313
- }
314
-
315
- }
316
- }
317
- return target;
318
- }
319
-
320
- /**
321
- * 对 formItems 数组进行合并
322
- * @param {Array} baseItems 基础 formItems 数组(可能为空)
323
- * @param {Array} overrideItems 覆盖的 formItems 数组
324
- * @returns {Array} 合并后的 formItems 数组
325
- */
326
- function mergeFormItems(baseItems, overrideItems) {
327
- // 如果基础数据不存在或不是数组,则初始化为空数组
328
- if (!Array.isArray(baseItems)) {
329
- baseItems = [];
330
- }
331
-
332
- // 遍历覆盖数组中的每一项
333
- overrideItems.forEach(overrideItem => {
334
- let matched = false;
335
- // 遍历基础数组中所有 name 相同的项
336
- baseItems.forEach((baseItem, index) => {
337
- if (baseItem.name === overrideItem.name) {
338
- // 如果覆盖项设置了 hideHandle,则只有在 hideHandle 值相同的情况下才进行合并
339
- if (overrideItem.hasOwnProperty('hideHandle')) {
340
- if (baseItem.hideHandle === overrideItem.hideHandle) {
341
- baseItems[index] = deepMerge(baseItem, overrideItem);
342
- matched = true;
343
- }
344
- } else {
345
- // 如果没有设置 hideHandle,则覆盖所有 name 相同的项
346
- baseItems[index] = deepMerge(baseItem, overrideItem);
347
- matched = true;
348
- }
349
- }
350
- });
351
- // 如果没有找到匹配项,则直接添加新的项(深拷贝以防引用问题)
352
- if (!matched) {
353
- baseItems.push(JSON.parse(JSON.stringify(overrideItem)));
354
- }
355
- });
356
-
357
- return baseItems;
358
- }
359
-
360
-
361
- // 默认配置
362
- let config={
363
- labelWidth: '70px',
364
- labelPosition: 'top',
365
- formItems: [
366
- {
367
- label: '节点名称',
368
- name: 'name',
369
- value: '',
370
- component: 'input',
371
- options: {
372
- placeholder: '请输入节点名称'
373
- },
374
- span: 24
375
- },
376
- {
377
- label: '节点并行度',
378
- name: 'para',
379
- value: '',
380
- component: 'number',
381
- options: {
382
- placeholder: '请输入节点并行度'
383
- },
384
- span: 24
385
- },
386
- {
387
- label: '节点标签',
388
- name: 'tags',
389
- value: '',
390
- component: 'tags',
391
- // options: {
392
- // placeholder: '请输入节点标签'
393
- // },
394
- span: 24
395
- },
396
-
397
- {
398
- label: '描述信息',
399
- name: 'desp',
400
- value: '',
401
- component: 'input',
402
- options: {
403
- placeholder: '请输入描述信息'
404
- },
405
- span: 24
406
- },
407
- ]
408
- }
409
-
410
- // 注意:基础数据以 nodeDatas 为主,节点配置(nodesDataConfig)覆盖其中的对应字段
411
- let nodeDatasMerge = deepMerge(
412
- nodeDatas,
413
- this.nodesDataConfig
414
- );
415
-
416
- // 取出对应节点的表单配置
417
- let nodeConfig = nodeDatasMerge?.basicNode?.formConfig || {};
418
238
  // 深拷贝,避免直接修改全局配置
419
239
  nodeConfig = JSON.parse(JSON.stringify(nodeConfig));
420
240
 
@@ -450,13 +270,10 @@ export default {
450
270
  config.formItems = nodeConfig.formItems;
451
271
  }
452
272
  return config;
453
- },
273
+ }
454
274
 
455
275
  },
456
276
  methods: {
457
- changedFieldValue(val){
458
- this.$emit('changedFieldValue',val)
459
- },
460
277
  async onSubmit() {
461
278
  await this.$refs.dataFormRef.$refs.dataFormRef.validate();
462
279
  const { id } = this.dataForm
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <lw-form-mini ref="dataFormRef"
3
- :config="config"
4
- v-model="dataForm">
3
+ :config="config"
4
+ v-model="dataForm">
5
5
  <template #fontStyle>
6
6
  <el-button size="small"
7
7
  :type="dataForm.fontWeight === 'bold'? 'primary' : ''"
@@ -68,7 +68,7 @@ export default {
68
68
  return {
69
69
  labelWidth: '70px',
70
70
  labelPosition: 'right',
71
- size: 'medium',
71
+ size: 'default',
72
72
  formItems: [
73
73
  {
74
74
  label: '背景色',
@@ -3,6 +3,60 @@
3
3
  */
4
4
 
5
5
  export default {
6
+ // 表单内容
7
+ formConfig: {
8
+ labelWidth: '70px',
9
+ labelPosition: 'top',
10
+ formItems: [
11
+ {
12
+ label: '节点名称',
13
+ name: 'name',
14
+ value: '',
15
+ component: 'input',
16
+ options: {
17
+ placeholder: '请输入节点名称'
18
+ },
19
+ span: 24
20
+ },
21
+ {
22
+ label: '节点并行度',
23
+ name: 'para',
24
+ value: '',
25
+ component: 'number',
26
+ options: {
27
+ placeholder: '请输入节点并行度'
28
+ },
29
+ span: 24
30
+ },
31
+ {
32
+ label: '节点标签',
33
+ name: 'tags',
34
+ value: '',
35
+ component: 'tags',
36
+ span: 24
37
+ },
38
+ {
39
+ label: '描述信息',
40
+ name: 'desp',
41
+ value: '',
42
+ component: 'input',
43
+ options: {
44
+ placeholder: '请输入描述信息'
45
+ },
46
+ span: 24
47
+ },
48
+ {
49
+ label: '输出名称',
50
+ name: 'into',
51
+ value: '',
52
+ component: 'select',
53
+ options: {
54
+ placeholder: '请选择输出名称'
55
+ },
56
+ span: 24
57
+ }
58
+ ]
59
+ },
6
60
  // 数据来源
7
61
  configKeyableSource: {
8
62
  treeProps: {
@@ -66,14 +120,13 @@ export default {
66
120
  }
67
121
  ]
68
122
  },
69
- // 映射动作
123
+ // 映射动作
70
124
  configMapAction: {
71
125
  treeProps: {
72
126
  children: 'fields'
73
127
  },
74
128
  rowKey: 'id',
75
129
  formItems: [
76
-
77
130
  {
78
131
  label: '来源字段',
79
132
  name: 'from',
@@ -23,6 +23,23 @@ export default {
23
23
  span: 24,
24
24
  rules: [{ required: true, message: '不能为空', trigger: 'blur' }]
25
25
  },
26
+ {
27
+ label: '节点并行度',
28
+ name: 'para',
29
+ value: '',
30
+ component: 'number',
31
+ options: {
32
+ placeholder: '请输入节点并行度'
33
+ },
34
+ span: 24
35
+ },
36
+ {
37
+ label: '节点标签',
38
+ name: 'tags',
39
+ value: '',
40
+ component: 'tags',
41
+ span: 24
42
+ },
26
43
  {
27
44
  label: '连接模式',
28
45
  name: 'mode',
@@ -26,6 +26,33 @@ export default {
26
26
  labelWidth: '70px',
27
27
  labelPosition: 'top',
28
28
  formItems: [
29
+ {
30
+ label: '节点名称',
31
+ name: 'name',
32
+ value: '',
33
+ component: 'input',
34
+ options: {
35
+ placeholder: '请输入节点名称'
36
+ },
37
+ span: 24
38
+ },
39
+ {
40
+ label: '节点并行度',
41
+ name: 'para',
42
+ value: '',
43
+ component: 'number',
44
+ options: {
45
+ placeholder: '请输入节点并行度'
46
+ },
47
+ span: 24
48
+ },
49
+ {
50
+ label: '节点标签',
51
+ name: 'tags',
52
+ value: '',
53
+ component: 'tags',
54
+ span: 24
55
+ },
29
56
  {
30
57
  label: '运行模式',
31
58
  name: 'mode',
@@ -100,6 +127,16 @@ export default {
100
127
  },
101
128
  span: 24,
102
129
  },
130
+ {
131
+ label: '输出名称',
132
+ name: 'into',
133
+ value: '',
134
+ component: 'select',
135
+ options: {
136
+ placeholder: '请选择输出名称'
137
+ },
138
+ span: 24
139
+ }
103
140
  ]
104
141
  }
105
142
  }