<%@ 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 class="search-input" >
                                <input placeholder="输入盘点单号" type="text" name="pd_id" class="input-text" />
                            </td>
                            <td class="search-label">
                                盘点状态：
                            </td>
                            <td class="search-input" id="pd_status">
                                <select class="input-text" name="pd_status" >
                                    <option value="">请选择</option>
                                    <option value="0">盘点中</option>
                                    <option value="1">盘点结束</option>
                                </select>
                            </td>
                            <td class="search-label">
                                盘点人：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入盘点人" type="text" name="pd_user" class="input-text" />
                            </td>
                        </tr>
                        <tr>
                            <td class="search-label" >
                                盘点开始时间：
                            </td>
                            <td class="search-input" >
                                <input type="text"  class="input-text Wdate"  autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="pd_b_time" >
                            </td>
                            <td class="search-label" >
                                盘点结束时间：
                            </td>
                            <td class="search-input" >
                                <input type="text"  class="input-text Wdate"  autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="pd_e_time" >
                            </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(title, url) {
        var abc = layer.open({
            title: title,
            type: 2,
            content: url,
            area: ['100%', '100%'],
            maxmin: true
        });
    }
    function infoView(id,user){
        var abc = layer.open({
            title: "详情",
            type: 2,
            content: "./list_zc_ajax-t.jsp?pd_number="+id+"&pd_user="+user,
            area: ['100%', '100%'],
            maxmin: true
        });
    }
    function deleteById(id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "./action.jsp",
                data: {"action":"delete","delete_id":id},
                success: function (msg) {
                    if (msg.indexOf("success") >= 0) {
                        layer.msg('操作成功!', {icon: 1, time: 1000},
                            function () {
                                searchModel();
                            });
                    } else {
                        layer.msg('操作失败'+msg, {
                            icon: 5,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                        });
                    }
                }
            });
         })
    }
    function pdEnd(id) {
        layer.confirm('确认盘点完成吗？', function (index) {
            $.ajax({
                type: "POST",
                url: "./action.jsp",
                data: {"action":"pd_end","pd_id":id},
                success: function (msg) {
                    if (msg.indexOf("success") >= 0) {
                        layer.msg('操作成功!', {icon: 1, time: 1000},
                            function () {
                                searchModel();
                            });
                    } else {
                        layer.msg('操作失败'+msg, {
                            icon: 5,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                        });
                    }
                }
            });
        })
    }
</script>