#
luxiaotao1123
2024-04-28 8877cd129a4dc36f7848101a78dbefe18263a6f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
import { useSpring, animated } from 'react-spring';
import { useState } from 'react';
import styles from '@/styles/panel.module.scss';
 
import Panel from '@/components/panel';
 
import StockCharts from './components/stock-charts';
import TaskCharts from './components/task-charts';
// import AgvCharts from './components/agv-charts';
import CapacityCharts from './components/capacity-charts';
 
const Left = () => {
    const [isExpanded, setIsExpanded] = useState(true);
    // 定义动画属性
    const containerAnimation = useSpring({
        transform: isExpanded ? 'translate(0%)' : 'translateX(-100%)',
        config: { precision: 0.01 },
    });
 
    // 切换容器状态
    const toggleContainer = () => {
        setIsExpanded(!isExpanded);
    };
    return (
        <animated.div
            style={{
                ...containerAnimation,
            }}
            className={`absolute top-2 left-2 bottom-2 w-[280px] ${styles.panel}`}
        >
            <div className="h-full overflow-auto">
                <Panel title="库房情况">
                    <StockCharts />
                </Panel>
                <Panel title="库存类型">
                    <TaskCharts />
                </Panel>
                <Panel title="AGV信息">
                    {/* <AgvCharts /> */}
                    <CapacityCharts />
                </Panel>
            </div>
            <div
                className={`${'absolute text-white top-1/2 -translate-y-1/2 right-[-21px] bg-black bg-opacity-20 text-xl font-bold bg'}`}
            >
                {isExpanded ? (
                    <LeftOutlined
                        className="hover:scale-110 transition-transform duration-300 "
                        onClick={toggleContainer}
                    />
                ) : (
                    <RightOutlined
                        className="hover:scale-110 transition-transform duration-300"
                        onClick={toggleContainer}
                    />
                )}
            </div>
        </animated.div>
    );
};
 
export default Left;