Files
ruoyi-plus-vben5/apps/web-antd/src/views/monitor/logininfor/data.tsx
dap a272c54561 refactor(表单): 移除查询表单中时间组件的冗余默认值
清理多个模块查询表单中 RangePicker 组件的 defaultValue 设置,因为框架后续版本已修复重置问题,不再需要显式设置为 [null, null] 来确保表单重置正常工作。同时更新相关文档说明。
2026-02-26 19:24:06 +08:00

117 lines
2.4 KiB
TypeScript

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants';
import { getDictOptions } from '#/utils/dict';
import { renderBrowserIcon, renderDict, renderOsIcon } from '#/utils/render';
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: '登录日期',
},
];
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '用户账号',
field: 'userName',
},
{
title: '登录平台',
field: 'clientKey',
},
{
title: 'IP地址',
field: 'ipaddr',
},
{
title: 'IP地点',
field: 'loginLocation',
width: 200,
},
{
title: '浏览器',
field: 'browser',
slots: {
default: ({ row }) => {
return (
<div class="flex items-center justify-center gap-[6px]">
{renderBrowserIcon(row.browser, 'shrink-0')}
{row.browser}
</div>
);
},
},
},
{
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 (
<div class="flex items-center justify-center gap-[6px]">
{renderOsIcon(row.os, 'shrink-0')}
{value}
</div>
);
},
},
},
{
title: '登录结果',
field: 'status',
slots: {
default: ({ row }) => {
return renderDict(row.status, DictEnum.SYS_COMMON_STATUS);
},
},
},
{
title: '信息',
field: 'msg',
},
{
title: '日期',
field: 'loginTime',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 150,
},
];