cloud-web-corejs 1.1.0-dev.10 → 1.1.0-dev.13
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/VabUpload/view.vue +25 -25
- package/src/components/excelExport/exportColumnMemory.js +118 -0
- package/src/components/excelExport/exportFieldDialog.vue +50 -38
- package/src/components/excelExport/index.js +30 -13
- package/src/components/excelExport/mixins.js +390 -64
- package/src/components/excelImport/mixins.js +898 -850
- package/src/components/mobile/wf/addTaskUserdialog.vue +100 -100
- package/src/components/mobile/wf/content.vue +5 -5
- package/src/components/mobile/wf/deleteTaskUserDialog.vue +73 -73
- package/src/components/mobile/wf/selectUserDialog.vue +8 -12
- package/src/components/mobile/wf/setCandidateDialog.vue +69 -69
- package/src/components/mobile/wf/urgingDialog.vue +75 -75
- package/src/components/table/index.js +14 -1
- package/src/components/table/vxeFilter/mixin.js +28 -18
- package/src/components/xform/docs/2026-07 table/344/270/216excelExport/344/277/256/345/244/215/345/217/212/345/257/274/345/207/272/344/274/230/345/214/226.md" +64 -57
- package/src/components/xform/docs/2026-09 /346/235/241/344/273/266/345/257/274/345/207/272/345/244/247/346/225/260/346/215/256/351/207/217/345/264/251/346/272/203/346/216/222/346/237/245.md" +389 -0
- package/src/components/xform/form-designer/form-widget/container-widget/detail-h5-widget.vue +243 -243
- package/src/components/xform/form-designer/form-widget/container-widget/h5-card-pane-widget.vue +228 -228
- package/src/components/xform/form-designer/form-widget/container-widget/h5-card-widget.vue +165 -165
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +61 -2
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +3 -0
- package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -145
- package/src/components/xform/form-render/container-item/data-table-item.vue +350 -347
- package/src/components/xform/form-render/container-item/data-table-mixin.js +240 -37
- package/src/components/xform/form-render/container-item/detail-h5-item.vue +1 -1
- package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -1
- package/src/components/xform/styles/h5.scss +483 -459
- package/src/components/xform/utils/dynamicSchemaUtil.js +385 -361
- package/src/layout/components/TagsView/index.vue +325 -323
- package/src/store/modules/tagsView.js +241 -217
- package/src/utils/importLimit.js +72 -0
- package/src/utils/pdfUtil.js +6 -1
- package/src/utils/request.js +17 -0
|
@@ -1,850 +1,898 @@
|
|
|
1
|
-
/**version-1.0*/
|
|
2
|
-
import { read, utils } from "xlsx";
|
|
3
|
-
|
|
4
|
-
let tmixins = {};
|
|
5
|
-
var XLSX = window.XLSX || { read, utils };
|
|
6
|
-
import { getToken } from "../../utils/auth";
|
|
7
|
-
import XEUtils from "xe-utils";
|
|
8
|
-
import { getErrorMsg } from "@base/utils/index.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
fixed: "left",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
this.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
this.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
this.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
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
|
-
var
|
|
524
|
-
var
|
|
525
|
-
|
|
526
|
-
|
|
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
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
if (
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
let
|
|
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
|
-
if (resultMsg.type === "success") {
|
|
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
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
let
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
let
|
|
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
|
-
|
|
1
|
+
/**version-1.0*/
|
|
2
|
+
import { read, utils } from "xlsx";
|
|
3
|
+
|
|
4
|
+
let tmixins = {};
|
|
5
|
+
var XLSX = window.XLSX || { read, utils };
|
|
6
|
+
import { getToken } from "../../utils/auth";
|
|
7
|
+
import XEUtils from "xe-utils";
|
|
8
|
+
import { getErrorMsg } from "@base/utils/index.js";
|
|
9
|
+
import {
|
|
10
|
+
getImportCellText,
|
|
11
|
+
getImportFileSizeLimit,
|
|
12
|
+
getImportRowLimit,
|
|
13
|
+
isImportFileOversize,
|
|
14
|
+
isImportRowsOverLimit,
|
|
15
|
+
toFileSizeMb,
|
|
16
|
+
} from "../../utils/importLimit";
|
|
17
|
+
|
|
18
|
+
let configUtil = {
|
|
19
|
+
baseUrl: process.env.VUE_APP_BASE_API,
|
|
20
|
+
XLSX,
|
|
21
|
+
getToken,
|
|
22
|
+
};
|
|
23
|
+
// 计时器与遮罩句柄必须挂实例:模块级单例在 tagsView 同时开两个导入页时会被后开的
|
|
24
|
+
// 那个覆盖,先开的 100ms interval 永远停不掉,还会把整个组件钉住不被回收。
|
|
25
|
+
tmixins = {
|
|
26
|
+
name: "excelImport",
|
|
27
|
+
props: ["param"],
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
excTime: 0,
|
|
31
|
+
showImportDialog: false,
|
|
32
|
+
showImportDialog2: false,
|
|
33
|
+
falseValue: false,
|
|
34
|
+
fileRaw: false,
|
|
35
|
+
isEnd: false,
|
|
36
|
+
currentIndex: 0,
|
|
37
|
+
excelTemplate: "",
|
|
38
|
+
prefix: "/user",
|
|
39
|
+
dataSize: 0,
|
|
40
|
+
totalSuccessNum: 0,
|
|
41
|
+
totalErrorNum: 0,
|
|
42
|
+
percentageNum: 0,
|
|
43
|
+
successRows: [],
|
|
44
|
+
failRows: [],
|
|
45
|
+
oriCols: [],
|
|
46
|
+
showImportResult: false,
|
|
47
|
+
resultType: "",
|
|
48
|
+
option: {},
|
|
49
|
+
showContent: false,
|
|
50
|
+
resOption: {},
|
|
51
|
+
importTimer: null,
|
|
52
|
+
loadingObj: null,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
created() {},
|
|
56
|
+
beforeDestroy() {
|
|
57
|
+
this.clearImportTimer();
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
initResGird() {
|
|
61
|
+
var that = this;
|
|
62
|
+
let tableRef = "resGrid";
|
|
63
|
+
let columns = [
|
|
64
|
+
{
|
|
65
|
+
type: "checkbox",
|
|
66
|
+
fixed: "left",
|
|
67
|
+
width: 48,
|
|
68
|
+
resizable: false,
|
|
69
|
+
headerClassName: "vxe-hcs",
|
|
70
|
+
className: "vxe-hcs",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
field: "impNumber",
|
|
74
|
+
title: this.$t2("行号", "components.excelImport.impNumber"),
|
|
75
|
+
width: 100,
|
|
76
|
+
fixed: "left",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
field: "_resultContent",
|
|
80
|
+
title: this.$t2("结果", "components.excelImport.resultContent"),
|
|
81
|
+
width: 250,
|
|
82
|
+
fixed: "left",
|
|
83
|
+
slots: {
|
|
84
|
+
default: ({ row, $rowIndex, $table }) => {
|
|
85
|
+
return that.handleRes(row._resultContent);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
let cCols = this.oriCols.map((oriCol, index) => {
|
|
91
|
+
let col = {
|
|
92
|
+
field: oriCol.field,
|
|
93
|
+
title: oriCol.title,
|
|
94
|
+
width: 150,
|
|
95
|
+
};
|
|
96
|
+
if (index === 0) {
|
|
97
|
+
col.fixed = "left";
|
|
98
|
+
}
|
|
99
|
+
return col;
|
|
100
|
+
});
|
|
101
|
+
columns = columns.concat(cCols);
|
|
102
|
+
|
|
103
|
+
let tableOption = {
|
|
104
|
+
vue: this,
|
|
105
|
+
tableRef: tableRef,
|
|
106
|
+
tableNameRequired: false,
|
|
107
|
+
columns: columns,
|
|
108
|
+
config: {
|
|
109
|
+
toolbarConfig: {
|
|
110
|
+
custom: false,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
|
|
116
|
+
this.resOption = opts;
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
exc() {
|
|
120
|
+
this.option = this.param;
|
|
121
|
+
this.showContent = true;
|
|
122
|
+
this.showImportDialog = true;
|
|
123
|
+
this.showImportDialog2 = false;
|
|
124
|
+
},
|
|
125
|
+
showSuccessResult() {
|
|
126
|
+
this.showImportResult = true;
|
|
127
|
+
this.resultType = 1;
|
|
128
|
+
this.$nextTick(() => {
|
|
129
|
+
this.initResGird();
|
|
130
|
+
this.$nextTick(() => {
|
|
131
|
+
let tDatas = this.successRows.map((item, index) => {
|
|
132
|
+
item.id = index;
|
|
133
|
+
return item;
|
|
134
|
+
});
|
|
135
|
+
this.$refs.resGrid.loadData(tDatas);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
showErrorResult() {
|
|
140
|
+
this.showImportResult = true;
|
|
141
|
+
this.resultType = 0;
|
|
142
|
+
this.$nextTick(() => {
|
|
143
|
+
this.initResGird();
|
|
144
|
+
this.$nextTick(() => {
|
|
145
|
+
let tDatas = this.failRows.map((item, index) => {
|
|
146
|
+
item.id = index;
|
|
147
|
+
return item;
|
|
148
|
+
});
|
|
149
|
+
this.$refs.resGrid.loadData(tDatas);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
fileChange(file) {
|
|
154
|
+
if (file) {
|
|
155
|
+
this.fileRaw = file.raw;
|
|
156
|
+
} else {
|
|
157
|
+
this.fileRaw = false;
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
dialogClose1() {
|
|
161
|
+
this.$emit("update:visiable", false);
|
|
162
|
+
this.showContent = false;
|
|
163
|
+
},
|
|
164
|
+
async dialogPrimary1() {
|
|
165
|
+
let that = this;
|
|
166
|
+
let option = this.option;
|
|
167
|
+
let saveUrl = option.saveUrl;
|
|
168
|
+
if (!saveUrl) {
|
|
169
|
+
this.dialogPrimary3();
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!this.fileRaw) {
|
|
174
|
+
this.$baseAlert(
|
|
175
|
+
this.$t2("请上传附件", "components.excelImport.warmMsg1")
|
|
176
|
+
);
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
this.createImportTimer();
|
|
180
|
+
this.showImportDialog = false;
|
|
181
|
+
if (!option.onConfirm) {
|
|
182
|
+
this.showImportDialog2 = true;
|
|
183
|
+
}
|
|
184
|
+
this.$nextTick(() => {
|
|
185
|
+
try {
|
|
186
|
+
this.readExcel(this.fileRaw, function (resultData) {
|
|
187
|
+
if (option.onConfirm) {
|
|
188
|
+
option.onConfirm(resultData.data, that.fileRaw);
|
|
189
|
+
} else {
|
|
190
|
+
that.syncDataForImport({
|
|
191
|
+
multi: false,
|
|
192
|
+
data: resultData,
|
|
193
|
+
saveUrl: saveUrl,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
} catch (et) {
|
|
198
|
+
that.clearImportTimer();
|
|
199
|
+
console.error(et);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
handleBeforeClose(hide) {
|
|
204
|
+
this.option.onCancel
|
|
205
|
+
&& this.option.onCancel(this.getCallbackData(), this.fileRaw);
|
|
206
|
+
hide();
|
|
207
|
+
},
|
|
208
|
+
dialogClose2() {
|
|
209
|
+
this.showImportDialog2 = false;
|
|
210
|
+
this.option.onBeforeCancel
|
|
211
|
+
&& this.option.onBeforeCancel(this.getCallbackData(), this.fileRaw);
|
|
212
|
+
},
|
|
213
|
+
handleClose2() {
|
|
214
|
+
this.clearImportTimer();
|
|
215
|
+
this.showImportDialog2 = false;
|
|
216
|
+
this.showContent = false;
|
|
217
|
+
this.option.onClose
|
|
218
|
+
&& this.option.onClose(this.getCallbackData(), this.fileRaw);
|
|
219
|
+
this.option.callback
|
|
220
|
+
&& this.option.callback(this.getCallbackData(), this.fileRaw);
|
|
221
|
+
},
|
|
222
|
+
dialogPrimary2() {
|
|
223
|
+
this.showImportDialog2 = false;
|
|
224
|
+
this.option.onBeforeConfirm
|
|
225
|
+
&& this.option.onBeforeConfirm(this.getCallbackData(), this.fileRaw);
|
|
226
|
+
},
|
|
227
|
+
getCallbackData() {
|
|
228
|
+
return {
|
|
229
|
+
...this.resultData,
|
|
230
|
+
successRows: this.successRows,
|
|
231
|
+
failRows: this.failRows,
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
async readExcel(file, callback) {
|
|
235
|
+
let that = this;
|
|
236
|
+
let option = this.option;
|
|
237
|
+
|
|
238
|
+
// 整文件读进内存前先卡一刀:下面的 readAsBinaryString + XLSX.read 是同步的,
|
|
239
|
+
// 占用约为文件体积的 5~20 倍,超限时崩在库内部,连提示都给不出来。
|
|
240
|
+
if (isImportFileOversize(file, option)) {
|
|
241
|
+
this.showImportDialog2 = false;
|
|
242
|
+
this.showContent = false;
|
|
243
|
+
this.clearImportTimer();
|
|
244
|
+
this.$baseAlert(
|
|
245
|
+
this.$t1(
|
|
246
|
+
"导入文件过大({size}MB),当前最多支持 {limit}MB,请拆分后分批导入",
|
|
247
|
+
{
|
|
248
|
+
size: toFileSizeMb(file.size),
|
|
249
|
+
limit: toFileSizeMb(getImportFileSizeLimit(option)),
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
);
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const fileReader = new FileReader();
|
|
257
|
+
fileReader.onload = async (ev) => {
|
|
258
|
+
var resultData;
|
|
259
|
+
try {
|
|
260
|
+
const data = ev.target.result;
|
|
261
|
+
const workbook = configUtil.XLSX.read(data, {
|
|
262
|
+
type: "binary",
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
var sheet = workbook.Sheets[workbook.SheetNames[0]];
|
|
266
|
+
if (sheet["!ref"] === undefined) {
|
|
267
|
+
that.showImportDialog2 = false;
|
|
268
|
+
that.showContent = false;
|
|
269
|
+
that.clearImportTimer();
|
|
270
|
+
that.$baseAlert(
|
|
271
|
+
this.$t2(
|
|
272
|
+
"请使用正确的导入模版!",
|
|
273
|
+
"components.excelImport.warmMsg2"
|
|
274
|
+
)
|
|
275
|
+
);
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
var range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
|
|
279
|
+
var dataSize = range.e.r + 1; //行数
|
|
280
|
+
that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
|
|
281
|
+
// 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时
|
|
282
|
+
// 主线程会被占死甚至 OOM。文件本身不大但行极多(窄表)时只有这一道能拦。
|
|
283
|
+
if (isImportRowsOverLimit(that.dataSize, option)) {
|
|
284
|
+
that.showImportDialog2 = false;
|
|
285
|
+
that.showContent = false;
|
|
286
|
+
that.clearImportTimer();
|
|
287
|
+
that.$baseAlert(
|
|
288
|
+
that.$t1(
|
|
289
|
+
"导入数据 {size} 行,超过单次上限 {limit} 行,请拆分后分批导入",
|
|
290
|
+
{
|
|
291
|
+
size: that.dataSize,
|
|
292
|
+
limit: getImportRowLimit(option),
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
var titles = [];
|
|
299
|
+
var fields = [];
|
|
300
|
+
|
|
301
|
+
const ws = workbook.Sheets[sheet];
|
|
302
|
+
|
|
303
|
+
let prefix = option.prefix;
|
|
304
|
+
let excelUrl = option.excel;
|
|
305
|
+
|
|
306
|
+
var excelRows = [];
|
|
307
|
+
var row;
|
|
308
|
+
var rowNum;
|
|
309
|
+
var colNum;
|
|
310
|
+
for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
|
|
311
|
+
row = [];
|
|
312
|
+
for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
|
|
313
|
+
var nextCell
|
|
314
|
+
= sheet[
|
|
315
|
+
configUtil.XLSX.utils.encode_cell({
|
|
316
|
+
r: rowNum,
|
|
317
|
+
c: colNum,
|
|
318
|
+
})
|
|
319
|
+
];
|
|
320
|
+
if (typeof nextCell === "undefined") {
|
|
321
|
+
row.push(void 0);
|
|
322
|
+
} else {
|
|
323
|
+
row.push(getImportCellText(nextCell));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (rowNum === 1) {
|
|
327
|
+
titles = row;
|
|
328
|
+
}
|
|
329
|
+
if (rowNum === 2) {
|
|
330
|
+
fields = row;
|
|
331
|
+
let checkResult = true;
|
|
332
|
+
if (!option.importAttachCode) {
|
|
333
|
+
await that
|
|
334
|
+
.checkExcelForImport(titles, fields, excelUrl, prefix)
|
|
335
|
+
.then((res) => {
|
|
336
|
+
if (res.type != "success") {
|
|
337
|
+
checkResult = false;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
if (!checkResult) {
|
|
341
|
+
that.showContent = false;
|
|
342
|
+
that.clearImportTimer();
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (rowNum > 2) {
|
|
348
|
+
let item = {};
|
|
349
|
+
for (let i = 0; i < fields.length; i++) {
|
|
350
|
+
let field = fields[i];
|
|
351
|
+
item[field] = row[i];
|
|
352
|
+
}
|
|
353
|
+
excelRows.push(item);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (
|
|
357
|
+
!titles.length
|
|
358
|
+
|| !fields.length
|
|
359
|
+
|| titles.length != fields.length
|
|
360
|
+
) {
|
|
361
|
+
that.showContent = false;
|
|
362
|
+
that.clearImportTimer();
|
|
363
|
+
that.$baseAlert(
|
|
364
|
+
this.$t2(
|
|
365
|
+
"请使用正确的导入模版!",
|
|
366
|
+
"components.excelImport.warmMsg2"
|
|
367
|
+
)
|
|
368
|
+
);
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
var columns = [];
|
|
373
|
+
var cols = [];
|
|
374
|
+
let uniqueFields = [];
|
|
375
|
+
for (let i = 0; i < titles.length; i++) {
|
|
376
|
+
let title = titles[i];
|
|
377
|
+
if (title) {
|
|
378
|
+
let field = fields[i];
|
|
379
|
+
if (field === null) {
|
|
380
|
+
that.showContent = false;
|
|
381
|
+
that.clearImportTimer();
|
|
382
|
+
that.$baseAlert(
|
|
383
|
+
this.$t2(
|
|
384
|
+
"请使用正确的导入模版!",
|
|
385
|
+
"components.excelImport.warmMsg2"
|
|
386
|
+
)
|
|
387
|
+
);
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
let t = title.substr(-1);
|
|
391
|
+
let u = title.length >= 2 ? title.substr(-2) : title;
|
|
392
|
+
let isNeed = false;
|
|
393
|
+
if (t === "*") {
|
|
394
|
+
isNeed = true;
|
|
395
|
+
}
|
|
396
|
+
let isUnique = false;
|
|
397
|
+
if (u === "**") {
|
|
398
|
+
uniqueFields.push(field);
|
|
399
|
+
isUnique = true;
|
|
400
|
+
}
|
|
401
|
+
let col = {
|
|
402
|
+
field: field,
|
|
403
|
+
title: title,
|
|
404
|
+
width: 100,
|
|
405
|
+
isNeed: isNeed,
|
|
406
|
+
isUnique: isUnique,
|
|
407
|
+
};
|
|
408
|
+
cols.push(col);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
var oriCols = JSON.parse(JSON.stringify(cols)); //列信息
|
|
413
|
+
if (uniqueFields.length) {
|
|
414
|
+
//分组唯一字段为空时,全部不发包。
|
|
415
|
+
for (let i = 0; i < oriCols.length; i++) {
|
|
416
|
+
let oriCol = oriCols[i];
|
|
417
|
+
if (oriCol.isNeed) {
|
|
418
|
+
for (let j = 0; j < excelRows.length; j++) {
|
|
419
|
+
let data = excelRows[j];
|
|
420
|
+
let value = data[oriCol.field];
|
|
421
|
+
if (value === null || value === "") {
|
|
422
|
+
that.clearImportTimer();
|
|
423
|
+
that.$baseAlert(
|
|
424
|
+
this.$t2(
|
|
425
|
+
"第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
|
|
426
|
+
"components.excelImport.warmMsg3",
|
|
427
|
+
{
|
|
428
|
+
lineNo: j + 4,
|
|
429
|
+
title: oriCol.title,
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
);
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
this.oriCols = oriCols;
|
|
441
|
+
|
|
442
|
+
resultData = {
|
|
443
|
+
data: excelRows,
|
|
444
|
+
titles: titles,
|
|
445
|
+
fields: fields,
|
|
446
|
+
uniqueFields: uniqueFields,
|
|
447
|
+
oriCols: oriCols,
|
|
448
|
+
};
|
|
449
|
+
this.resultData = resultData;
|
|
450
|
+
callback(resultData);
|
|
451
|
+
} catch (et) {
|
|
452
|
+
that.showContent = false;
|
|
453
|
+
that.clearImportTimer();
|
|
454
|
+
console.error(et);
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
fileReader.readAsBinaryString(file);
|
|
458
|
+
},
|
|
459
|
+
async checkExcelForImport(titles, fields, turl, prefix) {
|
|
460
|
+
let that = this;
|
|
461
|
+
var data = {
|
|
462
|
+
filed_name: fields,
|
|
463
|
+
field_note: titles,
|
|
464
|
+
url: turl,
|
|
465
|
+
};
|
|
466
|
+
var param = JSON.stringify(data);
|
|
467
|
+
return this.$http({
|
|
468
|
+
url: prefix + "/sf_common/compareExcelFields",
|
|
469
|
+
method: "post",
|
|
470
|
+
headers: {
|
|
471
|
+
"Content-Type": "application/json;charset=utf-8",
|
|
472
|
+
},
|
|
473
|
+
// data: param,
|
|
474
|
+
data: data,
|
|
475
|
+
});
|
|
476
|
+
},
|
|
477
|
+
syncDataForImport(opts) {
|
|
478
|
+
let that = this;
|
|
479
|
+
var multi = this.option.multi;
|
|
480
|
+
var resultData = opts.data;
|
|
481
|
+
var datas = resultData.data;
|
|
482
|
+
var titles = resultData.titles;
|
|
483
|
+
var fields = resultData.fields;
|
|
484
|
+
let uniqueFields = resultData.uniqueFields;
|
|
485
|
+
var saveUrl = opts.saveUrl;
|
|
486
|
+
var size = datas.length;
|
|
487
|
+
var index = 0;
|
|
488
|
+
var successNum = 0;
|
|
489
|
+
var failNum = 0;
|
|
490
|
+
var dialogObj = this.$refs.importDialog.$el;
|
|
491
|
+
var successNumObj = dialogObj.querySelector(".successNum");
|
|
492
|
+
var failNumObj = dialogObj.querySelector(".failNum");
|
|
493
|
+
var percentageObj = dialogObj.querySelector(".percentage");
|
|
494
|
+
var doneNumObj = dialogObj.querySelector(".doneNum");
|
|
495
|
+
dialogObj.querySelector(".dataSize").innerText = size;
|
|
496
|
+
|
|
497
|
+
that.successRows = [];
|
|
498
|
+
that.failRows = [];
|
|
499
|
+
|
|
500
|
+
var multiSize = opts.multiSize || 2;
|
|
501
|
+
|
|
502
|
+
let groupIndex = 0;
|
|
503
|
+
let groupDatas = [];
|
|
504
|
+
if (uniqueFields.length) {
|
|
505
|
+
let d = XEUtils.groupBy(datas, function (item, itemIndex, items) {
|
|
506
|
+
let keyArr = [];
|
|
507
|
+
uniqueFields.forEach((field) => {
|
|
508
|
+
keyArr.push(item[field]);
|
|
509
|
+
});
|
|
510
|
+
return keyArr.join("&_&");
|
|
511
|
+
});
|
|
512
|
+
for (let key in d) {
|
|
513
|
+
groupDatas.push(d[key]);
|
|
514
|
+
}
|
|
515
|
+
datas.forEach((item, itemIndex) => {
|
|
516
|
+
item.impSeq = itemIndex;
|
|
517
|
+
item.impNumber = itemIndex + 4;
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
var compareV = function (property) {
|
|
522
|
+
return function (a, b) {
|
|
523
|
+
var value1 = a[property];
|
|
524
|
+
var value2 = b[property];
|
|
525
|
+
return value1 - value2;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
var prevHandleData = function (percentageStr, excNum) {
|
|
530
|
+
successNumObj.innerText = successNum;
|
|
531
|
+
failNumObj.innerText = failNum;
|
|
532
|
+
doneNumObj.innerText = successNum + failNum;
|
|
533
|
+
that.percentageNum = percentageStr;
|
|
534
|
+
let isEnd = false;
|
|
535
|
+
if (uniqueFields.length) {
|
|
536
|
+
isEnd = groupIndex + 1 >= groupDatas.length;
|
|
537
|
+
} else {
|
|
538
|
+
isEnd = index + excNum >= size;
|
|
539
|
+
}
|
|
540
|
+
if (!isEnd) {
|
|
541
|
+
index = index + excNum;
|
|
542
|
+
groupIndex = groupIndex + 1;
|
|
543
|
+
setTimeout(function () {
|
|
544
|
+
handleData();
|
|
545
|
+
}, 1);
|
|
546
|
+
} else {
|
|
547
|
+
setTimeout(function () {
|
|
548
|
+
that.clearImportTimer();
|
|
549
|
+
}, 300);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
let getDefaultValue = (row) => {
|
|
554
|
+
let value = null;
|
|
555
|
+
let defaultValue = this.option.defaultValue;
|
|
556
|
+
if (defaultValue) {
|
|
557
|
+
if (typeof defaultValue === "function") {
|
|
558
|
+
value = defaultValue(row) || {};
|
|
559
|
+
} else {
|
|
560
|
+
value = defaultValue || {};
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return value;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
let handleData = () => {
|
|
567
|
+
if (!that.isEnd && index < size) {
|
|
568
|
+
var param;
|
|
569
|
+
var excNum;
|
|
570
|
+
if (multi) {
|
|
571
|
+
if (!uniqueFields.length) {
|
|
572
|
+
if (index + multiSize < size) {
|
|
573
|
+
excNum = multiSize;
|
|
574
|
+
} else {
|
|
575
|
+
excNum = size - index;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
let dataList = [];
|
|
579
|
+
for (let i = 0; i < excNum; i++) {
|
|
580
|
+
var mIndex = index + i;
|
|
581
|
+
let mData = datas[mIndex];
|
|
582
|
+
mData.impSeq = mIndex;
|
|
583
|
+
mData.impNumber = mIndex + 4;
|
|
584
|
+
|
|
585
|
+
let errorInfo = that.vailData(mData, opts);
|
|
586
|
+
if (errorInfo.length > 0) {
|
|
587
|
+
mData._resultType = "error";
|
|
588
|
+
mData._resultContent = errorInfo;
|
|
589
|
+
failNum++;
|
|
590
|
+
that.failRows.push(mData);
|
|
591
|
+
} else {
|
|
592
|
+
let defaultValue = getDefaultValue(mData);
|
|
593
|
+
if (defaultValue) {
|
|
594
|
+
Object.assign(mData, defaultValue);
|
|
595
|
+
}
|
|
596
|
+
dataList.push(mData);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
datas[mIndex] = mData;
|
|
600
|
+
}
|
|
601
|
+
if (dataList.length > 0) {
|
|
602
|
+
param = dataList;
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
excNum = groupDatas[groupIndex].length;
|
|
606
|
+
param = groupDatas[groupIndex];
|
|
607
|
+
}
|
|
608
|
+
} else {
|
|
609
|
+
var data = datas[index];
|
|
610
|
+
data.impSeq = index;
|
|
611
|
+
data.impNumber = index + 4;
|
|
612
|
+
excNum = 1;
|
|
613
|
+
datas[index] = data;
|
|
614
|
+
|
|
615
|
+
let errorInfo = that.vailData(data, opts);
|
|
616
|
+
if (errorInfo.length > 0) {
|
|
617
|
+
data._resultType = "error";
|
|
618
|
+
data._resultContent = errorInfo;
|
|
619
|
+
failNum++;
|
|
620
|
+
that.failRows.push(data);
|
|
621
|
+
} else {
|
|
622
|
+
param = data;
|
|
623
|
+
let defaultValue = getDefaultValue(data);
|
|
624
|
+
if (defaultValue) {
|
|
625
|
+
Object.assign(param, defaultValue);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
var percentageStr = parseInt(((index + excNum) * 100) / size);
|
|
631
|
+
if (param === null || param.length === 0) {
|
|
632
|
+
if (that.showContent) {
|
|
633
|
+
prevHandleData(percentageStr, excNum);
|
|
634
|
+
}
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
that
|
|
639
|
+
.$http({
|
|
640
|
+
url: saveUrl,
|
|
641
|
+
method: "post",
|
|
642
|
+
data: param,
|
|
643
|
+
resultType: "special",
|
|
644
|
+
modal: false,
|
|
645
|
+
callback: (resultMsg) => {
|
|
646
|
+
if (multi) {
|
|
647
|
+
if (resultMsg.type === "success") {
|
|
648
|
+
var multiRows = resultMsg.objx;
|
|
649
|
+
for (let i = 0; i < multiRows.length; i++) {
|
|
650
|
+
var multiRow = multiRows[i];
|
|
651
|
+
var data = { ...datas[multiRow.impSeq] };
|
|
652
|
+
data._rqeData = { ...datas[multiRow.impSeq] };
|
|
653
|
+
data._resultData = multiRow;
|
|
654
|
+
data._resultType = multiRow.impReturnType;
|
|
655
|
+
data._resultContent
|
|
656
|
+
= multiRow.impReturnType === "success"
|
|
657
|
+
? this.$t2(
|
|
658
|
+
"导入成功",
|
|
659
|
+
"components.excelImport.importSucess"
|
|
660
|
+
)
|
|
661
|
+
: multiRow.impReturnMsg;
|
|
662
|
+
if (multiRow.impReturnType === "success") {
|
|
663
|
+
successNum++;
|
|
664
|
+
that.successRows.push(data);
|
|
665
|
+
} else {
|
|
666
|
+
failNum++;
|
|
667
|
+
that.failRows.push(data);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
that.failRows = that.failRows.sort(compareV("impSeq"));
|
|
672
|
+
} else {
|
|
673
|
+
// error_win(resultMsg);
|
|
674
|
+
// layer.close(opts.dialogObjIndex);
|
|
675
|
+
that.$errorMsg(resultMsg);
|
|
676
|
+
that.showContent = false;
|
|
677
|
+
that.clearImportTimer();
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
} else {
|
|
681
|
+
var data = { ...datas[index] };
|
|
682
|
+
data._resultType = resultMsg.type;
|
|
683
|
+
data._resultContent
|
|
684
|
+
= resultMsg.type === "success"
|
|
685
|
+
? this.$t2(
|
|
686
|
+
"导入成功",
|
|
687
|
+
"components.excelImport.importSucess"
|
|
688
|
+
)
|
|
689
|
+
: this.handleRes(resultMsg.content);
|
|
690
|
+
data._rqeData = { ...datas[index] };
|
|
691
|
+
data._resultData = resultMsg.objx;
|
|
692
|
+
if (resultMsg.type === "success") {
|
|
693
|
+
successNum++;
|
|
694
|
+
that.successRows.push(data);
|
|
695
|
+
} else {
|
|
696
|
+
failNum++;
|
|
697
|
+
that.failRows.push(data);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
if (that.showContent) {
|
|
701
|
+
prevHandleData(percentageStr, excNum);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
})
|
|
705
|
+
.catch(function (et) {
|
|
706
|
+
that.isEnd = true;
|
|
707
|
+
that.clearImportTimer();
|
|
708
|
+
console.error(et);
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
handleData();
|
|
713
|
+
},
|
|
714
|
+
commonLocalDownload() {
|
|
715
|
+
if (this.option.importAttachCode) {
|
|
716
|
+
this.commonLocalDownload2();
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
let path = this.option.excel;
|
|
720
|
+
let prefix = this.option.prefix;
|
|
721
|
+
prefix = prefix || "";
|
|
722
|
+
var url = configUtil.baseUrl + prefix + "/sf_common/download";
|
|
723
|
+
if (path) {
|
|
724
|
+
var params = {
|
|
725
|
+
url: path,
|
|
726
|
+
};
|
|
727
|
+
params["access_token"] = configUtil.getToken();
|
|
728
|
+
|
|
729
|
+
var form = document.createElement("form");
|
|
730
|
+
|
|
731
|
+
let randomNum
|
|
732
|
+
= new Date().valueOf() + Math.floor(Math.random() * 1000000);
|
|
733
|
+
let formId = "formId-" + randomNum;
|
|
734
|
+
let formName = "formName-" + randomNum;
|
|
735
|
+
|
|
736
|
+
form.id = formId;
|
|
737
|
+
form.name = formName;
|
|
738
|
+
form.target = "_blank";
|
|
739
|
+
document.body.appendChild(form);
|
|
740
|
+
for (let obj in params) {
|
|
741
|
+
if (params.hasOwnProperty(obj)) {
|
|
742
|
+
let input = document.createElement("input");
|
|
743
|
+
input.tpye = "hidden";
|
|
744
|
+
input.name = obj;
|
|
745
|
+
input.value = params[obj];
|
|
746
|
+
form.appendChild(input);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
form.method = "post"; //请求方式
|
|
750
|
+
form.action = url;
|
|
751
|
+
form.submit();
|
|
752
|
+
document.body.removeChild(form);
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
commonLocalDownload2() {
|
|
756
|
+
let importAttachCode = this.option.importAttachCode;
|
|
757
|
+
if (!importAttachCode) return;
|
|
758
|
+
this.$http({
|
|
759
|
+
url: USER_PREFIX + "/bd_attach_setting/getByCode",
|
|
760
|
+
method: "post",
|
|
761
|
+
data: {
|
|
762
|
+
stringOne: importAttachCode,
|
|
763
|
+
},
|
|
764
|
+
success: (res) => {
|
|
765
|
+
let fileObj = res.objx;
|
|
766
|
+
let url = fileObj?.url;
|
|
767
|
+
if (fileObj && url) {
|
|
768
|
+
this.$commonFileUtil.downloadFile(url, fileObj.name);
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
});
|
|
772
|
+
},
|
|
773
|
+
vailData(data, opts) {
|
|
774
|
+
var oriCols = opts.data.oriCols;
|
|
775
|
+
var errorInfo = [];
|
|
776
|
+
for (let i = 0; i < oriCols.length; i++) {
|
|
777
|
+
let oriCol = oriCols[i];
|
|
778
|
+
if (oriCol.isNeed) {
|
|
779
|
+
let value = data[oriCol.field];
|
|
780
|
+
if (value === null || value === "") {
|
|
781
|
+
errorInfo.push(
|
|
782
|
+
this.$t2(
|
|
783
|
+
"[" + oriCol.title + "]不能为空;",
|
|
784
|
+
"components.excelImport.warmMsg4",
|
|
785
|
+
{ title: oriCol.title }
|
|
786
|
+
)
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
return errorInfo.join("");
|
|
792
|
+
},
|
|
793
|
+
handleRes(val) {
|
|
794
|
+
/* var content = val;
|
|
795
|
+
var text = content;
|
|
796
|
+
if (content && content.indexOf("Exception") >= 0) {
|
|
797
|
+
var index0 = content.lastIndexOf("*]");
|
|
798
|
+
if (index0 >= 0) {
|
|
799
|
+
text = content.substr(index0);
|
|
800
|
+
if (text) {
|
|
801
|
+
var index1 = text.indexOf("Exception:");
|
|
802
|
+
if (index1 >= 0) {
|
|
803
|
+
text = text.substr(index1 + 10);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
} */
|
|
808
|
+
let text = getErrorMsg(val);
|
|
809
|
+
return text;
|
|
810
|
+
},
|
|
811
|
+
exportToExcel() {
|
|
812
|
+
let str
|
|
813
|
+
= this.resultType === 1
|
|
814
|
+
? this.$t2("成功", "components.excelImport.success")
|
|
815
|
+
: this.$t2("失败", "components.excelImport.fail");
|
|
816
|
+
let fileName
|
|
817
|
+
= this.$t2("导入结果导出", "components.excelImport.exportFileName")
|
|
818
|
+
+ "("
|
|
819
|
+
+ str
|
|
820
|
+
+ ")";
|
|
821
|
+
let $grid = this.$refs.resGrid;
|
|
822
|
+
let columns = $grid.getColumns();
|
|
823
|
+
if (columns && columns.length) {
|
|
824
|
+
let fields = columns
|
|
825
|
+
.filter((item, index) => {
|
|
826
|
+
return index > 0 && item.property;
|
|
827
|
+
})
|
|
828
|
+
.map((item, index) => {
|
|
829
|
+
return item.property;
|
|
830
|
+
});
|
|
831
|
+
this.$refs.resGrid.exportData({
|
|
832
|
+
filename: fileName,
|
|
833
|
+
mode: "all",
|
|
834
|
+
type: "csv",
|
|
835
|
+
columns: fields,
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
createImportTimer() {
|
|
840
|
+
this.excTime = 0;
|
|
841
|
+
let beginTime = new Date().getTime();
|
|
842
|
+
this.importTimer = setInterval(() => {
|
|
843
|
+
let nowTime = new Date().getTime();
|
|
844
|
+
let diffTime = (nowTime - beginTime) / 1000;
|
|
845
|
+
this.$set(this, "excTime", this.$baseLodash.round(diffTime, 2));
|
|
846
|
+
}, 100);
|
|
847
|
+
},
|
|
848
|
+
clearImportTimer() {
|
|
849
|
+
if (this.importTimer) clearInterval(this.importTimer);
|
|
850
|
+
this.importTimer = null;
|
|
851
|
+
this.loadingObj && this.loadingObj.close();
|
|
852
|
+
this.loadingObj = null;
|
|
853
|
+
},
|
|
854
|
+
async dialogPrimary3() {
|
|
855
|
+
if (!this.fileRaw) {
|
|
856
|
+
this.$baseAlert(
|
|
857
|
+
this.$t2("请上传附件", "components.excelImport.warmMsg1")
|
|
858
|
+
);
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
let that = this;
|
|
862
|
+
let option = this.option;
|
|
863
|
+
let done = () => {
|
|
864
|
+
that.showImportDialog = false;
|
|
865
|
+
};
|
|
866
|
+
if (!option.excel) {
|
|
867
|
+
if (
|
|
868
|
+
option.callback
|
|
869
|
+
&& option.callback(null, this.fileRaw, done) !== false
|
|
870
|
+
) {
|
|
871
|
+
that.showImportDialog = false;
|
|
872
|
+
}
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
this.loadingObj = this.$baseLoading({
|
|
876
|
+
target: document.body,
|
|
877
|
+
background: "unset",
|
|
878
|
+
});
|
|
879
|
+
this.readExcel(this.fileRaw, function (resultData) {
|
|
880
|
+
try {
|
|
881
|
+
if (
|
|
882
|
+
option.callback
|
|
883
|
+
&& option.callback(resultData, that.fileRaw, done) !== false
|
|
884
|
+
) {
|
|
885
|
+
that.showImportDialog = false;
|
|
886
|
+
}
|
|
887
|
+
} catch (et) {
|
|
888
|
+
console.error(et);
|
|
889
|
+
}
|
|
890
|
+
setTimeout(function () {
|
|
891
|
+
that.loadingObj && that.loadingObj.close();
|
|
892
|
+
that.loadingObj = null;
|
|
893
|
+
}, 200);
|
|
894
|
+
});
|
|
895
|
+
},
|
|
896
|
+
},
|
|
897
|
+
};
|
|
898
|
+
export const mixins = tmixins;
|