cmBaikeHotSearchList.jsp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  3. <html>
  4. <head>
  5. <title>热搜词管理</title>
  6. <meta name="decorator" content="default"/>
  7. <style type="text/css">
  8. .table th{text-align: center;}
  9. .table td{text-align: center;}
  10. </style>
  11. <script type="text/javascript">
  12. $(document).ready(function() {
  13. });
  14. function page(n,s){
  15. $("#pageNo").val(n);
  16. $("#pageSize").val(s);
  17. $("#searchForm").submit();
  18. return false;
  19. }
  20. </script>
  21. </head>
  22. <body>
  23. <ul class="nav nav-tabs">
  24. <li class="active"><a href="${ctx}/baike/cmBaikeHotSearch/">热搜词列表</a></li>
  25. <li><a href="${ctx}/baike/cmBaikeHotSearch/form">热搜词添加</a></li>
  26. </ul>
  27. <form:form id="searchForm" modelAttribute="cmBaikeHotSearch" action="${ctx}/baike/cmBaikeHotSearch/" method="post" class="breadcrumb form-search">
  28. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  29. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  30. <div class="ul-form">
  31. <label>ID:</label>
  32. <form:input path="id" htmlEscape="false" maxlength="8" class="input-medium digits"/>
  33. <label>热搜词:</label>
  34. <form:input path="keyWord" htmlEscape="false" maxlength="15" class="input-medium"/>
  35. <label>状态:</label>
  36. <form:select path="status" class="input-medium">
  37. <form:option value="" label="全部"/>
  38. <form:option value="1" label="启用"/>
  39. <form:option value="0" label="停用"/>
  40. </form:select>
  41. &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
  42. &nbsp;&nbsp;<input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序" />
  43. <div class="clearfix"></div>
  44. </div>
  45. </form:form>
  46. <sys:message content="${message}"/>
  47. <table id="contentTable" class="table table-striped table-bordered table-condensed">
  48. <thead>
  49. <tr>
  50. <th>ID</th>
  51. <th>热搜词</th>
  52. <th>排序</th>
  53. <th>状态</th>
  54. <th>添加时间</th>
  55. <th>添加人</th>
  56. <th>操作</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. <c:forEach items="${page.list}" var="cmBaikeHotSearch">
  61. <tr>
  62. <input class="check-item" type="hidden" id="saveSort${cmBaikeHotSearch.id}" value='${cmBaikeHotSearch.id}-${cmBaikeHotSearch.sort}'/>
  63. <td>
  64. ${cmBaikeHotSearch.id}
  65. </td>
  66. <td>
  67. ${cmBaikeHotSearch.keyWord}
  68. </td>
  69. <td>
  70. <input id="sort" name="sort" style="width:50px;" value="${cmBaikeHotSearch.sort}" onkeyup="onlynum(this)" onchange="changeSort(${cmBaikeHotSearch.id},this)">
  71. </td>
  72. <td>
  73. <c:if test="${cmBaikeHotSearch.status eq 1 }">
  74. <font color="green">已启用</font>
  75. <a href="javascript:void(0);" onclick="updateStatus(0,${cmBaikeHotSearch.id});" >
  76. 停用
  77. </a>
  78. </c:if>
  79. <c:if test="${cmBaikeHotSearch.status ne 1 }">
  80. <font color="red">已停用</font>
  81. <a href="javascript:void(0)" onclick="updateStatus(1,${cmBaikeHotSearch.id});">
  82. 启用
  83. </a>
  84. </c:if>
  85. </td>
  86. <td>
  87. <fmt:formatDate value="${cmBaikeHotSearch.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
  88. </td>
  89. <td>
  90. ${cmBaikeHotSearch.addUserName}
  91. </td>
  92. <td>
  93. <a href="${ctx}/baike/cmBaikeHotSearch/form?id=${cmBaikeHotSearch.id}">编辑</a>
  94. <a href="${ctx}/baike/cmBaikeHotSearch/delete?id=${cmBaikeHotSearch.id}" onclick="return confirmx('确认要删除该热搜词吗?', this.href)">删除</a>
  95. </td>
  96. </tr>
  97. </c:forEach>
  98. </tbody>
  99. </table>
  100. <div class="pagination">${page}</div>
  101. <script>
  102. function updateStatus(status, hotSearchId) {
  103. var msg='确定启用该热搜词吗?';
  104. if(0==status) {
  105. msg = '确定停用该热搜词吗?';
  106. }
  107. top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
  108. if(v=='ok'){
  109. $.post("${ctx}/baike/cmBaikeHotSearch/updateStatus",{'status':status,'hotSearchId':hotSearchId}, function(data) {
  110. if(true==data.success){
  111. $.jBox.tip(data.msg, 'info');
  112. } else {
  113. $.jBox.tip(data.msg,'error');
  114. }
  115. setTimeout(function () {
  116. $("#searchForm").submit();
  117. },1000)
  118. },"JSON");//这里返回的类型有:json,html,xml,text
  119. }
  120. return;
  121. },{buttonsFocus:1,persistent: true});
  122. }
  123. //批量保存排序
  124. function batchSaveSort() {
  125. var items = new Array();
  126. var $items = $('.check-item');
  127. $items.each(function(){
  128. items.push($(this).val());
  129. });
  130. //保存批量排序
  131. $.post("${ctx}/baike/cmBaikeHotSearch/batchSaveSort?sortList="+items, function(data) {
  132. if(true==data.success){
  133. $.jBox.tip(data.msg, 'info');
  134. setTimeout(function () {
  135. $("#searchForm").submit();
  136. },200)
  137. } else {
  138. $.jBox.tip(data.msg,'error');
  139. }
  140. },"JSON");//这里返回的类型有:json,html,xml,text
  141. }
  142. //修改排序值
  143. function changeSort(id,sortThis) {
  144. var value = sortThis.value;
  145. $("#saveSort"+id).val(id+"-"+value);
  146. }
  147. </script>
  148. </body>
  149. </html>