@dayan_hjm hace 2 años
padre
commit
3a666f9399

+ 3 - 3
src/assets/css/styleTemplate.less

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 茶百道主题样式
3 3
  * @Date: 2022-10-27 10:56:37 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-14 17:48:54
5
+ * @Last Modified time: 2023-11-16 16:23:00
6 6
  */
7 7
 
8 8
 @import url("../../themes/themes.less");
@@ -554,7 +554,7 @@
554 554
 
555 555
         .bottomContent2 {
556 556
           width: 100%;
557
-          height: 42%;
557
+          height: 28%;
558 558
         }
559 559
 
560 560
         .bottomContent {
@@ -598,7 +598,7 @@
598 598
 
599 599
       .rightContent .bottomContent2 {
600 600
         width: 100%;
601
-        height: 28%;
601
+        height: 100%;
602 602
       }
603 603
 
604 604
       .rightContent .bottomContent {

+ 21 - 21
src/pages/gvc/api.js

@@ -73,61 +73,61 @@ export function momeyService(params) {
73 73
 }
74 74
 
75 75
 
76
-/**百万工时损工率   产量计划完成率*/
77
-export function timeService(params) {
76
+/**左侧数据*/
77
+export function leftService(params) {
78 78
   return request({
79
-    url: "/dataengine-center-oneservice/list/1356250124518724729",
79
+    url: "/dataengine-center-oneservice/list/1357592107129541992",
80 80
     method: "POST",
81 81
     data: {
82
-      "apiId": "1356250124518724729",
83
-      "appKey": "200000134",
82
+      "apiId": "1357592107129541992",
83
+      "appKey": "200000135",
84 84
       "env": "PROD",
85 85
       "reqProtocol": 1,
86 86
       "returnFields": [
87
-        "indexName",
88
-        "factoryName",
89
-        "indexValue"
87
+        "prodCode",
88
+        "production",
89
+        "inventory"
90 90
       ],
91 91
       "pageNum": 1,
92 92
       "pageSize": 10,
93 93
       "useResultCache": false
94 94
     },
95 95
     headers: {
96
-      sign: '46847fe90889330f13cdc3318d848d45',
96
+      sign: '2d35f0b798fe2cc8443f95aed6da466a',
97 97
       account: 'yunxi_fuxue',
98 98
       'Cache-Control': 'no-cache',
99
-      apiId: '1356250124518724729',
100
-      appKey: '200000134',
99
+      apiId: '1357592107129541992',
100
+      appKey: '200000135',
101 101
       execType: '3',
102 102
       env: 'PROD',
103 103
     }
104 104
   });
105 105
 }
106 106
 
107
-/**产值+发货量+产量+库存*/
108
-export function numberService(params) {
107
+/**累计销量客户*/
108
+export function rollService(params) {
109 109
   return request({
110
-    url: "/dataengine-center-oneservice/list/1356243326548087867",
110
+    url: "/dataengine-center-oneservice/list/1357509594900108615",
111 111
     method: "POST",
112 112
     data: {
113
-      "apiId": "1356243326548087867",
114
-      "appKey": "200000134",
113
+      "apiId": "1357509594900108615",
114
+      "appKey": "200000135",
115 115
       "env": "PROD",
116 116
       "reqProtocol": 1,
117 117
       "returnFields": [
118
-        "indexName",
119
-        "indexValue"
118
+        "customerName",
119
+        "salesQty"
120 120
       ],
121 121
       "pageNum": 1,
122 122
       "pageSize": 10,
123 123
       "useResultCache": false
124 124
     },
125 125
     headers: {
126
-      sign: '2f079b53e1e63b753bb6f9807f6c6818',
126
+      sign: '839f9217d1cf81ec03ff6ccf54c86e37',
127 127
       account: 'yunxi_fuxue',
128 128
       'Cache-Control': 'no-cache',
129
-      apiId: '1356243326548087867',
130
-      appKey: '200000134',
129
+      apiId: '1357509594900108615',
130
+      appKey: '200000135',
131 131
       execType: '3',
132 132
       env: 'PROD',
133 133
     }

+ 23 - 96
src/pages/gvc/component/rightBottomView.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 累计销量客户
3 3
  * @Date: 2023-10-23 09:32:12 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-13 16:14:33
5
+ * @Last Modified time: 2023-11-16 17:05:05
6 6
  */
7 7
 
8 8
 import React, { useState, useEffect, Component } from "react";
@@ -13,9 +13,9 @@ import Slider from "react-slick";
13 13
 import "slick-carousel/slick/slick.css";
14 14
 import "slick-carousel/slick/slick-theme.css";
15 15
 import { Progress } from 'antd';
16
-import { getArrMax } from "@utils/util";
16
+import { getArrMax,sortby } from "@utils/util";
17 17
 import {
18
-  dataengineCenterOneservice,
18
+  rollService,
19 19
 } from "../api";
20 20
 import { get, } from "lodash";
21 21
 
@@ -27,107 +27,35 @@ class RightBottomView extends Component {
27 27
     super(props, context);
28 28
     this.store = mod;
29 29
     this.state = {
30
-      data_item: [
31
-        {
32
-          name: '很长的很长的很长的很长的很长的很长的很长的布置岛实业有限公司',
33
-          num: 666969988666969988666969988666969988,
34
-          percent:99.5
35
-        },
36
-        {
37
-          name: '布置岛实业有限公司',
38
-          num: 966,
39
-          percent:95.5
40
-
41
-        },
42
-        {
43
-          name: '布置岛实业有限公司',
44
-          num: 666969988,
45
-          percent:85.5
46
-        },
47
-        {
48
-          name: '布置岛实业有限公司',
49
-          num: 666969988,
50
-          percent:59.5
51
-
52
-        },
53
-        {
54
-          name: '布置岛实业有限公司',
55
-          num: 666969988,
56
-          percent:48.5
57
-
58
-        },
59
-        {
60
-          name: '布置岛实业有限公司',
61
-          num: 36,
62
-          percent:6
63
-
64
-        },
65
-        {
66
-          name: '布置岛实业有限公司',
67
-          num: 666969988,
68
-          percent:78
69
-        },
70
-        {
71
-          name: '布置岛实业有限公司',
72
-          num: 666969988,
73
-          percent:45
74
-        },
75
-        {
76
-          name: '布置岛实业有限公司',
77
-          num: 666969988,
78
-          percent:36
79
-        },
80
-        {
81
-          name: '布置岛实业有限公司',
82
-          num: 666969988,
83
-          percent:36
84
-        },
85
-        {
86
-          name: '布置岛实业有限公司',
87
-          num: 666969988,
88
-          percent:98
89
-        },
90
-        {
91
-          name: '布置岛实业有限公司',
92
-          num: 666969988,
93
-          percent:65
94
-        },
95
-        {
96
-          name: '布置岛实业有限公司',
97
-          num: 666969988,
98
-          percent:36
99
-        },
100
-      ],
30
+      data_item: [],
101 31
     };
102 32
   }
103 33
 
104 34
   componentDidMount() {
35
+    this.getUrl()
105 36
   }
106 37
 
107 38
   async getUrl() {
108
-    // await dataengineCenterOneservice().then(({ data=[], resultCode }) => {
109
-    //   if (+resultCode === 0) {
110
-    //     let year = [],missionsIntensity_arr = [],missionsTotal_arr = [],max1=[],max2=[];
111
-    //     data.map((x,i)=>{
112
-    //       year.unshift(x.byear)
113
-    //       missionsIntensity_arr.unshift(x.missionsIntensity)
114
-    //       missionsTotal_arr.unshift(x.missionsTotal)
115
-    //     });
116
-    //     const max_1 = getArrMax(missionsIntensity_arr);
117
-    //     const max_2 = getArrMax(missionsTotal_arr);
118
-    //     for (let index = 0; index < data.length; index++) {
119
-    //       max1.unshift(max_1/0.8)
120
-    //       max2.unshift(max_2/0.8)
121
-    //     }
122
-    //     this.setState({year,missionsIntensity_arr,missionsTotal_arr,max1,max2});
123
-    //       this.setData();
124
-    //       this.setData2();    
125
-    //   }
126
-    // });
39
+    await rollService().then(({ data=[], resultCode }) => {
40
+      if (+resultCode === 0) {
41
+        let data_item = [];
42
+        const max1 = data.sort(sortby('salesQty',false));
43
+        const max2 = max1?.[0]?.salesQty / 0.95 || 0;
44
+        data.map((x,i)=>{  
45
+          data_item.push({
46
+            name: x.customerName,
47
+            num: x.salesQty,
48
+            percent:Number(x.salesQty / max2).toFixed(2) * 100
49
+          })
50
+        });
51
+        this.setState({data_item});
52
+      }
53
+    });
127 54
 
128 55
   }
129 56
 
130 57
   render() {
58
+    const { data_item } = this.state;
131 59
     const settings = {
132 60
       dots: false,
133 61
       arrows:false,
@@ -135,7 +63,7 @@ class RightBottomView extends Component {
135 63
       autoplay: true,
136 64
       autoplaySpeed: 2500,//自动播放的时间
137 65
       // fade: true,//是否采用淡入淡出的效果  竖着的滚动方式不能添加此动效
138
-      slidesToShow: 8,
66
+      slidesToShow: data_item.length >= 8 ? 8 : data_item.length,
139 67
       slidesToScroll: 1,
140 68
       vertical: true,
141 69
       verticalSwiping: true,
@@ -146,9 +74,8 @@ class RightBottomView extends Component {
146 74
         console.log("after change", currentSlide);
147 75
       }
148 76
     };
149
-    const { data_item } = this.state;
150 77
     return (
151
-      <div className={["eacharView cbRightBottomView slider_item_box"]}>
78
+      <div className={["eacharView cbRightBottomView slider_item_box"]} style={{height: data_item.length > 8 ? 'auto' : "100%"}}>
152 79
         <p className="title_">累计销量客户/吨</p>
153 80
         <Slider {...settings}>
154 81
           {

+ 48 - 11
src/pages/gvc/style.less

@@ -35,6 +35,7 @@
35 35
             width: 73%;
36 36
           }
37 37
         }
38
+
38 39
         @media (min-height: 900px) {
39 40
           .alls {
40 41
             width: 64%;
@@ -59,7 +60,7 @@
59 60
           height: 70%;
60 61
           margin-top: 5%;
61 62
           margin-left: 1%;
62
-          padding-right: 8%;
63
+          padding-right: 7%;
63 64
 
64 65
           >ul {
65 66
             width: 100%;
@@ -83,7 +84,7 @@
83 84
                 justify-content: center;
84 85
 
85 86
                 >div {
86
-                  width: 60%;
87
+                  width: 51%;
87 88
                   position: relative;
88 89
                   display: block;
89 90
 
@@ -117,11 +118,11 @@
117 118
                 display: flex;
118 119
                 align-items: center;
119 120
                 justify-content: space-between;
120
-                margin-top: 0.5em;
121
+                margin-top: 1em;
121 122
                 font-weight: normal;
122 123
                 font-size: 0.9em;
123 124
                 color: #CDF1FF;
124
-                padding: 0.8em 0.9em 0.2em;
125
+                padding: 0.8em 0.5em 0.2em;
125 126
                 background: linear-gradient(0deg, #ffffff26 0%, #ffffff00 100%);
126 127
                 border-radius: 0.5em;
127 128
 
@@ -136,6 +137,21 @@
136 137
           }
137 138
         }
138 139
 
140
+        @media (max-height: 900px) {
141
+          .leftContent li {
142
+            height: 15% !important;
143
+
144
+            .text {
145
+              width: 107% !important;
146
+              margin-top: 1em !important;
147
+
148
+              .topMsg_number {
149
+                font-size: 1em !important;
150
+              }
151
+            }
152
+          }
153
+        }
154
+
139 155
         .centerCon {
140 156
           width: 62%;
141 157
           height: 80%;
@@ -153,6 +169,7 @@
153 169
             margin: 0% 0 0 -3%;
154 170
           }
155 171
         }
172
+
156 173
         @media (min-height: 900px) {
157 174
           .centerCon {
158 175
             width: 62%;
@@ -160,7 +177,7 @@
160 177
             padding: 0;
161 178
             position: relative;
162 179
             margin: 0% 0 0 -1%;
163
-            }
180
+          }
164 181
         }
165 182
 
166 183
         @media (min-height: 1000PX) {
@@ -193,6 +210,7 @@
193 210
             box-sizing: border-box;
194 211
             font-size: 0.9em;
195 212
             color: #CDF1FF;
213
+
196 214
             .nums {
197 215
               font-size: 1.3em;
198 216
               color: #69FFDE;
@@ -265,7 +283,8 @@
265 283
               }
266 284
             }
267 285
           }
268
-          li:hover{
286
+
287
+          li:hover {
269 288
             background: linear-gradient(0deg, #42ca9840 0%, #42ca9800 98%);
270 289
           }
271 290
         }
@@ -274,9 +293,9 @@
274 293
           width: 15%;
275 294
           position: absolute;
276 295
           right: 0;
277
-          bottom: 16%;
296
+          bottom: 10%;
278 297
           z-index: 9;
279
-          height: auto;
298
+          height: 60%;
280 299
 
281 300
           .title_ {
282 301
             text-align: left;
@@ -290,6 +309,10 @@
290 309
             color: #F1E9E0;
291 310
             margin-bottom: 0.6em;
292 311
           }
312
+          .eacharView{
313
+            height: auto;
314
+            overflow: hidden;
315
+          }
293 316
 
294 317
           .slider_box {
295 318
             padding: 0 0.5em;
@@ -306,7 +329,7 @@
306 329
             font-weight: normal;
307 330
 
308 331
             >p {
309
-              width: 59%;
332
+              width: 83%;
310 333
               display: flex;
311 334
               overflow: hidden;
312 335
               text-overflow: ellipsis;
@@ -342,9 +365,23 @@
342 365
           }
343 366
 
344 367
         }
345
-      }
346 368
 
369
+        @media (min-height: 800px) {
370
+          .rightContent {
371
+            bottom: 3%;
372
+          }
373
+        }
374
+        @media (min-height: 900px) {
375
+          .rightContent {
376
+            bottom: 3%;
377
+          }
378
+        }
379
+        @media (min-height: 1000px) {
380
+          .rightContent {
381
+            bottom:-5%;
382
+          }
383
+        }
384
+      }
347 385
     }
348
-
349 386
   }
350 387
 }

+ 22 - 41
src/pages/gvc/view.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm  产供销价值链
3 3
  * @Date: 2023-11-10 10:19:34 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-15 16:30:25
5
+ * @Last Modified time: 2023-11-16 16:47:16
6 6
  */
7 7
 
8 8
 import React, { useState, useEffect, Component } from "react";
@@ -14,8 +14,8 @@ import mod from './mod';
14 14
 import { toJS } from "mobx";
15 15
 import RightBottomView from "./component/rightBottomView.jsx";
16 16
 import {
17
-  timeService,
18
-  numberService,
17
+  leftService,
18
+  rollService,
19 19
   checkToken,
20 20
   updateTimeService
21 21
 } from "./api";
@@ -32,26 +32,6 @@ class Gvc extends Component {
32 32
     this.store = mod;
33 33
     this.state = {
34 34
       LeftHtml: [
35
-        {
36
-          txt_name: '碳酸锂',
37
-          num1: 1222,
38
-          num2: 1000,
39
-        },
40
-        {
41
-          txt_name: '氢氧化钠',
42
-          num1: 2525,
43
-          num2: 25,
44
-        },
45
-        {
46
-          txt_name: '氯化锂',
47
-          num1: 3654,
48
-          num2: 7541,
49
-        },
50
-        {
51
-          txt_name: '金属锂',
52
-          num1: 45,
53
-          num2: 698,
54
-        },
55 35
       ],
56 36
       updateTime: '',
57 37
       changGif: false,
@@ -85,11 +65,10 @@ class Gvc extends Component {
85 65
   }
86 66
   componentDidMount() {
87 67
     // this.fontMsgChange();
88
-    // this.getUrl();
68
+    this.getUrl();
89 69
     // this.getUrl2()
90
-    // this.getUrl3();
70
+    this.getUrl3();
91 71
     setTimeout(() => {
92
-
93 72
       this.videoStart();
94 73
     }, 200)
95 74
     setTimeout(() => {
@@ -154,28 +133,27 @@ class Gvc extends Component {
154 133
   }
155 134
 
156 135
   async getUrl() {
157
-    await timeService().then(({ data = [], resultCode }) => {
136
+    await leftService().then(({ data = [], resultCode }) => {
158 137
       if (+resultCode === 0) {
159
-        let plannedCompletionData = [], manHourData = [];
138
+        let LeftHtml = [], name_ = ["碳酸锂", '氢氧化钠', '氯化锂', '金属锂'];
160 139
         data.map((x, i) => {
161
-          if (x.indexName == '产量计划完成率') {
162
-            plannedCompletionData.push({
163
-              name: x.factoryName,
164
-              value: x.indexValue * 100,
165
-            })
166
-          } else {
167
-            manHourData.push({
168
-              name: x.factoryName,
169
-              value: x.indexValue * 100,
170
-            })
140
+          if (i >= 4) {
141
+            return
171 142
           }
143
+          LeftHtml.push(
144
+            {
145
+              txt_name: name_[i],
146
+              num1: x.production,
147
+              num2: x.inventory,
148
+            }
149
+          );
172 150
         });
173
-        this.setState({ plannedCompletionData, manHourData, plannedCompletionNum: 1, manHourNum: 1 });
151
+        this.setState({ LeftHtml });
174 152
       }
175 153
     });
176 154
   }
177 155
   async getUrl2() {
178
-    await numberService().then(({ data = [], resultCode }) => {
156
+    await rollService().then(({ data = [], resultCode }) => {
179 157
       if (+resultCode === 0) {
180 158
         let totalValue = 0, yearDecline = 0, yearSend = 0, productInventory = 0;
181 159
         data.map((x, i) => {
@@ -262,7 +240,7 @@ class Gvc extends Component {
262 240
   render() {
263 241
     const stores = this.store.state;
264 242
     let { totalValue, yearDecline, yearSend, imgMsgData } = this.store.state;
265
-    let { LeftHtml } = this.state;
243
+    let { LeftHtml,updateTime } = this.state;
266 244
     return (
267 245
       <div className={[styles.home_box + ' home_box']}>
268 246
         <div className={"all_box"}>
@@ -359,6 +337,9 @@ class Gvc extends Component {
359 337
               </div>
360 338
             </div>
361 339
             <div className="bottom_box">
340
+              <p style={{ color: "#6a818d", lineHeight: '2px',width: '100%',textAlign: "center" }}>
341
+                更新时间 : {updateTime}
342
+              </p>
362 343
             </div>
363 344
           </div>
364 345
         </div>

+ 11 - 0
src/utils/util.js

@@ -29,6 +29,17 @@ export function getParams(url = "") {
29 29
   return args;
30 30
 }
31 31
 
32
+
33
+export function sortby(prop, rev = true) {
34
+  // prop 属性名
35
+  // rev  升序降序 默认升序
36
+   return function(a, b) {
37
+      var val1 = a[prop]; 
38
+      var val2 = b[prop]; 
39
+      return rev ? val1 - val2 : val2 - val1;
40
+   }
41
+}
42
+
32 43
 /**下载文件*/
33 44
 export function download(param) {
34 45
   // 文件类型是否为pdf