index.vue
6.38 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<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 v-dialogDrag title="错误日志" width="69%" :visible.sync="outerVisible">
<div style="min-height: 600px;width: 100%" v-show="errorLog.length>0">
<div style="min-height: 600px;width: 27%;border-right: 1px solid #b2b7b7;float: left;overflow:auto">
<ul>
<li v-for="(it,index) in errorLog" :key="index">
<span>日志{{index+1}},</span><el-button type="text" @click="showMessage(it.value)">{{it.name}}</el-button>
</li>
</ul>
</div>
<div style="height: 600px;width: 70%;float: right;overflow:auto">
<div v-html="concreteLog"></div>
</div>
</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 class="pagination">
<el-pagination background layout="prev, pager, next,total" :total="total"
:current-page="pageNo" :page-size="pageSize" @current-change="handleCurrentChange">
</el-pagination>
</div>
</div>
</template>
<script>
import {getLogData,getErrorLog} from "@api/manage";
export default {
name: "index",
data(){
return{
tableData:[],
errorLog:[],
concreteLog:'',
total: 0,
pageNo: 1,
pageSize: 50,
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": this.startValue,
"endTime": this.endValue,
"pageNo": this.pageNo,
"pageSize": this.pageSize
};
getLogData(data).then((res)=>{
console.log(res.result);
this.tableData = res.result.records;
this.total = res.result.total
})
},
handleCurrentChange(val) {
this.pageNo = val;
this.getData();
},
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;
if(this.errorLog.length>0){
this.concreteLog = this.errorLog[this.errorLog.length-1].value;
}
})
},
showMessage(data){
this.concreteLog = data;
},
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;
}
ul{
list-style-type: circle;
}
li{
display:block;
margin:10px;
}
.pagination {
padding: 18px 0;
}
</style>