feat: 指标卡阈值设置

This commit is contained in:
junjun 2022-04-26 14:40:25 +08:00
parent ce152ac0e6
commit c138a7c9f7

View File

@ -175,37 +175,38 @@ export default {
if (this.chart.senior) { if (this.chart.senior) {
const senior = JSON.parse(this.chart.senior) const senior = JSON.parse(this.chart.senior)
if (senior.threshold && senior.threshold.labelThreshold && senior.threshold.labelThreshold.length > 0) { if (senior.threshold && senior.threshold.labelThreshold && senior.threshold.labelThreshold.length > 0) {
const value = this.chart.data.series[0].data[0] const value = parseFloat(this.chart.data.series[0].data[0])
for (let i = 0; i < senior.threshold.labelThreshold.length; i++) { for (let i = 0; i < senior.threshold.labelThreshold.length; i++) {
let flag = false let flag = false
const t = senior.threshold.labelThreshold[i] const t = senior.threshold.labelThreshold[i]
const tv = parseFloat(t.value)
if (t.term === 'eq') { if (t.term === 'eq') {
if (value === t.value) { if (value === tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'not_eq') { } else if (t.term === 'not_eq') {
if (value !== t.value) { if (value !== tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'lt') { } else if (t.term === 'lt') {
if (value < t.value) { if (value < tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'gt') { } else if (t.term === 'gt') {
if (value > t.value) { if (value > tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'le') { } else if (t.term === 'le') {
if (value <= t.value) { if (value <= tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }
} else if (t.term === 'ge') { } else if (t.term === 'ge') {
if (value >= t.value) { if (value >= tv) {
this.label_content_class.color = t.color this.label_content_class.color = t.color
flag = true flag = true
} }