fix(测试跟踪): 编辑评审用例后,切换评审编辑相同用例,评论还是显示的之前的评论

--bug=1023023 --user=陈建星 【测试跟踪】功能用例,历史用例数据中的用例评审评论显示了2次 https://www.tapd.cn/55049933/s/1335385
This commit is contained in:
chenjianxing 2023-02-15 15:11:04 +08:00 committed by jianxing
parent b296717ad4
commit 6dfb278d9b
2 changed files with 17 additions and 19 deletions

View File

@ -78,8 +78,8 @@
<comment-history <comment-history
default-type="REVIEW" default-type="REVIEW"
:case-id="testCase.caseId" :case-id="caseId"
:review-id="testCase.reviewId" :review-id="reviewId"
@emptyChange="handleCommentEmptyChange" @emptyChange="handleCommentEmptyChange"
ref="comment"/> ref="comment"/>
@ -174,7 +174,9 @@ export default {
isCustomFiledActive: false, isCustomFiledActive: false,
titleWith: 0, titleWith: 0,
relationGraphOpen: false, relationGraphOpen: false,
isCommentEmpty: true isCommentEmpty: true,
caseId: null,
reviewId: null,
}; };
}, },
props: { props: {
@ -261,12 +263,14 @@ export default {
this.$emit("refreshTable"); this.$emit("refreshTable");
}, },
refreshComment() { refreshComment() {
this.$refs.comment.getComments(); if (this.$refs.comment) {
this.$refs.comment.getComments();
}
}, },
refreshTestCaseStatus(status) { refreshTestCaseStatus(status) {
this.testCase.reviewStatus = status; this.testCase.reviewStatus = status;
this.updateTestCases(this.testCase); this.updateTestCases(this.testCase);
this.$refs.comment.getComments(); this.refreshComment();
this.$refs.headerBar.getReviewerStatus(); this.$refs.headerBar.getReviewerStatus();
}, },
updateTestCases(param) { updateTestCases(param) {
@ -386,9 +390,12 @@ export default {
if (this.$refs.otherInfo) { if (this.$refs.otherInfo) {
this.$refs.otherInfo.reset(); this.$refs.otherInfo.reset();
} }
if (this.$refs.comment) {
this.$refs.comment.getComments(); this.caseId = testCase.caseId;
} this.reviewId = testCase.reviewId;
this.$nextTick(() => {
this.refreshComment();
});
}, },
getRelatedTest() { getRelatedTest() {
if ( if (

View File

@ -41,7 +41,6 @@ export default {
data() { data() {
return { return {
comments: [], comments: [],
type: '',
loading: false, loading: false,
}; };
}, },
@ -52,17 +51,10 @@ export default {
}, },
computed: { computed: {
isCommentEmpty() { isCommentEmpty() {
return !this.comments || this.comments.length == 0 return !this.comments || this.comments.length == 0;
} }
}, },
watch: { watch: {
caseId() {
this.type = this.defaultType;
this.getComments();
},
type() {
this.getComments();
},
comments() { comments() {
this.$emit('emptyChange', this.isCommentEmpty); this.$emit('emptyChange', this.isCommentEmpty);
} }
@ -71,8 +63,7 @@ export default {
getComments() { getComments() {
if (this.caseId) { if (this.caseId) {
this.loading = true; this.loading = true;
let type = this.type || ''; testCaseCommentListByTypeAndBelongId(this.caseId, this.defaultType, this.reviewId)
testCaseCommentListByTypeAndBelongId(this.caseId, type, this.reviewId)
.then(res => { .then(res => {
this.comments = res.data; this.comments = res.data;
this.loading = false; this.loading = false;