Quellcode durchsuchen

feat: VETDROS产品工作站ID返回0,修改src/states/workstation.ts和src/states/exam/aprSlice.ts

- 为workstationIdFromWorkstation函数添加可选的productName参数
- VETDROS产品时直接返回0,不再使用工作站映射
- 更新aprSlice.ts中middleware调用以传入产品类型
- 修改文件:
  * src/states/workstation.ts
  * src/states/exam/aprSlice.ts
  * src/pages/exam/ContentAreaLarge.tsx

close #72
sw vor 1 Woche
Ursprung
Commit
4a4c5be9ee
3 geänderte Dateien mit 23 neuen und 7 gelöschten Zeilen
  1. 7 3
      src/pages/exam/ContentAreaLarge.tsx
  2. 7 3
      src/states/exam/aprSlice.ts
  3. 9 1
      src/states/workstation.ts

+ 7 - 3
src/pages/exam/ContentAreaLarge.tsx

@@ -11,7 +11,7 @@ import {
   Flex,
 } from 'antd';
 import ErrorMessage from '@/components/ErrorMessage';
-import { patientSizes } from '../../states/patientSize';
+import { patientSizes, PatientSize } from '../../states/patientSize';
 import { WorkstationTypeLabels } from '../../states/workstation';
 import { FormattedMessage } from 'react-intl';
 import { useSelector, useDispatch, useStore } from 'react-redux';
@@ -56,8 +56,12 @@ const ContentAreaLarge = () => {
     (state: RootState) => state.product.productName
   );
 
-  const handleBodysizeChange = (value: string) => {
-    dispatch(setBodysize(value));
+  const handleBodysizeChange = (key: string) => {
+    const value = patientSizes[key as PatientSize]; // 获取对应的显示文本
+    console.log('体型 key:', key); // 例如: 'small'
+    console.log('体型 value:', value); // 例如: 'Small'
+
+    dispatch(setBodysize(key));
   };
 
   const handleWorkstationChange = (value: string) => {

+ 7 - 3
src/states/exam/aprSlice.ts

@@ -204,6 +204,7 @@ const aprSlice = createSlice({
 });
  
 const aprMiddleware: Middleware = (store) => (next) => (action: any) => {
+  const result = next(action);
   if (
     action.type === aprSlice.actions.setBodysize.type ||
     action.type === aprSlice.actions.setWorkstation.type
@@ -212,13 +213,16 @@ const aprMiddleware: Middleware = (store) => (next) => (action: any) => {
     const state = store.getState();
     const id =
       state.bodyPositionList.selectedBodyPosition?.view_id || 'default_id'; // Dynamically determined based on selectedBodyPosition
-    const workStationId = workstationIdFromWorkstation(state.apr.workstation);
+    const workStationId = workstationIdFromWorkstation(
+      state.apr.workstation,
+      state.product.productName
+    );
     const patientSize = state.apr.bodysize;
     console.log(
       `Fetching APR exposure parameters for ID: ${id}, Workstation ID: ${workStationId}, Patient Size: ${patientSize}`
     );
     // Fetch APR exposure parameters based on the current state
-    if (!!patientSize && workStationId !== 0) {
+    if (!!patientSize) {
       getAprExposureParams(id, workStationId, patientSize)
         .then((data) => {
           console.log('Received APR exposure parameters:', data);
@@ -235,7 +239,7 @@ const aprMiddleware: Middleware = (store) => (next) => (action: any) => {
         });
     }
   }
-  return next(action);
+  return result;
 };
  
 export const incKV = createAsyncThunk<number, number>('apr/incKV', async (amount: number) => {

+ 9 - 1
src/states/workstation.ts

@@ -26,7 +26,15 @@ export function workstationFromWorkstationId(id: number) {
   }
 }
 
-export function workstationIdFromWorkstation(type: WorkstationType) {
+export function workstationIdFromWorkstation(
+  type: WorkstationType,
+  productName?: 'DROS' | 'VETDROS'
+) {
+  // VETDROS 产品返回 0
+  if (productName === 'VETDROS') {
+    return 0;
+  }
+
   switch (type) {
     case WorkstationType.Free:
       return 1;