layui.use('laydate', function () {
    var laydate = layui.laydate;
    //日期时间范围
    laydate.render({
        elem: '#test10'
        , type: 'datetime'
        , range: true
    });
});
layui.use(['table', 'jquery'], function () {
    var table = layui.table;
    //监听表格复选框选择
    table.on('checkbox(demo)', function (obj) {
        console.log(obj)
    });

    var $ = layui.$, active = {
        //查询按钮
        reload: function () {
            var cusName = $('#cusName');
            var cusNum = $('#cusNum');
            var content = $('#content');
            
            //执行重载
            table.reload('recordtable', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                , where: {
                    dateParty: $("#test10").val()
                    , NowDateTime: new Date()
                    ,cusName: cusName.val()
                   , content: content.val()

                }
            });
        }

    };

    $('.searchfilter .layui-btn').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
    formatcalldir = function (d) {
        var rescontent = "";
        if (d === 1) {
            rescontent = "<i class=\"iconfont icon-huchu\"></i>";
        }
        else {
            rescontent = "<i class=\"iconfont icon-huru\"></i>";
        }
        return rescontent;
    }
    //回车执行
    document.onkeydown = function (event) {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode === 13) {
            var cusName = $('#cusName');
            var cusNum = $('#cusNum');
            var content = $('#content');
            //执行重载
            table.reload('recordtable', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                , where: {
                    dateParty: $("#test10").val()
                    , NowDateTime: new Date()
                   , cusName: cusName
                    ,cusNum: cusNum
                    ,cusNcontentum: content

                }
            });
        }
    }; 
});