list.html.vm 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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('${functionName}列表')" />
  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.query)
  15. #set($dictType=$column.dictType)
  16. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  17. #set($parentheseIndex=$column.columnComment.indexOf("("))
  18. #if($parentheseIndex != -1)
  19. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  20. #else
  21. #set($comment=$column.columnComment)
  22. #end
  23. #if($column.htmlType == "input")
  24. <li>
  25. <label>${comment}:</label>
  26. <input type="text" name="${column.javaField}"/>
  27. </li>
  28. #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
  29. <li>
  30. <label>${comment}:</label>
  31. <select name="${column.javaField}" th:with="type=${@dict.getType('${dictType}')}">
  32. <option value="">所有</option>
  33. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  34. </select>
  35. </li>
  36. #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
  37. <li>
  38. <label>${comment}:</label>
  39. <select name="${column.javaField}">
  40. <option value="">所有</option>
  41. <option value="-1">代码生成请选择字典属性</option>
  42. </select>
  43. </li>
  44. #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
  45. <li>
  46. <label>${comment}:</label>
  47. <input type="text" class="time-input" placeholder="请选择${comment}" name="${column.javaField}"/>
  48. </li>
  49. #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
  50. <li class="select-time">
  51. <label>${comment}:</label>
  52. <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[begin${AttrName}]"/>
  53. <span>-</span>
  54. <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[end${AttrName}]"/>
  55. </li>
  56. #end
  57. #end
  58. #end
  59. <li>
  60. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  61. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  62. </li>
  63. </ul>
  64. </div>
  65. </form>
  66. </div>
  67. <div class="btn-group-sm" id="toolbar" role="group">
  68. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="${permissionPrefix}:add">
  69. <i class="fa fa-plus"></i> 添加
  70. </a>
  71. <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="${permissionPrefix}:edit">
  72. <i class="fa fa-edit"></i> 修改
  73. </a>
  74. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="${permissionPrefix}:remove">
  75. <i class="fa fa-remove"></i> 删除
  76. </a>
  77. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="${permissionPrefix}:export">
  78. <i class="fa fa-download"></i> 导出
  79. </a>
  80. </div>
  81. <div class="col-sm-12 select-table table-striped">
  82. <table id="bootstrap-table"></table>
  83. </div>
  84. </div>
  85. </div>
  86. <th:block th:include="include :: footer" />
  87. <script th:inline="javascript">
  88. var editFlag = [[${@permission.hasPermi('${permissionPrefix}:edit')}]];
  89. var removeFlag = [[${@permission.hasPermi('${permissionPrefix}:remove')}]];
  90. #foreach($column in $columns)
  91. #if(${column.dictType} != '')
  92. var ${column.javaField}Datas = [[${@dict.getType('${column.dictType}')}]];
  93. #end
  94. #end
  95. var prefix = ctx + "${moduleName}/${businessName}";
  96. $(function() {
  97. var options = {
  98. url: prefix + "/list",
  99. createUrl: prefix + "/add",
  100. updateUrl: prefix + "/edit/{id}",
  101. removeUrl: prefix + "/remove",
  102. exportUrl: prefix + "/export",
  103. modalName: "${functionName}",
  104. columns: [{
  105. checkbox: true
  106. },
  107. #foreach($column in $columns)
  108. #set($dictType=$column.dictType)
  109. #set($javaField=$column.javaField)
  110. #set($parentheseIndex=$column.columnComment.indexOf("("))
  111. #if($parentheseIndex != -1)
  112. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  113. #else
  114. #set($comment=$column.columnComment)
  115. #end
  116. #if($column.pk)
  117. {
  118. field: '${javaField}',
  119. title: '${comment}',
  120. visible: false
  121. },
  122. #elseif($column.list && "" != $dictType)
  123. {
  124. field: '${javaField}',
  125. title: '${comment}',
  126. formatter: function(value, row, index) {
  127. return $.table.selectDictLabel#if($column.htmlType == "checkbox")s#end(${javaField}Datas, value);
  128. }
  129. },
  130. #elseif($column.list && "" != $javaField)
  131. {
  132. field: '${javaField}',
  133. title: '${comment}'
  134. },
  135. #end
  136. #end
  137. {
  138. title: '操作',
  139. align: 'center',
  140. formatter: function(value, row, index) {
  141. var actions = [];
  142. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.${pkColumn.javaField} + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  143. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.${pkColumn.javaField} + '\')"><i class="fa fa-remove"></i>删除</a>');
  144. return actions.join('');
  145. }
  146. }]
  147. };
  148. $.table.init(options);
  149. });
  150. </script>
  151. </body>
  152. </html>