sadais-piui 1.2.7-beta7 → 1.2.7-beta71
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/components/pi-bottom-bar/index.vue +1 -1
- package/components/pi-calendar/index.vue +187 -182
- package/components/pi-calendar-input/index.vue +6 -2
- package/components/pi-calendar-panel/components/calendar-days/index.vue +410 -0
- package/components/pi-calendar-panel/index.vue +201 -163
- package/components/pi-cascader/index.vue +536 -0
- package/components/pi-checkbox/index.vue +3 -4
- package/components/pi-checkbox-group/index.vue +2 -8
- package/components/pi-circle-progress/index.vue +108 -21
- package/components/pi-collapse/index.vue +124 -0
- package/components/pi-collapse-item/index.vue +352 -0
- package/components/pi-date-picker/index.vue +464 -391
- package/components/pi-date-picker-input/index.vue +12 -3
- package/components/pi-dropdown/components/dropdown-tab.vue +33 -24
- package/components/pi-dropdown/index.vue +58 -22
- package/components/pi-dropdown-item/index.vue +74 -55
- package/components/pi-form-item/index.vue +9 -4
- package/components/pi-grid/index.vue +1 -1
- package/components/pi-grid-item/index.vue +4 -4
- package/components/pi-img/index.vue +0 -1
- package/components/pi-img-cropper/index.vue +110 -110
- package/components/pi-input/index.vue +21 -3
- package/components/pi-list-item/index.vue +1 -1
- package/components/pi-popup/index.vue +5 -1
- package/components/pi-radio/index.vue +5 -5
- package/components/pi-radio-group/index.vue +0 -4
- package/components/pi-regions-select/index.vue +6 -1
- package/components/pi-regions-select-input/index.vue +6 -2
- package/components/pi-search/index.vue +29 -2
- package/components/pi-section/index.vue +1 -1
- package/components/pi-select/index.vue +48 -4
- package/components/pi-select-input/index.vue +6 -2
- package/components/pi-stepper/index.vue +1 -1
- package/components/pi-steps/index.vue +115 -36
- package/components/pi-table/index.vue +351 -0
- package/components/pi-tabs/index.vue +9 -3
- package/components/pi-tag/index.vue +488 -0
- package/components/pi-upload-img/index.vue +58 -9
- package/components/pi-webview/index.vue +9 -3
- package/config/actionSheet.js +0 -1
- package/config/calendarPanel.js +4 -1
- package/config/cascader.js +22 -0
- package/config/circleProgress.js +17 -10
- package/config/collapse.js +7 -0
- package/config/collapseItem.js +11 -0
- package/config/datePicker.js +29 -24
- package/config/dropdown.js +4 -1
- package/config/input.js +1 -0
- package/config/select.js +2 -0
- package/config/steps.js +1 -1
- package/config/table.js +9 -0
- package/config/tag.js +21 -0
- package/config/uploadImg.js +3 -7
- package/package.json +5 -2
- package/scss/common.scss +11 -13
- package/scss/icon/icon.scss +2 -1
- package/scss/mixin.scss +1 -1
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<pi-popup-select
|
|
3
|
+
:value="val"
|
|
4
|
+
:custom-style="getPopupSelect.customStyle"
|
|
5
|
+
:custom-class="getPopupSelect.customClass"
|
|
6
|
+
:height="getPopupSelect.height"
|
|
7
|
+
:show-title="getPopupSelect.showTitle"
|
|
8
|
+
:title="getPopupSelect.title"
|
|
9
|
+
:title-padding="getPopupSelect.titlePadding"
|
|
10
|
+
:toolbar-position="getPopupSelect.toolbarPosition"
|
|
11
|
+
:on-confirm-close="getPopupSelect.onConfirmClose"
|
|
12
|
+
:on-cancel-close="getPopupSelect.onCancelClose"
|
|
13
|
+
:confirm-btn="getConfirmBtn"
|
|
14
|
+
:cancel-btn="getCancelBtn"
|
|
15
|
+
:popup="getPopup"
|
|
16
|
+
@close="handlePopupClose"
|
|
17
|
+
@cancel="handleCancel"
|
|
18
|
+
@confirm="handleConfirm"
|
|
19
|
+
>
|
|
20
|
+
<view
|
|
21
|
+
class="pi-cascader pi-h-100P pi-flex-column"
|
|
22
|
+
:style="[customStyle]"
|
|
23
|
+
:class="[customClass]"
|
|
24
|
+
>
|
|
25
|
+
<slot name="header" />
|
|
26
|
+
<view class="cascader-wrap pi-flex-sub pi-flex-column">
|
|
27
|
+
<!-- 顶部面包屑 -->
|
|
28
|
+
<scroll-view class="node-breadcrumb pi-solid-bottom-1" scroll-x>
|
|
29
|
+
<view
|
|
30
|
+
v-for="(item, index) in pathItems"
|
|
31
|
+
:key="index"
|
|
32
|
+
class="breadcrumb-item"
|
|
33
|
+
@click="handleClickItem(item)"
|
|
34
|
+
>
|
|
35
|
+
<pi-icon v-if="item[keyField] !== ROOT_NODE" name="right" custom-class="pi-mg-lr-6" />
|
|
36
|
+
<view
|
|
37
|
+
class="breadcrumb-item-title"
|
|
38
|
+
:class="{
|
|
39
|
+
active: currentItem && currentItem[keyField] === item[keyField]
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
{{ item[displayField] }}
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</scroll-view>
|
|
46
|
+
<!-- 选择区域 -->
|
|
47
|
+
<scroll-view class="scroll-view" :scroll-left="scrollLeft" scroll-x scroll-with-animation>
|
|
48
|
+
<scroll-view
|
|
49
|
+
v-for="(col, index) of columns"
|
|
50
|
+
:key="index"
|
|
51
|
+
scroll-y
|
|
52
|
+
class="column"
|
|
53
|
+
:style="[{ width: isOnlyColumn ? '100%' : '50%' }]"
|
|
54
|
+
>
|
|
55
|
+
<view
|
|
56
|
+
v-for="item in col"
|
|
57
|
+
:key="item[keyField]"
|
|
58
|
+
class="column-item pi-align-center"
|
|
59
|
+
:class="{
|
|
60
|
+
active: activeIds.includes(item[keyField]),
|
|
61
|
+
selected: selectedIds.includes(item[keyField])
|
|
62
|
+
}"
|
|
63
|
+
>
|
|
64
|
+
<view class="pi-flex-sub">
|
|
65
|
+
<slot name="item" :item="item">
|
|
66
|
+
<view class="pi-align-center">
|
|
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
|
+
@change="handleChangeParentSelect(item, $event)"
|
|
74
|
+
/>
|
|
75
|
+
<text class="pi-lh-36 pi-flex-sub" @click="handleClickItem(item)">
|
|
76
|
+
{{ item[displayField] || '' }}
|
|
77
|
+
</text>
|
|
78
|
+
</view>
|
|
79
|
+
</slot>
|
|
80
|
+
</view>
|
|
81
|
+
<pi-icon
|
|
82
|
+
v-if="!parentCanSelect && selectedIds.includes(item[keyField])"
|
|
83
|
+
name="blod-check"
|
|
84
|
+
size="36"
|
|
85
|
+
/>
|
|
86
|
+
<pi-icon
|
|
87
|
+
v-if="item[childrenField] && item[childrenField].length > 0"
|
|
88
|
+
name="right"
|
|
89
|
+
@click="handleClickItem(item)"
|
|
90
|
+
/>
|
|
91
|
+
</view>
|
|
92
|
+
</scroll-view>
|
|
93
|
+
</scroll-view>
|
|
94
|
+
<!-- 已选区域 -->
|
|
95
|
+
<view class="cascader-area">
|
|
96
|
+
<text>{{ `已选(${selectedIds.length})` }}</text>
|
|
97
|
+
<scroll-view class="scroll-area" scroll-x>
|
|
98
|
+
<view
|
|
99
|
+
v-for="id in selectedIds"
|
|
100
|
+
:key="id"
|
|
101
|
+
class="cascader-item"
|
|
102
|
+
@tap="handleRemoveItem(id)"
|
|
103
|
+
>
|
|
104
|
+
<text class="pi-mg-right-12">{{ itemsMap[id][displayField] }}</text>
|
|
105
|
+
<pi-icon name="close" />
|
|
106
|
+
</view>
|
|
107
|
+
</scroll-view>
|
|
108
|
+
</view>
|
|
109
|
+
</view>
|
|
110
|
+
<slot name="footer" />
|
|
111
|
+
</view>
|
|
112
|
+
</pi-popup-select>
|
|
113
|
+
</template>
|
|
114
|
+
|
|
115
|
+
<script>
|
|
116
|
+
import ValueSync from '../../mixin/value-sync'
|
|
117
|
+
import cloneDeep from 'lodash/cloneDeep'
|
|
118
|
+
import { getConfig } from '../../config'
|
|
119
|
+
|
|
120
|
+
const TAG = 'PiCascader'
|
|
121
|
+
const ROOT_NODE = 'ROOT'
|
|
122
|
+
const { cascader } = getConfig()
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
name: 'PiCascader',
|
|
126
|
+
// 混入v-model
|
|
127
|
+
mixins: [ValueSync],
|
|
128
|
+
props: {
|
|
129
|
+
// 初始值
|
|
130
|
+
value: {
|
|
131
|
+
required: false
|
|
132
|
+
},
|
|
133
|
+
// 自定义样式
|
|
134
|
+
customStyle: {
|
|
135
|
+
type: Object,
|
|
136
|
+
// {}
|
|
137
|
+
default() {
|
|
138
|
+
return cascader.customStyle
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
// 自定义样式类
|
|
142
|
+
customClass: {
|
|
143
|
+
type: String,
|
|
144
|
+
// ''
|
|
145
|
+
default() {
|
|
146
|
+
return cascader.customClass
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
// 数据源
|
|
150
|
+
items: {
|
|
151
|
+
type: Array,
|
|
152
|
+
default() {
|
|
153
|
+
return []
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
defaultValue: {
|
|
157
|
+
type: Array,
|
|
158
|
+
default: () => []
|
|
159
|
+
},
|
|
160
|
+
// 列表选项的唯一标识
|
|
161
|
+
keyField: {
|
|
162
|
+
type: String,
|
|
163
|
+
// 'id'
|
|
164
|
+
default: cascader.keyField
|
|
165
|
+
},
|
|
166
|
+
// 选项显示字段
|
|
167
|
+
displayField: {
|
|
168
|
+
type: String,
|
|
169
|
+
// 'text'
|
|
170
|
+
default: cascader.displayField
|
|
171
|
+
},
|
|
172
|
+
// children字段,默认为desc
|
|
173
|
+
childrenField: {
|
|
174
|
+
type: String,
|
|
175
|
+
// 'children'
|
|
176
|
+
default: cascader.childrenField
|
|
177
|
+
},
|
|
178
|
+
// 父节点是否可选(默认:'false')
|
|
179
|
+
parentCanSelect: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
// false
|
|
182
|
+
default: cascader.parentCanSelect
|
|
183
|
+
},
|
|
184
|
+
// 弹窗选择参数设置
|
|
185
|
+
popupSelect: {
|
|
186
|
+
type: Object,
|
|
187
|
+
default() {
|
|
188
|
+
// 参照popupSelect
|
|
189
|
+
return cascader.popupSelect
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
// 确认按钮配置
|
|
193
|
+
confirmBtn: {
|
|
194
|
+
type: Object,
|
|
195
|
+
default() {
|
|
196
|
+
return cascader.confirmBtn
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
// 取消按钮配置
|
|
200
|
+
cancelBtn: {
|
|
201
|
+
type: Object,
|
|
202
|
+
default() {
|
|
203
|
+
return cascader.cancelBtn
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
// 弹窗参数设置
|
|
207
|
+
popup: {
|
|
208
|
+
type: Object,
|
|
209
|
+
default() {
|
|
210
|
+
// 参照popup
|
|
211
|
+
return cascader.popup
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
data() {
|
|
216
|
+
const rootItem = {
|
|
217
|
+
[this.displayField]: '全部',
|
|
218
|
+
[this.keyField]: ROOT_NODE
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
rootItem,
|
|
222
|
+
currentItem: cloneDeep(rootItem),
|
|
223
|
+
innerItems: [],
|
|
224
|
+
itemsMap: {}, // 已选数据id索引
|
|
225
|
+
selectedIds: [], // 已选数据
|
|
226
|
+
cascaderWidth: 0, // 容器宽度
|
|
227
|
+
scrollLeft: 0 // 视图左侧滚动区域,自动对齐到选择的栏目
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
computed: {
|
|
231
|
+
ROOT_NODE() {
|
|
232
|
+
return ROOT_NODE
|
|
233
|
+
},
|
|
234
|
+
getPopupSelect() {
|
|
235
|
+
const popupSelect = this.$pi.lang.mergeDeep(cascader.popupSelect, this.popupSelect)
|
|
236
|
+
if (!this.singleCancel && this.singleConfirm) {
|
|
237
|
+
popupSelect.toolbarPosition = 'none'
|
|
238
|
+
}
|
|
239
|
+
return popupSelect
|
|
240
|
+
},
|
|
241
|
+
getConfirmBtn() {
|
|
242
|
+
const cascaderConfirmBtn = this.$pi.lang.mergeDeep(
|
|
243
|
+
cascader.confirmBtn,
|
|
244
|
+
this.popupSelect.confirmBtn
|
|
245
|
+
)
|
|
246
|
+
return this.$pi.lang.mergeDeep(cascaderConfirmBtn, this.confirmBtn)
|
|
247
|
+
},
|
|
248
|
+
getCancelBtn() {
|
|
249
|
+
const cascaderCancelBtn = this.$pi.lang.mergeDeep(
|
|
250
|
+
cascader.cancelBtn,
|
|
251
|
+
this.popupSelect.cancelBtn
|
|
252
|
+
)
|
|
253
|
+
return this.$pi.lang.mergeDeep(cascaderCancelBtn, this.cancelBtn)
|
|
254
|
+
},
|
|
255
|
+
getPopup() {
|
|
256
|
+
const cascaderPopup = this.$pi.lang.mergeDeep(cascader.popup, this.popupSelect.popup)
|
|
257
|
+
return this.$pi.lang.mergeDeep(cascaderPopup, this.popup)
|
|
258
|
+
},
|
|
259
|
+
getItemStyle() {
|
|
260
|
+
return {
|
|
261
|
+
height: this.$pi.common.addUnit(this.itemHeight)
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
columns() {
|
|
265
|
+
let columns = []
|
|
266
|
+
if (this.currentItem) {
|
|
267
|
+
// 如果有当前显示的节点,往上找父节点下的所有children放到数组的前面
|
|
268
|
+
let p = this.currentItem
|
|
269
|
+
while (p) {
|
|
270
|
+
const children = p[this.childrenField] || []
|
|
271
|
+
if (children.length > 0) {
|
|
272
|
+
columns.unshift(children)
|
|
273
|
+
}
|
|
274
|
+
p = p.pid ? this.itemsMap[p.pid] : undefined
|
|
275
|
+
}
|
|
276
|
+
columns.unshift(this.innerItems)
|
|
277
|
+
} else {
|
|
278
|
+
columns = [this.innerItems]
|
|
279
|
+
}
|
|
280
|
+
return columns
|
|
281
|
+
},
|
|
282
|
+
isOnlyColumn() {
|
|
283
|
+
return this.columns.length === 1
|
|
284
|
+
},
|
|
285
|
+
activeIds() {
|
|
286
|
+
return this.pathItems.map(i => i[this.keyField])
|
|
287
|
+
},
|
|
288
|
+
pathItems() {
|
|
289
|
+
const pathItems = []
|
|
290
|
+
if (this.currentItem[this.keyField] !== ROOT_NODE) {
|
|
291
|
+
// 往上找构建完整路径
|
|
292
|
+
let p = this.currentItem
|
|
293
|
+
while (p) {
|
|
294
|
+
pathItems.unshift(p)
|
|
295
|
+
p = this.itemsMap[p.pid]
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return [
|
|
299
|
+
{
|
|
300
|
+
[this.displayField]: '全部',
|
|
301
|
+
[this.keyField]: 'ROOT'
|
|
302
|
+
}
|
|
303
|
+
].concat(pathItems)
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
watch: {
|
|
307
|
+
items: {
|
|
308
|
+
immediate: true,
|
|
309
|
+
handler() {
|
|
310
|
+
this.rebuildItems()
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
defaultValue: {
|
|
314
|
+
immediate: true,
|
|
315
|
+
handler(vals) {
|
|
316
|
+
this.selectedIds = [...vals]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
methods: {
|
|
322
|
+
rebuildItems() {
|
|
323
|
+
/**
|
|
324
|
+
* 以非递归的方式 深度拷贝items 且建立父子节点关系
|
|
325
|
+
* 目的为了不影响外部传入的prop: items
|
|
326
|
+
* 写成非递归的目的 是为了防止树的层次太深,
|
|
327
|
+
* 递归调用太多次,导致栈溢出
|
|
328
|
+
*/
|
|
329
|
+
const innerItems = []
|
|
330
|
+
// 初始化堆栈 为items的根节点
|
|
331
|
+
const stack = [...this.items]
|
|
332
|
+
const itemsMap = {}
|
|
333
|
+
while (stack.length > 0) {
|
|
334
|
+
// 将栈顶元素出栈进行处理
|
|
335
|
+
let item = stack.shift()
|
|
336
|
+
if (!item.pid) {
|
|
337
|
+
item = {
|
|
338
|
+
...item,
|
|
339
|
+
level: 0
|
|
340
|
+
}
|
|
341
|
+
innerItems.push(item)
|
|
342
|
+
}
|
|
343
|
+
const children = item[this.childrenField] || []
|
|
344
|
+
const newChilds = []
|
|
345
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
346
|
+
// 浅拷贝子孩子
|
|
347
|
+
const subItem = {
|
|
348
|
+
...children[i],
|
|
349
|
+
level: item.level + 1
|
|
350
|
+
}
|
|
351
|
+
// 建立父子关系
|
|
352
|
+
subItem.pid = item[this.keyField]
|
|
353
|
+
// 放置到新数组中
|
|
354
|
+
newChilds.unshift(subItem)
|
|
355
|
+
// 入栈 模拟递归效果 等待之后的while循环出栈进行处理
|
|
356
|
+
stack.unshift(subItem)
|
|
357
|
+
}
|
|
358
|
+
// 更新children 为新的数组
|
|
359
|
+
item[this.childrenField] = newChilds
|
|
360
|
+
itemsMap[item[this.keyField]] = item
|
|
361
|
+
}
|
|
362
|
+
// 此时的innerItems无论怎么修改 均不影响items
|
|
363
|
+
this.innerItems = innerItems
|
|
364
|
+
// 方便通过节点的id 为key快速定位到对应的节点dto
|
|
365
|
+
this.itemsMap = itemsMap
|
|
366
|
+
},
|
|
367
|
+
handleRemoveItem(id) {
|
|
368
|
+
this.selectedIds = this.selectedIds.filter(i => i !== id)
|
|
369
|
+
},
|
|
370
|
+
handleClickItem(item) {
|
|
371
|
+
console.log(item)
|
|
372
|
+
// 点击全部
|
|
373
|
+
if (item[this.keyField] === ROOT_NODE) {
|
|
374
|
+
this.currentItem = cloneDeep(this.rootItem)
|
|
375
|
+
this.$nextTick(this.syncScrollLeft)
|
|
376
|
+
return
|
|
377
|
+
}
|
|
378
|
+
const isLeafNode = !item[this.childrenField] || item[this.childrenField]?.length === 0
|
|
379
|
+
// 点击非叶子节点
|
|
380
|
+
if (item && !isLeafNode && this.currentItem[this.keyField] !== item[this.keyField]) {
|
|
381
|
+
this.currentItem = item
|
|
382
|
+
this.$nextTick(this.syncScrollLeft)
|
|
383
|
+
return
|
|
384
|
+
}
|
|
385
|
+
// 点击的是叶子节点
|
|
386
|
+
if (isLeafNode) {
|
|
387
|
+
if (this.selectedIds.includes(item[this.keyField])) {
|
|
388
|
+
this.handleRemoveItem(item[this.keyField])
|
|
389
|
+
} else {
|
|
390
|
+
// 选中
|
|
391
|
+
this.selectedIds.push(item[this.keyField])
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
handleChangeParentSelect(item, selected) {
|
|
396
|
+
if (this.selectedIds.includes(item[this.keyField])) {
|
|
397
|
+
this.handleRemoveItem(item[this.keyField])
|
|
398
|
+
} else {
|
|
399
|
+
// 选中
|
|
400
|
+
this.selectedIds.push(item[this.keyField])
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
async syncScrollLeft() {
|
|
404
|
+
// 调用此方法的时候,必须使用$nextTick,因为column是动态变化的,需要等待界面更新渲染后,才能正确设置scrollLeft的位置
|
|
405
|
+
let scrollLeft = 0
|
|
406
|
+
if (this.cascaderWidth === 0) {
|
|
407
|
+
const srollWrapRect = await this.$pi.common.queryRect(this, '.pi-cascader', false)
|
|
408
|
+
if (srollWrapRect) {
|
|
409
|
+
this.cascaderWidth = srollWrapRect.width
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (this.columns.length > 2) {
|
|
413
|
+
scrollLeft = (this.columns.length - 2) * (this.cascaderWidth / 2)
|
|
414
|
+
}
|
|
415
|
+
this.scrollLeft = scrollLeft
|
|
416
|
+
},
|
|
417
|
+
handlePopupClose() {
|
|
418
|
+
this.val = false
|
|
419
|
+
// 关闭弹窗
|
|
420
|
+
this.$emit('close')
|
|
421
|
+
this.handleEmitChange()
|
|
422
|
+
},
|
|
423
|
+
/**
|
|
424
|
+
* @vuese
|
|
425
|
+
* 根据id获取item
|
|
426
|
+
*/
|
|
427
|
+
getItemByKeyField(keyField) {
|
|
428
|
+
return this.itemsMap[keyField]
|
|
429
|
+
},
|
|
430
|
+
/**
|
|
431
|
+
* @vuese
|
|
432
|
+
* 取消选择
|
|
433
|
+
*/
|
|
434
|
+
handleCancel() {
|
|
435
|
+
this.$emit('cancel')
|
|
436
|
+
this.selectedIds = [...this.defaultValue]
|
|
437
|
+
this.getPopupSelect.onCancelClose && this.handlePopupClose()
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* @vuese
|
|
441
|
+
* 确认选择
|
|
442
|
+
*/
|
|
443
|
+
handleConfirm() {
|
|
444
|
+
this.$emit('confirm', this.selectedIds)
|
|
445
|
+
this.getPopupSelect.onConfirmClose && this.handlePopupClose()
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
</script>
|
|
450
|
+
|
|
451
|
+
<style lang="scss" scoped>
|
|
452
|
+
.cascader-wrap {
|
|
453
|
+
width: 100%;
|
|
454
|
+
height: 100%;
|
|
455
|
+
background: #f4f2f6;
|
|
456
|
+
}
|
|
457
|
+
.scroll-view {
|
|
458
|
+
width: 100%;
|
|
459
|
+
flex: 1;
|
|
460
|
+
white-space: nowrap;
|
|
461
|
+
overflow: auto hidden;
|
|
462
|
+
.column {
|
|
463
|
+
display: inline-block;
|
|
464
|
+
height: 100%;
|
|
465
|
+
width: 50%;
|
|
466
|
+
overflow: hidden auto;
|
|
467
|
+
&:last-child {
|
|
468
|
+
background: #ffffff;
|
|
469
|
+
}
|
|
470
|
+
.column-item {
|
|
471
|
+
position: relative;
|
|
472
|
+
height: 100rpx;
|
|
473
|
+
width: 100%;
|
|
474
|
+
white-space: initial;
|
|
475
|
+
padding: 0 16rpx 0 32rpx;
|
|
476
|
+
font-size: 28rpx;
|
|
477
|
+
color: #333333;
|
|
478
|
+
overflow: hidden;
|
|
479
|
+
&.active {
|
|
480
|
+
color: $pi-primary-color;
|
|
481
|
+
background: #ffffff;
|
|
482
|
+
::v-deep .pi-icon-right {
|
|
483
|
+
color: #333333;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
&.selected {
|
|
487
|
+
color: $pi-primary-color;
|
|
488
|
+
::v-deep .pi-icon-right {
|
|
489
|
+
color: #333333;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.node-breadcrumb {
|
|
497
|
+
width: 100%;
|
|
498
|
+
padding-left: 32rpx;
|
|
499
|
+
background: #ffffff;
|
|
500
|
+
white-space: nowrap;
|
|
501
|
+
.breadcrumb-item {
|
|
502
|
+
display: inline-flex;
|
|
503
|
+
align-items: center;
|
|
504
|
+
font-size: 14px;
|
|
505
|
+
padding: 32rpx 0;
|
|
506
|
+
|
|
507
|
+
.breadcrumb-item-title.active {
|
|
508
|
+
color: $pi-primary-color;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.cascader-area {
|
|
514
|
+
background: #ffffff;
|
|
515
|
+
padding: 22rpx 24rpx;
|
|
516
|
+
color: #333333;
|
|
517
|
+
display: flex;
|
|
518
|
+
align-items: center;
|
|
519
|
+
white-space: nowrap;
|
|
520
|
+
|
|
521
|
+
.scroll-area {
|
|
522
|
+
width: calc(100% - 128rpx);
|
|
523
|
+
flex: 1;
|
|
524
|
+
white-space: nowrap;
|
|
525
|
+
}
|
|
526
|
+
.cascader-item {
|
|
527
|
+
display: inline-flex;
|
|
528
|
+
padding: 14rpx 24rpx;
|
|
529
|
+
background: rgba($pi-primary-color, 0.1);
|
|
530
|
+
align-items: center;
|
|
531
|
+
margin-left: 16rpx;
|
|
532
|
+
border-radius: 8rpx;
|
|
533
|
+
color: $pi-primary-color;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
</style>
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
class="pi-check-wrap"
|
|
4
4
|
:style="[customStyle]"
|
|
5
5
|
:class="[getShape, getActiveMode, { disabled: getDisable }, { active: val }, customClass]"
|
|
6
|
-
@tap="handleCheckboxToggle(true)"
|
|
7
6
|
>
|
|
8
7
|
<view
|
|
9
8
|
v-if="getShape !== 'text'"
|
|
10
9
|
class="check-icon"
|
|
11
10
|
:style="[checkStyle]"
|
|
12
|
-
@tap
|
|
11
|
+
@tap="handleCheckboxToggle(false)"
|
|
13
12
|
>
|
|
14
13
|
<view v-if="getShape === 'dot'" class="dot" :style="[dotStyle]" />
|
|
15
14
|
<pi-icon v-else name="blod-check" :size="getIconSize" />
|
|
@@ -19,6 +18,7 @@
|
|
|
19
18
|
class="check-label"
|
|
20
19
|
:class="{ text: getShape === 'text' }"
|
|
21
20
|
:style="[textStyle]"
|
|
21
|
+
@tap="handleCheckboxToggle(true)"
|
|
22
22
|
>
|
|
23
23
|
<!-- checkbox 内容 -->
|
|
24
24
|
<slot />
|
|
@@ -289,14 +289,13 @@ $unactive-color: #cccccc;
|
|
|
289
289
|
}
|
|
290
290
|
.check-label {
|
|
291
291
|
flex: 1;
|
|
292
|
-
|
|
292
|
+
padding: 0 24rpx 0 16rpx;
|
|
293
293
|
line-height: 1.5;
|
|
294
294
|
word-wrap: break-word;
|
|
295
295
|
transition: $pi-animation-duration $pi-animation-timing-function;
|
|
296
296
|
transition-property: border, color, background-color;
|
|
297
297
|
&.text {
|
|
298
298
|
padding: 12rpx 24rpx;
|
|
299
|
-
margin-left: 0;
|
|
300
299
|
color: $unactive-color;
|
|
301
300
|
border-color: transparent;
|
|
302
301
|
border-style: solid;
|
|
@@ -182,7 +182,8 @@ export default {
|
|
|
182
182
|
emitChange() {
|
|
183
183
|
const vals = []
|
|
184
184
|
this._children.forEach(child => {
|
|
185
|
-
|
|
185
|
+
console.log(child.val, child.name)
|
|
186
|
+
if (child.val && !this.$pi.lang.isEmpty(child.name)) vals.push(child.name)
|
|
186
187
|
})
|
|
187
188
|
this.val = vals
|
|
188
189
|
this.handleEmitChange()
|
|
@@ -209,13 +210,6 @@ export default {
|
|
|
209
210
|
&.horizontal {
|
|
210
211
|
flex-direction: row;
|
|
211
212
|
align-items: center;
|
|
212
|
-
::v-deep .pi-check-wrap:not(:last-child) {
|
|
213
|
-
margin-right: 28rpx;
|
|
214
|
-
}
|
|
215
|
-
// 兼容小程序
|
|
216
|
-
::v-deep pi-checkbox:not(:last-child) {
|
|
217
|
-
margin-right: 28rpx;
|
|
218
|
-
}
|
|
219
213
|
}
|
|
220
214
|
}
|
|
221
215
|
</style>
|