cma_search/client/src/views/ability/queryrecord.vue

109 lines
2.9 KiB
Python

<template>
<div class="app-container">
<div>
<el-input
v-model="listQuery.search"
placeholder="用户名"
style="width: 400px;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button
class="filter-item"
style="margin-left: 10px;"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData.results"
style="width: 100%;margin-top:10px;"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column label="访问时间">
<template slot-scope="scope">
<span>{{ scope.row.create_time }}</span>
</template>
</el-table-column>
<el-table-column label="用户">
<template slot-scope="scope" v-if="scope.row.user_">{{ scope.row.user_.name }}</template>
</el-table-column>
<el-table-column label="部门">
<template slot-scope="scope" v-if="scope.row.user_">{{ scope.row.user_.dept }}</template>
</el-table-column>
<el-table-column label="访问地址">
<template slot-scope="scope">{{ scope.row.path }}</template>
</el-table-column>
<el-table-column label="ip地址">
<template slot-scope="scope">{{ scope.row.ip }}</template>
</el-table-column>
<el-table-column label="查询字符">
<template slot-scope="scope">{{ scope.row.search }}</template>
</el-table-column>
</el-table>
<pagination
v-show="tableData.count>0"
:total="tableData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</div>
</template>
<script>
import { getRecord } from "@/api/queryrecord"
import Pagination from "@/components/Pagination"
export default {
components: { Pagination },
data() {
return {
tableData: {count:0},
listLoading: true,
listQuery: {
page: 1,
page_size: 20
},
};
},
created() {
this.getList();
},
methods: {
getList() {
this.listLoading = true;
getRecord(this.listQuery).then(response => {
if (response.data) {
this.tableData = response.data
}
this.listLoading = false;
});
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
};
this.getList();
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
}
};
</script>