【优化】增强访问日志,支持是否记录、脱敏、操作信息等功能

This commit is contained in:
YunaiV 2024-04-03 19:55:54 +08:00
parent ffc81621d7
commit 757281ce34
3 changed files with 28 additions and 5 deletions

View File

@ -8,11 +8,15 @@ export interface ApiAccessLogVO {
applicationName: string applicationName: string
requestMethod: string requestMethod: string
requestParams: string requestParams: string
responseBody: string
requestUrl: string requestUrl: string
userIp: string userIp: string
userAgent: string userAgent: string
operateModule: string
operateName: string
operateType: number
beginTime: Date beginTime: Date
endTIme: Date endTime: Date
duration: number duration: number
resultCode: number resultCode: number
resultMsg: string resultMsg: string

View File

@ -26,6 +26,9 @@
<el-descriptions-item label="请求参数"> <el-descriptions-item label="请求参数">
{{ detailData.requestParams }} {{ detailData.requestParams }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="请求结果">
{{ detailData.responseBody }}
</el-descriptions-item>
<el-descriptions-item label="请求时间"> <el-descriptions-item label="请求时间">
{{ formatDate(detailData.beginTime) }} ~ {{ formatDate(detailData.endTime) }} {{ formatDate(detailData.beginTime) }} ~ {{ formatDate(detailData.endTime) }}
</el-descriptions-item> </el-descriptions-item>
@ -36,6 +39,15 @@
失败 | {{ detailData.resultCode }} | {{ detailData.resultMsg }} 失败 | {{ detailData.resultCode }} | {{ detailData.resultMsg }}
</div> </div>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="操作模块">
{{ detailData.operateModule }}
</el-descriptions-item>
<el-descriptions-item label="操作名">
{{ detailData.operateName }}
</el-descriptions-item>
<el-descriptions-item label="操作名">
<dict-tag :type="DICT_TYPE.SYSTEM_OPERATE_TYPE" :value="detailData.operateType" />
</el-descriptions-item>
</el-descriptions> </el-descriptions>
</Dialog> </Dialog>
</template> </template>

View File

@ -91,16 +91,16 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="日志编号" align="center" prop="id" /> <el-table-column label="日志编号" align="center" prop="id" width="100" fix="right" />
<el-table-column label="用户编号" align="center" prop="userId" /> <el-table-column label="用户编号" align="center" prop="userId" />
<el-table-column label="用户类型" align="center" prop="userType"> <el-table-column label="用户类型" align="center" prop="userType">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" /> <dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="应用名" align="center" prop="applicationName" /> <el-table-column label="应用名" align="center" prop="applicationName" width="150" />
<el-table-column label="请求方法" align="center" prop="requestMethod" width="80" /> <el-table-column label="请求方法" align="center" prop="requestMethod" width="80" />
<el-table-column label="请求地址" align="center" prop="requestUrl" width="250" /> <el-table-column label="请求地址" align="center" prop="requestUrl" width="500" />
<el-table-column label="请求时间" align="center" prop="beginTime" width="180"> <el-table-column label="请求时间" align="center" prop="beginTime" width="180">
<template #default="scope"> <template #default="scope">
<span>{{ formatDate(scope.row.beginTime) }}</span> <span>{{ formatDate(scope.row.beginTime) }}</span>
@ -114,7 +114,14 @@
{{ scope.row.resultCode === 0 ? '成功' : '失败(' + scope.row.resultMsg + ')' }} {{ scope.row.resultCode === 0 ? '成功' : '失败(' + scope.row.resultMsg + ')' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作模块" align="center" prop="operateModule" width="180" />
<el-table-column label="操作名" align="center" prop="operateName" width="180" />
<el-table-column label="操作类型" align="center" prop="operateType">
<template #default="scope">
<dict-tag :type="DICT_TYPE.SYSTEM_OPERATE_TYPE" :value="scope.row.operateType" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="60">
<template #default="scope"> <template #default="scope">
<el-button <el-button
link link