fix(测试跟踪): 关联缺陷汇总问题

--bug=1023324 --user=宋昌昌 【测试跟踪】功能用例-编辑-关联现有缺陷-列表字段和原型不一致 https://www.tapd.cn/55049933/s/1339201
This commit is contained in:
song-cc-rock 2023-02-21 11:35:52 +08:00 committed by jianxing
parent d30cea995c
commit 739949fafb
5 changed files with 133 additions and 75 deletions

View File

@ -432,6 +432,13 @@ public class IssuesService {
ServiceUtils.getDefaultOrder(issueRequest.getOrders());
issueRequest.setRefType(refType);
List<IssuesDao> issues = extIssuesMapper.getIssuesByCaseId(issueRequest);
Map<String, User> userMap = getUserMap(issues);
issues.forEach(issue -> {
User user = userMap.get(issue.getCreator());
if (user != null) {
issue.setCreatorName(user.getName());
}
});
handleCustomFieldStatus(issues);
return DistinctKeyUtil.distinctByKey(issues, IssuesDao::getId);
}
@ -1199,7 +1206,16 @@ public class IssuesService {
}
public List<IssuesDao> relateList(IssuesRequest request) {
return extIssuesMapper.getIssues(request);
List<IssuesDao> issues = extIssuesMapper.getIssues(request);
Map<String, User> userMap = getUserMap(issues);
issues.forEach(issue -> {
User user = userMap.get(issue.getCreator());
if (user != null) {
issue.setCreatorName(user.getName());
}
});
handleCustomFieldStatus(issues);
return issues;
}
public void userAuth(AuthUserIssueRequest authUserIssueRequest) {

View File

@ -212,7 +212,6 @@
</span>
</template>
</ms-table-column>
</span>
</ms-table>

View File

@ -88,7 +88,7 @@
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
</span>
<span v-else-if="scope.row.platform ==='Local'">
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
{{ '--' }}
</span>
<span v-else-if="platformStatusMap && platformStatusMap.get(scope.row.platformStatus)">
{{ platformStatusMap.get(scope.row.platformStatus) }}
@ -100,21 +100,6 @@
</template>
</ms-table-column>
<ms-table-column
v-else
:field="item"
:label="$t('test_track.issue.status')"
prop="status"
>
<template v-slot="scope">
<span>{{
issueStatusMap[scope.row.status]
? issueStatusMap[scope.row.status]
: scope.row.status
}}</span>
</template>
</ms-table-column>
<span v-for="field in issueTemplate.customFields" :key="field.id">
<ms-table-column
:field="item"
@ -157,6 +142,13 @@
>
</ms-table-column>
<ms-table-column
:field="item"
:label="$t('test_track.review.creator')"
prop="creatorName"
>
</ms-table-column>
<issue-description-table-item :field="item" />
</span>
</ms-table>
@ -217,7 +209,7 @@ export default {
MsTableColumn,
MsTable,
TestPlanIssueEdit,
MsNewUiSearch,
MsNewUiSearch
},
data() {
return {
@ -239,6 +231,8 @@ export default {
status: [],
issueRelateVisible: false,
condition: {},
platformStatus: [],
platformStatusMap: new Map(),
};
},
props: {

View File

@ -44,64 +44,84 @@
class="relate-issue-table"
ref="table"
>
<ms-table-column
:label="$t('test_track.issue.id')"
prop="id"
v-if="false"
>
</ms-table-column>
<ms-table-column :label="$t('test_track.issue.id')" prop="num">
</ms-table-column>
<span v-for="item in fields" :key="item.key">
<ms-table-column
:field="item"
:label="$t('test_track.issue.id')"
prop="id"
v-if="false"
>
</ms-table-column>
<ms-table-column
:field="item"
:label="'ID'"
prop="num"
:sortable="true">
</ms-table-column>
<ms-table-column
:label="$t('test_track.issue.title')"
prop="title"
min-width="200px"
>
</ms-table-column>
<ms-table-column
:field="item"
:label="$t('test_track.issue.title')"
prop="title"
:sortable="true"
>
</ms-table-column>
<ms-table-column
:label="$t('test_track.issue.platform_status')"
v-if="isThirdPart"
prop="platformStatus"
>
<template v-slot="scope">
<span v-if="scope.row.platform === 'Tapd'">
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
<!-- 自定义状态字段 -->
<span v-for="field in issueTemplate.customFields" :key="field.id">
<ms-table-column
:field="item"
:label="field.name"
:prop="field.name"
v-if="field.name === '状态'"
>
<template v-slot="scope">
<span>
{{ getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field) : issueStatusMap[scope.row.status]}}
</span>
</template>
</ms-table-column>
</span>
<ms-table-column
:field="item"
:label="$t('test_track.issue.platform_status')"
v-if="isThirdPart"
prop="platformStatus"
>
<template v-slot="scope">
<span v-if="scope.row.platform === 'Tapd'">
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
</span>
<span v-else-if="scope.row.platform ==='Local'">
{{ '--' }}
</span>
<span v-else-if="platformStatusMap && platformStatusMap.get(scope.row.platformStatus)">
{{ platformStatusMap.get(scope.row.platformStatus) }}
</span>
<span v-else-if="scope.row.platform ==='Local'">
{{ scope.row.platformStatus ? tapdIssueStatusMap[scope.row.platformStatus] : '--' }}
</span>
<span v-else-if="platformStatusMap && platformStatusMap.get(scope.row.platformStatus)">
{{ platformStatusMap.get(scope.row.platformStatus) }}
</span>
<span v-else>
{{ scope.row.platformStatus ? scope.row.platformStatus : '--' }}
</span>
</template>
</ms-table-column>
<span v-else>
{{ scope.row.platformStatus ? scope.row.platformStatus : '--' }}
</span>
</template>
</ms-table-column>
<ms-table-column
v-else
:label="$t('test_track.issue.status')"
prop="status"
>
<template v-slot="scope">
<span>{{
issueStatusMap[scope.row.status]
? issueStatusMap[scope.row.status]
: scope.row.status
}}</span>
</template>
</ms-table-column>
<ms-table-column
:field="item"
:label="$t('test_track.issue.platform')"
prop="platform"
>
</ms-table-column>
<ms-table-column
:label="$t('test_track.issue.platform')"
prop="platform"
>
</ms-table-column>
<ms-table-column
:field="item"
:label="$t('test_track.review.creator')"
prop="creatorName"
>
</ms-table-column>
<issue-description-table-item :field="item" />
</span>
<issue-description-table-item />
</ms-table>
<!-- <ms-table-pagination
@ -137,12 +157,14 @@
}
</style>
<script>
import { LOCAL } from "metersphere-frontend/src/utils/constants";
import MsNewUiSearch from "metersphere-frontend/src/components/new-ui/MsSearch";
import MsEditDialog from "metersphere-frontend/src/components/MsEditDialog";
import HomePagination from "@/business/home/components/pagination/HomePagination";
import MsTable from "metersphere-frontend/src/components/new-ui/MsTable";
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
import {
getIssuePartTemplateWithProject,
getPlatformOption, getPlatformStatus,
getRelateIssues,
isThirdPartEnable,
@ -158,6 +180,7 @@ import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
import MsDrawerComponent from "../common/MsDrawerComponent";
import MsTableAdvSearch from "metersphere-frontend/src/components/new-ui/MsTableAdvSearch";
import {setIssuePlatformComponent} from "@/business/issue/issue";
import {getCustomFieldValue, getTableHeaderWithCustomFields} from "metersphere-frontend/src/utils/tableUtils";
export default {
name: "CaseIssueRelateList",
@ -179,6 +202,8 @@ export default {
components: TEST_CASE_RELEVANCE_ISSUE_LIST,
}),
visible: false,
issueTemplate: {},
fields: [],
isThirdPart: false,
selectCounts: null,
screenHeight: 'calc(100vh - 185px)',
@ -203,11 +228,35 @@ export default {
notInIds: Array,
},
created() {
isThirdPartEnable((data) => {
this.isThirdPart = data;
});
this.getIssueTemplate();
},
methods: {
getIssueTemplate() {
getIssuePartTemplateWithProject((template, project) => {
this.currentProject = project;
this.issueTemplate = template;
if (this.issueTemplate.platform === LOCAL) {
this.isThirdPart = false;
} else {
this.isThirdPart = true;
}
this.fields = getTableHeaderWithCustomFields("ISSUE_LIST", this.issueTemplate.customFields);
if (!this.isThirdPart) {
for (let i = 0; i < this.fields.length; i++) {
if (this.fields[i].id === "platformStatus") {
this.fields.splice(i, 1);
break;
}
}
}
if (this.$refs.table) {
this.$refs.table.reloadTable();
}
});
},
getCustomFieldValue(row, field) {
return getCustomFieldValue(row, field, this.members);
},
clearSelection() {
if (this.$refs.table) {
this.$refs.table.clearSelectRows();
@ -217,6 +266,7 @@ export default {
this.$refs.relevanceDialog.selectCounts = data;
},
open() {
this.getIssueTemplate();
this.getIssues();
this.visible = true;
this.$refs.relevanceDialog.open();

View File

@ -146,7 +146,6 @@
<ms-single-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 80"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
<span/>
</template>
</ms-table-column>