<%@ 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/zTree_v3-master/css/zTreeStyle/zTreeStyle.css">
    <link rel="stylesheet" href="${path}/static/treegrid/jquery.treegrid.min.css">

    <script src="${path}/static/zTree_v3-master/js/jquery.ztree.core.js"></script>
    <script src="${path}/static/zTree_v3-master/js/jquery.ztree.exhide.js"></script>
    <script src="${path}/static/bootstrap-3.3.7/TreeGrid.js"></script>
    <script src="${path}/static/treegrid/bootstrap-table-treegrid.js"></script>
    <script src="${path}/static/treegrid/jquery.treegrid.min.js"></script>
    <style type="text/css">
        /*页头*/
        .panel-heading{
            padding: 0 4px;

        }
        hr{
            margin:0;
        }
        .form-group{
            margin-left:5px;
            padding-top: 3px;
        }
        /*模态框表单*/
        .formDiv{
            width:100%;
            height:30px;
            margin-top:10px;
        }
        .control-label{
            width:30%;
            text-align: right;
            padding-top:2px;
        }
        .input{
            width:50%;
            float:left;
        }
        /*模态框*/
        .modal-header{
            text-align: center;
        }
        .modal-title{
            font-weight: bold;
        }
        .modelBtns{
            margin-top:40px;
            text-align: center;
        }
        .modelBtn{
            width: 74px;
            margin-left: 38px;
            margin-bottom: 16px;
        }
        .shortInput{
            width:80px;
        }
        .sexInput{
            width:70px;
        }
        #modal-content{
            width:740px;
        }
        .treeDiv{
            margin-top: -15px;
        }
        /*模态框头*/
        .modal-header{
            background-color: #199ED8;
            text-align: center;
        }
        /*通知类型模态框*/
        #typeModelLeft{
            width:30%;
        }
        #typeModelRight{
            width:69%;
        }
        /**左侧树搜索框*/
        .searcDiv{
            padding:15px;
        }
        /**右侧表单div*/
        #form1{
            padding-top:80px;
        }
        #addBtn{
            height: 30px;
            padding: 20px 375px;
        }
        /**列表按钮*/
        .operBtns{
            margin-left:10px;
        }
        /*多选下拉框*/
        .dropdown-menu {
            position: absolute;
            top: 103%;
            left: 0;
            z-index: 1000;
            display: none;
            float: left;
            list-style: none;
            text-shadow: none;
            max-height: 400px;
            /*设置最大高度为400 overflow: scroll;*/
            /* 设置可滚动 padding: 5 px;*/
            margin: 0px;
            -webkit-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
            -moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
            box-shadow: 0 1px 8px rgba(120, 234, 61, 0.55);
            font-size: 14px;
            font-family: "Segoe UI", Helvetica, Arial, sans-serif;
            border: 1px solid #ddd;
        }
        /**
       *多选下拉框
       */
        .bootstrap-select:not([class*=col-]):not([class*=form-control]):not(.input-group-btn){
            width: 168px!important;
        }
        .bootstrap-select>.dropdown-toggle.bs-placeholder{
            height: 30px!important;
        }
        .bootstrap-select>.dropdown-toggle.bs-placeholder{
            font-size: 12px!important;
        }
    </style>
