feat: 更新自定义分组排序

This commit is contained in:
wanglihui 2024-01-14 15:37:48 +08:00
parent ce95ff4547
commit 12cb42c0c5
2 changed files with 23 additions and 4 deletions

View File

@ -235,11 +235,18 @@ const tableDrop = () => {
Sortable.create(document.querySelector('.el-table__body-wrapper tbody') as HTMLElement, {
handle: '.bd-drag',
animation: 300,
onEnd({ newIndex, oldIndex }: any) {
onEnd(evt: any) {
const { newIndex, oldIndex } = evt;
const tablesList = [...tableData.value];
const currRow = tablesList.splice(oldIndex as number, 1)[0];
tablesList.splice(newIndex as number, 0, currRow);
bannerReorder(tablesList[newIndex].banner_no, tablesList[oldIndex].banner_no);
if (oldIndex > newIndex) {
//
bannerReorder(tablesList[newIndex].banner_no, tablesList[oldIndex].banner_no);
} else {
//
bannerReorder(tablesList[oldIndex].banner_no, tablesList[newIndex].banner_no);
}
}
});
};

View File

@ -170,7 +170,13 @@ const treesDrop = () => {
const treesList = [...dataTree.value];
const currRow = treesList.splice(oldIndex as number, 1)[0];
treesList.splice(newIndex as number, 0, currRow);
categoryReorder(treesList[newIndex].category_no, treesList[oldIndex].category_no);
if (oldIndex > newIndex) {
//
categoryReorder(treesList[newIndex].category_no, treesList[oldIndex].category_no);
} else {
//
categoryReorder(treesList[oldIndex].category_no, treesList[newIndex].category_no);
}
}
});
};
@ -378,7 +384,13 @@ const tableDrop = () => {
const currRow = tablesList.splice(oldIndex as number, 1)[0];
tablesList.splice(newIndex as number, 0, currRow);
tableData.value = tablesList;
categorysAppsReorder(tablesList[newIndex].app_id, tablesList[oldIndex].app_id);
if (oldIndex > newIndex) {
//
categorysAppsReorder(tablesList[newIndex].app_id, tablesList[oldIndex].app_id);
} else {
//
categorysAppsReorder(tablesList[oldIndex].app_id, tablesList[newIndex].app_id);
}
}
});
};