ludc
2024-09-26 085df90e488067783759dcd63cdb5fb43a51ff1f
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
<template>
  <basic-container>
    <div class="container">
      <el-form ref="form" :model="form" label-width="150px">
        <el-form-item label="当前在线用户人数">
          <div style="display: flex;">
            <el-input v-model="form.currentOnlineUser" :readOnly="true"></el-input>
            <el-button plain type="primary" style="margin-left: 10px" @click="getOnlineUsersNum"> 刷新</el-button>
          </div>
        </el-form-item>
      </el-form>
    </div>
  </basic-container>
</template>
 
<script>
import {
  getOnlineUsersNum
} from "@/api/systemModel/systemConfig/api"
export default {
  name: "index",
  data() {
    return {
      form: {
        currentOnlineUser: '0'
      }
    }
  },
  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>