index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
  4. <el-form-item label="登录地址" prop="ipaddr">
  5. <el-input
  6. v-model="queryParams.ipaddr"
  7. placeholder="请输入登录地址"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="用户名称" prop="userName">
  14. <el-input
  15. v-model="queryParams.userName"
  16. placeholder="请输入用户名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-table
  28. v-loading="loading"
  29. :data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
  30. style="width: 100%;"
  31. >
  32. <el-table-column label="序号" type="index" align="center">
  33. <template slot-scope="scope">
  34. <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
  38. <el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
  39. <el-table-column label="部门名称" align="center" prop="deptName" />
  40. <el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
  41. <el-table-column label="登录地点" align="center" prop="loginLocation" :show-overflow-tooltip="true" />
  42. <el-table-column label="浏览器" align="center" prop="browser" />
  43. <el-table-column label="操作系统" align="center" prop="os" />
  44. <el-table-column label="登录时间" align="center" prop="loginTime" width="180">
  45. <template slot-scope="scope">
  46. <span>{{ parseTime(scope.row.loginTime) }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  50. <template slot-scope="scope">
  51. <el-button
  52. size="mini"
  53. type="text"
  54. icon="el-icon-delete"
  55. @click="handleForceLogout(scope.row)"
  56. v-hasPermi="['monitor:online:forceLogout']"
  57. >强退</el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
  62. </div>
  63. </template>
  64. <script>
  65. import { list, forceLogout } from "@/api/monitor/online";
  66. export default {
  67. name: "Online",
  68. data() {
  69. return {
  70. // 遮罩层
  71. loading: true,
  72. // 总条数
  73. total: 0,
  74. // 表格数据
  75. list: [],
  76. pageNum: 1,
  77. pageSize: 10,
  78. // 查询参数
  79. queryParams: {
  80. ipaddr: undefined,
  81. userName: undefined
  82. }
  83. };
  84. },
  85. created() {
  86. this.getList();
  87. },
  88. methods: {
  89. /** 查询登录日志列表 */
  90. getList() {
  91. this.loading = true;
  92. list(this.queryParams).then(response => {
  93. this.list = response.rows;
  94. this.total = response.total;
  95. this.loading = false;
  96. });
  97. },
  98. /** 搜索按钮操作 */
  99. handleQuery() {
  100. this.pageNum = 1;
  101. this.getList();
  102. },
  103. /** 重置按钮操作 */
  104. resetQuery() {
  105. this.resetForm("queryForm");
  106. this.handleQuery();
  107. },
  108. /** 强退按钮操作 */
  109. handleForceLogout(row) {
  110. this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的数据项?').then(function() {
  111. return forceLogout(row.tokenId);
  112. }).then(() => {
  113. this.getList();
  114. this.$modal.msgSuccess("强退成功");
  115. }).catch(() => {});
  116. }
  117. }
  118. };
  119. </script>