fix(接口测试): 修复自定义脚本导入api时不展示没有case接口的问题

--bug=1010932 --user=宋天阳
【接口测试】github#11239,接口定义不创建CASE,在场景中前后置脚本添加从API定义导入关联时不显示没有CASE的接口
https://www.tapd.cn/55049933/s/1115387
This commit is contained in:
song-tianyang 2022-03-09 14:34:24 +08:00 committed by xiaomeinvG
parent 3dbc32bc21
commit ab1c3f7b7b
4 changed files with 51 additions and 5 deletions

View File

@ -25,7 +25,7 @@
ref="apitable"> ref="apitable">
<template v-slot:header> <template v-slot:header>
<ms-environment-select :project-id="projectId" v-if="isTestPlan" :is-read-only="isReadOnly" <ms-environment-select :project-id="projectId" v-if="isTestPlan || isScript" :is-read-only="isReadOnly"
@setEnvironment="setEnvironment" ref="msEnvironmentSelect"/> @setEnvironment="setEnvironment" ref="msEnvironmentSelect"/>
</template> </template>
@ -80,6 +80,12 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isScript: {
type: Boolean,
default() {
return false;
}
},
isApiListEnable: { isApiListEnable: {
type: Boolean, type: Boolean,
default: false, default: false,

View File

@ -8,7 +8,7 @@
<slot name="version"></slot> <slot name="version"></slot>
</template> </template>
<ms-environment-select :project-id="projectId" v-if="isTestPlan" :is-read-only="isReadOnly" <ms-environment-select :project-id="projectId" v-if="isTestPlan || isScript" :is-read-only="isReadOnly"
@setEnvironment="setEnvironment" ref="msEnvironmentSelect"/> @setEnvironment="setEnvironment" ref="msEnvironmentSelect"/>
<el-input :placeholder="$t('commons.search_by_name_or_id')" @blur="initTable" <el-input :placeholder="$t('commons.search_by_name_or_id')" @blur="initTable"
@ -174,6 +174,12 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isScript: {
type: Boolean,
default() {
return false;
}
},
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -4,6 +4,7 @@
@setProject="setProject" @setProject="setProject"
@save="save" @save="save"
:plan-id="planId" :plan-id="planId"
:dialog-title="dialogTitle"
ref="baseRelevance"> ref="baseRelevance">
<template v-slot:aside> <template v-slot:aside>
@ -24,7 +25,8 @@
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:is-api-list-enable="isApiListEnable" :is-api-list-enable="isApiListEnable"
:project-id="projectId" :project-id="projectId"
:is-test-plan="true" :is-test-plan="isTestPlan"
:is-script="isScript"
:plan-id="planId" :plan-id="planId"
@isApiListEnableChange="isApiListEnableChange" @isApiListEnableChange="isApiListEnableChange"
ref="apiList"/> ref="apiList"/>
@ -35,7 +37,8 @@
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:is-api-list-enable="isApiListEnable" :is-api-list-enable="isApiListEnable"
:project-id="projectId" :project-id="projectId"
:is-test-plan="true" :is-test-plan="isTestPlan"
:is-script="isScript"
:plan-id="planId" :plan-id="planId"
@isApiListEnableChange="isApiListEnableChange" @isApiListEnableChange="isApiListEnableChange"
ref="apiCaseList"/> ref="apiCaseList"/>
@ -68,6 +71,7 @@ export default {
currentModule: null, currentModule: null,
selectNodeIds: [], selectNodeIds: [],
moduleOptions: {}, moduleOptions: {},
dialogTitle:this.$t('test_track.plan_view.relevance_test_case'),
trashEnable: false, trashEnable: false,
isApiListEnable: true, isApiListEnable: true,
condition: {}, condition: {},
@ -79,12 +83,42 @@ export default {
props: { props: {
planId: { planId: {
type: String type: String
},
isTestPlan: {
type: Boolean,
default() {
return true;
}
},
isScript: {
type: Boolean,
default() {
return false;
}
}
},
created() {
if(this.isScript){
if(this.isApiListEnable){
this.dialogTitle = this.$t('permission.project_api_definition.import_api');
}else {
this.dialogTitle = this.$t('permission.project_track_case.import');
}
} }
}, },
watch: { watch: {
planId() { planId() {
this.condition.planId = this.planId; this.condition.planId = this.planId;
}, },
isApiListEnable(){
if(this.isScript){
if(this.isApiListEnable){
this.dialogTitle = this.$t('permission.project_api_definition.import_api');
}else {
this.dialogTitle = this.$t('permission.project_track_case.import');
}
}
}
}, },
methods: { methods: {
open() { open() {

View File

@ -24,7 +24,7 @@
</div> </div>
<custom-function-relate ref="customFunctionRelate" @addCustomFuncScript="handleCodeTemplate"/> <custom-function-relate ref="customFunctionRelate" @addCustomFuncScript="handleCodeTemplate"/>
<!--接口列表--> <!--接口列表-->
<api-func-relevance @save="apiSave" @close="apiClose" ref="apiFuncRelevance"/> <api-func-relevance @save="apiSave" :is-test-plan="false" :is-script="true" @close="apiClose" ref="apiFuncRelevance"/>
</div> </div>
</template> </template>