Files
mes-ui-d2/src/layout/header-aside/components/header-error-log/index.vue
liyang 2d17d09d61 D2ErrorLogList 放在了 layout 文件夹内
Former-commit-id: e7c5073e750de6659873bf827575e67d60fda6cc [formerly e7c5073e750de6659873bf827575e67d60fda6cc [formerly e7c5073e750de6659873bf827575e67d60fda6cc [formerly e7c5073e750de6659873bf827575e67d60fda6cc [formerly 73408af989e90a4f3fb9d7dcf87115d115784a85 [formerly 25c75956a932431724fc33b1076e72edd3bad64a]]]]]
Former-commit-id: efb244c3b1729ce3ce80fefcc2116b5682c544f8
Former-commit-id: 33cbec8cac3b464ba50691a0301816a14c92c507
Former-commit-id: 0d402138f2324a28d52f685049c3299197c2292d [formerly 715be3a1af8c720d3102a7556dd709dbb106f102]
Former-commit-id: 574cfa22abbb883db5a1bb9d83abbb59ccc15d21
Former-commit-id: 0f2ed4796206d30f827600b14603972a9a6db594
Former-commit-id: 1d1543d63a76cff518a8a6122b489395c5de8052
Former-commit-id: 10202d438c9adfa300ba3603895bab17f17d2372
Former-commit-id: 5a4bc16655a86dabed9a235699ed945466895032
2018-08-22 11:12:52 +08:00

83 lines
1.9 KiB
Vue

<template>
<div>
<el-tooltip
effect="dark"
:content="tooltipContent"
placement="bottom">
<el-button
class="d2-ml-0 d2-mr btn-text can-hover"
type="text"
@click="handleClick">
<el-badge
v-if="logLength > 0"
:max="99"
:value="logLengthError"
:is-dot="logLengthError === 0">
<d2-icon
:name="logLengthError === 0 ? 'dot-circle-o' : 'bug'"
style="font-size: 20px"/>
</el-badge>
<d2-icon
v-else
name="dot-circle-o"
style="font-size: 20px"/>
</el-button>
</el-tooltip>
<el-dialog
:title="tooltipContent"
:fullscreen="true"
:visible.sync="dialogVisible"
:append-to-body="true">
<div class="d2-mb-10">
<el-button type="danger" size="mini" @click="handleLogClean">
<d2-icon name="trash-o"/>
清空
</el-button>
</div>
<d2-error-log-list/>
</el-dialog>
</div>
</template>
<script>
import { mapGetters, mapMutations } from 'vuex'
import D2ErrorLogList from './components/list'
export default {
components: {
D2ErrorLogList
},
data () {
return {
dialogVisible: false
}
},
computed: {
...mapGetters('d2admin', {
logLength: 'log/length',
logLengthError: 'log/lengthError'
}),
tooltipContent () {
return this.logLength === 0
? '没有日志或异常'
: `${this.logLength} 条日志${this.logLengthError > 0
? ` | 包含 ${this.logLengthError} 个异常`
: ''}`
}
},
methods: {
...mapMutations('d2admin/log', [
'clean'
]),
handleClick () {
if (this.logLength > 0) {
this.dialogVisible = true
}
},
handleLogClean () {
this.dialogVisible = false
this.clean()
}
}
}
</script>