fix: 编辑用例控制台报错

This commit is contained in:
chenjianxing 2021-05-26 13:05:34 +08:00 committed by jianxing
parent 07dbb1ef23
commit bfca311bfd
2 changed files with 24 additions and 6 deletions

View File

@ -1,7 +1,6 @@
<template>
<el-form-item :disable="true" :label="title" :prop="prop" :label-width="labelWidth">
<!-- <test-case-rich-text :disabled="disabled" :content="data[prop]" @updateRichText="updateData"/>-->
<mavon-editor :editable="!disabled" @imgAdd="imgAdd" :default-open="disabled ? 'preview' : null" class="mavon-editor"
<mavon-editor v-if="active" :editable="!disabled" @imgAdd="imgAdd" :default-open="disabled ? 'preview' : null" class="mavon-editor"
:subfield="disabled ? false : true" :toolbars="toolbars" @imgDel="imgDel" v-model="data[prop]" ref="md"/>
</el-form-item>
</template>
@ -51,10 +50,15 @@ export default {
}
}
},
computed: {
active() {
if (this.data[this.prop] !== undefined) {
return true;
}
return false;
}
},
methods: {
updateData(value) {
this.data[this.prop] = value;
},
imgAdd(pos, file){
let param = {
id: getUUID().substring(0, 8)

View File

@ -367,7 +367,20 @@
}
}
},
setDefaultValue() {
if (!this.form.prerequisite) {
this.form.prerequisite = "";
}
if (!this.form.stepDescription) {
this.form.stepDescription = "";
}
if (!this.form.expectedResult) {
this.form.expectedResult = "";
}
if (!this.form.remark) {
this.form.remark = "";
}
},
handleCommand(e) {
if (e === "ADD_AND_CREATE") {
this.$refs['caseFrom'].validate((valid) => {
@ -524,6 +537,7 @@
this.form.module = testCase.nodeId;
//
parseCustomField(this.form, this.testCaseTemplate, this.customFieldForm, this.customFieldRules, buildTestCaseOldFields(this.form));
this.setDefaultValue();
//
this.reloadForm();
},