Files
mes-ui-d2/src/views/system/log/index.vue
liyang 6c6fe66350 layout i18n
Former-commit-id: e761056ea154aedf2ae927936fff49ba5b9fcb66 [formerly e761056ea154aedf2ae927936fff49ba5b9fcb66 [formerly e761056ea154aedf2ae927936fff49ba5b9fcb66 [formerly e761056ea154aedf2ae927936fff49ba5b9fcb66 [formerly 3cc73e4d679f97554d2c1f8f253bc4d6447694c1 [formerly a05de779fd7fb56b722cdb448baee6b1d44208ed]]]]]
Former-commit-id: 02aa23fd3e50eb0780d75b3bc9c5209dbf1f0e67
Former-commit-id: b21e3fe71b527439904a1a574e3d3a3032bcef09
Former-commit-id: bba111d14373493a4ef35318bfb7f41c8c388914 [formerly c1dd1cdbe86b65faff26c35db32d1ee942a97054]
Former-commit-id: d2c677083ddb6e285ea033ce8e62432ca2a89907
Former-commit-id: 8fa9b2196bc47bf6bf97b1355630eb443c4d2564
Former-commit-id: ec58dc5a2aff6a11fa31144035ca0bd250acbe63
Former-commit-id: 27ef4661fcb60de5968ce0b75d7d006774f88f0c
Former-commit-id: 352e82ebff5f22931fae48cb2525ad9867a98fa6
2019-05-24 10:09:05 +08:00

122 lines
3.3 KiB
Vue

<template>
<d2-container>
<el-table
:data="log"
size="mini"
style="width: 100%"
:empty-text="$t('views.system.log.table.empty-text')"
stripe>
<!-- time -->
<el-table-column
prop="time"
:label="$t('views.system.log.table.label.time')"
width="140">
</el-table-column>
<!-- message -->
<el-table-column
prop="message"
:label="$t('views.system.log.table.label.message')">
</el-table-column>
<!-- url -->
<el-table-column
:label="$t('views.system.log.table.label.url')"
align="center"
min-width="200">
<template slot-scope="scope">
{{get(scope.row, 'meta.url')}}
</template>
</el-table-column>
<!-- componnet -->
<el-table-column
:label="$t('views.system.log.table.label.component')"
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">
&#60;{{get(scope.row, 'meta.instance.$vnode.componentOptions.tag')}}&gt;
</el-tag>
</template>
</el-table-column>
<!-- more -->
<el-table-column
fixed="right"
align="center"
:label="$t('views.system.log.table.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>
</el-table>
<template slot="footer">
<el-button
type="primary"
size="mini"
:loading="uploading"
@click="handleUpload">
<d2-icon name="cloud-upload"/>
{{ $t('views.system.log.upload.button', { number: log.length }) }}
</el-button>
</template>
</d2-container>
</template>
<script>
import { mapState } from 'vuex'
import { get } from 'lodash'
export default {
data () {
return {
uploading: false
}
},
computed: {
...mapState('d2admin/log', [
'log'
])
},
methods: {
get,
handleShowMore (log) {
// Print all information from a log to the console
this.$notify({
type: 'info',
title: this.$t('public.notify.special.show-log.title'),
message: this.$t('public.notify.special.show-log.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()
},
// Log upload
handleUpload () {
this.uploading = true
this.$notify({
type: 'info',
title: this.$t('public.notify.special.upload.start.title'),
message: this.$t('public.notify.special.upload.start.message')
})
setTimeout(() => {
this.uploading = false
this.$notify({
type: 'success',
title: this.$t('public.notify.special.upload.success.title'),
message: this.$t('public.notify.special.upload.success.message')
})
}, 3000)
}
}
}
</script>