init
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<div class="oper-log-wrap">
|
||||
<!-- 顶部搜索栏 -->
|
||||
<div class="top-search-bar">
|
||||
<div></div>
|
||||
<div class="search-box">
|
||||
<Input
|
||||
v-model="searchKeyword"
|
||||
placeholder="请输入用户名、IP、模块或详细操作"
|
||||
search
|
||||
style="width:460px"
|
||||
@on-search="handleSearch"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 自适应滚动表格容器 -->
|
||||
<div class="table-scroll-wrap">
|
||||
<Table
|
||||
border
|
||||
stripe
|
||||
:columns="tableColumns"
|
||||
:data="tableData"
|
||||
:height="useTableHeight()+32"
|
||||
></Table>
|
||||
</div>
|
||||
|
||||
<!-- 底部分栏:分页固定底部 -->
|
||||
<div class="page-bottom-bar">
|
||||
<div></div>
|
||||
<div class="page-wrap">
|
||||
<span style="margin-right:12px">共 {{ total }} 条</span>
|
||||
<Page
|
||||
:current.sync="pageNum"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
:page-size-opts="[10,20,50,100]"
|
||||
show-sizer
|
||||
@on-change="pageChange"
|
||||
@on-page-size-change="sizeChange"
|
||||
></Page>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { self_viewport } from "@/mixins/self_viewport";
|
||||
export default {
|
||||
name: 'OperationLogPage',
|
||||
data() {
|
||||
return {
|
||||
// 搜索关键词
|
||||
searchKeyword: '',
|
||||
|
||||
// 分页参数
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
|
||||
// 表格配置列
|
||||
tableColumns: [],
|
||||
// 模拟表格数据
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
mixins: [self_viewport],
|
||||
created() {
|
||||
this.initTableColumn()
|
||||
this.loadLogData()
|
||||
},
|
||||
methods: {
|
||||
// 初始化配置式表格列
|
||||
initTableColumn() {
|
||||
this.tableColumns = [
|
||||
{ title: '序号', type: 'index', align: 'center', width: 70 },
|
||||
{ title: '用户', key: 'operator', align: 'center', width: 130 },
|
||||
{ title: 'IP', key: 'ip', align: 'center', width: 150 },
|
||||
{ title: '模块', key: 'module', align: 'center', width: 160 },
|
||||
{ title: '详细操作', key: 'content', align: 'left' },
|
||||
{
|
||||
title: '时间',
|
||||
key: 'operateTime',
|
||||
align: 'center',
|
||||
width: 190,
|
||||
render: (h, params) => {
|
||||
return h("div", { style: "line-height: 56px" }, this.$utils.dateFormat(params.row.operateTime,'yyyy-MM-dd HH:mm:ss'));
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// 请求日志列表
|
||||
loadLogData() {
|
||||
const _this = this;
|
||||
var item = {
|
||||
keyword:_this.searchKeyword,
|
||||
page:_this.pageNum-1,
|
||||
size:_this.pageSize
|
||||
};
|
||||
_this.$api.get(APIConfig.BschClassSystem.getlogsearch, item, resp => {
|
||||
if (resp.code == 0) {
|
||||
_this.tableData = resp.data.content;
|
||||
_this.total=resp.data.total;
|
||||
} else {
|
||||
_this.tableData = [];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索
|
||||
handleSearch() {
|
||||
this.pageNum = 1
|
||||
this.loadLogData()
|
||||
},
|
||||
|
||||
// 页码切换
|
||||
pageChange(page) {
|
||||
this.pageNum = page
|
||||
this.loadLogData()
|
||||
},
|
||||
// 每页条数修改
|
||||
sizeChange(size) {
|
||||
this.pageSize = size
|
||||
this.pageNum = 1
|
||||
this.loadLogData()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.oper-log-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
/* 顶部搜索栏 */
|
||||
.top-search-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 14px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.search-box {
|
||||
width: 100%;
|
||||
background: #f7f7f7;
|
||||
padding: 10px 16px;
|
||||
height: 52px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* 表格自适应滚动区域 */
|
||||
.table-scroll-wrap {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.table-scroll-wrap >>> .ivu-table {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* 底部分页固定栏 */
|
||||
.page-bottom-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 14px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.page-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user