<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绑卡记录</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="icon" th:href="@{image/sgl.png}" sizes="32x32">
    <script th:src="@{/layui/layui.js}"></script>
    <script th:src="@{/layui/jquery-3.4.1.min.js}"></script>
    <script th:src="@{/js/common.js}"></script>
    <script th:src="@{/js/rules.js}"></script>
    <link rel="stylesheet" th:href="@{/css/common.css}">
</head>
<style>
.btn:hover{color: #555;}
.layui-table-view {margin: 0;}
.layui-tab-card{box-shadow:none;border-radius: 0px;}
.layui-tab{margin:0;}
.layui-tab-content{padding:0;}
.layui-form-radio{margin:0;}
.tdBackground-color{background-color:#ff0000;}
</style>

<body class="layui-layout-body">

	<div class="toolbar">           	
    	<div class="layui-inline">
			<span>日期：</span>
            <input type="text" id="start_date" placeholder="开始日期" autocomplete="off" class="layui-input formWidth" />&nbsp--
            <input type="text" id="end_date" placeholder="结束日期" autocomplete="off" class="layui-input formWidth" />
        </div>
        <div class="layui-inline">
			<span>状态：</span>
            <select id="status" class="layui-select">
				<option value="">-请选择-</option>
				<option value="0">邦卡</option>
				<option value="1">解绑</option>
			</select>
        </div>
        <div class="layui-inline">
			<button class="layui-btn layui-btn-sm" data-type="search" id="search"><i class="layui-icon">&#xe615;</i>查询</button>
		</div>
		<!--<div class="layui-inline">
			<button class="layui-btn layui-btn-sm layui-btn-normal" data-type="add" id="add"><i class="layui-icon">&#xe654;</i>添加</button>
   		</div>-->
    </div>
    	
	<table id="demo" lay-filter="test"></table>	
	   
	<!-- 表格操作栏 --> 		
	<script type="text/html" id="barDemo">
  		<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
		<a class="layui-btn layui-btn-xs" lay-event="delete">删除</a>
	</script>
		
</body>   
</html>
<script th:inline="javascript">


</script>
<script>
	var element ,
	    table,
	    laydate,
	    layer,
	    form,
	    tree;
	var tHeight = $(".toolbar").height()+6;
    layui.use(['element','table','laydate','layer','form','tree'], function(){
		element = layui.element;
	    table = layui.table;
	    laydate = layui.laydate;
	    layer = layui.layer;
	    form = layui.form;
	    tree = layui.tree;
	    
	    //表格加载
		table.render({
			elem: '#demo',
			height: 'full-'+tHeight,
			url: '/patient/findBindCardLogList', //数据接口
			title: '用户表',
			page: true ,//开启分页
			limit:20,
			limits:[20,30,50],
			//toolbar: '', //开启工具栏，此处显示默认图标，可以自定义模板
			defaultToolbar: [],	 
			id:'test', 
			cols: [
			 [ //表头
			   {type: 'numbers', title: '序号', width: 30},
			   {field: 'NICK', title: '微信昵称', sort: false},
			   {field: 'MOBILE', title: '微信手机号', sort: false, totalRow: true},
			   {field: 'TRUE_NAME', title: '患者姓名', sort: false},
			   {field: 'MEDICAL_CARD', title: '患者卡号', sort: false},
			   {field: 'ID_CARD', title: '患者身份证', sort: false},
			   {field: 'STATUS', title: '状态', sort: false,templet:function(d){
			   		if(d.STATUS == '0'){
			   			return '绑卡';
			   		}else{
			   			return '解绑';
			   		}
			   }},
			   {field: 'CREATE_TIME', title: '操作时间', sort: false},
			 ]
			]
		});
	
		//时间控件
		laydate.render({
	  		elem:'#start_date', //指定元素
	  		eventElem: '.date-input-icon',
	  		trigger: 'click',
		});
		
		//时间控件
		laydate.render({
	  		elem:'#end_date', //指定元素
	  		eventElem: '.date-input-icon',
	  		trigger: 'click',
		});
		
		//查询
		$("#search").on('click',function(){
			findBindCardLogList();
		});
		
        $(".downpanel").on("click", ".layui-select-title", function (e) {
            $(".layui-form-select").not($(this).parents(".layui-form-select")).removeClass("layui-form-selected");
            $(this).parents(".downpanel").toggleClass("layui-form-selected");
            layui.stope(e);
        }).on("click", "dl i", function (e) {
            layui.stope(e);
        });
        $(document).on("click", function (e) {
            $(".layui-form-select").removeClass("layui-form-selected");
        });
    });
    
    
  	function findBindCardLogList(){
		var start_date = $("#start_date").val();
		var end_date = $("#end_date").val();
		var status = $("#status").val();
		table.reload('test', {
			method: 'get',
			url:'/patient/findBindCardLogList',
			where: {
				'start_date':start_date,
				'end_date':end_date,
				'status':status
			},
			page: {
				curr: 1
			}
		});
	}
    </script>