multi.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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="form1">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 用户名称:<input type="text" name="userName"/>
  15. </li>
  16. <li>
  17. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('form1', 'bootstrap-table1')"><i class="fa fa-search"></i>&nbsp;搜索</a>
  18. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('form1', 'bootstrap-table1')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  19. </li>
  20. </ul>
  21. </div>
  22. </form>
  23. </div>
  24. <div class="btn-group-sm" id="toolbar1" role="group">
  25. <a class="btn btn-success" onclick="options1()">
  26. <i class="fa fa-search"></i> options
  27. </a>
  28. <a class="btn btn-success" onclick="$.operate.add()">
  29. <i class="fa fa-plus"></i> 新增
  30. </a>
  31. <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
  32. <i class="fa fa-edit"></i> 修改
  33. </a>
  34. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
  35. <i class="fa fa-remove"></i> 删除
  36. </a>
  37. </div>
  38. <div class="col-xs-12 select-table table-striped">
  39. <table id="bootstrap-table1"></table>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="container-div">
  44. <div class="row">
  45. <div class="col-sm-12 search-collapse">
  46. <form id="form2">
  47. <div class="select-list">
  48. <ul>
  49. <li>
  50. 用户名称:<input type="text" name="userName"/>
  51. </li>
  52. <li>
  53. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('form2', 'bootstrap-table2')"><i class="fa fa-search"></i>&nbsp;搜索</a>
  54. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('form2', 'bootstrap-table2')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  55. </li>
  56. </ul>
  57. </div>
  58. </form>
  59. </div>
  60. <div class="btn-group-sm" id="toolbar2" role="group">
  61. <a class="btn btn-success" onclick="options2()">
  62. <i class="fa fa-search"></i> options
  63. </a>
  64. <a class="btn btn-success" onclick="$.operate.add()">
  65. <i class="fa fa-plus"></i> 新增
  66. </a>
  67. <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
  68. <i class="fa fa-edit"></i> 修改
  69. </a>
  70. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
  71. <i class="fa fa-remove"></i> 删除
  72. </a>
  73. </div>
  74. <div class="col-xs-12 select-table table-striped">
  75. <table id="bootstrap-table2"></table>
  76. </div>
  77. </div>
  78. </div>
  79. <div th:include="include :: footer"></div>
  80. <script th:inline="javascript">
  81. var prefix = ctx + "demo/operate";
  82. var datas = [[${@dict.getType('sys_normal_disable')}]];
  83. $(function() {
  84. var options = {
  85. id: "bootstrap-table1",
  86. toolbar: "toolbar1",
  87. url: prefix + "/list",
  88. createUrl: prefix + "/add",
  89. removeUrl: prefix + "/remove",
  90. updateUrl: prefix + "/edit/{id}",
  91. modalName: "用户",
  92. columns: [{
  93. checkbox: true
  94. },
  95. {
  96. field : 'userId',
  97. title : '用户ID'
  98. },
  99. {
  100. field : 'userCode',
  101. title : '用户编号'
  102. },
  103. {
  104. field : 'userName',
  105. title : '用户姓名'
  106. },
  107. {
  108. field : 'userPhone',
  109. title : '用户手机'
  110. },
  111. {
  112. field : 'userEmail',
  113. title : '用户邮箱'
  114. },
  115. {
  116. field : 'userBalance',
  117. title : '用户余额'
  118. },
  119. {
  120. field: 'status',
  121. title: '用户状态',
  122. align: 'center',
  123. formatter: function(value, row, index) {
  124. return $.table.selectDictLabel(datas, value);
  125. }
  126. },
  127. {
  128. title: '操作',
  129. align: 'center',
  130. formatter: function(value, row, index) {
  131. var actions = [];
  132. actions.push('<a class="btn btn-success btn-xs" href="###" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  133. actions.push('<a class="btn btn-danger btn-xs" href="###" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a>');
  134. return actions.join('');
  135. }
  136. }]
  137. };
  138. $.table.init(options);
  139. });
  140. $(function() {
  141. var options = {
  142. id: "bootstrap-table2",
  143. toolbar: "toolbar2",
  144. url: prefix + "/list",
  145. createUrl: prefix + "/add",
  146. removeUrl: prefix + "/remove",
  147. updateUrl: prefix + "/edit/{id}",
  148. modalName: "用户",
  149. columns: [{
  150. checkbox: true
  151. },
  152. {
  153. field : 'userId',
  154. title : '用户ID'
  155. },
  156. {
  157. field : 'userCode',
  158. title : '用户编号'
  159. },
  160. {
  161. field : 'userName',
  162. title : '用户姓名'
  163. },
  164. {
  165. field : 'userPhone',
  166. title : '用户手机'
  167. },
  168. {
  169. field : 'userEmail',
  170. title : '用户邮箱'
  171. },
  172. {
  173. field : 'userBalance',
  174. title : '用户余额'
  175. },
  176. {
  177. field: 'status',
  178. title: '用户状态',
  179. align: 'center',
  180. formatter: function(value, row, index) {
  181. return $.table.selectDictLabel(datas, value);
  182. }
  183. },
  184. {
  185. title: '操作',
  186. align: 'center',
  187. formatter: function(value, row, index) {
  188. var actions = [];
  189. actions.push('<a class="btn btn-success btn-xs" href="###" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  190. actions.push('<a class="btn btn-danger btn-xs" href="###" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a>');
  191. return actions.join('');
  192. }
  193. }]
  194. };
  195. $.table.init(options);
  196. });
  197. function options1() {
  198. var temp = "";
  199. var obj = table.config['bootstrap-table1'];
  200. for (var i in obj) {
  201. temp += i + ":" + obj[i] + "<br/>";
  202. }
  203. $.modal.alert(temp);
  204. }
  205. function options2() {
  206. var temp = "";
  207. var obj = table.config['bootstrap-table2'];
  208. for (var i in obj) {
  209. temp += i + ":" + obj[i] + "<br/>";
  210. }
  211. $.modal.alert(temp);
  212. }
  213. </script>
  214. </body>
  215. </html>