Explorar o código

修复实时刷新时的台架高度;更新定时刷新时间

Jay hai 6 meses
pai
achega
7a32188406
Modificáronse 2 ficheiros con 44 adicións e 53 borrados
  1. 9 9
      src/uwb-sample.js
  2. 35 44
      src/views/ordinaryPage/index.vue

+ 9 - 9
src/uwb-sample.js

@@ -24,7 +24,7 @@ var fbxMesh2 = null;
 var fbxMesh3 = null;
 var fbxLoader1Loaded = false;
 var fbxLoader2Loaded = false;
-var fbxLoader3Loaded = false
+var fbxLoader3Loaded = false;
 
 var oldStatus = '';
 var oldBenchIds = '';
@@ -1150,8 +1150,8 @@ function benchRefresh(result) {
       }
 
       if (benchIdList.indexOf(Number(bench_id)) >= 0) {
-        console.log('移动原台架模型位置', bench_id)
-        window.benchMeshMap[bench_id].position.set(x, y + 10, z);
+        // console.log('移动原台架模型位置', bench_id)
+        window.benchMeshMap[bench_id].position.set(x, y, z);
       }
     }
   } else { // 台架变化,需移除原模型后重新添加新模型
@@ -1159,25 +1159,25 @@ function benchRefresh(result) {
     oldBenchIds = newBenchIds;
     // 请求到的新台架id
 
-    let new_bench_id_arr = []
+    let new_bench_id_arr = [];
     benchList.forEach(function (item) {
-      new_bench_id_arr.push(item.id)
-    })
+      new_bench_id_arr.push(item.id);
+    });
     // console.log('新台架id', new_bench_id_arr)
 
     // 旧存的台架id
-    let old_bench_id_arr = Object.keys(window.benchMeshMap); 
+    let old_bench_id_arr = Object.keys(window.benchMeshMap);
     // console.log('旧台架id', old_bench_id_arr)
 
     // 要移除的台架id
-    let remove_bench_id_arr = old_bench_id_arr.filter(item => !new_bench_id_arr.includes(item))
+    let remove_bench_id_arr = old_bench_id_arr.filter(item => !new_bench_id_arr.includes(item));
     // console.log('要移除的台架', remove_bench_id_arr)
 
     if (remove_bench_id_arr.length > 0) {
       // console.log('存在消失的台架,移除模型')
       for (var bench_id of remove_bench_id_arr) {
         let deleteChildMesh = window.benchMeshMap[bench_id];
-        window.sdkInstance.sceneRenderer.scene.remove(deleteChildMesh)
+        window.sdkInstance.sceneRenderer.scene.remove(deleteChildMesh);
         // deleteChildMesh.geometry.dispose(); // 清理几何体
         // deleteChildMesh.material.dispose(); // 清理材质
         deleteChildMesh = null; // 置空指向该3D模型的变量

+ 35 - 44
src/views/ordinaryPage/index.vue

@@ -950,42 +950,6 @@ export default {
       //   this.refreshBenchStatus(); // 更新台架各状态总台数
       // }, 1000);
     });
-
-
-    // 调用定时器方法,返回定时器id,用于按条件清空
-    that.timerId = that.myInterval((count) => {
-      this.$store.dispatch("benchList/fetchBenchList").then(() => {
-        // this.refreshBenchStatus();
-        // if (!this.waterdotrefresh) {
-        //   this.waterdotrefresh = true;
-        //   window.getsqlData(window.sdkInstance, window.uwbInstance,true)
-        // }
-        // setTimeout(() => { // 请求异步原因,强制2秒后执行
-        //   console.log("各状态台架数量刷新时间:", Date.now());
-        //   this.refreshBenchStatus(); // 更新台架各状态总台数
-        //   window.getsqlDataRealTime();
-        // }, 1000);
-
-        // 加载右侧台架照片
-        this.getImageName();
-        // 获取奥迪-各台架详情
-        this.benchList.forEach( (item, index) => {
-          this.$store.dispatch("benchList/getBenchDetail", item.id).then(() => {
-            // 获取全部台架信息后
-            if (this.benchList.length - 1 == index) {
-              // 更新台架各状态总台数
-              this.refreshBenchStatus();
-              // 更新水滴、台架模型
-              window.getsqlDataRealTime();
-            }
-          })
-        })
-
-        if (count > 30000) {
-          that.clearMyInterval(that.timerId);
-        }
-      });
-    }, 10000);
   },
 
   mounted() {
@@ -1035,14 +999,41 @@ export default {
       }
     }, 3000);
 
-    // that.timerId = that.myInterval((count) => {
-    //   this.$store.dispatch("benchList/fetchBenchList");
-    //   // window.getsqlDataRealTime(window.sdkInstance, window.uwbInstance,true);
-    //   this.refreshBenchStatus();
-    //   if (count > 30000) {
-    //     that.clearMyInterval(that.timerId);
-    //   }
-    // }, 10000);
+
+    // 调用定时器方法,返回定时器id,用于按条件清空
+    that.timerId = that.myInterval((count) => {
+      this.$store.dispatch("benchList/fetchBenchList").then(() => {
+        // this.refreshBenchStatus();
+        // if (!this.waterdotrefresh) {
+        //   this.waterdotrefresh = true;
+        //   window.getsqlData(window.sdkInstance, window.uwbInstance,true)
+        // }
+        // setTimeout(() => { // 请求异步原因,强制2秒后执行
+        //   console.log("各状态台架数量刷新时间:", Date.now());
+        //   this.refreshBenchStatus(); // 更新台架各状态总台数
+        //   window.getsqlDataRealTime();
+        // }, 1000);
+
+        // 加载右侧台架照片
+        this.getImageName();
+        // 获取奥迪-各台架详情
+        this.benchList.forEach( (item, index) => {
+          this.$store.dispatch("benchList/getBenchDetail", item.id).then(() => {
+            // 获取全部台架信息后
+            if (this.benchList.length - 1 == index) {
+              // 更新台架各状态总台数
+              this.refreshBenchStatus();
+              // 更新水滴、台架模型
+              window.getsqlDataRealTime();
+            }
+          })
+        })
+
+        if (count > 30000) {
+          that.clearMyInterval(that.timerId);
+        }
+      });
+    }, 10000);
 
     bus.on("newLog", (param) => {
       if (param.action) {