@infly/ui 1.0.23 → 1.0.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/README.md +799 -755
- package/package.json +2 -2
- package/src/Base/InflyForm/InflyForm.test.js +329 -239
- package/src/Base/InflyForm/InflyForm.vue +986 -974
|
@@ -1,974 +1,986 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- packages\infly-ui\Business\ELForm\ELForm.vue 表单组件集合 -->
|
|
3
|
-
<div class="comp-InflyForm">
|
|
4
|
-
<slot name="prepend"></slot>
|
|
5
|
-
<div class="btn-list__wrap" :class="[`btn-list__wrap--${btnWrapDirection}`]">
|
|
6
|
-
<div
|
|
7
|
-
class="btn-list__item"
|
|
8
|
-
v-for="({ click, ...btnItem }, index) in visibleBtnList"
|
|
9
|
-
:key="`btn_${index}_${btnItem.name || btnItem.label || index}`"
|
|
10
|
-
>
|
|
11
|
-
<el-button size="mini" v-bind="btnItem" @click="handleBtnClick({ click, ...btnItem })">
|
|
12
|
-
{{ btnItem.name || btnItem.label }}
|
|
13
|
-
</el-button>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<el-form
|
|
17
|
-
:class="['infly-form__wrap', formClass, layoutClass]"
|
|
18
|
-
:model="formData"
|
|
19
|
-
:ref="formRef"
|
|
20
|
-
:size="$attrs.size || 'mini'"
|
|
21
|
-
:label-width="formLabelWidth"
|
|
22
|
-
:label-suffix="formLabelSuffix"
|
|
23
|
-
v-bind="$attrs"
|
|
24
|
-
@submit.native.prevent
|
|
25
|
-
>
|
|
26
|
-
<el-form-item
|
|
27
|
-
v-for="(
|
|
28
|
-
{
|
|
29
|
-
label,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:
|
|
52
|
-
:
|
|
53
|
-
:
|
|
54
|
-
:
|
|
55
|
-
:
|
|
56
|
-
:
|
|
57
|
-
:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
v-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
v-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
v-
|
|
113
|
-
v-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
v-
|
|
118
|
-
v-
|
|
119
|
-
v-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
v-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
v-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
v-
|
|
138
|
-
v-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
</
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
},
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
return
|
|
409
|
-
},
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
},
|
|
450
|
-
|
|
451
|
-
return
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
602
|
-
*
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
*
|
|
650
|
-
* @param {Object}
|
|
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
|
-
* @param {
|
|
706
|
-
* @returns {String} -
|
|
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
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
return
|
|
764
|
-
},
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
return
|
|
776
|
-
},
|
|
777
|
-
|
|
778
|
-
return
|
|
779
|
-
},
|
|
780
|
-
|
|
781
|
-
return type
|
|
782
|
-
},
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
const {
|
|
802
|
-
|
|
803
|
-
|
|
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
|
-
|
|
830
|
-
|
|
831
|
-
|
|
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
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<!-- packages\infly-ui\Business\ELForm\ELForm.vue 表单组件集合 -->
|
|
3
|
+
<div class="comp-InflyForm">
|
|
4
|
+
<slot name="prepend"></slot>
|
|
5
|
+
<div class="btn-list__wrap" :class="[`btn-list__wrap--${btnWrapDirection}`]">
|
|
6
|
+
<div
|
|
7
|
+
class="btn-list__item"
|
|
8
|
+
v-for="({ click, ...btnItem }, index) in visibleBtnList"
|
|
9
|
+
:key="`btn_${index}_${btnItem.name || btnItem.label || index}`"
|
|
10
|
+
>
|
|
11
|
+
<el-button size="mini" v-bind="btnItem" @click="handleBtnClick({ click, ...btnItem })">
|
|
12
|
+
{{ btnItem.name || btnItem.label }}
|
|
13
|
+
</el-button>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<el-form
|
|
17
|
+
:class="['infly-form__wrap', formClass, layoutClass]"
|
|
18
|
+
:model="formData"
|
|
19
|
+
:ref="formRef"
|
|
20
|
+
:size="$attrs.size || 'mini'"
|
|
21
|
+
:label-width="formLabelWidth"
|
|
22
|
+
:label-suffix="formLabelSuffix"
|
|
23
|
+
v-bind="$attrs"
|
|
24
|
+
@submit.native.prevent
|
|
25
|
+
>
|
|
26
|
+
<el-form-item
|
|
27
|
+
v-for="(
|
|
28
|
+
{
|
|
29
|
+
label,
|
|
30
|
+
labelRender,
|
|
31
|
+
name,
|
|
32
|
+
type,
|
|
33
|
+
options,
|
|
34
|
+
required,
|
|
35
|
+
isHide,
|
|
36
|
+
valuePrefix,
|
|
37
|
+
optionConfig,
|
|
38
|
+
mode,
|
|
39
|
+
formItemClass,
|
|
40
|
+
nowrap,
|
|
41
|
+
position,
|
|
42
|
+
__positionStyle,
|
|
43
|
+
radioType = 'el-radio',
|
|
44
|
+
__events__,
|
|
45
|
+
rules,
|
|
46
|
+
secTabList,
|
|
47
|
+
...otherAttributes
|
|
48
|
+
},
|
|
49
|
+
index
|
|
50
|
+
) in visibleFilterList"
|
|
51
|
+
:key="`form_item_${name || index}_${index}`"
|
|
52
|
+
:required="required"
|
|
53
|
+
:label="formItemLabel(label, type)"
|
|
54
|
+
:prop="Array.isArray(name) ? name.join(',') : name"
|
|
55
|
+
:label-width="calcLabelWidth(otherAttributes)"
|
|
56
|
+
:class="getFormItemClass({ type, nowrap, formItemClass, position })"
|
|
57
|
+
:style="__positionStyle"
|
|
58
|
+
:rules="rules"
|
|
59
|
+
>
|
|
60
|
+
<!-- 自定义 label 渲染:labelRender 存在时优先于 label 文本(element-ui label 插槽优先于 label prop) -->
|
|
61
|
+
<template v-if="labelRender" #label>
|
|
62
|
+
<InflyFormRenderCell :render-fn="labelRender" :form-data="formData" container-tag="span" />
|
|
63
|
+
</template>
|
|
64
|
+
<template v-if="isSecTabGroupType(type)">
|
|
65
|
+
<el-tabs v-model="activitySecTab" @tab-click="handleSecTabClick">
|
|
66
|
+
<el-tab-pane
|
|
67
|
+
v-for="{ filterList, buttonList, __events__, ...otherTabAttributes } in secTabList"
|
|
68
|
+
:key="otherTabAttributes.name"
|
|
69
|
+
v-bind="otherTabAttributes"
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
class="infly-form__sec-tab-btns"
|
|
73
|
+
v-for="(btnItem, btnIndex) in buttonList"
|
|
74
|
+
:key="`sec_btn_${btnIndex}_${btnItem.name || btnIndex}`"
|
|
75
|
+
>
|
|
76
|
+
<el-button v-if="shouldShowEL(btnItem)" size="mini" v-bind="btnItem" @click="handleBtnClick(btnItem)">
|
|
77
|
+
<span :class="['btn__text', btnItem.className]">
|
|
78
|
+
{{ Uts.isFunction(btnItem.name) ? btnItem.name(formData) : btnItem.name }}
|
|
79
|
+
</span>
|
|
80
|
+
</el-button>
|
|
81
|
+
</div>
|
|
82
|
+
</el-tab-pane>
|
|
83
|
+
</el-tabs>
|
|
84
|
+
</template>
|
|
85
|
+
<!-- 编辑状态 -->
|
|
86
|
+
<template v-else-if="mode === 'edit' || (computedEdit && type && !isEditExcludeType(type))">
|
|
87
|
+
<BusinessSwitch v-if="isBusinessSwitchType(type)" v-bind="otherAttributes" v-on="__events__">
|
|
88
|
+
<template #content>
|
|
89
|
+
<div class="form__switch-text">
|
|
90
|
+
<InflyFormRenderCell
|
|
91
|
+
v-if="Uts.isFunction(__events__.render)"
|
|
92
|
+
:render-fn="__events__.render"
|
|
93
|
+
:value="formData[name]"
|
|
94
|
+
:form-data="formData"
|
|
95
|
+
/>
|
|
96
|
+
<template v-else>{{ formData[name] || "-" }}</template>
|
|
97
|
+
</div>
|
|
98
|
+
</template>
|
|
99
|
+
</BusinessSwitch>
|
|
100
|
+
<InstitutionSelect
|
|
101
|
+
v-else-if="isInstitutionSelectType(type)"
|
|
102
|
+
ref="InstitutionSelectRef"
|
|
103
|
+
v-model="formData[name]"
|
|
104
|
+
:formData="formData"
|
|
105
|
+
v-bind="otherAttributes"
|
|
106
|
+
v-on="__events__"
|
|
107
|
+
/>
|
|
108
|
+
<InflyCheckbox
|
|
109
|
+
v-else-if="isInflyCheckboxType(type)"
|
|
110
|
+
v-model="formData[name]"
|
|
111
|
+
:options="options"
|
|
112
|
+
v-bind="otherAttributes"
|
|
113
|
+
v-on="__events__"
|
|
114
|
+
/>
|
|
115
|
+
<InflyInput
|
|
116
|
+
v-else-if="isInflyInputType(type)"
|
|
117
|
+
v-model="formData[name]"
|
|
118
|
+
v-bind="{ ...otherAttributes, label, type }"
|
|
119
|
+
v-on="__events__"
|
|
120
|
+
/>
|
|
121
|
+
<el-radio-group
|
|
122
|
+
v-else-if="type === 'el-radio-group'"
|
|
123
|
+
v-model="formData[name]"
|
|
124
|
+
v-bind="otherAttributes"
|
|
125
|
+
v-on="__events__"
|
|
126
|
+
>
|
|
127
|
+
<component :is="radioType" v-for="option in options" :key="option.value" :label="option.value">
|
|
128
|
+
{{ __events__?.radioLabel?.(option) || option.name || option.label || "" }}
|
|
129
|
+
</component>
|
|
130
|
+
</el-radio-group>
|
|
131
|
+
<component
|
|
132
|
+
v-else-if="isDatePickerType(type)"
|
|
133
|
+
:is="type === 'el-time-picker' ? 'el-time-picker' : 'el-date-picker'"
|
|
134
|
+
:value="getDatePickerValue(name)"
|
|
135
|
+
:key="getFieldKey(name)"
|
|
136
|
+
@input="handleDatePickerInput($event, name)"
|
|
137
|
+
v-bind="type === 'el-time-picker' ? otherAttributes : { ...datePickerDefaults, ...otherAttributes, type }"
|
|
138
|
+
v-on="__events__"
|
|
139
|
+
/>
|
|
140
|
+
<el-select
|
|
141
|
+
v-else-if="type === 'el-select'"
|
|
142
|
+
v-model="formData[name]"
|
|
143
|
+
v-bind="otherAttributes"
|
|
144
|
+
v-on="__events__"
|
|
145
|
+
>
|
|
146
|
+
<el-option
|
|
147
|
+
v-for="option in options"
|
|
148
|
+
:key="getOptionValue(option, optionConfig)"
|
|
149
|
+
:label="getOptionLabel(option, optionConfig)"
|
|
150
|
+
:value="getOptionValue(option, optionConfig)"
|
|
151
|
+
/>
|
|
152
|
+
</el-select>
|
|
153
|
+
<el-upload v-else-if="type === 'el-upload'" v-bind="otherAttributes" v-on="otherAttributes">
|
|
154
|
+
<el-image
|
|
155
|
+
v-if="isUploadPictureList(otherAttributes) && formData[name]"
|
|
156
|
+
:src="formData[name]"
|
|
157
|
+
v-bind="otherAttributes.imgAtts"
|
|
158
|
+
/>
|
|
159
|
+
<template v-else-if="otherAttributes.drag">
|
|
160
|
+
<i class="el-icon-upload"></i>
|
|
161
|
+
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
162
|
+
</template>
|
|
163
|
+
<template v-else-if="otherAttributes.uploadBtn">
|
|
164
|
+
<el-button size="small" type="primary">点击上传</el-button>
|
|
165
|
+
</template>
|
|
166
|
+
<template v-else>
|
|
167
|
+
<i class="standard-upload_icon el-icon-plus avatar-uploader-icon"></i>
|
|
168
|
+
<div class="el-upload__text">点击上传</div>
|
|
169
|
+
</template>
|
|
170
|
+
<!-- XSS 风险:确保 tips 内容已转义或来自可信数据源 -->
|
|
171
|
+
<div v-if="otherAttributes.tips" class="el-upload__tip" slot="tip" v-html="otherAttributes.tips"></div>
|
|
172
|
+
</el-upload>
|
|
173
|
+
<!-- 支持自定义customRender插槽,当type为'customRender'时显示 -->
|
|
174
|
+
<slot
|
|
175
|
+
v-else-if="type === 'customRender'"
|
|
176
|
+
name="customRender"
|
|
177
|
+
:item="{ label, name, type, options, required, isHide, __events__, ...otherAttributes }"
|
|
178
|
+
></slot>
|
|
179
|
+
</template>
|
|
180
|
+
<!-- 非编辑状态显示 -->
|
|
181
|
+
<template v-else>
|
|
182
|
+
<div v-if="type === 'daterange' || type === 'datetimerange'">
|
|
183
|
+
{{ getDateRangeDisplay(name) }}
|
|
184
|
+
</div>
|
|
185
|
+
<el-image
|
|
186
|
+
v-else-if="type === 'el-upload' && isUploadPictureList(otherAttributes) && formData[name]"
|
|
187
|
+
:src="formData[name]"
|
|
188
|
+
v-bind="otherAttributes.imgAtts"
|
|
189
|
+
/>
|
|
190
|
+
<div v-else-if="type === 'router-link'">
|
|
191
|
+
<router-link v-bind="otherAttributes">{{ formData[name] }}</router-link>
|
|
192
|
+
</div>
|
|
193
|
+
<!-- 自定义render函数渲染,支持返回字符串(v-html)或VNode(JSX/h) -->
|
|
194
|
+
<InflyFormRenderCell
|
|
195
|
+
v-else-if="type === 'render' || Uts.isFunction(__events__?.render)"
|
|
196
|
+
:render-fn="__events__.render"
|
|
197
|
+
:value="formData[name]"
|
|
198
|
+
:form-data="formData"
|
|
199
|
+
/>
|
|
200
|
+
<!-- 统一的默认值渲染(支持 el-tag 和普通 div) -->
|
|
201
|
+
<component
|
|
202
|
+
v-else
|
|
203
|
+
:is="type === 'el-tag' ? 'el-tag' : 'div'"
|
|
204
|
+
:type="
|
|
205
|
+
type === 'el-tag'
|
|
206
|
+
? getTagType({ prop: name, options, propValueField: otherAttributes.propValueField })
|
|
207
|
+
: undefined
|
|
208
|
+
"
|
|
209
|
+
v-bind="type === 'el-tag' ? otherAttributes : {}"
|
|
210
|
+
>
|
|
211
|
+
{{ defaultValueRender({ name, type, valuePrefix, label }) }}
|
|
212
|
+
</component>
|
|
213
|
+
</template>
|
|
214
|
+
</el-form-item>
|
|
215
|
+
<div
|
|
216
|
+
v-if="Uts.notEmptyArray(filterList)"
|
|
217
|
+
:class="['btn-list__wrap--bottom', btnWrapClass]"
|
|
218
|
+
:style="{ '--btn-left': computedBtnLeft }"
|
|
219
|
+
>
|
|
220
|
+
<div
|
|
221
|
+
v-for="({ isShow, isHide, ...btnItem }, index) in formOptBtnList"
|
|
222
|
+
:key="`opt_btn_${index}_${btnItem.label || btnItem.name || index}`"
|
|
223
|
+
>
|
|
224
|
+
<el-button
|
|
225
|
+
v-if="shouldShowEL({ isShow, isHide })"
|
|
226
|
+
size="mini"
|
|
227
|
+
v-bind="btnItem"
|
|
228
|
+
@click="handleBtnClick(btnItem)"
|
|
229
|
+
>
|
|
230
|
+
{{ btnItem.name || btnItem.label }}
|
|
231
|
+
</el-button>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</el-form>
|
|
235
|
+
<slot name="append"></slot>
|
|
236
|
+
</div>
|
|
237
|
+
</template>
|
|
238
|
+
|
|
239
|
+
<script>
|
|
240
|
+
import { MessageBox, Message, Loading } from "element-ui";
|
|
241
|
+
import Uts from "../../utils/Uts.js";
|
|
242
|
+
import { exportFile } from "@infly/ts-libs";
|
|
243
|
+
|
|
244
|
+
// ─── 模块级常量 ────────────────────────────────────────────────────────────────
|
|
245
|
+
// 提升到模块顶层,避免每次 computed/render 时重复分配内存
|
|
246
|
+
|
|
247
|
+
/** visibleFilterList 中不归类为事件的函数 key(isHide/isShow 是显示条件,labelRender 是标签渲染配置) */
|
|
248
|
+
const NON_EVENT_FUNCTION_KEYS = new Set(["isHide", "isShow", "labelRender"]);
|
|
249
|
+
/** el-upload 用 onXxx 回调属性而非 emit,整体走 v-bind 更稳妥 */
|
|
250
|
+
const KEEP_FUNC_COMPONENT_TYPES = new Set(["el-upload"]);
|
|
251
|
+
|
|
252
|
+
/** 日期选择器固定默认配置,冻结对象保证引用永远稳定 */
|
|
253
|
+
const DATE_PICKER_DEFAULTS = Object.freeze({
|
|
254
|
+
unlinkPanels: true,
|
|
255
|
+
rangeSeparator: "至",
|
|
256
|
+
startPlaceholder: "开始日期",
|
|
257
|
+
endPlaceholder: "结束日期",
|
|
258
|
+
valueFormat: "yyyy-MM-dd"
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
/** existModuleType 条件对象,避免每次 computed 重算时创建新引用 */
|
|
262
|
+
const MODULE_TYPE_CONDITION = Object.freeze({ type: "module" });
|
|
263
|
+
|
|
264
|
+
// 用 Set 替代模板中 Uts.contain([...], type) 的内联数组字面量,
|
|
265
|
+
// 将 O(n) 线性查找变为 O(1) 哈希查找,同时消除每次渲染的数组分配
|
|
266
|
+
const EDIT_EXCLUDE_TYPES = new Set(["text", "render"]);
|
|
267
|
+
const BUSINESS_SWITCH_TYPES = new Set(["BusinessSwitch", "business-switch"]);
|
|
268
|
+
const INSTITUTION_SELECT_TYPES = new Set(["InstitutionSelect", "institution-select"]);
|
|
269
|
+
const INFLY_CHECKBOX_TYPES = new Set(["InflyCheckBox", "infly-checkbox"]);
|
|
270
|
+
const INFLY_INPUT_TYPES = new Set(["InflyInput", "infly-input", "el-autocomplete", "textarea", "infly-input-number"]);
|
|
271
|
+
const DATE_PICKER_TYPES = new Set(["daterange", "datetimerange", "datetime", "date", "month", "year", "el-time-picker"]);
|
|
272
|
+
const SUPPORTED_LAYOUT_TYPES = new Set(["inline", "inline-seamless", "compact"]);
|
|
273
|
+
const SUPPORTED_POSITION_TYPES = new Set(["left", "right", "full"]);
|
|
274
|
+
const INTERNAL_TABGROUP_TYPE = "tabgroup";
|
|
275
|
+
// ───────────────────────────────────────────────────────────────────────────────
|
|
276
|
+
|
|
277
|
+
export default {
|
|
278
|
+
name: "InflyForm",
|
|
279
|
+
inheritAttrs: false,
|
|
280
|
+
components: {
|
|
281
|
+
InflyFormRenderCell: {
|
|
282
|
+
props: {
|
|
283
|
+
// 支持函数(调用后返回字符串/VNode)或直接传 VNode 对象(如 JSX 元素)
|
|
284
|
+
renderFn: { type: [Function, Object], required: true },
|
|
285
|
+
value: { default: undefined },
|
|
286
|
+
formData: { type: Object, default: () => ({}) },
|
|
287
|
+
// 字符串结果包裹的容器标签:字段值渲染默认 div,label 场景传 span 保持行内对齐
|
|
288
|
+
containerTag: { type: String, default: "div" }
|
|
289
|
+
},
|
|
290
|
+
render(createElement) {
|
|
291
|
+
if (!Uts.isFunction(this.renderFn)) {
|
|
292
|
+
// VNode 直传(JSX 元素):原样渲染
|
|
293
|
+
return this.renderFn;
|
|
294
|
+
}
|
|
295
|
+
const result = this.renderFn(this.value, this.formData);
|
|
296
|
+
if (typeof result === "string") {
|
|
297
|
+
// XSS 风险:确保 renderFn 返回值已转义或来自可信数据源
|
|
298
|
+
return createElement(this.containerTag, { domProps: { innerHTML: result } });
|
|
299
|
+
}
|
|
300
|
+
return result || createElement("span");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
props: {
|
|
305
|
+
formClass: { type: String, default: "" },
|
|
306
|
+
layout: {
|
|
307
|
+
type: [String, Array],
|
|
308
|
+
default: "",
|
|
309
|
+
validator: (value) => {
|
|
310
|
+
const layoutList = Array.isArray(value) ? value : [value];
|
|
311
|
+
return layoutList.every((item) => !item || SUPPORTED_LAYOUT_TYPES.has(item));
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
formData: { type: Object, required: true, default: () => ({}) },
|
|
315
|
+
formRef: { type: String, default: "formRef" },
|
|
316
|
+
btnList: { type: Array, default: () => [] },
|
|
317
|
+
filterList: { type: Array, default: () => [] },
|
|
318
|
+
reqParams: { type: Object, default: () => ({}) },
|
|
319
|
+
hideSearchBtn: { type: Boolean, default: false },
|
|
320
|
+
hideResetBtn: { type: Boolean, default: true },
|
|
321
|
+
isEdit: { type: Boolean, default: null },
|
|
322
|
+
optBtnList: { type: Array, default: () => [] },
|
|
323
|
+
btnWrapDirection: { type: String, default: "row" },
|
|
324
|
+
btnWrapClass: { type: String, default: "" },
|
|
325
|
+
baseButtonsLeft: { type: String, default: "420px" },
|
|
326
|
+
emptyStr: { type: String, default: "-" },
|
|
327
|
+
request: { type: Function, default: null }
|
|
328
|
+
},
|
|
329
|
+
data() {
|
|
330
|
+
const [firstSecTab] = this.getVisibleSecTabList();
|
|
331
|
+
const { name: firstSecTabName } = firstSecTab || {};
|
|
332
|
+
|
|
333
|
+
return {
|
|
334
|
+
originFormData: Uts.copyObj(this.formData),
|
|
335
|
+
activitySecTab: firstSecTabName
|
|
336
|
+
};
|
|
337
|
+
},
|
|
338
|
+
created() {
|
|
339
|
+
this.initRangeFieldValues();
|
|
340
|
+
},
|
|
341
|
+
computed: {
|
|
342
|
+
/**
|
|
343
|
+
* 底部操作按钮列表。computed 化后可响应 hideSearchBtn / hideResetBtn / optBtnList prop 动态变化;
|
|
344
|
+
* 在 data() 中快照只能取到初始值。
|
|
345
|
+
*/
|
|
346
|
+
formOptBtnList() {
|
|
347
|
+
return [
|
|
348
|
+
{
|
|
349
|
+
label: "查询",
|
|
350
|
+
type: "primary",
|
|
351
|
+
size: "mini",
|
|
352
|
+
isHide: this.hideSearchBtn,
|
|
353
|
+
btnEvent: "initData",
|
|
354
|
+
plain: true
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
label: "重置",
|
|
358
|
+
type: "success",
|
|
359
|
+
size: "mini",
|
|
360
|
+
isHide: this.hideResetBtn,
|
|
361
|
+
btnEvent: this.resetFormData,
|
|
362
|
+
plain: true
|
|
363
|
+
},
|
|
364
|
+
...this.optBtnList
|
|
365
|
+
];
|
|
366
|
+
},
|
|
367
|
+
/**
|
|
368
|
+
* 标准化并过滤出应该显示的表单项列表
|
|
369
|
+
* 1. 标准化:如果没有 name 但有 prop,则使用 prop 作为 name
|
|
370
|
+
* 2. 过滤:排除 isHide 为 true 的项
|
|
371
|
+
* 3. 分离:将函数类型的属性归类到 events,其他归类到普通属性
|
|
372
|
+
*/
|
|
373
|
+
visibleFilterList() {
|
|
374
|
+
return this.withPositionRows(this.getVisibleFilterList());
|
|
375
|
+
},
|
|
376
|
+
formLabelWidth() {
|
|
377
|
+
// 直接计算,避免循环依赖
|
|
378
|
+
return this.$attrs.labelWidth || this.$attrs["label-width"] || "80px";
|
|
379
|
+
},
|
|
380
|
+
// 计算底部按钮距离左侧的距离
|
|
381
|
+
computedBtnLeft() {
|
|
382
|
+
const labelWidth = this.formLabelWidth;
|
|
383
|
+
return `calc(${labelWidth} + ${this.baseButtonsLeft})`;
|
|
384
|
+
},
|
|
385
|
+
computedEdit() {
|
|
386
|
+
const { query = {} } = this.$route || {};
|
|
387
|
+
const { mode } = query;
|
|
388
|
+
|
|
389
|
+
if (Uts.isBoolean(this.isEdit)) {
|
|
390
|
+
return this.isEdit;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return mode === "edit" || !mode;
|
|
394
|
+
},
|
|
395
|
+
existModuleType() {
|
|
396
|
+
const moduleList = Uts.filterObjByCondition(this.getFlattenFilterList() || [], MODULE_TYPE_CONDITION) || [];
|
|
397
|
+
return moduleList.length > 0;
|
|
398
|
+
},
|
|
399
|
+
/** 原始 label-suffix 配置值,兼容 kebab-case 和 camelCase */
|
|
400
|
+
rawLabelSuffix() {
|
|
401
|
+
return this.$attrs["label-suffix"] || this.$attrs["labelSuffix"] || "";
|
|
402
|
+
},
|
|
403
|
+
formLabelSuffix() {
|
|
404
|
+
if (this.existModuleType) {
|
|
405
|
+
return "";
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return this.rawLabelSuffix;
|
|
409
|
+
},
|
|
410
|
+
/**
|
|
411
|
+
* 过滤出应该显示的按钮列表
|
|
412
|
+
*/
|
|
413
|
+
visibleBtnList() {
|
|
414
|
+
return this.btnList.filter((btnItem) => this.shouldShowEL(btnItem));
|
|
415
|
+
},
|
|
416
|
+
/**
|
|
417
|
+
* 日期选择器默认配置(返回模块级冻结常量,引用永远稳定)
|
|
418
|
+
*/
|
|
419
|
+
datePickerDefaults() {
|
|
420
|
+
return DATE_PICKER_DEFAULTS;
|
|
421
|
+
},
|
|
422
|
+
layoutClass() {
|
|
423
|
+
const layoutList = Array.isArray(this.layout) ? this.layout : [this.layout];
|
|
424
|
+
const classes = layoutList.filter(Boolean).map((item) => `standard-form--${item}`);
|
|
425
|
+
if (this.hasPositionedItems) {
|
|
426
|
+
classes.push("standard-form--positioned");
|
|
427
|
+
}
|
|
428
|
+
return classes;
|
|
429
|
+
},
|
|
430
|
+
hasPositionedItems() {
|
|
431
|
+
return this.visibleFilterList.some((item) => SUPPORTED_POSITION_TYPES.has(String(item.position || "").trim()));
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
methods: {
|
|
435
|
+
initRangeFieldValues() {
|
|
436
|
+
// 为数组形式的 name(日期范围字段)初始化联合 key,确保 el-form-item :prop 校验能找到值
|
|
437
|
+
this.getFlattenFilterList().forEach((item) => {
|
|
438
|
+
const { name } = item;
|
|
439
|
+
|
|
440
|
+
if (!Array.isArray(name)) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const [startField, endField] = name;
|
|
445
|
+
const startValue = this.formData[startField];
|
|
446
|
+
const endValue = this.formData[endField];
|
|
447
|
+
this.$set(this.formData, name.join(","), startValue && endValue ? [startValue, endValue] : undefined);
|
|
448
|
+
});
|
|
449
|
+
},
|
|
450
|
+
getFlattenFilterList(list = this.filterList) {
|
|
451
|
+
return (list || []).reduce((result, item) => {
|
|
452
|
+
result.push(item);
|
|
453
|
+
if (Uts.notEmptyArray(item && item.filterList)) {
|
|
454
|
+
result.push(...this.getFlattenFilterList(item.filterList));
|
|
455
|
+
}
|
|
456
|
+
return result;
|
|
457
|
+
}, []);
|
|
458
|
+
},
|
|
459
|
+
getVisibleSecTabList() {
|
|
460
|
+
return (this.filterList || []).filter((item) => item && item.type === "secTab" && this.shouldShowEL(item));
|
|
461
|
+
},
|
|
462
|
+
getActiveSecTab(secTabList = []) {
|
|
463
|
+
return secTabList.find((item) => item.name === this.activitySecTab) || secTabList[0];
|
|
464
|
+
},
|
|
465
|
+
createSecTabGroupItem(secTabList = []) {
|
|
466
|
+
return {
|
|
467
|
+
type: INTERNAL_TABGROUP_TYPE,
|
|
468
|
+
name: INTERNAL_TABGROUP_TYPE,
|
|
469
|
+
label: "",
|
|
470
|
+
labelWidth: "0",
|
|
471
|
+
secTabList,
|
|
472
|
+
__events__: {}
|
|
473
|
+
};
|
|
474
|
+
},
|
|
475
|
+
appendActiveSecTabFilters(result, activeSecTab = {}) {
|
|
476
|
+
const activeFilterList = activeSecTab.filterList || [];
|
|
477
|
+
|
|
478
|
+
activeFilterList.forEach((filterItem) => {
|
|
479
|
+
const normalizedItem = this.normalizeVisibleFilterItem(filterItem);
|
|
480
|
+
if (normalizedItem) {
|
|
481
|
+
result.push(normalizedItem);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
},
|
|
485
|
+
getVisibleFilterList() {
|
|
486
|
+
const secTabList = this.getVisibleSecTabList().map((item) => this.normalizeFilterItem(item));
|
|
487
|
+
const activeSecTab = this.getActiveSecTab(secTabList);
|
|
488
|
+
let hasInsertedSecTabGroup = false;
|
|
489
|
+
|
|
490
|
+
return (this.filterList || []).reduce((result, item) => {
|
|
491
|
+
const { type } = item || {};
|
|
492
|
+
|
|
493
|
+
if (type === "secTab") {
|
|
494
|
+
if (!hasInsertedSecTabGroup && Uts.notEmptyArray(secTabList)) {
|
|
495
|
+
hasInsertedSecTabGroup = true;
|
|
496
|
+
result.push(this.createSecTabGroupItem(secTabList));
|
|
497
|
+
this.appendActiveSecTabFilters(result, activeSecTab);
|
|
498
|
+
}
|
|
499
|
+
return result;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
const normalizedItem = this.normalizeVisibleFilterItem(item);
|
|
503
|
+
if (normalizedItem) {
|
|
504
|
+
result.push(normalizedItem);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return result;
|
|
508
|
+
}, []);
|
|
509
|
+
},
|
|
510
|
+
normalizeVisibleFilterItem(item = {}) {
|
|
511
|
+
if (!this.shouldShowEL(item)) {
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return this.normalizeFilterItem(item);
|
|
516
|
+
},
|
|
517
|
+
normalizeFilterItem(item = {}) {
|
|
518
|
+
const { name, prop, type } = item;
|
|
519
|
+
const events = {};
|
|
520
|
+
const attributes = {};
|
|
521
|
+
|
|
522
|
+
Object.keys(item).forEach((key) => {
|
|
523
|
+
const value = item[key];
|
|
524
|
+
|
|
525
|
+
if (this.isEventAttribute({ key, value, type })) {
|
|
526
|
+
events[key] = value;
|
|
527
|
+
} else {
|
|
528
|
+
attributes[key] = value;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
return {
|
|
533
|
+
...attributes,
|
|
534
|
+
name: name || prop || "",
|
|
535
|
+
__events__: events
|
|
536
|
+
};
|
|
537
|
+
},
|
|
538
|
+
getNormalizedPosition({ position, type } = {}) {
|
|
539
|
+
const normalizedPosition = String(position || "").trim();
|
|
540
|
+
if (SUPPORTED_POSITION_TYPES.has(normalizedPosition)) {
|
|
541
|
+
return normalizedPosition;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return type === INTERNAL_TABGROUP_TYPE ? "full" : "";
|
|
545
|
+
},
|
|
546
|
+
withPositionRows(list = []) {
|
|
547
|
+
if (!list.some((item) => this.getNormalizedPosition(item))) {
|
|
548
|
+
return list;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
let leftRow = 1;
|
|
552
|
+
let rightRow = 1;
|
|
553
|
+
let nextFullRow = 1;
|
|
554
|
+
|
|
555
|
+
return list.map((item) => {
|
|
556
|
+
const normalizedPosition = this.getNormalizedPosition(item);
|
|
557
|
+
if (!normalizedPosition) {
|
|
558
|
+
return item;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (normalizedPosition === "full") {
|
|
562
|
+
const row = Math.max(leftRow, rightRow, nextFullRow);
|
|
563
|
+
leftRow = row + 1;
|
|
564
|
+
rightRow = row + 1;
|
|
565
|
+
nextFullRow = row + 1;
|
|
566
|
+
return { ...item, __positionStyle: { gridRow: `${row}` } };
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const row = normalizedPosition === "left" ? leftRow : rightRow;
|
|
570
|
+
if (normalizedPosition === "left") {
|
|
571
|
+
leftRow += 1;
|
|
572
|
+
} else {
|
|
573
|
+
rightRow += 1;
|
|
574
|
+
}
|
|
575
|
+
nextFullRow = Math.max(nextFullRow, row + 1);
|
|
576
|
+
|
|
577
|
+
return { ...item, __positionStyle: { gridRow: `${row}` } };
|
|
578
|
+
});
|
|
579
|
+
},
|
|
580
|
+
isEventAttribute({ key, value, type }) {
|
|
581
|
+
return Uts.isFunction(value) && !NON_EVENT_FUNCTION_KEYS.has(key) && !KEEP_FUNC_COMPONENT_TYPES.has(type);
|
|
582
|
+
},
|
|
583
|
+
handleSecTabClick(tab) {
|
|
584
|
+
const tabName = tab.name;
|
|
585
|
+
const originalTabConfig = this.getVisibleSecTabList().find((item) => item.name === tabName) || {};
|
|
586
|
+
const emitParams = {
|
|
587
|
+
...originalTabConfig,
|
|
588
|
+
tabName,
|
|
589
|
+
name: tabName,
|
|
590
|
+
activitySecTab: tabName
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
this.activitySecTab = tabName;
|
|
594
|
+
this.$emit("secTabChange", emitParams);
|
|
595
|
+
this.$emit("sec-tab-change", emitParams);
|
|
596
|
+
},
|
|
597
|
+
/**
|
|
598
|
+
* 通用显示判断方法
|
|
599
|
+
* @param {Boolean|Function} condition - 显示/隐藏条件
|
|
600
|
+
* @param {Object} context - 上下文数据
|
|
601
|
+
* @param {Boolean} isShowCondition - true 表示是 isShow,false 表示是 isHide
|
|
602
|
+
* @returns {Boolean} - 是否显示
|
|
603
|
+
*/
|
|
604
|
+
shouldShow(condition, context = this.formData, isShowCondition = false) {
|
|
605
|
+
if (condition === undefined) {
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const result = Uts.isFunction(condition) ? condition(context) : condition;
|
|
610
|
+
return isShowCondition ? result : !result;
|
|
611
|
+
},
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* 判断按钮是否应该显示
|
|
615
|
+
* @param {Object} config - 按钮配置对象 { isShow, isHide }
|
|
616
|
+
* @returns {Boolean} - 是否显示
|
|
617
|
+
*/
|
|
618
|
+
shouldShowEL({ isShow, isHide }) {
|
|
619
|
+
// 优先判断 isShow
|
|
620
|
+
if (isShow !== undefined) {
|
|
621
|
+
return this.shouldShow(isShow, this.formData, true);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// 其次判断 isHide
|
|
625
|
+
if (isHide !== undefined) {
|
|
626
|
+
return this.shouldShow(isHide, this.formData, false);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return true;
|
|
630
|
+
},
|
|
631
|
+
isUploadPictureList(otherAttributes = {}) {
|
|
632
|
+
const listType = otherAttributes.listType || otherAttributes["list-type"] || "text";
|
|
633
|
+
return listType === "picture" || listType === "picture-card";
|
|
634
|
+
},
|
|
635
|
+
/**
|
|
636
|
+
* 获取表单项的类名
|
|
637
|
+
*/
|
|
638
|
+
getFormItemClass({ type, nowrap, formItemClass, position }) {
|
|
639
|
+
const normalizedPosition = String(position || "").trim();
|
|
640
|
+
return [
|
|
641
|
+
"standard-form__item",
|
|
642
|
+
type && `standard-form__item--${type}`,
|
|
643
|
+
nowrap && "standard-form__item--nowrap",
|
|
644
|
+
SUPPORTED_POSITION_TYPES.has(normalizedPosition) && `standard-form__item--position-${normalizedPosition}`,
|
|
645
|
+
formItemClass
|
|
646
|
+
];
|
|
647
|
+
},
|
|
648
|
+
/**
|
|
649
|
+
* 获取选项的值
|
|
650
|
+
* @param {Object} option - 选项对象
|
|
651
|
+
* @param {Object} optionConfig - 选项配置
|
|
652
|
+
* @returns {String|Number} - 选项值
|
|
653
|
+
*/
|
|
654
|
+
getOptionValue(option, optionConfig = {}) {
|
|
655
|
+
const { valueKey } = optionConfig;
|
|
656
|
+
return valueKey ? option[valueKey] : option.value;
|
|
657
|
+
},
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* 获取选项的标签
|
|
661
|
+
* @param {Object} option - 选项对象
|
|
662
|
+
* @param {Object} optionConfig - 选项配置
|
|
663
|
+
* @returns {String} - 选项标签
|
|
664
|
+
*/
|
|
665
|
+
getOptionLabel(option, optionConfig = {}) {
|
|
666
|
+
const { labelKey, labelRender } = optionConfig;
|
|
667
|
+
|
|
668
|
+
if (labelRender && typeof labelRender === "function") {
|
|
669
|
+
return labelRender(option);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
return labelKey ? option[labelKey] : option.label || option.name;
|
|
673
|
+
},
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* 获取字段显示值(优先显示 _str 字段)
|
|
677
|
+
* @param {Object} params - 参数对象
|
|
678
|
+
* @param {String} params.name - 字段名
|
|
679
|
+
* @param {String} params.type - 字段类型
|
|
680
|
+
* @param {String} params.valuePrefix - 值前缀
|
|
681
|
+
* @param {String} params.label - 字段标签
|
|
682
|
+
* @returns {String|Number} - 显示值
|
|
683
|
+
*/
|
|
684
|
+
defaultValueRender({ name, type, valuePrefix = "", label = "" }) {
|
|
685
|
+
const strValue = this.formData[`${name}_str`];
|
|
686
|
+
const normalValue = this.formData[name];
|
|
687
|
+
const defaultValue = strValue || normalValue;
|
|
688
|
+
|
|
689
|
+
if (Uts.isNumber(defaultValue)) {
|
|
690
|
+
return defaultValue;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (type === "module" || !label || (!valuePrefix && !defaultValue && !this.emptyStr)) {
|
|
694
|
+
return "";
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if (!defaultValue && defaultValue !== 0) {
|
|
698
|
+
return this.emptyStr;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return `${valuePrefix}${defaultValue}`;
|
|
702
|
+
},
|
|
703
|
+
/**
|
|
704
|
+
* 获取标签类型
|
|
705
|
+
* @param {Object} atts - 属性对象
|
|
706
|
+
* @returns {String} - 标签类型
|
|
707
|
+
*/
|
|
708
|
+
getTagType(atts = {}) {
|
|
709
|
+
const { options = [], prop = "", propValueField = prop.replace("_str", "") } = atts;
|
|
710
|
+
const [option] = Uts.filterObjByCondition(options, { value: this.formData[propValueField] }) || [];
|
|
711
|
+
const { tagType = "" } = option || {};
|
|
712
|
+
return tagType;
|
|
713
|
+
},
|
|
714
|
+
/**
|
|
715
|
+
* 获取表单项标签文本
|
|
716
|
+
* @param {String} label - 标签文本
|
|
717
|
+
* @param {String} type - 表单项类型
|
|
718
|
+
* @returns {String} - 处理后的标签文本
|
|
719
|
+
*/
|
|
720
|
+
formItemLabel(label = "", type = "text") {
|
|
721
|
+
if (!label) {
|
|
722
|
+
return "";
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (this.existModuleType && this.rawLabelSuffix && type !== "module") {
|
|
726
|
+
return `${label}${this.rawLabelSuffix}`;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
return label;
|
|
730
|
+
},
|
|
731
|
+
/**
|
|
732
|
+
* 计算表单项的标签宽度
|
|
733
|
+
* @param {Object} otherAttributes - 其他属性对象
|
|
734
|
+
* @returns {String} - 标签宽度
|
|
735
|
+
*/
|
|
736
|
+
calcLabelWidth(otherAttributes = {}) {
|
|
737
|
+
// 优先使用每项配置的 labelWidth,其次复用已缓存的 formLabelWidth computed(避免重复读 $attrs)
|
|
738
|
+
return otherAttributes.labelWidth || otherAttributes["label-width"] || this.formLabelWidth;
|
|
739
|
+
},
|
|
740
|
+
/**
|
|
741
|
+
* 重置表单数据
|
|
742
|
+
*/
|
|
743
|
+
resetFormData() {
|
|
744
|
+
// 通过事件通知父组件重置数据
|
|
745
|
+
if (Uts.isArray(this.$refs.InstitutionSelectRef)) {
|
|
746
|
+
this.$refs.InstitutionSelectRef.forEach((refItem) => {
|
|
747
|
+
if (Uts.isFunction(refItem.onDelete)) {
|
|
748
|
+
refItem.onDelete();
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
this.$emit("reset-form", Uts.copyObj(this.originFormData));
|
|
753
|
+
},
|
|
754
|
+
/**
|
|
755
|
+
* 获取表单实例
|
|
756
|
+
*/
|
|
757
|
+
getFormInstance() {
|
|
758
|
+
return this.$refs[this.formRef];
|
|
759
|
+
},
|
|
760
|
+
validate(callback) {
|
|
761
|
+
const form = this.getFormInstance();
|
|
762
|
+
if (!form) return Promise.reject(new Error("Form ref not found"));
|
|
763
|
+
return form.validate(callback);
|
|
764
|
+
},
|
|
765
|
+
clearValidate(props) {
|
|
766
|
+
const form = this.getFormInstance();
|
|
767
|
+
if (form) form.clearValidate(props);
|
|
768
|
+
},
|
|
769
|
+
validateField(props, callback) {
|
|
770
|
+
const form = this.getFormInstance();
|
|
771
|
+
if (form) form.validateField(props, callback);
|
|
772
|
+
},
|
|
773
|
+
// ─── 类型判断方法(供模板调用,使用模块级 Set,O(1) 查找)─────────────────────
|
|
774
|
+
isEditExcludeType(type) {
|
|
775
|
+
return EDIT_EXCLUDE_TYPES.has(type);
|
|
776
|
+
},
|
|
777
|
+
isBusinessSwitchType(type) {
|
|
778
|
+
return BUSINESS_SWITCH_TYPES.has(type);
|
|
779
|
+
},
|
|
780
|
+
isInstitutionSelectType(type) {
|
|
781
|
+
return INSTITUTION_SELECT_TYPES.has(type);
|
|
782
|
+
},
|
|
783
|
+
isInflyCheckboxType(type) {
|
|
784
|
+
return INFLY_CHECKBOX_TYPES.has(type);
|
|
785
|
+
},
|
|
786
|
+
isInflyInputType(type) {
|
|
787
|
+
return INFLY_INPUT_TYPES.has(type);
|
|
788
|
+
},
|
|
789
|
+
isDatePickerType(type) {
|
|
790
|
+
return DATE_PICKER_TYPES.has(type);
|
|
791
|
+
},
|
|
792
|
+
isSecTabGroupType(type) {
|
|
793
|
+
return type === INTERNAL_TABGROUP_TYPE;
|
|
794
|
+
},
|
|
795
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
796
|
+
/**
|
|
797
|
+
* 按钮点击事件处理
|
|
798
|
+
* @param {Object} btnItem - 按钮配置对象
|
|
799
|
+
*/
|
|
800
|
+
handleBtnClick(btnItem = {}) {
|
|
801
|
+
const {
|
|
802
|
+
click,
|
|
803
|
+
btnEvent = click,
|
|
804
|
+
exportUrl,
|
|
805
|
+
exportFileName,
|
|
806
|
+
exportFunc,
|
|
807
|
+
exportMethod,
|
|
808
|
+
dealParams,
|
|
809
|
+
...otherBtnParams
|
|
810
|
+
} = btnItem;
|
|
811
|
+
|
|
812
|
+
// 列表里面查询用到的请求参数,一般与导出参数一致
|
|
813
|
+
const { page, pagesize, ...exportParams } = this.reqParams;
|
|
814
|
+
|
|
815
|
+
// 处理函数类型的按钮事件
|
|
816
|
+
if (Uts.isFunction(btnEvent)) {
|
|
817
|
+
btnEvent(btnItem, this.formData);
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// 处理字符串类型的按钮事件
|
|
822
|
+
if (Uts.isString(btnEvent)) {
|
|
823
|
+
if (btnEvent === "submit") {
|
|
824
|
+
this.validate((valid) => {
|
|
825
|
+
if (valid) {
|
|
826
|
+
this.$emit("submit", btnItem);
|
|
827
|
+
} else {
|
|
828
|
+
console.log("error submit!!");
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
this.$emit(btnEvent, btnItem);
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// 处理导出功能
|
|
838
|
+
if (exportUrl) {
|
|
839
|
+
const request = this.resolveExportRequest(exportFunc);
|
|
840
|
+
if (!request) {
|
|
841
|
+
const error = new Error("InflyForm export request is not configured");
|
|
842
|
+
Message.error(error.message);
|
|
843
|
+
this.$emit("export-request-error", error, btnItem);
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
exportFile({
|
|
848
|
+
url: exportUrl,
|
|
849
|
+
fileName: exportFileName,
|
|
850
|
+
params: Uts.isFunction(dealParams) ? dealParams(exportParams, this.formData) : exportParams,
|
|
851
|
+
request,
|
|
852
|
+
reqMethod: exportMethod,
|
|
853
|
+
message: Message,
|
|
854
|
+
messageBox: MessageBox,
|
|
855
|
+
loading: Loading,
|
|
856
|
+
...otherBtnParams
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
|
|
861
|
+
resolveExportRequest(exportFunc) {
|
|
862
|
+
return exportFunc || this.request || this.$axios || null;
|
|
863
|
+
},
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* 处理数组形式的字段名
|
|
867
|
+
* @param {String|Array} name - 字段名或字段名数组
|
|
868
|
+
* @returns {String} - 处理后的字段名
|
|
869
|
+
*/
|
|
870
|
+
getFieldKey(name) {
|
|
871
|
+
return Array.isArray(name) ? name.join(",") : name;
|
|
872
|
+
},
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* 获取日期选择器的值
|
|
876
|
+
* @param {String|Array} name - 字段名或字段名数组
|
|
877
|
+
* @param {String} type - 日期选择器类型
|
|
878
|
+
* @returns {*} - 日期选择器的值
|
|
879
|
+
*/
|
|
880
|
+
getDatePickerValue(name) {
|
|
881
|
+
if (!Array.isArray(name)) {
|
|
882
|
+
return this.formData[name];
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const [startField, endField] = name;
|
|
886
|
+
const startValue = this.formData[startField];
|
|
887
|
+
const endValue = this.formData[endField];
|
|
888
|
+
return startValue && endValue ? [startValue, endValue] : undefined;
|
|
889
|
+
},
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* 处理日期选择器输入
|
|
893
|
+
* @param {*} value - 日期选择器的值
|
|
894
|
+
* @param {String|Array} name - 字段名或字段名数组
|
|
895
|
+
* @param {String} type - 日期选择器类型
|
|
896
|
+
*/
|
|
897
|
+
handleDatePickerInput(value, name) {
|
|
898
|
+
if (!Array.isArray(name)) {
|
|
899
|
+
this.$set(this.formData, name, value);
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
const [startField, endField] = name;
|
|
904
|
+
const [startValue = "", endValue = ""] = value || [];
|
|
905
|
+
|
|
906
|
+
this.$set(this.formData, startField, startValue);
|
|
907
|
+
this.$set(this.formData, endField, endValue);
|
|
908
|
+
this.$set(this.formData, name.join(","), value || "");
|
|
909
|
+
},
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* 获取日期范围显示文本(非编辑状态)
|
|
913
|
+
* @param {String|Array} name - 字段名或字段名数组
|
|
914
|
+
* @returns {String} - 显示文本
|
|
915
|
+
*/
|
|
916
|
+
getDateRangeDisplay(name) {
|
|
917
|
+
if (Array.isArray(name)) {
|
|
918
|
+
const [startField, endField] = name;
|
|
919
|
+
const startValue = this.formData[startField];
|
|
920
|
+
const endValue = this.formData[endField];
|
|
921
|
+
|
|
922
|
+
if (startValue && endValue) {
|
|
923
|
+
return `${startValue} 至 ${endValue}`;
|
|
924
|
+
}
|
|
925
|
+
return "";
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
return this.formData[name] || "";
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
</script>
|
|
933
|
+
|
|
934
|
+
<style lang="scss" scoped>
|
|
935
|
+
.comp-InflyForm {
|
|
936
|
+
position: relative;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.infly-form__wrap {
|
|
940
|
+
.el-form .el-form-item.el-form-item--mini {
|
|
941
|
+
margin-bottom: 18px;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.form__switch-text {
|
|
945
|
+
display: inline-block;
|
|
946
|
+
white-space: normal;
|
|
947
|
+
overflow-wrap: break-word;
|
|
948
|
+
word-break: break-all;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.infly-form__sec-tab-btns {
|
|
952
|
+
text-align: right;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
.btn-list__wrap {
|
|
957
|
+
z-index: 100;
|
|
958
|
+
position: absolute;
|
|
959
|
+
top: 0;
|
|
960
|
+
right: 0;
|
|
961
|
+
width: 140px;
|
|
962
|
+
text-align: right;
|
|
963
|
+
|
|
964
|
+
&--row {
|
|
965
|
+
display: flex;
|
|
966
|
+
width: auto;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
&--bottom {
|
|
970
|
+
display: flex;
|
|
971
|
+
margin-left: 8px;
|
|
972
|
+
|
|
973
|
+
& .el-button {
|
|
974
|
+
margin-right: 8px;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.btn-list__item {
|
|
979
|
+
margin-bottom: 8px;
|
|
980
|
+
|
|
981
|
+
& + .btn-list__item {
|
|
982
|
+
margin-left: 12px;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
</style>
|