addInfoForm.jsp 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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 td i {
  9. margin: 0 2px;
  10. }
  11. </style>
  12. <script type="text/javascript">
  13. $(document).ready(function () {
  14. //弹出框去滚动条
  15. top.$('#jbox-content').css("overflow-y", "hidden");
  16. show_title(30);
  17. // 反选
  18. $('body').on('click', 'input[name="info"]', function () {
  19. var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
  20. allInputCheckedLength = $('input[name="info"]:checked').length,
  21. checkAllEle = $('.check-all');
  22. // 判断选中长度和总长度,如果相等就是全选否则取消全选
  23. if (allInputLength === allInputCheckedLength) {
  24. checkAllEle.attr('checked', true);
  25. } else {
  26. checkAllEle.attr('checked', false);
  27. }
  28. })
  29. });
  30. function page(n, s) {
  31. $("#pageNo").val(n);
  32. $("#pageSize").val(s);
  33. $("#searchForm").submit();
  34. return false;
  35. }
  36. function getCheckedItems() {
  37. var items = new Array();
  38. var $items = $('.check-item:checked');
  39. $items.each(function () {
  40. //通过拿到的商品ID组合键获取其它值
  41. var productId = $(this).val();
  42. items.push(productId);
  43. });
  44. return items;
  45. }
  46. function allCkbfun(ckb) {
  47. var isChecked = ckb.checked;
  48. $(".check-item").attr('checked', isChecked);
  49. }
  50. /**
  51. * @param obj
  52. * jquery控制input只能输入数字
  53. */
  54. function onlynum(obj) {
  55. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  56. }
  57. /**
  58. * @param obj
  59. * jquery控制input只能输入数字和两位小数(金额)
  60. */
  61. function num(obj) {
  62. obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
  63. obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
  64. obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
  65. obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  66. obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
  67. }
  68. var ontypeId = null;
  69. var typeId = null;
  70. function ischangeType() {
  71. if (null != typeId) {
  72. $("#typeListId option[value=" + typeId + "]").val(ontypeId);
  73. }
  74. $("#optionType").find("option").eq(0).prop("selected", true)
  75. optionTypeParent()
  76. }
  77. function optionTypeParent() {
  78. $("#optionType [parent]").each(function (item) {
  79. if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
  80. $(this).show()
  81. } else {
  82. $(this).hide()
  83. }
  84. })
  85. }
  86. function isoptionType() {
  87. if ("" != $("#optionType option:selected").val()) {
  88. ontypeId = $("#optionType option:selected").attr("parent")
  89. typeId = $("#optionType option:selected").val()
  90. $("#typeListId option:selected").val($("#optionType option:selected").val())
  91. }else {
  92. ischangeType()
  93. }
  94. }
  95. $(document).ready(function () {
  96. $("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
  97. optionTypeParent()
  98. isoptionType()
  99. $("input[type='radio'][name='publishSource']").change(function (obj) {
  100. $("#searchForm").submit();
  101. })
  102. })
  103. </script>
  104. </head>
  105. <body>
  106. <form:form id="searchForm" modelAttribute="info" action="${ctx}/info/info/findInfoPage" method="post"
  107. class="breadcrumb form-search">
  108. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  109. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  110. <div class="ul-form">
  111. <br>
  112. <input type="radio" name="publishSource"
  113. value="1" ${empty info.publishSource?'checked=checked':info.publishSource eq 1?'checked=checked':''} >采美文章
  114. <input type="radio" name="publishSource" value="2" ${info.publishSource eq 2?'checked=checked':''}>供应商文章
  115. <br>
  116. <br>
  117. <label>ID:</label>
  118. <form:hidden path="cmRelatedType"/>
  119. <form:input path="id" htmlEscape="false" maxlength="11" class="input-mini"/>
  120. <label>标题:</label>
  121. <form:input path="title" htmlEscape="false" maxlength="100" class="input-medium"/>
  122. <label>发布人:</label>
  123. <form:input path="publisher" htmlEscape="false" maxlength="50" class="input-medium"/>
  124. <label>发布时间:</label>
  125. <form:input path="startPubDate" type="text" maxlength="10" class="input-medium Wdate"
  126. value="${startPubDate}"
  127. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  128. <form:input path="endPubDate" type="text" maxlength="10" class="input-medium Wdate"
  129. value="${startPubDate}"
  130. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  131. <br> <br>
  132. <label>文章分类:</label>
  133. <form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
  134. <form:option value="" label=" "/>
  135. <c:forEach items="${typeList}" var="type" varStatus="index">
  136. <c:if test="${type.parentId eq 0}">
  137. <form:option value="${type.id}" label="${type.name}"/>
  138. </c:if>
  139. </c:forEach>
  140. </form:select>
  141. <form:select id="optionType" path="typeId" class="input-small" onchange="isoptionType()">
  142. <form:option value="" label=" "/>
  143. <c:forEach items="${typeList}" var="type" varStatus="index">
  144. <c:if test="${type.parentId ne 0}">
  145. <form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
  146. cssStyle="display: none"/>
  147. </c:if>
  148. </c:forEach>
  149. </form:select>
  150. &nbsp;&nbsp<input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
  151. <div class="clearfix"></div>
  152. </div>
  153. </form:form>
  154. <sys:message content="${message}"/>
  155. <table class="table table-striped table-bordered table-condensed table-hover">
  156. <tr>
  157. <th style="width:20px;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></th>
  158. <th>文章ID</th>
  159. <th>文章分类</th>
  160. <th>引导图</th>
  161. <th>发布人</th>
  162. <th>文章标题</th>
  163. <th>发布时间</th>
  164. </tr>
  165. <tbody>
  166. <c:if test="${not empty page.list}">
  167. <c:forEach items="${page.list}" var="item">
  168. <tr id="${item.id}" class="itemtr">
  169. <th>
  170. <input class="check-item" type="checkbox" name="info" value='${item.id}'/>
  171. </th>
  172. <td>${item.id}</td>
  173. <td>${item.infoType.name}</td>
  174. <td><img src="${item.guidanceImage}" width="50px" height="50px"></td>
  175. <td>${item.publisher}</td>
  176. <td>${item.title}</td>
  177. <td><fmt:formatDate value="${item.pubdate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
  178. </tr>
  179. </c:forEach>
  180. </c:if>
  181. </tbody>
  182. </table>
  183. <c:if test="${empty page.list}">
  184. <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
  185. </c:if>
  186. <div class="pagination">${page}</div>
  187. </body>
  188. </html>