fix(测试跟踪): 缺陷列表自定义多选框筛选失效
--bug=1015404 --user=李玉号 【测试跟踪】缺陷模版添加自定义字段,字段类型“多选框”,使用该模版添加缺陷后,缺陷列表,点击该字段下拉框筛选失效 https://www.tapd.cn/55049933/s/1216602
This commit is contained in:
parent
0d3b6df3bf
commit
a38e2799f4
|
@ -239,15 +239,26 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key.startsWith('custom')">
|
||||
<when test="key.startsWith('custom_single')">
|
||||
and issues.id in (
|
||||
select resource_id from custom_field_issues where concat('custom',field_id) = #{key}
|
||||
select resource_id from custom_field_issues
|
||||
where concat('custom_single-',field_id) = #{key}
|
||||
and trim(both '"' from value) in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
<when test="key.startsWith('custom_multiple')">
|
||||
and issues.id in (
|
||||
select resource_id from custom_field_issues
|
||||
where concat('custom_multiple-',field_id) = #{key}
|
||||
and JSON_CONTAINS(value,
|
||||
<foreach collection="values" item="value" separator="" open="" close="">
|
||||
#{value}
|
||||
</foreach>)
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
|
|
@ -587,13 +587,22 @@
|
|||
and test_case.maintainer in
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<when test="key.startsWith('custom')">
|
||||
<when test="key.startsWith('custom_single')">
|
||||
and test_case.id in (
|
||||
select resource_id from custom_field_test_case where concat('custom',field_id) = #{key}
|
||||
select resource_id from custom_field_test_case where concat('custom_single-',field_id) = #{key}
|
||||
and trim(both '"' from value) in
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
|
||||
)
|
||||
</when>
|
||||
<when test="key.startsWith('custom_multiple')">
|
||||
and test_case.id in (
|
||||
select resource_id from custom_field_test_case where concat('custom_multiple-',field_id) = #{key}
|
||||
and JSON_CONTAINS(value,
|
||||
<foreach collection="values" item="value" separator="" open="" close="">
|
||||
#{value}
|
||||
</foreach>)
|
||||
)
|
||||
</when>
|
||||
<when test="key=='create_user'">
|
||||
and test_case.create_user in
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.filterInWrapper"/>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package io.metersphere.controller.request;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -81,4 +84,18 @@ public class BaseQueryRequest {
|
|||
* 版本来源字段
|
||||
*/
|
||||
private String refId;
|
||||
|
||||
public Map<String, List<String>> getFilters() {
|
||||
if (MapUtils.isEmpty(filters) || filters.containsKey("isHandleCustomMultiple")) {
|
||||
return filters;
|
||||
}
|
||||
// 处理过滤器中的自定义字段多选值
|
||||
filters.forEach((k,v) -> {
|
||||
if (k.contains("custom_multiple") && CollectionUtils.isNotEmpty(v)) {
|
||||
filters.put(k, Collections.singletonList(JSON.toJSONString(v)));
|
||||
}
|
||||
});
|
||||
filters.put("isHandleCustomMultiple", null);
|
||||
return filters;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ public class IssuesService {
|
|||
request.getOrders().forEach(order -> {
|
||||
if (StringUtils.isNotEmpty(order.getName()) && order.getName().startsWith("custom")) {
|
||||
request.setIsCustomSorted(true);
|
||||
request.setCustomFieldId(order.getName().substring(6));
|
||||
request.setCustomFieldId(order.getName().substring(order.getName().indexOf("-") + 1));
|
||||
order.setPrefix("cfi");
|
||||
order.setName("value");
|
||||
}
|
||||
|
|
|
@ -132,3 +132,12 @@ export function _findByKey(components, key) {
|
|||
export function _findIndexByKey(components, key) {
|
||||
return components.findIndex(co => co.key === key);
|
||||
}
|
||||
|
||||
export function generateFilterColumnKey(field) {
|
||||
if (field.type === 'select' || field.type === 'radio' || field.type === 'member') {
|
||||
// 修改标识
|
||||
return 'custom_single-' + field.id;
|
||||
} else if (field.type === 'multipleSelect' || field.type === 'checkbox' || field.type === 'multipleMember') {
|
||||
return 'custom_multiple-' + field.id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@
|
|||
:fields-width="fieldsWidth"
|
||||
:label="field.system ? $t(systemFiledMap[field.name]) :field.name"
|
||||
:min-width="120"
|
||||
:column-key="field.columnKey ? field.columnKey : 'custom' + field.id"
|
||||
:column-key="field.columnKey ? field.columnKey : generateFilterColumnKey(field)"
|
||||
:prop="field.name">
|
||||
<template v-slot="scope">
|
||||
<span v-if="field.name === '用例等级'">
|
||||
|
@ -276,7 +276,10 @@ import {editTestCaseOrder} from "@/network/testCase";
|
|||
import {getGraphByCondition} from "@/network/graph";
|
||||
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||
import ListItemDeleteConfirm from "@/business/components/common/components/ListItemDeleteConfirm";
|
||||
import {getAdvSearchCustomField} from "@/business/components/common/components/search/custom-component";
|
||||
import {
|
||||
generateFilterColumnKey,
|
||||
getAdvSearchCustomField
|
||||
} from "@/business/components/common/components/search/custom-component";
|
||||
import MsSearch from "@/business/components/common/components/search/MsSearch";
|
||||
import RelateDemand from "@/business/components/track/case/components/RelateDemand";
|
||||
import TestCaseReviewStatusTableItem from "@/business/components/track/common/tableItems/TestCaseReviewStatusTableItem";
|
||||
|
@ -1238,6 +1241,7 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
generateFilterColumnKey,
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
:fields-width="fieldsWidth"
|
||||
min-width="120"
|
||||
:label="field.system ? $t(systemNameMap[field.name]) :field.name"
|
||||
:column-key="'custom' + field.id"
|
||||
:column-key="generateFilterColumnKey(field)"
|
||||
:prop="field.name">
|
||||
<template v-slot="scope">
|
||||
<span v-if="field.name === '状态'">
|
||||
|
@ -197,7 +197,10 @@ import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
|
|||
import {getProjectMember} from "@/network/user";
|
||||
import {LOCAL} from "@/common/js/constants";
|
||||
import {TEST_TRACK_ISSUE_LIST} from "@/business/components/common/components/search/search-components";
|
||||
import {getAdvSearchCustomField} from "@/business/components/common/components/search/custom-component";
|
||||
import {
|
||||
generateFilterColumnKey,
|
||||
getAdvSearchCustomField
|
||||
} from "@/business/components/common/components/search/custom-component";
|
||||
import MsMarkDownText from "@/business/components/track/case/components/MsMarkDownText";
|
||||
|
||||
export default {
|
||||
|
@ -290,6 +293,7 @@ export default {
|
|||
this.getMaintainerOptions();
|
||||
},
|
||||
methods: {
|
||||
generateFilterColumnKey,
|
||||
tableDoLayout() {
|
||||
if (this.$refs.table) this.$refs.table.doLayout();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue