fix(测试跟踪): 优化功能用例编辑页面

优化功能用例编辑页面
This commit is contained in:
song-tianyang 2022-04-13 14:51:33 +08:00 committed by TIanyang
parent d1d36352c3
commit e12ec631a1
3 changed files with 86 additions and 32 deletions

View File

@ -131,7 +131,7 @@
:select-node="selectNode" :select-node="selectNode"
:select-condition="condition" :select-condition="condition"
:public-enable="currentActiveName === 'default' ? false : true" :public-enable="currentActiveName === 'default' ? false : true"
:type="type" :case-type="type"
@addTab="addTab" @addTab="addTab"
ref="testCaseEdit"> ref="testCaseEdit">
</test-case-edit> </test-case-edit>

View File

@ -1,9 +1,9 @@
<template> <template>
<el-card> <el-card :bodyStyle="{padding:'0px'}">
<div class="card-content"> <div class="card-content">
<div class="ms-main-div" @click="showAll"> <div class="ms-main-div" @click="showAll">
<ms-container v-loading="result.loading" style="overflow: auto"> <ms-container v-loading="result.loading" style="overflow: auto">
<ms-aside-container :height="pageHight" width="360px"> <ms-aside-container :height="pageHight">
<test-case-base-info <test-case-base-info
:form="form" :form="form"
:is-form-alive="isFormAlive" :is-form-alive="isFormAlive"
@ -48,6 +48,7 @@
@compare="compare" @checkout="checkout" @create="create" @del="del"/> @compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand" <el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px" @command="handleCommand" size="small" style="float: right;margin-right: 20px"
v-if="(this.path ==='/test/case/add') || (this.isPublic && this.isXpack)"
:disabled="readOnly"> :disabled="readOnly">
{{ $t('commons.save') }} {{ $t('commons.save') }}
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
@ -61,6 +62,10 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button v-else type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.save') }}
</el-button>
</div> </div>
<ms-form-divider :title="$t('test_track.case.step_info')"/> <ms-form-divider :title="$t('test_track.case.step_info')"/>
@ -81,30 +86,10 @@
<test-case-edit-other-info :read-only="readOnly" :project-id="projectIds" :form="form" <test-case-edit-other-info :read-only="readOnly" :project-id="projectIds" :form="form"
:is-copy="currentTestCaseInfo.isCopy" :is-copy="currentTestCaseInfo.isCopy"
:label-width="formLabelWidth" :case-id="form.id" :label-width="formLabelWidth" :case-id="form.id"
:type="type" :comments="comments"
@openComment="openComment"
:version-enable="versionEnable" :version-enable="versionEnable"
ref="otherInfo"/> ref="otherInfo"/>
<el-row style="margin-top: 10px" v-if="type!=='add'">
<el-col :span="20" :offset="1">{{ $t('test_track.review.comment') }}:
<el-button icon="el-icon-plus" type="mini" @click="openComment"></el-button>
</el-col>
</el-row>
<el-row v-if="type!=='add'">
<el-col :span="20" :offset="1">
<review-comment-item v-for="(comment,index) in comments"
:key="index"
:comment="comment"
@refresh="getComments" api-url="/test/case"/>
<div v-if="comments.length === 0" style="text-align: center">
<i class="el-icon-chat-line-square" style="font-size: 15px;color: #8a8b8d;">
<span style="font-size: 15px; color: #8a8b8d;">
{{ $t('test_track.comment.no_comment') }}
</span>
</i>
</div>
</el-col>
</el-row>
<test-case-comment :case-id="form.id" <test-case-comment :case-id="form.id"
@getComments="getComments" ref="testCaseComment"/> @getComments="getComments" ref="testCaseComment"/>
</el-form> </el-form>
@ -217,6 +202,7 @@ export default {
showFollow: false, showFollow: false,
isValidate: false, isValidate: false,
currentValidateName: "", currentValidateName: "",
type:"",
form: { form: {
name: '', name: '',
module: 'default-module', module: 'default-module',
@ -308,7 +294,7 @@ export default {
selectCondition: { selectCondition: {
type: Object type: Object
}, },
type: String, caseType: String,
publicEnable: { publicEnable: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -390,6 +376,7 @@ export default {
}, },
created() { created() {
this.type = this.caseType;
if (!this.projectList || this.projectList.length === 0) { // if (!this.projectList || this.projectList.length === 0) { //
this.$get("/project/listAll", (response) => { this.$get("/project/listAll", (response) => {
this.projectList = response.data; //, this.projectList = response.data; //,
@ -717,6 +704,7 @@ export default {
} else { } else {
param.id = response.data.id; param.id = response.data.id;
this.$emit("caseCreate", param); this.$emit("caseCreate", param);
this.type = 'edit';
this.close(); this.close();
} }
this.form.id = response.data.id; this.form.id = response.data.id;
@ -1105,7 +1093,7 @@ export default {
.ms-opt-btn { .ms-opt-btn {
position: fixed; position: fixed;
right: 50px; right: 50px;
z-index: 9; z-index: 9999!important;
} }
.ms-case-input { .ms-case-input {

View File

@ -41,7 +41,8 @@
<template v-slot:label> <template v-slot:label>
<tab-pane-count :title="$t('commons.relationship.name')" :count="relationshipCount"/> <tab-pane-count :title="$t('commons.relationship.name')" :count="relationshipCount"/>
</template> </template>
<dependencies-list @setCount="setRelationshipCount" :read-only="readOnly" :resource-id="caseId" :version-enable="versionEnable" resource-type="TEST_CASE" ref="relationship"/> <dependencies-list @setCount="setRelationshipCount" :read-only="readOnly" :resource-id="caseId"
:version-enable="versionEnable" resource-type="TEST_CASE" ref="relationship"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('test_track.case.attachment')" name="attachment"> <el-tab-pane :label="$t('test_track.case.attachment')" name="attachment">
@ -72,6 +73,36 @@
</el-col> </el-col>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="type!=='add'" :label="$t('test_track.review.comment')" name="comment">
<el-tooltip class="item-tabs" effect="dark" :content="$t('test_track.review.comment')" placement="top-start" slot="label">
<span>
{{ $t('test_track.review.comment') }}
<div class="el-step__icon is-text ms-api-col ms-header" v-if="comments.length>0">
<div class="el-step__icon-inner">{{ comments.length }}</div>
</div>
</span>
</el-tooltip>
<el-row style="margin-top: 10px" v-if="type!=='add'">
<el-col :span="20" :offset="1">{{ $t('test_track.review.comment') }}:
<el-button icon="el-icon-plus" type="mini" @click="openComment"></el-button>
</el-col>
</el-row>
<el-row v-if="type!=='add'">
<el-col :span="20" :offset="1">
<review-comment-item v-for="(comment,index) in comments"
:key="index"
:comment="comment"
@refresh="getComments" api-url="/test/case"/>
<div v-if="comments.length === 0" style="text-align: center">
<i class="el-icon-chat-line-square" style="font-size: 15px;color: #8a8b8d;">
<span style="font-size: 15px; color: #8a8b8d;">
{{ $t('test_track.comment.no_comment') }}
</span>
</i>
</div>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
@ -86,6 +117,8 @@ import TestCaseTestRelate from "@/business/components/track/case/components/Test
import DependenciesList from "@/business/components/common/components/graph/DependenciesList"; import DependenciesList from "@/business/components/common/components/graph/DependenciesList";
import TabPaneCount from "@/business/components/track/plan/view/comonents/report/detail/component/TabPaneCount"; import TabPaneCount from "@/business/components/track/plan/view/comonents/report/detail/component/TabPaneCount";
import {getRelationshipCountCase} from "@/network/testCase"; import {getRelationshipCountCase} from "@/network/testCase";
import TestCaseComment from "@/business/components/track/case/components/TestCaseComment";
import ReviewCommentItem from "@/business/components/track/review/commom/ReviewCommentItem";
export default { export default {
name: "TestCaseEditOtherInfo", name: "TestCaseEditOtherInfo",
@ -93,8 +126,11 @@ export default {
TabPaneCount, TabPaneCount,
DependenciesList, DependenciesList,
TestCaseTestRelate, TestCaseTestRelate,
FormRichTextItem, TestCaseIssueRelate, TestCaseAttachment, MsRichText, TestCaseRichText}, TestCaseComment,
props: ['form', 'labelWidth', 'caseId', 'readOnly', 'projectId', 'isTestPlan', 'planId', 'versionEnable', 'isCopy', 'isTestPlanEdit'], ReviewCommentItem,
FormRichTextItem, TestCaseIssueRelate, TestCaseAttachment, MsRichText, TestCaseRichText
},
props: ['form', 'labelWidth', 'caseId', 'readOnly', 'projectId', 'isTestPlan', 'planId', 'versionEnable', 'isCopy', 'isTestPlanEdit', 'type', 'comments'],
data() { data() {
return { return {
result: {}, result: {},
@ -153,6 +189,20 @@ export default {
updateRemark(text) { updateRemark(text) {
this.form.remark = text; this.form.remark = text;
}, },
openComment() {
this.$emit('openComment');
},
getComments(testCase) {
let id = '';
if (testCase) {
id = testCase.id;
} else {
id = this.form.id;
}
this.result = this.$get('/test/case/comment/list/' + id, res => {
this.comments = res.data;
})
},
setRelationshipCount(count) { setRelationshipCount(count) {
this.relationshipCount = count; this.relationshipCount = count;
}, },
@ -280,13 +330,21 @@ export default {
if (response.data.data && response.data.data.length > 0) { if (response.data.data && response.data.data.length > 0) {
this.buildDemandCascaderOptions(response.data.data, this.demandOptions, []); this.buildDemandCascaderOptions(response.data.data, this.demandOptions, []);
} }
this.demandOptions.unshift({value: 'other', label: 'Other: ' + this.$t('test_track.case.other'), platform: 'Other'}); this.demandOptions.unshift({
value: 'other',
label: 'Other: ' + this.$t('test_track.case.other'),
platform: 'Other'
});
if (this.form.demandId === 'other') { if (this.form.demandId === 'other') {
this.demandValue = ['other']; this.demandValue = ['other'];
} }
this.result = {loading: false}; this.result = {loading: false};
}).catch(() => { }).catch(() => {
this.demandOptions.unshift({value: 'other', label: 'Other: ' + this.$t('test_track.case.other'), platform: 'Other'}); this.demandOptions.unshift({
value: 'other',
label: 'Other: ' + this.$t('test_track.case.other'),
platform: 'Other'
});
if (this.form.demandId === 'other') { if (this.form.demandId === 'other') {
this.demandValue = ['other']; this.demandValue = ['other'];
} }
@ -335,4 +393,12 @@ export default {
.el-cascader >>> .el-input { .el-cascader >>> .el-input {
cursor: pointer; cursor: pointer;
} }
.ms-header{
background: #783887;
color: white;
height: 18px;
width: 18px;
font-size: xx-small;
border-radius: 50%;
}
</style> </style>