feat(测试跟踪): 缺陷管理查询列表支持自定义字段, 处理人、严重程度、状态的筛选, 排序

--story=1006594 --user=宋昌昌 【测试跟踪】缺陷列表,对缺陷的 处理人、严重程度、状态增加筛选和排序(1.20分支同步上) https://www.tapd.cn/55049933/s/1191112
This commit is contained in:
song-cc-rock 2022-06-28 16:04:51 +08:00 committed by f2c-ci-robot[bot]
parent 1d57d1b8ed
commit dddb822859
5 changed files with 32 additions and 2 deletions

View File

@ -60,6 +60,9 @@
left join
project on issues.project_id = project.id
</if>
<if test="request.isCustomSorted and request.customFieldId != null">
left join custom_field_issues cfi on issues.id = cfi.resource_id and cfi.field_id = #{request.customFieldId}
</if>
<include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>

View File

@ -41,7 +41,7 @@ public class OrderRequest {
if (StringUtils.isEmpty(script)) {
return false;
}
Pattern pattern = Pattern.compile("^\\w+$");
Pattern pattern = Pattern.compile("^[\\w-]+$");
Matcher matcher = pattern.matcher(script.toLowerCase());
return !matcher.find();
}

View File

@ -50,4 +50,13 @@ public class IssuesRequest extends BaseQueryRequest {
private String defaultCustomFields;
private Boolean isPlanEdit = false;
private String planId;
/**
* 是否根据自定义字段进行排序
*/
private Boolean isCustomSorted = false;
/**
* 自定义字段ID
*/
private String customFieldId;
}

View File

@ -341,6 +341,14 @@ public class IssuesService {
public List<IssuesDao> list(IssuesRequest request) {
request.setOrders(ServiceUtils.getDefaultOrderByField(request.getOrders(), "create_time"));
request.getOrders().forEach(order -> {
if (StringUtils.isNotEmpty(order.getName()) && order.getName().startsWith("custom")) {
request.setIsCustomSorted(true);
request.setCustomFieldId(order.getName().substring(6));
order.setPrefix("cfi");
order.setName("value");
}
});
List<IssuesDao> issues = extIssuesMapper.getIssues(request);
Map<String, Set<String>> caseSetMap = getCaseSetMap(issues);

View File

@ -130,9 +130,11 @@
</ms-table-column>
<ms-table-column v-for="field in issueTemplate.customFields" :key="field.id"
:filters="getCustomFieldFilter(field)"
:filters="field.name === '状态'? i18nCustomStatus(getCustomFieldFilter(field)) : getCustomFieldFilter(field)"
sortable="custom"
:field="item"
:fields-width="fieldsWidth"
min-width="120"
:label="field.system ? $t(systemNameMap[field.name]) :field.name"
:column-key="'custom' + field.id"
:prop="field.name">
@ -297,6 +299,14 @@ export default {
return Array.isArray(field.options) ?
(field.options.length > 0 ? field.options : null) : null;
},
i18nCustomStatus(options) {
let i18ns = [];
options.forEach(option => {
option.text = this.$t(option.text);
i18ns.push(option);
})
return i18ns;
},
initFields(template) {
this.issueTemplate = template;
if (this.issueTemplate.platform === LOCAL) {