From f108cd773c5d83cacd0dcc6540aca60408ead597 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Sun, 23 Apr 2023 15:06:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=AE=A1=E5=88=92=E5=88=97=E8=A1=A8=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=8E=87=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025720 --user=宋昌昌 【工作台】我的待办-测试计划-测试进度显示错误 https://www.tapd.cn/55049933/s/1365641 --- workstation/frontend/src/api/test-plan.js | 4 ++ .../src/business/component/PlanTableList.vue | 37 +++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/workstation/frontend/src/api/test-plan.js b/workstation/frontend/src/api/test-plan.js index 3d232b77c4..b07d9330f9 100644 --- a/workstation/frontend/src/api/test-plan.js +++ b/workstation/frontend/src/api/test-plan.js @@ -19,3 +19,7 @@ export function getPlanList(goPage, pageSize,param) { export function editPlan(param) { return post('/test/plan/edit',param); } + +export function getTestPlanMetricDataList(ids) { + return post('/test/plan/metric', ids); +} diff --git a/workstation/frontend/src/business/component/PlanTableList.vue b/workstation/frontend/src/business/component/PlanTableList.vue index 52ab08049e..f8db8585fb 100644 --- a/workstation/frontend/src/business/component/PlanTableList.vue +++ b/workstation/frontend/src/business/component/PlanTableList.vue @@ -189,7 +189,7 @@ import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter"; import MsTablePagination from 'metersphere-frontend/src/components/pagination/TablePagination'; import {TEST_PLAN_CONFIGS} from "metersphere-frontend/src/components/search/search-components"; import {getCustomTableHeaderByXpack} from "@/business/component/js/table-head-util"; -import {editPlan, getDashboardPlanList, getPlanList, getPlanStageOption, getPrincipalById} from "@/api/test-plan"; +import {editPlan, getDashboardPlanList, getPlanList, getPlanStageOption, getPrincipalById, getTestPlanMetricDataList} from "@/api/test-plan"; export default { name: "PlanTableList", @@ -338,12 +338,12 @@ export default { dealResponseData(data){ this.total = data.itemCount; this.tableData = data.listObject; + let testPlanIds = []; this.tableData.forEach(item => { + testPlanIds.push(item.id); if (item.tags && item.tags.length > 0) { item.tags = JSON.parse(item.tags); } - item.passRate = item.passRate + '%'; - item.testRate = item.testRate ? item.testRate : 0; getPrincipalById(item.id).then(res => { let data = res.data; let principal = ""; @@ -362,6 +362,37 @@ export default { this.$set(item, "principals", principalIds); }) }); + console.log(testPlanIds) + this.getTestPlanDetailData(testPlanIds); + }, + getTestPlanDetailData(testPlanIds) { + getTestPlanMetricDataList(testPlanIds) + .then((res) => { + let metricDataList = res.data; + if (metricDataList && metricDataList.length > 0) { + this.tableData.forEach((item) => { + let metricData = null; + metricDataList.forEach((metricItem) => { + if (item.id === metricItem.id) { + metricData = metricItem; + } + }); + if (metricData) { + this.$set(item, "passRate", metricData['passRate'] + '%'); + this.$set(item, "testRate", metricData['testRate']); + } else { + this.$set(item, "passRate", 0); + this.$set(item, "testRate", 0); + } + }); + } + }) + .catch(() => { + this.tableData.forEach((item) => { + this.$set(item, "passRate", 0); + this.$set(item, "testRate", 0); + }); + }); }, statusChange(data) { if (!hasPermission('PROJECT_TRACK_PLAN:READ+EDIT')) {