lw-cdp-ui 1.2.24 → 1.2.26

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.
@@ -216,7 +216,12 @@ export default {
216
216
  if (!existingValue) {
217
217
  existingValue = []
218
218
  } else {
219
- existingValue = form?.[item.name][listIndex] || {}
219
+ if (form?.[item.name] && form?.[item.name][listIndex]) {
220
+ existingValue = form?.[item.name][listIndex] || {}
221
+ } else {
222
+ existingValue = {}
223
+ }
224
+
220
225
  }
221
226
  return parse(list, existingValue)
222
227
  }) || [];
@@ -4,15 +4,18 @@
4
4
  class="title-name title-name-divider"
5
5
  :id="'divider-' + index"
6
6
  :data-index="index">
7
- {{ item.label }}
8
- <el-tooltip v-if="item.tips">
9
- <template #content>
10
- <span style="max-width: 300px; display: inline-block;">
11
- {{ item.tips }}
12
- </span>
13
- </template>
14
- <el-icon><el-icon-question-filled /></el-icon>
15
- </el-tooltip>
7
+ <span>
8
+ {{ item.label }}
9
+ <el-tooltip v-if="item.tips">
10
+ <template #content>
11
+ <span style="max-width: 300px; display: inline-block;">
12
+ {{ item.tips }}
13
+ </span>
14
+ </template>
15
+ <el-icon><el-icon-question-filled /></el-icon>
16
+ </el-tooltip>
17
+ </span>
18
+ <slot :name="item?.options?.component"></slot>
16
19
  </div>
17
20
 
18
21
  <!-- 表单内容 -->
@@ -385,7 +388,6 @@ export default {
385
388
  padding-top: 20px;
386
389
  }
387
390
 
