<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jspf/common.jspf" %>
<%@ include file="/WEB-INF/jspf/confirmJsp.jspf" %>
<html>
<head>
    <title>科室管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link rel="stylesheet" href="${path}/static/css/comm.css">
    <link rel="stylesheet" href="${path}/static/zTree_v3-master/css/zTreeStyle/zTreeStyle.css">
    <style type="text/css">
        /*页头*/
        .panel-heading{
            padding: 0 16px;

        }
        hr{
            margin:0;
        }
        .form-group{
            margin-left:15px;
        }
        /*模态框表单*/
        .formDiv{
            width:100%;
            height:30px;
            margin-top:10px;
        }
        .control-label{
            width:30%;
            text-align: right;
            padding-top:2px;
        }
        .input{
            width:50%;
            float:left;
        }
        /*按钮组*/
        .btns{
            text-align: right;
            margin-bottom: 5px;
        }
        /*模态框*/
        .modal-header{
            text-align: center;
        }
        .modal-title{
            font-weight: bold;
        }
        .modelBtns{
            text-align: center;
        }
        .modelBtn{
            width: 74px;
            margin-left: 38px;
            margin-bottom: 16px;
        }
        .operBtns{
            margin-left:10px;
        }
        .tableDiv{
            margin-left:14px;
        }
        .shortInput{
            width:80px;
        }
        .warningLabel{
            margin-left:102px;
        }
        .warningDiv{
            margin-left: 134px;
            margin-top: -20px;
        }
    </style>
</head>
<body>
<div style="width: 100%">
    <input type="hidden" id="roleId" value="${user.roleId}">
    <input type="hidden" id="checks">
    <input type="hidden" id="userNames">
    <div class="row">
        <div class="col-md-12">
            <div class="panel-heading"><h4>基本管理/科室管理</h4></div>
            <hr>
            <form class="form-inline" style="margin-top: 5px;" role="form">
                <div class="">
                    <div class="form-group">
                        <label for="dept_name">科室名</label>
                        <input type="text" class="form-control input-sm" id="dept_name" maxlength="16"/>
                    </div>
                    <c:if test="${user.roleId == 0}">
                        <div class="form-group">
                            <label for="dict_id">所属医院</label>
                            <div class=" form-group form-inline">
                                <select class=" form-control input-sm" id="dict_id">
                                    <option value="">全部</option>
                                </select>
                            </div>
                        </div>
                    </c:if>
                    <div class="form-group">
                        <label for="effective">是否有效</label>
                        <div class=" form-group form-inline">
                            <select class="form-control input-sm" id="effective">
                                <option value="">全部</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="creater">创建人</label>
                        <input type="text" class="form-control input-sm" id="creater" maxlength="16"/>
                    </div>
                    <div class="form-group">
                        <button type="button" style="margin-left:20px" id="queryBtn" class="btn btn-info btn-sm">查询</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="btns">
        <pm:myPermissions permissions="/dept/add">
            <button type="button" onclick="add()" class="btn btn-warning btn-sm">增加</button>
        </pm:myPermissions>
        <pm:myPermissions permissions="/dept/importExcel">
            <button type="button" class="btn btn-success btn-sm" onclick="importBtn()">导入Excel</button>
        </pm:myPermissions>
        <pm:myPermissions permissions="/dept/export">
            <button type="button" class="btn btn-primary btn-sm" onclick="exportExcel()">导出Excel</button>
        </pm:myPermissions>
    </div>
    <div class="tableDiv">
        <table id="bootstrapTable" class="table text-nowrap table-bordered"></table>
    </div>
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">角色信息</h4>
            </div>
            <div class="modal-body" style="height:auto">
                <form id="updateaddform">
                    <div class="formDiv">
                        <label class="control-label left">科室名：</label>
                        <input type="hidden" id="re_deptId" name="deptId">
                        <input type="text" class="form-control input input-sm" id="re_deptName" name="deptName" maxlength="15">
                    </div>
                    <div class="formDiv">
                        <label for="re_effective" class="control-label left">有效否：</label>
                        <select class="form-control input input-sm shortInput" id="re_effective" name="effective">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                    </div>
                    <div class="formDiv">
                        <label for="re_effective" class="control-label left">所属医院：</label>
                        <select class="form-control input input-sm" id="re_dictId" name="dictId"></select>
                    </div>
                    <div class="formDiv">
                        <label for="re_remark" class="control-label left">备注：</label>
                        <textarea id="re_remark" class="form-control input input-sm" name="remark" maxlength="50"></textarea>
                    </div>

                </form>
            </div>
            <div class="modelBtns">
                <button type="button" class="btn btn-primary btn-sm modelBtn" id="btn_submit">提交</button>
                <button type="button" class="btn btn-default btn-sm modelBtn" onclick="clearForm()">清空</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- 模态框（Modal1） 导入-->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel1">导入信息</h4>
            </div>
            <div class="modal-body" style="height:240px">
                <form  method="POST" enctype="multipart/form-data"
                       id="form1">
                    <div class="formDiv">
                        <label class="control-label left">下载模板：</label>
                        <input class="btn btn-primary btn-sm" onclick="window.open('${path }/static/template/科室列表导入模板.xls');" type="button" value="下载模板">
                    </div>
                    <div class="formDiv">
                        <label for="re_effective" class="control-label left">选择文件：</label>
                        <input id="upfile" type="file" name="upfile" calss="layui-btn">
                    </div>
                    <div class="modelBtns">
                        <input class="btn btn-primary btn-sm" type="button" value="批量导入Excel数据"
                               onclick="importExcel('/dept/importExcel','科室')">
                    </div>
                    <div class="formDiv">
                        <label class="warningLabel">友情提醒:</label>
                        <div class="warningDiv">
                            <span style="color: red"></br>1、科室名不能为空,不能重复,内容最多16个字。</span></br>
                            <span style="color: red">2、是否有效不能为空,内容最多9个字。</span></br>
                            <span style="color: red">3、备注可为空,内容最多50个字。</span></br>
                            <span style="color: red">4、值包含逗号必须单元格设置为文本类型。</span></br>
                        </div>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<script>
    $(function () {
        $(".modal-dialog").draggable();//为模态对话框添加拖拽
    })
</script>
<script src="${path}/static/zTree_v3-master/js/jquery.ztree.core.js"></script>
<script src="${path}/static/zTree_v3-master/js/jquery.ztree.excheck.js"></script>
<script src="${path}/static/js/dept.js"></script>
<%@ include file="/WEB-INF/jspf/importExcelJsp.jspf" %>
</body>
</html>