footer.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 select-table table-striped">
  10. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  11. </div>
  12. </div>
  13. </div>
  14. <div th:include="include :: footer"></div>
  15. <script th:inline="javascript">
  16. var prefix = ctx + "demo/table";
  17. var datas = [[${@dict.getType('sys_normal_disable')}]];
  18. $(function() {
  19. var options = {
  20. url: prefix + "/list",
  21. showFooter: true,
  22. showSearch: false,
  23. showRefresh: false,
  24. showToggle: false,
  25. showColumns: false,
  26. columns: [{
  27. checkbox: true
  28. },
  29. {
  30. field : 'userId',
  31. title : '用户ID'
  32. },
  33. {
  34. field : 'userCode',
  35. title : '用户编号'
  36. },
  37. {
  38. field : 'userName',
  39. title : '用户姓名'
  40. },
  41. {
  42. field : 'userPhone',
  43. title : '用户手机'
  44. },
  45. {
  46. field : 'userEmail',
  47. title : '用户邮箱'
  48. },
  49. {
  50. field : 'userBalance',
  51. title : '用户余额',
  52. footerFormatter:function (value) {
  53. var sumBalance = 0;
  54. for (var i in value) {
  55. sumBalance += parseFloat(value[i].userBalance);
  56. }
  57. return "总金额:" + sumBalance;
  58. }
  59. },
  60. {
  61. field: 'status',
  62. title: '用户状态',
  63. formatter: function(value, row, index) {
  64. return $.table.selectDictLabel(datas, value);
  65. }
  66. },
  67. {
  68. title: '操作',
  69. align: 'center',
  70. formatter: function(value, row, index) {
  71. var actions = [];
  72. actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
  73. actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
  74. return actions.join('');
  75. }
  76. }]
  77. };
  78. $.table.init(options);
  79. });
  80. </script>
  81. </body>
  82. </html>