Vue3 重构:REVIEW API 日志

pull/41/MERGE
YunaiV 2023-03-23 23:37:15 +08:00
parent 3575e6adbb
commit 12b60da942
3 changed files with 18 additions and 18 deletions

View File

@ -18,6 +18,7 @@ export interface ApiAccessLogVO {
resultMsg: string
createTime: Date
}
// 查询列表API 访问日志
export const getApiAccessLogPage = (params: PageParam) => {
return request.get({ url: '/infra/api-access-log/page', params })

View File

@ -1,11 +1,5 @@
<template>
<Dialog
title="API 访问日志详细"
v-model="modelVisible"
:scroll="true"
:max-height="500"
width="800"
>
<Dialog title="详情" v-model="modelVisible" :scroll="true" :max-height="500" width="800">
<el-descriptions border :column="1">
<el-descriptions-item label="日志主键" min-width="120">
{{ detailData.id }}
@ -17,20 +11,26 @@
{{ detailData.applicationName }}
</el-descriptions-item>
<el-descriptions-item label="用户信息">
{{ detailData.userId }} |
{{ detailData.userId }}
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="detailData.userType" />
| {{ detailData.userIp }} | {{ detailData.userAgent }}
</el-descriptions-item>
<el-descriptions-item label="用户 IP">
{{ detailData.userIp }}
</el-descriptions-item>
<el-descriptions-item label="用户 UA">
{{ detailData.userAgent }}
</el-descriptions-item>
<el-descriptions-item label="请求信息">
{{ detailData.requestMethod }} | {{ detailData.requestUrl }}
{{ detailData.requestMethod }} {{ detailData.requestUrl }}
</el-descriptions-item>
<el-descriptions-item label="请求参数">
{{ detailData.requestParams }}
</el-descriptions-item>
<el-descriptions-item label="开始时间">
<el-descriptions-item label="请求时间">
{{ formatDate(detailData.beginTime, 'YYYY-MM-DD HH:mm:ss') }} ~
{{ formatDate(detailData.endTime, 'YYYY-MM-DD HH:mm:ss') }} | {{ detailData.duration }} ms
{{ formatDate(detailData.endTime, 'YYYY-MM-DD HH:mm:ss') }}
</el-descriptions-item>
<el-descriptions-item label="请求耗时">{{ detailData.duration }} ms</el-descriptions-item>
<el-descriptions-item label="操作结果">
<div v-if="detailData.resultCode === 0"></div>
<div v-else-if="detailData.resultCode > 0"
@ -51,7 +51,7 @@ const detailLoading = ref(false) // 表单地加载中
const detailData = ref() //
/** 打开弹窗 */
const openModal = async (data: ApiAccessLog.ApiAccessLogVO) => {
const open = async (data: ApiAccessLog.ApiAccessLogVO) => {
modelVisible.value = true
//
detailLoading.value = true
@ -62,5 +62,5 @@ const openModal = async (data: ApiAccessLog.ApiAccessLogVO) => {
}
}
defineExpose({ openModal }) // openModal
defineExpose({ open }) // open
</script>

View File

@ -85,6 +85,7 @@
</el-form-item>
</el-form>
</content-wrap>
<!-- 列表 -->
<content-wrap>
<el-table v-loading="loading" :data="list">
@ -96,7 +97,7 @@
</template>
</el-table-column>
<el-table-column label="应用名" align="center" prop="applicationName" />
<el-table-column label="请求方法" align="center" prop="requestMethod" />
<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="beginTime" width="180">
<template #default="scope">
@ -128,7 +129,6 @@
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<Pagination
:total="total"
@ -154,7 +154,6 @@ const message = useMessage() // 消息弹窗
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -169,7 +168,7 @@ const queryParams = reactive({
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询参数列表 */
/** 查询列表 */
const getList = async () => {
loading.value = true
try {