<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>自定义查询iframe页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv=X-UA-Compatible IE=EmulateIE7>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${path}/static/js/html5shiv.min.js"></script>
    <script type="text/javascript" src="${path}/static/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="${path}/static/js/respond.min.js"></script>
    <![endif]-->
    <script>
        var path = "${path}";
        var array = new Array();
        var nameArray = new Array();
        <c:forEach items="${relateds}" var="related">
        array.push("${related.id}");
        </c:forEach>
        <c:forEach items="${relateds}" var="related">
        nameArray.push("${related.name}");
        </c:forEach>
    </script>
    <style type="text/css">
        .collapse{
            overflow-y:auto;
        }
        .divClass{
            padding-top:0.5%;
        }
        .labelDiv{
            width:20%;
            margin-left: 5%;
            float:left;
            text-align: right;
        }
        .blockDiv{
            background-color: #fff
        }
        .hrDiv{
            padding-top:5px;
        }
        hr{
            margin-bottom: 0!important;
        }
        .bottomDiv{
            background-color: #fff;
        }
        .control-label{
            text-align: right;
            padding-top:1%;
        }
        .whereDiv{
            float:left;
            width:8%;
            height: 27px;
            padding-left: 1%;
        }
        .inputDiv{
            width:23%;
            float:left;
            padding-left: 1%;
            height:27px;
        }
        .whereDiv select{
            width:100%;
            height:100%;
        }
        .select1{
            width:100%;
        }
        .select2{
            width:100%;
            height:100%;
        }
        .select21{
            float:left;
            width:48%;
            height:100%;
        }
        .select22{
            float:left;
            width:49%;
            padding-left:2%;
            height:100%;
        }
        .btns{
            margin-left:26.5%!important;
        }
        .btn{
            margin-left:-2%;
        }
        .TableView{
            margin-left:2%;
        }
        /*模态框头*/
        .modal-header{
            background-color: #199ED8;
            text-align: center;
        }
        /*tableDiv*/
        .tableDiv{
            /*margin-top: 1%;*/
            width:100%;
            height: auto;
            min-height: 400px;
            background-color: #fff;
            padding-top: 1px;
            overflow: auto;
        }
        .fixed-table-body{
            overflow: scroll;
            height: 100%;
        }
        .fixed-table-container{
            height: 100%;
        }
        /**表格鼠标悬停样式*/
        .table-hover > tbody > tr:hover > td,
        .table-hover > tbody > tr:hover > th {
            cursor: pointer;
        }
        .checkBoxClass{
            cursor: pointer;
        }
    </style>
</head>
<body style="background-color:#c1d7e3;">
<div class="panel-group" id="accordion" style="margin-bottom: 10px">
    <div class="panel">
        <div class="panel-heading" style="padding:0px 14px!important;">
            <h5>
                <div style="float: left; width: 10%">
                    <a data-toggle="collapse" href="#b">
                        可收缩
                    </a>
                </div>
                <div style="margin-left: 80%; width: 10%">
                    <a data-toggle="collapse" href="#c" onclick="checkCancel(array, nameArray)">
                        所选取消
                    </a>
                </div>
            </h5>
        </div>
        <div id="b" class="panel-collapse collapse in">
            <div class="panel-body" >
                <div class="row checkDiv">
                    <c:forEach items="${relateds}" var="related" varStatus="i">
                        <input type="hidden" id="${related.name.replace('.','')}" value="${related.columnType}">
                        <div class="col-sm-3"><input type='checkbox' id="${related.id}" class="check" value="${related.name}"/><span><label for="${related.id}" class="checkBoxClass" style="text-align: right">${related.columnName}</label></span></div>
                    </c:forEach>
                </div>
            </div>
        </div>
        <div id="c" class="panel-collapse collapse in"></div>
    </div>
