1
pzy
2024-08-26 306a5bb459d13ded4bc4772a3da0a4c88bb27701
WebTM/views/²É¹º¹ÜÀí/²É¹ººÏͬ/Add_Edit_Cg_ContractBillList.html
@@ -323,7 +323,8 @@
            //记录组织的值
            var HOrgIDBar = 0;
            var HModName = "Add_Edit_Cg_ContractBillSub1"
            var HModName2 = "Add_Edit_Cg_ContractBillSub2"
            //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //判断是否登录 æœªç™»å½•则跳到登录页
@@ -448,6 +449,10 @@
                    case 'get_InOutSum': get_InOutSum();
                        break;
                    //列设置
                    case 'set_HideColumn':
                        get_HideColumn();
                        break;
                    //列设置
                    //case 'set_hidecolumn':
                    //    get_hidecolumn();
                    //    break;
@@ -487,6 +492,10 @@
                            //刷新复选框
                            //checkRefresh();
                        }
                        break;
                    //列设置
                    case 'set_HideColumn2':
                        get_HideColumn2();
                        break;
                    //列设置
                    //case 'set_hidecolumn':
@@ -788,7 +797,7 @@
                    , loading: false
                    , cols: [[ //子表
                        { type: 'checkbox', fixed: 'left', totalRowText: '合计行', style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', title: '序号', width: 100, style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', field: '序号', title: '序号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                        , { field: '物料代码', title: '物料代码', width: 150, edit: 'text', event: "HMaterID" }//f7
                        , { field: '物料名称', title: '物料名称', width: 150, style: 'background-color:#efefef4d;' }
@@ -802,12 +811,13 @@
                        , { field: 'HTaxMoney', title: '税额', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotal', title: '价税合计', width: 100, edit: 'text' }
                        , { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                        , { fixed: 'right', field: '操作', title: '操作', toolbar: '#barDemo', width: 70 }
                    ]]
                }
                option.data = rowdata;
                table.render(option);
                DisPlay_HideColumn();
            }
            function set_InitGrid2() {
                option2 = {
@@ -819,19 +829,20 @@
                    , loading: false
                    , cols: [[ //子表
                        { type: 'checkbox', fixed: 'left', totalRowText: '合计行', style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', title: '序号', width: 100, style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', field: '序号', title: '序号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HCurID', title: '货币代码', width: 100, hide: true }
                        , { field: '货币名称', title: '货币名称', width: 100, edit: 'text', event: "HCurID" }//f7
                        , { field: 'HExRate', title: '汇率', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HMoney', title: '金额', width: 100, edit: 'text', totalRow: true }
                        , { field: 'HDate', title: '到货日期', width: 120, event: 'HDate' }
                        , { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo2', width: 70 }
                        , { fixed: 'right', field: '操作', title: '操作', toolbar: '#barDemo2', width: 70 }
                    ]]
                }
                option2.data = rowdata2;
                table.render(option2);
                DisPlay_HideColumn2();
            }
            //#endregion
            //#region åŠ è½½è¡¨å¤´
@@ -1631,7 +1642,223 @@
            //#endregion
            //#endregion
            //#region åˆ—设置1
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["field"] + ",";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            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 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 (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[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //显示列
                                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;
                                }
                                //设置表格title属性显示别名
                                if (dataCols[4] != null && dataCols[4] != "") {
                                    option.cols[0][i + 1]["title"] = dataCols[4];
                                }
                            }
                            //取消冻结列
                            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
            //#region åˆ—设置2
            //隐藏列设置
            function get_HideColumn2() {
                var colName = "";
                for (var i = 1; i < option2.cols[0].length - 1; i++) {
                    colName += option2.cols[0][i]["field"] + ",";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName2 + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            function DisPlay_HideColumn2() {
                $.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 titleData = [];//不需要显示的字段 å¯æ‰©å±•
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option2.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option2.cols[0][i + 1]["hide"] = true;
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option2.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option2.cols[0][i + 1]["style"] = "font-size:100%";
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option2.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option2.cols[0][i + 1]["title"], titleData) == -1) {
                                    option2.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(å·¦ å±…中 å³)
                                switch (dataCols[2]) {
                                    case "L":
                                        option2.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option2.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option2.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                                //设置表格title属性显示别名
                                if (dataCols[4] != null && dataCols[4] != "") {
                                    option2.cols[0][i + 1]["title"] = dataCols[4];
                                }
                            }
                            //取消冻结列
                            for (var i = 1; i < option2.cols[0].length - 1; i++) {
                                if (option2.cols[0][i]["fixed"] != null) {
                                    option2.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(option2.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option2.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option2);
                        } else {
                            table.render(option2);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //以上是layui模块