wtt
2024-08-07 0866c815efee0c79cc75724208e0aa3559cacbae
付款单列设置
1个文件已修改
156 ■■■■■ 已修改文件
WebTM/views/采购管理/付款单/YF_PayMentBill.html 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/²É¹º¹ÜÀí/¸¶¿îµ¥/YF_PayMentBill.html
@@ -309,7 +309,11 @@
                    </div>
                   
                        <table  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="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                            </div>
                        </script>
                </form>
            </div>
        </div>
@@ -343,7 +347,6 @@
            //子表渲染参数
            var option = {};
            var tableShow = false;
            //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //#region åˆ¤æ–­æ˜¯å¦ç™»å½• æœªç™»å½•则跳到登录页
            if (sessionStorage.login != "login") {
@@ -391,7 +394,17 @@
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {   //监听mainTable表格上的工具栏事件 è§¦å‘回调函数obj参数
                var checkStatus = table.checkStatus('mainTable')  //  ç›‘听选中的的状态
                    , data = checkStatus.data;          //从选中状态中提取数据,这些数据是表格中被选中的行
                switch (obj.event) { // switch (obj.event)用于根据obj.event的值来决定执行哪个case块
                    ////列设置
                    case 'set_HideColumn':
                        get_HideColumn();
                        break;
                }
            });
            //#region è¡Œå†…事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
@@ -724,7 +737,8 @@
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                    ]]
                }
                option.data = [];
                table.render(option);
            }
            //#endregion
@@ -1046,7 +1060,6 @@
                }
                option.data = rowdata;
                table.render(option);
                tableShow = true;
            }
            //#endregion
@@ -1178,7 +1191,7 @@
                //获取表头数据并序列化
                var sMainStr = JSON.stringify(data.field);              //主表数据
                //子表数据
                if (tableShow == true) {
                if (table.cache["mainTable"].length!= 0 ) {
                    var num = [];
                    for (var i = 0; i < table.cache["mainTable"].length; i++) {
                        if (table.cache["mainTable"][i] != "") {
@@ -1238,8 +1251,8 @@
                            var data = result.data[0];
                            form.val("formData", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                                "HMainSourceInterID": data.HMainSourceInterID
                                , "HMainSourceEntryID": data.HMainSourceEntryID
                                "HMainSourceInterID": data.HMainSourceInterID == null ? 0 : data.HMainSourceInterID
                                , "HMainSourceEntryID": data.HMainSourceEntryID == null ? 0 : data.HMainSourceEntryID
                                , "HMainSourceBillNo": data.HMainSourceBillNo
                                , "HMainSourceBillType": data.HMainSourceBillType
                                , "HBillNo": data.单据号
@@ -1327,7 +1340,6 @@
                                }
                                option.data = rowdata;
                                table.render(option);
                                tableShow = true;
                            }
                            layer.close(ajaxLoad);
@@ -1343,6 +1355,132 @@
            }
            //#endregion
            //#region éšè—åˆ—设置
            function get_HideColumn() {
                var colName = "";
                for (var i = 1; i < option.cols[0].length; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                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_New.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //#endregion
            //#region æ˜¾ç¤ºåˆ—数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["hmainid", "HBillType", "HSupID", "业务状态", "HUnitID", "供应商代码", "业务员代码", "HPriority", "HPSStyleID", "HSSID", "HCurID", "HDeptID", "HManagerID", "HEmpID", "hsubid", "HMaterID"];//不需要显示的字段 å¯æ‰©å±•
                            var newCols = [[]];//对应数据库列顺序col
                            newCols[0].push(option.cols[0][0]);//放入第一个checkbox
                            dataCol = data1.data[0].HGridString.split(',');
                            //列设置列数与页面列数是否一致
                            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[4]) {
                                            //隐藏列
                                            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;
                                            }
                                            //字体所在位置(å·¦ å±…中 å³)
                                            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;
                                            }
                                            newCols[0].push(option.cols[0][i + 1]);
                                        }
                                    }
                                }
                                //遍历循环后判断对应列数是否一致
                                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);
                            var HBillType = "1102";
                            //刷新按钮显示
                            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
                        } else {
                            table.render(option);
                            var HBillType = "1102";
                            //刷新按钮显示
                            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#region éžç©ºéªŒè¯
            function AllowLoadData(data) {
                //#region æ•°æ®æ ¡éªŒå·¥å…·