import.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="keywords" content="">
  8. <meta name="description" content="">
  9. <title text="">代码生成导入</title>
  10. <link rel="stylesheet" href="../../component/pear/css/pear.css">
  11. <style>
  12. .layui-table-tool {display: none;}
  13. .layui-card-body {padding: 10px 15px 5px 15px;}
  14. </style>
  15. </head>
  16. <body class="pear-container">
  17. <div class="layui-card">
  18. <div class="layui-card-body">
  19. <form class="layui-form">
  20. <div class="layui-form-item">
  21. <div class="layui-inline">
  22. <label class="layui-form-label">表名称</label>
  23. <div class="layui-input-inline">
  24. <input class="layui-input" type="text" name="tableName" placeholder="" autocomplete="off">
  25. </div>
  26. </div>
  27. <div class="layui-inline">
  28. <label class="layui-form-label">表描述</label>
  29. <div class="layui-input-inline">
  30. <input class="layui-input" type="text" name="tableComment" placeholder="" autocomplete="off">
  31. </div>
  32. </div>
  33. <div class="layui-inline">
  34. <button type="button" class="pear-btn pear-btn-md-0 pear-btn-primary" lay-submit lay-filter="query">
  35. <i class="layui-icon layui-icon-search"></i> 搜索
  36. </button>
  37. <button type="reset" class="pear-btn pear-btn-md-0">
  38. <i class="layui-icon layui-icon-refresh"></i> 重置
  39. </button>
  40. </div>
  41. </div>
  42. </form>
  43. </div>
  44. </div>
  45. <div class="layui-card">
  46. <div class="layui-card-body">
  47. <table id="table" lay-filter="table"></table>
  48. </div>
  49. </div>
  50. <script type="text/html" id="createTime">
  51. {{ layui.util.toDateString(d.createTime, 'yyyy-MM-dd') }}
  52. </script>
  53. <script type="text/html" id="updateTime">
  54. {{ layui.util.toDateString(d.updateTime, 'yyyy-MM-dd') }}
  55. </script>
  56. <script src="../../component/layui/layui.js"></script>
  57. <script src="../../component/pear/pear.js"></script>
  58. <script>
  59. layui.use(['request', 'form', 'common', 'table'], function() {
  60. var $ = layui.jquery,
  61. request = layui.request,
  62. form = layui.form,
  63. table = layui.table;
  64. var MODULE_PATH = "/generator/v1/";
  65. request.tableRender({
  66. url: MODULE_PATH + 'database',
  67. defaultToolbar: [],
  68. cols: [
  69. [
  70. {type: 'checkbox', width: 40},
  71. {title: '表名称', field: 'tableName' },
  72. {title: '表描述', field: 'tableComment' },
  73. {title: '创建时间',field: 'createTime', width: 160, sort: true, templet: '#createTime'},
  74. {title: '更新时间',field: 'updateTime', width: 160, templet: '#updateTime'}
  75. ]
  76. ]
  77. });
  78. form.on('submit(query)', function (data) {
  79. window.refresh(data.field);
  80. return false;
  81. });
  82. window.refresh = function (param) {
  83. table.reload('table', {where: param});
  84. }
  85. });
  86. function submitHandler() {
  87. var check = layui.table.checkStatus('table');
  88. if (check.data.length === 0) {
  89. parent.layer.alert("请至少选择一条记录");
  90. return;
  91. }
  92. layui.request.http({
  93. url: "/generator/v1/",
  94. type: 'post',
  95. data: {"params": layui.common.joinArray(check.data, "tableName")},
  96. success: function (result) {
  97. if (result.success) {
  98. parent.layui.popup.success(result.msg, function () {
  99. parent.layer.close(parent.layer.getFrameIndex(window.name));
  100. parent.refresh();
  101. })
  102. } else {
  103. parent.layui.popup.failure(result.msg);
  104. }
  105. }
  106. })
  107. }
  108. </script>
  109. </body>
  110. </html>