lw-cdp-ui 1.2.1 → 1.2.2

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.
@@ -7,7 +7,7 @@
7
7
  ghost-class="draggable-ghost"
8
8
  :class="{ showBorder: hideBorder, cur: curIndex == (formItems.name || formItems?.options?.items[0]?.name) }">
9
9
  <template #item="{element: item, index}">
10
- <el-col :span="item.span || 24"
10
+ <el-col :span="['list'].includes(item.component) ? 24 : item.span || 24"
11
11
  :class="{ borderItem: hideBorder, cur: hideBorder && curIndex == (item.name || item?.options?.items[0]?.name) }"
12
12
  v-if="!hideHandle(item)">
13
13
  <!-- 组合/列表 -->
@@ -24,30 +24,34 @@
24
24
  </template>
25
25
  <!-- 列表 显示时 -->
26
26
  <template v-else-if="['list'].includes(item.component)">
27
- <el-form-item :label="item.label"
28
- @click.capture="changeClick(item)">
29
- <div class="list-item"
30
- :class="{ borderItem: hideBorder }"
31
- v-for="(x, xIndex) in item.value">
32
- <JsonItem v-if="form[item.name]"
33
- :formItems="x"
34
- :form="form[item.name][xIndex]"
35
- :hideBorder="hideBorder"
36
- @curClick="changeClick"></JsonItem>
27
+ <el-form-item @click.capture="changeClick(item)">
28
+ <template #label>
29
+ {{ item.label }}
30
+ <el-button v-if="!hideBorder"
31
+ type="primary"
32
+ class="add-btn"
33
+ plain
34
+ size="small"
35
+ icon="el-icon-plus"
36
+ @click="addListItem(item.value)">{{ $t('btn.add') }}</el-button>
37
+ </template>
38
+ <el-col :span="item.span || 24"
39
+ v-for="(x, xIndex) in item.value">
40
+ <div class="list-item"
41
+ :class="{borderItem: hideBorder}">
42
+ <JsonItem v-if="form[item.name]"
43
+ :formItems="x"
44
+ :form="form[item.name][xIndex]"
45
+ :hideBorder="hideBorder"
46
+ @curClick="changeClick"></JsonItem>
47
+ <el-icon class="remove-btn"
48
+ size="14"
49
+ v-if="!hideBorder && item.value.length > 1"
50
+ @click="deleteListItem(item.value, xIndex)"><el-icon-delete /></el-icon>
51
+ </div>
37
52
 
38
- <el-icon class="remove-btn"
39
- size="14"
40
- v-if="!hideBorder && item.value.length > 1"
41
- @click="deleteListItem(item.value, xIndex)"><el-icon-delete /></el-icon>
42
- </div>
53
+ </el-col>
43
54
 
44
- <el-button v-if="!hideBorder"
45
- type="primary"
46
- class="add-btn"
47
- plain
48
- size="small"
49
- icon="el-icon-plus"
50
- @click="addListItem(item.value)">{{ $t('btn.add') }}</el-button>
51
55
  </el-form-item>
52
56
 
53
57
  </template>
@@ -235,9 +239,25 @@ export default {
235
239
  padding: 10px;
236
240
  width: 100%;
237
241
  }
238
-
242
+ :deep(.el-form-item) {
243
+ position: relative;
244
+ }
239
245
  .add-btn {
240
- width: 100%;
241
- margin-top: 5px;
246
+ top: 0px;
247
+ right: 0;
248
+ z-index: 9;
249
+ position: absolute;
250
+ }
251
+ :deep(.el-form-item--label-right),:deep(.el-form-item--label-left) {
252
+ .el-form-item__label {
253
+ position: relative;
254
+ .add-btn {
255
+ top: 30px;
256
+ right: 10px;
257
+ // left: 0;
258
+ // z-index: 9;
259
+ // position: absolute;
260
+ }
261
+ }
242
262
  }
243
263
  </style>
@@ -110,6 +110,38 @@
110
110
 
111
111
  </template>
112
112
 
