list.html.vm 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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('${tableComment}列表')" />
  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="formId">
  11. <div class="select-list">
  12. <ul>
  13. #foreach($column in $columns)
  14. #if($column.columnName != $primaryKey.columnName)
  15. #if(!${column.configInfo})
  16. <li>
  17. ${column.columnComment}:<input type="text" name="${column.attrname}"/>
  18. </li>
  19. #else
  20. #if(${column.configInfo.type} == "dict")
  21. <li>
  22. ${column.columnComment}:<select name="${column.attrname}" th:with="type=${@dict.getType('${column.configInfo.value}')}">
  23. <option value="">所有</option>
  24. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  25. </select>
  26. </li>
  27. #elseif(${column.configInfo.type} == "date")
  28. <li class="select-time">
  29. <label>${column.columnComment}: </label>
  30. <input type="text" class="time-input" id="start${column.attrName}" placeholder="开始" name="params[begin${column.attrName}]"/>
  31. <span>-</span>
  32. <input type="text" class="time-input" id="end${column.attrName}" placeholder="结束" name="params[end${column.attrName}]"/>
  33. </li>
  34. #elseif(${column.configInfo.type} == "fk")
  35. #end
  36. #end
  37. #end
  38. #end
  39. <li>
  40. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  41. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  42. </li>
  43. </ul>
  44. </div>
  45. </form>
  46. </div>
  47. <div class="btn-group-sm" id="toolbar" role="group">
  48. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="${moduleName}:${classname}:add">
  49. <i class="fa fa-plus"></i> 添加
  50. </a>
  51. <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="${moduleName}:${classname}:edit">
  52. <i class="fa fa-edit"></i> 修改
  53. </a>
  54. <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="${moduleName}:${classname}:remove">
  55. <i class="fa fa-remove"></i> 删除
  56. </a>
  57. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="${moduleName}:${classname}:export">
  58. <i class="fa fa-download"></i> 导出
  59. </a>
  60. </div>
  61. <div class="col-sm-12 select-table table-striped">
  62. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  63. </div>
  64. </div>
  65. </div>
  66. <div th:include="include :: footer"></div>
  67. <script th:inline="javascript">
  68. var editFlag = [[${@permission.hasPermi('${moduleName}:${classname}:edit')}]];
  69. var removeFlag = [[${@permission.hasPermi('${moduleName}:${classname}:remove')}]];
  70. var prefix = ctx + "${moduleName}/${classname}";
  71. #foreach($column in $columns)
  72. #if(${column.configInfo} && ${column.configInfo.type} == 'dict')
  73. var datas = [[${@dict.getType('${column.configInfo.value}')}]];
  74. #end
  75. #end
  76. $(function() {
  77. var options = {
  78. url: prefix + "/list",
  79. createUrl: prefix + "/add",
  80. updateUrl: prefix + "/edit/{id}",
  81. removeUrl: prefix + "/remove",
  82. exportUrl: prefix + "/export",
  83. modalName: "${tableComment}",
  84. showExport: true,
  85. columns: [{
  86. checkbox: true
  87. },
  88. #foreach($column in $columns)
  89. #if($column.columnName == $primaryKey.columnName)
  90. {
  91. field : '${column.attrname}',
  92. title : '${column.columnComment}',
  93. visible: false
  94. },
  95. #elseif($column.columnName != $primaryKey.columnName)
  96. #if(${column.configInfo} && ${column.configInfo.type} == 'dict')
  97. {
  98. field : '${column.attrname}',
  99. title : '${column.columnComment}',
  100. sortable: true,
  101. formatter: function(value, row, index) {
  102. return $.table.selectDictLabel(datas, value);
  103. }
  104. },
  105. #else
  106. {
  107. field : '${column.attrname}',
  108. title : '${column.columnComment}',
  109. sortable: true
  110. },
  111. #end
  112. #end
  113. #end
  114. {
  115. title: '操作',
  116. align: 'center',
  117. formatter: function(value, row, index) {
  118. var actions = [];
  119. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.${primaryKey.attrname} + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  120. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.${primaryKey.attrname} + '\')"><i class="fa fa-remove"></i>删除</a>');
  121. return actions.join('');
  122. }
  123. }]
  124. };
  125. $.table.init(options);
  126. });
  127. </script>
  128. </body>
  129. </html>