showRoom.jsp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <title>会议室信息显示</title>
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <!-- 引入bootstrap -->
  10. <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
  11. <!-- 引入JQuery bootstrap.js-->
  12. <script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
  13. <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
  14. <%--<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">--%>
  15. </head>
  16. <body>
  17. <!-- 顶栏 -->
  18. <jsp:include page="top.jsp"></jsp:include>
  19. <!-- 中间主体 -->
  20. <div class="container" id="content">
  21. <div class="row">
  22. <jsp:include page="menu.jsp"></jsp:include>
  23. <div class="col-md-10">
  24. <div class="panel panel-default">
  25. <div class="panel-heading">
  26. <div class="row">
  27. <h1 class="col-md-5">会议室信息管理</h1>
  28. <form class="bs-example bs-example-form col-md-5" role="form" style="margin: 20px 0 10px 0;" action="${pageContext.request.contextPath}/admin/queryRoom" id="form1" method="post">
  29. <div class="input-group">
  30. <input type="text" class="form-control" placeholder="请输入会议室" name="findByName">
  31. <span class="input-group-addon btn" onclick="document.getElementById('form1').submit" id="sub">搜索</span>
  32. </div>
  33. </form>
  34. <button class="btn btn-default col-md-2" style="margin-top: 20px" onClick="location.href='${pageContext.request.contextPath}/admin/addRoom'">
  35. 添加会议室信息
  36. <sapn class="glyphicon glyphicon-plus"/>
  37. </button>
  38. </div>
  39. </div>
  40. <table class="table table-bordered">
  41. <thead>
  42. <tr>
  43. <th>会议室编号</th>
  44. <th>会议室名称</th>
  45. <th>详细信息</th>
  46. <th>操作</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. <c:forEach items="${roomList}" var="item">
  51. <tr>
  52. <td>${item.id}</td>
  53. <td>${item.name}</td>
  54. <td>${item.message}</td>
  55. <td>
  56. <button class="btn btn-default btn-xs btn-info" onClick="location.href='${pageContext.request.contextPath}/admin/editRoom?id=${item.id}'">修改</button>
  57. <button class="btn btn-default btn-xs btn-danger btn-primary" onclick="removeRoom(${item.id})">删除</button>
  58. <%--<button class="btn btn-default btn-xs btn-danger btn-primary" onClick="location.href='${pageContext.request.contextPath}/admin/removeRoom?id=${item.id}'">删除</button>--%>
  59. <!--弹出框-->
  60. </td>
  61. </tr>
  62. </c:forEach>
  63. </tbody>
  64. </table>
  65. <div class="panel-footer">
  66. <c:if test="${pagingVO != null}">
  67. <nav style="text-align: center">
  68. <ul class="pagination">
  69. <li><a href="${pageContext.request.contextPath}/admin/showRoom?page=${pagingVO.upPageNo}">&laquo;上一页</a></li>
  70. <li class="active"><a href="">${pagingVO.curentPageNo}</a></li>
  71. <c:if test="${pagingVO.curentPageNo+1 <= pagingVO.totalCount}">
  72. <li><a href="${pageContext.request.contextPath}/admin/showRoom?page=${pagingVO.curentPageNo+1}">${pagingVO.curentPageNo+1}</a></li>
  73. </c:if>
  74. <c:if test="${pagingVO.curentPageNo+2 <= pagingVO.totalCount}">
  75. <li><a href="${pageContext.request.contextPath}/admin/showRoom?page=${pagingVO.curentPageNo+2}">${pagingVO.curentPageNo+2}</a></li>
  76. </c:if>
  77. <c:if test="${pagingVO.curentPageNo+3 <= pagingVO.totalCount}">
  78. <li><a href="${pageContext.request.contextPath}/admin/showRoom?page=${pagingVO.curentPageNo+3}">${pagingVO.curentPageNo+3}</a></li>
  79. </c:if>
  80. <c:if test="${pagingVO.curentPageNo+4 <= pagingVO.totalCount}">
  81. <li><a href="${pageContext.request.contextPath}/admin/showRoom?page=${pagingVO.curentPageNo+4}">${pagingVO.curentPageNo+4}</a></li>
  82. </c:if>
  83. <li><a href="${pageContext.request.contextPath}/admin/showRoom?page=${pagingVO.totalCount}">最后一页&raquo;</a></li>
  84. </ul>
  85. </nav>
  86. </c:if>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="container" id="footer">
  93. <div class="row">
  94. <div class="col-md-12"></div>
  95. </div>
  96. </div>
  97. </body>
  98. <script type="text/javascript">
  99. <%--设置菜单中选中背景色改变,nth-child(1)中参数1表示第1个导航栏,参数不可重复--%>
  100. $("#nav li:nth-child(1)").addClass("active")
  101. <c:if test="${pagingVO != null}">
  102. if (${pagingVO.curentPageNo} == ${pagingVO.totalCount}) {
  103. $(".pagination li:last-child").addClass("disabled")
  104. };
  105. if (${pagingVO.curentPageNo} == ${1}) {
  106. $(".pagination li:nth-child(1)").addClass("disabled")
  107. };
  108. </c:if>
  109. function removeRoom(id) {
  110. if(confirm('确认要删除该会议室吗?')) {
  111. $.post("${pageContext.request.contextPath}/admin/removeRoom",{"id":id},function(data){
  112. alert("会议室删除更新成功!");
  113. window.location.reload();
  114. });
  115. }
  116. }
  117. $("#sub").click(function () {
  118. $("#form1").submit();
  119. });
  120. </script>
  121. </html>