Log.vue
5.4 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<template>
<section>
<!--工具条-->
<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
<el-form :inline="true" :model="filters">
<el-form-item>
<el-input v-model="filters.username" placeholder="账号"></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="filters.methodname" placeholder="系统动作"></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="filters.modelnamecn" placeholder="操作模块"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" v-on:click="getRoles()">查询</el-button>
</el-form-item>
</el-form>
</el-col>
<!--列表-->
<el-table :data="logs" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;">
<el-table-column type="index" width="60">
</el-table-column>
<el-table-column prop="logid" label="ID" width="80" sortable>
</el-table-column>
<el-table-column prop="username" label="操作账号" width="120" sortable>
</el-table-column>
<el-table-column prop="ip" label="IP" width="100" sortable>
</el-table-column>
<el-table-column prop="logcreattime" label="操作时间" width="200" sortable>
</el-table-column>
<el-table-column prop="methodname" label="系统动作" width="120" sortable>
</el-table-column>
<el-table-column prop="operatenamecn" label="动作描述" width="120" sortable>
</el-table-column>
<el-table-column prop="modelnamecn" label="操作模块" width="120" sortable>
</el-table-column>
<!--<el-table-column prop="parameters" label="参数" width="100" sortable>-->
<!--</el-table-column>-->
<el-table-column prop="classname" label="系统类" show-overflow-tooltip="true" width="100" sortable>
</el-table-column>
<el-table-column prop="result" label="操作结果" min-width="200" sortable>
</el-table-column>
</el-table>
<!--工具条-->
<el-col :span="24" class="toolbar">
<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;">
</el-pagination>
</el-col>
</section>
</template>
<script>
import util from '../../common/js/util'
import NProgress from 'nprogress'
import moment from 'moment'
import { getList } from '../../api/log_api';
export default {
data() {
return {
filters: {},
logs: [],
total: 0,
pageNum: 1,
pageSize: 10,
listLoading: false,
sels: [],//列表选中列
}
},
methods: {
//性别显示转换
formatSex: function (row, column) {
return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知';
},
formatState: function (row, column) {
return row.state == true ? '是' : row.state == false ? '否' : '未知';
},
handleCurrentChange(val) {
this.pageNum = val;
this.getRoles();
},
//获取角色列表
getLogs() {
let para = {
pageNum: this.pageNum,
pageSize: this.pageSize,
};
this.listLoading = true;
//NProgress.start();
getList(para).then((res) => {
this.total = res.data.total;
this.logs = res.data.list;
this.listLoading = false;
//NProgress.done();
}).catch((error) => {
this.listLoading = false;
if(null!= error.response && error.response!==undefined){
let status= error.response.status;
let msg = error.response.statusText;
alert(status+msg);
}else {
alert(error);
}
});
},
selsChange: function (sels) {
this.sels = sels;
},
//批量删除
batchRemove: function () {
var ids = this.sels.map(item => item.id).toString();
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.listLoading = true;
//NProgress.start();
let para = { ids: ids };
batchRemove(para).then((res) => {
this.listLoading = false;
//NProgress.done();
this.$message({
message: '删除成功',
type: 'success'
});
this.getRoles();
});
}).catch(() => {
});
}
},
mounted() {
this.getLogs();
}
}
</script>
<style scoped>
</style>