import type { ProColumns, ProDescriptionsItemProps, } from '@ant-design/pro-components'; import dayjs from 'dayjs'; import type { LoginLogVO } from '@/services/system/log/login'; export const baseTenantColumns: ProColumns[] = [ { title: '日志编号', dataIndex: 'id', tip: '日志编号', width: 100, hideInSearch: true, // 在搜索表单中隐藏 }, { title: '操作类型', dataIndex: 'logType', hideInSearch: true, // 在搜索表单中隐藏 tip: '操作类型', // 提示信息 }, { title: '操作模块', dataIndex: 'type', hideInSearch: true, // 在搜索表单中隐藏 }, { title: '用户名称', dataIndex: 'username', }, { title: '登录地址', dataIndex: 'userIp', }, { title: '浏览器', dataIndex: 'userAgent', hideInSearch: true, // 在搜索表单中隐藏 }, { title: '登录结果', dataIndex: 'result', hideInSearch: true, }, { title: '登录日期', dataIndex: 'createTime', valueType: 'dateRange', search: { transform: (value) => { return { [`createTime[0]`]: dayjs(value[0]) .startOf('day') .format('YYYY-MM-DD HH:mm:ss'), [`createTime[1]`]: dayjs(value[1]) .endOf('day') .format('YYYY-MM-DD HH:mm:ss'), }; }, }, render: (_, record: LoginLogVO) => dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'), }, ]; export const descriptionsColumns = (): ProDescriptionsItemProps< Record, 'text' >[] => [ { title: '日志编号', key: 'id', dataIndex: 'id', }, { title: '操作类型', key: 'logType', dataIndex: 'logType', }, { title: '用户名称', key: 'username', dataIndex: 'username', }, { title: '登录地址', key: 'userIp', dataIndex: 'userIp', }, { title: '浏览器', key: 'userAgent', dataIndex: 'userAgent', }, { title: '登录结果', key: 'result', dataIndex: 'result', }, { title: '登录日期', key: 'createTime', dataIndex: 'createTime', }, ];