fix(测试计划): 修复测试计划组内拖拽失效&防止只有一个时参数报错

This commit is contained in:
xinxin.wu 2024-07-17 16:14:14 +08:00 committed by 刘瑞斌
parent 697d0d47c6
commit 8e958e5128
2 changed files with 2 additions and 6 deletions

View File

@ -142,8 +142,6 @@ export default function useModuleSelections<T>(
// 更新选择数据 // 更新选择数据
function updateSelectModule(moduleId: string, id: string) { function updateSelectModule(moduleId: string, id: string) {
const selectedProps = innerSelectedModulesMaps[moduleId]; const selectedProps = innerSelectedModulesMaps[moduleId];
console.log(222);
if (selectedProps) { if (selectedProps) {
const selectedSet = selectedProps.selectIds; const selectedSet = selectedProps.selectIds;
const excludedSet = selectedProps.excludeIds; const excludedSet = selectedProps.excludeIds;

View File

@ -655,7 +655,6 @@
newIndex = newDragData.findIndex((item: any) => item[rowKey || 'id'] === extra.dragTarget?.[rowKey || 'id']); newIndex = newDragData.findIndex((item: any) => item[rowKey || 'id'] === extra.dragTarget?.[rowKey || 'id']);
oldIndex = oldDragData.findIndex((item: any) => item[rowKey || 'id'] === extra.dragTarget?.[rowKey || 'id']); oldIndex = oldDragData.findIndex((item: any) => item[rowKey || 'id'] === extra.dragTarget?.[rowKey || 'id']);
let position: 'AFTER' | 'BEFORE' = 'BEFORE'; let position: 'AFTER' | 'BEFORE' = 'BEFORE';
position = newIndex > oldIndex ? 'AFTER' : 'BEFORE'; position = newIndex > oldIndex ? 'AFTER' : 'BEFORE';
const params: DragSortParams = { const params: DragSortParams = {
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
@ -677,9 +676,8 @@
targetIndex = newIndex - 1; targetIndex = newIndex - 1;
} }
params.targetId = newDragData[targetIndex]?.[rowKey || 'id'] ?? newDragData[newIndex]?.[rowKey || 'id']; params.targetId = newDragData[targetIndex]?.[rowKey || 'id'] ?? newDragData[newIndex]?.[rowKey || 'id'];
//
if (oldIndex !== newIndex) { if (newDragData.length > 1) {
//
emit('dragChange', params); emit('dragChange', params);
} }
} }