fix(测试跟踪): 功能用例批量编辑用例状态无效

--bug=1017751 --user=陈建星 【测试跟踪】批量修改用例状态未生效 https://www.tapd.cn/55049933/s/1258120
This commit is contained in:
chenjianxing 2022-10-11 14:43:21 +08:00 committed by jianxing
parent 1572af5a0d
commit a37c82dc5b
4 changed files with 38 additions and 7 deletions

View File

@ -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 = [];

View File

@ -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 === '责任人') {

View File

@ -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);

View File

@ -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;
}