fix(测试计划): 修复测试计划组内拖拽失效&防止只有一个时参数报错
This commit is contained in:
parent
697d0d47c6
commit
8e958e5128
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue