yangle
2024-10-27 f6d6a3c0c65103cb4a58e4f929ed7a1c8da21b9a
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξ߹ÜÀí/Gy_BarCodeBillList.html
@@ -839,6 +839,11 @@
                            if ($("#ColName option").length < 1) {
                                ColFilter();
                            }
                            //刷新按钮显示
                            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                            var HBillType = "条码主档";
                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            option.data = [[]]
@@ -857,8 +862,8 @@
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                for (var i = 1; i < option.cols[0].length; i++) {
                    colName += option.cols[0][i]["field"] + ",";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
@@ -870,7 +875,7 @@
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide_New.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
@@ -882,93 +887,197 @@
            }
            //显示列数据
            //function DisPlay_HideColumn() {
            //    $.ajax({
            //        url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
            //        type: "GET",
            //        data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
            //        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);
            //            }
            //            //刷新按钮显示
            //            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
            //            var HBillType = "条码主档";
            //            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
            //        }, error: function () {
            //            layer.alert("接口请求失败!", { icon: 5 });
            //        }
            //    })
            //}
            //#region æ˜¾ç¤ºåˆ—数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    async: false,
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var newCols = [[]];//对应数据库列顺序col
                            newCols[0].push(option.cols[0][0]);//放入第一个checkbox
                            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;
                            //列设置列数与页面列数是否一致
                            if (dataCol.length == option.cols[0].length - 1) {
                                //遍历寻找列设置对应列按顺序插入
                                for (var j = 0; j < option.cols[0].length - 1; j++) {
                                    for (var i = 0; i < option.cols[0].length - 1; i++) {
                                        var dataCols = dataCol[j].split('|');
                                        //选择与datacols相应列进行修改
                                        if (option.cols[0][i + 1]["field"] == dataCols[5]) {
                                            //隐藏列
                                            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 (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                                option.cols[0][i + 1]["hide"] = false;
                                            }
                                            //统计列
                                            if (dataCols[6] == 1) {
                                                option.cols[0][i + 1]["totalRow"] = true;
                                            }
                                            //字体所在位置(å·¦ å±…中 å³)
                                            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;
                                            }
                                            //设置表格title属性显示别名
                                            if (dataCols[4] != null && dataCols[4] != "") {
                                                option.cols[0][i + 1]["title"] = dataCols[4];
                                            }
                                            newCols[0].push(option.cols[0][i + 1]);
                                        }
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                                //遍历循环后判断对应列数是否一致
                                if (dataCol.length == newCols[0].length - 1) {
                                    option.cols = newCols;
                                    //取消冻结列
                                    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);
                        }
                        //刷新按钮显示
                        var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                        var HBillType = "条码主档";
                        Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#region å¯¼å‡ºExecel
            function get_Export() {