refactor: 测试计划关联列表只列出有未关联用例的接口
This commit is contained in:
parent
2ff0726965
commit
62ac695a0b
|
@ -297,10 +297,20 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listRelevance" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
|
<select id="listRelevance" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
|
||||||
select
|
select api_definition.id, api_definition.project_id, api_definition.num,
|
||||||
<include refid="io.metersphere.base.mapper.ApiDefinitionMapper.Base_Column_List"/>
|
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
|
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>
|
<where>
|
||||||
<if test="request.combine != null">
|
<if test="request.combine != null">
|
||||||
<include refid="combine">
|
<include refid="combine">
|
||||||
|
@ -308,6 +318,7 @@
|
||||||
<property name="name" value="request.name"/>
|
<property name="name" value="request.name"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="request.name != null">
|
<if test="request.name != null">
|
||||||
and api_definition.name like CONCAT('%', #{request.name},'%')
|
and api_definition.name like CONCAT('%', #{request.name},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -45,11 +45,6 @@
|
||||||
:label="$t('api_test.definition.api_path')"
|
:label="$t('api_test.definition.api_path')"
|
||||||
show-overflow-tooltip/>
|
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">
|
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
|
|
|
@ -138,6 +138,7 @@
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
projectId: String,
|
projectId: String,
|
||||||
|
planId: String,
|
||||||
isTestPlan: Boolean
|
isTestPlan: Boolean
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
|
@ -174,7 +175,13 @@
|
||||||
if (this.currentProtocol != null) {
|
if (this.currentProtocol != null) {
|
||||||
this.condition.protocol = this.currentProtocol;
|
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.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
:is-api-list-enable="isApiListEnable"
|
:is-api-list-enable="isApiListEnable"
|
||||||
:project-id="projectId"
|
:project-id="projectId"
|
||||||
:is-test-plan="true"
|
:is-test-plan="true"
|
||||||
|
:plan-id="planId"
|
||||||
@isApiListEnableChange="isApiListEnableChange"
|
@isApiListEnableChange="isApiListEnableChange"
|
||||||
ref="apiCaseList"/>
|
ref="apiCaseList"/>
|
||||||
|
|
||||||
|
@ -82,8 +83,20 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
|
this.init();
|
||||||
this.$refs.baseRelevance.open();
|
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) {
|
setProject(projectId) {
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
},
|
},
|
||||||
|
|
|
@ -162,18 +162,6 @@
|
||||||
this.moduleOptions = data;
|
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) {
|
openTestCaseRelevanceDialog(model) {
|
||||||
if (model === 'scenario') {
|
if (model === 'scenario') {
|
||||||
this.$refs.scenarioCaseRelevance.open();
|
this.$refs.scenarioCaseRelevance.open();
|
||||||
|
|
Loading…
Reference in New Issue