Quellcode durchsuchen

[Fix 0000] 修复场景类历史组件获取表头时的错误

houzekong vor 9 Monaten
Ursprung
Commit
b1bc3ed629
1 geänderte Dateien mit 11 neuen und 1 gelöschten Zeilen
  1. 11 1
      src/views/vent/comment/history/HistoryTable.vue

+ 11 - 1
src/views/vent/comment/history/HistoryTable.vue

@@ -217,7 +217,17 @@
 
   onMounted(async () => {
     await fetchDevice();
-    initTable([deviceInfo.value.deviceType as string, props.columnsCode], deviceOptions.value, dictOptions.value);
+    // 生成所有需要查询的表头编码,例如 forcFan_auto 对应 forcFan_auto_history、forcFan_history 这两个
+    const codes: string[] = [];
+    if (deviceInfo.value.deviceType) {
+      const arr = (deviceInfo.value.deviceType as string).split('_');
+      while (arr.length) {
+        codes.push(arr.join('_').concat('_history'));
+        arr.pop();
+      }
+    }
+    // 如此,例如deviceType为forcFan_auto, 则查询表头按 forcFan_auto_history、forcFan_history、columnsCode 为顺序
+    initTable(codes.concat(props.columnsCode), deviceOptions.value, dictOptions.value);
     search();
   });
 </script>