清空主机连接日志.

This commit is contained in:
lijiahang
2024-03-04 18:28:07 +08:00
parent 0538d2aa26
commit b9127967d0
10 changed files with 98 additions and 36 deletions

View File

@@ -1,3 +1,7 @@
import type { OperatorLogQueryResponse } from '@/api/user/operator-log';
import { pick } from 'lodash';
import { dateFormat } from '@/utils';
// 结果状态
export const ResultStatus = {
// 失败
@@ -6,6 +10,23 @@ export const ResultStatus = {
SUCCESS: 1,
};
// 获取日志详情
export const getLogDetail = (record: OperatorLogQueryResponse): Record<string, any> => {
try {
const detail = Object.assign({} as Record<string, any>,
pick(record, 'traceId', 'address', 'location',
'userAgent', 'errorMessage'));
detail.duration = `${record.duration} ms`;
detail.startTime = dateFormat(new Date(record.startTime));
detail.endTime = dateFormat(new Date(record.endTime));
detail.extra = record?.extra;
detail.returnValue = JSON.parse(record?.returnValue);
return detail;
} catch (e) {
return record;
}
};
// 操作日志模块 字典项
export const operatorLogModuleKey = 'operatorLogModule';

View File

@@ -3,13 +3,6 @@ import { dateFormat } from '@/utils';
const columns = [
{
title: 'id',
dataIndex: 'id',
slotName: 'id',
width: 70,
align: 'left',
fixed: 'left',
}, {
title: '操作用户',
dataIndex: 'username',
slotName: 'username',
@@ -20,16 +13,7 @@ const columns = [
title: '操作模块',
dataIndex: 'module',
slotName: 'module',
width: 120,
ellipsis: true,
tooltip: true,
}, {
title: '操作类型',
dataIndex: 'type',
slotName: 'type',
width: 150,
ellipsis: true,
tooltip: true,
width: 214,
}, {
title: '风险等级',
dataIndex: 'riskLevel',
@@ -61,7 +45,7 @@ const columns = [
title: '操作',
dataIndex: 'handle',
slotName: 'handle',
width: 90,
width: 138,
align: 'center',
fixed: 'right',
},