fix(用例评审):用例评审状态展示错乱

--bug=1010120 --user=李敏 [测试跟踪]github #10249用例评审评论展示错乱 https://www.tapd.cn/55049933/s/1108872
This commit is contained in:
limin-fit2 2022-02-23 16:13:54 +08:00 committed by jianxing
parent efbee853cf
commit 884fee0b8a
5 changed files with 90 additions and 37 deletions

View File

@ -6,7 +6,7 @@
:comment="comment"
@refresh="refresh"
:review-status="reviewStatus" api-url="/test/case"/>
<div v-if="comments.length === 0" style="text-align: center" >
<div v-if="comments.length === 0" style="text-align: center">
<i class="el-icon-chat-line-square" style="font-size: 15px;color: #8a8b8d;">
<span style="font-size: 15px; color: #8a8b8d;">
{{ $t('test_track.comment.no_comment') }}
@ -16,7 +16,7 @@
</div>
<div>
<div class="editors_div_style">
<div id="editorsDiv" >
<div id="editorsDiv">
<ms-mark-down-text prop="description" :data="form" :toolbars="toolbars" ref="md"/>
</div>
</div>
@ -37,12 +37,13 @@ import MsMarkDownText from "@/business/components/track/case/components/MsMarkDo
export default {
name: "ReviewComment",
components: {MsMarkDownText, ReviewCommentItem,FormRichTextItem},
components: {MsMarkDownText, ReviewCommentItem, FormRichTextItem},
props: {
caseId: String,
comments: Array,
reviewId: String,
reviewStatus: String,
oldReviewStatus: String,
},
data() {
return {
@ -50,9 +51,9 @@ export default {
form: {
description: ''
},
loadCommenItem:true,
loadCommenItem: true,
labelWidth: '120px',
showEditor:true,
showEditor: true,
isReadOnly: false,
toolbars: {
bold: false, //
@ -94,8 +95,8 @@ export default {
created() {
this.isReadOnly = false;
},
watch:{
comments(){
watch: {
comments() {
}
},
methods: {
@ -113,23 +114,26 @@ export default {
this.$success(this.$t('test_track.comment.send_success'));
this.form.description = "";
this.refresh();
if(this.$refs.md){
if (this.$refs.md) {
this.$refs.md.toolbar_left_click('trash');
}
if ((this.oldReviewStatus === 'Prepare' || this.oldReviewStatus === 'Pass') && this.reviewStatus === 'UnPass') {
this.$emit('saveCaseReview');
}
});
},
inputLight() {
let textAreaDom = this.$refs.md.getTextareaDom();
let editorDivDom = document.getElementById("editorsDiv");
if(editorDivDom){
editorDivDom.setAttribute("style","-webkit-box-shadow: 0 0 8px rgb(205,51,43);");
if (editorDivDom) {
editorDivDom.setAttribute("style", "-webkit-box-shadow: 0 0 8px rgb(205,51,43);");
}
textAreaDom.focus();
},
resetInputLight(){
},
resetInputLight() {
let editorDivDom = document.getElementById("editorsDiv");
if(editorDivDom){
editorDivDom.setAttribute("style","-webkit-box-shadow: 0 0 0px rgb(-1,0,0);");
if (editorDivDom) {
editorDivDom.setAttribute("style", "-webkit-box-shadow: 0 0 0px rgb(-1,0,0);");
}
},
refresh() {
@ -150,9 +154,11 @@ export default {
overflow-y: scroll;
height: calc(100vh - 450px);
}
.editors-div{
-webkit-box-shadow: 0 0 8px rgb(-1,0,0);
.editors-div {
-webkit-box-shadow: 0 0 8px rgb(-1, 0, 0);
}
.editors_div_style {
height: 300px;
overflow: auto

View File

@ -59,7 +59,9 @@
<el-row style="margin-top: 0;">
<el-col>
<el-divider content-position="left">
<el-button class="test-case-name" type="text" @click="openTestTestCase(testCase)">{{ testCase.name }}</el-button>
<el-button class="test-case-name" type="text" @click="openTestTestCase(testCase)">
{{ testCase.name }}
</el-button>
</el-divider>
</el-col>
</el-row>
@ -71,14 +73,16 @@
<el-row>
<el-col :span="7">
<el-form-item :label="$t('test_track.case.module')" prop="nodePath" :label-width="formLabelWidth">
{{testCase.nodePath}}
</el-form-item >
<el-form-item :label="$t('test_track.case.module')" prop="nodePath"
:label-width="formLabelWidth">
{{ testCase.nodePath }}
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item :label="$t('test_track.plan.plan_project')" prop="projectName" :label-width="formLabelWidth">
{{testCase.projectName}}
</el-form-item >
<el-form-item :label="$t('test_track.plan.plan_project')" prop="projectName"
:label-width="formLabelWidth">
{{ testCase.projectName }}
</el-form-item>
</el-col>
</el-row>
@ -87,7 +91,8 @@
class="case-form">
<el-row>
<el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index">
<el-form-item :label="item.system ? $t(systemNameMap[item.name]) : item.name" :prop="item.name"
<el-form-item :label="item.system ? $t(systemNameMap[item.name]) : item.name"
:prop="item.name"
:label-width="formLabelWidth">
<custom-filed-component :disabled="true" :data="item" :form="{}" prop="defaultValue"/>
</el-form-item>
@ -95,18 +100,26 @@
</el-row>
</el-form>
<form-rich-text-item :label-width="formLabelWidth" :disabled="true" :title="$t('test_track.case.prerequisite')"
<form-rich-text-item :label-width="formLabelWidth" :disabled="true"
:title="$t('test_track.case.prerequisite')"
:data="testCase" prop="prerequisite"/>
<step-change-item :disable="true" :label-width="formLabelWidth" :form="testCase"/>
<form-rich-text-item :label-width="formLabelWidth" :disabled="true" v-if="testCase.stepModel === 'TEXT'" :title="$t('test_track.case.step_desc')" :data="testCase" prop="stepDescription"/>
<form-rich-text-item :label-width="formLabelWidth" :disabled="true" v-if="testCase.stepModel === 'TEXT'" :title="$t('test_track.case.expected_results')" :data="testCase" prop="expectedResult"/>
<form-rich-text-item :label-width="formLabelWidth" :disabled="true"
v-if="testCase.stepModel === 'TEXT'" :title="$t('test_track.case.step_desc')"
:data="testCase" prop="stepDescription"/>
<form-rich-text-item :label-width="formLabelWidth" :disabled="true"
v-if="testCase.stepModel === 'TEXT'"
:title="$t('test_track.case.expected_results')" :data="testCase"
prop="expectedResult"/>
<test-case-step-item :label-width="formLabelWidth" :read-only="true" v-if="testCase.stepModel === 'STEP'" :form="testCase"/>
<test-case-step-item :label-width="formLabelWidth" :read-only="true"
v-if="testCase.stepModel === 'STEP'" :form="testCase"/>
<el-form-item :label="$t('test_track.case.other_info')" :label-width="formLabelWidth">
<test-case-edit-other-info @openTest="openTest" :read-only="true" :is-test-plan="true"
:project-id="projectId" :form="testCase" :case-id="testCase.caseId" ref="otherInfo"/>
</el-form-item >
:project-id="projectId" :form="testCase" :case-id="testCase.caseId"
ref="otherInfo"/>
</el-form-item>
</el-form>
</div>
@ -122,7 +135,9 @@
style="margin-left:10px;font-size: 14px; cursor: pointer"/>
</template>
<review-comment :comments="comments" :case-id="testCase.caseId" :review-id="testCase.reviewId"
@getComments="getComments" :review-status="testCase.reviewStatus" ref="reviewComment"/>
:oldReviewStatus="oldReviewStatus"
@getComments="getComments" :review-status="testCase.reviewStatus" ref="reviewComment"
@saveCaseReview="saveCaseReview"/>
</el-card>
</el-col>
</div>
@ -198,7 +213,8 @@ export default {
hasTapdId: false,
hasZentaoId: false,
formLabelWidth: '100px',
isCustomFiledActive: false
isCustomFiledActive: false,
oldReviewStatus: 'Pass'
};
},
props: {
@ -275,13 +291,23 @@ export default {
param.status = status;
//reviewComment
if (status === 'UnPass') {
if (this.$refs.reviewComment.form.description.length > 0) {
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.$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;
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.testCase.reviewStatus = status;
//
this.testCases[this.index].reviewStatus = status;
if (this.index < this.testCases.length - 1) {
@ -306,7 +332,25 @@ export default {
}
});
}
},
saveCaseReview() {
let param = {};
let status = this.testCase.reviewStatus;
param.id = this.testCase.id;
param.caseId = this.testCase.caseId;
param.reviewId = this.testCase.reviewId;
param.status = status;
this.$post('/test/review/case/edit', param, () => {
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();
}
});
},
updateTestCases(param) {
for (let i = 0; i < this.testCases.length; i++) {
@ -415,7 +459,7 @@ export default {
id = this.testCase.caseId;
}
this.result = this.$get('/test/case/comment/list/' + id, res => {
if(res.data){
if (res.data) {
this.comments = null;
this.comments = res.data;
}

View File

@ -2203,6 +2203,7 @@ export default {
execute_result: "Result",
cannot_edit: "Cannot edit this comment",
cannot_delete: "Cannot delete this comment",
submit_description: "please submit comments first",
},
module: {
id: 'Module ID',

View File

@ -2200,6 +2200,7 @@ export default {
send_success: "评论成功!",
cannot_edit: "无法编辑此评论!",
cannot_delete: "无法删除此评论!",
submit_description: "请先提交评论!",
},
review_view: {
review: "评审",

View File

@ -2199,6 +2199,7 @@ export default {
send_success: "評論成功!",
cannot_edit: "無法編輯此評論!",
cannot_delete: "無法刪除此評論!",
submit_description: "請先提交評論!",
},
review_view: {
review: "評審",