Bladeren bron

局部风机

hrx 2 jaren geleden
bovenliggende
commit
383f6f6843

+ 2 - 2
.env

@@ -8,10 +8,10 @@ VITE_GLOB_APP_TITLE = JeecgBoot 企业级低代码平台
 VITE_GLOB_APP_SHORT_NAME = JeecgBootAdmin
 
 # 单点登录服务端地址
-VITE_GLOB_APP_CAS_BASE_URL=http://cas.test.com:8443/cas
+VITE_GLOB_APP_CAS_BASE_URL=http://192.168.8.28:8443/cas
 
 # 是否开启单点登录
-VITE_GLOB_APP_OPEN_SSO = false
+VITE_GLOB_APP_OPEN_SSO=false
 
 # 开启微前端模式
 VITE_GLOB_APP_OPEN_QIANKUN=true

+ 0 - 16
.gitee/ISSUE_TEMPLATE.md

@@ -1,16 +0,0 @@
-##### 版本号:
-
-
-##### 问题描述:
-
-
-##### 截图&代码:
-
-
-
-
-#### 友情提示(为了提高issue处理效率):
-  - 未按格式要求发帖,会被直接删掉;
-  - 描述过于简单或模糊,导致无法分析处理的,会被直接删掉;
-  - 请自己初判问题描述是否清楚,是否方便我们调查处理;
-  

+ 1 - 2
README.md

@@ -1,3 +1,2 @@
 # VentAnaly_2.0_front
-
-智能通风系统v2.0前端代码仓库
+系统v2.0前端代码仓库

+ 3 - 9
index.html

@@ -4,17 +4,14 @@
     <meta charset="UTF-8" />
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
     <meta name="renderer" content="webkit" />
-    <meta
-      name="viewport"
-      content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
-    />
-
+    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" />
     <title><%= title %></title>
     <link rel="icon" href="/logo.png" />
     <!-- 全局配置 -->
     <script>
       window._CONFIG = {};
     </script>
+    <script src="/js/liveplayer-lib.min.js"></script>
   </head>
   <body>
     <script>
@@ -26,8 +23,6 @@
           theme = htmlRoot = null;
         }
       })();
-
-      
     </script>
     <div id="app">
       <style>
@@ -156,8 +151,6 @@
             opacity: 1;
           }
         }
-
-        
       </style>
       <div class="app-loading">
         <div class="app-loading-wrap">
@@ -170,5 +163,6 @@
       </div>
     </div>
     <script type="module" src="/src/main.ts"></script>
+    <script type="module" src="/src/utils/threejs/main.worker.ts"></script>
   </body>
 </html>

BIN
public/model/glft/jbfj/jbfj_hd.glb


+ 11 - 0
src/assets/less/modal.less

@@ -218,6 +218,7 @@
       -webkit-mask: linear-gradient(to left, red, transparent);
     }
   }
+
   .tabs-box {
     position: fixed;
     bottom: 0;
@@ -225,6 +226,16 @@
     pointer-events: auto;
     background-color: #ffffff11;
     backdrop-filter: blur(10px);
+    .tabs-button-group{
+      position: absolute;
+      display: flex;
+      right: 0;
+      top: 5px;
+      align-items: center;
+      .tabs-button{
+        margin-right: 10px;
+      }
+    }
     .tab-item {
       height: 240px;
       color: #fff;

+ 3 - 1
src/hooks/core/threejs/useThree.ts

@@ -173,7 +173,9 @@ class UseThree {
                     obj.material.emissiveIntensity = 1;
                     obj.material.emissiveMap = obj.material.map;
                     obj.material.blending = THREE.CustomBlending;
-
+                    if(obj.material.opacity < 1){
+                      obj.material.transparent = true;
+                    }
                     // if (obj.name !== 'buxiugangse') {
                     //   obj.receiveShadow = true;
                     // }

+ 3 - 1
src/utils/threejs/FlyLine1.ts

@@ -75,7 +75,9 @@ class Fly {
     });
     flyPointArr.forEach((point, index) => {
       posArr.push(...point);
-      scaleArr.push((index + 1) / this.length);
+      // scaleArr.push((index + 1) / this.length);
+      const scale = Math.random() * 1
+      scaleArr.push(scale)
     });
     // 更新几何体
     this.geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(posArr), 3));

+ 20 - 26
src/utils/threejs/util.ts

