refactor: 缺陷列表添加过滤排序条件

This commit is contained in:
chenjianxing 2021-07-09 14:21:19 +08:00 committed by jianxing
parent 09ae82d841
commit df1c5b2962
5 changed files with 35 additions and 25 deletions

View File

@ -71,22 +71,20 @@
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="request.filters != null and request.filters.size() > 0">-->
<!-- <foreach collection="request.filters.entrySet()" index="key" item="values">-->
<!-- <if test="values != null and values.size() > 0">-->
<!-- <choose>-->
<!-- <when test="key == 'scene'">-->
<!-- AND cf.scene IN-->
<!-- <foreach collection="values" item="value" separator="," open="(" close=")">-->
<!-- #{value}-->
<!-- </foreach>-->
<!-- </when>-->
<!-- </choose>-->
<!-- </if>-->
<!-- </foreach>-->
<!-- </if>-->
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key == 'platform'">
AND issues.platform IN
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
</sql>

View File

@ -194,8 +194,8 @@ public class TapdPlatform extends AbstractIssuePlatform {
@Override
public void syncIssues(Project project, List<IssuesDao> tapdIssues) {
int pageNum = 1;
int limit = 200;
int count = 200;
int limit = 50;
int count = 50;
List<String> ids = tapdIssues.stream()
.map(Issues::getId)

View File

@ -6,7 +6,7 @@
:fixed="fixed"
:filters="filters"
:prop="prop"
:column-key="prop"
:column-key="columnKey ? columnKey : prop"
:label="label"
:sortable="sortable"
:show-overflow-tooltip="showOverflowTooltip">
@ -50,7 +50,13 @@ export default {
}
},
//
fieldsWidth: Object
fieldsWidth: Object,
columnKey: {
type: String,
default() {
return null;
}
}
}
};
</script>

View File

@ -62,6 +62,7 @@
<ms-table-column
:field="item"
:fields-width="fieldsWidth"
:filters="platformFilters"
:label="$t('test_track.issue.platform')"
prop="platform">
</ms-table-column>
@ -69,6 +70,7 @@
<ms-table-column
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.issue.platform_status') "
prop="platformStatus">
<template v-slot="scope">
@ -79,6 +81,8 @@
<ms-table-column
:field="item"
:fields-width="fieldsWidth"
column-key="creator"
sortable
:label="$t('custom_field.issue_creator')"
prop="creatorName">
</ms-table-column>
@ -159,7 +163,7 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import {
CUSTOM_FIELD_SCENE_OPTION,
CUSTOM_FIELD_TYPE_OPTION,
FIELD_TYPE_MAP,
FIELD_TYPE_MAP, ISSUE_PLATFORM_OPTION,
ISSUE_STATUS_MAP,
SYSTEM_FIELD_NAME_MAP
} from "@/common/js/table-constants";
@ -177,7 +181,6 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta
import {getCurrentProjectID} from "@/common/js/utils";
import {getIssueTemplate} from "@/network/custom-field-template";
import {getProjectMember} from "@/network/user";
import {getIntegrationService} from "@/network/organization";
export default {
name: "IssueList",
@ -247,6 +250,9 @@ export default {
fieldFilters() {
return CUSTOM_FIELD_TYPE_OPTION;
},
platformFilters() {
return ISSUE_PLATFORM_OPTION;
},
sceneFilters() {
return CUSTOM_FIELD_SCENE_OPTION;
},

View File

@ -135,7 +135,7 @@ export function _filter(filters, condition) {
//表格数据排序
export function _sort(column, condition) {
column.prop = humpToLine(column.prop);
let field = humpToLine(column.column.columnKey ? column.column.columnKey : column.prop);
if (column.order === 'descending') {
column.order = 'desc';
} else {
@ -146,7 +146,7 @@ export function _sort(column, condition) {
}
let hasProp = false;
condition.orders.forEach(order => {
if (order.name === column.prop) {
if (order.name === field) {
order.type = column.order;
hasProp = true;
}
@ -155,7 +155,7 @@ export function _sort(column, condition) {
hasProp = true;
}*/
if (!hasProp) {
condition.orders.push({name: column.prop, type: column.order});
condition.orders.push({name: field, type: column.order});
}
}