yangle
2023-11-01 dbcc87f39f85b6ec81d53e6dc66e9f51cd34b5d8
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>产线返修平台(更换配件)</title>
    <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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <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 type="text/javascript" src="../../../layuiadmin/lib/extend/echarts.min.js"></script>
    <!--<style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
            height: 30px;
            line-height: 30px;
        }
 
        .btn-title {
            font-size: 16px;
        }
        /* 防止下拉框的下拉列表被隐藏---必须设置--- */
        .layui-table-cell {
            overflow: visible !important;
        }
        /* 使得下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }
 
        .layui-form-item .layui-inline {
            margin-top: 5px;
            margin-bottom: 5px;
            margin-right: 0px;
        }
 
        .layui-form-label {
            width: 25%;
        }
    </style>-->
 
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card" style="padding: 2px;background-color: #efefef;">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                    <div style="padding: 2px; ">
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnAdd" id="btnSave">新增</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnCancel" id="btnEdit">退出</button>
                    </div>
                    <div class="layui-tab" lay-filter="tab-POStockInBill">
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1" style="padding:1px;" class="layui-this">采集信息</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--采集信息-->
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form-item" style="padding-top: 10px;">
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">条形码</label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <input type="text" class="layui-input" lay-verify="HBarCode" name="HBarCode" id="HBarCode">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">单据号</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
                                                <input type="hidden" name="HEntryID" id="HEntryID" lay-verify="HEntryID" value="1">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">维修人</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" lay-verify="HEmpName" name="HEmpName" id="HEmpName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">产品MAC</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" lay-verify="HProdMac" name="HProdMac" id="HProdMac" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">产品SN</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" lay-verify="HMaterSN" name="HMaterSN" id="HMaterSN" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">备注</label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <input type="hidden" name="HSourceInterID" id="HSourceInterID" lay-verify="HSourceInterID" value="0">
                                                <input type="hidden" name="HSourceEntryID" id="HSourceEntryID" lay-verify="HSourceEntryID" value="0">
                                                <input type="hidden" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" value="">
                                                <input type="hidden" name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType" value="">
                                                <input type="hidden" name="HRelationQty" id="HRelationQty" lay-verify="HRelationQty" value="0">
                                                <input type="hidden" name="HRelationMoney" id="HRelationMoney" lay-verify="HRelationMoney" value="0">
 
                                                <input type="hidden" name="HMaterID" id="HMaterID" lay-verify="HMaterID" value="0">
                                                <input type="hidden" name="HMaterNumber" id="HMaterNumber" lay-verify="HMaterNumber" value="">
                                                <input type="hidden" name="HMaterName" id="HMaterName" lay-verify="HMaterName" value="">
                                                <input type="hidden" name="HUnitID" id="HUnitID" lay-verify="HUnitID" value="0">
                                                <input type="hidden" name="HQty" id="HQty" lay-verify="HQty" value="0">
                                                <input type="hidden" name="HSupID" id="HSupID" lay-verify="HSupID" value="0">
                                                <input type="hidden" name="HBatchNo" id="HBatchNo" lay-verify="HBatchNo">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;"></label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btSave" id="NGSave">暂存</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                    <script type="text/html" id="toolbarDemo">
                        <div class="layui-btn-container">
                            <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>-->
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                        </div>
                    </script>
                </form>
            </div>
        </div>
    </div>
    <!--子表表:删除-->
    <script type="text/html" id="barDemo">
        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            //#region 公共变量
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element;
 
            //模块名
            var HModName = "Sc_SourceLineRepairBillSub_Mater";
            //表格渲染参数
            var option = {};            //项目阶段表渲染参数
            var titleData = ["HInterID", "HEntryID", "HBillNo_bak", "HICMOInterID", "HICMOEntryID", "HICMOBillType", "HMaterID", "HUnitID", "HSupID", "配件数量", "更换匹配批次", "源单主内码", "源单子内码", "源单单号", "源单类型"];//子表不需要显示的字段 可扩展
            //获取参数
            var params = getUrlVars();
            var OperationType = params.OperationType; //从参数中获取 数据类型  1添加 保存  2复制  3 编辑
            //#endregion
 
            //#region 进入页面即加载
            //#region 判断是否登录 未登录则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
            //#endregion
 
            //#region 判断并设置操作类型、页面初始化
            if (OperationType == null || OperationType == 1) {                            //新增
                //set_ClearBill();
            } else if (OperationType == 2) {
                set_ClearBill();
            }
            //#endregion
 
            //#region 初始化表格
            DisPlay_HideColumn();
            //#endregion
 
            //#endregion
 
            //#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region 弹窗选择触发事件
            //#endregion
 
            //#region 操作按钮触发事件
            //#region 新增
            form.on('submit(btnAdd)', function (data) {
                //layer.msg("新增");
                $("#HBarCode").val("");
                $("#HRemark").val("");
                $("#HEntryID").val(option.data.length +1 );
                $("#HMaterID").val("0");
                $("#HMaterNumber").val("");
                $("#HMaterName").val("")
                $("#HUnitID").val("0");
                $("#HQty").val("0");
                $("#HSupID").val("0");
                $("#HBatchNo").val("0");
 
            });
            //#endregion
 
            //#region 退出
            form.on('submit(btnCancel)', function (data) {
                if (params[1] != null) {
                    Pub_Close(1);
                } else if (params[1] == null) {
                    Pub_Close(2);
                }
            });
            //#endregion
 
            //#region 暂存
            form.on('submit(btSave)', function (data) {
                set_AddNew(data);
            });
            //#endregion
            //#endregion
 
            //#region 文本框监听
            $(document).ready(function () {
                //#region 条形码回车事件监听
                $("#HBarCode").on('input keyup', function (data) {
                    if (data.keyCode == "13") {
                        //layer.msg(data.keyCode);
                        touchedByEnter_HBarCode();
                    }
                });
                //#endregion
            });
            //#endregion
 
            //#region 复选框 选中/取消 触发事件
            //#endregion
 
            //#region 子表:头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
 
                //新增行表格数据
                var NewRow =
                {
                    "RowID": (table.cache["mainTable"].length + 1) * 10
                    , "HDate": Format(new Date(), "yyyy-MM-dd")
                    , "HMaterID": "0"
                    , "HMaterName": ""
                    , "HMaterSN": ""
                    , "HBadReasonID": "0"
                    , "HBadReasonName": ""
                    , "HResult": ""
                };
                switch (obj.event) {
                    case 'btn-AddLine':
                        table.cache["mainTable"].push(NewRow);
                        option.data = table.cache["mainTable"];
                        table.render(option);
                        break;
                    case 'btn-CopyLine':
                        var copydata = JSON.stringify(data);
                        if (data.length <= 0) {
                            layer.msg("请选择需要复制的一行!");
                        }
                        else if (data.length > 1) {
                            layer.msg("只能选择复制一行!");
                        }
                        else {
                            var copydata2 = copydata.substring(1, copydata.length);//去除首行字符'['
                            var copyrow = copydata2.substring(0, copydata2.length - 1);//去除末尾字符']'
                            table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
                            option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.render(option);//将数据渲染到表格上
                        }
                        break;
                    //列设置
                    case 'set_HideColumn':
                        get_HideColumn();
                        break;
                }
            });
            //#endregion
 
            //#region 子表:行内事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
                //set_GridCellCheck(obj); //行内快捷键筛选
 
            });
            //#endregion
 
            //#region 子表:行内鼠标离开事件:
            table.on('edit(mainTable)', function (obj) {
 
            })
            //#endregion
 
            //#region 子表:单元格编辑监听
            table.on('edit(mainTable)', function (obj) {
                // 单元格编辑之前的值
                var oldText = $(this).prev().text();
                var value = obj.value //得到修改后的值
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                //正则表达式-校验非负浮点数
                var ref = /^\d+(\.\d+)?$/;
 
                switch (field) {
                    case "HQty":                                            //数量
                        //if (!ref.test(value)) {                             //若输入值格式不正确,则变回原来的值
                        //    obj.update({
                        //        HQty: oldText
                        //    });
                        //    layer.msg("数量:数据错误,请输入非负小数")
                        //} else {
                        //    var HQty = value;                               //数量
                        //    var HPrice = data.HPrice;                       //工价
                        //    var HPriceRate = data.HPriceRate;               //定额浮动比率
 
                        //    var HSubsidyQty = data.HSubsidyQty;             //补贴数量
 
                        //    var HPackQty = data.HPackQty;                   //包装数量
                        //    var HPackPrice = data.HPackPrice;               //包装单价
 
                        //    var HDeuctTotal = data.HDeuctTotal * 1;               //扣款小计
                        //    var HSubsidyTotal = data.HSubsidyTotal * 1;           //补贴合计
 
                        //    obj.update({
                        //        HMoney: (HQty * HPrice * HPriceRate) + (HSubsidyQty * HPrice) + (HPackQty * HPackPrice) + HSubsidyTotal - HDeuctTotal       //金额= (数量*单价*定额浮动比率) + (补贴数量*工价) + (包装数量*包装单价) - 补贴合计 - 扣款小计
                        //    });
                        //}
                        break;
                    default:
                }
            });
            //#endregion
 
            //#region 监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
 
                    // if (value != '') {
                    if (!/^\d+$/.test(value)) {
                        return '不能为空或数字或者0';
                    }
                    //}
                }
            });
            //#endregion
            //#endregion
 
            //#region 此页面所有的方法
            //#region 获取参数
            function getUrlVars() {
                var datajson;
                var str = window.location.search; //获取链接中传递的参数
                var arr = str.substring(str.indexOf("=") + 1);
                datajson = $.parseJSON(decodeURI(arr));
                return datajson;
            }
            //#endregion
 
            //#region 获取表头初始信息
            function getMainInfo() {
                var dataParams = params;
                var subMaterList_Temp = JSON.parse(params.subMaterList_Temp);
 
                $("#HInterID").val(dataParams.HInterID);
                $("#HEntryID").val(subMaterList_Temp.length+1);
                $("#HBillNo").val(dataParams.HBillNo);
                $("#HEmpName").val(dataParams.HEmpName);
                $("#HProdMac").val(dataParams.HProdMac);
                $("#HMaterSN").val(dataParams.HBarCode);
                $("#HSourceInterID").val(dataParams.HSourceInterID);
                $("#HSourceEntryID").val(dataParams.HSourceEntryID);
                $("#HSourceBillNo").val(dataParams.HSourceBillNo);
                $("#HSourceBillType").val(dataParams.HSourceBillType);
            }
            //#endregion
 
            //#region 子表初始化
            function get_InitGrid() {
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , async: true
                    , page: false
                    , totalRow: true
                    , cellMinWidth: 120
                    , height: 400
                    , cols: [[
                        { type: 'checkbox', fixed: 'left' }
                        , { type: 'numbers', title: '序号' }
                        , { field: 'HInterID', title: 'HInterID', hide: true }
                        , { field: 'HEntryID', title: 'HEntryID', hide: true }
                        , { field: 'HBillNo_bak', title: 'HBillNo_bak', hide: true }
                        , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
                        , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
                        , { field: 'HICMOBillType', title: 'HICMOBillType', hide: true }
                        , { field: 'HICMOBillNo', title: '生产订单' }
                        , { field: 'HDate', title: '日期'}
                        , { field: 'HMaterID', title: 'HMaterID', hide: true }
                        , { field: 'HMaterNumber', title: '配件物料编码' }
                        , { field: 'HMaterName', title: '配件物料名称' }
                        , { field: 'HUnitID', title: 'HUnitID', hide: true }
                        , { field: 'HQty', title: '配件数量', hide: true }
                        , { field: 'HSupID', title: 'HSupID', hide: true }
                        , { field: 'HBatchNo', title: '更换匹配批次', hide: true }
                        , { field: 'HBarCode', title: '配件SN码' }
                        , { field: 'HMaterSN', title: '产品SN码' }
                        , { field: 'HSourceInterID', title: '源单主内码', hide: true }
                        , { field: 'HSourceEntryID', title: '源单子内码', hide: true }
                        , { field: 'HSourceBillNo', title: '源单单号', hide: true }
                        , { field: 'HSourceBillType', title: '源单类型', hide: true }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                    ]]
                }
            }
            var subMaterList_Temp = JSON.parse(params.subMaterList_Temp);
 
            option.data = subMaterList_Temp;
            table.render(option);
            //#endregion
 
            //#region 页面初始化
            function set_ClearBill() {
                //设置表头初始信息
                getMainInfo();
                //初始化项目阶段表
                get_InitGrid();
                
                
            }
            //#endregion
 
            //#region 条形码回车事件
            function touchedByEnter_HBarCode() {
                var HBarCode = $("#HBarCode").val();
 
                $.ajax({
                    url: GetWEBURL() + "/Sc_SourceLineRepairBill/getBarCodeInfo",
                    type: "GET",
                    async: false,
                    data: { "HBarCode": HBarCode},
                    success: function (result) {
                        if (result.count == 1) {
                            $("#HMaterID").val(result.data[0]["HMaterID"]);
                            $("#HMaterNumber").val(result.data[0]["HMaterNumber"]);
                            $("#HMaterName").val(result.data[0]["HMaterName"]);
                            $("#HUnitID").val(result.data[0]["HUnitID"]);
                            $("#HQty").val(result.data[0]["HQty"]);
                            $("#HSupID").val(result.data[0]["HSupID"]);
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
 
            //#region 保存HMaker
            function set_AddNew(data) {
                var newRow = {
                    "HInterID": data.field.HInterID
                    , "HEntryID": data.field.HEntryID
                    , "HBillNo_bak": data.field.HBillNo
                    , "HICMOInterID": data.field.HSourceInterID
                    , "HICMOEntryID": data.field.HSourceEntryID
                    , "HICMOBillNo": data.field.HSourceBillNo
                    , "HICMOBillType": data.field.HSourceBillType
                    , "HDate": Format(new Date(), "yyyy-MM-dd")
                    , "HMaterID": data.field.HMaterID
                    , "HMaterNumber": data.field.HMaterNumber
                    , "HMaterName": data.field.HMaterName
                    , "HUnitID": data.field.HUnitID
                    , "HQty": data.field.HQty
                    , "HSupID": data.field.HSupID
                    , "HBatchNo": data.field.HBatchNo
                    , "HBarCode": data.field.HBarCode
                    , "HMaterSN": data.field.HMaterSN
                    , "HSourceInterID": data.field.HSourceInterID
                    , "HSourceEntryID": data.field.HSourceEntryID
                    , "HSourceBillNo": data.field.HSourceBillNo
                    , "HSourceBillType": data.field.HSourceBillType
                }
                option.data.push(newRow);
                table.render(option);
                //将子表数据传给主页面
                $("#subMaterList_Temp", window.parent.document).val(JSON.stringify(option.data));
                $("#HEntryID").val(option.data.length + 1);
            }
            //#endregion
 
            //#region 编辑 页面赋值
            function RoadBillMain(linterid)//加载表头
            {
                //$.ajax({
                //    url: GetWEBURL() + "/Pay_SingleBalBill/editInit",
                //    type: "GET",
                //    async: false,
                //    data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
                //    success: function (result) {
                //        var tableMain = result.data[0];
                //        var tableSub = result.data[1];
 
                //        //主表 赋值
                //        form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                //            "HInterID": tableMain[0]["HInterID"]
                //        });
 
                //        //子表  赋值
                //        option.data = tableSub;
                //        table.render(option);
                //    }
                //})
            }
            //#endregion
 
            //#region 数据校验
            function AllowLoadData(data) {
                //#region 表头数据检验
                if ($("#HBillNo").val() == "") {
                    layer.msg("单据号不能为空!");
                    return false;
                }
                //#endregion
                return true;
            }
            //#endregion
 
            //#region 子表:删除指定行
            function set_GridDelete(obj) {
                var data = obj.data;
                var rowIndex = $(obj.tr).attr("data-index");
                if (obj.event === 'del') {
                    layer.confirm('真的删除行吗?', function (index) {
                        var oldData = table.cache["mainTable"];
                        oldData.splice(obj.tr.data('index'), 1)
                        option.data = oldData;//将数据绑定到data上
                        table.render(option);
                        //将子表数据传给主页面
                        $("#subMaterList_Temp", window.parent.document).val(JSON.stringify(option.data));
                        layer.close(index);
                    });
                }
            }
            //#endregion
 
            //#region 隐藏列设置
            function get_HideColumn() {
                var colName = "";
                var contentUrl = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                var urlStr = window.document.location.pathname;//获取文件路径
                var urlLen = urlStr.split('/');
                for (var i = 0; i < urlLen.length - 4; i++) {
                    contentUrl += "../";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI 进行编码
 
                contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
 
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 的 样式
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: [contentUrl, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //#endregion
            //#region 显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    async: false,
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
 
                            dataCol = data1.data[0].HGridString.split(',');
 
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] += "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] += "font-size:100%";
                                }
                                //设置列宽
                                //if (data1.data[0].HColumnWidth != 0) {
                                //    option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
                                //} else {
                                //    option.cols[0][i + 1]["width"] = "";
                                //}
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                    option.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(左 居中 右)
                                switch (dataCols[2]) {
                                    case "L":
                                        option.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
 
                            //取消冻结列
                            for (var i = 1; i < option.cols[0].length - 1; i++) {
                                if (option.cols[0][i]["fixed"] != null) {
                                    option.cols[0][i]["fixed"] = null;
                                }
                                else {
                                    break;
                                }
                            }
                            //冻结列
                            if (data1.data[0].HFixCols != 0) {
                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option);
                        } else {
                            table.render(option);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#endregion
 
 
 
 
        });
 
 
    </script>
</body>
</html>