From a37c82dc5bb412a59664bfd9b430b9b404735d52 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 11 Oct 2022 14:43:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E6=89=B9=E9=87=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=94=A8=E4=BE=8B=E7=8A=B6=E6=80=81=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017751 --user=陈建星 【测试跟踪】批量修改用例状态未生效 https://www.tapd.cn/55049933/s/1258120 --- .../business/case/components/BatchEdit.vue | 7 +++++- .../business/case/components/TestCaseList.vue | 10 +++++--- .../functional/FunctionalTestCaseList.vue | 5 ++-- .../frontend/src/business/utils/sdk-utils.js | 23 +++++++++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/test-track/frontend/src/business/case/components/BatchEdit.vue b/test-track/frontend/src/business/case/components/BatchEdit.vue index 3558060bfe..e76de63b1c 100644 --- a/test-track/frontend/src/business/case/components/BatchEdit.vue +++ b/test-track/frontend/src/business/case/components/BatchEdit.vue @@ -223,7 +223,12 @@ export default { getCustomField(id) .then(res => { this.loading = false; - this.customField = res ? res.data : {}; + if (res) { + res.data.defaultValue = null; + this.customField = res.data; + } else { + this.customField = {defaultValue: null}; + } this.customField.options = JSON.parse(this.customField.options); if (this.customField.type === 'checkbox' || this.customField.type === 'multipleMember') { this.customField.defaultValue = []; diff --git a/test-track/frontend/src/business/case/components/TestCaseList.vue b/test-track/frontend/src/business/case/components/TestCaseList.vue index 2253c4cb59..f0acbf74e4 100644 --- a/test-track/frontend/src/business/case/components/TestCaseList.vue +++ b/test-track/frontend/src/business/case/components/TestCaseList.vue @@ -219,7 +219,6 @@ import MsTag from "metersphere-frontend/src/components/MsTag"; import { buildBatchParam, getCustomFieldBatchEditOption, getCustomFieldFilter, - getCustomFieldValue, getCustomTableHeader, getCustomTableWidth, getLastTableSortField, @@ -264,7 +263,12 @@ import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCrea import TestCaseReviewStatusTableItem from "@/business/common/tableItems/TestCaseReviewStatusTableItem"; import RelateDemand from "@/business/case/components/RelateDemand"; import TestPlanCaseStatusTableItem from "@/business/common/tableItems/TestPlanCaseStatusTableItem"; -import {generateColumnKey, getAdvSearchCustomField, getProjectMemberOption} from "@/business/utils/sdk-utils"; +import { + generateColumnKey, + getAdvSearchCustomField, + getCustomFieldValueForTrack, + getProjectMemberOption +} from "@/business/utils/sdk-utils"; export default { @@ -591,7 +595,7 @@ export default { useStore().testCaseDefaultValue = testCaseDefaultValue; }, getCustomFieldValue(row, field, defaultVal = '') { - let value = getCustomFieldValue(row, field, this.members); + let value = getCustomFieldValueForTrack(row, field, this.members); if (field.name === '用例等级') { return row.priority; } else if (field.name === '责任人') { diff --git a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue index 0125dfa897..80c548ecf8 100644 --- a/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/functional/FunctionalTestCaseList.vue @@ -285,7 +285,6 @@ import BatchEdit from "../../../../case/components/BatchEdit"; import MsTag from "metersphere-frontend/src/components/MsTag"; import { buildBatchParam, - getCustomFieldValue, getCustomTableHeader, getCustomTableWidth, getLastTableSortField, @@ -307,7 +306,7 @@ import {SYSTEM_FIELD_NAME_MAP} from "metersphere-frontend/src/utils/table-consta import {getTestPlanTestCase} from "@/api/testCase"; import TestPlanCaseIssueItem from "@/business/plan/view/comonents/functional/TestPlanCaseIssueItem"; import {getProjectVersions} from "@/api/project"; -import {getProjectMemberOption} from "@/business/utils/sdk-utils"; +import {getCustomFieldValueForTrack, getProjectMemberOption} from "@/business/utils/sdk-utils"; import { testPlanTestCaseBatchDelete, testPlanTestCaseBatchEdit, @@ -560,7 +559,7 @@ export default { }); }, getCustomFieldValue(row, field) { - return getCustomFieldValue(row, field, this.members); + return getCustomFieldValueForTrack(row, field, this.members); }, initTableData(callback) { initCondition(this.condition, this.condition.selectAll); diff --git a/test-track/frontend/src/business/utils/sdk-utils.js b/test-track/frontend/src/business/utils/sdk-utils.js index 6627015a00..bbf07d58c8 100644 --- a/test-track/frontend/src/business/utils/sdk-utils.js +++ b/test-track/frontend/src/business/utils/sdk-utils.js @@ -17,3 +17,26 @@ export {getOwnerProjects, getProjectListAll} from "metersphere-frontend/src/api/ export {deleteRelationshipEdge} from "metersphere-frontend/src/api/relationship-edge"; export {isProjectVersionEnable} from "metersphere-frontend/src/api/version"; + +import { + getCustomFieldValue, +} from "metersphere-frontend/src/utils/tableUtils"; +import i18n from "@/i18n"; + +export function getCustomFieldValueForTrack(row, field, members) { + if (field.name === '用例状态' && field.system) { + return parseStatus(row, field.options); + } + return getCustomFieldValue(row, field, members); +} + +function parseStatus(row, options) { + if (options) { + for (let option of options) { + if (option.value === row.status) { + return option.system ? i18n.t(option.text) : option.text; + } + } + } + return row.status; +}