</head>
<body>
<div style="width: 100%;height: 100%;overflow: auto;">
    <input type="hidden" id="userName" value="${user.userName}">
    <input type="hidden" id="userId" value="${user.userId}">
    <input type="hidden" id="roleId" value="${user.roleId}">
    <input type="hidden" id="checks">
    <div class="">
        <div class="col-md-12">
            <div class="panel-heading"><h4>通知管理</h4></div>
            <hr>
            <form class="form-inline" style="margin-top: 10px;" role="form">
                <div class="">
                    <div class="form-group">
                        <label>通知类型:</label>
                        <div class=" form-group form-inline" >
                            <select class=" form-control input-sm" id="searchNoticeId" style="width:140px">
                                <option value="">全部</option>
                                <c:forEach items="${dicts}" var="dict">
                                    <c:if test="${dict.noticeTypeName != ''&& dict.noticeTypeName != null}">
                                        <option value="${dict.noticeId}">${dict.noticeTypeName}</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <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>通知人:</label>
                        <input type="text" class="form-control input-sm" id="noticeSend" style="width:100px"/>
                    </div>
                    <div class="form-group">
                        <label>接收人:</label>
                        <input type="text" class="form-control input-sm" id="searcchNoticeReceive" style="width:100px"/>
                    </div>
                    <div class="form-group">
                        <label>通知时间:</label>
                        <input type="text" class="form-control input-sm" id="startTime1" style="width:100px"/>
                        至
                        <input type="text" class="form-control input-sm" id="endTime1" style="width:100px"/>
                    </div>
                    <div class="form-group">
                        <label>所属系统:</label>
                        <div class=" form-group form-inline">
                            <select class=" form-control input-sm" style="width:106px" id="searchNoticeTypeFlag" style="width:100px">
                                <option value="">全部</option>
                                <c:forEach items="${dicts}" var="dict">
                                    <c:if test="${dict.noticeTypeName != ''&& dict.noticeTypeName != null}">
                                        <option value="${dict.noticeTypeFlag}">${dict.remark}</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <button type="button" id="queryBtn" class="btn btn-primary btn-sm" onclick="refreshTable()">查询</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="btns">
       <%-- <pm:myPermissions permissions="/user/resetPassword">--%>
        <c:if test="${user.roleId == 0}">
            <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">通知类别</button>
        </c:if>
        <%--</pm:myPermissions>
        <pm:myPermissions permissions="/user/add">--%>
            <button type="button" onclick="addNotice()" class="btn btn-warning btn-sm" data-toggle="modal" data-target="#myModal1">增加</button>
       <%-- </pm:myPermissions>
        &lt;%&ndash;<button type="button" class="btn btn-success btn-sm" id="btn_import">导入Excel</button>&ndash;%&gt;
        <pm:myPermissions permissions="/user/export">--%>
            <button type="button" class="btn btn-primary btn-sm" style="margin-right:40px" onclick="exportExcel()">导出Excel</button>
       <%-- </pm:myPermissions>--%>
    </div>
    <div class="tableDiv">
        <table id="table" 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">
    <input type="hidden" id="currentTreeId">
    <div class="modal-dialog">
        <div class="modal-content" id="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel" style="font-weight: bold">通知类别信息</h4>
            </div>
            <div class="modal-body" style="height:450px;padding:0">
                <div id="typeModelLeft" class="left">
                    <div class="searcDiv">
                        <input type="text" id="key" value="" class="form-control input-sm"
                               placeholder="类别名称"/><br/>
                    </div>
                    <div class="treeDiv">
                        <ul id="treeDemo" class="ztree"></ul>
                    </div>
                </div>
                <div style="float:left;width: 1px;height:450px; background: gray;"></div>
                <div id="typeModelRight" class="left">
                    <div id="addBtn" style="display: none">
                        <button type="button" class="btn btn-primary btn-sm modelBtn" onclick="addNoticeType()">添加</button>
                    </div>
                    <form id="form1" style="display: none">
                        <div class="formDiv">
                            <input type="hidden" id="noticeId" name="noticeId">
                            <label class="control-label left">类别标志：</label>
                            <input type="text" class="form-control input input-sm" id="noticeTypeFlag" name="noticeTypeFlag">
                        </div>
                        <div class="formDiv">
                            <label  class="control-label left">类别名称：</label>
                            <input type="text" class="form-control input input-sm" id="noticeTypeName" name="noticeTypeName">
                            <input type="hidden" class="form-control input input-sm" value="1" name="effective">
                        </div>
                        <div class="modelBtns">
                            <button type="button" class="btn btn-primary btn-sm modelBtn" id="btn_submit">保存</button>
                            <button type="button" class="btn btn-danger btn-sm modelBtn" onclick="delNoticeType()">删除</button>
                        </div>
                    </form>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- 模态框1（Modal）添加编辑 -->
<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"  style="font-weight: bold">通知信息</h4>
            </div>
            <div class="modal-body" style="height:auto">
                <form id="form2">
                    <div class="formDiv">
                        <label class="control-label left">通知主题：</label>
                        <input type="hidden" name="noticeId" id="noticeId1">
                        <input type="hidden" name="readFlag" id="readFlag">
                        <input type="text" class="form-control input input-sm" id="noticeTitle" name="noticeTitle" maxlength="15">
                    </div>
                    <div class="formDiv">
                        <label  class="control-label left">通知类型：</label>
                        <select class="form-control input input-sm sexInput" id="parentId" name="parentId" style="width:180px">
                            <option value="">请选择</option>
                            <c:forEach items="${dicts}" var="dict">
                                <c:if test="${dict.noticeTypeName != ''&& dict.noticeTypeName != null}">
                                    <option value="${dict.noticeId}">${dict.noticeTypeName}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                    <div class="formDiv" style="height:47px;">
                        <label  class="control-label left">通知内容：</label>
                        <textarea class="form-control input input-sm" id="noticeContent" name="noticeContent" style="resize: none;"></textarea>
                    </div>
                    <div class="formDiv">
                        <label  class="control-label left">接收人：</label>
                        <select class="selectpicker form-control input input-sm" multiple name="noticeReceive" id="noticeReceive" data-live-search="true" data-actions-box="true" title="请选择通知用户">
                        </select>
                    </div>
                    <div class="formDiv">
                        <label  class="control-label left">是否有效：</label>
                        <select class="form-control input input-sm shortInput"  id="effective1" name="effective">
                            <option value="1">有效</option>
                            <option value="0">无效</option>
                        </select>
                    </div>
                    <div class="formDiv">
                        <label  class="control-label left">备注：</label>
                        <textarea class="form-control input input-sm" id="remark" name="remark" style="resize: none;height: 90px"></textarea>
                    </div>
                </form>
            </div>
            <div class="modelBtns">
                <button type="button" class="btn btn-primary btn-sm modelBtn" id="notice_submit">提交</button>
                <button type="button" class="btn btn-default btn-sm modelBtn" onclick="clearForm()">清空</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<script src="${path}/static/js/dateUtil.js"></script>
<script src="${path}/static/js/noticePage.js?t=2020-08-21"></script>
<script src="${path}/static/js/menu/fuzzysearch.js"></script>

</body>
</html>