list-tree.html.vm 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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="$.treeTable.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" onclick="$.operate.edit()" shiro:hasPermission="${permissionPrefix}:edit">
  72. <i class="fa fa-edit"></i> 修改
  73. </a>
  74. <a class="btn btn-info" id="expandAllBtn">
  75. <i class="fa fa-exchange"></i> 展开/折叠
  76. </a>
  77. </div>
  78. <div class="col-sm-12 select-table table-striped">
  79. <table id="bootstrap-tree-table"></table>
  80. </div>
  81. </div>
  82. </div>
  83. <th:block th:include="include :: footer" />
  84. <script th:inline="javascript">
  85. var addFlag = [[${@permission.hasPermi('${permissionPrefix}:add')}]];
  86. var editFlag = [[${@permission.hasPermi('${permissionPrefix}:edit')}]];
  87. var removeFlag = [[${@permission.hasPermi('${permissionPrefix}:remove')}]];
  88. #foreach($column in $columns)
  89. #if(${column.dictType} != '')
  90. var ${column.javaField}Datas = [[${@dict.getType('${column.dictType}')}]];
  91. #end
  92. #end
  93. var prefix = ctx + "${moduleName}/${businessName}";
  94. $(function() {
  95. var options = {
  96. code: "${treeCode}",
  97. parentCode: "${treeParentCode}",
  98. expandColumn: "${expandColumn}",
  99. uniqueId: "${pkColumn.javaField}",
  100. url: prefix + "/list",
  101. createUrl: prefix + "/add/{id}",
  102. updateUrl: prefix + "/edit/{id}",
  103. removeUrl: prefix + "/remove/{id}",
  104. exportUrl: prefix + "/export",
  105. modalName: "${functionName}",
  106. columns: [{
  107. field: 'selectItem',
  108. radio: true
  109. },
  110. #foreach($column in $columns)
  111. #set($dictType=$column.dictType)
  112. #set($javaField=$column.javaField)
  113. #set($parentheseIndex=$column.columnComment.indexOf("("))
  114. #if($parentheseIndex != -1)
  115. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  116. #else
  117. #set($comment=$column.columnComment)
  118. #end
  119. #if($column.pk)
  120. #elseif($column.list && "" != $dictType)
  121. {
  122. field: '${javaField}',
  123. title: '${comment}',
  124. align: 'left',
  125. formatter: function(value, row, index) {
  126. return $.table.selectDictLabel#if($column.htmlType == "checkbox")s#end(${javaField}Datas, value);
  127. }
  128. },
  129. #elseif($column.list && "" != $javaField)
  130. {
  131. field: '${javaField}',
  132. title: '${comment}',
  133. align: 'left'
  134. },
  135. #end
  136. #end
  137. {
  138. title: '操作',
  139. align: 'center',
  140. align: 'left',
  141. formatter: function(value, row, index) {
  142. var actions = [];
  143. 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> ');
  144. actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.${pkColumn.javaField} + '\')"><i class="fa fa-plus"></i>新增</a> ');
  145. 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>');
  146. return actions.join('');
  147. }
  148. }]
  149. };
  150. $.treeTable.init(options);
  151. });
  152. </script>
  153. </body>
  154. </html>