From d51a5404ee2dcf0f83ce5fcb098cf5a87764e648 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 12 Jan 2025 12:06:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE=E5=9C=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8E=92=E5=BA=8F=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=A1=B9=E7=9B=AE=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/item/components/Content.vue | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/pages/item/components/Content.vue b/src/pages/item/components/Content.vue index aa0d1ba..3b6d8a3 100644 --- a/src/pages/item/components/Content.vue +++ b/src/pages/item/components/Content.vue @@ -130,6 +130,7 @@ import { setItemWidth, run, removeInvalidItem, + showItemList, } from "../js"; import ItemList from "./List.vue"; import { Item } from "../../../../types/item"; @@ -315,12 +316,21 @@ function createItemSortable() { let fromClassificationId = parseInt( event.from.getAttribute("classification-id")! ); - // 当前项目 - const currentItem = - getItemListByClassificationId(fromClassificationId)[ - event.oldIndex - ]; - fromIdList.push(currentItem.id); + let fromClassification = + getClassificationById(fromClassificationId); + if (fromClassification) { + let itemList = + getItemListByClassificationId(fromClassificationId); + if (itemList) { + let copyItemList = JSON.parse(JSON.stringify(itemList)); + // 可能会存在自定义排序的情况,所以需要按照指定的排序方式获取项目 + const currentItem = showItemList( + copyItemList, + fromClassification + )[event.oldIndex]; + fromIdList.push(currentItem.id); + } + } } else { // 批量操作 for (const value of store.itemBatchOperationDataArray) {