日志添加关键词搜索

This commit is contained in:
浅念
2025-10-24 16:28:37 +08:00
parent 37e75014d0
commit 926823df32
2 changed files with 44 additions and 24 deletions
+2 -1
View File
@@ -147,7 +147,8 @@
const { records, current, size, total } = await logService.getChangelogList({
current: currentPage,
size: pageSize
size: pageSize,
keyword: keyword.value
})
tableData.value = records.map((item: any) => ({
...item
+42 -23
View File
@@ -1,27 +1,36 @@
<template>
<div class="page-content">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="ID" prop="id" />
<ElTableColumn label="操作人" prop="user_name" />
<ElTableColumn label="请求路由" prop="route" />
<ElTableColumn label="用户ip" prop="ip" />
<ElTableColumn label="用户ua" prop="ua" />
<ElTableColumn label="入参摘要" prop="params_brief" />
<ElTableColumn label="异常" prop="message" />
<ElTableColumn label="创建时间" prop="created_at" />
</template>
</ArtTable>
<div class="customer-toolbar boxshadow">
<div class="customer-search-group">
<el-form-item label="关键字:" label-width="70px">
<el-input style="min-width: 120px" v-model="keyword" placeholder="请输入关键字" />
</el-form-item>
</div>
</div>
<div class="boxshadow">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="ID" prop="id" />
<ElTableColumn label="操作人" prop="user_name" />
<ElTableColumn label="请求路由" prop="route" />
<ElTableColumn label="用户ip" prop="ip" />
<ElTableColumn label="用户ua" prop="ua" />
<ElTableColumn label="入参摘要" prop="params_brief" />
<ElTableColumn label="异常" prop="message" />
<ElTableColumn label="创建时间" prop="created_at" />
</template>
</ArtTable>
</div>
</div>
</template>
@@ -31,6 +40,7 @@
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
defineOptions({ name: 'Operationlog' })
const keyword = ref('')
const loading = ref(false)
const pagination = reactive({
currentPage: 1,
@@ -46,6 +56,10 @@
onMounted(() => {
getWorkList()
})
watch([keyword], () => {
pagination.currentPage = 1
getWorkList()
})
// 处理表格分页变化
const handleSizeChange = (newPageSize: number) => {
pagination.pageSize = newPageSize
@@ -63,7 +77,8 @@
const { records, current, size, total } = await logService.getOperationLogList({
current: currentPage,
size: pageSize
size: pageSize,
keyword: keyword.value
})
tableData.value = records.map((item: any) => ({
...item
@@ -94,4 +109,8 @@
fill: currentcolor;
}
}
.customer-search-group {
display: flex;
gap: 12px;
}
</style>