2019-03-19 19:50:23 +08:00
|
|
|
<template>
|
|
|
|
|
<d2-container>
|
2019-03-21 23:26:28 +08:00
|
|
|
<el-table
|
|
|
|
|
:data="log"
|
|
|
|
|
size="mini"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
stripe>
|
|
|
|
|
<el-table-column
|
|
|
|
|
prop="time"
|
|
|
|
|
label="Time"
|
|
|
|
|
width="140">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
prop="message"
|
|
|
|
|
label="Message">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<template slot="footer">
|
2019-03-19 19:50:23 +08:00
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="mini"
|
|
|
|
|
:loading="uploading"
|
|
|
|
|
@click="handleUpload">
|
2019-03-19 21:28:04 +08:00
|
|
|
<d2-icon name="cloud-upload"/>
|
2019-03-21 22:42:03 +08:00
|
|
|
Upload {{log.length}} log data
|
2019-03-19 19:50:23 +08:00
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</d2-container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-03-19 21:26:14 +08:00
|
|
|
import { mapState } from 'vuex'
|
2019-03-21 23:26:28 +08:00
|
|
|
import { get } from 'lodash'
|
2019-03-19 19:50:23 +08:00
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
2019-03-21 23:26:28 +08:00
|
|
|
get,
|
2019-03-19 19:50:23 +08:00
|
|
|
uploading: false
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-03-19 21:26:14 +08:00
|
|
|
computed: {
|
|
|
|
|
...mapState('d2admin/log', [
|
2019-03-21 22:42:03 +08:00
|
|
|
'log'
|
2019-03-19 21:26:14 +08:00
|
|
|
])
|
|
|
|
|
},
|
2019-03-19 19:50:23 +08:00
|
|
|
methods: {
|
2019-03-21 23:26:28 +08:00
|
|
|
handleLogConsole (log) {
|
|
|
|
|
// 打印一条日志的所有信息到控制台
|
|
|
|
|
console.log(log)
|
|
|
|
|
},
|
|
|
|
|
// 日志上传
|
2019-03-19 19:50:23 +08:00
|
|
|
handleUpload () {
|
|
|
|
|
this.uploading = true
|
|
|
|
|
this.$notify({
|
|
|
|
|
type: 'info',
|
|
|
|
|
title: '日志上传',
|
2019-03-21 22:42:03 +08:00
|
|
|
message: `开始上传${this.log.length}条日志`
|
2019-03-19 19:50:23 +08:00
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.uploading = false
|
|
|
|
|
this.$notify({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: '日志上传',
|
|
|
|
|
message: '上传成功'
|
|
|
|
|
})
|
|
|
|
|
}, 3000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|