ContentAreaSmall.tsx 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. import {
  2. Card,
  3. Select,
  4. InputNumber,
  5. Button,
  6. Switch,
  7. Carousel,
  8. Row,
  9. Col,
  10. Divider,
  11. Tooltip,
  12. } from 'antd';
  13. import {
  14. DeleteOutlined,
  15. CopyOutlined,
  16. SaveOutlined,
  17. CameraOutlined,
  18. CloseOutlined,
  19. } from '@ant-design/icons';
  20. import { patientSizes } from '@/states/patientSize';
  21. import { WorkstationTypeLabels } from '@/states/workstation';
  22. import { FormattedMessage } from 'react-intl';
  23. import { useSelector, useDispatch } from 'react-redux';
  24. import { RootState } from '@/states/store';
  25. import {
  26. setAprConfig,
  27. setIsAECEnabled,
  28. } from '@/states/exam/aprSlice';
  29. import ParaSettingCoordinator from '@/domain/exam/paraSettingCoordinator';
  30. const ContentAreaSmall = ({ className }: { className?: string }) => {
  31. const dispatch = useDispatch();
  32. const aprConfig = useSelector((state: RootState) => state.apr.aprConfig);
  33. const currentExposureMode = useSelector(
  34. (state: RootState) => state.apr.currentExposureMode
  35. );
  36. const isAECEnabled = useSelector(
  37. (state: RootState) => state.apr.isAECEnabled
  38. );
  39. const handleExposureModeChange = (value: string) => {
  40. ParaSettingCoordinator.setExposureMode(value);
  41. };
  42. const handleAECChange = (checked: boolean) => {
  43. dispatch(setIsAECEnabled(checked));
  44. };
  45. console.log('ContentAreaSmall component rendered');
  46. console.log('ContentAreaSmall component rendered');
  47. return (
  48. <Carousel
  49. autoplay={false}
  50. effect="fade"
  51. adaptiveHeight={true}
  52. className={`w-full max-w-[800px] h-full ${className}`}
  53. >
  54. <div className="h-full">
  55. <Card title="体位列表">体位列表</Card>
  56. </div>
  57. <div>
  58. <Card title="体位详情">体位详情</Card>
  59. </div>
  60. <div>
  61. <Row gutter={16} align="middle">
  62. <Col span={9}>
  63. <Select
  64. placeholder="选择体型"
  65. style={{ width: '100%', marginBottom: 8 }}
  66. >
  67. {Object.entries(patientSizes).map(
  68. ([key, value]: [string, string]) => (
  69. <Select.Option key={key} value={key}>
  70. {value}
  71. </Select.Option>
  72. )
  73. )}
  74. </Select>
  75. </Col>
  76. <Col span={15}>
  77. <Select
  78. placeholder="选择工作位"
  79. style={{ width: '100%', marginBottom: 8 }}
  80. >
  81. {Object.entries(WorkstationTypeLabels).map(
  82. ([key, value]: [string, string]) => (
  83. <Select.Option key={key} value={value}>
  84. <FormattedMessage id={`workstation.${key.toLowerCase()}`} />
  85. </Select.Option>
  86. )
  87. )}
  88. </Select>
  89. </Col>
  90. </Row>
  91. <div>
  92. <Tooltip
  93. title={
  94. currentExposureMode === 'mAs'
  95. ? '当前为 mAs 模式,mA 和 ms 不可调整'
  96. : ''
  97. }
  98. >
  99. <InputNumber
  100. disabled={currentExposureMode === 'mAs'}
  101. placeholder={currentExposureMode === 'mAs' ? '--' : 'mA'}
  102. style={{ width: '100%', marginBottom: 8 }}
  103. value={
  104. currentExposureMode === 'mAs'
  105. ? null
  106. : (aprConfig.mA ?? undefined)
  107. }
  108. onChange={(value) =>
  109. dispatch(setAprConfig({ ...aprConfig, mA: value ?? 0 }))
  110. }
  111. />
  112. </Tooltip>
  113. <Tooltip
  114. title={
  115. currentExposureMode === 'mAs'
  116. ? '当前为 mAs 模式,mA 和 ms 不可调整'
  117. : ''
  118. }
  119. >
  120. <InputNumber
  121. disabled={currentExposureMode === 'mAs'}
  122. placeholder={currentExposureMode === 'mAs' ? '--' : 'ms'}
  123. style={{ width: '100%', marginBottom: 8 }}
  124. value={
  125. currentExposureMode === 'mAs'
  126. ? null
  127. : (aprConfig.ms ?? undefined)
  128. }
  129. onChange={(value) =>
  130. dispatch(setAprConfig({ ...aprConfig, ms: value ?? 0 }))
  131. }
  132. />
  133. </Tooltip>
  134. <Tooltip
  135. title={
  136. currentExposureMode === 'time'
  137. ? '当前为 time 模式,mAs 不可调整'
  138. : ''
  139. }
  140. >
  141. <InputNumber
  142. disabled={currentExposureMode === 'time'}
  143. placeholder={currentExposureMode === 'time' ? '--' : 'mAs'}
  144. style={{ width: '100%', marginBottom: 8 }}
  145. value={
  146. currentExposureMode === 'time'
  147. ? null
  148. : (aprConfig.mAs ?? undefined)
  149. }
  150. onChange={(value) =>
  151. dispatch(setAprConfig({ ...aprConfig, mAs: value ?? 0 }))
  152. }
  153. />
  154. </Tooltip>
  155. <InputNumber
  156. placeholder="KV"
  157. style={{ width: '100%', marginBottom: 8 }}
  158. />
  159. <InputNumber
  160. placeholder="density"
  161. style={{ width: '100%', marginBottom: 8 }}
  162. />
  163. </div>
  164. <Row gutter={16} align="middle">
  165. <Col span={12}>
  166. <Select
  167. placeholder="选择曝光模式"
  168. style={{ width: '100%' }}
  169. value={currentExposureMode}
  170. onChange={handleExposureModeChange}
  171. >
  172. <Select.Option value="mAs">mAs</Select.Option>
  173. <Select.Option value="time">time</Select.Option>
  174. </Select>
  175. </Col>
  176. <Col span={9}>
  177. <Switch
  178. checkedChildren="开启AEC"
  179. unCheckedChildren="关闭AEC"
  180. checked={isAECEnabled}
  181. onChange={handleAECChange}
  182. />
  183. </Col>
  184. <Col span={3}>
  185. <Button
  186. type="primary"
  187. style={{ width: '100%' }}
  188. icon={<DeleteOutlined />}
  189. title="重置参数"
  190. />
  191. </Col>
  192. </Row>
  193. <Divider />
  194. <Row gutter={16} align="middle">
  195. <Col span={4}>
  196. <Tooltip title="删除选择的体位">
  197. <Button
  198. type="primary"
  199. style={{ width: '100%' }}
  200. icon={<DeleteOutlined />}
  201. />
  202. </Tooltip>
  203. </Col>
  204. <Col span={4}>
  205. <Tooltip title="复制选择的体位">
  206. <Button
  207. type="primary"
  208. style={{ width: '100%' }}
  209. icon={<CopyOutlined />}
  210. />
  211. </Tooltip>
  212. </Col>
  213. <Col span={4}>
  214. <Tooltip title="保存参数">
  215. <Button
  216. type="primary"
  217. style={{ width: '100%' }}
  218. icon={<SaveOutlined />}
  219. />
  220. </Tooltip>
  221. </Col>
  222. <Col span={4}>
  223. <Tooltip title="打开/关闭摄像头">
  224. <Button
  225. type="primary"
  226. style={{ width: '100%' }}
  227. icon={<CameraOutlined />}
  228. />
  229. </Tooltip>
  230. </Col>
  231. <Col span={4}>
  232. <Tooltip title="拒绝">
  233. <Button
  234. type="primary"
  235. style={{ width: '100%' }}
  236. icon={<CloseOutlined />}
  237. />
  238. </Tooltip>
  239. </Col>
  240. </Row>
  241. </div>
  242. </Carousel>
  243. );
  244. };
  245. export default ContentAreaSmall;