增加用户操作日志

This commit is contained in:
龙运模 2024-07-16 20:00:05 +08:00
parent fc5453019f
commit 39caa09d1a
2 changed files with 69 additions and 25 deletions

View File

@ -86,6 +86,13 @@ export default {
return await http.post(this.url, params);
},
},
log:{
url: `${config.API_URL}/user.log.list`,
name: "用户操作日志",
get: async function (params) {
return await http.post(this.url, params);
},
},
subscribe:{
list:{
url: `${config.API_URL}/messages.subscribe.list`,

View File

@ -1,15 +1,18 @@
<template>
<el-card shadow="never" header="近7天操作记录">
<scTable ref="table" :data="data" height="auto" paginationLayout="total, prev, pager, next" hideDo>
<sc-table-column label="序号" type="index"></sc-table-column>
<sc-table-column label="业务名称" prop="title" min-width="240"></sc-table-column>
<sc-table-column label="IP" prop="ip" width="150"></sc-table-column>
<sc-table-column label="结果" prop="code" width="150">
<el-tag type="success">成功</el-tag>
</sc-table-column>
<sc-table-column label="操作时间" prop="time" width="150"></sc-table-column>
<el-card class="logCard" shadow="never" header="操作日志">
<el-main class="nopadding">
<div class="searchMain">
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
<div class="searchItem searchBtn">
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
</div>
</div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe :size="size">
<sc-table-column label="序号" type="index"></sc-table-column>
</scTable>
</el-main>
</el-card>
</template>
@ -17,24 +20,58 @@
export default {
data() {
return {
data: [
{
title: "修改用户 lolowan",
ip: "211.187.11.18",
code: "成功",
time: "2022-10-10 08:41:17"
size:"small",
list:{
apiObj: this.$API.user.log,
column: [],
},
{
title: "用户登录",
ip: "211.187.11.18",
code: "成功",
time: "2022-10-10 08:21:51"
searchList:[
{name:'操作日期',type:'date',code:'created_at'},
{name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true},
{name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true},
],
params: {},
}
]
},
mounted() {
},
methods:{
getSelectData(item){
let {data,params} = item;
this.params = params;
if(data.code == "type"){
this.getTypeList(data,params)
}
},
async getTypeList(data,params) {
const res = await this.$API.system.log.operation.post(params);
if(res.code == 200){
res.data.forEach(item=>{
item.id = item.type;
item.label = item.log_title;
})
this.searchList.forEach(item=>{
if(item.code == data.code){
item.data = res.data;
}
})
}
},
upSearch(){
this.$refs.table.upData(this.params);
},
reset(){
this.params = {};
this.$refs.scSearch.reload();
this.$refs.table.reload();
},
}
}
</script>
<style>
<style lang="scss" scoped>
.logCard :deep(.el-card__body){padding: 0 !important;}
</style>