wtt
2024-11-22 4f90256a50a31f587853ce3ce51a89732764c924
WebTM/views/É豸¹ÜÀí/Sb_EqpMaintenanceBillList.html
@@ -174,6 +174,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-getCheckData"><i class="layui-icon layui-icon-tips"></i>预览</button>-->
@@ -223,6 +224,8 @@
            //查询条件
            var sWhere = "";
            var page = 1;//分页数据
            var size = 50;
            var option = [];
            var HModName = "Sb_EqpMaintenanceBillList";
@@ -232,11 +235,11 @@
            var HPageTitle = get_PageTitle(HModuleType) == "" ? document.title : get_PageTitle(HModuleType);
        //#endregion
            var titleData = ["hmainid", "单据ID", "单据类型", "HEquipID", "HRepairID", "HEmpID", "HDeptID", "HManagerID", "hsubid", "HRepairID1", "HManagerID1", "源单主内码", "源单子内码", "HBillType", "HMainSourceBillType", "HMainSourceInterID"];//不需要显示的字段 å¯æ‰©å±•
            var titleData = ["sorderid","hmainid", "单据ID", "单据类型", "HEquipID", "HRepairID", "HEmpID", "HDeptID", "HManagerID", "hsubid", "HRepairID1", "HManagerID1", "源单主内码", "源单子内码", "HBillType", "HMainSourceBillType", "HMainSourceInterID"];//不需要显示的字段 å¯æ‰©å±•
            //#region ã€è¿‡æ»¤æ–¹æ¡ˆã€‘
            //过滤条件的classç±»
            //过滤条件的classç±»
            var HClassTag = "ForFilteringSchemes";
            //模块名称(中文版) æ¯ä¸ªæ¨¡å—页面都需要修改
            window.HModuleName = "设备维修记录单列表";
@@ -253,7 +256,7 @@
            //初始化界面
            set_ClearBill();
            //初始化表格
            DisPlay_HideColumn();
            //DisPlay_HideColumn();
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
@@ -325,7 +328,11 @@
            // æŸ¥è¯¢æŒ‰é’®
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
                if (page != 1) {
                    $("#page a:eq(1)").get(0).click();//点击分页栏第一页
                } else {
                    get_FastQuery();
                }
            });
            // é‡ç½®æŒ‰é’®
@@ -351,7 +358,7 @@
                    get_DefaultModule();
                }
            }
            //初始化表格
@@ -362,7 +369,7 @@
                    , height: 'full-50'
                    , limit: 50
                    , limits: [50, 500, 5000, 20000]
                    , page: true
                    , page: false
                    , cellMinWidth: 90
                    , cols: [[
                        { type: 'checkbox', fixed: 'left' }
@@ -426,6 +433,24 @@
                        , { field: 'HBillType', title: 'HBillType', width: 200, hide: true }
                    ]]
                };
                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);
            }
            //查询
@@ -463,7 +488,7 @@
                                        case 'double':
                                        case 'Decimal':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120, totalRow: true });
                                            break;
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                    }
@@ -511,6 +536,78 @@
                    }
                });
            }
            //#region åˆ†é¡µæŸ¥è¯¢
            function get_DisplayPage(sWhere) {
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Sb_EqpRepairWorkBill/GetEqpRepairWorkBillListPage',
                    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()
@@ -605,8 +702,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()
@@ -682,18 +779,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 = "";
        }
@@ -781,7 +880,7 @@
                else {
                    layer.msg("请选择一条数据!");
                }
            }
            }
            //隐藏列设置
            function get_HideColumn() {
@@ -919,12 +1018,12 @@
            function addSWhereByOpenType() {
                //获取参数
                var params = getUrlVars();
                var openType = params[params[0]]; //从参数中获取 æ‰“开方式  1直接打开 2其它页面通过选择按钮打开
                var openType = params[params[0]]; //从参数中获取 æ‰“开方式  1直接打开 2其它页面通过选择按钮打开
                if (openType == 2) {
                    sWhere += " and  å®¡æ ¸äºº IS NOT NULL and å®¡æ ¸äºº <> '' and (关闭人 IS NULL OR å…³é—­äºº = '')  ";
                    form.render("select");
                    return true;
                }
                }
            }
            //#endregion
@@ -1010,7 +1109,7 @@
                for (var i = 0; i < Filter.length; i++) {
                    HFilterIdList = Filter[i].id; //过滤条件ID
                    HFilterIdLists += Filter[i].id + ","; //过滤条件ID(拼接)
                    HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
                    HValue += $("#" + HFilterIdList).val() + ","; //过滤条件中输入的值
                    HElement_type += document.getElementById(HFilterIdList).tagName + ",";//通过标签id获取标签类型
                }