mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-12-31 22:57:17 +08:00
优化:聚合日志相关 API,封装 date-range-picker 组件并优化部分细节
This commit is contained in:
@@ -25,12 +25,7 @@
|
||||
field="createTime"
|
||||
hide-label
|
||||
>
|
||||
<a-range-picker
|
||||
v-model="queryFormData.createTime"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
show-time
|
||||
style="width: 100%"
|
||||
/>
|
||||
<date-range-picker v-model="queryFormData.createTime" />
|
||||
</a-form-item>
|
||||
<a-button type="primary" @click="toQuery">
|
||||
<template #icon>
|
||||
@@ -85,7 +80,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { queryLoginLogList, LoginLogRecord, LoginLogParams } from '@/api/monitor/login-log';
|
||||
import { queryLoginLogList, LoginLogRecord, LoginLogParams } from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
@@ -135,9 +130,10 @@
|
||||
title: '登录状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '登录IP',
|
||||
title: '登录 IP',
|
||||
dataIndex: 'clientIp',
|
||||
},
|
||||
{
|
||||
@@ -153,6 +149,8 @@
|
||||
dataIndex: 'createTime',
|
||||
},
|
||||
]);
|
||||
|
||||
// 查询列表
|
||||
const fetchData = async (
|
||||
params: LoginLogParams = { page: 1, size: 10, sort: ['createTime,desc'] }
|
||||
) => {
|
||||
@@ -162,8 +160,6 @@
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
} catch (err) {
|
||||
// you can report use errorHandler or other
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -37,12 +37,7 @@
|
||||
field="createTime"
|
||||
hide-label
|
||||
>
|
||||
<a-range-picker
|
||||
v-model="queryFormData.createTime"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
show-time
|
||||
style="width: 100%"
|
||||
/>
|
||||
<date-range-picker v-model="queryFormData.createTime" />
|
||||
</a-form-item>
|
||||
<a-button type="primary" @click="toQuery">
|
||||
<template #icon>
|
||||
@@ -97,7 +92,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { queryOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/operation-log';
|
||||
import { queryOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
@@ -152,9 +147,10 @@
|
||||
title: '操作状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作IP',
|
||||
title: '操作 IP',
|
||||
dataIndex: 'clientIp',
|
||||
},
|
||||
{
|
||||
@@ -166,6 +162,8 @@
|
||||
dataIndex: 'browser',
|
||||
},
|
||||
]);
|
||||
|
||||
// 查询列表
|
||||
const fetchData = async (
|
||||
params: OperationLogParams = { page: 1, size: 10, sort: ['createTime,desc'] }
|
||||
) => {
|
||||
@@ -175,8 +173,6 @@
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
} catch (err) {
|
||||
// you can report use errorHandler or other
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -7,12 +7,7 @@
|
||||
<a-col :span="24">
|
||||
<a-form ref="queryFormRef" :model="queryFormData" layout="inline">
|
||||
<a-form-item field="createTime" hide-label>
|
||||
<a-range-picker
|
||||
v-model="queryFormData.createTime"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
show-time
|
||||
style="width: 100%"
|
||||
/>
|
||||
<date-range-picker v-model="queryFormData.createTime" />
|
||||
</a-form-item>
|
||||
<a-button type="primary" @click="toQuery">
|
||||
<template #icon>
|
||||
@@ -88,7 +83,7 @@
|
||||
<template #title>日志详情</template>
|
||||
<div style="margin: 10px 0 0 10px">
|
||||
<a-descriptions title="基础信息" :column="2" bordered>
|
||||
<a-descriptions-item label="客户端IP">
|
||||
<a-descriptions-item label="客户端 IP">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :widths="['200px']" :rows="1" />
|
||||
</a-skeleton>
|
||||
@@ -100,7 +95,7 @@
|
||||
</a-skeleton>
|
||||
<span v-else>{{ renderDetailData.browser }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="IP归属地">
|
||||
<a-descriptions-item label="IP 归属地">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :widths="['200px']" :rows="1" />
|
||||
</a-skeleton>
|
||||
@@ -149,7 +144,7 @@
|
||||
</a-skeleton>
|
||||
<span v-else>{{ renderDetailData.requestMethod }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="请求URL" :span="2">
|
||||
<a-descriptions-item label="请求 URL" :span="2">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
@@ -201,7 +196,6 @@
|
||||
<a-space v-else>
|
||||
<VueJsonPretty
|
||||
v-if="renderDetailData.requestHeaders"
|
||||
:path="'res'"
|
||||
:data="JSON.parse(renderDetailData.requestHeaders)"
|
||||
:show-length="true" />
|
||||
<span v-else>无</span>
|
||||
@@ -237,7 +231,7 @@
|
||||
querySystemLogList,
|
||||
SystemLogRecord,
|
||||
SystemLogParams,
|
||||
} from '@/api/monitor/system-log';
|
||||
} from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { FormInstance } from '@arco-design/web-vue/es/form';
|
||||
@@ -253,7 +247,6 @@
|
||||
const renderData = ref<SystemLogRecord[]>([]);
|
||||
const renderDetailData = ref<SystemLogDetailRecord>({
|
||||
logId: '',
|
||||
description: '',
|
||||
requestUrl: '',
|
||||
requestMethod: '',
|
||||
requestHeaders: '',
|
||||
@@ -265,7 +258,6 @@
|
||||
clientIp: '',
|
||||
location: '',
|
||||
browser: '',
|
||||
createUserString: '',
|
||||
createTime: '',
|
||||
});
|
||||
|
||||
@@ -290,22 +282,24 @@
|
||||
title: '状态码',
|
||||
dataIndex: 'statusCode',
|
||||
slotName: 'statusCode',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '请求方式',
|
||||
dataIndex: 'requestMethod',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '请求URI',
|
||||
title: '请求 URI',
|
||||
dataIndex: 'requestUrl',
|
||||
slotName: 'requestUrl',
|
||||
},
|
||||
{
|
||||
title: '客户端IP',
|
||||
title: '客户端 IP',
|
||||
dataIndex: 'clientIp',
|
||||
},
|
||||
{
|
||||
title: 'IP归属地',
|
||||
title: 'IP 归属地',
|
||||
dataIndex: 'location',
|
||||
},
|
||||
{
|
||||
@@ -316,6 +310,7 @@
|
||||
title: '请求耗时',
|
||||
dataIndex: 'elapsedTime',
|
||||
slotName: 'elapsedTime',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
@@ -324,6 +319,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
slotName: 'operations',
|
||||
align: 'center',
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, reactive } from "vue";
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import { useLoginStore } from '@/store';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { queryOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/operation-log';
|
||||
import { queryOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
|
||||
@@ -78,9 +78,10 @@
|
||||
title: '操作状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作IP',
|
||||
title: '操作 IP',
|
||||
dataIndex: 'clientIp',
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user