schangxiang@126.com
2024-11-21 60735779c303c2dd10feea45d7fd761103b225e0
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
<template>
  <!-- 添加、编辑、 打印-->
  <el-dialog v-model="dialogVisible" width="95%" @close="closeDialog" :close-on-click-modal="false">
    <template #header>
      <div style="color: #fff">
        <span v-if="dialogType == 'add'">
          添加
        </span>
        <span v-if="dialogType == 'edit'">
          编辑
        </span>
        <span v-if="dialogType == 'print'">
          打印
        </span>
      </div>
    </template>
 
    <!-- 添加  编辑-->
    <div v-if="dialogType != 'print'">
      <el-form :model="addForm" ref="dialogRef" labelWidth="90" :rules="formRules" style="width: 60%">
        <el-row>
          <!-- 后端默认是 ASN单 update by liuwq 2024-05-23 -->
 
          <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                    <el-form-item  label="订单类型" prop="asnType">
                        <el-select :disabled="dialogType != 'add'" clearable v-model="addForm.asnType" placeholder="请选择订单类型">
                            <el-option v-for="(item, index) in getEnumOrderTypeData" :key="index" :value="item.value"
                                :label="`${item.describe}`"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col> -->
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="8" class="mb10">
            <el-form-item label="业务类型" prop="businessType">
              <el-select clearable v-model="addForm.businessType" placeholder="请选择业务类型" :disabled="showYwlx">
                <el-option v-for="(item, index) in getBusinessTypeData_Index" :key="index" :value="item.businessTypeValue"
                  :label="`[${item.businessTypeValue}] ${item.businessTypeName}`"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
          <el-form-item label="自动生成条码">
            <el-switch v-model="addForm.hasTMCode" active-text="是" inactive-text="否" />
          </el-form-item>
        </el-col>
        <el-col
          :xs="24"
          :sm="12"
          :md="12"
          :lg="8"
          :xl="4"
          class="mb10"
          v-show="addForm.hasTMCode"
        >
          <el-form-item label="条码类型">
            <el-switch
              v-model="addForm.typeTMCode"
              active-text="一维"
              inactive-text="二维"
            />
          </el-form-item> 
        </el-col> -->
 
          <!-- 默认ERP库存地 -->
          <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
          <el-form-item label="供应商编号" prop="supplierCode">
            <el-select
              v-model="addForm.supplierCode"
              filterable
              remote
              reserve-keyword
              remote-show-suffix
              :remote-method="remoteMethod"
              :loading="loading"
              placeholder="请选择替代品物料编号"
              clearable
              style="width: 100%"
              @change="changeXmbh(addForm.supplierCode)"
            >
              <el-option
                v-for="(item, index) in arrTdp"
                :key="index"
                :value="item.custCode"
                :label="`[${item.custCode}]${item.custChinaName}`"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col> -->
 
          <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
          <el-form-item label="ERP单号" prop="erpOrderNo">
            <el-input
              v-model="addForm.erpOrderNo"
              placeholder="请输入ERP单号"
              maxlength="50"
              show-word-limit
              clearable
            />
          </el-form-item>
        </el-col> -->
 
          <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                    <el-form-item label="项目号" prop="projectNo">
                        <el-input v-model="addForm.projectNo" placeholder="请输入项目号" maxlength="50" show-word-limit
                            clearable />
                    </el-form-item>
                </el-col> -->
        </el-row>
      </el-form>
      <div class="msi-content" style="margin-top: 10px">
        <div class="header" style="margin-bottom: 10px">
          <div>
            <el-button v-show="isMaterialBox == true" type="primary" icon="el-icon-plus"
              @click="addMaterialDialog">新增物料</el-button>
            <el-button v-show="isPoBox == true" type="primary" icon="el-icon-plus"
              @click="addMaterialDialog('po')">关联PO单</el-button>
 
            <el-button icon="el-icon-delete" plain :disabled="checkedDetails.length == 0"
              @click="delCheckedDetails">删除选中行</el-button>
          </div>
        </div>
        <el-table :data="warehousOrderDetails" border style="width: 100%" row-key="setRowKey" ref="detailRef"
          v-loading="loading" @selection-change="detailsCheckChange" max-height="480">
          <el-table-column align="center" width="60" type="selection" />
          <el-table-column fixed="left" label="序号" align="center" width="60" type="index" />
          <el-table-column fixed="left" label="物料编号" min-width="140" prop="materialCode" align="center"
            show-overflow-tooltip />
          <el-table-column label="物料名称" min-width="100" prop="materialName" align="center" show-overflow-tooltip />
          <el-table-column v-if="isPoBox == 1" label="PO单号" min-width="130" prop="poNo" align="center"
            show-overflow-tooltip />
 
          <el-table-column v-if="isPoBox == 1" label="PO行号" prop="poLineNumber" align="center" min-width="120">
            <template #default="scope">
              {{ scope.row.poLineNumber }}
            </template>
          </el-table-column>
 
          <el-table-column label="ASN行号" prop="asnLineNumber" align="center" v-if="dialogType != 'add'" min-width="120">
            <template #default="scope">
              {{ scope.row.asnLineNumber }}
            </template>
          </el-table-column>
 
          <el-table-column label="数量" align="center" min-width="150">
            <template #default="scope">
              <el-input-number :precision="3" min="0" v-model="scope.row.poQuantity" size="small" />
            </template>
          </el-table-column>
 
          <el-table-column label="计划开始时间" align="center" min-width="180">
            <template #default="scope">
              <el-date-picker v-model="scope.row.plannedStartTime" type="datetime" :disabled-date="disabledDate"
                value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" placeholder="请选择计划开始时间"
                style="width: 100%" />
            </template>
          </el-table-column>
          <el-table-column label="计划结束时间" align="center" min-width="180">
            <template #default="scope">
              <el-date-picker v-model="scope.row.plannedEndTime" type="datetime" :disabled-date="disabledDate"
                value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" placeholder="请选择计划结束时间"
                style="width: 100%" />
            </template>
          </el-table-column>
 
          <el-table-column label="供应商" align="center" min-width="180">
            <template #default="scope">
              <!--       @click="changeXmbh(scope.row.supplierCode,scope.row.materialCode,scope.row)"  
                   :loading="loading"
                placeholder="请选择供应商"
                clearable
                
                :remote = "false"
                :defaultActiveFirstOption="false"
                reserve-keyword
                remote-show-suffix      :remote-method="remoteMethod(scope.row.supplierCode,scope.row.materialName)"
                
                
                        
                :loading="loading"
                placeholder="请选择供应商"
                clearable
                filterable
                :defaultActiveFirstOption="false"
                reserve-keyword
                remote-show-suffix    
                :remote-method="(val:any) => changeXmbh(val,scope.row.materialName)" 
                
                      -->
              <el-select filterable v-model="scope.row.supplierCode" style="width: 100%"
                @click.native="changeXmbh(scope.row.supplierCode, scope.row.materialCode, scope.row)">
                <el-option v-for="(item, index) in scope.row.arrTdp" :key="index" :value="item.custCode"
                  :label="`[${item.custCode}]${item.custChinaName}`"></el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="供应商批次" prop="supplierBatch" align="center" min-width="120">
            <template #default="scope">
              <el-input v-model.trim="scope.row.supplierBatch" clearable min-width="150" placeholder="请输入供应商批次" />
            </template>
          </el-table-column>
 
          <el-table-column label="ERP库存地" prop="erpCode" align="center" min-width="120">
            <template #default="scope">
              <el-input v-model.trim="scope.row.erpCode" clearable min-width="150" placeholder="请输入ERP库存地" />
            </template>
          </el-table-column>
 
          <el-table-column label="项目号" prop="projectNo" align="center" min-width="120">
            <template #default="scope">
              <el-input v-model.trim="scope.row.projectNo" clearable min-width="150" placeholder="请输入项目号" />
            </template>
          </el-table-column>
 
          <el-table-column label="收货道口" prop="dock" align="center" min-width="120">
            <template #default="scope">
              <!-- <el-input v-model.trim="scope.row.dock" clearable min-width="150" placeholder="请输入收货道口" /> -->
 
              <el-select clearable v-model="scope.row.dock" placeholder="请选择收货道口">
                <el-option v-for="(item, index) in getEnumDockData" :key="index" :value="item.value"
                  :label="`${item.describe}`"></el-option>
              </el-select>
            </template>
          </el-table-column>
 
          <el-table-column label="是否冻结" prop="isFreeze" align="center" min-width="120">
            <template #default="scope">
              <el-switch v-model="scope.row.isFreeze" active-text="是" inactive-text="否" />
            </template>
          </el-table-column>
 
          <el-table-column label="冻结原因" prop="freezeReason" align="center" min-width="120">
            <template #default="scope">
              <el-input v-model="scope.row.freezeReason" placeholder="请输入冻结原因" maxlength="255" show-word-limit
                clearable />
            </template>
          </el-table-column>
 
          <el-table-column label="采购单位" min-width="80" prop="poUnit" align="center" show-overflow-tooltip />
          <el-table-column label="库存单位" min-width="80" prop="materialUnit" align="center" show-overflow-tooltip />
        </el-table>
      </div>
    </div>
    <!-- 打印 -->
    <div v-if="dialogType == 'print'">
      <el-table :data="warehousOrderDetails" border style="width: 100%" row-key="setRowKey" ref="detailRef"
        @selection-change="detailsCheckChange" max-height="480">
        <el-table-column align="center" width="60" type="selection" />
        <el-table-column fixed="left" label="序号" align="center" width="60" type="index" />
        <el-table-column fixed="left" label="物料编号" min-width="140" prop="materialCode" align="center"
          show-overflow-tooltip />
        <el-table-column label="物料名称" min-width="100" prop="materialName" align="center" show-overflow-tooltip />
 
        <el-table-column label="ASN行号" prop="asnLineNumber" align="center" min-width="120">
          <template #default="scope">
            {{ scope.row.asnLineNumber }}
          </template>
        </el-table-column>
        <el-table-column label="数量" align="center" min-width="150">
          <template #default="scope">
            {{ scope.row.quantity }}
          </template>
        </el-table-column>
 
        <el-table-column label="计划开始时间" align="center" min-width="180">
          <template #default="scope">
            {{ scope.row.plannedStartTime }}
          </template>
        </el-table-column>
        <el-table-column label="计划结束时间" align="center" min-width="180">
          <template #default="scope">
            {{ scope.row.plannedEndTime }}
          </template>
        </el-table-column>
 
        <el-table-column label="供应商" align="center" min-width="180">
          <template #default="scope">
            {{ scope.row.supplierCode }}
          </template>
        </el-table-column>
        <el-table-column label="供应商批次" prop="supplierBatch" align="center" min-width="120">
          <template #default="scope">
            {{ scope.row.supplierBatch }}
          </template>
        </el-table-column>
        <el-table-column label="库存单位" min-width="80" prop="materialUnit" align="center" show-overflow-tooltip />
 
        <el-table-column prop="sN_1d" min-width="120px" label="一维条码" show-overflow-tooltip="" />
        <el-table-column prop="sN_2d" min-width="120px" label="二维条码" show-overflow-tooltip="" />
 
      </el-table>
 
    </div>
 
 
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" :disabled="disabled_btn" @click="confirm">确认</el-button>
      </span>
    </template>
  </el-dialog>
  <!-- 添加物料 -->
  <el-dialog v-model="addMaterialVisible" width="80%" @close="closeMaterialDialog">
    <template #header>
      <div style="color: #fff">
        <span v-if="isMaterialBox == 1">添加物料详情</span>
        <span v-if="isPoBox == 1">关联PO单物料</span>
      </div>
    </template>
 
    <div class="msi-form" style="padding-top: 0px">
      <el-form :model="materialForm" labelWidth="90">
        <el-row>
          <el-col :span="8" v-if="isMaterialBox == 1">
            <el-form-item label="物料编号">
              <el-input v-model="materialForm.materialCode" placeholder="请输入物料编号" clearable></el-input>
            </el-form-item>
          </el-col>
          <!-- 关联PO单号 -->
 
          <el-col :span="6" v-if="isPoBox == 1">
            <el-form-item label="PO单号:">
              <el-input v-model="materialForm.poNo" placeholder="请输入PO单号" clearable></el-input>
            </el-form-item>
          </el-col>
 
          <el-col :span="6" v-if="isPoBox == 1">
            <el-form-item label="项目号" prop="projectNo">
              <el-input v-model="materialForm.projectNo" placeholder="请输入项目号" maxlength="50" show-word-limit clearable />
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="isPoBox == 1">
            <el-form-item label="物料编号">
              <el-input v-model="materialForm.materialCode" placeholder="请输入物料编号" clearable></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="isPoBox == 1" style="margin-bottom: 10px">
            <el-form-item label="供应商" prop="supplierCode">
              <el-select v-model="materialForm.supplierCode" filterable remote reserve-keyword remote-show-suffix
                :remote-method="remoteMethod2" :loading="loading" placeholder="请选择供应商" clearable style="width: 100%">
                <el-option v-for="(item, index) in arrTdp2" :key="index" :value="item.custCode"
                  :label="`[${item.custCode}]${item.custChinaName}`"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
 
          <el-col :span="6" v-if="isPoBox == 1">
            <el-form-item label="计划时间">
              <el-date-picker placeholder="请选择计划时间" value-format="YYYY/MM/DD" type="daterange"
                v-model="materialForm.plannedStartTimeRange" />
            </el-form-item>
          </el-col>
 
          <!-- <el-form-item label="计划时间">
              <el-date-picker placeholder="请选择计划时间" value-format="YYYY/MM/DD" type="datetime" v-model="materialForm.plannedStartTimeRange" />
            </el-form-item> -->
 
          <!-- <el-col :span="6" v-if="isPoBox == 1">
            <el-form-item label="计划结束时间">
              <el-date-picker placeholder="请选择计划结束时间" value-format="YYYY/MM/DD" type="datetime" v-model="materialForm.plannedEndTimeRange" />
            </el-form-item>
          </el-col> -->
 
          <el-col :span="4">
            <el-form-item label-width="20px">
              <el-button type="primary" icon="el-icon-search" @click="getMaterialList">查询</el-button>
              <!-- <el-button icon="el-icon-refresh-right" @click="resetMaterialForm">重置</el-button> -->
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="msi-content" style="padding-top: 0; margin-top: 10px">
      <el-table :data="materialList" border style="width: 100%" row-key="id" ref="materialRef"
        @selection-change="materialSelectionChange" :max-height="480" v-if="isMaterialBox == 1">
        <el-table-column align="center" width="60" type="selection" />
        <el-table-column label="序号" align="center" width="60" type="index" />
        <el-table-column label="物料编号" prop="materialCode" align="center" min-width="140px" show-overflow-tooltip />
        <el-table-column label="物料名称" prop="materialName" align="center" min-width="140px" show-overflow-tooltip />
        <el-table-column prop="isCheck" label="是否质检" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag v-if="scope.row.isCheck"> 是 </el-tag>
            <el-tag type="danger" v-else> 否 </el-tag>
 
          </template>
        </el-table-column>
        <el-table-column label="采购单位" prop="poUnit" align="center" show-overflow-tooltip />
        <el-table-column label="库存单位" prop="materialUnit" align="center" show-overflow-tooltip />
      </el-table>
      <!-- PO单 -->
      <el-table :data="materialList" border style="width: 100%" row-key="id" ref="materialRef"
        @selection-change="materialSelectionChange" :max-height="480" v-if="isPoBox == 1">
        <el-table-column align="center" width="60" type="selection" />
        <el-table-column label="序号" align="center" width="60" type="index" />
        <el-table-column prop="poNo" label="PO单号" min-width="160px" show-overflow-tooltip="" />
        <el-table-column prop="poLineNumber" label="PO行号" show-overflow-tooltip="" />
        <!-- <el-table-column prop="erpOrderNo" label="ERP单号" show-overflow-tooltip="" /> -->
        <!-- <el-table-column prop="erpCode" label="ERP库存地" show-overflow-tooltip="" /> -->
        <el-table-column prop="materialCode" label="物料编号" min-width="120px" show-overflow-tooltip="" />
        <el-table-column prop="materialName" label="物料名称" min-width="120px" show-overflow-tooltip="" />
        <el-table-column prop="poDetailStatusName" label="单据状态" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag :type="getTypeStatus(1, scope.row.poDetailStatusName)">{{ scope.row.poDetailStatusName }} </el-tag>
          </template>
        </el-table-column>
 
        <el-table-column prop="quantity" label="数量" show-overflow-tooltip="" />
        <!-- <el-table-column prop="goodsQuantity" label="已收数量" show-overflow-tooltip="" /> -->
        <el-table-column prop="createASNQuantity" min-width="110px" label="已创建ASN数量" show-overflow-tooltip="" />
 
 
        <el-table-column prop="usedQty" label="剩余可用数" show-overflow-tooltip="">
          <template #default="scope">
            <span> {{ Number(scope.row.usedQty).toFixed(3).replace(/\.?0*$/, '') }} </span>
          </template>
        </el-table-column>
 
 
        <el-table-column prop="snp" label="标包数量" show-overflow-tooltip="">
          <template #default="scope">
            <span> {{ scope.row.snp }} </span>
          </template>
        </el-table-column>
 
        <!-- <el-table-column prop="printQuantity" label="条码打印数量" show-overflow-tooltip="" /> -->
 
        <!-- <el-table-column prop="poDetailStatus" label="状态" show-overflow-tooltip="">
                    <template #default="scope">
                        {{ scope.row.poDetailStatus }}
                        <el-tag>{{ getEnumDesc(scope.row.poDetailStatus, getEnumPoDetailStatusData_Index) }}</el-tag>
                    </template>
                </el-table-column> -->
        <el-table-column prop="supplierCode" label="供应商编号" show-overflow-tooltip="" />
        <el-table-column prop="supplierName" label="供应商名称" show-overflow-tooltip="" />
        <el-table-column prop="plannedStartTime" label="计划开始时间" min-width="130px" show-overflow-tooltip="" />
        <el-table-column prop="plannedEndTime" label="计划结束时间" min-width="130px" show-overflow-tooltip="" />
        <el-table-column prop="projectNo" min-width="100px" label="项目号" show-overflow-tooltip="" />
 
        <!-- <el-table-column prop="dock" min-width="100px" label="收货道口" show-overflow-tooltip="" /> -->
 
        <!-- <el-table-column prop="createTime" label="创建时间" width="130" :formatter="formatDate_T_Time" show-overflow-tooltip="" />
                <el-table-column prop="updateTime" label="修改时间" width="130" :formatter="formatDate_T_Time" show-overflow-tooltip="" />
                <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip="" />
                <el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip="" /> -->
      </el-table>
 
      <Pagination :total="materialTotal" v-model:page="materialForm.Page" v-model:limit="materialForm.PageSize"
        @pagination="getMaterialList" style="margin-top: 20px; text-align: center"></Pagination>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="addMaterialVisible = false">取消</el-button>
        <el-button type="primary" @click="confirmAddMaterial">确认</el-button>
      </span>
    </template>
  </el-dialog>
  <!-- 单详情 -->
  <el-drawer v-model="drawerVisible" :title="`${detailForm.asnId}订单详情`" direction="rtl" size="80%"
    @close="handleDrawerClose">
    <template #title>
      <div class="slot_title">
        <div class="title_orderNo">{{ title }}</div>
        <div>订单详情</div>
      </div>
    </template>
 
    <div class="detailBoxWrap">
      <!-- 详情组件 -->
      <open-details ref="propDetailRef"></open-details>
      <div class="msi-form">
        <el-form :model="detailForm">
          <el-row>
            <el-col :span="6">
              <el-form-item label="物料编号">
                <el-input v-model="detailForm.materialCode" clearable placeholder="请输入物料编号" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label-width="20px">
                <el-button type="primary" icon="el-icon-search" @click="getDetail">查询</el-button>
 
                <el-button type="primary" icon="ele-Finished" @click="goGenerateCode"
                  :disabled="sccheckedDetails.length == 0">生成条码</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div class="msi-content">
        <!-- <p style="margin-bottom: 10px">物料明细</p> -->
        <el-table :data="drawerList" @selection-change="scdetailsCheckChange" border striped :max-height="480">
 
          <el-table-column fixed="left" align="center" width="60" type="selection" />
          <el-table-column fixed="left" label="序号" align="center" width="60" type="index" />
          <!-- <el-table-column prop="asnNo" min-width="100px" label="ASN单号" show-overflow-tooltip="" /> -->
          <el-table-column prop="materialCode" fixed="left" min-width="130px" label="物料编号" show-overflow-tooltip="" />
          <el-table-column prop="materialName" min-width="130px" label="物料名称" show-overflow-tooltip="" />
 
          <el-table-column prop="asnLineNumber" min-width="100px" label="ASN行号" show-overflow-tooltip="" />
          <el-table-column prop="asnStatus" min-width="100px" label="单据状态" show-overflow-tooltip="">
            <template #default="scope">
              <el-tag :type="getTypeStatus(
                1, scope.row.asnStatusName)
                ">
                {{ scope.row.asnStatusName }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="poQuantity" min-width="100px" label="采购数量" show-overflow-tooltip="" />
          <el-table-column prop="quantity" min-width="100px" label="送货数量" show-overflow-tooltip="" />
          <el-table-column prop="goodsQuantity" min-width="100px" label="已收数量" show-overflow-tooltip="" />
 
          <el-table-column prop="poNo" label="PO单号" min-width="120px" show-overflow-tooltip="" />
          <el-table-column prop="poLineNumber" min-width="100px" label="PO行号" show-overflow-tooltip="" />
 
          <el-table-column prop="poUnit" min-width="100px" label="采购单位" show-overflow-tooltip="" />
          <el-table-column prop="materialUnit" min-width="100px" label="库存单位" show-overflow-tooltip="" />
          <el-table-column prop="translateRate" min-width="100px" label="换算率" show-overflow-tooltip="" />
 
          <el-table-column prop="supplierCode" min-width="100px" label="供应商编号" show-overflow-tooltip="" />
          <el-table-column prop="supplierName" min-width="100px" label="供应商名称" show-overflow-tooltip="" />
          <el-table-column prop="supplierBatch" min-width="100px" label="供应商批次" show-overflow-tooltip="" />
          <el-table-column prop="sN_1d" min-width="180px" label="一维条码" show-overflow-tooltip="" />
          <el-table-column prop="sN_2d" min-width="180px" label="二维条码" show-overflow-tooltip="" />
          <!-- <el-table-column prop="package" min-width="100px" label="包装名称" show-overflow-tooltip="" /> -->
          <el-table-column prop="plannedStartTime" min-width="120px" label="计划开始时间" show-overflow-tooltip="" />
          <el-table-column prop="plannedEndTime" min-width="120px" label="计划结束时间" show-overflow-tooltip="" />
          <el-table-column label="是否冻结" prop="isFreeze" align="center" min-width="120">
            <template #default="scope">
 
 
              <el-tag v-if="scope.row.isFreeze"> 是 </el-tag>
              <el-tag type="danger" v-else> 否 </el-tag>
 
            </template>
          </el-table-column>
          <el-table-column prop="projectNo" min-width="100px" label="项目号" show-overflow-tooltip="" />
          <!-- <el-table-column prop="factoryName" min-width="100px" label="工厂名称" show-overflow-tooltip="" />
                    <el-table-column prop="factoryCode" min-width="100px" label="工厂编号" show-overflow-tooltip="" /> -->
          <el-table-column prop="dock" min-width="100px" label="收货道口" show-overflow-tooltip="" />
 
          <!-- <el-table-column prop="batch" min-width="100px" label="批次" show-overflow-tooltip="" /> -->
 
          <el-table-column prop="erpCode" min-width="100px" label="ERP库存地" show-overflow-tooltip="" />
          <el-table-column prop="erpOrderNo" min-width="100px" label="ERP单号" show-overflow-tooltip="" />
 
          <el-table-column prop="createTime" min-width="100px" label="创建时间" width="130" :formatter="formatDate_T_Time"
            show-overflow-tooltip="" />
          <el-table-column prop="updateTime" min-width="100px" label="修改时间" width="130" :formatter="formatDate_T_Time"
            show-overflow-tooltip="" />
          <el-table-column prop="createUserName" min-width="120px" label="创建人" show-overflow-tooltip="" />
          <el-table-column prop="updateUserName" min-width="120px" label="修改人" show-overflow-tooltip="" />
        </el-table>
        <Pagination :total="detailCount" v-model:page="detailForm.Page" v-model:limit="detailForm.PageSize"
          @pagination="getDetail" style="margin-top: 20px; text-align: center"></Pagination>
 
        <div></div>
      </div>
    </div>
  </el-drawer>
 
  <el-dialog v-model="outVisible2" title="SPA获取" width="20%" @close="closeOutDialog2">
    <el-form :model="outerForm2" label-width="120px">
      <el-row style="font-size: 16px">
        <el-col :span="23">
          <el-form-item label="单号:" required>
            <el-input v-model="outerForm2.purchaseNo" clearable placeholder="请输入单号" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
 
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="outVisible2 = false">取消</el-button>
        <el-button type="primary" @click="getSapOrderPO">确认</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script lang="ts" setup>
import Pagination from "/@/components/Pagination/index.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import {
  ref,
  nextTick,
  computed,
  getCurrentInstance,
  watch,
  defineExpose,
  defineProps,
  onMounted,
} from "vue";
import {
  removeTrailingZeros,
  formatDate,
  formatDate_T_Date,
  formatDate_T_Time,
  defaultTimeRange,
} from "/@/utils/formatTime";
 
