From 725be95ca7847da4e70fff1347d81618f983b088 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 1 Jul 2022 13:41:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E6=A8=A1=E5=9D=97=E7=9A=84?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014477 --user=王孝刚 【接口测试】TEST-另存为新接口,第一次不选择模块保存后,提示信息不会消失 https://www.tapd.cn/55049933/s/1192849 --- .../api/definition/components/complete/BasisApi.vue | 9 ++++++++- .../components/complete/EditCompleteHTTPApi.vue | 11 +++++++++-- .../definition/components/complete/TCPBasicApi.vue | 9 ++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) 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,