topic.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('话题管理')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 search-collapse">
  10. <form id="role-form">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 标题:<input type="text" name="title" placeholder="请输入标题"/>
  15. </li>
  16. <li>
  17. 状态:<select name="status" th:with="type=${@dict.getType('enable_status')}">
  18. <option value="">所有</option>
  19. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  20. </select>
  21. </li>
  22. <li>
  23. 操作人:<input type="text" name="adminName" placeholder="请输入操作人"/>
  24. </li>
  25. <li>
  26. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  27. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  28. </li>
  29. </ul>
  30. </div>
  31. </form>
  32. </div>
  33. <div class="btn-group-sm" id="toolbar" role="group">
  34. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="dynamic:circle:topic:add">
  35. <i class="fa fa-plus"></i> 新增
  36. </a>
  37. </div>
  38. <div class="col-sm-12 select-table table-striped" style="overflow:scroll;">
  39. <table id="bootstrap-table" data-mobile-responsive="false" style="min-width:1500px;"></table>
  40. </div>
  41. </div>
  42. </div>
  43. <th:block th:include="include :: footer" />
  44. <script th:inline="javascript">
  45. var editFlag = [[${@permission.hasPermi('dynamic:circle:topic:edit')}]];
  46. var settingFlag = [[${@permission.hasPermi('dynamic:circle:topic:setting')}]];
  47. var pkStatus = [[${@dict.getType('pk_status')}]];
  48. var enableStatus = [[${@dict.getType('enable_status')}]];
  49. var prefix = ctx + "dynamic/circle/topic";
  50. $(function() {
  51. var options = {
  52. url: prefix + "/list",
  53. createUrl: prefix + "/add",
  54. updateUrl: prefix + "/edit/{id}",
  55. modalName: "话题管理",
  56. height: $(window).height()-120,
  57. columns: [
  58. {
  59. field: 'id',
  60. align: 'center',
  61. title: 'ID'
  62. },
  63. {
  64. field: 'title',
  65. title: '话题标题'
  66. },
  67. {
  68. field: 'pic',
  69. title: '话题配图',
  70. align : 'center',
  71. formatter:function (value,row,index) {
  72. return "<img src='" + value + "' width='70' height='60'>";
  73. }
  74. },
  75. {
  76. field: 'pk',
  77. title: '开启PK',
  78. align : 'center',
  79. formatter: function(value, row, index) {
  80. return $.table.selectDictLabel(pkStatus, value);
  81. }
  82. },
  83. {
  84. field: 'redOption',
  85. title: '红方选项'
  86. },
  87. {
  88. field: 'blueOption',
  89. title: '蓝方选项'
  90. },
  91. {
  92. field: 'redTicket',
  93. title: '红方票数'
  94. },
  95. {
  96. field: 'blueTicket',
  97. title: '蓝方票数'
  98. },
  99. {
  100. field: 'sort',
  101. title: '排序'
  102. },
  103. {
  104. field: 'activation',
  105. title: '状态',
  106. align : 'center',
  107. formatter: function(value, row, index) {
  108. return $.table.selectDictLabel(enableStatus, value);
  109. }
  110. },
  111. {
  112. field: 'examine',
  113. title: '默认访问数'
  114. },
  115. {
  116. field: 'examineNum',
  117. title: '访问叠加数'
  118. },
  119. {
  120. field: 'createTime',
  121. title: '开始时间'
  122. },
  123. {
  124. field: 'adminName',
  125. title: '操作人',
  126. align : 'center'
  127. },
  128. {
  129. title: '操作',
  130. align: 'center',
  131. formatter: function(value, row, index) {
  132. var actions = [];
  133. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
  134. if(row.activation == 1){
  135. actions.push('<a class="btn btn-danger btn-xs ' + settingFlag + '" href="javascript:void(0)" onclick="setting(\'' + row.id + '\',\'' + row.activation + '\')"><i class="fa fa-toggle-off"></i> 不激活</a>');
  136. }else{
  137. actions.push('<a class="btn btn-danger btn-xs ' + settingFlag + '" href="javascript:void(0)" onclick="setting(\'' + row.id + '\',\'' + row.activation + '\')"><i class="fa fa-toggle-on"></i> 激活</a>');
  138. }
  139. return actions.join('');
  140. }
  141. }]
  142. };
  143. $.table.init(options);
  144. });
  145. function setting(id,activation) {
  146. if(activation == 1){
  147. $.modal.confirm("确认要设置不激活该记录吗?", function() {
  148. $.operate.post(prefix + "/setting?id=" +id);
  149. });
  150. }else{
  151. $.modal.confirm("确认要设置激活该记录吗?", function() {
  152. $.operate.post(prefix + "/setting?id=" +id);
  153. });
  154. }
  155. }
  156. </script>
  157. </body>
  158. </html>