1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<template>
  <basic-container>
    <div style="display: flex;justify-content: space-between;align-items: center">
      <h3>当前在线人员信息</h3>
      <el-button type="primary" size="small" plain style="margin-right: 10px">刷新</el-button>
    </div>
    <avue-crud :data="data" :option="option" ></avue-crud>
  </basic-container>
</template>
 
<script>
import {
  getOnlineUsersNum
} from "@/api/systemModel/systemConfig/api"
import basicOption from '@/util/basic-option';
export default {
  name: "index",
  data() {
    return {
      data:[
        {
          id:'admin',
          name:'admin',
          ip:'1.0.0',
          time:'2024-12-27',
          lastTime:'2024-12-27'
        }
      ],
      option:{
        ...basicOption,
        refreshBtn:false,
        addBtn:false,
        menu:false,
        column:[
          {
            label:'账号',
            prop:'id'
          },
          {
            label:'姓名',
            prop:'name'
          },
          {
            label:'机器ip',
            prop:'ip'
          },
          {
            label:'登录时间',
            prop:'time'
          },
          {
            label:'最后操作时间',
            prop:'lastTime'
          }
        ]
      }
    }
  },
  created() {
    this.getOnlineUsersNum();
  },
  methods: {
    // 左侧树查询
    getOnlineUsersNum() {
      getOnlineUsersNum().then(res => {
        if (res.data.code === 200) {
          const data = res.data.obj;
          this.form.currentOnlineUser = data;
        }
      })
    }
  }
}
</script>
 
<style scoped>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 500px;
  height: 500px;
  margin: auto;
}
</style>