MeasurementPanel.tsx 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. import React from 'react';
  2. import { Layout, Button, Typography, Divider, Flex } from 'antd';
  3. import { ArrowLeftOutlined } from '@ant-design/icons';
  4. import { useDispatch } from 'react-redux';
  5. import { switchToOperationPanel } from '../../../states/panelSwitchSliceForView';
  6. import Icon from '@/components/Icon';
  7. import '@/themes/truncateText.css';
  8. const { Header, Content } = Layout;
  9. const { Title, Text } = Typography;
  10. const FunctionButton = ({
  11. title,
  12. action,
  13. iconName,
  14. productId,
  15. }: {
  16. title: string;
  17. action: string;
  18. iconName: string;
  19. productId?: string;
  20. }) => {
  21. const handleMeasurementAction = (action: string) => {
  22. console.log(`执行测量操作: ${action}`);
  23. // 这里可以添加具体的测量逻辑
  24. };
  25. return (
  26. <Button
  27. onClick={() => handleMeasurementAction(action)}
  28. icon={
  29. iconName ? (
  30. <Icon
  31. productId={productId}
  32. module="module-process"
  33. name={iconName}
  34. userId="base"
  35. theme="default"
  36. size="2x"
  37. state="normal"
  38. />
  39. ) : undefined
  40. }
  41. style={{
  42. width: '1.5rem',
  43. height: '1.5rem',
  44. padding: 0,
  45. }}
  46. title={title}
  47. className="truncate-text"
  48. >
  49. {/* {title} */}
  50. </Button>
  51. );
  52. };
  53. const MeasurementPanel = () => {
  54. const dispatch = useDispatch();
  55. const handleReturn = () => {
  56. dispatch(switchToOperationPanel());
  57. };
  58. return (
  59. <Layout className="h-full">
  60. {/* 顶部导航栏 */}
  61. <Header
  62. style={{
  63. display: 'flex',
  64. alignItems: 'center',
  65. padding: '0 16px',
  66. }}
  67. >
  68. <Button
  69. type="text"
  70. icon={<ArrowLeftOutlined />}
  71. onClick={handleReturn}
  72. />
  73. <Title level={5} style={{ margin: 0, lineHeight: '48px' }}>
  74. 图像测量
  75. </Title>
  76. </Header>
  77. {/* 主体内容 */}
  78. <Content
  79. style={{ padding: '16px', maxHeight: '100%', overflowY: 'auto' }}
  80. >
  81. {/* 基础测量组 */}
  82. <div style={{ marginBottom: '24px' }}>
  83. <Text
  84. strong
  85. style={{ fontSize: '14px', marginBottom: '12px', display: 'block' }}
  86. >
  87. 基础测量
  88. </Text>
  89. <Flex wrap gap="small" align="center" justify="start" className="p-1">
  90. <FunctionButton
  91. title="线段测量"
  92. action="线段测量"
  93. iconName="btn_LineMeasurement"
  94. />
  95. <FunctionButton
  96. title="角度测量"
  97. action="角度测量"
  98. iconName="btn_AngleMeasurement"
  99. />
  100. <FunctionButton
  101. title="清除测量"
  102. action="清除测量"
  103. iconName="btn_ClearMeasurement"
  104. />
  105. <FunctionButton
  106. title="测量校正"
  107. action="测量校正"
  108. iconName="MeasurementCalibration"
  109. />
  110. </Flex>
  111. <div style={{ marginTop: '8px', fontSize: '12px', color: '#666' }}>
  112. 说明:要选择测量标记,即线段测量标记
  113. </div>
  114. </div>
  115. <Divider />
  116. {/* 专业测量组 */}
  117. <div style={{ marginBottom: '24px' }}>
  118. <Text
  119. strong
  120. style={{ fontSize: '14px', marginBottom: '12px', display: 'block' }}
  121. >
  122. 专业测量
  123. </Text>
  124. <Flex wrap gap="small" align="center" justify="start" className="p-1">
  125. <FunctionButton
  126. title="Cobb角"
  127. action="Cobb角"
  128. iconName="CobbAngle"
  129. />
  130. </Flex>
  131. </div>
  132. <Divider />
  133. {/* 宠物专用测量组 */}
  134. <div style={{ marginBottom: '24px' }}>
  135. <Text
  136. strong
  137. style={{ fontSize: '14px', marginBottom: '12px', display: 'block' }}
  138. >
  139. 宠物专用测量
  140. </Text>
  141. <Flex wrap gap="small" align="center" justify="start" className="p-1">
  142. <FunctionButton
  143. title="髋臼水平角"
  144. action="髋臼水平角"
  145. iconName="btn_DAR"
  146. productId="animal"
  147. />
  148. <FunctionButton
  149. title="胫骨平台夹角"
  150. action="胫骨平台夹角"
  151. iconName=""
  152. />
  153. <FunctionButton
  154. title="髋关节牵引指数"
  155. action="髋关节牵引指数"
  156. iconName=""
  157. />
  158. <FunctionButton
  159. title="髋关节水平角"
  160. action="髋关节水平角"
  161. iconName=""
  162. />
  163. <FunctionButton title="心锥比" action="心锥比" iconName="" />
  164. <FunctionButton
  165. title="胫骨平台骨切开术"
  166. action="胫骨平台骨切开术"
  167. iconName=""
  168. />
  169. <FunctionButton
  170. title="胫骨结节前移术"
  171. action="胫骨结节前移术"
  172. iconName=""
  173. />
  174. <FunctionButton
  175. title="胫骨结节前移术5点测量法"
  176. action="胫骨结节前移术5点测量法"
  177. iconName=""
  178. />
  179. <FunctionButton
  180. title="水平截骨术"
  181. action="水平截骨术"
  182. iconName=""
  183. />
  184. <FunctionButton
  185. title="股骨头覆盖率"
  186. action="股骨头覆盖率"
  187. iconName=""
  188. />
  189. <FunctionButton
  190. title="髋臼背覆盖"
  191. action="髋臼背覆盖"
  192. iconName=""
  193. />
  194. <FunctionButton
  195. title="拆线长度测量"
  196. action="拆线长度测量"
  197. iconName=""
  198. />
  199. <FunctionButton
  200. title="多边形长度测量"
  201. action="多边形长度测量"
  202. iconName=""
  203. />
  204. <FunctionButton title="找圆心" action="找圆心" iconName="" />
  205. <FunctionButton title="找中线" action="找中线" iconName="" />
  206. <FunctionButton title="找中点" action="找中点" iconName="" />
  207. <FunctionButton
  208. title="直线垂直倾斜度"
  209. action="直线垂直倾斜度"
  210. iconName=""
  211. />
  212. <FunctionButton
  213. title="直线水平倾斜度"
  214. action="直线水平倾斜度"
  215. iconName=""
  216. />
  217. <FunctionButton
  218. title="矩形区域灰度"
  219. action="矩形区域灰度"
  220. iconName=""
  221. />
  222. <FunctionButton title="直线灰度" action="直线灰度" iconName="" />
  223. </Flex>
  224. </div>
  225. </Content>
  226. </Layout>
  227. );
  228. };
  229. export default MeasurementPanel;