<template> <div> <el-radio-group v-model="type" style="padding: 5px 50px;margin-bottom: 10px" @change="fetchData(false)"> <el-radio label="水下机器人交互日志">水下机器人交互日志</el-radio> <el-radio label="岸基控制交互日志">岸基控制交互日志</el-radio> <el-radio label="系统操作日志">系统操作日志</el-radio> </el-radio-group> <normal-table :data="list" :total="total" :columns="columns" :query="listQuery" :list-loading="listLoading" @change="changePage"> <template slot="columns"/> </normal-table> </div> </template> <script> import { getBizLogList, getBizLogDetail, getLogType, delLog } from '@/api/system/log' export default { name: 'Log', components: {}, data() { return { type:'水下机器人交互日志', listQuery: { keywords: '', beginTime: '', endTime: '', logType: '业务日志', offset: 1, limit: '10', sort: '', order: '' }, columns: [ { text: '日志名称', value: 'logName', width: 150 }, { text: '用户', value: 'userName' }, { text: '时间', value: 'createTime' }, { text: '详细信息', value: 'message' } ], list: [], total: 10, logTypeList: null, listLoading: true, dialogFormVisible: false, dialogStatus: '' } }, created() { this.fetchData(false) }, methods: { fetchData(isNowPage = true) { this.listLoading = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 this.listQuery.offset = 1 } if(this.type==='水下机器人交互日志'){ }else if(this.type==='岸基控制交互日志'){ }else if(this.type==='系统操作日志'){ getBizLogList(this.listQuery).then(response => { this.list = response.data.rows if(this.list.length>10) this.list.length = 10 //后端bug this.total = parseInt(response.data.total) this.listLoading = false }) } }, // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 changePage(val) { if (val && val.size) { this.listQuery.limit = val.size } if (val && val.page) { this.listQuery.offset = val.page } this.fetchData() } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> </style>