sadais-piui 1.2.7-beta34 → 1.2.7-beta37
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.
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
:start-text="getCalendarPanel.startText"
|
|
40
40
|
:end-text="getCalendarPanel.endText"
|
|
41
41
|
:date-format="getCalendarPanel.dateFormat"
|
|
42
|
+
@date-change="$emit('date-change', $event)"
|
|
42
43
|
/>
|
|
43
44
|
<!-- footer -->
|
|
44
45
|
<view class="pi-w-100P pi-align-center pi-pd-24 pi-solid-top-1">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2022-06-28 16:53:54
|
|
4
|
-
* @LastEditTime: 2022-08-
|
|
4
|
+
* @LastEditTime: 2022-08-23 11:45:24
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 日历日期数据
|
|
7
7
|
* @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-calendar-panel/components/calendar-days/index.vue
|
|
@@ -361,7 +361,7 @@ export default {
|
|
|
361
361
|
return
|
|
362
362
|
}
|
|
363
363
|
// 处理范围选择方式
|
|
364
|
-
if (this.calendarValue.length === 2) {
|
|
364
|
+
if (this.calendarValue.length === 0 || this.calendarValue.length === 2) {
|
|
365
365
|
// 如果选了两项,则重新开始选择范围
|
|
366
366
|
this.handleChange([date])
|
|
367
367
|
} else {
|
|
@@ -232,8 +232,8 @@ export default {
|
|
|
232
232
|
const now = this.$pi.date.parseDate()
|
|
233
233
|
return {
|
|
234
234
|
now: now, // 当前时间
|
|
235
|
-
year:
|
|
236
|
-
month:
|
|
235
|
+
year: now.year, // 年份
|
|
236
|
+
month: now.month, // 月份
|
|
237
237
|
week: 1, // 当前周
|
|
238
238
|
calendarValue: '',
|
|
239
239
|
currentTabIndex: 1, // 当前选中的tab索引
|
|
@@ -278,24 +278,25 @@ export default {
|
|
|
278
278
|
this.init()
|
|
279
279
|
},
|
|
280
280
|
methods: {
|
|
281
|
-
valid() {
|
|
282
|
-
if (this.type === 'date') return true
|
|
283
|
-
if (this.type === 'range' && this.$pi.lang.isArray(this.value) && this.value.length === 2)
|
|
284
|
-
return true
|
|
285
|
-
return false
|
|
286
|
-
},
|
|
287
281
|
init() {
|
|
288
282
|
console.log(TAG, '组件初始化', this.value)
|
|
289
|
-
if (!this.valid()) return
|
|
290
283
|
let initValue = this.value
|
|
291
284
|
const nowDate = this.$pi.date.parseDate(this.type === 'date' ? this.value : this.value[0])
|
|
292
285
|
if (this.type === 'range') {
|
|
293
|
-
|
|
294
|
-
if (this.
|
|
286
|
+
initValue = initValue || []
|
|
287
|
+
if (this.value[1]) {
|
|
288
|
+
const endDate = this.$pi.date.parseDate(this.value[1])
|
|
289
|
+
|
|
290
|
+
this.year = endDate.year
|
|
291
|
+
this.month = endDate.month
|
|
292
|
+
|
|
293
|
+
initValue = [nowDate, endDate]
|
|
294
|
+
} else if (initValue.length === 1) {
|
|
295
|
+
initValue = [nowDate]
|
|
296
|
+
|
|
295
297
|
this.year = nowDate.year
|
|
296
298
|
this.month = nowDate.month
|
|
297
299
|
}
|
|
298
|
-
initValue = [nowDate, endDate]
|
|
299
300
|
} else {
|
|
300
301
|
this.year = nowDate.year
|
|
301
302
|
this.month = nowDate.month
|
|
@@ -347,6 +348,10 @@ export default {
|
|
|
347
348
|
} else {
|
|
348
349
|
this.month = month
|
|
349
350
|
}
|
|
351
|
+
this.$emit('date-change', {
|
|
352
|
+
year: this.year,
|
|
353
|
+
month: this.month
|
|
354
|
+
})
|
|
350
355
|
},
|
|
351
356
|
handlePrevMonth() {
|
|
352
357
|
if (this.currentTabIndex === 0) {
|
|
@@ -368,6 +373,10 @@ export default {
|
|
|
368
373
|
if (change > 0 && this.isMaxYear) return
|
|
369
374
|
if (change < 0 && this.isMinYear) return
|
|
370
375
|
this.year = this.year + change
|
|
376
|
+
this.$emit('date-change', {
|
|
377
|
+
year: this.year,
|
|
378
|
+
month: this.month
|
|
379
|
+
})
|
|
371
380
|
},
|
|
372
381
|
handleBackToday() {
|
|
373
382
|
this.year = this.now.year
|
|
@@ -0,0 +1,489 @@
|
|
|
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
|
+
@click="handleClickItem(item)"
|
|
64
|
+
>
|
|
65
|
+
<view class="pi-flex-sub pi-lh-36">
|
|
66
|
+
<slot name="item" :item="item">
|
|
67
|
+
{{ item[displayField] || '' }}
|
|
68
|
+
</slot>
|
|
69
|
+
</view>
|
|
70
|
+
<pi-icon v-if="selectedIds.includes(item[keyField])" name="blod-check" />
|
|
71
|
+
<pi-icon v-if="item.children && item.children.length > 0" name="right" />
|
|
72
|
+
</view>
|
|
73
|
+
</scroll-view>
|
|
74
|
+
</scroll-view>
|
|
75
|
+
<!-- 已选区域 -->
|
|
76
|
+
<view class="cascader-area">
|
|
77
|
+
<text>{{ `已选(${selectedIds.length})` }}</text>
|
|
78
|
+
<scroll-view class="scroll-area" scroll-x>
|
|
79
|
+
<view
|
|
80
|
+
v-for="id in selectedIds"
|
|
81
|
+
:key="id"
|
|
82
|
+
class="cascader-item"
|
|
83
|
+
@tap="handleRemoveItem(id)"
|
|
84
|
+
>
|
|
85
|
+
<text class="pi-mg-right-12">{{ itemsMap[id][displayField] }}</text>
|
|
86
|
+
<pi-icon name="close" />
|
|
87
|
+
</view>
|
|
88
|
+
</scroll-view>
|
|
89
|
+
</view>
|
|
90
|
+
</view>
|
|
91
|
+
<slot name="footer" />
|
|
92
|
+
</view>
|
|
93
|
+
</pi-popup-select>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<script>
|
|
97
|
+
import ValueSync from '../../mixin/value-sync'
|
|
98
|
+
import cloneDeep from 'lodash/cloneDeep'
|
|
99
|
+
import { getConfig } from '../../config'
|
|
100
|
+
|
|
101
|
+
const TAG = 'PiCascader'
|
|
102
|
+
const ROOT_NODE = 'ROOT'
|
|
103
|
+
const { cascader } = getConfig()
|
|
104
|
+
|
|
105
|
+
export default {
|
|
106
|
+
name: 'PiCascader',
|
|
107
|
+
// 混入v-model
|
|
108
|
+
mixins: [ValueSync],
|
|
109
|
+
props: {
|
|
110
|
+
// 初始值
|
|
111
|
+
value: {
|
|
112
|
+
required: false
|
|
113
|
+
},
|
|
114
|
+
// 自定义样式
|
|
115
|
+
customStyle: {
|
|
116
|
+
type: Object,
|
|
117
|
+
// {}
|
|
118
|
+
default() {
|
|
119
|
+
return cascader.customStyle
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
// 自定义样式类
|
|
123
|
+
customClass: {
|
|
124
|
+
type: String,
|
|
125
|
+
// ''
|
|
126
|
+
default() {
|
|
127
|
+
return cascader.customClass
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
// 数据源
|
|
131
|
+
items: {
|
|
132
|
+
type: Array,
|
|
133
|
+
default() {
|
|
134
|
+
return []
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
defaultValue: {
|
|
138
|
+
type: Array,
|
|
139
|
+
default: () => []
|
|
140
|
+
},
|
|
141
|
+
// 列表选项的唯一标识
|
|
142
|
+
keyField: {
|
|
143
|
+
type: String,
|
|
144
|
+
// 'id'
|
|
145
|
+
default: cascader.keyField
|
|
146
|
+
},
|
|
147
|
+
// 选项显示字段
|
|
148
|
+
displayField: {
|
|
149
|
+
type: String,
|
|
150
|
+
// 'text'
|
|
151
|
+
default: cascader.displayField
|
|
152
|
+
},
|
|
153
|
+
// children字段,默认为desc
|
|
154
|
+
childrenField: {
|
|
155
|
+
type: String,
|
|
156
|
+
// 'children'
|
|
157
|
+
default: cascader.childrenField
|
|
158
|
+
},
|
|
159
|
+
// 弹窗选择参数设置
|
|
160
|
+
popupSelect: {
|
|
161
|
+
type: Object,
|
|
162
|
+
default() {
|
|
163
|
+
// 参照popupSelect
|
|
164
|
+
return cascader.popupSelect
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
// 确认按钮配置
|
|
168
|
+
confirmBtn: {
|
|
169
|
+
type: Object,
|
|
170
|
+
default() {
|
|
171
|
+
return cascader.confirmBtn
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// 取消按钮配置
|
|
175
|
+
cancelBtn: {
|
|
176
|
+
type: Object,
|
|
177
|
+
default() {
|
|
178
|
+
return cascader.cancelBtn
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
// 弹窗参数设置
|
|
182
|
+
popup: {
|
|
183
|
+
type: Object,
|
|
184
|
+
default() {
|
|
185
|
+
// 参照popup
|
|
186
|
+
return cascader.popup
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
data() {
|
|
191
|
+
const rootItem = {
|
|
192
|
+
[this.displayField]: '全部',
|
|
193
|
+
[this.keyField]: ROOT_NODE
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
rootItem,
|
|
197
|
+
currentItem: cloneDeep(rootItem),
|
|
198
|
+
innerItems: [],
|
|
199
|
+
itemsMap: {}, // 已选数据id索引
|
|
200
|
+
selectedIds: [], // 已选数据
|
|
201
|
+
cascaderWidth: 0, // 容器宽度
|
|
202
|
+
scrollLeft: 0 // 视图左侧滚动区域,自动对齐到选择的栏目
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
computed: {
|
|
206
|
+
ROOT_NODE() {
|
|
207
|
+
return ROOT_NODE
|
|
208
|
+
},
|
|
209
|
+
getPopupSelect() {
|
|
210
|
+
const popupSelect = this.$pi.lang.mergeDeep(cascader.popupSelect, this.popupSelect)
|
|
211
|
+
if (!this.singleCancel && this.singleConfirm) {
|
|
212
|
+
popupSelect.toolbarPosition = 'none'
|
|
213
|
+
}
|
|
214
|
+
return popupSelect
|
|
215
|
+
},
|
|
216
|
+
getConfirmBtn() {
|
|
217
|
+
const cascaderConfirmBtn = this.$pi.lang.mergeDeep(
|
|
218
|
+
cascader.confirmBtn,
|
|
219
|
+
this.popupSelect.confirmBtn
|
|
220
|
+
)
|
|
221
|
+
return this.$pi.lang.mergeDeep(cascaderConfirmBtn, this.confirmBtn)
|
|
222
|
+
},
|
|
223
|
+
getCancelBtn() {
|
|
224
|
+
const cascaderCancelBtn = this.$pi.lang.mergeDeep(
|
|
225
|
+
cascader.cancelBtn,
|
|
226
|
+
this.popupSelect.cancelBtn
|
|
227
|
+
)
|
|
228
|
+
return this.$pi.lang.mergeDeep(cascaderCancelBtn, this.cancelBtn)
|
|
229
|
+
},
|
|
230
|
+
getPopup() {
|
|
231
|
+
const cascaderPopup = this.$pi.lang.mergeDeep(cascader.popup, this.popupSelect.popup)
|
|
232
|
+
return this.$pi.lang.mergeDeep(cascaderPopup, this.popup)
|
|
233
|
+
},
|
|
234
|
+
getItemStyle() {
|
|
235
|
+
return {
|
|
236
|
+
height: this.$pi.common.addUnit(this.itemHeight)
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
columns() {
|
|
240
|
+
let columns = []
|
|
241
|
+
if (this.currentItem) {
|
|
242
|
+
// 如果有当前显示的节点,往上找父节点下的所有children放到数组的前面
|
|
243
|
+
let p = this.currentItem
|
|
244
|
+
while (p) {
|
|
245
|
+
const children = p[this.childrenField] || []
|
|
246
|
+
if (children.length > 0) {
|
|
247
|
+
columns.unshift(children)
|
|
248
|
+
}
|
|
249
|
+
p = p.pid ? this.itemsMap[p.pid] : undefined
|
|
250
|
+
}
|
|
251
|
+
columns.unshift(this.innerItems)
|
|
252
|
+
} else {
|
|
253
|
+
columns = [this.innerItems]
|
|
254
|
+
}
|
|
255
|
+
return columns
|
|
256
|
+
},
|
|
257
|
+
isOnlyColumn() {
|
|
258
|
+
return this.columns.length === 1
|
|
259
|
+
},
|
|
260
|
+
activeIds() {
|
|
261
|
+
return this.pathItems.map(i => i[this.keyField])
|
|
262
|
+
},
|
|
263
|
+
pathItems() {
|
|
264
|
+
const pathItems = []
|
|
265
|
+
if (this.currentItem[this.keyField] !== ROOT_NODE) {
|
|
266
|
+
// 往上找构建完整路径
|
|
267
|
+
let p = this.currentItem
|
|
268
|
+
while (p) {
|
|
269
|
+
pathItems.unshift(p)
|
|
270
|
+
p = this.itemsMap[p.pid]
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return [
|
|
274
|
+
{
|
|
275
|
+
[this.displayField]: '全部',
|
|
276
|
+
[this.keyField]: 'ROOT'
|
|
277
|
+
}
|
|
278
|
+
].concat(pathItems)
|
|
279
|
+
},
|
|
280
|
+
syncIds() {
|
|
281
|
+
return `${this.innerItems.length}-${this.defaultValue.length}`
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
watch: {
|
|
285
|
+
items: {
|
|
286
|
+
immediate: true,
|
|
287
|
+
handler() {
|
|
288
|
+
this.rebuildItems()
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
methods: {
|
|
294
|
+
rebuildItems() {
|
|
295
|
+
/**
|
|
296
|
+
* 以非递归的方式 深度拷贝items 且建立父子节点关系
|
|
297
|
+
* 目的为了不影响外部传入的prop: items
|
|
298
|
+
* 写成非递归的目的 是为了防止树的层次太深,
|
|
299
|
+
* 递归调用太多次,导致栈溢出
|
|
300
|
+
*/
|
|
301
|
+
const innerItems = []
|
|
302
|
+
// 初始化堆栈 为items的根节点
|
|
303
|
+
const stack = [...this.items]
|
|
304
|
+
const itemsMap = {}
|
|
305
|
+
while (stack.length > 0) {
|
|
306
|
+
// 将栈顶元素出栈进行处理
|
|
307
|
+
let item = stack.shift()
|
|
308
|
+
if (!item.pid) {
|
|
309
|
+
item = {
|
|
310
|
+
...item,
|
|
311
|
+
level: 0
|
|
312
|
+
}
|
|
313
|
+
innerItems.push(item)
|
|
314
|
+
}
|
|
315
|
+
const children = item[this.childrenField] || []
|
|
316
|
+
const newChilds = []
|
|
317
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
318
|
+
// 浅拷贝子孩子
|
|
319
|
+
const subItem = {
|
|
320
|
+
...children[i],
|
|
321
|
+
level: item.level + 1
|
|
322
|
+
}
|
|
323
|
+
// 建立父子关系
|
|
324
|
+
subItem.pid = item[this.keyField]
|
|
325
|
+
// 放置到新数组中
|
|
326
|
+
newChilds.unshift(subItem)
|
|
327
|
+
// 入栈 模拟递归效果 等待之后的while循环出栈进行处理
|
|
328
|
+
stack.unshift(subItem)
|
|
329
|
+
}
|
|
330
|
+
// 更新children 为新的数组
|
|
331
|
+
item[this.childrenField] = newChilds
|
|
332
|
+
itemsMap[item[this.keyField]] = item
|
|
333
|
+
}
|
|
334
|
+
// 此时的innerItems无论怎么修改 均不影响items
|
|
335
|
+
this.innerItems = innerItems
|
|
336
|
+
// 方便通过节点的id 为key快速定位到对应的节点dto
|
|
337
|
+
this.itemsMap = itemsMap
|
|
338
|
+
},
|
|
339
|
+
handleRemoveItem(id) {
|
|
340
|
+
this.selectedIds = this.selectedIds.filter(i => i !== id)
|
|
341
|
+
},
|
|
342
|
+
handleClickItem(item) {
|
|
343
|
+
if (item[this.keyField] === ROOT_NODE) {
|
|
344
|
+
this.currentItem = cloneDeep(this.rootItem)
|
|
345
|
+
this.$nextTick(this.syncScrollLeft)
|
|
346
|
+
return
|
|
347
|
+
}
|
|
348
|
+
if (item?.children?.length && this.currentItem[this.keyField] !== item[this.keyField]) {
|
|
349
|
+
this.currentItem = item
|
|
350
|
+
this.$nextTick(this.syncScrollLeft)
|
|
351
|
+
return
|
|
352
|
+
}
|
|
353
|
+
if (item?.children?.length === 0) {
|
|
354
|
+
// 点击的是叶子节点
|
|
355
|
+
if (this.selectedIds.includes(item[this.keyField])) {
|
|
356
|
+
this.handleRemoveItem(item[this.keyField])
|
|
357
|
+
} else {
|
|
358
|
+
// 选中
|
|
359
|
+
this.selectedIds.push(item[this.keyField])
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
async syncScrollLeft() {
|
|
364
|
+
// 调用此方法的时候,必须使用$nextTick,因为column是动态变化的,需要等待界面更新渲染后,才能正确设置scrollLeft的位置
|
|
365
|
+
let scrollLeft = 0
|
|
366
|
+
if (this.cascaderWidth === 0) {
|
|
367
|
+
const srollWrapRect = await this.$pi.common.queryRect(this, '.pi-cascader', false)
|
|
368
|
+
if (srollWrapRect) {
|
|
369
|
+
this.cascaderWidth = srollWrapRect.width
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (this.columns.length > 2) {
|
|
373
|
+
scrollLeft = (this.columns.length - 2) * (this.cascaderWidth / 2)
|
|
374
|
+
}
|
|
375
|
+
this.scrollLeft = scrollLeft
|
|
376
|
+
},
|
|
377
|
+
handlePopupClose() {
|
|
378
|
+
this.val = false
|
|
379
|
+
// 关闭弹窗
|
|
380
|
+
this.$emit('close')
|
|
381
|
+
this.handleEmitChange()
|
|
382
|
+
},
|
|
383
|
+
/**
|
|
384
|
+
* @vuese
|
|
385
|
+
* 根据id获取item
|
|
386
|
+
*/
|
|
387
|
+
getItemByKeyField(keyField) {
|
|
388
|
+
return this.itemsMap[keyField]
|
|
389
|
+
},
|
|
390
|
+
/**
|
|
391
|
+
* @vuese
|
|
392
|
+
* 取消选择
|
|
393
|
+
*/
|
|
394
|
+
handleCancel() {
|
|
395
|
+
this.$emit('cancel')
|
|
396
|
+
this.getPopupSelect.onCancelClose && this.handlePopupClose()
|
|
397
|
+
},
|
|
398
|
+
/**
|
|
399
|
+
* @vuese
|
|
400
|
+
* 确认选择
|
|
401
|
+
*/
|
|
402
|
+
handleConfirm() {
|
|
403
|
+
this.$emit('confirm', this.selectedIds)
|
|
404
|
+
this.getPopupSelect.onConfirmClose && this.handlePopupClose()
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
</script>
|
|
409
|
+
|
|
410
|
+
<style lang="scss" scoped>
|
|
411
|
+
.cascader-wrap {
|
|
412
|
+
width: 100%;
|
|
413
|
+
height: 100%;
|
|
414
|
+
background: #f4f2f6;
|
|
415
|
+
}
|
|
416
|
+
.scroll-view {
|
|
417
|
+
width: 100%;
|
|
418
|
+
flex: 1;
|
|
419
|
+
white-space: nowrap;
|
|
420
|
+
overflow: auto hidden;
|
|
421
|
+
.column {
|
|
422
|
+
display: inline-block;
|
|
423
|
+
height: 100%;
|
|
424
|
+
width: 50%;
|
|
425
|
+
overflow: hidden auto;
|
|
426
|
+
&:last-child {
|
|
427
|
+
background: #ffffff;
|
|
428
|
+
}
|
|
429
|
+
.column-item {
|
|
430
|
+
position: relative;
|
|
431
|
+
height: 100rpx;
|
|
432
|
+
width: 100%;
|
|
433
|
+
white-space: initial;
|
|
434
|
+
padding: 0 16rpx 0 32rpx;
|
|
435
|
+
font-size: 28rpx;
|
|
436
|
+
color: #333333;
|
|
437
|
+
overflow: hidden;
|
|
438
|
+
&.active {
|
|
439
|
+
color: $pi-primary-color;
|
|
440
|
+
background: #ffffff;
|
|
441
|
+
}
|
|
442
|
+
&.selected {
|
|
443
|
+
color: $pi-primary-color;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.node-breadcrumb {
|
|
450
|
+
width: 100%;
|
|
451
|
+
padding-left: 32rpx;
|
|
452
|
+
background: #ffffff;
|
|
453
|
+
white-space: nowrap;
|
|
454
|
+
.breadcrumb-item {
|
|
455
|
+
display: inline-flex;
|
|
456
|
+
align-items: center;
|
|
457
|
+
font-size: 14px;
|
|
458
|
+
padding: 32rpx 0;
|
|
459
|
+
|
|
460
|
+
.breadcrumb-item-title.active {
|
|
461
|
+
color: $pi-primary-color;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.cascader-area {
|
|
467
|
+
background: #ffffff;
|
|
468
|
+
padding: 22rpx 24rpx;
|
|
469
|
+
color: #333333;
|
|
470
|
+
display: flex;
|
|
471
|
+
align-items: center;
|
|
472
|
+
white-space: nowrap;
|
|
473
|
+
|
|
474
|
+
.scroll-area {
|
|
475
|
+
width: calc(100% - 128rpx);
|
|
476
|
+
flex: 1;
|
|
477
|
+
white-space: nowrap;
|
|
478
|
+
}
|
|
479
|
+
.cascader-item {
|
|
480
|
+
display: inline-flex;
|
|
481
|
+
padding: 14rpx 24rpx;
|
|
482
|
+
background: rgba($pi-primary-color, 0.1);
|
|
483
|
+
align-items: center;
|
|
484
|
+
margin-left: 16rpx;
|
|
485
|
+
border-radius: 8rpx;
|
|
486
|
+
color: $pi-primary-color;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import popupSelect from './popupSelect'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
customClass: '', // 自定义样式类,字符串形式('')
|
|
5
|
+
customStyle: {}, // 自定义样式,对象形式(默认值:{})
|
|
6
|
+
items: [], // 选项列表,默认([])
|
|
7
|
+
keyField: 'id', // 选项id字段,默认为id
|
|
8
|
+
displayField: 'text', // 选项显示字段,默认为text
|
|
9
|
+
childrenField: 'children', // 描述显示字段,默认为children
|
|
10
|
+
defaultValue: null, // 默认值,单选是传Object,多选时传Array,默认null
|
|
11
|
+
itemHeight: 110, // 行高(默认:'110rpx')
|
|
12
|
+
showItemBottomBorder: false, // 是否显示item下边框(默认:'true')
|
|
13
|
+
itemStyle: {}, // 行样式(默认:'{}')
|
|
14
|
+
popupSelect: popupSelect, // popupSelect配置
|
|
15
|
+
popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
|
|
16
|
+
confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
|
|
17
|
+
cancelBtn: {
|
|
18
|
+
...popupSelect.cancelBtn,
|
|
19
|
+
show: true
|
|
20
|
+
} // 取消按钮配置
|
|
21
|
+
}
|