388
-
389
391
  .form-mini {
390
392
  display: flex;
391
393
  width: 100%;
@@ -400,7 +402,6 @@ export default {
400
402
  width: 100px;
401
403
  }
402
404
 
403
-
404
405
  :deep(.form-item-name-null) {
405
406
  > .el-form-item__label {
406
407
  display: none !important;
@@ -4,15 +4,19 @@
4
4
  class="title-name title-name-divider"
5
5
  :id="'divider-' + index"
6
6
  :data-index="index">
7
- {{ item.label }}
8
- <el-tooltip v-if="item.tips">
9
- <template #content>
10
- <span style="max-width: 300px; display: inline-block;">
11
- {{ item.tips }}
12
- </span>
13
- </template>
14
- <el-icon><el-icon-question-filled /></el-icon>
15
- </el-tooltip>
7
+ <span>
8
+ {{ item.label }}
9
+ <el-tooltip v-if="item.tips">
10
+ <template #content>
11
+ <span style="max-width: 300px; display: inline-block;">
12
+ {{ item.tips }}
13
+ </span>
14
+ </template>
15
+ <el-icon><el-icon-question-filled /></el-icon>
16
+ </el-tooltip>
17
+ </span>
18
+ <slot :name="item?.options?.component"></slot>
19
+
16
20
  </div>
17
21
 
18
22
  <!-- 表单内容 -->
@@ -97,23 +101,14 @@
97
101
  </template>
98
102
  <!-- date -->
99
103
  <template v-else-if="item.component == 'date'">
100
- {{ dayjs(objItem.value).format(item?.options.valueFormat || 'YYYY-MM-DD HH:mm:ss') }}
104
+ {{ dayjs(objItem.value).format(item?.options?.valueFormat || 'YYYY-MM-DD HH:mm:ss') }}
101
105
  </template>
102
106
  <!-- number -->
103
107
  <template v-else-if="item.component == 'number'">
104
- <el-input-number v-model="objItem.value"
105
- :disabled="item?.options?.disabled"
106
- :min="item?.options?.min"
107
- :max="item?.options?.max"
108
- :step="item?.options?.step || 1"
109
- :precision="item?.options?.precision"
110
- :placeholder="item?.options?.placeholder || ''"
111
- :controls-position="item?.options?.controlsPosition || 'right'">
112
- <template v-if="item?.options?.suffix"
113
- #suffix>
114
- <span>{{ item?.options.suffix }}</span>
115
- </template>
116
- </el-input-number>
108
+ {{ objItem.value }}
109
+ <template v-if="item?.options?.suffix">
110
+ <span>{{ item?.options.suffix }}</span>
111
+ </template>
117
112
  </template>
118
113
  <!-- color -->
119
114
  <template v-else-if="item.component == 'color'">
@@ -313,6 +308,9 @@ export default {
313
308
  margin-top: 25px;
314
309
  border-top: 10px solid #f5f7fa;
315
310
  padding-top: 20px;
311
+ display: flex;
312
+ align-items: center;
313
+ justify-content: space-between;
316
314
  }
317
315
 
318
316
  .form-mini {
@@ -24,7 +24,6 @@
24
24
  :label-width="config.labelWidth"
25
25
  :label-position="$i18n.locale == 'en-us' ? 'top' : config.labelPosition"
26
26
  v-loading="loading"
27
- :disabled="isView"
28
27
  element-loading-text="Loading...">
29
28
  <el-row :gutter="15">
30
29
 
@@ -36,7 +35,7 @@
36
35
  :form="form"
37
36
  :index="index">
38
37
  <!-- 没有组件是component值 就是插槽名称 -->
39
- <template v-if="!['input', 'upload', 'checkbox', 'checkboxGroup', 'switch', 'select', 'treeSelect', 'cascader', 'date', 'number', 'radio', 'color', 'rate', 'slider','tags'].includes(item.component)"
38
+ <template v-if="!['input', 'upload', 'checkbox', 'checkboxGroup', 'switch', 'select', 'treeSelect', 'cascader', 'date', 'number', 'radio', 'color', 'rate', 'slider','tags', 'divider'].includes(item.component)"
40
39
  v-slot:[item.component]>
41
40
  <slot :name="item.component"
42
41
  :itemCur="item"
@@ -45,13 +44,18 @@
45
44
  没有这个默认组件也未自定义插槽内容</el-tag>
46
45
  </slot>
47
46
  </template>
47
+ <template v-if="item?.options?.component"
48
+ v-slot:[item?.options?.component]>
49
+ <slot :name="item?.options?.component"></slot>
50
+ </template>
51
+
48
52
  </ViewItem>
49
53
  <FormItem v-else
50
54
  :item="item"
51
55
  :form="form"
52
56
  :index="index">
53
57
  <!-- 没有组件是component值 就是插槽名称 -->
54
- <template v-if="!['input', 'upload', 'checkbox', 'checkboxGroup', 'switch', 'select', 'treeSelect', 'cascader', 'date', 'number', 'radio', 'color', 'rate', 'slider','tags'].includes(item.component)"
58
+ <template v-if="!['input', 'upload', 'checkbox', 'checkboxGroup', 'switch', 'select', 'treeSelect', 'cascader', 'date', 'number', 'radio', 'color', 'rate', 'slider','tags', 'divider'].includes(item.component)"
55
59
  v-slot:[item.component]>
56
60
  <slot :name="item.component"
57
61
  :itemCur="item"
@@ -60,10 +64,15 @@
60
64
  没有这个默认组件也未自定义插槽内容</el-tag>
61
65
  </slot>
62
66
  </template>
67
+ <template v-if="item?.options?.component"
68
+ v-slot:[item?.options?.component]>
69
+ <slot :name="item?.options?.component"></slot>
70
+ </template>
63
71
  </FormItem>
64
72
  </el-col>
65
73
  </template>
66
- <el-col v-if="!isView" :span="24">
74
+ <el-col v-if="!isView"
75
+ :span="24">
67
76
  <el-form-item>
68
77
  <slot>
69
78
  <el-button type="primary"
@@ -241,6 +250,7 @@ export default {
241
250
  });
242
251
 
243
252
  delete obj[key]
253
+
244
254
  }
245
255
  return result;
246
256
  },
@@ -248,8 +258,13 @@ export default {
248
258
  //处理动态隐藏
249
259
  hideHandle(item) {
250
260
  if (typeof item?.hideHandle === 'string') {
251
- const func = new Function('form', `return ${item?.hideHandle.replace(/\$/g, "form")}`);
252
- return func(this.form);
261
+ try {
262
+ // 构造一个函数并执行,同时捕获潜在的异常
263
+ const func = new Function('form', `return ${item?.hideHandle.replace(/\$/g, "form")}`);
264
+ return func(this.form);
265
+ } catch (error) {
266
+ return false; // 或根据需求返回默认值
267
+ }
253
268
  } else if (typeof item?.hideHandle === 'boolean') {
254
269
  return item.hideHandle
255
270
  }