zrg
2024-08-06 310d7435e49c17bd759e4e115a13d4a367c440a7
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>巡检记录单</title>
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!--引用layui js文件-->
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <!--自定义样式-->
    <style>     
        .layui-form-label {
            font-size: 14px;
            width: 85px;
            text-align: inherit;
        }
        /*全局设置输入框高度*/
        .set_height {
            height: 30px;
        }
        /*设置表头输入框*/
        .t1_input {
            padding: 1%;
        }
        /*本站信息td*/
        .bz_td {
            display: -webkit-box; /*设置按钮不换行*/
            padding: 1%; /*设置输入框边距*/
        }
        /*设置本站信息按钮高度*/
        .bz_btu {
            height: 30px;
            width: 60px;
            line-height: 30px;
        }
 
        th {
            width: 70px;
            text-align: left;
        }
 
        /* 防止下拉框的下拉列表被隐藏---必须设置--- */
        .layui-table-cell {
            overflow: visible !important;
        }
        /* 使得下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }
    </style>
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" id="formData" style="background-color:white;">
                    <div style="background-color:#0085E8;">
                        <span style="color: white;" class="gxcz"><i class="layui-icon layui-icon-form"></i>巡检记录单</span>
                    </div>
                    <div class="layui-form-item" style="margin: 1% 2%;text-align: right;">
                        <button type="button" lay-submit="" lay-filter="Saver" class="layui-btn layui-btn-radius" id="Saver">保存</button>
                        <button type="button" lay-submit="" lay-filter="Add" class="layui-btn layui-btn-radius" id="Add">新增</button>
                        <!--<button type="button" lay-submit="" lay-filter="Detail" class="layui-btn layui-btn-radius" id="Detail">明细</button>-->
 
                        <button type="button" lay-submit="" lay-filter="Cancel" class="layui-btn layui-btn-radius layui-btn-danger">退出</button>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-tab layui-tab-card" lay-filter="TabTest">
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <table style="width:80%;">
                                        <tbody>
                                            <tr>
                                                <th>条形码</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HBarCode" class="layui-input set_height" id="HBarCode" placeholder="请输入条形码后回车" style="border-radius: 50px;">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu layui-btn-radius" lay-filter="QueDin" style="line-height: 30px;">确定</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>数量</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HQty" class="layui-input set_height" id="HQty" value="0" placeholder="请输入数量" style="border-radius: 50px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产资源</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HSourceName" class="layui-input set_height" id="HSourceName" placeholder="选择生产资源" style="border-radius: 50px; background-color: #efefef4d;">
                                                    <input type="hidden" name="HSourceID" id="HSourceID" value="0" autocomplete="off" class="layui-input set_height">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="ProductionResources-BT" id="ProductionResources-BT" style="font-weight:bolder;">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>试样结论</th>
                                                <td class="bz_td">
                                                    <input type="radio" name="HLastResult" value="true" title="合格">
                                                    <input type="radio" name="HLastResult" value="false" title="不合格">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>单据日期</th>
                                                <td class="t1_input">
                                                    <input type="text" name="HDate" class="layui-input set_height" id="HDate" style="border-radius: 50px;" placeholder="请选择日期" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>单据号</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HBillNo" class="layui-input set_height" id="HBillNo" placeholder="单据号" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                    <input type="hidden" name="HInterID" id="HInterID" value="0" autocomplete="off" class="layui-input set_height">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产组织</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HPRDORGName" class="layui-input set_height" id="HPRDORGName" placeholder="生产组织" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                    <input type="hidden" name="HPRDORGID" id="HPRDORGID" value="0" autocomplete="off" class="layui-input set_height">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产订单号</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HICMOBillNo" class="layui-input set_height" id="HICMOBillNo" placeholder="生产订单号" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                    <input type="hidden" name="HICMOInterID" id="HICMOInterID" value="0" autocomplete="off" class="layui-input set_height">
                                                    <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" value="0" autocomplete="off" class="layui-input set_height">
                                            </tr>
                                            <tr>
                                                <th>流转卡</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HProcExchBillNo" class="layui-input set_height" id="HProcExchBillNo" placeholder="流转卡" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                    <input type="hidden" name="HProcExchHinteID" class="layui-input set_height" id="HProcExchHinteID">
                                                    <input type="hidden" name="HProcExchInterID" class="layui-input set_height" id="HProcExchInterID" value="0">
                                                    <input type="hidden" name="HProcExchEntryID" class="layui-input set_height" id="HProcExchEntryID" value="0">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>批次号</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HBatchNo" class="layui-input set_height" id="HBatchNo" placeholder="批次号" style="border-radius: 50px;background-color:#efefef4d;" readonly>                                                   
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>物料代码</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaterNumber" class="layui-input set_height" id="HMaterNumber" placeholder="产品代码" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                    <input type="hidden" name="HMaterID" class="layui-input set_height" id="HMaterID">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>物料名称</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaterName" class="layui-input set_height" id="HMaterName" value="" placeholder="物料名称" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>规格型号</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaterModel" class="layui-input set_height" id="HMaterModel" placeholder="规格型号" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>计量单位</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HUnitName" class="layui-input set_height" id="HUnitName" placeholder="选择计量单位" style="border-radius: 50px; background-color: #efefef4d;">
                                                    <input type="hidden" name="HUnitID" id="HUnitID" value="0" autocomplete="off" class="layui-input set_height">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="BtnHUnit" id="BtnHUnit" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>工序</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HProcName" class="layui-input set_height" id="HProcName" placeholder="选择工序" style="background-color:#efefef4d;border-radius: 50px;">
                                                    <input type="hidden" name="HProcID" id="HProcID" value="0" autocomplete="off" class="layui-input set_height">
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="layui-tab-item">
                                    <div class="layui-inline" style="margin-bottom:5px;">
                                        <label class="layui-form-label" style="width:100px;">检验方案</label>
                                        <div class="layui-input-inline">
                                            <input type="hidden" name="HQCSchemeID" id="HQCSchemeID" class="layui-input" value="0" style="float:left;width:150px;">
                                            <input type="text" name="HQCSchemeName" id="HQCSchemeName" class="layui-input" value="" style="float:left;width:150px;" readonly="readonly">
                                            <button type="button" lay-submit="" class="layui-btn layui-btn-primary" lay-filter="btnSearchQCScheme" style="width:40px;">
                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                            </button>
                                        </div>
                                    </div>
                                    <table class="" id="mainTable" lay-filter="mainTable"></table>
                                    <!--序号-->
                                    <script type="text/html" id="xuhao">
                                        {{d.LAY_TABLE_INDEX+1}}
                                    </script>
                                    <!--删除-->
                                    <script type="text/html" id="barDemo">
                                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                                    </script>
                                    <!--行下拉选择(分析方法)-->
                                    <script type="text/html" id="HAnalysisMethod">
                                        <select name="HAnalysisMethod" lay-filter="HAnalysisMethod" id="HAnalysisMethod{{d.LAY_TABLE_INDEX+1}}">
                                            <option value="">请选择</option>
                                            <option value="1">定性分析</option>
                                            <option value="2">定量分析</option>
                                            <option value="3">其他分析</option>
                                        </select>
                                    </script>
                                    <!--复选框(重点检查)-->
                                    <script type="text/html" id="HKeyInspect">
                                        <input type="checkbox" value="{{d.HKeyInspect}}" lay-skin="primary" id="HKeyInspect{{d.LAY_TABLE_INDEX+1}}" lay-filter="HKeyInspect" {{ d.HKeyInspect == 1 ? 'checked' : '' }}>
                                    </script>
                                    <!--复选框(结果)-->
                                    <script type="text/html" id="HResult">
                                        <input type="checkbox" value="{{d.HResult}}" lay-skin="primary" id="HResult{{d.LAY_TABLE_INDEX+1}}" lay-filter="HResult" {{ d.HResult == 1 ? 'checked' : '' }}>
                                    </script>
                                </div>
                                <div class="layui-tab-item">
                                    <table style="width:80%;">
                                        <tbody>
                                            <tr>
                                                <th>制单人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaker" class="layui-input set_height" id="HMaker" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>制单日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMakeDate" class="layui-input set_height" id="HMakeDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>修改人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HUpDater" class="layui-input set_height" id="HUpDater" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>修改日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HUpDateDate" class="layui-input set_height" id="HUpDateDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>审核人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HChecker" class="layui-input set_height" id="HChecker" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>审核日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HCheckDate" class="layui-input set_height" id="HCheckDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>作废人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HDeleteMan" class="layui-input set_height" id="HDeleteMan" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>作废日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HDeleteDate" class="layui-input set_height" id="HDeleteDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <ul class="layui-tab-title">
                                <li class="layui-this">单据信息</li>
                                <li>检验项目</li>
                                <li>制单信息</li>
                            </ul>
                        </div>
                    </div>
                    <!--隐藏字段-->
                    <input type="hidden" name="lngICMOEntryID" id="lngICMOEntryID">
                    <input type="hidden" name="lngBillKey" id="lngBillKey" value="0">
                    <input type="hidden" name="lngBillSubKey" id="lngBillSubKey" value="0">
                    <input type="hidden" name="eventType" id="eventType" value="Add">
                    <input type="hidden" name="HMainInterID" id="HMainInterID" value="0">
                    <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" value="0">
                    <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" value="0">
                    <input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo" value="0">
                    <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" value="0">
                </form>
            </div>
        </div>
    </div>
</body>
</html>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
        var $ = layui.$
            , admin = layui.admin
            , layer = layui.layer
            , table = layui.table
            , form = layui.form
            , laydate = layui.laydate
            , upload = layui.upload
            , element = layui.element;
        //#region 公共变量
        var params = get_UrlVars();
        var option = [];
        var titleData = [];
 
        //#endregion
 
        //#region 进入页面即加载
        var params = getUrlVars();
        if (typeof (params[params[0]]) == "undefined") {
            var OperationType = 1;//操作类型
            var closeType = 2;  //关闭类型
        }
        else {
            var OperationType = params[params[0]];//操作类型
            var linterid = params[params[1]];//源单id
            var HSouceBillType = params[params[2]];//源单类型
            var HBillNo = params[params[3]];  //获取单据号
            var closeType = params[params[4]];  //关闭类型
        }
 
        //初始化表格
        set_InitGrid();
 
        //判断是否新增
        if (OperationType == 1) {
            $("#HInterID").val("");
            $("#HBillNo").val("");
            //获取最大单据号
            $.ajax({
                url: GetWEBURL() + "/Web/GetMAXNum",
                type: "GET",
                data: { "HBillType": '7520' },
                success: function (d) {
                    $("#HInterID").val(d.data[0].HInterID);
                    $("#HBillNo").val(d.data[0].HBillNo);
                }
            });
            $('#Add').addClass("layui-btn-disabled").attr("disabled", true);//新增按钮默认禁用
            //GetDefValByUser();
        }
 
 
        //进入页面默认光标在条形码上
        $("#HBarCode").focus();
        //流转卡是否扫描标记
        var HProcExchBillNoFlag = false;
        //初始基本信息赋值
        $("#HMaker").val(sessionStorage["HUserName"]);
        $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));
        $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
 
        //#endregion
 
        //#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
 
        //条形码回车方法
        $('#HBarCode').on('keydown', function (event) {
            var HBarCode = $('#HBarCode').val();
            if (event.keyCode == 13) {
                if (!HBarCode) {
                    layer.msg("条形码不能为空!")
                    return;
                }
                txtHBarCode_KeyDown(HBarCode);
            }
        });
 
        //选择生产资源弹窗
        form.on('submit(ProductionResources-BT)', function () {//生产资源
            layer.open({
                type: 2 //类型
                , skin: 'layui-layer-rim'//加上边框
                , area: ['90%', '90%']//大小
                , title: '生产资源列表'//标题
                , shift: 2//弹出动画
                , content: ['../../基础资料/生产基础资料/Gy_Source.html', 'yes']
                , btn: ['确定', '取消']
                , btn1: function (index, layero) {//按钮【按钮一】的回调
                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                    if (checkStatus.data.length === 0) {
                        return layer.msg('请选择数据');
                    }
                    //获取数据
                    $("#HSourceID").val(checkStatus.data[0].HItemID);
                    $("#HSourceName").val(checkStatus.data[0].生产资源名称);
                    layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                }
            })
        });
 
        //选择计量单位
        form.on('submit(BtnHUnit)', function () {//生产资源
            layer.open({
                type: 2
                , skin: "layui-layer-rim"                           //加上边框
                , title: "计量单位列表"                             //标题
                , closeBtn: 1                                       //窗体右上角关闭 的 样式
                , shift: 2                                          //弹出动画
                , area: ["90%", "90%"]                              //窗体大小
                , maxmin: true                                      //设置最大最小按钮是否显示
                , content: ["../../../views/基础资料/公用基础资料/Gy_Unit.html", "yes"]
                , btn: ["确定", "取消"]
                , btn1: function (index, laero) {
                    //按钮一  的回调
                    var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
 
                    if (checkStatus.data.length != 1) {
                        return layer.msg("请选择一条数据");
                    }
 
                    $("#HUnitID").val(checkStatus.data[0].HItemID);//内码
                    $("#HUnitName").val(checkStatus.data[0].计量单位名称);//名称
                    layer.close(index);//关闭弹窗
                }
            })
        });
 
        //表头信息检验方案弹窗
        form.on('submit(btnSearchQCScheme)', function () {
            //页面层-自定义
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '检验方案列表',
                closeBtn: 1,
                shift: 2,
                area: ['90%', '90%'],
                maxmin: true,
                content: ['../../../views/Baseset/基础资料/Gy_QCCheckProjectListView.html', 'yes'],
                btn: ['确定', '取消']
                , btn1: function (index, layero) {
 
                    //按钮【按钮一】的回调
                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                    if (checkStatus.data.length === 0) {
                        return layer.msg('请选择数据');
                    }
                    $("#HQCSchemeID").val(checkStatus.data[0].HItemID);
                    $("#HQCSchemeName").val(checkStatus.data[0].方案名称);
                    get_CheckItem();
                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                }
                , btn2: function (index, layero) {
                    //按钮【按钮二】的回调
                    //return false 开启该代码可禁止点击该按钮关闭
                },
                end: function () {
 
                },
                success: function (layero, index) {
 
                }
            });
        });
 
        //提交
        form.on('submit(Saver)', function (data) {//提交
            if ($('input[name="HLastResult"]:checked').val() == undefined) {
                layer.msg("请选择试样结论!");
                return;
            }
            if (!HProcExchBillNoFlag) {
                layer.msg("请扫条码!");
                return;
            }
            Get_Save(data);
 
        });
 
        //退出--全屏版
        form.on('submit(Cancel)', function () {
            layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                parent.location.href = "../../../views/index_Mobile_QiaoYi.html";
            });
        })
 
        form.on('submit(Add)', function () {//提交
            layer.confirm('新增后页面数据将消失?', { icon: 3, title: '提示' }, function (index) {
                location.replace('MES_ColorRecordBill_PDA.html?OperationType=1&linterid=0&HSouceBillType=&HBillNo=&closeType=2');
            });
        })
 
        //行选择处理(分析方法)
        form.on('select(HAnalysisMethod)', function (data) {
            //获取下拉框选中的值
            var elem = data.othis.parents('tr');
            var dataindex = elem.attr("data-index");
            $.each(option.data, function (index, value) {
                if (value.LAY_TABLE_INDEX == dataindex) {
                    value.HAnalysisMethod = data.value;//把选中下拉框id值赋值给表格缓存
                }
            });
        });
 
        //是否重点检查
        form.on('checkbox(HKeyInspect)', function (data) {
            //获取下拉框选中的值
            var elem = data.othis.parents('tr');
            var dataindex = elem.attr("data-index");
            $.each(option.data, function (index, value) {
                if (value.LAY_TABLE_INDEX == dataindex) {
                    value.HKeyInspect = data.elem.checked;//把选中下拉框id值赋值给表格缓存
                }
            });
        });
 
        //是否合格
        form.on('checkbox(HResult)', function (data) {
            //获取下拉框选中的值
            var elem = data.othis.parents('tr');
            var dataindex = elem.attr("data-index");
            $.each(option.data, function (index, value) {
                if (value.LAY_TABLE_INDEX == dataindex) {
                    value.HResult = data.elem.checked;//把选中下拉框id值赋值给表格缓存
                }
            });
        });
        //#endregion
 
        //#region 此页面所有的方法
 
        //初始化表格
        function set_InitGrid() {
            $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
            $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
            //初始表格数据
            rowdata = [{
                "HQCCheckItemID": 0, "检验项目": "", "HInspectInstruMentID": 0, "检验仪器": "", "HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": false,
                "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": false, "HStatus": 0,
            }];
            option = {
                elem: '#mainTable'
                //, toolbar: '#toolbarDemo'
                , limit: 500 //每页默认显示的数量
                , height: 'full-50'
                , cellMinWidth: 150
                , cols: [[ //表头
                    { type: 'checkbox', totalRowText: '合计行' }
                    , { type: 'numbers', title: '序号', totalRow: true }
                    , { field: 'HQCCheckItemID', title: 'HQCCheckItemID', hide: true }
                    , { field: '检验项目', title: '检验项目', edit: 'text', event: 'HQCCheckItemID' }
                    , { field: 'HResult', title: '检验结果', width: 80, templet: '#HResult', unresize: false }
                    , { field: 'HAnalysisMethod', title: '分析方法', width: 100, templet: '#HAnalysisMethod', event: 'HAnalysisMethod' }
                    , { field: 'HKeyInspect', title: '重点检查', width: 80, templet: '#HKeyInspect', unresize: false }
                    , { field: 'HInspectInstruMentID', title: 'HInspectInstruMentID', hide: true }
                    , { field: '检验仪器', title: '检验仪器', edit: 'text', event: 'HInspectInstruMentID', hide: true }
                    , { field: 'HQCStd', title: '检验标准', edit: 'text' }
                    , { field: 'HUnit', title: '单位', edit: 'text' }
                    , { field: 'HQCNote', title: '检验记录', edit: 'text' }
                    , { field: 'HMax', title: '最大值', edit: 'text' }
                    , { field: 'HMin', title: '最小值', edit: 'text' }
                    , { field: 'HAvg', title: '平均值', edit: 'text', totalRow: true }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 60 }
                ]]
                , done: function (res, curr, count) {
                    option.data = res.data;
                    //去掉下拉框失焦事件否则在下拉框里输入值
                    $('.layui-form-select').find('input').unbind("blur");
                    //表格重载回显下拉框里的数据
                    $('tr').each(function (e) {
                        var $cr = $(this);
                        var dataIndex = $cr.attr("data-index");
                        $.each(option.data, function (index, value) {
                            if (value.LAY_TNDEX == dataIndex) {
                                //$cr.find('input').val(value.HResult);
                            }
                        });
                    });
                }
                , text: {
                    none: '无数据!'
                }
            };
            //加载空表格
            option.data = rowdata;
            table.render(option);
        }
 
        function get_CheckItem() {
            $.ajax({
                url: GetWEBURL() + "/Web/GetCheckItemByCheckProjectID",
                type: "GET",
                data: { "CheckProjectID": $("#HQCSchemeID").val() == '' ? 0 : $("#HQCSchemeID").val(), "HBatchQty": 0 },
                success: function (result) {
                    if (result.code == 1) {
                        var rowdata = [];
                        var data = result.data;
                        for (var i = 0; i < result.data.length; i++) {
                            //子表  赋值
                            rowdata.push(
                                {
                                    "HQCCheckItemID": data[i]["HQCCheckItemID"], "检验项目": data[i]["检验项目"], "HInspectInstruMentID": data[i]["HInspectInstruMentID"], "检验仪器": data[i]["检验仪器"], "HQCStd": data[i]["HQCStd"], "HUnit": data[i]["单位名称"], "HQCNote": "", "HAnalysisMethod": data[i]["分析方法"], "HResult": data[i]["默认结论"] == 1 ? true : false,
                                    "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": data[i]["重点检查"] == 1 ? true : false, "HStatus": 0
                                }
                            );
                        }
                        //检验项目
                        option.data = rowdata;
                        table.render(option);
                        for (var i = 1; i <= result.data.length; i++) {
                            $('#HAnalysisMethod' + i + '').find("option[value='" + option.data[i - 1].HAnalysisMethod + "']").attr("selected", true);
                        }
                        form.render('select');
                    }
                }
            })
        }
 
        function txtHBarCode_KeyDown(HBarCode) {
            //检查扫描的条码是否为纯数字,如果是纯数字,目前默认判断为 "工序进站接收单号"
            var result = /^\d+$/.test(HBarCode)
            if (result == true) {
                HBarCode = HBarCode.slice(0, 0) + 'GXJZ' + HBarCode.slice(0)
            }
            //扫码类型1
            var barNo = HBarCode.substr(0, 3);
            //扫码类型2
            var barNo2 = HBarCode.substr(0, 4);
            var index = layer.load();
            $.ajax({
                url: GetWEBURL() + "/MES_SampleRecordBill_PDA/SampleRecordBillHBarCode_KeyDown",
                type: "GET",
                data: { "HBarCode": HBarCode, "HInterID": $('#HProcExchHinteID').val(), "UserID": sessionStorage["Czybm"], "HBillType": "7505" },
                success: function (result) {
                    if (result.count == 1) {
                        var data = result.data[0];
 
                        switch (barNo) {
                            case "HCX":
                                form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                                    "HSourceID": data.HItemID,
                                    "HSourceName": data.生产资源名称
                                });
                                break;
                        }
 
                        switch (barNo2) {
                            case "GXLX":
                                form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                                    "HProcExchBillNo": data.单据号,
                                    "HProcExchInterID": data.hmainid,
                                    "HProcExchEntryID": data.hsubid,
                                    "HBatchNo": data.流转卡批次号,
                                    "HICMOInterID": data.hicmointerid,
                                    "HICMOEntryID": data.HICMOEntryID,
                                    "HICMOBillNo": data.任务单号,
                                    "HMaterID": data.HMaterID,
                                    "HMaterName": data.产品,
                                    "HMaterNumber": data.产品代码,
                                    "HMaterModel": data.规格型号,
                                    "HPRDORGID": data.组织,
                                    "HPRDORGName": data.组织名称,
                                    "HUnitID": data.HUnitID,
                                    "HUnitName": data.单位,
                                    "HProcName": data.工序,
                                    "HProcID": data.HProcID,
                                    "HQCSchemeID": data.检验方案ID == null ? 0 : data.检验方案ID,
                                    "HQCSchemeName": data.检验方案名称,
                                    "HMainSourceInterID": data.hmainid,
                                    "HMainSourceEntryID": data.hsubid,
                                    "HMainSourceBillNo": data.单据号,
                                    "HMainSourceBillType": data.HBillType,
                                });
                                //获取检验方案/检验项目信息
                                get_CheckItem();
                                HProcExchBillNoFlag = true;
 
                                var HProcExchHinteID = $('#HProcExchHinteID').val();
                                var HInterID = data.hmainid;
                                break;
                            case "GXJZ":
                                form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                                    "HProcExchBillNo": data.流转卡号,
                                    "HProcExchInterID": data.HProcExchInterID,
                                    "HProcExchEntryID": data.HProcExchEntryID,
                                    "HBatchNo": data.流转卡批次号,
                                    "HICMOInterID": data.HICMOInterID,
                                    "HICMOEntryID": data.HICMOEntryID,
                                    "HICMOBillNo": data.任务单,
                                    "HMaterID": data.HMaterID,
                                    "HMaterName": data.产品名称,
                                    "HMaterNumber": data.产品代码,
                                    "HMaterModel": data.规格型号,
                                    "HPRDORGID": data.组织,
                                    "HPRDORGName": data.组织名称,
                                    "HUnitID": data.HUnitID,
                                    "HUnitName": data.计量单位,
                                    "HProcName": data.当前工序,
                                    "HProcID": data.HProcID,
                                    "HQCSchemeID": data.检验方案ID == null ? 0 : data.检验方案ID,
                                    "HQCSchemeName": data.检验方案名称,
                                    "HMainSourceInterID": data.hmainid,
                                    "HMainSourceEntryID": 0,
                                    "HMainSourceBillNo": data.单据号,
                                    "HMainSourceBillType": data.HBillType,
                                });
                                //获取检验方案/检验项目信息
                                get_CheckItem();
                                HProcExchBillNoFlag = true;
                                break;
                            case "MO00":
                                form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                                    "HProcExchBillNo": "",
                                    "HProcExchInterID": 0,
                                    "HProcExchEntryID": 0,
                                    "HICMOInterID": data.hmainid,
                                    "HICMOEntryID": data.hsubid,
                                    "HICMOBillNo": data.单据号,
                                    "HMaterID": data.HMaterID,
                                    "HMaterName": data.产品名称,
                                    "HMaterNumber": data.产品代码,
                                    "HMaterModel": data.规格型号,
                                    "HPRDORGID": 0,//data.组织,
                                    "HPRDORGName": '',//data.组织名称,
                                    "HUnitID": data.hunitid,
                                    "HUnitName": data.计量单位,
                                    "HProcName": data.当前工序,
                                    "HProcID": data.HProcID,
                                    "HQCSchemeID": data.检验方案ID == null ? 0 : data.检验方案ID,
                                    "HQCSchemeName": data.检验方案名称,
                                    "HMainSourceInterID": data.hmainid,
 
                                    "HMainSourceEntryID": data.hsubid,
                                    "HMainSourceBillNo": data.单据号,
                                    "HMainSourceBillType": data.单据类型,
                                });
                                //获取检验方案/检验项目信息
                                get_CheckItem();
                                HProcExchBillNoFlag = true;
                                break;
                        }
                        layer.close(index);
                        //清空条码框
                        $('#HBarCode').val("");
                    }
                    else {
                        layer.close(index);
                        layer.msg(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("接口请求失败!" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                }
            });
        }
 
        //保存
        function Get_Save(data) {
 
            var tableData = data.field;
            var sSubStr = JSON.stringify(table.cache['mainTable']);
            var oMain = JSON.stringify(data.field) + ";" + sessionStorage["HUserName"] + ";" + OperationType + ";" + sSubStr;
            var index = layer.load();
            $.ajax({
                type: "POST",
                url: GetWEBURL() + "/QC_PatrolProcCheckOtherBill/QC_PatrolProcCheckOtherBillAddBill_PDA",
                async: false,
                data: { "oMain": oMain },
                dataType: "json",
                success: function (data) {
                    if (data.count == 1) {
                        layer.close(index);
                        layer.msg("提交成功");
                        $('#Add').removeClass("layui-btn-disabled").attr("disabled", false);//新增按钮启用
                        $('#Saver').addClass("layui-btn-disabled").attr("disabled", true);//禁用保存按钮
                    }
                    else {
                        layer.close(index);
                        layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                }
            });
        }
 
        //获取参数
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
        //#endregion
        //以上为layui模块
    });
</script>