@@ -9,7 +9,7 @@ import gsap from 'gsap';
 import { onUpdated } from 'vue';
 // import * as dat from "dat.gui";
 
-let modal,
+let
   cubeList: THREE.Mesh[] = [],
   curve,
   line;
@@ -23,7 +23,7 @@ let modal,
 // 画点
 const addCube = (initialPoints, scene) => {
   return initialPoints.map((pos) => {
-    const geometry = new THREE.BoxBufferGeometry(1, 1, 1);
+    const geometry = new THREE.BoxGeometry(0.1, 0.1, 0.1);
     const material = new THREE.MeshBasicMaterial({
       color: 0xffffff,
       side: THREE.DoubleSide,
@@ -39,32 +39,27 @@ const addCube = (initialPoints, scene) => {
 };
 
 // 获取点击位置
-const addChangeEvent = () => {
+const addChangeEvent = (modal, cubeList) => {
   // debugger
   const control = new TransformControls(modal.camera, modal.renderer.domElement);
   // 获取点击位置
-  const mouse = new THREE.Vector2();
   window.addEventListener(
     'mousedown',
     (event) => {
       // debugger
-      mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
-      mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
-      // mouse.x = ((event.clientX - dom.offsetLeft) / dom.clientWidth) * 2 - 1; // dom.offsetLeft -- dom元素距离浏览器左侧的距离   dom.clientWidth -- dom元素宽度
-      // mouse.y = -((event.clientY - dom.offsetTop) / dom.clientHeight) * 2 + 1; // dom.offsetTop -- dom元素距离浏览器顶部的距离    dom.clientHeight -- dom元素高度
-      //根据照相机,把这个向量转换到视点坐标系
-      const vector = new THREE.Vector3(mouse.x, mouse.y, 0.5).unproject(modal.camera);
-
-      // 方块点击检测
-      // const rayCaster = new THREE.Raycaster();
-      //在视点坐标系中形成射线,射线的起点向量是照相机, 射线的方向向量是照相机到点击的点,这个向量应该归一标准化。
-      const rayCaster = new THREE.Raycaster(modal.camera.position, vector.sub(modal.camera.position).normalize());
+      modal.mouse.x = ((event.clientX - modal.canvasContainer.getBoundingClientRect().left) / modal.canvasContainer.clientWidth) * 2 - 1;
+      modal.mouse.y = -((event.clientY - modal.canvasContainer.getBoundingClientRect().top) / modal.canvasContainer.clientHeight) * 2 + 1;
+      (modal.rayCaster as THREE.Raycaster).setFromCamera(modal.mouse, modal.camera as THREE.Camera);
+      // 计算物体和射线的焦点
+      const intersects = modal.rayCaster?.intersectObjects(cubeList) as THREE.Intersection[];
       // rayCaster.setFromCamera(mouse, modal.camera);
-      const intersects = rayCaster.intersectObjects(cubeList);
       if (intersects.length) {
+        modal.orbitControls.enabled = false
         const target = intersects[0].object;
         control.attach(target); // 绑定controls和方块
         modal.scene.add(control);
+      }else {
+        modal.orbitControls.enabled = true
       }
     },
     false
@@ -82,21 +77,20 @@ const addChangeEvent = () => {
 };
 
 // 画线
-export const drawLine = (initialPoints, obj) => {
-  modal = obj;
-  addCube(initialPoints, modal.scene);
+export const drawLine = (initialPoints, modal, group) => {
+  addCube(initialPoints, group);
   curve = new THREE.CatmullRomCurve3(
     cubeList.map((cube) => cube.position) // 直接绑定方块的position以便后续用方块调整曲线
   );
-  curve.curveType = 'chordal'; // 曲线类型
-  curve.closed = false; // 曲线是否闭合
+  curve.curveType = "chordal";
+  curve.closed = false;
 
-  const points = curve.getPoints(50); // 50等分获取曲线点数组
-  line = new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(points), new THREE.LineBasicMaterial({ color: 0xffffff, linewidth: 10 })); // 绘制实体线条,仅用于示意曲线,后面的向量线条同理,相关代码就省略了
+  const points = curve.getPoints(10); // 50等分获取曲线点数组
+  line = new THREE.Line(new THREE.BufferGeometry().setFromPoints(points), new THREE.LineBasicMaterial({ color: 0xffffff, linewidth: 10 })); // 绘制实体线条,仅用于示意曲线,后面的向量线条同理,相关代码就省略了
+  line.name = 'runPath'
+  group.add(line);
 
-  modal.scene.add(line);
-
-  addChangeEvent();
+  addChangeEvent(modal, cubeList);
 };
 
 /* 设置模型居中 */

+ 66 - 23
src/views/vent/monitorManager/fanLocalMonitor/fanLocal.three.ts

@@ -1,13 +1,15 @@
 import * as THREE from 'three';
-import { animateCamera, getTextCanvas, renderVideo } from '/@/utils/threejs/util';
+import { animateCamera, getTextCanvas, renderVideo, drawLine } from '/@/utils/threejs/util';
 import UseThree from '../../../../hooks/core/threejs/useThree';
 import Fly from '/@/utils/threejs/FlyLine1';
 import fcFan from './fcfanLocal.three';
 import fmFan from './fmfanLocal.three';
+import { types } from "util";
+import num from "/@/views/demo/charts/Num.vue";
 
 const modelName = 'jbfj_hd';
 // 模型对象、 文字对象
-let model, group, fcFanObj, fmFanObj, player1, fanType;
+let model, group, fcFanObj, fmFanObj, player1, fanType, flyArr = [];
 
 // 打灯光
 const addLight = (scene) => {
@@ -210,29 +212,52 @@ export const addFmText = (selectData) => {
 
 const setFly = () => {
   // 路径
-  const points = [];
   const curve = new THREE.CatmullRomCurve3([
-    new THREE.Vector3(-400, 10, 0),
-    new THREE.Vector3(-50, 10, 150),
-    new THREE.Vector3(50, 10, -50),
-    new THREE.Vector3(300, 10, 150),
-    new THREE.Vector3(350, 10, 150),
-    new THREE.Vector3(500, 150, 0),
-    new THREE.Vector3(600, 0, 0),
+    // new THREE.Vector3(-90.860, 2.380, 4.854),
+    new THREE.Vector3(-88.020, 2.360, 3.70),
+    new THREE.Vector3(-85.872, 2.352, 3.672),
+    new THREE.Vector3(-85.652, 2.342, 3.442),
+    new THREE.Vector3(-85.669, 2.353, -0.002),
+    new THREE.Vector3(-85.690, 2.367, -3.824),
+    new THREE.Vector3(-85.650, 2.217, -4.154),
+    new THREE.Vector3(-85.680, 1.067, -5.674),
+    new THREE.Vector3(-85.680, 0.947, -6.024),
+    new THREE.Vector3(-85.680, 0.947, -12.894),
+    new THREE.Vector3(-85.450, 0.947, -12.894),
+    new THREE.Vector3(85.000, 0.920, -12.910)
   ]);
+
   // 采样
-  curve.getSpacedPoints(500).forEach((point) => {
-    const { x, y, z } = point;
-    points.push([x, y, z]);
-  });
-  const length = 50;
-  const circle = 10;
-  const color = '#ee0000';
-  const opacity = 1;
-  const size = 15;
-  const fly = new Fly(points, length, circle, color, opacity, size);
-  fly.move();
-  model.scene.add(fly.obj);
+  for(let i = 0; i < 80; i++){
+    setTimeout(() => {
+      const points: any = [];
+      const mvPosition = {
+        'x' : (Math.random() * 2 - 1) * 0.01,
+        'y' : (Math.random() * 2 - 1) * 0.01,
+        'z' : (Math.random() * 2 - 1) * 0.01,
+      }
+      curve.getSpacedPoints(500).forEach((point) => {
+        const { x, y, z } = point;
+        // points.push([x + mvPosition.x, y + mvPosition.y, z + mvPosition.z]);
+        points.push([x, y, z]);
+      });
+      const length = 50;
+      const circle = i * 2 + 8;
+      const color = '#ffffff';
+      const opacity = 0.3;
+      const size = 3;
+      const fly = new Fly(points, length, circle, color, opacity, size);
+      fly.move();
+      group.add(fly.obj);
+      flyArr.push(fly)
+    }, i * 500)
+  }
+
+  const stopFly = () => {
+    flyArr.forEach((fly) => {
+      fly.stop()
+    })
+  }
 
   // 路径轨迹
   const material = new THREE.LineBasicMaterial({
@@ -243,6 +268,7 @@ const setFly = () => {
   model.scene.add(line);
 };
 
+
 export const mountedThree = (playerVal1) => {
   player1 = playerVal1;
   return new Promise((resolve) => {
@@ -275,7 +301,6 @@ export const mountedThree = (playerVal1) => {
 
       model.animate();
       setFly();
-      debugger
       const videoPlayer1 = document.getElementById('jb-player1')?.getElementsByClassName('vjs-tech')[0];
       if (videoPlayer1) {
         const mesh = renderVideo(group, videoPlayer1, 'player1');
@@ -284,6 +309,24 @@ export const mountedThree = (playerVal1) => {
         mesh.rotation.y = -Math.PI/2
         group.add(mesh)
       }
+
+      // const curve = new THREE.CatmullRomCurve3([
+      //   new THREE.Vector3(-90.860, 2.380, 25.854),
+      //   new THREE.Vector3(-91.020, 2.360, 4.220),
+      //   new THREE.Vector3(-85.872, 2.352, 3.672),
+      //   new THREE.Vector3(-85.652, 2.342, 3.442),
+      //   new THREE.Vector3(-85.669, 2.353, -0.002),
+      //   new THREE.Vector3(-85.690, 2.367, -3.824),
+      //   new THREE.Vector3(-85.650, 2.217, -4.154),
+      //   new THREE.Vector3(-85.680, 1.067, -5.674),
+      //   new THREE.Vector3(-85.680, 0.947, -6.024),
+      //   new THREE.Vector3(-85.680, 0.947, -12.894),
+      //   new THREE.Vector3(-85.450, 0.947, -12.894),
+      //   new THREE.Vector3(85.000, 0.920, -12.910)
+      //   // new THREE.Vector3(76, 28, 27),
+      // ]);
+      //
+      // drawLine(curve.getPoints(10), model, group)
       resolve(model);
     });
   });

+ 14 - 1
src/views/vent/monitorManager/fanLocalMonitor/index.vue

@@ -65,6 +65,9 @@
   import '/@/assets/less/modal.less';
   import {
     onBeforeMount,
+    onBeforeUpdate,
+    onUpdated,
+    onBeforeUnmount,
     computed,
     ref,
     onMounted,
@@ -181,13 +184,23 @@
     loading.value = true;
     mountedThree(player1).then(() => {
       nextTick(() => {
-        setModelType('fm')
+        setModelType('fc')
         loading.value = false;
         getMonitor();
         // addFmText(selectData);
       });
     });
+    console.log('onMounted');
   });
+  onBeforeUpdate(() => {
+    console.log('onBeforeUpdate');
+  })
+  onUpdated(() => {
+    console.log('onUpdated');
+  })
+  onBeforeUnmount(() => {
+    console.log('onBeforeUnmount');
+  })
   onUnmounted(() => {
     destroy();
     if(timer) {

+ 5 - 1
src/views/vent/monitorManager/windrectMonitor/index.vue

@@ -19,7 +19,6 @@
     <div class="top-box">
       <div class="top-left row"> 井下测风装置集中管理 </div>
       <div class="top-center row">
-        <div class="button-box" @click="start(1)">一键测风</div>
         <div class="button-box" @click="start(0)">复位</div>
         <div class="button-box" @click="testPlay()">自测动画</div>
         <div class="button-box" @click="testPlay('up')">上</div>
@@ -51,6 +50,10 @@
     </div>
     <div class="title-box"> 2-2煤主辅三联巷自动风窗 </div>
     <div class="tabs-box">
+      <div class="tabs-button-group">
+        <a-button class="tabs-button" type="primary" @click="start(1)">一键测风</a-button>
+        <a-button class="tabs-button" type="primary">导出报表</a-button>
+      </div>
       <a-tabs v-model:activeKey="activeKey" @change="tabChange">
         <a-tab-pane key="1" tab="实时监测">
           <MonitorTable columnsType="windrect_monitor" :dataSource="dataSource" design-scope="windrect-monitor" @selectRow="getSelectRow" title="测风装置监测" />
@@ -76,6 +79,7 @@
     <LivePlayer id="cf-player1" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
     <LivePlayer id="cf-player2" ref="player2" :videoUrl="flvURL1()" muted live loading controls style="margin-top: 10px"/>
   </div>
+
 </template>
 
 <script setup lang="ts">