list.html.vm 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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")
  45. <li class="select-time">
  46. <label>${comment}:</label>
  47. <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[begin${AttrName}]"/>
  48. <span>-</span>
  49. <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[end${AttrName}]"/>
  50. </li>
  51. #end
  52. #end
  53. #end
  54. <li>
  55. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  56. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  57. </li>
  58. </ul>
  59. </div>
  60. </form>
  61. </div>
  62. <div class="btn-group-sm" id="toolbar" role="group">
  63. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="${permissionPrefix}:add">
  64. <i class="fa fa-plus"></i> 添加
  65. </a>
  66. <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="${permissionPrefix}:edit">
  67. <i class="fa fa-edit"></i> 修改
  68. </a>
  69. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="${permissionPrefix}:remove">
  70. <i class="fa fa-remove"></i> 删除
  71. </a>
  72. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="${permissionPrefix}:export">
  73. <i class="fa fa-download"></i> 导出
  74. </a>
  75. </div>
  76. <div class="col-sm-12 select-table table-striped">
  77. <table id="bootstrap-table"></table>
  78. </div>
  79. </div>
  80. </div>
  81. <th:block th:include="include :: footer" />
  82. <script th:inline="javascript">
  83. var editFlag = [[${@permission.hasPermi('${permissionPrefix}:edit')}]];
  84. var removeFlag = [[${@permission.hasPermi('${permissionPrefix}:remove')}]];
  85. #foreach($column in $columns)
  86. #if(${column.dictType} != '')
  87. var ${column.javaField}Datas = [[${@dict.getType('${column.dictType}')}]];
  88. #end
  89. #end
  90. var prefix = ctx + "${moduleName}/${businessName}";
  91. $(function() {
  92. var options = {
  93. url: prefix + "/list",
  94. createUrl: prefix + "/add",
  95. updateUrl: prefix + "/edit/{id}",
  96. removeUrl: prefix + "/remove",
  97. exportUrl: prefix + "/export",
  98. modalName: "${functionName}",
  99. columns: [{
  100. checkbox: true
  101. },
  102. #foreach($column in $columns)
  103. #set($dictType=$column.dictType)
  104. #set($javaField=$column.javaField)
  105. #set($parentheseIndex=$column.columnComment.indexOf("("))
  106. #if($parentheseIndex != -1)
  107. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  108. #else
  109. #set($comment=$column.columnComment)
  110. #end
  111. #if($column.pk)
  112. {
  113. field: '${javaField}',
  114. title: '${comment}',
  115. visible: false
  116. },
  117. #elseif($column.list && "" != $dictType)
  118. {
  119. field: '${javaField}',
  120. title: '${comment}',
  121. formatter: function(value, row, index) {
  122. return $.table.selectDictLabel#if($column.htmlType == "checkbox")s#end(${javaField}Datas, value);
  123. }
  124. },
  125. #elseif($column.list && "" != $javaField)
  126. {
  127. field: '${javaField}',
  128. title: '${comment}'
  129. },
  130. #end
  131. #end
  132. {
  133. title: '操作',
  134. align: 'center',
  135. formatter: function(value, row, index) {
  136. var actions = [];
  137. 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> ');
  138. 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>');
  139. return actions.join('');
  140. }
  141. }]
  142. };
  143. $.table.init(options);
  144. });
  145. </script>
  146. </body>
  147. </html>