增加日子检索和导出

This commit is contained in:
龙运模 2024-07-13 19:09:38 +08:00
parent 1d11e683a5
commit 88193f9c57
5 changed files with 67 additions and 36 deletions

View File

@ -391,6 +391,20 @@ export default {
return await http.post(this.url, params); return await http.post(this.url, params);
}, },
}, },
operation: {
url: `${config.API_URL}/sys.log.operation.list`,
name: "日志操作功能",
post: async function (params) {
return await http.post(this.url, params);
},
},
export:{
url: `${config.API_URL}/sys.log.export`,
name: "操作日志导出",
post: async function (params) {
return await http.post(this.url,params);
}
}
}, },
table: { table: {
list: { list: {

View File

@ -1,6 +1,6 @@
<template> <template>
<el-popover <el-popover
placement="bottom-start" placement="bottom-end"
title="" title=""
trigger="click" trigger="click"
content="" content=""
@ -43,7 +43,7 @@ export default {
}, },
methods:{ methods:{
getWsResult(res){ getWsResult(res){
if(res.data && res.data.type == 6){ if(res.data && (res.data.type == 6 || res.data.type == 7 || res.data.type == 8)){
if(res.data.status == 0){ if(res.data.status == 0){
this.exportVisible = true; this.exportVisible = true;
} }
@ -54,6 +54,7 @@ export default {
this.down(res.data); this.down(res.data);
} }
} }
}, },
down(item){ down(item){
const link = document.createElement('a'); const link = document.createElement('a');

View File

@ -7,7 +7,7 @@
<div class="searchItem" v-if="item.type =='multiple' && ((item.isOpen && item.show) || item.show)"> <div class="searchItem" v-if="item.type =='multiple' && ((item.isOpen && item.show) || item.show)">
<label class="name">{{item.name}}</label> <label class="name">{{item.name}}</label>
<scMultipleSelect :size="size" v-model:activation_select="params[item.code]" @fetchData="getSelect(item,$event)" :placeholder="item.placeholder" multiple collapse-tags filterable clearable> <scMultipleSelect :size="size" v-model:activation_select="params[item.code]" @fetchData="getSelect(item,$event)" :placeholder="item.placeholder" multiple collapse-tags filterable clearable>
<el-option v-for="em in item.data" :key="em" :label="em.full_name" :value="em.id"></el-option> <el-option v-for="em in item.data" :key="em" :label="em.label" :value="em.id"></el-option>
</scMultipleSelect> </scMultipleSelect>
</div> </div>
<div class="searchItem" v-if="item.type == 'select' && ((item.isOpen && item.show) || item.show)"> <div class="searchItem" v-if="item.type == 'select' && ((item.isOpen && item.show) || item.show)">

View File

@ -115,6 +115,11 @@ export default {
async getCompanyList(data,params) { async getCompanyList(data,params) {
const res = await this.$API.system.company.select.post(params); const res = await this.$API.system.company.select.post(params);
if(res.data && res.data.length>0){
res.data.forEach(item=>{
item.label = item.full_name;
})
}
if(res.code == 200){ if(res.code == 200){
this.searchList.forEach(item=>{ this.searchList.forEach(item=>{
if(item.code == data.code){ if(item.code == data.code){

View File

@ -2,31 +2,12 @@
<el-container class="mainBox mainBoxHeaderNoBorder"> <el-container class="mainBox mainBoxHeaderNoBorder">
<el-main class="nopadding"> <el-main class="nopadding">
<div class="searchMain"> <div class="searchMain">
<div class="searchItem"> <scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
<label class="name">时间</label>
<el-date-picker class="input" type="daterange" :size="size" v-model="params.date" :popper-options="{ placement: 'bottom-start' }" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" clearable></el-date-picker>
</div>
<div class="searchItem">
<label class="name">业务端</label>
<el-select class="input" :size="size" v-model="params.id" @visible-change="getCompanyList" placeholder="请选择业务" filterable clearable>
<el-option v-for="item in setMap.name" :key="item" :label="item.full_name" :value="item.id"></el-option>
</el-select>
</div>
<div class="searchItem">
<label class="name">操作功能</label>
<el-select class="input" :size="size" v-model="params.id" @visible-change="getCompanyList" placeholder="请选择功能" filterable clearable>
<el-option v-for="item in setMap.name" :key="item" :label="item.full_name" :value="item.id"></el-option>
</el-select>
</div>
<div class="searchItem">
<label class="name">操作日志</label>
<el-select class="input" :size="size" v-model="params.id" @visible-change="getCompanyList" placeholder="请选择日志" filterable clearable>
<el-option v-for="item in setMap.name" :key="item" :label="item.full_name" :value="item.id"></el-option>
</el-select>
</div>
<div class="searchItem searchBtn"> <div class="searchItem searchBtn">
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button> <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> <el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
<scExport :size="size" @exportData="exportData"></scExport>
</div> </div>
</div> </div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick"> <scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick">
@ -61,27 +42,57 @@
apiObj: this.$API.system.log.list, apiObj: this.$API.system.log.list,
column:[] column:[]
}, },
params: { searchList:[
date:"", {name:'操作日期',type:'date',code:'created_at'},
id: "", {name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true},
} {name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true},
],
params: {}
} }
}, },
methods: { methods: {
getCompanyList(e){ getSelectData(item){
if(!e) return 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;
}
})
}
},
async exportData() {
const res = await this.$API.system.log.export.post(this.params);
if(res.code == 200){
this.$message.success('开始导出');
}
},
upSearch(){ upSearch(){
this.$refs.table.upData(this.params); this.$refs.table.upData(this.params);
}, },
reset(){ reset(){
this.params = {};
this.$refs.scSearch.reload();
this.$refs.table.reload(); this.$refs.table.reload();
}, },
rowClick(row){ rowClick(){
this.infoDrawer = true // row
this.$nextTick(() => { // this.infoDrawer = true
this.$refs.info.setData(row) // this.$nextTick(() => {
}) // this.$refs.info.setData(row)
// })
} }
} }
} }