detail.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. showSearch: false,
  22. showRefresh: false,
  23. showToggle: false,
  24. showColumns: false,
  25. detailView: true,
  26. detailFormatter: detailFormatter,
  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. },
  54. {
  55. field: 'status',
  56. title: '用户状态',
  57. align: 'center',
  58. formatter: function(value, row, index) {
  59. return $.table.selectDictLabel(datas, value);
  60. }
  61. },
  62. {
  63. title: '操作',
  64. align: 'center',
  65. formatter: function(value, row, index) {
  66. var actions = [];
  67. actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
  68. actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
  69. return actions.join('');
  70. }
  71. }]
  72. };
  73. $.table.init(options);
  74. });
  75. function detailFormatter(index, row) {
  76. var html = [];
  77. $.each(row, function(key, value) {
  78. html.push('<p><b>' + key + ':</b> ' + value + '</p>');
  79. });
  80. return html.join('');
  81. }
  82. </script>
  83. </body>
  84. </html>