import { type ProColumns, type ProDescriptionsItemProps, ProFormColumnsType, } from '@ant-design/pro-components'; import { DescriptionsProps } from 'antd'; import dayjs from 'dayjs'; import type { OperateLogVO } from '@/services/system/log/operate'; export const baseTenantColumns: ProColumns[] = [ { title: '日志编号', dataIndex: 'id', tip: '日志编号', width: 100, hideInSearch: true, // 在搜索表单中隐藏 }, { title: '操作人', dataIndex: 'userName', tip: '操作人', // 提示信息 }, { title: '操作模块', dataIndex: 'type', }, { title: '操作名', dataIndex: 'subType', }, { title: '操作内容', dataIndex: 'action', }, { 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: OperateLogVO) => dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'), }, { title: '业务编号', dataIndex: 'bizId', }, { title: '操作 IP', dataIndex: 'userIp', hideInSearch: true, }, ]; export const descriptionsColumns = (): ProDescriptionsItemProps< Record, 'text' >[] => [ { title: '日志主键', key: 'id', dataIndex: 'id', }, { title: '链路追踪', key: 'traceId', dataIndex: 'traceId', }, { title: '操作人编号', key: 'userId', dataIndex: 'userId', }, { title: '操作人名字', key: 'userName', dataIndex: 'userName', }, { title: '操作人 IP', key: 'userIp', dataIndex: 'userIp', }, { title: '操作人 UA', key: 'userAgent', dataIndex: 'userAgent', }, { title: '操作模块', key: 'type', dataIndex: 'type', }, { title: '操作名', key: 'subType', dataIndex: 'subType', }, { title: '操作内容', key: 'action', dataIndex: 'action', }, { title: '操作拓展参数', key: 'extra', dataIndex: 'extra', }, { title: '请求 URL', key: 'requestUrl', dataIndex: 'requestUrl', }, { title: '操作时间', key: 'createTime', dataIndex: 'createTime', }, { title: '业务编号', key: 'bizId', dataIndex: 'bizId', }, ];