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; -}