|
@@ -12,10 +12,9 @@ import MeButton from '../pages/security/components/MeButton';
|
|
|
|
|
|
interface BusinessZoneProps {
|
|
|
onMenuClick?: (key: string) => void;
|
|
|
- collapsed: boolean;
|
|
|
}
|
|
|
|
|
|
-const BusinessZone: React.FC<BusinessZoneProps> = ({ onMenuClick, collapsed }) => {
|
|
|
+const BusinessZone: React.FC<BusinessZoneProps> = ({ onMenuClick }) => {
|
|
|
const items = [
|
|
|
{
|
|
|
key: 'patient_management',
|
|
@@ -124,6 +123,7 @@ const BusinessZone: React.FC<BusinessZoneProps> = ({ onMenuClick, collapsed }) =
|
|
|
];
|
|
|
|
|
|
const [visibleItems, setVisibleItems] = useState(items);
|
|
|
+ const [floatingMenuVisible, setFloatingMenuVisible] = useState(false);
|
|
|
const businessZoneRef = useRef<HTMLDivElement>(null);
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -134,7 +134,9 @@ const BusinessZone: React.FC<BusinessZoneProps> = ({ onMenuClick, collapsed }) =
|
|
|
const systemZoneHeight = 100; // Assuming SystemZone height is fixed
|
|
|
|
|
|
if (businessZoneHeight + systemZoneHeight > windowHeight) {
|
|
|
- const visibleCount = Math.floor((windowHeight - systemZoneHeight) / 50); // Assuming each button height is 50px
|
|
|
+ const visibleCount = Math.floor(
|
|
|
+ (windowHeight - systemZoneHeight) / 50
|
|
|
+ ); // Assuming each button height is 50px
|
|
|
setVisibleItems(items.slice(0, visibleCount));
|
|
|
} else {
|
|
|
setVisibleItems(items);
|
|
@@ -150,67 +152,59 @@ const BusinessZone: React.FC<BusinessZoneProps> = ({ onMenuClick, collapsed }) =
|
|
|
};
|
|
|
}, [items]);
|
|
|
|
|
|
- return (
|
|
|
- <div style={{ width: '100%', overflow: 'hidden', position: 'relative' }} className='grid grid-rows-[1fr] h-0 flex-grow'>
|
|
|
- <div className='overflow-y-auto'>
|
|
|
- {/* <p>1. 这里内容很多,会撑高。</p>
|
|
|
- <p>2. 这里内容很多,会撑高。</p>
|
|
|
- <p>3. 这里内容很多,会撑高。</p>
|
|
|
- <p>4. 这里内容很多,会撑高。</p>
|
|
|
- <p>5. 这里内容很多,会撑高。</p>
|
|
|
- <p>6. 这里内容很多,会撑高。</p>
|
|
|
- <p>7. 这里内容很多,会撑高。</p>
|
|
|
- <p>8. 这里内容很多,会撑高。</p>
|
|
|
- <p>9. 这里内容很多,会撑高。</p>
|
|
|
- <p>10. 这里内容很多,会撑高。</p>
|
|
|
- <p>11. 这里内容很多,会撑高。</p>
|
|
|
- <p>12. 这里内容很多,会撑高。</p>
|
|
|
- <p>13. 这里内容很多,会撑高。</p>
|
|
|
- <p>14. 这里内容很多,会撑高。</p>
|
|
|
- <p>15. 这里内容很多,会撑高。</p>
|
|
|
- <p>12. 这里内容很多,会撑高。</p>
|
|
|
- <p>13. 这里内容很多,会撑高。</p>
|
|
|
- <p>14. 这里内容很多,会撑高。</p>
|
|
|
- <p>15. 这里内容很多,会撑高。</p>
|
|
|
- <p>12. 这里内容很多,会撑高。</p>
|
|
|
- <p>13. 这里内容很多,会撑高。</p>
|
|
|
- <p>14. 这里内容很多,会撑高。</p>
|
|
|
- <p>15. 这里内容很多,会撑高。</p>
|
|
|
- <p>12. 这里内容很多,会撑高。</p>
|
|
|
- <p>13. 这里内容很多,会撑高。</p>
|
|
|
- <p>14. 这里内容很多,会撑高。</p>
|
|
|
- <p>15. 这里内容很多,会撑高。</p>
|
|
|
- <p>12. 这里内容很多,会撑高。</p>
|
|
|
- <p>13. 这里内容很多,会撑高。</p>
|
|
|
- <p>14. 这里内容很多,会撑高。</p>
|
|
|
- <p>1852. 这里内容很多,会撑高。</p> */}
|
|
|
+ const handlePatientManagementClick = () => {
|
|
|
+ setFloatingMenuVisible(!floatingMenuVisible);
|
|
|
+ };
|
|
|
|
|
|
- {/* <div>444444</div> */}
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ style={{ width: '100%', overflow: 'hidden', position: 'relative' }}
|
|
|
+ className="grid grid-rows-[1fr] h-0 flex-grow"
|
|
|
+ >
|
|
|
+ <div className="overflow-y-auto">
|
|
|
<Space direction="vertical">
|
|
|
- {visibleItems.map((item) => (
|
|
|
- <div key={item.key}>
|
|
|
- <MeButton
|
|
|
- icon={item.icon}
|
|
|
- onClick={() => onMenuClick?.(item.key)}
|
|
|
- username={typeof item.label === 'string' ? item.label : undefined}
|
|
|
+ {visibleItems.map((item) =>
|
|
|
+ item.type === 'divider' ? (
|
|
|
+ <hr
|
|
|
+ key="divider"
|
|
|
+ style={{
|
|
|
+ width: '100%',
|
|
|
+ borderTop: '1px solid #f0f0f0',
|
|
|
+ margin: '8px 0',
|
|
|
+ }}
|
|
|
/>
|
|
|
- {item.children && (
|
|
|
- <Space direction="vertical" style={{ marginLeft: 20 }}>
|
|
|
- {item.children.map((child) => (
|
|
|
- <MeButton
|
|
|
- key={child.key}
|
|
|
- onClick={() => onMenuClick?.(child.key)}
|
|
|
- username={typeof child.label === 'string' ? child.label : undefined}
|
|
|
- />
|
|
|
- ))}
|
|
|
- </Space>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- ))}
|
|
|
+ ) : (
|
|
|
+ <div key={item.key}>
|
|
|
+ <MeButton
|
|
|
+ icon={item.icon}
|
|
|
+ onClick={
|
|
|
+ item.key === 'patient_management'
|
|
|
+ ? handlePatientManagementClick
|
|
|
+ : () => onMenuClick?.(item.key ?? 'error')
|
|
|
+ }
|
|
|
+ username={item.label}
|
|
|
+ />
|
|
|
+ {item.key === 'patient_management' && floatingMenuVisible && (
|
|
|
+ <Space direction="vertical" style={{ marginLeft: 20 }}>
|
|
|
+ {item.children?.map((child) => (
|
|
|
+ <MeButton
|
|
|
+ key={child.key}
|
|
|
+ onClick={() => onMenuClick?.(child.key)}
|
|
|
+ username={
|
|
|
+ typeof child.label === 'string'
|
|
|
+ ? child.label
|
|
|
+ : undefined
|
|
|
+ }
|
|
|
+ />
|
|
|
+ ))}
|
|
|
+ </Space>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ )}
|
|
|
</Space>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
);
|
|
|
};
|
|
|
|