ソースを参照

fix: 空指针

@dayan_hjm 2 年 前
コミット
23870a291c
共有2 個のファイルを変更した20 個の追加17 個の削除を含む
  1. 2 2
      src/pages/tqcDataVHome/component/bottomLineForSend.jsx
  2. 18 15
      src/pages/tqcDataVHome/view.jsx

+ 2 - 2
src/pages/tqcDataVHome/component/bottomLineForSend.jsx

@@ -90,11 +90,11 @@ class BottomLineForSend extends Component {
90 90
 
91 91
         xAxis: [{
92 92
           type: 'category',
93
-          boundaryGap: false,
93
+          // boundaryGap: ['20%', '20%'],
94 94
           axisLabel: {
95 95
             textStyle: {
96 96
                 color: '#7d7d7d',
97
-                fontSize: 12
97
+                fontSize: 11
98 98
             },
99 99
             showMaxLabel: true,//关键部分,显示最后一个label
100 100
           },

+ 18 - 15
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-12-19 15:47:39
5
+ * @Last Modified time: 2024-01-02 10:42:01
6 6
  */
7 7
 /*
8 8
  * @Author: dayan_hjm 
@@ -30,7 +30,7 @@ import {
30 30
   checkToken,
31 31
   updateTimeService
32 32
 } from "./api";
33
-import { getThousandNum,deleteCacheAndChangeUrl } from "@utils/util";
33
+import { getThousandNum, deleteCacheAndChangeUrl } from "@utils/util";
34 34
 import {
35 35
   fullscreen,
36 36
 } from "@ant-design/icons";
@@ -213,23 +213,26 @@ class Home extends Component {
213 213
       //产量计划完成率
214 214
       var p1 = document.getElementById('plannedCompletionBox');
215 215
       const datas_ = plannedCompletionData[plannedCompletionNum - 1];
216
-      var res;
217
-      if (type) {
218
-        res = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number">' + getThousandNum(datas_?.value.toFixed(2)) + '</span><span class="topMsg_number_2" style={{fontSize: "0.75em",color: "#fff"}}>%</span><p class="topMsg_number_p">' + datas_.name + '</p></div>';
219
-      } else {
220
-        res = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number shu1">' + datas_?.value.toFixed(2) + '</span><span class="topMsg_number_2" style={{fontSize: "0.75em",color: "#fff"}}>%</span><p class="topMsg_number_p">' + datas_.name + '</p></div>';
216
+      var res = "";
217
+      if (datas_) {
218
+        if (type) {
219
+          res = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number">' + getThousandNum(datas_?.value.toFixed(2)) + '</span><span class="topMsg_number_2" style={{fontSize: "0.75em",color: "#fff"}}>%</span><p class="topMsg_number_p">' + datas_?.name + '</p></div>';
220
+        } else {
221
+          res = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number shu1">' + datas_?.value.toFixed(2) + '</span><span class="topMsg_number_2" style={{fontSize: "0.75em",color: "#fff"}}>%</span><p class="topMsg_number_p">' + datas_?.name + '</p></div>';
222
+        }
221 223
       }
222 224
       p1.innerHTML = res;
223 225
 
224 226
       //百万工时损工率
225 227
       var p2 = document.getElementById('manHourBox');
226 228
       const datas_2 = manHourData[manHourNum - 1];
227
-      var res2;
228
-
229
-      if (type) {
230
-        res2 = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number">' + getThousandNum(datas_2?.value.toFixed(2)) + '</span><p class="topMsg_number_p">' + datas_2.name + '</p></div>';//<span class="topMsg_number_2">%</span>
231
-      } else {
232
-        res2 = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number shu1">' + datas_2?.value.toFixed(2) + '</span><p class="topMsg_number_p">' + datas_2.name + '</p></div>';
229
+      var res2 = "";
230
+      if (datas_2) {
231
+        if (type) {
232
+          res2 = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number">' + getThousandNum(datas_2?.value.toFixed(2)) + '</span><p class="topMsg_number_p">' + datas_2?.name + '</p></div>';//<span class="topMsg_number_2">%</span>
233
+        } else {
234
+          res2 = '<div class="topMsg_box animate__animated animate__zoomIn"><span class="topMsg_number shu1">' + datas_2?.value.toFixed(2) + '</span><p class="topMsg_number_p">' + datas_2?.name + '</p></div>';
235
+        }
233 236
       }
234 237
       p2.innerHTML = res2;
235 238
 
@@ -248,14 +251,14 @@ class Home extends Component {
248 251
         {/* 右键切换大屏 */}
249 252
         <Tooltip placement="bottom" title={"产供销价值链"}>
250 253
           <img src={require("@assets/imgs/iconJpg/rightJ.png").default} alt="" className={"rightJ_png"} onClick={() => {
251
-            deleteCacheAndChangeUrl("/home/gvc",(url)=>{
254
+            deleteCacheAndChangeUrl("/home/gvc", (url) => {
252 255
               this.props.history.replace(url);
253 256
             })
254 257
           }} />
255 258
         </Tooltip>
256 259
         <Tooltip placement="bottom" title={"产供销价值链"}>
257 260
           <img src={require("@assets/imgs/iconJpg/rightJL.png").default} alt="" className={"rightJ_png rightJ_png_L"} onClick={() => {
258
-            deleteCacheAndChangeUrl("/home/gvc",(url)=>{
261
+            deleteCacheAndChangeUrl("/home/gvc", (url) => {
259 262
               this.props.history.replace(url);
260 263
             })
261 264
           }} />