增加用户操作日志

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); 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:{ subscribe:{
list:{ list:{
url: `${config.API_URL}/messages.subscribe.list`, url: `${config.API_URL}/messages.subscribe.list`,

View File

@ -1,15 +1,18 @@
<template> <template>
<el-card shadow="never" header="近7天操作记录"> <el-card class="logCard" shadow="never" header="操作日志">
<scTable ref="table" :data="data" height="auto" paginationLayout="total, prev, pager, next" hideDo> <el-main class="nopadding">
<sc-table-column label="序号" type="index"></sc-table-column> <div class="searchMain">
<sc-table-column label="业务名称" prop="title" min-width="240"></sc-table-column> <scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
<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>
</scTable> <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> </el-card>
</template> </template>
@ -17,24 +20,58 @@
export default { export default {
data() { data() {
return { return {
data: [ size:"small",
{ list:{
title: "修改用户 lolowan", apiObj: this.$API.user.log,
ip: "211.187.11.18", column: [],
code: "成功", },
time: "2022-10-10 08:41:17"
}, searchList:[
{ {name:'操作日期',type:'date',code:'created_at'},
title: "用户登录", {name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true},
ip: "211.187.11.18", {name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true},
code: "成功", ],
time: "2022-10-10 08:21:51" 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> </script>
<style> <style lang="scss" scoped>
.logCard :deep(.el-card__body){padding: 0 !important;}
</style> </style>