import { Row, Col, Select, InputNumber, Button, Switch, Divider, Tooltip, message, Flex, } from 'antd'; import ErrorMessage from '@/components/ErrorMessage'; import { patientSizes, PatientSize } from '../../states/patientSize'; import { WorkstationTypeLabels } from '../../states/workstation'; import { FormattedMessage } from 'react-intl'; import { useSelector, useDispatch, useStore } from 'react-redux'; import { deleteBodyPosition } from '../../API/patient/viewActions'; import { copyPositionThunk } from '../../states/exam/examWorksCacheSlice'; import { removeBodyPositionBySopInstanceUid, setByIndex, } from '../../states/exam/bodyPositionListSlice'; import { RootState } from '../../states/store'; import { setAprConfig, setBodysize, setWorkstation, setIsAECEnabled, setCurrentExposureMode, } from '../../states/exam/aprSlice'; import BodyPositionList from './components/BodyPositionList'; import BodyPositionDetail from './components/BodyPositionDetail'; import { AppDispatch } from '@/states/store'; import { useRef } from 'react'; import Icon from '@/components/Icon'; import ParaSettingCoordinator from '@/domain/exam/paraSettingCoordinator'; import { resetDevices } from '@/states/device/deviceSlice'; const ContentAreaLarge = () => { const dispatch = useDispatch(); const isResetting = useSelector( (state: RootState) => state.device.status === 'loading' ); const store = useStore(); const aprConfig = useSelector((state: RootState) => state.apr.aprConfig); const bodysize = useSelector((state: RootState) => state.apr.bodysize); const workstation = useSelector((state: RootState) => state.apr.workstation); const isAECEnabled = useSelector( (state: RootState) => state.apr.isAECEnabled ); const currentExposureMode = useSelector( (state: RootState) => state.apr.currentExposureMode ); const productName = useSelector( (state: RootState) => state.product.productName ); 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) => { dispatch(setWorkstation(value)); }; const handleAECChange = (checked: boolean) => { dispatch(setIsAECEnabled(checked)); }; const handleExposureModeChange = (value: string) => { dispatch(setCurrentExposureMode(value)); }; const handleResetParameters = async () => { try { await dispatch(resetDevices()); } catch (error) { console.error('Error resetting devices:', error); } }; // 1. 正常在顶层用 useSelector 订阅 const selectedBodyPosition = useSelector( (state: RootState) => state.bodyPositionList.selectedBodyPosition ); // 2. 用 ref 保存最新值(每次渲染都会更新) const positionRef = useRef(selectedBodyPosition); positionRef.current = selectedBodyPosition; return ( {productName === 'DROS' && ( )}
dispatch(setAprConfig({ ...aprConfig, mA: value ?? 0 })) } onStep={(value, info) => { if (info.type === 'up') { ParaSettingCoordinator.increaseMA(); } else { ParaSettingCoordinator.decreaseMA(); } }} />
dispatch(setAprConfig({ ...aprConfig, ms: value ?? 0 })) } onStep={(value, info) => { if (info.type === 'up') { ParaSettingCoordinator.increaseMS(); } else { ParaSettingCoordinator.decreaseMS(); } }} />
dispatch(setAprConfig({ ...aprConfig, mAs: value ?? 0 })) } onStep={(value, info) => { if (info.type === 'up') { ParaSettingCoordinator.increaseMAS(); } else { ParaSettingCoordinator.decreaseMAS(); } }} />
// dispatch(setAprConfig({ ...aprConfig, kV: value ?? 0 })) // } onStep={(value, info) => { if (info.type === 'up') { ParaSettingCoordinator.increaseKV(); } else { ParaSettingCoordinator.decreaseKV(); } }} />
dispatch(setAprConfig({ ...aprConfig, AECDensity: value ?? 0 })) } onStep={(value, info) => { if (info.type === 'up') { ParaSettingCoordinator.increaseDensity(); } else { ParaSettingCoordinator.decreaseDensity(); } }} />