af-mobile-client-vue3 1.4.23 → 1.4.24
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/package.json +1 -1
- package/src/components/common/otherCharge/ChargePrintSelectorAndRemarks.vue +137 -137
- package/src/components/common/otherCharge/CodePayment.vue +357 -357
- package/src/components/common/otherCharge/FileUploader.vue +602 -602
- package/src/components/common/otherCharge/GridFileUploader.vue +846 -846
- package/src/components/common/otherCharge/PaymentMethodSelector.vue +202 -202
- package/src/components/common/otherCharge/PaymentMethodSelectorCard.vue +45 -45
- package/src/components/common/otherCharge/ReceiptModal.vue +273 -273
- package/src/components/common/otherCharge/index.ts +43 -43
- package/src/components/data/OtherCharge/OtherChargeForm.vue +744 -744
- package/src/components/data/OtherCharge/OtherChargeItem.vue +168 -168
- package/src/components/data/OtherCharge/OtherChargeItemModal.vue +547 -547
- package/src/components/data/XFormItem/index.vue +1638 -1632
- package/src/router/routes.ts +427 -427
- package/src/utils/queryFormDefaultRangePicker.ts +57 -57
- package/src/views/component/OtherCharge/index.vue +42 -42
- package/src/views/component/XCellListView/index.vue +138 -107
- package/src/views/component/XFormGroupView/index.vue +82 -78
- package/src/views/component/XFormView/index.vue +46 -41
|
@@ -1,1632 +1,1638 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { FieldType } from 'vant'
|
|
3
|
-
import type { Numeric } from 'vant/es/utils'
|
|
4
|
-
import ImageUploader from '@af-mobile-client-vue3/components/core/ImageUploader/index.vue'
|
|
5
|
-
import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
|
|
6
|
-
import XMultiSelect from '@af-mobile-client-vue3/components/core/XMultiSelect/index.vue'
|
|
7
|
-
import XSelect from '@af-mobile-client-vue3/components/core/XSelect/index.vue'
|
|
8
|
-
import XLocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
|
|
9
|
-
import { getConfigByNameAsync, runLogic } from '@af-mobile-client-vue3/services/api/common'
|
|
10
|
-
import { post } from '@af-mobile-client-vue3/services/restTools'
|
|
11
|
-
import { searchToListOption, searchToOption } from '@af-mobile-client-vue3/services/v3Api'
|
|
12
|
-
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
13
|
-
import { getDict } from '@af-mobile-client-vue3/utils/dictUtil'
|
|
14
|
-
import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
15
|
-
import { executeStrFunctionByContext } from '@af-mobile-client-vue3/utils/runEvalFunction'
|
|
16
|
-
import { areaList } from '@vant/area-data'
|
|
17
|
-
import dayjs from 'dayjs/esm/index'
|
|
18
|
-
import { debounce } from 'lodash-es'
|
|
19
|
-
import {
|
|
20
|
-
showToast,
|
|
21
|
-
Area as VanArea,
|
|
22
|
-
Button as VanButton,
|
|
23
|
-
Calendar as VanCalendar,
|
|
24
|
-
Cascader as VanCascader,
|
|
25
|
-
Checkbox as VanCheckbox,
|
|
26
|
-
CheckboxGroup as vanCheckboxGroup,
|
|
27
|
-
DatePicker as VanDatePicker,
|
|
28
|
-
Field as VanField,
|
|
29
|
-
Picker as VanPicker,
|
|
30
|
-
PickerGroup as VanPickerGroup,
|
|
31
|
-
Popup as VanPopup,
|
|
32
|
-
Radio as VanRadio,
|
|
33
|
-
RadioGroup as VanRadioGroup,
|
|
34
|
-
Rate as VanRate,
|
|
35
|
-
Slider as VanSlider,
|
|
36
|
-
Stepper as VanStepper,
|
|
37
|
-
Switch as VanSwitch,
|
|
38
|
-
TimePicker as VanTimePicker,
|
|
39
|
-
} from 'vant'
|
|
40
|
-
import { computed, defineEmits, defineModel, defineProps, getCurrentInstance, onBeforeMount, ref, watch } from 'vue'
|
|
41
|
-
|
|
42
|
-
const props = defineProps({
|
|
43
|
-
attr: {
|
|
44
|
-
type: Object,
|
|
45
|
-
},
|
|
46
|
-
form: {
|
|
47
|
-
type: Object,
|
|
48
|
-
},
|
|
49
|
-
// 整表只读:来自 XForm,统一控制交互
|
|
50
|
-
formReadonly: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false,
|
|
53
|
-
},
|
|
54
|
-
datePickerFilter: {
|
|
55
|
-
type: Function,
|
|
56
|
-
default: () => true,
|
|
57
|
-
},
|
|
58
|
-
datePickerFormatter: {
|
|
59
|
-
type: Function,
|
|
60
|
-
default: (type, val) => val,
|
|
61
|
-
},
|
|
62
|
-
mode: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: '查询',
|
|
65
|
-
},
|
|
66
|
-
serviceName: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: undefined,
|
|
69
|
-
},
|
|
70
|
-
// 调用logic获取数据源的追加参数
|
|
71
|
-
getDataParams: {
|
|
72
|
-
type: Object,
|
|
73
|
-
default: undefined,
|
|
74
|
-
},
|
|
75
|
-
disabled: {
|
|
76
|
-
type: Boolean,
|
|
77
|
-
default: false,
|
|
78
|
-
},
|
|
79
|
-
rules: {
|
|
80
|
-
type: Object,
|
|
81
|
-
default: () => {},
|
|
82
|
-
},
|
|
83
|
-
// 用 defineModel 替代 modelValue/emit
|
|
84
|
-
modelValue: {
|
|
85
|
-
type: [String, Number, Boolean, Array, Object],
|
|
86
|
-
default: undefined,
|
|
87
|
-
},
|
|
88
|
-
showLabel: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
default: true,
|
|
91
|
-
},
|
|
92
|
-
// radio/checkbox/select/mul-select 选项数据结构
|
|
93
|
-
columnsField: {
|
|
94
|
-
type: Object,
|
|
95
|
-
default: () => {
|
|
96
|
-
return { text: 'label', value: 'value' }
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
isAsyncUpload: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false,
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
const emits = defineEmits(['setForm', 'xFormItemEmitFunc', 'scanCodeOrNfc'])
|
|
107
|
-
|
|
108
|
-
// 用 defineModel 替代 modelValue/emit
|
|
109
|
-
const modelData = defineModel<string | number | boolean | any[] | Record<string, any>>()
|
|
110
|
-
|
|
111
|
-
// 获取字典
|
|
112
|
-
interface OptionItem {
|
|
113
|
-
label: string
|
|
114
|
-
value: any
|
|
115
|
-
children?: OptionItem[]
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 判断并初始化防抖函数
|
|
119
|
-
let debouncedUserLinkFunc: (() => void) | null = null
|
|
120
|
-
let debouncedDepLinkFunc: (() => void) | null = null
|
|
121
|
-
let debouncedUpdateOptions: (() => void) | null = null
|
|
122
|
-
|
|
123
|
-
const { attr, form, mode, serviceName, getDataParams, columnsField } = props
|
|
124
|
-
// 配置的表单值格式(仅针对 datePicker 生效)
|
|
125
|
-
// 作用:统一控制日期值的格式化输入/输出与选择器展示粒度
|
|
126
|
-
// 可选:'YYYY' | 'YYYY-MM' | 'YYYY-MM-DD' | 'YYYY-MM-DD HH' | 'YYYY-MM-DD HH:mm' | 'YYYY-MM-DD HH:mm:ss'
|
|
127
|
-
const formValueFormat = computed(() => {
|
|
128
|
-
// 默认全格式
|
|
129
|
-
return (attr && (attr as any).formValueFormat) || 'YYYY-MM-DD HH:mm:ss'
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
// 根据 formValueFormat 动态计算日期列类型(决定 VanDatePicker 展示年/月/日)
|
|
133
|
-
// 例如:YYYY 只显示年;YYYY-MM 显示年、月;YYYY-MM-DD 显示年、月、日
|
|
134
|
-
const dateColumnsType = computed(() => {
|
|
135
|
-
const format = formValueFormat.value
|
|
136
|
-
const columns: string[] = ['year']
|
|
137
|
-
if (format.includes('MM'))
|
|
138
|
-
columns.push('month')
|
|
139
|
-
if (format.includes('DD'))
|
|
140
|
-
columns.push('day')
|
|
141
|
-
return columns as any
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
// 是否包含时间(决定是否展示时间页签与 VanTimePicker)
|
|
145
|
-
const hasTime = computed(() => formValueFormat.value.includes('HH'))
|
|
146
|
-
|
|
147
|
-
// 根据 formValueFormat 动态计算时间列类型(决定时/分/秒的展示)
|
|
148
|
-
// 例如:包含 HH 显示小时;包含 mm 显示分钟;包含 ss 显示秒
|
|
149
|
-
const timeColumnsType = computed(() => {
|
|
150
|
-
const format = formValueFormat.value
|
|
151
|
-
const columns: string[] = []
|
|
152
|
-
if (format.includes('HH'))
|
|
153
|
-
columns.push('hour')
|
|
154
|
-
if (format.includes('mm'))
|
|
155
|
-
columns.push('minute')
|
|
156
|
-
if (format.includes('ss'))
|
|
157
|
-
columns.push('second')
|
|
158
|
-
return columns as any
|
|
159
|
-
})
|
|
160
|
-
const calendarShow = ref(false)
|
|
161
|
-
const option = ref([])
|
|
162
|
-
const pickerValue = ref(undefined)
|
|
163
|
-
const timePickerValue = ref(undefined)
|
|
164
|
-
const area = ref<any>(undefined)
|
|
165
|
-
const showPicker = ref(false)
|
|
166
|
-
const showDatePicker = ref(false)
|
|
167
|
-
const showTimePicker = ref(false)
|
|
168
|
-
const showArea = ref(false)
|
|
169
|
-
const errorMessage = ref('')
|
|
170
|
-
const showTreeSelect = ref(false)
|
|
171
|
-
const treeValue = ref('')
|
|
172
|
-
// 懒加载 最后检索版本
|
|
173
|
-
const lastFetchId = ref(0)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
const
|
|
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
|
-
if (def === '
|
|
251
|
-
if (attr.type === 'treeSelect') {
|
|
252
|
-
treeValue.value = userState.f.resources.
|
|
253
|
-
}
|
|
254
|
-
return attr.type === 'select' ? userState.f.resources.
|
|
255
|
-
}
|
|
256
|
-
if (def === '
|
|
257
|
-
if (attr.type === 'treeSelect') {
|
|
258
|
-
treeValue.value = userState.f.resources.
|
|
259
|
-
}
|
|
260
|
-
return attr.type === 'select' ? userState.f.resources.
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
//
|
|
271
|
-
const
|
|
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
|
-
return end
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
case '
|
|
441
|
-
if (
|
|
442
|
-
errorMessage.value =
|
|
443
|
-
return
|
|
444
|
-
}
|
|
445
|
-
break
|
|
446
|
-
case '
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
case '
|
|
455
|
-
if (
|
|
456
|
-
errorMessage.value =
|
|
457
|
-
return
|
|
458
|
-
}
|
|
459
|
-
break
|
|
460
|
-
case '
|
|
461
|
-
if (!/^-?\d
|
|
462
|
-
errorMessage.value = `${attr.name}
|
|
463
|
-
return
|
|
464
|
-
}
|
|
465
|
-
break
|
|
466
|
-
case '
|
|
467
|
-
if (
|
|
468
|
-
errorMessage.value =
|
|
469
|
-
return
|
|
470
|
-
}
|
|
471
|
-
break
|
|
472
|
-
case '
|
|
473
|
-
if (!/^
|
|
474
|
-
errorMessage.value =
|
|
475
|
-
return
|
|
476
|
-
}
|
|
477
|
-
break
|
|
478
|
-
case '
|
|
479
|
-
if (!/^
|
|
480
|
-
errorMessage.value =
|
|
481
|
-
return
|
|
482
|
-
}
|
|
483
|
-
break
|
|
484
|
-
case '
|
|
485
|
-
if (!/^
|
|
486
|
-
errorMessage.value =
|
|
487
|
-
return
|
|
488
|
-
}
|
|
489
|
-
break
|
|
490
|
-
case '
|
|
491
|
-
if (!/^
|
|
492
|
-
errorMessage.value =
|
|
493
|
-
return
|
|
494
|
-
}
|
|
495
|
-
break
|
|
496
|
-
case '
|
|
497
|
-
if (!/^(
|
|
498
|
-
errorMessage.value =
|
|
499
|
-
return
|
|
500
|
-
}
|
|
501
|
-
break
|
|
502
|
-
case '
|
|
503
|
-
if (
|
|
504
|
-
errorMessage.value =
|
|
505
|
-
return
|
|
506
|
-
}
|
|
507
|
-
break
|
|
508
|
-
case '
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
// eslint-disable-next-line no-case-declarations
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
//
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
// eslint-disable-next-line no-case-declarations
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (attr
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
if (attr.
|
|
602
|
-
return
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
case '
|
|
613
|
-
case '
|
|
614
|
-
case '
|
|
615
|
-
|
|
616
|
-
case '
|
|
617
|
-
case '
|
|
618
|
-
case '
|
|
619
|
-
case '
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
function
|
|
643
|
-
if (attr.keyName &&
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
//
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
function
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
}]
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
const
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
source,
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
:
|
|
1159
|
-
:
|
|
1160
|
-
:
|
|
1161
|
-
:
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
:
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
:
|
|
1346
|
-
:
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
:
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
:
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
:
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
:
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
:
|
|
1472
|
-
:
|
|
1473
|
-
|
|
1474
|
-
:
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
:
|
|
1490
|
-
|
|
1491
|
-
:
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
:
|
|
1507
|
-
:
|
|
1508
|
-
:
|
|
1509
|
-
:
|
|
1510
|
-
:
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
:
|
|
1557
|
-
:
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
:
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
:
|
|
1586
|
-
:
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FieldType } from 'vant'
|
|
3
|
+
import type { Numeric } from 'vant/es/utils'
|
|
4
|
+
import ImageUploader from '@af-mobile-client-vue3/components/core/ImageUploader/index.vue'
|
|
5
|
+
import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
|
|
6
|
+
import XMultiSelect from '@af-mobile-client-vue3/components/core/XMultiSelect/index.vue'
|
|
7
|
+
import XSelect from '@af-mobile-client-vue3/components/core/XSelect/index.vue'
|
|
8
|
+
import XLocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
|
|
9
|
+
import { getConfigByNameAsync, runLogic } from '@af-mobile-client-vue3/services/api/common'
|
|
10
|
+
import { post } from '@af-mobile-client-vue3/services/restTools'
|
|
11
|
+
import { searchToListOption, searchToOption } from '@af-mobile-client-vue3/services/v3Api'
|
|
12
|
+
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
13
|
+
import { getDict } from '@af-mobile-client-vue3/utils/dictUtil'
|
|
14
|
+
import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
|
|
15
|
+
import { executeStrFunctionByContext } from '@af-mobile-client-vue3/utils/runEvalFunction'
|
|
16
|
+
import { areaList } from '@vant/area-data'
|
|
17
|
+
import dayjs from 'dayjs/esm/index'
|
|
18
|
+
import { debounce } from 'lodash-es'
|
|
19
|
+
import {
|
|
20
|
+
showToast,
|
|
21
|
+
Area as VanArea,
|
|
22
|
+
Button as VanButton,
|
|
23
|
+
Calendar as VanCalendar,
|
|
24
|
+
Cascader as VanCascader,
|
|
25
|
+
Checkbox as VanCheckbox,
|
|
26
|
+
CheckboxGroup as vanCheckboxGroup,
|
|
27
|
+
DatePicker as VanDatePicker,
|
|
28
|
+
Field as VanField,
|
|
29
|
+
Picker as VanPicker,
|
|
30
|
+
PickerGroup as VanPickerGroup,
|
|
31
|
+
Popup as VanPopup,
|
|
32
|
+
Radio as VanRadio,
|
|
33
|
+
RadioGroup as VanRadioGroup,
|
|
34
|
+
Rate as VanRate,
|
|
35
|
+
Slider as VanSlider,
|
|
36
|
+
Stepper as VanStepper,
|
|
37
|
+
Switch as VanSwitch,
|
|
38
|
+
TimePicker as VanTimePicker,
|
|
39
|
+
} from 'vant'
|
|
40
|
+
import { computed, defineEmits, defineModel, defineProps, getCurrentInstance, onBeforeMount, ref, watch } from 'vue'
|
|
41
|
+
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
attr: {
|
|
44
|
+
type: Object,
|
|
45
|
+
},
|
|
46
|
+
form: {
|
|
47
|
+
type: Object,
|
|
48
|
+
},
|
|
49
|
+
// 整表只读:来自 XForm,统一控制交互
|
|
50
|
+
formReadonly: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
datePickerFilter: {
|
|
55
|
+
type: Function,
|
|
56
|
+
default: () => true,
|
|
57
|
+
},
|
|
58
|
+
datePickerFormatter: {
|
|
59
|
+
type: Function,
|
|
60
|
+
default: (type, val) => val,
|
|
61
|
+
},
|
|
62
|
+
mode: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '查询',
|
|
65
|
+
},
|
|
66
|
+
serviceName: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: undefined,
|
|
69
|
+
},
|
|
70
|
+
// 调用logic获取数据源的追加参数
|
|
71
|
+
getDataParams: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: undefined,
|
|
74
|
+
},
|
|
75
|
+
disabled: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
78
|
+
},
|
|
79
|
+
rules: {
|
|
80
|
+
type: Object,
|
|
81
|
+
default: () => {},
|
|
82
|
+
},
|
|
83
|
+
// 用 defineModel 替代 modelValue/emit
|
|
84
|
+
modelValue: {
|
|
85
|
+
type: [String, Number, Boolean, Array, Object],
|
|
86
|
+
default: undefined,
|
|
87
|
+
},
|
|
88
|
+
showLabel: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: true,
|
|
91
|
+
},
|
|
92
|
+
// radio/checkbox/select/mul-select 选项数据结构
|
|
93
|
+
columnsField: {
|
|
94
|
+
type: Object,
|
|
95
|
+
default: () => {
|
|
96
|
+
return { text: 'label', value: 'value' }
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
isAsyncUpload: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const emits = defineEmits(['setForm', 'xFormItemEmitFunc', 'scanCodeOrNfc'])
|
|
107
|
+
|
|
108
|
+
// 用 defineModel 替代 modelValue/emit
|
|
109
|
+
const modelData = defineModel<string | number | boolean | any[] | Record<string, any>>()
|
|
110
|
+
|
|
111
|
+
// 获取字典
|
|
112
|
+
interface OptionItem {
|
|
113
|
+
label: string
|
|
114
|
+
value: any
|
|
115
|
+
children?: OptionItem[]
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 判断并初始化防抖函数
|
|
119
|
+
let debouncedUserLinkFunc: (() => void) | null = null
|
|
120
|
+
let debouncedDepLinkFunc: (() => void) | null = null
|
|
121
|
+
let debouncedUpdateOptions: (() => void) | null = null
|
|
122
|
+
|
|
123
|
+
const { attr, form, mode, serviceName, getDataParams, columnsField } = props
|
|
124
|
+
// 配置的表单值格式(仅针对 datePicker 生效)
|
|
125
|
+
// 作用:统一控制日期值的格式化输入/输出与选择器展示粒度
|
|
126
|
+
// 可选:'YYYY' | 'YYYY-MM' | 'YYYY-MM-DD' | 'YYYY-MM-DD HH' | 'YYYY-MM-DD HH:mm' | 'YYYY-MM-DD HH:mm:ss'
|
|
127
|
+
const formValueFormat = computed(() => {
|
|
128
|
+
// 默认全格式
|
|
129
|
+
return (attr && (attr as any).formValueFormat) || 'YYYY-MM-DD HH:mm:ss'
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
// 根据 formValueFormat 动态计算日期列类型(决定 VanDatePicker 展示年/月/日)
|
|
133
|
+
// 例如:YYYY 只显示年;YYYY-MM 显示年、月;YYYY-MM-DD 显示年、月、日
|
|
134
|
+
const dateColumnsType = computed(() => {
|
|
135
|
+
const format = formValueFormat.value
|
|
136
|
+
const columns: string[] = ['year']
|
|
137
|
+
if (format.includes('MM'))
|
|
138
|
+
columns.push('month')
|
|
139
|
+
if (format.includes('DD'))
|
|
140
|
+
columns.push('day')
|
|
141
|
+
return columns as any
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
// 是否包含时间(决定是否展示时间页签与 VanTimePicker)
|
|
145
|
+
const hasTime = computed(() => formValueFormat.value.includes('HH'))
|
|
146
|
+
|
|
147
|
+
// 根据 formValueFormat 动态计算时间列类型(决定时/分/秒的展示)
|
|
148
|
+
// 例如:包含 HH 显示小时;包含 mm 显示分钟;包含 ss 显示秒
|
|
149
|
+
const timeColumnsType = computed(() => {
|
|
150
|
+
const format = formValueFormat.value
|
|
151
|
+
const columns: string[] = []
|
|
152
|
+
if (format.includes('HH'))
|
|
153
|
+
columns.push('hour')
|
|
154
|
+
if (format.includes('mm'))
|
|
155
|
+
columns.push('minute')
|
|
156
|
+
if (format.includes('ss'))
|
|
157
|
+
columns.push('second')
|
|
158
|
+
return columns as any
|
|
159
|
+
})
|
|
160
|
+
const calendarShow = ref(false)
|
|
161
|
+
const option = ref([])
|
|
162
|
+
const pickerValue = ref(undefined)
|
|
163
|
+
const timePickerValue = ref(undefined)
|
|
164
|
+
const area = ref<any>(undefined)
|
|
165
|
+
const showPicker = ref(false)
|
|
166
|
+
const showDatePicker = ref(false)
|
|
167
|
+
const showTimePicker = ref(false)
|
|
168
|
+
const showArea = ref(false)
|
|
169
|
+
const errorMessage = ref('')
|
|
170
|
+
const showTreeSelect = ref(false)
|
|
171
|
+
const treeValue = ref('')
|
|
172
|
+
// 懒加载 最后检索版本
|
|
173
|
+
const lastFetchId = ref(0)
|
|
174
|
+
const customizeReadOnly = ref(false)
|
|
175
|
+
|
|
176
|
+
// 登录信息 (可以在配置的动态函数中使用 this.setupState 获取到当前组件内的全部函数和变量 例:this.setupState.userState)
|
|
177
|
+
const userState = useUserStore().getLogin()
|
|
178
|
+
const currUser = computed(() => userState.f.resources.id)
|
|
179
|
+
const userInfo = computed(() => ({
|
|
180
|
+
orgId: userState.f.resources.orgid,
|
|
181
|
+
userId: userState.f.resources.id,
|
|
182
|
+
}))
|
|
183
|
+
|
|
184
|
+
// 是否展示当前项
|
|
185
|
+
const showItem = ref(true)
|
|
186
|
+
|
|
187
|
+
// 当前组件实例(不推荐使用,可能会在后续的版本更迭中调整,暂时用来绑定函数的上下文)
|
|
188
|
+
const currInst = getCurrentInstance()
|
|
189
|
+
|
|
190
|
+
// 配置中心->表单项变更触发函数
|
|
191
|
+
async function dataChangeFunc() {
|
|
192
|
+
if (attr.dataChangeFunc) {
|
|
193
|
+
await executeStrFunctionByContext(currInst, attr.dataChangeFunc, [props.form, (formData: any) => emits('setForm', formData), attr, null, mode, runLogic, getConfigByNameAsync, userState.f.resources])
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const dataChangeFuncdebounce = debounce(dataChangeFunc, 300)
|
|
197
|
+
// 配置中心->表单项展示函数
|
|
198
|
+
async function showFormItemFunc() {
|
|
199
|
+
if (attr.showFormItemFunc) {
|
|
200
|
+
const obj = await executeStrFunctionByContext(currInst, attr.showFormItemFunc, [form, attr, null, mode])
|
|
201
|
+
// 判断是 bool 还是 obj 兼容
|
|
202
|
+
if (typeof obj === 'boolean') {
|
|
203
|
+
showItem.value = obj
|
|
204
|
+
}
|
|
205
|
+
else if (obj && typeof obj === 'object') {
|
|
206
|
+
// obj 是一个对象,并且不是数组
|
|
207
|
+
if (Object.prototype.hasOwnProperty.call(obj, 'show')) {
|
|
208
|
+
showItem.value = obj?.show
|
|
209
|
+
}
|
|
210
|
+
if (Object.prototype.hasOwnProperty.call(obj, 'readOnly')) {
|
|
211
|
+
customizeReadOnly.value = obj?.readOnly
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const showFormItemFuncdebounce = debounce(showFormItemFunc, 300)
|
|
217
|
+
/**
|
|
218
|
+
* 检测是否传入了有效的值
|
|
219
|
+
* @returns any
|
|
220
|
+
*/
|
|
221
|
+
function checkModel(val = props.modelValue) {
|
|
222
|
+
if (val === null || val === undefined || val === '')
|
|
223
|
+
return false
|
|
224
|
+
if (Array.isArray(val))
|
|
225
|
+
return val.length > 0
|
|
226
|
+
return true
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 获取表单项的默认值
|
|
230
|
+
* @returns any
|
|
231
|
+
*/
|
|
232
|
+
function getDefaultValue() {
|
|
233
|
+
const val = props.modelValue
|
|
234
|
+
// 如果有有效值,直接返回(datePicker 初始值需按 formValueFormat 归一)
|
|
235
|
+
// 目的:外部通过 formData 传入的初始值在组件挂载即与配置格式一致
|
|
236
|
+
if (checkModel(val)) {
|
|
237
|
+
if (attr.type === 'datePicker' && typeof val === 'string') {
|
|
238
|
+
const parsed = dayjs(val)
|
|
239
|
+
if (parsed.isValid())
|
|
240
|
+
return parsed.format(formValueFormat.value)
|
|
241
|
+
}
|
|
242
|
+
return val
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 根据类型获取默认值
|
|
246
|
+
const getDefaultByType = () => {
|
|
247
|
+
const def = mode !== '查询' ? attr.formDefault : attr.queryFormDefault
|
|
248
|
+
|
|
249
|
+
if (['treeSelect', 'select', 'checkbox'].includes(attr.type) && ['curOrgId', 'curDepId', 'curUserId'].includes(def)) {
|
|
250
|
+
if (def === 'curOrgId') {
|
|
251
|
+
if (attr.type === 'treeSelect') {
|
|
252
|
+
treeValue.value = userState.f.resources.orgs
|
|
253
|
+
}
|
|
254
|
+
return attr.type === 'select' ? userState.f.resources.orgid : [userState.f.resources.orgid]
|
|
255
|
+
}
|
|
256
|
+
if (def === 'curDepId') {
|
|
257
|
+
if (attr.type === 'treeSelect') {
|
|
258
|
+
treeValue.value = userState.f.resources.deps
|
|
259
|
+
}
|
|
260
|
+
return attr.type === 'select' ? userState.f.resources.depids : [userState.f.resources.depids]
|
|
261
|
+
}
|
|
262
|
+
if (def === 'curUserId') {
|
|
263
|
+
if (attr.type === 'treeSelect') {
|
|
264
|
+
treeValue.value = userState.f.resources.name
|
|
265
|
+
}
|
|
266
|
+
return attr.type === 'select' ? userState.f.resources.id : [userState.f.resources.id]
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 数组类型默认值
|
|
271
|
+
const arrayTypes = ['uploader', 'checkbox', 'file', 'area', 'image', 'treeSelect']
|
|
272
|
+
if (arrayTypes.includes(attr.type)) {
|
|
273
|
+
return def !== undefined ? def : []
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// 特殊类型默认值
|
|
277
|
+
const specialDefaults = {
|
|
278
|
+
switch: false,
|
|
279
|
+
stepper: 1,
|
|
280
|
+
addressSearch: val,
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (specialDefaults[attr.type] !== undefined) {
|
|
284
|
+
return specialDefaults[attr.type]
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 日期时间类型:调用 getDateRange,并传入 formValueFormat
|
|
288
|
+
// 说明:让初始化/查询默认值同样遵循配置的格式显示
|
|
289
|
+
const dateTypes = ['rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker', 'datePicker', 'timePicker']
|
|
290
|
+
if (dateTypes.includes(attr.type)) {
|
|
291
|
+
return getDateRange({
|
|
292
|
+
type: attr.type,
|
|
293
|
+
formDefault: attr.formDefault ?? '',
|
|
294
|
+
queryFormDefault: attr.queryFormDefault ?? '',
|
|
295
|
+
queryType: attr.queryType,
|
|
296
|
+
queryValueFormat: attr.queryValueFormat,
|
|
297
|
+
name: attr.name ?? '',
|
|
298
|
+
formValueFormat: formValueFormat.value,
|
|
299
|
+
}) ?? []
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// 其他类型(字符串、数字等)
|
|
303
|
+
return def ?? ''
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return getDefaultByType()
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// 初始化日期组件初始值,组件自定义格式显示值和实际值(日期相关初始化都在此函数中操作)
|
|
310
|
+
function getDateRange({
|
|
311
|
+
type,
|
|
312
|
+
formDefault: defaultValue,
|
|
313
|
+
queryFormDefault,
|
|
314
|
+
queryType,
|
|
315
|
+
queryValueFormat: defaultFormat,
|
|
316
|
+
name,
|
|
317
|
+
formValueFormat: formFormat,
|
|
318
|
+
}: {
|
|
319
|
+
type: string
|
|
320
|
+
formDefault: string
|
|
321
|
+
queryFormDefault: string
|
|
322
|
+
queryType?: string
|
|
323
|
+
queryValueFormat?: string
|
|
324
|
+
name: string
|
|
325
|
+
// 新增:用于优先覆盖 datePicker 的显示/存储格式
|
|
326
|
+
formValueFormat?: string
|
|
327
|
+
}): string | [string, string] | undefined {
|
|
328
|
+
const formatMap: Record<string, string> = {
|
|
329
|
+
yearPicker: 'YYYY',
|
|
330
|
+
yearRangePicker: 'YYYY',
|
|
331
|
+
monthPicker: 'YYYY-MM',
|
|
332
|
+
monthRangePicker: 'YYYY-MM',
|
|
333
|
+
datePicker: 'YYYY-MM-DD HH:mm:ss',
|
|
334
|
+
rangePicker: 'YYYY-MM-DD HH:mm:ss',
|
|
335
|
+
}
|
|
336
|
+
if (mode) {
|
|
337
|
+
// datePicker 优先使用 formValueFormat(否则退回 queryValueFormat 或默认映射)
|
|
338
|
+
const preferFormat = type === 'datePicker' ? (formFormat || defaultFormat) : defaultFormat
|
|
339
|
+
const format = preferFormat || formatMap[type]
|
|
340
|
+
const val = mode === '查询' ? queryFormDefault : defaultValue
|
|
341
|
+
let start: string, end: string
|
|
342
|
+
switch (val) {
|
|
343
|
+
case 'curYear':
|
|
344
|
+
start = dayjs().startOf('year').format(format)
|
|
345
|
+
end = dayjs().endOf('year').format(format)
|
|
346
|
+
break
|
|
347
|
+
case 'curMonth':
|
|
348
|
+
start = dayjs().startOf('month').format(format)
|
|
349
|
+
end = dayjs().endOf('month').format(format)
|
|
350
|
+
break
|
|
351
|
+
case 'curDay':
|
|
352
|
+
start = dayjs().startOf('day').format(format)
|
|
353
|
+
end = dayjs().endOf('day').format(format)
|
|
354
|
+
break
|
|
355
|
+
case 'curTime':
|
|
356
|
+
start = dayjs().format(format)
|
|
357
|
+
end = dayjs().format(format)
|
|
358
|
+
break
|
|
359
|
+
default:
|
|
360
|
+
return undefined
|
|
361
|
+
}
|
|
362
|
+
if (['monthPicker', 'yearPicker', 'datePicker'].includes(type)) {
|
|
363
|
+
if (mode !== '查询') {
|
|
364
|
+
if (queryType === 'BETWEEN') {
|
|
365
|
+
return [start, end]
|
|
366
|
+
}
|
|
367
|
+
if (name.includes('开始') || name.includes('起始')) {
|
|
368
|
+
return start
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
return end
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
return start
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// rangePicker组件表单显示的值
|
|
379
|
+
if (mode === '查询' && type === 'rangePicker') {
|
|
380
|
+
pickerValue.value = `${start} ~ ${end}`
|
|
381
|
+
}
|
|
382
|
+
return mode !== '查询' ? start : [start, end]
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
return undefined
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// 监听 props.form 的变化
|
|
390
|
+
watch(
|
|
391
|
+
() => props.form,
|
|
392
|
+
(newVal, oldVal) => {
|
|
393
|
+
// 如果是从函数获取 options
|
|
394
|
+
if (props.attr.keyName && (props.attr.keyName.toString().includes('async ') || props.attr.keyName.toString().includes('function'))) {
|
|
395
|
+
debouncedUpdateOptions()
|
|
396
|
+
}
|
|
397
|
+
if (props.attr.showFormItemFunc) {
|
|
398
|
+
showFormItemFuncdebounce()
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
{ deep: true },
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
// 监听 modelData 的变化,调用 dataChangeFunc
|
|
405
|
+
watch(
|
|
406
|
+
() => modelData.value,
|
|
407
|
+
(newVal, oldVal) => {
|
|
408
|
+
// 避免初始化时的调用
|
|
409
|
+
if (newVal !== oldVal) {
|
|
410
|
+
dataChangeFuncdebounce()
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
{ deep: true },
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
// 监听 option.value 的变化
|
|
417
|
+
watch(
|
|
418
|
+
() => option.value,
|
|
419
|
+
(newOption) => {
|
|
420
|
+
if (attr.type === 'treeSelect' && newOption && newOption.length > 0) {
|
|
421
|
+
// 你可以在这里调用 findOptionInTree 函数来查找默认值对应的 label
|
|
422
|
+
const result = findOptionInTree(option.value, modelData.value)
|
|
423
|
+
if (attr.type === 'treeSelect' && result)
|
|
424
|
+
treeValue.value = result.label
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
function updateFile(files, _index) {
|
|
430
|
+
modelData.value = files
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// 表单校验的类型校验
|
|
434
|
+
function formTypeCheck(attr, value) {
|
|
435
|
+
if (mode === '查询' || mode === '预览')
|
|
436
|
+
return
|
|
437
|
+
// if (!attr.rule || !attr.rule.required || attr.rule.required === 'false')
|
|
438
|
+
// return
|
|
439
|
+
switch (attr.rule.type) {
|
|
440
|
+
case 'string':
|
|
441
|
+
if (value.length === 0) {
|
|
442
|
+
errorMessage.value = `请输入${attr.name}`
|
|
443
|
+
return
|
|
444
|
+
}
|
|
445
|
+
break
|
|
446
|
+
case 'number':
|
|
447
|
+
if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(value)) {
|
|
448
|
+
errorMessage.value = `${attr.name}必须为数字`
|
|
449
|
+
return
|
|
450
|
+
}
|
|
451
|
+
break
|
|
452
|
+
case 'boolean':
|
|
453
|
+
case 'array':
|
|
454
|
+
case 'regexp':
|
|
455
|
+
if (value) {
|
|
456
|
+
errorMessage.value = ''
|
|
457
|
+
return
|
|
458
|
+
}
|
|
459
|
+
break
|
|
460
|
+
case 'integer':
|
|
461
|
+
if (!/^-?\d+$/.test(value)) {
|
|
462
|
+
errorMessage.value = `${attr.name}必须为整数`
|
|
463
|
+
return
|
|
464
|
+
}
|
|
465
|
+
break
|
|
466
|
+
case 'float':
|
|
467
|
+
if (!/^-?\d+\.\d+$/.test(value)) {
|
|
468
|
+
errorMessage.value = `${attr.name}必须为小数`
|
|
469
|
+
return
|
|
470
|
+
}
|
|
471
|
+
break
|
|
472
|
+
case 'email':
|
|
473
|
+
if (!/^[\w.%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i.test(value)) {
|
|
474
|
+
errorMessage.value = `请输入正确的邮箱地址`
|
|
475
|
+
return
|
|
476
|
+
}
|
|
477
|
+
break
|
|
478
|
+
case 'idNumber':
|
|
479
|
+
if (!/^(?:\d{15}|\d{17}[0-9X])$/.test(value)) {
|
|
480
|
+
errorMessage.value = `请输入正确的身份证号码`
|
|
481
|
+
return
|
|
482
|
+
}
|
|
483
|
+
break
|
|
484
|
+
case 'userPhone':
|
|
485
|
+
if (!/^1[3-9]\d{9}$/.test(value)) {
|
|
486
|
+
errorMessage.value = `请输入正确的手机号码`
|
|
487
|
+
return
|
|
488
|
+
}
|
|
489
|
+
break
|
|
490
|
+
case 'landlineNumber':
|
|
491
|
+
if (!/^0\d{2,3}[-\s]?\d{7,8}$/.test(value)) {
|
|
492
|
+
errorMessage.value = `请输入正确的座机号码`
|
|
493
|
+
return
|
|
494
|
+
}
|
|
495
|
+
break
|
|
496
|
+
case 'greaterThanZero':
|
|
497
|
+
if (!/^(?:[1-9]\d*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(value)) {
|
|
498
|
+
errorMessage.value = `请输入一个大于0的数字`
|
|
499
|
+
return
|
|
500
|
+
}
|
|
501
|
+
break
|
|
502
|
+
case 'greaterThanOrEqualZero':
|
|
503
|
+
if (!/^(?:\d+|\d*\.\d+)$/.test(value)) {
|
|
504
|
+
errorMessage.value = `请输入一个大于等于0的数字`
|
|
505
|
+
return
|
|
506
|
+
}
|
|
507
|
+
break
|
|
508
|
+
case 'stringLength':
|
|
509
|
+
if (!(value.length >= attr.rule.minLen && value.length < attr.rule.maxLen)) {
|
|
510
|
+
errorMessage.value = `长度必须在${attr.rule.minLen}~${attr.rule.maxLen}之间`
|
|
511
|
+
return
|
|
512
|
+
}
|
|
513
|
+
break
|
|
514
|
+
case 'customJs':
|
|
515
|
+
// eslint-disable-next-line no-case-declarations
|
|
516
|
+
const funcStr = attr.rule.customValidatorFunc
|
|
517
|
+
// 输入的数据是否符合条件
|
|
518
|
+
// eslint-disable-next-line no-case-declarations
|
|
519
|
+
const status = ref(true)
|
|
520
|
+
// 提取函数体部分
|
|
521
|
+
// eslint-disable-next-line no-case-declarations
|
|
522
|
+
const funcBodyMatch = funcStr.match(/function\s*\(.*?\)\s*\{([\s\S]*)\}/)
|
|
523
|
+
if (!funcBodyMatch)
|
|
524
|
+
throw new Error('自定义校验函数不合法')
|
|
525
|
+
// eslint-disable-next-line no-case-declarations
|
|
526
|
+
const funcBody = funcBodyMatch[1].trim() // 提取函数体
|
|
527
|
+
// 使用 new Function 创建函数
|
|
528
|
+
// eslint-disable-next-line no-new-func,no-case-declarations
|
|
529
|
+
const customValidatorFunc = new Function('rule', 'value', 'callback', 'form', 'attr', 'util', funcBody)
|
|
530
|
+
// 定义 callback 函数
|
|
531
|
+
// eslint-disable-next-line no-case-declarations
|
|
532
|
+
const callback = (error) => {
|
|
533
|
+
if (error) {
|
|
534
|
+
errorMessage.value = `${error}`
|
|
535
|
+
status.value = false // 表示有错误发生
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
// 调用自定义校验函数
|
|
539
|
+
customValidatorFunc(
|
|
540
|
+
attr.rule,
|
|
541
|
+
value,
|
|
542
|
+
callback,
|
|
543
|
+
form,
|
|
544
|
+
attr,
|
|
545
|
+
{}, // util 对象(可以根据需要传递)
|
|
546
|
+
)
|
|
547
|
+
if (!status.value)
|
|
548
|
+
return
|
|
549
|
+
break
|
|
550
|
+
default:
|
|
551
|
+
errorMessage.value = ''
|
|
552
|
+
break
|
|
553
|
+
}
|
|
554
|
+
errorMessage.value = ''
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
onBeforeMount(() => {
|
|
558
|
+
init()
|
|
559
|
+
modelData.value = getDefaultValue()
|
|
560
|
+
showFormItemFunc()
|
|
561
|
+
dataChangeFunc()
|
|
562
|
+
if (attr?.keyName?.toString()?.startsWith('search@根据表单项[') && attr?.keyName?.toString().endsWith(']联动人员'))
|
|
563
|
+
debouncedUserLinkFunc = debounce(() => updateResOptions('人员'), 200)
|
|
564
|
+
|
|
565
|
+
if (attr?.keyName?.toString()?.startsWith('search@根据表单项[') && attr?.keyName?.toString().endsWith(']联动部门'))
|
|
566
|
+
debouncedDepLinkFunc = debounce(() => updateResOptions('部门'), 200)
|
|
567
|
+
|
|
568
|
+
if (attr.keyName && (attr?.keyName?.toString().indexOf('async ') !== -1 || attr?.keyName?.toString()?.indexOf('function') !== -1)) {
|
|
569
|
+
debouncedUpdateOptions = debounce(updateOptions, 200)
|
|
570
|
+
}
|
|
571
|
+
})
|
|
572
|
+
// 是否展示表单左侧label文字
|
|
573
|
+
const labelData = computed(() => {
|
|
574
|
+
return props.showLabel ? attr.name : null
|
|
575
|
+
})
|
|
576
|
+
// 是否展示表单左侧label文字
|
|
577
|
+
const labelAlign = computed(() => {
|
|
578
|
+
return attr.labelAlign ? attr.labelAlign : 'left'
|
|
579
|
+
})
|
|
580
|
+
// 是否只读
|
|
581
|
+
const readonly = computed(() => {
|
|
582
|
+
return props.formReadonly || attr.addOrEdit === 'readonly' || mode === '预览' || customizeReadOnly.value
|
|
583
|
+
})
|
|
584
|
+
|
|
585
|
+
// 判断是否显示空提示(只读且值为空)
|
|
586
|
+
const showEmptyTip = computed(() => {
|
|
587
|
+
if ((attr.type === 'image' || attr.type === 'file') && props.formReadonly) {
|
|
588
|
+
const value = modelData.value
|
|
589
|
+
return !value || (Array.isArray(value) && value.length === 0)
|
|
590
|
+
}
|
|
591
|
+
return false
|
|
592
|
+
})
|
|
593
|
+
|
|
594
|
+
// 提示内容
|
|
595
|
+
const placeholder = computed(() => {
|
|
596
|
+
if (attr.addOrEdit === 'readonly' || mode === '预览' || props.formReadonly) {
|
|
597
|
+
// 根据类型返回更具体的空状态提示
|
|
598
|
+
if (attr.type === 'image') {
|
|
599
|
+
return '暂无图片'
|
|
600
|
+
}
|
|
601
|
+
else if (attr.type === 'file') {
|
|
602
|
+
return '暂无文件'
|
|
603
|
+
}
|
|
604
|
+
return '暂无内容'
|
|
605
|
+
}
|
|
606
|
+
else
|
|
607
|
+
if (attr.placeholder) {
|
|
608
|
+
return attr.placeholder
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
switch (attr.type) {
|
|
612
|
+
case 'datePicker':
|
|
613
|
+
case 'timePicker':
|
|
614
|
+
case 'rangePicker':
|
|
615
|
+
case 'radio':
|
|
616
|
+
case 'select':
|
|
617
|
+
case 'treeSelect':
|
|
618
|
+
case 'area':
|
|
619
|
+
case 'citySelect':
|
|
620
|
+
case 'picker':
|
|
621
|
+
return `请选择${attr.name}`
|
|
622
|
+
case 'addressSearch':
|
|
623
|
+
case 'input':
|
|
624
|
+
case 'textarea':
|
|
625
|
+
case 'intervalPicker':
|
|
626
|
+
return `请输入${attr.name}`
|
|
627
|
+
default:
|
|
628
|
+
return `请选择${attr.name}`
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
})
|
|
632
|
+
|
|
633
|
+
const formatDate = date => `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
|
|
634
|
+
|
|
635
|
+
function onCalendarConfirm(values) {
|
|
636
|
+
modelData.value = [formatDate(values[0]), formatDate(values[1])]
|
|
637
|
+
pickerValue.value = `${formatDate(values[0])} ~ ${formatDate(values[1])}`
|
|
638
|
+
calendarShow.value = false
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// js 函数作为数据源
|
|
642
|
+
async function updateOptions() {
|
|
643
|
+
if (attr.keyName && (attr.keyName.toString().includes('async ') || attr.keyName.toString().includes('function '))) {
|
|
644
|
+
option.value = await executeStrFunctionByContext(currInst, attr.keyName, [props.form, runLogic, props.mode, getConfigByNameAsync, post, userState.f.resources])
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function init() {
|
|
649
|
+
if (attr.keyName && typeof attr.keyName === 'string') {
|
|
650
|
+
if (attr.keyName && attr.keyName.includes('logic@')) {
|
|
651
|
+
getData({}, (res) => {
|
|
652
|
+
option.value = res
|
|
653
|
+
initRadioValue()
|
|
654
|
+
})
|
|
655
|
+
}
|
|
656
|
+
else if (attr.keyName && attr.keyName.includes('config@')) {
|
|
657
|
+
const configName = attr.keyName.substring(7)
|
|
658
|
+
getDict(configName, (result) => {
|
|
659
|
+
if (result)
|
|
660
|
+
option.value = result
|
|
661
|
+
}, serviceName)
|
|
662
|
+
}
|
|
663
|
+
else if (attr.keyName && attr.keyName.includes('search@')) {
|
|
664
|
+
let source = attr.keyName.substring(7)
|
|
665
|
+
const userid = currUser.value
|
|
666
|
+
let roleName = 'roleName'
|
|
667
|
+
if (source.startsWith('根据角色[') && source.endsWith(']获取人员')) {
|
|
668
|
+
const startIndex = source.indexOf('[') + 1
|
|
669
|
+
const endIndex = source.indexOf(']', startIndex)
|
|
670
|
+
roleName = source.substring(startIndex, endIndex)
|
|
671
|
+
source = '根据角色获取人员'
|
|
672
|
+
}
|
|
673
|
+
const searchData = { source, userid, roleName }
|
|
674
|
+
if (source.startsWith('根据表单项[') && source.endsWith(']联动人员'))
|
|
675
|
+
updateResOptions('人员')
|
|
676
|
+
else if (source.startsWith('根据表单项[') && source.endsWith(']联动部门'))
|
|
677
|
+
updateResOptions('部门')
|
|
678
|
+
else if (attr.type === 'select' || attr.type === 'checkbox')
|
|
679
|
+
searchToListOption(searchData, res => getDataCallback(res))
|
|
680
|
+
else
|
|
681
|
+
searchToOption(searchData, res => getDataCallback(res))
|
|
682
|
+
}
|
|
683
|
+
else if (attr.keyName.toString().includes('async ') || attr.keyName.toString().includes('function ')) {
|
|
684
|
+
updateOptions()
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
initRadioValue()
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function getDataCallback(res) {
|
|
693
|
+
option.value = res
|
|
694
|
+
if (attr.type === 'radio')
|
|
695
|
+
initRadioValue()
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
async function updateResOptions(type) {
|
|
699
|
+
if (attr?.keyName?.toString()?.startsWith('search@根据表单项[') && attr?.keyName?.toString()?.endsWith(`]联动${type}`)) {
|
|
700
|
+
const searchData = { source: `获取${type}`, userid: currUser.value }
|
|
701
|
+
const startIndex = attr.keyName.indexOf('[') + 1
|
|
702
|
+
const endIndex = attr.keyName.indexOf(']', startIndex)
|
|
703
|
+
const formModel = attr.keyName.substring(startIndex, endIndex).replace('.', '_')
|
|
704
|
+
const formModelData = form[formModel]
|
|
705
|
+
if (formModel?.length && formModelData?.length) {
|
|
706
|
+
await searchToListOption(searchData, (res) => {
|
|
707
|
+
getDataCallback(res.filter((h) => {
|
|
708
|
+
return formModelData['0'] === h.f_organization_id || formModelData['0'] === h.f_department_id || formModelData['0'] === h.parentid
|
|
709
|
+
// if (formModel.indexOf('org') > -1) {
|
|
710
|
+
// return formModelData?.includes(h.orgid || h.f_organization_id || h.parentid)
|
|
711
|
+
// } else {
|
|
712
|
+
// return formModelData?.includes(h?.parentid)
|
|
713
|
+
// }
|
|
714
|
+
}))
|
|
715
|
+
})
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function initRadioValue() {
|
|
721
|
+
if ((mode === '新增' || mode === '修改') && attr.type === 'radio' && !props.modelValue) {
|
|
722
|
+
if (attr.keys && attr.keys.length > 0)
|
|
723
|
+
modelData.value = attr.keys[0].value
|
|
724
|
+
else if (option.value && option.value.length > 0)
|
|
725
|
+
modelData.value = option.value[0].value
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function getData(value, callback) {
|
|
730
|
+
if (value !== '') {
|
|
731
|
+
const logicName = attr.keyName
|
|
732
|
+
const logic = logicName.substring(6)
|
|
733
|
+
// 调用logic前设置参数
|
|
734
|
+
if (getDataParams && getDataParams[attr.model])
|
|
735
|
+
Object.assign(value, getDataParams[attr.model])
|
|
736
|
+
Object.assign(value, userInfo.value)
|
|
737
|
+
runLogic(logic, value, serviceName).then((res) => {
|
|
738
|
+
callback(res)
|
|
739
|
+
})
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// 已废弃 不进行维护
|
|
744
|
+
function onPickerConfirm({ selectedOptions }) {
|
|
745
|
+
showPicker.value = false
|
|
746
|
+
modelData.value = selectedOptions[0].text
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
// 日期时间选择数据
|
|
750
|
+
const dateTimePickerValue = ref<any>({})
|
|
751
|
+
// 展示日期时间选择器:根据 formValueFormat 初始化 VanDatePicker/VanTimePicker 的当前值
|
|
752
|
+
// 规则:
|
|
753
|
+
// - 若已有字符串值,按 formValueFormat 解析并拆分为日期/时间数组
|
|
754
|
+
// - 若无值,按当前时间生成匹配格式的默认数组
|
|
755
|
+
function showDataTimePicker() {
|
|
756
|
+
if (props.modelValue && typeof props.modelValue === 'string') {
|
|
757
|
+
const base = dayjs(props.modelValue as string, formValueFormat.value)
|
|
758
|
+
const dateArr: string[] = []
|
|
759
|
+
dateArr.push(base.format('YYYY'))
|
|
760
|
+
if (dateColumnsType.value.includes('month'))
|
|
761
|
+
dateArr.push(base.format('MM'))
|
|
762
|
+
if (dateColumnsType.value.includes('day'))
|
|
763
|
+
dateArr.push(base.format('DD'))
|
|
764
|
+
const timeArr: string[] = []
|
|
765
|
+
if (hasTime.value) {
|
|
766
|
+
if (timeColumnsType.value.includes('hour'))
|
|
767
|
+
timeArr.push(base.format('HH'))
|
|
768
|
+
if (timeColumnsType.value.includes('minute'))
|
|
769
|
+
timeArr.push(base.format('mm'))
|
|
770
|
+
if (timeColumnsType.value.includes('second'))
|
|
771
|
+
timeArr.push(base.format('ss'))
|
|
772
|
+
}
|
|
773
|
+
dateTimePickerValue.value = {
|
|
774
|
+
date: dateArr,
|
|
775
|
+
time: timeArr.length ? timeArr : ['00', '00', '00'].slice(0, timeColumnsType.value.length),
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
const now = dayjs()
|
|
780
|
+
const dateArr: string[] = []
|
|
781
|
+
dateArr.push(now.format('YYYY'))
|
|
782
|
+
if (dateColumnsType.value.includes('month'))
|
|
783
|
+
dateArr.push(now.format('MM'))
|
|
784
|
+
if (dateColumnsType.value.includes('day'))
|
|
785
|
+
dateArr.push(now.format('DD'))
|
|
786
|
+
const timeArr: string[] = []
|
|
787
|
+
if (hasTime.value) {
|
|
788
|
+
if (timeColumnsType.value.includes('hour'))
|
|
789
|
+
timeArr.push(now.format('HH'))
|
|
790
|
+
if (timeColumnsType.value.includes('minute'))
|
|
791
|
+
timeArr.push(now.format('mm'))
|
|
792
|
+
if (timeColumnsType.value.includes('second'))
|
|
793
|
+
timeArr.push(now.format('ss'))
|
|
794
|
+
}
|
|
795
|
+
dateTimePickerValue.value = {
|
|
796
|
+
date: dateArr,
|
|
797
|
+
time: timeArr.length ? timeArr : ['00', '00', '00'].slice(0, timeColumnsType.value.length),
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
showDatePicker.value = true
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function onDatePickerConfirm({ selectedValues }) {
|
|
804
|
+
showDatePicker.value = false
|
|
805
|
+
modelData.value = selectedValues.join('-')
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// 已废弃 不进行维护
|
|
809
|
+
function onTimePickerConfirm({ selectedValues }) {
|
|
810
|
+
showTimePicker.value = false
|
|
811
|
+
timePickerValue.value = selectedValues.join(':')
|
|
812
|
+
modelData.value = timePickerValue.value
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// 没人用到本次先不动。后续需要看这个组件需要怎么使用
|
|
816
|
+
function onAreaConfirm({ selectedOptions }) {
|
|
817
|
+
area.value = `${selectedOptions[0].text}-${selectedOptions[1].text}-${selectedOptions[2].text}`
|
|
818
|
+
showArea.value = false
|
|
819
|
+
modelData.value = [{
|
|
820
|
+
province: selectedOptions[0].text,
|
|
821
|
+
city: selectedOptions[1].text,
|
|
822
|
+
district: selectedOptions[2].text,
|
|
823
|
+
}]
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// 日期时间选择确认:将选择的年月日(+时分秒)拼装后,最终使用 formValueFormat 输出到 v-model
|
|
827
|
+
function onDateTimePickerConfirm() {
|
|
828
|
+
showDatePicker.value = false
|
|
829
|
+
const dateParts = dateTimePickerValue.value.date as string[]
|
|
830
|
+
const timeParts = (dateTimePickerValue.value.time as string[]) || []
|
|
831
|
+
const year = dateParts[0]
|
|
832
|
+
const month = dateParts[1] || '01'
|
|
833
|
+
const day = dateParts[2] || '01'
|
|
834
|
+
const hour = hasTime.value && timeParts[0] ? timeParts[0] : '00'
|
|
835
|
+
const minute = hasTime.value && timeParts[1] ? timeParts[1] : '00'
|
|
836
|
+
const second = hasTime.value && timeParts[2] ? timeParts[2] : '00'
|
|
837
|
+
const full = `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
|
838
|
+
modelData.value = dayjs(full, 'YYYY-MM-DD HH:mm:ss').format(formValueFormat.value)
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function onPickerCancel() {
|
|
842
|
+
showDatePicker.value = false
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const showAddressPicker = ref(false)
|
|
846
|
+
const addressValue = ref('')
|
|
847
|
+
|
|
848
|
+
// XLocationPicker 默认加载的中心点
|
|
849
|
+
const defaultMapCenter = computed(() => {
|
|
850
|
+
const lonLat = form[`${attr.model}_lon_lat`]
|
|
851
|
+
if (lonLat && typeof lonLat === 'string' && lonLat.includes(',')) {
|
|
852
|
+
const [lon, lat] = lonLat.split(',').map(Number)
|
|
853
|
+
if (!Number.isNaN(lon) && !Number.isNaN(lat)) {
|
|
854
|
+
return [lon, lat] as [number, number]
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return undefined
|
|
858
|
+
})
|
|
859
|
+
|
|
860
|
+
// 处理地址选择器确认
|
|
861
|
+
function handleAddressConfirm(location) {
|
|
862
|
+
// 构造新的数据格式
|
|
863
|
+
const formData = {
|
|
864
|
+
[`${attr.model}_lon_lat`]: `${location.longitude},${location.latitude}`,
|
|
865
|
+
[attr.model]: location.address,
|
|
866
|
+
}
|
|
867
|
+
// 更新表单数据
|
|
868
|
+
emits('setForm', formData)
|
|
869
|
+
showAddressPicker.value = false
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// 重置方法,供父组件调用
|
|
873
|
+
function reset() {
|
|
874
|
+
modelData.value = getDefaultValue()
|
|
875
|
+
errorMessage.value = ''
|
|
876
|
+
treeValue.value = null
|
|
877
|
+
area.value = null
|
|
878
|
+
pickerValue.value = null
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
defineExpose({
|
|
882
|
+
reset,
|
|
883
|
+
})
|
|
884
|
+
|
|
885
|
+
// 数据处理
|
|
886
|
+
function cleanEmptyChildren(options, fieldNames = { text: 'label', value: 'value', children: 'children' }) {
|
|
887
|
+
if (!Array.isArray(options))
|
|
888
|
+
return options
|
|
889
|
+
|
|
890
|
+
const childrenKey = fieldNames.children || 'children'
|
|
891
|
+
|
|
892
|
+
return options.map((option) => {
|
|
893
|
+
// 深拷贝选项,避免修改原始数据
|
|
894
|
+
const newOption = { ...option }
|
|
895
|
+
|
|
896
|
+
// 如果存在children属性且是空数组
|
|
897
|
+
if (newOption[childrenKey] && Array.isArray(newOption[childrenKey]) && newOption[childrenKey].length === 0) {
|
|
898
|
+
delete newOption[childrenKey]
|
|
899
|
+
}
|
|
900
|
+
// 如果存在children属性且非空,则递归处理
|
|
901
|
+
else if (newOption[childrenKey] && Array.isArray(newOption[childrenKey])) {
|
|
902
|
+
newOption[childrenKey] = cleanEmptyChildren(newOption[childrenKey], fieldNames)
|
|
903
|
+
}
|
|
904
|
+
return newOption
|
|
905
|
+
})
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// 级联选择完成事件
|
|
909
|
+
function onTreeSelectFinish({ selectedOptions }) {
|
|
910
|
+
const index = selectedOptions.length - 1
|
|
911
|
+
treeValue.value = selectedOptions[index].label
|
|
912
|
+
if (mode === '查询') {
|
|
913
|
+
modelData.value = [selectedOptions[index].value]
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
modelData.value = selectedOptions[index].value
|
|
917
|
+
}
|
|
918
|
+
showTreeSelect.value = false
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function emitFunc(func, data) {
|
|
922
|
+
emits('xFormItemEmitFunc', func, data, data?.model ? form[data.model] : form)
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
function findOptionInTree(options, value) {
|
|
926
|
+
// 在当前层级查找
|
|
927
|
+
const foundItem = options.find(item => item[columnsField.value] === value)
|
|
928
|
+
if (foundItem) {
|
|
929
|
+
return foundItem
|
|
930
|
+
}
|
|
931
|
+
// 递归查找子级
|
|
932
|
+
for (const item of options) {
|
|
933
|
+
if (item.children?.length) {
|
|
934
|
+
const foundInChildren = findOptionInTree(item.children, value)
|
|
935
|
+
if (foundInChildren)
|
|
936
|
+
return foundInChildren
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
return null
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// 懒加载搜索函数
|
|
944
|
+
async function handleLazySearch(searchText: string) {
|
|
945
|
+
if (!attr.keyName || typeof attr.keyName !== 'string') {
|
|
946
|
+
return []
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
try {
|
|
950
|
+
// 如果是 search@ 类型的数据源
|
|
951
|
+
if (attr.keyName.includes('search@')) {
|
|
952
|
+
let source = attr.keyName.substring(7)
|
|
953
|
+
const userid = currUser.value
|
|
954
|
+
let roleName = 'roleName'
|
|
955
|
+
|
|
956
|
+
if (source.startsWith('根据角色[') && source.endsWith(']获取人员')) {
|
|
957
|
+
const startIndex = source.indexOf('[') + 1
|
|
958
|
+
const endIndex = source.indexOf(']', startIndex)
|
|
959
|
+
roleName = source.substring(startIndex, endIndex)
|
|
960
|
+
source = '根据角色获取人员'
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const searchData = {
|
|
964
|
+
source,
|
|
965
|
+
userid,
|
|
966
|
+
roleName,
|
|
967
|
+
searchText, // 添加搜索关键词
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
return new Promise((resolve) => {
|
|
971
|
+
if (attr.type === 'select' || attr.type === 'checkbox') {
|
|
972
|
+
searchToListOption(searchData, (res) => {
|
|
973
|
+
// 根据搜索关键词过滤结果
|
|
974
|
+
const filtered = res.filter((item) => {
|
|
975
|
+
const text = item[columnsField.value.text] || item.label || ''
|
|
976
|
+
return text.toString().toLowerCase().includes(searchText.toLowerCase())
|
|
977
|
+
})
|
|
978
|
+
resolve(filtered)
|
|
979
|
+
})
|
|
980
|
+
}
|
|
981
|
+
else {
|
|
982
|
+
searchToOption(searchData, (res) => {
|
|
983
|
+
const filtered = res.filter((item) => {
|
|
984
|
+
const text = item[columnsField.value.text] || item.label || ''
|
|
985
|
+
return text.toString().toLowerCase().includes(searchText.toLowerCase())
|
|
986
|
+
})
|
|
987
|
+
resolve(filtered)
|
|
988
|
+
})
|
|
989
|
+
}
|
|
990
|
+
})
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// logic 数据源
|
|
994
|
+
if (attr.keyName.includes('logic@')) {
|
|
995
|
+
const logicName = attr.keyName.substring(6)
|
|
996
|
+
const value = { word: searchText, ...userInfo.value }
|
|
997
|
+
|
|
998
|
+
// 调用logic前设置参数
|
|
999
|
+
if (getDataParams && getDataParams[attr.model]) {
|
|
1000
|
+
Object.assign(value, getDataParams[attr.model])
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
lastFetchId.value++
|
|
1004
|
+
const fetchId = lastFetchId.value
|
|
1005
|
+
// 根据搜索关键词过滤结果
|
|
1006
|
+
const results = await runLogic(logicName, value, serviceName) as any
|
|
1007
|
+
if (fetchId !== lastFetchId.value) {
|
|
1008
|
+
return
|
|
1009
|
+
}
|
|
1010
|
+
if (searchText) {
|
|
1011
|
+
return results.filter((item) => {
|
|
1012
|
+
const text = item[columnsField.value.text] || item.label || ''
|
|
1013
|
+
return text.toString().toLowerCase().includes(searchText.toLowerCase())
|
|
1014
|
+
})
|
|
1015
|
+
}
|
|
1016
|
+
return results
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// 自定义 js 函数
|
|
1020
|
+
if (attr.keyName.includes('async ') || attr.keyName.includes('function ')) {
|
|
1021
|
+
const results = await executeStrFunctionByContext(currInst, attr.keyName, [
|
|
1022
|
+
{ ...props.form, searchText },
|
|
1023
|
+
runLogic,
|
|
1024
|
+
props.mode,
|
|
1025
|
+
getConfigByNameAsync,
|
|
1026
|
+
post,
|
|
1027
|
+
userState,
|
|
1028
|
+
])
|
|
1029
|
+
// 根据搜索关键词过滤结果
|
|
1030
|
+
return results.filter((item) => {
|
|
1031
|
+
const text = item[columnsField.value.text] || item.label || ''
|
|
1032
|
+
return text.toString().toLowerCase().includes(searchText.toLowerCase())
|
|
1033
|
+
})
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
return []
|
|
1037
|
+
}
|
|
1038
|
+
catch (error) {
|
|
1039
|
+
console.error('懒加载搜索失败:', error)
|
|
1040
|
+
return []
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// 扫码/NFC
|
|
1045
|
+
function scanCodeOrNfc(attr) {
|
|
1046
|
+
if (attr.type === 'scanCode') {
|
|
1047
|
+
// 扫码逻辑
|
|
1048
|
+
mobileUtil.execute({
|
|
1049
|
+
funcName: 'scanBarcode',
|
|
1050
|
+
param: {},
|
|
1051
|
+
callbackFunc: (res: any) => {
|
|
1052
|
+
console.log('扫码结果:------', res)
|
|
1053
|
+
if (res && res.status === 'success') {
|
|
1054
|
+
if (res.data.status && res.data.status === 'cancelled') {
|
|
1055
|
+
showToast(res.data?.message || '扫码已取消')
|
|
1056
|
+
return
|
|
1057
|
+
}
|
|
1058
|
+
modelData.value = res.data?.rawValue
|
|
1059
|
+
showToast('扫码成功')
|
|
1060
|
+
emitFunc('xFormItemEmitFunc', res)
|
|
1061
|
+
}
|
|
1062
|
+
else {
|
|
1063
|
+
showToast('扫码失败')
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
})
|
|
1067
|
+
}
|
|
1068
|
+
else if (attr.type === 'nfc') {
|
|
1069
|
+
// NFC逻辑
|
|
1070
|
+
mobileUtil.execute({
|
|
1071
|
+
funcName: 'startNfcScan',
|
|
1072
|
+
param: {},
|
|
1073
|
+
callbackFunc: (res: any) => {
|
|
1074
|
+
console.log('nfc结果:------', res)
|
|
1075
|
+
if (res && res.status === 'success') {
|
|
1076
|
+
modelData.value = res.data?.id
|
|
1077
|
+
showToast('NFC 检测成功')
|
|
1078
|
+
emitFunc('xFormItemEmitFunc', res)
|
|
1079
|
+
}
|
|
1080
|
+
else {
|
|
1081
|
+
showToast(res?.message || 'NFC 功能不可用')
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
})
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
</script>
|
|
1088
|
+
|
|
1089
|
+
<template>
|
|
1090
|
+
<div>
|
|
1091
|
+
<!-- switch开关 -->
|
|
1092
|
+
<VanField
|
|
1093
|
+
v-if="attr.type === 'switch' && showItem"
|
|
1094
|
+
name="switch"
|
|
1095
|
+
:label="labelData"
|
|
1096
|
+
:label-align="labelAlign"
|
|
1097
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'right'"
|
|
1098
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1099
|
+
:required="attr.rule.required === 'true'"
|
|
1100
|
+
>
|
|
1101
|
+
<template #input>
|
|
1102
|
+
<VanSwitch v-model="modelData" />
|
|
1103
|
+
</template>
|
|
1104
|
+
</VanField>
|
|
1105
|
+
|
|
1106
|
+
<!-- 复选框 -->
|
|
1107
|
+
<!-- <VanField
|
|
1108
|
+
v-if="attr.type === 'checkbox'"
|
|
1109
|
+
name="checkbox"
|
|
1110
|
+
:label="labelData"
|
|
1111
|
+
>
|
|
1112
|
+
<template #input>
|
|
1113
|
+
<VanCheckbox v-model="modelData" shape="square" />
|
|
1114
|
+
</template>
|
|
1115
|
+
</VanField> -->
|
|
1116
|
+
|
|
1117
|
+
<!-- 多选框-checkbox-复选框组 -->
|
|
1118
|
+
<template v-if="attr.type === 'checkbox' && showItem">
|
|
1119
|
+
<!-- 勾选 -->
|
|
1120
|
+
<VanField
|
|
1121
|
+
v-if="attr.showMode === 'checkbox' && mode !== '查询'"
|
|
1122
|
+
name="checkboxGroup"
|
|
1123
|
+
:label="labelData"
|
|
1124
|
+
:label-align="labelAlign"
|
|
1125
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1126
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1127
|
+
:required="attr.rule.required === 'true'"
|
|
1128
|
+
>
|
|
1129
|
+
<template #input>
|
|
1130
|
+
<van-checkbox-group v-model="modelData as any[]" direction="horizontal" shape="square" :disabled="readonly">
|
|
1131
|
+
<VanCheckbox v-for="(item, index) in option" :key="index" style="padding: 2px" :name="item[columnsField.value]" :shape="rules?.[attr.model].shape" :value="item[columnsField.value]">
|
|
1132
|
+
{{ item[columnsField.text] }}
|
|
1133
|
+
</VanCheckbox>
|
|
1134
|
+
</van-checkbox-group>
|
|
1135
|
+
</template>
|
|
1136
|
+
</VanField>
|
|
1137
|
+
<VanField
|
|
1138
|
+
v-if="attr.showMode === 'checkbox' && mode === '查询'"
|
|
1139
|
+
name="checkboxGroup"
|
|
1140
|
+
:label="labelData"
|
|
1141
|
+
:label-align="labelAlign"
|
|
1142
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1143
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1144
|
+
>
|
|
1145
|
+
<template #input>
|
|
1146
|
+
<XGridDropOption
|
|
1147
|
+
v-model="(modelData as string[])"
|
|
1148
|
+
:column-num="labelData ? 3 : 4"
|
|
1149
|
+
:multiple="true"
|
|
1150
|
+
:columns="option"
|
|
1151
|
+
/>
|
|
1152
|
+
</template>
|
|
1153
|
+
</VanField>
|
|
1154
|
+
<!-- 下拉 -->
|
|
1155
|
+
<XMultiSelect
|
|
1156
|
+
v-if="(!attr.showMode || attr.showMode === 'select') && mode === '查询'"
|
|
1157
|
+
v-model="modelData"
|
|
1158
|
+
:label="labelData"
|
|
1159
|
+
:readonly="readonly"
|
|
1160
|
+
:placeholder="placeholder"
|
|
1161
|
+
:columns="option"
|
|
1162
|
+
:select-value="Array.isArray(modelData) ? modelData : []"
|
|
1163
|
+
:option="attr.option ? attr.option : columnsField"
|
|
1164
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1165
|
+
:required="attr.rule.required === 'true'"
|
|
1166
|
+
:lazy-load="attr.lazyLoad"
|
|
1167
|
+
:on-search="attr.lazyLoad ? handleLazySearch : null"
|
|
1168
|
+
/>
|
|
1169
|
+
</template>
|
|
1170
|
+
|
|
1171
|
+
<!-- 单选框 -->
|
|
1172
|
+
<VanField
|
|
1173
|
+
v-if="attr.type === 'radio' && mode !== '查询' && showItem"
|
|
1174
|
+
name="radio"
|
|
1175
|
+
center
|
|
1176
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1177
|
+
:label="labelData"
|
|
1178
|
+
:label-align="labelAlign"
|
|
1179
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1180
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1181
|
+
:required="attr.rule.required === 'true'"
|
|
1182
|
+
>
|
|
1183
|
+
<template #input>
|
|
1184
|
+
<VanRadioGroup v-model="modelData" direction="horizontal" :disabled="readonly">
|
|
1185
|
+
<VanRadio v-for="(item, index) in option" :key="index" style="padding: 2px" :name="item[columnsField.value]" :value="item[columnsField.value]">
|
|
1186
|
+
{{ item[columnsField.text] }}
|
|
1187
|
+
</VanRadio>
|
|
1188
|
+
</VanRadioGroup>
|
|
1189
|
+
</template>
|
|
1190
|
+
</VanField>
|
|
1191
|
+
|
|
1192
|
+
<!-- 单选框-查询 -->
|
|
1193
|
+
<VanField
|
|
1194
|
+
v-if="attr.type === 'radio' && mode === '查询' && showItem"
|
|
1195
|
+
name="radio"
|
|
1196
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1197
|
+
:label="labelData"
|
|
1198
|
+
:label-align="labelAlign"
|
|
1199
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1200
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1201
|
+
>
|
|
1202
|
+
<template #input>
|
|
1203
|
+
<XGridDropOption
|
|
1204
|
+
v-model="(modelData as string)"
|
|
1205
|
+
:column-num="labelData ? 3 : 4"
|
|
1206
|
+
:columns="option"
|
|
1207
|
+
/>
|
|
1208
|
+
</template>
|
|
1209
|
+
</VanField>
|
|
1210
|
+
|
|
1211
|
+
<!-- 步进器 -->
|
|
1212
|
+
<VanField
|
|
1213
|
+
v-if="attr.type === 'stepper' && showItem"
|
|
1214
|
+
name="stepper"
|
|
1215
|
+
:label="labelData"
|
|
1216
|
+
:label-align="labelAlign"
|
|
1217
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'center'"
|
|
1218
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1219
|
+
:required="attr.rule.required === 'true'"
|
|
1220
|
+
>
|
|
1221
|
+
<template #input>
|
|
1222
|
+
<VanStepper v-model="modelData as any" :disabled="readonly" />
|
|
1223
|
+
</template>
|
|
1224
|
+
</VanField>
|
|
1225
|
+
|
|
1226
|
+
<!-- 评分 -->
|
|
1227
|
+
<VanField
|
|
1228
|
+
v-if="attr.type === 'rate' && showItem"
|
|
1229
|
+
name="rate"
|
|
1230
|
+
:label="labelData"
|
|
1231
|
+
:label-align="labelAlign"
|
|
1232
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'center'"
|
|
1233
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1234
|
+
:required="attr.rule.required === 'true'"
|
|
1235
|
+
>
|
|
1236
|
+
<template #input>
|
|
1237
|
+
<VanRate v-model="modelData as number" :size="25" :count="attr.displayCount || 5" :readonly="readonly" void-color="#eee" void-icon="star" color="#ffd21e" />
|
|
1238
|
+
</template>
|
|
1239
|
+
</VanField>
|
|
1240
|
+
|
|
1241
|
+
<!-- 滑块 -->
|
|
1242
|
+
<VanField
|
|
1243
|
+
v-if="attr.type === 'slider' && showItem"
|
|
1244
|
+
name="slider"
|
|
1245
|
+
:label="labelData"
|
|
1246
|
+
:label-align="labelAlign"
|
|
1247
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1248
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1249
|
+
:required="attr.rule.required === 'true'"
|
|
1250
|
+
>
|
|
1251
|
+
<template #input>
|
|
1252
|
+
<VanSlider v-model="modelData as number" :readonly="readonly" />
|
|
1253
|
+
</template>
|
|
1254
|
+
</VanField>
|
|
1255
|
+
|
|
1256
|
+
<!-- 文件上传 -->
|
|
1257
|
+
<!-- 图片上传, 手机端拍照 -->
|
|
1258
|
+
<VanField
|
|
1259
|
+
v-if="(attr.type === 'image' || attr.type === 'file') && showItem"
|
|
1260
|
+
name="image"
|
|
1261
|
+
:label="labelData"
|
|
1262
|
+
center
|
|
1263
|
+
:label-align="labelAlign"
|
|
1264
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1265
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1266
|
+
:required="attr.rule.required === 'true'"
|
|
1267
|
+
>
|
|
1268
|
+
<template #input>
|
|
1269
|
+
<!-- 只读且为空时显示空提示 -->
|
|
1270
|
+
<div v-if="showEmptyTip" class="empty-tip">
|
|
1271
|
+
{{ placeholder }}
|
|
1272
|
+
</div>
|
|
1273
|
+
<!-- 有值或非只读时显示上传组件 -->
|
|
1274
|
+
<ImageUploader
|
|
1275
|
+
v-else
|
|
1276
|
+
upload-mode="server"
|
|
1277
|
+
:image-list="(modelData as any[])"
|
|
1278
|
+
authority="admin"
|
|
1279
|
+
:attr="attr"
|
|
1280
|
+
:mode="props.mode"
|
|
1281
|
+
:readonly="readonly"
|
|
1282
|
+
:is-async-upload="isAsyncUpload"
|
|
1283
|
+
@update-file-list="updateFile"
|
|
1284
|
+
/>
|
|
1285
|
+
</template>
|
|
1286
|
+
</VanField>
|
|
1287
|
+
|
|
1288
|
+
<!-- 选择器 琉璃中不存在,不进行维护后续将删除 -->
|
|
1289
|
+
<VanField
|
|
1290
|
+
v-if="attr.type === 'picker' && showItem"
|
|
1291
|
+
v-model="pickerValue"
|
|
1292
|
+
name="picker"
|
|
1293
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1294
|
+
:label="labelData"
|
|
1295
|
+
:label-align="labelAlign"
|
|
1296
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1297
|
+
readonly
|
|
1298
|
+
is-link
|
|
1299
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1300
|
+
@click="readonly ? null : showPicker = true"
|
|
1301
|
+
/>
|
|
1302
|
+
<VanPopup v-model:show="showPicker" round position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1303
|
+
<VanPicker
|
|
1304
|
+
v-model="(modelData as Numeric[])"
|
|
1305
|
+
:title="attr.name"
|
|
1306
|
+
:columns="attr.selectKey"
|
|
1307
|
+
:readonly="readonly"
|
|
1308
|
+
:columns-field-names="attr.customFieldName ? attr.customFieldName : { text: 'text', value: 'value', children: 'children' }"
|
|
1309
|
+
:confirm-button-text="attr.confirmButtonText || attr.confirmButtonText === '' ? attr.confirmButtonText : '确认'"
|
|
1310
|
+
:cancel-button-text="attr.cancelButtonText || attr.cancelButtonText === '' ? attr.cancelButtonText : '取消'"
|
|
1311
|
+
@cancel="showPicker = false"
|
|
1312
|
+
@confirm="onPickerConfirm"
|
|
1313
|
+
/>
|
|
1314
|
+
</VanPopup>
|
|
1315
|
+
|
|
1316
|
+
<!-- 日历选择-查询 -->
|
|
1317
|
+
<VanField
|
|
1318
|
+
v-if="attr.type === 'rangePicker' && mode === '查询' && showItem"
|
|
1319
|
+
v-model="(pickerValue as string | number)"
|
|
1320
|
+
is-link
|
|
1321
|
+
readonly
|
|
1322
|
+
name="rangePicker"
|
|
1323
|
+
:label="labelData"
|
|
1324
|
+
:label-align="labelAlign"
|
|
1325
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1326
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1327
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1328
|
+
@click="calendarShow = true"
|
|
1329
|
+
/>
|
|
1330
|
+
<VanCalendar
|
|
1331
|
+
v-model:show="calendarShow"
|
|
1332
|
+
switch-mode="year-month"
|
|
1333
|
+
type="range"
|
|
1334
|
+
teleport="body"
|
|
1335
|
+
overlay-class="date-picker-overlay"
|
|
1336
|
+
:show-confirm="attr.showConfirm"
|
|
1337
|
+
@confirm="onCalendarConfirm"
|
|
1338
|
+
/>
|
|
1339
|
+
|
|
1340
|
+
<!-- 日期选择-非查询 -->
|
|
1341
|
+
<VanField
|
|
1342
|
+
v-if="(attr.type === 'datePicker' || attr.type === 'rangePicker') && mode !== '查询' && showItem"
|
|
1343
|
+
v-model="(modelData as string | number)"
|
|
1344
|
+
name="datePicker"
|
|
1345
|
+
:label="labelData"
|
|
1346
|
+
:label-align="labelAlign"
|
|
1347
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1348
|
+
readonly
|
|
1349
|
+
:is-link="true"
|
|
1350
|
+
:placeholder="placeholder"
|
|
1351
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1352
|
+
:required="attr.rule.required === 'true'"
|
|
1353
|
+
@click="readonly ? null : showDataTimePicker()"
|
|
1354
|
+
/>
|
|
1355
|
+
<VanPopup v-model:show="showDatePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1356
|
+
<VanPickerGroup
|
|
1357
|
+
:title="attr.name"
|
|
1358
|
+
:tabs="hasTime ? ['选择日期', '选择时间'] : ['选择日期']"
|
|
1359
|
+
next-step-text="下一步"
|
|
1360
|
+
:confirm-button-text="attr.confirmButtonText ? attr.confirmButtonText : '确认'"
|
|
1361
|
+
:cancel-button-text="attr.cancelButtonText ? attr.cancelButtonText : '取消'"
|
|
1362
|
+
@confirm="onDateTimePickerConfirm"
|
|
1363
|
+
@cancel="onPickerCancel"
|
|
1364
|
+
>
|
|
1365
|
+
<VanDatePicker
|
|
1366
|
+
v-model="dateTimePickerValue.date"
|
|
1367
|
+
:columns-type="attr.dateColumnsType || dateColumnsType"
|
|
1368
|
+
/>
|
|
1369
|
+
<VanTimePicker
|
|
1370
|
+
v-if="hasTime"
|
|
1371
|
+
v-model="dateTimePickerValue.time"
|
|
1372
|
+
:columns-type="attr.timeColumnsType || timeColumnsType"
|
|
1373
|
+
:min-time="attr.minTime ? attr.minTime : '00:00:00'"
|
|
1374
|
+
:max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
|
|
1375
|
+
/>
|
|
1376
|
+
</VanPickerGroup>
|
|
1377
|
+
</VanPopup>
|
|
1378
|
+
|
|
1379
|
+
<!-- 日期选择-查询 -->
|
|
1380
|
+
<VanField
|
|
1381
|
+
v-if="attr.type === 'datePicker' && mode === '查询' && showItem"
|
|
1382
|
+
v-model="(modelData as string | number)"
|
|
1383
|
+
name="datePicker"
|
|
1384
|
+
:label="labelData"
|
|
1385
|
+
:label-align="labelAlign"
|
|
1386
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1387
|
+
readonly
|
|
1388
|
+
:is-link="true"
|
|
1389
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1390
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1391
|
+
@click="readonly ? null : showDataTimePicker()"
|
|
1392
|
+
/>
|
|
1393
|
+
<VanPopup v-model:show="showDatePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1394
|
+
<VanPickerGroup
|
|
1395
|
+
:title="attr.name"
|
|
1396
|
+
:tabs="hasTime ? ['选择日期', '选择时间'] : ['选择日期']"
|
|
1397
|
+
next-step-text="下一步"
|
|
1398
|
+
:confirm-button-text="attr.confirmButtonText ? attr.confirmButtonText : '确认'"
|
|
1399
|
+
:cancel-button-text="attr.cancelButtonText ? attr.cancelButtonText : '取消'"
|
|
1400
|
+
@confirm="onDateTimePickerConfirm"
|
|
1401
|
+
@cancel="onPickerCancel"
|
|
1402
|
+
>
|
|
1403
|
+
<VanDatePicker
|
|
1404
|
+
v-model="dateTimePickerValue.date"
|
|
1405
|
+
:columns-type="attr.dateColumnsType || dateColumnsType"
|
|
1406
|
+
/>
|
|
1407
|
+
<VanTimePicker
|
|
1408
|
+
v-if="hasTime"
|
|
1409
|
+
v-model="dateTimePickerValue.time"
|
|
1410
|
+
:columns-type="attr.timeColumnsType || timeColumnsType"
|
|
1411
|
+
:min-time="attr.minTime ? attr.minTime : '00:00:00'"
|
|
1412
|
+
:max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
|
|
1413
|
+
/>
|
|
1414
|
+
</VanPickerGroup>
|
|
1415
|
+
</VanPopup>
|
|
1416
|
+
|
|
1417
|
+
<!-- 时间选择 --该配置未在pc找到不进行维护 后续将删除 -->
|
|
1418
|
+
<VanField
|
|
1419
|
+
v-if="attr.type === 'timePicker' && showItem"
|
|
1420
|
+
v-model="timePickerValue"
|
|
1421
|
+
name="timePicker"
|
|
1422
|
+
is-link
|
|
1423
|
+
readonly
|
|
1424
|
+
:placeholder="attr.placeholder"
|
|
1425
|
+
:label="labelData"
|
|
1426
|
+
:label-align="labelAlign"
|
|
1427
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1428
|
+
:rules="[{ required: attr.rule.required === 'true', message: '请选择' }]"
|
|
1429
|
+
@click="readonly ? null : (showTimePicker = true)"
|
|
1430
|
+
/>
|
|
1431
|
+
<VanPopup v-model:show="showTimePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1432
|
+
<VanTimePicker
|
|
1433
|
+
v-model="modelData as string[]"
|
|
1434
|
+
:title="attr.name"
|
|
1435
|
+
:columns-type="attr.columnsType ? attr.columnsType : ['hour', 'minute', 'second']"
|
|
1436
|
+
:min-time="attr.minTime ? attr.minTime : '00:00:00'"
|
|
1437
|
+
:max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
|
|
1438
|
+
:readonly="readonly"
|
|
1439
|
+
@cancel="showTimePicker = false"
|
|
1440
|
+
@confirm="onTimePickerConfirm"
|
|
1441
|
+
/>
|
|
1442
|
+
</VanPopup>
|
|
1443
|
+
|
|
1444
|
+
<!-- 省市区选择 -->
|
|
1445
|
+
<VanField
|
|
1446
|
+
v-if="(attr.type === 'area' || attr.type === 'citySelect') && showItem"
|
|
1447
|
+
v-model="area"
|
|
1448
|
+
name="area"
|
|
1449
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1450
|
+
is-link
|
|
1451
|
+
readonly
|
|
1452
|
+
:label="labelData"
|
|
1453
|
+
:label-align="labelAlign"
|
|
1454
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1455
|
+
:rules="[{ required: attr.rule.required === 'true', message: '请选择' }]"
|
|
1456
|
+
:required="attr.rule.required === 'true'"
|
|
1457
|
+
@click="readonly ? null : (showArea = true)"
|
|
1458
|
+
/>
|
|
1459
|
+
<VanPopup v-model:show="showArea" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
1460
|
+
<VanArea
|
|
1461
|
+
v-model="modelData as string" :title="attr.name" :area-list="areaList"
|
|
1462
|
+
@confirm="onAreaConfirm"
|
|
1463
|
+
@cancel="showArea = false"
|
|
1464
|
+
/>
|
|
1465
|
+
</VanPopup>
|
|
1466
|
+
|
|
1467
|
+
<!-- 单选下拉列表 -->
|
|
1468
|
+
<XSelect
|
|
1469
|
+
v-if="attr.type === 'select' && showItem"
|
|
1470
|
+
v-model="modelData"
|
|
1471
|
+
:label="labelData"
|
|
1472
|
+
:readonly="readonly"
|
|
1473
|
+
clearable
|
|
1474
|
+
:placeholder="placeholder"
|
|
1475
|
+
:columns="option"
|
|
1476
|
+
:option="attr.option ? attr.option : columnsField"
|
|
1477
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1478
|
+
:required="attr.rule.required === 'true'"
|
|
1479
|
+
:lazy-load="attr.lazyLoad"
|
|
1480
|
+
:on-search="attr.lazyLoad ? handleLazySearch : null"
|
|
1481
|
+
/>
|
|
1482
|
+
|
|
1483
|
+
<!-- 文本区域 -->
|
|
1484
|
+
<VanField
|
|
1485
|
+
v-if="attr.type === 'textarea' && showItem"
|
|
1486
|
+
v-model="(modelData as string)"
|
|
1487
|
+
rows="3"
|
|
1488
|
+
autosize
|
|
1489
|
+
:label="labelData"
|
|
1490
|
+
:label-align="labelAlign"
|
|
1491
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1492
|
+
type="textarea"
|
|
1493
|
+
:readonly="readonly"
|
|
1494
|
+
:maxlength="attr.maxlength ? attr.maxlength : 200"
|
|
1495
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请输入${attr.name}`"
|
|
1496
|
+
show-word-limit
|
|
1497
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
|
|
1498
|
+
:required="attr.rule.required === 'true'"
|
|
1499
|
+
/>
|
|
1500
|
+
|
|
1501
|
+
<!-- 文本输入框 -->
|
|
1502
|
+
<VanField
|
|
1503
|
+
v-if="(attr.type === 'input' || attr.type === 'intervalPicker' || attr.type === 'scanCode' || attr.type === 'nfc') && showItem"
|
|
1504
|
+
v-model="(modelData as string)"
|
|
1505
|
+
style="align-items: center"
|
|
1506
|
+
:label="labelData"
|
|
1507
|
+
:label-align="labelAlign"
|
|
1508
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1509
|
+
:type="attr.type as FieldType"
|
|
1510
|
+
:readonly="readonly"
|
|
1511
|
+
:disabled="attr.disabled"
|
|
1512
|
+
:placeholder="placeholder"
|
|
1513
|
+
:error-message="errorMessage"
|
|
1514
|
+
:clearable="attr.clearable"
|
|
1515
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
|
|
1516
|
+
:required="attr.rule.required === 'true'"
|
|
1517
|
+
@blur="() => formTypeCheck(attr, modelData as string)"
|
|
1518
|
+
>
|
|
1519
|
+
<template #input>
|
|
1520
|
+
<input
|
|
1521
|
+
:value="modelData"
|
|
1522
|
+
:readonly="readonly"
|
|
1523
|
+
class="van-field__control"
|
|
1524
|
+
:placeholder="placeholder"
|
|
1525
|
+
style="flex: 1; min-width: 0;"
|
|
1526
|
+
@input="e => modelData = (e.target as HTMLInputElement).value"
|
|
1527
|
+
@blur="() => formTypeCheck(attr, modelData as string)"
|
|
1528
|
+
>
|
|
1529
|
+
<VanButton
|
|
1530
|
+
v-if="(attr.type === 'input' || attr.type === 'intervalPicker') && !props.formReadonly && attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|')"
|
|
1531
|
+
class="action-btn"
|
|
1532
|
+
round
|
|
1533
|
+
type="primary"
|
|
1534
|
+
size="small"
|
|
1535
|
+
@click="emitFunc(attr.inputOnAfterFunc, attr)"
|
|
1536
|
+
>
|
|
1537
|
+
{{ attr.inputOnAfterName }}
|
|
1538
|
+
</VanButton>
|
|
1539
|
+
<VanButton
|
|
1540
|
+
v-if="(attr.type === 'scanCode' || attr.type === 'nfc') && !props.formReadonly"
|
|
1541
|
+
class="action-btn scan-nfc"
|
|
1542
|
+
round
|
|
1543
|
+
size="small"
|
|
1544
|
+
@click="scanCodeOrNfc(attr)"
|
|
1545
|
+
>
|
|
1546
|
+
{{ attr.type === 'scanCode' ? '扫码' : 'NFC' }}
|
|
1547
|
+
</VanButton>
|
|
1548
|
+
</template>
|
|
1549
|
+
</VanField>
|
|
1550
|
+
|
|
1551
|
+
<!-- 地址选择器 -->
|
|
1552
|
+
<VanField
|
|
1553
|
+
v-if="attr.type === 'addressSearch' && showItem"
|
|
1554
|
+
v-model="modelData as string"
|
|
1555
|
+
name="addressSearch"
|
|
1556
|
+
:label="labelData"
|
|
1557
|
+
:label-align="labelAlign"
|
|
1558
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1559
|
+
readonly
|
|
1560
|
+
is-link
|
|
1561
|
+
:placeholder="placeholder"
|
|
1562
|
+
:rules="[{ required: attr.rule.required === 'true', message: '请选择地址' }]"
|
|
1563
|
+
:required="attr.rule.required === 'true'"
|
|
1564
|
+
@click="readonly ? null : (showAddressPicker = true)"
|
|
1565
|
+
/>
|
|
1566
|
+
<VanPopup
|
|
1567
|
+
v-model:show="showAddressPicker"
|
|
1568
|
+
position="bottom"
|
|
1569
|
+
:style="{ height: '80vh' }"
|
|
1570
|
+
teleport="body"
|
|
1571
|
+
overlay-class="date-picker-overlay"
|
|
1572
|
+
>
|
|
1573
|
+
<XLocationPicker
|
|
1574
|
+
:default-center="defaultMapCenter"
|
|
1575
|
+
:service-name="serviceName"
|
|
1576
|
+
@confirm="handleAddressConfirm"
|
|
1577
|
+
/>
|
|
1578
|
+
</VanPopup>
|
|
1579
|
+
|
|
1580
|
+
<!-- pc的树形选择框————》 手机端采用 Cascader 级联选择 -->
|
|
1581
|
+
<VanField
|
|
1582
|
+
v-if="attr.type === 'treeSelect' && showItem"
|
|
1583
|
+
v-model="treeValue"
|
|
1584
|
+
name="treeSelect"
|
|
1585
|
+
:label="labelData"
|
|
1586
|
+
:label-align="labelAlign"
|
|
1587
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1588
|
+
readonly
|
|
1589
|
+
is-link
|
|
1590
|
+
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1591
|
+
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1592
|
+
:required="attr.rule.required === 'true'"
|
|
1593
|
+
@click="readonly ? null : (showTreeSelect = true)"
|
|
1594
|
+
/>
|
|
1595
|
+
<VanPopup
|
|
1596
|
+
v-model:show="showTreeSelect"
|
|
1597
|
+
position="bottom"
|
|
1598
|
+
teleport="body"
|
|
1599
|
+
overlay-class="date-picker-overlay"
|
|
1600
|
+
>
|
|
1601
|
+
<VanCascader
|
|
1602
|
+
:options="cleanEmptyChildren(option, attr.customFieldName ? attr.customFieldName : { text: 'label', value: 'value', children: 'children' })"
|
|
1603
|
+
:field-names="attr.customFieldName ? attr.customFieldName : { text: 'label', value: 'value', children: 'children' }"
|
|
1604
|
+
:title="attr.name"
|
|
1605
|
+
:closeable="true"
|
|
1606
|
+
@close="showTreeSelect = false"
|
|
1607
|
+
@finish="onTreeSelectFinish"
|
|
1608
|
+
/>
|
|
1609
|
+
</VanPopup>
|
|
1610
|
+
</div>
|
|
1611
|
+
</template>
|
|
1612
|
+
|
|
1613
|
+
<style scoped>
|
|
1614
|
+
.date-picker-overlay {
|
|
1615
|
+
background-color: rgba(0, 0, 0, 0.2); /* 设置为半透明的黑色 */
|
|
1616
|
+
}
|
|
1617
|
+
.action-btn {
|
|
1618
|
+
border-radius: 10px;
|
|
1619
|
+
margin-left: 8px;
|
|
1620
|
+
min-width: 4rem;
|
|
1621
|
+
max-width: 6rem;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/* 扫码/NFC按钮特殊样式 */
|
|
1625
|
+
.action-btn.scan-nfc {
|
|
1626
|
+
background-color: transparent;
|
|
1627
|
+
border: 1px dashed #aca8a8;
|
|
1628
|
+
color: #1989fa;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/* 空提示样式 */
|
|
1632
|
+
.empty-tip {
|
|
1633
|
+
color: #969799;
|
|
1634
|
+
font-size: 14px;
|
|
1635
|
+
text-align: center;
|
|
1636
|
+
padding: 16px 0;
|
|
1637
|
+
}
|
|
1638
|
+
</style>
|