<template> <div class="OperationLog"> <a-table :columns="columns" :dataSource="logData" size="default" rowKey="id" :pagination="pagination" @change="handleTableChange"> <span slot="title"></span> <span slot="createBy" slot-scope="createBy"> {{ createBy ? createBy : '系统操作' }} </span> <span slot="remoteAddr"></span> <span slot="createTime"></span> </a-table> </div> </template> <script> import { config } from './../../../api/config.js' import { $http } from './../../../api/axios.js' export default { name: 'operationLog', data () { return { pagination: { current: 1, defaultCurrent: 1, defaultPageSize: 10, hideOnSinglePage: true, total: 0 }, columns: [{ title: '日志类型', dataIndex: 'title' }, { title: '操作人', dataIndex: 'createBy', scopedSlots: { customRender: 'createBy' } }, { title: 'IP地址', dataIndex: 'remoteAddr' }, { title: '操作时间', dataIndex: 'createTime' }], logData: [] } }, created: function () { this.queryLog() }, methods: { queryLog () { let queryLogData = { desc: 'create_time', serviceId: 'mingpay-web', current: this.pagination.current, size: this.pagination.defaultPageSize } $http.get(`/mingpay/v1/log/query`, queryLogData).then((res) => { if (res.data.resultCode === 0) { this.pagination.total = res.data.data.total this.logData = res.data.data.records } else { this.$message.error('获取日志信息失败') } }).catch(() => { this.$message.error('获取日志信息失败') }) }, handleTableChange (pagination, filters, sorter) { this.pagination.current = pagination.current this.queryLog() } } } </script> <style lang="less" scoped> </style>