113
+ <template v-if="['tags'].includes(item.component)">
114
+ <el-form-item label="按钮名称">
115
+ <el-input v-model="item.options.addText"
116
+ placeholder="请输入"
117
+ clearable />
118
+ </el-form-item>
119
+ <el-form-item label="默认标签">
120
+ <div class="tags-list">
121
+ <el-tag v-for="tag in item.value"
122
+ :key="tag"
123
+ closable
124
+ :disable-transitions="false"
125
+ @close="tagClose(tag, item.value)">
126
+ {{ tag }}
127
+ </el-tag>
128
+ <el-input v-if="tagVisible[item.name]"
129
+ v-model="tagValue"
130
+ class="w-20"
131
+ size="small"
132
+ @keyup.enter="tagInputConfirm(item, item.value)"
133
+ @blur="tagInputConfirm(item, item.value)" />
134
+ <el-button v-else
135
+ class="button-new-tag"
136
+ size="small"
137
+ @click="tagVisible[item.name] = true">
138
+ + 添加
139
+ </el-button>
140
+ </div>
141
+ </el-form-item>
142
+
143
+ </template>
144
+
113
145
  <el-form-item v-if="item.component === 'switch'"
114
146
  label="开关文字">
115
147
  <div class="form-item">
@@ -301,6 +333,12 @@
301
333
  <script>
302
334
  export default {
303
335
  name: 'StatsConfig',
336
+ data() {
337
+ return {
338
+ tagVisible: {},
339
+ tagValue: ''
340
+ }
341
+ },
304
342
  props: {
305
343
  item: {
306
344
  type: Object,
@@ -314,6 +352,21 @@ export default {
314
352
  type: Boolean,
315
353
  default: false
316
354
  }
355
+ },
356
+ methods: {
357
+ // 删除tag
358
+ tagClose(tag, item) {
359
+ item.splice(item.indexOf(tag), 1)
360
+ },
361
+ // 增加tag
362
+ tagInputConfirm(item, val) {
363
+ if (this.tagValue) {
364
+ val = val || []
365
+ val.push(this.tagValue)
366
+ }
367
+ this.tagVisible[item.name] = false
368
+ this.tagValue = ''
369
+ }
317
370
  }
318
371
  };
319
372
  </script>
@@ -342,5 +395,17 @@ export default {
342
395
  gap: 5px;
343
396
  margin-bottom: 10px;
344
397
  }
398
+
399
+ :deep(.el-tag) {
400
+ & + .button-new-tag {
401
+ margin-left: 10px;
402
+ }
403
+ & + .w-20 {
404
+ margin-left: 10px;
405
+ }
406
+ }
407
+ .w-20 {
408
+ width: 100px;
409
+ }
345
410
  }
346
411
  </style>
@@ -65,8 +65,11 @@ export default [
65
65
  {
66
66
  label: '标签',
67
67
  name: 'tags',
68
- value: '',
68
+ value: [],
69
69
  span: 24,
70
+ options: {
71
+ addText: '添加',
72
+ },
70
73
  component: 'tags'
71
74
  }
72
75
  ]
@@ -203,7 +203,7 @@
203
203
  class="button-new-tag"
204
204
  size="small"
205
205
  @click="tagVisible[item.name] = true">
206
- + 添加
206
+ + {{item?.options?.addText || '添加'}}
207
207
  </el-button>
208
208
  </div>
209
209
  </template>
@@ -375,13 +375,9 @@ export default {
375
375
  min-width: 130px;
376
376
  padding-left: 20px;
377
377
  }
378
- .button-new-tag {
379
- margin-left: 10px;
380
- }
381
378
 
382
379
  .w-20 {
383
380
  width: 100px;
384
- margin-left: 10px;
385
381
  }
386
382
 
387
383
  .title-name {
@@ -440,4 +436,13 @@ export default {
440
436
  }
441
437
  }
442
438
  }
439
+
440
+ :deep(.el-tag){
441
+ &+.button-new-tag{
442
+ margin-left: 10px;
443
+ }
444
+ &+.w-20{
445
+ margin-left: 10px;
446
+ }
447
+ }
443
448
  </style>