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' }