From b2bbfab22c60c32df87e985a4169bfba02334533 Mon Sep 17 00:00:00 2001 From: loveuer Date: Wed, 2 Apr 2025 09:28:39 +0800 Subject: [PATCH] wip: alpha --- .../src/pages/task/components/TaskCreate.tsx | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/frontend/src/pages/task/components/TaskCreate.tsx b/frontend/src/pages/task/components/TaskCreate.tsx index 69825e1..dcb363e 100644 --- a/frontend/src/pages/task/components/TaskCreate.tsx +++ b/frontend/src/pages/task/components/TaskCreate.tsx @@ -22,11 +22,11 @@ export interface TaskCreateProps { const steps: Step[] = [ { id: 1, title: '步骤1', type: 'src' } as Step, { id: 2, title: '步骤2', type: 'mid' } as Step, - { id: 2, title: '步骤3', type: 'mid' } as Step, - { id: 2, title: '步骤4', type: 'mid' } as Step, - { id: 2, title: '步骤5', type: 'mid' } as Step, - { id: 2, title: '步骤6', type: 'mid' } as Step, - { id: 3, title: '步骤7', type: 'dst' } as Step, + { id: 3, title: '步骤3', type: 'mid' } as Step, + { id: 4, title: '步骤4', type: 'mid' } as Step, + { id: 5, title: '步骤5', type: 'mid' } as Step, + { id: 6, title: '步骤6', type: 'mid' } as Step, + { id: 7, title: '步骤7', type: 'dst' } as Step, ] @@ -37,14 +37,13 @@ export const TaskCreate = (props: TaskCreateProps) => { const onDragEnd = ({ active, over }) => { if (active.id !== over?.id) { setItems(items => { - const oldIndex = items.indexOf(active.id); - const newIndex = items.indexOf(over.id); + const oldIndex = items.findIndex(item => item.id === active.id); + const newIndex = items.findIndex(item => item.id === over.id); return arrayMove(items, oldIndex, newIndex); }); } }; - return (
{ }} title="新建任务" open={props.open} - - // footer={null} > - {items.filter(v => v.type === "mid").map(item => ( + {items.map(item => ( - 步骤内容 + {'步骤内容-' + item.type} ))} @@ -79,7 +76,6 @@ export const TaskCreate = (props: TaskCreateProps) => { }; -// Bug fix: Correctly define the type of the children prop to avoid implicit 'any' type const SortableItem = ({ id, children }: { id: number; children: JSX.Element }) => { const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });