2018-08-01 22:55:40 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2018-08-02 20:28:50 +08:00
|
|
|
<el-tooltip
|
|
|
|
|
effect="dark"
|
|
|
|
|
:content="tooltipContent"
|
|
|
|
|
placement="bottom">
|
|
|
|
|
<el-button
|
|
|
|
|
class="d2-ml-0 d2-mr btn-text can-hover"
|
|
|
|
|
type="text"
|
|
|
|
|
@click="handleClick">
|
2018-08-02 20:16:41 +08:00
|
|
|
<el-badge
|
|
|
|
|
v-if="d2adminLogLength > 0"
|
2018-08-02 20:28:50 +08:00
|
|
|
:max="99"
|
2018-08-02 20:16:41 +08:00
|
|
|
:value="d2adminLogErrorLength"
|
|
|
|
|
:is-dot="d2adminLogErrorLength === 0">
|
2018-08-02 20:28:50 +08:00
|
|
|
<d2-icon
|
|
|
|
|
:name="d2adminLogErrorLength === 0 ? 'dot-circle-o' : 'bug'"
|
|
|
|
|
style="font-size: 20px"/>
|
2018-08-02 20:16:41 +08:00
|
|
|
</el-badge>
|
2018-08-02 20:28:50 +08:00
|
|
|
<d2-icon
|
|
|
|
|
v-else
|
|
|
|
|
name="dot-circle-o"
|
|
|
|
|
style="font-size: 20px"/>
|
2018-08-01 22:55:40 +08:00
|
|
|
</el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
<el-dialog
|
2018-08-02 21:30:04 +08:00
|
|
|
:title="tooltipContent"
|
2018-08-01 22:55:40 +08:00
|
|
|
:fullscreen="true"
|
|
|
|
|
:visible.sync="dialogVisible"
|
|
|
|
|
:append-to-body="true">
|
|
|
|
|
<d2-error-log-list/>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2018-08-02 20:16:41 +08:00
|
|
|
import { mapGetters } from 'vuex'
|
2018-08-01 22:55:40 +08:00
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
dialogVisible: false
|
|
|
|
|
}
|
2018-08-02 20:16:41 +08:00
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters([
|
|
|
|
|
'd2adminLogLength',
|
|
|
|
|
'd2adminLogErrorLength'
|
|
|
|
|
]),
|
|
|
|
|
tooltipContent () {
|
|
|
|
|
return this.d2adminLogLength === 0 ?
|
|
|
|
|
'没有日志或异常' :
|
|
|
|
|
`${this.d2adminLogLength} 条日志${this.d2adminLogErrorLength > 0 ?
|
|
|
|
|
` | 包含 ${this.d2adminLogErrorLength} 个异常` :
|
|
|
|
|
''}`
|
|
|
|
|
}
|
2018-08-02 20:21:40 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleClick () {
|
|
|
|
|
if (this.d2adminLogLength > 0) {
|
|
|
|
|
this.dialogVisible = true
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-01 22:55:40 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|