fix(通用功能): 高级搜索

This commit is contained in:
shiziyuan9527 2022-06-24 14:51:14 +08:00 committed by f2c-ci-robot[bot]
parent d48dd41231
commit 0c9f45bb00
12 changed files with 188 additions and 20 deletions

View File

@ -133,13 +133,30 @@
</include>
</if>
<if test="${condition}.status != null">
<if test="${condition}.lastResult != null">
and api_scenario.last_result
<include refid="condition">
<property name="object" value="${condition}.lastResult"/>
</include>
</if>
<if test="${condition}.status != null">
and api_scenario.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.module != null">
and api_scenario.module_path
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.module"/>
</include>
</if>
<if test="${condition}.stepCount != null">
and api_scenario.step_total
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.stepCount"/>
</include>
</if>
</sql>
<select id="listModule" resultType="java.lang.Integer">
select count(api_scenario.id) from api_scenario

View File

@ -22,6 +22,49 @@
</select>
<sql id="combine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and test_case_review.name
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.createTime != null">
and test_case_review.create_time
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and test_case_review.update_time
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.endTime != null">
and test_case_review.end_time
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.endTime"/>
</include>
</if>
<if test="${condition}.status != null">
and test_case_review.status
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "not like"'>
and (test_case_review.tags is null or test_case_review.tags
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.tags"/>
</include>
)
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "like"'>
and test_case_review.tags
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.tags"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and test_case_review.id in (
select review_id from test_case_review_follow where follow_id

View File

