清空主机连接日志.

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,7 +1,7 @@
<template>
<a-drawer v-model:visible="visible"
title="主机连接日志详情"
:width="420"
:width="428"
:mask-closable="false"
:unmount-on-close="true"
ok-text="关闭"
@@ -49,6 +49,10 @@
<a-descriptions-item label="userAgent">
{{ record.extra?.userAgent }}
</a-descriptions-item>
<!-- 错误信息 -->
<a-descriptions-item v-if="record.extra?.errorMessage" label="错误信息">
{{ record.extra?.errorMessage }}
</a-descriptions-item>
<!-- 开始时间 -->
<a-descriptions-item label="开始时间">
{{ dateFormat(new Date(record.startTime)) }}
@@ -57,6 +61,18 @@
<a-descriptions-item label="结束时间">
{{ dateFormat(new Date(record.endTime)) }}
</a-descriptions-item>
<!-- traceId -->
<a-descriptions-item label="traceId">
{{ record.extra?.traceId }}
</a-descriptions-item>
<!-- channelId -->
<a-descriptions-item label="channelId">
{{ record.extra?.channelId }}
</a-descriptions-item>
<!-- sessionId -->
<a-descriptions-item label="sessionId">
{{ record.extra?.sessionId }}
</a-descriptions-item>
</a-descriptions>
</a-drawer>
</template>

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',
},