王 垚
2021-08-13 ceed6b33ff4d3b87b309a1a63532f824dece95ef
WebTM/views/É豸¹ÜÀí/Sb_EquipMaintainPlanBillList.html
@@ -115,10 +115,80 @@
                , laypage = layui.laypage
                , laydate = layui.laydate
                , util = layui.util
            //查询条件
            var sWhere = "";
            //公用变量
            var option = [];
            var option = {
            //初始化表格
            set_InitGrid();
            //加载数据到网格
            get_Display(sWhere);
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus(obj.config.id);
                switch (obj.event) {
                    //新增按钮
                    case 'btn-Add':
                        set_AddNew();
                        break;
                    case 'btn-Edit':
                        set_ShowBill();
                        break;
                    case 'btn-Delete':
                        set_DeleteBill();
                        break;
                    //审核按钮
                    case 'btn-Audit':
                        set_CheckBill();
                        break;
                    //反审核按钮
                    case 'btn-DeAudit':
                        set_AbandonCheck();
                        break;
                    //预览按钮
                    case 'btn-Print':
                        get_PrintReport();
                        break;
                    //退出按钮
                    case 'btn-Close':
                        parent.layui.admin.events.closeThisTabs();
                        break;
                };
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                set_ClearQuery();
            });
            //重置过滤条件
            function set_ClearQuery() {
                $("#HNumber").val("");
                $("#HName").val("");
            }
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery(table, option);
            });
            //快速过滤
            function get_FastQuery(table, option) {
                //var HNumber = $("#HNumber").val();
                //var HName = $("#HName").val();
                //if (HNumber) {
                //    sWhere += " and èŒå‘˜ä»£ç  like '%" + HNumber + "%'";
                //}
                //if (HName) {
                //    sWhere += " and èŒå‘˜åç§° like '%" + HName + "%'";
                //}
                var index = layer.load(0);
                get_Display(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
            function set_InitGrid() {
                option = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
                , height: 'full-50'
@@ -167,15 +237,11 @@
                    , { field: '源单类型', title: '源单类型', width: 200 }
                    , { field: 'hbilltype', title: 'hbilltype', width: 200 }
                ]]
            };
                }
            }
            var index = layer.load(0);
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus(obj.config.id);
                switch (obj.event) {
                    case 'btn-Add':
            //新增
            function set_AddNew() {
                        //页面层-自定义
                        layer.open({
                            type: 2,
@@ -194,8 +260,9 @@
                            }
                        });
                        break;
                    case 'btn-Edit':
            }
            //编辑单据
            function set_ShowBill() {
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        if (checkStatus.data.length === 1) {
@@ -222,9 +289,9 @@
                        } else {
                            layer.msg('请选择一行数据编辑!');
                        }
                        break;
                    case 'btn-Delete':
            }
            //删除
            function set_DeleteBill() {
                        var checkStatus = table.checkStatus('mainTable')
                            , data = checkStatus.data;
                        if (checkStatus.data.length === 1) {
@@ -259,11 +326,9 @@
                        else {
                            layer.msg('请选择一行数据删除!');
                        }
                        break;
                };
            });
            }
            //进入页面显示的缓存列表
            function get_Display(sWhere) {
            $.ajax({
                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                url: GetWEBURL() + '/Sb_EquipMaintainPlanBill/GetEquipMaintainPlanBillList',
@@ -283,83 +348,16 @@
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
            //重置按钮
            //form.on('submit(btnReSearch)', function (data) {
            //    $("#HBillType").val("");//单据类型
            //    $("#HBillNo").val("");//单据号
            //    $("#HSourceBillNo").val("");//源单号
            //    $("#HCreateBy").val("");//制单人
            //    $("#BenginHCreateDate").val("");//开始制单时间
            //    $("#EndHCreateDate").val("");//结束制单时间
            //    $("#btnSearch").click();
            //});
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
                //var HBillType = $("#HBillType").val();//单据类型
                //var HBillNo = $("#HBillNo").val();//单据号
                //var HCreateBy = $("#HCreateBy").val();//制单人
                //var BenginHCreateDate = $("#BenginHCreateDate").val();//开始制单时间
                //var EndHCreateDate = $("#EndHCreateDate").val();//结束制单时间
                //if (HBillNo) {
                //    sWhere += " and HBillNo like '%" + HBillNo + "%'";
                //}
                //if (HCreateBy) {
                //    sWhere += " and HCreateBy like '%" + HCreateBy + "%'";
                //}
                //if (BenginHCreateDate) {
                //    sWhere += " and CONVERT(varchar(100),HCreateDate, 23) >= '" + BenginHCreateDate + "'";
                //}
                //if (EndHCreateDate) {
                //    sWhere += " and CONVERT(varchar(100),HCreateDate, 23) <= '" + EndHCreateDate + "'";
                //}
                var index = layer.load(0);
                $.ajax({
                    //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                    url: GetWEBURL() + '/Sb_EquipMaintainPlanBill/GetEquipMaintainPlanBillList',
                    type: "GET",
                    data: { "sWhere": sWhere},
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.close(index);
                            layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.close(index);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index);
                        layer.alert("接口失效!", { icon: 5 });
            //审核
            function set_CheckBill() {
                    }
                });
                //调用接口后清空sWhere缓存
                sWhere = "";
                //$("#HBillType").val("");//单据类型
                //$("#HBillNo").val("");//单据号
                //$("#HSourceBillNo").val("");//源单号
                //$("#HCreateBy").val("");//制单人
                //$("#BenginHCreateDate").val("");//开始制单时间
                //$("#EndHCreateDate").val("");//结束制单时间
            });
            //监听行双击事件
            table.on('rowDouble(mainTable)', function (obj) {
                layer.alert("双击事件", { icon: 1 });
            });
            //反审核
            function set_AbandonCheck() {
            }
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //以上是layui模块
        });