xwt
2025-09-30 e9330bc1e2449b5763097dff4cb896746fda8d4d
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
<template>
    <view class="inspection-sheet">
            <!-- 头部信息 -->
            <view class="sheet-header">
                <h1>来料检验单</h1>
                <view class="inspection-number">检验单号:{{formData.releaseNo}}</view>
                <!--实验室送检 -->
                <view style="text-align: right;" class="action-buttons">
                    <a class="sysLike" v-if="this.current" @click="toSysSubmitFrom(formData.releaseNo)">实验室送检</a>
                </view>
            </view>
 
        <!-- 基本信息区 -->
        <view class="basic-info">
            <view class="info-row">
                <span class="info-label">到货单号:</span>
                <span class="info-value">{{formData.lotNo}}</span>
                <span class="info-label">创建人:</span>
                <span class="info-value">{{formData.createBy}}</span>
            </view>
            <view class="info-row">
                <span class="info-label">创建时间:</span>
                <span class="info-value">{{formData.createDate}}</span>
                <span class="info-label">&nbsp;负责人:</span>
                <span class="info-value">{{formData.userName}}</span>
            </view>
        </view>
 
        <!-- 物料信息区 -->
        <view class="material-info">
            <view class="info-block">
                <view class="info-label">物料编码:</view>
                <view class="info-value">{{formData.itemNo}}</view>
 
            </view>
            <view class="info-block">
                <view class="info-label">物料名称:</view>
                <view class="info-value">{{formData.itemName}}</view>
            </view>
            <view class="info-block">
                <view class="info-label">规格型号:</view>
                <view class="info-value">{{formData.itemModel}}</view>
            </view>
 
            <view class="info-block">
 
                <view class="info-label" v-if="formData.extendNo1!=null">技改状态:</view>
                <view class="info-value" v-if="formData.extendNo1!=null">{{formData.extendNo1}}</view>
 
 
                <view class="info-label">数量:</view>
                <view class="info-value highlight">{{formData.fcovertQty}}</view>
 
            </view>
            <view class="info-block" v-if="formData.fngDesc!=null">
                <view class="info-label">不良描述:</view>
                <view class="info-value">{{formData.fngDesc}}</view>
            </view>
        </view>
        <view class="dropdown-row">
            <view class="info-label">不良原因:</view>
            <picker v-if="current" :value="badreasonIndex" :range="badreasonOptions" @change="onBadreasonChange">
                <view class="picker-text" :class="{ 'selected': badreason }">{{ badreason || '' }}</view>
            </picker>
            <view v-else class="info-value">{{ badreason }}</view>
        </view>
        <view class="dropdown-row">
            <view class="info-label">所属车间:</view>
            <picker v-if="current" :value="workshopIndex" :range="workshopOptions" @change="onWorkshopChange">
                <view class="picker-text" :class="{ 'selected': WORKSHOP }">{{ WORKSHOP || '' }}</view>
            </picker>
            <view v-else class="info-value">{{ WORKSHOP }}</view>
        </view>
        <view class="dropdown-row">
            <view class="info-label">评审状态:</view>
            <picker v-if="current" :value="pstypeIndex" :range="pstypeOptions" @change="onPstypeChange">
                <view class="picker-text" :class="{ 'selected': PSTYPE }">{{ PSTYPE || '' }}</view>
            </picker>
            <view v-else class="info-value">{{ PSTYPE }}</view>
        </view>
                    <view class="info-block" style="margin-top: 10px;">   
            <view class="info-label">备注:</view>
            <input type="text" id="lotNo1" v-model="formData.lotNo1" 
                               placeholder="请输入备注信息" 
                               style="color: red; font-weight: bold; background-color: #fff !important; -webkit-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important; pointer-events: auto !important; opacity: 1 !important; z-index: 1 !important;"/> 
        </view>
        <view class="info-block" style="margin-top: 10px;">   
            <view class="info-label">破坏实验数量:</view>
            <view class="info-value highlight">{{formData.PHSY || formData.phsy || ''}}</view>
        </view>
 
        <!-- 表单上方操作按钮区 -->
        <view class="top-action-buttons">
            <button class="action-btn" @click="getInspectionItems" v-if="this.current">获取检验项目</button>
            <button class="action-btn" @click="openGlobalBlockHoleDialog" v-if="this.current">堵穴设置</button>
            <button class="action-btn" @click="handleEmergencyRelease" v-if="this.current">紧急放行</button>
            <button class="action-btn" @click="handleWithdraw" v-if="this.current">撤回</button>
        </view>
 
        <!-- 检验项目表格 -->
        <view class="inspection-table">
            <table>
                <thead>
                    <tr>
                        <th width="20%" style="text-align: center;">检验项目</th>
                        <th width="50%" style="text-align: center;">检验描述</th>
                        <th width="15%" style="text-align: center;">记录(点击)</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(item, index) in tableData" :key="index">
                        <td>{{ item.fcheckItem }}</td>
                        <td>
                            <view v-if="item.fcheckResu=='合格'" class="watermark approved">
                                {{ getStatusText(item.fcheckResu) }}
                            </view>
                            <view v-if="item.fcheckResu=='不合格'" class="watermark rejected">
                                {{ getStatusText(item.fcheckResu) }}
                            </view>
                            <view v-if="item.fcheckResu==null" class="watermark pending">
                                {{ getStatusText(item.fcheckResu) }}
                            </view>
                            <view class="description-text">{{ item.fcheckItemDesc }}</view>
                        </td>
                        <td>
                            <button v-if="item.current" class="record-btn" @click="fillRecord(item,index)">填写</button>
                            <button v-if="!item.current" class="record-btn" @click="fillRecord(item,index)">查看</button>
                        </td>
                        
                    </tr>
                </tbody>
            </table>
        </view>
 
        <!-- 表单下方操作按钮区 -->
        <view class="bottom-action-buttons">
            <button class="action-btn small" @click="addDestruction" v-if="this.current">破坏实验</button>
            <button class="action-btn small" @click="uploadImages">上传/查看图片</button>
            <button class="action-btn small" @click="fetchDrawingNumber">调取PLM图纸</button>
            <button class="action-btn small" @click="viewAttachmentInfo">查看附件信息</button>
            <button class="action-btn small" @click="addDefectDescription" v-if="this.current">添加不良描述</button>
            <button class="action-btn small primary" @click="submitInspection" v-if="this.current">检验提交</button>
        </view>
        <view v-if="remarksPopup" class="overlay">
            <view class="popup">
                <h3>修改不合格描述</h3>
                <form>
                    <view class="form-group">
                        <label class="form-label">不合格描述:</label>
                        <input class="info-input" type="text" v-model="remarks" placeholder="请输入不合格描述" />
                    </view>
 
                </form>
                <button class="updateBut" @click="editRemarks">修改</button>
                <button @click="remarksPopup = !remarksPopup">取消</button>
            </view>
        </view>
        
        <view v-if="destructionPopup" class="overlay">
            <view class="popup destruction-popup">
                <h3>破坏实验</h3>
                
                <!-- 第一步:扫描二维码(无记录时显示) -->
                <view v-if="!hasExistingRecord && !scannedMaterialInfo" class="scan-step">
                    <view class="scan-icon">📷</view>
                    <view class="scan-title">扫描物料二维码</view>
                    <view class="scan-description">请扫描要用于破坏实验的物料条码</view>
                    <view class="scan-actions">
                        <button class="scan-btn" @click="scanQRCode">开始扫描</button>
                        <button class="destruction-btn cancel-btn" @click="closeDestructionPopup">返回</button>
                    </view>
                </view>
                
                <!-- 第二步:显示扫描结果和输入数量(无记录时扫描后显示) -->
                <view v-if="!hasExistingRecord && scannedMaterialInfo" class="result-step">
                    <view class="scan-success-icon">✅</view>
                    <view class="scan-success-title">扫描成功</view>
                    
                    <!-- 显示扫描到的物料信息 -->
                    <view class="material-info-display">
                        <view class="material-detail">
                            <view class="detail-row">
                                <span class="detail-label">扫描条码:</span>
                                <span class="detail-value barcode-value">{{ scannedMaterialInfo.itemBarcode || scannedMaterialInfo.itemNo }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">物料编码:</span>
                                <span class="detail-value">{{ scannedMaterialInfo.itemNo }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">物料名称:</span>
                                <span class="detail-value">{{ scannedMaterialInfo.itemName }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">规格型号:</span>
                                <span class="detail-value">{{ scannedMaterialInfo.itemModel }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">到货单号:</span>
                                <span class="detail-value">{{ scannedMaterialInfo.billNo }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">可用数量:</span>
                                <span class="detail-value">{{ scannedMaterialInfo.oldQty }}</span>
                            </view>
                        </view>
                    </view>
                    
                    <!-- 重新设计的输入区域 -->
                    <view class="input-section">
                        <view class="input-title">破坏实验数量</view>
                        <view class="input-container">
                            <view class="input-box" @click="focusInput">
                                <text v-if="destructionQuantity" class="input-value">{{ destructionQuantity }}</text>
                                <text v-else class="input-placeholder">点击输入数量</text>
                            </view>
                        </view>
                        <view v-if="!isInteger && destructionQuantity" class="error-tip">请输入有效的正整数</view>
                    </view>
                    
                    <!-- 操作按钮 -->
                    <view class="destruction-actions">
                        <!-- 无记录时显示:确认、修改、删除、返回 -->
                        <template v-if="!hasExistingRecord">
                            <button class="destruction-btn confirm-btn" @click="confirmDestruction" :disabled="!isInteger || !destructionQuantity">确认</button>
                            <button class="destruction-btn modify-btn" @click="modifyDestruction">修改</button>
                            <button class="destruction-btn delete-btn" @click="deleteDestruction">删除</button>
                            <button class="destruction-btn cancel-btn" @click="resetDestruction">返回</button>
                        </template>
                        <!-- 有记录时显示:修改、删除、返回 -->
                        <template v-else>
                            <button class="destruction-btn modify-btn" @click="modifyDestruction">修改</button>
                            <button class="destruction-btn delete-btn" @click="deleteDestruction">删除</button>
                            <button class="destruction-btn cancel-btn" @click="resetDestruction">返回</button>
                        </template>
                    </view>
                </view>
                
                <!-- 第三步:显示已有记录信息(有记录时显示,复用扫描结果界面) -->
                <view v-if="hasExistingRecord" class="result-step">
                    <view class="scan-success-icon">✅</view>
                    <view class="scan-success-title">扫描成功</view>
                    
                    <!-- 显示扫描到的物料信息 -->
                    <view class="material-info-display">
                        <view class="material-detail">
                            <view class="detail-row">
                                <span class="detail-label">扫描条码:</span>
                                <span class="detail-value barcode-value">{{ (scannedMaterialInfo && scannedMaterialInfo.itemBarcode) || (scannedMaterialInfo && scannedMaterialInfo.itemNo) || '' }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">物料编码:</span>
                                <span class="detail-value">{{ (scannedMaterialInfo && scannedMaterialInfo.itemNo) || '' }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">物料名称:</span>
                                <span class="detail-value">{{ (scannedMaterialInfo && scannedMaterialInfo.itemName) || '' }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">规格型号:</span>
                                <span class="detail-value">{{ (scannedMaterialInfo && scannedMaterialInfo.itemModel) || '' }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">到货单号:</span>
                                <span class="detail-value">{{ (scannedMaterialInfo && scannedMaterialInfo.billNo) || formData.lotNo }}</span>
                            </view>
                            <view class="detail-row">
                                <span class="detail-label">可用数量:</span>
                                <span class="detail-value">{{ (scannedMaterialInfo && scannedMaterialInfo.oldQty) || '0' }}</span>
                            </view>
                        </view>
                    </view>
                    
                    <!-- 重新设计的输入区域 -->
                    <view class="input-section">
                        <view class="input-title">破坏实验数量</view>
                        <view class="input-container">
                            <view class="input-box" @click="focusInput">
                                <text v-if="destructionQuantity" class="input-value">{{ destructionQuantity }}</text>
                                <text v-else class="input-placeholder">点击输入数量</text>
                            </view>
                        </view>
                        <view v-if="!isInteger && destructionQuantity" class="error-tip">请输入有效的正整数</view>
                    </view>
                    
                    <!-- 操作按钮 -->
                    <view class="destruction-actions">
                        <button class="destruction-btn modify-btn" @click="modifyDestruction">修改</button>
                        <button class="destruction-btn delete-btn" @click="deleteDestruction">删除</button>
                        <button class="destruction-btn cancel-btn" @click="resetDestruction">返回</button>
                    </view>
                </view>
            </view>
        </view>
        
        <!-- 全局堵穴设置对话框 -->
        <view v-if="globalBlockHolePopup" class="overlay">
            <view class="popup global-block-hole-popup">
                <h3>全局堵穴设置</h3>
                <view class="block-hole-content">
                    <view class="hole-info">
                        <view class="info-label">检验单号:{{ formData.releaseNo }}</view>
                        <view class="info-label">将应用于所有有开穴数的检验项目</view>
                    </view>
                    <view class="input-section">
                        <view class="input-label">堵穴数量:</view>
                        <input class="info-input" type="text" v-model="globalBlockHoleInput" 
                            placeholder="请输入1,2,3" @input="onGlobalBlockHoleInput" />
                        <view v-if="globalBlockHoleError" class="error-message">{{ globalBlockHoleError }}</view>
                    </view>
                    <view class="block-hole-actions">
                        <button class="block-hole-btn confirm" @click="confirmGlobalBlockHole" 
                            :disabled="!isGlobalBlockHoleValid">确认设置</button>
                        <button class="block-hole-btn cancel" @click="closeGlobalBlockHoleDialog">取消</button>
                    </view>
                </view>
            </view>
        </view>
        
        <view class="barcode">
            <u-modal :show="itemShow" title="物料明细" @confirm="drawingConfirm" @cancel="drawingCancel"
                showCancelButton :z-index="1000">
                <uni-table border stripe emptyText="暂无更多数据" style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;">
                    <uni-tr>
                        <uni-th align="center">料号</uni-th>
                        <uni-th align="center" width="90">名称</uni-th>
                        <uni-th align="center" width="90">规格型号</uni-th>
                        <uni-th align="center" width="150">调取PLM图纸</uni-th>
                    </uni-tr>
                    <uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;">
                        <uni-td align="center">{{item.itemNo}}</uni-td>
                        <uni-td align="center" style="font-size:25px;">
                            <div >{{item.itemName}}</div>
                        </uni-td>
                        <uni-td align="center" style="font-size:25px;">
                            <div>{{item.itemModel}}</div>
                        </uni-td>
                        <uni-td align="center" class="click-wd">
                            <div @click="fetchDrawingNumber">调取图纸</div>
                        </uni-td>
                    </uni-tr>
                </uni-table>
            </u-modal>
        </view>
        
        <view class="barcode">
            <u-modal :show="drawingShow" title="图纸明细" @confirm="drawingConfirm" @cancel="drawingCancel"
                showCancelButton :z-index="1000">
                <uni-table border stripe emptyText="暂无更多数据" style="margin-left: 5px;margin-right: 5px;height: 400px;max-height: 60vh;overflow-y: auto;">
                    <uni-tr>
                        <uni-th align="center">相关文档</uni-th>
                        <uni-th align="center" width="90">有无关联PDF文件</uni-th>
                        <uni-th align="center" width="90">能否打开文件</uni-th>
                        <uni-th align="center" width="150">操作(点击)</uni-th>
                    </uni-tr>
                    <uni-tr v-for="(item,index) in (drawing || [])" style="height: 100px;">
                        <uni-td align="center">{{item.fName}}</uni-td>
                        <uni-td align="center" style="font-size:25px;">
                            <div v-if="item.fRelevantObject==' '" style="color: #E47470;">×</div>
                            <div style="color: #90BA87;" v-else>√</div>
                        </uni-td>
                        <uni-td align="center" style="font-size:25px;">
                            <div v-if="item.isSupported || item.fRelevantObject!=' '" style="color: #90BA87;">√</div>
                            <div style="color: #E47470;" v-else>×</div>
                        </uni-td>
                        <uni-td align="center" class="click-wd">
                            <div @click="openDrawings(item)">打开文档</div>
                        </uni-td>
                    </uni-tr>
                </uni-table>
            </u-modal>
        </view>
        <!-- 附件详情弹窗 -->
        <view v-if="showAttachmentDetail" class="overlay">
            <view class="popup attachment-detail-popup">
                <h3 class="attachment-popup-title">附件详情</h3>
                <div class="attachment-popup-divider"></div>
                <div v-if="selectedAttachment" class="attachment-detail-content">
                    <div class="attachment-detail-row"><span class="attachment-label">ID:</span><span>{{ Math.trunc(selectedAttachment.id) }}</span></div>
                    <div class="attachment-detail-row"><span class="attachment-label">附件名:</span><span>{{ selectedAttachment.fattach }}</span></div>
                    <div class="attachment-detail-row"><span class="attachment-label">类型:</span><span>{{ selectedAttachment.ftype }}</span></div>
                    <div class="attachment-detail-row"><span class="attachment-label">版本:</span><span>{{ selectedAttachment.fversion }}</span></div>
                    <div class="attachment-detail-row"><span class="attachment-label">受控日期:</span><span>{{ selectedAttachment.fdate }}</span></div>
                    <div class="attachment-detail-row"><span class="attachment-label">上传人:</span><span>{{ selectedAttachment.createBy }}</span></div>
                    <div class="attachment-detail-row"><span class="attachment-label">上传时间:</span><span>{{ selectedAttachment.createDate }}</span></div>
                    <div class="attachment-actions-detail">
                        <button class="attachment-action-btn preview-btn" 
                            @click="previewFtpFile(selectedAttachment)" 
                            v-if="isPreviewable(selectedAttachment.fattach)">
                            🔍 在线预览
                        </button>
                        <button class="attachment-action-btn download-btn" 
                            @click="downloadAttachment(selectedAttachment)">
                            📥 下载文件
                        </button>
                    </div>
                </div>
                <div v-else class="attachment-detail-empty">暂无附件信息</div>
                <button class="attachment-popup-close" @click="closeAttachmentDetail">返回附件列表</button>
            </view>
        </view>
        <!-- 附件列表弹窗 -->
        <view v-if="showAttachmentPopup" class="overlay">
            <view class="popup" style="width: 60vw; max-width: 500px;">
                <h3>附件列表</h3>
                <div v-if="attachmentsLoading">加载中...</div>
                <div v-else-if="attachments.length === 0">暂无附件</div>
                <ul class="attachment-list" v-else>
                    <li v-for="item in attachments" :key="item.id">
                        <div class="attachment-info">
                            <span class="attachment-name" @click="showAttachmentDetailDialog(item)">
                                {{ item.fattach }}
                            </span>
                            <div class="attachment-meta">
                                <span class="attachment-type">{{ item.ftype || '未知类型' }}</span>
                            </div>
                        </div>
                        <div class="attachment-actions">
                            <button class="secondary-btn" @click="showAttachmentDetailDialog(item)">详情</button>
                            <button class="secondary-btn preview-btn" @click="previewFtpFile(item)" 
                                v-if="isPreviewable(item.fattach)">预览</button>
                            <button class="secondary-btn" @click="downloadAttachment(item)">下载</button>
                        </div>
                    </li>
                </ul>
                <button class="attachment-popup-close" @click="closeAttachmentPopup">关闭</button>
            </view>
        </view>
        
        <!-- 文件预览弹窗 -->
        <view v-if="showFilePreviewPopup" class="overlay">
            <view class="popup file-preview-popup">
                <h3 class="file-preview-title">{{ previewTitle }}</h3>
                <div class="file-preview-divider"></div>
                <div class="file-preview-content">
                    <!-- 文本内容预览 -->
                    <pre v-if="previewType === 'text'">{{ previewContent }}</pre>
                    
                    <!-- 图片内容预览 -->
                    <view v-else-if="previewType === 'image'" class="image-preview-container">
                        <image 
                            :src="previewContent" 
                            mode="aspectFit" 
                            class="preview-image-clickable"
                            @click="previewImageInPopup"
                            style="width: 100%; max-height: 400px; cursor: pointer;"
                        />
                        <div class="image-zoom-hint">点击图片可放大查看</div>
                    </view>
                    
                    <!-- Excel 等 Office 文件提示 -->
                    <view v-else-if="previewType === 'excel'" class="unsupported-preview">
                        <view class="unsupported-icon">📊</view>
                        <view class="unsupported-text">Excel 文件暂不支持在线预览</view>
                        <view class="unsupported-hint">请点击下载按钮获取完整文件</view>
                    </view>
                    
                    <!-- 不支持的文件类型 -->
                    <view v-else class="unsupported-preview">
                        <view class="unsupported-icon">📄</view>
                        <view class="unsupported-text">此文件格式暂不支持预览</view>
                        <view class="unsupported-hint">请点击下载按钮获取完整文件</view>
                    </view>
                </div>
                <div class="file-preview-actions">
                    <button v-if="previewType !== 'text'" class="file-preview-btn download-btn" @click="downloadPreviewFile">📥 下载文件</button>
                    <button class="file-preview-btn close-btn" @click="closeFilePreview">关闭</button>
                </div>
            </view>
        </view>
    </view>
    
</template>
 
<script>
    export default {
        data() {
            return {
                formData: {
                    id: "",
                    releaseNo: "",
                    createBy: "",
                    createDate: "",
                    lotNo: "",
                    itemNo: "",
                    billNo: "",
                    fcovertQty: "",
                    detailMem: "",
                    taskNo: "",
                    fcheckResu: "",
                    boardModel: "",
                    planQty: "",
                    mocode: "",
                    boardStyle: "",
                    itemId: "",
                    emergencyStatus: false,
                    lotNo1: '', 
                    emergency:'',
                    permissionModalVisible: false,
                    permissionAccount: '',
                    hasEmergencyPermission: false,
                    showPopup: false,
                    PHSY:'',
                    EMERGENCY: '0',
                    
                },
                tableData: [],
                remarksPopup: false,
                meomPopup: false,
                current: true,
                drawing: [],
                drawingShow: false,
                itemShow: false,
                badreason: '',
                PSTYPE: '',
                WORKSHOP: '',
                REMARK: '',
                // picker 选项和索引
                badreasonOptions: ['', '外观不良', '尺寸不良', '包装不良', '性能不良', '装配不良', '安规不良'],
                badreasonIndex: 0,
                workshopOptions: ['', '生产一部', '生产二部', '注塑车间', '其他'],
                workshopIndex: 0,
                pstypeOptions: ['', '特采/让步使用', '挑选/返工使用', '退货', '待判'],
                pstypeIndex: 0,
                checkState: false,
                writeStatu: true,
                fileName:'',
                originalRemarks: '',
                hasEmergencyPermission: false,
                destructionPopup: false,
                PHSY: '',
                isInteger: true,
                scannedMaterialInfo: null, // 扫描到的物料信息
                destructionQuantity: '', // 破坏实验数量输入
                inputFocus: false, // 输入框焦点状态
                hasExistingRecord: false, // 是否有已存在的破坏实验记录
                attachments: [],
                showAttachmentPopup: false,
                attachmentsLoading: false,
                selectedAttachment: null,
                showAttachmentDetail: false,
                showFilePreviewPopup: false,
                previewContent: '',
                previewTitle: '',
                previewItemNo: '',
                previewType: '', // 'text', 'image', 'excel', 'unsupported'
                
                // 全局堵穴相关数据
                globalBlockHolePopup: false,
                globalBlockHoleInput: '',
                globalBlockHoleError: '',
                isGlobalBlockHoleValid: false,
                
            }
        },
        computed: {
            isUnmaintainedAndNotEmergency() {
                // 判断表单是否未维护且不是紧急放行
                // 未维护的条件:tableData为空或所有检验项目都未完成
                const isUnmaintained = this.tableData.length === 0 || 
                    this.tableData.every(item => item.fcheckResu === null || item.fcheckResu === '');
                
                // 不是紧急放行的条件:emergencyStatus为false
                const isNotEmergency = !this.formData.emergencyStatus;
                
                return isUnmaintained && isNotEmergency;
            }
        },
        onLoad(options) {
            //options中包含了url附带的参数
            let params = options;
            
            
                
            if (params["id"]) {
                this.formData.id = params["id"];
                this.formData.releaseNo = params["releaseNo"];
                this.formData.lotNo = params["lotNo"];
                this.msgId = params["msgId"];
                this.emergency = params["emergency"]
                this.meom = params["meom"]
 
                if (params["current"] === 'A') {
                    this.current = true;
                } else if (params["current"] === 'B') {
                    this.current = false;
                }
 
                if (this.msgId > 0) {
                    this.msgRead();
                }
 
            } else {
                //初始化检验单号
                this.$post({
                    url: "/LLJ/getMaxReleaseNo"
                }).then(res => {
                    this.formData.releaseNo = res.data.tbBillList;
                    this.formData.createBy = this.$loginInfo.account;
                    this.formData.createDate = this.$getDate("yyyy-mm-dd");
                });
 
            }
             if (this.$loginInfo.account === 'PL017') {this.hasEmergencyPermission = true;}
 
             // 测试附件服务器连接
             
 
 
        },
        methods: {
            getStatusText(status) {
                const statusMap = {
                    approved: '合格',
                    rejected: '不合格',
                    pending: '待确认'
                }
                if (status == null) {
                    return statusMap['pending'] || ''
                } else if (status == '合格') {
                    return statusMap['approved'] || ''
                } else {
                    return statusMap['rejected'] || ''
                }
 
            },
            getInspectionItems() {
                // 获取检验项目的逻辑
                this.$post({
                    url: "/LLJ/setJYItem",
                    data: {
                        itemNo: this.formData.itemId,
                        quantity: this.formData.fcovertQty,
                        releaseNo: this.formData.releaseNo,
                        PHSY: this.formData.PHSY
                    }
                }).then(res => {
                    if (res.status == 0) {
                        uni.showToast({
                            title: res.message.toString(),
                            //将值设置为 success 或者直接不用写icon这个参数
                            icon: 'success',
                            //显示持续时间为 2秒
                            duration: 2000
                        })
                        // 如果有页面跳转,需要用定时器延迟
                        setTimeout(() => {
                            this.init();
                        }, 2000);
 
                    } else {
                        uni.showToast({
                            title: res.message.toString(),
                            //将值设置为 success 或者直接不用写icon这个参数
                            icon: 'error',
                            //显示持续时间为 2秒
                            duration: 2000
                        })
                    }
                });
            },
            
            fillRecord(item, index) {
                // 填写记录的逻辑
                uni.navigateTo({
                    url: 'detail?mainId=' + item.id + '&formID=' + this.formData.id + '&releaseNo=' + this.formData
                        .releaseNo + '&index=' + index + '&current=' + this.current
                });
            },
            uploadImages() {
                // 上传/查看图片的逻辑
                uni.navigateTo({
                    url: 'ImageItem?id=' + this.formData.id
                });
            },
            addDefectDescription() {
                // 添加不良描述的逻辑
                this.remarksPopup = !this.remarksPopup;
                this.remarks = this.formData.remarks || this.remarks || '';
                console.log('打开弹窗时的remarks值:', this.remarks);
            },
            
            // picker 事件处理方法
            onBadreasonChange(e) {
                const index = e.detail.value;
                this.badreasonIndex = index;
                this.badreason = this.badreasonOptions[index];
                this.saveRemarksGid('badreason');
            },
            onWorkshopChange(e) {
                const index = e.detail.value;
                this.workshopIndex = index;
                this.WORKSHOP = this.workshopOptions[index];
                this.saveRemarksGid('WORKSHOP');
            },
            onPstypeChange(e) {
                const index = e.detail.value;
                this.pstypeIndex = index;
                this.PSTYPE = this.pstypeOptions[index];
                this.saveRemarksGid('PSTYPE');
            },
            saveRemarksGid(fieldName) {
              // 直接保存到数据库
              const requestData = {
                  gid: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  BLYY: this.badreason || '',
                  SSCJ: this.WORKSHOP || '',
                  PSZT: this.PSTYPE || ''
              };
              console.log('发送的数据:', requestData);
              console.log('badreason:', this.badreason);
              console.log('WORKSHOP:', this.WORKSHOP);
              console.log('PSTYPE:', this.PSTYPE);
              console.log('选择的字段:', fieldName);
              this.$post({
                  url: "/LLJ/saveDropdownFields",
                  data: requestData
              }).then(res => {
                  if (res && res.data && res.data.data && res.data.data.tbBillList && res.data.data.tbBillList.length > 0) {
                      // 延迟重新加载数据,确保数据库更新完成
                      setTimeout(() => {
                          this.init();
                      }, 500);
                  }
              }).catch(err => {
                  console.error('保存失败:', err);
              });
            },
            submitInspection() {
                
                // 重置验证状态
                this.writeStatu = true;
                
                // if (this.PSTYPE == '') {
                //     this.writeStatu = false
                // }
                // if (this.badreason == '') {
                //     this.writeStatu = false
                // }
                // 移除对未定义变量DEPARTMENT的检查
                // if (this.DEPARTMENT == '') {
                //     this.writeStatu = false
                // }
 
                console.log(this.tableData)
                this.checkState = false;
                this.tableData.forEach((item) => {
                    if (item.fcheckResu == "不合格") {
                        this.checkState = true;
                    }
                })
                if (this.checkState) {
 
                    if (this.formData.fngDesc == '') {
                        uni.showToast({
                            title: '未填写不良描述',
                            icon: 'none'
                        });
                    } else {
                        // 检验提交的逻辑
                        this.$post({
                            url: "/LLJ/IqcQaSubmit",
                            data: {
                                userNo: this.$loginInfo.account,
                                releaseNo: this.formData.releaseNo
                            }
                        }).then(res => {
                            if (res.status == 0) {
 
                                // 统一推送给HMCS,不管哪个账号
                                this.QcIssueResultDetailes = {
                                    fbatchQty: this.formData.fcovertQty,
                                    itemName: this.formData.itemName,
                                    itemNo: this.formData.itemNo,
                                    suppName: this.formData.suppName,
                                    appicationReason: this.formData.fngDesc,
                                    badReason: this.badreason,
                                    remark: this.remarks || '',
                                    workShop: this.WORKSHOP,
                                    releaseNo: this.formData.releaseNo,
                                    staffNo: 'HMCS', // 统一推送给HMCS
                                    iqcStatus: this.PSTYPE,
                                    department: this.WORKSHOP, // 使用WORKSHOP替代未定义的DEPARTMENT
                                    EMERGENCY: this.formData.emergencyStatus ? "1" : "0" // 确保紧急放行状态正确传递
                                };
 
                                console.log("提交的紧急放行状态:", this.formData.emergencyStatus ? "1" : "0");
                                console.log("完整的提交数据:", this.QcIssueResultDetailes);
 
                                const url = this.$store.state.serverInfo.serverAPI+`/QcIssueResult/GetProcessNo`;
                                if (this.PSTYPE === '待判') {// 发送 POST 请求
                                uni.request({
                                    url: url, // 请求地址
                                    method: 'POST', // 请求方法
                                    data: this.QcIssueResultDetailes, // 请求体数据
                                    header: {
                                        'content-type': 'application/json' // 设置请求头,确保发送 JSON 格式的数据
                                    },
                                    success: (response) => {
                                        // 请求成功
                                        uni.showToast({
                                            title: '推送异常处置单成功',
                                            icon: 'none'
                                        });
 
                                        // 如果有页面跳转,需要用定时器延迟
                                        setTimeout(() => {
                                            // 设置一个标记,告诉List页面需要刷新
                                            getApp().globalData = getApp().globalData || {};
                                            getApp().globalData.needRefreshList = true;
                                            uni.redirectTo({
                                                url: 'List'
                                            });
                                        }, 2000); // 保持与 duration 相同的时长
 
                                    },
                                    fail: (error) => {
                                        // 请求失败
                                        console.log('请求失败:', error);
                                        uni.showToast({
                                            title: '推送异常处置单失败',
                                            icon: 'none'
                                        });
                                    }
                                });
                            }
                                uni.showToast({
                                    title: res.message.toString(),
                                    icon: 'success',
                                    duration: 2000
                                })
 
 
                            } else {
                                uni.showModal({
                                    title: "提示",
                                    content: res.message.toString(),
                                    confirmText: "确定",
                                    showCancel: false,
                                    success: (res) => {
 
                                    }
                                })
                            }
                        })
                    }
                } else {
                    // 检验提交的逻辑
                    this.$post({
                        url: "/LLJ/IqcQaSubmit",
                        data: {
                            userNo: this.$loginInfo.account,
                            releaseNo: this.formData.releaseNo
                        }
                    }).then(res => {
                        if (res.status == 0) {
 
                            uni.showToast({
                                title: res.message.toString(),
                                icon: 'success',
                                duration: 2000
                            })
                            // 如果有页面跳转,需要用定时器延迟
                            setTimeout(() => {
                                // 设置一个标记,告诉List页面需要刷新
                                getApp().globalData = getApp().globalData || {};
                                getApp().globalData.needRefreshList = true;
                                uni.navigateBack();
                            }, 2000); // 保持与 duration 相同的时长
                        } else {
                            uni.showModal({
                                title: "提示",
                                content: res.message.toString(),
                                confirmText: "确定",
                                showCancel: false,
                                success: (res) => {
 
                                }
                            })
                        }
                    })
                }
            },
            onShow() {
                //每次进入页面都会执行的方法
                if (this.formData.id) {
                    this.init();
                }
            },
            init() {
                let userName = this.$loginInfo.account;
 
                this.$post({
                    url: "/LLJ/getPage",
                    data: {
                        id: this.formData.id,
                        createUser: userName,
                        pageIndex: 1,
                        limit: 1,
                    }
                }).then(res => {
                    let data = res.data.tbBillList[0];
                    if (data) {
                        this.formData = {
                            ...data,
                            emergencyStatus: data.emergency === 1 || data.emergency === "1" || data.emergency === true
                        };
                        // 关键:赋值到页面绑定变量
                        this.badreason = data.blyy || '';
                        this.PSTYPE = data.pszt || '';
                        this.WORKSHOP = data.sscj || '';
                        this.remarks = data.remarks || ''; // 设置remarks变量
                        
                        // 设置 picker 索引
                        this.badreasonIndex = this.badreasonOptions.indexOf(this.badreason);
                        this.workshopIndex = this.workshopOptions.indexOf(this.WORKSHOP);
                        this.pstypeIndex = this.pstypeOptions.indexOf(this.PSTYPE);
 
                        
                        // 确保PHSY字段被正确设置(兼容大小写)
                        this.formData.PHSY = data.PHSY || data.phsy;
                        this.PHSY = (data.PHSY || data.phsy || '').toString(); // 同时设置页面绑定的PHSY变量
                        
                        console.log("加载的紧急放行状态:", this.formData.emergencyStatus);
                        this.$post({
                            url: "/LLJ/getJYItem",
                            data: {
                                id: this.formData.id,
                                releaseNo: this.formData.releaseNo
                            }
                        }).then(res1 => {
                            let tableData = res1.data.tbBillList
                            //当已检验个数都不为空时按照检测结构排序
                            tableData.sort((a, b) => {
                                // 首先按Fstand排序:Fstand不为空的排在前面
                                const aHasFstand = a.fstand !== null && a.fstand !== undefined;
                                const bHasFstand = b.fstand !== null && b.fstand !== undefined;
                                if (aHasFstand && !bHasFstand) {
                                    return -1;
                                } else if (!aHasFstand && bHasFstand) {
                                    return 1;
                                }
                                
                                // 然后按检验结果排序
                                if (a.result === '合格' && b.result === '未完成') {
                                    return -1;
                                } else if (a.result === '未完成' && b.result === '合格') {
                                    return 1;
                                } else {
                                    return 0;
                                }
                            });
                            this.tableData = tableData;
                            if (this.tableData.length === 0) {
                                this.isShowTable = true;
                            }
                            this.tableData.forEach((item, index) => {
                                this.$set(item, 'current', this.current);
 
                            });
 
                        })
                    }
                });
            },
            msgRead() {
                msgRead(this.msgId, this.$loginInfo.account);
            },
            //去文件列表页面(文件类型,物料编号)
            toFileUrlByU9List(type, u9No) {
                if (type === 1) {
                    uni.navigateTo({
                        url: 'FileUrlByU9List?type=' + type + '&itemID=' + u9No
                    });
                } else {
                    uni.navigateTo({
                        url: 'FileUrlByU9List2?type=' + type + '&itemID=' + u9No
                    });
                }
            },
            toSysSubmitFrom(releaseNo) {
                uni.navigateTo({
                    url: 'SysSubmitFrom?releaseNo=' + releaseNo + '&userID=' + this.$loginInfo.account
                });
            },
 
 
            drawingConfirm() {
                this.drawingShow = false
                this.imageShow = false
                this.productionShow = false
                this.itemShow=false
            },
            drawingCancel() {
                this.drawingShow = false
                this.imageShow = false
                this.productionShow = false
                this.itemShow=false
            },
 
            fetchDrawingNumber() {
                // const item = '83040700101'
                const item = this.formData.itemNo;
                console.log(this.formData.itemNo)
                // console.log(item)
                const url = this.$store.state.serverInfo.serverAPI +"/PLM/RetrieveDrawings?ItemNo=" + item
 
                // const item = '5.06.04.4002';
                // const url = "http://192.168.0.100:10054/api/PLM/RetrieveDrawings?ItemNo=" + item
                
                let _this = this;
                
                uni.request({
                    url: url,
                    method: 'POST',
                    success: (response) => {
                        console.log(response)
                        if (response.data.data == '返回结果为空') {
                            _this.drawing = []
                        } else {
                            _this.drawing = response.data.data
                            // 遍历数据,判断文件后缀并添加字段
                            _this.drawing.forEach((file) => {
                                // 获取文件名的后缀
                                const fileExtension = file.fName.split('.').pop()
                                    .toLowerCase();
 
                                // 定义支持的文件类型
                                const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc',
                                    'docx',
                                    'xls'
                                ];
 
                                // 判断是否支持该文件类型
                                file.isSupported = supportedExtensions.includes(fileExtension);
                            });
                        }
                    },
                    fail: (error) => {
                        uni.showToast({
                            title: '请求图纸链接失败',
                            icon: 'none'
                        });
                    }
                });
                this.drawingShow = true
            },
            
 
            //图纸相关文档
            openDrawings(item) {
                console.log("jkjoi", item)
                if (item.fRelevantObject.length > 2) {
                    // 生成请求URL(简化编码逻辑)
                    const encodedName = encodeURIComponent(item.fName); 
                    const url = this.$store.state.serverInfo.serverAPI+`/PLM/OpenDrawingsGet?fileId=${item.fRelevantObject}&fName=${encodedName}`;
                    console.log('请求URL:', url);
                    
                    const now = new Date();
                    const timestamp = [
                      now.getFullYear(),
                      String(now.getMonth() + 1).padStart(2, '0'),
                      String(now.getDate()).padStart(2, '0'),
                      String(now.getHours()).padStart(2, '0'),
                      String(now.getMinutes()).padStart(2, '0'),
                      String(now.getSeconds()).padStart(2, '0')
                    ].join('');
                                    
                    // 生成新文件名(基础名_时间戳.后缀)
                    this.fileName = `${item.fName}_${timestamp}.pdf`;
                    console.log('新文件名:', this.fileName);
                    
                    uni.downloadFile({
                        url: url,
                        success: (res) => {
                            console.log(res);
                            let fileName = this.fileName;
                            let fileExt = fileName.split('.').pop();
                            // let newFilePath = "_doc/uniapp_temp_1742877118745/download" + "/" + fileName;
                            // console.log('newFilePath', newFilePath)
                            if (fileExt === 'xls' || fileExt === 'xlsx' || fileExt === 'pdf'|| fileExt === 'jpg'|| fileExt === 'png') {
                                plus.io.resolveLocalFileSystemURL(res.tempFilePath, (entry) => {
                                        // 获取文件所在的目录
                                        entry.getParent((parentEntry) => {
                                          let newFileName = this.fileName; // 新的文件名
                                
                                          // 移动并重命名文件
                                          entry.moveTo(
                                            parentEntry,
                                            newFileName,
                                            (newEntry) => {
                                              console.log('重命名成功:', newEntry.fullPath);
                                
                                              // 打开 Excel 文件
                                              plus.runtime.openFile(newEntry.fullPath, {}, (e) => {
                                                console.error('无法打开 Excel 文件:', e);
                                              });
                                              
                                              // let pages = getCurrentPages();
                                              // let beforePage = pages[pages.length - 2];
                                              // uni.navigateBack({
                                              //     delta: 1, //返回的页面数,如果为1表示返回上一页
                                              //     success: (event) => {
                                              //         beforePage.$vm.reload()
                                              //     }
                                              // });
                                              
                                            },
                                            (err) => {
                                              console.error('重命名失败:', err);
                                            }
                                          );
                                        }, (err) => {
                                          console.error('获取父目录失败:', err);
                                        });
                                      }, (err) => {
                                        console.error('获取文件失败:', err);
                                      });
                            } else {
                                console.error('文件格式不匹配:', fileExt);
                                uni.showToast({
                                    title: '文件格式不支持',
                                    icon: 'none'
                                });
                            }
                        }
                    })
                    
                    
                    // uni.downloadFile({
                    //     url: url,
                    //     responseType: 'arraybuffer', // 关键:指定响应数据类型为 ArrayBuffer
                    //     success: (res) => {
                    //         console.log(res)
                    //         if (res.statusCode === 200) {
                    //             // 获取 ArrayBuffer 数据
                    //             const arrayBuffer = res.data;
 
                    //             // 可选:验证文件类型(例如检查 PDF 文件头)
                    //             const header = new Uint8Array(arrayBuffer).subarray(0, 4);
                    //             const headerStr = Array.from(header).map(byte => byte.toString(16).padStart(2,
                    //                 '0')).join('').toUpperCase();
                    //             if (headerStr !== '25504446') { // PDF 文件头为 "%PDF" 的十六进制表示
                    //                 console.error('文件格式无效,非 PDF 文件');
                    //                 return;
                    //             }
 
                    //             // 保存为临时文件(确保扩展名为 .pdf)
                    //             const tempPath = `${wx.env.USER_DATA_PATH}/${Date.now()}.pdf`; // 微信小程序路径
                    //             uni.saveFile({
                    //                 tempFilePath: arrayBuffer, // 注意:部分平台可能需要转换 ArrayBuffer 为 Base64
                    //                 filePath: tempPath,
                    //                 success: () => {
                    //                     uni.openDocument({
                    //                         filePath: tempPath,
                    //                         fileType: 'pdf',
                    //                         success: () => console.log('文档打开成功'),
                    //                         fail: (err) => console.error('打开失败:', err)
                    //                     });
                    //                 },
                    //                 fail: (saveErr) => console.error('保存文件失败:', saveErr)
                    //             });
                    //         } else {
                    //             console.error('下载失败,状态码:', res.statusCode);
                    //         }
                    //     },
                    //     fail: (error) => {
                    //         console.error('下载请求失败:', error.errMsg);
                    //     }
                    // });
                    uni.request({
                        url: url,
                        method: 'POST',
                        responseType: 'arraybuffer',
                        success: (response) => {
                            console.log(response.data)
                            if (!response) {
                                uni.showToast({
                                    title: "协议预览失败",
                                    duration: 2000
                                });
                            }
                            
                            
                            
                            // const base64Data = uni.arrayBufferToBase64(response.data);
 
                            // // 构造一个可以用于预览的 Data URL
                            // const pdfUrl = `data:application/pdf;base64,${base64Data}`;
 
                            // // 使用 pdfUrl 作为预览路径
                            // console.log("PDF 预览路径:", pdfUrl);
 
                            // // 将 Base64 数据传递给另一个页面进行预览
                            // // 注意:直接传递 pdfUrl 可能会导致 URL 过长,建议使用其他方式传递
                            // uni.navigateTo({
                            //     url: `/pages/fileView/pdfView?url=${encodeURIComponent(pdfUrl)}`
                            // });
 
                            // const base64Data = uni.arrayBufferToBase64(response.data);
 
                            //     // 存储到全局变量(在App.vue中定义)
                            //     getApp().globalData.tempPDF = base64Data;
 
                            //     uni.navigateTo({
                            //       url: '/pages/fileView/pdfView'
                            //     });
 
                        },
                        fail: (error) => {
                            console.log(error)
                            uni.showToast({
                                title: '请求预览链接失败',
                                icon: 'none'
                            });
                        }
                    });
                } else if (item.fName && item.fName.toLowerCase().endsWith('.jpg')) {
                    const url = "http://192.168.1.22:10054/api/PLM/OpenDrawings?fileId=" + item.fFileId +
                        '&fName=' +
                        encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace(
                                /\#/g,
                                '%23')
                            .replace(/\?/g, '%3F').replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\&/g,
                                '%26'))
                    console.log('jpgurl: ' + url);
                    uni.request({
                        url: url,
                        method: 'POST',
                        responseType: 'arraybuffer',
                        success: (response) => {
                            console.log(response.data)
                            if (!response) {
                                uni.showToast({
                                    title: "协议预览失败",
                                    duration: 2000
                                });
                            }
                            const base64Data = uni.arrayBufferToBase64(response.data);
 
                            // 构造一个可以用于预览的 Data URL
                            const jpgUrl = `data:image/jpeg;base64,${base64Data}`;
 
                            // 使用 pdfUrl 作为预览路径
                            console.log("PDF 预览路径:", jpgUrl);
 
                            // 将 Base64 数据传递给另一个页面进行预览
                            // 注意:直接传递 jpgUrl 可能会导致 URL 过长,建议使用其他方式传递
                            uni.navigateTo({
                                url: `/pages/fileView/jpgView?url=${encodeURIComponent(jpgUrl)}`
                            });
                        },
                        fail: (error) => {
                            console.log(error)
                            uni.showToast({
                                title: '请求预览链接失败',
                                icon: 'none'
                            });
                        }
                    });
                } else if (item.fName && item.fName.toLowerCase().endsWith('.xlsx')) {
                    console.log(item);
                    const url = "http://192.168.1.22:10054/api/PLM/OpenDrawings?fileId=" + item.fFileId +
                        '&fName=' +
                        encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace(
                                /\#/g,
                                '%23')
                            .replace(/\?/g, '%3F').replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\&/g,
                                '%26'))
                    console.log('jpgurl: ' + url);
                    uni.request({
                        url: url,
                        method: 'POST',
                        responseType: 'arraybuffer',
                        success: (response) => {
                            console.log(response.data)
                            if (!response) {
                                uni.showToast({
                                    title: "协议预览失败",
                                    duration: 2000
                                });
                            }
                            // const base64Data = uni.arrayBufferToBase64(response.data);
 
                            // const excelUrl =
                            //     `data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,${base64Data}`;
 
                            // // 使用 pdfUrl 作为预览路径
                            // console.log("PDF 预览路径:", excelUrl);
 
                            // 将 ArrayBuffer 转换为 Base64 数据
                            const base64Data = uni.arrayBufferToBase64(response.data);
 
                            // 存储 Base64 数据到本地存储
                            uni.setStorageSync('excelBase64Data', base64Data);
                            // 将 Base64 数据传递给另一个页面进行预览
                            // 注意:直接传递 excelUrl 可能会导致 URL 过长,建议使用其他方式传递
                            // uni.navigateTo({
                            //     url: `/pages/fileView/excelView?url=${encodeURIComponent(excelUrl)}`
                            // });
                            uni.navigateTo({
                                url: `/pages/fileView/excelView`
                            });
                        },
                        fail: (error) => {
                            console.log(error)
                            uni.showToast({
                                title: '请求预览链接失败',
                                icon: 'none'
                            });
                        }
                    });
                }
                // else if (item.fName && item.fName.toLowerCase().endsWith('.doc') || item.fName && item.fName
                //     .toLowerCase().endsWith('.docx')) {
                // console.log(item);
                // const url = "http://192.168.0.100:10054/api/PLM/OpenDrawings?fileId=" + item.fFileId + '&fName=' +
                //     encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace(/\#/g, '%23')
                //         .replace(/\?/g, '%3F').replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\&/g, '%26'));
                // console.log('Word 文档 URL:' + url);
                // uni.request({
                //     url: url,
                //     method: 'POST',
                //     responseType: 'arraybuffer',
                //     success: (response) => {
                //         console.log(response.data);
                //         if (!response) {
                //             uni.showToast({
                //                 title: "文档预览失败",
                //                 duration: 2000
                //             });
                //         }
                //         const base64Data = uni.arrayBufferToBase64(response.data);
 
                //         // 构造一个可以用于预览的 Data URL
                //         const wordUrl = `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,${base64Data}`;
 
                //         // 使用 wordUrl 作为预览路径
                //         console.log("Word 文档预览路径:", wordUrl);
 
                //         // 将 Base64 数据传递给另一个页面进行预览
                //         // 注意:直接传递 wordUrl 可能会导致 URL 过长,建议使用其他方式传递
                //         uni.navigateTo({
                //             url: `/pages/fileView/wordView?url=${encodeURIComponent(wordUrl)}`
                //         });
                //     },
                //         fail: (error) => {
                //             console.log(error)
                //             uni.showToast({
                //                 title: '请求预览链接失败',
                //                 icon: 'none'
                //             });
                //         }
                //     });
                // } else {
                //     uni.showToast({
                //         title: '无对应PDF文件,打开失败',
                //         icon: 'none'
                //     });                // }
            },
            // 处理紧急放行
            handleEmergencyRelease() {
                        if (this.formData.emergencyStatus) {
                            uni.showModal({
                                title: "提示",
                                content: '该单已紧急放行,请勿重复操作',
                                showCancel: false
                            });
                            return;
                        }
            
                        uni.showModal({
                            title: '确认',
                            content: '确定要执行紧急放行吗?',
                            success: (res) => {
                                if (res.confirm) {
                                    // 调用新的后端接口
                                    this.$post({
                                        url: "/LLJ/EmergencyRelease",
                                        data: {
                                            id: this.formData.id
                                        }
                                    }).then(res => {
                                        if (res.data && res.status === 0) {
                                            const result = res.data.tbBillList[0];
                                            const message = res.data.tbBillList[1];
                                            const lotNo1 = res.data.tbBillList[2] || "";
            
                                            if (result === "0") {
                                                this.formData.emergencyStatus = true;
                                                this.originalLotNo1 = lotNo1; 
                                                this.formData.lotNo1 = lotNo1;
                                                // 更新紧急放行状态,确保提交时能正确传递
                                                this.formData.EMERGENCY = "1";
                                                
                                                uni.showToast({
                                                    title: message || '紧急放行成功',
                                                    icon: 'success',
                                                    duration: 2000
                                                });
                                                this.init();
                                            } else {
                                                uni.showModal({
                                                    title: "提示",
                                                    content: message || '操作失败',
                                                    showCancel: false
                                                });
                                            }
                                        }
                                    }).catch(error => {
                                        uni.showModal({
                                            title: "错误",
                                            content: '网络错误,请检查网络连接',
                                            showCancel: false
                                        });
                                    });
                                }
                            }
                        });
                    },
            
                    // 处理撤回
                    handleWithdraw() {
                        uni.showModal({
                            title: '确认',
                            content: '确定要撤回紧急放行吗?',
                            success: (res) => {
                                if (res.confirm) {
                                    // 调用新的后端接口
                                    this.$post({
                                        url: "/LLJ/WithdrawEmergencyRelease",
                                        data: {
                                            id: this.formData.id
                                        }
                                    }).then(res => {
                                        if (res.data && res.status === 0) {
                                            const result = res.data.tbBillList[0];
                                            const message = res.data.tbBillList[1];
            
                                            if (result === "0") {
                                                this.formData.emergencyStatus = false;
                                                // 更新紧急放行状态,确保提交时能正确传递
                                                this.formData.EMERGENCY = "0";
                                                
                                                uni.showToast({
                                                    title: message || '撤回成功',
                                                    icon: 'success',
                                                    duration: 2000
                                                });
                                                this.init();
                                            } else {
                                                uni.showModal({
                                                    title: "提示",
                                                    content: message || '操作失败',
                                                    showCancel: false
                                                });
                                            }
                                        }
                                    }).catch(error => {
                                        uni.showModal({
                                            title: "错误",
                                            content: '网络错误,请检查网络连接',
                                            showCancel: false
                                        });
                                    });
                                }
                            }
                        });
                    },
                    editRemarks() {
                        this.$post({
                            url: "/LLJ/saveRemarksGid",
                            data: {
                                gid: this.formData.id,
                                remarks: this.remarks || '',
                                releaseNo: this.formData.releaseNo
                            }
                        }).then(res => {
                            if (res.data.tbBillList > 0) {
                                this.formData.remarks = this.remarks;
                                this.remarksPopup = !this.remarksPopup;
                                // 立即重新加载数据确保同步
                                setTimeout(() => {
                                    this.init();
                                }, 500);
                            }
                        }).catch(err => {
                            console.error('保存失败:', err);
                        })
                    },
            addDestruction() {
                // 添加破坏实验的逻辑
                this.destructionPopup = true;
                
                // 每次点击都查询是否已有破坏实验记录
                this.checkPhsyRecord();
            },
            
            // 查询破坏实验记录是否存在
            checkPhsyRecord() {
                uni.showLoading({
                    title: '查询破坏实验记录...'
                });
                
                this.$post({
                    url: "/LLJ/CheckPhsyRecord",
                    data: {
                        billNo: this.formData.lotNo, // 使用到货单号
                        releaseNo: this.formData.releaseNo // 使用检验单号
                    }
                }).then(res => {
                    uni.hideLoading();
                    if (res.status === 0) {
                        const hasRecord = res.data.exists;
                        if (hasRecord) {
                            // 有记录,显示物料信息,只显示修改、删除、返回按钮
                            this.showExistingRecord();
                        } else {
                            // 无记录,显示扫描界面
                            this.showScanInterface();
                        }
                    } else {
                        uni.showToast({
                            title: res.message || '查询失败',
                            icon: 'none'
                        });
                        this.destructionPopup = false;
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('查询破坏实验记录失败:', err);
                    uni.showToast({
                        title: '查询失败,请重试',
                        icon: 'none'
                    });
                    this.destructionPopup = false;
                });
            },
            
            // 显示已有记录
            showExistingRecord() {
                // 设置已有记录状态
                this.hasExistingRecord = true;
                // 获取破坏实验记录中的物料信息
                this.getPhsyRecordInfo();
            },
            
            // 获取破坏实验记录信息
            getPhsyRecordInfo() {
                uni.showLoading({
                    title: '获取破坏实验记录...'
                });
                
                this.$post({
                    url: "/LLJ/GetPhsyRecordInfo",
                    data: {
                        billNo: this.formData.lotNo, // 使用到货单号
                        releaseNo: this.formData.releaseNo // 使用检验单号
                    }
                }).then(res => {
                    uni.hideLoading();
                    if (res.status === 0 && res.data && res.data.tbBillList && res.data.tbBillList.length > 0) {
                        // 获取到破坏实验记录,设置物料信息
                        const record = res.data.tbBillList[0];
                        this.scannedMaterialInfo = {
                            itemBarcode: record.itemBarcode,
                            itemNo: record.itemNo,
                            itemName: record.itemName,
                            itemModel: record.itemModel,
                            billNo: record.billNo,
                            oldQty: record.yqty
                        };
                        // 设置破坏实验数量
                        this.destructionQuantity = record.cqty ? record.cqty.toString() : '';
                    } else {
                        // 如果没有获取到详细信息,显示提示
                        uni.showToast({
                            title: '已存在破坏实验记录',
                            icon: 'none',
                            duration: 1500
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('获取破坏实验记录失败:', err);
                    uni.showToast({
                        title: '获取记录失败,请重试',
                        icon: 'none'
                    });
                });
            },
            
            // 显示扫描界面
            showScanInterface() {
                // 设置无记录状态
                this.hasExistingRecord = false;
                // 如果已经有扫描的物料信息,直接显示结果步骤
                if (this.scannedMaterialInfo) {
                    // 保持当前扫描信息,不重置
                    return;
                }
                
                // 如果没有扫描信息,重置所有相关数据
                this.scannedMaterialInfo = null;
                this.destructionQuantity = '';
                this.isInteger = true;
            },
            
            // 扫描二维码
            scanQRCode() {
                // #ifdef APP-PLUS
                // APP环境使用uni.scanCode
                uni.scanCode({
                    success: (res) => {
                        console.log('扫描结果:', res.result);
                        this.processQRCodeResult(res.result);
                    },
                    fail: (err) => {
                        console.error('扫描失败:', err);
                        uni.showToast({
                            title: '扫描失败,请重试',
                            icon: 'none'
                        });
                    }
                });
                // #endif
                
                // #ifdef H5
                // H5环境提示用户手动输入
                uni.showModal({
                    title: '二维码扫描',
                    content: 'H5环境暂不支持摄像头扫描,请输入二维码内容',
                    editable: true,
                    placeholderText: '请输入二维码内容',
                    success: (res) => {
                        if (res.confirm && res.content) {
                            this.processQRCodeResult(res.content);
                        }
                    }
                });
                // #endif
                
                // #ifdef MP
                // 小程序环境使用wx.scanCode
                wx.scanCode({
                    success: (res) => {
                        console.log('扫描结果:', res.result);
                        this.processQRCodeResult(res.result);
                    },
                    fail: (err) => {
                        console.error('扫描失败:', err);
                        uni.showToast({
                            title: '扫描失败,请重试',
                            icon: 'none'
                        });
                    }
                });
                // #endif
            },
            
            // 处理二维码扫描结果
            processQRCodeResult(qrCodeResult) {
                if (!qrCodeResult) {
                    uni.showToast({
                        title: '二维码内容为空',
                        icon: 'none'
                    });
                    return;
                }
                
                // 显示加载提示
                uni.showLoading({
                    title: '查询物料信息...'
                });
                
                // 调用后端接口查询物料信息
                this.$post({
                    url: "/LLJ/GetMaterialByBarcode",
                    data: {
                        itemBarcode: qrCodeResult,
                        currentBillNo: this.formData.lotNo  // 传递当前检验单的到货单号
                    }
                }).then(res => {
                    uni.hideLoading();
                    if (res.status === 0 && res.data && res.data.tbBillList && res.data.tbBillList.length > 0) {
                        // 查询成功,验证物料ID是否与检验单一致
                        const scannedMaterial = res.data.tbBillList[0];
                        
                        // 检查扫描的物料ID是否与当前检验单的物料ID一致
                        if (this.formData.itemId && scannedMaterial.itemId && 
                            this.formData.itemId.toString() !== scannedMaterial.itemId.toString()) {
                            // 物料ID不一致,显示错误信息
                            this.scannedMaterialInfo = null;
                            uni.showModal({
                                title: '物料不匹配',
                                content: '扫秒的条码不为该检验单物料,请重新扫描',
                                showCancel: false
                            });
                            return;
                        }
                        
                        // 物料ID验证通过,显示物料信息
                        this.scannedMaterialInfo = scannedMaterial;
                        // 保存扫描到的条码值,用于后续调用存储过程
                        this.scannedMaterialInfo.itemBarcode = qrCodeResult;
                        uni.showToast({
                            title: '查询成功',
                            icon: 'success'
                        });
                    } else {
                        // 查询失败,显示错误信息
                        this.scannedMaterialInfo = null;
                        uni.showModal({
                            title: '查询失败',
                            content: res.message || '未找到对应的物料信息,请检查二维码是否正确',
                            showCancel: false
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('查询物料信息失败:', err);
                    this.scannedMaterialInfo = null;
                    uni.showModal({
                        title: '查询失败',
                        content: '网络错误,请检查网络连接后重试',
                        showCancel: false
                    });
                });
            },
            
            // 测试输入
            testInput() {
                this.destructionQuantity = '5';
                this.validateInteger();
                uni.showToast({
                    title: '测试输入完成',
                    icon: 'success'
                });
            },
            
            // 点击输入框
            focusInput() {
                // 使用uni-app的输入弹窗
                uni.showModal({
                    title: '输入破坏实验数量',
                    content: `可用数量: ${this.scannedMaterialInfo.oldQty}`,
                    editable: true,
                    placeholderText: '请输入数量',
                    success: (res) => {
                        if (res.confirm && res.content) {
                            this.destructionQuantity = res.content;
                            this.validateInteger();
                        }
                    }
                });
            },
            
            // 验证输入是否为整数
            validateInteger() {
                if (!this.destructionQuantity) {
                    this.isInteger = true;
                    return;
                }
                
                const value = this.destructionQuantity.toString().trim();
                // 只允许正整数
                this.isInteger = /^[1-9]\d*$/.test(value);
            },
            
            // 确认破坏实验
            confirmDestruction() {
                if (!this.isInteger || !this.destructionQuantity) {
                    uni.showToast({
                        title: '请输入有效的整数数量',
                        icon: 'none'
                    });
                    return;
                }
                
                // 检查扫描的物料信息是否存在
                if (!this.scannedMaterialInfo) {
                    uni.showToast({
                        title: '请先扫描物料二维码',
                        icon: 'none'
                    });
                    return;
                }
                
                // 验证破坏实验数量不能大于可用数量
                const destructionQty = parseInt(this.destructionQuantity);
                const availableQty = parseInt(this.scannedMaterialInfo.oldQty);
                
                if (destructionQty > availableQty) {
                    uni.showModal({
                        title: '数量错误',
                        content: `破坏实验数量(${destructionQty})不能大于可用数量(${availableQty}),请重新填写或重新扫码!`,
                        showCancel: false
                    });
                    return;
                }
                
                // 显示加载提示
                uni.showLoading({
                    title: '调用存储过程中...'
                });
                
                // 调用破坏实验存储过程
                this.$post({
                    url: "/LLJ/CallPhsyUpdateProcedure",
                    data: {
                        itemBarcode: this.scannedMaterialInfo.itemBarcode || this.scannedMaterialInfo.itemNo, // 使用扫描的条码
                        yqty: availableQty, // 扫码查询出来的条码数量
                        cqty: destructionQty, // 填写的破坏实验数量
                        billNo: this.scannedMaterialInfo.billNo, // 查询到的到货单号
                        lx: 1, // 操作类型:1新增
                        releaseNo: this.formData.releaseNo, // 检验单号
                        itemId: this.formData.itemId // 检验单的物料ID
                    }
                }).then(res => {
                    uni.hideLoading();
                    
                    // 检查存储过程返回的结果
                    if (res.status === 0) {
                        // 存储过程执行成功
                        this.formData.PHSY = this.destructionQuantity;
                        this.destructionPopup = false;
                        this.hasExistingRecord = true; // 设置为有记录状态
                        uni.showToast({
                            title: '破坏实验记录保存成功',
                            icon: 'success',
                            duration: 2000
                        });
                        // 立即重新加载数据确保同步
                        setTimeout(() => {
                            this.init();
                        }, 500);
                    } else {
                        // 存储过程执行失败,显示错误信息
                        uni.showModal({
                            title: '操作失败',
                            content: res.message || '破坏实验记录保存失败',
                            showCancel: false
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('调用存储过程失败:', err);
                    uni.showModal({
                        title: '网络错误',
                        content: '调用存储过程失败,请检查网络连接后重试',
                        showCancel: false
                    });
                });
            },
            
            // 修改破坏实验(只修改数量)
            modifyDestruction() {
                // 显示数量输入界面
                uni.showModal({
                    title: '修改破坏实验数量',
                    content: '请输入新的破坏实验数量',
                    editable: true,
                    placeholderText: '请输入数量',
                    success: (res) => {
                        if (res.confirm && res.content) {
                            const newQuantity = parseInt(res.content);
                            if (isNaN(newQuantity) || newQuantity <= 0) {
                                uni.showToast({
                                    title: '请输入有效的正整数',
                                    icon: 'none'
                                });
                                return;
                            }
                            
                            // 调用修改存储过程
                            this.callModifyProcedure(newQuantity);
                        }
                    }
                });
            },
            
            // 调用修改存储过程
            callModifyProcedure(newQuantity) {
                uni.showLoading({
                    title: '修改中...'
                });
                
                // 获取当前扫描的物料信息
                const itemBarcode = (this.scannedMaterialInfo && this.scannedMaterialInfo.itemBarcode) || 
                                   (this.scannedMaterialInfo && this.scannedMaterialInfo.itemNo) || '';
                const yqty = (this.scannedMaterialInfo && this.scannedMaterialInfo.oldQty) || 0;
                
                this.$post({
                    url: "/LLJ/CallPhsyUpdateProcedure",
                    data: {
                        itemBarcode: itemBarcode, // 使用扫描的条码
                        yqty: yqty, // 使用扫码查询出来的条码数量
                        cqty: newQuantity, // 新的破坏实验数量
                        billNo: this.formData.lotNo, // 到货单号
                        lx: 2, // 操作类型:2修改
                        releaseNo: this.formData.releaseNo, // 检验单号
                        itemId: this.formData.itemId // 检验单的物料ID
                    }
                }).then(res => {
                    uni.hideLoading();
                    
                    if (res.status === 0) {
                        // 修改成功
                        this.formData.PHSY = newQuantity.toString();
                        this.PHSY = newQuantity.toString();
                        this.destructionPopup = false;
                        
                        uni.showToast({
                            title: '修改成功',
                            icon: 'success',
                            duration: 2000
                        });
                        
                        // 重新加载数据
                        setTimeout(() => {
                            this.init();
                        }, 500);
                    } else {
                        uni.showModal({
                            title: '修改失败',
                            content: res.message || '修改失败',
                            showCancel: false
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('修改失败:', err);
                    uni.showModal({
                        title: '网络错误',
                        content: '修改失败,请检查网络连接后重试',
                        showCancel: false
                    });
                });
            },
            
            // 删除破坏实验
            deleteDestruction() {
                uni.showModal({
                    title: '确认删除',
                    content: '确定要删除当前的破坏实验记录吗?',
                    success: (res) => {
                        if (res.confirm) {
                            // 调用存储过程删除记录
                            this.callDeleteProcedure();
                        }
                    }
                });
            },
            
            // 调用删除存储过程
            callDeleteProcedure() {
                uni.showLoading({
                    title: '删除中...'
                });
                
                // 获取当前扫描的物料信息
                const itemBarcode = (this.scannedMaterialInfo && this.scannedMaterialInfo.itemBarcode) || 
                                   (this.scannedMaterialInfo && this.scannedMaterialInfo.itemNo) || '';
                const yqty = (this.scannedMaterialInfo && this.scannedMaterialInfo.oldQty) || 0;
                const cqty = parseFloat(this.destructionQuantity) || 0; // 使用当前记录的破坏数量
                
                this.$post({
                    url: "/LLJ/CallPhsyUpdateProcedure",
                    data: {
                        itemBarcode: itemBarcode, // 使用扫描的条码
                        yqty: yqty, // 使用扫码查询出来的条码数量
                        cqty: cqty, // 使用当前记录的破坏数量
                        billNo: this.formData.lotNo, // 到货单号
                        lx: 3, // 操作类型:3删除
                        releaseNo: this.formData.releaseNo, // 检验单号
                        itemId: this.formData.itemId // 检验单的物料ID
                    }
                }).then(res => {
                    uni.hideLoading();
                    
                    if (res.status === 0) {
                        // 删除成功
                        this.scannedMaterialInfo = null;
                        this.destructionQuantity = '';
                        this.isInteger = true;
                        this.formData.PHSY = '';
                        this.PHSY = '';
                        this.hasExistingRecord = false;
                        this.destructionPopup = false;
                        
                        uni.showToast({
                            title: '删除成功',
                            icon: 'success',
                            duration: 2000
                        });
                        
                        // 重新加载数据
                        setTimeout(() => {
                            this.init();
                        }, 500);
                    } else {
                        uni.showModal({
                            title: '删除失败',
                            content: res.message || '删除失败',
                            showCancel: false
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('删除失败:', err);
                    uni.showModal({
                        title: '网络错误',
                        content: '删除失败,请检查网络连接后重试',
                        showCancel: false
                    });
                });
            },
            
            // 重置破坏实验(返回上一步)
            resetDestruction() {
                this.scannedMaterialInfo = null;
                this.destructionQuantity = '';
                this.isInteger = true;
                this.hasExistingRecord = false;
                this.destructionPopup = false; // 直接关闭弹窗,返回到表单
            },
            
            // 关闭破坏实验弹窗
            closeDestructionPopup() {
                this.destructionPopup = false;
                // 重置所有相关数据
                this.scannedMaterialInfo = null;
                this.destructionQuantity = '';
                this.isInteger = true;
            },
            
            editDestruction() {
                // 验证输入是否为整数或空字符串
                if(this.PHSY === '') {
                    this.isInteger = true;
                } else {
                    const isInteger = /^-?\d+$/.test(this.PHSY);
                    this.isInteger = isInteger;
                    if (!isInteger) {
                        uni.showToast({
                            title: '请输入整数值或留空',
                            icon: 'none',
                            duration: 2000
                        });
                        return;
                    }
                }
            
                // 显示加载提示
                uni.showLoading({
                    title: '保存中...'
                });
            
                this.$post({
                    url: "/LLJ/savePhsyGid",
                    data: {
                        gid: this.formData.id,
                        releaseNo: this.formData.releaseNo,
                        PHSY: this.PHSY
                    }
                }).then(res => {
                    uni.hideLoading();
                    if (res.data && res.data.tbBillList > 0) {
                        this.formData.PHSY = this.PHSY === '' ? null : this.PHSY;
                        this.destructionPopup = false;
                        uni.showToast({
                            title: '保存成功',
                            icon: 'success',
                            duration: 2000
                        });
                        // 立即重新加载数据确保同步
                        setTimeout(() => {
                            this.init();
                        }, 500);
                    } else {
                        uni.showToast({
                            title: '保存失败',
                            icon: 'none',
                            duration: 2000
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('保存失败:', err);
                    uni.showToast({
                        title: '保存失败,请重试',
                        icon: 'none',
                        duration: 2000
                    });
                })
            },
            clearDestruction() {
                // 显示加载提示
                uni.showLoading({
                    title: '清除中...'
                });
                
                this.$post({
                    url: "/LLJ/savePhsyGid",
                    data: {
                        gid: this.formData.id,
                        releaseNo: this.formData.releaseNo,
                        PHSY: ''
                    }
                }).then(res => {
                    uni.hideLoading();
                    if (res.data && res.data.tbBillList > 0) {
                        this.formData.PHSY = null;
                        this.PHSY = '';
                        this.destructionPopup = false;
                        uni.showToast({
                            title: '清除成功',
                            icon: 'success',
                            duration: 2000
                        });
                        // 立即重新加载数据确保同步
                        setTimeout(() => {
                            this.init();
                        }, 500);
                    } else {
                        uni.showToast({
                            title: '清除失败',
                            icon: 'none',
                            duration: 2000
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('清除失败:', err);
                    uni.showToast({
                        title: '清除失败,请重试',
                        icon: 'none',
                        duration: 2000
                    });
                })
            },
            viewAttachmentInfo() {
                this.showAttachmentPopup = true; // 先弹窗
                this.attachmentsLoading = true;
                this.attachments = [];
                this.$post({
                    url: "/LLJ/getAttachments",
                    data: { itemNo: this.formData.itemNo }
                }).then(res => {
                    this.attachmentsLoading = false;
                    if (res.status === 0) {
                        this.attachments = res.data.tbBillList;
                        // 为每个附件设置默认可用状态
                        this.attachments.forEach((item, index) => {
                            this.$set(item, 'ftpAvailable', true); // 默认认为文件可用
                            this.$set(item, 'checking', false);
                        });
                    } else if (res.status === 1 && res.message === "该检验单未上传附件信息!") {
                        uni.showToast({ title: res.message, icon: "none" });
                    } else {
                        uni.showToast({ title: "获取附件失败", icon: "none" });
                    }
                });
            },
            closeAttachmentPopup() {
                this.showAttachmentPopup = false;
            },
            getAttachmentUrl(item) {
                // 去除所有空白字符(包括中英文空格、制表符等)
                let fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim();
                // 统一使用FTP下载接口,包含FTP服务器地址
                return this.$store.state.serverInfo.serverAPI + "/LLJ/DownloadFtpFile?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + encodeURIComponent(this.$store.state.serverInfo.ftpServer);
            },
            showAttachmentDetailDialog(item) {
                console.log('查看详情', item);
                this.selectedAttachment = item;
                this.showAttachmentPopup = false;
                this.showAttachmentDetail = true;
                console.log('showAttachmentDetail:', this.showAttachmentDetail);
            },
            closeAttachmentDetail() {
                this.showAttachmentDetail = false;
                this.selectedAttachment = null;
                this.showAttachmentPopup = true;
            },
            isPreviewable(filename) {
                if (!filename) return false;
                const ext = filename.trim().split('.').pop().toLowerCase();
                // 支持在线预览的文件类型
                return [
                    'pdf',           // PDF文件
                    'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp',  // 图片文件
                    'txt', 'log', 'md',  // 文本文件
                    'doc', 'docx',   // Word文档
                    'xls', 'xlsx',   // Excel表格
                    'ppt', 'pptx',   // PowerPoint演示文稿
                    'csv'            // CSV文件
                ].includes(ext);
            },
            // 处理附件下载错误
            handleAttachmentError(item) {
                uni.showModal({
                    title: '下载失败',
                    content: `无法下载附件:${item.fattach}\n请检查网络连接或联系管理员`,
                    showCancel: false
                });
            },
            // 预览FTP文件
            previewFtpFile(item) {
                const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim();
                const fileExt = fileName.split('.').pop().toLowerCase();
                
                // 检查文件类型是否支持预览
                if (!this.isPreviewable(fileName)) {
                    uni.showModal({
                        title: '不支持预览',
                        content: '该文件类型不支持在线预览,请下载后查看',
                        showCancel: false
                    });
                    return;
                }
                
                const previewUrl = this.$store.state.serverInfo.serverAPI + "/LLJ/PreviewFtpFile?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + encodeURIComponent(this.$store.state.serverInfo.ftpServer);
                
                // 根据文件类型进行不同的预览处理
                if (['pdf'].includes(fileExt)) {
                    this.previewPdfFile(previewUrl, fileName);
                } else if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(fileExt)) {
                    this.previewImageFile(previewUrl, fileName);
                } else if (['txt'].includes(fileExt)) {
                    this.previewTextFile(previewUrl, fileName);
                } else if (['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'].includes(fileExt)) {
                    this.previewOfficeFile(previewUrl, fileName);
                } else {
                    // 尝试通用预览
                    this.previewGenericFile(previewUrl, fileName);
                }
            },
            
            // 预览PDF文件
            previewPdfFile(url, fileName) {
                // 先下载PDF文件,转为base64后预览
                uni.request({
                    url: url,
                    method: 'GET',
                    responseType: 'arraybuffer',
                    success: (res) => {
                        if (res.statusCode === 200) {
                            const base64Data = uni.arrayBufferToBase64(res.data);
                            // 存储到全局变量
                            getApp().globalData.tempPDF = base64Data;
                            uni.navigateTo({
                                url: `/pages/fileView/pdfView`
                            });
                        } else {
                            this.handlePreviewError(res.statusCode, fileName);
                        }
                    },
                    fail: (error) => {
                        this.handlePreviewError(0, fileName, error.errMsg);
                    }
                });
            },
            
            // 预览图片文件
            previewImageFile(url, fileName) {
                // #ifdef APP-PLUS
                // APP环境:先下载到本地再预览,避免网络图片加载问题
                uni.showLoading({ title: '加载图片...' });
                uni.downloadFile({
                    url: url,
                    success: (res) => {
                        uni.hideLoading();
                        if (res.statusCode === 200) {
                            // 使用本地临时路径
                            uni.navigateTo({
                                url: `/pages/fileView/imageView?url=${encodeURIComponent(res.tempFilePath)}`
                            });
                        } else {
                            this.handlePreviewError(res.statusCode, fileName);
                        }
                    },
                    fail: (error) => {
                        uni.hideLoading();
                        this.handlePreviewError(0, fileName, error.errMsg);
                    }
                });
                // #endif
                
                // #ifdef H5 || MP
                // H5和小程序:直接使用网络URL
                uni.navigateTo({
                    url: `/pages/fileView/imageView?url=${encodeURIComponent(url)}`
                });
                // #endif
            },
            
            // 预览文本文件
            previewTextFile(url, fileName) {
                // 文本文件直接显示在弹窗中
                uni.showLoading({ title: '加载文件内容...' });
                uni.request({
                    url: url,
                    method: 'GET',
                    success: (res) => {
                        uni.hideLoading();
                        if (res.statusCode === 200) {
                            const fileType = this.getFileType(fileName);
                            
                            if (fileType === 'text') {
                                // 文本文件:显示内容
                                this.showFilePreview(res.data, fileName);
                            } else if (fileType === 'image') {
                                // 图片文件:显示图片URL
                                this.showFilePreview(url, fileName);
                            } else {
                                // 其他文件类型:显示提示信息
                                this.showFilePreview('', fileName);
                            }
                        } else {
                            this.handlePreviewError(res.statusCode, fileName);
                        }
                    },
                    fail: (error) => {
                        uni.hideLoading();
                        this.handlePreviewError(0, fileName, error.errMsg);
                    }
                });
            },
            
            // 检测文件类型
            getFileType(fileName) {
                const fileExt = fileName.split('.').pop().toLowerCase();
                
                if (['txt', 'log', 'md', 'csv', 'json', 'xml'].includes(fileExt)) {
                    return 'text';
                } else if (['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(fileExt)) {
                    return 'image';
                } else if (['xls', 'xlsx', 'doc', 'docx', 'ppt', 'pptx'].includes(fileExt)) {
                    return 'excel';
                } else {
                    return 'unsupported';
                }
            },
            
            // 显示文件预览弹窗
            showFilePreview(content, fileName) {
                this.previewContent = content;
                this.previewTitle = fileName;
                this.previewItemNo = (this.selectedAttachment && this.selectedAttachment.itemNo) || '';
                this.previewType = this.getFileType(fileName);
                this.showFilePreviewPopup = true;
            },
            
            // 关闭文件预览弹窗
            closeFilePreview() {
                this.showFilePreviewPopup = false;
                this.previewContent = '';
                this.previewTitle = '';
                this.previewItemNo = '';
                this.previewType = '';
            },
            
            // 下载预览文件
            downloadPreviewFile() {
                const item = { fattach: this.previewTitle, itemNo: this.previewItemNo };
                this.downloadAttachment(item);
                this.closeFilePreview();
            },
            
            // 在弹窗中预览图片(放大功能)
            previewImageInPopup() {
                // 使用uni.previewImage API实现图片放大预览
                uni.previewImage({
                    current: this.previewContent, // 当前显示图片的链接
                    urls: [this.previewContent], // 需要预览的图片链接列表
                    loop: false, // 是否开启图片轮播
                    indicator: 'default', // 图片指示器类型
                    longPressActions: {
                        itemList: ['发送给朋友', '保存图片', '收藏'],
                        success: function (data) {
                            console.log('选中了第' + (data.tapIndex + 1) + '个按钮');
                        },
                        fail: function (err) {
                            console.log(err.errMsg);
                        }
                    },
                    success: () => {
                        console.log('图片预览成功');
                    },
                    fail: (err) => {
                        console.error('图片预览失败:', err);
                        uni.showToast({
                            title: '图片预览失败',
                            icon: 'none'
                        });
                    }
                });
            },
            
            // 预览Office文件
            previewOfficeFile(url, fileName) {
                // 先检查Excel文件,使用专门的Excel预览页面
                const fileExt = fileName.split('.').pop().toLowerCase();
                if (['xls', 'xlsx'].includes(fileExt)) {
                    // Excel文件预览
                    uni.request({
                        url: url,
                        method: 'GET',
                        responseType: 'arraybuffer',
                        success: (res) => {
                            if (res.statusCode === 200) {
                                const base64Data = uni.arrayBufferToBase64(res.data);
                                // 存储 Base64 数据到本地存储
                                uni.setStorageSync('excelBase64Data', base64Data);
                                uni.navigateTo({
                                    url: `/pages/fileView/excelView`
                                });
                            } else {
                                this.handlePreviewError(res.statusCode, fileName);
                            }
                        },
                        fail: (error) => {
                            this.handlePreviewError(0, fileName, error.errMsg);
                        }
                    });
                } else if (['doc', 'docx'].includes(fileExt)) {
                    // Word文件,尝试使用Word预览页面或者微软在线预览
                    try {
                        const officePreviewUrl = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`;
                        // 如果有webView页面,使用webView预览
                        this.previewGenericFile(officePreviewUrl, fileName);
                    } catch (error) {
                        this.handlePreviewError(0, fileName, '不支持此Office文件类型的预览');
                    }
                } else {
                    // 其他Office文件,使用微软在线预览服务
                    const officePreviewUrl = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`;
                    this.previewGenericFile(officePreviewUrl, fileName);
                }
            },
            
            // 通用文件预览
            previewGenericFile(url, fileName) {
                // 由于没有通用的webView页面,显示提示并提供下载
                uni.showModal({
                    title: '文件预览',
                    content: `文件 "${fileName}" 需要下载后查看,是否立即下载?`,
                    showCancel: true,
                    confirmText: '下载',
                    cancelText: '取消',
                    success: (res) => {
                        if (res.confirm) {
                            const item = { fattach: fileName, itemNo: this.selectedAttachment.itemNo };
                            this.downloadAttachment(item);
                        }
                    }
                });
            },
            
            // 处理预览错误
            handlePreviewError(statusCode, fileName, errorMsg = '') {
                let message = '';
                if (statusCode === 404) {
                    message = `文件 ${fileName} 在FTP服务器上不存在`;
                } else if (statusCode === 0) {
                    message = `预览失败:${errorMsg}`;
                } else {
                    message = `预览失败,状态码:${statusCode}`;
                }
                
                uni.showModal({
                    title: '预览失败',
                    content: message,
                    showCancel: true,
                    confirmText: '下载',
                    cancelText: '取消',
                    success: (res) => {
                        if (res.confirm) {
                            // 用户选择下载文件
                            const item = { fattach: fileName, itemNo: this.selectedAttachment.itemNo };
                            this.downloadAttachment(item);
                        }
                    }
                });
            },
            
            downloadAttachment(item) {
                // 去除所有空格、全角空格、回车、换行
                const fileName = item.fattach.replace(/[\s\u3000\r\n]+/g, '').trim();
                // 使用配置的服务器地址和FTP服务器地址
                const url = this.$store.state.serverInfo.serverAPI + "/LLJ/DownloadFtpFile?itemNo=" + encodeURIComponent(item.itemNo) + "&fileName=" + encodeURIComponent(fileName) + "&ftpServer=" + encodeURIComponent(this.$store.state.serverInfo.ftpServer);
                
                // 检查运行环境
                // #ifdef H5
                // H5环境:使用浏览器下载
                this.downloadFileInBrowser(url, fileName);
                // #endif
                
                // #ifdef APP-PLUS
                // APP环境:使用uni.downloadFile
                this.downloadFileInApp(url, fileName);
                // #endif
                
                // #ifdef MP
                // 小程序环境:使用uni.downloadFile
                this.downloadFileInApp(url, fileName);
                // #endif
            },
            
            // 在浏览器中下载文件
            downloadFileInBrowser(url, fileName) {
                uni.showLoading({ title: '正在准备下载...' });
                
                // 方法1:创建隐藏的a标签下载
                try {
                    const link = document.createElement('a');
                    link.href = url;
                    link.download = fileName;
                    link.style.display = 'none';
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);
                    
                    uni.hideLoading();
                    uni.showToast({ 
                        title: '下载已开始', 
                        icon: 'success',
                        duration: 2000
                    });
                } catch (error) {
                    console.log('a标签下载失败,尝试window.open方式:', error);
                    // 方法2:使用window.open
                    try {
                        window.open(url, '_blank');
                        uni.hideLoading();
                        uni.showToast({ 
                            title: '下载已开始', 
                            icon: 'success',
                            duration: 2000
                        });
                    } catch (error2) {
                        console.log('window.open下载失败,尝试fetch方式:', error2);
                        // 方法3:使用fetch下载
                        this.downloadFileWithFetch(url, fileName);
                    }
                }
            },
            
            // 使用fetch下载文件
            downloadFileWithFetch(url, fileName) {
                fetch(url)
                    .then(response => {
                        if (!response.ok) {
                            throw new Error(`HTTP error! status: ${response.status}`);
                        }
                        return response.blob();
                    })
                    .then(blob => {
                        // 创建blob URL
                        const blobUrl = window.URL.createObjectURL(blob);
                        
                        // 创建下载链接
                        const link = document.createElement('a');
                        link.href = blobUrl;
                        link.download = fileName;
                        link.style.display = 'none';
                        document.body.appendChild(link);
                        link.click();
                        document.body.removeChild(link);
                        
                        // 释放blob URL
                        window.URL.revokeObjectURL(blobUrl);
                        
                        uni.hideLoading();
                        uni.showToast({ 
                            title: '下载成功', 
                            icon: 'success',
                            duration: 2000
                        });
                    })
                    .catch(error => {
                        console.error('Fetch下载失败:', error);
                        uni.hideLoading();
                        if (error.message.includes('404')) {
                            uni.showModal({ 
                                title: '文件不存在', 
                                content: `该附件在FTP服务器上不存在`,
                                showCancel: false 
                            });
                        } else {
                            uni.showModal({ 
                                title: '下载失败', 
                                content: `下载失败: ${error.message}`,
                                showCancel: false 
                            });
                        }
                    });
            },
            
            // 在APP中下载文件
            downloadFileInApp(url, fileName) {
                // #ifdef APP-PLUS
                uni.showLoading({ title: '从FTP服务器下载中...' });
                
                // Android 获取存储路径
                const saveDir = plus.os.name === 'Android' ? plus.io.convertLocalFileSystemURL('_downloads/') : plus.io.convertLocalFileSystemURL('_documents/');
                const filePath = `${saveDir}${fileName}`;
                
                const downloadTask = uni.downloadFile({
                    url: url,
                    filePath: filePath, // 指定保存路径
                    success: (res) => {
                        uni.hideLoading();
                        if (res.statusCode === 200) {
                            const fileInfo = {
                                name: fileName,
                                path: res.filePath || filePath,
                                tempPath: res.tempFilePath
                            };
                            
                            uni.showModal({
                                title: '下载成功',
                                content: `文件已保存到:${fileInfo.path}`,
                                showCancel: true,
                                confirmText: '打开文件',
                                cancelText: '确定',
                                success: (modalRes) => {
                                    if (modalRes.confirm) {
                                        // 用户选择打开文件
                                        this.openFileInApp(fileInfo);
                                    }
                                }
                            });
                        } else if (res.statusCode === 404) {
                            uni.showModal({ 
                                title: '文件不存在', 
                                content: `该附件在FTP服务器上不存在`,
                                showCancel: false 
                            });
                        } else {
                            uni.showModal({ 
                                title: '下载失败', 
                                content: `状态码:${res.statusCode}`,
                                showCancel: false 
                            });
                        }
                    },
                    fail: (error) => {
                        uni.hideLoading();
                        console.error('下载失败:', error);
                        uni.showModal({ 
                            title: '下载失败', 
                            content: `网络错误:${error.errMsg}`,
                            showCancel: false 
                        });
                    }
                });
                
                // 监听下载进度
                downloadTask.onProgressUpdate((res) => {
                    const progress = Math.round(res.progress);
                    uni.showLoading({ 
                        title: `下载中 ${progress}%`,
                        mask: true 
                    });
                });
                // #endif
                
                // #ifdef MP
                // 小程序环境的简化实现
                uni.showLoading({ title: '下载中...' });
                uni.downloadFile({
                    url: url,
                    success: (res) => {
                        uni.hideLoading();
                        if (res.statusCode === 200) {
                            uni.showToast({ title: '下载完成', icon: 'success' });
                        }
                    },
                    fail: (error) => {
                        uni.hideLoading();
                        uni.showModal({ title: '下载失败', content: error.errMsg, showCancel: false });
                    }
                });
                // #endif
            },
            
            // APP中打开文件
            openFileInApp(fileInfo) {
                // #ifdef APP-PLUS
                if (typeof plus !== 'undefined') {
                    const filePath = fileInfo.path || fileInfo.tempPath;
                    
                    // 尝试打开文件
                    plus.runtime.openFile(filePath, {}, (error) => {
                        console.error('打开文件失败:', error);
                        uni.showModal({
                            title: '无法打开',
                            content: '系统中没有找到能打开此文件的应用程序',
                            showCancel: false
                        });
                    });
                }
                // #endif
            },
            
            
            // 全局堵穴相关方法
            // 检查检验项目是否有穴数
            hasHoleCount(fcheckItem) {
                if (!fcheckItem) return false;
                const match = fcheckItem.match(/[((](\d+)穴[))]/);
                return match ? true : false;
            },
            
            // 获取穴数
            getHoleCount(fcheckItem) {
                if (!fcheckItem) return 0;
                const match = fcheckItem.match(/[((](\d+)穴[))]/);
                return match ? parseInt(match[1]) : 0;
            },
            
            // 打开全局堵穴对话框
            openGlobalBlockHoleDialog() {
                console.log('点击堵穴设置按钮');
                console.log('tableData:', this.tableData);
                
                // 检查是否有有开穴数的检验项目
                const hasHoleItems = this.tableData.some(item => this.hasHoleCount(item.fcheckItem));
                console.log('hasHoleItems:', hasHoleItems);
                
                if (!hasHoleItems) {
                    uni.showModal({
                        title: '提示',
                        content: '当前检验单没有有开穴数的检验项目',
                        showCancel: false
                    });
                    return;
                }
                
                this.globalBlockHoleInput = '';
                this.globalBlockHolePopup = true;
                console.log('设置globalBlockHolePopup为true');
                this.validateGlobalBlockHoleInput();
            },
            
            // 关闭全局堵穴对话框
            closeGlobalBlockHoleDialog() {
                this.globalBlockHolePopup = false;
                this.globalBlockHoleInput = '';
                this.globalBlockHoleError = '';
                this.isGlobalBlockHoleValid = false;
            },
            
            
            // 处理全局堵穴输入(保留原方法以防其他地方调用)
            onGlobalBlockHoleInput(e) {
                console.log('输入事件触发:', e);
                // 兼容不同的事件格式
                const value = e.detail ? e.detail.value : e.target ? e.target.value : e;
                console.log('输入值:', value);
                this.globalBlockHoleInput = value;
                this.validateGlobalBlockHoleInput();
            },
            
            // 验证全局堵穴输入
            validateGlobalBlockHoleInput() {
                const input = this.globalBlockHoleInput.trim();
                if (!input) {
                    this.globalBlockHoleError = '';
                    this.isGlobalBlockHoleValid = false;
                    return;
                }
                
                // 验证格式:1,2,3 或 1,2,3
                const blockedHoles = input.split(/[,,]/).map(s => s.trim()).filter(s => s);
                
                // 检查是否都是有效数字
                const isValid = blockedHoles.every(hole => {
                    const num = parseInt(hole);
                    return !isNaN(num) && num > 0;
                });
                
                if (!isValid) {
                    this.globalBlockHoleError = '请输入有效的穴号,用逗号分隔';
                    this.isGlobalBlockHoleValid = false;
                    return;
                }
                
                // 检查是否有重复
                const uniqueHoles = [...new Set(blockedHoles.map(h => parseInt(h)))];
                if (uniqueHoles.length !== blockedHoles.length) {
                    this.globalBlockHoleError = '不能输入重复的穴号';
                    this.isGlobalBlockHoleValid = false;
                    return;
                }
                
                this.globalBlockHoleError = '';
                this.isGlobalBlockHoleValid = true;
            },
            
            // 确认全局堵穴
            confirmGlobalBlockHole() {
                if (!this.isGlobalBlockHoleValid) return;
                
                uni.showLoading({
                    title: '设置堵穴中...'
                });
                
                // 获取所有有开穴数的检验项目
                const holeItems = this.tableData.filter(item => this.hasHoleCount(item.fcheckItem));
                
                // 批量调用后端接口设置堵穴
                const promises = holeItems.map(item => {
                    return this.$post({
                        url: "/LLJ/SetBlockedHoles",
                        data: {
                            releaseNo: this.formData.releaseNo,
                            blockedHoles: this.globalBlockHoleInput,
                            itemId: item.id
                        }
                    });
                });
                
                Promise.all(promises).then(results => {
                    uni.hideLoading();
                    
                    // 检查所有请求是否成功
                    const failedCount = results.filter(res => res.status !== 0).length;
                    
                    if (failedCount === 0) {
                        uni.showToast({
                            title: `成功为${holeItems.length}个检验项目设置堵穴`,
                            icon: 'success',
                            duration: 2000
                        });
                        
                        // 立即关闭对话框
                        this.closeGlobalBlockHoleDialog();
                        
                        // 立即重新加载数据确保同步
                        setTimeout(() => {
                            this.init();
                        }, 500);
                    } else {
                        uni.showModal({
                            title: '部分设置失败',
                            content: `${failedCount}个检验项目设置失败,请重试`,
                            showCancel: false
                        });
                    }
                }).catch(err => {
                    uni.hideLoading();
                    console.error('全局堵穴设置失败:', err);
                    uni.showModal({
                        title: '网络错误',
                        content: '堵穴设置失败,请检查网络连接后重试',
                        showCancel: false
                    });
                });
            },
            
            
        }
    }
</script>
 
<style>
    /* 基础样式 */
    .inspection-sheet {
        font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
        max-width: 1000px;
        margin: 0 auto;
        padding: 20px 20px 100px 20px; /* 底部增加内边距为固定按钮留空间 */
        background-color: #fff;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        min-height: 100vh;
        position: relative;
        transition: all 0.3s ease;
    }
 
    /* 未维护且非紧急放行表单的紫色样式 */
    .inspection-sheet.unmaintained-form {
        background: linear-gradient(135deg, #f8f4ff 0%, #f0e6ff 100%);
        border: 2px solid #9c27b0;
        box-shadow: 0 0 20px rgba(156, 39, 176, 0.2);
    }
 
    .inspection-sheet.unmaintained-form .sheet-header {
        border-bottom: 2px solid #9c27b0;
    }
 
    .inspection-sheet.unmaintained-form .sheet-header h1 {
        color: #6a1b9a;
    }
 
    .inspection-sheet.unmaintained-form .inspection-number {
        color: #9c27b0;
    }
 
    .inspection-sheet.unmaintained-form .material-info {
        border: 1px solid #e1bee7;
        background-color: rgba(156, 39, 176, 0.05);
    }
 
    .inspection-sheet.unmaintained-form .info-label {
        color: #6a1b9a;
    }
 
    .inspection-sheet.unmaintained-form .info-value {
        color: #4a148c;
    }
 
    /* 头部样式 */
    .sheet-header {
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #e0e0e0;
    }
 
    .sheet-header h1 {
        color: #2c3e50;
        font-size: 24px;
        margin-bottom: 5px;
    }
 
    .inspection-number {
        font-size: 16px;
        font-weight: bold;
        color: #3498db;
    }
 
    /* 基本信息区样式 */
    .basic-info,
    .material-info {
        margin-bottom: 20px;
    }
 
    .info-row {
        display: flex;
        margin-bottom: 10px;
        flex-wrap: wrap;
    }
 
    .info-label {
        font-weight: bold;
        color: #34495e;
        min-width: 80px;
        margin-right: 5px;
    }
 
    .info-value {
        color: #2c3e50;
        margin-right: 20px;
    }
    
    .picker-text {
        padding: 6px 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background-color: white;
        color: #999;
        font-size: 14px;
        min-height: 32px;
        display: flex;
        align-items: center;
        max-width: 150px;
    }
    
    .picker-text.selected {
        color: #e74c3c;
        font-weight: 500;
    }
 
    .highlight {
        font-weight: bold;
        color: #e74c3c;
    }
 
    /* 物料信息区样式 */
    .material-info {
        border: 1px solid #eee;
        padding: 15px;
        border-radius: 5px;
    }
 
    .info-block {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
        flex-wrap: wrap;
    }
 
    .doc-links {
        margin-left: auto;
    }
 
    .doc-link {
        color: #3498db;
        text-decoration: none;
        margin-left: 15px;
        padding: 3px 8px;
        border: 1px solid #3498db;
        border-radius: 3px;
        font-size: 12px;
    }
 
    .sysLike {
        color: #1890ff;
        text-decoration: none;
        cursor: pointer;
    }
 
    .doc-link:hover {
        background-color: #f0f8ff;
    }
 
    /* 表格样式 */
    .inspection-table {
        margin: 25px 0;
    }
 
    .inspection-table table {
        width: 100%;
        border-collapse: collapse;
    }
 
    .inspection-table th,
    .inspection-table td {
        padding: 12px 15px;
        border: 1px solid #ddd;
        text-align: left;
    }
 
    .inspection-table th {
        background-color: #f8f9fa;
        font-weight: bold;
        color: #34495e;
    }
 
    .inspection-table tr:nth-child(even) {
        background-color: #f9f9f9;
    }
 
    .inspection-table tr:hover {
        background-color: #f1f5f9;
    }
 
    /* 表单上方操作按钮区样式 */
    .top-action-buttons {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin: 20px 0;
        padding: 15px;
        background-color: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }
 
    /* 表单下方操作按钮区样式 */
.bottom-action-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    flex-wrap: wrap;
    align-items: center;
    position: fixed; /* 固定在屏幕底部 */
    bottom: 0; /* 距离底部0px */
    left: 0; /* 距离左边0px */
    right: 0; /* 距离右边0px */
    background-color: #fff; /* 背景色 */
    border-top: 1px solid #e9ecef; /* 顶部边框 */
    z-index: 1000; /* 确保在最上层 */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); /* 顶部阴影 */
}
 
    .action-btn {
        background-color: #ecf0f1;
        color: #34495e;
        padding: 12px 15px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.3s ease;
        text-align: center;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
 
    .action-btn:hover {
        background-color: #d5dbdb;
        transform: translateY(-1px);
    }
 
    .action-btn.primary {
        background-color: #3498db;
        color: #fff;
    }
 
    .action-btn.primary:hover {
        background-color: #2980b9;
    }
 
    /* 小尺寸按钮样式 */
    .action-btn.small {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: 80px;
        max-width: 120px;
        flex: 1;
    }
 
    /* 原有按钮样式保持兼容 */
    .action-buttons {
        display: flex;
        gap: 10px;
        margin: 15px 0;
        justify-content: flex-end;
    }
 
    .secondary-btn {
        background-color: #ecf0f1;
        color: #7f8c8d;
        padding: 8px 15px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }
 
    .secondary-btn:hover {
        background-color: #d5dbdb;
    }
 
    .secondary-btn:disabled {
        background-color: #d9d9d9;
        cursor: not-allowed;
        opacity: 0.7;
    }
 
    .primary-btn {
        padding: 10px 20px;
        border: none;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s;
    }
 
    .primary-btn:hover {
        background-color: #2980b9;
    }
 
    .record-btn {
        padding: 6px 12px;
        background-color: #f8f9fa;
        border: 1px solid #ddd;
        /* border-radius: 3px; */
        cursor: pointer;
        transition: all 0.2s;
    }
 
    .record-btn:hover {
        background-color: #e9ecef;
    }
 
    /* 水印样式 */
    .watermark {
        position: absolute;
        font-size: 40px;
        font-weight: bold;
        opacity: 1;
        z-index: 1;
        pointer-events: none;
        transform: rotate(-15deg);
        width: 100%;
        text-align: center;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-15deg);
    }
 
    .watermark.approved {
        color: #2ecc71;
        /* 绿色 */
    }
 
    .watermark.rejected {
        color: #e74c3c;
        /* 红色 */
    }
 
    .watermark.pending {
        color: #f39c12;
        /* 橙色 */
    }
 
    /* 描述文本容器 */
    .description-text {
        position: relative;
        z-index: 2;
        padding: 25px;
        background-color: rgba(255, 255, 255, 0.7);
    }
 
    /* 调整表格单元格 */
    .inspection-table td:nth-child(2) {
        position: relative;
        overflow: hidden;
        padding: 0;
    }
 
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000; /* 提高层级,确保在固定按钮上方 */
    }
    
    /* 全局堵穴设置对话框需要更高的z-index */
    .global-block-hole-popup {
        z-index: 1001;
    }
 
    /* 弹窗整体美化 */
    .popup, .attachment-detail-popup {
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(60,60,60,0.18);
        padding: 28px 28px 18px 28px;
        border: none;
        position: relative;
        min-width: 260px;
        z-index: 1001; /* 确保弹窗内容在最上层 */
        max-height: 80vh; /* 限制最大高度,避免被底部按钮遮挡 */
        overflow-y: auto; /* 内容过多时可滚动 */
    }
    .attachment-popup-title {
        font-size: 22px;
        font-weight: 700;
        color: #222;
        margin-bottom: 8px;
        letter-spacing: 1px;
        text-align: center;
    }
    .attachment-popup-divider {
        height: 1px;
        background: linear-gradient(90deg,#e0e7ef 0%,#f5f7fa 100%);
        margin-bottom: 18px;
    }
    .attachment-detail-content {
        margin-bottom: 18px;
    }
    .attachment-detail-row {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
        font-size: 15px;
    }
    .attachment-label {
        min-width: 80px;
        color: #1976d2;
        font-weight: 500;
        margin-right: 8px;
    }
    .attachment-preview-area {
        margin: 18px 0 8px 0;
        border-radius: 10px;
        background: #f8fafc;
        padding: 10px;
        box-shadow: 0 2px 8px rgba(60,60,60,0.06);
    }
    .attachment-download-area {
        margin: 18px 0 8px 0;
        text-align: center;
    }
    .attachment-download-link {
        display: inline-block;
        padding: 7px 18px;
        background: linear-gradient(90deg,#4f8cff 0%,#1976d2 100%);
        color: #fff;
        border-radius: 6px;
        font-weight: 500;
        text-decoration: none;
        transition: background 0.2s;
        box-shadow: 0 2px 8px rgba(60,60,60,0.08);
    }
    .attachment-download-link:hover {
        background: linear-gradient(90deg,#1976d2 0%,#4f8cff 100%);
    }
    .attachment-detail-empty {
        color: #888;
        text-align: center;
        margin: 30px 0;
        font-size: 16px;
    }
    .attachment-popup-close {
        margin-top: 18px;
        width: 100%;
        background: linear-gradient(90deg,#e0e0e0 0%,#f5f7fa 100%);
        color: #444;
        border-radius: 8px;
        font-size: 16px;
        padding: 10px 0;
        border: none;
        font-weight: 600;
        letter-spacing: 1px;
        transition: background 0.2s, color 0.2s;
        box-shadow: 0 2px 8px rgba(60,60,60,0.06);
    }
    .attachment-popup-close:hover {
        background: linear-gradient(90deg,#bdbdbd 0%,#e0e0e0 100%);
        color: #1976d2;
    }
    
    /* 附件详情页面的操作按钮 */
    .attachment-actions-detail {
        margin: 20px 0;
        display: flex;
        gap: 12px;
        justify-content: center;
        flex-wrap: wrap;
    }
    .attachment-action-btn {
        padding: 10px 20px;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 120px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .attachment-action-btn.preview-btn {
        background: linear-gradient(135deg, #4CAF50, #45a049);
        color: white;
    }
    .attachment-action-btn.preview-btn:hover {
        background: linear-gradient(135deg, #45a049, #3d8b40);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    .attachment-action-btn.download-btn {
        background: linear-gradient(135deg, #2196F3, #1976D2);
        color: white;
    }
    .attachment-action-btn.download-btn:hover {
        background: linear-gradient(135deg, #1976D2, #1565C0);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    /* 文件预览弹窗样式 */
    .file-preview-popup {
        width: 80vw;
        max-width: 600px;
        max-height: 70vh;
        display: flex;
        flex-direction: column;
    }
    
    /* APP环境适配 */
    /* #ifdef APP-PLUS */
    .file-preview-popup {
        width: 85vw;
        max-height: 75vh;
    }
    .file-preview-content {
        max-height: 350px;
    }
    /* #endif */
    .file-preview-title {
        font-size: 18px;
        font-weight: 700;
        color: #222;
        margin-bottom: 8px;
        text-align: center;
        word-break: break-all;
    }
    .file-preview-divider {
        height: 1px;
        background: linear-gradient(90deg,#e0e7ef 0%,#f5f7fa 100%);
        margin-bottom: 16px;
    }
    .file-preview-content {
        flex: 1;
        max-height: 400px;
        overflow-y: auto;
        background: #f8fafc;
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 16px;
        border: 1px solid #e2e8f0;
    }
    .file-preview-content pre {
        font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
        font-size: 12px;
        line-height: 1.5;
        color: #2d3748;
        white-space: pre-wrap;
        word-wrap: break-word;
        margin: 0;
    }
    
    /* 图片预览样式 */
    .image-preview-container {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 200px;
    }
    
    /* 不支持文件类型的提示样式 */
    .unsupported-preview {
        text-align: center;
        padding: 40px 20px;
        color: #666;
    }
    .unsupported-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }
    .unsupported-text {
        font-size: 16px;
        font-weight: 600;
        color: #333;
        margin-bottom: 8px;
    }
    .unsupported-hint {
        font-size: 14px;
        color: #999;
        line-height: 1.4;
    }
    
    .file-preview-actions {
        display: flex;
        gap: 12px;
        justify-content: center;
    }
    .file-preview-btn {
        padding: 8px 20px;
        border: none;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 120px;
    }
    .file-preview-btn.download-btn {
        background: linear-gradient(135deg, #2196F3, #1976D2);
        color: white;
    }
    .file-preview-btn.download-btn:hover {
        background: linear-gradient(135deg, #1976D2, #1565C0);
        transform: translateY(-1px);
    }
    .file-preview-btn.close-btn {
        background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
        color: #444;
    }
    .file-preview-btn.close-btn:hover {
        background: linear-gradient(135deg, #bdbdbd, #9e9e9e);
        transform: translateY(-1px);
    }
    /* 列表弹窗美化(保留原有) */
    .attachment-list {
        padding: 0;
        margin: 0;
        list-style: none;
        max-height: 300px;
        overflow-y: auto;
    }
    .attachment-list li {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    .attachment-info {
        flex: 1;
        margin-right: 10px;
    }
    .attachment-name {
        color: #3498db;
        cursor: pointer;
        font-weight: 500;
        transition: color 0.2s;
        display: block;
        margin-bottom: 4px;
    }
    .attachment-name:hover {
        color: #217dbb;
        text-decoration: underline;
    }
    .attachment-meta {
        font-size: 12px;
    }
    .attachment-type {
        color: #7f8c8d;
        font-style: italic;
    }
    .attachment-actions {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
    }
    .attachment-list .secondary-btn {
        padding: 4px 10px;
        font-size: 13px;
        border-radius: 3px;
        background: #f5f7fa;
        color: #333;
        border: 1px solid #dbe2ea;
        transition: background 0.2s, color 0.2s;
    }
    .attachment-list .secondary-btn:hover {
        background: #e6f0fa;
        color: #1976d2;
    }
    .preview-btn {
        background: #e8f5e8 !important;
        color: #2e7d2e !important;
        border-color: #a5d6a5 !important;
    }
    .preview-btn:hover {
        background: #d4eecc !important;
        color: #1e5f1e !important;
    }
    .attachment-popup-close {
        margin-top: 18px;
        width: 100%;
        background: #e0e0e0;
        color: #444;
        border-radius: 4px;
        font-size: 15px;
        padding: 8px 0;
        border: none;
        transition: background 0.2s;
    }
    .attachment-popup-close:hover {
        background: #bdbdbd;
    }
 
    /* 响应式设计 */
    @media (max-width: 500px) {
 
        .info-row,
        .info-block {
            flex-direction: column;
            align-items: flex-start;
        }
 
        .doc-links {
            margin-left: 0;
            margin-top: 10px;
        }
 
        .top-action-buttons {
            flex-direction: column;
            align-items: stretch;
        }
 
        .bottom-action-buttons {
            flex-direction: row;
            align-items: center;
            justify-content: center;
            padding: 8px;
            gap: 6px;
            position: fixed; /* 保持固定在屏幕底部 */
            bottom: 0;
            left: 0;
            right: 0;
            background-color: #fff;
            border-top: 1px solid #e9ecef;
            z-index: 1000;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        }
 
        .action-btn.small {
            min-width: 70px;
            max-width: 100px;
            padding: 8px 10px;
            font-size: 13px;
            min-height: 40px;
        }
 
        .inspection-table table {
            display: block;
            overflow-x: auto;
        }
    }
    
    /* 图片放大预览相关样式 */
    .preview-image-clickable {
        transition: transform 0.2s ease;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .preview-image-clickable:hover {
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .image-zoom-hint {
        text-align: center;
        margin-top: 8px;
        font-size: 12px;
        color: #666;
        font-style: italic;
    }
    
    .image-preview-container {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    /* 扫描按钮样式 */
    .scan-btn {
        background: linear-gradient(135deg, #4CAF50, #45a049);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 12px 20px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .scan-btn:hover {
        background: linear-gradient(135deg, #45a049, #3d8b40);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    /* 物料信息显示样式 */
    .material-info-display {
        margin-top: 16px;
        padding: 16px;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef);
        border-radius: 8px;
        border: 1px solid #dee2e6;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .material-info-display h4 {
        margin: 0 0 12px 0;
        color: #495057;
        font-size: 16px;
        font-weight: 600;
        text-align: center;
    }
    
    .material-detail {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .detail-row {
        display: flex;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #e9ecef;
    }
    
    .detail-row:last-child {
        border-bottom: none;
    }
    
    .detail-label {
        min-width: 80px;
        font-weight: 600;
        color: #6c757d;
        font-size: 14px;
    }
    
    .detail-value {
        flex: 1;
        color: #212529;
        font-size: 14px;
        font-weight: 500;
        word-break: break-all;
    }
    
    .detail-value.barcode-value {
        font-family: 'Courier New', monospace;
        font-weight: 600;
        color: #2c3e50;
        background-color: #f8f9fa;
        padding: 4px 8px;
        border-radius: 4px;
        border: 1px solid #dee2e6;
        font-size: 13px;
        letter-spacing: 0.5px;
    }
    
    /* 破坏实验弹窗样式 */
    .destruction-popup {
        width: 90vw;
        max-width: 500px;
        min-height: 300px;
    }
    
    /* 扫描步骤样式 */
    .scan-step {
        text-align: center;
        padding: 40px 20px;
    }
    
    /* 已有记录步骤样式 */
    .existing-record-step {
        padding: 20px;
        text-align: center;
    }
    
    .existing-icon {
        font-size: 48px;
        text-align: center;
        margin-bottom: 16px;
    }
    
    .existing-title {
        font-size: 18px;
        font-weight: 600;
        color: #2c3e50;
        text-align: center;
        margin-bottom: 12px;
    }
    
    .existing-description {
        font-size: 14px;
        color: #7f8c8d;
        text-align: center;
        margin-bottom: 20px;
    }
    
    /* 当前破坏实验数量显示 */
    .current-phsy-display {
        margin: 20px 0;
        padding: 16px;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef);
        border-radius: 8px;
        border: 1px solid #dee2e6;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .phsy-info {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    .phsy-label {
        font-size: 16px;
        font-weight: 600;
        color: #495057;
    }
    
    .phsy-value {
        font-size: 18px;
        font-weight: 700;
        color: #e74c3c;
        background-color: #fff;
        padding: 4px 12px;
        border-radius: 4px;
        border: 1px solid #e74c3c;
    }
    
    .scan-icon {
        font-size: 64px;
        margin-bottom: 20px;
        opacity: 0.8;
    }
    
    .scan-title {
        font-size: 20px;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 12px;
    }
    
    .scan-description {
        font-size: 14px;
        color: #7f8c8d;
        margin-bottom: 30px;
        line-height: 1.5;
    }
    
    /* 扫描步骤按钮布局 */
    .scan-actions {
        display: flex;
        gap: 12px;
        justify-content: center;
        align-items: center;
    }
    
    /* 结果步骤样式 */
    .result-step {
        padding: 20px;
    }
    
    .scan-success-icon {
        font-size: 48px;
        text-align: center;
        margin-bottom: 16px;
    }
    
    .scan-success-title {
        font-size: 18px;
        font-weight: 600;
        color: #27ae60;
        text-align: center;
        margin-bottom: 20px;
    }
    
    /* 破坏实验操作按钮样式 */
    .destruction-actions {
        display: flex;
        gap: 8px;
        margin-top: 24px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .destruction-btn {
        padding: 10px 16px;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        min-width: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
        max-width: 120px;
    }
    
    .destruction-btn.confirm-btn {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        color: white;
        box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
    }
    
    .destruction-btn.confirm-btn:hover:not(:disabled) {
        background: linear-gradient(135deg, #229954, #27ae60);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
    }
    
    .destruction-btn.confirm-btn:disabled {
        background: #bdc3c7;
        color: #7f8c8d;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }
    
    .destruction-btn.cancel-btn {
        background: linear-gradient(135deg, #95a5a6, #7f8c8d);
        color: white;
        box-shadow: 0 2px 8px rgba(149, 165, 166, 0.3);
    }
    
    .destruction-btn.cancel-btn:hover {
        background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(149, 165, 166, 0.4);
    }
    
    .destruction-btn.modify-btn {
        background: linear-gradient(135deg, #f39c12, #e67e22);
        color: white;
        box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
    }
    
    .destruction-btn.modify-btn:hover {
        background: linear-gradient(135deg, #e67e22, #d35400);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
    }
    
    .destruction-btn.delete-btn {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        color: white;
        box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    }
    
    .destruction-btn.delete-btn:hover {
        background: linear-gradient(135deg, #c0392b, #a93226);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
    }
    
    /* 表单输入框样式优化 */
    .form-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        font-size: 16px;
        transition: border-color 0.3s ease;
        box-sizing: border-box;
        background-color: #fff !important;
        color: #333 !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
        pointer-events: auto !important;
        opacity: 1 !important;
        z-index: 1 !important;
    }
    
    .form-input:focus {
        border-color: #3498db;
        outline: none;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
        background-color: #fff;
    }
    
    /* 简单输入框样式 - 参考SJ.vue */
    .info-input {
        flex: 1;
        padding: 12px 16px;
        border: 2px solid #ddd;
        border-radius: 6px;
        background-color: white;
        font-size: 16px;
        width: 100%;
        box-sizing: border-box;
        min-height: 44px;
        line-height: 1.4;
    }
    
    .info-input:focus {
        border-color: #3498db;
        outline: none;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    /* 输入框包装器 */
    .input-wrapper {
        position: relative;
        width: 100%;
    }
    
    /* 破坏实验输入框特殊样式 */
    .destruction-input {
        background-color: #fff !important;
        border: 2px solid #e9ecef !important;
        color: #333 !important;
        font-size: 16px !important;
        padding: 12px 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        pointer-events: auto !important;
        opacity: 1 !important;
        z-index: 1 !important;
    }
    
    .destruction-input:focus {
        border-color: #3498db !important;
        background-color: #fff !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1) !important;
    }
    
    .destruction-input:disabled {
        background-color: #f5f5f5 !important;
        color: #999 !important;
        cursor: not-allowed !important;
    }
    
    /* uni-easyinput 样式 */
    .destruction-input-uni {
        width: 100% !important;
    }
    
    .destruction-input-uni .uni-easyinput__content {
        border: 2px solid #e9ecef !important;
        border-radius: 8px !important;
        background-color: #fff !important;
    }
    
    .destruction-input-uni .uni-easyinput__content-input {
        font-size: 16px !important;
        color: #333 !important;
        padding: 12px 16px !important;
    }
    
    /* 模拟输入框样式 */
    .fake-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        background-color: #fff;
        font-size: 16px;
        color: #333;
        cursor: pointer;
        transition: border-color 0.3s ease;
        box-sizing: border-box;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .fake-input:hover {
        border-color: #3498db;
    }
    
    .fake-input.error {
        border-color: #e74c3c;
    }
    
    .fake-input .placeholder {
        color: #999;
    }
    
    /* 简化的输入框样式 */
    .simple-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        font-size: 16px;
        color: #333;
        background-color: #fff;
        box-sizing: border-box;
        outline: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
        -webkit-tap-highlight-color: transparent;
    }
    
    .simple-input:focus {
        border-color: #3498db;
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    
    /* 重新设计的输入区域样式 */
    .input-section {
        margin: 20px 0;
        padding: 20px;
        background: #f8f9fa;
        border-radius: 12px;
        border: 1px solid #e9ecef;
    }
    
    .input-title {
        font-size: 16px;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 12px;
        text-align: center;
    }
    
    .input-container {
        display: flex;
        justify-content: center;
        margin-bottom: 8px;
    }
    
    .input-box {
        width: 200px;
        height: 50px;
        border: 2px solid #3498db;
        border-radius: 8px;
        background-color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .input-box:hover {
        border-color: #2980b9;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        transform: translateY(-1px);
    }
    
    .input-box:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .input-value {
        font-size: 18px;
        font-weight: 600;
        color: #2c3e50;
    }
    
    .input-placeholder {
        font-size: 16px;
        color: #7f8c8d;
        font-style: italic;
    }
    
    .error-tip {
        text-align: center;
        color: #e74c3c;
        font-size: 14px;
        margin-top: 8px;
    }
    
    .form-label {
        display: block;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 8px;
        font-size: 14px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    /* 错误信息样式 */
    .error-message {
        color: #e74c3c;
        font-size: 12px;
        margin-top: 4px;
        text-align: center;
    }
    
    /* 堵穴相关样式 */
    .block-hole-btn {
        background-color: #f39c12;
        color: white;
        padding: 6px 12px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 12px;
        transition: all 0.3s ease;
    }
    
    .block-hole-btn:hover:not(.disabled) {
        background-color: #e67e22;
        transform: translateY(-1px);
    }
    
    .block-hole-btn.disabled {
        background-color: #bdc3c7;
        color: #7f8c8d;
        cursor: not-allowed;
    }
    
    .blocked-info {
        color: #e74c3c;
        font-size: 12px;
        margin-left: 8px;
        font-weight: bold;
    }
    
    .block-hole-popup,
    .global-block-hole-popup {
        width: 80vw;
        max-width: 500px;
        min-height: 300px;
    }
    
    .block-hole-content {
        padding: 20px;
    }
    
    .hole-info {
        margin-bottom: 20px;
        padding: 15px;
        background-color: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }
    
    .hole-info .info-label {
        font-weight: 600;
        color: #495057;
        margin-bottom: 8px;
        display: block;
    }
    
    .input-section {
        margin-bottom: 20px;
    }
    
    .input-label {
        font-weight: 600;
        color: #495057;
        margin-bottom: 8px;
        display: block;
    }
    
    .block-hole-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        font-size: 16px;
        transition: border-color 0.3s ease;
        box-sizing: border-box;
        background-color: #fff !important;
        color: #333 !important;
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
        pointer-events: auto !important;
        opacity: 1 !important;
        /* 移除z-index,避免遮挡弹窗 */
    }
    
    .block-hole-input:focus {
        border-color: #3498db;
        outline: none;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    .block-hole-actions {
        display: flex;
        gap: 12px;
        justify-content: center;
        margin-top: 20px;
    }
    
    .block-hole-btn.confirm {
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        color: white;
        padding: 12px 24px;
        min-width: 100px;
    }
    
    .block-hole-btn.confirm:hover:not(:disabled) {
        background: linear-gradient(135deg, #229954, #27ae60);
    }
    
    .block-hole-btn.confirm:disabled {
        background: #bdc3c7;
        color: #7f8c8d;
        cursor: not-allowed;
    }
    
    .block-hole-btn.cancel {
        background: linear-gradient(135deg, #95a5a6, #7f8c8d);
        color: white;
        padding: 12px 24px;
        min-width: 100px;
    }
    
    .block-hole-btn.cancel:hover {
        background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    }
    
    
    .blocked-holes-info {
        color: #e74c3c;
        font-weight: bold;
        margin-left: 8px;
    }
</style>