refactor: 测试计划关联列表只列出有未关联用例的接口

This commit is contained in:
chenjianxing 2020-12-29 16:43:29 +08:00
parent 2ff0726965
commit 62ac695a0b
5 changed files with 35 additions and 21 deletions

View File

@ -297,10 +297,20 @@
</select>
<select id="listRelevance" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
select
<include refid="io.metersphere.base.mapper.ApiDefinitionMapper.Base_Column_List"/>
select api_definition.id, api_definition.project_id, api_definition.num,
api_definition.name,api_definition.protocol,api_definition.path,api_definition.module_id,api_definition.module_path,api_definition.method,
api_definition.description,api_definition.request,api_definition.response,api_definition.environment_id,
api_definition.status, api_definition.user_id, api_definition.create_time, api_definition.update_time
from api_definition
inner join
api_test_case c
on c.api_definition_id = api_definition.id
and not exists (
select id
from test_plan_api_case t
where t.api_case_id = c.id
and t.test_plan_id = #{request.planId}
)
<where>
<if test="request.combine != null">
<include refid="combine">
@ -308,6 +318,7 @@
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and api_definition.name like CONCAT('%', #{request.name},'%')
</if>

View File

@ -45,11 +45,6 @@
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip/>
<el-table-column
prop="userName"
:label="$t('api_test.definition.api_principal')"
show-overflow-tooltip/>
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>

View File

@ -138,6 +138,7 @@
default: false,
},
projectId: String,
planId: String,
isTestPlan: Boolean
},
created: function () {
@ -174,7 +175,13 @@
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}
this.result = this.$post("/api/testcase/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
let url = '/api/testcase/list/';
if (this.isTestPlan) {
url = '/test/plan/api/case/relevance/list/';
this.condition.planId = this.planId;
}
this.result = this.$post(url + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});

View File

@ -34,6 +34,7 @@
:is-api-list-enable="isApiListEnable"
:project-id="projectId"
:is-test-plan="true"
:plan-id="planId"
@isApiListEnableChange="isApiListEnableChange"
ref="apiCaseList"/>
@ -82,8 +83,20 @@
},
methods: {
open() {
this.init();
this.$refs.baseRelevance.open();
},
init() {
if (this.$refs.apiList) {
this.$refs.apiList.initTable();
}
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.initTable();
}
if (this.$refs.nodeTree) {
this.$refs.nodeTree.list();
}
},
setProject(projectId) {
this.projectId = projectId;
},

View File

@ -162,18 +162,6 @@
this.moduleOptions = data;
},
saveCaseRelevance() {
let url = '';
let selectIds = [];
let param = {};
param.planId = this.planId;
param.selectIds = selectIds;
this.result = this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.refresh();
this.$refs.baseRelevance.close();
});
},
openTestCaseRelevanceDialog(model) {
if (model === 'scenario') {
this.$refs.scenarioCaseRelevance.open();