fix(接口测试): 场景和缺陷的表格批量操作支持表头过滤

This commit is contained in:
Jianguo-Genius 2024-04-18 17:45:36 +08:00 committed by 刘瑞斌
parent a1df7f5557
commit 0b3f7b40b2
5 changed files with 64 additions and 6 deletions

View File

@ -1533,14 +1533,20 @@ public class BugService {
// 全选{根据查询条件查询所有数据, 排除取消勾选的数据}
BugPageRequest bugPageRequest = new BugPageRequest();
BeanUtils.copyBean(bugPageRequest, request);
if (request.getCondition() != null) {
bugPageRequest.setCombine(request.getCondition().getCombine());
bugPageRequest.setFilter(request.getCondition().getFilter());
}
List<String> ids = extBugMapper.getIdsByPageRequest(bugPageRequest);
ids.addAll(request.getSelectIds());
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
ids.removeIf(id -> request.getExcludeIds().contains(id));
}
if (CollectionUtils.isEmpty(ids)) {
throw new MSException(Translator.get("no_bug_select"));
}
return ids;
//返回去重后的id
return new ArrayList<>(ids.stream().distinct().toList());
} else {
// 部分勾选
if (CollectionUtils.isEmpty(request.getSelectIds())) {

View File

@ -1123,7 +1123,7 @@
selectIds,
selectAll: !!params?.selectAll,
excludeIds: params?.excludeIds || [],
condition: { keyword: keyword.value },
condition: { ...params?.condition, keyword: keyword.value },
projectId: appStore.currentProjectId,
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
deleteAll: true,
@ -1449,8 +1449,21 @@
* @param event 批量操作事件对象
*/
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
tableSelected.value = params?.selectedIds || [];
batchParams.value = params;
tableSelected.value = params?.selectedIds || [];
const filterParams = {
lastReportStatus: lastReportStatusListFilters.value,
status: statusFilters.value,
priority: priorityFilters.value,
createUser: createUserFilters.value,
updateUser: updateUserFilters.value,
};
if (batchParams.value.condition) {
batchParams.value.condition.filter = { ...filterParams };
} else {
batchParams.value.condition = { filter: { ...filterParams } };
}
switch (event.eventTag) {
case 'delete':
deleteScenario(undefined, true, batchParams.value);

View File

@ -328,6 +328,7 @@
dataIndex: 'environmentName',
width: 159,
showDrag: true,
showTooltip: true,
},
{
title: 'apiScenario.table.columns.steps',
@ -514,7 +515,7 @@
});
//
async function recover(record?: ApiScenarioTableItem, isBatch?: boolean) {
async function recover(record?: ApiScenarioTableItem, isBatch?: boolean, params?: BatchActionQueryParams) {
try {
if (isBatch) {
recoverLoading.value = true;
@ -522,7 +523,7 @@
selectIds: batchParams.value?.selectedIds || [],
selectAll: !!batchParams.value?.selectAll,
excludeIds: batchParams.value?.excludeIds || [],
condition: { keyword: keyword.value },
condition: { ...params?.condition, keyword: keyword.value },
projectId: appStore.currentProjectId,
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
});
@ -607,12 +608,25 @@
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
tableSelected.value = params?.selectedIds || [];
batchParams.value = params;
const filterParams = {
lastReportStatus: lastReportStatusListFilters.value,
status: statusFilters.value,
priority: priorityFilters.value,
createUser: createUserFilters.value,
updateUser: updateUserFilters.value,
};
if (batchParams.value.condition) {
batchParams.value.condition.filter = { ...filterParams };
} else {
batchParams.value.condition = { filter: { ...filterParams } };
}
switch (event.eventTag) {
case 'delete':
deleteOperation(undefined, true, batchParams.value);
break;
case 'recover':
recover(undefined, true);
recover(undefined, true, batchParams.value);
break;
default:
break;

View File

@ -791,7 +791,20 @@
}
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
const filterParams = {
status: statusFilterValue.value,
handleUser: handleUserFilterValue.value,
updateUser: updateUserFilterValue.value,
createUser: createUserFilterValue.value,
};
filterParams[severityColumnId.value] = severityFilterValue.value;
if (params.condition) {
params.condition.filter = { ...filterParams };
} else {
params.condition = { filter: { ...filterParams } };
}
currentSelectParams.value = params;
switch (event.eventTag) {
case 'export':
handleExport();

View File

@ -477,6 +477,18 @@
//
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
const filterParams = {
status: statusFilterValue.value,
handleUser: handleUserFilterValue.value,
updateUser: updateUserFilterValue.value,
createUser: createUserFilterValue.value,
};
filterParams[severityColumnId.value] = severityFilterValue.value;
if (params.condition) {
params.condition.filter = { ...filterParams };
} else {
params.condition = { filter: { ...filterParams } };
}
switch (event.eventTag) {
case 'recover':
handleBatchRecover(params);