From 72f903a303c01673b3854fd1e399678b97a52d4c Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 4 Apr 2023 19:28:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0=E6=88=91=E7=9A=84=E5=85=B3=E6=B3=A8=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0loading=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025139 --user=宋天阳 【工作台】我创建的/我关注得-查看缺陷关联-先显示暂无数据 https://www.tapd.cn/55049933/s/1359571 --- .../src/business/component/CaseTableList.vue | 15 +- .../src/business/component/IssueTableList.vue | 271 +++++++++++------- 2 files changed, 174 insertions(+), 112 deletions(-) diff --git a/workstation/frontend/src/business/component/CaseTableList.vue b/workstation/frontend/src/business/component/CaseTableList.vue index f66fe804f3..0ac865e6bc 100644 --- a/workstation/frontend/src/business/component/CaseTableList.vue +++ b/workstation/frontend/src/business/component/CaseTableList.vue @@ -1,7 +1,7 @@ @@ -113,7 +143,7 @@ import MsTablePagination from "metersphere-frontend/src/components/pagination/Ta import { ISSUE_PLATFORM_OPTION, ISSUE_STATUS_MAP, - TAPD_ISSUE_STATUS_MAP + TAPD_ISSUE_STATUS_MAP, } from "metersphere-frontend/src/utils/table-constants"; import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader"; @@ -124,19 +154,24 @@ import { getPlatformOption, } from "@/api/issue"; import { + getCustomFieldFilter, getCustomFieldValue, getCustomTableWidth, - getPageInfo, getTableHeaderWithCustomFields, getLastTableSortField, getCustomFieldFilter, parseCustomFilesForList + getLastTableSortField, + getPageInfo, + getTableHeaderWithCustomFields, + parseCustomFilesForList, } from "metersphere-frontend/src/utils/tableUtils"; import MsContainer from "metersphere-frontend/src/components/MsContainer"; import MsMainContainer from "metersphere-frontend/src/components/MsMainContainer"; -import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; -import {getProjectMember, getProjectMemberUserFilter} from "@/api/user"; -import {LOCAL} from "metersphere-frontend/src/utils/constants"; -import {TEST_TRACK_ISSUE_LIST} from "metersphere-frontend/src/components/search/search-components"; import { - getAdvSearchCustomField -} from "metersphere-frontend/src/components/search/custom-component"; + getCurrentProjectID, + getCurrentWorkspaceId, +} from "metersphere-frontend/src/utils/token"; +import { getProjectMember, getProjectMemberUserFilter } from "@/api/user"; +import { LOCAL } from "metersphere-frontend/src/utils/constants"; +import { TEST_TRACK_ISSUE_LIST } from "metersphere-frontend/src/components/search/search-components"; +import { getAdvSearchCustomField } from "metersphere-frontend/src/components/search/custom-component"; import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText"; import MsReviewTableItem from "@/business/component/MsReviewTableItem"; import IssueDescriptionTableItem from "@/business/component/IssueDescriptionTableItem"; @@ -150,7 +185,11 @@ export default { MsContainer, IssueDescriptionTableItem, MsTableHeader, - MsTablePagination, MsTableButton, MsTableOperators, MsTableColumn, MsTable + MsTablePagination, + MsTableButton, + MsTableOperators, + MsTableColumn, + MsTable, }, data() { return { @@ -161,7 +200,7 @@ export default { fields: [], customFields: [], // 通过表头过滤后的自定义字段列表 tableHeaderKey: "ISSUE_LIST", - fieldsWidth: getCustomTableWidth('ISSUE_LIST'), + fieldsWidth: getCustomTableWidth("ISSUE_LIST"), issueTemplate: {}, members: [], userFilter: [], @@ -176,7 +215,7 @@ export default { columns: { num: { sortable: true, - minWidth: 100 + minWidth: 100, }, title: { sortable: true, @@ -184,34 +223,33 @@ export default { }, platform: { minWidth: 80, - filters: this.platformFilters + filters: this.platformFilters, }, platformStatus: { minWidth: 110, }, creatorName: { - columnKey: 'creator', + columnKey: "creator", minWidth: 100, - filters: this.creatorFilters + filters: this.creatorFilters, }, resourceName: {}, createTime: { sortable: true, - minWidth: 180 + minWidth: 180, }, updateTime: { sortable: true, - minWidth: 180 + minWidth: 180, }, - caseCount: {} - } + caseCount: {}, + }, }; }, activated() { - getPlatformOption() - .then((r) => { - this.platformOptions = r.data; - }); + getPlatformOption().then((r) => { + this.platformOptions = r.data; + }); }, props: { isFocus: { @@ -237,8 +275,8 @@ export default { screenHeight: { type: [Number, String], default() { - return 'calc(100vh - 160px)'; - } + return "calc(100vh - 160px)"; + }, }, //屏幕高度 }, computed: { @@ -261,18 +299,17 @@ export default { }, isToDo() { return !this.isFocus && !this.isCreation; - } + }, }, created() { this.getMaintainerOptions(); - this.page.result.loading = true; + this.loading = true; this.$nextTick(() => { getProjectMember((data) => { this.members = data; }); getIssuePartTemplateWithProject((template) => { this.initFields(template); - this.page.result.loading = false; this.getIssues(); }); }); @@ -291,36 +328,56 @@ export default { } else { this.isThirdPart = true; } - let fields = getTableHeaderWithCustomFields('ISSUE_LIST', template.customFields, this.members); + let fields = getTableHeaderWithCustomFields( + "ISSUE_LIST", + template.customFields, + this.members + ); if (!this.isThirdPart) { for (let i = 0; i < fields.length; i++) { - if (fields[i].id === 'platformStatus') { + if (fields[i].id === "platformStatus") { fields.splice(i, 1); break; } } // 如果不是三方平台则移除备选字段中的平台状态 - let removeField = {id: 'platformStatus', name: 'platformStatus', remove: true}; + let removeField = { + id: "platformStatus", + name: "platformStatus", + remove: true, + }; template.customFields.push(removeField); } this.issueTemplate = template; - fields.forEach(item => { + fields.forEach((item) => { if (this.columns[item.id]) { Object.assign(item, this.columns[item.id]); if (this.columns[item.id].filters) { item.filters = this.columns[item.id].filters; } } - if (this.isToDo && item.id === '状态') { - item.filters = item.filters.filter(i => (i.value !== 'closed' && i.value !== '已关闭' && i.value !== 'resolved' && i.value !== 'Done' && i.value !== 'verified')) + if (this.isToDo && item.id === "状态") { + item.filters = item.filters.filter( + (i) => + i.value !== "closed" && + i.value !== "已关闭" && + i.value !== "resolved" && + i.value !== "Done" && + i.value !== "verified" + ); } }); this.fields = fields; // 过滤自定义字段 - this.page.condition.components = this.page.condition.components.filter(item => item.custom !== true); - let comp = getAdvSearchCustomField(this.page.condition, template.customFields); + this.page.condition.components = this.page.condition.components.filter( + (item) => item.custom !== true + ); + let comp = getAdvSearchCustomField( + this.page.condition, + template.customFields + ); this.page.condition.components.push(...comp); this.initCustomFieldValue(); @@ -328,6 +385,7 @@ export default { if (this.$refs.table) { this.$refs.table.reloadTable(); } + this.loading = false; }, search() { // 添加搜索条件时,当前页设置成第一页 @@ -338,8 +396,11 @@ export default { this.initFields(this.issueTemplate); }, handleEdit(resource) { - let issueData = this.$router.resolve({path: '/track/issue', query: {id: resource.id}}); - window.open(issueData.href, '_blank'); + let issueData = this.$router.resolve({ + path: "/track/issue", + query: { id: resource.id }, + }); + window.open(issueData.href, "_blank"); }, getIssues() { if (this.isSelectAll === false) { @@ -350,39 +411,44 @@ export default { followPeople: { operator: "current user", value: "current user", - } - } + }, + }; } else if (this.isCreation) { if (this.page.condition.filters) { - delete this.condition.filters['user_id'] + delete this.condition.filters["user_id"]; } this.page.condition.combine = { creator: { operator: "current user", value: "current user", - } - - } + }, + }; } else { this.addDefaultStatusFilter(); } this.page.condition.workspaceId = getCurrentWorkspaceId(); this.page.condition.orders = getLastTableSortField(this.tableHeaderKey); if (this.isDashboard) { - this.page.result.loading = getDashboardIssues(this.page).then((response)=>{ - let data = response.data; - this.page.total = data.itemCount; - this.page.data = data.listObject; - parseCustomFilesForList(this.page.data); - this.initCustomFieldValue(); - }); + this.loading = true; + this.page.result.loading = getDashboardIssues(this.page).then( + (response) => { + let data = response.data; + this.page.total = data.itemCount; + this.page.data = data.listObject; + parseCustomFilesForList(this.page.data); + this.initCustomFieldValue(); + this.loading = false; + } + ); } else { + this.loading = true; this.page.result.loading = getIssues(this.page).then((response) => { let data = response.data; this.page.total = data.itemCount; this.page.data = data.listObject; parseCustomFilesForList(this.page.data); this.initCustomFieldValue(); + this.loading = false; }); } }, @@ -391,42 +457,46 @@ export default { creator: { operator: "current user", value: "current user", - } - } + }, + }; if (this.isToDo) { this.page.condition.combine.doneStatus = { operator: "not in", value: [ - 'closed', - '已关闭', - '已完成', - '完成', - '拒绝', - '已拒绝', - 'rejected', - 'delete', - 'resolved', - 'Done', - 'verified', - '已验证' + "closed", + "已关闭", + "已完成", + "完成", + "拒绝", + "已拒绝", + "rejected", + "delete", + "resolved", + "Done", + "verified", + "已验证", ], - } + }; } }, initCustomFieldValue() { if (this.fields.length <= 0) { return; } - this.page.data.forEach(item => { + this.page.data.forEach((item) => { let displayValueMap = {}; - let fieldIdSet = new Set(this.fields.map(i => i.id)); - this.issueTemplate.customFields.forEach(field => { + let fieldIdSet = new Set(this.fields.map((i) => i.id)); + this.issueTemplate.customFields.forEach((field) => { let displayValue; if (!fieldIdSet.has(field.name)) { return; } - if (field.name === '状态') { - displayValue = this.getCustomFieldValue(item, field, this.issueStatusMap[item.status]); + if (field.name === "状态") { + displayValue = this.getCustomFieldValue( + item, + field, + this.issueStatusMap[item.status] + ); } else { displayValue = this.getCustomFieldValue(item, field); } @@ -441,7 +511,7 @@ export default { this.creatorFilters = data; }); }, - } + }, }; @@ -456,4 +526,3 @@ export default { cursor: pointer; } -