Browse Source

[Mod 0000] 解决冲突

hongrunxia 1 month ago
parent
commit
ab8f3c32e4

+ 28 - 0
src/views/vent/monitorManager/balancePressMonitor/balancePress.threejs.ts

@@ -1,11 +1,13 @@
 import UseThree from '../../../../utils/threejs/useThree';
 import balancePressBase from './balancePress.threejs.base';
+import balancePressTun from './balancePress.threejs.tun';
 import { animateCamera } from '/@/utils/threejs/util';
 import useEvent from '../../../../utils/threejs/useEvent';
 
 // 模型对象、 文字对象
 let model,
   balancePressBaseObj: balancePressBase | undefined,
+  balancePressTunObj: balancePressTun | undefined,
   group: THREE.Object3D | undefined,
   balancePressType = 'balancePressBase'; // workerFaceFiber
 
@@ -47,11 +49,14 @@ export const play = (controlType, deviceType, frequency, state, duration?) => {
 export const updateText = (selectData) => {
   if (balancePressType === 'balancePressBase') {
     return balancePressBaseObj?.addText.call(balancePressBaseObj, selectData);
+  } else if (balancePressType === 'balancePressTun') {
+    return balancePressTunObj?.addText.call(balancePressTunObj, selectData);
   }
 };
 
 // 切换模型类型
 export const setModelType = (type) => {
+  debugger;
   balancePressType = type;
   return new Promise((resolve) => {
     if (balancePressType === 'balancePressBase' && balancePressBaseObj && balancePressBaseObj.group) {
@@ -72,6 +77,24 @@ export const setModelType = (type) => {
       }
 
       resolve(null);
+    } else if (balancePressType === 'balancePressTun' && balancePressTunObj && balancePressTunObj.group) {
+      group = balancePressTunObj.group;
+      if (group) {
+        const oldCameraPosition = { x: 27.9165, y: 17.3763, z: 51.3388 };
+        setTimeout(async () => {
+          model.scene.add(balancePressTunObj?.group);
+          await animateCamera(
+            oldCameraPosition,
+            { x: 3.9025, y: 0.7782, z: 6.6307 },
+            { x: 1.4763946591400468, y: 28.41203761378685, z: 14.142784066252352 },
+            { x: 1.334507975656787, y: 1.6848765189635717, z: -1.5733583795572064 },
+            model,
+            0.8
+          );
+        }, 300);
+      }
+
+      resolve(null);
     }
   });
 };
@@ -84,6 +107,9 @@ export const mountedThree = () => {
     balancePressBaseObj = new balancePressBase(model);
     await balancePressBaseObj.mountedThree();
 
+    balancePressTunObj = new balancePressTun(model);
+    await balancePressTunObj.mountedThree();
+
     addMouseEvent();
     model.animate();
     resolve(null);
@@ -96,6 +122,8 @@ export const destroy = () => {
     console.log('场景销毁前信息----------->', model.renderer?.info);
     balancePressBaseObj?.destroy();
     balancePressBaseObj = undefined;
+    balancePressTunObj?.destroy();
+    balancePressTunObj = undefined;
     group = undefined;
     model.destroy();
     model = undefined;

+ 10 - 8
src/views/vent/monitorManager/balancePressMonitor/components/balancePressHome.vue

@@ -42,7 +42,7 @@
           </ventBox1>
         </div>
       </div>
-      <div class="lr right-box ml-auto">
+      <!-- <div class="lr right-box ml-auto">
         <div class="item-box sensor-container">
           <ventBox1 class="">
             <template #title>
@@ -67,12 +67,13 @@
             </template>
           </ventBox1>
         </div>
-      </div>
+      </div> -->
       <div class="lr right-box ml-5px">
         <div class="item-box sensor-container">
           <ventBox1>
             <template #title>
-              <div>CO与O2监测</div>
+              <!-- <div>CO与O2监测</div> -->
+              <div>传感器/安全监控监测</div>
             </template>
             <template #container>
               <div class="overflow-y-auto max-h-300px">
@@ -96,7 +97,7 @@
               <div>设备监测详情</div>
             </template>
             <template #container>
-              <div class="overflow-y-auto max-h-500px">
+              <div class="overflow-y-auto max-h-400px">
                 <template v-for="monitor in windowMonitorData" :key="monitor.deviceId">
                   <div class="parameter-title group-parameter-title"
                     ><SvgIcon class="icon" size="14" name="fiber-title" />
@@ -200,7 +201,7 @@
     windowMonitorData.value = [];
     windrectMonitorData.value = [];
     result.forEach((item) => {
-      if (item.type.startsWith('safetymonitor')) {
+      if (item.type.startsWith('safetymonitor') || item.type.startsWith('avgpressure_lowoxygen')) {
         safetyMonitorData.value.push(...item.datalist);
       }
       if (item.type.startsWith('fanlocal')) {
@@ -246,8 +247,9 @@
         setModelType('balancePressBase');
       }
       loading.value = true;
-    }
-  );
+  //     loading.value = true;
+  //   }
+  // );
 
   const formData = ref({
     coMaxStart: 0,
@@ -270,7 +272,7 @@
   onMounted(() => {
     loading.value = true;
     mountedThree().then(async () => {
-      await setModelType('balancePressBase');
+      await setModelType('balancePressTun'); //balancePressBase
       loading.value = false;
       timer = null;
       await initParamList()