@ -78,6 +78,30 @@
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.actualStartTime != null">
and test_plan.actual_start_time
<include refid="condition">
<property name="object" value="${condition}.actualStartTime"/>
</include>
</if>
<if test="${condition}.actualEndTime != null">
and test_plan.actual_end_time
<include refid="condition">
<property name="object" value="${condition}.actualEndTime"/>
</include>
</if>
<if test="${condition}.planStartTime != null">
and test_plan.planned_start_time
<include refid="condition">
<property name="object" value="${condition}.planStartTime"/>
</include>
</if>
<if test="${condition}.planEndTime != null">
and test_plan.planned_end_time
<include refid="condition">
<property name="object" value="${condition}.planEndTime"/>
</include>
</if>
<if test="${condition}.status != null">
and test_plan.status
<include refid="condition">
@ -102,6 +126,19 @@
<property name="object" value="${condition}.creator"/>
</include>
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "not like"'>
and (test_plan.tags is null or test_plan.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
)
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "like"'>
and test_plan.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
</if>
<if test="${condition}.principal != null">
and test_plan.id in (SELECT test_plan_id FROM test_plan_principal WHERE principal_id
<include refid="condition">
@ -128,6 +165,7 @@
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">

View File

@ -16,7 +16,7 @@
</el-row>
</div>
<el-link type="primary" icon="el-icon-plus" v-if="showAddFilterLink"
class="add-filter-link" @click="addFilter">添加筛选条件</el-link>
class="add-filter-link" @click="addFilter">{{ $t('commons.adv_search.add_filter_link') }}</el-link>
</div>
<template v-slot:footer>
<div class="dialog-footer">
@ -157,8 +157,8 @@ export default {
}
//
this.optional.components = slice(this.optional.components, 0, this.showItemSize);
const all = concat(this.config.components[0].child, this.config.components[1].child);
let allComponent = this.condition.custom ? all : this.config.components;
let allComponent = this.condition.custom ?
concat(this.config.components[0].child, this.config.components[1].child) : this.config.components;
for (let component of allComponent) {
let co = _findByKey(this.optional.components, component.key);
co ? this.$set(co, 'disable', true) : this.$set(component, 'disable', false);
@ -174,7 +174,7 @@ export default {
addFilter() {
const index = _findIndexByKey(this.optional.components, this.nullFilterKey);
if (index > -1) {
this.$warning("有为空的查询条件,请先选择!")
this.$warning(this.$t('commons.adv_search.add_filter_link'));
return;
}
let data = {

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-select class="search-label" v-model="selectKey" v-if="!custom"
filterable placeholder="请选择" size="small">
filterable :placeholder="$t('commons.please_select')" size="small">
<el-option
v-for="item in components"
:disabled="item.disable !== undefined ? item.disable : true"
@ -12,7 +12,7 @@
</el-option>
</el-select>
<el-select class="search-label" v-model="selectKey" v-else
filterable placeholder="请选择" size="small">
filterable :placeholder="$t('commons.please_select')" size="small">
<el-option-group
v-for="group in components"
:key="group.key"

View File

@ -27,5 +27,7 @@ export default {
</script>
<style scoped>
/deep/ .el-input-number--small {
width: 100%;
}
</style>

View File

@ -198,7 +198,7 @@ export const API_CASE_RESULT = {
}
// 场景执行结果
export const API_SCENARIO_RESULT = {
key: "status",
key: "lastResult",
name: 'MsTableSearchSelect',
label: 'test_track.plan_view.execute_result',
operator: {
@ -560,7 +560,64 @@ export const CASE_COUNT = {
},
}
export const TEST_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, STATUS, CREATOR];
export const STEP_COUNT = {
key: "stepCount",
name: 'MsTableSearchInputNumber',
label: 'api_test.automation.step',
operator: {
options: [OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
},
}
// 测试计划 实际开始时间
export const ACTUAL_START_TIME = {
key: "actualStartTime",
name: 'MsTableSearchDateTimePicker',
label: 'test_track.plan.actual_start_time',
operator: {
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
},
}
// 测试计划 实际结束时间
export const ACTUAL_END_TIME = {
key: "actualEndTime",
name: 'MsTableSearchDateTimePicker',
label: 'test_track.plan.actual_end_time',
operator: {
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
},
}
// 测试计划 计划开始时间
export const PLAN_START_TIME = {
key: "planStartTime",
name: 'MsTableSearchDateTimePicker',
label: 'test_track.plan.planned_start_time',
operator: {
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
},
}
// 测试计划 计划结束时间
export const PLAN_END_TIME = {
key: "planEndTime",
name: 'MsTableSearchDateTimePicker',
label: 'test_track.plan.planned_end_time',
operator: {
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
},
}
// 测试评审 截止时间
export const END_TIME = {
key: "endTime",
name: 'MsTableSearchDateTimePicker',
label: 'test_track.review.end_time',
operator: {
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
},
}
export const TEST_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, STATUS, CREATOR, FOLLOW_PEOPLE];
export const PROJECT_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, CREATOR];
@ -573,13 +630,16 @@ export const UI_REPORT_CONFIGS = [NAME, TEST_NAME, CREATE_TIME, UI_REPORT_STATUS
// 测试跟踪-测试用例 列表
export const TEST_CASE_CONFIGS = [NAME, TAGS, MODULE, CREATE_TIME, UPDATE_TIME, CREATOR, CASE_REVIEW_STATUS, FOLLOW_PEOPLE];
export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE];
export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE, TAGS, FOLLOW_PEOPLE, ACTUAL_START_TIME, ACTUAL_END_TIME, PLAN_START_TIME, PLAN_END_TIME];
// 测试跟踪 测试评审列表
export const TEST_REVIEW = [NAME, CREATOR, TAGS, TEST_PLAN_STATUS, FOLLOW_PEOPLE, CREATE_TIME, UPDATE_TIME, END_TIME];
export const API_DEFINITION_CONFIGS = [NAME, API_METHOD, API_PATH, API_STATUS, TAGS, UPDATE_TIME, CREATE_TIME, API_PRINCIPAL, ISREFERENCE, MODULE, FOLLOW_PEOPLE, CASE_COUNT];
export const API_CASE_CONFIGS = [NAME, PRIORITY, TAGS, API_CASE_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR, ISREFERENCE, FOLLOW_PEOPLE, API_PATH];
export const API_SCENARIO_CONFIGS = [NAME, PRIORITY, TAGS, API_SCENARIO_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR];
export const API_SCENARIO_CONFIGS = [NAME, PRIORITY, TAGS, API_SCENARIO_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR, FOLLOW_PEOPLE, STEP_COUNT, MODULE, API_STATUS];
export const TEST_PLAN_REPORT_CONFIGS = [NAME, TEST_PLAN_NAME, CREATOR, CREATE_TIME, TEST_PLAN_TRIGGER_MODE, TEST_PLAN_REPORT_STATUS];

View File

@ -19,6 +19,7 @@ import TestCaseReviewEdit from "./components/TestCaseReviewEdit";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsContainer from "../../common/components/MsContainer";
import {getCurrentProjectID} from "@/common/js/utils";
import {TEST_REVIEW} from "@/business/components/common/components/search/search-components";
export default {
name: "TestCaseReview",
@ -29,9 +30,7 @@ export default {
TestCaseReviewEdit
},
data() {
return {
}
return {}
},
computed: {
projectId() {
@ -61,7 +60,7 @@ export default {
this.$refs.caseReviewEditDialog.openCaseReviewEditDialog(data);
},
refreshCaseReviewList() {
this.$refs.caseReviewList.condition = {};
this.$refs.caseReviewList.condition = {TEST_REVIEW};
this.$refs.caseReviewList.initTableData();
}
}

View File

@ -146,6 +146,7 @@ import {TEST_CASE_REVIEW_LIST} from "@/common/js/constants";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTag from "@/business/components/common/components/MsTag";
import {TEST_REVIEW} from "@/business/components/common/components/search/search-components";
export default {
name: "TestCaseReviewList",
@ -168,7 +169,9 @@ export default {
tableLabel: [],
tableHeaderKey:"TEST_CASE_REVIEW",
result: {},
condition: {},
condition: {
components: TEST_REVIEW
},
tableData: [],
isTestManagerOrTestUser: false,
currentPage: 1,

View File

@ -315,6 +315,8 @@ export default {
reset: "Reset",
and: 'All',
or: 'any one',
add_filter_link: 'Add filter',
add_filter_link_tip: 'There are empty query conditions, please select first!',
operators: {
is_empty: "Is empty",
is_not_empty: "Is not empty",

View File

@ -316,6 +316,8 @@ export default {
reset: "重置",
and: '所有',
or: '任意一个',
add_filter_link: '添加筛选条件',
add_filter_link_tip: '有为空的查询条件,请先选择!',
operators: {
is_empty: "空",
is_not_empty: "非空",

View File

@ -316,6 +316,8 @@ export default {
reset: "重置",
and: '所有',
or: '任意一個',
add_filter_link: '添加篩選條件',
add_filter_link_tip: '有為空的查詢條件,請先選擇!',
operators: {
is_empty: "空",
is_not_empty: "非空",