lw-cdp-ui 1.1.29 → 1.1.31
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/dist/components/lwForm/index.vue +22 -3
- package/dist/components/lwFormMini/index.vue +27 -12
- package/dist/components/lwUpload/index.vue +176 -139
- package/dist/lw-cdp-ui.esm.js +3266 -3233
- package/dist/lw-cdp-ui.umd.js +13 -13
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</div>
|
|
27
27
|
<!-- 表单内容 -->
|
|
28
28
|
<el-form-item v-else
|
|
29
|
-
:prop="item
|
|
29
|
+
:prop="getPropName(item)"
|
|
30
30
|
:rules="rulesHandle(item)">
|
|
31
31
|
<template #label>
|
|
32
32
|
{{ item.label }}
|
|
@@ -78,7 +78,10 @@
|
|
|
78
78
|
:accept="_item.accept"
|
|
79
79
|
:title="_item.label"
|
|
80
80
|
:parseData="item.parseData"
|
|
81
|
-
:disabled="item.options
|
|
81
|
+
:disabled="item.options?.disabled"
|
|
82
|
+
:multiple="_item?.multiple"
|
|
83
|
+
:limit="_item?.limit"
|
|
84
|
+
:tip="_item?.tip"
|
|
82
85
|
:apiObj="item.apiObj"></lw-upload>
|
|
83
86
|
</div>
|
|
84
87
|
</template>
|
|
@@ -89,7 +92,10 @@
|
|
|
89
92
|
:accept="_item.accept"
|
|
90
93
|
:title="_item.label"
|
|
91
94
|
:parseData="item.parseData"
|
|
92
|
-
:disabled="item.options
|
|
95
|
+
:disabled="item.options?.disabled"
|
|
96
|
+
:multiple="_item?.multiple"
|
|
97
|
+
:limit="_item?.limit"
|
|
98
|
+
:tip="_item?.tip"
|
|
93
99
|
:apiObj="item.apiObj"></lw-upload>
|
|
94
100
|
</div>
|
|
95
101
|
</template>
|
|
@@ -580,6 +586,19 @@ export default {
|
|
|
580
586
|
}
|
|
581
587
|
this.tagVisible = false
|
|
582
588
|
this.tagValue = ''
|
|
589
|
+
},
|
|
590
|
+
// prop NAME
|
|
591
|
+
getPropName(item) {
|
|
592
|
+
if (item.component == 'checkbox' || item.component == 'upload') {
|
|
593
|
+
if (item.name) {
|
|
594
|
+
return `${item.name}.${item.options.items[0].name}`
|
|
595
|
+
} else {
|
|
596
|
+
return item.options.items[0].name
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
} else {
|
|
600
|
+
return item?.options?.name ? `${item.name}.${item.options.name}` : item.name
|
|
601
|
+
}
|
|
583
602
|
}
|
|
584
603
|
}
|
|
585
604
|
}
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
<el-input v-model="form[item.name]"
|
|
42
42
|
:placeholder="item.options?.placeholder"
|
|
43
43
|
clearable
|
|
44
|
-
:type="item.options
|
|
45
|
-
:disabled="item.options
|
|
46
|
-
:maxlength="item.options
|
|
44
|
+
:type="item.options?.type"
|
|
45
|
+
:disabled="item.options?.disabled"
|
|
46
|
+
:maxlength="item.options?.maxlength"
|
|
47
47
|
show-word-limit>
|
|
48
|
-
<template v-if="item.options
|
|
48
|
+
<template v-if="item.options?.prepend"
|
|
49
49
|
#prepend>{{ item.options.prepend }}</template>
|
|
50
|
-
<template v-if="item.options
|
|
50
|
+
<template v-if="item.options?.append"
|
|
51
51
|
#append>{{ item.options.append }}</template>
|
|
52
52
|
</el-input>
|
|
53
53
|
</template>
|
|
@@ -60,7 +60,10 @@
|
|
|
60
60
|
:accept="_item.accept"
|
|
61
61
|
:title="_item.label"
|
|
62
62
|
:parseData="item.parseData"
|
|
63
|
-
:disabled="item.options
|
|
63
|
+
:disabled="item.options?.disabled"
|
|
64
|
+
:multiple="_item?.multiple"
|
|
65
|
+
:limit="_item?.limit"
|
|
66
|
+
:tip="_item?.tip"
|
|
64
67
|
:apiObj="item.apiObj"></lw-upload>
|
|
65
68
|
|
|
66
69
|
</template>
|
|
@@ -105,6 +108,16 @@
|
|
|
105
108
|
:value="option.value"></el-option>
|
|
106
109
|
</el-select>
|
|
107
110
|
|
|
111
|
+
</template>
|
|
112
|
+
<!-- treeSelect -->
|
|
113
|
+
<template v-else-if="item.component == 'treeSelect'">
|
|
114
|
+
<el-tree-select v-model="form[item.name]"
|
|
115
|
+
:props="item.options?.props"
|
|
116
|
+
:node-Key="item.options?.nodeKey"
|
|
117
|
+
:multiple="item.options?.multiple"
|
|
118
|
+
:check-Strictly="item.options?.checkStrictly"
|
|
119
|
+
:data="item.options?.items"></el-tree-select>
|
|
120
|
+
|
|
108
121
|
</template>
|
|
109
122
|
<!-- cascader -->
|
|
110
123
|
<template v-else-if="item.component == 'cascader'">
|
|
@@ -178,7 +191,7 @@
|
|
|
178
191
|
@close="tagClose(tag, form[item.name])">
|
|
179
192
|
{{ tag }}
|
|
180
193
|
</el-tag>
|
|
181
|
-
<el-input v-if="tagVisible"
|
|
194
|
+
<el-input v-if="tagVisible[item.name]"
|
|
182
195
|
v-model="tagValue"
|
|
183
196
|
class="w-20"
|
|
184
197
|
size="small"
|
|
@@ -187,7 +200,7 @@
|
|
|
187
200
|
<el-button v-else
|
|
188
201
|
class="button-new-tag"
|
|
189
202
|
size="small"
|
|
190
|
-
@click="tagVisible = true">
|
|
203
|
+
@click="tagVisible[item.name] = true">
|
|
191
204
|
+ 添加
|
|
192
205
|
</el-button>
|
|
193
206
|
</div>
|
|
@@ -273,7 +286,7 @@ export default {
|
|
|
273
286
|
return {
|
|
274
287
|
form: {},
|
|
275
288
|
tagValue: '',
|
|
276
|
-
tagVisible:
|
|
289
|
+
tagVisible: {},
|
|
277
290
|
isChange: true,
|
|
278
291
|
renderLoading: false
|
|
279
292
|
}
|
|
@@ -282,7 +295,8 @@ export default {
|
|
|
282
295
|
modelValue: {
|
|
283
296
|
handler(val, old) {
|
|
284
297
|
if (this.hasConfig && this.isChange) {
|
|
285
|
-
|
|
298
|
+
let form = this.flattenObject(val)
|
|
299
|
+
this.form = Object.assign(this.form, form)
|
|
286
300
|
}
|
|
287
301
|
},
|
|
288
302
|
deep: true
|
|
@@ -344,7 +358,8 @@ export default {
|
|
|
344
358
|
})
|
|
345
359
|
|
|
346
360
|
if (this.hasValue) {
|
|
347
|
-
|
|
361
|
+
let form = this.flattenObject(this.modelValue)
|
|
362
|
+
this.form = Object.assign(this.form, form)
|
|
348
363
|
}
|
|
349
364
|
},
|
|
350
365
|
flattenObject(obj, prefix = '') {
|
|
@@ -428,7 +443,7 @@ export default {
|
|
|
428
443
|
row[item.name] = row[item.name] || []
|
|
429
444
|
row[item.name].push(this.tagValue)
|
|
430
445
|
}
|
|
431
|
-
this.tagVisible = false
|
|
446
|
+
this.tagVisible[item.name] = false
|
|
432
447
|
this.tagValue = ''
|
|
433
448
|
}
|
|
434
449
|
}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="lw-upload"
|
|
3
|
-
:class="{ 'lw-upload-round': round }"
|
|
4
|
-
|
|
3
|
+
:class="{ 'lw-upload-round': round }">
|
|
4
|
+
|
|
5
|
+
<template v-for="(f, index) in fileList">
|
|
6
|
+
<div class="lw-upload__img"
|
|
7
|
+
:style="style">
|
|
8
|
+
<el-image class="image"
|
|
9
|
+
:src="f"
|
|
10
|
+
:preview-src-list="fileList"
|
|
11
|
+
fit="cover"
|
|
12
|
+
hide-on-click-modal
|
|
13
|
+
append-to-body
|
|
14
|
+
:z-index="9999">
|
|
15
|
+
<template #placeholder>
|
|
16
|
+
<div class="lw-upload__img-slot">
|
|
17
|
+
Loading...
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
</el-image>
|
|
21
|
+
<div class="lw-upload__img-actions"
|
|
22
|
+
v-if="!disabled">
|
|
23
|
+
<span class="del"
|
|
24
|
+
@click="handleRemove(index)"><el-icon><el-icon-delete /></el-icon></span>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
5
29
|
<div v-if="file && file.status != 'success'"
|
|
6
30
|
class="lw-upload__uploading">
|
|
7
31
|
<div class="lw-upload__progress">
|
|
@@ -13,29 +37,10 @@
|
|
|
13
37
|
:src="file.tempFile"
|
|
14
38
|
fit="cover"></el-image>
|
|
15
39
|
</div>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<el-image class="image"
|
|
19
|
-
:src="file.url"
|
|
20
|
-
:preview-src-list="[file.url]"
|
|
21
|
-
fit="cover"
|
|
22
|
-
hide-on-click-modal
|
|
23
|
-
append-to-body
|
|
24
|
-
:z-index="9999">
|
|
25
|
-
<template #placeholder>
|
|
26
|
-
<div class="lw-upload__img-slot">
|
|
27
|
-
Loading...
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
</el-image>
|
|
31
|
-
<div class="lw-upload__img-actions"
|
|
32
|
-
v-if="!disabled">
|
|
33
|
-
<span class="del"
|
|
34
|
-
@click="handleRemove()"><el-icon><el-icon-delete /></el-icon></span>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
<el-upload v-if="!file"
|
|
40
|
+
|
|
41
|
+
<el-upload v-if="fileList.length < limit"
|
|
38
42
|
class="uploader"
|
|
43
|
+
:style="style"
|
|
39
44
|
ref="uploader"
|
|
40
45
|
:auto-upload="autoUpload"
|
|
41
46
|
:disabled="disabled"
|
|
@@ -44,7 +49,7 @@
|
|
|
44
49
|
:name="name"
|
|
45
50
|
:data="data"
|
|
46
51
|
:accept="accept"
|
|
47
|
-
:limit="
|
|
52
|
+
:limit="limit"
|
|
48
53
|
:http-request="request"
|
|
49
54
|
:on-change="change"
|
|
50
55
|
:before-upload="before"
|
|
@@ -61,9 +66,12 @@
|
|
|
61
66
|
</div>
|
|
62
67
|
</div>
|
|
63
68
|
</slot>
|
|
69
|
+
<template #tip>
|
|
70
|
+
<div class="el-upload__tip">
|
|
71
|
+
{{tip}}
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
64
74
|
</el-upload>
|
|
65
|
-
<span style="display:none!important"><el-input v-model="value"></el-input></span>
|
|
66
|
-
|
|
67
75
|
</div>
|
|
68
76
|
</template>
|
|
69
77
|
|
|
@@ -87,14 +95,16 @@ export default {
|
|
|
87
95
|
* @property {Boolean} showFileList - 是否显示已上传文件列表,默认为 false
|
|
88
96
|
* @property {Boolean} disabled - 是否禁用上传功能,默认为 false
|
|
89
97
|
* @property {Boolean} round - 是否显示圆角按钮,默认为 false
|
|
98
|
+
* @property {Boolean} multiple - 是否多个文件,默认为 false
|
|
90
99
|
* @property {Function} onSuccess - 上传成功后的回调函数,默认为空函数
|
|
91
100
|
* @property {Function} parseData - 解析上传响应数据的函数,默认为解析状态码、文件名、图片远程地址和描述字段
|
|
92
101
|
*/
|
|
93
102
|
props: {
|
|
94
|
-
modelValue: { type: String, default: "" },
|
|
103
|
+
modelValue: { type: [String, Array], default: "" },
|
|
95
104
|
height: { type: Number, default: 148 },
|
|
96
105
|
width: { type: Number, default: 148 },
|
|
97
106
|
title: { type: String, default: "" },
|
|
107
|
+
tip: { type: String, default: "" },
|
|
98
108
|
icon: { type: String, default: "el-icon-plus" },
|
|
99
109
|
action: { type: String, default: () => { } },
|
|
100
110
|
apiObj: { type: Object, default: () => { } },
|
|
@@ -105,6 +115,7 @@ export default {
|
|
|
105
115
|
limit: { type: Number, default: 1 },
|
|
106
116
|
autoUpload: { type: Boolean, default: true },
|
|
107
117
|
showFileList: { type: Boolean, default: false },
|
|
118
|
+
multiple: { type: Boolean, default: false },
|
|
108
119
|
disabled: { type: Boolean, default: false },
|
|
109
120
|
round: { type: Boolean, default: false },
|
|
110
121
|
onSuccess: { type: Function, default: () => { return true } },
|
|
@@ -124,6 +135,7 @@ export default {
|
|
|
124
135
|
return {
|
|
125
136
|
value: "",
|
|
126
137
|
file: null,
|
|
138
|
+
fileList: [],
|
|
127
139
|
style: {
|
|
128
140
|
width: this.width + "px",
|
|
129
141
|
height: this.height + "px"
|
|
@@ -156,7 +168,10 @@ export default {
|
|
|
156
168
|
this.file = null
|
|
157
169
|
}
|
|
158
170
|
},
|
|
159
|
-
handleRemove() {
|
|
171
|
+
handleRemove(index) {
|
|
172
|
+
if (this.multiple) {
|
|
173
|
+
this.fileList.splice(index, 1)
|
|
174
|
+
}
|
|
160
175
|
this.clearFiles()
|
|
161
176
|
},
|
|
162
177
|
clearFiles() {
|
|
@@ -224,9 +239,16 @@ export default {
|
|
|
224
239
|
})
|
|
225
240
|
return false
|
|
226
241
|
}
|
|
227
|
-
var response = this.parseData(res,file)
|
|
242
|
+
var response = this.parseData(res, file)
|
|
228
243
|
file.url = response.src
|
|
229
|
-
this.
|
|
244
|
+
console.log(this.fileList)
|
|
245
|
+
this.fileList.push(file.url)
|
|
246
|
+
if (this.multiple) {
|
|
247
|
+
this.value = this.fileList
|
|
248
|
+
} else {
|
|
249
|
+
this.value = file.url
|
|
250
|
+
}
|
|
251
|
+
|
|
230
252
|
},
|
|
231
253
|
error(err) {
|
|
232
254
|
this.$nextTick(() => {
|
|
@@ -264,135 +286,150 @@ export default {
|
|
|
264
286
|
}
|
|
265
287
|
</script>
|
|
266
288
|
|
|
267
|
-
<style
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
289
|
+
<style lang="scss" scoped>
|
|
290
|
+
// 表单错误状态样式
|
|
291
|
+
.el-form-item.is-error {
|
|
292
|
+
.lw-upload {
|
|
293
|
+
.el-upload--picture-card {
|
|
294
|
+
border-color: var(--el-color-danger);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
274
297
|
}
|
|
275
298
|
|
|
276
|
-
|
|
277
|
-
.lw-upload
|
|
299
|
+
// 上传组件通用样式
|
|
300
|
+
.lw-upload {
|
|
301
|
+
display: flex;
|
|
302
|
+
gap: 10px;
|
|
278
303
|
width: 100%;
|
|
279
|
-
|
|
280
|
-
|
|
304
|
+
flex-wrap: wrap;
|
|
305
|
+
justify-content: left;
|
|
306
|
+
.el-upload--picture-card {
|
|
307
|
+
border-radius: 0;
|
|
308
|
+
}
|
|
281
309
|
|
|
282
|
-
.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
310
|
+
.uploader,
|
|
311
|
+
:deep(.el-upload) {
|
|
312
|
+
width: 100%;
|
|
313
|
+
height: 100%;
|
|
314
|
+
}
|
|
287
315
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
316
|
+
&__img {
|
|
317
|
+
width: 100%;
|
|
318
|
+
height: 100%;
|
|
319
|
+
position: relative;
|
|
292
320
|
|
|
293
|
-
.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
display: none;
|
|
298
|
-
}
|
|
321
|
+
.image {
|
|
322
|
+
width: 100%;
|
|
323
|
+
height: 100%;
|
|
324
|
+
}
|
|
299
325
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
height: 25px;
|
|
306
|
-
cursor: pointer;
|
|
307
|
-
color: #fff;
|
|
308
|
-
}
|
|
326
|
+
&-actions {
|
|
327
|
+
position: absolute;
|
|
328
|
+
top: 0;
|
|
329
|
+
right: 0;
|
|
330
|
+
display: none;
|
|
309
331
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
332
|
+
span {
|
|
333
|
+
display: flex;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
align-items: center;
|
|
336
|
+
width: 25px;
|
|
337
|
+
height: 25px;
|
|
338
|
+
cursor: pointer;
|
|
339
|
+
color: #fff;
|
|
313
340
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
341
|
+
i {
|
|
342
|
+
font-size: 12px;
|
|
343
|
+
}
|
|
317
344
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
345
|
+
&.del {
|
|
346
|
+
background: #f56c6c;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
321
350
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
font-size: 12px;
|
|
329
|
-
background-color: var(--el-fill-color-lighter);
|
|
330
|
-
}
|
|
351
|
+
&:hover {
|
|
352
|
+
&-actions {
|
|
353
|
+
display: block;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
331
357
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
358
|
+
&__img-slot {
|
|
359
|
+
display: flex;
|
|
360
|
+
justify-content: center;
|
|
361
|
+
align-items: center;
|
|
362
|
+
width: 100%;
|
|
363
|
+
height: 100%;
|
|
364
|
+
font-size: 12px;
|
|
365
|
+
background-color: var(--el-fill-color-lighter);
|
|
366
|
+
}
|
|
337
367
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
display: flex;
|
|
343
|
-
justify-content: center;
|
|
344
|
-
align-items: center;
|
|
345
|
-
background-color: var(--el-overlay-color-lighter);
|
|
346
|
-
z-index: 1;
|
|
347
|
-
padding: 10px;
|
|
348
|
-
}
|
|
368
|
+
&__uploading {
|
|
369
|
+
width: 100%;
|
|
370
|
+
height: 100%;
|
|
371
|
+
position: relative;
|
|
349
372
|
|
|
350
|
-
.
|
|
351
|
-
|
|
352
|
-
|
|
373
|
+
.image {
|
|
374
|
+
width: 100%;
|
|
375
|
+
height: 100%;
|
|
376
|
+
}
|
|
353
377
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
378
|
+
&__progress {
|
|
379
|
+
position: absolute;
|
|
380
|
+
width: 100%;
|
|
381
|
+
height: 100%;
|
|
382
|
+
display: flex;
|
|
383
|
+
justify-content: center;
|
|
384
|
+
align-items: center;
|
|
385
|
+
background-color: var(--el-overlay-color-lighter);
|
|
386
|
+
z-index: 1;
|
|
387
|
+
padding: 10px;
|
|
358
388
|
|
|
359
|
-
.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
align-items: center;
|
|
365
|
-
flex-direction: column;
|
|
366
|
-
}
|
|
389
|
+
.el-progress {
|
|
390
|
+
width: 100%;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
367
394
|
|
|
368
|
-
.
|
|
369
|
-
|
|
370
|
-
|
|
395
|
+
.file-empty {
|
|
396
|
+
width: 100%;
|
|
397
|
+
height: 100%;
|
|
398
|
+
display: flex;
|
|
399
|
+
justify-content: center;
|
|
400
|
+
align-items: center;
|
|
401
|
+
flex-direction: column;
|
|
371
402
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
color: #8c939d;
|
|
376
|
-
margin-top: 8px;
|
|
377
|
-
}
|
|
403
|
+
i {
|
|
404
|
+
font-size: 28px;
|
|
405
|
+
}
|
|
378
406
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
407
|
+
h4 {
|
|
408
|
+
font-size: 12px;
|
|
409
|
+
font-weight: normal;
|
|
410
|
+
color: #8c939d;
|
|
411
|
+
margin-top: 8px;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
383
414
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
415
|
+
&.lw-upload-round {
|
|
416
|
+
border-radius: 50%;
|
|
417
|
+
overflow: hidden;
|
|
387
418
|
|
|
388
|
-
.
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
right: 0;
|
|
392
|
-
bottom: 0;
|
|
393
|
-
}
|
|
419
|
+
.el-upload--picture-card {
|
|
420
|
+
border-radius: 50%;
|
|
421
|
+
}
|
|
394
422
|
|
|
395
|
-
.lw-
|
|
396
|
-
|
|
423
|
+
.lw-upload__img-actions {
|
|
424
|
+
top: auto;
|
|
425
|
+
left: 0;
|
|
426
|
+
right: 0;
|
|
427
|
+
bottom: 0;
|
|
428
|
+
|
|
429
|
+
span {
|
|
430
|
+
width: 100%;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
397
434
|
}
|
|
398
435
|
</style>
|