浏览代码

feat: add continue functionality for feature not available dialog in src/states/businessFlowMiddlewareLogic.ts, src/components/FeatureNotAvailableFeedback.tsx, src/app.tsx

sw 5 天之前
父节点
当前提交
73f9e44ff5
共有 3 个文件被更改,包括 28 次插入5 次删除
  1. 5 0
      src/app.tsx
  2. 12 4
      src/components/FeatureNotAvailableFeedback.tsx
  3. 11 1
      src/states/businessFlowMiddlewareLogic.ts

+ 5 - 0
src/app.tsx

@@ -13,6 +13,7 @@ import QuotaAlertModal from './pages/security/QuotaAlertModal';
 import AcquisitionTracer from './pages/exam/components/acquisitionTracer';
 import FeatureNotAvailableFeedback from './components/FeatureNotAvailableFeedback';
 import { setFeatureNotAvailableOpen } from './states/featureNotAvailableSlice';
+import { setBusinessFlow } from './states/BusinessFlowSlice';
 import { logger } from './log/logger';
 console.log = logger.log;
 console.warn = logger.warn;
@@ -144,6 +145,10 @@ function AppContent({ children }: { children: ReactNode }): JSX.Element {
           <FeatureNotAvailableFeedback
             open={isFeatureNotAvailableOpen}
             onClose={() => dispatch(setFeatureNotAvailableOpen(false))}
+            onContinue={() => {
+              dispatch(setFeatureNotAvailableOpen(false));
+              dispatch(setBusinessFlow('continueAfterFeatureNotAvailable'));
+            }}
           />
           {children}
           {process.env.NODE_ENV === 'development' && <ProductSelector />}

+ 12 - 4
src/components/FeatureNotAvailableFeedback.tsx

@@ -7,6 +7,8 @@ export interface FeatureNotAvailableFeedbackProps {
   open: boolean;
   /** 点击"我知道了"按钮的处理函数 */
   onClose: () => void;
+  /** 点击"继续"按钮的处理函数 */
+  onContinue?: () => void;
   /** 自定义标题 */
   title?: string;
   /** 自定义提示内容 */
@@ -18,8 +20,9 @@ const FeatureNotAvailableFeedback: React.FC<
 > = ({
   open,
   onClose,
+  onContinue,
   title = '功能开发中',
-  message = '该功能正在开发中敬请期待。',
+  message = '该功能正在开发中,敬请期待。',
 }) => {
   return (
     <Modal
@@ -32,9 +35,14 @@ const FeatureNotAvailableFeedback: React.FC<
       open={open}
       onCancel={onClose}
       footer={
-        <Button type="primary" onClick={onClose}>
-          我知道了
-        </Button>
+        <>
+          <Button onClick={onClose}>我知道了</Button>
+          {onContinue && (
+            <Button type="primary" onClick={onContinue}>
+              继续
+            </Button>
+          )}
+        </>
       }
       centered
       closable={false}

+ 11 - 1
src/states/businessFlowMiddlewareLogic.ts

@@ -31,6 +31,14 @@ const businessFlowMiddlewareLogic: Middleware =
     if (action.type !== setBusinessFlow.type) {
       return next(action); // Only handle setBusinessFlow actions
     }
+
+    // 响应功能不可用后的继续操作
+    if (action.payload === 'continueAfterFeatureNotAvailable') {
+      console.log(
+        `[businessFlowMiddleware] Continuing to: ${continueBusinessFlow}`
+      );
+      return next({ ...action, payload: continueBusinessFlow });
+    }
     const state = store.getState().BusinessFlow as BusinessFlowState;
     const currentKey = state.currentKey;
     const targetKey = action.payload;
@@ -247,11 +255,13 @@ const businessFlowMiddlewareLogic: Middleware =
     if (
       action.payload === 'archivelist' ||
       action.payload === 'bin' ||
-      action.payload === 'outputlist'
+      action.payload === 'outputlist' ||
+      action.payload === 'print'
     ) {
       console.log(
         `[businessFlowMiddleware] Feature not available: ${action.payload}`
       );
+      continueBusinessFlow = action.payload; // 保存要继续的业务流程
       store.dispatch(setFeatureNotAvailableOpen(true));
       return;
     }