footer.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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"></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. footerStyle: footerStyle,
  27. columns: [{
  28. checkbox: true
  29. },
  30. {
  31. field : 'userId',
  32. title : '用户ID'
  33. },
  34. {
  35. field : 'userCode',
  36. title : '用户编号'
  37. },
  38. {
  39. field : 'userName',
  40. title : '用户姓名'
  41. },
  42. {
  43. field : 'userPhone',
  44. title : '用户手机'
  45. },
  46. {
  47. field : 'userEmail',
  48. title : '用户邮箱'
  49. },
  50. {
  51. field : 'userBalance',
  52. title : '用户余额',
  53. footerFormatter:function (value) {
  54. var sumBalance = 0;
  55. for (var i in value) {
  56. sumBalance += parseFloat(value[i].userBalance);
  57. }
  58. return "总金额:" + sumBalance;
  59. }
  60. },
  61. {
  62. field: 'status',
  63. title: '用户状态',
  64. formatter: function(value, row, index) {
  65. return $.table.selectDictLabel(datas, value);
  66. }
  67. },
  68. {
  69. title: '操作',
  70. align: 'center',
  71. formatter: function(value, row, index) {
  72. var actions = [];
  73. actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
  74. actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
  75. return actions.join('');
  76. }
  77. }]
  78. };
  79. $.table.init(options);
  80. });
  81. function footerStyle(column) {
  82. return {
  83. // userBalance: {
  84. // classes: 'class'
  85. // },
  86. userBalance: {
  87. css: { color: 'red', 'font-weight': 'normal' }
  88. }
  89. }[column.field]
  90. }
  91. </script>
  92. </body>
  93. </html>