fix: 修改仪表盘文字位置 以及 panel 首次加载 时间显示的问题

This commit is contained in:
zhangyu
2021-12-24 10:20:19 +08:00
parent 54334af93c
commit 88b8404b73
3 changed files with 13 additions and 6 deletions

View File

@@ -170,6 +170,7 @@ export default {
option.series[0].detail = { option.series[0].detail = {
fontSize: 24, fontSize: 24,
fontWeight: 'bolder', fontWeight: 'bolder',
offsetCenter: [0, '20%'],
formatter: (params) => { formatter: (params) => {
let showValue = chartDataFormat.getUnit(self.chartInfo.unit ? self.chartInfo.unit : 2).compute(params, null, -1, 2).trim() let showValue = chartDataFormat.getUnit(self.chartInfo.unit ? self.chartInfo.unit : 2).compute(params, null, -1, 2).trim()
if (item.mapping) { if (item.mapping) {
@@ -177,9 +178,9 @@ export default {
} }
let str = '' let str = ''
if (this.chartInfo.param.text === 'all') { if (this.chartInfo.param.text === 'all') {
str += item.alias
str += '\n'
str += showValue str += showValue
str += '\n'
str += item.alias
} }
if (this.chartInfo.param.text === 'value' || !this.chartInfo.param.text) { if (this.chartInfo.param.text === 'value' || !this.chartInfo.param.text) {
str += showValue str += showValue

View File

@@ -37,7 +37,8 @@ const chartGaugeOption = {
show: false show: false
}, },
title: { title: {
show: false show: false,
offsetCenter: [0, '-50%']
}, },
data: [] data: []
} }

View File

@@ -172,7 +172,7 @@ export default {
this.$set(this.showTime, 'text', this.searchTime[0] + ' ' + this.$t('dashboard.panel.to') + ' ' + this.searchTime[1]) this.$set(this.showTime, 'text', this.searchTime[0] + ' ' + this.$t('dashboard.panel.to') + ' ' + this.searchTime[1])
this.$emit('change', this.searchTime) this.$emit('change', this.searchTime)
}, },
setCustomTime (timeGroup,timeRange) { setCustomTime (timeGroup, timeRange) {
if (timeGroup) { if (timeGroup) {
this.showTime = this.nowTimeType = this.timeData.find(item => item.id == timeGroup.id) this.showTime = this.nowTimeType = this.timeData.find(item => item.id == timeGroup.id)
console.log(this.showTime) console.log(this.showTime)
@@ -188,8 +188,13 @@ export default {
value: 1 value: 1
} }
const time = bus.getTimezontDateRange() const time = bus.getTimezontDateRange()
this.$set(this.searchTime, 0, time[0]) if (timeGroup.start_time) {
this.$set(this.searchTime, 1, time[1]) this.$set(this.searchTime, 0, bus.timeFormate(timeGroup.start_time, 'yyyy-MM-dd hh:mm:ss'))
this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time, 'yyyy-MM-dd hh:mm:ss'))
} else {
this.$set(this.searchTime, 0, bus.timeFormate(time[0], 'yyyy-MM-dd hh:mm:ss'))
this.$set(this.searchTime, 1, bus.timeFormate(time[1], 'yyyy-MM-dd hh:mm:ss'))
}
} }
} else { } else {
this.showTime = this.nowTimeType = { this.showTime = this.nowTimeType = {