importTable.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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="gen-form">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 表名称:<input type="text" name="tableName"/>
  15. </li>
  16. <li>
  17. 表描述:<input type="text" name="tableComment"/>
  18. </li>
  19. <li>
  20. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  21. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  22. </li>
  23. </ul>
  24. </div>
  25. </form>
  26. </div>
  27. <div class="col-sm-12 select-table table-striped">
  28. <table id="bootstrap-table"></table>
  29. </div>
  30. </div>
  31. </div>
  32. <th:block th:include="include :: footer" />
  33. <script type="text/javascript">
  34. var prefix = ctx + "tool/gen";
  35. $(function() {
  36. var options = {
  37. url: prefix + "/db/list",
  38. sortName: "createTime",
  39. sortOrder: "desc",
  40. showSearch: false,
  41. showRefresh: false,
  42. showToggle: false,
  43. showColumns: false,
  44. clickToSelect: true,
  45. rememberSelected: true,
  46. uniqueId: "tableName",
  47. columns: [{
  48. field: 'state',
  49. checkbox: true
  50. },
  51. {
  52. title: "序号",
  53. formatter: function (value, row, index) {
  54. return $.table.serialNumber(index);
  55. }
  56. },
  57. {
  58. field: 'tableName',
  59. title: '表名称',
  60. width: '20%',
  61. sortable: true,
  62. formatter: function(value, row, index) {
  63. return $.table.tooltip(value);
  64. }
  65. },
  66. {
  67. field: 'tableComment',
  68. title: '表描述',
  69. width: '20%',
  70. sortable: true,
  71. formatter: function(value, row, index) {
  72. return $.table.tooltip(value);
  73. }
  74. },
  75. {
  76. field: 'createTime',
  77. title: '创建时间',
  78. width: '20%',
  79. sortable: true
  80. },
  81. {
  82. field: 'updateTime',
  83. title: '更新时间',
  84. width: '20%',
  85. sortable: true
  86. }]
  87. };
  88. $.table.init(options);
  89. });
  90. /* 导入表结构-选择表结构-提交 */
  91. function submitHandler() {
  92. var rows = $.table.selectColumns("tableName");
  93. if (rows.length == 0) {
  94. $.modal.alertWarning("请至少选择一条记录");
  95. return;
  96. }
  97. var data = {"tables": rows.join()};
  98. $.operate.save(prefix + "/importTable", data);
  99. }
  100. </script>
  101. </body>
  102. </html>