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-05-22 14:39:51 +08:00
|
|
|
:empty-text="$t('views.system.log.table.empty-text')"
|
2019-03-21 23:26:28 +08:00
|
|
|
stripe>
|
2019-05-22 14:39:51 +08:00
|
|
|
<!-- time -->
|
2019-03-21 23:26:28 +08:00
|
|
|
<el-table-column
|
|
|
|
|
prop="time"
|
2019-05-22 14:39:51 +08:00
|
|
|
:label="$t('views.system.log.table.label.time')"
|
2019-03-21 23:26:28 +08:00
|
|
|
width="140">
|
|
|
|
|
</el-table-column>
|
2019-05-22 14:39:51 +08:00
|
|
|
<!-- message -->
|
2019-03-21 23:26:28 +08:00
|
|
|
<el-table-column
|
|
|
|
|
prop="message"
|
2019-05-22 14:39:51 +08:00
|
|
|
:label="$t('views.system.log.table.label.message')">
|
2019-03-21 23:26:28 +08:00
|
|
|
</el-table-column>
|
2019-05-22 14:39:51 +08:00
|
|
|
<!-- url -->
|
2019-03-22 15:09:39 +08:00
|
|
|
<el-table-column
|
2019-05-22 14:39:51 +08:00
|
|
|
:label="$t('views.system.log.table.label.url')"
|
2019-03-22 15:09:39 +08:00
|
|
|
align="center"
|
|
|
|
|
min-width="200">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{get(scope.row, 'meta.url')}}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2019-05-22 14:39:51 +08:00
|
|
|
<!-- componnet -->
|
2019-03-22 15:09:39 +08:00
|
|
|
<el-table-column
|
2019-05-22 14:39:51 +08:00
|
|
|
:label="$t('views.system.log.table.label.component')"
|
2019-03-22 15:09:39 +08:00
|
|
|
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>
|
2019-05-22 14:39:51 +08:00
|
|
|
<!-- more -->
|
2019-03-22 15:09:39 +08:00
|
|
|
<el-table-column
|
|
|
|
|
fixed="right"
|
|
|
|
|
align="center"
|
2019-05-22 14:39:51 +08:00
|
|
|
:label="$t('views.system.log.table.label.more')"
|
2019-03-22 15:09:39 +08:00
|
|
|
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-05-22 14:39:51 +08:00
|
|
|
{{ $t('views.system.log.upload.button', { number: log.length }) }}
|
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-05-22 14:39:51 +08:00
|
|
|
// Print all information from a log to the console
|
2019-03-22 15:09:39 +08:00
|
|
|
this.$notify({
|
|
|
|
|
type: 'info',
|
2019-05-24 10:09:05 +08:00
|
|
|
title: this.$t('public.notify.special.show-log.title'),
|
|
|
|
|
message: this.$t('public.notify.special.show-log.message')
|
2019-03-22 15:09:39 +08:00
|
|
|
})
|
|
|
|
|
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-05-22 14:39:51 +08:00
|
|
|
// Log upload
|
2019-03-19 19:50:23 +08:00
|
|
|
handleUpload () {
|
|
|
|
|
this.uploading = true
|
|
|
|
|
this.$notify({
|
|
|
|
|
type: 'info',
|
2019-05-22 14:47:56 +08:00
|
|
|
title: this.$t('public.notify.special.upload.start.title'),
|
|
|
|
|
message: this.$t('public.notify.special.upload.start.message')
|
2019-03-19 19:50:23 +08:00
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.uploading = false
|
|
|
|
|
this.$notify({
|
|
|
|
|
type: 'success',
|
2019-05-22 14:47:56 +08:00
|
|
|
title: this.$t('public.notify.special.upload.success.title'),
|
|
|
|
|
message: this.$t('public.notify.special.upload.success.message')
|
2019-03-19 19:50:23 +08:00
|
|
|
})
|
|
|
|
|
}, 3000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|