list.html.vm 5.0 KB

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