From 83b2f358d8b4186e01367d7bdf6ef92997e520d0 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 14 Jun 2022 16:49:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E3=80=90=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E3=80=91=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=95=B0=E7=BB=9F=E8=AE=A1=E9=94=99=E8=AF=AF?= =?UTF-8?q?-=E5=81=B6=E5=8F=91=E4=BD=86=E7=BB=8F=E5=B8=B8=E9=81=87?= =?UTF-8?q?=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --bug=1013306 【测试计划】执行功能用例页面用例数统计错误-偶发但经常遇到 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001013306 --- .../functional/FunctionalTestCaseList.vue | 45 +++++++++++-------- .../components/TestReviewTestCaseList.vue | 17 +++++-- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue index da2ba53f0f..92e214d2bc 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -13,7 +13,8 @@ :content="$t('test_track.plan_view.my_case')" @click="searchMyTestCase"/> - @@ -154,7 +155,7 @@ :fields-width="fieldsWidth" :label="$t('test_track.plan_view.executor')"> @@ -223,10 +224,11 @@ :prop="field.name"> @@ -267,11 +269,8 @@ import MsTableHeader from '../../../../../common/components/MsTableHeader'; import MsTableButton from '../../../../../common/components/MsTableButton'; import NodeBreadcrumb from '../../../../common/NodeBreadcrumb'; -import { - TEST_PLAN_FUNCTION_TEST_CASE, - TokenKey, -} from "@/common/js/constants"; -import {getCurrentProjectID, hasPermission, hasLicense} from "@/common/js/utils"; +import {TEST_PLAN_FUNCTION_TEST_CASE, TokenKey,} from "@/common/js/constants"; +import {getCurrentProjectID, hasLicense, hasPermission} from "@/common/js/utils"; import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem"; import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem"; import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem"; @@ -283,7 +282,10 @@ import BatchEdit from "../../../../case/components/BatchEdit"; import MsTag from "@/business/components/common/components/MsTag"; import { buildBatchParam, - getCustomFieldValue, getCustomTableHeader, getCustomTableWidth, getLastTableSortField, + getCustomFieldValue, + getCustomTableHeader, + getCustomTableWidth, + getLastTableSortField, getTableHeaderWithCustomFields, initCondition, } from "@/common/js/tableUtils"; @@ -333,6 +335,7 @@ export default { currentPage: 1, pageSize: 10, total: 0, + totalCount: 0, status: 'default', testPlan: {}, isReadOnly: false, @@ -400,8 +403,8 @@ export default { systemFiledMap() { return SYSTEM_FIELD_NAME_MAP; }, - operators(){ - if (this.planStatus==='Archived') { + operators() { + if (this.planStatus === 'Archived') { return [ { tip: this.$t('commons.edit'), icon: "el-icon-edit", @@ -431,8 +434,8 @@ export default { ] } }, - buttons(){ - if (this.planStatus==='Archived') { + buttons() { + if (this.planStatus === 'Archived') { return [ { name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, @@ -458,7 +461,7 @@ export default { } ] } - } , + }, }, watch: { planId() { @@ -476,7 +479,7 @@ export default { }, condition() { this.$emit('setCondition', this.condition); - } + }, }, created() { this.condition.orders = getLastTableSortField(this.tableHeaderKey); @@ -495,7 +498,7 @@ export default { }, methods: { loadIssue(row) { - if(row.issuesSize && !row.hasLoadIssue) { + if (row.issuesSize && !row.hasLoadIssue) { this.$get("/issues/get/case/PLAN_FUNCTIONAL/" + row.id).then(response => { this.$set(row, "issuesContent", response.data.data); this.$set(row, "hasLoadIssue", true); @@ -562,7 +565,13 @@ export default { this.condition.projectId = getCurrentProjectID(); if (this.planId) { this.result = getTestPlanTestCase(this.currentPage, this.pageSize, this.condition, (data) => { + if (this.totalCount === 0) { + this.totalCount = data.itemCount; + } this.total = data.itemCount; + if (this.total !== this.totalCount) { + this.currentPage = 1 + } this.tableData = data.listObject; for (let i = 0; i < this.tableData.length; i++) { if (this.tableData[i]) { @@ -755,7 +764,7 @@ export default { getVersionOptions() { if (hasLicense()) { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { - this.versionOptions= response.data; + this.versionOptions = response.data; this.versionFilters = response.data.map(u => { return {text: u.name, value: u.id}; }); diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue index 4de8c77ccf..57f0722af8 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue @@ -182,8 +182,12 @@ import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import { _handleSelectAll, - buildBatchParam, deepClone, getCustomTableWidth, getLastTableSortField, - getSelectDataCounts, getTableHeaderWithCustomFields, + buildBatchParam, + deepClone, + getCustomTableWidth, + getLastTableSortField, + getSelectDataCounts, + getTableHeaderWithCustomFields, initCondition, toggleAllSelection } from "@/common/js/tableUtils"; @@ -193,7 +197,7 @@ import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOpe import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTable from "@/business/components/common/components/table/MsTable"; -import {editTestReviewTestCaseOrder, getTestPlanTestCase, getTestReviewTestCase} from "@/network/testCase"; +import {editTestReviewTestCaseOrder, getTestReviewTestCase} from "@/network/testCase"; import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; export default { @@ -224,6 +228,7 @@ export default { currentPage: 1, pageSize: 10, total: 0, + totalCount: 0, enableOrderDrag: true, selectRows: new Set(), testReview: {}, @@ -369,7 +374,13 @@ export default { this.condition.nodeIds = this.selectNodeIds; if (this.reviewId) { this.result = getTestReviewTestCase(this.currentPage, this.pageSize, this.condition, (data) => { + if (this.totalCount === 0) { + this.totalCount = data.itemCount; + } this.total = data.itemCount; + if (this.total !== this.totalCount) { + this.currentPage = 1 + } this.tableData = data.listObject; this.getPreData(); if (callback && callback instanceof Function) {