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, setThickness, setIsAECEnabled, } 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'; import { openCamera, closeCamera } from '@/states/exam/cameraSlice'; import CameraModal from '@/components/CameraModal'; 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 thickness = useSelector((state: RootState) => state.apr.thickness); 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(value)); }; const handleWorkstationChange = (value: string) => { dispatch(setWorkstation(value)); }; const handleThicknessChange = (value: number | null) => { if (value !== null) { dispatch(setThickness(value)); } }; const handleAECChange = (checked: boolean) => { dispatch(setIsAECEnabled(checked)); }; const handleExposureModeChange = (value: string) => { ParaSettingCoordinator.setExposureMode(value); }; const handleResetParameters = async () => { try { await dispatch(resetDevices()); } catch (error) { console.error('Error resetting devices:', error); } }; /** * 处理打开摄像头按钮点击事件 */ const handleOpenCamera = () => { // 获取当前选中体位的 study_id const currentStudyId = selectedBodyPosition?.study_id; if (!currentStudyId) { message.warning('请先选择一个体位'); return; } console.log('[handleOpenCamera] 打开摄像头,Study ID:', currentStudyId); // dispatch openCamera action,打开摄像头 dispatch(openCamera(currentStudyId)); }; // 1. 正常在顶层用 useSelector 订阅 const selectedBodyPosition = useSelector( (state: RootState) => state.bodyPositionList.selectedBodyPosition ); // 2. 用 ref 保存最新值(每次渲染都会更新) const positionRef = useRef(selectedBodyPosition); positionRef.current = selectedBodyPosition; // 3. 订阅 camera 状态 const cameraIsOpen = useSelector((state: RootState) => state.camera.isOpen); const cameraStudyId = useSelector( (state: RootState) => state.camera.currentStudyId ); return ( { if (info.type === 'up') { ParaSettingCoordinator.increaseThickness(); } else { ParaSettingCoordinator.decreaseThickness(); } }} /> {productName === 'DROS' && ( )}
{ if (info.type === 'up') { ParaSettingCoordinator.increaseMA(); } else { ParaSettingCoordinator.decreaseMA(); } return false; }} />
{ if (info.type === 'up') { ParaSettingCoordinator.increaseMS(); } else { ParaSettingCoordinator.decreaseMS(); } }} />
{ 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(); } }} />
*/}