index.vue
4.83 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
148
149
150
151
152
153
<template>
<div class="log-content">
<div class="log-search">
开始时间:
<el-date-picker
v-model="startValue"
type="datetime"
placeholder="选择日期时间"
align="right"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions">
</el-date-picker>
结束时间:
<el-date-picker
v-model="endValue"
type="datetime"
placeholder="选择日期时间"
align="right"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions">
</el-date-picker>
<el-button type="primary" @click="query">查询</el-button>
<el-button type="warning" @click="reset">重置</el-button>
<el-button type="info" @click="getError">错误日志</el-button>
</div>
<el-dialog title="错误日志" :visible.sync="outerVisible">
<div v-for="(item,index) in errorLog" :key="index">
<span> {{item.name}}</span> <br/>
<span> {{item.value}}</span>
</div>
</el-dialog>
<div class="log-table">
<el-table :data="tableData">
<el-table-column type="index" width="80" align="center" label="序号">
</el-table-column>
<el-table-column prop="operationtype" align="center" label="操作类型">
</el-table-column>
<el-table-column prop="username" align="center" width="100" label="操作人">
</el-table-column>
<el-table-column prop="addtime" align="center" label="操作时间">
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import {getLogData,getErrorLog} from "@api/manage";
export default {
name: "index",
data(){
return{
tableData:[],
errorLog:[],
outerVisible: false,
innerVisible: false,
pickerOptions: {
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
},
startValue: '',
endValue:'',
}
},
methods:{
getData(){
let data={
"startTime": "",
"pageNo": 1,
"pageSize": 50
};
getLogData(data).then((res)=>{
console.log(res.result);
this.tableData = res.result.records;
})
},
query(){
let data={
"startTime": this.startValue,
"endTime": this.endValue,
"pageNo": 1,
"pageSize": 50
};
getLogData(data).then((res)=>{
console.log(res.result);
this.tableData = res.result.records;
})
},
getError(){
getErrorLog().then((res)=>{
console.log(res.result)
this.errorLog= res.result;
this.outerVisible = true;
})
},
reset(){
this.startValue = "";
this.endValue = "";
}
},
mounted() {
this.getData();
}
}
</script>
<style scoped>
.log-content{
width: 100%;
/*border: 1px solid red;*/
}
.log-search{
margin-top: 10px;
padding-left: 15px;
padding-top: 20px;
width: 100%;
border: 1px solid #a8adad;
height: 60px;
background-color: white;
}
.log-table{
margin-top: 10px;
width: 100%;
border: 1px solid #a8adad;
}
.el-button {
width: 100px;
margin-left: 15px;
}
</style>