-
-
Notifications
You must be signed in to change notification settings - Fork 339
Expand file tree
/
Copy pathIndex.vue
More file actions
373 lines (366 loc) · 9.94 KB
/
Copy pathIndex.vue
File metadata and controls
373 lines (366 loc) · 9.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<template>
<page-wraper>
<view>
<wd-cell-group border>
<wd-select-picker :label="$t('xuan-ze-di-zhi')" v-model="value1" :columns="columns1" @confirm="handleConfirm1" />
<wd-select-picker :label="$t('lei-xing-qie-huan')" type="radio" v-model="value2" :columns="columns1" @confirm="handleConfirm2" />
<wd-select-picker :label="$t('jinYong')" disabled v-model="value3" :columns="columns1" @confirm="handleConfirm3" />
<wd-select-picker :label="$t('zhi-du')" readonly v-model="value4" :columns="columns1" @confirm="handleConfirm4" />
<wd-select-picker :label="$t('jin-yong-xuan-xiang')" v-model="value5" :columns="columns2" @confirm="handleConfirm5" />
<wd-select-picker label="loading" loading v-model="value6" :columns="columns1" @confirm="handleConfirm6" />
<wd-select-picker :label="$t('xuan-ze-qi-change')" v-model="value6" :columns="columns1" @change="handleChange" @confirm="handleConfirm7" />
<wd-select-picker
:label="$t('zhan-shi-ge-shi-hua')"
v-model="value8"
:columns="columns1"
@confirm="handleConfirm8"
:display-format="displayFormat"
/>
<wd-select-picker label="before-confirm" v-model="value9" :columns="columns1" @confirm="handleConfirm9" :before-confirm="beforeConfirm" />
<wd-select-picker :label="$t('biaoTi-0')" v-model="value10" :title="$t('duo-xuan')" :columns="columns1" @confirm="handleConfirm10" />
<wd-select-picker :label="$t('cuo-wu')" error v-model="value11" :columns="columns1" @confirm="handleConfirm11" />
<wd-select-picker clearable :label="$t('bi-tian')" required v-model="value12" :columns="columns1" @confirm="handleConfirm12" />
<wd-select-picker
:label="$t('bi-tian-xing-hao-zai-you-ce')"
required
v-model="value21"
:columns="columns1"
marker-side="after"
@confirm="handleConfirm21"
/>
<wd-select-picker :label="$t('ke-sou-suo')" filterable v-model="value13" :columns="columns1" @confirm="handleConfirm13" />
<wd-select-picker
:label="$t('dan-xuan-ke-sou-suo')"
filterable
v-model="value18"
type="radio"
:columns="columns1"
@confirm="handleConfirm13"
/>
<wd-select-picker
:label="$t('zi-dong-wan-cheng')"
type="radio"
:show-confirm="false"
v-model="value19"
:columns="columns1"
@confirm="handleConfirm2"
/>
<wd-select-picker
:label="$t('ke-qing-kong')"
clearable
type="radio"
:show-confirm="false"
v-model="value20"
:columns="columns1"
@confirm="handleConfirm2"
/>
<wd-select-picker
:label="$t('fu-jia-shu-ju')"
type="radio"
:show-confirm="false"
v-model="value20"
:columns="columns3"
@confirm="handleConfirm2"
>
<template #addition="{ item }">
<wd-tag type="primary" round>{{ item.additional.position }}</wd-tag>
<wd-tag icon="phone" type="success" round>{{ item.additional.mobile }}</wd-tag>
</template>
</wd-select-picker>
</wd-cell-group>
</view>
<demo-block :title="$t('label-bu-chuan')" transparent>
<wd-select-picker v-model="value14" :columns="columns1" @confirm="handleConfirm14" />
</demo-block>
<demo-block :title="$t('da-xiao')" transparent>
<wd-select-picker :label="$t('da-chi-cun')" v-model="value15" size="large" :columns="columns1" @confirm="handleConfirm15" />
</demo-block>
<demo-block :title="$t('zhi-kao-you-zhan-shi')" transparent>
<wd-select-picker :label="$t('zhi-kao-you-zhan-shi')" align-right v-model="value16" :columns="columns1" @confirm="handleConfirm16" />
</demo-block>
<demo-block :title="$t('zi-ding-yi-xuan-ze-qi')" transparent>
<view style="margin-left: 15px">
<view style="margin-bottom: 10px">{{ $t('dang-qian-xuan-zhong-xiang-displayvalue') + customShow }}</view>
<wd-select-picker v-model="value17" use-default-slot :columns="columns1" @confirm="handleConfirm17" style="display: inline-block">
<wd-button>{{ $t('huan-qi-duo-xuan') }}</wd-button>
</wd-select-picker>
</view>
</demo-block>
<wd-toast />
</page-wraper>
</template>
<script lang="ts" setup>
import { useToast } from '@/uni_modules/wot-design-uni'
import type { SelectPickerBeforeConfirm, SelectPickerDisplayFormat } from '@/uni_modules/wot-design-uni/components/wd-select-picker/types'
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const columns1 = ref<Record<string, any>[]>([
{
value: '101',
label: t('nan-zhuang')
},
{
value: '102',
label: t('she-chi-pin')
},
{
value: '103',
label: t('nv-zhuang')
},
{
value: '104',
label: t('xie-xue')
},
{
value: '105',
label: t('nei-yi-pei-shi')
},
{
value: '106',
label: t('xiang-bao')
},
{
value: '107',
label: t('mei-zhuang-hu-fu')
},
{
value: '108',
label: t('ge-xing-qing-jie')
},
{
value: '109',
label: t('zhong-biao-zhu-bao')
},
{
value: '110',
label: t('shou-ji')
},
{
value: '111',
label: t('shu-ma')
},
{
value: '112',
label: t('dian-nao-ban-gong')
}
])
const columns2 = ref<Record<string, any>[]>([
{
value: '101',
label: t('nan-zhuang-0'),
disabled: true
},
{
value: '102',
label: t('she-chi-pin')
},
{
value: '103',
label: t('nv-zhuang-0')
}
])
const columns3 = ref<Record<string, any>[]>([
{
value: '101',
label: t('nan-zhuang'),
additional: {
mobile: 13800138000,
position: 'manager'
}
},
{
value: '102',
label: t('she-chi-pin'),
additional: {
mobile: 10000,
position: 'telecom'
}
},
{
value: '103',
label: t('nv-zhuang'),
additional: {
mobile: 10010,
position: 'unicom'
}
},
{
value: '104',
label: t('xie-xue'),
additional: {
mobile: 10086,
position: 'mobile'
}
},
{
value: '105',
label: t('nei-yi-pei-shi'),
additional: {
mobile: 110,
position: 'police'
}
},
{
value: '106',
label: t('xiang-bao'),
additional: {
mobile: 120,
position: 'ambulance'
}
},
{
value: '107',
label: t('mei-zhuang-hu-fu'),
additional: {
mobile: 510000,
position: 'postcode'
}
},
{
value: '108',
label: t('ge-xing-qing-jie'),
additional: {
mobile: 13800138000,
position: 'staff'
}
},
{
value: '109',
label: t('zhong-biao-zhu-bao'),
additional: {
mobile: 13800138000,
position: 'manager'
}
},
{
value: '110',
label: t('shou-ji'),
additional: {
mobile: 13800138000,
position: 'manager'
}
},
{
value: '111',
label: t('shu-ma'),
additional: {
mobile: 13800138000,
position: 'manager'
}
},
{
value: '112',
label: t('dian-nao-ban-gong'),
additional: {
mobile: 13800138000,
position: 'manager'
}
}
])
const value1 = ref<string[]>(['101'])
const value2 = ref<string>('101')
const value3 = ref<string[]>(['102'])
const value4 = ref<string[]>(['103'])
const value5 = ref<string[]>([])
const value6 = ref<string[]>([])
const value7 = ref<string[]>([])
const value8 = ref<string[]>([])
const value9 = ref<string[]>([])
const value10 = ref<string[]>([])
const value11 = ref<string[]>([])
const value12 = ref<string[]>(['103'])
const value13 = ref<string[]>(['102'])
const value14 = ref<string[]>([])
const value15 = ref<string[]>(['101'])
const value16 = ref<string[]>(['103'])
const value17 = ref<string[]>(['102'])
const value18 = ref<string>('102')
const value19 = ref<string>('101')
const value20 = ref<string>('101')
const value21 = ref<string[]>(['102'])
const customShow = ref<string>(t('she-chi-pin'))
const toast = useToast()
const displayFormat: SelectPickerDisplayFormat = (items, columns) => {
let showValue = ''
columns.forEach((column) => {
;(items as (string | number | boolean)[]).forEach((item, index) => {
if (column.value === item) {
showValue += `${item}: ${column.label} ${index + 1 < (items as (string | number | boolean)[]).length ? '--' : ''} `
}
})
})
return showValue
}
const beforeConfirm: SelectPickerBeforeConfirm = (value, resolve) => {
if ((value as string[]).length > 0) {
toast.error(t('zan-shi-wu-fa-xuan-ze-shang-pin'))
resolve(false)
} else {
resolve(true)
}
}
function handleChange({ value }: any) {
toast.show(t('xuan-ze-le') + value)
}
function handleConfirm1({ value }: any) {
console.log(value)
}
function handleConfirm2({ value }: any) {
console.log(value)
}
function handleConfirm3({ value }: any) {
console.log(value)
}
function handleConfirm4({ value }: any) {
console.log(value)
}
function handleConfirm5({ value }: any) {
console.log(value)
}
function handleConfirm6({ value }: any) {
console.log(value)
}
function handleConfirm7({ value }: any) {
console.log(value)
}
function handleConfirm8({ value }: any) {
console.log(value)
}
function handleConfirm9({ value }: any) {
console.log(value)
}
function handleConfirm10({ value }: any) {
console.log(value)
}
function handleConfirm11({ value }: any) {
console.log(value)
}
function handleConfirm12({ value }: any) {
console.log(value)
}
function handleConfirm13({ value }: any) {
console.log(value)
}
function handleConfirm14({ value }: any) {
console.log(value)
}
function handleConfirm15({ value }: any) {
console.log(value)
}
function handleConfirm16({ value }: any) {
console.log(value)
}
function handleConfirm17({ value, selectedItems }: any) {
console.log(value)
customShow.value = selectedItems
.map((item: any) => {
return item.label
})
.join(', ')
}
function handleConfirm21({ value }: any) {
console.log(value)
}
</script>
<style lang="scss" scoped></style>