From ca7373cd634faac0f699a30e64237bce5f936f44 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 10 Jan 2025 15:41:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BAtotal=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/monitor/online/index.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/web-antd/src/views/monitor/online/index.vue b/apps/web-antd/src/views/monitor/online/index.vue index 358e7f0a..4aff152d 100644 --- a/apps/web-antd/src/views/monitor/online/index.vue +++ b/apps/web-antd/src/views/monitor/online/index.vue @@ -4,6 +4,8 @@ import type { VbenFormProps } from '@vben/common-ui'; import type { VxeGridProps } from '#/adapter/vxe-table'; import type { OnlineUser } from '#/api/monitor/online/model'; +import { ref } from 'vue'; + import { Page } from '@vben/common-ui'; import { getVxePopupContainer } from '@vben/utils'; @@ -25,6 +27,7 @@ const formOptions: VbenFormProps = { wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', }; +const onlineCount = ref(0); const gridOptions: VxeGridProps = { columns, height: 'auto', @@ -34,10 +37,12 @@ const gridOptions: VxeGridProps = { }, proxyConfig: { ajax: { - query: async (_, formValues) => { - return await onlineList({ + query: async (_, formValues = {}) => { + const resp = await onlineList({ ...formValues, }); + onlineCount.value = resp.total; + return resp; }, }, }, @@ -58,10 +63,6 @@ async function handleForceOffline(row: OnlineUser) { await forceLogout(row.tokenId); await tableApi.query(); } - -function onlineCount() { - return tableApi?.grid?.getData?.()?.length ?? 0; -}