<%@ 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="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"  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="zc_id" class="input-text" />
                            </td>
                            <td class="search-label" >
                                资产名称：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入资产名称" type="text" name="zc_name" class="input-text" />
                            </td>
                        </tr>
                         <!--<tr class="">
                           <td class="search-label" >
                                资产分类：
                            </td>
                            <td class="search-input" id="zc_fl">
                                <script>
                                    $.post("../zd/zd_view_list.jsp?name_id=zc_fl&zd_e_name=zc_fl&math="+Math.random(),function(data){
                                            document.getElementById("zc_fl").innerHTML=data;
                                        }
                                    );
                                </script>
                            </td>
                            <td class="search-label" >
                                使用部门：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入使用部门" type="text" name="ly_dept" class="input-text" />
                            </td>
                            <td class="search-label" >
                                使用人：
                            </td>
                            <td class="search-input" >
                                <input placeholder="输入使用人" type="text" name="ly_user" class="input-text" />
                            </td>
                        </tr>-->
                        <tr class="">
							<td class="search-label" >
								使用人：
							</td>
							<td class="search-input" >
								<input placeholder="输入使用人" type="text" name="ly_user" class="input-text" />
							</td>
							<td class="search-label" >
								使用部门：
							</td>
							<td class="search-input" >
								<input placeholder="输入使用部门" type="text" name="ly_dept" class="input-text" />
							</td>
                            <!--<td class="search-label" >
                                资产国际大类：
                            </td>
                            <td class="search-input" id="zc_gj_type">
                                <script>
                                    $.post("../zd/zd_view_list.jsp?name_id=zc_gj_type&zd_e_name=gjdl&math="+Math.random(),function(data){
                                            document.getElementById("zc_gj_type").innerHTML=data;
                                        }
                                    );
                                </script>
                            </td>
                            <td class="search-label" >
                                价值类型：
                            </td>
                            <td class="search-input" id="jz_type">
                                <script>
                                    $.post("../zd/zd_view_list.jsp?name_id=jz_type&zd_e_name=jz_type&math="+Math.random(),function(data){
                                            document.getElementById("jz_type").innerHTML=data;
                                        }
                                    );
                                </script>
                            </td>-->
                            <td class="search-label" >
                                资产状态：
                            </td>
                            <td class="search-input">
                                <select class="input-text" name="zc_status" >
                                    <option value="">全部</option>
                                    <option value="0">闲置</option>
                                    <option value="1">已提交</option>
                                    <option value="2">审核中</option>
                                    <option value="3">已领用</option>
                                    <option value="5">维修</option>
                                    <option value="6">报废</option>
                                </select>
                            </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="cw_b_time" style="width:90px;">
                                &nbsp;至&nbsp;
                                <input type="text"  class="input-text Wdate"  autocomplete="off"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="cw_e_time" style="width:90px;">
                            </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="ly_b_time" style="width:90px;">
                                &nbsp;至&nbsp;
                                <input type="text"  class="input-text Wdate"  autocomplete="off"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                                       name="ly_e_time" style="width:90px;">
                            </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" style="height:55%;">

        </div>
        <div id="export_type"  style="display:none;border:1px solid #ddd;position: absolute;z-index: 9999;background-color: #fff;width:500px;height:250px;top:200px;left:400px;">
            <div style="text-align: center;width:50px;cursor: pointer;height:30px;float:right;" onclick="guanbi();">关闭</div>
            <div onclick="operList('1');" style="text-align: center;width:300px;margin:0 auto;border:1px solid #e1e1e1;margin-top: 30px;cursor: pointer;">导出卡片信息</div>
            <div onclick="operTxm('2');" style="text-align: center;width:300px;margin:0 auto;border:1px solid #e1e1e1;margin-top: 30px;cursor: pointer;">导出条形码</div>
            <div onclick="operList('3');" style="text-align: center;width:300px;margin:0 auto;border:1px solid #e1e1e1;margin-top: 30px;cursor: pointer;">导出信息列表</div>
        </div>
    </div>
</div>
<div id="export_txm" style="width:0px;height:0px;overflow: hidden;"></div>
<script type="text/javascript" src="./js/jquery.resizableColumns.js"></script>
<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 openDiv() {
        $("#export_type").css("display","");
    }
    function guanbi() {
        $("#export_type").css("display","none");
    }
    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,
            maxmin: true
        });
        layer.full(abc);
    }
    function openZcInfo(ly_id,zc_id) {
        var url="./list_info-t.jsp?ly_id="+ly_id+"&zc_id="+zc_id;
        var abc = layer.open({
            title:"详情",
            type: 2,
            content: url,
            area: ['100%', '100%'],
            maxmin: true
        });
    }
    function updateById(id){
        var abc = layer.open({
            title:"编辑",
            type: 2,
            content: "./list_add-t.jsp?update_id="+id,
            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 () {
                        });
                    }
                }
            });
         })
    }
	dayin_iframe=function(index,layero){
		var iframeWin=layero.find('iframe')[0];
		iframeWin.contentWindow.dayin();
	}
    function operTxm(type) {
		$("#export_txm").html("");
		guanbi();
        var check_len=$('input[name="zc_ids"]:checked').length;
        if(check_len>1){
            layer.msg('请选择一条数据', {
                icon: 5,
                time: 3000
            })
            return false;
        }
		var url="./exportTxm.jsp?zc_ids="+$('input[name="zc_ids"]:checked').val();
        var abc = layer.open({
            title:"生成条形码",
            type: 2,
            content: url,
            area: ['50%', '80%'],
			btn:["打印","关闭"],
			yes:dayin_iframe,
            maxmin: true
        });
		 //document.getElementById("form1").action="exportTxm.jsp";
		//document.form1.submit();
       /** $.ajax({
            type: "POST",
            url: "./exportTxm.jsp",
            data: $('#form1').serialize(),
            success: function (msg) {
                $("#export_txm").html(msg);
                $('#word_export').click();
            }
        });*/
    }
    function operList(type) {
        var isChecked=false;
        var us = document.getElementsByName("zc_ids");
        if(type=='1'){
            document.getElementById("form1").action="exportCard.jsp";
            var check_len=$('input[name="zc_ids"]:checked').length;
            if(check_len>1){
                layer.msg('请选择一条数据', {
                    icon: 5,
                    time: 3000
                })
                return false;
            }
        }
        if(type=='2'){
            document.getElementById("form1").action="exportTxm.jsp";
            var check_len=$('input[name="zc_ids"]:checked').length;
            if(check_len>1){
                layer.msg('请选择一条数据', {
                    icon: 5,
                    time: 3000
                })
                return false;
            }
        }
        if(type=='3'){
            document.getElementById("form1").action="exportList.jsp";
        }
        for(var i=0;i<us.length;i++){
            if(us[i].checked){
                isChecked = true;
            }
        }
        if(!isChecked){
            layer.alert("请勾选号码",{icon:5,title:"提示"});
            return false;
        }
        document.form1.submit();
    }
</script>