xw_admin/src/views/setting/log/index.vue
2024-07-23 23:21:24 +08:00

111 lines
2.9 KiB
Vue

<template>
<el-container class="mainBox mainBoxHeaderNoBorder">
<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>
<scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="8">
<el-button :size="size" icon="sc-icon-Download" @click="exportData">下载</el-button>
</scExport>
</div>
</div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick">
<sc-table-column label="序号" align="center" type="index"></sc-table-column>
</scTable>
</el-main>
</el-container>
<el-drawer v-model="infoDrawer" title="日志详情" :size="600" destroy-on-close>
<info ref="info"></info>
</el-drawer>
</template>
<script>
import info from './info'
export default {
components: {
info,
},
data() {
return {
size:"small",
setMap:{
name:[]
},
infoDrawer: false,
date: [],
list:{
apiObj: this.$API.system.log.list,
column:[]
},
exportShow:false,
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: {},
}
},
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;
}
})
}
},
// 下载导出
exportChangeShow(params){
if(params.type == 8){
this.exportShow = params.status==0?true:false
}
},
async exportData() {
if(this.exportShow) return
const res = await this.$API.system.log.export.post(this.params);
if(res.code == 200){
this.$message.success('开始导出');
}
},
upSearch(){
this.$refs.table.upData(this.params);
},
reset(){
this.params = {};
this.$refs.scSearch.reload();
this.$refs.table.reload();
},
rowClick(){
// row
// this.infoDrawer = true
// this.$nextTick(() => {
// this.$refs.info.setData(row)
// })
}
}
}
</script>
<style>
</style>