1
duhe
2024-10-25 130a2c32b6eb0bb48330ff2eb93f83470f22a05f
WebTM/views/»ù´¡×ÊÁÏ/ÏúÊÛ»ù´¡×ÊÁÏ/Gy_Customer.html
@@ -164,6 +164,7 @@
                            <div>
                                <table class="" id="mainTable" lay-filter="mainTable"></table>
                            </div>
                            <div id="page" style="position:relative;bottom:0;"></div>
                        </div>
                    </div>
@@ -204,6 +205,8 @@
            var titleData1 = ["HCusID"];
            var HCusTypeID = 0;
            var HCusClsName = '';
            var page = 1;//分页数据
            var size = 50;
            var ins;                        //用于导出excel
            var data_Tree = {};             //获取树状图数据
@@ -299,7 +302,11 @@
            //#region æŸ¥è¯¢æŒ‰é’®
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
                if (page != 1) {
                    $("#page a:eq(1)").get(0).click();//点击分页栏第一页
                } else {
                    get_FastQuery();
                }
            });
            //#endregion
@@ -351,7 +358,7 @@
                //查询
                //根据页面的打开方式,判断过滤条件是否需要进行额外的添加
                addSWhereByOpenType();
                get_Display(sWhere);
                get_DisplayPage(sWhere);
                //树状图生成
                get_Display_Tree();
@@ -364,7 +371,7 @@
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                    , page: true
                    , page: false
                    , limits: [50, 500, 5000, 50000]
                    , limit: 50
                    , cellMinWidth: 90
@@ -382,6 +389,28 @@
                        $("#mainTable").css("width", "100%");
                    },
                };
                optionPage = {
                    elem: 'page', //注意,这里的 page æ˜¯ ID,不用加 # å·
                    count: 10000, //数据总数,从服务端得到
                    limit: 50,
                    limits: [50, 500, 5000, 50000],
                    layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
                    jump: function (obj, first) {
                        //console.log(obj)
                        //obj包含了当前分页的所有参数,比如:
                        //console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
                        //console.log(obj.limit); //得到每页显示的条数
                        //首次不执行
                        if (!first) {
                            //do something
                            page = obj.curr;
                            size = obj.limit;
                            get_FastQuery();
                        }
                    }
                }
                laypage.render(optionPage);
            }
            //#endregion
@@ -473,6 +502,83 @@
                    }
                });
                layer.close(index);
            }
            //#endregion
            //#region åˆ†é¡µæŸ¥è¯¢
            function get_DisplayPage(sWhere) {
                var wait = layer.load();//遮罩
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Gy_Customer/page',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": page, "size": size, "Organization": Organization },
                    success: function (data1) {
                        option.limit = size;//改变表格页大小
                        if (data1.code == 1) {
                            optionPage.count = data1.count;//改变列表数据总数
                            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 });
                                //获取不需要显示的列(H开头的列不显示)
                                var patrn = new RegExp(/^h/i);
                                if (patrn.test(data1.list[key].ColmCols)) {
                                    titleData[key] = data1.list[key].ColmCols;
                                }
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 160 });
                                            break;
                                        case 'Decimal':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140, totalRow: true });
                                            break;
                                        case 'Int32':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140, totalRow: true });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140 });
                                    }
                                }
                            }
                            columns = col;
                            option.cols = [col];
                            option.data = data1.data;
                            option.totalRow = true;
                            laypage.render(optionPage);
                            //刷新表格数据
                            DisPlay_HideColumn();
                            layer.close(ajaxLoad);
                            if ($("#ColName option").length < 1) {
                                ColFilter();
                                get_DefaultModule();//加载方案
                            }
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            //option.data = [[]]
                            //table.render(option);
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
@@ -620,26 +726,27 @@
                if (HName) {
                    sWhere += " and å®¢æˆ·åç§° like '%" + HName + "%'";
                }
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL() + '/Gy_Customer/list',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "Organization": Organization  },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.close(ajaxLoad);
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                //$.ajax({
                //    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                //    url: GetWEBURL() + '/Gy_Customer/list',
                //    type: "GET",
                //    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "Organization": Organization  },
                //    success: function (data1) {
                //        if (data1.count == 1) {
                //            option.data = data1.data;
                //            table.render(option);
                //            layer.close(ajaxLoad);
                //            //layer.alert("查询成功", { icon: 1 });
                //        } else {
                //            layer.close(ajaxLoad);
                //            layer.alert(data1.code + data1.Message, { icon: 5 });
                //        }
                //    }, error: function () {
                //        layer.close(ajaxLoad);
                //        layer.alert("接口请求失败!", { icon: 5 });
                //    }
                //});
                get_DisplayPage(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
            //#endregion
@@ -958,8 +1065,18 @@
                                }
                            }
                            table.render(option);
                            ins = table.render(option);
                            //刷新按钮显示
                            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                            var HBillType = "Gy_Customer";
                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
                        } else {
                            table.render(option);
                            ins = table.render(option);
                            //刷新按钮显示
                            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                            var HBillType = "Gy_Customer";
                            Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
@@ -1197,7 +1314,7 @@
                            HCusTypeID = data.id;
                            HCusClsName = data.title;
                        }
                        get_Display(sql);
                        get_DisplayPage(sql);
                    }
                });
            }