张延森 3 years ago
parent
commit
06c12dd8f2

+ 3
- 0
config/config.dev.js View File

1
 // https://umijs.org/config/
1
 // https://umijs.org/config/
2
 import { defineConfig } from 'umi';
2
 import { defineConfig } from 'umi';
3
 export default defineConfig({
3
 export default defineConfig({
4
+  define: {
5
+    API_BASE: '',
6
+  },
4
   //
7
   //
5
   plugins: [
8
   plugins: [
6
     // https://github.com/zthxxx/react-dev-inspector
9
     // https://github.com/zthxxx/react-dev-inspector

+ 3
- 1
config/config.js View File

7
 const { REACT_APP_ENV } = process.env;
7
 const { REACT_APP_ENV } = process.env;
8
 
8
 
9
 export default defineConfig({
9
 export default defineConfig({
10
-  // 以下是 umi 参数
10
+  define: {
11
+    API_BASE: 'http://sgl-v2.njyunzhi.com',
12
+  },
11
   hash: true,
13
   hash: true,
12
   antd: {},
14
   antd: {},
13
   dva: {
15
   dva: {

+ 1
- 1
src/components/ScreenBox/TitleBox/style.less View File

14
     height: 10px;
14
     height: 10px;
15
     background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
15
     background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
16
     background-size: 400% 400%;
16
     background-size: 400% 400%;
17
-    animation: gradient 5s ease infinite;
17
+    animation: gradient 2s ease infinite;
18
   }
18
   }
19
   .TitleBox-ListBox-value {
19
   .TitleBox-ListBox-value {
20
     margin-left: 12px;
20
     margin-left: 12px;

+ 3
- 1
src/pages/MonitoringScreen/components/MachineryStatus.jsx View File

23
 });
23
 });
24
 
24
 
25
 const defaultOpt = {
25
 const defaultOpt = {
26
-  tooltip: {},
26
+  tooltip: {
27
+    extraCssText: 'width:160px;height:40px;',
28
+  },
27
   grid: {
29
   grid: {
28
     top: 20,
30
     top: 20,
29
     right: 10,
31
     right: 10,

+ 3
- 1
src/pages/MonitoringScreen/components/MachineryType.jsx View File

23
 });
23
 });
24
 
24
 
25
 const defaultOpt = {
25
 const defaultOpt = {
26
-  tooltip: {},
26
+  tooltip: {
27
+    extraCssText: 'width:160px;height:40px;',
28
+  },
27
   legend: {},
29
   legend: {},
28
   grid: {
30
   grid: {
29
     top: 20,
31
     top: 20,

+ 8
- 9
src/pages/MonitoringScreen/components/WorkArea.jsx View File

3
 import deepCopy from '@/utils/deepCopy';
3
 import deepCopy from '@/utils/deepCopy';
4
 
4
 
5
 const defaultOpt = {
5
 const defaultOpt = {
6
-  tooltip: {
7
-    trigger: 'item',
8
-    formatter: '{b} : {c} ({d}%)',
9
-  },
6
+  // tooltip: {
7
+  //   trigger: 'item',
8
+  //   formatter: '{b} : {c} ({d}%)',
9
+  // },
10
   legend: {
10
   legend: {
11
     orient: 'vertical',
11
     orient: 'vertical',
12
     left: 'right',
12
     left: 'right',
17
   series: [
17
   series: [
18
     {
18
     {
19
       type: 'pie',
19
       type: 'pie',
20
-      radius: ['30%', '60%'],
20
+      radius: ['40%', '55%'],
21
       center: ['40%', '50%'],
21
       center: ['40%', '50%'],
22
-      roseType: 'area',
23
-      itemStyle: {
24
-        borderRadius: 5,
25
-      },
22
+      selectedMode: 'single',
23
+      avoidLabelOverlap: false,
26
       label: {
24
       label: {
27
         color: '#fff',
25
         color: '#fff',
28
         formatter: '{b} \n{d}%',
26
         formatter: '{b} \n{d}%',
38
 export default (props) => {
36
 export default (props) => {
39
   const option = useMemo(() => deepCopy(defaultOpt), []);
37
   const option = useMemo(() => deepCopy(defaultOpt), []);
40
   option.series[0].data = props.source;
38
   option.series[0].data = props.source;
39
+  (option.series[0].data[0] || {}).selected = true; // 设置第一个是选中状态
41
 
40
 
42
   return <BasicChart title="农机作业量面积统计" option={option} />;
41
   return <BasicChart title="农机作业量面积统计" option={option} />;
43
 };
42
 };

+ 11
- 10
src/pages/MonitoringScreen/components/WorkData.jsx View File

3
 import deepCopy from '@/utils/deepCopy';
3
 import deepCopy from '@/utils/deepCopy';
4
 
4
 
5
 const defaultOpt = {
5
 const defaultOpt = {
6
-  tooltip: {
7
-    trigger: 'item',
8
-    formatter: '{b} : {c} ({d}%)',
9
-  },
6
+  // tooltip: {
7
+  //   trigger: 'item',
8
+  //   formatter: '{b} : {c} ({d}%)',
9
+  // },
10
   legend: {
10
   legend: {
11
     orient: 'vertical',
11
     orient: 'vertical',
12
     left: 'left',
12
     left: 'left',
13
     top: '5%',
13
     top: '5%',
14
     textStyle: { color: '#fff' },
14
     textStyle: { color: '#fff' },
15
   },
15
   },
16
-  toolbox: {},
17
   series: [
16
   series: [
18
     {
17
     {
19
       type: 'pie',
18
       type: 'pie',
20
-      radius: ['30%', '60%'],
19
+      radius: ['45%', '65%'],
21
       itemStyle: {
20
       itemStyle: {
22
-        borderRadius: 5,
21
+        borderRadius: 4,
22
+        borderColor: '#041B38',
23
+        borderWidth: 2,
23
       },
24
       },
24
       // itemStyle: {
25
       // itemStyle: {
25
       //   borderRadius: 10,
26
       //   borderRadius: 10,
29
       label: {
30
       label: {
30
         show: false,
31
         show: false,
31
         position: 'center',
32
         position: 'center',
33
+        formatter: '{b}\n{d}%',
32
       },
34
       },
33
       emphasis: {
35
       emphasis: {
34
         label: {
36
         label: {
35
-          color: '#fff',
37
+          color: '#25E1AA',
36
           show: true,
38
           show: true,
37
-          fontSize: '28',
38
-          fontWeight: 'bold',
39
+          fontSize: '18',
39
         },
40
         },
40
       },
41
       },
41
       labelLine: {
42
       labelLine: {

+ 3
- 4
src/pages/MonitoringScreen/index.jsx View File

49
   ]);
49
   ]);
50
 
50
 
51
   useEffect(() => {
51
   useEffect(() => {
52
-    console.log('-------process------->', process);
53
-
54
     getWeather('邓州市').then((res) => {
52
     getWeather('邓州市').then((res) => {
55
       if (res && res.length) {
53
       if (res && res.length) {
56
         const { casts } = res[0];
54
         const { casts } = res[0];
57
         const { dayweather, nighttemp, daytemp } = casts[0];
55
         const { dayweather, nighttemp, daytemp } = casts[0];
58
-        const [min, max] = nighttemp > daytemp ? [daytemp, nighttemp] : [nighttemp, daytemp];
56
+        const [min, max] =
57
+          parseInt(nighttemp) > parseInt(daytemp) ? [daytemp, nighttemp] : [nighttemp, daytemp];
59
         setWeather(`${dayweather} ${min}-${max} °C`);
58
         setWeather(`${dayweather} ${min}-${max} °C`);
60
       } else {
59
       } else {
61
         setWeather('暂无天气信息');
60
         setWeather('暂无天气信息');
94
           </div>
93
           </div>
95
           <div className={Styles['grail-right']}>
94
           <div className={Styles['grail-right']}>
96
             <div className="flex flex-column full-height">
95
             <div className="flex flex-column full-height">
97
-              <div className="flex-0" style={{ minHeight: '37%' }}>
96
+              <div className="flex-0" style={{ minHeight: '46%' }}>
98
                 <WorkData source={workData} />
97
                 <WorkData source={workData} />
99
               </div>
98
               </div>
100
               <div className="flex-1" style={{ marginTop: '30px' }}>
99
               <div className="flex-1" style={{ marginTop: '30px' }}>

+ 1
- 2
src/utils/request.js View File

24
     ? { Authorization: localStorage.getItem('token') }
24
     ? { Authorization: localStorage.getItem('token') }
25
     : {};
25
     : {};
26
 
26
 
27
-  const prefix =
28
-    process.env.NODE_ENV === 'production' ? 'http://sgl-v2.njyunzhi.com/api/admin' : '/api/admin';
27
+  const prefix = `${process.env.API_BASE}/api/admin`;
29
 
28
 
30
   return {
29
   return {
31
     url: `${prefix}${url}`,
30
     url: `${prefix}${url}`,