综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 4.2KB

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