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

[Fix 0000] 采煤工作面无历史数据导致的报错

ruienger 1 месяц назад
Родитель
Сommit
505dec0256
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      src/views/vent/home/configurable/configurable.api.ts

+ 7 - 3
src/views/vent/home/configurable/configurable.api.ts

@@ -1,4 +1,4 @@
-import { floor, random, slice } from 'lodash-es';
+import { floor, isArray, random, slice } from 'lodash-es';
 import { defHttp } from '/@/utils/http/axios';
 import { get } from '../billboard/utils';
 
@@ -77,8 +77,12 @@ export const list = (params) => {
       // e.dengjikong_merge = floor((1.19 * (m3_merge / 60)) / Math.sqrt(drag_merge), 2);
     });
     res.sys_surface_caimei.forEach((e) => {
-      e.history = slice(e.history, e.history.length - 30, e.history.length);
-      e.history_report = slice(e.history_report, e.history_report.length - 30, e.history_report.length);
+      if (isArray(e.history)) {
+        e.history = slice(e.history, e.history.length - 30, e.history.length);
+      }
+      if (isArray(e.history_report)) {
+        e.history_report = slice(e.history_report, e.history_report.length - 30, e.history_report.length);
+      }
     });
     res.device_arr = Object.values(res.device);