Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit da8c05c

Browse files
committed
用例支持按作者进行筛选的操作
1 parent 348ddc7 commit da8c05c

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

src/components/TestCaseList.vue

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const caseId = ref(0);
2424
const dialogVisible = ref(false);
2525
const tableLoading = ref(false);
2626
const moduleIds = ref([]);
27+
const caseAuthorNames = ref([]);
2728
const getTestCaseList = (pageNum, pSize) => {
2829
tableLoading.value = true;
2930
pageSize.value = pSize || pageSize.value;
@@ -33,12 +34,12 @@ const getTestCaseList = (pageNum, pSize) => {
3334
params: {
3435
projectId: props.projectId,
3536
moduleIds: moduleIds.value.length > 0 ? moduleIds.value : undefined,
37+
caseAuthorNames: caseAuthorNames.value.length > 0 ? caseAuthorNames.value : undefined,
3638
platform: props.platform,
3739
name: name.value,
3840
page: pageCurrNum.value,
3941
pageSize: pageSize.value,
4042
idSort: sortingType.value.idSort,
41-
designerSort: sortingType.value.designerSort,
4243
editTimeSort: sortingType.value.editTimeSort,
4344
},
4445
})
@@ -120,40 +121,58 @@ const getModuleList = () => {
120121
}
121122
});
122123
};
124+
const caseAuthorList = ref([]);
125+
const getCaseAuthorList = () => {
126+
axios
127+
.get('/controller/testCases/listAllCaseAuthor', {
128+
params: {
129+
projectId: props.projectId,
130+
platform: props.platform,
131+
}
132+
})
133+
.then((resp) => {
134+
if (resp.code === 2000) {
135+
resp.data.map((item) => {
136+
caseAuthorList.value.push({ text: item, value: item });
137+
});
138+
}
139+
});
140+
};
123141
let sortingType = ref({});
124142
const sequence = (column) => {
125143
sortingType.value = {};
126144
if (column.order === 'ascending') {
127145
if (column.prop === 'id') {
128146
sortingType.value.idSort = 'asc';
129147
}
130-
if (column.prop === 'designer') {
131-
sortingType.value.designerSort = 'asc';
132-
}
133148
if (column.prop === 'editTime') {
134149
sortingType.value.editTimeSort = 'asc';
135150
}
136151
} else if (column.order === 'descending') {
137152
if (column.prop === 'id') {
138153
sortingType.value.idSort = 'desc';
139154
}
140-
if (column.prop === 'designer') {
141-
sortingType.value.designerSort = 'desc';
142-
}
143155
if (column.prop === 'editTime') {
144156
sortingType.value.editTimeSort = 'desc';
145157
}
146158
}
147159
// 判断排序方式
148160
getTestCaseList();
149161
};
150-
const filter = (e) => {
151-
moduleIds.value = e.moduleId;
162+
const filter = (filters) => {
163+
for (let key in filters) {
164+
if (key === 'moduleId') {
165+
moduleIds.value = filters.moduleId;
166+
} else if (key === 'caseAuthorName') {
167+
caseAuthorNames.value = filters.caseAuthorName;
168+
}
169+
}
152170
getTestCaseList();
153171
};
154172
onMounted(() => {
155173
getTestCaseList();
156174
getModuleList();
175+
getCaseAuthorList();
157176
});
158177
defineExpose({ open });
159178
</script>
@@ -234,11 +253,10 @@ defineExpose({ open });
234253
<el-table-column
235254
min-width="80"
236255
:label="$t('testcase.designer')"
237-
sortable="custom"
238256
prop="designer"
239257
align="center"
240-
:sort-orders="['ascending', 'descending']"
241-
show-overflow-tooltip
258+
column-key="caseAuthorName"
259+
:filters="caseAuthorList"
242260
/>
243261
<el-table-column
244262
min-width="180"

0 commit comments

Comments
 (0)