Просмотр исходного кода

fix: 库存金额-左右图数据对不上 / 计划完成率是null就不显示这个数据

@dayan_hjm лет назад: 2
Родитель
Сommit
2bdb04d6c8
2 измененных файлов с 25 добавлено и 23 удалено
  1. 10 10
      src/pages/tqcDataVHome/component/leftMenoyView.jsx
  2. 15 13
      src/pages/tqcDataVHome/view.jsx

+ 10 - 10
src/pages/tqcDataVHome/component/leftMenoyView.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-08 15:41:54
5
+ * @Last Modified time: 2023-11-16 11:01:51
6 6
  */
7 7
 
8 8
 
@@ -40,7 +40,7 @@ class LeftMenoyView extends Component {
40 40
 
41 41
   async getUrl() {
42 42
     let data_style= [{
43
-            value: 25, name: '碳酸锂', itemStyle: {
43
+            value: 25, name: '', itemStyle: {
44 44
               normal: {
45 45
                 // barBorderRadius: 15,
46 46
                 // borderColor: "rgba(141, 147, 255, 1)",
@@ -62,7 +62,7 @@ class LeftMenoyView extends Component {
62 62
             },
63 63
 
64 64
           }, {
65
-            value: 33, name: '氧化纳', itemStyle: {
65
+            value: 33, name: '', itemStyle: {
66 66
               normal: {
67 67
                 // barBorderRadius: 15,
68 68
                 // borderColor: "rgba(105, 255, 222, 1)",
@@ -85,7 +85,7 @@ class LeftMenoyView extends Component {
85 85
             },
86 86
 
87 87
           }, {
88
-            value: 35, name: '金属锂', itemStyle: {
88
+            value: 35, name: '', itemStyle: {
89 89
               normal: {
90 90
                 // barBorderRadius: 15,
91 91
                 // borderColor: "rgba(47, 210, 255, 1)",
@@ -108,7 +108,7 @@ class LeftMenoyView extends Component {
108 108
             },
109 109
 
110 110
           }, {
111
-            value: 40, name: '氢氧化钠', itemStyle: {
111
+            value: 40, name: '', itemStyle: {
112 112
               normal: {
113 113
                 // barBorderRadius: 15,
114 114
                 // borderColor: "rgba(255, 206, 0, 1)",
@@ -137,7 +137,7 @@ class LeftMenoyView extends Component {
137 137
         let year = [], missionsIntensity_arr = [],max1=[],num=[];
138 138
         data.map((x, i) => {
139 139
           num.push(x.indexValue)
140
-          year.push(x.prodCatgory);
140
+          year.unshift(x.prodCatgory);
141 141
           data_style[i].value = x.indexValue;
142 142
           data_style[i].name = x.prodCatgory;
143 143
           missionsIntensity_arr.push(data_style[i])
@@ -146,6 +146,7 @@ class LeftMenoyView extends Component {
146 146
         for (let index = 0; index < data.length; index++) {
147 147
           max1.unshift(max_1/0.7)
148 148
         }
149
+        console.log("year, missionsIntensity_arr,max1",year, missionsIntensity_arr,max1)
149 150
         this.setState({ year, missionsIntensity_arr,max1 });
150 151
         this.setData();
151 152
         this.setData2();
@@ -159,7 +160,6 @@ class LeftMenoyView extends Component {
159 160
     setTimeout(() => {
160 161
       // 基于准备好的dom,初始化echarts实例
161 162
       var myChart = echarts.init(document.getElementById('echarts4'));
162
-      var myColor = ['#eb2100', '#eb3600', '#d0570e', '#d0a00e', '#34da62', '#00e9db', '#00c0e9', '#0096f3'];
163 163
       var option = {
164 164
 
165 165
         grid: {
@@ -291,7 +291,7 @@ class LeftMenoyView extends Component {
291 291
           myChart.dispatchAction({
292 292
             type: 'downplay',
293 293
             seriesIndex: 0,
294
-            dataIndex: index == 0 ? 5 : index - 1,
294
+            dataIndex: index == 0 ? 3 : index - 1,
295 295
           });
296 296
           myChart.dispatchAction({
297 297
             type: 'highlight',
@@ -299,10 +299,10 @@ class LeftMenoyView extends Component {
299 299
             dataIndex: index,
300 300
           });
301 301
           index++;
302
-          if (index > 5) {
302
+          if (index >= 4) {
303 303
             index = 0;
304 304
           }
305
-        }, 1800);
305
+        }, 3000);
306 306
       }
307 307
       fun();
308 308
       setTimeout(function () {

+ 15 - 13
src/pages/tqcDataVHome/view.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 
3 3
  * @Date: 2023-10-25 10:32:44 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-08 17:23:19
5
+ * @Last Modified time: 2023-11-16 10:35:01
6 6
  */
7 7
 /*
8 8
  * @Author: dayan_hjm 
@@ -144,16 +144,18 @@ class Home extends Component {
144 144
       if (+resultCode === 0) {
145 145
         let plannedCompletionData = [], manHourData = [];
146 146
         data.map((x, i) => {
147
-          if (x.indexName == '产量计划完成率') {
148
-            plannedCompletionData.push({
149
-              name: x.factoryName,
150
-              value: x.indexValue * 100,
151
-            })
152
-          } else {
153
-            manHourData.push({
154
-              name: x.factoryName,
155
-              value: x.indexValue * 100,
156
-            })
147
+          if(x.indexValue){
148
+            if (x.indexName == '产量计划完成率') {
149
+              plannedCompletionData.push({
150
+                name: x.factoryName,
151
+                value: Number((x.indexValue * 100).toFixed(2)),
152
+              })
153
+            } else {
154
+              manHourData.push({
155
+                name: x.factoryName,
156
+                value: Number((x.indexValue * 100).toFixed(2)),
157
+              })
158
+            }
157 159
           }
158 160
         });
159 161
         this.setState({ plannedCompletionData, manHourData, plannedCompletionNum: 1, manHourNum: 1 });
@@ -211,8 +213,8 @@ class Home extends Component {
211 213
       var res2 = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number shu1">' + datas_2?.value.toFixed(2) + '</span><span class="topMsg_number_2">%</span><p class="topMsg_number_p">' + datas_2.name + '</p></div>';
212 214
       p2.innerHTML = res2;
213 215
 
214
-      const num_ = plannedCompletionNum + 1 >= plannedCompletionData.length ? 1 : plannedCompletionNum + 1;
215
-      const num_2 = manHourNum + 1 >= manHourData.length ? 1 : manHourNum + 1;
216
+      const num_ = plannedCompletionNum + 1 > plannedCompletionData.length ? 1 : plannedCompletionNum + 1;
217
+      const num_2 = manHourNum + 1 > manHourData.length ? 1 : manHourNum + 1;
216 218
       this.setState({ plannedCompletionNum: num_, manHourNum: num_2 })
217 219
     }, 4000)
218 220
   }