From 8cb077f32ee5ecf333226c985c4cfb742da2a3ef Mon Sep 17 00:00:00 2001 From: likexuan Date: Wed, 10 Aug 2022 13:36:46 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20recordRule=20=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/rightBox/recordRuleBox.vue | 12 +++++++----- .../common/table/settings/recordRuleTable.vue | 14 +++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue b/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue index eceafd6e0..e90d546bf 100644 --- a/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue @@ -247,6 +247,7 @@ export default { removeLabels (index) { if (this.editRecordRule.labels.length === 1) { this.editRecordRule.labels = [{ label: '', value: '' }] + return } this.editRecordRule.labels.splice(index, 1) }, @@ -271,12 +272,13 @@ export default { immediate: true, handler (n, o) { this.isEdit = true + const editObj = lodash.cloneDeep(n) this.editRecordRule = { - ...n, - type: n.type + '', - inr: n.inr + '', - labels: this.labelsSort(n.labels), - state: n.state + '' + ...editObj, + type: editObj.type + '', + inr: editObj.inr + '', + labels: typeof editObj.labels != 'object' ? this.labelsSort(editObj.labels) : editObj.labels, + state: editObj.state + '' } // expression if (this.editRecordRule.id || this.editRecordRule.name) { diff --git a/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue b/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue index d6b5acad7..5deee73aa 100644 --- a/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue +++ b/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue @@ -133,6 +133,7 @@