Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:用例支持按作者进行筛选的操作 #270

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions src/components/TestCaseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const caseId = ref(0);
const dialogVisible = ref(false);
const tableLoading = ref(false);
const moduleIds = ref([]);
const caseAuthorNames = ref([]);
const getTestCaseList = (pageNum, pSize) => {
tableLoading.value = true;
pageSize.value = pSize || pageSize.value;
Expand All @@ -33,12 +34,12 @@ const getTestCaseList = (pageNum, pSize) => {
params: {
projectId: props.projectId,
moduleIds: moduleIds.value.length > 0 ? moduleIds.value : undefined,
caseAuthorNames: caseAuthorNames.value.length > 0 ? caseAuthorNames.value : undefined,
platform: props.platform,
name: name.value,
page: pageCurrNum.value,
pageSize: pageSize.value,
idSort: sortingType.value.idSort,
designerSort: sortingType.value.designerSort,
editTimeSort: sortingType.value.editTimeSort,
},
})
Expand Down Expand Up @@ -120,40 +121,58 @@ const getModuleList = () => {
}
});
};
const caseAuthorList = ref([]);
const getCaseAuthorList = () => {
axios
.get('/controller/testCases/listAllCaseAuthor', {
params: {
projectId: props.projectId,
platform: props.platform,
}
})
.then((resp) => {
if (resp.code === 2000) {
resp.data.map((item) => {
caseAuthorList.value.push({ text: item, value: item });
});
}
});
};
let sortingType = ref({});
const sequence = (column) => {
sortingType.value = {};
if (column.order === 'ascending') {
if (column.prop === 'id') {
sortingType.value.idSort = 'asc';
}
if (column.prop === 'designer') {
sortingType.value.designerSort = 'asc';
}
if (column.prop === 'editTime') {
sortingType.value.editTimeSort = 'asc';
}
} else if (column.order === 'descending') {
if (column.prop === 'id') {
sortingType.value.idSort = 'desc';
}
if (column.prop === 'designer') {
sortingType.value.designerSort = 'desc';
}
if (column.prop === 'editTime') {
sortingType.value.editTimeSort = 'desc';
}
}
// 判断排序方式
getTestCaseList();
};
const filter = (e) => {
moduleIds.value = e.moduleId;
const filter = (filters) => {
for (let key in filters) {
if (key === 'moduleId') {
moduleIds.value = filters.moduleId;
} else if (key === 'caseAuthorName') {
caseAuthorNames.value = filters.caseAuthorName;
}
}
getTestCaseList();
};
onMounted(() => {
getTestCaseList();
getModuleList();
getCaseAuthorList();
});
defineExpose({ open });
</script>
Expand Down Expand Up @@ -234,11 +253,10 @@ defineExpose({ open });
<el-table-column
min-width="80"
:label="$t('testcase.designer')"
sortable="custom"
prop="designer"
align="center"
:sort-orders="['ascending', 'descending']"
show-overflow-tooltip
column-key="caseAuthorName"
:filters="caseAuthorList"
/>
<el-table-column
min-width="180"
Expand Down
Loading