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

View File

@ -59,7 +59,9 @@
<el-row style="margin-top: 0;"> <el-row style="margin-top: 0;">
<el-col> <el-col>
<el-divider content-position="left"> <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-divider>
</el-col> </el-col>
</el-row> </el-row>
@ -71,14 +73,16 @@
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">
<el-form-item :label="$t('test_track.case.module')" prop="nodePath" :label-width="formLabelWidth"> <el-form-item :label="$t('test_track.case.module')" prop="nodePath"
{{testCase.nodePath}} :label-width="formLabelWidth">
</el-form-item > {{ testCase.nodePath }}
</el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item :label="$t('test_track.plan.plan_project')" prop="projectName" :label-width="formLabelWidth"> <el-form-item :label="$t('test_track.plan.plan_project')" prop="projectName"
{{testCase.projectName}} :label-width="formLabelWidth">
</el-form-item > {{ testCase.projectName }}
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -87,7 +91,8 @@
class="case-form"> class="case-form">
<el-row> <el-row>
<el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index"> <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"> :label-width="formLabelWidth">
<custom-filed-component :disabled="true" :data="item" :form="{}" prop="defaultValue"/> <custom-filed-component :disabled="true" :data="item" :form="{}" prop="defaultValue"/>
</el-form-item> </el-form-item>
@ -95,18 +100,26 @@
</el-row> </el-row>
</el-form> </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"/> :data="testCase" prop="prerequisite"/>
<step-change-item :disable="true" :label-width="formLabelWidth" :form="testCase"/> <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"
<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"/> 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"> <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" <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"/> :project-id="projectId" :form="testCase" :case-id="testCase.caseId"
</el-form-item > ref="otherInfo"/>
</el-form-item>
</el-form> </el-form>
</div> </div>
@ -122,7 +135,9 @@
style="margin-left:10px;font-size: 14px; cursor: pointer"/> style="margin-left:10px;font-size: 14px; cursor: pointer"/>
</template> </template>
<review-comment :comments="comments" :case-id="testCase.caseId" :review-id="testCase.reviewId" <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-card>
</el-col> </el-col>
</div> </div>
@ -198,7 +213,8 @@ export default {
hasTapdId: false, hasTapdId: false,
hasZentaoId: false, hasZentaoId: false,
formLabelWidth: '100px', formLabelWidth: '100px',
isCustomFiledActive: false isCustomFiledActive: false,
oldReviewStatus: 'Pass'
}; };
}, },
props: { props: {
@ -275,13 +291,23 @@ export default {
param.status = status; param.status = status;
//reviewComment //reviewComment
if (status === 'UnPass') { 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.$post('/test/review/case/edit', param, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.updateTestCases(param); this.updateTestCases(param);
this.setReviewStatus(this.testCase.reviewId); this.setReviewStatus(this.testCase.reviewId);
// // //
this.testCase.reviewStatus = status; // this.testCase.reviewStatus = status;
// //
this.testCases[this.index].reviewStatus = status; this.testCases[this.index].reviewStatus = status;
if (this.index < this.testCases.length - 1) { 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) { updateTestCases(param) {
for (let i = 0; i < this.testCases.length; i++) { for (let i = 0; i < this.testCases.length; i++) {
@ -415,7 +459,7 @@ export default {
id = this.testCase.caseId; id = this.testCase.caseId;
} }
this.result = this.$get('/test/case/comment/list/' + id, res => { this.result = this.$get('/test/case/comment/list/' + id, res => {
if(res.data){ if (res.data) {
this.comments = null; this.comments = null;
this.comments = res.data; this.comments = res.data;
} }

View File

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

View File

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

View File

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