export.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. <th:block th:include="include :: bootstrap-table-export-js" />
  16. <script th:inline="javascript">
  17. var prefix = ctx + "demo/table";
  18. var datas = [[${@dict.getType('sys_normal_disable')}]];
  19. $(function() {
  20. var options = {
  21. url: prefix + "/list",
  22. showSearch: false,
  23. showRefresh: false,
  24. showToggle: false,
  25. showColumns: false,
  26. showExport: true,
  27. exportDataType: 'selected', // 导出选择数据
  28. exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'], // 导出的文件类型
  29. exportOptions: {
  30. fileName: '用户数据', // 文件名称设置
  31. ignoreColumn: [0, 8] // 忽略第一列和最后一列
  32. },
  33. clickToSelect: true,
  34. columns: [{
  35. checkbox: true
  36. },
  37. {
  38. field : 'userId',
  39. title : '用户ID'
  40. },
  41. {
  42. field : 'userCode',
  43. title : '用户编号'
  44. },
  45. {
  46. field : 'userName',
  47. title : '用户姓名'
  48. },
  49. {
  50. field : 'userPhone',
  51. title : '用户手机'
  52. },
  53. {
  54. field : 'userEmail',
  55. title : '用户邮箱'
  56. },
  57. {
  58. field : 'userBalance',
  59. title : '用户余额'
  60. },
  61. {
  62. field: 'status',
  63. title: '用户状态',
  64. align: 'center',
  65. formatter: function(value, row, index) {
  66. return $.table.selectDictLabel(datas, value);
  67. }
  68. },
  69. {
  70. title: '操作',
  71. align: 'center',
  72. formatter: function(value, row, index) {
  73. var actions = [];
  74. actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
  75. actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
  76. return actions.join('');
  77. }
  78. }]
  79. };
  80. $.table.init(options);
  81. });
  82. </script>
  83. </body>
  84. </html>