ToolBarNew.js
190 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
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
524
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
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
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
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
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
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
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
/* eslint-disable */
/* eslint-disable spaced-comment,no-lonely-if */
/* eslint-disable prefer-destructuring */
import React, { Component } from "react";
import moment from "moment";
import lodash from "lodash";
import { Icon as LegacyIcon } from "@ant-design/compatible";
import { DownloadOutlined, DownOutlined, UploadOutlined } from "@ant-design/icons";
import { Menu, Spin, Input, Checkbox, Upload, Modal, Progress } from "antd-v4";
import { message } from "@/utils/common/message";
import commonConfig from "@/utils/config";
import * as commonUtils from "@/utils/utils";
import StatementInfo from "@/components/CommonElementEvent/StatementInfo";
import FilfileManageInfo from "@/components/CommonElementEvent/FilfileManageInfo";
import BatchPriceUpdate from "@/components/CommonElementEvent/BatchPriceUpdate";
import BatchNPriceUpdate from "@/components/CommonElementEvent/BatchNPriceUpdate"; /* 产品单价价格批量更新 */
import AffixMenu from "@/routes/common/AffixMenu";
import * as commonBusiness from "@/components/Common/commonBusiness";
import * as commonFunc from "@/components/Common/commonFunc";
import AntdDraggableModal from "@/components/Common/AntdDraggableModal";
import SlaveMemo from "@/components/Common/SlaveMemo";
import SlaveMemo1 from "@/components/Common/SlaveMemo1";
import * as commonServices from "@/services/services";
import BatchWorkListPriceUpdate from "@/components/CommonElementEvent/BatchWorkListPriceUpdate";
import CommonListSelect from "@/components/Common/CommonListSelect";
import EditorModal from "@/components/Common/EditorModal";
import styles from "./index.less";
import SvgIcon from "../../SvgIcon";
import CommonList from "@/components/Common/CommonList";
import instructSet from "@/components/Common/CommonInstructSet";
import PersonCenterAddFace from "@/components/Common/PersonCenter/PersonCenterAddFace";
import FileImposition from "@/components/Common/FileImposition";
import MakeUpPDF from "@/components/Common/MakeUpPDF";
import BoxDesignCompontent from "@/components/Common/BoxDesignCompontent";
const { SubMenu } = Menu;
const MenuItemGroup = Menu.ItemGroup;
let time;
const throttle = (fn, wtime) => {
return (...arg) => {
if (!time || Date.now() - time > wtime) {
time = Date.now();
fn(...arg);
}
};
};
class ToolBarComponent extends Component {
/** 构造函数 */
constructor(props) {
super(props);
this.state = {
menuData: [] /* 导航工具栏 */,
enabled: false,
bCheck: false,
bInvalid: false,
reportData: [] /* 报表数据 */,
reportSelectedRowKeys: [],
inputChange: "",
checked: false,
checkedId: "",
printData: [] /* 打印数据集 */,
};
}
componentWillMount() {
this.componentWillReceiveProps(this.props);
}
componentWillReceiveProps(nextProps) {
const { masterConfig, gdsjurisdiction, report, masterData, app, menuChildData } = nextProps;
let {
searchUpDownData,
enabled,
bCheck,
bInvalid,
visibleStatement,
visibleBatchPriceUpdate,
visibleBatchNPriceUpdate,
reportData,
reportSelectedRowKeys,
} = this.state;
const btnShowData = [];
commonConfig.btnData.forEach(item => {
btnShowData.push({ ...item });
});
let menuData = [];
if (commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isEmptyArr(menuData)) {
const buttonConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === "" && item.showName !== "" && item.sControlName !== "");
/** 筛选出显示的按钮 */
buttonConfig.forEach(child => {
const index = btnShowData.findIndex(item => item.sControlName === child.sControlName);
if (
child.bVisible &&
child.sControlName.substring(0, 3) === "Btn" &&
btnShowData.findIndex(item => item.sControlName === child.sControlName) === -1
) {
child.iconName = "menu-unfold";
if (child.sControlName === "BtnBatchExamine") {
child.iconName = "check";
}
if (child.sControlName === "BtnBatchCancelExamine") {
child.iconName = "rollback";
}
if (child.sControlName === "BtnUpload") {
child.iconName = "upload";
}
if (child.sControlName === "BtnUploadicon") {
child.iconName = "upload";
}
if (child.sControlName === "BtnUploadPic") {
child.iconName = "upload";
}
if (child.sControlName === "BtnCalculation") {
child.iconName = "calculator";
}
if (child.sControlName === "BtnAddBug") {
child.iconName = "plus";
}
if (child.sControlName === "BtnAddTo") {
child.iconName = "plus";
}
if (child.sControlName === "BtnSubmit") {
child.iconName = "submit";
}
if (child.sControlName === "BtnSubmitCancel") {
child.iconName = "submitCancel";
}
if (child.sControlName === "BtnBatchSubmit") {
child.iconName = "batchSubmit";
}
if (child.sControlName === "BtnEventAdjust") {
child.iconName = "batchSubmitCancel";
}
btnShowData.push(child);
} else if (!child.bVisible && index > -1) {
btnShowData.splice(index, 1);
} else if (index > -1) {
btnShowData[index].sColor = child.sColor;
btnShowData[index].showName = child.showName;
btnShowData[index].interface = commonUtils.isNotEmptyArr(child.interface) ? child.interface : []; /* 按钮接口参数 */
btnShowData[index] = { ...child, ...btnShowData[index] };
}
});
/** 根据权限,筛选出显示的按钮 */
gdsjurisdiction.forEach(child => {
const index = btnShowData.findIndex(item => item.sControlName === child.sAction);
if (index > -1) {
btnShowData.splice(index, 1);
}
});
/* 管理员有重置按钮,非管理员无重置按钮 */
const { sType } = app.userinfo;
if (sType !== "sysadmin") {
const index = btnShowData.findIndex(item => item.sControlName === "BtnResetpwd");
if (index > -1) {
btnShowData.splice(index, 1);
}
}
/* 筛选出一级菜单 */
menuData = btnShowData.filter(item => !item.sControlName.includes("."));
/* 初始值的二级菜单 */
// const secondMenu = btnShowData.filter(item => item.sControlName.includes('.'));
/** 配置后匹配二级菜单 */
menuData.forEach(menu => {
menu.child = [];
/** 匹配相应的子菜单 */
const childData = btnShowData.filter(
item => item.sControlName.startsWith(`${menu.sControlName}.`) && item.sControlName.split(".").length <= 2
);
if (menu.sControlName === "BtnPrint") {
/* 打印的二级菜单集合 */
const reportChild = [];
if (commonUtils.isNotEmptyArr(report)) {
for (const each of report) {
reportChild.push({
sControlName: `BtnPrint.${each.sId}`,
showName: each.sReportName,
disabled: false,
sActiveId: each.sId,
sId: each.sId,
});
}
}
menu.child.push(...reportChild);
} else if (menu.sControlName === "BtnPrintCustomer" && commonUtils.isNotEmptyObject(menuChildData)) {
const reportChild = [];
if (commonUtils.isNotEmptyArr(menuChildData)) {
for (const each of menuChildData) {
reportChild.push({
sControlName: `BtnPrintCus.${each.sId}`,
showName: each.sReportName,
disabled: false,
sActiveId: each.sId,
sId: each.sId,
});
}
}
menu.child.push(...reportChild);
} else if (commonUtils.isNotEmptyArr(childData)) {
childData.forEach(childTwo => {
if (childTwo.sControlName === "BtnBsOperation.BtnUpCheck" || childTwo.sControlName === "BtnBsOperation.BtnDownCheck") {
const childDataThree = btnShowData.filter(
item => item.sControlName.startsWith(`${childTwo.sControlName}.`) && item.sControlName.split(".").length === 3
);
childTwo.child = childDataThree;
}
});
menu.child.push(...childData);
}
});
}
/* 按照后台配置加载按钮顺序 */
if (commonUtils.isNotEmptyArr(menuData)) {
menuData = menuData.sort((item, item2) => item.iOrder - item2.iOrder);
}
if (enabled !== nextProps.enabled) {
enabled = nextProps.enabled;
}
if (visibleStatement !== nextProps.visibleStatement) {
visibleStatement = nextProps.visibleStatement;
}
if (visibleBatchPriceUpdate !== nextProps.visibleBatchPriceUpdate) {
visibleBatchPriceUpdate = nextProps.visibleBatchPriceUpdate;
}
if (visibleBatchNPriceUpdate !== nextProps.visibleBatchNPriceUpdate) {
visibleBatchNPriceUpdate = nextProps.visibleBatchNPriceUpdate;
}
if (reportData !== nextProps.reportData) {
reportData = nextProps.reportData;
}
if (reportSelectedRowKeys !== nextProps.reportSelectedRowKeys) {
reportSelectedRowKeys = nextProps.reportSelectedRowKeys;
}
if (commonUtils.isNotEmptyObject(masterData) && bCheck !== masterData.bCheck) {
bCheck = masterData.bCheck;
}
if (commonUtils.isNotEmptyObject(masterData) && bInvalid !== masterData.bInvalid) {
bInvalid = masterData.bInvalid;
}
if (JSON.stringify(searchUpDownData) !== JSON.stringify(nextProps.searchUpDownData)) {
searchUpDownData = nextProps.searchUpDownData;
}
// 当前页面全部数据
const allTableData = commonFunc.getAllTableData(nextProps);
// 当前页面所有选中数据
const allTableSelectedData = Object.keys(allTableData).reduce((result, tableName) => {
const tableData = allTableData[tableName];
if (!Array.isArray(tableData)) {
result = {
...result,
[tableName]: tableData,
};
} else {
const { [`${tableName}SelectedRowKeys`]: selectedRowKeys = [] } = nextProps;
result = {
...result,
[tableName]: tableData.filter(item => selectedRowKeys.includes(item.sSlaveId) || selectedRowKeys.includes(item.sId)),
};
}
return result;
}, {});
this.setState({
menuData,
searchUpDownData,
enabled,
bCheck,
bInvalid,
visibleStatement,
visibleBatchPriceUpdate,
visibleBatchNPriceUpdate,
reportData,
reportSelectedRowKeys,
allTableSelectedData,
});
if (this.props.makeUpPDFRecord === undefined && nextProps.makeUpPDFRecord !== undefined) {
this.setState({
makeUpPDFRecord: nextProps.makeUpPDFRecord,
}, () => {
this.handleClick({ key: "BtnSendCombined" });
});
}
}
shouldComponentUpdate(nextProps, nextState) {
const { masterConfig } = nextProps;
const {
menuData,
searchUpDownData,
enabled,
bCheck,
bInvalid,
visibleStatement,
visibleBatchPriceUpdate,
visibleBatchNPriceUpdate,
visibleBatchWorkListPriceUpdate,
reportData,
reportSelectedRowKeys,
} = this.state;
const { adDisabled } = this.props;
return (
masterConfig !== undefined &&
Object.keys(masterConfig).length > 0 &&
(JSON.stringify(menuData) !== JSON.stringify(nextState.menuData) ||
JSON.stringify(masterConfig) !== JSON.stringify(nextState.masterConfig) ||
JSON.stringify(searchUpDownData) !== JSON.stringify(nextState.searchUpDownData) ||
JSON.stringify(reportData) !== JSON.stringify(nextState.initialReportData) ||
JSON.stringify(reportSelectedRowKeys) !== JSON.stringify(nextState.reportSelectedRowKeys) ||
enabled !== nextState.enabled ||
bCheck !== nextState.bCheck ||
visibleStatement !== nextState.visibleStatement ||
visibleBatchPriceUpdate !== nextState.visibleBatchPriceUpdate ||
visibleBatchNPriceUpdate !== nextState.visibleBatchNPriceUpdate ||
visibleBatchWorkListPriceUpdate !== nextState.visibleBatchWorkListPriceUpdate ||
bInvalid !== nextState.bInvalid ||
adDisabled !== nextProps.adDisabled)
);
}
componentDidUpdate(prevProps) {
const { slaveSelectedRowKeys, slaveInfoSelectedRowKeys, slaveData, slaveInfoData, masterData } = prevProps;
if (
JSON.stringify(slaveData) !== JSON.stringify(this.props.slaveData) ||
JSON.stringify(slaveInfoData) !== JSON.stringify(this.props.slaveInfoData) ||
JSON.stringify(slaveSelectedRowKeys) !== JSON.stringify(this.props.slaveSelectedRowKeys) ||
JSON.stringify(masterData) !== JSON.stringify(this.props.masterData) ||
JSON.stringify(slaveInfoSelectedRowKeys) !== JSON.stringify(this.props.slaveInfoSelectedRowKeys)
) {
this.handleBtnEnabled(this.props, false);
}
if (!this.btnSendDialogLoaded) {
const { masterConfig = {} } = this.props;
const { gdsconfigformslave = [] } = masterConfig;
const sBtnSendDialogConfigList = gdsconfigformslave.filter(item => item.sControlName && item.sControlName.includes("BtnSendDialog"));
if (location.pathname === "/indexPage/quotationPackTableTree" || (commonUtils.isNotEmptyArr(sBtnSendDialogConfigList) && !this.props.onToolBarBtnClick)) {
this.btnSendDialogLoaded = true;
this.props.onSaveState({
onToolBarBtnClick: this.handleClick,
sBtnSendDialogConfigList,
});
}
}
}
/** 获取有三级菜单的父级菜单属性 */
getMenuProps = (menu, type) => {
const { iconName, showName: showNameOld, sIcon } = menu;
const { menuStatus, bShown, showName: showNameNew } = this.getMenuStatus(menu);
const showName = showNameNew || showNameOld;
const obj = {};
obj.key = menu.sControlName;
obj.name = showName;
obj.disabled = menuStatus;
obj.style = bShown ? {} : { display: "none" };
obj.className = this.getMenuStatus(menu) && this.props.billList === "billList" ? styles.toolBarSubDisabled : styles.toolBarSub;
if (
menu.sControlName !== undefined &&
(menu.sControlName === "BtnBsOperation.BtnUpCheck" || menu.sControlName === "BtnBsOperation.BtnDownCheck")
) {
obj.onMouseEnter = this.handleMouseEnter; /* 根据二级菜单获取三级数据 */
}
// if (menu.sControlName !== undefined && (menu.sControlName.indexOf('BtnBsOperation.BtnUpCheck') > -1 || menu.sControlName.indexOf('BtnBsOperation.BtnDownCheck') > -1) && menu.sControlName.split('.').length === 3) {
// obj.onMouseEnter = this.handleMouseEnter; /* 根据二级菜单获取三级数据 */
// }
obj["data-sactiveid"] = menu.sActiveId;
if (type === "icon") {
const imageDom = this.getImageDom(sIcon) || <SvgIcon className="toolbarIcon" iconClass={iconName} />;
obj.title = (
<span>
{imageDom}
{showName}
<DownOutlined />
</span>
);
} else if (type === "title") {
obj.title = showName;
} else if (type === "key" && commonUtils.isEmpty(menu.sControlName)) {
obj.key = menu.sId;
}
return obj;
};
/** 获取父级菜单属性 */
getMenuStatus = menu => {
let bShown = true;
// 如果配置了按钮自定义状态,走自定义逻辑
const statusObj = this.getMenuStatusCostom(menu);
const { bContinue, bContinueMenuStatus } = statusObj;
if (!bContinue && !bContinueMenuStatus) {
// 如果不在配置中,走默认逻辑
return statusObj;
} else if (bContinueMenuStatus) {
// 如果只配置了show没有配置enabled,show取自定义结果,enabled走默认逻辑
bShown = statusObj.bShown;
}
let { masterData, formRoute, enabled } = this.props;
// 主表数据是当前表格已选中数据
if (formRoute === "/indexPage/commonListLeft") {
const { slaveSelectedData } = this.props;
if (commonUtils.isNotEmptyArr(slaveSelectedData)) {
masterData = slaveSelectedData[0];
}
}
const { sortEnabled } = this.props;
const { sUseInfo, adDisabled, sModelsType, masterConfig, activeKey, sModelsId } = this.props;
if (commonUtils.isEmptyObject(masterData)) {
masterData = {};
}
const { bInvalid, bSubmit } = masterData;
let { bCheck, bNextCheck } = masterData;
/* 是否有审核按钮 基础模块转换的commonNewBill复制到只需通过有无审核按钮判断 */
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName && item.sControlName.includes("BtnCheck"));
let bBtnCheck = true;
if (iIndex > -1) {
bBtnCheck = true;
} else {
bBtnCheck = false;
}
if(commonUtils.isNotEmptyObject(sUseInfo)) {
enabled = false;
}
if (location.pathname === "/indexPage/commonClassify") {
/* 通用分类 若配置没有审核按钮 则默认bCheck不为空 */
if (iIndex === -1) {
bCheck = false;
}
}
let disabledData = []; /* 置灰按钮集合 */
if (adDisabled) {
disabledData = ["BtnAdd", "BtnAddChild", "BtnUpd", "BtnDel", "BtnSave", "BtnCancel", "BtnSetPeriod"];
} else if (!adDisabled) {
if (!enabled) {
if (bInvalid) {
// 已作废
disabledData = [
"BtnUpd",
"BtnDel",
"BtnSave",
"BtnCancel",
"BtnExamine",
"BtnCancelExamine",
"BtnCopyTo",
"BtnCopyFrom",
"BtnBsOperation.BtnInvalid",
"BtnInvalid",
];
} else if (bCheck) {
// 已审核
if (!commonUtils.isEmpty(sModelsType) && sModelsType.includes("element/")) {
if (sModelsType === "element/customerInfo") {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnCheck");
if (iIndex > -1) {
disabledData = ["BtnDel", "BtnSave", "BtnCancel", "BtnExamine", "BtnCopyFrom", "BtnCancelInvalid", "BtnImport"]; //'BtnUpd',
} else {
disabledData = ["BtnSave", "BtnCancel", "BtnCancelExamine", "BtnCopyFrom", "BtnCancelInvalid"];
}
} else {
disabledData = ["BtnSave", "BtnCancel", "BtnCancelExamine", "BtnCopyFrom", "BtnCancelInvalid"];
}
} else {
/* 已审核查看状态 修改 删除 保存 取消 审核 复制从 取消作废置灰 */
disabledData = ["BtnUpd", "BtnDel", "BtnSave", "BtnCancel", "BtnExamine", "BtnCopyFrom", "BtnCancelInvalid", "BtnImport"];
}
} else {
/** 查看状态 修改 删除 保存 取消 审核 复制从置灰 */
disabledData = ["BtnSave", "BtnCancel", "BtnCopy2Custom", "BtnCancelExamine", "BtnCopyTo", "BtnCopyFrom", "BtnCancelInvalid"];
if (!commonUtils.isEmpty(sModelsType) && sModelsType.includes("element/")) {
/* 除了客户信息,其他基础信息在查看状态状态下 复制到常亮 */
disabledData = ["BtnSave", "BtnCancel", "BtnCancelExamine", "BtnCopyFrom", "BtnCancelInvalid"];
if (sModelsType === "element/customerInfo") {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnCheck");
if (iIndex > -1) {
disabledData = ["BtnSave", "BtnCancel", "BtnCancelExamine", "BtnCopyTo", "BtnCopyFrom", "BtnCancelInvalid"];
}
}
}
}
} else {
/* 修改状态 */
if (sModelsType === "production/productionPlanInfo" || sModelsType === "productionMainPlan/productionMainPlan") {
disabledData = [
"BtnAdd",
"BtnAddChild",
"BtnUpd",
"BtnDel",
"BtnFirst",
"BtnPrior",
"BtnNext",
"BtnLast",
"BtnUpCheck",
"BtnDownCheck",
"BtnExamine",
"BtnCancelExamine",
"BtnCopyTo",
"BtnBsOperation.BtnInvalid",
"BtnBsOperation.BtnCancelInvalid",
"BtnCancelInvalid",
"BtnInvalid",
];
} else {
disabledData = [
"BtnRefresh",
"BtnAdd",
"BtnInit",
"BtnExportSql",
"Btn",
"BtnAddChild",
"BtnUpd",
"BtnDel",
"BtnFirst",
"BtnPrior",
"BtnNext",
"BtnLast",
"BtnUpCheck",
"BtnDownCheck",
"BtnExamine",
"BtnCancelExamine",
"BtnCopyTo",
"BtnBsOperation.BtnInvalid",
"BtnBsOperation.BtnCancelInvalid",
"BtnPrint",
"BtnCancelInvalid",
"BtnInvalid",
];
}
}
}
if (bSubmit) {
// 提交后不能修改
if (!disabledData.includes("BtnUpd")) {
disabledData.push("BtnUpd");
}
if (!disabledData.includes("BtnDel")) {
disabledData.push("BtnDel");
}
if (!disabledData.includes("BtnSave")) {
disabledData.push("BtnSave");
}
if (!disabledData.includes("BtnEventCancel")) {
disabledData.push("BtnEventCancel");
}
// 提交后提交按钮变灰
if (!disabledData.includes("BtnSubmit")) {
disabledData.push("BtnSubmit");
}
// 提交后取消提交按钮变亮
if (disabledData.indexOf("BtnSubmitCancel") !== -1) {
disabledData.splice(disabledData.indexOf("BtnSubmitCancel"), 1);
}
} else {
// 未提交时取消提交按钮变灰
if (!disabledData.includes("BtnSubmitCancel")) {
disabledData.push("BtnSubmitCancel");
disabledData.push("BtnEventOrder");
}
}
// 修改或者审核后提交、取消提交按钮都变灰
if (enabled || bCheck) {
if (!disabledData.includes("BtnSubmit")) {
disabledData.push("BtnSubmit");
}
if (!disabledData.includes("BtnSubmitCancel")) {
disabledData.push("BtnSubmitCancel");
}
}
if (bCheck) {
/* 已审核状态下 审核按钮灰色 */
if (!disabledData.includes("BtnEventOrder")) {
disabledData.push("BtnEventOrder");
}
// if (!disabledData.includes('BtnEventSubmit')) {
// disabledData.push('BtnEventSubmit');
// }
// /* 已审核状态下 消审亮 */
// if (disabledData.indexOf('BtnEventSubmitCancel') !== -1) {
// disabledData.splice(disabledData.indexOf('BtnEventSubmitCancel'), 1);
// }
/* 已审核状态下 驳回灰色 */
// if (!disabledData.includes('BtnEventCancel')) {
// disabledData.push('BtnEventCancel');
// }
// if (!disabledData.includes('BtnBatchExamine')) {
// disabledData.push('BtnBatchExamine');
// }
}
/* 未审核状态 ,审核按钮亮,销审按钮灰色 */
if (!bCheck) {
if (!disabledData.includes("BtnEventSubmitCancel")) {
disabledData.push("BtnEventSubmitCancel");
}
if (!disabledData.includes("BtnBatchCancelExamine")) {
disabledData.push("BtnBatchCancelExamine");
}
}
/* 若下游已审核,则上游的消审按钮置灰 */
if (bNextCheck) {
if (!disabledData.includes("BtnEventSubmitCancel")) {
disabledData.push("BtnEventSubmitCancel");
}
if (!disabledData.includes("BtnBatchCancelExamine")) {
disabledData.push("BtnBatchCancelExamine");
}
}
/*
将按钮的sButtonParam中的b开头字段的值 与 主表中相同字段的值做对比
值相同 代表审核通过 对应按钮置灰
**/
const sButtonParamBtn = masterConfig.gdsconfigformslave.filter(
item => commonUtils.isNotEmptyStr(item.showName) && commonUtils.isNotEmptyStr(item.sControlName) && commonUtils.isNotEmptyStr(item.sButtonParam)
);
sButtonParamBtn.forEach(btn => {
const { sButtonParam = {} } = commonUtils.convertStrToObj(btn.sButtonParam);
const key = Object.keys(sButtonParam).find(item => item && item.substring(0, 1) === "b");
if (key) {
const bCheckCostom = masterData[key] === sButtonParam[key];
if (bCheckCostom) {
disabledData.push(btn.sControlName);
}
}
});
// 生产排程搜索时不可以上下移动
if (sortEnabled === false) {
if (sModelsType === "production/productionPlanInfo") {
// disabledData.push('BtnSave');
}
disabledData.push("BtnRepairstartdate");
}
/* 通用上传按钮 除了新增,其他状态下都是亮的*/
if (menu.sControlName === "BtnUpload") {
const { handleType } = masterData;
if (handleType === "add") {
disabledData.push("BtnUpload");
}
}
// 其它自定义按钮不在以上 不能操作数据里
if (menu.disabled) {
disabledData.push(menu.sControlName);
}
// 订单已审核 价格批量更新亮 */
if (commonUtils.isNotEmptyObject(menu.sControlName) && menu.sControlName.includes("PriceUpdate")) {
const { bCheck } = masterData;
if (!bCheck) {
disabledData.push(menu.sControlName);
}
}
/* 导入未清按钮 只有编辑亮的*/
if (menu.sControlName === "BtnImportFormData") {
if (!enabled) {
disabledData.push("BtnImportFormData");
}
}
/* 盘点导出模板数据 只有非编辑 按钮亮*/
if (menu.sControlName === "BtnOutTemplateData") {
if (enabled) {
disabledData.push("BtnOutTemplateData");
}
}
if (sModelsType === "productionMainPlan/productionMainPlan") {
// 主计划中保存,取消保存按钮默认不可点击
if (disabledData.indexOf("BtnSave") === -1) {
disabledData.push("BtnSave");
}
if (disabledData.indexOf("BtnRefresh") === -1) {
disabledData.push("BtnRefresh");
}
// 生产主计划数据集有改动的时候才会高亮保存按钮
// 生产主计划保存按钮和确认计划的按钮互斥,存一
if (this.props.dataChanged === true) {
// 列表有所改动
// 显示保存,禁用确认计划
if (disabledData.indexOf("BtnSave") !== -1) {
disabledData.splice(disabledData.indexOf("BtnSave"), 1);
}
if (disabledData.indexOf("BtnRefresh") !== -1) {
disabledData.splice(disabledData.indexOf("BtnRefresh"), 1);
}
if (disabledData.indexOf("BtnUnifiedPlanning") === -1) {
disabledData.push("BtnUnifiedPlanning");
}
}
// if (this.props.dataChanged === false) {
// if (disabledData.indexOf('BtnUnifiedPlanning') !== -1) {
// disabledData.splice(disabledData.indexOf('BtnUnifiedPlanning'), 1);
// }
// if (disabledData.indexOf('BtnSave') === -1) {
// disabledData.push('BtnSave');
// disabledData.push('BtnRefresh'); /* 生产主计划刷新按钮的亮与灰与保存按钮同步 */
// }
// }
}
if (sModelsType === "system/sisformulaInfo") {
// 方案保存开放复制方案
disabledData.splice(disabledData.indexOf("BtnCopyTo"), 1);
}
/* 审核中的按钮 所有按钮都置灰 */
if (commonUtils.isNotEmptyObject(masterData) && masterData.sStatus === "2") {
const disabledDataNew = [
"BtnUpd",
"BtnDel",
"BtnRevert",
"BtnSave",
"BtnCopyTo",
"BtnCancel",
"BtnExamine",
"BtnCancelExamine",
"BtnCopyFrom",
"BtnCancelInvalid",
"BtnImport",
"BtnBsOperation.BtnInvalid",
"BtnBsOperation.BtnCancelInvalid",
"BtnUpload",
"BtnSend",
"BtnEject",
"BtnBsOperation.BtnUpCheck",
"BtnBsOperation",
];
if (commonUtils.isNotEmptyArr(disabledDataNew)) {
for (const item of disabledDataNew) {
const iIndex = disabledData.findIndex(each => each === item);
if (iIndex === -1) {
disabledData.push(item);
}
}
}
}
/* 红冲中的单据 根据条件进行所有按钮置灰 */
if (
commonUtils.isNotEmptyObject(masterData) &&
((masterData.bCheck && commonUtils.isNotEmptyObject(masterData.sMinusSrcId)) || commonUtils.isNotEmptyObject(masterData.sMinusUsed))
) {
disabledData = [
"BtnUpd",
"BtnDel",
"BtnRevert",
"BtnSave",
"BtnCopyTo",
"BtnCancel",
"BtnExamine",
"BtnCancelExamine",
"BtnCopyFrom",
"BtnCancelInvalid",
"BtnImport",
"BtnBsOperation.BtnInvalid",
"BtnBsOperation.BtnCancelInvalid",
"BtnUpload",
"BtnSend",
"BtnEject",
"BtnBsOperation.BtnUpCheck",
"BtnBsOperation",
];
}
/* 红冲中的单据 红冲按钮置灰色 */
if (
commonUtils.isNotEmptyObject(masterData) &&
(commonUtils.isNotEmptyObject(masterData.sMinusSrcId) || commonUtils.isNotEmptyObject(masterData.sMinusUsed))
) {
disabledData.push("BtnCopyTo.ActProductionMaterials"); /* 红冲单据按钮若已红冲 则置灰色 */
}
/* 工艺卡启用按钮 只有审核是亮的 */
if (location.pathname.includes("processCardPackTableTree")) {
if (!masterData.bCheck) {
disabledData.push("BtnEventEnable");
}
}
/* 单据的自定义按钮,控制它在保存后才高亮 */
if (location.pathname.includes("Bill")) {
if (
commonUtils.isNotEmptyObject(menu.sControlName) &&
(menu.sControlName.indexOf("BtnEvent") > -1 ||
menu.sControlName.indexOf("BtnRepair") > -1 ||
menu.sControlName.indexOf("BtnSubmit") > -1 ||
menu.sControlName.indexOf("BtnBatchSubmit") > -1)
) {
if (enabled) {
/* 只有非编辑编辑状态 按钮会亮 */
disabledData.push(menu.sControlName);
}
}
if (commonUtils.isNotEmptyObject(menu.sControlName) && menu.sControlName.indexOf("BtnCalc") > -1) {
if (!enabled) {
/* 只有编辑状态 按钮会亮 */
disabledData.push(menu.sControlName);
}
}
}
if (location.pathname.includes("systemPermission")) {
if (activeKey === "3") {
/* 用户权限 */
if (commonUtils.isNotEmptyObject(menu.sControlName) && menu.sControlName.indexOf("BtnRepairGroup") > -1) {
disabledData.push(menu.sControlName);
}
} else {
/* 组权限 */
if (commonUtils.isNotEmptyObject(menu.sControlName) && menu.sControlName.indexOf("BtnRepairUser") > -1) {
disabledData.push(menu.sControlName);
}
}
}
if (menu.sColor === "alwaysAbled") {
const iIndex = disabledData.findIndex(item => item === menu.sControlName);
if (iIndex !== -1) {
disabledData.splice(iIndex, 1);
}
if (sModelsId === "12710101117055564119120" || sModelsId === "12710101117170330526240") {
/* 物资评审 采购申请常亮 */
const iCIndex = disabledData.findIndex(item => item === "BtnCopyTo");
if (iCIndex !== -1) {
disabledData.splice(iCIndex, 1);
}
}
}
let bReturn = true;
if (menu.sControlName !== undefined && menu.sControlName.indexOf(".") > -1) {
bReturn = disabledData.findIndex(item => item === menu.sControlName.substring(0, menu.sControlName.indexOf("."))) > -1;
if (!bReturn) {
bReturn = disabledData.findIndex(item => item === menu.sControlName) > -1;
}
} else {
bReturn = disabledData.findIndex(item => item === menu.sControlName) > -1;
}
bReturn = bReturn || (this.props.getMenuStatus !== undefined && this.props.getMenuStatus(menu));
return { menuStatus: bReturn, bShown };
};
// 获取父级菜单属性(自定义逻辑)
getMenuStatusCostom = menu => {
const { sInstruct: sInstructStr } = this.props.masterConfig || {};
const sInstruct = commonUtils.convertStrToObj(sInstructStr, {});
const { data = [], conditionGroup = {} } = sInstruct;
let menuStatus = false;
let bShown = true;
const { showName: showNameDefault } = menu;
let { sControlName } = menu;
if (sControlName && sControlName.includes("BtnPrint")) {
sControlName = "BtnPrint";
}
let showName = showNameDefault;
const btnConfig = data.find(
item => item.name && item.name.split(",").includes(sControlName) && (item.enabled !== undefined || item.show !== undefined)
);
if (btnConfig === undefined) return { bContinue: true };
const getStatus = (type, defaultValue) => {
const { [type]: condition = "" } = btnConfig;
if (condition === "") return defaultValue;
if (typeof condition === "boolean") {
return condition;
} else if (condition.includes("conditionGroup")) {
const [, conditionName] = condition.split(".");
const conditionNew = conditionGroup[conditionName];
const result = this.getStatusResult(conditionNew, defaultValue);
return condition.includes("!") ? !result : result;
} else if (typeof condition === "string") {
return this.getStatusResult(condition, defaultValue);
}
return defaultValue;
};
menuStatus = !getStatus("enabled", menuStatus);
bShown = getStatus("show", bShown);
const { showText } = btnConfig;
if (typeof showText === "string") {
showName = showText;
} else if (commonUtils.isNotEmptyArr(showText)) {
for (let i = 0; i < showText.length; i++) {
let tempResult = false;
const item = showText[i];
const { condition, text } = item;
if (condition.includes("conditionGroup")) {
const [, conditionName] = condition.split(".");
const conditionNew = conditionGroup[conditionName];
tempResult = this.getStatusResult(conditionNew, tempResult);
tempResult = condition.includes("!") ? !tempResult : tempResult;
} else {
tempResult = this.getStatusResult(condition, tempResult);
}
if (tempResult) {
showName = text;
break;
}
}
}
// 是否继续走原先的逻辑(当没有配置enabled时)
const bContinueMenuStatus = btnConfig.enabled === undefined;
return { menuStatus, bShown, showName, bContinueMenuStatus };
};
matchResult = (rowData, sFileName, conditionStr, conditionValue) => {
let rowDataValue = rowData[sFileName];
try {
if (rowDataValue === undefined || rowDataValue === null || rowData === "null") {
rowDataValue = "";
} else {
rowDataValue = rowDataValue.toString();
}
} catch (error) {}
switch (conditionStr) {
case "===":
return rowDataValue === conditionValue;
case "==":
return rowDataValue === conditionValue;
case ">=":
return rowDataValue >= conditionValue;
case "<=":
return rowDataValue <= conditionValue;
case ">":
return rowDataValue > conditionValue;
case "<":
return rowDataValue < conditionValue;
case "!=":
return rowDataValue != conditionValue;
case "!==":
return rowDataValue !== conditionValue;
default:
throw new Error("conditionStr is not valid");
}
};
getStatusResult = (str, defaultValue) => {
let strNew = str.replace(/\s+/g, "");
let result = defaultValue;
const { allTableSelectedData: tempData } = this.state;
tempData.props = {
sSrcModelsId: this.props.sSrcModelsId,
enabled: !!this.props.enabled,
};
Object.keys(tempData).forEach(key => {
const reg = new RegExp(`${key}\\.`, "g");
strNew = strNew.replace(reg, `tempData["${key}"].`);
});
try {
// 截取字符串中 ${tableName@all.fieldName.判断符号.判断内容} 格式的内容
const reg1 = /\$\{[^{}@]+@[^{}\.]+\.[^{}\.]+\.[^{}\.]+\.[^{}\.]*\}/g;
strNew = strNew.replace(reg1, matchStr => {
const matchStrNew = matchStr.substring(2, matchStr.length - 1);
const [tableName, restStr] = matchStrNew.split("@");
const [filterType, sFileName, conditionStr, conditionValue] = restStr.split(".");
let matchResult = matchStr;
const tableData = tempData[tableName] || [];
const selectedRowKeys = this.props[`${tableName}SelectedRowKeys`] || [];
const selectedData = tableData.filter(rowData => selectedRowKeys.includes(rowData.sSlaveId) || selectedRowKeys.includes(rowData.sId));
if (commonUtils.isEmptyObject(selectedData)) return false;
if (filterType === "all") {
matchResult = !selectedData.some(rowData => !this.matchResult(rowData, sFileName, conditionStr, conditionValue));
} else if (filterType === "one") {
matchResult = selectedData.some(rowData => this.matchResult(rowData, sFileName, conditionStr, conditionValue));
}
return matchResult;
});
const evalStr = eval("`" + strNew + "`");
// console.log("=====数据处理结果", { tempData, str, strNew, evalStr });
result = eval(evalStr);
} catch (error) {
// console.log("=====error", error);
// clearInterval(this.modaltimer);
// this.modaltimer = setTimeout(() => {
// Modal.error({
// width: 1000,
// title: "按钮状态指令集错误信息",
// content: <div>
// <div>按钮状态运算错误!</div>
// <div>请检查按钮状态运算语法!</div>
// <div>按钮状态运算内容:</div>
// <div>{str}</div>
// <div>按钮状态运算被替代后的结果:</div>
// <div>{strNew}</div>
// </div>,
// okText: "知道了"
// });
// }, 1000);
return defaultValue;
}
if (typeof result !== "boolean") {
clearInterval(this.modaltimer);
this.modaltimer = setTimeout(() => {
clearInterval(this.modaltimer);
Modal.error({
width: 1000,
title: "按钮状态指令集错误信息",
content: (
<div>
<div>按钮状态运算返回值不是布尔值!</div>
<div>请检查按钮状态运算语法!</div>
<div>按钮状态运算内容:</div>
<div>{str}</div>
<div>按钮状态运算被替代后的结果:</div>
<div>{strNew}</div>
<div>按钮状态运算返回值:</div>
<div>{result}</div>
</div>
),
okText: "知道了",
});
}, 1000);
return defaultValue;
}
// console.log("=====result", result);
return result;
};
getDisabledProps = name => {
if (commonUtils.isNotEmptyObject(name)) {
const { enabled } = this.props;
const obj = {};
obj.disabled = enabled;
return obj;
}
};
/* */
handleBtnEnabled = (props, isReturn) => {
const { masterConfig: masterConfigOld } = props;
if (commonUtils.isNotEmptyObject(masterConfigOld)) {
const masterConfig = JSON.parse(JSON.stringify(masterConfigOld));
const buttonConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === "" && item.showName !== "" && item.sControlName !== "");
if (commonUtils.isNotEmptyArr(buttonConfig)) {
for (const btnItem of buttonConfig) {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => btnItem.sId === item.sId);
let btndisabled = false;
if (commonUtils.isNotEmptyStr(btnItem.sButtonEnabled)) {
btndisabled = this.handleAnalysisBtnEnabled(props, btnItem, masterConfig.gdsconfigformslave);
}
if (!!masterConfig.gdsconfigformslave[iIndex].disabled !== btndisabled) {
masterConfig.gdsconfigformslave[iIndex].disabled = btndisabled; // = { ...masterConfig.gdsconfigformslave[iIndex], disabled: btndisabled };
}
}
}
if (isReturn) {
return { ...masterConfig };
} else if (JSON.stringify(masterConfig) === JSON.stringify(masterConfigOld)) {
return;
} else {
const addState = {};
addState.masterConfig = { ...masterConfig };
this.props.onSaveState({ ...addState });
}
}
};
handleAnalysisBtnEnabled = (props, currConfig, gdsconfigformslave) => {
const { sButtonEnabled } = currConfig;
let btndisabled = false;
if (commonUtils.isNotEmptyObject(sButtonEnabled)) {
const btnObj = JSON.parse(sButtonEnabled);
const solution = btnObj.solution;
const rowSelected = btnObj.rowSelected;
const buttonFilter = btnObj.button; /* 需要控制的按钮集 */
const dataArr = btnObj.data; /* 根据数据控制按钮亮与灰色 */
// 解析配置中 solution:["新工单"]
if (!(commonUtils.isNotEmptyArr(solution) && solution.includes(props.masterData.sSolutionName))) {
btndisabled = true;
// return btndisabled;
}
let disabledRowSelected;
// 解析配置中 rowSelected: [{name:'master',rule:'&&'},{name:'slave',rule:'&&'}],
if (commonUtils.isNotEmptyArr(rowSelected)) {
let rule;
let selectRt;
let i = 0;
for (const item of rowSelected) {
const name = item.name;
i += 1;
if (commonUtils.isNotEmptyArr(props[`${name}SelectedRowKeys`])) {
selectRt = true; // 表示 满足当前条件,
} else {
selectRt = false;
}
/* 只有1个配置:
selectRt = true 当满足当前条件,按钮应该为亮,即当前btndisabled =false,不返回继续往下进行判断
selectRt = false 不当满足当前条件,按钮应该为灰色,即当前btndisabled =true,已经有条件不满足,按钮可直接定为灰色的,即直接返回true
*/
if (i === 1) {
disabledRowSelected = selectRt;
} else if (i > 1 && rule === "&&") {
disabledRowSelected = selectRt && disabledRowSelected;
} else if (i > 1 && rule === "||") {
disabledRowSelected = selectRt || disabledRowSelected;
}
rule = item.rule;
}
if (!disabledRowSelected) {
btndisabled = true;
// return btndisabled;
}
}
// gdsconfigformslave[iIndex].disabled 为true 表示按钮至灰, false 表示按钮亮,可使用
let disabledButtonFilter;
if (commonUtils.isNotEmptyArr(buttonFilter)) {
let rule;
let buttonRt;
let i = 0;
for (const item of buttonFilter) {
i += 1;
const name = item.name;
const currDisabled = !item.enabled;
const iIndex = gdsconfigformslave.findIndex(config => config.sControlName === name);
if (iIndex === -1) {
continue;
}
const tempDisabled = gdsconfigformslave[iIndex].disabled;
if (tempDisabled === currDisabled) {
buttonRt = true;
} else {
buttonRt = false;
}
if (i === 1) {
disabledButtonFilter = buttonRt;
} else if (i > 1 && rule === "&&") {
disabledButtonFilter = buttonRt && disabledRowSelected;
} else if (i > 1 && rule === "||") {
disabledButtonFilter = buttonRt || disabledRowSelected;
}
rule = item.rule;
}
if (!disabledButtonFilter) {
btndisabled = true;
// return btndisabled;
}
}
/* 按钮根据需要能按字段值来控制 */
if (commonUtils.isNotEmptyArr(dataArr)) {
const currButtonName = currConfig.sControlName; /* 当前按钮 */
let flag = btndisabled;
for (const item of dataArr) {
const { name, fieldName, condition, value, showBtn, hideBtn } = item;
const { [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: selectedRowKeys, masterData } = this.props;
let tableDataRow = {};
if (name === "master") {
tableDataRow = masterData;
} else {
const filterData =
commonUtils.isNotEmptyArr(tableData) && commonUtils.isNotEmptyArr(selectedRowKeys)
? tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId))
: [];
if (commonUtils.isNotEmptyArr(filterData)) {
tableDataRow = filterData[0];
}
}
if (commonUtils.isNotEmptyObject(tableDataRow)) {
if (condition === ">") {
if (tableDataRow[fieldName] > value) {
if (commonUtils.isNotEmptyArr(showBtn)) {
const iIndex = showBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = false; /* 按钮亮 */
}
}
if (commonUtils.isNotEmptyArr(hideBtn)) {
const iIndex = hideBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = true; /* 按钮灰 */
}
}
}
} else if (condition === "===") {
if (tableDataRow[fieldName] === value) {
if (commonUtils.isNotEmptyArr(showBtn)) {
const iIndex = showBtn.findIndex(item => item.indexOf(currButtonName) > -1);
if (iIndex > -1) {
flag = false; /* 按钮亮 */
}
}
if (commonUtils.isNotEmptyArr(hideBtn)) {
const iIndex = hideBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = true; /* 按钮灰 */
}
}
}
} else if (condition === "!==") {
if (tableDataRow[fieldName] !== value) {
if (commonUtils.isNotEmptyArr(showBtn)) {
const iIndex = showBtn.findIndex(item => item.indexOf(currButtonName) > -1);
if (iIndex > -1) {
flag = false; /* 按钮亮 */
}
}
if (commonUtils.isNotEmptyArr(hideBtn)) {
const iIndex = hideBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = true; /* 按钮灰 */
}
}
}
} else if (condition === "<") {
if (tableDataRow[fieldName] < value) {
if (commonUtils.isNotEmptyArr(showBtn)) {
const iIndex = showBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = false; /* 按钮亮 */
}
}
if (commonUtils.isNotEmptyArr(hideBtn)) {
const iIndex = hideBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = true; /* 按钮灰 */
}
}
}
} else if (condition === "like") {
if (fieldName.substring(0, 1) === "s") {
if (commonUtils.isNotEmptyArr(showBtn)) {
const iIndex = showBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = false; /* 按钮亮 */
}
}
if (commonUtils.isNotEmptyArr(hideBtn)) {
const iIndex = hideBtn.findIndex(item => item.indexOf(currButtonName));
if (iIndex > -1) {
flag = true; /* 按钮灰 */
}
}
}
}
}
}
btndisabled = flag;
}
/* End */
}
return btndisabled;
};
/** 根据二级菜单获取三级数据 */
handleMouseEnter = e => {
if (commonUtils.isNotEmptyStr(e.key) && this.props.onSearchUpDownThird !== undefined) {
this.props.onSearchUpDownThird(e.key);
}
};
handleMouseEnterTooBar = () => {
const focusedElement = document.activeElement;
if (focusedElement.tagName.toLowerCase() === "input") {
focusedElement.blur();
}
};
handleImport = async (proName, proInParam, other) => {
this.props.onSaveState({
loading: true,
});
const { sModelsId, masterData, slaveData, slaveDelData: slaveDelDataOld, app } = this.props;
const confirmSetting = commonFunc.showLocalMessage(this.props, 'confirmSetting', '请配置按钮的存储过程');
const btnConfig = this.props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === "BtnCommonImport")[0]; // sButtonEnabled sButtonParam
if (!commonUtils.isNotEmptyObject(btnConfig) || !commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) {
message.error(confirmSetting);
this.props.onSaveState({
loading: false,
});
}
const sButtonParam = btnConfig.sButtonParam;
const btn = JSON.parse(sButtonParam);
const sProName = btn.sproName;
const inParams = [];
const inMap = btn.inMap;
const inlist = inMap ? inMap.split(",") : [];
const masterArr = [];
const slaveArr = [];
const slaveInfoArr = [];
const controlArr = [];
const materialsArr = [];
const processArr = [];
if (!sTableName && !inMap) {
// 都为undefined时直接退出
return;
}
if (inlist.length > 0) {
inlist.forEach(item => {
const itemArr = item.split(".");
if (itemArr.length > 0) {
const sname = itemArr[0];
const stype = itemArr[1];
if (commonUtils.isNotEmptyStr(sname) && sname === "master") {
masterArr.push(stype);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "slave") {
slaveArr.push(stype);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "slaveInfo") {
slaveInfoArr.push(stype);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "control") {
controlArr.push(stype);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "materials") {
materialsArr.push(stype);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "process") {
processArr.push(stype);
}
}
});
if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
const addState = {};
addState.key = "master";
const val = [];
const currVal = {};
masterArr.forEach(filed => {
currVal[`${filed}`] = masterData[`${filed}`];
});
val.push(currVal);
addState.value = val;
inParams.push({ ...addState });
}
if (commonUtils.isNotEmptyArr(slaveArr)) {
const addState = this.handleProParams("slave", slaveArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
const addState = this.handleProParams("slaveInfo", slaveInfoArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(controlArr)) {
const addState = this.handleProParams("control", controlArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(materialsArr)) {
const addState = this.handleProParams("materials", materialsArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(processArr)) {
const addState = this.handleProParams("process", processArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
}
const value = { sProName, sProInParam: JSON.stringify({ params: inParams }) };
if (other?.iFlag === 1) {
value.iFlag = 1;
}
const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
const dataReturn = (await commonServices.postValueService(app.token, value, url)).data;
// const url = `${commonConfig.server_host}eleMaterialsStock/getEleMaterialsStock?sModelsId=${sModelsId}&sWareHouseId=${masterData.sWareHouseId}&num=${num}`;
// const dataReturn = (await commonServices.getService(this.props.app.token, url)).data;
if (dataReturn.code === 1) {
const returnData = dataReturn.dataset.rows;
const slaveDelData = commonUtils.isEmptyArr(slaveDelDataOld) ? [] : slaveDelDataOld;
slaveData.forEach(item => {
item.handleType = "del";
slaveDelData.push({ ...item });
});
returnData.forEach((item, index) => {
item.handleType = "add";
item.sParentId = masterData.sId;
item.iOrder = index + 1;
returnData[index] = { ...item };
});
this.props.onSaveState({ slaveData: returnData, slaveDelData });
} else {
this.props.getServiceError({ ...dataReturn, fn: () => this.handleImport(proName, proInParam, { iFlag: 1 }) });
}
this.props.onSaveState({
loading: false,
});
};
handleSBusinessType = (key, sBusinessType) => {
const result = {
"BtnCopyTo.saldelivergoods": v => ({ isTrue: ["ZS05"].includes(v), message: "送货单只能选择非免费订单" }),
"BtnCopyTo.saldeliverfree": v => ({ isTrue: !["ZS05"].includes(v), message: "免费送货只能选择免费订单" }),
}[key];
return result?.(sBusinessType);
};
/**
* 区分是否免费送货
* @param {*} key
* @returns
*/
handleFreeDeliver = key => {
if (
["BtnCopyTo.saldelivergoods", "BtnCopyTo.saldeliverfree"].includes(key) &&
Array.isArray(this.props.slaveSelectedData) &&
this.props.slaveSelectedData.length
) {
const selectSBusinessType = this.props.slaveSelectedData.map(i => i?.sBusinessType);
if (selectSBusinessType.includes("ZS05") && selectSBusinessType.find(i => i !== "ZS05")) {
message.error("送货单只能选择非免费订单, 免费送货只能选择免费订单");
return true;
} else {
const result = this.handleSBusinessType(key, selectSBusinessType[0]);
if (result?.isTrue) {
message.error(result?.message || "送货类型需保持一致");
return true;
}
}
}
};
// 按钮指令集
handleClick = e => {
// 如果没找到调用指令集方法,执行原始方法
if (!this.props.onExecInstructSet) {
this.handleClick1(e);
return;
}
let { key } = e;
const { menuData } = this.state;
if (key.includes("BtnCopyTo")) {
key = "BtnCopyTo";
}
const iIndex = menuData.findIndex(item => item.sName === key || item.sControlName === key);
const { sInstruct: sInstructStr, sChangeType } = iIndex > -1 ? menuData[iIndex] : {};
const sInstruct = commonUtils.convertStrToObj(sInstructStr, {});
// const { data = [] } = sInstruct;
// console.log('btnConfig', iIndex, sInstruct, data);
// const btnConfig = data.find(item => item.name && item.name.split(',').includes(key) && item.click);
if (commonUtils.isEmptyObject(sInstruct)) {
this.handleClick1(e);
return;
}
if (sChangeType === "clickOnly") {
// 只执行指令集
this.props.onExecInstructSet({
sInstruct: sInstruct,
showName: "按钮only",
});
} else if (sChangeType === "afterClick") {
// 先按钮再指令集
this.handleClick1(e);
setTimeout(() => {
this.props.onExecInstructSet({
sInstruct: sInstruct,
showName: "按钮-指令集",
});
}, 1000);
} else {
// 先指令集再按钮
this.props.onExecInstructSet({
sInstruct: sInstruct,
showName: "指令集-按钮",
callback: ex => {
console.log("=====xxx", "指令集-按钮", ex);
this.handleClick1(e);
},
});
}
};
/** 菜单的点击事件 */
handleClick1 = async e => {
if (this.props.onToolBarClick && this.props.onToolBarClick(e)) {
return;
}
let checkedBoolean = false;
let obj = { enabled: false };
const { checked, checkedId, menuData, printData } = this.state;
const { key, keyPath = "" } = e;
// if (checked && checkedId === key) {
// checkedBoolean = true;
// }
const checkIndex = printData.findIndex(item => item.checkedId === key);
if (checkIndex > -1) {
checkedBoolean = printData[checkIndex].checked;
}
// console.log('toolbar-checked', checked, checkedId, key);
const iIndex = menuData.findIndex(item => item.sName === key || item.sControlName === key);
let interfaceArr = [];
if (iIndex > -1) {
interfaceArr = menuData[iIndex].interface;
}
const sErrorInfo = this.handleCheckButton(key); /* 验证按钮是否可以点击 */
if (commonUtils.isNotEmptyObject(sErrorInfo)) {
message.error(sErrorInfo);
return;
}
const bCancel = commonFunc.showLocalMessage(this.props, 'bCancel', '确定要取消');
const bInvalid = commonFunc.showLocalMessage(this.props, 'bInvalid', '确定要作废');
const bInvalidCancel = commonFunc.showLocalMessage(this.props, 'bInvalidCancel', '确定要作废');
const confirmSetting = commonFunc.showLocalMessage(this.props, 'confirmSetting', '请配置按钮的存储过程');
/* 新增 */
if (key === "BtnAdd") {
/* 增加 */
this.handleAdd(obj);
} else if (key === "BtnAddChild") {
/* 分类增加子级 */
this.handleAddChild(obj);
} else if (key.indexOf("BtnAddTo") > -1) {
/* 新增下拉 */
this.props.onAddTo(e.key);
} else if (key === "BtnUpd") {
/* 修改 */
this.props.onSaveState({
loading: true,
});
this.props.onEdit(obj);
} else if (key === "BtnSave") {
/* 保存 */
this.props.onSaveState({
loading: true,
});
/* 生产主计划重置数据变化状态 */
this.props.onSaveState({
dataChanged: false,
});
setTimeout(async () => {
/* 根据接口返回是之前调用还是之后调用 */
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
let flag = 0;
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i]);
if (!data) {
flag += 1;
return;
}
}
};
await asyncFunc();
// beforeInterfaceArr.forEach((item) => {
// this.handleInterfaceCall(item);
// });
if (flag == 0) {
this.handleSubmit();
} else {
this.props.onSaveState({
loading: false,
});
}
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
this.handleSubmit();
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
await this.handleInterfaceCall(afterInterfaceArr[i]);
}
};
await asyncFunc();
// afterInterfaceArr.forEach((item) => {
// this.handleInterfaceCall(item);
// });
}
} else {
this.handleSubmit();
}
}, 500);
} else if (key === "BtnExamine") {
/* 审核 */
this.props.onSaveState({
loading: true,
});
/* 根据接口返回是之前调用还是之后调用 */
let flag = 0;
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
// beforeInterfaceArr.forEach((item) => {
// this.handleInterfaceCall(item);
// });
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i]);
if (!data) {
flag += 1;
return;
}
}
};
await asyncFunc();
}
let result;
if (flag == 0) {
result = await this.props.onBtnExamine();
} else {
this.props.onSaveState({
loading: false,
});
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
// const result = await this.props.onBtnExamine();
if (result) {
/* 只有审核成功 才能调用接口 -5代表审核失败 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
await this.handleInterfaceCall(afterInterfaceArr[i], true);
}
};
await asyncFunc();
// afterInterfaceArr.forEach((item) => {
// this.handleInterfaceCall(item);
// });
}
}
} else {
this.props.onBtnExamine();
}
} else if (key === "BtnBatchExamine") {
/* 批量审核 接口循环调用 选中行1 调用接口+审核 选中行2 调用接口+审核 选中行3 调用接口+审核, 1错了,2、3继续 */
this.props.onSaveState({
loading: true,
});
/* 根据接口返回是之前调用还是之后调用 */
if (commonUtils.isNotEmptyArr(interfaceArr)) {
this.props.onBtnBatchExamine(interfaceArr);
} else {
this.props.onBtnBatchExamine();
}
this.props.onSaveState({
loading: false,
});
} else if (key === "BtnBatchCancelExamine") {
/* 批量审核 接口循环调用 选中行1 调用接口+审核 选中行2 调用接口+审核 选中行3 调用接口+审核, 1错了,2、3继续 */
this.props.onSaveState({
loading: true,
});
/* 根据接口返回是之前调用还是之后调用 */
if (commonUtils.isNotEmptyArr(interfaceArr)) {
this.props.onBtnBatchCancelExamine(interfaceArr);
} else {
this.props.onBtnBatchCancelExamine(interfaceArr);
}
this.props.onSaveState({
loading: false,
});
} else if (key === "BtnBatchExamine" && false) {
/* 批量审核 统一接口调用, 三条勾选行 合并为sIdArr */
this.props.onSaveState({
loading: true,
});
/* 根据接口返回是之前调用还是之后调用 */
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
// beforeInterfaceArr.forEach((item) => {
// this.handleInterfaceCall(item);
// });
let flag = 0;
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i]);
if (!data) {
flag += 1;
return;
}
}
};
await asyncFunc();
if (flag == 0) {
this.props.onBtnBatchExamine();
} else {
this.props.onSaveState({
loading: false,
});
}
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
const result = await this.props.onBtnBatchExamine();
if (result !== -5) {
/* 只有审核成功 才能调用接口 -5代表审核失败 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
await this.handleInterfaceCall(afterInterfaceArr[i], true);
}
};
await asyncFunc();
this.props.onSaveState({
loading: false,
});
// afterInterfaceArr.forEach((item) => {
// this.handleInterfaceCall(item);
// });
}
}
} else {
this.props.onBtnBatchExamine();
this.props.onSaveState({
loading: false,
});
}
} else if ( key.includes("BtnSendDialog")) {
/* 推送接口 */
/* 将当前界面所有数据集作为入参传到接口中 */
const { masterConfig, sModelsId } = this.props;
let { masterData } = this.props;
const addState = {};
let allTableMap = {};
const allReturnMap = {};
let masterDataList = []; /* 弹窗数据集合 */
let allDataList = {}; /* 接口返回所有数据对象集合 */
const btnConfig = commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === key))
? masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0]
: {}; // sButtonEnabled sButtonParam
const slaveNameList = [];
if (commonUtils.isNotEmptyObject(btnConfig)) {
/* 组装allTableData */
/* 从props找到 所有的Config */
if (commonUtils.isNotEmptyArr(this.props)) {
for (const key of Object.keys(this.props)) {
if (key.includes("Config") && !key.includes("onGet") && !key.includes("report")) {
const tablename = key.replace("Config", "").trim();
slaveNameList.push(tablename);
}
}
}
addState.slaveNameList = slaveNameList;
if (commonUtils.isNotEmptyArr(slaveNameList)) {
slaveNameList.forEach((name, index) => {
const tableConfig = this.props[name + "Config"]; /* 动态配置 */
if (commonUtils.isNotEmptyObject(tableConfig)) {
const tableData = this.props[name + "Data"]; /* 动态配置 */
const tableSelectedRowKeys = this.props[name + "SelectedRowKeys"]; /* 选中Key */
if (commonUtils.isNotEmptyObject(tableConfig)) {
allTableMap[name + "." + tableConfig.sTbName] = tableData;
}
}
});
const masterTbName = masterConfig.sTbName;
allTableMap["master." + masterTbName] = masterData;
}
const { sActiveKey } = btnConfig;
if (commonUtils.isNotEmptyStr(sActiveKey)) {
sActiveKey.split(",").forEach(item => {
const [tableName, fieldName] = item.split(".");
if (commonUtils.isNotEmptyStr(tableName) && commonUtils.isNotEmptyStr(fieldName)) {
let tableData = this.props[`${tableName}Data`];
if (commonUtils.isNotEmptyObject(tableData)) {
tableData = tableName === "master" ? tableData : tableData[0];
if (commonUtils.isNotEmptyObject(tableData)) {
allTableMap[fieldName] = tableData[fieldName];
}
}
}
});
if (commonUtils.isNotEmptyObject(this.tempCondition)) {
allTableMap = {
...allTableMap,
...this.tempCondition,
};
}
}
}
/* 根据接口返回是之前调用还是之后调用 */
this.props.onSaveState({
loading: true,
});
let addStateReturn = {};
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
addStateReturn = await this.handleInterfaceCallDialog(beforeInterfaceArr[i], true, key, allTableMap);
}
};
await asyncFunc();
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
addStateReturn = await this.handleInterfaceCallDialog(afterInterfaceArr[i], true, key, allTableMap);
}
};
await asyncFunc();
}
}
if (addStateReturn && addStateReturn.bResult) {
addState.interfaceDialogData = addStateReturn.returnData;
addState.interfaceDialogAllData = addStateReturn.returnData;
} else {
addState.interfaceDialogData = [];
}
addState.masterData = { ...masterData, bIsSAP: 1 };
if (commonUtils.isNotEmptyArr(addState.interfaceDialogAllData)) {
/* 循环interfaceDialogData */
addState.interfaceDialogAllData.forEach((item, index) => {
/* 先把master数据 放到interfaceDialogData中 */
let sMasterId = "";
const dataMap = {};
for (const key of Object.keys(item)) {
/* 把主表数据塞到masterDataList中 */
if (key && key.includes("master")) {
const data = commonUtils.isNotEmptyObject(item[key]) && commonUtils.isJSON(item[key]) ? JSON.parse(item[key]) : [];
if (commonUtils.isNotEmptyObject(data)) {
sMasterId = commonUtils.isNotEmptyObject(data.sSlaveId) ? data.sSlaveId : data.sId;
masterDataList.push(data);
}
}
const data = commonUtils.isNotEmptyObject(item[key]) && commonUtils.isJSON(item[key]) ? JSON.parse(item[key]) : [];
dataMap[key] = data;
}
/* 将全部返回数据都铺到allDataList中 */
const allKey = "master-" + sMasterId;
allDataList[allKey] = dataMap; /* 根据返回的下标 封装key-value */
});
addState.allDataList = allDataList;
}
/* 弹窗的条件是 数据集数量>1 或者有this.tempCondition 切配置弹窗,否则直接将返回数据集铺到界面上 */
if (
(commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyObject(btnConfig.sActiveId) && masterDataList.length > 0) ||
commonUtils.isNotEmptyObject(this.tempCondition)
) {
addState.interfaceDialogData = masterDataList;
addState.visibleInterfaceDialog = true;
addState.masterData = { ...masterData, bIsSAP: 1 };
} else {
addState.visibleInterfaceDialog = false; /* 没有弹窗 且主表只有1条 则不弹窗 直接带值 */
const dataMap = commonUtils.isNotEmptyArr(addState.interfaceDialogData) ? addState.interfaceDialogData[0] : {};
console.log("接口返回值:", dataMap);
if (commonUtils.isNotEmptyArr(slaveNameList) && commonUtils.isNotEmptyArr(dataMap)) {
slaveNameList.forEach(name => {
const tableConfig = this.props[name + "Config"]; /* 动态配置 */
let tableData = [];
if (commonUtils.isNotEmptyObject(tableConfig)) {
tableData = dataMap[name + "-" + tableConfig.sTbName]; /* 动态配置 */
if (commonUtils.isNotEmptyObject(tableData) && commonUtils.isJSON(tableData)) {
const newCopyTo = {};
newCopyTo.master = masterData;
let tableNewData = JSON.parse(tableData);
if (name === "master") {
tableNewData = Array.isArray(tableNewData) ? tableNewData[0] : tableNewData;
masterData = { ...masterData, ...commonFunc.getAssignFieldValue(btnConfig.sAssignField, tableNewData, newCopyTo, true), bIsSAP: 1 }; // 取赋值字段
addState.masterData = masterData;
} else {
const btnTableName = btnConfig.sControlName + "." + name;
const btnTableConfig = commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === btnTableName))
? masterConfig.gdsconfigformslave.filter(item => item.sControlName === btnTableName)[0]
: {}; // sButtonEnabled sButtonParam
const newData = [];
tableNewData.forEach(child => {
let newRow = {};
if (commonUtils.isNotEmptyObject(btnTableConfig) && btnTableConfig.sAssignField) {
newRow = { ...child, ...commonFunc.getAssignFieldValue(btnTableConfig.sAssignField, child, newCopyTo) }; // 取赋值字段
} else {
newRow = child;
}
newRow = {
...newRow,
handleType: "add",
sId: commonUtils.createSid(),
sParentId: masterData.sId,
};
newData.push(newRow);
});
addState[name + "Data"] = newData;
}
}
}
});
} else {
addState.masterData = { ...masterData, bIsSAP: 1 };
}
}
this.tempCondition = null;
addState.loading = false;
console.log("弹窗接口数据:", addState);
this.props.onSaveState({
...addState,
});
} else if (key.indexOf('BtnSend') > -1) { /* 推送接口 */
/* 根据接口返回是之前调用还是之后调用 */
this.props.onSaveState({
loading: true,
});
if(commonUtils.isNotEmptyArr(interfaceArr)) {
const sendInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "0" );
if(commonUtils.isNotEmptyArr(sendInterfaceArr)) { /* 之前调用 */
const asyncFunc = async () => {
for (let i = 0; i < sendInterfaceArr.length; i ++) {
await this.handleInterfaceCall(sendInterfaceArr[i], true, key);
}
}
await asyncFunc();
}
}
this.props.onSaveState({
loading: false,
});
} else if (key.includes("BtnAddFace")) {
// 显示人脸采集弹窗
this.props.onSaveState({
addFaceVisible: true,
});
} else if (key.includes("BtnGetApiDialog")) {
/* 从第三方拿数据 */
/* 将当前界面所有数据集作为入参传到接口中 */
const { masterConfig, sModelsId } = this.props;
let { masterData } = this.props;
const addState = {};
let allTableMap = {};
const allReturnMap = {};
let masterDataList = []; /* 弹窗数据集合 */
let allDataList = {}; /* 接口返回所有数据对象集合 */
const btnConfig = commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === key))
? masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0]
: {}; // sButtonEnabled sButtonParam
/* 根据接口返回是之前调用还是之后调用 */
this.props.onSaveState({
loading: true,
});
let addStateReturn = {};
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
addStateReturn = await this.handleInterfaceCallDialog(beforeInterfaceArr[i], true, key, allTableMap);
}
};
await asyncFunc();
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
addStateReturn = await this.handleInterfaceCallDialog(afterInterfaceArr[i], true, key, allTableMap);
}
};
await asyncFunc();
}
}
if (addStateReturn) {
addState.getApiDialogData = addStateReturn.returnData;
} else {
addState.getApiDialogData = [];
}
/* 弹窗的条件是 数据集数量>1 或者有this.tempCondition 切配置弹窗,否则直接将返回数据集铺到界面上 */
if (
(commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyObject(btnConfig.sActiveId)) ||
commonUtils.isNotEmptyObject(this.tempCondition)
) {
addState.visibleApiDialog = true;
}
this.tempCondition = null;
addState.loading = false;
console.log("发票获取第三方接口:", addState);
this.props.onSaveState({
...addState,
});
} else if (key === "BtnCancelExamine") {
/* 消审 */
this.props.onSaveState({
loading: true,
});
/* 根据接口返回是之前调用还是之后调用 */
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
let flag = 0;
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i]);
if (!data) {
flag += 1;
return;
}
}
};
await asyncFunc();
if (flag == 0) {
this.props.onBtnCancelExamine();
} else {
this.props.onSaveState({
loading: false,
});
}
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
const result = await this.props.onBtnCancelExamine();
if (result) {
/* 只有审核成功 才能调用接口 -5代表审核失败 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
await this.handleInterfaceCall(afterInterfaceArr[i], true);
}
};
await asyncFunc();
}
}
} else {
this.props.onBtnCancelExamine();
}
} else if (key.indexOf("BtnBsOperation") > -1) {
/* 作废、取消作废 */
if (key === "BtnBsOperation.BtnInvalid") {
obj = {
title: bInvalid,
handleType: "toVoid",
};
this.props.onChangeInvalid(obj);
} else if (key === "BtnBsOperation.BtnCancelInvalid") {
obj = {
title: bInvalidCancel,
handleType: "cancel",
};
this.props.onChangeInvalid(obj);
} else {
const name = key.split(".");
this.props.onButtonClick(name[1]);
}
} else if (key === "BtnInvalid") {
obj = {
title: bInvalid,
handleType: "toVoid",
};
this.props.onChangeInvalid(obj);
} else if (key === "BtnCancelInvalid") {
obj = {
title: bInvalidCancel,
handleType: "cancel",
};
this.props.onChangeInvalid(obj);
} else if (key === "BtnGetWeight") {
// 获取重量
this.props.onGetWeight();
} else if (key.indexOf("BtnCopyTo") > -1) {
/* 复制到 */ // && commonUtils.isNotEmptyStr(e.item.props.sActiveId)
// if (this.handleFreeDeliver(key)) return;
this.props.onCopyTo(e.key, e.item.props["data-sactiveid"]);
} else if (key.indexOf("BtnCopyFrom") > -1 && commonUtils.isNotEmptyStr(e.item.props["data-sactiveid"])) {
/* 复制从 */
obj = {
name: e.key,
copyFromKey: key,
copyFromSActiveId: e.item.props["data-sactiveid"],
};
this.props.onCopyFrom(obj);
} else if (key.indexOf("BtnEject") > -1) {
/* 自定义接口弹出 */
const { masterConfig, masterData } = this.props;
const buttonConfig = masterConfig.gdsconfigformslave.filter(item => item.sName === "" && item.showName !== "" && item.sControlName === key);
if (commonUtils.isNotEmptyStr(buttonConfig)) {
const sActiveKey = buttonConfig[0].sActiveKey;
/* 拿到表名 */
if (commonUtils.isNotEmptyObject(sActiveKey)) {
let tbName = "slave"; /* 表名 */
const btnName = key; /* 按钮名 */
let record = {}; /* 选中行 */
let iIndex = -1;
const splitData = sActiveKey.split(".");
if (commonUtils.isNotEmptyStr(splitData) && splitData.length > 1) {
tbName = splitData[0]; /* 表名 */
if (tbName === "master") {
record = masterData;
} else {
const { [`${tbName}SelectedRowKeys`]: tableSelectedRowKeys, [`${tbName}Data`]: tableData } = this.props;
if (commonUtils.isNotEmptyStr(tableData)) {
iIndex = tableData.findIndex(item => tableSelectedRowKeys.includes(item.sSlaveId));
if (iIndex > -1) {
record = tableData[iIndex];
}
}
}
}
this.props.onViewClick(tbName, btnName, record, iIndex);
}
}
} else if (
keyPath.indexOf("BtnBsOperation.BtnUpCheck") > -1 &&
commonUtils.isNotEmptyStr(e.item.props["data-sactiveid"]) &&
key.indexOf("BtnBsOperation.BtnUpCheck") < 0
) {
/* 上查 */ /* key.indexOf('BtnUpCheck') < 0 用于防止用户点击二级菜单时的跳转 */
this.props.onSearchUpDown(key, e.item.props["data-sactiveid"]);
} else if (
keyPath.indexOf("BtnBsOperation.BtnDownCheck") > -1 &&
commonUtils.isNotEmptyStr(e.item.props["data-sactiveid"]) &&
key.indexOf("BtnBsOperation.BtnDownCheck") < 0
) {
/* 下查 */ /* key.indexOf('BtnDownCheck') < 0 用于防止用户点击二级菜单时的跳转 */
this.props.onSearchUpDown(key, e.item.props["data-sactiveid"]);
} else if (key === "BtnNext") {
/* 下一条 */
this.props.onNext();
} else if (key === "BtnPrior") {
/* 上一条 */
this.props.onBtnPrior();
} else if (key === "BtnFirst") {
/* 首条 */
this.props.onBtnFirst();
} else if (key === "BtnLast") {
/* 末条 */
this.props.onBtnLast();
} else if (key === "BtnCancel") {
/* 取消 */
obj = {
title: bCancel,
};
this.props.onCancel(obj);
} else if (key.indexOf("BtnPrint") > -1 && commonUtils.isNotEmptyStr(e.item.props["data-sactiveid"])) {
/* 打印 */
const { billnosetting, masterData } = this.props;
let sActiveId = e.item.props["data-sActiveId"];
if (commonUtils.isEmptyObject(sActiveId)) {
sActiveId = e.item.props["data-sactiveid"];
}
if (billnosetting.sStatusType === "1") {
/* 1:审核后打印 0:制单后打印 */
if (!masterData.bCheck) {
/* 未审核只能预览pdf */
this.props.onBtnPreview(sActiveId, checkedBoolean, e.key);
} else {
/* 已审核:打印 */
this.props.onBtnPrint(sActiveId, checkedBoolean, e.key);
}
} else {
/* 制单后可以直接打印 */
this.props.onBtnPrint(sActiveId, checkedBoolean, e.key);
}
} else if (key === "BtnDel") {
/* 删除 */
const sureDelTitle = commonUtils.isNotEmptyObject(this.props?.app) ? commonFunc.showMessage(this.props.app.commonConst, "SureDel") : "SureDel";
obj = {
title: sureDelTitle,
};
this.props.onDel(obj);
} else if (key === "BtnGetGoods") {
this.props.onGetGoods();
} else if (key.indexOf("BtnUploadOther") > -1) {
/* 上传 */
const { slaveSelectedRowKeys } = this.props;
if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.warning("请先选择一条数据");
return;
}
this.props.onSaveState({
visibleOtherFilfile: true,
});
} else if (key.indexOf("BtnUpload_") > -1) {
const targetField = key.replace("BtnUpload_", "");
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = 'image/*';
fileInput.style.position = 'fixed';
fileInput.style.left = '-9999px';
document.body.appendChild(fileInput);
fileInput.addEventListener('change', (e) => {
const file = e.target.files[0];
const formData = new FormData();
formData.append('file', file);
const { formId } = this.props;
const { token } = this.props.app;
const url = `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`;
fetch(url, {
method: 'POST',
body: formData,
}).then(res => res.json()).then(response => {
if (response.code === 1) {
const imgUrl = response.dataset.rows[0].savePathStr;
const { masterData = {} } = this.props;
this.props.onSaveState({
masterData: {
...masterData,
[targetField]: imgUrl,
handleType: masterData.handleType || 'update'
}
});
} else {
this.props.getServiceError(response);
}
})
document.body.removeChild(fileInput);
});
fileInput.click();
} else if (key.indexOf("BtnUpload") > -1) {
/* 上传 */
const { slaveSelectedRowKeys } = this.props;
if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.warning("请先选择一条数据");
return;
}
this.props.onSaveState({
visibleFilfile: true,
});
}else if (key.indexOf("BtnDownloadBacth") > -1) {
/* 一键下载功能 */
const { slaveSelectedRowKeys, slaveData, app } = this.props;
// 检查是否选中数据
if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.warning("请先选择数据");
return;
}
// 获取选中数据的文件路径
const savePathArr = [];
const dataSelect = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) || slaveSelectedRowKeys.includes(item.sId));
if (commonUtils.isNotEmptyArr(dataSelect)) {
dataSelect.forEach(item => {
// 假设文件路径字段为sFilePath,根据实际数据结构调整
if (item.sPicturePath) {
savePathArr.push(item.sPicturePath);
}
});
}
// 如果没有找到文件路径,提示用户
if (commonUtils.isEmptyArr(savePathArr)) {
message.warning("选中的数据没有文件路径");
return;
}
// 获取菜单名称作为压缩包文件名
const menuName = commonUtils.isNotEmptyArr(dataSelect) ? dataSelect[0].sZipFileName : '下载文件';
const savePathStr = savePathArr.join(",");
// savePathStr = 'D:/xlyweberp/printPreviewPdf/192116811110017394976081060_采购订单_标准A4_CGDD25020036.xlsx,D:/xlyweberp/printPreviewPdf/19211681211917497873921861_估价单.pdf';
const zipFileName = `${menuName}`;
// 调用下载接口
const downloadUrl = `${commonConfig.file_host}file/downloadBacth`;
this.handleOpenPostBatch(downloadUrl, savePathStr, zipFileName);
} else if (key.indexOf("BtnEvent") > -1 || key.indexOf("BtnBatchSubmit") > -1 || key.indexOf("BtnSubmit") > -1) {
const {
slaveSelectedRowKeys,
slaveData,
formRoute,
slave0Child1Data: controlData,
materialsData: materialsData,
slave0Data: processData,
} = this.props;
let { slaveSelectedData } = this.props;
if (key == "BtnEventSAP" && ["/indexPage/processCardPackTableTree"].includes(this.props.formRoute)) {
if (!commonBusiness.validatePramsNotEmpty(this.props)) return;
}
// if (formRoute === '/indexPage/commonList' && commonUtils.isEmptyArr(slaveSelectedData)) {
// message.warning('请先选择一条数据');
// return;
// }
/* 如果主体数据为空 则提示 */
// if(location.pathname ==='/indexPage/commonCostomTabBill') {
// if(commonUtils.isEmptyArr(controlData) && commonUtils.isEmptyArr(processData) && commonUtils.isEmptyArr(materialsData)){
// message.error('主体数据不能为空!');
// return;
// }
// }
if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) {
slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId));
}
this.props.onSaveState({
loading: true,
});
// const slaveSelectedDataNew = this.deteleObject(slaveSelectedData); // 删除sid重复的数据
const btnConfig = this.props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0]; // sButtonEnabled sButtonParam
if (commonUtils.isNotEmptyObject(btnConfig) && commonUtils.isNotEmptyStr(btnConfig.sButtonParam)) {
/* 根据接口返回是之前调用还是之后调用 */
if (commonUtils.isNotEmptyArr(interfaceArr)) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
const bProgressBar = btnConfig.sRelation === "progressBar";
let bContinue = true;
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
let flag = 0;
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
if (bProgressBar) {
this.xlyProcessPercent = 0;
clearInterval(this.xlyProcessTimer);
message.loading({
content: <Progress percent={this.xlyProcessPercent} />,
key: "xlyProcess",
duration: 0,
className: styles.xlyProcess,
});
for (let j = 0; j < slaveSelectedRowKeys.length; j++) {
const slaveSelectedRowOneKey = slaveSelectedRowKeys[j];
const data = await this.handleInterfaceCall(beforeInterfaceArr[i], false, key, slaveSelectedRowOneKey, slaveSelectedRowOneKey);
if (!data) {
message.destroy("xlyProcess");
flag += 1;
break;
}
this.xlyProcessPercent = ((((i + 1) * (j + 1)) / (beforeInterfaceArr.length * slaveSelectedRowKeys.length)) * 100).toFixed(2);
message.loading({
content: <Progress percent={this.xlyProcessPercent} />,
key: "xlyProcess",
duration: this.xlyProcessPercent >= 100 ? 3 : 0,
className: styles.xlyProcess,
});
}
} else {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i], false, key, slaveSelectedRowKeys);
if (!data) {
flag += 1;
return;
}
}
}
};
await asyncFunc();
if (flag == 0) {
await this.handleBtnEent(btnConfig);
} else {
bContinue = false;
}
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr) && bContinue) {
/* 之后调用 */
const result = await this.handleBtnEent(btnConfig);
if (result === 1) {
/* 只有按钮成功 才能调用接口 -5代表审核失败 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
if (bProgressBar) {
this.xlyProcessPercent = 0;
clearInterval(this.xlyProcessTimer);
message.loading({
content: <Progress percent={this.xlyProcessPercent} />,
key: "xlyProcess",
duration: 0,
className: styles.xlyProcess,
});
for (let j = 0; j < slaveSelectedRowKeys.length; j++) {
const slaveSelectedRowOneKey = slaveSelectedRowKeys[j];
const data = await this.handleInterfaceCall(afterInterfaceArr[i], false, key, slaveSelectedRowOneKey, slaveSelectedRowOneKey);
if (!data) {
message.destroy("xlyProcess");
break;
}
this.xlyProcessPercent = ((((i + 1) * (j + 1)) / (afterInterfaceArr.length * slaveSelectedRowKeys.length)) * 100).toFixed(2);
message.loading({
content: <Progress percent={this.xlyProcessPercent} />,
key: "xlyProcess",
duration: this.xlyProcessPercent >= 100 ? 3 : 0,
className: styles.xlyProcess,
});
}
} else {
await this.handleInterfaceCall(afterInterfaceArr[i], false, key, slaveSelectedRowKeys);
}
}
};
await asyncFunc();
}
}
// for (const child of slaveSelectedDataNew) {
//
// }
} else if (btnConfig.sButtonParam?.includes("Sp_BtnEven_CalcJsHs") && btnConfig.showName?.includes("工资核算")) {
// 工资核算特殊处理
const { slave3Data = [], slave3SelectedRowKeys = [] } = this.props;
const slave3SelectedData = slave3Data.filter(item => slave3SelectedRowKeys.includes(item.sId));
if (slave3SelectedData.length) {
for (let i = 0; i < slave3SelectedData.length; i++) {
const slave3DataOne = slave3SelectedData[i];
const { sCalcProName: sCalcProDetail, sId, sCalcDepart } = slave3DataOne;
const inParams = [
{
key: "slave3",
value: [{ sId, sCalcProDetail }],
},
];
const percent = ((i / slave3SelectedData.length) * 100).toFixed(2);
message.loading({ content: <Progress percent={percent} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
await this.handleBtnEent(btnConfig, undefined, undefined, inParams);
// message.success(`【${sCalcDepart}】核算完成。`);
}
message.loading({ content: <Progress percent={99} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
message.success(`全部方案计算成功。`);
setTimeout(() => {
message.loading({ content: <Progress percent={100} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
}, 1000);
setTimeout(() => {
message.destroy("xlyProcess");
}, 2000);
} else {
message.warning("请先选择计算方案!");
}
} else {
this.handleBtnEent(btnConfig);
}
this.props.onSaveState({
loading: false,
});
} else {
message.error(confirmSetting);
this.props.onSaveState({
loading: false,
});
}
} else if (key.indexOf("BtnRepair") > -1) {
if (key.toLowerCase().endsWith("choosedate")) {
this.handleForceComplete(key, "chooseDate");
} else if (key.includes("BtnRepairGroup") || key.includes("BtnRepairUser")) {
/* 复制组权限单独处理 */
this.props.onButtonClick(key);
} else {
/* 根据接口返回是之前调用还是之后调用 */
if (false) {
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "2");
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
let flag = 0;
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i]);
if (!data) {
flag += 1;
return;
}
}
};
await asyncFunc();
if (flag == 0) {
this.handleForceComplete(key);
}
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
const result = await this.handleForceComplete(key);
if (result !== -5) {
/* 只有审核成功 才能调用接口 -5代表审核失败 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
await this.handleInterfaceCall(afterInterfaceArr[i], true);
}
};
await asyncFunc();
}
}
} else {
this.handleForceComplete(key);
}
}
} else if (key.indexOf("BtnApiLog") > -1) {
/* 操作日志 */
const { slaveSelectedRowKeys, slaveData, formRoute } = this.props;
let { slaveSelectedData } = this.props;
/* 根据接口返回是之前调用还是之后调用 */
const btnConfig = commonUtils.isNotEmptyArr(this.props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === key))
? this.props.masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0]
: {}; // sButtonEnabled sButtonParam
const msgInfo = commonUtils.isNotEmptyObject(btnConfig) ? btnConfig.sAssignField : "";
if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) {
slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId));
}
let slaveSelectedDataNew = [];
if (commonUtils.isNotEmptyArr(slaveSelectedData)) {
slaveSelectedDataNew = this.deteleObject(slaveSelectedData); // 删除sid重复的数据
if (slaveSelectedData[0].iStatus !== 0) {
message.error(msgInfo);
return;
}
}
let ids = "";
if (commonUtils.isNotEmptyArr(slaveSelectedDataNew)) {
slaveSelectedDataNew.forEach(item => {
if (commonUtils.isNotEmptyObject(item)) {
ids += `${item.sId},`;
}
});
ids = commonUtils.isNotEmptyObject(ids) ? ids.substr(0, ids.length - 1) : "";
}
this.handleInterfaceCallLog(ids);
} else if (key === "BtnForceComplete" || key === "BtnNoPurchase" || key === "BtnForceComplete2" || key === "BtnForceComplete3") {
this.handleForceComplete(key);
} else if (key === "BtnUpPbOrder") {
this.props.onSaveState({
upPbOrderVisible: true,
});
} else if (key === "BtnDlPbOrder") {
this.props.onSaveState({
dlPbOrderVisible: true,
});
} else if (key === "BtnCommonImport") {
this.handleImport();
} else if (key === "BtnInit") {
this.props.handleSlaveInit("slave");
} else if (key === "BtnExportSql.salve") {
this.props.handleMenuClick({ key: "formSlave" });
} else if (key === "BtnExportSql.master") {
this.props.handleMenuClick({ key: "formMaster" });
} else if (key === "BtnExportSql.full") {
this.props.handleMenuClick({ key: "fromMasterSlave" });
} else if (key === "BtnExportSql.full") {
this.props.handleMenuClick({ key: "fromMasterSlave" });
} else if (key === "BtnCopy2Custom") {
this.props.handleCopy2Custom();
} else if (key === "BtnModuleSql.sModuleSql") {
this.props.handleSqlDownload("single");
} else if (key === "BtnModuleSql.sModule2Sql") {
this.props.handleSqlDownload("all");
} else if (key === "BtnFileImposition") {
this.setState({
fileImpositionData: {
visible: true,
onCancel: () => {
this.setState({ fileImpositionData: null });
},
onOk: () => {
this.setState({ fileImpositionData: null });
},
onSaveState: obj => {
this.setState({
fileImpositionData: { ...this.state.fileImpositionData, ...obj },
});
},
onSaveState1: this.props.onSaveState,
},
});
} else if (key === "BtnSendCombined") {
const { masterConfig, sModelsId } = this.props;
const { makeUpPDFRecord } = this.state;
const config = masterConfig.gdsconfigformslave.find(x => x.sControlName === key) || makeUpPDFRecord.picArrConfig;
if (!config?.sActiveId) {
message.error("请先配置弹出界面");
return;
}
this.setState({
makeUpPDFData: {
pdfMakeUpVisible: true,
makeUpPDFRecord,
title: config.showName,
onCancel: (bRefreshTable) => {
if (bRefreshTable && this.props.onBtnSearch) {
this.props.onBtnSearch();
}
this.setState({ makeUpPDFData: null, makeUpPDFRecord: undefined });
this.props.onSaveState({
makeUpPDFRecord: undefined,
});
},
onOk: () => {
this.setState({ makeUpPDFData: null, makeUpPDFRecord: undefined });
this.props.onSaveState({
makeUpPDFRecord: undefined,
});
},
selectData: this.props.slaveData.filter(x => this.props.slaveSelectedRowKeys.includes(x.sSlaveId || x.sId)),
app: {
...this.props.app,
currentPane: {
name: "pdfMakeUp",
config,
title: "文件拼板",
route: "element/pdfMakeUp",
formId: config.sActiveId,
key: `${sModelsId}${config.sActiveId}`,
sModelsType: "element/pdfMakeUp",
},
},
sModelsId: config.sActiveId,
formSrcRoute: "element/pdfMakeUp",
dispatch: this.props.dispatch,
content: this.props.content,
config,
enabled: true,
},
});
} else if (key === "BtnBoxData") {
// 盒型设计弹窗
// 获取页面上的盒型数据
const { masterConfig, sModelsId } = this.props;
const { makeUpPDFRecord } = this.state;
const config = masterConfig.gdsconfigformslave.find(x => x.sControlName === key) || makeUpPDFRecord.picArrConfig;
const makeConfig = masterConfig.gdsconfigformslave.find(x => x.sControlName === "sMakeUpFile")
if (!config?.sActiveId) {
message.error("请先配置弹出界面");
return;
}
this.setState({
BtnBoxData: {
state:{...this.props},
boxVisible: true,
makeUpPDFRecord,
title: config.showName,
onCancel: () => {
this.setState({ BtnBoxData: null, makeUpPDFRecord: undefined });
this.props.onSaveState({
makeUpPDFRecord: undefined,
});
},
onOk: (obj) => {
this.setState({ BtnBoxData: null, makeUpPDFRecord: undefined ,slaveData:obj.slaveData,masterData:obj.masterData});
this.props.onSaveState({
slaveData:obj.slaveData,
masterData:obj.masterData
});
},
selectData: this.props.slaveData.filter(x => this.props.slaveSelectedRowKeys.includes(x.sSlaveId || x.sId)),
app: {
...this.props.app,
currentPane: {
name: "boxDesign",
config,
title: "盒型设计",
route: "element/boxDesign",
formId: config.sActiveId,
key: `${sModelsId}${config.sActiveId}`,
sModelsType: "element/boxDesign",
sActiveName:config.sActiveName
},
},
sModelsId: config.sActiveId,
formSrcRoute: "element/boxDesign",
dispatch: this.props.dispatch,
content: this.props.content,
config,
makeConfig,
enabled: true,
},
});
} else if (this.props.onButtonClick !== undefined) {
this.props.onButtonClick(key);
}
};
// 删除当前pane
handleClosePane = (btnConfig, callback) => {
const { showName, sButtonParam } = btnConfig;
/* 若sButtonParam含有 bClose": true 则关闭当前页签*/
let bClose = false; /* 是否关闭当前页签 */
let bRefreshBefore = false; /* 是否刷新之前列表 */
if (sButtonParam && commonUtils.isJSON(sButtonParam)) {
const jsonObj = JSON.parse(sButtonParam);
if (jsonObj.bClose) {
bClose = true;
}
if (jsonObj.bRefreshBefore) {
bRefreshBefore = true;
}
}
if (bClose) {
const { panes, currentPane } = this.props.app;
const currentPaneIndex = panes.findIndex(item => item.key === currentPane.key);
if (currentPaneIndex > 0) {
const newPanes = panes.filter(item => item.key !== currentPane.key);
this.props.dispatch({
type: "app/removePane",
payload: { changePanes: newPanes, currentPane: panes[currentPaneIndex - 1] },
}); /* 关闭当前页签 */
}
if (bRefreshBefore) {
if (currentPane.refresh !== undefined) {
currentPane.refresh();
}
}
} else {
callback();
}
};
// 在handleOpenPost方法后添加批量下载方法
handleOpenPostBatch = (url, savePathStr, zipFileName) => {
console.log('222', {url, savePathStr, zipFileName})
const newWin = window.open();
let formStr = "";
formStr =
`<form style="visibility:hidden;" method="POST" action="${url}">` +
`<input type="hidden" name="savePathStr" value='${savePathStr}' />` +
`<input type="hidden" name="zipFileName" value='${zipFileName}' />` +
"</form>";
newWin.document.body.innerHTML = formStr;
newWin.document.forms[0].submit();
return newWin;
};
handleSubmit = () => {
// 保存前手机号、邮箱校验
let checkResult = true;
const { masterData = {}, masterConfig = {} } = this.props;
const { gdsconfigformslave = [] } = masterConfig;
const sDateFormatTypeList = ["phone", "mobile", "mail", "postcode"];
const fieldsList = gdsconfigformslave.filter(item => item.bVisible && item.sDateFormat && sDateFormatTypeList.includes(item.sDateFormat));
for (let i = 0; i < fieldsList.length; i++) {
const config = fieldsList[i];
const { sName, showName, sDateFormat } = config;
const value = masterData[sName];
if (value === undefined || value === "") {
continue;
}
if (sDateFormat === "phone") {
const reg = /^0\d{2,3}-\d{7,8}$/;
const reg1 = /^1[0-9]{10}$/;
const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/;
if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) {
message.warning(`【${showName}】【${sName}】格式不正确!`);
checkResult = false;
break;
}
} else if (sDateFormat === "mobile") {
const reg = /^0\d{2,3}-\d{7,8}$/;
const reg1 = /^1[0-9]{10}$/;
const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/;
if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) {
message.warning(`【${showName}】【${sName}】格式不正确!`);
checkResult = false;
break;
}
} else if (sDateFormat === "mail") {
const reg = /^[a-zA-Z0-9]{1,20}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}$/;
if (!reg.test(value)) {
message.warning(`【${showName}】【${sName}】格式不正确!`);
checkResult = false;
break;
}
} else if (sDateFormat === "postcode") {
const reg = /^[1-9][0-9]{5}$/;
if (!reg.test(value)) {
message.warning(`【${showName}】【${sName}】格式不正确!`);
checkResult = false;
break;
}
}
}
// 客户简码校验
// if (masterData.sBuSort2) {
// const reg = /^(?:[A-Z]{4}|[A-Z]{2}\d{2}|[A-Z]{3}\d)$/;
// if (!reg.test(masterData.sBuSort2)) {
// message.warning(`【客户简码】格式不正确【正确格式:大写字母+数字(共四位)】!`);
// checkResult = false;
// }
// }
if (checkResult) {
// 验证各种工序参数的必填项
if (!commonBusiness.validatePramsNotEmpty(this.props)) return;
this.props.onSubmit();
} else {
this.props.onSaveState({
loading: false,
});
}
};
deteleObject = (obj = []) => {
// eslint-disable-next-line camelcase
const replace_data = obj;
const result = []; // 去重后的数组对象集合
const hash = {};
// eslint-disable-next-line no-plusplus
for (let i = 0; i < replace_data.length; i++) {
const elem = replace_data[i].sId;
if (!hash[elem]) {
result.push(replace_data[i]);
hash[elem] = true;
}
}
return result;
};
handleCheckButton = key => {
let sErrorInfo = "";
const sCheckName = "s" + key + "ErroMsg";
/* sControlName + ErrorMsg 看数据集是否包含,包含则提示出来 */
let tableName = "";
if (location.pathname && location.pathname.includes("List")) {
tableName = "slave";
} else {
tableName = "master";
}
if (commonUtils.isNotEmptyObject(tableName)) {
const { [`${tableName}Data`]: tableData, [`${tableName}SelectedRowKeys`]: tableSelectedRowKeys } = this.props;
if (tableName === "master" && commonUtils.isNotEmptyObject(tableData)) {
sErrorInfo = tableData[sCheckName];
} else if (commonUtils.isNotEmptyArr(tableData)) {
const iIndex = tableData.findIndex(item => tableSelectedRowKeys.includes(item.sSlaveId));
if (iIndex > -1) {
const tableRow = tableData[iIndex];
if (commonUtils.isNotEmptyObject(tableRow[sCheckName])) {
sErrorInfo = tableRow[sCheckName];
}
}
}
}
return sErrorInfo;
};
handleToolBarKeyDown = e => {
/* 前端CTRL+ALT+G后,如果没有数据默认跳转第一个配置的数据 */
if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) {
/* CTRL+ALT+G F7 设置界面 */
const { sType } = this.props?.app?.userinfo || {};
if (!["sysadmin"].includes(sType)) {
return;
}
if (commonUtils.isNotEmptyObject(this.props)) {
let name = "master";
if (location.pathname.includes("commonList")) {
name = "slave";
}
console.log("name", name);
const { [`${name}Config`]: tableConfig } = this.props;
if (commonUtils.isNotEmptyArr(tableConfig)) {
const myTableConfig = JSON.parse(JSON.stringify(tableConfig));
myTableConfig.sActiveId = "16411004790004762980820285096000";
/* 找到配置的第一个字段 */
const columnArr = tableConfig.gdsconfigformslave.filter(child => child.sName !== "" && child.bVisible && child.showName !== "");
const sName = commonUtils.isNotEmptyArr(columnArr) ? columnArr[0].sName : "";
myTableConfig.sName = sName;
const myTableConfigArr = [];
myTableConfigArr.push(myTableConfig);
if (name === "master") {
/* 主表 */
this.props.onViewClick(name, "myTableConfig", {}, 0, myTableConfigArr, "");
} else {
/* 从表 */
this.props.onViewClick(name, "myTableConfig", {}, 0, myTableConfigArr, "");
}
}
}
}
};
/* 解析消息 */
handleGetMsg = str => {
const msgArr = commonUtils.isNotEmptyObject(str) ? str.split("xpm") : "";
const divStr = [];
if (commonUtils.isNotEmptyArr(msgArr)) {
for (let i = 0; i < msgArr.length; i++) {
divStr.push(<p>{msgArr[i]}</p>);
}
}
return divStr;
};
/* 调用后台配置的接口 */
handleInterfaceCall = async (obj, showTip, key, ids, slaveSelectedRowKeysOld) => {
let bResult = false;
const { app, sModelsId, masterData, slaveData, masterConfig, slaveFilterCondition } = this.props;
const slaveSelectedRowKeys = slaveSelectedRowKeysOld || this.props.slaveSelectedRowKeys;
const sInterfaceName = obj.sInterfaceName;
/* 如果key是BtnSendList 传从表的主键集合 */
let idArr = "";
/* 如果有对应字段 则取对应字段 ,否则 取默认值 */
const btnConfig = commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === key))
? masterConfig.gdsconfigformslave.filter(item => item.sControlName === key)[0]
: {};
let sActiveKey = "";
if (commonUtils.isNotEmptyObject(btnConfig)) {
sActiveKey = btnConfig.sActiveKey;
}
if (sActiveKey) {
if (sActiveKey.includes("master.sId")) {
idArr = masterData.sId;
}
} else if (key && (key.includes("BtnSendList") || key.includes("BtnBatchExamine"))) {
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
slaveSelectedRowKeys.forEach(item => {
if (commonUtils.isNotEmptyObject(item)) {
idArr += `${item},`;
}
});
idArr = commonUtils.isNotEmptyObject(idArr) ? idArr.substr(0, idArr.length - 1) : "";
}
} else if (location.pathname.includes("commonList")) {
const { slaveSelectedRowKeys, slaveData } = this.props;
let { slaveSelectedData } = this.props;
if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) {
slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId));
}
const slaveSelectedDataNew = this.deteleObject(slaveSelectedData); // 删除sid重复的数据
if (commonUtils.isNotEmptyArr(slaveSelectedDataNew)) {
slaveSelectedDataNew.forEach(item => {
if (commonUtils.isNotEmptyObject(item)) {
idArr += `${item.sId},`;
}
});
idArr = commonUtils.isNotEmptyObject(idArr) ? idArr.substr(0, idArr.length - 1) : "";
}
if (commonUtils.isNotEmptyObject(ids)) {
/* 如果是勾选多行 则sId为循环的每一条 */
idArr = ids;
}
} else {
idArr = masterData.sId;
}
const value = {
sId: commonUtils.isNotEmptyObject(idArr) ? idArr : commonUtils.isNotEmptyObject(ids) ? ids : masterData.sId,
sSlaveId: slaveSelectedRowKeys?.toString(),
masterData,
userInfo: app.userinfo,
};
if (location.pathname.includes("commonList") && commonUtils.isNotEmptyArr(slaveFilterCondition)) {
value.bFilter = JSON.stringify(slaveFilterCondition);
}
const url = `${commonConfig.interface_host}interfaceDefine/callthirdparty/${sInterfaceName}?sModelsId=${sModelsId}`;
const returnData = (await commonServices.postValueService(app.token, value, url, app)).data;
if (showTip) {
if (!returnData || returnData.code < 0) {
if (commonUtils.isNotEmptyObject(returnData) && returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
} else {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
return;
}
// message.error('同步INFOR失败!');
return;
} else {
// message.success('同步INFOR成功!');
}
}
if (!returnData) {
message.error("接口调用失败!");
return false;
}
if (returnData.code === 1) {
bResult = true;
// message.success(returnData.msg);
} else if (returnData.code === 2) {
// Modal.info({
// title: '温馨提示:',
// content: (
// <div>
// {this.handleGetMsg(returnData.msg)}
// </div>
// ),
// okText: '确认',
// onOk() {},
// });
bResult = true;
} else if (returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
bResult = false;
} else {
bResult = false;
this.props.getServiceError(returnData);
}
/* 若配置的是按钮后调用第三方, 则调用成功后 需要重新回刷一次数据 */
if (commonUtils.isNotEmptyObject(obj) && obj.sInterfaceCallMethod === "2") {
if (bResult) {
this.props.onButtonClick("BtnRefresh");
}
}
return bResult;
};
/* 调用后台配置的接口 */
handleInterfaceCallDialog = async (obj, showTip, key, map) => {
const addState = {};
let bResult = false;
const { app, sModelsId, masterData, slaveSelectedRowKeys } = this.props;
const sInterfaceName = obj.sInterfaceName;
/* 如果key是BtnSendList 传从表的主键集合 */
let idArr = "";
if (key && key.includes("BtnSendList")) {
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
slaveSelectedRowKeys.forEach(item => {
if (commonUtils.isNotEmptyObject(item)) {
idArr += `${item},`;
}
});
idArr = commonUtils.isNotEmptyObject(idArr) ? idArr.substr(0, idArr.length - 1) : "";
}
}
const value = { sId: key === "BtnSendList" ? idArr : masterData.sId, masterData, userInfo: app.userinfo, data: map };
const url = `${commonConfig.interface_host}interfaceDefine/callthirdparty/${sInterfaceName}?sModelsId=${sModelsId}`;
const returnData = (await commonServices.postValueService(app.token, value, url, app)).data;
/*
-1: 提示returnData.msg的信息(message.error)
-8: 提示提示returnData.msg的信息(Modal温馨提示)
1: 提示returnData.msg的信息(message.sucess)
2: 提示提示returnData.msg的信息(Modal温馨提示)
**/
if (showTip) {
if (!returnData || returnData.code < 1) {
if (commonUtils.isNotEmptyObject(returnData) && returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
} else if (commonUtils.isNotEmptyObject(returnData) && returnData.code === -1) {
message.error(returnData.msg);
}
return;
} else if (returnData.code === 2) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
} else {
// message.success('同步INFOR成功!');
}
}
let inforEvent = ["itemiss", "jobmatliss", "jobmatliss-bz", "jobmatliss-tl", "jobmatliss-cx"];
if (obj && inforEvent.indexOf(obj.sInterfaceName) !== -1) {
if (!returnData || returnData.code < 1) {
if (returnData) {
if (returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
} else {
message.error(returnData.erroMsg || returnData.msg);
}
} else {
message.error("审核失败!");
}
return false;
}
}
if (commonUtils.isNotEmptyObject(returnData)) {
if (returnData.code > 0) {
bResult = true;
if (commonUtils.isNotEmptyObject(returnData.data) && commonUtils.isNotEmptyObject(returnData.data.dataList)) {
addState.returnData = returnData.data.dataList;
}
} else if (returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
} else {
message.error(returnData.erroMsg || returnData.msg);
}
} else {
bResult = false;
this.props.getServiceError(returnData);
}
addState.bResult = bResult;
// addState.returnData = datalist;
return addState;
};
/* 调用后台配置的日志接口 */
handleInterfaceCallLog = async ids => {
let bResult = false;
const { app, sModelsId } = this.props;
const value = { userInfo: app.userinfo };
const url = `${commonConfig.interface_host}interfaceDefine/callthirdpartyByLogId/${ids}?sModelsId=${sModelsId}`;
const returnData = (await commonServices.postValueService(app.token, value, url, app)).data;
if (!returnData) {
message.error("接口调用失败!");
return false;
}
if (returnData.code === 1) {
bResult = true;
// message.success(returnData.msg);
} else if (returnData.code === 2) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
bResult = true;
} else if (returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
bResult = false;
} else {
bResult = false;
this.props.getServiceError(returnData);
}
return bResult;
};
/* 新增 */
handleAdd = () => {
this.props.onAdd();
};
/* 新增子级 */
handleAddChild = obj => {
this.props.onAddChild(obj);
};
handleRefresh = () => {
this.props.onButtonClick("BtnRefresh");
};
handleFilfileManageCancel = modelVisible => {
const { slaveConfig, sModelsId } = this.props;
if (["12710101117013204247130"].includes(sModelsId)) {
this.props.onGetData(slaveConfig);
}
this.props.onSaveState({ [modelVisible]: false });
};
onSaveFaceSuccess = () => {
// 人脸采集成功后关闭弹窗
this.props.onSaveState({ addFaceVisible: false });
message.success("人脸采集成功");
};
handleFilfileManageOk = (modelVisible, selectConfig, filfileSelectedData, sSrcSlaveId, filfileDelData) => {
if (commonUtils.isNotEmptyObject(sSrcSlaveId) && !location.pathname.includes("commonList")) {
/* 工单、工艺卡、报价单控制表数据带回 */
let controlFilfileData = [];
let controlFilfileDelData = [];
if (commonUtils.isNotEmptyArr(filfileSelectedData)) {
controlFilfileData = filfileSelectedData.filter(item => item.sSrcSlaveId === sSrcSlaveId); /* 控制表选中行上传的图片数组 */
}
if (commonUtils.isNotEmptyArr(filfileDelData)) {
controlFilfileDelData = filfileDelData.filter(item => item.sSrcSlaveId === sSrcSlaveId);
}
const { sActiveId } = selectConfig;
if (sActiveId && location.pathname.includes("processCardPackTableTree")) {
// 印品PBOM专用附件回调
this.props.onFilfileManageOk1 &&
this.props.onFilfileManageOk1({
controlFilfileData,
controlFilfileDelData,
sSrcSlaveId,
});
} else {
// 通用附件回调
this.props.onFilfileManageOk(controlFilfileData, controlFilfileDelData, sSrcSlaveId);
}
}
this.props.onSaveState({ [modelVisible]: false, visibleOtherFilfile: false }, () => {
const { sAfterClickInstruct, showName } = selectConfig;
if (sAfterClickInstruct) {
instructSet({
...this.props,
slavepupData: filfileSelectedData,
btnConfig: { sInstruct: sAfterClickInstruct, showName },
});
}
});
};
handleSelectDialog = (name, selectConfig, selectData) => {
this.props.onSelectDialog(name, selectConfig, selectData, "master");
};
handleDialogCancel = () => {
this.props.onSaveState({ visibleInterfaceDialog: false });
};
// 获取订单中的取消
handleCancel = () => {
this.setState({
inputChange: "",
});
this.props.onGetGoodsCancle();
};
// 获取订单中的确定
handleOk = () => {
this.props.onGetGoodsValue(this.state.inputChange);
};
// 获取订单中的值变化
handleInputChange = e => {
this.setState({
inputChange: e.target.value,
});
};
radioClick = (Child, e) => {
e.stopPropagation();
const { printData } = this.state;
const iIndex = printData.findIndex(item => item.checkedId === Child.sControlName);
if (iIndex === -1) {
const printObj = {};
printObj.checked = e.target.checked;
printObj.checkedId = Child.sControlName;
printData.push(printObj);
} else {
printData[iIndex] = { ...printData[iIndex], checked: e.target.checked };
}
this.setState({
// eslint-disable-next-line react/no-unused-state
// checked: e.target.checked, checkedId: Child.sControlName,
printData,
});
};
// 进行存储过程按钮存储过程参数解析拼接 根据存储过程按钮参数配置进行解析,配置是json格式 {"sproName":"cal_sss","inMap":"master.sSlaveId,slave.sId"}
handleBtnEent = async (btnConfig, name, sValue, nextInParams) => {
this.xlyProcessPercent = 0;
clearInterval(this.xlyProcessTimer);
if (this.props.app?.currentPane?.title === "工单损耗及无形损跟踪" && btnConfig?.sControlName === "BtnEventAllWork") {
message.loading({ content: <Progress percent={0} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
this.xlyProcessTimer = setInterval(() => {
if (this.xlyProcessPercent >= 50) {
this.xlyProcessPercent += 0.2;
} else if (this.xlyProcessPercent >= 90) {
return;
} else {
this.xlyProcessPercent += 0.5;
}
message.loading({ content: <Progress percent={this.xlyProcessPercent} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
}, 500);
}
this.props.onSaveState({
pageLoading: true,
});
const { menuData } = this.state;
let iResult = 0;
let bFirst = false;
if (
commonUtils.isNotEmptyObject(btnConfig) &&
(btnConfig.sControlName === "BtnEventReceiveReturn" || btnConfig.sControlName === "BtnEventReceive")
) {
// 刀模归还, 刀模领用判断是否选择数据
const { slaveSelectedRowKeys, app } = this.props;
if (slaveSelectedRowKeys && commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.warn(commonFunc.showMessage(app.commonConst, "pleaseChooseData")); // 请选择记录
this.props.onSaveState({
pageLoading: false,
});
return;
}
}
if (commonUtils.isNotEmptyObject(btnConfig) && btnConfig.sControlName.includes("BtnEventAutoOrder")) {
// 刀模归还, 刀模领用判断是否选择数据
bFirst = true; /* 沒有选中行时 默认第一条 */
}
const { masterData, sCurrMemoProps, masterConditionData } = this.props;
if (commonUtils.isNotEmptyObject(name) && name.indexOf("BtnRepair") > -1 && commonUtils.isNotEmptyObject(sCurrMemoProps)) {
sCurrMemoProps.bVisibleMemo = false;
this.props.onSaveState({ sCurrMemoProps });
}
const sButtonParam = btnConfig.sButtonParam;
console.log("11", btnConfig);
const btn = commonUtils.convertStrToObj(sButtonParam);
const sProName = btn.sproName;
const inParams = [];
const inMap = btn.inMap;
const inlist = inMap ? inMap.split(",") : [];
const masterArr = [];
const masterConditionArr = [];
const slaveArr = [];
const slaveInfoArr = [];
const controlArr = [];
const materialsArr = [];
const processArr = [];
const sTableName = btn.sTableName;
if (!sTableName && !inMap) {
// 都为undefined时直接退出
this.props.onSaveState({
pageLoading: false,
});
return;
}
if (inlist.length > 0) {
inlist.forEach(item => {
const itemArr = item.split(".");
if (itemArr.length > 0) {
const sname = itemArr[0];
const stype = itemArr[1];
const stypeNew = itemArr.length > 2 ? itemArr[2] : stype;
if (commonUtils.isNotEmptyStr(sname) && sname === "master") {
masterArr.push([stype, stypeNew]);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "masterCondition") {
/* 参数数据集 */
masterConditionArr.push([stype, stypeNew]);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "slave") {
slaveArr.push([stype, stypeNew]);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "slaveInfo") {
slaveInfoArr.push([stype, stypeNew]);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "control") {
controlArr.push([stype, stypeNew]);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "materials") {
materialsArr.push([stype, stypeNew]);
}
if (commonUtils.isNotEmptyStr(sname) && sname === "process") {
processArr.push([stype, stypeNew]);
}
if (
commonUtils.isNotEmptyStr(sname) &&
!["master", "masterCondition", "slave", "slaveInfo", "control", "materials", "process"].includes(sname)
) {
const addState = this.handleProParams(sname, [[stype, stypeNew]]);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
}
});
if (commonUtils.isNotEmptyArr(masterArr) && commonUtils.isNotEmptyObject(masterData)) {
const addState = {};
addState.key = "master";
const val = [];
const currVal = {};
masterArr.forEach(([stype, stypeNew]) => {
currVal[`${stypeNew}`] = masterData[`${stype}`];
});
val.push(currVal);
addState.value = val;
inParams.push({ ...addState });
}
if (commonUtils.isNotEmptyArr(masterConditionArr) && commonUtils.isNotEmptyObject(masterConditionData)) {
const addState = {};
addState.key = "masterCondition";
const val = [];
const currVal = {};
masterConditionArr.forEach(filed => {
currVal[`${filed}`] = masterConditionData[`${filed}`];
});
val.push(currVal);
addState.value = val;
inParams.push({ ...addState });
}
if (commonUtils.isNotEmptyArr(slaveArr)) {
const addState = this.handleProParams("slave", slaveArr, bFirst);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(slaveInfoArr)) {
const addState = this.handleProParams("slaveInfo", slaveInfoArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(controlArr)) {
const addState = this.handleProParams("control", controlArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(materialsArr)) {
const addState = this.handleProParams("materials", materialsArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
if (commonUtils.isNotEmptyArr(processArr)) {
const addState = this.handleProParams("process", processArr);
if (commonUtils.isNotEmptyObject(addState)) {
inParams.push({ ...addState });
}
}
}
if (commonUtils.isNotEmptyStr(sTableName) && commonUtils.isNotEmptyArr(inParams)) {
inParams.forEach(item => {
if (commonUtils.isNotEmptyArr(item.value)) {
item.value.forEach(item1 => {
item1.sTableName = sTableName;
});
}
});
}
/* 列表增加查询条件的传参 */
if (
location.pathname?.includes("indexPage/commonList") &&
(btnConfig?.sControlName === "BtnEventOneWork" || btnConfig?.sControlName === "BtnEventAllWork")
) {
const { slaveFilterCondition = [] } = this.props;
if (commonUtils.isNotEmptyArr(slaveFilterCondition) && commonUtils.isNotEmptyArr(inParams)) {
inParams.forEach(item => {
item.bFilter = slaveFilterCondition;
});
}
console.log("inParams", inParams);
}
const iIndex = commonUtils.isNotEmptyObject(btnConfig) ? menuData.findIndex(item => item.sControlName === btnConfig.sControlName) : -1;
let interfaceArr = [];
if (iIndex > -1) {
interfaceArr = menuData[iIndex].interface;
}
if (commonUtils.isNotEmptyArr(interfaceArr) && commonUtils.isNotEmptyObject(btnConfig) && btnConfig.sControlName.includes("BtnRepair")) {
if (true) {
const { slaveSelectedRowKeys, app, slaveData } = this.props;
if (inMap && inMap.includes("slave.") && slaveSelectedRowKeys && commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.warn(commonFunc.showMessage(app.commonConst, "pleaseChooseData")); // 请选择记录
this.props.onSaveState({
pageLoading: false,
});
return;
}
let slaveRow = {};
const iSlaveDataIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId));
if (iSlaveDataIndex > -1) {
slaveRow = slaveData[iSlaveDataIndex];
}
let ids = "";
if (location.pathname.includes("commonList")) {
let { slaveSelectedData } = this.props;
if (commonUtils.isEmptyArr(slaveSelectedData) && commonUtils.isNotEmptyArr(slaveData)) {
slaveSelectedData = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sId) || slaveSelectedRowKeys.includes(item.sSlaveId));
}
const slaveSelectedDataNew = this.deteleObject(slaveSelectedData); // 删除sid重复的数据
if (commonUtils.isNotEmptyArr(slaveSelectedDataNew)) {
slaveSelectedDataNew.forEach(item => {
if (commonUtils.isNotEmptyObject(item)) {
ids += `${item.sId},`;
}
});
ids = commonUtils.isNotEmptyObject(ids) ? ids.substr(0, ids.length - 1) : "";
}
} else {
ids = slaveRow.sId;
}
const beforeInterfaceArr = interfaceArr.filter(item => item.sInterfaceCallMethod === "1");
const afterInterfaceArr = commonUtils.isNotEmptyArr(interfaceArr) ? interfaceArr.filter(item => item.sInterfaceCallMethod === "2") : [];
if (commonUtils.isNotEmptyArr(beforeInterfaceArr)) {
/* 之前调用 */
let flag = 0;
const asyncFunc = async () => {
for (let i = 0; i < beforeInterfaceArr.length; i++) {
const data = await this.handleInterfaceCall(beforeInterfaceArr[i], true, btnConfig.sControlName, ids);
if (!data) {
flag += 1;
this.props.onSaveState({
pageLoading: false,
});
return;
}
}
};
await asyncFunc();
if (flag == 0) {
await this.handleProcedureCall(btnConfig, sProName, JSON.stringify({ params: inParams, changeValue: sValue, sButtonParam: btn }));
}
}
if (commonUtils.isNotEmptyArr(afterInterfaceArr)) {
/* 之后调用 */
const result = await this.handleProcedureCall(
btnConfig,
sProName,
JSON.stringify({ params: inParams, changeValue: sValue, sButtonParam: btn })
);
console.log("result", result);
if (result > 0) {
/* 只有成功 才能调用接口 -5代表失败 */
const asyncFunc = async () => {
for (let i = 0; i < afterInterfaceArr.length; i++) {
await this.handleInterfaceCall(afterInterfaceArr[i], true, btnConfig.sControlName, ids);
}
};
await asyncFunc();
}
}
}
} else {
const inParamsNew = nextInParams || inParams;
iResult = await this.handleProcedureCall(btnConfig, sProName, JSON.stringify({ params: inParamsNew, changeValue: sValue, sButtonParam: btn }));
}
if (this.props.app?.currentPane?.title === "工单损耗及无形损跟踪" && btnConfig?.sControlName === "BtnEventAllWork") {
clearInterval(this.xlyProcessTimer);
this.xlyProcessPercent = 91;
message.loading({ content: <Progress percent={91} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
this.xlyProcessTimer = setInterval(() => {
this.xlyProcessPercent += 1;
message.loading({ content: <Progress percent={this.xlyProcessPercent} />, key: "xlyProcess", duration: 0, className: styles.xlyProcess });
if (this.xlyProcessPercent === 100) {
clearInterval(this.xlyProcessTimer);
setTimeout(() => {
message.destroy();
}, 1000);
}
}, 100);
}
this.props.onSaveState({
pageLoading: false,
});
return iResult;
};
// 存储过程按钮调用存储过程
handleProcedureCall = async (btnConfig, proName, proInParam, other) => {
const { app, sModelsId } = this.props;
let iResult = 0;
const sBtnName = btnConfig.sControlName;
const value = { sProName: proName, sProInParam: proInParam, sBtnName };
if (other?.iFlag === 1) {
value.iFlag = 1;
}
const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`;
// const url = '';
const returnData = (await commonServices.postValueService(app.token, value, url)).data;
if (proName === "Sp_BtnEven_CalcJsHs") {
if (returnData.code === 1) {
message.success(returnData.msg);
} else {
message.warning(returnData.msg);
}
const proInParamJson = commonUtils.convertStrToObj(proInParam);
const sId = proInParamJson.params?.[0]?.value?.[0]?.sId;
const { slave3Data = [] } = this.props;
const iIndex = slave3Data.findIndex(item => item.sId === sId);
if (iIndex !== -1) {
slave3Data[iIndex].sCalcProDetail = returnData.msg;
this.props.onSaveState({ slave3Data });
}
} else if (returnData.code === 1) {
message.success(returnData.msg);
this.handleClosePane(btnConfig, () => {
this.props.onButtonClick("BtnRefresh");
});
} else if (returnData.code === -8) {
Modal.info({
title: "温馨提示:",
content: <div>{this.handleGetMsg(returnData.msg)}</div>,
okText: "确认",
onOk() {},
});
} else {
this.props.getServiceError({ ...returnData, fn: () => this.handleProcedureCall(btnConfig, proName, proInParam, { iFlag: 1 }) });
}
iResult = returnData.code;
this.props.onSaveState({ loading: false });
// 点击返回重排的时候刷新树
if (btnConfig.sControlName === "BtnEventReturn") {
if (this.props.refreshTreeData) {
this.props.refreshTreeData();
}
}
return iResult;
};
// 根据配置解析拼接具体参数
handleProParams = (sKey, arr, bFirst) => {
const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
let keyData =
commonUtils.isNotEmptyArr(tableData) && commonUtils.isNotEmptyArr(selectedRowKeys)
? tableData.filter(
item => commonUtils.isEmptyObject(item.sDivRowNew) && (selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId))
)
: [];
if (bFirst) {
/* 没有选中行时默认第一条 */
if (commonUtils.isNotEmptyArr(tableData)) {
keyData = [tableData[0]];
}
}
if (commonUtils.isNotEmptyArr(keyData)) {
const addState = {};
addState.key = sKey;
const val = [];
keyData.forEach(currData => {
const currVal = {};
arr.forEach(([stype, stypeNew]) => {
currVal[`${stypeNew}`] = currData[`${stype}`];
});
val.push(currVal);
});
addState.value = val;
return addState;
} else {
return undefined;
}
};
/* 双击弹出Memo */
handleGetMemo = (name, sValue, sMemoFiled, sRecord, bVisibleMemo, btnConfig, sCurrMemoPropsType) => {
const sCurrMemoProps = sCurrMemoPropsType === "1" ? this.props.sCurrMemoProps1 : this.props.sCurrMemoProps;
sCurrMemoProps.bVisibleMemo = false;
if (btnConfig.length > 0) {
sRecord[sMemoFiled] = sValue;
if (sCurrMemoPropsType === "1") {
this.props.onSaveState({ sCurrMemoProps1: sCurrMemoProps });
} else {
this.props.onSaveState({ sCurrMemoProps });
}
this.handleToForceComplete(sValue);
} else {
let { [`${name}Data`]: tableData } = this.props;
let addStata = { [`${sMemoFiled}`]: sValue };
if (name !== "master") {
const iIndex = tableData.findIndex(item => item.sId === sRecord.sId);
let handleType = tableData[iIndex].handleType; /* 获取操作类型 */
handleType = commonUtils.isEmpty(handleType) ? "update" : handleType;
addStata.handleType = handleType;
tableData[iIndex] = { ...tableData[iIndex], ...addStata };
} else {
if (sMemoFiled === "sFormulaMemo") {
addStata.sFormula = sValue;
}
let handleType = tableData.handleType; /* 获取操作类型 */
handleType = commonUtils.isEmpty(handleType) ? "update" : handleType;
addStata.handleType = handleType;
tableData = { ...tableData, ...addStata };
}
this.props.onSaveState({ ...sCurrMemoProps, [`${name}Data`]: tableData });
}
};
handleGetMemo1 = (name, sValue, sMemoFiled, sRecord, bVisibleMemo, btnConfig) => {
this.handleGetMemo(name, sValue, sMemoFiled, sRecord, bVisibleMemo, btnConfig, "1");
};
/* 点击隐藏Memo 弹窗 */
handleGetMemoCancel = () => {
const { sCurrMemoProps } = this.props;
sCurrMemoProps.bVisibleMemo = false;
this.props.onSaveState({ sCurrMemoProps });
};
handleGetMemoCancel1 = () => {
const { sCurrMemoProps1 } = this.props;
sCurrMemoProps1.bVisibleMemo = false;
this.props.onSaveState({ sCurrMemoProps1 });
};
handleForceComplete = (name, createDate) => {
let sysLogData = {};
const slaveMemoConfigOld = [];
const { slaveSelectedRowKeys, slaveInfoSelectedRowKeys, app, masterConfig, slaveInfoData, masterData, slaveData, gdsformconst } = this.props;
const btnConfig =
commonUtils.isNotEmptyObject(masterConfig) &&
commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === name))
? masterConfig.gdsconfigformslave.filter(item => item.sControlName === name)[0]
: {}; // sButtonEnabled sButtonParam
const bNoMemo = btnConfig.sDefault === "noMemo";
if (createDate !== "chooseDate") {
let target = "";
if (btnConfig.sActiveKey) {
target = btnConfig.sActiveKey.split(",")[0].split(".")[0];
}
if (target === "slave" && commonUtils.isEmptyArrNew(slaveSelectedRowKeys)) {
message.warn(commonFunc.showMessage(app.commonConst, "pleaseChooseData")); // 请选择记录
} else if (target === "slaveInfo" && commonUtils.isEmptyArrNew(slaveInfoSelectedRowKeys)) {
message.warn(commonFunc.showMessage(app.commonConst, "pleaseChooseData")); // 请选择记录
} else if (target === "slaveInfo" && !Array.isArray(slaveInfoData)) {
message.warn("请展开详情并选择数据。"); // 请选择记录
} else {
let btnConfigNameArr = [];
let singleConfig = {};
let singleRow = {}; /* 选中行的数据 */
if (name.indexOf("BtnRepair") > -1) {
if (!commonUtils.isEmpty(btnConfig.sActiveKey)) {
btnConfigNameArr = btnConfig.sActiveKey.split(",");
}
if (commonUtils.isNotEmptyArr(btnConfigNameArr)) {
// eslint-disable-next-line array-callback-return
btnConfigNameArr.map(i => {
let sIndex = -1;
if (target === "slaveInfo") {
sIndex = this.props.slaveInfoConfig.gdsconfigformslave.findIndex(item => item.sName === i.split(".")[1]);
const iSlaveIndex = slaveInfoData.findIndex(item => slaveInfoSelectedRowKeys.includes(item.sSlaveId));
if (iSlaveIndex > -1) {
singleRow = slaveInfoData[iSlaveIndex];
}
} else if (target === "master") {
sIndex = this.props.masterConfig.gdsconfigformslave.findIndex(item => item.sName === i.split(".")[1]);
singleRow = masterData;
} else {
if (commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.slaveConfig)) {
sIndex = this.props.slaveConfig.gdsconfigformslave.findIndex(item => item.sName === i);
const iSlaveIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId) || slaveSelectedRowKeys.includes(item.sId));
if (iSlaveIndex > -1) {
singleRow = slaveData[iSlaveIndex];
}
}
}
console.log("singleRow:", singleRow);
if (sIndex > -1) {
if (target === "slaveInfo") {
singleConfig = this.props.slaveInfoConfig.gdsconfigformslave[sIndex];
} else if (target === "master") {
singleConfig = this.props.masterConfig.gdsconfigformslave[sIndex];
} else {
singleConfig = this.props.slaveConfig.gdsconfigformslave[sIndex];
}
if (masterData && commonUtils.isNotEmptyObject(singleRow)) {
masterData[singleConfig.sName] = singleRow[singleConfig.sName];
}
// if (masterData && commonUtils.isNotEmptyObject(singleConfig)) {
// masterData[singleConfig.sName] = undefined;
// }
slaveMemoConfigOld.push(singleConfig);
}
});
}
}
/* 时间格式的字段 若默认值为空 则取当前时间 */
const activeKeyData = commonUtils.isNotEmptyObject(btnConfig.sActiveKey) ? btnConfig.sActiveKey.split(",") : [];
if (activeKeyData.length > 1) {
/* 当多字段时候 若时间格式的字段 若默认值为空 则取当前时间 */
const filterData = activeKeyData.filter(item => item.substring(0, 1) === "t");
if (commonUtils.isNotEmptyArr(filterData)) {
filterData.forEach(item => {
let currentDate = moment().format("YYYY-MM-DD HH:mm:ss");
// 如果默认值为0 则不设置默认时间
const itemConfigIndex = masterConfig.gdsconfigformslave.findIndex(config => config.sName === item);
if (itemConfigIndex !== -1 && masterConfig.gdsconfigformslave[itemConfigIndex].sDefault === "0") {
currentDate = null;
}
if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isEmpty(masterData[item])) {
masterData[item] = currentDate;
}
});
}
} else {
if (commonUtils.isNotEmptyObject(btnConfig.sActiveKey) && btnConfig.sActiveKey.substring(0, 1) === "t") {
if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isEmpty(masterData[btnConfig.sActiveKey])) {
masterData[btnConfig.sActiveKey] = moment().format("YYYY-MM-DD HH:mm:ss");
}
}
}
// if (slaveSelectedRowKeys === undefined || slaveSelectedRowKeys === null) {
// message.warn('请选择数据!');
// return;
// }
sysLogData = commonUtils.isNotEmptyArr(slaveSelectedRowKeys) ? { sId: slaveSelectedRowKeys.toString() } : {};
this.props.onSaveState({
slaveMemoConfig: slaveMemoConfigOld,
masterData: commonUtils.isNotEmptyObject(masterData)
? lodash.cloneDeep(masterData)
: {} /* 将选中行数据深拷贝 变成两个互不相扰的独立数据源 */,
sCurrMemoProps: {
bVisibleMemo: true,
sMemoField: "sReason",
sRecord: sysLogData,
dataSource: sysLogData,
btnName: name,
bNoMemo,
},
});
}
} else {
/* 从系统常量中找到pChooseDate的sName */
let pChooseDateName = "生成凭证";
if (commonUtils.isNotEmptyArr(gdsformconst)) {
const iIndex = gdsformconst.findIndex(item => item.sName === "pChooseDate");
if (iIndex > -1) {
pChooseDateName = gdsformconst[iIndex].showName;
}
}
const chooseDateConfig = {
sId: commonUtils.createSid(),
sName: "pChooseDate",
sDropDownType: "sql",
bNotEmpty: false,
iVisCount: 1,
dropDownData: [],
showName: pChooseDateName,
sDateFormat: btnConfig && btnConfig.sDateFormat ? btnConfig.sDateFormat : "YYYY-MM-DD",
};
slaveMemoConfigOld.push(chooseDateConfig);
this.props.onSaveState({
slaveMemoConfig: slaveMemoConfigOld,
sCurrMemoProps: {
bVisibleMemo: true,
sMemoField: "sReason",
sRecord: sysLogData,
dataSource: sysLogData,
btnName: name,
bNoMemo,
},
});
}
};
handleToForceComplete = async sValue => {
const { app, slaveSelectedRowKeys, slaveConfig, sModelsId, slaveInfoSelectedRowKeys, formRoute, masterConfig } = this.props;
const { token } = app;
let iIndex = -1;
if (masterConfig && Array.isArray(masterConfig.gdsconfigformslave)) {
iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnForceComplete" || item.sControlName === "BtnNoPurchase");
}
if (iIndex < 0 && slaveConfig && Array.isArray(slaveConfig.gdsconfigformslave)) {
iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnForceComplete" || item.sControlName === "BtnNoPurchase");
}
if (iIndex < 0) return;
const btnConfig = slaveConfig.gdsconfigformslave[iIndex];
// debugger
const sRelation = btnConfig.sRelation;
let selectedRowKeys = "";
if (formRoute === "/indexPage/materialRequirementsPlanning") {
selectedRowKeys = slaveInfoSelectedRowKeys.toString();
} else {
selectedRowKeys = slaveSelectedRowKeys.toString();
}
const url = `${commonConfig.server_host}bill/billForceComplete?sModelsId=${sModelsId}&sName=${formRoute}`;
const values = { sqlParam: sRelation, sId: selectedRowKeys, sReason: sValue };
const masterReturn = (await commonServices.postValueService(token, values, url)).data;
if (masterReturn.code === 1) {
message.success(masterReturn.msg);
this.props.onButtonClick("BtnRefresh");
} else {
this.props.getServiceError(masterReturn);
}
};
/** 上传文件改变时的状态 */
handleUploadChange = async info => {
const { slaveSelectedRowKeys, app, slaveSelectedData, sModelsId, token } = this.props;
if (slaveSelectedRowKeys === undefined || slaveSelectedRowKeys.length !== 1) {
message.warn(commonFunc.showMessage(app.commonConst, "selectedRowKeysNo")); /* 请先选择一条数据! */
return;
}
const { file } = info;
if (file.response) {
if (file.response.code === 1) {
/* 成功 */
message.success(file.response.msg);
const savePathStr = file.response.dataset.rows[0].savePathStr;
const sId = commonUtils.isNotEmptyArr(slaveSelectedData) ? slaveSelectedData[0].sId : "";
const bFile = commonUtils.isNotEmptyArr(slaveSelectedData) ? slaveSelectedData[0].bCorrespondFile : "";
if (commonUtils.isNotEmptyObject(sId) && !bFile) {
const url = `${commonConfig.server_host}salesorder/updateOrderCorrespondFile?sModelsId=${sModelsId}`;
const values = { sOrderId: sId, savePathStr };
const sReturn = (await commonServices.postValueService(token, values, url)).data;
if (sReturn.code === 1) {
this.props.onButtonClick("BtnRefresh");
} else {
this.props.getServiceError(sReturn);
}
}
} else {
/* 失败 */
this.props.getServiceError({ msg: commonFunc.showMessage(app.commonConst, "reportDesign") + file.response }); /* 报表设计 */
}
}
};
/** 上传发票文件改变时的状态 */
handleUploadInvoiceChange = async info => {
const { slaveSelectedRowKeys, app, slaveSelectedData, sModelsId, token } = this.props;
if (slaveSelectedRowKeys === undefined || slaveSelectedRowKeys.length !== 1) {
message.warn(commonFunc.showMessage(app.commonConst, "selectedRowKeysNo")); /* 请先选择一条数据! */
return;
}
const { file } = info;
if (file.response) {
if (file.response.code === 1) {
/* 成功 */
message.success(file.response.msg);
} else {
/* 失败 */
this.props.getServiceError({ msg: "发票上传失败!" }); /* 报表设计 */
}
}
};
/* 订单文件下载 */
handleBtnDownload = () => {
const { slaveSelectedRowKeys, slaveData, app } = this.props;
if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
message.warn(commonFunc.showMessage(app.commonConst, "selectedRowKeysNo")); /* 请先选择一条数据 */
return;
}
const dataSelect = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId));
const sBillNoArr = [];
let sBillNoStr = "";
if (commonUtils.isNotEmptyArr(dataSelect)) {
dataSelect.forEach(item => {
sBillNoArr.push(item.sBillNo);
});
sBillNoStr = JSON.stringify(sBillNoArr);
}
if (commonUtils.isNotEmptyArr(sBillNoArr)) {
const urlPrint = `${commonConfig.file_host}file/downloadPbOrder`;
this.handleOpenPost(urlPrint, sBillNoStr);
}
};
handleOpenPost = (url, params) => {
const newWin = window.open();
let formStr = "";
formStr =
`<form style="visibility:hidden;" method="POST" action="${url}">` + `<input type="hidden" name="sOrderNo" value='${params}' />` + "</form>";
newWin.document.body.innerHTML = formStr;
newWin.document.forms[0].submit();
return newWin;
};
handleUploadImgChange = info => {
const { file } = info;
if (file.response && file.response.code === 1) {
const { treeSelectedKeys } = this.props;
const sPicturePath = file.response.dataset.rows[0].savePathStr;
const uploadInfo = {
sPicturePath,
sFileName: file.name,
};
let { masterData } = this.props;
const addState = {};
if (file.response && file.response.code === 1) {
addState.sTitleLogoPath = uploadInfo.sPicturePath;
/* 当前设备状态上传多张图 */
if (commonUtils.isNotEmptyArr(treeSelectedKeys) && treeSelectedKeys[0].indexOf("101251240115016043081412740") > -1) {
addState.sTitleLogoPath = masterData.sTitleLogoPath;
if (commonUtils.isNotEmptyObject(addState.sTitleLogoPath)) {
addState.sTitleLogoPath += `,${uploadInfo.sPicturePath}`;
} else {
addState.sTitleLogoPath = uploadInfo.sPicturePath;
}
}
addState.handleType = "update";
}
masterData = { ...masterData, ...addState };
this.props.onSaveState({ masterData });
} else if (file.response && file.response.code === -1) {
message.error(file.response.msg);
}
};
/* 通用上传员工图片 */
handleUploadPicChange = info => {
const { file } = info;
if (file.response && file.response.code === 1) {
const sPicturePath = file.response.dataset.rows[0].savePathStr;
const spicture = sPicturePath;
const uploadInfo = {
sPicturePath,
sFileName: file.name,
};
let { masterData } = this.props;
const addState = {};
if (file.response && file.response.code === 1) {
addState.sPicturePath = uploadInfo.sPicturePath;
addState.spicture = spicture;
addState.handleType = "update";
}
masterData = { ...masterData, ...addState };
this.props.onSaveState({ masterData });
} else if (file.response && file.response.code === -1) {
message.error(file.response.msg);
}
};
/* 通用上传各种文件 */
handleUploadFilesChange = info => {
const { file,} = info;
if (file.response && file.response.code === 1) {
/* 刷新列表 */
message.open({
type: 'success',
content: '文件上传成功',
duration: 1
});
this.handleRefresh();
}else if (file.response && file.response.code === -8) {
Modal.info({
title: '温馨提示:',
content: (
<div>
{this.handleGetMsg(file.response.msg)}
</div>
),
okText: '确认',
onOk() {},
});
} else if (file.response && file.response.code === -1) {
message.error(file.response.msg);
}
};
customRequest = option => {
const { onSuccess, onError, file, action, data = {} } = option;
// 添加额外的参数
const formData = new FormData();
formData.append("file", file);
Object.keys(data).forEach(key => {
formData.append(key, data[key]);
});
fetch(action, {
method: "POST",
body: formData,
})
.then(response => response.json())
.then(data => {
onSuccess(data, file);
})
.catch(error => {
onError(error);
});
};
// 获取img元素
getImageDom = sIcon => {
if (!sIcon) {
return false;
}
const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${sIcon}&sModelsId=100&token=${this.props.token}`;
return (
<img
src={imageUrl}
style={{
width: 13,
height: 13,
marginRight: 3,
marginTop: -2,
}}
/>
);
};
/** 渲染 */
render() {
const { menuData, searchUpDownData, fileImpositionData = {}, makeUpPDFData = {},BtnBoxData={} } = this.state;
const {
loading,
sModelsId,
masterConfig,
masterData,
visibleGetGoods,
visibleFilfile,
visibleOtherFilfile,
copyFromChooseVisible,
app,
sTabId,
controlSelectedRowKeys,
sModelsType,
slaveSelectedData,
slaveSelectedRowKeys,
formRoute,
slaveData,
visibleInterfaceDialog,
interfaceDialogData,
visibleApiDialog,
getApiDialogData,
bTabModal,
addFaceVisible,
} = this.props;
const { userinfo } = app;
const pane = app.panes.filter(paneTmp => paneTmp.key === sTabId)[0];
const filfileManageTitle = commonFunc.showMessage(app.commonConst, "filfileManageTitle"); /* 通用文件上传 */
const getGoodsTitle = commonFunc.showMessage(app.commonConst, "getGoodsTitle"); /* 获取订单表头 */
const getGoodsPlaceholder = commonFunc.showMessage(app.commonConst, "handleNoWebOrderIds"); /* 获取订单输入框字样 */
let btnUploadConfig = {};
if (commonUtils.isNotEmptyObject(masterConfig)) {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnUpload");
if (iIndex > -1) {
btnUploadConfig = this.props.masterConfig.gdsconfigformslave[iIndex];
}
}
/* 第二个上传按钮 */
let btnUploadOtherConfig = {};
if (commonUtils.isNotEmptyObject(masterConfig)) {
const iOtherIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName && item.sControlName.includes("BtnUploadOther"));
if (iOtherIndex > -1) {
btnUploadOtherConfig = this.props.masterConfig.gdsconfigformslave[iOtherIndex];
}
}
let btnUploadIconConfig = {};
if (commonUtils.isNotEmptyObject(masterConfig)) {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnUploadicon");
if (iIndex > -1) {
btnUploadIconConfig = this.props.masterConfig.gdsconfigformslave[iIndex];
}
}
let sSlaveId = "";
let selectedsId = ""; /* 列表选中行或窗体sFormId */
let selectedRow = {};
const bList = ["/indexPage/commonList", "/indexPage/commonClassify"].includes(formRoute);
if (
(sModelsType === "manufacture/workOrder" || sModelsType === "manufacture/workOrder3" || sModelsType === "quotation/quotation") &&
commonUtils.isNotEmptyArr(controlSelectedRowKeys)
) {
sSlaveId = controlSelectedRowKeys[0]; /* 控制表选中行ID */
} else if (bList) {
/* HM订单准印资质列表 sSrcId为列表选中行sId */
if (sModelsType === "HMOrderList") {
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
selectedsId = slaveSelectedRowKeys[0];
}
} else if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId));
if (iIndex > -1) {
selectedRow = slaveData[iIndex];
selectedsId =
commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(selectedRow)
? commonUtils.isNotEmptyObject(selectedRow.sFormId)
? selectedRow.sFormId
: ""
: ""; /* 列表从表的sFormId */
sSlaveId =
commonUtils.isNotEmptyArr(slaveData) && commonUtils.isNotEmptyObject(selectedRow)
? commonUtils.isNotEmptyObject(selectedRow.sSlaveId)
? selectedRow.sSlaveId
: ""
: ""; /* 列表从表的sSlaveId */
}
}
}
/* 如果配置按钮有sqlConditon条件 则根据SQLCondition条件 否则走正常 */
let conditonValues = { sSrcId: bList ? selectedsId : commonUtils.isNotEmptyObject(masterData) ? masterData.sId : "" };
if (commonUtils.isNotEmptyObject(btnUploadConfig) && btnUploadConfig.sSqlCondition) {
/* 选中行 */
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId));
if (iIndex > -1) {
if (commonUtils.isNotEmptyObject(selectedRow)) {
conditonValues = this.props.getSqlCondition(btnUploadConfig, "slave", selectedRow);
}
}
}
}
let conditonOtherValues = { sSrcId: bList ? selectedsId : commonUtils.isNotEmptyObject(masterData) ? masterData.sId : "" };
if (commonUtils.isNotEmptyObject(btnUploadOtherConfig) && btnUploadOtherConfig.sSqlCondition) {
/* 选中行 */
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId));
if (iIndex > -1) {
if (commonUtils.isNotEmptyObject(selectedRow)) {
conditonOtherValues = this.props.getSqlCondition(btnUploadOtherConfig, "slave", selectedRow);
}
}
}
}
const filfilemanageType = {
app: {
...this.props.app,
currentPane: {
name: "elefilfilemanage",
config: btnUploadConfig,
conditonValues,
title: filfileManageTitle,
route: "/elefilfilemanage",
formId: btnUploadConfig && btnUploadConfig.sActiveId ? btnUploadConfig.sActiveId : "15864832090002447752315825731600",
key: `${sModelsId}15864832090002447752315825731600`,
sModelsType: "element/filfilemanage",
sSrcNo: bList
? commonUtils.isNotEmptyArr(selectedRow)
? selectedRow.sBillNo
: ""
: commonUtils.isNotEmptyObject(masterData)
? masterData.sBillNo
: "" /* 源单号 */,
sSrcFormId: bList
? commonUtils.isNotEmptyArr(selectedRow)
? sModelsId
: ""
: commonUtils.isNotEmptyObject(masterData)
? masterData.sFormId
: "" /* 源单窗体Id */,
sSrcId: bList
? commonUtils.isNotEmptyObject(selectedRow)
? selectedRow.sId
: ""
: commonUtils.isNotEmptyObject(masterData)
? masterData.sId
: "" /* 源单Id */,
sSrcSlaveId: commonUtils.isNotEmptyObject(sSlaveId) ? sSlaveId : "" /* 工单控制表选中行或列表的是sSlaveId */,
onFilfileOk: this.handleFilfileManageOk,
onFilfileCancel: this.handleFilfileManageCancel,
refresh: this.handleRefresh,
},
},
config: btnUploadConfig,
enabled: true /*this.props.enabled */,
dispatch: this.props.dispatch,
content: this.props.content,
id: new Date().getTime().toString(),
};
/* 第二个上传按钮配置 */
const filfilemanageOtherType = {
app: {
...this.props.app,
currentPane: {
name: "elefilfilemanage",
config: btnUploadOtherConfig,
conditonValues: conditonOtherValues,
title: filfileManageTitle,
route: "/elefilfilemanage",
formId: btnUploadOtherConfig && btnUploadOtherConfig.sActiveId ? btnUploadOtherConfig.sActiveId : "15864832090002447752315825731600",
key: `${sModelsId}15864832090002447752315825731600`,
sModelsType: "element/filfilemanage",
sSrcNo: bList
? commonUtils.isNotEmptyArr(selectedRow)
? selectedRow.sBillNo
: ""
: commonUtils.isNotEmptyObject(masterData)
? masterData.sBillNo
: "" /* 源单号 */,
sSrcFormId: bList
? commonUtils.isNotEmptyArr(selectedRow)
? sModelsId
: ""
: commonUtils.isNotEmptyObject(masterData)
? masterData.sFormId
: "" /* 源单窗体Id */,
sSrcId: bList
? commonUtils.isNotEmptyObject(selectedRow)
? selectedRow.sId
: ""
: commonUtils.isNotEmptyObject(masterData)
? masterData.sId
: "" /* 源单Id */,
sSrcSlaveId: commonUtils.isNotEmptyObject(sSlaveId) ? sSlaveId : "" /* 工单控制表选中行或列表的是sSlaveId */,
onFilfileOk: this.handleFilfileManageOk,
onFilfileCancel: this.handleFilfileManageCancel.bind(this, "visibleOtherFilfile"),
},
},
config: btnUploadOtherConfig,
enabled: true /*this.props.enabled */,
dispatch: this.props.dispatch,
content: this.props.content,
id: new Date().getTime().toString(),
};
/* 通用复制从调用 */
let copyFromType = {};
let copyFromConfig = {};
let copyFromTitle = "自定义复制从窗体"; /* 复制从工艺卡查询结果 */
if (commonUtils.isNotEmptyObject(this.props.copyFromChooseData)) {
const copyFromKey = this.props.copyFromKey;
const iIndex = this.props.masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === copyFromKey);
if (iIndex > -1) {
copyFromConfig = this.props.masterConfig.gdsconfigformslave[iIndex];
copyFromTitle = commonUtils.isNotEmptyObject(copyFromConfig) ? copyFromConfig.sActiveName : copyFromTitle;
}
copyFromType = {
app: {
...this.props.app,
currentPane: {
name: "commonCopyFrom",
config: copyFromConfig,
conditonValues: this.props.getSqlCondition(copyFromConfig),
title: this.props.copyFromChooseData.sMenuName,
route: this.props.copyFromChooseData.sName,
formId: this.props.copyFromChooseData.sId,
key: sModelsId + this.props.copyFromChooseData.sId,
sModelsType: this.props.copyFromChooseData.sModelType,
select: this.props.onCopyFromSelect /* 自定义复制从窗体时间 */,
selectCancel: this.handleFilfileManageCancel.bind(this, "copyFromChooseVisible"),
},
},
dispatch: this.props.dispatch,
content: this.props.content,
id: new Date().getTime().toString(),
};
}
/* 接口对话框弹出推送接口返回数据功能 */
let btnDialogConfig = {};
if (commonUtils.isNotEmptyObject(masterConfig)) {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnSendDialog");
if (iIndex > -1) {
btnDialogConfig = this.props.masterConfig.gdsconfigformslave[iIndex];
}
}
const intefaceDialogType = {
app: {
...this.props.app,
currentPane: {
name: "interfaceDialog",
config: btnDialogConfig,
conditonValues,
title: filfileManageTitle,
route: "/eleintefaceDialog",
formId: btnDialogConfig && btnDialogConfig.sActiveId ? btnDialogConfig.sActiveId : "15864832090002447752315825731600",
key: `${sModelsId}15864832090002447752315825731600`,
sModelsType: "element/intefaceDialog",
select: this.handleSelectDialog,
selectCancel: this.handleDialogCancel,
},
},
config: btnDialogConfig,
slaveData: interfaceDialogData,
enabled: true /*this.props.enabled */,
dispatch: this.props.dispatch,
content: this.props.content,
id: new Date().getTime().toString(),
onGetIntefaceDialogData: (slaveFilterCondition = [], callback) => {
const tempCondition = {};
slaveFilterCondition.forEach(item => {
const { bFilterName, bFilterValue } = item;
tempCondition[bFilterName] = bFilterValue;
});
this.tempCondition = tempCondition;
this.handleClick({ key: "BtnSendDialog" });
setTimeout(() => {
callback && callback();
}, 1000);
},
};
let upPbOrderProps = {};
let sBillNo = "";
if (commonUtils.isNotEmptyArr(slaveSelectedData)) {
sBillNo = slaveSelectedData[0].sBillNo;
}
const uploadIconProps = {
action: `${commonConfig.file_host}file/upload?sModelsId=${sModelsId}&token=${app.token}&sUploadType=model`,
onChange: this.handleUploadImgChange,
accept: "image/*",
showUploadList: false,
listType: "text",
disabled: !this.props.enabled,
// beforeUpload: this.handleBeforeUpload,
};
upPbOrderProps = {
action: `${commonConfig.file_host_ebc}file/uploadPbOrder?sModelsId=${sModelsId}&&sOrderNo=${sBillNo}`,
onChange: this.handleUploadChange,
accept: ".pdf",
showUploadList: false,
beforeUpload: () => {
if (commonUtils.isEmptyObject(sBillNo)) {
const noUpload = commonFunc.showMessage(app.commonConst, "NoUpload"); /* 禁止上传 */
message.error(noUpload);
return false;
}
},
};
/* 职工信息上传员工图片 */
const uploadPicProps = {
action: `${commonConfig.file_host}file/upload?sModelsId=${sModelsId}&token=${app.token}`,
onChange: this.handleUploadPicChange,
accept: "image/*",
showUploadList: false,
disabled: !this.props.enabled,
// beforeUpload: this.handleBeforeUpload,
};
const sBrandsId = userinfo?.sBrandsId;
const sSubsidiaryId = userinfo?.sSubsidiaryId;
/* 上传文件 */
const uploadFilesProps = {
action: `${commonConfig.file_host}file/uploadMachinePlc?sModelsId=${sModelsId}&&sBrandsId=${sBrandsId}&sSubsidiaryId=${sSubsidiaryId}&token=${app.token}`,
onChange: this.handleUploadFilesChange,
accept: '*/*',
showUploadList: false,
disabled: false,
multiple:true,
// beforeUpload: this.handleBeforeUpload,
};
/* 发票上传 */
let invoiceBody = {};
if (commonUtils.isNotEmptyArr(slaveSelectedData)) {
const slaveRow = slaveSelectedData[0];
invoiceBody = {
invTaxNum: slaveRow.sBillNo /* 发票号码 */,
invType: "8000" /* 增值税发票类型代码 */,
invSellerName: slaveRow.sSupplyName /* 发票销方名称 */,
statusQuery: 0 /* 查询条件 */,
relaBizNos: {
/* 业务单号集合 */
// "relaBizNo1": "",
// "relaBizNo2": "",
// "relaOaNo": "",
// "relaVoucherNo": ""
},
operatorId: userinfo.sUserNo /* 操作人账号 */,
operatorName: userinfo.sUserName /* 操作人名字 */,
InfoSysSource: "EBC" /* 信息系统来源 */,
beginDate: slaveRow.tCreateDate /* 查询起始时间 */,
endDate: slaveRow.tEndDate /* 查询结束时间 */,
// size:3, /* 查询行 */
// page:1, /* 查询页 */
// invOrder: "desc", /* 排序方式 */
companyCode: userinfo.sSubsidiaryId /* 公司代码 */,
};
}
const upInvoiceProps = {
action: `${commonConfig.server_host}open/api/tax/input/invlock`,
onChange: this.handleUploadInvoiceChange,
accept: "*/*",
customRequest: this.customRequest,
// 添加额外的参数
data: invoiceBody,
showUploadList: false,
beforeUpload: () => {},
};
/* 第三方接口拉取数据源 */
let btnGetApiDialogConfig = {};
if (commonUtils.isNotEmptyObject(masterConfig)) {
const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === "BtnGetApiDialog");
if (iIndex > -1) {
btnGetApiDialogConfig = this.props.masterConfig.gdsconfigformslave[iIndex];
/* 根据配置条件 */
if (bList && commonUtils.isNotEmptyObject(btnGetApiDialogConfig) && btnGetApiDialogConfig.sSqlCondition) {
/* 选中行 */
if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sSlaveId));
if (iIndex > -1) {
if (commonUtils.isNotEmptyObject(selectedRow)) {
conditonValues = this.props.getSqlCondition(btnGetApiDialogConfig, "slave", selectedRow);
}
}
}
}
}
}
const getApiDialogType = {
app: {
...this.props.app,
currentPane: {
name: "getApiDialog",
config: btnGetApiDialogConfig,
conditonValues,
title: filfileManageTitle,
route: "/eleintefaceDialog",
formId: btnGetApiDialogConfig && btnGetApiDialogConfig.sActiveId ? btnGetApiDialogConfig.sActiveId : "15864832090002447752315825731600",
key: `${sModelsId}15864832090002447752315825731600`,
sModelsType: "element/getApiDialog",
select: this.props.onSelect,
selectCancel: this.handleFilfileManageCancel.bind(this, "visibleApiDialog"),
},
},
config: btnGetApiDialogConfig,
// slaveData: getApiDialogData,
enabled: true /*this.props.enabled */,
dispatch: this.props.dispatch,
content: this.props.content,
id: new Date().getTime().toString(),
// onGetApiDialogData: (slaveFilterCondition = [], callback) => {
// const tempCondition = {};
// slaveFilterCondition.forEach(item => {
// const { bFilterName, bFilterValue } = item;
// tempCondition[bFilterName] = bFilterValue;
// });
// this.tempCondition = tempCondition;
// this.handleClick({ key: 'BtnGetApiDialog' });
// setTimeout(() => {
// callback && callback();
// }, 1000);
// }
};
let menuDataCopy = JSON.parse(JSON.stringify(menuData));
// let btnOutData = menuDataCopy.find(item => item.sName === 'BtnOut');
// if (commonUtils.isNotEmptyObject(btnOutData)) {
// btnOutData.child = [];
// for (let i = -1; i < 100; i++) {
// const slaveConfigName = i === -1 ? `slaveConfig` : `slave${i}Config`;
// const slaveConfig = this.props[slaveConfigName];
// if (slaveConfig && commonUtils.isNotEmptyObject(slaveConfig) && slaveConfig.bGrd) {
// const child = {
// child: [],
// iconName: 'menu-unfold',
// sControlName: `BtnOut.slave${i === -1 ? '' : i}`,
// sName: `BtnOut.slave${i === -1 ? '' : i}`,
// showName: slaveConfig.showName
// };
// btnOutData.child.push(child);
// }
// }
// if (btnOutData.child.length === 1) {
// // 如果只有一张表,还是用原来的配置
// menuDataCopy = JSON.parse(JSON.stringify(menuData));
// }
// }
// 如果复制到的child为空,则隐藏掉复制到按钮
let btnCopyToIndex = menuDataCopy.findIndex(item => item.sName === "BtnCopyTo");
if (btnCopyToIndex !== -1) {
const btnCopyTo = menuDataCopy[btnCopyToIndex];
if (commonUtils.isEmptyArr(btnCopyTo.child)) {
menuDataCopy.splice(btnCopyToIndex, 1);
}
}
const { tabModalConfig, tabModalRecord } = this.props;
const sActiveId = tabModalConfig?.sActiveId;
let sActiveKey = tabModalConfig?.sActiveKey;
let tabModalTitle = tabModalConfig?.showName ? tabModalConfig.showName : "数据展示";
const sFormId =
sActiveId === "1" ? (commonUtils.isEmpty(tabModalRecord?.sFormId) ? tabModalRecord?.sSrcFormId : tabModalRecord?.sFormId) : sActiveId;
if (commonUtils.isNotEmptyObject(sActiveKey) && sActiveKey.includes(".")) {
const index = sActiveKey.lastIndexOf(".");
sActiveKey = sActiveKey.substring(index + 1, sActiveKey.length);
}
const tabModalProps = {
app: {
...this.props.app,
currentPane: {
...this.props.app.currentPane,
formId: sFormId,
route: "/indexPage/commonList",
name: "CommonList",
sModelsType: "sales/autoView",
selectCancel: this.handleFilfileManageCancel.bind(this, "bTabModal"),
checkedId: tabModalRecord?.[sActiveKey],
},
},
bTabModal: bTabModal,
token: this.props.app.token,
dispatch: this.props.dispatch,
content: this.props.content,
id: new Date().getTime().toString(),
pageLoading: false,
};
if (this.props.customRender) return this.props.customRender({ ...this.props, menuDataCopy, getMenuProps: this.getMenuProps, handleClick: this.handleClick });
return (
<div className={styles.toolBar} onMouseEnter={this.handleMouseEnterTooBar}>
<Spin spinning={loading === undefined ? false : loading}>
<Menu
mode="horizontal"
onClick={throttle(this.handleClick, 1000)}
onKeyDown={this.handleToolBarKeyDown}
className={`${styles.toolMenu} ${this.props.className ? this.props.className : ""}`}
>
{menuDataCopy.map(item => {
const { child, iconName, showName, sIcon } = item;
const imageDom = this.getImageDom(sIcon) || <SvgIcon className="toolbarIcon" iconClass={iconName} />;
return child.length > 1 ? (
<SubMenu {...this.getMenuProps(item, "icon")}>
{child.map(eachChild => {
if (eachChild.sControlName === "BtnBsOperation.BtnUpCheck" || eachChild.sControlName === "BtnBsOperation.BtnDownCheck") {
return (
<SubMenu {...this.getMenuProps(eachChild, "title")}>
{eachChild.child.map(threeChild => {
if (
commonUtils.isNotEmptyObject(searchUpDownData) &&
commonUtils.isNotEmptyArr(searchUpDownData[threeChild.sControlName])
) {
return (
<MenuItemGroup {...this.getMenuProps(threeChild, "title")}>
{searchUpDownData[threeChild.sControlName].map(fourMenuItem => {
return (
<Menu.Item {...this.getMenuProps(fourMenuItem, "key")}>
<span>{fourMenuItem.showName}</span>
</Menu.Item>
);
})}
</MenuItemGroup>
);
} else {
return "";
}
})}
</SubMenu>
);
} else {
return (
<Menu.Item {...this.getMenuProps(eachChild, "key")}>
<span>{eachChild.showName}</span>
{eachChild.sControlName.indexOf("BtnPrint") > -1 ? (
<Checkbox onClick={this.radioClick.bind(this, eachChild)} style={{ float: "right", marginTop: "8px" }} />
) : (
""
)}
</Menu.Item>
);
}
})}
</SubMenu>
) : child.length === 1 ? (
<Menu.Item {...this.getMenuProps(child[0], "key")}>
{imageDom}
{item.sName === "BtnPrint" ? showName : child[0].showName}
</Menu.Item>
) : (
[""].map(() => {
const menuItemProps = this.getMenuProps(item, "key");
const { name } = menuItemProps;
const showNameNew = name || showName;
const myStyle = {};
if (item?.sControlName === "BtnLook") {
/* 查看全部 */
if (!this.props.bSecondMainMaterials) {
myStyle.color = "#1890FF";
} else {
myStyle.color = "#fff";
}
} else if (item?.sControlName === "BtnLookSwitch") {
/* 查看二级 */
if (this.props.bSecondMainMaterials) {
myStyle.color = "#1890FF";
} else {
myStyle.color = "#fff";
}
}
return (
<Menu.Item {...menuItemProps}>
{commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.indexOf("BtnUpPbOrder") > -1 ? (
<div className={styles.toolBarUpload}>
<Upload {...upPbOrderProps}>
<a {...this.getDisabledProps("BtnUpPbOrder")}>
<UploadOutlined /> {showNameNew}
</a>
</Upload>
</div>
) : commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.indexOf("BtnUploadApi") > -1 ? (
<div className={styles.toolBarUpload}>
<Upload {...upInvoiceProps}>
<a style={{ color: "#ffffff" }}>
<UploadOutlined fill="#fff" /> {showNameNew}
</a>
</Upload>
</div>
) : commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.indexOf("BtnUploadPic") > -1 ? (
<div>
<Upload {...uploadPicProps}>
{imageDom}
<span style={{ color: this.props.enabled ? "#fff" : "#a2a2a2" }}>{showNameNew}</span>
</Upload>
</div>
): commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.indexOf("BtnImportFile") > -1 ? (
<div>
<Upload {...uploadFilesProps}>
<a className={styles.uploadlink} style={{ color: "#ffffff"}}>
<UploadOutlined fill="#fff"/> {showNameNew}
</a>
</Upload>
</div>
) : commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.indexOf("BtnDlPbOrder") > -1 ? (
<div className={styles.toolBarUpload}>
<a {...this.getDisabledProps("BtnDlPbOrder")} onClick={() => this.handleBtnDownload()}>
{" "}
<DownloadOutlined />
{showNameNew}
</a>
</div>
) : item.sControlName === "BtnUploadicon" ? (
<div>
<Upload {...uploadIconProps}>
{imageDom}
<span style={{ color: this.props.enabled ? "#fff" : "#a2a2a2" }}>{showNameNew}</span>
</Upload>
</div>
) : (
<div style={myStyle}>
{imageDom}
{showNameNew}
</div>
)}
</Menu.Item>
);
})
);
})}
</Menu>
<AffixMenu {...this.props} className={styles.affixMenu} />
</Spin>
<StatementInfo {...this.props} />
<BatchPriceUpdate {...this.props} />
<BatchNPriceUpdate {...this.props} />
<BatchWorkListPriceUpdate {...this.props} />
{commonUtils.isNotEmptyObject(btnUploadConfig) && (pane?.notCurrentPane ? false : visibleFilfile) ? (
<AntdDraggableModal
width={1300}
title={filfileManageTitle}
visible={pane?.notCurrentPane ? false : visibleFilfile}
onCancel={this.handleFilfileManageCancel.bind(this, "visibleFilfile")}
footer={null}
>
<FilfileManageInfo {...filfilemanageType} />
</AntdDraggableModal>
) : (
""
)}
{commonUtils.isNotEmptyObject(btnUploadOtherConfig) && (pane?.notCurrentPane ? false : visibleOtherFilfile) ? (
<AntdDraggableModal
width={1300}
title={filfileManageTitle}
visible={pane?.notCurrentPane ? false : visibleOtherFilfile}
onCancel={this.handleFilfileManageCancel.bind(this, "visibleOtherFilfile")}
footer={null}
>
<FilfileManageInfo {...filfilemanageOtherType} />
</AntdDraggableModal>
) : (
""
)}
{commonUtils.isNotEmptyObject(btnDialogConfig) && (pane?.notCurrentPane ? false : visibleInterfaceDialog) ? (
<AntdDraggableModal
width={1300}
title={intefaceDialogType?.app?.currentPane?.config?.sActiveName || "获取接口数据"}
visible={pane?.notCurrentPane ? false : visibleInterfaceDialog}
onCancel={this.handleDialogCancel.bind(this, "visibleInterfaceDialog")}
footer={null}
>
<CommonListSelect {...intefaceDialogType} />
</AntdDraggableModal>
) : (
""
)}
{commonUtils.isNotEmptyObject(btnGetApiDialogConfig) && (pane?.notCurrentPane ? false : visibleApiDialog) ? (
<AntdDraggableModal
width={1300}
title={getApiDialogType?.app?.currentPane?.config?.sActiveName || "查询发票"}
visible={pane?.notCurrentPane ? false : visibleApiDialog}
onCancel={this.handleFilfileManageCancel.bind(this, "visibleApiDialog")}
footer={null}
>
<CommonListSelect {...getApiDialogType} />
</AntdDraggableModal>
) : (
""
)}
{pane?.notCurrentPane ? (
false
) : copyFromChooseVisible ? (
<AntdDraggableModal
width={1200}
title={copyFromTitle}
visible={copyFromChooseVisible}
onCancel={this.handleFilfileManageCancel.bind(this, "copyFromChooseVisible")}
footer={null}
wrapClassName="worker-order-pack-modal"
>
<CommonListSelect {...copyFromType} />
</AntdDraggableModal>
) : (
""
)}
{visibleGetGoods ? (
<AntdDraggableModal title={getGoodsTitle} visible={visibleGetGoods} onOk={this.handleOk} onCancel={this.handleCancel}>
<Input placeholder={getGoodsPlaceholder} value={this.state.inputChange} onChange={this.handleInputChange} />
</AntdDraggableModal>
) : (
""
)}
{bTabModal ? (
<AntdDraggableModal
width="95%"
title={tabModalTitle}
visible={bTabModal}
onCancel={this.handleFilfileManageCancel.bind(this, "bTabModal")}
onOk={this.handleFilfileManageCancel.bind(this, "bTabModal")}
bodyStyle={{
height: "70vh",
overflowY: "auto",
}}
style={{
top: "10vh",
}}
>
<div style={{}}>
查看
{/*<CommonList {...tabModalProps} />*/}
</div>
</AntdDraggableModal>
) : (
""
)}
{!commonUtils.isEmpty(this.props.routing) ? (
""
) : (
<SlaveMemo
fromToorBar="true"
onGetMemo={this.handleGetMemo}
onGetMemoCancel={this.handleGetMemoCancel}
onBtnEent={this.handleBtnEent}
{...this.props}
/>
)}
{!commonUtils.isEmpty(this.props.routing) ? (
""
) : (
<SlaveMemo1
fromToorBar="true"
onGetMemo={this.handleGetMemo1}
onGetMemoCancel={this.handleGetMemoCancel1}
onBtnEent={this.handleBtnEent}
{...this.props}
/>
)}
{!commonUtils.isEmpty(this.props.routing) ? "" : <EditorModal fromToorBar="true" {...this.props} />}
<FileImposition {...this.props} {...fileImpositionData} />
{makeUpPDFData?.pdfMakeUpVisible && <MakeUpPDF {...makeUpPDFData} />}
{BtnBoxData?.boxVisible && <BoxDesignCompontent {...BtnBoxData} />}
{
<PersonCenterAddFace
{...this.props}
addFaceVisible={addFaceVisible}
onCancel={this.handleFilfileManageCancel.bind(this, "addFaceVisible")}
handelCance={this.handleFilfileManageCancel.bind(this, "addFaceVisible")}
onSaveFaceSuccess={this.onSaveFaceSuccess}
app={app}
formItemLayout={this.formItemLayout}
tailFormItemLayout={this.tailFormItemLayout}
/>
}
</div>
);
}
}
export default ToolBarComponent;