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

View File

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

View File

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

View File

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

View File

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