refactor: --story=1002988 --user=刘瑞斌 16.功能测试用例添加评论的编辑框改成用例评审的评论编辑框一致 https://www.tapd.cn/55049933/s/1048049

This commit is contained in:
Captain.B 2021-09-17 16:56:34 +08:00 committed by 刘瑞斌
parent 062db32e77
commit 6d85fd55f9
1 changed files with 96 additions and 18 deletions

View File

@ -2,20 +2,14 @@
<el-dialog :visible.sync="dialogTableVisible">
<div v-loading="result.loading">
<div class="editors_div_style">
<div id="editorsDiv">
<mavon-editor :disabled="isReadOnly"
@imgAdd="imgAdd" :default-open="'edit'" class="review-mavon-editor" :imageFilter="imageFilter"
:toolbars="richDataToolbars" @imgDel="imgDel" v-model="textarea" ref="md"/>
</div>
</div>
<div>
<el-input
type="textarea"
:placeholder="$t('test_track.comment.send_comment')"
v-model="textarea"
maxlength="60"
show-word-limit
resize="none"
:autosize="{ minRows: 4, maxRows: 4}"
@keyup.ctrl.enter.native="sendComment"
:disabled="isReadOnly"
>
</el-input>
<el-button type="primary" size="mini" class="send-btn" @click="sendComment" :disabled="isReadOnly">
{{ $t('test_track.comment.send') }}
</el-button>
@ -41,15 +35,50 @@ export default {
result: {},
textarea: '',
isReadOnly: false,
dialogTableVisible: false
}
dialogTableVisible: false,
richDataToolbars: {
bold: false, //
italic: false, //
header: false, //
underline: false, // 线
strikethrough: false, // 线
mark: false, //
superscript: false, //
subscript: false, //
quote: false, //
ol: false, //
ul: false, //
link: false, //
imagelink: true, //
code: false, // code
table: false, //
fullscreen: false, //
readmodel: false, //
htmlcode: false, // html
help: false, //
/* 1.3.5 */
undo: false, //
redo: false, //
trash: false, //
save: false, // eventssave
/* 1.4.2 */
navigation: false, //
/* 2.1.8 */
alignleft: false, //
aligncenter: false, //
alignright: false, //
/* 2.2.1 */
subfield: false, //
preview: false, //
}
};
},
created() {
},
methods: {
open() {
this.dialogTableVisible = true
this.dialogTableVisible = true;
},
sendComment() {
let comment = {};
@ -63,14 +92,52 @@ export default {
this.$success(this.$t('test_track.comment.send_success'));
this.refresh(comment.caseId);
this.textarea = '';
this.dialogTableVisible = false
this.dialogTableVisible = false;
});
},
refresh(id) {
this.$emit('getComments');
},
//
imgAdd(pos, file) {
let param = {
id: getUUID().substring(0, 8)
};
file.prefix = param.id;
this.result = this.$fileUpload('/resource/md/upload', file, null, param, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.md.$img2Url(pos, '/resource/md/get/' + param.id+"_"+file.name);
this.sendComment();
});
this.$emit('imgAdd', file);
},
imageFilter(file){
let isImg = false;
if(file){
if(file.name){
if (file.name.indexOf("[")> 0 || file.name.indexOf("]") > 0||file.name.indexOf("([)")> 0 || file.name.indexOf(")") > 0){
this.$error("图片名称不能含有特殊字符");
isImg = false;
}else {
isImg = true;
}
}
}
return isImg;
},
imgDel(file) {
let fileUrl = file[1].prefix + "_" + file[1].name;
let comments = this.$refs.reviewComments;
comments.forEach(item => {
let imgCheckResult = item.checkByUrls(fileUrl);
if(imgCheckResult){
item.deleteComment();
}
});
},
}
}
};
</script>
<style scoped>
@ -83,4 +150,15 @@ export default {
overflow-y: scroll;
height: calc(100vh - 250px);
}
.editors_div_style {
height: 300px;
overflow: auto
}
.review-mavon-editor {
min-height: 20px;
height: 300px;
overflow: auto
}
</style>