fix: 版本管理列表相关bug
This commit is contained in:
parent
7825059db7
commit
75700557c8
|
@ -27,6 +27,8 @@ public class TestPlanScenarioRequest {
|
|||
private Map<String, Object> combine;
|
||||
private List<String> ids;
|
||||
private String reviewId;
|
||||
private String versionId;
|
||||
private String refId;
|
||||
|
||||
/**
|
||||
* 是否选中所有数据
|
||||
|
|
|
@ -24,20 +24,48 @@
|
|||
</select>
|
||||
|
||||
<select id="list" resultType="io.metersphere.api.dto.automation.ApiScenarioDTO">
|
||||
select
|
||||
t.id, t.environment, t.create_time, t.update_time, t.last_result, t.pass_rate, t.report_id, c.scenario_definition,
|
||||
c.id as case_id, c.user_id,c.api_scenario_module_id, c.module_path, c.name, c.level,
|
||||
c.status, c.principal, c.step_total, c.schedule, c.description, c.tags, t.create_user, c.project_id,
|
||||
c.num, c.custom_num, t.environment_group_id, t.environment_type
|
||||
from
|
||||
SELECT
|
||||
t.id,
|
||||
t.environment,
|
||||
t.create_time,
|
||||
t.update_time,
|
||||
t.last_result,
|
||||
t.pass_rate,
|
||||
t.report_id,
|
||||
c.scenario_definition,
|
||||
c.id AS case_id,
|
||||
c.user_id,
|
||||
c.api_scenario_module_id,
|
||||
c.module_path,
|
||||
c. NAME,
|
||||
c. LEVEL,
|
||||
c. STATUS,
|
||||
c.principal,
|
||||
c.step_total,
|
||||
c. SCHEDULE,
|
||||
c.description,
|
||||
c.tags,
|
||||
t.create_user,
|
||||
c.project_id,
|
||||
c.num,
|
||||
c.custom_num,
|
||||
t.environment_group_id,
|
||||
t.environment_type,
|
||||
project_version. NAME versionName,
|
||||
project_version.id versionId
|
||||
FROM
|
||||
test_plan_api_scenario t
|
||||
inner join
|
||||
api_scenario c
|
||||
on t.api_scenario_id = c.id and c.status != 'Trash'
|
||||
INNER JOIN api_scenario c ON t.api_scenario_id = c.id
|
||||
INNER JOIN project_version ON c.project_id = project_version.project_id
|
||||
AND c.version_id = project_version.id
|
||||
AND c. STATUS != 'Trash'
|
||||
<if test="request.planId != null and request.planId!=''">
|
||||
and t.test_plan_id = #{request.planId}
|
||||
</if>
|
||||
where 1
|
||||
WHERE 1
|
||||
<include refid="queryVersionCondition">
|
||||
<property name="versionTable" value="c"/>
|
||||
</include>
|
||||
|
||||
<if test="request.scenarioIds != null and request.scenarioIds.size() > 0">
|
||||
and c.id in
|
||||
|
@ -72,7 +100,7 @@
|
|||
</foreach>
|
||||
</if>
|
||||
|
||||
<include refid="filers"/>
|
||||
<include refid="filters"/>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
|
@ -132,7 +160,7 @@
|
|||
#{nodeId}
|
||||
</foreach>
|
||||
</if>
|
||||
<include refid="filers"/>
|
||||
<include refid="filters"/>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
|
@ -148,7 +176,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<sql id="filers">
|
||||
<sql id="filters">
|
||||
<if test="request.filters != null and request.filters.size() > 0">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
|
@ -165,6 +193,12 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key == 'version_id'">
|
||||
and c.version_id in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
@ -275,4 +309,16 @@
|
|||
</if>
|
||||
order by `order` desc limit 1;
|
||||
</select>
|
||||
|
||||
<sql id="queryVersionCondition">
|
||||
<if test="request.versionId != null">
|
||||
and ${versionTable}.version_id = #{request.versionId}
|
||||
</if>
|
||||
<if test="request.refId != null">
|
||||
and ${versionTable}.ref_id = #{request.refId}
|
||||
</if>
|
||||
<if test="request.versionId == null and request.refId == null and request.id == null">
|
||||
AND ${versionTable}.latest = 1
|
||||
</if>
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
@ -24,7 +24,7 @@ export default {
|
|||
data: {}
|
||||
}
|
||||
},
|
||||
props: ['title','tip'],
|
||||
props: ['title','tip', 'versionEnable'],
|
||||
methods: {
|
||||
open(item) {
|
||||
this.visible = true;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
<template v-slot:header>
|
||||
<test-plan-scenario-list-header
|
||||
:condition="condition"
|
||||
:projectId="projectId"
|
||||
@changeVersion="changeVersion"
|
||||
@refresh="search"
|
||||
@relevanceCase="$emit('relevanceCase', 'scenario')"/>
|
||||
</template>
|
||||
|
@ -40,6 +42,18 @@
|
|||
:label="$t('api_test.automation.scenario_name')" min-width="120px"
|
||||
sortable/>
|
||||
|
||||
<ms-table-column
|
||||
:field="item"
|
||||
v-if="versionEnable"
|
||||
prop="versionId"
|
||||
:filters="versionFilters"
|
||||
:label="$t('commons.version')"
|
||||
min-width="120px">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.versionName }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column :field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
prop="level" :label="$t('api_test.automation.case_level')" min-width="120px"
|
||||
|
@ -177,7 +191,7 @@
|
|||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import MsTag from "../../../../../common/components/MsTag";
|
||||
import {getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID, hasLicense, strMapToObj} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
|
@ -229,7 +243,8 @@ export default {
|
|||
selectNodeIds: Array,
|
||||
reviewId: String,
|
||||
planId: String,
|
||||
clickType: String
|
||||
clickType: String,
|
||||
versionEnable: Boolean,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -288,6 +303,7 @@ export default {
|
|||
},
|
||||
planCaseIds: [],
|
||||
apiscenariofilters:{},
|
||||
versionFilters: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -301,7 +317,7 @@ export default {
|
|||
created() {
|
||||
this.apiscenariofilters = API_SCENARIO_FILTERS();
|
||||
this.search();
|
||||
|
||||
this.getVersionOptions();
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
|
@ -551,6 +567,19 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
changeVersion(currentVersion) {
|
||||
this.condition.versionId = currentVersion || null;
|
||||
this.search();
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<ms-table-button v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
|
||||
:content="$t('test_track.plan_view.relevance_test_case')"
|
||||
@click="$emit('relevanceCase')"/>
|
||||
<version-select v-xpack :project-id="projectId" @changeVersion="$emit('changeVersion', $event)" margin-left="10"/>
|
||||
</template>
|
||||
|
||||
</ms-table-header>
|
||||
|
@ -20,11 +21,15 @@
|
|||
import MsTableHeader from "../../../../../common/components/MsTableHeader";
|
||||
import MsTableButton from "../../../../../common/components/MsTableButton";
|
||||
import MsEnvironmentSelect from "../../../../../api/definition/components/case/MsEnvironmentSelect";
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
||||
|
||||
export default {
|
||||
name: "TestPlanScenarioListHeader",
|
||||
components: {MsEnvironmentSelect, MsTableButton, MsTableHeader},
|
||||
props: ['condition', 'isReadOnly'],
|
||||
components: {
|
||||
MsEnvironmentSelect, MsTableButton, MsTableHeader, 'VersionSelect': VersionSelect.default,
|
||||
},
|
||||
props: ['condition', 'isReadOnly', 'projectId'],
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
@nodeSelectEvent="nodeChange"
|
||||
@refreshTable="refreshTable"
|
||||
@setModuleOptions="setModuleOptions"
|
||||
:version-enable="versionEnable"
|
||||
:is-read-only="true"
|
||||
:review-id="reviewId"
|
||||
ref="scenarioNodeTree">
|
||||
|
@ -41,6 +42,7 @@
|
|||
v-if="model === 'api'"
|
||||
:current-protocol="currentProtocol"
|
||||
:currentRow="currentRow"
|
||||
:version-enable="versionEnable"
|
||||
:select-node-ids="selectNodeIds"
|
||||
:trash-enable="trashEnable"
|
||||
:is-case-relevance="true"
|
||||
|
@ -88,6 +90,7 @@ import MsApiModule from "../../../../api/definition/components/module/ApiModule"
|
|||
import TestReviewRelevanceApi from "@/business/components/track/review/view/components/TestReviewRelevanceApi";
|
||||
import TestReviewRelevanceScenario
|
||||
from "@/business/components/track/review/view/components/TestReviewRelevanceScenario";
|
||||
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestReviewApi",
|
||||
|
@ -112,7 +115,8 @@ export default {
|
|||
currentModule: null,
|
||||
selectNodeIds: [],
|
||||
moduleOptions: {},
|
||||
model: 'api'
|
||||
model: 'api',
|
||||
versionEnable: false,
|
||||
}
|
||||
},
|
||||
props: [
|
||||
|
@ -122,6 +126,7 @@ export default {
|
|||
],
|
||||
mounted() {
|
||||
this.checkRedirectCharType();
|
||||
this.checkVersionEnable();
|
||||
},
|
||||
watch: {
|
||||
model() {
|
||||
|
@ -182,6 +187,16 @@ export default {
|
|||
this.$refs.apiCaseRelevance.open();
|
||||
}
|
||||
},
|
||||
checkVersionEnable() {
|
||||
if (!getCurrentProjectID()) {
|
||||
return;
|
||||
}
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/enable/' + getCurrentProjectID(), response => {
|
||||
this.versionEnable = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -45,11 +45,13 @@
|
|||
<test-review-relevance
|
||||
@refresh="refresh"
|
||||
:review-id="reviewId"
|
||||
:version-enable="versionEnable"
|
||||
ref="testReviewRelevance"/>
|
||||
|
||||
<is-change-confirm
|
||||
:title="'请保存脑图'"
|
||||
:tip="'脑图未保存,确认保存脑图吗?'"
|
||||
:version-enable="versionEnable"
|
||||
@confirm="changeConfirm"
|
||||
ref="isChangeConfirm"/>
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="hasLicense()"
|
||||
v-if="versionEnable"
|
||||
prop="versionName"
|
||||
:label="$t('test_track.case.version')"
|
||||
column-key="versionId"
|
||||
|
@ -193,6 +193,10 @@ export default {
|
|||
props: {
|
||||
reviewId: {
|
||||
type: String
|
||||
},
|
||||
versionEnable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -218,9 +222,6 @@ export default {
|
|||
this.toggleSelection(this.testReviews);
|
||||
},
|
||||
methods: {
|
||||
hasLicense() {
|
||||
return hasLicense();
|
||||
},
|
||||
openTestReviewRelevanceDialog() {
|
||||
this.getProject();
|
||||
this.dialogFormVisible = true;
|
||||
|
|
|
@ -173,6 +173,7 @@ export let CUSTOM_TABLE_HEADER = {
|
|||
TEST_PLAN_SCENARIO_CASE: [
|
||||
{id: 'num', key: '1', label: 'commons.id'},
|
||||
{id: 'name', key: '2', label: 'api_test.automation.scenario_name'},
|
||||
{id: 'versionId', key: 'd', label: 'commons.version'},
|
||||
{id: 'level', key: '3', label: 'api_test.automation.case_level'},
|
||||
{id: 'tagNames', key: '4', label: 'api_test.automation.tag'},
|
||||
{id: 'stepTotal', key: '7', label: 'api_test.automation.step'},
|
||||
|
|
Loading…
Reference in New Issue