1
wangyi
2026-03-12 f5bcbefaf9bbaa1d4d2ff3b8805d751c1ed3939a
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
<template>
    <view>
        <view class="form">
            <view class="tabs">
                <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">基本信息</view>
                <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">其他信息</view>
            </view>
 
            <view v-if="tabs == 0">
                <view class="form-item">
                    <view class="title">模具条码</view>
                    <view class="right" :class="barcodeReadOnly?'readonly':''">
                        <input type="text" :disabled="barcodeReadOnly" :focus="barCodeFocus" v-model="hform.HBarCode"
                            @confirm="getHBarCodeData(hform.HBarCode)" />
                    </view>
                    <uni-icons type="scan"
                        style="background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;flex-shrink: 0;"
                        size="20" @click="toScanCode"></uni-icons>
                </view>
                <view class="form-item" @click="searchModule">
                    <view class="title">器具</view>
                    <view class="righton" style="width: 350rpx;">
                        <input  placeholder="请选择器具" />
                    </view>
                    <uni-icons type="search"
                        style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
                        size="20" ></uni-icons>
                </view>
                <view class="form-item">
                    <view class="title">故障发生日期</view>
 
                    <view class="right">
                        <uni-datetime-picker type="date">
                            <view style="font-size: 30rpx;">{{hform.HConkBeginDate}}</view>
                        </uni-datetime-picker>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">故障类别</view>
                    <view class="right">
                        <uni-combox :candidates="ConkTypeNameList" placeholder="请选择故障类别" v-model="hform.HConkTypeName"
                            @input="ConkTypeNameChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">故障原因</view>
                    <view class="right">
                        <uni-combox :candidates="ConkReasonNameList" placeholder="请选择故障原因"
                            v-model="hform.HConkReasonName" @input="ConkReasonChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">故障描述</view>
                    <view class="right">
                        <textarea value="" style="height: 6em;" maxlength="2000" placeholder="请输入故障描述..." />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据号</view>
                    <view class="right">
                        <input name="HInterID" v-model="hform.HBillNo" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据日期</view>
                    <view class="right">
                        <uni-datetime-picker type="date">
                            <view style="font-size: 30rpx;">{{hform.HDate}}</view>
                        </uni-datetime-picker>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">部门</view>
                    <view class="right">
                        <uni-combox :candidates="DeptNameList" placeholder="请选择部门" v-model="hform.HDeptName"
                            @input="DeptChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">发现人</view>
                    <view class="right">
                        <uni-combox :candidates="EmpNameList" placeholder="请选择发现人" v-model="hform.HEmpName"
                            @input="EmpChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title required">负责人</view>
                    <view class="right">
                        <uni-combox :candidates="EmpNameList" placeholder="请选择负责人" v-model="hform.HManagerName"
                            @input="ManagerChange"></uni-combox>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">器具名称</view>
                    <view class="righton">
                        <input disabled type="text" placeholder="请输入器具名称" v-model="hform.HBarName" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">器具规格</view>
                    <view class="righton">
                        <input disabled type="text" placeholder="请输入器具规格" v-model="hform.HBarSpec" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">器具型号</view>
                    <view class="righton">
                        <input disabled type="text" placeholder="请输入器具型号" v-model="hform.HBarModel" />
                    </view>
                </view>
            </view>
 
            <view v-if="tabs == 1">
                <view class="form-item">
                    <view class="title">创建人:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HMaker" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">创建日期:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HMakeDate" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改人:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HUpDater" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改日期:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HUpDateDate" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核人:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HChecker" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核日期:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HCheckDate" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">作废人:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HDeleteMan" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">作废日期:</view>
                    <view class="righton">
                        <input type="text" v-model="hform.HDeleteDate" disabled />
                    </view>
                </view>
            </view>
 
            <view class="bottom-btn">
                <button :class="EnableSave?'btn-a':'btn-c'" :disabled="!EnableSave" size="mini"
                    @tap="submit">提交</button>
                <view style="flex: 1;"></view>
                <button class="btn-a" size="mini" @tap="addNew">新增</button>
                <button class="btn-c" size="mini" @tap="goBack">退出</button>
            </view>
        </view>
        <BarCodePopupVue ref="barcodePopup"></BarCodePopupVue>
        <BillListPopupMouldVue @BillSelectComplete="MouldBillHandler" ref="billListMould"></BillListPopupMouldVue>
    </view>
