OperationPanel.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import { Divider, Flex, Spin } from 'antd';
  2. import { useSelector } from 'react-redux';
  3. import { selectIsAnyViewportLoading } from '@/states/view/imageLoadingSlice';
  4. import FunctionArea from './FunctionArea';
  5. import TransferArea from './TransferArea';
  6. import SendPanelForView from '../../output/SendPanelForView';
  7. import MeasurementPanel from './MeasurementPanel';
  8. import MorePanel from './MorePanel';
  9. import AdvancedProcessingPanel from './AdvancedProcessingPanel';
  10. import RectCropPanel from './RectCropPanel';
  11. import MarkPanel from './MarkPanel';
  12. import ImageStateControl from './ImageStateControl';
  13. import { RootState } from '../../../states/store';
  14. import SliderAdjustmentPanel from './SliderAdjustmentPanel';
  15. const OperationPanel = () => {
  16. const currentPanel = useSelector(
  17. (state: RootState) => state.panelSwitchForView.currentPanel
  18. );
  19. // 检查是否有任何视口正在加载
  20. const isAnyViewportLoading = useSelector(selectIsAnyViewportLoading);
  21. const renderPanel = () => {
  22. switch (currentPanel) {
  23. case 'OperationPanel':
  24. return (
  25. <Flex
  26. vertical
  27. gap="small"
  28. style={{
  29. height: '100%',
  30. overflowY: 'auto',
  31. //padding: '0.5rem'
  32. }}
  33. >
  34. <FunctionArea />
  35. <Divider style={{ margin: 0 }} />
  36. <ImageStateControl />
  37. <Divider style={{ margin: 0 }} />
  38. <TransferArea />
  39. </Flex>
  40. );
  41. case 'SendPanel':
  42. return <SendPanelForView />;
  43. case 'MeasurementPanel':
  44. return <MeasurementPanel />;
  45. case 'MorePanel':
  46. return <MorePanel />;
  47. case 'AdvancedProcessingPanel':
  48. return <AdvancedProcessingPanel />;
  49. case 'RectCropPanel':
  50. return <RectCropPanel />;
  51. case 'MarkPanel':
  52. return <MarkPanel />;
  53. case 'SliderAdjustmentPanel':
  54. return <SliderAdjustmentPanel />
  55. default:
  56. return (
  57. <Flex
  58. vertical
  59. gap="small"
  60. style={{
  61. height: '100%',
  62. overflowY: 'auto',
  63. padding: '0.5rem'
  64. }}
  65. >
  66. <FunctionArea />
  67. <Divider style={{ margin: 0 }} />
  68. <ImageStateControl />
  69. <Divider style={{ margin: 0 }} />
  70. <TransferArea />
  71. </Flex>
  72. );
  73. }
  74. };
  75. return (
  76. <div style={{ height: '100%', position: 'relative' }}>
  77. {renderPanel()}
  78. {/* 加载遮罩层 */}
  79. {isAnyViewportLoading && (
  80. <div
  81. style={{
  82. position: 'absolute',
  83. top: 0,
  84. left: 0,
  85. right: 0,
  86. bottom: 0,
  87. backgroundColor: 'rgba(0, 0, 0, 0.3)',
  88. zIndex: 1000,
  89. display: 'flex',
  90. alignItems: 'center',
  91. justifyContent: 'center',
  92. cursor: 'not-allowed',
  93. }}
  94. >
  95. <Spin size="large" tip="图像加载中,请稍候..." />
  96. </div>
  97. )}
  98. </div>
  99. );
  100. };
  101. export default OperationPanel;