张延森 3 år sedan
förälder
incheckning
4c335b9eaf

+ 12
- 2
src/components/ECharts/index.jsx Visa fil

@@ -14,6 +14,7 @@ import {
14 14
   DatasetComponent,
15 15
   TransformComponent,
16 16
   LegendComponent,
17
+  ToolboxComponent,
17 18
 } from 'echarts/components';
18 19
 // 标签自动布局,全局过渡动画等特性
19 20
 import { LabelLayout, UniversalTransition } from 'echarts/features';
@@ -33,6 +34,7 @@ echarts.use([
33 34
   UniversalTransition,
34 35
   SVGRenderer,
35 36
   LegendComponent,
37
+  ToolboxComponent,
36 38
 ]);
37 39
 
38 40
 import Styles from './style.less';
@@ -43,11 +45,19 @@ export default forwardRef((props, ref) => {
43 45
 
44 46
   useEffect(() => {
45 47
     echartsRef.current = echarts.init(domRef.current);
46
-    window.onresize = function () {
48
+    console.log('---------echarts------>', domRef.current);
49
+
50
+    const handleResize = () => {
51
+      console.log('---------onresize------>', domRef.current);
47 52
       echartsRef.current.resize();
48 53
     };
49 54
 
50
-    return () => echartsRef.current.dispose();
55
+    window.addEventListener('resize', handleResize);
56
+
57
+    return () => {
58
+      window.removeEventListener('resize', handleResize);
59
+      echartsRef.current.dispose();
60
+    };
51 61
   }, []);
52 62
 
53 63
   useEffect(() => {

+ 1
- 1
src/components/ECharts/style.less Visa fil

@@ -1,5 +1,5 @@
1 1
 .echart {
2 2
   width: 100%;
3 3
   height: 100%;
4
-  min-height: 200px;
4
+  min-height: 100px;
5 5
 }

+ 1
- 1
src/pages/MonitoringScreen/components/BasicChart.jsx Visa fil

@@ -7,7 +7,7 @@ export default (props) => {
7 7
   return (
8 8
     <div style={{ height: '100%' }}>
9 9
       <TitleBox value={props.title} />
10
-      <SquareBox style={{ height: 'calc(100% - 48px)', minHeight: '200px', maxHeight: '350px' }}>
10
+      <SquareBox style={{ height: 'calc(100% - 48px)', minHeight: '100px' }}>
11 11
         <ECharts option={props.option} />
12 12
       </SquareBox>
13 13
     </div>

+ 2
- 2
src/pages/MonitoringScreen/components/List/style.less Visa fil

@@ -4,11 +4,11 @@
4 4
     padding: 0 20px;
5 5
 
6 6
     & > div {
7
-      height: 48px;
7
+      height: 28px;
8 8
       color: #ffffff;
9 9
       font-weight: bold;
10 10
       font-size: 18px;
11
-      line-height: 48px;
11
+      line-height: 28px;
12 12
 
13 13
       background: linear-gradient(0deg, #ffcf84 0%, #fb9900 93.84765625%);
14 14
       background-clip: text;

+ 6
- 7
src/pages/MonitoringScreen/index.jsx Visa fil

@@ -21,7 +21,7 @@ import Styles from './style.less';
21 21
 
22 22
 export default (props) => {
23 23
   const screenRef = useRef();
24
-  const [height, setHeight] = useState('1080px');
24
+  const [height, setHeight] = useState('800px');
25 25
   const { isFullScreen, toggleFullScreen } = useFullScreen(screenRef);
26 26
 
27 27
   const [machineryTypeData, setMachineryTypeData] = useState([
@@ -71,10 +71,10 @@ export default (props) => {
71 71
           <div className={Styles['grail-header']}>
72 72
             <ScreenHeader weather="多云 21-28 °C" />
73 73
           </div>
74
-          <div className={classNames(Styles['grail-container'], Styles['pd-tp-30'])}>
74
+          <div className={classNames(Styles['grail-container'], Styles['mg-tp-30'])}>
75 75
             <div className={Styles['grail-left']}>
76 76
               <div className="flex flex-column full-height">
77
-                <div className="flex-0" style={{ height: '250px' }}>
77
+                <div className="flex-0" style={{ minHeight: '37%' }}>
78 78
                   <MachineryType source={machineryTypeData} />
79 79
                 </div>
80 80
                 <div className="flex-1" style={{ marginTop: '30px' }}>
@@ -93,7 +93,7 @@ export default (props) => {
93 93
             </div>
94 94
             <div className={Styles['grail-right']}>
95 95
               <div className="flex flex-column full-height">
96
-                <div className="flex-0" style={{ height: '250px' }}>
96
+                <div className="flex-0" style={{ minHeight: '37%' }}>
97 97
                   <WorkData source={workData} />
98 98
                 </div>
99 99
                 <div className="flex-1" style={{ marginTop: '30px' }}>
@@ -102,9 +102,9 @@ export default (props) => {
102 102
               </div>
103 103
             </div>
104 104
           </div>
105
-          <div className={classNames(Styles['grail-footer'], Styles['pd-tp-30'])}>
105
+          <div className={classNames(Styles['grail-footer'], Styles['mg-tp-30'])}>
106 106
             <SquareBox>
107
-              <div className="flex">
107
+              <div className="flex" style={{ padding: '20px 0' }}>
108 108
                 <div className="flex-1">
109 109
                   <List title="预约订单">
110 110
                     <div>
@@ -141,7 +141,6 @@ export default (props) => {
141 141
                 </div>
142 142
               </div>
143 143
             </SquareBox>
144
-            <div className={Styles['pd-tp-30']} style={{ height: '30px' }} />
145 144
           </div>
146 145
         </div>
147 146
       </div>

+ 3
- 2
src/pages/MonitoringScreen/style.less Visa fil

@@ -2,6 +2,7 @@
2 2
   position: relative;
3 3
   width: 100%;
4 4
   height: 100%;
5
+  padding-bottom: 30px;
5 6
 
6 7
   background-color: #021222;
7 8
   background-image: url('~@/assets/images/screen/bg.png');
@@ -73,6 +74,6 @@
73 74
   padding-left: 40px;
74 75
 }
75 76
 
76
-.pd-tp-30 {
77
-  padding-top: 30px;
77
+.mg-tp-30 {
78
+  margin-top: 30px;
78 79
 }