Sfoglia il codice sorgente

使用新的返回值

visuddhinanda 1 anno fa
parent
commit
76adf9418f

+ 13 - 5
dashboard-v4/dashboard/src/components/task/TaskBuilderProjects.tsx

@@ -280,10 +280,11 @@ const TaskBuilderProjects = ({
                 return;
                 return;
               }
               }
               console.debug("prop", prop);
               console.debug("prop", prop);
-              let taskData: ITaskGroupInsertData[] = res.data.leafs.map(
-                (projectId, pId) => {
+              let taskData: ITaskGroupInsertData[] = res.data.rows
+                .filter((value) => value.isLeaf)
+                .map((project, pId) => {
                   return {
                   return {
-                    project_id: projectId,
+                    project_id: project.id,
                     tasks: workflow.map((task, tId) => {
                     tasks: workflow.map((task, tId) => {
                       let newContent = task.description;
                       let newContent = task.description;
                       prop
                       prop
@@ -306,8 +307,7 @@ const TaskBuilderProjects = ({
                       };
                       };
                     }),
                     }),
                   };
                   };
-                }
-              );
+                });
 
 
               console.info("api request", taskUrl, taskData);
               console.info("api request", taskUrl, taskData);
               const taskRes = await post<
               const taskRes = await post<
@@ -318,6 +318,14 @@ const TaskBuilderProjects = ({
               if (taskRes.ok) {
               if (taskRes.ok) {
                 message.success("ok");
                 message.success("ok");
                 setMessages((origin) => [...origin, "生成任务成功."]);
                 setMessages((origin) => [...origin, "生成任务成功."]);
+                setMessages((origin) => [
+                  ...origin,
+                  "生成任务" + taskRes.data.taskCount,
+                ]);
+                setMessages((origin) => [
+                  ...origin,
+                  "生成任务关联" + taskRes.data.taskRelationCount,
+                ]);
                 onDone && onDone();
                 onDone && onDone();
               } else {
               } else {
                 setMessages((origin) => [
                 setMessages((origin) => [