Files
api-client/src/views/personnelManagement/accessLogManagement/index.vue

135 lines
4.8 KiB
Vue
Raw Normal View History

2025-05-07 20:35:49 +08:00
<template>
<div class="accessLogManagement-container">
2026-04-22 19:20:32 +08:00
<el-tabs v-model="queryForm.appId" type="card" @tab-click="handleTabClick">
<el-tab-pane v-for="item in applicationList" :key="item.id" :label="item.name" :name="item.id" />
</el-tabs>
2025-05-07 20:35:49 +08:00
<vab-query-form>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item>
<el-input v-model.trim="queryForm.permission" clearable placeholder="请输入查询条件" />
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
</el-form-item>
</el-form>
</vab-query-form-right-panel>
</vab-query-form>
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText" @selection-change="setSelectRows">
<el-table-column show-overflow-tooltip type="selection" />
<el-table-column align="center" label="IP" prop="ip" show-overflow-tooltip />
<el-table-column align="center" label="地址" prop="address" show-overflow-tooltip />
2025-05-16 15:55:26 +08:00
<el-table-column align="center" label="创建时间" show-overflow-tooltip>
<template #default="{ row }">
{{ formatTime(row.createdAt) }}
</template>
</el-table-column>
<el-table-column align="center" label="类型" show-overflow-tooltip>
<template #default="{ row }">
2026-04-22 19:13:28 +08:00
<el-tag v-if="row.platform.includes('weixin')" type="success">微信小程序</el-tag>
2025-05-16 15:55:26 +08:00
<el-tag v-else type="info">后台</el-tag>
</template>
</el-table-column>
2025-05-07 20:35:49 +08:00
<el-table-column align="center" label="url" prop="url" show-overflow-tooltip />
<el-table-column align="center" label="应用" show-overflow-tooltip>
<template slot-scope="{ row }">
{{ row.appName || row.addId }}
</template>
</el-table-column>
<el-table-column align="center" label="用户" show-overflow-tooltip>
<template slot-scope="{ row }">
{{ row.userName || row.userId }}
</template>
</el-table-column>
2026-04-22 19:13:28 +08:00
<el-table-column align="center" label="method" prop="method" show-overflow-tooltip width="80" />
<el-table-column align="center" label="statusCode" prop="statusCode" show-overflow-tooltip width="100" />
<el-table-column align="center" label="耗时(ms)" prop="duration" show-overflow-tooltip width="100" />
<el-table-column align="center" label="平台" prop="platform" show-overflow-tooltip width="100" />
2025-05-07 20:35:49 +08:00
<el-table-column align="center" label="userAgent" prop="userAgent" show-overflow-tooltip />
<el-table-column align="center" label="referrer" prop="referrer" show-overflow-tooltip />
2026-04-22 19:13:28 +08:00
<el-table-column align="center" label="body" prop="body" show-overflow-tooltip />
2025-05-07 20:35:49 +08:00
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</template>
<script>
import { getList } from '@/api/accessLogManagement'
2026-04-22 19:20:32 +08:00
import { getList as getApplicationList } from '@/api/appManagement'
2025-05-07 20:35:49 +08:00
import { formatTime } from '@/utils'
export default {
name: 'AccessLogManagement',
data() {
return {
list: null,
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
selectRows: '',
elementLoadingText: '正在加载...',
queryForm: {
2026-04-22 19:20:32 +08:00
appId: '',
2025-05-07 20:35:49 +08:00
pageNo: 1,
pageSize: 10,
permission: '',
},
2026-04-22 19:20:32 +08:00
applicationList: [],
2025-05-07 20:35:49 +08:00
timeOutID: null,
}
},
created() {
2026-04-22 19:20:32 +08:00
this.fetchApplicationList()
2025-05-07 20:35:49 +08:00
this.fetchData()
},
beforeDestroy() {
clearTimeout(this.timeOutID)
},
methods: {
2026-04-22 19:20:32 +08:00
async fetchApplicationList() {
const { data } = await getApplicationList({ pageNo: 1, pageSize: 100 })
this.applicationList = data.list
},
handleTabClick() {
this.queryData()
},
2025-05-16 15:55:26 +08:00
formatTime,
2025-05-07 20:35:49 +08:00
setSelectRows(val) {
this.selectRows = val
},
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
queryData() {
this.queryForm.pageNo = 1
this.fetchData()
},
async fetchData() {
this.listLoading = true
const { data } = await getList(this.queryForm)
this.list = data.list
this.total = data.totalCount
this.timeOutID = setTimeout(() => {
this.listLoading = false
}, 300)
},
},
}
</script>