2025-01-20 11:43:19 +08:00
|
|
|
import type { VNode } from 'vue';
|
|
|
|
|
|
|
|
import type { FormSchemaGetter } from '#/adapter/form';
|
2024-10-17 15:16:22 +08:00
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
2024-09-12 09:51:59 +08:00
|
|
|
|
2024-10-05 14:02:20 +08:00
|
|
|
import { DictEnum } from '@vben/constants';
|
2024-09-12 09:51:59 +08:00
|
|
|
|
2024-09-24 11:23:02 +08:00
|
|
|
import { getDictOptions } from '#/utils/dict';
|
2024-09-12 09:51:59 +08:00
|
|
|
import { renderBrowserIcon, renderDict, renderOsIcon } from '#/utils/render';
|
|
|
|
|
2024-09-24 11:23:02 +08:00
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'ipaddr',
|
|
|
|
label: 'IP地址',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'userName',
|
|
|
|
label: '用户账号',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions(DictEnum.SYS_COMMON_STATUS),
|
|
|
|
},
|
|
|
|
fieldName: 'status',
|
|
|
|
label: '登录状态',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'RangePicker',
|
|
|
|
fieldName: 'dateTime',
|
|
|
|
label: '登录日期',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2024-10-05 14:02:20 +08:00
|
|
|
export const columns: VxeGridProps['columns'] = [
|
|
|
|
{ type: 'checkbox', width: 60 },
|
2024-09-12 09:51:59 +08:00
|
|
|
{
|
|
|
|
title: '用户账号',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'userName',
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '登录平台',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'clientKey',
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'IP地址',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'ipaddr',
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'IP地点',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'loginLocation',
|
2024-09-12 09:51:59 +08:00
|
|
|
width: 200,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '浏览器',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'browser',
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
return renderBrowserIcon(row.browser, true) as VNode;
|
|
|
|
},
|
|
|
|
},
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
2024-10-05 14:02:20 +08:00
|
|
|
title: '系统',
|
|
|
|
field: 'os',
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
2025-01-20 11:43:19 +08:00
|
|
|
/**
|
|
|
|
* Windows 10 or Windows Server 2016 太长了 分割一下 详情依旧能看到详细的
|
|
|
|
*/
|
2024-10-05 14:02:20 +08:00
|
|
|
let value = row.os;
|
|
|
|
if (value) {
|
|
|
|
const split = value.split(' or ');
|
|
|
|
if (split.length === 2) {
|
|
|
|
value = split[0];
|
|
|
|
}
|
2024-09-12 09:51:59 +08:00
|
|
|
}
|
2024-10-05 14:02:20 +08:00
|
|
|
return renderOsIcon(value, true) as VNode;
|
|
|
|
},
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '登录结果',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'status',
|
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
return renderDict(row.status, DictEnum.SYS_COMMON_STATUS);
|
|
|
|
},
|
|
|
|
},
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '信息',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'msg',
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '日期',
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'loginTime',
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
{
|
2024-10-05 14:02:20 +08:00
|
|
|
field: 'action',
|
|
|
|
fixed: 'right',
|
|
|
|
slots: { default: 'action' },
|
2024-09-12 09:51:59 +08:00
|
|
|
title: '操作',
|
2024-10-07 16:56:32 +08:00
|
|
|
width: 150,
|
2024-09-12 09:51:59 +08:00
|
|
|
},
|
|
|
|
];
|