
@{
    Layout = null;
}
@using ReportWeb_MVC.Models;
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>话务员交接记录</title>
    <script src="~/Content/layui/layui.js"></script>
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Content/jquery-1.8.3.js"></script>
    <script src="~/Content/Common.js"></script>
    <script type="text/javascript">

        layui.use(['laydate', 'layer', 'form', 'table'], function () {
            var bodyWidth = $(document.body).width();
            var laydate = layui.laydate;
            var form = layui.form;
            var layer = layui.layer;
            var table = layui.table;
            var util = layui.util;
            //常规用法
            laydate.render({
                elem: '#test1'
            });
            laydate.render({
                elem: '#test2'
            });
            //普通查询
            SelectValue("今天", "txt_StaData", "txt_EndData");
            form.on('select(test)', function (data) {
                SelectValue(data.value, "txt_StaData", "txt_EndData");
                if (data.value == "自定义") {
                    $("input[name='txt_StaData']").css("pointer-events", "auto");
                    $("input[name='txt_StaData']").css("opacity", "1");
                    $("input[name='txt_EndData']").css("pointer-events", "auto");
                    $("input[name='txt_EndData']").css("opacity", "1");
                } else {
                    $("input[name='txt_StaData']").css("pointer-events", "none");
                    $("input[name='txt_StaData']").css("opacity", "0.5");
                    $("input[name='txt_EndData']").css("pointer-events", "none");
                    $("input[name='txt_EndData']").css("opacity", "0.5");
                }
            });
            var tableIns = table.render({
                ID: 'tablet',
                elem: '#LAY-app-content-comm',
                height: 'full-100',
                width: (bodyWidth - 80).toString(),
                cellMinWidth: 60,
                url: '/Home/loadOperatorCallRecord',
                even: true,
                page: {
                    // layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'],
                    curr: 1,
                    groups: 5,
                    limit: 50,
                    limits: [50, 100, 200, 300, 500]
                },
                toolbar: '#toolbarDemo',
                where: {
                    CallMethod: "交接"
                },
                //defaultToolbar: [{
                //    title: '导出' //标题
                //    , layEvent: 'lyexport' //事件名，用于 toolbar 事件中使用
                //    , icon: 'layui-icon-download-circle' //图标类名
                //}, 'print'],

                title: '话务员交接记录',
                loading: true,
                text: { none: '暂无相关数据' },
                //totalRow: true,
                cols: [[
                    { type: 'numbers', fixed: 'left', width: 60, title: '序号', templet: '#indexTpl', align: 'center' },//, totalRowText: '合计'
                    { field: 'ID', title: 'ID', width: 60, sort: true, align: 'center', hide: true },
                    { field: 'ExtensionNum', title: '分机号码', width: 120, align: 'center', fixed: 'left' },
                    { field: 'JobNum', title: '工号', width: 120, align: 'center', fixed: 'left' },
                    { field: 'TrueName', title: '姓名', width: 120, align: 'center', fixed: 'left' },
                    { field: 'CallDate', title: '交接日期', width: 150, align: 'center', templet: function (d) { return formatCSTDate(d.CallDate, "yyyy-MM-dd"); } },
                    { field: 'StartTime', title: '交接时间', width: 150, align: 'center', templet: function (d) { return formatCSTDate(d.CallDate, "hh:mm:ss"); } },
                ]]
            });
            $("#btn_Query").click(function () {
                var type = $("select[name='sel_Data']").val();
                var startData = $("#test1").val();
                var endData = $("#test2").val();
                var content = $("#txt_Content").val();
                tableIns.reload({
                    url: '/Home/loadOperatorCallRecord',
                    where: {
                        Type: type,
                        StartDta: startData,
                        EndData: endData,
                        Content: content,
                        TypeWhere: "1",
                        CallMethod: "交接"
                    },
                    page: {
                        curr: 1
                    }
                });
            });

            table.on('toolbar(table_filter)', function (obj) {
                var event = obj.event;
                if (event == "lyexport") {//导出
                    var index = layer.load(1);
                    $.post("/Home/OperateExport", function (result) {
                        var Rst = result;
                        if (Rst != "-1") {
                            $("input[name='txtPath']").val(Rst);
                            $("#inp_Submit").click();
                            layer.close(index);
                        }
                        else {
                            layer.close(index);
                            layer.alert("没有导出的文件");
                        }
                    });
                }
            });
        });
    </script>
    <style type="text/css">
        .txt_data {
            pointer-events: none;
            opacity: 0.5;
        }

        ._TianChong {
            clear: both;
            height: 5px;
        }

        ._TianChong_top {
            clear: both;
            height: 10px;
        }
    </style>
</head>
<body>
    <div class="_TianChong_top"></div>
    <div id="divMain" class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <form action="/Home/excelDownLoadOperate" method="post" style="display:none;">
                @*@using (Html.BeginForm("RecordingDownLoad", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
                    {*@
                <input type="text" name="txtPath" value="" />
                <input type="submit" id="inp_Submit" />
                @*}*@
            </form>

            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-form-item">
                            <div class="layui-inline" style="margin-top:3px; float:right;">
                                <label class="layui-form-label" style="margin-top:2px;padding-right:5px;padding-left:0px;">操作日期</label>
                                <div class="layui-input-inline" style="width:80px;margin: 0px;margin-right: 5px;">
                                    <select name="sel_Data" lay-filter="test">
                                        <option value="全部">全部</option>
                                        <option value="今天" selected="">今天</option>
                                        <option value="昨天">昨天</option>
                                        <option value="本周">本周</option>
                                        <option value="上周">上周</option>
                                        <option value="本月">本月</option>
                                        <option value="上月">上月</option>
                                        <option value="自定义">自定义</option>
                                    </select>
                                </div>
                                <div class="layui-input-inline" style="width:90px; margin: 0px;margin-right: 5px;">
                                    <input type="text" name="txt_StaData" class="layui-input txt_data" id="test1" placeholder="yyyy-MM-dd">
                                </div>

                                <div class="layui-input-inline" style="width:90px;margin: 0px;margin-right: 5px;">
                                    <input type="text" name="txt_EndData" class="layui-input txt_data" id="test2" placeholder="yyyy-MM-dd">
                                </div>
                                <div class="layui-input-inline" style="width:200px; margin: 0px;margin-right: 5px;">
                                    <input type="text" class="layui-input" placeholder="请输入查询条件" id="txt_Content">
                                </div>
                                <div class="layui-input-inline" style="width:60px; margin: 0px;margin-right: 8px;">
                                    <button class="layui-btn" id="btn_Query" style="margin-bottom:3px;">查询</button>
                                </div>
                            </div>
                        </div>
                        <div class="layui-card-body" style="margin-top:-30px;">
                            <table id="LAY-app-content-comm" lay-filter="table_filter"></table>
                            <script type="text/html" id="table-content-com">
                                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="Approval"><i class="layui-icon layui-icon-edit"></i></a>
                            </script>
                            <div class="layui-inline">
                                <script type="text/html" id="toolbarDemo">
                                    <div class="layui-btn-container">
                                    </div>
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
