index.jsp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
  5. <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
  6. <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
  7. <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
  8. <c:set var="basePath" value="${pageContext.request.contextPath}"/>
  9. <!DOCTYPE HTML>
  10. <html lang="zh-cn">
  11. <head>
  12. <meta charset="utf-8">
  13. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  14. <meta name="viewport" content="width=device-width, initial-scale=1">
  15. <title>权限管理</title>
  16. <link href="${basePath}/resources/zheng-admin/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
  17. <link href="${basePath}/resources/zheng-admin/plugins/material-design-iconic-font-2.2.0/css/material-design-iconic-font.min.css" rel="stylesheet"/>
  18. <link href="${basePath}/resources/zheng-admin/plugins/bootstrap-table-1.11.0/bootstrap-table.min.css" rel="stylesheet"/>
  19. <link href="${basePath}/resources/zheng-admin/plugins/waves-0.7.5/waves.min.css" rel="stylesheet"/>
  20. <link href="${basePath}/resources/zheng-admin/css/common.css" rel="stylesheet"/>
  21. </head>
  22. <body>
  23. <div id="main">
  24. <div id="toolbar">
  25. <shiro:hasPermission name="upms:permission:create"><a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-plus"></i> 新增权限</a></shiro:hasPermission>
  26. <shiro:hasPermission name="upms:permission:update"><a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-edit"></i> 编辑权限</a></shiro:hasPermission>
  27. <shiro:hasPermission name="upms:permission:delete"><a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-close"></i> 删除权限</a></shiro:hasPermission>
  28. </div>
  29. <table id="table"></table>
  30. </div>
  31. <script src="${basePath}/resources/zheng-admin/plugins/jquery.1.12.4.min.js"></script>
  32. <script src="${basePath}/resources/zheng-admin/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
  33. <script src="${basePath}/resources/zheng-admin/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
  34. <script src="${basePath}/resources/zheng-admin/plugins/bootstrap-table-1.11.0/locale/bootstrap-table-zh-CN.min.js"></script>
  35. <script src="${basePath}/resources/zheng-admin/plugins/waves-0.7.5/waves.min.js"></script>
  36. <script src="${basePath}/resources/zheng-admin/js/common.js"></script>
  37. <script>
  38. $(function() {
  39. // bootstrap table初始化
  40. $('#table').bootstrapTable({
  41. url: '${basePath}/manage/permission/list',
  42. height: getHeight(),
  43. striped: true,
  44. search: true,
  45. showRefresh: true,
  46. showColumns: true,
  47. minimumCountColumns: 2,
  48. clickToSelect: true,
  49. detailView: true,
  50. detailFormatter: 'detailFormatter',
  51. pagination: true,
  52. toolbar: '#toolbar',
  53. columns: [
  54. {field: 'state', checkbox: true},
  55. {field: 'permissionId', title: '编号', sortable: true, align: 'center'},
  56. {field: 'systemId', title: '所属系统'},
  57. {field: 'pid', title: '所属上级'},
  58. {field: 'name', title: '权限名称'},
  59. {field: 'type', title: '类型', formatter: 'typeFormatter'},
  60. {field: 'permissionValue', title: '权限值'},
  61. {field: 'uri', title: '路径'},
  62. {field: 'icon', title: '图标', align: 'center', formatter: 'iconFormatter'},
  63. {field: 'status', title: '状态', sortable: true, align: 'center', formatter: 'statusFormatter'},
  64. {field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents'}
  65. ]
  66. }).on('all.bs.table', function (e, name, args) {
  67. $('[data-toggle="tooltip"]').tooltip();
  68. $('[data-toggle="popover"]').popover();
  69. });
  70. });
  71. // 格式化操作按钮
  72. function actionFormatter(value, row, index) {
  73. return [
  74. '<a class="update" href="javascript:void(0)" data-toggle="tooltip" title="Edit"><i class="glyphicon glyphicon-edit"></i></a> ',
  75. '<a class="delete" href="javascript:void(0)" data-toggle="tooltip" title="Remove"><i class="glyphicon glyphicon-remove"></i></a>'
  76. ].join('');
  77. }
  78. // 格式化图标
  79. function iconFormatter(value, row, index) {
  80. return '<i class="' + value + '"></i>';
  81. }
  82. // 格式化类型
  83. function typeFormatter(value, row, index) {
  84. if (value == 1) {
  85. return '菜单';
  86. }
  87. if (value == 2) {
  88. return '按钮';
  89. }
  90. return '-';
  91. }
  92. // 格式化状态
  93. function statusFormatter(value, row, index) {
  94. if (value == 1) {
  95. return '<span class="label label-success">正常</span>';
  96. } else {
  97. return '<span class="label label-danger">锁定</span>';
  98. }
  99. }
  100. // 操作按钮事件
  101. window.actionEvents = {
  102. 'click .update': function (e, value, row, index) {
  103. alert('You click update icon, row: ' + JSON.stringify(row));
  104. console.log(value, row, index);
  105. },
  106. 'click .delete': function (e, value, row, index) {
  107. alert('You click delete icon, row: ' + JSON.stringify(row));
  108. console.log(value, row, index);
  109. }
  110. };
  111. </script>
  112. </body>
  113. </html>