refactor: 测试计划关联页添加高级搜索#1002978

--story=1002978 --user=lyh 6.测试计划关联测试用例 搜索后面加高级搜索,包括 接口用例、场景用例、性能用例
https://www.tapd.cn/55049933/s/1044468
This commit is contained in:
shiziyuan9527 2021-09-07 15:15:16 +08:00 committed by 刘瑞斌
parent 920104a796
commit f6a71c7def
8 changed files with 187 additions and 34 deletions

View File

@ -34,10 +34,92 @@
</if>
</foreach>
</if>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
and load_test.id not in (
select tplc.load_case_id from test_plan_load_case tplc where tplc.test_plan_id = #{request.testPlanId}
)
</select>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and load_test.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and load_test.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.createTime != null">
and load_test.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.status != null">
and load_test.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.creator != null">
and load_test.create_user
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<select id="selectTestPlanLoadCaseList" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO">
select tplc.id,
u.name as userName,

View File

@ -18,5 +18,5 @@ public class LoadCaseRequest extends TestPlanLoadCase {
private String status;
private Map<String, List<String>> filters;
private List<OrderRequest> orders;
private Map<String, Object> combine;
}

View File

@ -9,6 +9,9 @@
<el-input :placeholder="$t('commons.search_by_name_or_id')" @blur="initTable" class="search-input" size="small"
@keyup.enter.native="initTable" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0"
@search="initTable"/>
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
:total="total" enableSelection
@ -117,8 +120,11 @@
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _sort, buildBatchParam, getLabel,} from "@/common/js/tableUtils";
import {WORKSPACE_ID} from "@/common/js/constants";
import {getCurrentProjectID} from "@/common/js/utils";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {
TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS,
} from "@/business/components/common/components/search/search-components";
export default {
name: "RelevanceApiList",
@ -135,11 +141,14 @@
ShowMoreBtn,
MsBatchEdit,
MsTable,
MsTableColumn
MsTableColumn,
MsTableAdvSearchBar
},
data() {
return {
condition: {},
condition: {
components: TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS
},
selectCase: {},
result: {},
moduleId: "",
@ -408,4 +417,10 @@
margin-right: 20px;
}
.adv-search-bar {
float: right;
margin-top: 5px;
margin-right: 10px;
}
</style>

View File

@ -9,7 +9,9 @@
<el-input :placeholder="$t('commons.search_by_name_or_id')" @blur="initTable"
@keyup.enter.native="initTable" class="search-input" size="small" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0"
@search="initTable"/>
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
:total="total" enableSelection
:screenHeight="screenHeight"
@ -92,7 +94,8 @@ import PriorityTableItem from "../../../../track/common/tableItems/planview/Prio
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
import {_filter, _sort, buildBatchParam} from "@/common/js/tableUtils";
import {API_CASE_LIST} from "@/common/js/constants";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {TEST_PLAN_RELEVANCE_API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
name: "RelevanceCaseList",
@ -109,11 +112,14 @@ export default {
ShowMoreBtn,
MsBatchEdit,
MsTable,
MsTableColumn
MsTableColumn,
MsTableAdvSearchBar
},
data() {
return {
condition: {},
condition: {
components: TEST_PLAN_RELEVANCE_API_CASE_CONFIGS
},
selectCase: {},
result: {},
moduleId: "",
@ -319,4 +325,10 @@ export default {
margin-right: 20px;
}
.adv-search-bar {
float: right;
margin-top: 5px;
margin-right: 10px;
}
</style>

View File

@ -497,3 +497,10 @@ export const API_CASE_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, API_CASE_RES
export const API_SCENARIO_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, API_SCENARIO_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR];
export const TEST_PLAN_REPORT_CONFIGS = [NAME, TEST_PLAN_NAME,CREATOR, CREATE_TIME, TEST_PLAN_TRIGGER_MODE, TEST_PLAN_STATUS];
// 测试计划关联页面
export const TEST_PLAN_RELEVANCE_FUNC_CONFIGS = [NAME, API_TAGS, CREATE_TIME, UPDATE_TIME, CREATOR];
export const TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS = [NAME, API_METHOD, API_PATH, API_TAGS, UPDATE_TIME, CREATE_TIME, CREATOR];
export const TEST_PLAN_RELEVANCE_API_CASE_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, UPDATE_TIME, CREATOR];
export const TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, API_SCENARIO_RESULT, CREATE_TIME, UPDATE_TIME, CREATOR];
export const TEST_PLAN_RELEVANCE_LOAD_CASE= [NAME, UPDATE_TIME, CREATE_TIME, STATUS, CREATOR];

View File

@ -1,18 +1,14 @@
<template>
<div>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<el-row>
<el-col :span="8" :offset="11">
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search"
@keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
</el-col>
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:show-config-button-with-out-permission="showConfigButtonWithOutPermission"
:project-list="projectList" ref="envPopover" class="env-popover"/>
</el-row>
</template>
<el-card v-loading="result.loading">
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:show-config-button-with-out-permission="showConfigButtonWithOutPermission"
:project-list="projectList" ref="envPopover" class="env-popover"/>
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search"
@keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0"
@search="search"/>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect">
<el-table-column type="selection"/>
@ -71,6 +67,8 @@
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
import EnvPopover from "@/business/components/track/common/EnvPopover";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
name: "RelevanceScenarioList",
@ -78,7 +76,15 @@
PriorityTableItem,
EnvPopover,
TestPlanScenarioListHeader,
MsTablePagination, MsTableMoreBtn, ShowMoreBtn, MsTableHeader, MsTag, MsApiReportDetail, MsTestPlanList},
MsTablePagination,
MsTableMoreBtn,
ShowMoreBtn,
MsTableHeader,
MsTag,
MsApiReportDetail,
MsTestPlanList,
MsTableAdvSearchBar
},
props: {
referenced: {
type: Boolean,
@ -92,7 +98,9 @@
return {
result: {},
showConfigButtonWithOutPermission:false,
condition: {},
condition: {
components: TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS
},
currentScenario: {},
schedule: {},
selectAll: false,
@ -210,6 +218,20 @@
.env-popover {
float: right;
margin-top: 4px;
margin-top: 10px;
}
.search-input {
float: right;
width: 250px;
margin-top: 10px;
margin-bottom: 20px;
margin-right: 20px;
}
.adv-search-bar {
float: right;
margin-top: 15px;
margin-right: 10px;
}
</style>

View File

@ -102,6 +102,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag";
import {TEST_PLAN_RELEVANCE_FUNC_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
@ -130,7 +131,9 @@ export default {
projectId: '',
projectName: '',
projects: [],
page: getPageInfo(),
page: getPageInfo({
components: TEST_PLAN_RELEVANCE_FUNC_CONFIGS
}),
customNum: false,
priorityFilters: [
{text: 'P0', value: 'P0'},

View File

@ -14,14 +14,11 @@
</template>
<el-card>
<template v-slot:header>
<el-row>
<el-col :span="8" :offset="16">
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="getTestCases"
@keyup.enter.native="getTestCases" class="search-input" size="small" v-model="condition.name"/>
</el-col>
</el-row>
</template>
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="getTestCases"
@keyup.enter.native="getTestCases" class="search-input" size="small" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0"
@search="getTestCases"/>
<el-table
v-loading="result.loading"
@ -84,6 +81,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import {_filter} from "@/common/js/tableUtils";
import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components";
export default {
name: "TestCaseLoadRelevance",
@ -112,7 +110,9 @@ export default {
pageSize: 10,
currentPage: 1,
total: 0,
condition: {},
condition: {
components: TEST_PLAN_RELEVANCE_LOAD_CASE
},
statusFilters: [
{text: 'Saved', value: 'Saved'},
{text: 'Starting', value: 'Starting'},
@ -270,5 +270,17 @@ export default {
</script>
<style scoped>
.search-input {
float: right;
width: 250px;
margin-top: 10px;
margin-bottom: 20px;
margin-right: 20px;
}
.adv-search-bar {
float: right;
margin-top: 15px;
margin-right: 10px;
}
</style>