summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzyh <[email protected]>2023-07-06 17:53:40 +0800
committerzyh <[email protected]>2023-07-06 17:53:40 +0800
commitda649d407d2428fb6743fe1dc3630374f439da8d (patch)
treeb83df4ab361b7fc85c385a5e87795a2c70ada69b
parentca2a4dc5e442f9c902ba30a2400b49ba35e1df5e (diff)
fix:修复dashboard变量name重复时 修改其中一个name 另一个校验未消失
-rw-r--r--nezha-fronted/src/components/common/rightBox/panelBox.vue9
1 files changed, 9 insertions, 0 deletions
diff --git a/nezha-fronted/src/components/common/rightBox/panelBox.vue b/nezha-fronted/src/components/common/rightBox/panelBox.vue
index 1f3e0dd58..6643780d1 100644
--- a/nezha-fronted/src/components/common/rightBox/panelBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/panelBox.vue
@@ -501,6 +501,15 @@ export default {
if (findIndex !== lastIndex) {
callback(new Error(this.$t('error.nameDuplicate')))
} else {
+ // 没有重复的 则清除校验
+ nameArr.forEach((item, index) => {
+ const findIndex = nameArr.indexOf(item)
+ const lastIndex = nameArr.lastIndexOf(item)
+ const reg = /^[a-zA-Z_][a-zA-Z0-9_]*$/
+ if (item && reg.test(item) && findIndex == lastIndex) {
+ this.$refs.form.clearValidate('param.variables.' + index + '.name')
+ }
+ })
callback()
}
}, 100)