From 6deaa0b961818d7aa7079689cc7dc8fd211ec043 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 31 Oct 2022 17:49:48 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-2336=20fix=EF=BC=9ARcord=20rules=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E8=A7=84=E5=88=99=E4=BF=9D=E5=AD=98=E6=97=B6=E6=8F=90?= =?UTF-8?q?=E7=A4=BAname=E6=A0=BC=E5=BC=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/panelChart.vue | 19 ++++++++++++++++--- .../src/components/common/mixin/dataList.js | 5 +++-- .../common/rightBox/recordRuleBox.vue | 2 +- .../common/table/settings/recordRuleTable.vue | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index d5c38a795..cc1d737ae 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -55,7 +55,7 @@ :multipleTime="multipleTime" :isFullscreen="isFullscreen" :showAllData="showAllData" - v-if="!isGroup(chartInfo.type) || !chartInfo.param.collapse" + v-if="(!isGroup(chartInfo.type) || !chartInfo.param.collapse) && snapshotShow" > @@ -118,7 +118,8 @@ export default { allDataLength: 0, severityData: this.$store.getters.severityData, // 告警级别的数据 severityDataWeight: this.$store.getters.severityDataWeight, - myVariables: [] // 添加当前使用的变量 用于判断是否需要重新加载 + myVariables: [], // 添加当前使用的变量 用于判断是否需要重新加载 + snapshotShow: true // isExportData: false } }, @@ -159,7 +160,7 @@ export default { if (!this.variablesInit) { // 变量未加载完成 不请求数据 return } - this.chartData = [] + this.chartData = window.dataJson ? this.chartData : [] this.myVariables = [] this.loading = true // TODO assetInfo、endpointInfo、echarts等进行不同的处理 @@ -758,6 +759,9 @@ export default { deep: true, handler (n) { // console.log(n) + if (window.dataJson && this.loading) { + this.loading = false + } } }, variablesArr: { @@ -778,8 +782,17 @@ export default { } } }, + created () { + if (window.dataJson) { + this.snapshotShow = false + this.getChartData() + } + }, mounted () { this.chartInfo.loaded && this.getChartData() + setTimeout(() => { + this.snapshotShow = true + }) this.showAllData = !this.showMultiple(this.chartInfo.type) } } diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index a5ce470a4..a9da10084 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -232,8 +232,9 @@ export default { } }) }, - copy (u) { - this.object = { ...u, name: u.name + '-copy', id: '' } + copy (u, copyParams) { + const copyName = this.$loadsh.get(copyParams, 'copyName', '-copy') + this.object = { ...u, name: u.name + copyName, id: '' } if (this.object.name.length > 64) { const length = this.object.name.length - 64 this.object.name = u.name.substring(0, u.name.length - length) + '-copy' diff --git a/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue b/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue index 3e5812971..0a34700ef 100644 --- a/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/recordRuleBox.vue @@ -159,7 +159,7 @@ export default { rules: { name: [ { required: true, message: this.$t('validate.required'), trigger: 'change' }, - { pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: this.$t('overall.ASCIIKey'), trigger: 'change' } + { pattern: /^[a-zA-Z_:][a-zA-Z0-9_:]*$/, message: this.$t('overall.ASCIIKey'), trigger: 'change' } ], type: [ { required: true, message: this.$t('validate.required'), trigger: 'change' } diff --git a/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue b/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue index 6d1d8e6a5..b8582ba1e 100644 --- a/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue +++ b/nezha-fronted/src/components/common/table/settings/recordRuleTable.vue @@ -115,7 +115,7 @@ {{$t('overall.edit')}} - {{$t('overall.duplicate')}} + {{$t('overall.duplicate')}}