浏览代码

清空登录用户信息刷新表格

Zt 2 年之前
父节点
当前提交
569014e8b1
共有 2 个文件被更改,包括 20 次插入6 次删除
  1. 14 1
      chuanyi-admin/src/views/dashboard/index.vue
  2. 6 5
      chuanyi-admin/src/views/dashboard/onlineUsers.vue

+ 14 - 1
chuanyi-admin/src/views/dashboard/index.vue

@@ -90,7 +90,11 @@
     </el-row>
 
     <!-- 客户端在线用户数弹框 -->
-    <onlineUsers ref="onUsers" :table-data="onlineUsersTable" />
+    <onlineUsers
+      ref="onUsers"
+      :table-data="onlineUsersTable"
+      @updateOnlineUser="updateOnlineUser"
+    />
   </div>
 </template>
 
@@ -165,6 +169,15 @@ export default {
     // 点击客户端在线用户数
     onlineUsers() {
       this.$refs.onUsers.show()
+    },
+    // 更新客户端在线用户数
+    updateOnlineUser() {
+      getOnlineUser('front').then((res) => {
+        if (res.code === 200) {
+          this.statistics.onlineClientUserNum = res.data.count
+          this.onlineUsersTable = res.data.frontLoginList
+        }
+      })
     }
   }
 }

+ 6 - 5
chuanyi-admin/src/views/dashboard/onlineUsers.vue

@@ -8,10 +8,7 @@
     >
       <el-table-column prop="userName" label="用户名" />
       <el-table-column prop="createTime" label="创建时间" />
-      <el-table-column
-        prop="lastLoginTime"
-        label="最后登录时间"
-      />
+      <el-table-column prop="lastLoginTime" label="最后登录时间" />
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
           <el-button
@@ -34,7 +31,10 @@
 import { clearLoginSession } from '@/api/dashboard'
 export default {
   props: {
-    tableData: Array
+    tableData: {
+      type: Array,
+      default: () => []
+    }
   },
   data() {
     return {
@@ -63,6 +63,7 @@ export default {
                 message: res.data,
                 type: 'success'
               })
+              this.$emit('updateOnlineUser')
             }
           })
         })