import { formatDecimalData } from "/@/utils/formate";
import { expandMore } from "/@/hooks/expandMore";
import cache from "/@/utils/cache";
import { pageWmsMaterial } from "/@/api/main/WmsBase/wmsMaterial";
import { getTypeStatus } from "/@/utils/formate";
import { getAPI } from "/@/utils/axios-utils";
import { SysEnumApi } from "/@/api-services/api";
import {
  addWmsOrderPurchase,
  updateWmsOrderPurchase,
  detailWmsOrderPurchase,
} from "/@/api/main/WmsOrder/wmsOrderPurchase";
import OpenDetails from "/@/components/openDetails/openDetails.vue";
import { pageBaseCustomer, pageBaseCustomerForOrders } from "/@/api/main/WmsBase/baseCustomer";
import { pageWmsOrderPurchaseDetails, pageWmsOrderPurchaseDetailsForRelatedAsn } from "/@/api/main/WmsOrder/wmsOrderPurchaseDetails";
import {
  pageWmsOrderAsnDetails,
  deleteWmsOrderAsnDetails,
  updateWmsOrderAsnDetails,
  updateWmsOrderAsnDetailsBarCode,
} from "/@/api/main/WmsOrder/wmsOrderAsnDetails";
import commonFunction from "/@/utils/commonFunction";
import {
  addWmsOrderAsn,
  updateWmsOrderAsn,
  detailWmsOrderAsn,
} from "/@/api/main/WmsOrder/wmsOrderAsn";
import { handleSlectDataWmsBusinessType } from "/@/utils/selectData";
import { addWmsRecordSncodePrint } from "/@/api/main/PrintCenter/wmsRecordSncodePrint";
const moveType = 10; //移动类型 入库
const { proxy }: any = getCurrentInstance(); // 访问实例上下文 proxy同时支持开发 线上环境
const getBusinessTypeData_Index = ref<any>([]); //业务类型 create by liuwq 2024-05-23
const getEnumOrderTypeData = ref<any>([]);
const getEnumPoStatusData = ref<any>([]);
const { getEnumDesc } = commonFunction();
const emits = defineEmits(["getTabelData"]);
const getEnumAsnStatusData_Index = ref<any>([]);
const getEnumOrderTypeData_Index = ref<any>([]);
const getEnumDockData = ref<any>([]);
const props = defineProps({
  titleAuthor: {
    type: Number,
    required: true,
  },
  hexiao: {
    type: Number,
    default: 1,
    required: true,
  },
});
//控制订单类型 - 下拉菜单
const titleAuthor = computed(() => props.titleAuthor);
// 是否显示核销按钮
const hexiao = computed(() => props.hexiao);
const loading = ref(false);
 
