diff --git a/frontend/src/business/components/api/definition/components/complete/BasisApi.vue b/frontend/src/business/components/api/definition/components/complete/BasisApi.vue index d1448046f2..1dbaae9b78 100644 --- a/frontend/src/business/components/api/definition/components/complete/BasisApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/BasisApi.vue @@ -131,6 +131,13 @@ }, data() { + let validateModuleId = (rule, value, callback) => { + if (this.basicForm.moduleId.length === 0 || !this.basicForm.moduleId) { + callback(this.$t('test_track.case.input_module')); + } else { + callback(); + } + }; return { basicForm: {}, httpVisible: false, @@ -147,7 +154,7 @@ {max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'} ], userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}], - moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}], + moduleId: [{required: true, validator: validateModuleId, trigger: 'change'}], status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], }, value: API_STATUS[0].id, diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 14e1e6e370..59cc22c940 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -70,7 +70,7 @@ + :obj="moduleObj" clearable checkStrictly ref="msTree"/> @@ -226,6 +226,13 @@ export default { } callback(); }; + let validateModuleId = (rule, value, callback) => { + if (this.httpForm.moduleId.length === 0 || !this.httpForm.moduleId) { + callback(this.$t('test_track.case.input_module')); + } else { + callback(); + } + }; return { rule: { name: [ @@ -237,7 +244,7 @@ export default { trigger: 'blur' }], userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}], - moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}], + moduleId: [{required: true, validator: validateModuleId, trigger: 'change'}], status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], }, httpForm: {environmentId: "", path: "", tags: []}, diff --git a/frontend/src/business/components/api/definition/components/complete/TCPBasicApi.vue b/frontend/src/business/components/api/definition/components/complete/TCPBasicApi.vue index 0abac90b26..f56b2ff1b7 100644 --- a/frontend/src/business/components/api/definition/components/complete/TCPBasicApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/TCPBasicApi.vue @@ -96,6 +96,13 @@ }); }, data() { + let validateModuleId = (rule, value, callback) => { + if (this.basicForm.moduleId.length === 0 || !this.basicForm.moduleId) { + callback(this.$t('test_track.case.input_module')); + } else { + callback(); + } + }; return { basicForm: {}, httpVisible: false, @@ -108,7 +115,7 @@ {max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'} ], userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}], - moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}], + moduleId: [{required: true, validator: validateModuleId, trigger: 'change'}], status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], }, value: API_STATUS[0].id,