Files
xk-admin/apps/web-antd/src/views/log/api-log/config/table.ts
2025-03-07 08:18:45 +08:00

86 lines
2.1 KiB
TypeScript

import type { VxeGridProps } from '#/adapter/vxe-table';
import { getOldApiLogList } from '../api';
interface RowType {
id: string;
admin: string;
url: string;
ip: string;
param: string;
type: string;
created_at: string;
}
export const gridOptions: VxeGridProps<RowType> = {
checkboxConfig: {
highlight: true,
labelField: '',
},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
columns: [
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{
field: 'admin',
align: 'left',
title: '操作管理员',
slots: { default: 'admin' },
},
{ field: 'url', title: '访问路由' },
{ field: 'ip', title: '用户IP地址' },
{ field: 'controller', title: '访问控制器' },
// { field: 'param', title: '携带参数' },
{ field: 'equipment', title: '操作系统', slots: { default: 'equipment' }, width: 80 },
{ field: 'browser', title: '浏览器', slots: { default: 'browser' }, width: 80 },
{ field: 'type', title: '操作简述', slots: { default: 'type' } },
{ field: 'created_at', title: '访问时间' },
{ type: 'html', title: '操作', slots: { default: 'action' } },
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getOldApiLogList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
exportConfig: {
// 导出配置
filename: 'api-log',
remote: true,
type: 'csv',
},
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
search: true,
refresh: true, // 刷新
// import: true, // 导入
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
zoom: true, // 最大化最小化
slots: {
buttons: 'toolbar-buttons',
},
custom: {
// 自定义列-图标
icon: 'vxe-icon-menu',
},
},
showOverflow: false,
};