refactor(功能用例): 用例详情富文本框自定义字段,从右侧基础信息移到左侧
--story=1015721 --user=陈建星 【三星】测试用例模板:自定义字段类型为富文本类型,功能测试用例明细中,支持放在左侧,和默认的字段(前置条件和步骤描述)展示形式一样 https://www.tapd.cn/55049933/s/1566955
This commit is contained in:
parent
18f47640c3
commit
d69c77a60e
|
@ -119,10 +119,14 @@
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<ms-mark-down-text
|
<ms-mark-down-text
|
||||||
|
v-if="contentObject.content.defaultValue"
|
||||||
class="rich-text"
|
class="rich-text"
|
||||||
prop="defaultValue"
|
prop="defaultValue"
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
:data="contentObject.content"/>
|
:data="contentObject.content"/>
|
||||||
|
<div class="empty" v-else @click="handleReadTextClick">
|
||||||
|
{{ $t("case.none") }}
|
||||||
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="empty" v-else @click="handleReadTextClick">
|
<div class="empty" v-else @click="handleReadTextClick">
|
||||||
|
|
|
@ -224,6 +224,9 @@
|
||||||
:comments.sync="comments"
|
:comments.sync="comments"
|
||||||
@openComment="openComment"
|
@openComment="openComment"
|
||||||
@getComments="getComments"
|
@getComments="getComments"
|
||||||
|
:test-case-template="testCaseTemplate"
|
||||||
|
:custom-field-form="customFieldForm"
|
||||||
|
:custom-field-rules="customFieldRules"
|
||||||
:version-enable="versionEnable"
|
:version-enable="versionEnable"
|
||||||
:default-open="richTextDefaultOpen"
|
:default-open="richTextDefaultOpen"
|
||||||
ref="otherInfo"
|
ref="otherInfo"
|
||||||
|
@ -1589,6 +1592,9 @@ export default {
|
||||||
if (!this.$refs.testCaseBaseInfo.validateWithTip()) {
|
if (!this.$refs.testCaseBaseInfo.validateWithTip()) {
|
||||||
isValidate = false;
|
isValidate = false;
|
||||||
}
|
}
|
||||||
|
if (!this.$refs.otherInfo.validateForm()) {
|
||||||
|
isValidate = false;
|
||||||
|
}
|
||||||
return isValidate;
|
return isValidate;
|
||||||
},
|
},
|
||||||
async createVersion(row) {
|
async createVersion(row) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-row v-for="i in customFieldRowNums" :key="i">
|
<el-row v-for="i in customFieldRowNums" :key="i">
|
||||||
<span class="custom-item" v-for="(item, j) in issueTemplate.customFields" :key="j">
|
<span class="custom-item" v-for="(item, j) in customFields" :key="j">
|
||||||
<template v-if="j >= (i - 1) * 3 && j < (i - 1) * 3 + 3">
|
<template v-if="j >= (i - 1) * 3 && j < (i - 1) * 3 + 3">
|
||||||
<div class="custom-row case-wrap">
|
<div class="custom-row case-wrap">
|
||||||
<div class="case-title-wrap">
|
<div class="case-title-wrap">
|
||||||
|
@ -89,9 +89,14 @@ export default {
|
||||||
projectId: String
|
projectId: String
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
customFields() {
|
||||||
|
// 基本信息不显示富文本的自定义字段
|
||||||
|
return this.issueTemplate && this.issueTemplate.customFields ?
|
||||||
|
this.issueTemplate.customFields.filter((item) => item.type !== 'richText') : [];
|
||||||
|
},
|
||||||
customFieldRowNums() {
|
customFieldRowNums() {
|
||||||
let size = this.issueTemplate.customFields
|
let size = this.customFields
|
||||||
? this.issueTemplate.customFields.length
|
? this.customFields.length
|
||||||
: 0;
|
: 0;
|
||||||
let val = parseInt(size / 3);
|
let val = parseInt(size / 3);
|
||||||
return size % 3 === 0 ? val : val + 1;
|
return size % 3 === 0 ? val : val + 1;
|
||||||
|
|
|
@ -161,6 +161,55 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-form
|
||||||
|
:model="customFieldForm"
|
||||||
|
:rules="customFieldRules"
|
||||||
|
ref="textCustomFieldForm"
|
||||||
|
label-position="right"
|
||||||
|
size="small"
|
||||||
|
class="case-form case-padding"
|
||||||
|
>
|
||||||
|
<!-- 富文本自定义字段 -->
|
||||||
|
<div class="remark-row" v-for="item in richTextCustomFields">
|
||||||
|
<div class="remark-name case-title-wrap">
|
||||||
|
<div class="name title-wrap">
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
<div class="required required-item" v-if="item.required"></div>
|
||||||
|
</div>
|
||||||
|
<div class="content-wrap">
|
||||||
|
<div class="opt-row">
|
||||||
|
<base-edit-item-component
|
||||||
|
:editable="editable"
|
||||||
|
:auto-save="!readOnly"
|
||||||
|
trigger="hover"
|
||||||
|
:contentObject="{
|
||||||
|
content: item,
|
||||||
|
contentType: 'CUSTOM',
|
||||||
|
}"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:project-id="projectId"
|
||||||
|
>
|
||||||
|
<template v-slot:content="{ onClick, hoverEditable }">
|
||||||
|
<div :class="hoverEditable ? 'selectHover' : ''">
|
||||||
|
<el-form-item :prop="item.name">
|
||||||
|
<ms-custom-filed-component
|
||||||
|
:data="item"
|
||||||
|
:form="customFieldForm"
|
||||||
|
prop="defaultValue"
|
||||||
|
:project-id="projectId"
|
||||||
|
@onClick="onClick"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</base-edit-item-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
<!-- remark -->
|
<!-- remark -->
|
||||||
<div class="remark-row">
|
<div class="remark-row">
|
||||||
<div class="remark-name case-title-wrap">
|
<div class="remark-name case-title-wrap">
|
||||||
|
@ -219,6 +268,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -228,6 +278,7 @@ import TestCaseStepItem from "@/business/case/components/case/CaseStepItem";
|
||||||
import StepChangeItem from "@/business/case/components/case/CaseStepChange";
|
import StepChangeItem from "@/business/case/components/case/CaseStepChange";
|
||||||
import CaseAttachmentComponent from "@/business/case/components/case/CaseAttachmentComponent";
|
import CaseAttachmentComponent from "@/business/case/components/case/CaseAttachmentComponent";
|
||||||
import MsFileBatchMove from "metersphere-frontend/src/components/environment/commons/variable/FileBatchMove";
|
import MsFileBatchMove from "metersphere-frontend/src/components/environment/commons/variable/FileBatchMove";
|
||||||
|
import MsCustomFiledComponent from "metersphere-frontend/src/components/new-ui/MsCustomFiledComponent";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CaseDetailComponent",
|
name: "CaseDetailComponent",
|
||||||
|
@ -237,6 +288,7 @@ export default {
|
||||||
TestCaseStepItem,
|
TestCaseStepItem,
|
||||||
StepChangeItem,
|
StepChangeItem,
|
||||||
CaseAttachmentComponent,
|
CaseAttachmentComponent,
|
||||||
|
MsCustomFiledComponent
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -271,7 +323,22 @@ export default {
|
||||||
isCopy: Boolean,
|
isCopy: Boolean,
|
||||||
editableState: Boolean,
|
editableState: Boolean,
|
||||||
isPublicShow: Boolean,
|
isPublicShow: Boolean,
|
||||||
isReadonlyUser: Boolean
|
isReadonlyUser: Boolean,
|
||||||
|
testCaseTemplate: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
customFieldForm: Object,
|
||||||
|
customFieldRules: Object,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
richTextCustomFields() {
|
||||||
|
// 基本信息不显示富文本的自定义字段
|
||||||
|
return this.testCaseTemplate && this.testCaseTemplate.customFields ?
|
||||||
|
this.testCaseTemplate.customFields.filter((item) => item.type == 'richText') : [];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getUploadFiles() {
|
getUploadFiles() {
|
||||||
|
@ -312,13 +379,18 @@ export default {
|
||||||
handleSaveEvent() {
|
handleSaveEvent() {
|
||||||
//触发保存 TODO
|
//触发保存 TODO
|
||||||
},
|
},
|
||||||
valideForm() {
|
validateForm() {
|
||||||
let isValidate = true;
|
let isValidate = true;
|
||||||
this.$refs["caseDetailForm"].validate((valid) => {
|
this.$refs["caseDetailForm"].validate((valid) => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
isValidate = false;
|
isValidate = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.$refs["textCustomFieldForm"].validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
isValidate = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
return isValidate;
|
return isValidate;
|
||||||
},
|
},
|
||||||
getFileMetaData(id) {
|
getFileMetaData(id) {
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
:form="form"
|
:form="form"
|
||||||
:richTextDefaultOpen="richTextDefaultOpen"
|
:richTextDefaultOpen="richTextDefaultOpen"
|
||||||
:formLabelWidth="formLabelWidth"
|
:formLabelWidth="formLabelWidth"
|
||||||
|
:test-case-template="testCaseTemplate"
|
||||||
|
:custom-field-form="customFieldForm"
|
||||||
|
:custom-field-rules="customFieldRules"
|
||||||
></case-detail-component>
|
></case-detail-component>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
@ -188,6 +191,9 @@
|
||||||
:editable-state="editableState"
|
:editable-state="editableState"
|
||||||
:form="form"
|
:form="form"
|
||||||
:richTextDefaultOpen="richTextDefaultOpen"
|
:richTextDefaultOpen="richTextDefaultOpen"
|
||||||
|
:test-case-template="testCaseTemplate"
|
||||||
|
:custom-field-form="customFieldForm"
|
||||||
|
:custom-field-rules="customFieldRules"
|
||||||
:formLabelWidth="formLabelWidth"
|
:formLabelWidth="formLabelWidth"
|
||||||
ref="testCaseBaseInfo"
|
ref="testCaseBaseInfo"
|
||||||
></case-detail-component>
|
></case-detail-component>
|
||||||
|
@ -246,7 +252,10 @@ export default {
|
||||||
"edit",
|
"edit",
|
||||||
"editableState",
|
"editableState",
|
||||||
"isPublicShow",
|
"isPublicShow",
|
||||||
"isReadonlyUser"
|
"isReadonlyUser",
|
||||||
|
"testCaseTemplate",
|
||||||
|
"customFieldForm",
|
||||||
|
"customFieldRules"
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -332,7 +341,7 @@ export default {
|
||||||
validateForm() {
|
validateForm() {
|
||||||
let isValidate = true;
|
let isValidate = true;
|
||||||
if (this.$refs.testCaseBaseInfo) {
|
if (this.$refs.testCaseBaseInfo) {
|
||||||
isValidate = this.$refs["testCaseBaseInfo"].valideForm();
|
isValidate = this.$refs["testCaseBaseInfo"].validateForm();
|
||||||
}
|
}
|
||||||
return isValidate;
|
return isValidate;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue