fix: 用例评审 不通过 时评论为必填 高亮显示输入框

This commit is contained in:
wenyann 2021-05-13 16:36:40 +08:00 committed by 刘瑞斌
parent 103b2946fa
commit 0c084a3c77
2 changed files with 47 additions and 21 deletions

View File

@ -15,15 +15,16 @@
</div> </div>
<div> <div>
<el-input <el-input
type="textarea" ref="test"
:placeholder="$t('test_track.comment.send_comment')" type="textarea"
v-model="textarea" :placeholder="$t('test_track.comment.send_comment')"
maxlength="180" v-model.trim="textarea"
show-word-limt maxlength="180"
resize="none" show-word-limt
:autosize="{ minRows: 4, maxRows: 4}" resize="none"
@keyup.ctrl.enter.native="sendComment" :autosize="{ minRows: 4, maxRows: 4}"
:disabled="isReadOnly" @keyup.ctrl.enter.native="sendComment"
:disabled="isReadOnly"
> >
</el-input> </el-input>
<el-button type="primary" size="mini" class="send-btn" @click="sendComment" :disabled="isReadOnly"> <el-button type="primary" size="mini" class="send-btn" @click="sendComment" :disabled="isReadOnly">
@ -71,6 +72,9 @@ export default {
this.textarea = ''; this.textarea = '';
}); });
}, },
inputLight() {
this.$refs.test.focus();
},
refresh() { refresh() {
this.$emit('getComments'); this.$emit('getComments');
}, },

View File

@ -115,7 +115,7 @@
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"/> @getComments="getComments" ref="reviewComment"/>
</el-card> </el-card>
</el-col> </el-col>
</div> </div>
@ -256,18 +256,40 @@ export default {
param.caseId = this.testCase.caseId; param.caseId = this.testCase.caseId;
param.reviewId = this.testCase.reviewId; param.reviewId = this.testCase.reviewId;
param.status = status; param.status = status;
this.$post('/test/review/case/edit', param, () => { //reviewComment
this.$success(this.$t('commons.save_success')); if (status == 'UnPass') {
this.updateTestCases(param); if (this.comments.length > 0) {
this.setReviewStatus(this.testCase.reviewId); this.$post('/test/review/case/edit', param, () => {
// this.$success(this.$t('commons.save_success'));
this.testCase.reviewStatus = status; this.updateTestCases(param);
// this.setReviewStatus(this.testCase.reviewId);
this.testCases[this.index].reviewStatus = status; //
if (this.index < this.testCases.length - 1) { this.testCase.reviewStatus = status;
this.handleNext(); //
this.testCases[this.index].reviewStatus = 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, () => {
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;
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++) {