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(); BugPageRequest bugPageRequest = new BugPageRequest();
BeanUtils.copyBean(bugPageRequest, request); BeanUtils.copyBean(bugPageRequest, request);
if (request.getCondition() != null) {
bugPageRequest.setCombine(request.getCondition().getCombine());
bugPageRequest.setFilter(request.getCondition().getFilter());
}
List<String> ids = extBugMapper.getIdsByPageRequest(bugPageRequest); List<String> ids = extBugMapper.getIdsByPageRequest(bugPageRequest);
ids.addAll(request.getSelectIds());
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
ids.removeIf(id -> request.getExcludeIds().contains(id)); ids.removeIf(id -> request.getExcludeIds().contains(id));
} }
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
throw new MSException(Translator.get("no_bug_select")); throw new MSException(Translator.get("no_bug_select"));
} }
return ids; //返回去重后的id
return new ArrayList<>(ids.stream().distinct().toList());
} else { } else {
// 部分勾选 // 部分勾选
if (CollectionUtils.isEmpty(request.getSelectIds())) { if (CollectionUtils.isEmpty(request.getSelectIds())) {

View File

@ -1123,7 +1123,7 @@
selectIds, selectIds,
selectAll: !!params?.selectAll, selectAll: !!params?.selectAll,
excludeIds: params?.excludeIds || [], excludeIds: params?.excludeIds || [],
condition: { keyword: keyword.value }, condition: { ...params?.condition, keyword: keyword.value },
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule], moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
deleteAll: true, deleteAll: true,
@ -1449,8 +1449,21 @@
* @param event 批量操作事件对象 * @param event 批量操作事件对象
*/ */
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
tableSelected.value = params?.selectedIds || [];
batchParams.value = params; 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) { switch (event.eventTag) {
case 'delete': case 'delete':
deleteScenario(undefined, true, batchParams.value); deleteScenario(undefined, true, batchParams.value);

View File

@ -328,6 +328,7 @@
dataIndex: 'environmentName', dataIndex: 'environmentName',
width: 159, width: 159,
showDrag: true, showDrag: true,
showTooltip: true,
}, },
{ {
title: 'apiScenario.table.columns.steps', 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 { try {
if (isBatch) { if (isBatch) {
recoverLoading.value = true; recoverLoading.value = true;
@ -522,7 +523,7 @@
selectIds: batchParams.value?.selectedIds || [], selectIds: batchParams.value?.selectedIds || [],
selectAll: !!batchParams.value?.selectAll, selectAll: !!batchParams.value?.selectAll,
excludeIds: batchParams.value?.excludeIds || [], excludeIds: batchParams.value?.excludeIds || [],
condition: { keyword: keyword.value }, condition: { ...params?.condition, keyword: keyword.value },
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
moduleIds: props.activeModule === 'all' ? [] : [props.activeModule], moduleIds: props.activeModule === 'all' ? [] : [props.activeModule],
}); });
@ -607,12 +608,25 @@
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
tableSelected.value = params?.selectedIds || []; tableSelected.value = params?.selectedIds || [];
batchParams.value = params; 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) { switch (event.eventTag) {
case 'delete': case 'delete':
deleteOperation(undefined, true, batchParams.value); deleteOperation(undefined, true, batchParams.value);
break; break;
case 'recover': case 'recover':
recover(undefined, true); recover(undefined, true, batchParams.value);
break; break;
default: default:
break; break;

View File

@ -791,7 +791,20 @@
} }
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { 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; currentSelectParams.value = params;
switch (event.eventTag) { switch (event.eventTag) {
case 'export': case 'export':
handleExport(); handleExport();

View File

@ -477,6 +477,18 @@
// //
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { 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) { switch (event.eventTag) {
case 'recover': case 'recover':
handleBatchRecover(params); handleBatchRecover(params);