wtt
2024-12-31 a8639d4836e656b961cdbf1c68a3747940f9a7df
模具列表添加分页
1个文件已修改
78 ■■■■ 已修改文件
WebTM/views/模治具管理/模治具管理/Gy_MouldFileList.html 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/Ä£Öξ߹ÜÀí/Ä£Öξ߹ÜÀí/Gy_MouldFileList.html
@@ -62,9 +62,10 @@
                            <div class="layui-col-xs3 layui-inline" style="border: solid 1.5px #e0d6d64d;">
                                <div id="TreeTable" class="demo-tree demo-tree-box"></div>
                            </div>
                            <div class="layui-col-xs8 layui-inline" style="padding-left: 10px; width: 73%">
                            <div class="layui-col-xs8 layui-inline" style="padding-left: 10px; width: 75%">
                                <div>
                                    <table class="" id="mainTable" lay-filter="mainTable"></table>
                                    <div id="page"></div>
                                </div>
                            </div>
                        </div>
@@ -110,6 +111,7 @@
                , tree = layui.tree
            var sWhere = "";
            var option = [];
            var sql = "";
            //#endregion
            //#region ã€è¿‡æ»¤æ–¹æ¡ˆã€‘
@@ -177,11 +179,13 @@
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                optionPage.curr = 1;
                get_FastQuery();
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                optionPage.curr = 1;
                set_ClearQuery();
            });
@@ -222,7 +226,7 @@
                set_InitGrid();
                //查询
                get_Display(sWhere);
                get_DisplayPage(sWhere);
                //查询器具分类
                get_Display_Tree();
@@ -236,8 +240,8 @@
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                    , page: true
                    , height: 'full-110'
                    , page: false
                    , totalRow: true
                    , limits: [50, 500, 5000, 20000]
                    , limit: 50 //每页默认显示的数量
@@ -308,6 +312,28 @@
                        , { field: 'hsubid', title: 'hsubid', hide: true, sort: true }
                    ]]
                };
                optionPage = {
                    elem: 'page', //注意,这里的 page æ˜¯ ID,不用加 # å·
                    count: 10000, //数据总数,从服务端得到
                    limit: 4,
                    limits: [4, 500, 1000, 2000],
                    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
                            console.log(obj)
                            get_FastQuery();
                        }
                    }
                }
                laypage.render(optionPage);
            }
            //查询
@@ -336,6 +362,39 @@
                });
            }
            //#region æŸ¥è¯¢(主表)-分页
            function get_DisplayPage(sWhere) {
                var ajaxLoad = layer.load();//遮罩
                var ModRightNameSelect = 'Gy_MouldFileList';
                $.ajax({
                    url: GetWEBURL() + '/Gy_Mould/page',
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "ModRightNameSelect": ModRightNameSelect, "user": sessionStorage["HUserName"],"page": optionPage.curr, "size": optionPage.limit },
                    success: function (data1) {
                        option.limit = optionPage.limit;//改变表格页大小
                        if (data1.code == 1) {
                            optionPage.count = data1.count;//改变列表数据总数
                            laypage.render(optionPage);
                            option.data = data1.data;
                            table.render(option);
                        } else {
                            optionPage.count = data1.count;//改变列表数据总数
                            laypage.render(optionPage);
                            option.data = [];
                            table.render(option);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                layer.close(ajaxLoad);
            }
            //#endregion
            //快速过滤
            function get_FastQuery() {
                var HNumber = $("#HNumber").val();
@@ -346,7 +405,10 @@
                if (HName) {
                    sWhere += " and æ¨¡å…·åç§° like '%" + HName + "%'";
                }
                get_Display(sWhere);
                if (sql != "") {
                    sWhere += sql;
                }
                get_DisplayPage(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
@@ -355,7 +417,7 @@
                $("#HNumber").val("")
                $("#HName").val("");
                sWhere = "";
                get_Display(sWhere);
                get_FastQuery();
            }
            //新增
@@ -634,13 +696,13 @@
                        obj.elem.addClass('layui-tree-set-active');
                        var data = obj.data;  //获取当前点击的节点数据
                        var sql = "";
                        sql = "";
                        if (data.id == "0") {
                            sql = "";
                        } else {
                            sql = " and HMouldTypeID='" + data.id + "' ";
                        }
                        get_Display(sql);
                        get_FastQuery();
                    }
                });
            }