loginlog.vue
3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
<div class="manage-container deviceStatus-wrapper">
<el-row class="manage-head-wrapper">
<header class="title-header">
<span class="title">{{ $t('Management.LoginLog') }}</span>
</header>
</el-row>
<el-row class="manage-content">
<el-col :span="24">
<el-table
:data="tableData"
:max-height="tableHeight"
:empty-text="dataMsg"
class="data-compare-table"
style="width: 100%"
header-row-class-name="manage-tab-head"
>
<el-table-column align="center" :label="$t('table.order')" width="100" type="index"></el-table-column>
<el-table-column :label="$t('table.username')" align="center" prop="opLoginname"></el-table-column>
<el-table-column :label="$t('table.name')" align="center" prop="opUsername"></el-table-column>
<el-table-column :label="$t('table.blocName')" align="center" prop="accountName"></el-table-column>
<el-table-column label="IP" align="center" prop="opIp"></el-table-column>
<el-table-column :label="$t('table.loginTime')" align="center" prop="opTime"></el-table-column>
</el-table>
<el-pagination
class="manage-pagination-box"
background
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
@size-change="sizeChange"
@current-change="cerrentChange"
layout="sizes, prev, pager, next, slot"
:total="total"
>
<span
class="slot-pagination-ele slot-ele-total"
>{{$t('table.pageHead')}} {{ total }} {{$t('table.pageTail')}}</span>
</el-pagination>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
data() {
return {
tableData: [],
total: 0,
pageSize: 20,
currentPage: 1,
dataMsg: ""
};
},
computed: {
tableHeight() {
const windowInnerHeight = window.innerHeight;
return (
windowInnerHeight -
(windowInnerHeight <= 720
? windowInnerHeight * 0.26
: windowInnerHeight * 0.24)
);
}
},
mounted() {
this.dataMsg = this.$t("echartsTitle.loading");
this.getLoginLog();
},
methods: {
getLoginLog() {
this.dataMsg = this.$t("echartsTitle.loading");
this.$api.management
.loginLog({
accountId: this.$cookie.get("accountId"),
page: this.currentPage,
pageSize: this.pageSize,
sortName: "op_time",
sortOrder: "desc"
})
.then(res => {
let result = res.data.data;
this.tableData = result.list;
this.total = result.total;
this.tableData.length === 0 &&
(this.dataMsg = this.$t("echartsTitle.noData"));
})
.catch(error => {});
},
sizeChange(val) {
this.pageSize = val;
this.getLoginLog();
},
cerrentChange(val) {
if (this.currentPage != val) {
this.currentPage = val;
this.getLoginLog();
}
},
// 搜索
searchFun() {
this.currentPage = 1;
// this.getDeviceList();
}
}
};
</script>
<style scoped>
.manage-head-wrapper {
padding: 15px 12px 10px;
}
.title-header {
text-align: center;
padding-bottom: 10px;
}
.title {
line-height: 20px;
display: inline-block;
font-size: 20px;
vertical-align: middle;
text-align: center;
color: #555;
}
</style>