ソースを参照

feat(exam): execute corresponding logic based on current business flow when switching body positions in list, send current position notification to backend in exam flow only

sw 1 ヶ月 前
コミット
9b32b7705e
1 ファイル変更17 行追加10 行削除
  1. 17 10
      src/pages/exam/components/BodyPositionList.tsx

+ 17 - 10
src/pages/exam/components/BodyPositionList.tsx

@@ -40,17 +40,24 @@ const BodyPositionList: React.FC<BodyPositionListProps> = ({
         sid: bodyPosition.sid,
       })
     );
-    changeBodyPosition(bodyPosition.sop_instance_uid)
-      .then(() => {
-        message.success(
-          `'Body position changed successfully' ${bodyPosition.sop_instance_uid}`
-        );
-      })
-      .catch((error) => {
-        console.error('Error changing body position:', error);
-        message.error('Failed to change body position');
-      });
+    if (currentKey === 'exam') {
+      changeBodyPosition(bodyPosition.sop_instance_uid)
+        .then(() => {
+          message.success(
+            `'Body position changed successfully' ${bodyPosition.sop_instance_uid}`
+          );
+        })
+        .catch((error) => {
+          console.error('Error changing body position:', error);
+          message.error('Failed to change body position');
+        });
+    } else {
+      // message.info(`Current key is ${currentKey}, not executing changeBodyPosition.`);
+    }
   };
+  const currentKey = useSelector(
+    (state: RootState) => state.BusinessFlow.currentKey
+  );
   const bodyPositions = useSelector(
     (state: RootState) => state.bodyPositionList.bodyPositions
   );