From 16be95d79f95fd73815a54b0d1b6038c578da4b2 Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Wed, 29 Sep 2021 17:26:15 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1035=20fix:=20group=20chart=20=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E9=9D=A2=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../charts/chart-bar-statistics.vue | 21 ++++++++++--------- .../src/components/common/js/validate.js | 2 +- .../src/components/common/language/en.js | 1 + .../common/rightBox/editEndpointBoxNew.vue | 5 +++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-bar-statistics.vue b/nezha-fronted/src/components/charts/chart-bar-statistics.vue index acd23d95d..834969a3e 100644 --- a/nezha-fronted/src/components/charts/chart-bar-statistics.vue +++ b/nezha-fronted/src/components/charts/chart-bar-statistics.vue @@ -569,17 +569,18 @@ export default { return [x, y] } }) - if (self.pieData[0].data.length > 0) { - getChart(self.chartIndex).clear() - getChart(self.chartIndex).setOption(self.option)// 创建图表 - self.noData = false - } else { - self.noData = true - self.option = chartConfig.getOption('noData') - getChart(self.chartIndex).clear() - getChart(self.chartIndex).setOption(self.option)// 创建图表 + if (self.pieData[0]) { + if (self.pieData[0].data.length > 0) { + getChart(self.chartIndex).clear() + getChart(self.chartIndex).setOption(self.option)// 创建图表 + self.noData = false + } else { + self.noData = true + self.option = chartConfig.getOption('noData') + getChart(self.chartIndex).clear() + getChart(self.chartIndex).setOption(self.option)// 创建图表 + } } - self.$refs['localLoading' + self.chartIndex].endLoading() self.firstShow = true // 展示操作按键 }, 100) diff --git a/nezha-fronted/src/components/common/js/validate.js b/nezha-fronted/src/components/common/js/validate.js index 612c0b972..ad9583460 100644 --- a/nezha-fronted/src/components/common/js/validate.js +++ b/nezha-fronted/src/components/common/js/validate.js @@ -76,7 +76,7 @@ export function nzNumber (rule, value, callback) { } export function noSpecialChar (rule, value, callback) { - const charReg = /\w+/ + const charReg = /^[a-z0-9A-Z-]+$/ setTimeout(() => { if (charReg.test(value)) { callback() diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 035234b04..0508dcc37 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -579,6 +579,7 @@ const en = { usize: 'Must be number(1 - 47)', fileSize: 'File exceed max size', // File exceed max size. port: 'Invalid port', + special: 'Cannot contain special characters', url: 'Invalid URL', uSize: 'Must be number(1 - 47)', requiredIdc: 'dc is required', diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue index c9ee369c8..aa5961c14 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue @@ -653,8 +653,9 @@ export default { showAllBasicOption: false, rules: { name: [ - { validator: this.optionType === 'batch' ? '' : noSpecialChar, trigger: 'change' }, - { required: true, message: this.$t('validate.required'), trigger: 'change' } + { required: true, message: this.$t('validate.required'), trigger: 'change' }, + { validator: this.optionType === 'batch' ? '' : noSpecialChar, trigger: 'change' } + ], assetId: [ { required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'change' }