online.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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('在线用户列表')" />
  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="online-form">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 登录地址:<input type="text" name="ipaddr"/>
  15. </li>
  16. <li>
  17. 操作人员:<input type="text" name="loginName"/>
  18. </li>
  19. <li>
  20. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  21. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  22. </li>
  23. </ul>
  24. </div>
  25. </form>
  26. </div>
  27. <div class="btn-group-sm" id="toolbar" role="group">
  28. <a class="btn btn-danger btn-del disabled" onclick="javascript:batchForceLogout()" shiro:hasPermission="monitor:online:batchForceLogout">
  29. <i class="fa fa-sign-out"></i> 强退
  30. </a>
  31. </div>
  32. <div class="col-sm-12 select-table table-striped">
  33. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  34. </div>
  35. </div>
  36. </div>
  37. <th:block th:include="include :: footer" />
  38. <script th:inline="javascript">
  39. var forceFlag = [[${@permission.hasPermi('monitor:online:forceLogout')}]];
  40. var prefix = ctx + "monitor/online";
  41. $(function() {
  42. var options = {
  43. url: prefix + "/list",
  44. exportUrl: prefix + "/export",
  45. sortName: "lastAccessTime",
  46. sortOrder: "desc",
  47. showExport: true,
  48. escape: true,
  49. columns: [{
  50. checkbox: true
  51. },
  52. {
  53. title: "序号",
  54. formatter: function (value, row, index) {
  55. return $.table.serialNumber(index);
  56. }
  57. },
  58. {
  59. field: 'sessionId',
  60. title: '会话编号'
  61. },
  62. {
  63. field: 'loginName',
  64. title: '登录名称',
  65. sortable: true
  66. },
  67. {
  68. field: 'deptName',
  69. title: '部门名称'
  70. },
  71. {
  72. field: 'ipaddr',
  73. title: '主机'
  74. },
  75. {
  76. field: 'loginLocation',
  77. title: '登录地点'
  78. },
  79. {
  80. field: 'browser',
  81. title: '浏览器'
  82. },
  83. {
  84. field: 'os',
  85. title: '操作系统'
  86. },
  87. {
  88. field: 'status',
  89. title: '会话状态',
  90. align: 'center',
  91. formatter: function(value, row, index) {
  92. if (value == 'on_line') {
  93. return '<span class="badge badge-primary">在线</span>';
  94. } else if (value == 'off_line') {
  95. return '<span class="badge badge-danger">离线</span>';
  96. }
  97. }
  98. },
  99. {
  100. field: 'startTimestamp',
  101. title: '登录时间',
  102. sortable: true
  103. },
  104. {
  105. field: 'lastAccessTime',
  106. title: '最后访问时间',
  107. sortable: true
  108. },
  109. {
  110. title: '操作',
  111. align: 'center',
  112. formatter: function(value, row, index) {
  113. var msg = '<a class="btn btn-danger btn-xs ' + forceFlag + '" href="javascript:void(0)" onclick="forceLogout(\'' + row.sessionId + '\')"><i class="fa fa-sign-out"></i>强退</a> ';
  114. return msg;
  115. }
  116. }]
  117. };
  118. $.table.init(options);
  119. });
  120. // 单条强退
  121. function forceLogout(sessionId) {
  122. $.modal.confirm("确定要强制选中用户下线吗?", function() {
  123. var data = { "sessionId": sessionId };
  124. $.operate.post(prefix + "/forceLogout", data);
  125. })
  126. }
  127. // 批量强退
  128. function batchForceLogout() {
  129. var rows = $.table.selectColumns("sessionId");
  130. if (rows.length == 0) {
  131. $.modal.alertWarning("请选择要强退的用户");
  132. return;
  133. }
  134. $.modal.confirm("确认要强退选中的" + rows.length + "条数据吗?", function() {
  135. var url = prefix + "/batchForceLogout";
  136. var data = { "ids": rows };
  137. $.operate.post(url, data);
  138. });
  139. }
  140. </script>
  141. </body>
  142. </html>