1
yangle
2024-11-19 e7ba0a4a15be1664853852c38bb2008b83251b73
WebTM/views/É豸¹ÜÀí/Sb_EquipRepairSignBillMain.html
@@ -152,6 +152,7 @@
                            </div>
                        </div>
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                        <div id="page" style="position: relative; bottom: 0;"></div>
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Add" id="Add"><i class="layui-icon layui-icon-add-1"></i>新增</button>
@@ -203,6 +204,8 @@
            //查询条件
            var sWhere = "";
            var option = [];
            var page = 1;//分页数据
            var size = 50;
            var HModName = "Sb_EquipRepairSignBillMain";
            //#region ã€åŠ¨æ€èŽ·å–æ¨¡å—åç§°ã€‘
@@ -211,7 +214,7 @@
            var HPageTitle = get_PageTitle(HModuleType) == "" ? document.title : get_PageTitle(HModuleType);
        //#endregion
            var titleData = ["hmainid", "单据ID", "单据类型", "HEquipID", "HSignEmpID", "HMainSourceInterID", "HMainSourceEntryID", "HMainSourceBillNo", "HMainSourceBillType", "HEquipConkBookInterID","HBillType"];//不需要显示的字段 å¯æ‰©å±•
            var titleData = ["sorderid","hmainid", "单据ID", "单据类型", "HEquipID", "HSignEmpID", "HMainSourceInterID", "HMainSourceEntryID", "HMainSourceBillNo", "HMainSourceBillType", "HEquipConkBookInterID", "HBillType","HDeptID"];//不需要显示的字段 å¯æ‰©å±•
            //#region ã€è¿‡æ»¤æ–¹æ¡ˆã€‘
@@ -232,7 +235,7 @@
            //初始化界面
            set_ClearBill();
            //初始化表格
            DisPlay_HideColumn();
            //DisPlay_HideColumn();
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
@@ -312,7 +315,11 @@
            // æŸ¥è¯¢æŒ‰é’®
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
                if (page != 1) {
                    $("#page a:eq(1)").get(0).click();//点击分页栏第一页
                } else {
                    get_FastQuery();
                }
            });
            // é‡ç½®æŒ‰é’®
@@ -340,11 +347,29 @@
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                    , page: true
                    , page: false
                    , totalRow: true
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                };
                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) {
                        //首次不执行
                        if (!first) {
                            //do something
                            page = obj.curr;
                            size = obj.limit;
                            get_FastQuery();
                        }
                    }
                }
                laypage.render(optionPage);
            }
            //#endregion
@@ -431,6 +456,78 @@
                    }
                });
            }
            //#region åˆ†é¡µæŸ¥è¯¢
            function get_DisplayPage(sWhere) {
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Sb_CheckEqpRepairWorkBill/Sb_EquipRepairSignBillListPage',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": page, "size": size },
                    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 ($.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();
                            }
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //新增
            function set_AddNew()
@@ -524,8 +621,8 @@
           //快速过滤
            function get_FastQuery() {
            var HDate = $("#HDate").val();//开始日期
            var HDate1 = $("#HDate1").val();//结束日期
                var HDate = $("#HDate").val();//开始日期
                var HDate1 = $("#HDate1").val();//结束日期
                var HBillNo = $("#HBillNo").val();//单据号
                var ColName = $("#ColName").val();//复选框
                var Comparator = $("#Comparator").val()
@@ -601,18 +698,20 @@
                    }
                    sWhere += " and " + ColName2 + " " + com2;
                }
            if (HDate) {
                sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HDate + "'";
            }
            if (HDate1) {
                sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HDate1 + "'";
            }
            if (HBillNo) {
                sWhere += " and å•据号 like '%" + HBillNo + "%'";
            }
            get_Display(sWhere);
            //调用接口后清空sWhere缓存
            sWhere = "";
                if (HDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HDate + "'";
                }
                if (HDate1) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HDate1 + "'";
                }
                if (HBillNo) {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                }
                //get_Display(sWhere);
                //数据库分页
                get_DisplayPage(sWhere)
                //调用接口后清空sWhere缓存
                sWhere = "";
        }