tenghui-ui 2.4.21 → 2.4.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.
- package/dist/style.css +1 -1
- package/dist/tenghui-ui.es.js +41 -5
- package/dist/tenghui-ui.es.js.map +1 -1
- package/dist/tenghui-ui.umd.js +22 -22
- package/dist/tenghui-ui.umd.js.map +1 -1
- package/package.json +1 -1
- package/packages/form-item/src/index.vue +79 -3
package/package.json
CHANGED
|
@@ -155,7 +155,11 @@
|
|
|
155
155
|
<el-cascader :class="{ inline_content: inlineLabel }" :ref="type" v-model="modelForm"
|
|
156
156
|
:options="options" :props="props"
|
|
157
157
|
:filter-method="filterMethod"
|
|
158
|
-
:filterable="filterable" :collapseTags="collapseTags" v-bind="setDefaultAttrs($attrs)" v-on="$listeners"
|
|
158
|
+
:filterable="filterable" :collapseTags="collapseTags" v-bind="setDefaultAttrs($attrs)" v-on="$listeners">
|
|
159
|
+
<slot name="empty">
|
|
160
|
+
<template v-slot:empty></template>
|
|
161
|
+
</slot>
|
|
162
|
+
</el-cascader>
|
|
159
163
|
</div>
|
|
160
164
|
</template>
|
|
161
165
|
<template v-else-if="type === 'daterange'">
|
|
@@ -285,6 +289,38 @@
|
|
|
285
289
|
v-on="$listeners"
|
|
286
290
|
v-model="modelForm"></check-cell>
|
|
287
291
|
</template>
|
|
292
|
+
<template v-else-if="type === 'upload'">
|
|
293
|
+
<span v-if="inlineLabel" class="inline_label" :style="{ width: labelWidth }">{{ inlineLabel }}</span>
|
|
294
|
+
<el-upload
|
|
295
|
+
ref="UploadRef"
|
|
296
|
+
action="#"
|
|
297
|
+
list-type="picture-card"
|
|
298
|
+
:http-request="handleUploadReqeust"
|
|
299
|
+
:file-list="uploadFileList"
|
|
300
|
+
:limit="1"
|
|
301
|
+
:on-exceed="() => $message.warning('超出可上传数量,请删除后再试!')"
|
|
302
|
+
v-bind="setDefaultAttrs($attrs)"
|
|
303
|
+
v-on="$listeners">
|
|
304
|
+
<i slot="default" class="el-icon-plus"></i>
|
|
305
|
+
<div slot="file" slot-scope="{file}">
|
|
306
|
+
<!-- clickHandler -->
|
|
307
|
+
<el-image ref="UploadImage" :src="file.url" :preview-src-list="[file.url]"></el-image>
|
|
308
|
+
<span class="el-upload-list__item-actions">
|
|
309
|
+
<span
|
|
310
|
+
class="el-upload-list__item-preview"
|
|
311
|
+
@click="handleUploadOperation('zoom', file)">
|
|
312
|
+
<i class="el-icon-zoom-in"></i>
|
|
313
|
+
</span>
|
|
314
|
+
|
|
315
|
+
<span
|
|
316
|
+
class="el-upload-list__item-delete"
|
|
317
|
+
@click="handleUploadOperation('remove', file)">
|
|
318
|
+
<i class="el-icon-delete"></i>
|
|
319
|
+
</span>
|
|
320
|
+
</span>
|
|
321
|
+
</div>
|
|
322
|
+
</el-upload>
|
|
323
|
+
</template>
|
|
288
324
|
</div>
|
|
289
325
|
</div>
|
|
290
326
|
</template>
|
|
@@ -412,12 +448,16 @@ export default {
|
|
|
412
448
|
optionLimit: {
|
|
413
449
|
type: Number,
|
|
414
450
|
default: 150
|
|
451
|
+
},
|
|
452
|
+
|
|
453
|
+
uploadApi: {
|
|
454
|
+
type: Function
|
|
415
455
|
}
|
|
416
456
|
},
|
|
417
457
|
data() {
|
|
418
458
|
|
|
419
459
|
let defaultModel = this.model;
|
|
420
|
-
if (this.type
|
|
460
|
+
if (['select', 'radio'].includes(this.type)) {
|
|
421
461
|
if (Array.isArray(this.model)) {
|
|
422
462
|
defaultModel = this.model.map(v => v.toString());
|
|
423
463
|
} else if (this.model || this.model === 0) {
|
|
@@ -445,6 +485,11 @@ export default {
|
|
|
445
485
|
};
|
|
446
486
|
},
|
|
447
487
|
computed: {
|
|
488
|
+
uploadFileList() {
|
|
489
|
+
return this.modelForm ? [{
|
|
490
|
+
url: this.modelForm
|
|
491
|
+
}] : []
|
|
492
|
+
},
|
|
448
493
|
staticStyle() {
|
|
449
494
|
const obj = {
|
|
450
495
|
|
|
@@ -506,6 +551,29 @@ export default {
|
|
|
506
551
|
},
|
|
507
552
|
methods: {
|
|
508
553
|
|
|
554
|
+
handleUploadOperation(cmd, file) {
|
|
555
|
+
switch (cmd) {
|
|
556
|
+
case 'zoom':
|
|
557
|
+
this.$refs.UploadImage.clickHandler();
|
|
558
|
+
break;
|
|
559
|
+
case 'remove':
|
|
560
|
+
this.modelForm = '';
|
|
561
|
+
this.$refs.UploadRef.clearFiles();
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
|
|
566
|
+
handleUploadReqeust(params) {
|
|
567
|
+
|
|
568
|
+
if (!this.uploadApi) {
|
|
569
|
+
return this.$message.warning('缺少上传API!');
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
this.uploadApi(params).then(res => {
|
|
573
|
+
this.modelForm = res;
|
|
574
|
+
})
|
|
575
|
+
},
|
|
576
|
+
|
|
509
577
|
handleAutoQuerySearch(query, callback) {
|
|
510
578
|
const backOptions = query ? this.selectOption.filter(v => v.label.toLowerCase().includes(query.toLowerCase())) : this.selectOption;
|
|
511
579
|
callback(backOptions.map(v => ({ label: v.label, value: v.label })));
|
|
@@ -670,7 +738,7 @@ export default {
|
|
|
670
738
|
model(val) {
|
|
671
739
|
|
|
672
740
|
let modelVal = val;
|
|
673
|
-
if (this.type
|
|
741
|
+
if (['select', 'radio'].includes(this.type) && !this.multiple) {
|
|
674
742
|
if (val || val === 0) {
|
|
675
743
|
modelVal = val.toString();
|
|
676
744
|
}
|
|
@@ -766,4 +834,12 @@ export default {
|
|
|
766
834
|
font-size: 14px;
|
|
767
835
|
}
|
|
768
836
|
}
|
|
837
|
+
|
|
838
|
+
/deep/ .el-upload--picture-card, /deep/ .el-upload-list--picture-card .el-upload-list__item {
|
|
839
|
+
width: 100px;
|
|
840
|
+
height: 100px;
|
|
841
|
+
line-height: 98px;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
|
|
769
845
|
</style>
|