sadais-piui 1.2.7-beta86 → 1.2.7-beta88
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.
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
@close="handlePopupClose"
|
|
17
17
|
@cancel="handleCancel"
|
|
18
18
|
@confirm="handleConfirm"
|
|
19
|
+
@showed="handlePopupShow"
|
|
19
20
|
>
|
|
20
21
|
<view
|
|
21
22
|
class="pi-cascader pi-h-100P pi-flex-column"
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
</scroll-view>
|
|
93
94
|
</scroll-view>
|
|
94
95
|
<!-- 已选区域 -->
|
|
95
|
-
<view class="cascader-area">
|
|
96
|
+
<view v-if="!isSingle" class="cascader-area">
|
|
96
97
|
<text>{{ `已选(${selectedIds.length})` }}</text>
|
|
97
98
|
<scroll-view class="scroll-area" scroll-x>
|
|
98
99
|
<view
|
|
@@ -108,6 +109,26 @@
|
|
|
108
109
|
</view>
|
|
109
110
|
</scroll-view>
|
|
110
111
|
</view>
|
|
112
|
+
<view v-else class="cascader-area">
|
|
113
|
+
<text>已选:</text>
|
|
114
|
+
<scroll-view
|
|
115
|
+
class="node-breadcrumb pi-solid-bottom-1"
|
|
116
|
+
scroll-x
|
|
117
|
+
style="flex: 1;padding-left: 0;overflow: hidden;"
|
|
118
|
+
>
|
|
119
|
+
<view
|
|
120
|
+
v-for="(item, index) in currentPathItems"
|
|
121
|
+
:key="index"
|
|
122
|
+
class="breadcrumb-item"
|
|
123
|
+
@click="handleClickItem(item)"
|
|
124
|
+
>
|
|
125
|
+
<pi-icon v-if="index > 0" name="right" custom-class="pi-mg-lr-6" />
|
|
126
|
+
<view class="breadcrumb-item-title">
|
|
127
|
+
{{ item[displayField] }}
|
|
128
|
+
</view>
|
|
129
|
+
</view>
|
|
130
|
+
</scroll-view>
|
|
131
|
+
</view>
|
|
111
132
|
</view>
|
|
112
133
|
<slot name="footer" />
|
|
113
134
|
</view>
|
|
@@ -230,7 +251,7 @@ export default {
|
|
|
230
251
|
innerItems: [],
|
|
231
252
|
itemsMap: {}, // 已选数据id索引
|
|
232
253
|
selectedIds: [], // 已选数据
|
|
233
|
-
cascaderWidth:
|
|
254
|
+
cascaderWidth: this.$pi.system.systemInfo.screenWidth, // 容器宽度
|
|
234
255
|
scrollLeft: 0 // 视图左侧滚动区域,自动对齐到选择的栏目
|
|
235
256
|
}
|
|
236
257
|
},
|
|
@@ -308,6 +329,18 @@ export default {
|
|
|
308
329
|
[this.keyField]: 'ROOT'
|
|
309
330
|
}
|
|
310
331
|
].concat(pathItems)
|
|
332
|
+
},
|
|
333
|
+
currentPathItems() {
|
|
334
|
+
const pathItems = []
|
|
335
|
+
if (this.isSingle) {
|
|
336
|
+
// 往上找构建完整路径
|
|
337
|
+
let p = this.itemsMap[this.selectedIds[0]]
|
|
338
|
+
while (p) {
|
|
339
|
+
pathItems.unshift(p)
|
|
340
|
+
p = this.itemsMap[p.pid]
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return pathItems
|
|
311
344
|
}
|
|
312
345
|
},
|
|
313
346
|
watch: {
|
|
@@ -385,7 +418,7 @@ export default {
|
|
|
385
418
|
handleClickItem(item) {
|
|
386
419
|
// 点击全部
|
|
387
420
|
if (item[this.keyField] === ROOT_NODE) {
|
|
388
|
-
this.currentItem = cloneDeep(this.rootItem)
|
|
421
|
+
this.currentItem = this.$pi.lang.cloneDeep(this.rootItem)
|
|
389
422
|
this.$nextTick(this.syncScrollLeft)
|
|
390
423
|
return
|
|
391
424
|
}
|
|
@@ -418,11 +451,16 @@ export default {
|
|
|
418
451
|
this.selectedIds.push(item[this.keyField])
|
|
419
452
|
}
|
|
420
453
|
},
|
|
454
|
+
handlePopupShow() {
|
|
455
|
+
this.$emit('showd')
|
|
456
|
+
this.syncScrollLeft()
|
|
457
|
+
},
|
|
421
458
|
async syncScrollLeft() {
|
|
422
459
|
// 调用此方法的时候,必须使用$nextTick,因为column是动态变化的,需要等待界面更新渲染后,才能正确设置scrollLeft的位置
|
|
423
460
|
let scrollLeft = 0
|
|
424
461
|
if (this.cascaderWidth === 0) {
|
|
425
|
-
const srollWrapRect = await this.$pi.common.queryRect(this, '.
|
|
462
|
+
const srollWrapRect = await this.$pi.common.queryRect(this, '.cascader-wrap', false)
|
|
463
|
+
console.log(this, srollWrapRect)
|
|
426
464
|
if (srollWrapRect) {
|
|
427
465
|
this.cascaderWidth = srollWrapRect.width
|
|
428
466
|
}
|
|
@@ -487,10 +525,10 @@ export default {
|
|
|
487
525
|
}
|
|
488
526
|
.column-item {
|
|
489
527
|
position: relative;
|
|
490
|
-
height: 100rpx;
|
|
528
|
+
min-height: 100rpx;
|
|
491
529
|
width: 100%;
|
|
492
530
|
white-space: initial;
|
|
493
|
-
padding:
|
|
531
|
+
padding: 16rpx 32rpx;
|
|
494
532
|
font-size: 28rpx;
|
|
495
533
|
color: #333333;
|
|
496
534
|
overflow: hidden;
|
|
@@ -514,6 +552,7 @@ export default {
|
|
|
514
552
|
.node-breadcrumb {
|
|
515
553
|
width: 100%;
|
|
516
554
|
padding-left: 32rpx;
|
|
555
|
+
padding-right: 32rpx;
|
|
517
556
|
background: #ffffff;
|
|
518
557
|
white-space: nowrap;
|
|
519
558
|
.breadcrumb-item {
|