{extend name="public:base" /}
{block name="body"}
<style type="text/css">
    .layui-table-page{
        text-align: right;
    }
</style>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form">
                        <div class="layui-input-inline" style="width:150px;">
                            <select name="search_type" id="search_type"   >
                                <option value="1" selected="selected" {if $search_type eq 1 } selected {/if}>抄表单号</option>
                                <option value="2"  {if $search_type eq 2 } selected {/if}>站名</option>
                                <option value="3" {if $search_type eq 3 } selected {/if}>电表识别号</option>

                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="search_text"
                                   style="width:150px;" placeholder="搜索内容" autocomplete="off" id="search_text" class="layui-input" value="{$search_text}">
                        </div>

                        <div class="layui-input-inline" style="width:150px;">
                            <select name="cp_date" id="cp_date">
                                <option value="1">抄表日期</option>
                                <!--<option value="2">缴费日期</option>-->
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="date_start" id="date_start" placeholder="开始日期" autocomplete="off" class="layui-input"  style="width:150px;" value="{$date_start}">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="date_end" style="width:150px;" id="date_end" placeholder="结束日期" autocomplete="off" class="layui-input" value="{$date_end}">
                        </div>

                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="search">
                                <i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>

                <div class="layui-card-body ">

                    <table class="layui-table" lay-data="{  url:'/useage', page:true,  id:'idTest',where:{search_type:document.getElementById('search_type').value,search_text:document.getElementById('search_text').value,date_start:document.getElementById('date_start').value,date_end:document.getElementById('date_end').value,cp_date:document.getElementById('cp_date').value} }">
                        <thead>
                        <tr>
                            <th lay-data="{templet: '#useage_id',sort: true} ">抄表单号</th>
                            <th lay-data="{field:'station_name'}">所属基站名</th>
                            <th lay-data="{field:'em_numb'} ">所属电表号</th>
                            <th lay-data="{field:'current_date',sort: true}">抄表日期</th>
                            <th lay-data="{templet: '#photo_id',sort: true}">抄表凭证</th>
                            <th lay-data="{fixed: 'right',  align:'center', toolbar: '#barDemo'}">操作</th>
                        </tr>
                        </thead>
                    </table>

                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script type="text/html" id="useage_id">
    <a  class="layui-link"  title="查看" href="/useage/{{d.useage_id}}">{{d.useage_id}}</a>
</script>
<script type="text/html" id="photo_id">
    {{# if(d.photo_id >0){ }}
    已上传
    {{# }else { }}
    未上传
    {{# } }}
</script>
<script type="text/html" id="barDemo">
    {{# if(d.status == 1){ }}
    <a title="删除" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-disabled" href="/useage/del/{{d.id}}">删除</a>
    {{# } }}
</script>
<script>
    layui.use(['laydate','form','table'], function(){
        var laydate = layui.laydate,
            form    = layui.form,
            table = layui.table
        laydate.render({
            elem:'#date_end',
            trigger:'click',

        })

        laydate.render({
            elem:'#date_start',
            trigger:'click',
        })
    });
    function del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                url: '/copy_del',
                method: "POST",
                data: {id:id},
                dataType: "json",
                success: function (data) {
                    if(data.status == 1){
                        layer.msg(data.message,{icon:1,time:1000});
                        location.reload()
                    } else {
                        layer.alert(data.message, {
                            icon: 5
                        });
                    }
                }
            });
        });
    }
</script>
{/block}



