diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index 773b99663..c1b114dd4 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue @@ -55,7 +55,7 @@ style="width: 100%;" > - + @@ -350,7 +350,8 @@ export default { { required: true, message: this.$t('validate.required'), trigger: 'change' } ], location: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } + // { required: true, message: this.$t('validate.required'), trigger: 'blur' } + { validator: this.checkLocation, trigger: 'blur' } ] }, cabRules: { @@ -718,6 +719,19 @@ export default { resolve() }) }) + }, + checkLocation (rule, value, callback) { + setTimeout(() => { + if (this.editAsset.cabinetId) { + callback() + } else if (this.editAsset.dcId) { + callback() + } else if (this.editAsset.cabinetStart && this.editAsset.cabinetEnd) { + callback() + } else { + callback(new Error(vm.$t('validate.required'))) + } + }, 100) } } }