fix(测试跟踪): 测试计划高级搜索切换项目模板字段不显示

--bug=1024934 --user=宋昌昌 【测试跟踪】github#23217,自定义字段在高级搜索中,非稳定出现 https://www.tapd.cn/55049933/s/1357260
This commit is contained in:
song-cc-rock 2023-03-29 17:56:54 +08:00 committed by jianxing
parent de4a5ecb22
commit c726bc2425
5 changed files with 47 additions and 8 deletions

View File

@ -183,6 +183,7 @@ export default {
} else {
this.setModulesParam();
this.refreshComponentOption();
this.handleCustomComponent();
}
},
refreshComponentOption() {
@ -194,6 +195,18 @@ export default {
let comps = this.optional.components.filter(c => c.key === 'moduleIds' && c.options.type === 'POST');
comps.forEach(comp => comp.options.params = {"projectId": this.condition.projectId});
},
handleCustomComponent() {
let newConfig = cloneDeep(this.condition);
newConfig.components.forEach(component => {
let operator = component.operator.value;
component.operator.value = operator === undefined ? component.operator.options[0].value : operator;
})
this.newCustomFiled = newConfig.components.filter(co => co.custom);
for (let customField of this.newCustomFiled) {
this.$set(customField, 'disable', false)
}
this.config.components[1] = {label: this.$t('custom_field.name'), child: this.newCustomFiled};
},
addFilter() {
const index = _findIndexByKey(this.optional.components, this.nullFilterKey);
if (index > -1) {

View File

@ -957,6 +957,7 @@ export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TES
// 测试跟踪 测试评审列表
export const TEST_REVIEW = [NAME, CREATOR, TAGS, TEST_PLAN_STATUS, FOLLOW_PEOPLE, CREATE_TIME, UPDATE_TIME, END_TIME];
export const TEST_REVIEW_CASE = [NAME, REVIEWER, MAINTAINER];
export const TEST_REVIEW_RELEVANCE_CASE_CONFIGS = [ID, NAME, TAGS, TEST_CASE_MODULE_TREE, CREATE_TIME, UPDATE_TIME, CREATOR, CASE_REVIEW_STATUS, FOLLOW_PEOPLE, CASE_DEMAND, TEST_CASE_STATUS, TEST_CASE_PRIORITY, TEST_CASE_MAINTAINER];
export const API_DEFINITION_CONFIGS = [ID, NAME, API_METHOD, API_PATH, API_STATUS, TAGS, UPDATE_TIME, CREATE_TIME, API_PRINCIPAL, API_MODULE_TREE, FOLLOW_PEOPLE];
export const API_DEFINITION_CONFIGS_TRASH = [ID, NAME, API_METHOD, API_PATH, API_STATUS_TRASH, TAGS, UPDATE_TIME, CREATE_TIME, API_PRINCIPAL, API_MODULE_TREE, FOLLOW_PEOPLE];
@ -976,7 +977,7 @@ export const TEST_PLAN_API_CASE_CONFIGS = [NAME, CASE_STATUS, CREATE_TIME, UPDAT
export const TEST_PLAN_API_SCENARIO_CONFIGS = [NAME, API_STATUS, CREATE_TIME, UPDATE_TIME];
// 测试计划关联页面
export const TEST_PLAN_RELEVANCE_FUNC_CONFIGS = [NAME, TAGS, CREATE_TIME, UPDATE_TIME, CREATOR];
export const TEST_PLAN_RELEVANCE_FUNC_CONFIGS = [ID, NAME, TAGS, TEST_CASE_MODULE_TREE, CREATE_TIME, UPDATE_TIME, CREATOR, CASE_REVIEW_STATUS, PLAN_CASE_STATUS, FOLLOW_PEOPLE, CASE_DEMAND, TEST_CASE_STATUS, TEST_CASE_PRIORITY, TEST_CASE_MAINTAINER];
export const TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS = [NAME, API_METHOD, API_PATH, TAGS, UPDATE_TIME, CREATE_TIME, CREATOR, API_STATUS];
export const TEST_PLAN_RELEVANCE_API_CASE_CONFIGS = [NAME, PRIORITY, TAGS, UPDATE_TIME, CREATOR, API_PATH, CASE_STATUS];
export const TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS = [NAME, PRIORITY, TAGS, API_SCENARIO_RESULT, CREATE_TIME, UPDATE_TIME, CREATOR, API_STATUS];

View File

@ -118,6 +118,19 @@
and test_case.demand_name like CONCAT('%', #{${condition}.demand.value},'%')
</if>
</if>
<if test="${condition}.planCaseStatus != null and ${condition}.planCaseStatus.value.contains('Prepare')">
and (test_case.last_execute_result
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.planCaseStatus"/>
</include> or test_case.last_execute_result is null
)
</if>
<if test="${condition}.planCaseStatus != null and !${condition}.planCaseStatus.value.contains('Prepare')">
and test_case.last_execute_result
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.planCaseStatus"/>
</include>
</if>
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
and test_case.id in (
@ -220,11 +233,11 @@
left join project_version on project_version.project_id = test_case.project_id and project_version.id =
test_case.version_id
<if test="!request.repeatCase">
left join test_plan_test_case as T2 on test_case.id=T2.case_id and T2.plan_id =#{request.planId}
left join test_plan_test_case on test_case.id = test_plan_test_case.case_id and test_plan_test_case.plan_id = #{request.planId}
</if>
<include refid="notInQueryWhereCondition"/>
<if test="!request.repeatCase">
and T2.case_id is null
and test_plan_test_case.case_id is null
</if>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
@ -336,12 +349,12 @@
select tcn.id, count(*) as caseNum, test_case.project_id
from test_case
<if test="!request.repeatCase">
left join test_plan_test_case tptc on tptc.case_id = test_case.id and tptc.plan_id = #{request.planId}
left join test_plan_test_case on test_plan_test_case.case_id = test_case.id and test_plan_test_case.plan_id = #{request.planId}
</if>
left join test_case_node tcn on test_case.node_id = tcn.id
<include refid="queryWhereCondition"/>
<if test="!request.repeatCase">
and tptc.case_id is null
and test_plan_test_case.case_id is null
</if>
group by tcn.id
</select>

View File

@ -219,7 +219,6 @@ export default {
this.getTestCases();
},
projectId(val) {
this.pushCustomFieldToCondition(val);
this.setConditionModuleIdParam();
this.page.condition.projectId = this.projectId;
this.page.condition.versionId = null;
@ -243,6 +242,7 @@ export default {
},
setProject(projectId) {
this.projectId = projectId;
this.pushCustomFieldToCondition(this.projectId);
},
setConditionModuleIdParam() {
this.page.condition.components.forEach(component => {

View File

@ -121,7 +121,7 @@ import MsTableSearchBar from "metersphere-frontend/src/components/MsTableSearchB
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
import SwitchProject from "../../../case/components/SwitchProject";
import {TEST_CASE_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import {TEST_REVIEW_RELEVANCE_CASE_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import ReviewStatus from "@/business/case/components/ReviewStatus";
import elTableInfiniteScroll from 'el-table-infinite-scroll';
import SelectMenu from "@/business/common/SelectMenu";
@ -137,6 +137,8 @@ import {getTestCaseReviewRelevance, getTestCaseReviewsCasePage} from "@/api/test
import {testCaseNodeListReviewRelate} from "@/api/test-case-node";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {projectRelated} from "@/api/project";
import {getTestTemplate} from "@/api/custom-field-template";
import {initTestCaseConditionComponents} from "@/business/case/test-case";
export default {
name: "TestReviewRelevance",
@ -182,7 +184,7 @@ export default {
total: 0,
lineStatus: true,
condition: {
components: TEST_CASE_CONFIGS
components: TEST_REVIEW_RELEVANCE_CASE_CONFIGS
},
priorityFilters: [
{text: 'P0', value: 'P0'},
@ -233,10 +235,18 @@ export default {
this.getVersionOptions();
}
},
activated() {
this.loadConditionComponents();
},
updated() {
this.toggleSelection(this.testReviews);
},
methods: {
loadConditionComponents() {
getTestTemplate(this.projectId).then((template) => {
this.condition.components = initTestCaseConditionComponents(this.condition, template.customFields, false);
});
},
fullScreen(){
this.isFullScreen = !this.isFullScreen;
this.screenHeight = this.isFullScreen ?'calc(100vh - 180px)' :'calc(100vh - 420px)'
@ -317,6 +327,7 @@ export default {
this.selectNodeNames = [];
this.dialogFormVisible = false;
this.condition.filters = {};
this.condition.combine = {};
if(this.condition.projectId) {
delete this.condition.projectId;
}
@ -368,6 +379,7 @@ export default {
},
changeProject(project) {
this.projectId = project.id;
this.loadConditionComponents();
},
getProjectNode(projectId, condition) {
return new Promise((resolve) => {