xw_admin/src/views/setting/log/components/command.vue

98 lines
2.4 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>
</div>
<div class="exportBtn">
<scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="32">
<el-button v-auth="'sysLogCommandExport'" :size="size" :disabled="exportShow" icon="sc-icon-Download" @click="exportData">导出</el-button>
</scExport>
</div>
</div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe border :size="size" highlightCurrentRow @row-click="rowClick">
</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.commandLog,
column:[]
},
exportShow:false,
searchList:[
{name:'操作日期',type:'date',code:'created_at',show:true},
{name:'关键字',type:'text',code:['job_name','content'],keyword:true,show:true},
],
params: {},
}
},
provide(){
return{
columnHeaderParams:false,
}
},
methods: {
getSelectData(item){
let {params} = item;
this.params = params;
},
// 下载导出
exportChangeShow(params){
if(params.type == 32){
this.exportShow = params.status==0?true:false
}
},
async exportData() {
if(this.exportShow) return
const res = await this.$API.system.log.commandExport.post(this.params);
if(res.code == 200){
this.exportShow = true;
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>