<!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" th:if="${tenant_id==0}">
							<label class="layui-form-label">推送组</label>
							<div class="layui-input-inline">
								<select name="sl_fwd_group_id" id="fwd_group_id" lay-search="">
									<option value="">全部</option>
									<option th:each="item : ${gnss_group_fwd_list}" th:text="${item.name}" th:value="${item.name}"></option>
								</select>
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">创建时间</label>
							<div class="layui-input-inline">
								<input type="text" name="dgt_createtime" autocomplete="off" id="ID-laydate-start-date1" class="layui-input" placeholder="开始日期">
							</div>
							<div class="layui-input-inline">
								<input type="text" name="dlt_createtime" autocomplete="off" id="ID-laydate-end-date1" class="layui-input" placeholder="结束日期">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">数据时间</label>
							<div class="layui-input-inline">
								<input type="text" name="dgt_begintime" autocomplete="off" id="ID-laydate-start-date2" class="layui-input" placeholder="开始日期">
							</div>
							<div class="layui-input-inline">
								<input type="text" name="dgt_begintime" autocomplete="off" id="ID-laydate-end-date2" 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>
						</div>
					</div>
				</form>
			</div>
		</fieldset>

		<table class="layui-hide" id="forwardParaTableId" lay-filter="forwardParaTableFilter"></table>
	</div>

</div>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script th:inline="none">
    layui.use(['form', 'table'], function () {
        var $ = layui.$,
				form = layui.form,
				table = layui.table,
				laydate = layui.laydate;
		laydate.render({
			elem: '#ID-laydate-start-date1',
			type: 'datetime'
		});
		laydate.render({
			elem: '#ID-laydate-end-date1',
			type: 'datetime'
		});
		laydate.render({
			elem: '#ID-laydate-start-date2',
			type: 'datetime'
		});
		laydate.render({
			elem: '#ID-laydate-end-date2',
			type: 'datetime'
		});
		/**
		 **   推送参数组
		 **/
		table.render({
		    elem: '#forwardParaTableId',
		    url: '/fwd/resend_records',
		    toolbar: '#toolbarTable',
			defaultToolbar: ['filter'],
			cols: [[
				{field: 'project_id', title: '项目号', sort: true},
				{field: 'deviceid', title: '设备号'},
				{field: 'createtime', title: '推送时间', templet: "<div>{{layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
				{field: 'starttime', title: '数据开始时间', templet: "<div>{{layui.util.toDateString(d.starttime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
				{field: 'endtime', title: '数据结束时间', templet: "<div>{{layui.util.toDateString(d.endtime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
				{field: 'fwd_group_id', title: '推送组'},
				{field: 'state', title: '状态',templet: '#stateTrans'}
			]],
		    limit: 10,
		    page: true,
		    skin: 'line'
		});

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

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

			return false;
		});

    });

</script>

<script type="text/html" id="stateTrans">
	{{#  if(d.state == 0){ }}
	<span class="layui-badge layui-bg-green">推送成功</span>
	{{# } else if(d.state == 1){ }}
	<span class="layui-badge layui-bg-red">推送失败</span>
	{{# } else { }}
	<span class="layui-badge layui-bg-orange">断点补传</span>
	{{#  } }}
</script>

</body>
</html>