<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="${pageContext.request.contextPath }/common/admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <title>生产批次二维码列表</title>
    <style>
        .exp1{font-size:18px;}
    </style>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页 <span class="c-gray en">&gt;</span>
    生产批次列表 <span class="c-gray en">&gt;</span>
    生产批次二维码列表
    <a class="btn btn-success radius r mr-20" style="line-height: 1.6em; margin-top: 3px" href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="pd-20">
    <div class="text-c">
        <form action="${pageContext.request.contextPath }/admin/qrCode/listQrCode" method="post" id="myForm">
            <%-- <input type="text" name="logsBatch" id="logsBatch" value="${logsBatch }" placeholder="批次号" style="width: 150px" class="input-text">
             日期范围：
             <input type="text" readonly="readonly" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')||\'2020-10-01\'}'})" id="beginDate" value="${beginDate }" name="beginDate" class="input-text Wdate" style="width: 120px;">
             - <input type="text" readonly="readonly" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'2020-10-01'})" id="endDate" value="${endDate }" name="endDate" class="input-text Wdate" style="width: 120px;">
             <button name="" id="submitBtn" class="btn btn-success" type="submit">
                 <i class="Hui-iconfont">&#xe665;</i> 搜索
             </button>
             <input type="hidden" id="pageNO" value="${pageNO }">--%>
         </form>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th width="10">批次号</th>
                <th width="100">条形码</th>
                <th width="100">二维码</th>
                <th width="100">购买日期</th>
                <th width="100">状态</th>
                <th width="100">是否打印过</th>
                <th width="50">生成时间</th>
                <th width="150">操作</th>
            </tr>
            </thead>
            <tbody id="listid">
            <c:if test="${ !(empty list)}">
                <c:forEach items="${list}" var="list" varStatus="st">
                    <tr>
                        <td class="text-c" width="10">${list.numberBatch }</td>
                        <td class="text-c" width="100">${list.numberBarcode }</td>
                        <td class="text-c" width="100"><div id="${100000 + st.index}"><img style="width: 50px;height: 50px;" src="${list.numberQrcode }"><br><span >NO:1111111111</span></div></td>
                        <td class="text-c" width="100"><fmt:formatDate value="${list.numberSalesTime }" pattern="yyyy-MM-dd HH:mm" /></td>
                        <td class="text-c" width="100">
                            <c:if test="${list.numberStatus == 1}">
                                启用
                            </c:if>
                            <c:if test="${list.numberStatus == 2}">
                                禁用
                            </c:if>
                        </td>
                        <td class="text-c" width="100">
                            <c:if test="${list.numberIsPrint == 1}">
                                未打印
                            </c:if>
                            <c:if test="${list.numberIsPrint == 2}">
                                已打印
                            </c:if>
                        </td>
                        <td class="text-c" width="100"><fmt:formatDate value="${list.numberCreateTime }" pattern="yyyy-MM-dd HH:mm" /></td>
                        <!-- 遍历操作 -->
                        <td class="td-manage text-c">
                            <a onclick="print(${100000 + st.index},${list.numberId},${list.numberIsPrint})" title="打印" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe652;</i></a>
                            <a onclick="downLoad();" title="下载" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe640;</i></a>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>
            </tbody>
        </table>
    </div>
    <div align="right">
        <%@include file="/common/other/paper/pager.jsp"%>
    </div>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/jquery.PrintArea.js"></script>
<script type="text/javascript">
        function print(id,numberId,status){
            updatePrint(numberId,status);
            /*$("#"+id).css("height", "142px");
            $("#"+id).css("width", "227px");*/
            $("#"+id).find('span').addClass("exp1");
            $("#"+id).find('img').css("width","150px");
            $("#"+id).find('img').css("height","150px");
            $("#"+id).printArea();
            $("#"+id).find('img').css("width","50px");
            $("#"+id).find('img').css("height","50px");
            $("#"+id).find('span').removeClass("exp1");
           /* $("#"+id).css("height", "100%");
            $("#"+id).css("width", "100%");*/
        }

        function updatePrint(numberId,status){
            if(status == 2){
                return false;
            }
            $.ajax({
                "type" : "post",
                "url" : "/tooth/admin/qrCode/updateIsprInt",
                "dataType" : "json",
                "data" :{numberId : numberId},
                "success" : function(data) {
                    if(data.resultCode == 200){

                    }
                },
                "error":function(data){
                    alert("操作失败，请联系管理员！");
                }
            });
        }
        function downLoad() {
            layer.alert("鼠标右键二维码图片，点击另存为到本地即可");
        }
</script>
</body>
</html>