sadais-piui 1.2.7-beta47 → 1.2.7-beta49
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.
|
@@ -64,10 +64,22 @@
|
|
|
64
64
|
>
|
|
65
65
|
<view class="pi-flex-sub pi-lh-36">
|
|
66
66
|
<slot name="item" :item="item">
|
|
67
|
+
<pi-checkbox
|
|
68
|
+
v-if="parentCanSelect"
|
|
69
|
+
:value="selectedIds.includes(item[keyField])"
|
|
70
|
+
shape="round"
|
|
71
|
+
active-mode="fill-circle"
|
|
72
|
+
class="pi-mg-right-16"
|
|
73
|
+
@click.stop="handleChangeParentSelect(item)"
|
|
74
|
+
/>
|
|
67
75
|
{{ item[displayField] || '' }}
|
|
68
76
|
</slot>
|
|
69
77
|
</view>
|
|
70
|
-
<pi-icon
|
|
78
|
+
<pi-icon
|
|
79
|
+
v-if="!parentCanSelect && selectedIds.includes(item[keyField])"
|
|
80
|
+
name="blod-check"
|
|
81
|
+
size="36"
|
|
82
|
+
/>
|
|
71
83
|
<pi-icon v-if="item[childrenField] && item[childrenField].length > 0" name="right" />
|
|
72
84
|
</view>
|
|
73
85
|
</scroll-view>
|
|
@@ -156,6 +168,12 @@ export default {
|
|
|
156
168
|
// 'children'
|
|
157
169
|
default: cascader.childrenField
|
|
158
170
|
},
|
|
171
|
+
// 父节点是否可选(默认:'false')
|
|
172
|
+
parentCanSelect: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
// false
|
|
175
|
+
default: cascader.parentCanSelect
|
|
176
|
+
},
|
|
159
177
|
// 弹窗选择参数设置
|
|
160
178
|
popupSelect: {
|
|
161
179
|
type: Object,
|
|
@@ -384,6 +402,14 @@ export default {
|
|
|
384
402
|
this.$emit('close')
|
|
385
403
|
this.handleEmitChange()
|
|
386
404
|
},
|
|
405
|
+
handleChangeParentSelect(item, selected) {
|
|
406
|
+
if (this.selectedIds.includes(item[this.keyField])) {
|
|
407
|
+
this.handleRemoveItem(item[this.keyField])
|
|
408
|
+
} else {
|
|
409
|
+
// 选中
|
|
410
|
+
this.selectedIds.push(item[this.keyField])
|
|
411
|
+
}
|
|
412
|
+
},
|
|
387
413
|
/**
|
|
388
414
|
* @vuese
|
|
389
415
|
* 根据id获取item
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2021-08-13 11:31:57
|
|
4
|
-
* @LastEditTime: 2022-
|
|
4
|
+
* @LastEditTime: 2022-11-03 12:11:22
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 图片上传组件
|
|
7
|
-
* @FilePath:
|
|
7
|
+
* @FilePath: \sadais-visitor-mp\node_modules\sadais-piui\components\pi-upload-img\index.vue
|
|
8
8
|
-->
|
|
9
9
|
|
|
10
10
|
<template>
|
|
@@ -291,6 +291,13 @@ export default {
|
|
|
291
291
|
fn: uploadImg.beforeRemove
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
+
},
|
|
295
|
+
// 压缩参数
|
|
296
|
+
compressOption: {
|
|
297
|
+
type: Object,
|
|
298
|
+
default() {
|
|
299
|
+
return uploadImg.compressOption
|
|
300
|
+
}
|
|
294
301
|
}
|
|
295
302
|
},
|
|
296
303
|
data() {
|
|
@@ -460,6 +467,26 @@ export default {
|
|
|
460
467
|
this.showCrop = false
|
|
461
468
|
this.handleUpload([this.cropedPic])
|
|
462
469
|
},
|
|
470
|
+
async handleCompressImgs(tempFilePaths) {
|
|
471
|
+
const compressUrls = []
|
|
472
|
+
|
|
473
|
+
for (let index = 0; index < tempFilePaths.length; index++) {
|
|
474
|
+
const url = tempFilePaths[index]
|
|
475
|
+
const [, result] = await uni.compressImage({
|
|
476
|
+
src: url,
|
|
477
|
+
...this.compressOption
|
|
478
|
+
})
|
|
479
|
+
const { errMsg, tempFilePath } = result
|
|
480
|
+
if (errMsg == 'compressImage:ok' && tempFilePath && typeof tempFilePath == 'string') {
|
|
481
|
+
compressUrls.push(tempFilePath)
|
|
482
|
+
console.log(TAG, '压缩图片成功', tempFilePath, 'src=' + url)
|
|
483
|
+
} else {
|
|
484
|
+
compressUrls.push(url)
|
|
485
|
+
console.log(TAG, '压缩图片成功', tempFilePath, 'src=' + url)
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return compressUrls
|
|
489
|
+
},
|
|
463
490
|
async handleChooseImage() {
|
|
464
491
|
if (this.disabled || !this.getUploadMaxCount) return
|
|
465
492
|
// 检查上传地址
|
|
@@ -484,6 +511,12 @@ export default {
|
|
|
484
511
|
if (errMsg !== 'chooseImage:ok') {
|
|
485
512
|
throw new Error(errMsg)
|
|
486
513
|
}
|
|
514
|
+
// #ifndef H5
|
|
515
|
+
// 压缩图片
|
|
516
|
+
if (this.compressOption && this.$pi.system.systemInfo.platform !== 'devtools') {
|
|
517
|
+
tempFilePaths = await this.handleCompressImgs(tempFilePaths)
|
|
518
|
+
}
|
|
519
|
+
// #endif
|
|
487
520
|
if (this.getUploadMaxCount === 1 && this.crop && tempFilePaths.length === 1) {
|
|
488
521
|
// 单张图片设置了剪裁
|
|
489
522
|
this.showCrop = true
|
package/config/cascader.js
CHANGED
|
@@ -11,6 +11,7 @@ export default {
|
|
|
11
11
|
itemHeight: 110, // 行高(默认:'110rpx')
|
|
12
12
|
showItemBottomBorder: false, // 是否显示item下边框(默认:'true')
|
|
13
13
|
itemStyle: {}, // 行样式(默认:'{}')
|
|
14
|
+
parentCanSelect: false, // 父节点是否可选(默认:'false')
|
|
14
15
|
popupSelect: popupSelect, // popupSelect配置
|
|
15
16
|
popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
|
|
16
17
|
confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
|