<title>统计列表</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>统计管理</cite></a>
        <a><cite>统计列表</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-card">
        <div id="layui-search" class="layui-form layui-form layui-card-header layuiadmin-card-header-auto"
             style="display: none">
            <div class="layui-form-item">
                <div id="layui-search-fields" class="layui-search-fields" style="display: inline-block">
                </div>
                <div id="layui-search-button" class="layui-inline">
                    <button class="layui-btn layuiadmin-btn" lay-submit lay-filter="LAY-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <div style="padding-bottom: 10px;" id="layui-top-button">
            </div>
            <table id="LAY-curd-table" lay-filter="LAY-curd-table"></table>
            <script type="text/html" id="table-curd-list">
            </script>
        </div>
    </div>
</div>
<script>
    var config;
    layui.admin.req({
        url: '/manage/system/stat/domains.json',
        method: 'get',
        success: function (res) {
            config = {
                api: {
                    list: '/manage/system/stat/index.json',
                },
                search: {
                    datetime: {type: 'range', text: '时间', date: true, config: {type: 'date', format: 'yyyy-MM-dd',}},
                    domain: {type: 'select', text: '域名', data: res.data, search: true},
                },
                actionButton: {
                    detail: {
                        text: '访问详情',
                        icon: 'layui-icon layui-icon-list',
                        action: function (obj) {
                            href = layui.router().href + 'detail/type=visit/datetime=' + obj.data.datetime;
                            location.hash = typeof layui.router().search.domain !== 'undefined' ? href + '/domain=' + layui.router().search.domain : href;
                        }
                    },
                    spiderDetail: {
                        text: '蜘蛛详情',
                        icon: 'layui-icon layui-icon-list',
                        action: function (obj) {
                            href = layui.router().href + 'detail/type=spider/datetime=' + obj.data.datetime;
                            location.hash = typeof layui.router().search.domain !== 'undefined' ? href + '/domain=' + layui.router().search.domain : href;
                        }
                    },
                },
                table: {
                    page: true,
                    limit: 30,
                    cols: [[
                        {field: 'datetime', title: '日期', width: 120},
                        {field: 'pv', title: 'PV', align: 'center'},
                        {field: 'uv', title: 'UV', align: 'center'},
                        {field: 'iv', title: 'IV', align: 'center'},
                        {field: 'spider', title: '蜘蛛', align: 'center'},
                        {title: '操作', width: 220, align: 'center', fixed: 'right', toolbar: '#table-curd-list'}
                    ]]
                }
            };
            layui.use('curd/list', layui.factory('curd/list'));
        }
    });
</script>