Blame view

Yi.Vben5.Vue3/apps/web-antd/src/views/monitor/online/data.ts 1.58 KB
515fceeb   “wangming”   框架初始化
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
72
73
74
75
76
77
  import type { VNode } from 'vue';
  
  import type { FormSchemaGetter } from '#/adapter/form';
  import type { VxeGridProps } from '#/adapter/vxe-table';
  
  import dayjs from 'dayjs';
  
  import { renderBrowserIcon, renderOsIcon } from '#/utils/render';
  
  export const querySchema: FormSchemaGetter = () => [
    {
      component: 'Input',
      fieldName: 'ipaddr',
      label: 'IP地址',
    },
    {
      component: 'Input',
      fieldName: 'userName',
      label: '用户账号',
    },
  ];
  
  export const columns: VxeGridProps['columns'] = [
    {
      title: '登录账号',
      field: 'userName',
    },
    {
      title: 'IP地址',
      field: 'ipaddr',
    },
    {
      title: '登录地址',
      field: 'loginLocation',
    },
    {
      title: '浏览器',
      field: 'browser',
      slots: {
        default: ({ row }) => {
          return renderBrowserIcon(row.browser, true) as VNode;
        },
      },
    },
    {
      title: '系统',
      field: 'os',
      slots: {
        default: ({ row }) => {
          // Windows 10 or Windows Server 2016 太长了 分割一下 详情依旧能看到详细的
          let value = row.os;
          if (value) {
            const split = value.split(' or ');
            if (split.length === 2) {
              value = split[0];
            }
          }
          return renderOsIcon(value, true) as VNode;
        },
      },
    },
    {
      title: '登录时间',
      field: 'loginTime',
      formatter: ({ cellValue }) => {
        return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss');
      },
    },
    {
      field: 'action',
      fixed: 'right',
      slots: { default: 'action' },
      title: '操作',
      resizable: false,
      width: 'auto',
    },
  ];