<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>健康检查报告</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="" id="searchFrm">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">设备号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sl_t.deviceid" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">设备类型</label>
                            <div class="layui-input-inline">
                                <select name="n_d.devicetype" id="n_d.devicetype" lay-search="">
                                    <option value="-1">全部</option>
                                    <option value="0">监测站</option>
                                    <option value="1">基准站</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline" >
                            <label class="layui-form-label">TopN排序</label>
                            <div class="layui-input-inline">
                                <select name="_sorttype" id="_sorttype" lay-search="">
                                    <option th:each="item : ${sort_items}" th:text="${item}" th:value="${item}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">范围</label>
                            <div class="layui-input-inline">
                                <input type="text" name="dgt_t.createtime" autocomplete="off" id="ID-laydate-start-date" class="layui-input" placeholder="开始日期" th:value="${begin_time}">
                            </div>
                            <div class="layui-input-inline">
                                <input type="text" name="dlt_t.createtime" autocomplete="off" id="ID-laydate-end-date" class="layui-input" placeholder="结束日期">
                            </div>
                        </div>
						<div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                            <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-export-btn"><i class="layui-icon">&#xe67d;</i>导出</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
    </div>
</div>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script th:inline="javascript">
    layui.use(['form', 'table', 'laydate'], function () {
        var $ = layui.$;
        var form = layui.form,
            table = layui.table,
            laydate = layui.laydate;

        var cfg_cols = [
            {field: 'deviceid', title: '设备号', width: 100},
            {field: 'devicetype', title: '类型', width: 80,templet: "<div>{{d.devicetype==0?'监测站':'基准站'}}</div>"},
            {field: 'model', title: '型号', width: 80,templet: "<div>{{d.model==0?'G505':'G510'}}</div>"},
            {field: 'createtime', title: '创建时间', templet: "<div>{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
            {field: 'offlinestatdays', title: '离线统计周期(天)'},
            {field: 'calcstathours', title: '数据分析周期(小时)'},
            {field: 'offlinecount', title: '离线次数'},
            {field: 'offlineminutes', title: '离线分钟数'},
            {field: 'invalidresultminutes', title: '连续无效解分钟数'},
            {field: 'stdeve', title: '东标准差'},
            {field: 'stdevn', title: '北标准差'},
            {field: 'stdevu', title: '天标准差'},
            {field: 'fixrate', title: '固定率%'},
            {field: 'validrate', title: '有效率%'},
            {field: 'jumpcount', title: '周跳次数'}
        ];
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        laydate.render({
            elem: '#ID-laydate-start-date',
            type: 'datetime'
        });
        laydate.render({
            elem: '#ID-laydate-end-date',
            type: 'datetime'
        });

        table.render({
            elem: '#currentTableId',
            url: '/gnss/ehm/list',
            toolbar: '#toolbarDemo',//开启头部工具栏
            defaultToolbar: ['filter'],
            cols: [
                cfg_cols
            ],
            limits: [50, 100, 200, 300],
            limit: 50,
            page: true,
            skin: 'line'
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });

        // 监听导出操作
        form.on('submit(data-export-btn)', function (data) {
            var result =  $('#searchFrm').serialize();
            var u = "/gnss/ehm/export?" + result;
            window.open(u, "_blank");
            return false;
        });
    });
</script>

</body>
</html>