fix(项目设置): 测试计划功能用例列表没有等级字段问题

--bug=1018325 --user=宋昌昌 【测试跟踪】测试计划-功能用例列表没有用例等级字段 https://www.tapd.cn/55049933/s/1266108

Co-authored-by: song-cc-rock <changchang.song@fit2cloud.com>
This commit is contained in:
MeterSphere Bot 2022-10-19 10:20:18 +08:00 committed by GitHub
parent fe0bb4bbe0
commit eac5002a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 11 deletions

View File

@ -218,7 +218,7 @@
</ms-table-column>
<ms-table-column v-for="field in testCaseTemplate.customFields" :key="field.id"
:filters="field.name === '用例等级' ? priorityFilters : null"
:filters="getCustomFieldFilter(field)"
:field="item"
column-key="priority"
:fields-width="fieldsWidth"
@ -290,6 +290,7 @@ import {
getLastTableSortField,
getTableHeaderWithCustomFields,
initCondition,
getCustomFieldFilter
} from "metersphere-frontend/src/utils/tableUtils";
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
@ -502,12 +503,12 @@ export default {
this.pageCount = Math.ceil(this.total / this.pageSize);
},
mounted() {
this.getTemplateField();
this.$emit('setCondition', this.condition);
this.$EventBus.$on("openFailureTestCase", this.handleOpenFailureTestCase);
this.refreshTableAndPlan();
this.hasEditPermission = hasPermission('PROJECT_TRACK_PLAN:READ+EDIT');
this.getMaintainerOptions();
this.getTemplateField();
this.getVersionOptions();
},
destroyed() {
@ -542,22 +543,44 @@ export default {
},
getTemplateField() {
this.result.loading = true;
let p1 = getProjectMember((data) => {
this.members = data;
});
let p1 = getProjectMember()
.then((response) => {
this.members = response.data;
});
let p2 = getTestTemplate();
Promise.all([p1, p2]).then((data) => {
let template = data[1];
this.testCaseTemplate = template;
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields);
if (this.$refs.table) {
this.$refs.table.resetHeader();
}
this.result.loading = false;
this.$nextTick(() => {
if (this.$refs.table) {
this.$refs.table.resetHeader();
}
this.result.loading = false;
});
});
},
getCustomFieldValue(row, field) {
return getCustomFieldValueForTrack(row, field, this.members);
getCustomFieldFilter(field) {
if (field.name === '用例状态') {
let option = [];
field.options.forEach((item) => {
option.push({
text: this.$t(item.text),
value: item.value
})
});
return option;
}
return getCustomFieldFilter(field, this.userFilters);
},
getCustomFieldValue(row, field, defaultVal = '') {
let value = getCustomFieldValueForTrack(row, field, this.members);
if (field.name === '用例等级') {
return row.priority;
} else if (field.name === '责任人') {
return row.maintainerName;
}
return value ? value : defaultVal;
},
initTableData(callback) {
initCondition(this.condition, this.condition.selectAll);