</div>
<div class="bottomDiv">
    <div class="blockDiv" id="blockDiv" style="display: none">
        <form id="block">

        </form>
    </div>
    <div class="hrDiv">
        <hr>
    </div>
    <input type="hidden" id="sql">
    <!--登录者Id-->
    <input type="hidden" id="userId" value="${CURRENT_USER.userName}">
    <input type="hidden" id="roleId" value="${CURRENT_USER.roleId}">
    <input type="hidden" id="userName" value="${CURRENT_USER.userName}">
    <input type="hidden" id="showRecord" value="${CURRENT_USER.userTel}">
    <input type="hidden" id="downloadRecord" value="${CURRENT_USER.userEmail}">
    <input type="hidden" id="showPrint" value="${CURRENT_USER.userAge}">
    <input type="hidden" id="flag" value="file_path">
    <input type="hidden" id="powerMenus" value="${power_menus}">
    <input type="hidden" id="approves">
    <!--该用户下载申请的审批过了且未过期的病案，不可重复申请，可查看的病案主键patientId-->
    <input type="hidden" id="loads">
    <input type="hidden" id="locks">
    <input type="hidden" id="patientIds">
    <input type="hidden" id="tableThNames">
    <input type="hidden" id="fields" value="${fields}">
    <input type="hidden" id="fieldCns" value="${fieldCns}">
    <input id="englishFields" hidden>
    <input id="fromTableSql" hidden>
    <input id="whereSql" hidden>
    <input type="hidden" id="orderBys" value=" order by commomtable.name">
    <!--查询总行数-->
    <input type="hidden" id="rows">
    <div class="row btns"  style="clear:both;text-align: right">
        <div class="btn">
            <button type="button" class="btn btn-sm btn-primary" onclick="search()">开始搜索</button>
        </div>
        <div class="btn">
            <button type="button" class="btn btn-sm  btn-default" onclick="clearForm()">&nbsp;&nbsp;清&nbsp;&nbsp;空&nbsp;&nbsp;</button>
        </div>
        <shiro:hasPermission name="/commom/exportExcel">
            <div class="btn">
                <button type="button" class="btn btn-sm btn-success" onclick="exportExcel()">导出excel</button>
            </div>
        </shiro:hasPermission>
        <shiro:hasPermission name="/commom/downloadZip">
            <div class="btn" id="downBorrowingBox">
                <button type="button" class="btn btn-sm  btn-warning" onclick="downloadZip('loads')">下载(批量)</button>
            </div>
        </shiro:hasPermission>
        <shiro:hasPermission name="/commom/addApplyApprove">
            <div class="btn" id="borrowingsBox">
                <button type="button" class="btn btn-sm btn-primary" id="borrowings" onclick="borrowings()">批量借阅申请</button>
            </div>
        </shiro:hasPermission>
        <shiro:hasPermission name="/commom/downloadZip">
            <div class="btn" id="downBorrowingsBox">
                <button type="button" class="btn btn-sm btn-success" id="downBorrowings" onclick="downBorrowings()">批量下载申请</button>
            </div>
        </shiro:hasPermission>
        <shiro:hasPermission name="/commom/addLockByPatientId">
            <div class="btn">
                <button type="button" class="btn btn-sm btn-danger" onclick="blocks()">批量锁定</button>
            </div>
        </shiro:hasPermission>
        <shiro:hasPermission name="/commom/updateLockByPatientId">
            <div class="btn">
                <button type="button" class="btn btn-sm btn-success" onclick="unlocks()">批量解锁</button>
            </div>
        </shiro:hasPermission>
    </div>
    <!--数据表格-->
    <div id="tableDiv" class="table-responsive tableDiv table-hover" style="height:470px">
        <table id="mytab" class="table text-nowrap table-bordered"></table>
    </div>
    <!-- 模态框1（Modal） 借阅申请-->
    <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <font size="30">&times;</font>
                    </button>
                    <h4 class="modal-title" style="font-weight: bold">
                        申请信息
                    </h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <input type="hidden" name="formToken" id="formToken" value="${formToken}">
                        <input type="hidden" id="checks">
                        <input type="hidden" id="check">
                        <input type="hidden" id="approveId">
                        <!--隐藏申请过的集合input Id-->
                        <input type="hidden" id="typeId">
                        <div class="row">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">有效时间：</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control input" id="effeTime" name="effeTime" maxlength="10" autocomplete="off">
                                </div>
                                <div class="col-sm-1"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">申请天数：</label>
                                <div class="col-sm-7">
                                    <input type="number" class="form-control input" id="effeDays" name="effeDays">
                                </div>
                                <div class="col-sm-1"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">申请类型：</label>
                                <div class="col-sm-7">
                                    <select class="form-control input" name="applyType" id="applyType">
                                        <c:forEach items="${applyTypes}" var="applyType">
                                            <option value="${applyType.code}">${applyType.name}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="col-sm-1"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <label class="col-sm-4 control-label">申请理由：</label>
                                <div class="col-sm-7">
                                    <textarea class="form-control input" id="applyReason" name="applyReason"></textarea>
                                </div>
                                <div class="col-sm-1"></div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" onclick="save()">
                        暂时保存
                    </button>
                    <button type="button" class="btn btn-primary" onclick="add()">
                        确认提交
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $(".modal-dialog").draggable();//为模态对话框添加拖拽
    })
</script>
<script type="text/javascript" src="${path}/static/js/recordManage/templateSearch/searchCommomMethodqf.js?time=2021-11-28"></script>
<script type="text/javascript" src="${path}/static/js/recordManage/templateSearch/customSearchIframeqf.js?time=2021-11-28"></script>
<script type="text/javascript" src="${path}/static/js/dateUtil.js"></script>
<script type="text/javascript" src="${path}/static/js/approveManage/approveList/approveDateCommmomMethod.js"></script>
</body>
</body>
</html>

