1
yangle
2025-04-08 2bf78eb12b5911a5a7c662422e3c84bce3d42a9f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
<!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 src="../../../layuiadmin/PageTitle.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 class="layui-row" lay-split="true">
                        <div class="layui-col-xs12 layui-col-md6">
                            <h1 style="text-align: center; padding: 10px 0;"><b>未核销采购入库单</b></h1>
                            <div class="layui-collapse">
                                <div class="layui-colla-item">
                                    <div class="layui-colla-title layui-inline">
                                        <div class="layui-inline">
                                            <span>更多</span>
                                        </div>
                                    </div>
                                    <!--<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 ForFilteringSchemes" name="HBillNo" id="HBillNo">
                                        </div>
                                    </div>-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">供应商<label style="color:red"> * </label></label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="HSupName" id="HSupName" class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
                                            <input type="hidden" name="HSupID" id="HSupID" class="layui-input" value="0" style="float:left;width:150px;">
                                            <button type="button" id="HSupList" lay-submit="" class="layui-btn" lay-filter="HSupList" style="width:40px;">
                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                            </button>
                                        </div>
                                    </div>
                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                    </button>
                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                    <div class="layui-colla-content" style="padding: 0px; margin-left: 6%;">
                                        <div class="layui-row" style="margin-top:5px;display:none;">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">过滤</label>
                                                <div class="layui-input-block">
                                                    <select name="ColName" id="ColName" lay-filter="ColName" style="width:190px;">
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <select name="Comparator" id="Comparator" lay-filter="Comparator" style="width:190px;">
                                                    <option value="0" selected="selected"></option>
                                                    <option value="=">=</option>
                                                    <option value=">=">>=</option>
                                                    <option value=">">></option>
                                                    <option value="<="><=</option>
                                                    <option value="<"><</option>
                                                    <option value="<>"><></option>
                                                    <option value="7">包含</option>
                                                    <option value="8">左包含</option>
                                                    <option value="9">右包含</option>
                                                    <option value="10">不包含</option>
                                                </select>
                                            </div>
                                            <div class="layui-inline">
                                                <input type="text" class="layui-input" value="" name="ColContent" id="ColContent">
                                            </div>
                                        </div>
                                        <div class="layui-row" style="margin-top: 5px; display: none;">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">过滤</label>
                                                <div class="layui-input-block">
                                                    <select name="ColName1" id="ColName1" lay-filter="ColName1" style="width:190px;">
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <select name="Comparator1" id="Comparator1" lay-filter="Comparator1" style="width:190px;">
                                                    <option value="0" selected="selected"></option>
                                                    <option value="=">=</option>
                                                    <option value=">=">>=</option>
                                                    <option value=">">></option>
                                                    <option value="<="><=</option>
                                                    <option value="<"><</option>
                                                    <option value="<>"><></option>
                                                    <option value="7">包含</option>
                                                    <option value="8">左包含</option>
                                                    <option value="9">右包含</option>
                                                    <option value="10">不包含</option>
                                                </select>
                                            </div>
                                            <div class="layui-inline">
                                                <input type="text" class="layui-input" value="" name="ColContent1" id="ColContent1">
                                            </div>
                                        </div>
                                        <div class="layui-row" style="margin-top: 5px; display: none;">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">过滤</label>
                                                <div class="layui-input-block">
                                                    <select name="ColName2" id="ColName2" lay-filter="ColName2" style="width:190px;">
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <select name="Comparator2" id="Comparator2" lay-filter="Comparator2" style="width:190px;">
                                                    <option value="0" selected="selected"></option>
                                                    <option value="=">=</option>
                                                    <option value=">=">>=</option>
                                                    <option value=">">></option>
                                                    <option value="<="><=</option>
                                                    <option value="<"><</option>
                                                    <option value="<>"><></option>
                                                    <option value="7">包含</option>
                                                    <option value="8">左包含</option>
                                                    <option value="9">右包含</option>
                                                    <option value="10">不包含</option>
                                                </select>
                                            </div>
                                            <div class="layui-inline">
                                                <input type="text" class="layui-input" value="" name="ColContent2" id="ColContent2">
                                            </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-waitSec"><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>
                        </div>
                        <div class="layui-col-xs12 layui-col-md6">
                            <h1 style="text-align: center; padding: 10px 0;"><b>待核销列表</b></h1>
                            <div class="layui-collapse">
                                <div class="layui-colla-item">
                                    <div class="layui-colla-title layui-inline">
                                        <div class="layui-inline">
                                            <span>更多</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
                            <script type="text/html" id="toolbarDemo1">
                                <div class="layui-btn-container">
                                    <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><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>
                                    <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Sec"><i class="layui-icon layui-icon-form"></i>核销</button>
                                </div>
                            </script>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
 
    <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 option = {};            //表1渲染参数
            var option1 = {};           //表2渲染参数
            //模块名
            var HModName = "Cg_POStockInBillList_Sec_Sub";
            var HModName1 = "Cg_POStockInBillList_Sec_Sub1";
            var HBillType = "0001";
            //过滤条件
            var sWhere = "";
 
            //#endregion
 
            //#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 进入页面即加载
            //#region 页面初始化
            set_ClearBill();
            //#endregion
            //#endregion
 
            //#region 选择供应商按钮
            form.on('submit(HSupList)', function () {
                get_checkSup();
            });
 
            //#region 供应商选择页面
            function get_checkSup() {
                var HOrgName = sessionStorage["Organization"];
                layer.open({
                    type: 2//弹窗类型
                    , skin: 'layui-layer-rim' //加上边框
                    , area: ['90%', '90%']//大小
                    , title: '供应商列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/采购基础资料/Gy_Supplier.html?Type=HSup&HOrgName=' + HOrgName, '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('请选择数据');
                        }
 
                        $("#HSupName").val(checkStatus.data[0].供应商名称);
                        $("#HSupID").val(checkStatus.data[0].HItemID);
 
                        document.getElementById("HSupList").disabled = true;
                        document.getElementById("HSupList").style.color = "white";
 
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
            //#endregion
 
            //#region 子表1:点击行选中高亮
            table.on('row(mainTable)', function (obj) {
                //选中行改变颜色
                var flag = !obj.tr.find(':checkbox:first').prop('checked');
                obj.tr.find(':checkbox').prop('checked', flag);
                if (flag) {
                    obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //设置复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
                } else {
                    obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
                }
                //mainTable 为表格ID   注意此处如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = flag;
                    }
                });
            })
            //#endregion
 
            //#region 子表2:点击行选中高亮
            //table.on('row(mainTable1)', function (obj) {
            //    //选中行改变颜色
            //    var flag = !obj.tr.find(':checkbox:first').prop('checked');
            //    obj.tr.find(':checkbox').prop('checked', flag);
            //    if (flag) {
            //        obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //设置复选框选中样式
            //        $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
            //    } else {
            //        obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
            //        $(obj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
            //    }
            //    //mainTable 为表格ID   注意此处如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
            //    layui.each(table.cache.mainTable1, function (i, l) {
            //        if (obj.tr.index() == l.LAY_TABLE_INDEX) {
            //            l.LAY_CHECKED = flag;
            //        }
            //    });
            //})
            //#endregion
 
            //#region 子表1:头工具栏事件
            //#region 子表1 头工具栏按钮监听
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                switch (obj.event) {
                    //加入待核销队列
                    case 'btn-waitSec':
                        waitSec(data);
                        break;
                    //列设置
                    case 'set_HideColumn':
                        get_HideColumn();
                        break;
                }
            });
            //#endregion
 
            //#region 加入待核销队列
            function waitSec(obj) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (data.length > 0) {
                    //判断选中的记录中是否存在不同的客户,若存在,则操作失败。若不存在,则记录销售出库单的主内码
                    var dataArray = [];
                    var HCusName = data[0].供应商;
                    //var HEmpName = data[0].业务员;
                    for (var i = 0; i < data.length; i++) {
                        if ($.inArray(data[i].hmainid, dataArray) == -1) {
                            var temp = {
                                "hmainid": data[i].hmainid
                                ,"单据号": data[i].单据号
                            }
                            dataArray.push(temp);
                        }
 
                        if (data[i].供应商 != HCusName) {
                            layer.msg("加入待核销列表失败!已经选中的记录中存在不同供应商!");
                            return;
                        }
                        //if (data[i].业务员 != HEmpName) {
                        //    layer.msg("下推失败!已经选中的记录中存在不同业务员!");
                        //    return;
                        //}
                    }
 
 
                    //判断选中的单据中是否已经被加入到待核销列表中
                    for (var i = 0; i < dataArray.length; i++) {
                        var err = "";
                        var sql = "select * from h_v_Cg_POStockInBillList_WaitSec where 1=1 " + " and hmainid = '" + dataArray[i].hmainid + "' order by 单据号 desc";
                        var ModRightNameCheck = "";
                        $.ajax({
                            url: GetWEBURL() + '/CommonModel/searchMethod',
                            type: "GET",
                            async: false,
                            data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
                            success: function (data1) {
                                if (data1.count == 1) {
                                    if (data1.data.length > 0) {
                                        err += "单据号[" + data[0].单据号 + "]:已经加入到待核销列表,核销人为[" + data[0].核销人 + "];";
                                    }
                                } else {
                                    err += data1.code + data1.Message;
                                }
                            }, error: function (e) {
                                err += "接口请求失败!" + e;
                            }
                        });
                    }
                    if (err != "") {
                        layer.alert(err, { icon: 5 });
                        return;
                    }
 
                    //将选中的单据加入到待核销列表中
                    var successMsg = "";
                    var errMsg = "";
                    for (var i = 0; i < dataArray.length; i++) {
                        $.ajax({
                            url: GetWEBURL() + '/Cg_POStockInBillList_Sec/addBillToWaitSecList',
                            type: "GET",
                            async: false,
                            data: { "hmainid": dataArray[i].hmainid, "user": sessionStorage["HUserName"] },
                            success: function (data1) {
                                if (data1.count == 1) {
                                    successMsg += "[" + dataArray[i].单据号 + "]";
                                } else {
                                    errMsg += "[" + dataArray[i].单据号 + "]";
                                }
                            }, error: function (e) {
                                errMsg += "[" + dataArray[i].单据号 + "]";
                            }
                        });
                    }
                    if (errMsg != "") {
                        successMsg += "加入成功!";
                        errMsg += "加入失败!";
                        layer.alert(successMsg + errMsg, { icon: 5 });
                    }
 
                    get_FastQuery();
                    get_FastQuery1();
 
 
                } else {
                    layer.msg('请选择数据下推!');
                }
            }
            //#endregion
            //#endregion
 
            //#region 子表2:头工具栏事件
            //#region 子表2 头工具栏按钮监听
            table.on('toolbar(mainTable1)', function (obj) {
                var checkStatus = table.checkStatus('mainTable1')
                    , data = checkStatus.data;
 
                switch (obj.event) {
                    //删除
                    case 'btn-Delete':
                        deleteFromWaitSecList();
                        break;
                    //核销
                    case 'btn-Sec':
                        SecSellOutBill();
                        break;
                    //列设置
                    case 'set_HideColumn':
                        get_HideColumn1();
                        break;
                }
            });
            //#endregion
 
            //#region 从待核销列表删除
            function deleteFromWaitSecList() {
                var checkStatus = table.checkStatus('mainTable1')
                    , data = checkStatus.data;
                if (data.length == 1) {
                    var ajaxLoad = layer.load();
                    var hmaindid = data[0].hmainid;
                    var sql = "delete from Cg_POStockInBillList_Sec where HMainSourceInterID = " + hmaindid + " and ISNULL(HSecEmp,'') = '' ";
                    var ModRightNameCheck = "";
                    $.ajax({
                        url: GetWEBURL() + '/CommonModel/commonMethod',
                        type: "GET",
                        async: false,
                        data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
                        success: function (data1) {
                            if (data1.count == 1) {
                                layer.close(ajaxLoad);
                                layer.msg("删除成功!", { time: 1 * 1000, icon: 1 }, function () {
                                    // 得到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    layer.close(index);
                                });
 
                                get_FastQuery();
                                get_FastQuery1();
                            } else {
                                layer.close(ajaxLoad);
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function (e) {
                            layer.close(ajaxLoad);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                } else {
                    layer.msg('请选择一行数据下推!');
                }
            }
            //#endregion
 
            //#region 核销
            function SecSellOutBill() {
                var checkStatus = table.checkStatus('mainTable1')
                    , data = checkStatus.data;
                if (data.length > 0) {
                    //判断选中的记录中是否存在不同的客户,若存在,则操作失败。若不存在,则记录销售出库单的主内码
                    var dataArray = [];
                    var HCusName = data[0].供应商;
                    //var HEmpName = data[0].业务员;
                    for (var i = 0; i < data.length; i++) {
                        if ($.inArray(data[i].hmainid, dataArray) == -1) {
                            var temp = {
                                "hmainid": data[i].hmainid
                                , "单据号": data[i].单据号
                            }
                            dataArray.push(temp);
                        }
 
                        if (data[i].供应商 != HCusName) {
                            layer.msg("核销失败!已经选中的记录中存在不同供应商!");
                            return;
                        }
                        //if (data[i].业务员 != HEmpName) {
                        //    layer.msg("下推失败!已经选中的记录中存在不同业务员!");
                        //    return;
                        //}
                    }
 
 
                    //判断选中的单据是否存在且符合核销条件
                    for (var i = 0; i < dataArray.length; i++) {
                        var err = "";
                        var sql = "select * from h_v_Cg_POStockInBillList_WhenSec where 1 = 1 and hmainid = " + dataArray[i].hmainid;
                        var ModRightNameCheck = "";
                        $.ajax({
                            url: GetWEBURL() + '/CommonModel/searchMethod',
                            type: "GET",
                            async: false,
                            data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
                            success: function (data1) {
                                if (data1.count == 1) {
                                    if (data1.data.length == 0) {
                                        err += "单据号[" + data[0].单据号 + "]:不存在或状态不为[审核/关闭];";
                                    }
                                } else {
                                    err += data1.code + data1.Message;
                                }
                            }, error: function (e) {
                                err += "接口请求失败!" + e;
                            }
                        });
                    }
                    if (err != "") {
                        layer.alert(err, { icon: 5 });
                        return;
                    }
 
                    //核销生成应收单
                    var hmainidList = [];
                    for (var i = 0; i < dataArray.length; i++) {
                        hmainidList.push(dataArray[i].hmainid);
                    }
                    $.ajax({
                        url: GetWEBURL() + '/Cg_POStockInBillList_Sec/SecToPayableBill',
                        type: "GET",
                        async: false,
                        data: { "hmainidList": hmainidList.toString(), "user": sessionStorage["HUserName"] },
                        success: function (data1) {
                            if (data1.count == 1) {
                                layer.msg(data1.Message, { icon: 1 });
                            } else {
                                layer.alert(data1.Message, { icon: 5 });
                            }
                        }, error: function (e) {
                            layer.alert("接口访问错误" + e.Message, { icon: 5 });
                        }
                    });
 
 
                    get_FastQuery();
                    get_FastQuery1();
                } else {
                    layer.msg('请选择数据下推!');
                }
            }
            //#endregion
            //#endregion
 
            //#region 此页面所有的方法
            //#region 获取参数
            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
 
            //#region 列明显示下拉框
            function ColFilter() {
                var Organization = '<option  value="0" selected="selected" ></option>';
                for (var i = 1; i < option.cols[0].length; i++) {
                    if (option.cols[0][i].hide != true) {
                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].field + '</option>';
                    }
                }
                $("#ColName").empty();
                $("#ColName").append(Organization);
                $("#ColName1").empty();
                $("#ColName1").append(Organization);
                $("#ColName2").empty();
                $("#ColName2").append(Organization);
                form.render('select');
            }
            //#endregion
 
            //#region 子表初始化
            function get_InitGrid() {
                //表1
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    //, page: true
                    //, limit: 500
                    //, limits: [50, 500, 5000, 50000]
                    , totalRow: true
                    , cellMinWidth: 120
                    , height: 'full-100'
                    , cols: [[
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectID', title: '项目ID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProNumber', title: '项目代码', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProName', title: '项目名称', style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectStageID', title: '项目阶段ID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectStageName', title: '项目阶段名称', style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HName', title: '任务名称', style: 'background-color: #f9f9f9;' }
                        , { field: 'HTaskNote', title: '任务描述', style: 'background-color: #f9f9f9;' }
                        , { field: 'HPlanTimes', title: '预计工时', edit: 'text', totalRow: true }
                        , { field: 'HReportTimes', title: '已汇报工时', totalRow: true, style: 'background-color: #f9f9f9;' }
 
                        , { field: 'HMonday', title: '周一', templet: "#HMonday" }//checkbox
                        , { field: 'HTuesday', title: '周二', templet: "#HTuesday" }
                        , { field: 'HWednesday', title: '周三', templet: "#HWednesday" }
                        , { field: 'HThursday', title: '周四', templet: "#HThursday" }
                        , { field: 'HFriday', title: '周五', templet: "#HFriday" }
                        , { field: 'HSaturday', title: '周六', templet: "#HSaturday" }
                        , { field: 'HSunday', title: '周日', templet: "#HSunday" }
 
                        , { field: 'HSourceInterID', title: '源单内码', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HSourceEntryID', title: '源单子内码', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HSourceBillNo', title: '源单单号', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HSourceBillType', title: '源单类型', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                    ]]
                }
 
                var rowdata = [
 
                ];
                option.data = rowdata;
                table.render(option);
 
 
 
                //表2
                option1 = {
                    elem: '#mainTable1'
                    , toolbar: '#toolbarDemo1'
                    //, page: true
                    , limit: 500
                    //, limits: [50, 500, 5000, 50000]
                    , totalRow: true
                    , cellMinWidth: 120
                    , height: 'full-100'
                    , cols: [[
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectID', title: '项目ID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProNumber', title: '项目代码', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProName', title: '项目名称', style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectStageID', title: '项目阶段ID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectStageName', title: '项目阶段名称', style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HName', title: '任务名称', style: 'background-color: #f9f9f9;' }
                        , { field: 'HTaskNote', title: '任务描述', style: 'background-color: #f9f9f9;' }
                        , { field: 'HPlanTimes', title: '预计工时', edit: 'text', totalRow: true }
                        , { field: 'HReportTimes', title: '已汇报工时', totalRow: true, style: 'background-color: #f9f9f9;' }
 
                        , { field: 'HSourceInterID', title: '源单内码', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HSourceEntryID', title: '源单子内码', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HSourceBillNo', title: '源单单号', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HSourceBillType', title: '源单类型', hide: true, style: 'background-color: #f9f9f9;' }     //f7
                        // , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                    ]]
                }
 
                var rowdata1 = [
 
                ];
                option1.data = rowdata1;
                table.render(option1);
            }
            //#endregion
 
            //#region 初始化界面
            function set_ClearBill() {
                get_InitGrid();
 
                //get_FastQuery();
                get_FastQuery1();
 
                DisPlay_HideColumn();
                DisPlay_HideColumn1();
            }
            //#endregion
 
            //#region 未核销采购入库单查询
            //#region 查询
            function get_Display(sql) {
                var ajaxLoad = layer.load();
                var ModRightNameCheck = "";
                $.ajax({
                    url: GetWEBURL() + '/CommonModel/searchMethod',
                    type: "GET",
                    async: false,
                    data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var totalArray = [];
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                                if ($.inArray(data[i].name, totalArray) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                } else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
                                    }
                                }
                            }
 
 
                            //设置列
                            option.cols = [col];
                            //处理并设置表格数据
                            option.data = data1.data;
                            table.render(option);
                            //刷新表格数据
                            DisPlay_HideColumn();
 
                            layer.close(ajaxLoad);
 
                            if ($("#Comparator").val() == 0 && $("#ColContent").val() == "" && $("#Comparator1").val() == 0 && $("#ColContent1").val() == "" && $("#Comparator2").val() == 0 && $("#ColContent2").val() == "") {
                                ColFilter();
                            }
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
 
            }
            //#endregion
 
            //#region 快速过滤
            function get_FastQuery() {
                //获取登录账户对应职员名称
                //var HUserName = getHEmpByHUserName();
                //if (HUserName != "" && HUserName != null) {
                //    sWhere += " and 计划人 = '" + HUserName + "'";
                //}
 
                var HOrgID = sessionStorage["OrganizationID"];
                var HBillNo = $("#HBillNo").val();  //单据号
                var HSupID = $("#HSupID").val();
                var HSupName = $("#HSupName").val();
 
                //任意字段过滤
                var ColName = $("#ColName").val();//复选框
                var Comparator = $("#Comparator").val()
                var ColContent = $("#ColContent").val();
 
                var ColName1 = $("#ColName1").val();//复选框
                var Comparator1 = $("#Comparator1").val()
                var ColContent1 = $("#ColContent1").val();
 
                var ColName2 = $("#ColName2").val();//复选框
                var Comparator2 = $("#Comparator2").val()
                var ColContent2 = $("#ColContent2").val();
 
                if (ColName != 0 && Comparator != 0) {
                    var com = "";
                    switch (Comparator) {
                        case "7":
                            com = "like'%" + ColContent + "%'";
                            break;
                        case "8":
                            com = "like'%" + ColContent + "'";
                            break;
                        case "9":
                            com = "like'" + ColContent + "%'";
                            break;
                        case "10":
                            com = "not like'%" + ColContent + "%'";
                            break;
                        default:
                            com = "" + Comparator + "'" + ColContent + "'";
                            break;
                    }
                    sWhere += " and " + ColName + " " + com;
                }
                if (ColName1 != 0 && Comparator1 != 0) {
                    var com1 = "";
                    switch (Comparator1) {
                        case "7":
                            com1 = "like'%" + ColContent1 + "%'";
                            break;
                        case "8":
                            com1 = "like'%" + ColContent1 + "'";
                            break;
                        case "9":
                            com1 = "like'" + ColContent1 + "%'";
                            break;
                        case "10":
                            com1 = "not like'%" + ColContent1 + "%'";
                            break;
                        default:
                            com1 = "" + Comparator1 + "'" + ColContent1 + "'";
                            break;
                    }
                    sWhere += " and " + ColName1 + " " + com1;
                }
                if (ColName2 != 0 && Comparator2 != 0) {
                    var com2 = "";
                    switch (Comparator2) {
                        case "7":
                            com2 = "like'%" + ColContent2 + "%'";
                            break;
                        case "8":
                            com2 = "like'%" + ColContent2 + "'";
                            break;
                        case "9":
                            com2 = "like'" + ColContent2 + "%'";
                            break;
                        case "10":
                            com2 = "not like'%" + ColContent2 + "%'";
                            break;
                        default:
                            com2 = "" + Comparator + "'" + ColContent + "'";
                            break;
                    }
                    sWhere += " and " + ColName2 + " " + com2;
                }
 
                //if (HBillNo) {
                //    sWhere += " and 单据号 like '%" + HBillNo + "%'";
                //}
 
                if (HSupName) {
                    sWhere += " and 供应商 like '" + HSupName + "'";
                } else {
                    sWhere += " and 1=0";
                }
 
                if (HOrgID) {
                    sWhere += " and HOrgID = '" + HOrgID + "'";
                }
 
                var sql = "select * from h_v_Cg_POStockInBillList_Sec where 1=1 " + sWhere + " order by 单据号 desc"
 
                get_Display(sql);
                sWhere = "";//调用接口后清空sWhere缓存
            }
            //#endregion
 
            //#region 查询按钮
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
            });
            //#endregion
 
            //#region 重置按钮
            form.on('submit(btnReSearch)', function (data) {
                //清空过滤条件
                set_ClearQuery();
            });
            //#endregion
 
            //#region 重置过滤条件
            function set_ClearQuery() {
                $("#HBillNo").val("");
 
                $("#ColContent").val("");
                $("#ColName").val("0");
                $("#Comparator").val("0");
 
                $("#ColContent1").val("");
                $("#ColName1").val("0");
                $("#Comparator1").val("0");
 
                $("#ColContent2").val("");
                $("#ColName2").val("0");
                $("#Comparator2").val("0");
 
                form.render('select');
                sWhere = "";
            }
            //#endregion
            //#endregion
 
            //#region 待核销列表查询
            //#region 查询
            function get_Display1(sql) {
                var ajaxLoad = layer.load();
                var ModRightNameCheck = "";
                $.ajax({
                    url: GetWEBURL() + '/CommonModel/searchMethod',
                    type: "GET",
                    async: false,
                    data: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": ModRightNameCheck },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var totalArray = [];
 
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                               if ($.inArray(data[i].name, totalArray) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                } else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
                                    }
                                }
                            }
 
 
                            //设置列
                            option1.cols = [col];
                            //处理并设置表格数据
                            option1.data = data1.data;
                            table.render(option1);
                            //刷新表格数据
                            DisPlay_HideColumn1();
 
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
 
            }
            //#endregion
 
            //#region 快速过滤
            function get_FastQuery1() {
                var sql = "select * from h_v_Cg_POStockInBillList_WaitSec where 1=1 " + " and 核销人 = '" + sessionStorage["HUserName"] + "' order by 单据号 desc";
                get_Display1(sql);
            }
            //#endregion
            //#endregion
 
            //#region 子表1:隐藏列设置
            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 子表1:显示列数据
            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 = [];//数据库查询出的列数据
                            var titleData = ["项目ID", "项目阶段ID", "源单内码", "源单子内码", "源单单号", "源单类型"];//不需要显示的字段 可扩展
                            //titleData = [];
 
                            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 (e) {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
 
            //#region 子表2:隐藏列设置
            function get_HideColumn1() {
                var colName = "";
                var contentUrl = "";
                for (var i = 1; i < option1.cols[0].length - 1; i++) {
                    colName += option1.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=' + HModName1 + '&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_HideColumn1();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //#endregion
            //#region 子表2:显示列数据
            function DisPlay_HideColumn1() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName1, "user": sessionStorage["HUserName"] },
                    async: false,
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["项目ID", "项目阶段ID", "源单内码", "源单子内码", "源单单号", "源单类型"];//不需要显示的字段 可扩展
                            //titleData = [];
 
                            dataCol = data1.data[0].HGridString.split(',');
 
                            for (var i = 0; i < option1.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option1.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option1.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option1.cols[0][i + 1]["style"] += "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option1.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(option1.cols[0][i + 1]["title"], titleData) == -1) {
                                    option1.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(左 居中 右)
                                switch (dataCols[2]) {
                                    case "L":
                                        option1.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option1.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option1.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
 
                            //取消冻结列
                            for (var i = 1; i < option1.cols[0].length - 1; i++) {
                                if (option1.cols[0][i]["fixed"] != null) {
                                    option1.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(option1.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option1.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option1);
                        } else {
                            table.render(option1);
                        }
                    }, error: function (e) {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#endregion
        });
    </script>
</body>
</html>