gen.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <meta charset="utf-8">
  4. <head th:include="include :: header"></head>
  5. <body class="gray-bg">
  6. <div class="container-div">
  7. <div class="row">
  8. <div class="col-sm-12 select-info">
  9. <form id="operlog-form">
  10. <div class="select-list gd">
  11. <ul>
  12. <li>
  13. 表名称:<input type="text" name="tableName"/>
  14. </li>
  15. <li>
  16. 表描述:<input type="text" name="tableComment"/>
  17. </li>
  18. <li>
  19. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
  20. </li>
  21. </ul>
  22. </div>
  23. </form>
  24. </div>
  25. <div class="btn-group hidden-xs" id="toolbar" role="group">
  26. <a class="btn btn-outline btn-success btn-rounded" onclick="javascript:batchGenCode()" shiro:hasPermission="tool:gen:code">
  27. <i class="fa fa-download"></i> 批量生成
  28. </a>
  29. </div>
  30. <div class="col-sm-12 select-info table-striped">
  31. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  32. </div>
  33. </div>
  34. </div>
  35. <div th:include="include :: footer"></div>
  36. <script type="text/javascript">
  37. var prefix = ctx + "tool/gen"
  38. $(function() {
  39. var options = {
  40. url: prefix + "/list",
  41. sortName: "createTime",
  42. sortOrder: "desc",
  43. search: false,
  44. columns: [{
  45. checkbox: true
  46. },
  47. {
  48. field: 'tableName',
  49. title: '表名称'
  50. },
  51. {
  52. field: 'tableComment',
  53. title: '表描述'
  54. },
  55. {
  56. field: 'createDateTimeStr',
  57. title: '创建时间'
  58. },
  59. {
  60. field: 'updateDateTimeStr',
  61. title: '更新时间'
  62. },
  63. {
  64. title: '操作',
  65. align: 'center',
  66. formatter: function(value, row, index) {
  67. var msg = '<a class="btn btn-primary btn-xs" href="#" onclick="genCode(\'' + row.tableName + '\')"><i class="fa fa-bug"></i>生成代码</a> ';
  68. return msg;
  69. }
  70. }]
  71. };
  72. $.table.init(options);
  73. });
  74. // 生成代码
  75. function genCode(tableName) {
  76. $.modal.confirm("确定要生成" + tableName + "表代码吗?", function() {
  77. location.href = prefix + "/genCode/" + tableName;
  78. layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
  79. })
  80. }
  81. //批量生成代码
  82. function batchGenCode() {
  83. var rows = $.table.selectColumns("tableName");
  84. if (rows.length == 0) {
  85. $.modal.alertWarning("请选择要生成的数据");
  86. return;
  87. }
  88. $.modal.confirm("确认要生成选中的" + rows.length + "条数据吗?", function() {
  89. location.href = prefix + "/batchGenCode?tables=" + rows;
  90. layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
  91. });
  92. }
  93. </script>
  94. </body>
  95. </html>