<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/pagination.css">
<div class="page-container">

    <div class="content" >
        <div class="search-form">
            <form  method="post" id="data_form_search" name="data_form_search">
                <input type="hidden" name="page_number" id="page_number" value="1"/>
                <input type="hidden" name="dept_id" id="dept_id" value=""/>
                <input type="hidden" name="page_size" id="page_size" value="10"/>
                <div class="text-l">
                    <table class="search-table ">
                        <tr class="">
                            <td class="search-label" >
                                所属项目：
                            </td>
                            <td id="xm_id">
                                <script>
                                    $.post("../zd/zd_view_list.jsp?name_id=xm_id&zd_e_name=xm_id&math="+Math.random(),function(data){
                                            document.getElementById("xm_id").innerHTML=data;
                                        }
                                    );
                                </script>
                            </td>
                            <td class="search-label" >
                                领用编号：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入领用编号" type="text" name="ly_id" class="input-text" />
                            </td>
                            <td class="search-label" >
                                领用单位：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入领用单位" type="text" name="ly_dept" class="input-text" />
                            </td>
                        </tr>
                        <tr>
                            <td class="search-label" >
                                领用人：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入领用人" type="text" name="ly_user" class="input-text" style="width: 160px;"/>
                            </td>
                            <td class="search-label">
                                领用状态：
                            </td>
                            <td class="search-input">
                                <select class="input-text" name="ly_status" >
                                    <option value="">请选择</option>
                                    <option value="0">未提交</option>
                                    <option value="1">已提交</option>
                                    <option value="2">审批中</option>
                                    <option value="3">已完结</option>
                                    <option value="4">审核未通过</option>
                                </select>
                            </td>
                            <td class="search-label" style="width: 120px;">
                                领用时间：
                            </td>
                            <td class="search-input" style="width: 270px;">
                                <input type="text"  class="input-text Wdate"  autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="b_time" style="width:120px;">
                                &nbsp;至&nbsp;
                                <input type="text"  class="input-text Wdate"  autocomplete="off"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="e_time" style="width:120px;">
                            </td>
                            <td colspan="2">
                                <a class="btn btn-primary radius" id="searchA" onclick="searchUserModel();" style="margin-left:19%;">
                                    查询
                                </a>
                                <a class="btn btn-info radius" onclick="chongzhi();" style="margin-left:5px;">
                                    重置
                                </a>
                            </td>
                            <%--<td class="search-label">
                                价值：
                            </td>
                            <td class="search-input" style="width: 270px;">
                                <input type="text"  class="input-text "  name="b_jiazhi" style="width:120px;">
                                &nbsp;~&nbsp;
                                <input type="text"  class="input-text "  name="e_jiazhi" style="width:120px;">
                            </td>--%>
                        </tr>
                        <%--<tr>
                            <td class="search-label" style="width: 120px;">
                                领用时间：
                            </td>
                            <td class="search-input" style="width: 270px;">
                                <input type="text"  class="input-text Wdate"  autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="b_time" style="width:120px;">
                                &nbsp;至&nbsp;
                                <input type="text"  class="input-text Wdate"  autocomplete="off"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="e_time" style="width:120px;">
                            </td>
                            <td colspan="2">
                                <a class="btn btn-primary radius" id="searchA" onclick="searchUserModel();" style="margin-left:19%;">
                                    查询
                                </a>
                                <a class="btn btn-info radius" onclick="chongzhi();" style="margin-left:5px;">
                                    重置
                                </a>
                            </td>
                        </tr>--%>
                    </table>
                </div>
            </form>
        </div>
        <div style="height:10px;background-color: #d9e4f6">

        </div>
        <div class="datalist " id="datalist">

        </div>
    </div>
</div>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript">
    function searchModel() {
        $.ajax({
            type: "post",
            url: "list_ajax.jsp",
            data: $('#data_form_search').serialize(),
            success: function (msg) {
                //data_form_search.reset();
                $("#datalist").html(msg);
            }
        });
    }


    function searchUserModel() {
        $("#page_number").val("1");
        searchModel();
    }
    $(function(){
        searchModel();
    });
    function chongzhi(){
        $("#page_size").val("10");
        data_form_search.reset();
        searchUserModel();
    }
    /*用户-编辑*/
    function addRules(url) {
        var abc = layer.open({
            title: "领用",
            type: 2,
            content: url,
            area: ['100%', '100%'],
            maxmin: true
        });
    }
    function updateById(info_url,id){
        var abc = layer.open({
            title: "编辑",
            type: 2,
            content: info_url,
            area: ['100%', '100%'],
            maxmin: true
        });
    }
    function nahui(ly_id) {
        layer.confirm('确认要拿回吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "./action.jsp",
                data: {"action":"nahui","ly_id":ly_id},
                success: function (msg) {
                    if (msg.indexOf("success") >= 0) {
                        layer.msg('操作成功!', {icon: 1, time: 1000},
                            function () {
                                searchModel();
                            });
                    } else {
                        layer.msg('操作失败', {
                            icon: 5,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                        });
                    }
                }
            });
        })
    }
    function deleteById(ly_id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "./action.jsp",
                data: {"action":"delete","delete_id":"","ly_id":ly_id},
                success: function (msg) {
                    if (msg.indexOf("success") >= 0) {
                        layer.msg('操作成功!', {icon: 1, time: 1000},
                            function () {
                                searchModel();
                            });
                    } else {
                        layer.msg('操作失败', {
                            icon: 5,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                        });
                    }
                }
            });
         })
    }
</script>