refactor: 💥 适配 ContiNew Starter Log(日志模块)

1.continew-starter 1.0.1-SNAPSHOT => 1.1.0-SNAPSHOT
2.日志表结构及相关管理 UI 变更
This commit is contained in:
2023-12-17 14:07:44 +08:00
parent 349899b4fc
commit 9bf015059b
35 changed files with 308 additions and 893 deletions

View File

@@ -5,9 +5,10 @@ const BASE_URL = '/monitor/log';
export interface LogRecord {
id?: number;
clientIp: string;
location: string;
ip: string;
address: string;
browser: string;
os: string;
createTime: string;
}
@@ -22,7 +23,7 @@ export interface OperationLogRecord extends LogRecord {
module: string;
description: string;
status: number;
errorMsg: string;
errorMsgString: string;
createUserString: string;
}
@@ -30,8 +31,7 @@ export interface SystemLogRecord extends LogRecord {
statusCode: number;
requestMethod: string;
requestUrl: string;
elapsedTime: number;
exceptionDetail?: string;
timeTaken: number;
}
export interface SystemLogDetailRecord extends SystemLogRecord {

View File

@@ -7,9 +7,10 @@ export interface DataRecord {
token: string;
username: string;
nickname: string;
clientIp: string;
location: string;
ip: string;
address: string;
browser: string;
os: string;
loginTime: string;
}

View File

@@ -72,9 +72,10 @@
</a-tooltip>
</template>
</a-table-column>
<a-table-column title="登录 IP" data-index="clientIp" />
<a-table-column title="登录地点" data-index="location" />
<a-table-column title="登录 IP" data-index="ip" />
<a-table-column title="登录地点" data-index="address" />
<a-table-column title="浏览器" data-index="browser" />
<a-table-column title="终端系统" data-index="os" />
<a-table-column title="登录时间" data-index="createTime" />
</template>
</a-table>

View File

@@ -83,8 +83,8 @@
</a-tooltip>
</template>
</a-table-column>
<a-table-column title="操作 IP" data-index="clientIp" />
<a-table-column title="操作地点" data-index="location" />
<a-table-column title="操作 IP" data-index="ip" />
<a-table-column title="操作地点" data-index="address" />
<a-table-column title="浏览器" data-index="browser" />
</template>
</a-table>

View File

@@ -74,21 +74,21 @@
}}</span>
</template>
</a-table-column>
<a-table-column title="客户端 IP" data-index="clientIp" />
<a-table-column title="IP 归属地" data-index="location" />
<a-table-column title="IP" data-index="ip" />
<a-table-column title="地" data-index="address" />
<a-table-column title="浏览器" data-index="browser" />
<a-table-column title="请求耗时">
<a-table-column title="耗时">
<template #cell="{ record }">
<a-tag v-if="record.elapsedTime > 500" color="red"
>{{ record.elapsedTime }} ms</a-tag
<a-tag v-if="record.timeTaken > 500" color="red"
>{{ record.timeTaken }} ms</a-tag
>
<a-tag v-else-if="record.elapsedTime > 200" color="orange"
>{{ record.elapsedTime }} ms</a-tag
<a-tag v-else-if="record.timeTaken > 200" color="orange"
>{{ record.timeTaken }} ms</a-tag
>
<a-tag v-else color="green">{{ record.elapsedTime }} ms</a-tag>
<a-tag v-else color="green">{{ record.timeTaken }} ms</a-tag>
</template>
</a-table-column>
<a-table-column title="创建时间" data-index="createTime" />
<a-table-column title="请求时间" data-index="createTime" />
<a-table-column title="操作" align="center">
<template #cell="{ record }">
<a-button
@@ -99,15 +99,6 @@
>
<template #icon><icon-eye /></template>详情
</a-button>
<a-button
v-if="record.exceptionDetail"
type="text"
size="small"
title="查看异常详情"
@click="toExceptionDetail(record)"
>
<template #icon><icon-bug /></template>异常
</a-button>
</template>
</a-table-column>
</template>
@@ -125,11 +116,11 @@
>
<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="loading" :animation="true">
<a-skeleton-line :widths="['200px']" :rows="1" />
</a-skeleton>
<span v-else>{{ systemLog.clientIp }}</span>
<span v-else>{{ systemLog.ip }}</span>
</a-descriptions-item>
<a-descriptions-item label="浏览器">
<a-skeleton v-if="loading" :animation="true">
@@ -137,34 +128,40 @@
</a-skeleton>
<span v-else>{{ systemLog.browser }}</span>
</a-descriptions-item>
<a-descriptions-item label="IP 归属地">
<a-descriptions-item label="地">
<a-skeleton v-if="loading" :animation="true">
<a-skeleton-line :widths="['200px']" :rows="1" />
</a-skeleton>
<span v-else>{{ systemLog.location }}</span>
<span v-else>{{ systemLog.address }}</span>
</a-descriptions-item>
<a-descriptions-item label="请求耗时">
<a-descriptions-item label="操作系统">
<a-skeleton v-if="loading" :animation="true">
<a-skeleton-line :widths="['200px']" :rows="1" />
</a-skeleton>
<span v-else>
<a-tag v-if="systemLog.elapsedTime > 500" color="red">
{{ systemLog.elapsedTime }} ms
</a-tag>
<a-tag v-else-if="systemLog.elapsedTime > 200" color="orange">
{{ systemLog.elapsedTime }} ms
</a-tag>
<a-tag v-else color="green"
>{{ systemLog.elapsedTime }} ms</a-tag
>
</span>
<span v-else>{{ systemLog.os }}</span>
</a-descriptions-item>
<a-descriptions-item label="创建时间">
<a-descriptions-item label="请求时间">
<a-skeleton v-if="loading" :animation="true">
<a-skeleton-line :widths="['200px']" :rows="1" />
</a-skeleton>
<span v-else>{{ systemLog.createTime }}</span>
</a-descriptions-item>
<a-descriptions-item label="耗时">
<a-skeleton v-if="loading" :animation="true">
<a-skeleton-line :widths="['200px']" :rows="1" />
</a-skeleton>
<span v-else>
<a-tag v-if="systemLog.timeTaken > 500" color="red">
{{ systemLog.timeTaken }} ms
</a-tag>
<a-tag v-else-if="systemLog.timeTaken > 200" color="orange">
{{ systemLog.timeTaken }} ms
</a-tag>
<a-tag v-else color="green"
>{{ systemLog.timeTaken }} ms</a-tag
>
</span>
</a-descriptions-item>
</a-descriptions>
<a-descriptions
title="协议信息"
@@ -256,20 +253,6 @@
</a-descriptions>
</div>
</a-drawer>
<!-- 异常详情区域 -->
<a-modal
title="异常详情"
:visible="exceptionDetailVisible"
width="83%"
:footer="false"
top="30px"
unmount-on-close
render-to-body
@cancel="handleExceptionDetailCancel"
>
<pre>{{ exceptionDetail }}</pre>
</a-modal>
</a-card>
</div>
</template>
@@ -297,17 +280,16 @@
statusCode: 200,
responseHeaders: '',
responseBody: '',
elapsedTime: 0,
clientIp: '',
location: '',
timeTaken: 0,
ip: '',
address: '',
browser: '',
os: '',
createTime: '',
});
const total = ref(0);
const exceptionDetail = ref('');
const loading = ref(false);
const visible = ref(false);
const exceptionDetailVisible = ref(false);
const data = reactive({
// 查询参数
@@ -362,24 +344,6 @@
visible.value = false;
};
/**
* 查看异常详情
*
* @param record 记录信息
*/
const toExceptionDetail = async (record: SystemLogRecord) => {
exceptionDetail.value = record.exceptionDetail || '';
exceptionDetailVisible.value = true;
};
/**
* 关闭异常详情
*/
const handleExceptionDetailCancel = () => {
exceptionDetail.value = '';
exceptionDetailVisible.value = false;
};
/**
* 查询
*/

View File

@@ -63,9 +63,10 @@
{{ record.nickname }}{{ record.username }}
</template>
</a-table-column>
<a-table-column title="登录 IP" data-index="clientIp" />
<a-table-column title="登录地点" data-index="location" />
<a-table-column title="登录 IP" data-index="ip" />
<a-table-column title="登录地点" data-index="address" />
<a-table-column title="浏览器" data-index="browser" />
<a-table-column title="终端系统" data-index="os" />
<a-table-column title="登录时间" data-index="loginTime" />
<a-table-column
v-if="checkPermission(['monitor:online:user:delete'])"

View File

@@ -40,8 +40,8 @@
</a-tooltip>
</template>
</a-table-column>
<a-table-column title="操作 IP" data-index="clientIp" />
<a-table-column title="操作地点" data-index="location" />
<a-table-column title="操作 IP" data-index="ip" />
<a-table-column title="操作地点" data-index="address" />
<a-table-column title="浏览器" data-index="browser" />
</template>
<template #pagination-left>