add
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<div class="filter-bar">
|
||||
<el-input v-model="filters.admin_id" placeholder="管理员 ID" clearable style="width: 160px"
|
||||
@keyup.enter="search" />
|
||||
<el-input v-model="filters.action" placeholder="操作类型(精确匹配)" clearable style="width: 220px"
|
||||
@keyup.enter="search" />
|
||||
<el-button type="primary" :icon="Search" @click="search">查询</el-button>
|
||||
<el-button :icon="Refresh" @click="reset">重置</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" :data="rows" border stripe>
|
||||
<el-table-column prop="id" label="ID" width="90" />
|
||||
<el-table-column prop="admin_id" label="管理员 ID" width="110" />
|
||||
<el-table-column prop="admin_name" label="管理员" width="140" />
|
||||
<el-table-column prop="action" label="操作类型" width="160" />
|
||||
<el-table-column prop="target" label="操作对象" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="detail" label="详情" min-width="240" class-name="cell-wrap" />
|
||||
<el-table-column prop="ip" label="IP" width="140" />
|
||||
<el-table-column prop="created_at" label="操作时间" width="180" />
|
||||
<template #empty><el-empty description="暂无数据" /></template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrap">
|
||||
<el-pagination v-model:current-page="page" :page-size="pageSize" :total="total"
|
||||
layout="total, prev, pager, next" @current-change="load" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Refresh, Search } from '@element-plus/icons-vue'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
||||
import { listLogs } from '@/api/logs'
|
||||
|
||||
const loading = ref(false)
|
||||
const rows = ref([])
|
||||
const total = ref(0)
|
||||
const page = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const filters = reactive({ admin_id: '', action: '' })
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await listLogs({
|
||||
admin_id: filters.admin_id,
|
||||
action: filters.action,
|
||||
page: page.value,
|
||||
page_size: pageSize.value,
|
||||
})
|
||||
rows.value = data.list || []
|
||||
total.value = data.total || 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function search() {
|
||||
page.value = 1
|
||||
load()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
filters.admin_id = ''
|
||||
filters.action = ''
|
||||
search()
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
Reference in New Issue
Block a user