</template>
<script>
    import getDateTime from '@/utils/getdateTime.js';
    import {
        getUserInfo
    } from "@/utils/auth.js";
    import {
        CommonUtils
    } from '../../utils/common';
    import {
        getUserStockRelation
    } from '../../utils/userRelationManager';
    import BillListPopupVue from '../../components/BillListPopup/BillListPopup.vue';
    import BarCodePopupVue from "../../components/BarCodePopup/BarCodePopup.vue";
    import BillSelectPopupXiaoWeiVue from '../../components/BillSelectPopupXiaoWei/BillSelectPopupXiaoWei.vue';
    import BillListPopupMouldVue from '../../components/BillListPopup/BillListPopup_Mould.vue';
    import dayjs from 'dayjs';
    import { MpaasScan } from '../../utils/mpaasScan';
    export default {
        components: {
            BillListPopupVue,
            BarCodePopupVue,
            BillSelectPopupXiaoWeiVue,
            BillListPopupMouldVue,
        },
 
        data() {
            return {
                HSourceBillNoFocus: false,
 
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                HModName: 'Kf_POStockInBackBill_PDA',
                ModRightName: 'CE_POStockInBack',
                OperationType: 1,
                HInterID_Temp: '',
 
                showHStockPlaceName: false,
                showHMainSourceBillType: true,
                showHSourceBillNo: true,
                reHSourceBillNo: true,
                showHSupName: true,
                barCodeFocus: false,
                barcodeReadOnly: false,
                EnableSave: true, // 是否启用保存
 
 
                tabs: 0,
 
                HBarCode: '',
                linterid: '',
                HBillNo: '',
                btnType: 0, //0新增,1修改,2审核,3反审核
                showmore: false,
 
                materMeta: [],
                Materlist: [],
 
                // 故障类别列表
                ConkTypeNameList: [],
                ConkTypeList: [],
                // 故障原因列表
                ConkReasonNameList: [],
                ConkReasonList: [],
                // 部门列表
                DeptNameList: [],
                DeptList: [],
                // 职员列表(同时作为发现人和负责人的可选择对象)
                EmpNameList: [],
                EmpList: [],
                // 提交数据
                hform: {
                    "HBarCode": "",
                    "HConkBeginDate": dayjs(new Date()).format("YYYY-MM-DD hh:mm:ss"),
                    "HConkTypeName": "",
                    "HConkTypeID": "0",
                    "HConkReasonName": "",
                    "HConkReasonID": "0",
                    "HExplanation": "",
                    "HBillNo": "",
                    "HInterID": "0",
                    "HDate": dayjs(new Date()).format("YYYY-MM-DD hh:mm:ss"),
                    "HDeptName": getUserInfo()["HDeptName"],
                    "HDeptID": getUserInfo()["HDeptID"],
                    "HEmpName": getUserInfo().HEmpName,
                    "HEmpID": getUserInfo().HEmpID,
                    "HManagerName": getUserInfo().HSecManager,
                    "HManagerID": getUserInfo().HSecManagerID,
                    "HBarName": "",
                    "HMouldID": "0",
                    "HBarSpec": "",
                    "HBarModel": "",
                    "HMaker": getUserInfo()["Czymc"],
                    "HMakeDate": dayjs(new Date()).format("YYYY-MM-DD hh:mm:ss"),
                    "HUpDater": "",
                    "HUpDateDate": "",
                    "HChecker": "",
                    "HCheckDate": "",
                    "HDeleteMan": "",
                    "HDeleteDate": "",
                    "lngBillKey": "",
                    "lngBillSubKey": "",
                    "HBillType": 3815,
 
                }
            }
        },
        computed: {
 
 
        },
        async onLoad(e) {
            console.log(e, this.userInfo)
            this.OperationType = e.OperationType
            if (e.HInterID) {
                this.HInterID_Temp = e.HInterID
                // this.btnType = 1
                this.RoadBillMain(e.HInterID)
                this.barCodeFocus = true
            } else {
                this.getNewData()
                this.HSourceBillNoFocus = true
                this.refreshBarCodeState()
            }
 
            this.InitConkType()
            this.InitConkReason()
            this.InitDept()
            this.InitEmp()
        },
        methods: {
            searchModule() {
                this.$refs['billListMould'].showPopup()
            },
            MouldBillHandler(mould) {
                if(!mould.enableMultiSourceBill){
                    let val = mould.val[0]
                    this.hform.HBarCode = val['条码编号']
                    this.getHBarCodeData(this.hform.HBarCode)
                }
                this.$refs['billListMould'].exit()
            },
            // 故障类别
            async InitConkType() { // 初始化故障类别
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Gy_ConkType/List_PDA',
                        data: {
                            sWhere: '',
                            user: getUserInfo()['Czymc']
                        }
                    })
                    let {
                        count,
                        code,
                        Message,
                        data
                    } = res.data
                    if (count == 1) {
                        this.ConkTypeList = data
                        this.ConkTypeNameList = Array.from(data).map(elem => elem['故障类别名称'])
                    } else {
                        CommonUtils.showTips({
                            title: '错误提示',
                            message: "初始化故障类型错误: " + Message,
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '错误提示',
                        message: "初始化故障类型错误: " + err,
                    })
                }
            },
            ConkTypeNameChange(elem) { // 故障类别改变 句柄
                let index = this.ConkTypeNameList.findIndex(e => e == elem)
                if (index == -1) {
                    this.hform.HConkTypeName = ''
                    this.hform.HConkTypeID = 0
                    return
                }
 
                this.hform.HConkTypeName = this.ConkTypeList[index]['故障类别名称']
                this.hform.HConkTypeID = this.ConkTypeList[index]['hitemid']
 
            },
 
            // 故障原因
            async InitConkReason() { // 初始化故障原因
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/PublicPageMethod/Gy_ConkReasonList_PDA',
                        data: {
                            sWhere: '',
                        }
                    })
                    let {
                        count,
                        code,
                        Message,
                        data
                    } = res.data
                    if (count == 1) {
                        this.ConkReasonList = data
                        this.ConkReasonNameList = Array.from(data).map(elem => elem['HName'])
                    } else {
                        CommonUtils.showTips({
                            title: '错误提示',
                            message: "初始化故障原因错误: " + Message,
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '错误提示',
                        message: "初始化故障原因错误: " + err,
                    })
                }
            },
            ConkReasonChange(elem) { // 故障原因改变 句柄
                let index = this.ConkReasonNameList.findIndex(e => e == elem)
 
                if (index == -1) {
                    this.hform.HConkReasonName = ''
                    this.hform.HConkReasonID = 0
                    return
                }
 
                this.hform.HConkReasonName = this.ConkReasonList[index]['HName']
                this.hform.HConkReasonID = this.ConkReasonList[index]['HItemID']
            },
 
            // 部门
            async InitDept() { // 初始化部门
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/PublicPageMethod/DeptList',
                        data: {
                            sWhere: 'where 1=1',
                        }
                    })
                    let {
                        count,
                        code,
                        Message,
                        data
                    } = res.data
                    if (count == 1) {
                        this.DeptList = data
                        this.DeptNameList = Array.from(data).map(elem => elem['HName'])
                    } else {
                        CommonUtils.showTips({
                            title: '错误提示',
                            message: "初始化部门错误: " + Message,
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '错误提示',
                        message: "初始化部门错误: " + err,
                    })
                }
            },
            DeptChange(elem) { // 部门改变 句柄
                let index = this.DeptNameList.findIndex(e => e == elem)
 
                if (index == -1) {
                    this.hform.HDeptName = ''
                    this.hform.HDeptID = 0
                    return
                }
 
                this.hform.HDeptName = this.DeptList[index]['HName']
                this.hform.HDeptID = this.DeptList[index]['HItemID']
            },
 
            // 职员
            async InitEmp() { // 初始化职员
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/Web/GetEmployeeList_Json',
                        data: {
                            Employee: '',
                            HGroupID: 0,
                        }
                    })
                    let {
                        count,
                        code,
                        Message,
                        data
                    } = res.data
                    if (count == 1) {
                        this.EmpList = data
                        this.EmpNameList = Array.from(data).map(elem => elem['HName'])
                    } else {
                        CommonUtils.showTips({
                            title: '错误提示',
                            message: "初始化职员错误: " + Message,
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '错误提示',
                        message: "初始化职员错误: " + err,
                    })
                }
            },
            EmpChange(elem) { // 发现人更改
                let index = this.EmpNameList.findIndex(e => e == elem)
 
                if (index == -1) {
                    this.hform.HEmpName = ''
                    this.hform.HEmpID = 0
                    return
                }
 
                this.hform.HEmpName = this.EmpList[index]['HName']
                this.hform.HEmpID = this.EmpList[index]['HItemID']
            },
            ManagerChange(elem) { // 负责人更改
                let index = this.EmpNameList.findIndex(e => e == elem)
 
                if (index == -1) {
                    this.hform.HManagerName = ''
                    this.hform.HManagerID = 0
                    return
                }
 
                this.hform.HManagerName = this.EmpList[index]['HName']
                this.hform.HManagerID = this.EmpList[index]['HItemID']
            },
 
            async qrCodeDisplay() {
                try {
                    this.$refs.barcodePopup.setCodeInfo(this.hform.HBillNo)
                    await this.$nextTick()
                    this.$refs.barcodePopup.open()
                } catch (err) {
                    uni.showToast({
                        icon: 'none',
                        title: err
                    })
                }
            },
            async refreshBarCodeState() {
                this.barCodeFocus = false
                await this.$nextTick(() => {
                    this.hform.HBarCode = ""
                    this.barCodeFocus = true
                })
            },
            playSound(e) {
                const innerAudioContext = uni.createInnerAudioContext();
                if (e == 1) {
                    innerAudioContext.src = '/static/success.wav';
                } else {
                    innerAudioContext.src = '/static/jingbao.wav';
                }
                innerAudioContext.play(); // 播放音频
            },
            //扫码
            toScanCode() {
                var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
                mpaasScanModule.mpaasScan({
                    'hideAlbum': true,
                    'timeoutInterval': '10', //超时时间
                    'timeoutText': '未识别到二维码' //超时提醒            
                }, (ret) => {
                    console.log(ret.resp_result)
                    if (this.hform.HBarCode == '*') {
                        this.hform.HBarCode = this.hform.HBarCode + ret.resp_result
                    } else {
                        this.hform.HBarCode = ret.resp_result
                    }
 
                    this.getHBarCodeData(this.hform.HBarCode)
                })
            },
            //日期
            HDateChange(e) {
                console.log(e.detail.value)
                this.hform.HDate = e.detail.value
            },
 
            // 扫描条码
            async getHBarCodeData(HBarCode) {
                if (!HBarCode) {
                    CommonUtils.showTips({
                        message: '条形码不能为空'
                    })
                    return
                }
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: '/QJ_PDA_MouldDotCheckBill/txtHBarCode_KeyDown',
                        data: {
                            "HBarCode": HBarCode
                        }
                    })
 
                    let {
                        count,
                        data,
                        Message
                    } = res.data
                    if (count == 1) {
                        this.hform.HMouldID = data[0].HInterID
                        this.hform.HBarName = data[0].HName
                        this.hform.HBarSpec = data[0].HModels
                        this.hform.HBarModel = data[0].HModel2
                        this.barcodeReadOnly = true
                    } else {
                        this.refreshBarCodeState()
                        return CommonUtils.showTips({
                            title: '温馨提示',
                            message: Message
                        })
                    }
                } catch (err) {
                    this.refreshBarCodeState()
                    return CommonUtils.showTips({
                        title: '温馨提示',
                        message: "接口请求失败" + err
                    })
                }
 
            },
            //物料信息
            DisBillEntryList() {
                uni.request({
                    url: this.serverUrl + '/WEBSController/GetBillEntryTmpList_Json',
                    data: {
                        HInterID: this.hform.HInterID,
                        HBillNo: this.hform.HBillNo,
                        HBillType: this.hform.HBillType,
                        HStockOrgID: this.hform.HStockOrgID
                    },
                    success: (res) => {
                        console.log('物料', res.data)
                        if (res.data.count == 1) {
                            var data = res.data.data
                            this.materMeta = data.BarCodeDetailslist
                            this.Materlist = data.Materlist
                            if (/兴达/.test(uni.getStorageSync("Organization"))) {
                                // 兴达客户 带出 仓库
                                console.log("兴达带出默认仓库")
                                this.HWHNameChange(data.BarCodeDetailslist[0].HWHName)
                            }
 
 
                            if (!data.BarCodeDetailslist[0].HBarCode) {
                                this.hform.HMaterName_B = ''
                                this.hform.HMaterModel_B = ''
                                this.hform.HBatchNo_B = ''
                                this.hform.HUnitName_B = ''
                                this.hform.HQty_B = ''
                                this.hform.HTMQty_B = ''
                                this.hform.HWHName_B = ''
                                this.hform.HSPName_B = ''
                            } else {
                                this.hform.HMaterName_B = data.BarCodeDetailslist[0].HMaterName
                                this.hform.HMaterModel_B = data.BarCodeDetailslist[0].HMaterModel
                                this.hform.HBatchNo_B = data.BarCodeDetailslist[0].HBatchNo
                                this.hform.HUnitName_B = data.BarCodeDetailslist[0].HUnitName
                                this.hform.HQty_B = data.BarCodeDetailslist[0].HQty
                                this.hform.HTMQty_B = data.BarCodeDetailslist[0].HTMQty
                                this.hform.HWHName_B = data.BarCodeDetailslist[0].HWHName
                                this.hform.HSPName_B = data.BarCodeDetailslist[0].HSPName
                            }
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            //删除物料码
            delMater(item) {
                uni.showModal({
                    title: '提示',
                    content: '确认要删除 " ' + item.物料名称 + ' " 所有扫码记录?删除后将不可恢复!',
                    success: (res) => {
                        if (res.confirm) {
                            uni.request({
                                url: this.serverUrl +
                                    '/WEBSController/set_DelPonderationBillMain_Temp_InterIDAndSource_Json',
                                data: {
                                    HInterID: this.hform.HInterID,
                                    HMaterID: item.HMaterID,
                                    HAuxPropID: item.HAuxPropID,
                                    HMTONo: item.HMTONo,
                                    HSourceInterID: item.HSourceInterID,
                                    HSourceEntryID: item.HSourceEntryID,
                                    HBillType: this.hform.HBillType
                                },
                                success: (res) => {
                                    if (res.data.count == 1) {
                                        this.DisBillEntryList()
                                    } else {
                                        uni.showToast({
                                            title: res.data.Message,
                                            icon: 'none'
                                        })
                                    }
                                },
                                fail: (res) => {
                                    console.log(res);
                                    uni.showToast({
                                        title: '接口请求失败',
                                        icon: 'none'
                                    })
                                },
                            });
                        }
                    }
                });
            },
            // 新增回调
            addNew() {
                uni.redirectTo({
                    url: '/pages/qijvguzhangdengji/mouldMistakeBill?OperationType=1'
                })
            },
            //新增
            getNewData() {
                uni.request({
                    url: this.serverUrl + '/Web/GetMAXNum',
                    data: {
                        HBillType: this.hform.HBillType
                    },
                    success: (res) => {
                        // console.log(res.data)
                        if (res.data.count == 1) {
                            this.hform.HInterID = 0
                            this.hform.HBillNo = res.data.data[0].HBillNo
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            //修改回填数据
            RoadBillMain(HInterID) {
                uni.request({
                    url: this.serverUrl + '/WEBSController/GetSourceBill_Temp_Json',
                    data: {
                        HInterID: HInterID,
                        HBillType: this.hform.HBillType
                    },
                    success: (res) => {
                        console.log(33, res.data.data[0]);
                        if (res.data.count == 1) {
                            var data = res.data.data[0]
                            this.hform.HInterID = data.HInterID
                            this.hform.HBillNo = data.HBillNo
                            this.hform.HMainSourceBillType = data.HSourceBillType
                            this.hform.HSourceBillNo = data.HSourceBillNo
                            if (data.HSourceBillType == 1105) {
                                this.hform.HMainSourceBillType = 1105
                                this.HMainSourceBillType = '退料通知单'
                                this.showHSupName = false
                            } else if (data.HSourceBillType == 1102) {
                                this.hform.HMainSourceBillType = 1102
                                this.HMainSourceBillType = '采购订单'
                                this.showHSupName = false
                            } else if (data.HSourceBillType == 1201) {
                                this.hform.HMainSourceBillType = 1201
                                this.HMainSourceBillType = '采购入库单'
                                this.showHSupName = false
                            } else {
                                this.hform.HMainSourceBillType = -1
                                this.HMainSourceBillType = '手工录入'
                            }
                            this.showHMainSourceBillType = false
 
                            //非多源单模式
                            if (data.HMulSourceBill == 0) {
                                this.showHSourceBillNo = false
                            }
                            this.hform.HDeptID = data.HDeptID
                            this.hform.HDeptName = data.HDeptName
                            this.hform.HSupID = data.HCusID
                            this.hform.HSupName = data.HSupName
                            this.DisBillEntryList()
                            this.tabs = 2
                        } else {
                            uni.showToast({
                                title: '获取数据回填失败',
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            checkBillValidate() {
                let message = ''
 
                if (!this.hform.HConkTypeName) {
                    message = '未填写故障类别'
                } else if (!this.hform.HConkReasonName) {
                    message = '未填写故障原因'
                } else if (!this.hform.HDeptName) {
                    message = '未填写部门'
                } else if (!this.hform.HEmpName) {
                    message = '未填写发现人'
                } 
                // else if (!this.hform.HManagerName) {
    //                 message = '未填写负责人'
    //             }
 
                if (!message) {
                    return true
                }
 
                CommonUtils.showTips({
                    message: message
                })
                return false
            },
            async submit() {
                if (!this.checkBillValidate()) {
                    return
                }
                let oMain = JSON.stringify(this.hform)
                let sSubStr = JSON.stringify([{
                    "HConkReasonID": this.hform.HConkReasonID,
                    "HConkReasonCode": "",
                    "HConkReasonName": this.hform.HConkReasonName,
                    "HConkExplanation": this.hform.HExplanation,
                    "HManagerID": this.hform.HManagerID,
                    "HManagerCode": "",
                    "HManagerName": this.hform.HManagerName,
                    "HRemark": "  "
                }])
                let sMainSub = `${oMain};${sSubStr};${getUserInfo()["Czymc"]};1`
                try {
                    this.EnableSave = false
                    let res = await CommonUtils.doRequest2Sync({
                        url: '/Sc_MouldConkBookBill/SaveGetMouldConkBookBillList',
                        data: {
                            msg: sMainSub
                        },
                        method: 'POST'
                    })
 
                    if (!res) {
                        return
                    }
 
                    let {
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        uni.showModal({
                            title: '提示',
                            content: res.data.Message + '。是否继续新增?',
                            success: (res) => {
                                if (res.confirm) {
                                    console.log('用户点击确定');
                                    uni.redirectTo({
                                        url: '/pages/qijvguzhangdengji/mouldMistakeBill?OperationType=1'
                                    })
                                } else if (res.cancel) {
                                    console.log('用户点击取消');
                                    // setTimeout(() => {
                                    //     uni.navigateBack();
                                    // }, 50)
                                }
                            }
                        });
                    } else {
                        CommonUtils.showTips({
                            title: '温馨提示',
                            message: Message
                        })
                        this.EnableSave = true
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: '温馨提示',
                        message: err
                    })
                    this.EnableSave = true
                }
            },
 
            goBack() {
                uni.showModal({
                    title: '提示',
                    content: '确认要退出当前页面吗?',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.navigateBack()
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .form {
        width: 668rpx;
        margin: 20rpx auto;
        padding-bottom: 240rpx;
    }
 
    .tab_area {
        width: 100%;
        height: 50rpx;
    }
 
    .other {
        margin-top: 8rpx;
        text-align: center;
        font-size: 28rpx;
        padding: 4rpx 18rpx;
        color: #1890FF;
    }
 
    .tabs {
        width: 100%;
        display: flex;
        border-bottom: 1px solid #ddd;
        margin: 20rpx 0;
 
        view {
            width: 25%;
            font-size: 30rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
        }
 
        .on {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
        }
    }
 
    .form-item {
        display: flex;
        align-items: center;
        font-size: inherit;
        padding: 6rpx 0;
        gap: 12rpx;
 
        .title {
            width: 200rpx;
            font-size: 30rpx;
 
            text {
                color: red;
                font-weight: bold;
            }
        }
 
        .right {
            flex: 1;
            border-radius: 22rpx;
            border: 1px solid #acacac;
            position: relative;
            padding: 8rpx 16rpx;
            display: flex;
            font-size: 30rpx;
 
            picker {
                width: 100%;
            }
 
            .uni-combox {
                width: 100%;
                padding: 0;
 
                ::v-deep .uni-combox__input {
                    font-size: 30rpx;
                    height: auto;
                }
            }
        }
 
        .righton {
            flex: 1;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
            padding: 8rpx 16rpx;
            font-size: 30rpx;
        }
 
        input {
            width: 100%;
            font-size: 30rpx;
        }
 
        textarea {
            width: 98%;
            font-size: 30rpx;
        }
 
    }
 
    .bottom-btn {
        width: 100%;
        box-sizing: border-box;
        // height: 120rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        background-color: #fff;
        box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
        padding: 30rpx 40rpx 40rpx 40rpx;
        display: flex;
        flex-direction: row;
        gap: 10rpx;
 
        button {
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
 
        .btn-a {
            background-color: #3A78FF;
            color: #fff;
        }
 
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
 
        .btn-c {
            background-color: #acacac;
            color: #fff;
            // position: absolute;
            // right: 120rpx;
        }
 
        .btn-d {
            background-color: #ff8901;
            color: #fff;
        }
    }
 
    .list {
        width: 100%;
 
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
 
            .detail {
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
 
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
 
        .more {
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
 
            .part {
                width: 50%;
                text-align: center;
            }
        }
    }
 
    .icon-wrapper {
        background-color: #3A78FF;
        width: 52rpx;
        height: 52rpx;
        border-radius: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
 
        .uni-icons {
            color: #fff !important;
        }
    }
 
    .required {
        position: relative;
 
    }
 
    .required::after {
        content: "*";
        position: relative;
        color: red;
        left: 0;
        top: 0;
        font-size: inherit;
    }
 
    .icon-wrapper[disabled] {
        background-color: rgba(228, 228, 228, 1);
        pointer-events: none;
        touch-action: none;
    }
 
    .readonly {
        background-color: #efefef4d;
    }
</style>