From 1e3e6a83de0f4b490247c77bf131043c1a5ffded Mon Sep 17 00:00:00 2001 From: limin-fit2 Date: Fri, 25 Feb 2022 14:33:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E8=AF=84=E5=AE=A1):?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E8=AF=84=E5=AE=A1=E8=BE=93=E5=85=A5=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=90=8E=E6=97=A0=E6=B3=95=E4=BB=8E=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=BA=E6=9C=AA=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1010120 --user=李敏 [测试跟踪]github #10249用例评审评论展示错乱 https://www.tapd.cn/55049933/s/1108872 --- .../components/TestReviewTestCaseEdit.vue | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue index b02974dc81..a94699190a 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue @@ -216,7 +216,7 @@ export default { hasZentaoId: false, formLabelWidth: '100px', isCustomFiledActive: false, - oldReviewStatus: 'Pass' + oldReviewStatus: 'Prepare' }; }, props: { @@ -294,29 +294,34 @@ export default { param.reviewId = this.testCase.reviewId; param.status = status; if (status === 'UnPass') { - if ((this.testCase.reviewStatus === 'Pass' || this.testCase.reviewStatus === 'Prepare') && this.$refs.reviewComment.form.description.length < 1) { - this.oldReviewStatus = this.testCase.reviewStatus; - this.testCase.reviewStatus = status; + this.testCase.reviewStatus = 'UnPass'; + // 第一种情况,第一次评审,用户直接点击未通过,需要提醒未评论 + if (this.oldReviewStatus === 'Prepare' && this.comments.length < 1) { this.$refs.reviewComment.inputLight(); this.$warning(this.$t('test_track.comment.description_is_null')); } else if (this.$refs.reviewComment.form.description.length > 0) { + // 第二种情况,当前状态为未通过,但是评论区内还有内容未提交 this.$refs.reviewComment.inputLight(); this.$warning(this.$t('test_track.comment.submit_description')); - } else if (this.comments.length > 0) { - this.oldReviewStatus = this.testCase.reviewStatus; - this.testCase.reviewStatus = status; + } else if (this.oldReviewStatus === 'Pass') { + // 第三种情况,从通过状态切换未通过状态,需要重新提交新的评论,才能切换 + this.$refs.reviewComment.inputLight(); + this.$warning(this.$t('test_track.comment.description_is_null')); + } else { + // 第四种情况,未通过状态直接点击未通过 this.$post('/test/review/case/edit', param, () => { this.$success(this.$t('commons.save_success')); this.updateTestCases(param); this.setReviewStatus(this.testCase.reviewId); + this.testCase.reviewStatus = status; + // 修改当前用例在整个用例列表的状态 this.testCases[this.index].reviewStatus = status; + // 修改旧的状态 + this.oldReviewStatus = status; if (this.index < this.testCases.length - 1) { this.handleNext(); } }); - } else { - this.$refs.reviewComment.inputLight(); - this.$warning(this.$t('test_track.comment.description_is_null')); } } else { this.$post('/test/review/case/edit', param, () => { @@ -324,10 +329,13 @@ export default { this.updateTestCases(param); this.setReviewStatus(this.testCase.reviewId); this.testCase.reviewStatus = status; + // 修改当前用例在整个用例列表的状态 this.testCases[this.index].reviewStatus = status; if (this.index < this.testCases.length - 1) { this.handleNext(); } + // 切换状态后需要修改旧的状态 + this.oldReviewStatus = status; }); } }, @@ -342,6 +350,7 @@ export default { this.updateTestCases(param); this.setReviewStatus(this.testCase.reviewId); this.oldReviewStatus = status; + // 修改当前用例在整个用例列表的状态 this.testCases[this.index].reviewStatus = status; if (this.index < this.testCases.length - 1) { this.handleNext(); @@ -395,7 +404,9 @@ export default { parseCustomField(item, this.testCaseTemplate, null, buildTestCaseOldFields(item)); this.isCustomFiledActive = true; this.testCase = item; + this.oldReviewStatus = this.testCase.reviewStatus; if (!this.testCase.actualResult) { + // 如果没值,使用模板的默认值 this.testCase.actualResult = this.testCaseTemplate.actualResult; } this.getComments(item); @@ -418,6 +429,8 @@ export default { }, openTestCaseEdit(testCase, tableData) { this.showDialog = true; + // 一开始加载时候需要保存用例评审旧的状态 + this.oldReviewStatus = testCase.reviewStatus; this.activeTab = 'detail'; this.getComments(testCase); this.hasTapdId = false;