import type { VbenFormProps, VxeGridProps } from '#/adapter'; import { LogApi } from '#/api'; export const searchFormOptions: VbenFormProps = { schema: [ { component: 'RangePicker', fieldName: '__date', label: '日期', componentProps: { format: 'YYYY-MM-DD HH:mm:ss', placeholder: ['开始时间', '结束时间'], showTime: { format: 'HH:mm:ss' }, }, }, ], }; export const gridOptions: VxeGridProps = { toolbarConfig: { refresh: true, print: false, export: false, zoom: true, custom: true, }, columns: [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', field: 'tableName', title: '表名', width: 120 }, { align: 'left', field: 'columnName', title: '列名', width: 120 }, { align: 'left', field: 'newValue', title: '新值', width: 100 }, { align: 'left', field: 'oldValue', title: '旧值', width: 100 }, { align: 'left', field: 'operate', title: '操作方式', width: 80 }, { align: 'left', field: 'auditTime', title: '审计时间', width: 150 }, { align: 'left', field: 'account', title: '账号', width: 100 }, { align: 'left', field: 'realName', title: '姓名' }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 100, }, ], height: 'auto', keepSource: true, proxyConfig: { ajax: { query: async ({ page }, formValues) => { const postData = { ...formValues }; if (postData.__date) { postData.startTime = postData.__date[0]; postData.endTime = postData.__date[1]; delete postData.__date; } return await LogApi.getAuditPage({ pageIndex: page.currentPage, pageSize: page.pageSize, ...postData, }); }, }, }, }; export const gridDifferenceOptions: VxeGridProps = { toolbarConfig: { refresh: true, print: false, export: false, zoom: true, custom: true, }, columns: [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', field: 'beforeData', title: '操作前记录', width: 150, showOverflow: true, }, { align: 'left', field: 'afterData', title: '操作后记录', width: 150, showOverflow: true, }, { align: 'left', field: 'sql', title: 'SQL', width: 100, showOverflow: true, }, { align: 'left', field: 'parameters', title: '参数', showOverflow: true, }, { align: 'left', field: 'businessData', title: '业务对象', width: 100, showOverflow: true, }, { align: 'left', field: 'diffType', title: '差异操作', width: 80, }, { align: 'left', field: 'elapsed', title: '耗时', width: 80, }, ], height: 'auto', keepSource: true, proxyConfig: { ajax: { query: async ({ page }, formValues) => { const postData = { ...formValues }; if (postData.__date) { postData.startTime = postData.__date[0]; postData.endTime = postData.__date[1]; delete postData.__date; } return await LogApi.getDifferencePage({ pageIndex: page.currentPage, pageSize: page.pageSize, ...postData, }); }, }, }, }; export const gridExceptionOptions: VxeGridProps = { toolbarConfig: { refresh: true, print: false, export: false, zoom: true, custom: true, }, columns: [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', field: 'httpMethod', title: '请求方式', width: 80, }, { align: 'left', field: 'requestUrl', title: '请求地址', width: 250, showOverflow: true, }, { align: 'left', field: 'requestParam', title: '请求参数', width: 100, showOverflow: true, }, { align: 'left', field: 'returnResult', title: '返回结果', showOverflow: true, width: 200, }, { align: 'left', field: 'exception', title: '异常信息', width: 150, showOverflow: true, }, { align: 'left', field: 'message', title: '日志消息', showOverflow: true, }, ], height: 'auto', keepSource: true, proxyConfig: { ajax: { query: async ({ page }, formValues) => { const postData = { ...formValues }; if (postData.__date) { postData.startTime = postData.__date[0]; postData.endTime = postData.__date[1]; delete postData.__date; } return await LogApi.getExceptionPage({ pageIndex: page.currentPage, pageSize: page.pageSize, ...postData, }); }, }, }, }; export const gridOperateOptions: VxeGridProps = { toolbarConfig: { refresh: true, print: false, export: false, zoom: true, custom: true, }, columns: [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', field: 'httpMethod', title: '请求方式', width: 80, }, { align: 'left', field: 'requestUrl', title: '请求地址', width: 250, showOverflow: true, }, { align: 'left', field: 'requestParam', title: '请求参数', width: 100, showOverflow: true, }, { align: 'left', field: 'returnResult', title: '返回结果', showOverflow: true, width: 200, }, { align: 'left', field: 'exception', title: '异常信息', width: 150, showOverflow: true, }, { align: 'left', field: 'message', title: '日志消息', showOverflow: true, }, ], height: 'auto', keepSource: true, proxyConfig: { ajax: { query: async ({ page }, formValues) => { const postData = { ...formValues }; if (postData.__date) { postData.startTime = postData.__date[0]; postData.endTime = postData.__date[1]; delete postData.__date; } return await LogApi.getOperatePage({ pageIndex: page.currentPage, pageSize: page.pageSize, ...postData, }); }, }, }, }; export const gridVisitOptions: VxeGridProps = { toolbarConfig: { refresh: true, print: false, export: false, zoom: true, custom: true, }, columns: [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', field: 'controllerName', title: '模块名称', width: 120, showOverflow: true, }, { align: 'left', field: 'actionName', title: '方法名称', width: 120, showOverflow: true, }, { align: 'left', field: 'displayTitle', title: '显示名称', width: 100, showOverflow: true, }, { align: 'left', field: 'status', title: '执行状态', showOverflow: true, width: 80, }, { align: 'left', field: 'remoteIp', title: 'IP地址', width: 80, showOverflow: true, }, { align: 'left', field: 'location', title: '登录地点', width: 100, showOverflow: true, }, { align: 'left', field: 'browser', title: '浏览器', showOverflow: true, width: 100, }, { align: 'left', field: 'elapsed', title: '操作用时', width: 80, showOverflow: true, }, { align: 'left', field: 'logDateTime', title: '日志时间', width: 120, showOverflow: true, }, { align: 'left', field: 'account', title: '账号', width: 120, showOverflow: true, }, { align: 'left', field: 'realName', title: '姓名', width: 120, }, ], height: 'auto', keepSource: true, proxyConfig: { ajax: { query: async ({ page }, formValues) => { const postData = { ...formValues }; if (postData.__date) { postData.startTime = postData.__date[0]; postData.endTime = postData.__date[1]; delete postData.__date; } return await LogApi.getVisitPage({ pageIndex: page.currentPage, pageSize: page.pageSize, ...postData, }); }, }, }, };