// 登录用户id
// const LoginUserID = computed(() => store.state.login.userInfo.id || localCache.getCache("LoginUserID"))
 
// const EnumWriteOffState = computed(
//   () => store.state.login.enums.enumWriteOffState
// );
 
let itemBtnArr = ["批量删除", "编辑", "新增"];
const boolEnum = ref([
  {
    title: "是",
    value: true,
  },
  {
    title: "否",
    value: false,
  },
]);
 
// form表单展开
 
const orderType = ref("");
const orderDoRuType = ref(); // 用于导入的变量
const itemBtn = ref(1);
// 控制bom物料权限
const isShowBomBtn = ref(0);
 
// 禁止之前的日期
const disabledDate = (time: Date) => {
  return time.getTime() + 3600 * 1000 * 24 < Date.now();
};
// 上传窗口
const uploadVisible = ref(false);
//打开导入窗口
const openUploadDialog = (param: any) => {
  orderDoRuType.value = param;
  uploadVisible.value = true;
};
//关闭窗口
const closeUploadDialog = () => {
  getTabelData();
};
//sap获取
const getSapOrder = () => {
  ElMessageBox.confirm("是否确认获取更新?", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(() => {
    // getSapRkPurchase().then((res) => {
    //   if (res.code == 200) {
    //     ElMessage.success("已开始重新获取,请稍后查看结果!");
    //   } else {
    //     ElMessage.error(
    //       `sap获取失败${res.code}:${JSON.stringify(res.message)}`
    //     );
    //   }
    // })
  });
};
 
//------------sap获取PO单
const outVisible2 = ref(false);
const outerForm2 = ref({
  purchaseNo: "",
});
const getSapOrderPO = (param?: number) => {
  debugger
  if (param && param == 1) {
    outVisible2.value = true;
    return;
  }
  if (outerForm2.value.purchaseNo == "") {
    ElMessage.warning("请输入单号");
    return;
  }
  // getSapPurchasePO({
  //   purchaseNo: outerForm2.value.purchaseNo
  // })
  //   .then((res) => {
  //     if (res.code == 200) {
  //       ElMessage.success("SAP获取成功");
  //       outVisible2.value = false;
  //     } else {
  //       ElMessage.error(
  //         `sap获取失败${res.code}:${JSON.stringify(res.message)}`
  //       );
  //     }
  //   })
  //   .catch((err) => ElMessage.error(err));
};
//关闭出库窗口的回调
const closeOutDialog2 = () => {
  outerForm2.value.purchaseNo = "";
};
 
//------------sap获取PO单
 
// --------------------PO单列表-----------------------------------
//查询
const formModel = ref({
  WareMaterialCode: "",
  WareMaterialName: "",
  PurchaseNo: "",
  CreatedUserName: "",
  CreatedTimeBegin: "",
  CreatedTimeEnd: "",
  CreateDate: [],
  IssueTimeBegin: "",
  IssueTimeEnd: "",
  IssueDate: [],
  MaterialTypeStaus: "",
  SourceBy: "",
  WriteOffState: "",
  signStatus: "",
  status: "",
  freeOrderType: "",
  IsQueryAll: false, //是否显示全部数据
  // LoginUserID: LoginUserID, //用户id
  OrderMenuType: "", //判断是哪个菜单入库
  Page: 1,
  PageSize: 10,
  poApprovalStatus: "",
  keyCode: "",
  IsDisable: "", //是否作废
});
 
//入库单列表数据
let tableData = ref([]);
const tableRef = ref();
 
//列表的数据条数
const totalItems = ref<number>(0);
 
//缓存枚举
const enumList: any = cache.getCache("enumList");
console.log(enumList.inEnumOrderType);
 
// .inEnumOrderType
 
//获取PO单列表
const getTabelData = () => {
  //判断创建时间是否有选择
  if (formModel.value.CreateDate && formModel.value.CreateDate.length > 0) {
    formModel.value.CreatedTimeBegin = formModel.value.CreateDate[0];
    formModel.value.CreatedTimeEnd = ""; //addDate(formModel.value.CreateDate[1], 1); //日期查询 结束时间 需要加一天
  } else {
    // 日历清空 再查询bug
    if (formModel.value.CreatedTimeBegin || formModel.value.CreatedTimeEnd) {
      formModel.value.CreatedTimeBegin = "";
      formModel.value.CreatedTimeEnd = "";
    }
  }
  //判断下发时间是否有选择
  if (formModel.value.IssueDate && formModel.value.IssueDate.length > 0) {
    formModel.value.IssueTimeBegin = formModel.value.IssueDate[0];
    formModel.value.IssueTimeEnd = formModel.value.IssueDate[1];
  } else {
    // 日历清空 再查询bug
    if (formModel.value.IssueTimeBegin || formModel.value.IssueTimeEnd) {
      formModel.value.IssueTimeBegin = "";
      formModel.value.IssueTimeEnd = "";
    }
  }
 
  //其它入库入口
  // if (titleAuthor.value == 1) { //免费入库单管理
  // }
 
  // if (titleAuthor.value == 2) { //订单入库管理
  // }
 
  // getPurchasePageForAllData(formModel.value)
  //   .then((res) => {
  //     if (res.code == 200) {
  //       const { data } = res;
  //       const result = data;
  //       result.rows.map(
  //         (item: { hasChildren: boolean }) => (item.hasChildren = true)
  //       );
  //       tableData.value = result.rows;
  //       totalItems.value = result.totalRows;
  //       orderType.value = formModel.value.MaterialTypeStaus;
  //       // 清除选中
  //       nextTick(() => {
  //         if (tableRef.value && typeof tableRef.value.clearSelection === 'function') {
  //           checkRows.value = [];
  //           tableRef.value.clearSelection();
  //         }
  //       })
  //     } else {
  //       ;
  //     }
  //   })
  //   .catch((err) => {
  //     console.log(err);
  //     ElMessage.error(JSON.stringify(err));
  //   });
};
getTabelData();
 
//重置搜索
const resetForm = () => {
  formModel.value = {
    WareMaterialCode: "",
    WareMaterialName: "",
    PurchaseNo: "",
    CreatedUserName: "",
    CreatedTimeBegin: "",
    CreatedTimeEnd: "",
    CreateDate: [],
    IssueTimeBegin: "",
    IssueTimeEnd: "",
    IssueDate: [],
    MaterialTypeStaus: "",
    SourceBy: "",
    WriteOffState: "",
    signStatus: "",
    status: "",
    freeOrderType: "",
    IsQueryAll: false, //是否显示全部数据
    //  LoginUserID: LoginUserID, //用户id
    OrderMenuType: "", //判断是哪个菜单入库
    Page: 1,
    PageSize: 10,
    poApprovalStatus: "",
    keyCode: "",
    IsDisable: "", //是否作废
  };
  getTabelData();
};
// -----------------删除、导出操作--------------------------
//选中的行
const checkRows = ref<{ id: number }[]>([]);
// 选择
const handleSelectionChange = (val: any) => {
  checkRows.value = val;
};
//导出PO单详情
const handExport = () => {
  // rkExport(formModel.value)
  //   .then((res) => {
  //     const link = document.createElement("a"); //创建a标签
  //     let blob = new Blob([res], { type: "application/vnd.ms-excel" }); // response就是接口返回的文件流
  //     let objectUrl = URL.createObjectURL(blob);
  //     link.href = objectUrl;
  //     link.download = `入库管理导出${formatUtcToData(
  //       new Date().toString(),
  //       "YYYY-MM-DD hh:mm:ss"
  //     )}`; // 自定义文件名
  //     link.click(); // 下载文件
  //     URL.revokeObjectURL(objectUrl); // 释放内存
  //   }).catch((err) => ElMessage.error(JSON.stringify(err)));
  //导出调用接口
  // let entozh = entozhExcell
  //   const { Page, PageSize, ...rest } = formModel.value
  //   getPurchasePage({ Page: 1, PageSize: 1000000, ...rest }).then(res => {
  //     if(res.code==200){
  //       res.data.rows.forEach((item)=>{
  //         item.writeOffState = EnumWriteOffState.value.filter((v: any) => v.value == item.writeOffState)[0].title;
  //         item.sourceBy =  sourceEnum.value.filter((v: any) => v.value == item.sourceBy)[0].title;
  //       })
  //       exportExcel(res.data.rows, entozh, "xlsx", `入库管理表${formatUtcToData(new Date().toString(), 'YYYY-MM-DD hh:mm:ss')}`);
  //     }
  //   })
  // 后端导出-字段不全
  // if (checkRows.value.length <= 0) {
  //   ElMessage.warning("请选择一个订单!");
  //   return
  // }
  // const arr = checkRows.value.reduce((curr, item) => {
  //   curr.push(item.purchaseNo);
  //   return curr;
  // }, []);
  // puchaseExport({ PurchaseNo: arr })
  //   .then((res) => {
  //     const link = document.createElement("a"); //创建a标签
  //     let blob = new Blob([res], { type: "application/vnd.ms-excel" }); // response就是接口返回的文件流
  //     let objectUrl = URL.createObjectURL(blob);
  //     link.href = objectUrl;
  //     link.download = `入库管理导出${formatUtcToData(
  //       new Date().toString(),
  //       "YYYY-MM-DD hh:mm:ss"
  //     )}`; // 自定义文件名
  //     link.click(); // 下载文件
  //     URL.revokeObjectURL(objectUrl); // 释放内存
  //   })
  //   .catch((err) => ElMessage.error(JSON.stringify(err)));
};
 
// -------------------获取PO单下物料详情-----------------------------------
//入库单下物料详情请求
const detailForm = ref({
  materialCode: "",
  asnId: "",
  Page: 1,
  PageSize: 10,
});
 
// 物料详情抽屉
const drawerVisible = ref(false);
const drawerType = ref("drawerAll");
// const
//单号
const purchaseNo = ref("");
 
const getEnumPoDetailStatusData_Index = ref<any>([]);
 
//------------------获取物料列表物料明细
const getDetail = async () => {
  loading.value = true;
  var res = await pageWmsOrderAsnDetails(Object.assign(detailForm.value));
  drawerList.value = res.data.result?.items ?? [];
  detailCount.value = res.data.result?.total;
  loading.value = false;
 
};
 
//----------------物料明细
//打开抽屉
const openDrawer = async (type: number, scope: any = {}, entozhExcell?: any) => {
  detailForm.value.Page = 1;
  detailForm.value.PageSize = 10;
  if (scope.asnNo) {
    title.value = `${scope.asnNo}`;
  }
  drawerType.value = "drawerAll";
  drawerVisible.value = true;
  //当前入库单号id
  detailForm.value.asnId = scope.id;
  //入库单
  purchaseNo.value = scope.purchaseNo;
  detailForm.value.asnId = scope.id;
  //获取物料列表
  if (detailForm.value.asnId == "") {
    drawerList.value = [];
    detailCount.value = 0;
    return;
  }
  // 获取物料列表物料明细
  getDetail();
 
  getEnumPoDetailStatusData_Index.value =
    (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet("OrderStatusEnum")).data.result ??
    [];
 
 
  getEnumOrderTypeData_Index.value =
    (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet("OrderTypeEnum")).data.result ??
    [];
 
  // 根据状态转中文 保留3位小数
  let scopetrans = JSON.parse(JSON.stringify(scope));
  // scopetrans.totalquantity = Number(scopetrans.totalquantity).toFixed(3);
  scopetrans.asnStatus = getEnumDesc(
    scopetrans.asnStatus,
    getEnumPoDetailStatusData_Index.value
  );
  scopetrans.asnType = getEnumDesc(scopetrans.asnType, getEnumOrderTypeData_Index.value);
 
  nextTick(() => {
    proxy.$refs["propDetailRef"].openADialog(scopetrans, entozhExcell);
  });
};
 
//关闭抽屉
const handleDrawerClose = () => {
  detailForm.value = {
    materialCode: "",
    asnId: "",
    Page: 1,
    PageSize: 10,
  };
  deltailList.value = [];
  detailCount.value = 0;
  drawerList.value = [];
  drawerList.value = [];
  detailCount.value = 0;
};
 
//物料详情类型
interface DetailType {
  id: number;
  barCode: string;
  wareMaterialCode: string;
  name: string;
  signStatus: string;
  category: string;
  materialTypeName: string;
  specificationModel: string;
  long: number;
  width: number;
  high: number;
  weight: number;
  unit: string;
  createdTime: string;
  purchaseNo: string;
  quantity: number;
  goodsquantity: number;
  surplusquantity: number;
  poLineNumber: string;
}
 
//入库单详情列表
const deltailList = ref<DetailType[]>([]);
//弹出层数据
const drawerList = ref<DetailType[]>([]);
 
//入库单详情列表数据条数
const detailCount = ref(0);
 
//弹出层标题
let title = ref("");
 
// ----------------新增、编辑-------------------------------
//窗口类型
const dialogType = ref("add");
 
const dialogVisible = ref(false);
 
//添加编辑表单ref
const dialogRef = ref();
 
//添加/编辑参数
let addForm = ref({
  hasTMCode: false,
  typeTMCode: false, //false二维码 true 1维码
  asnType: "",
  dock: "",
  projectNo: "",
  OrderDetails: [] as any[],
});
 
// 特殊字符的验证
// 包含特殊字符返回true,不包含特殊字符返回false
const checkEspcial = (rule: any, value: any, callback: any) => {
  if (!value) {
    callback();
  } else {
    const reg = /[@$%*^:;:;~+=!!#^{}><.,,。]/g;
    if (!reg.test(value.trim())) {
      callback();
    } else {
      return callback(new Error("不能存在特殊符号"));
    }
  }
};
 
// 验证角色编号
var validatorCode = (rule: any, value: any, callback: any) => {
  if (!value) {
    callback();
  } else {
    const reg = /[\u4E00-\u9FA5]/g;
    if (!reg.test(value)) {
      callback();
    } else {
      return callback(new Error("单号不能存在汉字"));
    }
  }
};
 
//rules
const formRules = {
  asnType: [{ required: true, message: "请选择订单类型!", trigger: "change" }],
  orderTypeName: [{ required: true, message: "请输入订单类型名称!", trigger: "blur" }],
  businessType: [{ required: true, message: "请选择业务类型!", trigger: "change" }],
  businessTypeName: [
    { required: true, message: "请输入业务类型名称!", trigger: "blur" },
  ],
  orderSocure: [{ required: true, message: "请输入单据来源!", trigger: "blur" }],
  poStatus: [{ required: true, message: "请选择单据状态!", trigger: "change" }],
  poStatusName: [{ required: true, message: "请输入单据状态名称!", trigger: "blur" }],
  supplierCode: [{ required: true, message: "请输入供应商编号!", trigger: "blur" }],
  supplierName: [{ required: true, message: "请输入供应商名称!", trigger: "blur" }],
  factoryId: [{ required: true, message: "请输入工厂ID!", trigger: "blur" }],
  // purchaseNo: [
  //   { required: true, message: "单号不能为空", trigger: "blur" },
  //   { validator: validatorCode, trigger: "blur" },
  //   { validator: checkEspcial, trigger: "blur" }
  // ],
};
const materialCodeValue = ref("");
//打开新增、编辑窗口
const openDialog = async (type: number, scope: any = {}) => {
  debugger
  showYwlx.value = false;
  // handleQueryTdp();
  if (type == 1) {//新增
    isPoBox.value = 1;
    isMaterialBox.value = 1;
    detailForm.value.PageSize = 10;
 
    dialogType.value = "add";
  }
 
  if (type == 3) {  //打印
    dialogType.value = "print";
    detailForm.value.PageSize = 100000;
    addForm.value = { ...scope };
    detailForm.value.asnId = scope.id;
    //------------------获取物料列表物料明细
    loading.value = true;
    var res = await pageWmsOrderAsnDetails(Object.assign(detailForm.value));
 
    warehousOrderDetails.value = res.data.result?.items ?? [];
    loading.value = false;
    if (warehousOrderDetails.value.length > 0 && warehousOrderDetails.value[0].poNo) {
      isPoBox.value = 1;
      isMaterialBox.value = 0;
    } else {
      isPoBox.value = 0;
      isMaterialBox.value = 1;
    }
    addForm.value.hasTMCode = false;
    addForm.value.typeTMCode = false;
    if (warehousOrderDetails.value.length > 0 && warehousOrderDetails.value[0].sN_1d) {
      addForm.value.hasTMCode = true;
      addForm.value.typeTMCode = true;
    }
    if (warehousOrderDetails.value.length > 0 && warehousOrderDetails.value[0].sN_2d) {
      addForm.value.hasTMCode = true;
      addForm.value.typeTMCode = false;
    }
    //------------------------------
 
  }
 
  if (type == 2) {//编辑
    dialogType.value = "edit";
    detailForm.value.PageSize = 100000;
    addForm.value = { ...scope };
    if (addForm.value.businessType == 1001) {
      showYwlx.value = true //禁用
    } else {
      showYwlx.value = false
    }
    console.log(addForm.value);
    detailForm.value.asnId = scope.id;
 
    //------------------获取物料列表物料明细
    loading.value = true;
    var res = await pageWmsOrderAsnDetails(Object.assign(detailForm.value));
 
    warehousOrderDetails.value = res.data.result?.items ?? [];
    loading.value = false;
    if (warehousOrderDetails.value.length > 0 && warehousOrderDetails.value[0].poNo) {
      isPoBox.value = 1;
      isMaterialBox.value = 0;
    } else {
      isPoBox.value = 0;
      isMaterialBox.value = 1;
    }
    addForm.value.hasTMCode = false;
    addForm.value.typeTMCode = false;
    if (warehousOrderDetails.value.length > 0 && warehousOrderDetails.value[0].sN_1d) {
      addForm.value.hasTMCode = true;
      addForm.value.typeTMCode = true;
    }
    if (warehousOrderDetails.value.length > 0 && warehousOrderDetails.value[0].sN_2d) {
      addForm.value.hasTMCode = true;
      addForm.value.typeTMCode = false;
    }
    //----------------物料明细
  }
  dialogVisible.value = true;
 
  //清除选中项
  nextTick(() => {
    if (dialogRef.value) {
      dialogRef.value.clearValidate();
    }
  });
};
 
//物料详情的table ref
const detailRef = ref();
const setRowKey = (row: any) => {
  return row.id + row.asnLineNumber;
};
//关闭窗口
const closeDialog = () => {
  disabled_btn.value = false;
  addForm.value = {
    hasTMCode: false,
    typeTMCode: false, //false二维码 true 1维码
    asnType: "",
    dock: "",
    projectNo: "",
    OrderDetails: [] as any[],
  };
  warehousOrderDetails.value = [];
  checkedDetails.value = [];
  deltailList.value = [];
  detailCount.value = 0;
  detailRef.value.clearSelection();
};
 
//添加编辑窗口物料列表
const warehousOrderDetails = ref<any[]>([]);
 
//物料详情列表选中的物料
const checkedDetails = ref<any[]>([]);
 
//物料详情列表中勾选事件
const detailsCheckChange = (val: any) => {
  checkedDetails.value = val;
};
 
//删除选中的物料详情
const delCheckedDetails = () => {
  debugger
  ElMessageBox.confirm("是否确认删除?", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      let arr = [];
      if (checkedDetails.value[0].asnLineNumber) {
        checkedDetails.value.forEach((item) => {
          console.log(item);
          let index = warehousOrderDetails.value.findIndex(
            (detail) =>
              detail.materialCode == item.materialCode && detail.asnLineNumber == item.asnLineNumber
          );
          if (index > -1) {
            warehousOrderDetails.value.splice(index, 1);
          }
        });
      } else {
        checkedDetails.value.forEach((item) => {
          let index = warehousOrderDetails.value.findIndex(
            (detail) =>
              detail.materialCode == item.materialCode
          );
          warehousOrderDetails.value.splice(index, 1);
        });
      }
      arr = warehousOrderDetails.value;
      warehousOrderDetails.value = [];
      //bug 相同物料 不同Bom
      nextTick(() => {
        warehousOrderDetails.value = arr;
        checkedDetails.value = [];
        detailRef.value.clearSelection();
      });
    })
    .catch(() => ElMessage.info("已取消删除"));
};
const disabled_btn = ref(false);
//编辑、添加提交
const confirm = async () => {
  //打印
  if (dialogType.value == "print") {
    if (checkedDetails.value.length <= 0) {
      ElMessage.warning("请选中一条");
      return
    }
    checkedDetails.value.forEach((item) => {
      // handleArr.push(item.id);
      item.PrintSource = 2 //ASN单跟踪码打印
      item.PrintType = 1  //物料跟踪码
      item.PrintSheetNum = 1
      item.PrintNum = 1
      item.PrintStatu = 1
      item.IsAllowPrint = 1
      if (item.sN_1d) {
        item.snCode = item.sN_1d
      }
      if (item.sN_2d) {
        item.snCode = item.sN_2d
      }
    });
    disabled_btn.value = true;
    loading.value = true;
    var res = await addWmsRecordSncodePrint(checkedDetails.value);
    if (res.data && res.data.code == 200) {
      ElMessage.success("添加成功");
      dialogVisible.value = false;
    }
    loading.value = false;
    disabled_btn.value = false;
 
    return
  }
 
  //新增编辑
  dialogRef.value.validate(async (vali: any) => {
    if (vali) {
      console.log("确认");
      if (warehousOrderDetails.value.length <= 0) {
        ElMessage.warning("请选择物料");
        return
      }
      let idx2 = warehousOrderDetails.value.findIndex(
        (v) => v.poQuantity == "" || v.poQuantity == undefined || v.poQuantity <= 0
      );
      if (idx2 > -1) {
        ElMessage.warning("数量不合规范!");
        return;
      }
 
      addForm.value.OrderDetails = [];
      warehousOrderDetails.value.forEach((item) => {
        const obj = {
          ...item,
          asnLineNumber: item.asnLineNumber
        };
        addForm.value.OrderDetails.push(obj);
      });
      debugger
 
      //添加
      if (dialogType.value == "add") {
        disabled_btn.value = true;
        let res = await addWmsOrderAsn(addForm.value);
        if (res.data && res.data.code == 200) {
          ElMessage.success("添加成功");
          dialogVisible.value = false;
          emits("getTabelData");
        }
        disabled_btn.value = false;
      } else {
        disabled_btn.value = true;
        let res = await updateWmsOrderAsn(addForm.value);
        if (res.data && res.data.code == 200) {
          ElMessage.success("编辑成功");
          dialogVisible.value = false;
          emits("getTabelData");
        }
        disabled_btn.value = false;
      }
    } else {
      ElMessage.warning("表单验证失败");
    }
  });
  disabled_btn.value = false;
};
// -----------------添加物料操作-------------------------
//物料基础数据窗口
const addMaterialVisible = ref(false);
 
//物料基础数据列表
const materialList = ref([]);
 
//物料基础数据条数
const materialTotal = ref(0);
 
//物料基础数据form
const materialForm = ref({
  materialCode: "",
  projectNo: "",
  supplierCode: "",
  poNo: "",
  Code: "",
  Page: 1,
  PageSize: 10,
  filterOrderStauts: 1, //过滤“新建”“处理中”的PO单
  IsDisabled: false, //未禁用的
  MaterialType: "546896760045637", //物料类型:原材料
  plannedStartTimeRange: [],
  plannedEndTimeRange: []
});
 
//获取物料基础列表
const getMaterialList = async () => {
  debugger
  // 创建po
  if (isPoBox.value == 1) {
    loading.value = true;
    materialForm.value.filterOrderStauts = 1;
    // var res = await pageWmsOrderPurchaseDetails(Object.assign(materialForm.value));
    var res = await pageWmsOrderPurchaseDetailsForRelatedAsn(Object.assign(materialForm.value));
 
    if (res.data.result && res.data.result?.items.length > 0) {
      res.data.result?.items.forEach((item: any) => {
        //asn未绑的可用po剩余数量
        item.usedQty = Number(Number(item.quantity) - Number(item.createASNQuantity)).toFixed(3);
        //po总数
        item.quantityAll = item.quantity;
        if (item.snp == 0) {
          item.snp = "";
        }
        // item.quantity = Number(item.quantityAll - item.goodsQuantity).toFixed(3);
      });
    }
 
    materialList.value = res.data.result?.items ?? [];
    materialTotal.value = res.data.result?.total;
    loading.value = false;
  }
  //创建asn
  if (isMaterialBox.value == 1) {
    loading.value = true;
    var res = await pageWmsMaterial(Object.assign(materialForm.value));
    materialList.value = res.data.result?.items ?? [];
    materialTotal.value = res.data.result?.total;
    loading.value = false;
  }
};
 
//重置物料
const resetMaterialForm = () => {
  materialForm.value = {
    poNo: "",
    Code: "",
    Page: 1,
    PageSize: 10,
    filterOrderStauts: 1, //过滤“新建”“处理中”的PO单
    IsDisabled: false, //未禁用的
    MaterialType: "546896760045637", //物料类型:原材料
    plannedStartTimeRange: [],
    plannedEndTimeRange: []
  };
  getMaterialList();
};
 
//选中的基础物料数据
const checkedMaterial = ref<any[]>([]);
const showYwlx = ref(false);
//物料基础数据勾选
const materialSelectionChange = (val: any) => {
  checkedMaterial.value = val;
};
const isMaterialBox: any = ref(true);
const isPoBox: any = ref(false);
//打开新增物料窗口
const addMaterialDialog = (param?: any) => {
  if (param && param == "po") {
    isPoBox.value = 1;
    isMaterialBox.value = 0;
    addForm.value.businessType = 1001;
    showYwlx.value = true
  } else {
    isPoBox.value = 0;
    isMaterialBox.value = 1;
    showYwlx.value = false;
  }
  getMaterialList();
 
  // if ( addForm.value.freeOrderType && isShowBomBtn.value ) {
  //   ElMessage.warning("免费件类型是PR2,只能新增DI维护的物料!");
  //   return;
  // }
  addMaterialVisible.value = true;
};
 
//基础物料table的ref对象
const materialRef = ref();
 
//确认添加材料
const confirmAddMaterial = () => {
 
  //物料列表没数据,直接添加
  // if (warehousOrderDetails.value.length == 0) {
  //   // 自动给行号复值
  //   checkedMaterial.value.forEach((item, index) => {
  //     item.unit = item.poUnit || item.unit;
  //     // item.asnLineNumber = index + 1;
  //     // if (!item.asnLineNumber) {
  //     //   item.asnLineNumber = index + 1 + warehousOrderDetails.value.length;
  //     // }
  //   });
  //   warehousOrderDetails.value.push(...checkedMaterial.value);
  // } else {
  if (isPoBox.value == 1) { //PO
    debugger
    for (let i = 0; i < checkedMaterial.value.length; i++) {
      let idx = warehousOrderDetails.value.findIndex(
        (item: any) =>
          item.materialCode == checkedMaterial.value[i].materialCode &&
          item.poLineNumber == checkedMaterial.value[i].poLineNumber &&
          item.poNo == checkedMaterial.value[i].poNo
      );
      if (idx > -1) {
        return ElMessage.warning(
          `PO号${checkedMaterial.value[i].poNo},物料编号${checkedMaterial.value[i].materialCode},PO行号:${checkedMaterial.value[i].poLineNumber || ""}在物料列表中已存在,请去除勾选`
        );
      }
    }
 
    //创建ASN单时,选择PO单时,如果物料是配置标包数量的话,需要根据 标包数量进行分配,并生成N条显示到界面上
    var arrChaifen = []
    checkedMaterial.value.forEach((item: any) => {
      if (item.snp && item.snp > 0) { //标包数 > 0
        //-------剩余可用数 > 0
        if (Number(item.usedQty) > 0) {
          // ----------- 标包数 > 剩余可用数  ------- 凑不够一包 就创建不足一包
          if (item.usedQty < item.snp) {
            var { quantity, ...rest } = item;
            arrChaifen.push({
              ...rest,
              poQuantity: item.usedQty, //剩余可用数
              quantity: 0 //后台处理转换后的送货数量
            });
            return
          } else {
            //----- 存在标包 拆分 10/3 拆成 3 3 3 1-----------
            var numArr = []; // var num = [3,3,3,1];
            var s1 = Math.floor(item.usedQty / item.snp);
            var qtyYs = Number(item.usedQty) % Number(item.snp); //取余数
            var numArr = Array.from({ length: s1 }, () => item.snp);//创建数组长度s1,并填充标包数
            if (qtyYs > 0) {
              numArr.push(qtyYs)
            }
            console.log("拆分的数组内容")
            console.log(numArr)
            numArr.forEach((itemCf: any) => {
              var { quantity, ...rest } = item;
              var quantityNew = Number(itemCf);
              arrChaifen.push({
                ...rest,
                poQuantity: quantityNew,
                quantity: 0 //后台处理转换后的送货数量
              });
            });
          }
        }
      } else {
        //-----------没有标包的直接插入
        var { quantity, ...rest } = item;
        var quantitySy = item.usedQty || 0
        arrChaifen.push({
          ...rest,
          poQuantity: quantitySy,//剩余可用数
          quantity: 0 //后台处理转换后的送货数量
        });
      }
    });
 
    warehousOrderDetails.value.push(...arrChaifen);
 
  } else {
    //直接添加物料
    for (let i = 0; i < checkedMaterial.value.length; i++) {
      let idx = warehousOrderDetails.value.findIndex(
        (item: { asnLineNumber: any; materialCode: any }) =>
          item.materialCode == checkedMaterial.value[i].materialCode
      );
      if (idx > -1) {
        return ElMessage.warning(
          `物料编号${checkedMaterial.value[i].materialCode}在物料列表中已存在,请去除勾选`
        );
      }
    }
    warehousOrderDetails.value.push(...checkedMaterial.value);
  }
  // 自动给行号复值
  checkedMaterial.value.forEach((item, index) => {
    item.unit = item.poUnit || item.unit;
    // if (!item.asnLineNumber) {
    //   item.asnLineNumber = index + 1 + warehousOrderDetails.value.length;
    // }
  });
  // }
  addMaterialVisible.value = false;
};
 
//关闭新增物料窗口
const closeMaterialDialog = () => {
  materialForm.value = {
    materialCode: "",
    projectNo: "",
    supplierCode: "",
    poNo: "",
    Code: "",
    Page: 1,
    PageSize: 10,
    filterOrderStauts: 1, //过滤“新建”“处理中”的PO单
    IsDisabled: false, //未禁用的
    MaterialType: "546896760045637", //物料类型:原材料
    plannedStartTimeRange: [],
    plannedEndTimeRange: []
  };
  materialList.value = [];
  checkedMaterial.value = [];
  materialRef.value.clearSelection();
};
 
// 页面加载时
onMounted(async () => {
  getEnumOrderTypeData.value =
    (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet("OrderTypeEnum")).data.result ??
    [];
 
  getEnumPoStatusData.value =
    (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet("OrderStatusEnum")).data.result ??
    [];
  getBusinessTypeData_Index.value = await handleSlectDataWmsBusinessType(moveType); //下拉读取业务类型接口 create  by liuwq
  getEnumDockData.value =
    (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet("DockEnum")).data.result ?? [];
});
 
//================
const arrTdp = ref<any[]>([]);
const queryParamsW = ref<any>({});
const tableParamsW = ref({
  page: 1,
  pageSize: 1000,
  total: 0,
  custType: "供应商"
});
 
//-----------------远程搜索pageBaseCustomer  ----------------
// const handleQueryTdp = async () => {
//     var res = await pageBaseCustomerForOrders(Object.assign(queryParamsW.value, tableParamsW.value));
//     arrTdp.value = res.data.result ?? [];
// };
 
const changeXmbh = async (query?: any, materialCode?: any, scope?: any) => {
  loading.value = true;
  var res = await pageBaseCustomerForOrders({
    ...tableParamsW.value,
    materialCode: materialCode,
    //  custCode: query  //客户编号
  });
  loading.value = false;
  scope.arrTdp = res.data.result ?? [];
};
 
// 远程搜索  输入关键字以从远程服务器中查找数据。
// const remoteMethod = async (query: any) => {
//     loading.value = true;
//     var res = await pageBaseCustomerForOrders({
//       ...tableParamsW.value,
//       custCode: query
//     });
//     loading.value = false;
//     arrTdp.value = res.data.result ?? [];
// };
//-----------------远程搜索----------------
 
 
//--------------二维码生成
const sccheckedDetails = ref<any[]>([]);
const scdetailsCheckChange = (val: any) => {
  sccheckedDetails.value = val;
};
const goGenerateCode = async () => {
 
  const handleArr: number[] = [];
  sccheckedDetails.value.forEach((item) => {
    handleArr.push(item.id);
  });
  debugger
  ElMessageBox.confirm("是否确认生成条码?", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(async () => {
      const ret = await updateWmsOrderAsnDetailsBarCode({
        ID: handleArr
      });
      if (ret.data.type == "success") {
        ElMessage.success('生成条码成功!');
        getDetail();
      }
    })
    .catch(() => {
      ElMessage.info("已取消生成条码");
    });
}
 
 
 
//-----------------远程搜索 ----------------
const arrTdp2 = ref<any[]>([]);
const queryParamsW2 = ref<any>({});
const tableParamsW2 = ref({
  page: 1,
  pageSize: 200,
  total: 0,
  custType: "供应商"
});
 
// 远程搜索  输入关键字以从远程服务器中查找数据。
const remoteMethod2 = async (query: any) => {
  loading.value = true;
  var res = await pageBaseCustomer({
    ...tableParamsW2.value,
    custCode: query
  });
  loading.value = false;
  arrTdp2.value = res.data.result?.items ?? [];
};
//-----------------远程搜索----------------
 
// 暴露方法
defineExpose({ openDialog, openDrawer });
</script>
<style lang="less" scoped>
.detailBoxWrap {
  margin: 10px;
}
 
.msi-form {
  margin-top: 10px;
}
 
.msi-form {
  margin-bottom: 10px;
}
 
.slot_title {
  display: flex;
  align-items: center;
 
  // margin-left: 20px;
  .title_orderNo {
    font-size: 18px;
    color: #f18201;
    font-weight: bold;
    margin-right: 5px;
  }
}
</style>