fix(测试跟踪): 添加自定义的用例等级,列表和编辑页显示的是ID

This commit is contained in:
chenjianxing 2023-03-17 11:09:52 +08:00 committed by jianxing
parent d5940c2c50
commit bd8de3a521
5 changed files with 45 additions and 11 deletions

View File

@ -17,7 +17,10 @@
<div class="case-edit" v-show="!isNameEdit && !editable"> <div class="case-edit" v-show="!isNameEdit && !editable">
<div class="case-level" v-if="!isPublicShow"> <div class="case-level" v-if="!isPublicShow">
<priority-table-item :value="form.priority" /> <priority-table-item
:value="form.priority"
:priority-options="priorityOptions"
/>
</div> </div>
<div> <div>
<!-- 版本历史 v-xpack --> <!-- 版本历史 v-xpack -->
@ -586,7 +589,8 @@ export default {
createVersionId: null, createVersionId: null,
editableState: false, editableState: false,
isNameEdit: false, isNameEdit: false,
useUserStore: {} useUserStore: {},
priorityOptions: []
}; };
}, },
props: { props: {
@ -1153,6 +1157,7 @@ export default {
this.testCaseTemplate.customFields.forEach((field) => { this.testCaseTemplate.customFields.forEach((field) => {
if (field.name === "用例等级") { if (field.name === "用例等级") {
field.defaultValue = this.form.priority; field.defaultValue = this.form.priority;
this.priorityOptions = field.options;
} else if (field.name === "责任人") { } else if (field.name === "责任人") {
field.defaultValue = this.form.maintainer; field.defaultValue = this.form.maintainer;
} else if (field.name === "用例状态") { } else if (field.name === "用例状态") {

View File

@ -202,7 +202,7 @@
<template v-slot="scope"> <template v-slot="scope">
<span v-if="field.name === '用例等级'"> <span v-if="field.name === '用例等级'">
<priority-table-item <priority-table-item
:value="getCustomFieldValue(scope.row, field, scope.row.priority)"/> :value="getCustomFieldValue(scope.row, field, scope.row.priority)" :priority-options="priorityOptions"/>
</span> </span>
<span v-else-if="field.name === '用例状态'"> <span v-else-if="field.name === '用例状态'">
<case-status-table-item :value="getCustomFieldValue(scope.row, field, scope.row.status)"></case-status-table-item> <case-status-table-item :value="getCustomFieldValue(scope.row, field, scope.row.status)"></case-status-table-item>
@ -488,7 +488,8 @@ export default {
selectCounts: 0, selectCounts: 0,
refreshBySearch: false, refreshBySearch: false,
enableVersionColumn: false, enableVersionColumn: false,
projectId: '' projectId: '',
priorityOptions: []
}; };
}, },
props: { props: {
@ -676,6 +677,7 @@ export default {
} }
if (item.name === '用例等级') { if (item.name === '用例等级') {
item.columnKey = 'priority'; item.columnKey = 'priority';
this.priorityOptions = item.options;
} else if (item.name === '责任人') { } else if (item.name === '责任人') {
item.columnKey = 'maintainer'; item.columnKey = 'maintainer';
} else if (item.name === '用例状态') { } else if (item.name === '用例状态') {

View File

@ -13,7 +13,7 @@
{{ value }} {{ value }}
</el-tag> </el-tag>
<el-tag v-else class="status-label unknown"> <el-tag v-else class="status-label unknown">
{{ value }} {{ getPriorityText() }}
</el-tag> </el-tag>
</div> </div>
@ -26,7 +26,19 @@
components: {MsTag}, components: {MsTag},
props: { props: {
value: { value: {
type: String type: String,
},
priorityOptions: {
type: Array,
default() {
return [];
}
}
},
methods: {
getPriorityText() {
let priorityItem = this.priorityOptions.find(item => item.value === this.value);
return priorityItem ? priorityItem.text : '';
} }
} }
} }

View File

@ -74,7 +74,7 @@
:label="$t('test_track.case.priority')" :label="$t('test_track.case.priority')"
width="120px"> width="120px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/> <priority-table-item :value="scope.row.priority" :priority-options="priorityOptions"/>
</template> </template>
</ms-table-column> </ms-table-column>
@ -185,7 +185,8 @@ export default {
], ],
versionFilters: null, versionFilters: null,
testCaseTemplate: {}, testCaseTemplate: {},
pageRefresh: false pageRefresh: false,
priorityOptions: []
}; };
}, },
props: { props: {
@ -328,6 +329,11 @@ export default {
getTestTemplate(projectId).then(data => { getTestTemplate(projectId).then(data => {
this.testCaseTemplate = data; this.testCaseTemplate = data;
this.page.condition.components = initTestCaseConditionComponents(this.page.condition, this.testCaseTemplate.customFields); this.page.condition.components = initTestCaseConditionComponents(this.page.condition, this.testCaseTemplate.customFields);
this.testCaseTemplate.customFields.forEach(item => {
if (item.name === '用例等级') {
this.priorityOptions = item.options;
}
});
}); });
}, },
getTagToolTips(tags) { getTagToolTips(tags) {

View File

@ -82,7 +82,10 @@
min-width="120px" min-width="120px"
:label="$t('test_track.case.priority')"> :label="$t('test_track.case.priority')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/> <priority-table-item
:value="scope.row.priority"
:priority-options="priorityOptions"
ref="priority"/>
</template> </template>
</ms-table-column> </ms-table-column>
@ -241,7 +244,7 @@
<template v-slot="scope"> <template v-slot="scope">
<span v-if="field.name === '用例等级'"> <span v-if="field.name === '用例等级'">
<priority-table-item <priority-table-item
:value="getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field) : scope.row.priority"/> :value="getCustomFieldValue(scope.row, field)" :priority-options="priorityOptions"/>
</span> </span>
<span v-else-if="field.name === '用例状态'"> <span v-else-if="field.name === '用例状态'">
{{ getCustomFieldValue(scope.row, field, scope.row.status) }} {{ getCustomFieldValue(scope.row, field, scope.row.status) }}
@ -414,7 +417,8 @@ export default {
}, },
selectDataRange: "all", selectDataRange: "all",
testCaseTemplate: {}, testCaseTemplate: {},
versionFilters: [] versionFilters: [],
priorityOptions: []
}; };
}, },
props: { props: {
@ -574,6 +578,11 @@ export default {
Promise.all([p1, p2]).then((data) => { Promise.all([p1, p2]).then((data) => {
let template = data[1]; let template = data[1];
this.testCaseTemplate = template; this.testCaseTemplate = template;
this.testCaseTemplate.customFields.forEach(item => {
if (item.name === '用例等级') {
this.priorityOptions = item.options;
}
});
this.testCaseTemplate.customFields = this.testCaseTemplate.customFields.filter(item => item.name === '用例状态' && item.system); this.testCaseTemplate.customFields = this.testCaseTemplate.customFields.filter(item => item.name === '用例状态' && item.system);
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields); this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields);
let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields); let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields);