Prechádzať zdrojové kódy

Merge branch 'master' of http://121.42.8.157:13000/zengminguo/D-MAP

leihao 1 rok pred
rodič
commit
524d7d6e26

+ 2 - 0
src/store/modules/case/index.js

@@ -9,7 +9,9 @@ export default {
       autoCaseList: [],
       caseList: [],
       autoTaskStatus: 'ready',
+      autoTaskStatusMap: {},
       planExecId: 0,
+      planExecIdMap: {},
       currentTaskIndex: 0
     };
   },

+ 1 - 1
src/store/modules/common/index.js

@@ -42,7 +42,7 @@ export default {
         label: ''
       }],
       isOpenSquare: false,
-      isOpen3d: true
+      isOpen3d: false
     };
   },
   mutations,

+ 117 - 70
src/uwb-sample.js

@@ -8,6 +8,7 @@ import { FXAAShader } from "../public/shader/FAAXShader.js"
 import '../public/libs/tools.js'
 
 // 定义一个函数,接受元素ID和一个回调函数作为参数,用于处理点击事件
+window.waterMap = {}
 
 function getsqlData(sdkInstance, uwbInstance) {
   let g_PosArrayResult = null;
@@ -40,6 +41,122 @@ function getsqlData(sdkInstance, uwbInstance) {
       var one_second_ago = new Date(now.getTime() - 1 * 1000).Format(
         "yyyy-MM-dd hh:mm:ss.S"
       );
+
+      {
+        let result = g_PosArrayResult;
+        for (var item of result) {
+          let x = item.x;
+          let y = item.y;
+          let z = item.z;
+          let ang_x = 0.0;
+          let ang_y = 0.0;
+          let ang_z = 0.0;
+          let benchType = item.bench_type
+          if (item.use_fix_pos == 1) {
+            x = JSON.parse(JSON.stringify(item.fix_pos_x));
+            y = JSON.parse(JSON.stringify(item.fix_pos_y));
+            z = JSON.parse(JSON.stringify(item.fix_pos_z));
+            ang_x = JSON.parse(JSON.stringify(item.fix_angle_x));
+            ang_y = JSON.parse(JSON.stringify(item.fix_angle_y));
+            ang_z = JSON.parse(JSON.stringify(item.fix_angle_z));
+          }
+          else {
+          }
+
+          var distance = 10000.0;
+
+          var xSubTmp = x;
+          var ySubTmp = y;
+          var zSubTmp = z;
+          var ang_xSubTmp = ang_x;
+          var ang_ySubTmp = ang_y;
+          var ang_zSubTmp = ang_z;
+
+          if (g_PosArrayResult) {
+            var iCount = 0;
+            for (var itemSub of g_PosArrayResult) {
+
+              iCount++;
+              var xSub = itemSub.x;
+              var ySub = itemSub.y;
+              var zSub = itemSub.z;
+              var ang_xSub = 0.0;
+              var ang_ySub = 0.0;
+              var ang_zSub = 0.0;
+              xSub = itemSub.fix_pos_x;
+              ySub = itemSub.fix_pos_y;
+              zSub = itemSub.fix_pos_z;
+              ang_xSub = itemSub.fix_angle_x;
+              ang_ySub = itemSub.fix_angle_y;
+              ang_zSub = itemSub.fix_angle_z;
+              var disTmp = Math.sqrt(Math.pow(x - xSub, 2) + Math.pow(y - ySub, 2) + Math.pow(z - zSub, 2))
+              if (disTmp < distance) {
+                distance = disTmp;
+                xSubTmp = xSub;
+                ySubTmp = ySub;
+                zSubTmp = zSub;
+                ang_xSubTmp = ang_xSub;
+                ang_ySubTmp = ang_ySub;
+                ang_zSubTmp = ang_zSub;
+              }
+            }
+          }
+
+
+          x = xSubTmp;
+          y = ySubTmp;
+          z = zSubTmp;
+          ang_x = ang_xSubTmp;
+          ang_y = ang_ySubTmp;
+          ang_z = ang_zSubTmp;
+          x = JSON.parse(JSON.stringify(xSubTmp));
+          y = JSON.parse(JSON.stringify(ySubTmp));
+          z = JSON.parse(JSON.stringify(zSubTmp));
+          ang_x = JSON.parse(JSON.stringify(ang_xSubTmp));
+          ang_y = JSON.parse(JSON.stringify(ang_ySubTmp));
+          ang_z = JSON.parse(JSON.stringify(ang_zSubTmp));
+
+          let card_id = item.card_id;
+          let bench_id = item.bench_id;
+          let show_remote_button = item.show_remote_button;
+          // 添加水滴
+          let benchList = window.store ? window.store.getters['benchList/getBenchList'] : [];
+          let currentBench = benchList.find(b => b.id == bench_id);
+          let texture = null;
+          if (currentBench) {
+            switch(currentBench.status) {
+              case "ready":
+                texture = textureReady;
+                break;
+              case "running":
+                texture = textureRunning;
+                break;
+              case "offline":
+                texture = textureOffline;
+                break;
+              default:
+                texture = textureOffline;
+                break;
+            }
+          } else {
+            texture = textureOffline;
+          }
+          
+
+          // 创建精灵对象
+          let spriteMaterial = new THREE.SpriteMaterial({
+            map: texture
+          });
+          let sprite = new THREE.Sprite(spriteMaterial);
+          sprite.userData = {};
+          // sprite.scale.set(100, 100, 1);
+          sprite.position.set(x, y + 10, z);
+          window.waterMap[bench_id] = sprite;
+          console.log('添加模型和水滴1111')
+          sdkInstance.sceneRenderer.scene.add(sprite)
+        };
+      }
+
       let dracoLoader = new THREE.DRACOLoader();
       THREE.DRACOLoader.setDecoderPath("../gltf/");
 
@@ -143,42 +260,8 @@ function getsqlData(sdkInstance, uwbInstance) {
             };
             childMeshTmp.userData = customData;
 
-            // 添加水滴
-            let benchList = window.store ? window.store.getters['benchList/getBenchList'] : [];
-            let currentBench = benchList.find(b => b.id == bench_id);
-            let texture = null;
-            if (currentBench) {
-              switch(currentBench.status) {
-                case "ready":
-                  texture = textureReady;
-                  break;
-                case "running":
-                  texture = textureRunning;
-                  break;
-                case "offline":
-                  texture = textureOffline;
-                  break;
-                default:
-                  texture = textureOffline;
-                  break;
-              }
-            } else {
-              texture = textureOffline;
-            }
-            
-
-            // 创建精灵对象
-            let spriteMaterial = new THREE.SpriteMaterial({
-              map: texture
-            });
-            let sprite = new THREE.Sprite(spriteMaterial);
-            sprite.userData = customData;
-            // sprite.scale.set(100, 100, 1);
-            sprite.position.set(x, y + 10, z);
-
             console.log('添加模型和水滴1111')
             sdkInstance.sceneRenderer.scene.add(childMeshTmp)
-            sdkInstance.sceneRenderer.scene.add(sprite)
           }
 
         };
@@ -282,43 +365,7 @@ function getsqlData(sdkInstance, uwbInstance) {
               benchFlag: true,
             };
             childMeshTmp.userData = customData;
-
-
-            // 添加水滴
-            // 加载图片纹理
-            let benchList = window.store ? window.store.getters['benchList/getBenchList'] : [];
-            let currentBench = benchList.find(b => b.id == bench_id);
-            let texture = null;
-            if (currentBench) {
-              switch(currentBench.status) {
-                case "ready":
-                  texture = textureReady;
-                  break;
-                case "running":
-                  texture = textureRunning;
-                  break;
-                case "offline":
-                  texture = textureOffline;
-                  break;
-                default:
-                  texture = textureOffline;
-                  break;
-              }
-            } else {
-              texture = textureOffline;
-            }
-
-            // 创建精灵对象
-            let spriteMaterial = new THREE.SpriteMaterial({
-              map: texture
-            });
-            let sprite = new THREE.Sprite(spriteMaterial);
-            // sprite.scale.set(100, 100, 1);
-            sprite.userData = customData;
-            sprite.position.set(x, y + 10, z);
-            console.log('添加模型和水滴2222')
             sdkInstance.sceneRenderer.scene.add(childMeshTmp)
-            sdkInstance.sceneRenderer.scene.add(sprite)
           }
         };
         if (!sessionStorage.getItem('3dMode') || sessionStorage.getItem('3dMode') == 0) {

+ 34 - 9
src/views/ordinaryPage/index.vue

@@ -854,7 +854,7 @@ export default {
     }),
   },
   created() {
-    uwbMain("player", window.innerWidth, window.innerHeight, "panorama");
+    // uwbMain("player", window.innerWidth, window.innerHeight, "panorama");
     ws.open().then((res) => {
       // console.log("res", res);
     });
@@ -909,7 +909,19 @@ export default {
     let style = getComputedStyle(mapDom);
     let width = parseFloat(style.width);
     let height = parseFloat(style.height);
-    // uwbMain('playersmall', width, height, "floorplan");
+    let ratio = 1.8;
+    window.renderWidth = width * ratio;
+    window.renderHeight = height * ratio;
+    sessionStorage.setItem('3dMode', 0)
+    uwbMain('playersmall', width * ratio, height * ratio, "floorplan");
+    
+    // window.sdkInstance.sceneRenderer.updateScreenSize(width * ratio, height * ratio);
+    setTimeout(() => {
+      var element = document.getElementById('house-player');
+      element.style.marginLeft = ((width - (width * ratio)) / 2) + 'px';
+      element.style.marginTop = ((height - (height * ratio)) / 2) + 'px';
+    }, 1000)
+
     setTimeout(() => {
       var readyCount = 0;
       var occupiedCount = 0;
@@ -2373,6 +2385,17 @@ export default {
     handleListClick(benchId, itemtype) {
       if (itemtype == 2) {
         return;
+      }
+      try{
+        for(let key in window.waterMap) {
+          if (key == benchId) {
+            window.waterMap[key].scale.set(1.3, 1.3, 1.3);
+          } else {
+            window.waterMap[key].scale.set(1, 1, 1);
+          }
+        }
+      } catch (e) {
+
       }
       console.log("benchId", benchId);
       let selectedBench = this.benchList.find((i) => i.benchId == benchId);
@@ -2406,10 +2429,7 @@ export default {
         //{
         //  element.style = "{background: rgba(0, 0, 0, 1)}"
         //});
-        if (
-          benchId == this.currentBench.id &&
-          this.currentBench.selected == true
-        ) {
+        if (benchId == this.currentBench.id &&this.currentBench.selected) {
           this.currentBench.selected = false;
           this.currentBench.scale = 1;
           this.currentBench = {};
@@ -2427,7 +2447,9 @@ export default {
           let itemOther = this.benchList.find(
             (b) => parseInt(b.id) == parseInt(title[0].textContent)
           );
-          itemOther.selected = false;
+          if (itemOther) {
+            itemOther.selected = false;
+          }
           if (parseInt(benchId) == parseInt(title[0].textContent)) {
             items[index].style.background = "#000000C0";
             this.currentBench = this.benchList.find((b) => b.id == benchId);
@@ -2598,8 +2620,11 @@ export default {
       var objRBL = JSON.parse(strRemoteBenchList);
       console.log("zmg1", objRBL);
       var objRBLReverse = [];
-      for (; objRBL.length > 0; ) {
-        objRBLReverse.push(objRBL.pop());
+      if(objRBL)
+      {
+        for (; objRBL.length > 0; ) {
+          objRBLReverse.push(objRBL.pop());
+        }
       }
       if (objRBLReverse.length > 0) {
         setTimeout(() => {