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%"
|
2019-03-22 16:58:58 +08:00
|
|
|
empty-text="暂无日志信息"
|
2019-03-21 23:26:28 +08:00
|
|
|
stripe>
|
2019-03-22 15:09:39 +08:00
|
|
|
<!-- 时间 -->
|
2019-03-21 23:26:28 +08:00
|
|
|
<el-table-column
|
|
|
|
|
prop="time"
|
|
|
|
|
label="Time"
|
|
|
|
|
width="140">
|
|
|
|
|
</el-table-column>
|
2019-03-22 15:09:39 +08:00
|
|
|
<!-- 信息 -->
|
2019-03-21 23:26:28 +08:00
|
|
|
<el-table-column
|
|
|
|
|
prop="message"
|
|
|
|
|
label="Message">
|
|
|
|
|
</el-table-column>
|
2019-03-22 15:09:39 +08:00
|
|
|
<!-- 触发页面 -->
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="Url"
|
|
|
|
|
align="center"
|
|
|
|
|
min-width="200">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{get(scope.row, 'meta.url')}}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- 触发组件 -->
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="Tag"
|
|
|
|
|
align="center"
|
|
|
|
|
min-width="120">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-tag
|
|
|
|
|
v-if="get(scope.row, 'meta.instance.$vnode.componentOptions.tag')"
|
|
|
|
|
type="info"
|
|
|
|
|
size="mini">
|
|
|
|
|
<{{get(scope.row, 'meta.instance.$vnode.componentOptions.tag')}}>
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- 查看详情 -->
|
|
|
|
|
<el-table-column
|
|
|
|
|
fixed="right"
|
|
|
|
|
align="center"
|
|
|
|
|
label="More"
|
|
|
|
|
width="100">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleShowMore(scope.row)">
|
|
|
|
|
<d2-icon name="eye"/>
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2019-03-21 23:26:28 +08:00
|
|
|
</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 {
|
|
|
|
|
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-22 15:09:39 +08:00
|
|
|
get,
|
|
|
|
|
handleShowMore (log) {
|
2019-03-21 23:26:28 +08:00
|
|
|
// 打印一条日志的所有信息到控制台
|
2019-03-22 15:09:39 +08:00
|
|
|
this.$notify({
|
|
|
|
|
type: 'info',
|
|
|
|
|
title: '日志详情',
|
|
|
|
|
message: '完整的日志内容已经打印到控制台'
|
|
|
|
|
})
|
|
|
|
|
this.$log.capsule('D2Admin', 'handleShowMore', 'primary')
|
|
|
|
|
console.group(log.message)
|
|
|
|
|
console.log('time: ', log.time)
|
|
|
|
|
console.log('type: ', log.type)
|
|
|
|
|
console.log(log.meta)
|
|
|
|
|
console.groupEnd()
|
2019-03-21 23:26:28 +08:00
|
|
|
},
|
|
|
|
|
// 日志上传
|
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>
|