ContentAreaLarge.tsx 7.3 KB

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