1
yhj
2025-03-31 9003044073373185511f1e2c901285a3287e7fa4
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
<!doctype html>
<html>
 
    <head>
        <meta charset="utf-8">
        <title></title>
        <meta name="viewport"
            content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <script src="../../js/mui.min.js"></script>
        <script src="../../js/api.js"></script>
        <script src="../../js/common.js"></script>
        <script src="../../js/jquery.js"></script>
        <script src="../../js/jquery-1.11.1.js"></script>
        <script src="../../js/jquery.xml2json.js.js"></script>
        <script src="../../js/template-web.js"></script>
        <link href="../../css/mui.min.css" rel="stylesheet" />
        <link rel="stylesheet" type="text/css" href="../../css/iconfont.css" />
        <link rel="stylesheet" type="text/css" href="../lyt/css/common_s.css" />
        <style>
            .mui-input-row label {
                background-color: #F0F0F0;
                font-size: 1.6rem;
            }
 
            .mui-input-row input {
                font-size: 1.35rem;
            }
 
            .mui-input-row select {
                font-size: 1.35rem;
                position: absolute;
                height: 3rem;
            }
 
            .mui-input-group .mui-input-row {
                height: 3.2rem;
            }
 
            .font {
                font-size: 1.6rem;
            }
 
            .item-height {
                height: 4rem;
            }
 
            .item-fname {
                position: absolute;
                height: 1.8rem;
                font-size: 1.6rem;
                color: #000000;
            }
 
            .mui-toast-container {
                top: 50% !important;
            }
 
            .mui-toast-message {
                font-size: 1rem;
                padding: 10px 25px;
                text-align: center;
                color: #fff;
                border-radius: 6px;
                background-color: #323232;
            }
        </style>
    </head>
 
    <body class="mui-fullscreen">
        <header class="mui-bar mui-bar-nav">
            <button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">
                <span class="mui-icon mui-icon-left-nav"></span>
            </button>
            <h1 class="mui-title font">PQC巡检录入</h1>
            <span class="title-right" id="usr"></span>
            <span class="title-right mui-icon mui-icon-camera" style="color:#0062CC" id="cameraId"></span>
            <span class="title-right mui-icon mui-icon-bars" style="color:#0062CC;" id="recodeList"></span>
        </header>
        <div class="mui-content">
            <div class="mui-input-group">
                <div class="mui-input-row">
                    <label>班次</label>
                    <span class="radio_inline mui-radio">
                        <input name="radio1" type="radio" id="A" value="A">
                        <label for="A" style="background-color: #ffffff;">A</label>
                        <input name="radio1" type="radio" id="B" value="B">
                        <label for="B" style="background-color: #ffffff;">B</label>
                    </span>
                </div>
                <div class="mui-input-row">
                    <label>系列</label>
                    <select id="lineType" class="mui-input"></select>
                </div>
                <div class="mui-input-row">
                    <label>工序</label>
                    <select id="proc_num"></select>
                </div>
                <div class="mui-input-row">
                    <label>时间段</label>
                    <select id="selectPeriod" onchange="selPeriod()">
                        <!-- <option value=""></option> -->
                    </select>
                </div>
                <div class="mui-input-row">
                    <label>型号</label>
                    <input id="board_model" type="text" class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label>工单</label>
                    <input id="selectBatch" type="text" class="mui-input-clear">
                </div>
                <div class="mui-input-row" style="display: none;">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>文件编号</label>
                    <input id="filenum" type="text" class="mui-input-clear">
                </div>
                <div class="mui-input-row" style="display: none;">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>文件版本</label>
                    <input id="filever" type="text" class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>检验单号</label>
                    <input id="fbill_no" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
                <div class="mui-input-row" style="display: none;">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>极性</label>
                    <input id="polarity" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>数量</label>
                    <input id="batch_count" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>检验人</label>
                    <input id="check_name" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>检验时间</label>
                    <input id="check_time" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
                <div class="mui-input-row" style="display: none;">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>批次号</label>
                    <input id="task_no" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
 
                <div class="mui-input-row">
                    <label onclick="clicked('commom/saomiao.html','premark','web/lyt/PQCxunjian.html');">
                        <span class="mui-icon iconfont icon-saomiao" id="num1"></span>备注信息
                    </label>
                    <input id="premark" type="text" class="mui-input-clear">
                </div>
                <div class="mui-input-row">
                    <label><span class="mui-icon iconfont" style="color: #FF8C00;"></span>检验结果</label>
                    <input id="presult" type="text" disabled="disabled" style="background-color: #F5F5F5;"
                        class="mui-input-clear">
                </div>
                <div class="mui-input-row" style="display: none;">
                    <ul class="mui-table-view">
                        <li class="mui-table-view-cell acss" id="getOkBtn"
                            style="width:100%;background-color: rgb(153,204,153);">
                            <a class="font">获取合格结果</a>
                        </li>
                    </ul>
                </div>
                <div class="mui-input-row">
                    <ul class="mui-table-view">
                        <li class="mui-table-view-cell acss" id="doAppearance"
                            style="width:100%;background-color: rgb(255, 145, 0);">
                            <a class="font">外观一键合格</a>
                        </li>
                    </ul>
                </div>
                <div class="mui-input-row">
                    <label>最终结果</label>
                    <span class="radio_inline mui-radio">
                        <input name="final_result" type="radio" value="合格">
                        <label for="合格" style="background-color: #ffffff;">合格</label>
                        <input name="final_result" type="radio" value="不合格">
                        <label for="不合格" style="background-color: #ffffff;">不合格</label>
                    </span>
                </div>
                <div class="mui-input-row" style="display: none;">
                    <ul class="mui-table-view" id="submitBtn">
                        <li class="mui-table-view-cell acss"
                            style="width:50%;float: left;background-color: rgb(184, 245, 184)">
                            <a class="font" data-code='送检'>送检</a>
                        </li>
                        <li class="mui-table-view-cell acss" style="width:50%;background-color: rgb(255, 167, 126)">
                            <a class="font" data-code='撤销送检'>撤销送检</a>
                        </li>
                    </ul>
                </div>
                <div class="mui-input-row">
                    <ul class="mui-table-view" id="submitBtn1">
                        <li class="mui-table-view-cell acss"
                            style="width:50%;float: left;background-color: rgb(153,204,153)">
                            <a class="font" data-code='提交'>提交</a>
                        </li>
                        <li class="mui-table-view-cell acss" style="width:50%;background-color: rgb(255,153,102)">
                            <a class="font" data-code='撤销提交'>撤销提交</a>
                        </li>
                    </ul>
                </div>
                <div class="mui-input-row">
                    <ul class="mui-table-view">
                        <li class="mui-table-view-cell acss" id="delBtn"
                            style="width:100%;background-color: rgb(255, 145, 0);">
                            <a class="font" data-code='删除'>删除</a>
                        </li>
                    </ul>
                </div>
            </div>
            <script id='ui-template' type="text/template">
                <% for(var i in record){ var item=record[i];var n = i>10?i%10:i; var colors=['99CCFF','FFCC33','FFFF33','FFCC00','66CC00','FFFF99','FF9900','FFFF00','0099CC','FFCC00','CCCC00'];var c=colors[n]; %>
                    <li class="mui-table-view-cell mui-media item-height">
                        <a href="javascript:;" class="mui-navigate-right font" id="<%=(item.ID)%>" sample_qty="<%=(item.CHECK_NUMBER)%>" fis_quan="<%=(item.FIS_QUAN)%>" mid="<%=(item.MID)%>" fname="<%=(item.FNAME)%>">
                         {{if item.FCHECK_RESULT=='合格'}}
                            <div class="font-seal font" style="color: #4CD964;border: 1px solid #4CD964"><%=(item.FCHECK_RESULT)%></div>
                            {{else if item.FCHECK_RESULT=='不合格'}}
                            <div class="font-seal font"><%=(item.FCHECK_RESULT)%></div>
                            {{else if item.FCHECK_RESULT=='/'}}
                                <div class="font-seal font" style="color: #4CD964;border: 1px solid #4CD964"><%=(item.FCHECK_RESULT)%></div>
                            {{else}}
                            {{/if}}
                        <span class="mui-media-object mui-pull-left" style="border-radius: 50%;    height: 30px;    width: 30px;    display: inline-block;    background: #<%=(c)%>;      vertical-align: top;">
                        <span style="display: block;    color: #FFFFFF;    height: 30px;    line-height: 30px;    text-align: center"><%=(++i)%></span>  </span>
                        </span>
                            <div class="mui-media-body"> 
                                <p class="item-fname"><%=(item.FNAME)%>&nbsp;&nbsp;
                                <%if(item.FLOWER){%>
                                <%=(item.FLOWER)%>-<%=(item.FUPPER)%>
                                <%}%></p><br>
                                <p class='mui-ellipsis' style="font-size: 1.2rem;"><%=(item.FREQU)%></p>
                            </div>
                        </a>
                    </li>
                <% } %>
            </script>
            <input type="hidden" id="flot" value="" />
            <input type="hidden" id="mid" value="" />
            <ul class="mui-table-view" id="ulId">
            </ul>
        </div>
        <script type="text/javascript" charset="utf-8">
            window.addEventListener('refresh', function(e) { //监听页面返回事件
                if ($("#flot").val() != "") {
                    getBacthInfoDet()
                } else {
                    getDataById($('#fbill_no').val())
                }
            });
            window.addEventListener("changeModel", function(e) {
                var stat = e.detail.flot;
                $("#board_model").val(stat)
                clear()
            })
            window.addEventListener('changeBatch', function(e) {
                //获取参数值
                var stat = e.detail.task; //显示在页面上
                var task = e.detail.flot //实际传递的值
                //console.log(stat)
                //console.log(task)
                if (stat && task) {
                    $("#flot").val(task)
                    $("#selectBatch").val(stat)
                    var checkValue1 = $('input:radio[name="radio1"]:checked').val();
                    //    var checkValue2 = $('input:radio[name="radio2"]:checked').val();
                    var checkValue2 = $('#lineType').val();
                    var period = $('#selectPeriod').val();
                    var batch = $("#flot").val()
                    if (checkValue1 != null && checkValue2 != "" && batch != "" && period != "" && batch != null) {
                        getBacthInfoDet()
                    }
                }
            });
            // 监听记录查询 如果状态为待提交,获得待提交的检验单号
            window.addEventListener('restart', function(e) {
                var mid_id = e.detail.mid_id
                getDataById(mid_id) // 检验单号
            })
            window.addEventListener("changeBar", function(e) { //扫码之后返回的数据
                var inputId = e.detail.inputId
                document.getElementById(inputId).value = e.detail.barcode;
                if (inputId == "premark") {
                    var ftableName = "pqc_testbill_main"
                    var fchangeName = "FNG_REASON"
                    var fvalues = e.detail.barcode;
                    modifyValue(ftableName, fchangeName, fvalues)
                }
            });
            mui.init({});
            mui.plusReady(function() {
                document.getElementById("usr").innerHTML = setUsrCode()
                doAppearance()
                getLineType()
                getOkBtn()
                //跳转到上传附件页面
                document.getElementById('cameraId').addEventListener('tap', function(event) {
                    var mid = document.getElementById('mid').value;
                    if (mid == '' || mid == 'undefined') {
                        mui.toast('请先填写选择批次号')
                        return;
                    }
                    mui.openWindow({
                        id: 'PQC_pictrue_add',
                        url: 'PQC_pictrue_add.html?mid=' + mid + '&type=11',
                        extras: {
                            urlPath: storage["_basePath"] + '/lyt_file/uploadFilepqc',
                            getImgUrl: "/lyt_file/getFilesList",
                            getviewUrl: storage["_basePath"] + '/lyt_file/view',
                        },
                        waiting: { // 控制 弹出转圈框的信息
                            autoShow: true, //自动显示等待框,默认为true 
                            title: '加载中' //等待对话框上显示的提示内容 
                        }
                    });
 
                });
                //查询型号
                document.getElementById('board_model').addEventListener('tap', function(event) {
                    if ($("#proc_num").val() == "" || $("#proc_num").val() == null) {
                        mui.toast("请先选择工序", {
                            duration: 'long',
                            type: 'div'
                        })
                        return false;
                    } else {
                        mui.openWindow({
                            id: 'pqc_task_xunjian',
                            url: 'pqc_task_xunjian.html',
                            extras: {
                                searchType: "型号",
                                urlId: "/pqc_patrol_input/getPatrolBatchNum",
                                fparam: {
                                    "procno": $("#proc_num").val(),
                                    "modelno": "",
                                    "period": $("#selectPeriod").val(),
                                    "lineType": $("#lineType").val()
                                }
                            },
                            waiting: { // 控制 弹出转圈框的信息
                                autoShow: true, //自动显示等待框,默认为true 
                                title: '加载中' //等待对话框上显示的提示内容 
                            }
                        });
                    }
                });
                //查询工单
                document.getElementById('selectBatch').addEventListener('tap', function(event) {
                    if ($("#proc_num").val() == "" || $("#proc_num").val() == null ||
                        $("#board_model").val() == "" || $("#board_model").val() == null) {
                        mui.toast("请先选择工序和型号", {
                            duration: 'long',
                            type: 'div'
                        })
                        return false;
                    } else {
                        mui.openWindow({
                            id: 'pqc_task_xunjian',
                            url: 'pqc_task_xunjian.html',
                            extras: {
                                searchType: "工单",
                                urlId: "/pqc_patrol_input/getPatrolBatchNum",
                                fparam: {
                                    "procno": $("#proc_num").val(),
                                    "modelno": $("#board_model").val(),
                                    "period": $("#selectPeriod").val()
                                }
                            },
                            waiting: { // 控制 弹出转圈框的信息
                                autoShow: true, //自动显示等待框,默认为true 
                                title: '加载中' //等待对话框上显示的提示内容 
                            }
                        });
                    }
                });
            })
 
            //修改备注
            $('#premark').bind('keyup', function(event) {
                if (event.keyCode == "13") { //输入回车执行
                    var ftableName = "pqc_testbill_main"
                    var fchangeName = "fng_reason"
                    var fvalues = $('#premark').val()
                    modifyValue(ftableName, fchangeName, fvalues)
                }
            });
 
            //修改字段数据
            function modifyValue(ftableName, fchangeName, fvalues) { //表名,字段名,字段值
                var fmid = document.getElementById('mid').value;
                if (fmid == '' || fmid == 'undefined') {
                    mui.toast('请先填写选择批次号', {
                        duration: 'long',
                        type: 'div'
                    })
                    return false;
                }
                aj.post('/pqc_first_input/modifyPQCValue', {
                    "factory": api_localStorageGet("factory"),
                    "company": api_localStorageGet("company"),
                    userNo: api_localStorageGet("code"),
                    mid: fmid,
                    tableName: ftableName, //表名
                    changeName: fchangeName, //字段名
                    changeValue: fvalues, //字段值
                }, function(data) {
                    if (data.result) {
                        console.log(JSON.stringify(data))
                        mui.toast('修改成功', {
                            duration: 'long',
                            type: 'div'
                        })
                    } else {
                        mui.alert(data.msg)
                    }
                })
            }
 
 
            $('input:radio[name="radio1"]').click(function() {
                var checkValue1 = $('input:radio[name="radio1"]:checked').val();
                // var checkValue2 = $('input:radio[name="radio2"]:checked').val();
                var checkValue2 = $('#lineType').val();
                if (checkValue1 != null && checkValue2 != "") {
                    getProcInfo()
                }
                var batch = $("#flot").val()
                if (batch != "") {
                    cleanDet()
                }
            })
 
            $('input:radio[name="final_result"]').click(function() {
                setFinal()
            })
            //修改最终结果
            function setFinal() {
                var fvalues = $('input:radio[name="final_result"]:checked').val();
                var ftableName = "pqc_testbill_main"
                var fchangeName = "ffinal_result"
                modifyValue(ftableName, fchangeName, fvalues)
            }
 
            $("#lineType").on("change", function(e) {
                var checkValue1 = $('input:radio[name="radio1"]:checked').val();
                //var checkValue2 = $('input:radio[name="radio2"]:checked').val();
                var checkValue2 = $('#lineType').val();
                if (checkValue1 != null && checkValue2 != '') {
                    getProcInfo()
                }
                clear()
                document.getElementById('board_model').value = ''
            })
 
            function selPeriod() { //选择时间段的触发事件
                clear()
                document.getElementById('board_model').value = ''
            }
 
            $("#proc_num").on("change", function() {
                getPeriodData()
                clear()
                document.getElementById('board_model').value = ''
            })
            
            // 记录查询中状态为待提交,根据待提交的检验单号查询数据
            function getDataById(mid_id) {
                aj.post("/pqc_patrol_input/getBillReturn", {
                    "billNo": mid_id
                }, function(data) {
                    // console.log(JSON.stringify(data.data.MAIN))
                    if (data.result) {
                        var main = data.data.MAIN[0]
                        $("#lineType").val(main.LINE_TYPE)
                        if (main.CLASS_NO == 'A') {
                            $('input:radio[name="radio1"]').eq(0).prop("checked", true)
                        } else if (main.CLASS_NO == 'B') {
                            $('input:radio[name="radio1"]').eq(1).prop("checked", true)
                        }
                        
                        // 先获取到工序的option选项
                        var checkValue1 = $('input:radio[name="radio1"]:checked').val();
                        var checkValue2 = $('#lineType').val();
                        if (checkValue1 != null && checkValue2 != "") {
                            getProcInfo()
                        }
                        // 根据返回的工序编码选择option对应的工序名称
                        var opts = document.getElementById("proc_num");
                        var value = main.PROC_NO //这个值就是你获取的值;  
                        // console.log(value)
                        if (value != "") {
                            // console.log(opts.options.length)
                            for (var i = 0; i < opts.options.length; i++) {
                                if (value == opts.options[i].value) {
                                    opts.options[i].selected = 'selected';
                                    // alert(opts.options[i].value);
                                    break;
                                }
                            }
                        }
                        
                        // 先获取到时间段的option选项
                        var mproc = $('#proc_num').val();
                        if (checkValue1 != "" || mproc != "" || checkValue1 != undefined || mproc != null) {
                            getPeriodData()
                        } 
                        // 根据返回的时间段选择option对应的时间段
                        opts = document.getElementById("selectPeriod");
                        value = main.TIME_SLOT //这个值就是你获取的值;  
                        if (value != "") {
                            for (var i = 0; i < opts.options.length; i++) {
                                if (value == opts.options[i].value) {
                                    opts.options[i].selected = 'selected';
                                    break;
                                }
                            }
                        }
                        
                        $('#board_model').val(main.BOARD_MODEL) //型号
                        $('#selectBatch').val(main.FLOT_NO) // 工单
                        $("#batch_count").val(main.FLOT_QTY) //数量
                        $('#check_name').val(main.USFNAME) // 检验人员
                        $('#check_time').val(main.FTEST_DATE) //检验时间
                        $('#fbill_no').val(main.FBILL_NO) // 检验单号
                        $("#presult").val(main.FCHECK_RESULT) //检验结果
                        $("#premark").val(main.FNG_REASON) //备注信息
                        $("#mid").val(main.ID) //主表ID
                        if (main.FFINAL_RESULT == "合格") { // 最终结果
                            $('input:radio[name="final_result"]').eq(0).prop("checked", true)
                        } else if (main.FFINAL_RESULT == "不合格") {
                            $('input:radio[name="final_result"]').eq(1).prop("checked", true)
                        } else { //都未选择
                            var final_result = document.getElementsByName("final_result");
                            for (var i = 0; i < final_result.length; i++) {
                                if (final_result[i].checked == true) {
                                    final_result[i].checked = false;
                                    final_result[i].removeAttribute("checked");
                                }
                            }
                        }
                        
                        //渲染检验项目
                        var cursor2 = checkZero(data.data.SUB) //对小数点前丢失的0进处理
                        document.getElementById('ulId').innerHTML = template('ui-template', {
                            "record": cursor2
                        });
 
                    } else {
                        mui.toast(data.msg, {
                            duration: 'long',
                            type: 'div'
                        });
                    }
                });
            }
 
            function getBacthInfoDet() {
                aj.post('/pqc_patrol_input/getPatrolBatchNumInfo', {
                    "factory": api_localStorageGet("factory"),
                    "company": api_localStorageGet("company"),
                    "userNo": api_localStorageGet("code"),
                    "lineType": $("#lineType").val(),
                    "procNo": $("#proc_num").val(),
                    "lotNo": $("#flot").val(),
                    "classNo": $("input[name='radio1']:checked").val(),
                    "period": $("#selectPeriod").val(),
                }, function(data) {
                    if (data.result) {
                        // console.log(JSON.stringify(data.data.cursor1))
                        //console.log(JSON.stringify(data.data.cursor2))
                        //数值填置
                        var cursor1 = data.data.cursor1
                        $("#filenum").val(cursor1[0].FILE_NO)
                        $("#filever").val(cursor1[0].FILE_VERSION)
                        $("#proc_num").val(cursor1[0].PROC_NO)
                        $("#check_name").val(cursor1[0].BNAME)
                        $("#check_time").val(cursor1[0].FTEST_DATE)
                        $("#board_model").val(cursor1[0].BOARD_MODEL)
                        $("#batch_count").val(cursor1[0].FLOT_QTY)
                        $("#machine").val(cursor1[0].MACHINE_NO)
                        $("#task_no").val(cursor1[0].TASK_NO)
                        $("#presult").val(cursor1[0].FCHECK_RESULT)
                        $("#premark").val(cursor1[0].FNG_REASON)
                        $("#mid").val(cursor1[0].ID)
                        $("#polarity").val(cursor1[0].POLAR_TYPE)
                        $("#fbill_no").val(cursor1[0].FBILL_NO);
 
                        if (cursor1[0].FFINAL_RESULT == "合格") {
                            $('input:radio[name="final_result"]').eq(0).prop("checked", true)
                        } else if (cursor1[0].FFINAL_RESULT == "不合格") {
                            $('input:radio[name="final_result"]').eq(1).prop("checked", true)
                        } else { //都未选择
                            var final_result = document.getElementsByName("final_result");
                            for (var i = 0; i < final_result.length; i++) {
                                if (final_result[i].checked == true) {
                                    final_result[i].checked = false;
                                    final_result[i].removeAttribute("checked");
                                }
                            }
                        }
 
                        //填置列表
                        var cursor2 = checkZero(data.data.cursor2) //对小数点前丢失的0进处理
                        document.getElementById('ulId').innerHTML = template('ui-template', {
                            "record": cursor2
                        });
                    } else {
                        clear()
                        document.getElementById('board_model').value = ''
                        $("#flot").val("")
                        $("#selectBatch").val("")
                        $("#selectPeriod").val("")
                        mui.alert(data.msg)
                    }
                })
            }
 
            function getPeriodData() {
                var checkValue1 = $('input:radio[name="radio1"]:checked').val();
                var mproc = $('#proc_num').val();
                if (checkValue1 == "" || mproc == "" || checkValue1 == undefined || mproc == null) {
                    mui.toast("请先选择班次和工序", {
                        duration: 'long',
                        type: 'div'
                    })
                    return;
                } else {
                    $.ajax({
                        url: storage['_basePath'] + "/pqc_patrol_input/getPeriod",
                        data: {
                            "factory": api_localStorageGet("factory"),
                            "company": api_localStorageGet("company"),
                            "classNo": checkValue1,
                            "proc": mproc
                        },
                        type: 'post',
                        dataType: "json",
                        async: false,
                        success: function(data) {
                            // console.log(JSON.stringify(data))
                            if (data.result) {
                                var period = data.data
                                $("#selectPeriod").empty()
                                $("#selectPeriod").append("<option value=''>请选择时间段</option>")
                                for (var i = 0; i < period.length; i++) {
                                    $("#selectPeriod").append("<option value=" + period[i].TIME_SLOT + ">" + period[
                                            i]
                                        .TIME_SLOT + "</option>")
                                }
                            } else {
                                mui.toast(data.msg, {
                                    duration: 'long',
                                    type: 'div'
                                });
                            }
                        }
                    });
                    // aj.post("/pqc_patrol_input/getPeriod", {
                    // "factory": api_localStorageGet("factory"),
                    // "company": api_localStorageGet("company"),
                    // "classNo": checkValue1,
                    // "proc": mproc
                    // }, function(data) {
                    //     console.log(JSON.stringify(data))
                    //     if (data.result) {
                    //         var period = data.data
                    //         $("#selectPeriod").empty()
                    //         $("#selectPeriod").append("<option value=''>请选择时间段</option>")
                    //         for (var i = 0; i < period.length; i++) {
                    //             $("#selectPeriod").append("<option value=" + period[i].TIME_SLOT + ">" + period[i]
                    //                 .TIME_SLOT + "</option>")
                    //         }
                    //     } else {
                    //         mui.toast(data.msg, {
                    //             duration: 'long',
                    //             type: 'div'
                    //         });
                    //     }
                    // });
                }
 
            }
 
            // function getProcInfo() {
            //     aj.post("/pqc_patrol_input/getPatrolBatchNum", {
            //         "factory": api_localStorageGet("factory"),
            //         "company": api_localStorageGet("company"),
            //         "ftype": "工序",
            //         "period": "",
            //         "procno": "",
            //         "modelno": "",
            //         "keyword": $("#lineType").val()
            //     }, function(data) {
            //         if (data.result) {
            //             //console.log(JSON.stringify(data) )
            //             $("#proc_num").empty()
            //             var data = data.data
            //             $("#proc_num").append("<option value=''>请选择</option>")
            //             for (var i = 0; i < data.length; i++) {
            //                 var list = data[i]
            //                 $("#proc_num").append("<option value=" + list.PROC_NO + ">" + list.PROC_NAME + "</option>")
            //             }
            //         } else {
            //             mui.toast(data.msg, {
            //                 duration: 'long',
            //                 type: 'div'
            //             });
            //         }
            //     });
            // }
 
            function getProcInfo() {
                $.ajax({
                    url: storage['_basePath'] + "/pqc_patrol_input/getPatrolBatchNum",
                    data: {
                        "factory": api_localStorageGet("factory"),
                        "company": api_localStorageGet("company"),
                        "ftype": "工序",
                        "period": "",
                        "procno": "",
                        "modelno": "",
                        "keyword": $("#lineType").val()
                    },
                    type: 'post',
                    dataType: "json",
                    async: false,
                    success: function(data) {
                        if (data.result) {
                            //console.log(JSON.stringify(data) )
                            $("#proc_num").empty()
                            var data = data.data
                            $("#proc_num").append("<option value=''>请选择</option>")
                            for (var i = 0; i < data.length; i++) {
                                var list = data[i]
                                $("#proc_num").append("<option value=" + list.PROC_NO + ">" + list.PROC_NAME +
                                    "</option>")
                            }
                        } else {
                            mui.toast(data.msg, {
                                duration: 'long',
                                type: 'div'
                            });
                        }
                    }
                });
            }
 
            //外观一键合格
            function doAppearance() {
                document.querySelector('#doAppearance').addEventListener('tap', function() {
                    var flotId = document.getElementById('mid').value;
                    aj.post("/pqc_first_input/setOK", {
                        "factory": api_localStorageGet("factory"),
                        "company": api_localStorageGet("company"),
                        "userNo": api_localStorageGet("code"),
                        "checkId": flotId
                    }, function(data) {
                        //console.log(JSON.stringify(data))
                        if (data.result) {
                            if ($("#flot").val() != "") {
                                getBacthInfoDet()
                            } else {
                                getDataById($('#fbill_no').val())
                            }
                            mui.toast("操作成功", {
                                duration: 'long',
                                type: 'div'
                            })
                        } else {
                            mui.toast(data.msg, {
                                duration: 'long',
                                type: 'div'
                            });
                        }
                    });
                });
            }
 
            function getOkBtn() {
                document.querySelector('#getOkBtn').addEventListener('tap', function() {
                    var flotId = document.getElementById('mid').value;
                    aj.post("/pqc_patrol_input/getOkResult", {
                        "factory": api_localStorageGet("factory"),
                        "company": api_localStorageGet("company"),
                        "userNo": api_localStorageGet("code"),
                        "mid": flotId
                    }, function(data) {
                        //console.log(JSON.stringify(data))
                        if (data.result) {
                            getBacthInfoDet()
                            mui.toast("操作成功!", {
                                duration: 'long',
                                type: 'div'
                            })
                        } else {
                            mui.toast(data.msg, {
                                duration: 'long',
                                type: 'div'
                            });
                        }
                    });
                });
            }
 
            function getLineType() {
                aj.post("/pqc_patrol_input/getPatrolBatchNum", {
                    "factory": api_localStorageGet("factory"),
                    "company": api_localStorageGet("company"),
                    "ftype": "产线类型",
                    "period": "",
                    "procno": "",
                    "modelno": "",
                    "keyword": ""
                }, function(data) {
                    if (data.result) {
                        //console.log(JSON.stringify(data) )
                        $("#lineType").empty()
                        var data = data.data
                        $("#lineType").append("<option value=''>请选择</option>")
                        for (var i = 0; i < data.length; i++) {
                            var list = data[i]
                            $("#lineType").append("<option value=" + list.LOOKUP_NAME + ">" + list.LOOKUP_NAME +
                                "</option>")
                        }
                    } else {
                        mui.toast(data.msg, {
                            duration: 'long',
                            type: 'div'
                        });
                    }
                });
            }
 
            mui("#submitBtn").on("tap", "a", function(event) {
                var code = this.getAttribute('data-code');
                doSubmit(code);
            })
            mui("#submitBtn1").on("tap", "a", function(event) {
                var code = this.getAttribute('data-code');
                if (code == "提交") {
                    checker()
                } else {
                    doSubmit(code);
                }
            })
 
            mui("#delBtn").on("tap", "a", function(event) {
                var elem = this;
                var btnArray = ['确认', '取消'];
                mui.confirm('确认删除该条记录?', '系统提示', btnArray, function(e) {
                    if (e.index == 0) {
                        var code = elem.getAttribute('data-code');
                        doSubmit(code);
                    }
                });
            })
 
            function doSubmit(opertype) {
                var mid = document.getElementById('mid').value;
                if (mid == '' || mid == 'undefined') {
                    mui.toast('请先填写选择批次号', {
                        duration: 'long',
                        type: 'div'
                    })
                    return;
                }
                aj.post("/pqc_first_input/submitInfo", {
                    factory: api_localStorageGet("factory"),
                    company: api_localStorageGet("company"),
                    userNo: api_localStorageGet("code"),
                    checkId: mid,
                    operaType: opertype,
                    remarks: document.getElementById('premark').value
                }, function(data) {
                    // console.log(JSON.stringify(data))
                    if (data.result) {
                        mui.toast('操作成功', {
                            duration: 'long',
                            type: 'div'
                        });
                        if (opertype == '删除') {
                            clear()
                            document.getElementById('board_model').value = ''
                            $("#flot").val("")
                            $("#selectBatch").val("")
                        }
                    } else {
                        mui.toast(data.msg, {
                            duration: 'long',
                            type: 'div'
                        });
                    }
                });
            }
 
            function checker() {
                var mid = document.getElementById('mid').value;
                if (mid == '' || mid == 'undefined') {
                    mui.toast('请先填写选择批次号', {
                        duration: 'long',
                        type: 'div'
                    })
                    return;
                }
                var presult = document.getElementById('presult').value;
                if (presult == '' || presult == 'undefined') {
                    mui.toast('检验结果为空,请检查', {
                        duration: 'long',
                        type: 'div'
                    })
                    return;
                }
                mui.openWindow({
                    id: 'pqc_checker',
                    url: 'pqc_checker.html',
                    extras: {
                        searchType: "checker",
                        urlId: "/pqc_first_input/getChecker",
                        fparam: {
                            "checkTask": $('#fbill_no').val(),
                            "mid": mid,
                            "premark": document.getElementById('premark').value
                        }
                    },
                    waiting: { // 控制 弹出转圈框的信息
                        autoShow: true, //自动显示等待框,默认为true 
                        title: '加载中' //等待对话框上显示的提示内容 
                    }
                });
            }
 
            mui("#ulId").on("tap", "a", function() {
                var id = this.getAttribute('id');
                var fis_quan = this.getAttribute('fis_quan');
                var fname = this.getAttribute('fname')
                var lineType = $("#lineType").val()
                var fboard_model = $("#board_model").val()
                var url = 'PQC_check_add_update.html?did=' + id + '&num=' + this.getAttribute('sample_qty') +
                    '&mid=' + this.getAttribute('mid') + '&proc=' + $("#proc_num").val() + '&board_model=' +
                    encodeURI(
                        fboard_model) +
                    '&lineType=' + encodeURI(lineType) + '&fname=' + encodeURI(fname);
                mui.openWindow({
                    id: id,
                    url: url,
                    extras: {
                        //自定义扩展参数,可以用来处理页面间传值 
                        fis_quan: fis_quan
                    },
                    waiting: { // 控制 弹出转圈框的信息
                        autoShow: true, //自动显示等待框,默认为true 
                        title: '加载中' //等待对话框上显示的提示内容 
                    }
                });
            })
 
 
            //清空数据
            function clearUi() {
                document.getElementById('ulId').innerHTML = template('ui-template', {
                    "record": []
                });
                document.getElementById('mid').value = '';
                document.getElementById('flot').value = '';
                document.getElementById('selectBatch').value = ''
                var final_result = document.getElementsByName("final_result");
                for (var i = 0; i < final_result.length; i++) {
                    if (final_result[i].checked == true) {
                        final_result[i].checked = false;
                        final_result[i].removeAttribute("checked");
                    }
                }
            }
 
            function cleanDet() {
                document.getElementById('filenum').value = ''
                document.getElementById('filever').value = ''
                //$("#selectBatch").empty()
                //document.getElementById('proc_num').value = ''
                document.getElementById('batch_count').value = ''
                // document.getElementById('machine').value = ''
                document.getElementById('task_no').value = ''
                document.getElementById('premark').value = ''
                document.getElementById('presult').value = ''
                document.getElementById('polarity').value = ''
                $('#fbill_no').val('');
                clearUi()
            }
 
            function clear() {
                cleanDet()
            }
 
            //对小数点前丢失的0进处理
            function checkZero(cursor) {
                for (var j = 0; j < cursor.length; j++) {
                    if (cursor[j].FLOWER != null) {
                        var f = cursor[j].FLOWER.substr(0, 1)
                        if (f == ".") {
                            var t = cursor[j].FLOWER.split(""); // 字符串处理
                            t.splice(0, 0, "0");
                            t = t.join("")
                            cursor[j].FLOWER = t
                        }
                    }
                    if (cursor[j].FUPPER != null) {
                        var f = cursor[j].FUPPER.substr(0, 1)
                        if (f == ".") {
                            var t = cursor[j].FUPPER.split(""); // 字符串处理
                            t.splice(0, 0, "0");
                            t = t.join("")
                            cursor[j].FUPPER = t
                        }
                    }
                }
                return cursor;
            }
 
            document.getElementById('recodeList').addEventListener('tap', function(e) {
                mui.openWindow({
                    id: 'search_xunjian_record',
                    url: 'search_xunjian_record.html',
                    extras: {
                        searchType: "1025", //首检:1015
                        urlId: "/pqc_patrol_input/getRecordList",
                    },
                    waiting: { // 控制 弹出转圈框的信息
                        autoShow: true, //自动显示等待框,默认为true 
                        title: '加载中' //等待对话框上显示的提示内容 
                    }
                });
            })
 
            function clicked(url, f1, urlId) {
                OpenWindow(f1, url, {
                    urlId: urlId,
                    inputId: f1,
                    premark: $("#premark").val()
                });
            };
        </script>
    </body>
</html>