wenhongquan преди 2 години
родител
ревизия
74e472aba2
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      ruoyi-ui-vue3/src/views/device/sensordash/index.vue

+ 10 - 1
ruoyi-ui-vue3/src/views/device/sensordash/index.vue

@@ -539,7 +539,16 @@ const isloading = ref(false);
 watchEffect(()=>{
   if(currentsensor.value && useWSStore().getMessage()[currentsensor.value.id]  && useWSStore().getMessage()[currentsensor.value.id][currentname.value] ){
     let data = useWSStore().getMessage()[currentsensor.value.id][currentname.value];
-    historytabledata.value.push([moment(data.time).toDate(),data.value]);
+    var isadd = false;
+    historytabledata.value.forEach(i=>{
+      if(moment(data.time).utc()-moment(i[0]).utc()>10){
+        isadd = true;
+      }
+    })
+    if(isadd){
+      historytabledata.value.push([moment(data.time).toDate(),data.value]);
+    }
+
   }
   if(historytabledata.value.length>0){
     const usedmemoryInstance = echarts.init(chartlinediv.value, "macarons");