ContentAreaMedium.tsx 7.7 KB

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