From 62a30b7e435a59dac03382550a658b8918152a31 Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Tue, 7 Sep 2021 15:06:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20alert=20rule=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rightBox/alertRuleBox.vue | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue index 6d2e199b4..d2bfeb29a 100644 --- a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue @@ -394,24 +394,17 @@ export default { }, selectAlertRuleMetric (val) { if (val === 'Metrics') { - // showMetrics 为 true 时,展示 Metrics - this.showMetrics = true - // type = 1 - this.MetricsType = 1 - // 移除from表单的 expr 验证 - this.$refs.alertRuleForm.clearValidate('expr') + this.MetricsType = 1 // type = 1 + this.showSnmpTrap = true // showSnmptrap 为 true 时显示 expr,thershold,unit + this.$refs.alertRuleForm.clearValidate('expr') // 移除from表单的 expr 验证 } else if (val === 'Logs') { - // showMetrics 为 false 时,展示 Logs label - this.showMetrics = false - // type = 2 - this.MetricsType = 2 - // 移除from表单的 expr 验证 - this.$refs.alertRuleForm.clearValidate('expr') + this.showMetrics = false // showMetrics 为 false 时,展示 Logs label + this.showSnmpTrap = true // showSnmptrap 为 true 时显示 expr,thershold,unit + this.MetricsType = 2 // type = 2 + this.$refs.alertRuleForm.clearValidate('expr') // 移除from表单的 expr 验证 } else if (val === 'SNMP trap') { - // showSnmpTrap 为 false 时,展示 OID - this.showSnmpTrap = false - // type = 3 - this.MetricsType = 3 + this.showSnmpTrap = false // showSnmpTrap 为 false 时,展示 OID + this.MetricsType = 3 // type = 3 } } }, @@ -429,19 +422,18 @@ export default { this.editAlertRule = JSON.parse(JSON.stringify(n)) if (this.editAlertRule.id || this.editAlertRule.name) { this.expressions = [this.editAlertRule.expr] - // 当 edit 时禁用 type下拉框 - this.showTypeSelect = true + this.showTypeSelect = true // 当 edit 时禁用 type下拉框 if (n.type === 1) { this.fromData.status = 'Metrics' - this.MetricsType = 1 + this.MetricsType = 1 // 默认保存 type } else if (n.type === 2) { this.fromData.status = 'Logs' - this.MetricsType = 2 + this.showMetrics = false // showMetrics 为 false 时,展示 Logs label + this.MetricsType = 2 // 默认保存 type } else if (n.type === 3) { this.fromData.status = 'SNMP trap' - // showSnmpTrap 为 false 时,展示 OID - this.showSnmpTrap = false - this.MetricsType = 3 + this.showSnmpTrap = false // showSnmpTrap 为 false 时,展示 OID + this.MetricsType = 3 // 默认保存 type return } this.$nextTick(() => {