gen.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 class="select-time">
  20. <label>表时间: </label>
  21. <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
  22. <span>-</span>
  23. <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
  24. </li>
  25. <li>
  26. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  27. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  28. </li>
  29. </ul>
  30. </div>
  31. </form>
  32. </div>
  33. <div class="btn-group-sm" id="toolbar" role="group">
  34. <a class="btn btn-success" onclick="javascript:batchGenCode()" shiro:hasPermission="tool:gen:code">
  35. <i class="fa fa-download"></i> 批量生成
  36. </a>
  37. </div>
  38. <div class="col-sm-12 select-table table-striped">
  39. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  40. </div>
  41. </div>
  42. </div>
  43. <th:block th:include="include :: footer" />
  44. <script type="text/javascript">
  45. var prefix = ctx + "tool/gen";
  46. $(function() {
  47. var options = {
  48. url: prefix + "/list",
  49. sortName: "createTime",
  50. sortOrder: "desc",
  51. showExport: true,
  52. columns: [{
  53. checkbox: true
  54. },
  55. {
  56. title: "序号",
  57. formatter: function (value, row, index) {
  58. return $.table.serialNumber(index);
  59. }
  60. },
  61. {
  62. field: 'tableName',
  63. title: '表名称',
  64. width: '20%',
  65. sortable: true
  66. },
  67. {
  68. field: 'tableComment',
  69. title: '表描述',
  70. width: '20%',
  71. sortable: true
  72. },
  73. {
  74. field: 'createTime',
  75. title: '创建时间',
  76. width: '20%',
  77. sortable: true
  78. },
  79. {
  80. field: 'updateTime',
  81. title: '更新时间',
  82. width: '20%',
  83. sortable: true
  84. },
  85. {
  86. title: '操作',
  87. width: '20%',
  88. align: 'center',
  89. formatter: function(value, row, index) {
  90. var msg = '<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="genCode(\'' + row.tableName + '\')"><i class="fa fa-bug"></i>生成代码</a> ';
  91. return msg;
  92. }
  93. }]
  94. };
  95. $.table.init(options);
  96. });
  97. // 生成代码
  98. function genCode(tableName) {
  99. $.modal.confirm("确定要生成" + tableName + "表代码吗?", function() {
  100. location.href = prefix + "/genCode/" + tableName;
  101. layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
  102. })
  103. }
  104. //批量生成代码
  105. function batchGenCode() {
  106. var rows = $.table.selectColumns("tableName");
  107. if (rows.length == 0) {
  108. $.modal.alertWarning("请选择要生成的数据");
  109. return;
  110. }
  111. $.modal.confirm("确认要生成选中的" + rows.length + "条数据吗?", function() {
  112. location.href = prefix + "/batchGenCode?tables=" + rows;
  113. layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
  114. });
  115. }
  116. </script>
  117. </body>
  118. </html>