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
| <script setup lang="ts">
| import type { Recordable } from '@vben/types';
|
| import { Page, type VbenFormProps } from '@vben/common-ui';
| import { getVxePopupContainer } from '@vben/utils';
|
| import { Popconfirm } from 'ant-design-vue';
|
| import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
| import { forceLogout, onlineList } from '#/api/monitor/online';
|
| import { columns, querySchema } from './data';
|
| const formOptions: VbenFormProps = {
| commonConfig: {
| labelWidth: 80,
| componentProps: {
| allowClear: true,
| },
| },
| schema: querySchema(),
| wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
| };
|
| const gridOptions: VxeGridProps = {
| columns,
| height: 'auto',
| keepSource: true,
| pagerConfig: {},
| proxyConfig: {
| ajax: {
| query: async ({ page }, formValues) => {
| return await onlineList({
| pageNum: page.currentPage,
| pageSize: page.pageSize,
| ...formValues,
| });
| },
| },
| },
| rowConfig: {
| isHover: true,
| keyField: 'tokenId',
| },
| id: 'monitor-online-index',
| };
|
| const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
| async function handleForceOffline(row: Recordable<any>) {
| await forceLogout(row.tokenId);
| await tableApi.query();
| }
| </script>
|
| <template>
| <Page :auto-content-height="true">
| <BasicTable table-title="在线用户列表">
| <template #action="{ row }">
| <Popconfirm
| :get-popup-container="getVxePopupContainer"
| :title="`确认强制下线[${row.userName}]?`"
| placement="left"
| @confirm="handleForceOffline(row)"
| >
| <ghost-button danger>强制下线</ghost-button>
| </Popconfirm>
| </template>
| </BasicTable>
| </Page>
| </template>
|
|