فهرست منبع

feat(exam): 防止删除检查中的最后一个体位

sw 6 روز پیش
والد
کامیت
7e7095e698
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      src/pages/exam/ContentAreaLarge.tsx

+ 10 - 2
src/pages/exam/ContentAreaLarge.tsx

@@ -324,8 +324,16 @@ const ContentAreaLarge = () => {
                 />
               }
               onClick={async () => {
-                const selectedBodyPosition =
-                  store.getState().bodyPositionList.selectedBodyPosition;
+                const state = store.getState().bodyPositionList;
+                const selectedBodyPosition = state.selectedBodyPosition;
+                const bodyPositions = state.bodyPositions;
+
+                // 检查体位数量,至少保留一个
+                if (bodyPositions.length <= 1) {
+                  message.warning('至少需要保留一个体位,无法删除');
+                  return;
+                }
+
                 console.log(
                   `选中的体位:${JSON.stringify(selectedBodyPosition)}`
                 );