
layui.use('laydate', function () {
    var laydate = layui.laydate;
    //����ʱ�䷶Χ
    laydate.render({
        elem: '#test10'
      , 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 dataParty= $("#test10").val(); 
            LoadData(dataParty);
        } 
    };
    //����
    $("#oneDay").click(function () { 
        var dataParty = formatDate(now) + ' - ' + formatDate(now);
        $(".dayParty").val(dataParty);
        LoadData(dataParty);
    });
    //���һ��
    $("#oneWeek").click(function () {
        var dataParty = getWeekStartDate() + ' - ' + formatDate(now);
        $(".dayParty").val(dataParty);
        LoadData(dataParty);
    });
    //����
    $("#oneMonth").click(function () {
        var dataParty = getMonthStartDate() + ' - ' + formatDate(now);
        $(".dayParty").val(dataParty); 
        LoadData(dataParty);
    });
    //������
    $("#onePrient").click(function () {
        var dataParty = getQuarterStartDate() + ' - ' + formatDate(now);
        $(".dayParty").val(dataParty); 
        LoadData(dataParty);
    });
    //����
    $("#oneYear").click(function () {
        var dataParty = getYearStartDate() + ' - ' + formatDate(now);
        $(".dayParty").val(dataParty); 
        LoadData(dataParty);
    });
    
    //��������
    function LoadData(dateParty) {
        var callnumber = $('#callnumber');
        var usercode = $('#usercode');
        //ִ������
        table.reload('recordtable', {
            page: {
                curr: 1 //���´ӵ� 1 ҳ��ʼ
            }
            , where: {
                NowDateTime: new Date(),
                callnumber: callnumber.val(),
                usercode: usercode.val(),
                callType: $('#callTypes').val(),
                callStatus: $('#callRercordStatus').val(),
                dateParty: $("#test10").val(),
                sort: $("#TalkLongTime").val(),
                ringtimes: $("#ringtimes").val(),
                F_HOUSING:$("#callTypeStatus").val().toString()
            }
        });
    }
    //�س�ִ��
    document.onkeydown = function (event) {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode == 13) {
            
            var callnumber = $('#callnumber');
            var usercode = $('#usercode');
            //ִ������
            table.reload('recordtable', {
                page: {
                    curr: 1 //���´ӵ� 1 ҳ��ʼ
                }
              , where: {
                  NowDateTime: new Date(),
                  callnumber: callnumber.val(),
                  usercode: usercode.val(),
                  callType: $('#callTypes').val(),
                  callStatus: $('#callRercordStatus').val(),
                  dateParty: $("#test10").val(),
                  sort: $("#TalkLongTime").val(),
                  ringtimes: $("#ringtimes").val(),
                  F_HOUSING:$("#callTypeStatus").val().toString()

              }
            });
        }
    };



    $('.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;
    }

    playMp3= function (d) {
      //  return  " <audio controls=\"controls\"><source src=\"/content/test.mp3\" type=\"audio/mpeg\"> </audio>";
        return " <audio src=\"/content/test.mp3\" controls></audio>";
        
    }

     
                            
                           
                       

});