index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true">
  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" />
  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. data() {
  68. return {
  69. // 遮罩层
  70. loading: true,
  71. // 总条数
  72. total: 0,
  73. // 表格数据
  74. list: [],
  75. pageNum: 1,
  76. pageSize: 10,
  77. // 查询参数
  78. queryParams: {
  79. ipaddr: undefined,
  80. userName: undefined
  81. }
  82. };
  83. },
  84. created() {
  85. this.getList();
  86. },
  87. methods: {
  88. /** 查询登录日志列表 */
  89. getList() {
  90. this.loading = true;
  91. list(this.queryParams).then(response => {
  92. this.list = response.rows;
  93. this.total = response.total;
  94. this.loading = false;
  95. });
  96. },
  97. /** 搜索按钮操作 */
  98. handleQuery() {
  99. this.pageNum = 1;
  100. this.getList();
  101. },
  102. /** 重置按钮操作 */
  103. resetQuery() {
  104. this.resetForm("queryForm");
  105. this.handleQuery();
  106. },
  107. /** 强退按钮操作 */
  108. handleForceLogout(row) {
  109. this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", {
  110. confirmButtonText: "确定",
  111. cancelButtonText: "取消",
  112. type: "warning"
  113. }).then(function() {
  114. return forceLogout(row.tokenId);
  115. }).then(() => {
  116. this.getList();
  117. this.msgSuccess("强退成功");
  118. }).catch(function() {});
  119. }
  120. }
  121. };
  122. </script>