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

This commit is contained in:
chenjianxing 2023-03-17 11:09:52 +08:00 committed by jianxing
parent 6545ce43a9
commit 1dda500d0e
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-level" v-if="!isPublicShow">
<priority-table-item :value="form.priority" />
<priority-table-item
:value="form.priority"
:priority-options="priorityOptions"
/>
</div>
<div>
<!-- 版本历史 v-xpack -->
@ -586,7 +589,8 @@ export default {
createVersionId: null,
editableState: false,
isNameEdit: false,
useUserStore: {}
useUserStore: {},
priorityOptions: []
};
},
props: {
@ -1153,6 +1157,7 @@ export default {
this.testCaseTemplate.customFields.forEach((field) => {
if (field.name === "用例等级") {
field.defaultValue = this.form.priority;
this.priorityOptions = field.options;
} else if (field.name === "责任人") {
field.defaultValue = this.form.maintainer;
} else if (field.name === "用例状态") {

View File

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

View File

@ -13,7 +13,7 @@
{{ value }}
</el-tag>
<el-tag v-else class="status-label unknown">
{{ value }}
{{ getPriorityText() }}
</el-tag>
</div>
@ -26,7 +26,19 @@
components: {MsTag},
props: {
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')"
width="120px">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
<priority-table-item :value="scope.row.priority" :priority-options="priorityOptions"/>
</template>
</ms-table-column>
@ -185,7 +185,8 @@ export default {
],
versionFilters: null,
testCaseTemplate: {},
pageRefresh: false
pageRefresh: false,
priorityOptions: []
};
},
props: {
@ -328,6 +329,11 @@ export default {
getTestTemplate(projectId).then(data => {
this.testCaseTemplate = data;
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) {

View File

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