list.html.vm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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="btn-group hidden-xs" id="toolbar" role="group">
  8. <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="${moduleName}:${classname}:add">
  9. <i class="fa fa-plus"></i> 新增
  10. </a>
  11. <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="${moduleName}:${classname}:remove">
  12. <i class="fa fa-trash-o"></i> 删除
  13. </a>
  14. </div>
  15. <div class="col-sm-12 select-info table-striped">
  16. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  17. </div>
  18. </div>
  19. <div th:include="include :: footer"></div>
  20. <script th:inline="javascript">
  21. var editFlag = [[${@permission.hasPermi('${moduleName}:${classname}:edit')}]];
  22. var removeFlag = [[${@permission.hasPermi('${moduleName}:${classname}:remove')}]];
  23. var prefix = ctx + "${moduleName}/${classname}"
  24. $(function() {
  25. var options = {
  26. url: prefix + "/list",
  27. createUrl: prefix + "/add",
  28. updateUrl: prefix + "/edit/{id}",
  29. removeUrl: prefix + "/remove",
  30. modalName: "${tableComment}",
  31. columns: [{
  32. checkbox: true
  33. },
  34. #foreach($column in $columns)
  35. {
  36. field : '${column.attrname}',
  37. title : '${column.columnComment}'
  38. },
  39. #end
  40. {
  41. title: '操作',
  42. align: 'center',
  43. formatter: function(value, row, index) {
  44. var actions = [];
  45. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.${primaryKey.attrname} + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  46. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.${primaryKey.attrname} + '\')"><i class="fa fa-remove"></i>删除</a>');
  47. return actions.join('');
  48. }
  49. }]
  50. };
  51. $.table.init(options);
  52. });
  53. </script>
  54. </body>
  55. </html>