fix: 调整visits=0时显示<0.01的问题

This commit is contained in:
chenjinsong
2021-08-26 19:56:04 +08:00
parent 922574745e
commit d1da718e2a
4 changed files with 11 additions and 8 deletions

View File

@@ -56,11 +56,12 @@ export default {
if (!this.username || !this.pin) { if (!this.username || !this.pin) {
return return
} }
// if (!this.blockOperation.query) { if (!this.blockOperation.query) {
// this.blockOperation.query = true this.blockOperation.query = true
// } else { } else {
// return return
// } }
this.loading = true
post('sys/login', { username: this.username, pin: this.pin }).then( post('sys/login', { username: this.username, pin: this.pin }).then(
res => { res => {
if (res.code === 200) { if (res.code === 200) {

View File

@@ -77,7 +77,8 @@ export const unitTypes = {
time: 'time', time: 'time',
number: 'number', number: 'number',
byte: 'byte', byte: 'byte',
string: 'string' string: 'string',
percent: 'percent'
} }
export const chartTableDefaultPageSize = 10 // table类型图表默认每页数据量 export const chartTableDefaultPageSize = 10 // table类型图表默认每页数据量

View File

@@ -82,6 +82,7 @@ export default function unitConvert (value, unitType, sourceUnit, targetUnit, do
case unitTypes.time: { case unitTypes.time: {
return timeUnitFormatter(value, sourceUnit, targetUnit, dot) return timeUnitFormatter(value, sourceUnit, targetUnit, dot)
} }
case unitTypes.percent:
case unitTypes.number: { case unitTypes.number: {
return numberUnitConvert(value, sourceUnit, targetUnit, dot) return numberUnitConvert(value, sourceUnit, targetUnit, dot)
} }

View File

@@ -110,7 +110,7 @@
</template> </template>
<template #title><span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span></template> <template #title><span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span></template>
<template #data> <template #data>
<span>{{handleSingleValue[0] ? handleSingleValue[0] : '-'}}</span> <span>{{handleSingleValue[0] || handleSingleValue[0] === 0 ? handleSingleValue[0] : '-'}}</span>
<span class="single-value__unit">{{handleSingleValue[1]}}</span> <span class="single-value__unit">{{handleSingleValue[1]}}</span>
</template> </template>
<template #chart> <template #chart>
@@ -968,7 +968,7 @@ export default {
const unitType = this.chartInfo.params.unitType const unitType = this.chartInfo.params.unitType
const result = unitConvert(value, unitType) const result = unitConvert(value, unitType)
switch (unitType) { switch (unitType) {
case unitTypes.number: { case unitTypes.percent: {
result[0] = result[0] < 0.01 ? '< 0.01' : result[0] result[0] = result[0] < 0.01 ? '< 0.01' : result[0]
break break
} }