Jelajahi Sumber

[Feat 0000] 主风机添加天窗监测、控制功能以及动画

hongrunxia 1 Minggu lalu
induk
melakukan
4559cf7152

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "jeecgboot-vue3",
   "version": "6.0.0",
-  "projectVersion": "6.0.0.1",
+  "projectVersion": "6.0.1.0",
   "author": {
     "name": "jeecg",
     "email": "jeecgos@163.com",

+ 8 - 5
src/views/system/user/user.data.ts

@@ -26,11 +26,14 @@ export const columns: BasicColumn[] = [
     dataIndex: 'userRoles',
     width: 100,
     customRender: ({ value }) => {
-      const nameList = [];
-      value.forEach((item) => {
-        nameList.push(item['roleName']);
-      });
-      return nameList.toString();
+      if (value) {
+        const nameList = [];
+        value.forEach((item) => {
+          nameList.push(item['roleName']);
+        });
+        return nameList.toString();
+      }
+      return '';
     },
   },
   {

+ 13 - 0
src/views/vent/monitorManager/mainFanMonitor/index.vue

@@ -589,6 +589,18 @@
         <div class="label">{{ setValPoint['valuename'] }}:</div>
         <a-input-number v-model:value="setValPoint['value']" style="width: 150px" />
       </div>
+      <div class="" v-if="modalType == 'tckz'">
+        <div class="vent-flex-row btn-box vent-margin-t-20">
+          <div>
+            <span class="btn btn1" @click="handleOk('openWindow1_ctr')">1#天窗打开</span>
+            <span class="btn btn1" @click="handleOk('closeWindow1_ctr')">1#天窗关闭</span>
+          </div>
+          <div>
+            <span class="btn btn2" @click="handleOk('openWindow2_ctr')">2#天窗打开</span>
+            <span class="btn btn2" @click="handleOk('closeWindow2_ctr')">2#天窗打开</span>
+          </div>
+        </div>
+      </div>
     </div>
   </a-modal>
   <a-modal
@@ -1041,6 +1053,7 @@
             }
 
             addText();
+
             playAnimate(selectData);
             modelRef.value?.animate?.(selectData);
           }

+ 5 - 0
src/views/vent/monitorManager/mainFanMonitor/main.data.ts

@@ -428,6 +428,11 @@ export const modalTypeArr = {
       value: '终止操作',
       permission: 'fan:zzcz',
     },
+    {
+      key: 'tckz',
+      value: '天窗控制',
+      permission: 'fan:tckz',
+    },
   ],
 };
 

+ 67 - 9
src/views/vent/monitorManager/mainFanMonitor/main.threejs.ts

@@ -407,7 +407,12 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('back', 'open', 'tubPositivePath', selectData.Fan2FreqHz, duration);
-          await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          // await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          if (selectData['Fan2OpenWindow'] == 1 && selectData['Fan2CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('back', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          }
         } else if (selectData.Fan2FreqReverseRun == 1 && selectData.Fan2FreqForwardRun == 0) {
           // 主风机反转
           if (mainObj['airJin1'] && !mainObj['airJin1'].visible) {
@@ -417,7 +422,12 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('back', 'open', 'tubInversePath', selectData.Fan2FreqHz, duration);
-          await mainObj.setSmokeDirection('back', 'tubInversePath');
+          // await mainObj.setSmokeDirection('back', 'tubInversePath');
+          if (selectData['Fan1OpenWindow'] == 1 && selectData['Fan1CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('back', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('back', 'tubInversePath');
+          }
         } else {
           if (mainObj['airChu1'] && !mainObj['airChu1'].visible) {
             mainObj['airJin1'].visible = false;
@@ -426,7 +436,12 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('back', 'open', 'tubPositivePath', selectData.Fan2FreqHz, duration);
-          await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          // await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          if (selectData['Fan2OpenWindow'] == 1 && selectData['Fan2CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('back', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          }
         }
 
         if (!mainObj?.backSmoke?.frameId) mainObj?.backSmoke?.startSmoke(duration);
@@ -452,7 +467,11 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = true;
           }
           mainObj.startGearAnimation('front', 'open', 'tubPositivePath', selectData.Fan2FreqHz, duration);
-          await mainObj.setSmokeDirection('front', 'tubPositivePath');
+          if (selectData['Fan2OpenWindow'] == 1 && selectData['Fan2CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('front', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('front', 'tubPositivePath');
+          }
         } else if (selectData.Fan2FreqReverseRun == 1 && selectData.Fan2FreqForwardRun == 0) {
           // 主风机反转
           if (mainObj['airJin2'] && !mainObj['airJin2'].visible) {
@@ -462,7 +481,11 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('front', 'open', 'tubInversePath', selectData.Fan2FreqHz, duration);
-          await mainObj.setSmokeDirection('front', 'tubInversePath');
+          if (selectData['Fan1OpenWindow'] == 1 && selectData['Fan1CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('front', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('front', 'tubInversePath');
+          }
         } else {
           // 默认主风机正转
           if (mainObj['airChu2'] && !mainObj['airChu2'].visible) {
@@ -472,7 +495,11 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = true;
           }
           mainObj.startGearAnimation('front', 'open', 'tubPositivePath', selectData.Fan2FreqHz, duration);
-          await mainObj.setSmokeDirection('front', 'tubPositivePath');
+          if (selectData['Fan2OpenWindow'] == 1 && selectData['Fan2CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('front', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('front', 'tubPositivePath');
+          }
         }
 
         if (!mainObj?.frontSmoke?.frameId) mainObj?.frontSmoke?.startSmoke(duration);
@@ -496,7 +523,12 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('back', 'open', 'tubPositivePath', selectData.Fan1FreqHz, duration);
-          await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          // await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          if (selectData['Fan1OpenWindow'] == 1 && selectData['Fan1CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('back', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          }
         } else if (selectData.Fan1FreqReverseRun == 1 && selectData.Fan1FreqForwardRun == 0) {
           // 主风机反转
           if (mainObj['airJin1'] && !mainObj['airJin1'].visible) {
@@ -506,7 +538,12 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('back', 'open', 'tubInversePath', selectData.Fan1FreqHz, duration);
-          await mainObj.setSmokeDirection('back', 'tubInversePath');
+          // await mainObj.setSmokeDirection('back', 'tubInversePath');
+          if (selectData['Fan1OpenWindow'] == 1 && selectData['Fan1CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('back', 'windowInversePath');
+          } else {
+            await mainObj.setSmokeDirection('back', 'tubInversePath');
+          }
         } else {
           if (mainObj['airChu1'] && !mainObj['airChu1'].visible) {
             mainObj['airJin1'].visible = false;
@@ -515,7 +552,12 @@ export const playAnimate = async (selectData, duration?) => {
             mainObj['airChu2'].visible = false;
           }
           mainObj.startGearAnimation('back', 'open', 'tubPositivePath', selectData.Fan1FreqHz, duration);
-          await mainObj.setSmokeDirection('back', 'tubPositivePath');
+
+          if (selectData['Fan1OpenWindow'] == 1 && selectData['Fan1CloseWindow'] == 0) {
+            await mainObj.setSmokeDirection('back', 'windowPositivePath');
+          } else {
+            await mainObj.setSmokeDirection('back', 'tubPositivePath');
+          }
         }
 
         if (!mainObj?.backSmoke?.frameId) mainObj?.backSmoke?.startSmoke(duration);
@@ -523,6 +565,22 @@ export const playAnimate = async (selectData, duration?) => {
         // 主风机停止
         mainObj.closeDevice('back');
       }
+      if (mainObj && modalType.includes('mainWindRect')) {
+        if (selectData['Fan1OpenWindow'] == 1 && selectData['Fan1CloseWindow'] == 0) {
+          // 打开天窗1
+          mainObj.openOrCloseWindow('back', 'openWindow');
+        } else {
+          // 关闭天窗1
+          mainObj.openOrCloseWindow('back', 'closeWindow');
+        }
+        if (selectData['Fan2OpenWindow'] == 1 && selectData['Fan2CloseWindow'] == 0) {
+          // 打开天窗1
+          mainObj.openOrCloseWindow('front', 'openWindow');
+        } else {
+          // 关闭天窗1
+          mainObj.openOrCloseWindow('front', 'closeWindow');
+        }
+      }
     }
 
     // 防爆门动画

+ 40 - 40
src/views/vent/monitorManager/mainFanMonitor/mainWind.threejs.ts

@@ -38,8 +38,8 @@ class mainWindRect {
   backSmoke: Smoke | null = null; // 后面风流对象
   player1; // 视频播放器
   playerStartClickTime1 = new Date().getTime();
-  frontWindowGroup;
-  backWindowGroup;
+  frontWindowMeshList: THREE.Mesh[] = [];
+  backWindowMeshList: THREE.Mesh[] = [];
   windowAngle = 0;
   fbmAnimationClip: THREE.AnimationClip | null = null;
   fbmMixers: THREE.AnimationMixer | null = null;
@@ -243,8 +243,8 @@ class mainWindRect {
     const pathPoints: THREE.Vector3[] = [];
     const windowPositivePath = [
       {
-        path0: new THREE.Vector3(4.441, 20.267, 3.614),
-        path1: new THREE.Vector3(5.041, 6.806, 3.614),
+        path0: new THREE.Vector3(3.441, 20.267, 3.614),
+        path1: new THREE.Vector3(4.041, 6.806, 3.614),
         isSpread: true,
         spreadDirection: -1, //
       },
@@ -256,26 +256,26 @@ class mainWindRect {
       },
       {
         path0: new THREE.Vector3(41.583, 1.485, 3.614),
-        path1: new THREE.Vector3(42.741, 5.364, 3.614),
+        path1: new THREE.Vector3(45.741, 5.364, 3.614),
         isSpread: false,
         spreadDirection: 0,
       },
       {
-        path0: new THREE.Vector3(42.741, 5.364, 3.614),
-        path1: new THREE.Vector3(44.741, 17.267, 3.614),
+        path0: new THREE.Vector3(45.741, 5.364, 3.614),
+        path1: new THREE.Vector3(46.741, 17.267, 3.614),
         isSpread: true,
         spreadDirection: 1, // 1是由小变大(出),-1是由大变小(进)
       },
     ];
     const windowInversePath = [
       {
-        path0: new THREE.Vector3(44.741, 17.267, 3.614),
-        path1: new THREE.Vector3(42.741, 5.364, 3.614),
+        path0: new THREE.Vector3(46.741, 17.267, 3.614),
+        path1: new THREE.Vector3(45.741, 5.364, 3.614),
         isSpread: true,
         spreadDirection: -1, //
       },
       {
-        path0: new THREE.Vector3(42.741, 5.364, 3.614),
+        path0: new THREE.Vector3(45.741, 5.364, 3.614),
         path1: new THREE.Vector3(41.583, 1.485, 3.614),
         isSpread: false,
         spreadDirection: 0, //
@@ -287,8 +287,8 @@ class mainWindRect {
         spreadDirection: 0, // 1是由小变大,-1是由大变小
       },
       {
-        path0: new THREE.Vector3(4.441, 17.267, 3.614),
-        path1: new THREE.Vector3(5.041, 6.806, 3.614),
+        path0: new THREE.Vector3(4.041, 6.806, 3.614),
+        path1: new THREE.Vector3(3.441, 20.267, 3.614),
         isSpread: true,
         spreadDirection: 1, //
       },
@@ -697,60 +697,56 @@ class mainWindRect {
   }
 
   openOrCloseWindow(deviceType, flag) {
-    const _this = this;
     let endAngle = 0,
-      windowGroup;
+      windowMeshList;
     if (deviceType === 'front') {
-      windowGroup = this.frontWindowGroup;
+      windowMeshList = this.frontWindowMeshList;
     }
     if (deviceType === 'back') {
-      windowGroup = this.backWindowGroup;
+      windowMeshList = this.backWindowMeshList;
     }
     if (flag == 'openWindow') {
       // 打开风窗
-      endAngle = 1;
+      endAngle = Math.PI / 2;
     } else {
       // 关闭风窗
       endAngle = 0;
     }
-    if (windowGroup)
-      gsap.to(this, {
-        windowAngle: endAngle,
-        duration: Math.abs(endAngle - this.windowAngle) * 10,
+
+    if (windowMeshList) {
+      const windowAngle = {
+        value: windowMeshList[0].rotation.y,
+      };
+      const duration = Math.abs(endAngle - windowAngle.value) * 5;
+      gsap.to(windowAngle, {
+        value: endAngle,
+        duration: duration,
         ease: 'none',
         onUpdate: function () {
-          windowGroup.children.forEach((mesh) => {
-            mesh.rotation.z = _this.windowAngle;
+          windowMeshList.forEach((mesh) => {
+            mesh.rotation.y = windowAngle.value;
           });
         },
       });
+    }
   }
 
   /** 初始化风窗 */
   initWindow() {
-    if (!this.group) return;
-    this.frontWindowGroup = new THREE.Group();
-    this.frontWindowGroup.name = 'frontWindowGroup';
-
-    this.backWindowGroup = new THREE.Group();
-    this.backWindowGroup.name = 'backWindowGroup';
-    if (this.group && this.group?.children.length > 0) {
-      for (let i = this.group?.children.length - 1; i >= 0; i--) {
-        const obj = this.group?.children[i];
+    const ztfjGroup = this.group?.getObjectByName('ztfj') as THREE.Group;
+    if (!ztfjGroup) return;
+    if (ztfjGroup && ztfjGroup?.children.length > 0) {
+      for (let i = ztfjGroup?.children.length - 1; i >= 0; i--) {
+        const obj = ztfjGroup?.children[i];
         if (obj.type === 'Mesh' && obj.name && obj.name.startsWith('TC')) {
-          const mesh = obj.clone();
           if (obj.name.startsWith('TC1')) {
-            this.backWindowGroup.add(mesh);
+            this.frontWindowMeshList.push(obj);
           } else if (obj.name.startsWith('TC2')) {
-            this.frontWindowGroup.add(mesh);
+            this.backWindowMeshList.push(obj);
           }
-          obj.removeFromParent();
-          this.group?.remove(obj);
         }
       }
     }
-    this.group?.add(this.backWindowGroup);
-    this.group?.add(this.frontWindowGroup);
   }
 
   initFbmAnimation() {
@@ -798,13 +794,15 @@ class mainWindRect {
   mountedThree() {
     this.group = new THREE.Group();
     return new Promise(async (resolve) => {
-      this.model.setGLTFModel(['bg1', 'fbm', 'ztfj', 'ztfj-fc'], this.group).then(async () => {
+      this.model.setGLTFModel(['bg1', 'fbm', 'ztfj'], this.group).then(async () => {
         this.group?.position.set(-0.44, 19.88, 22.37);
         this.initSmokeMass();
         await this.setSmokePosition();
         const ztfjGroup = this.group?.getObjectByName('ztfj') as THREE.Group;
+        // ztfjGroup.visible = false;
         const fbmGroup = this.group?.getObjectByName('fbm') as THREE.Group;
         const fcGroup = this.group?.getObjectByName('ztfj-fc') as THREE.Group;
+        console.log(fcGroup);
         if (ztfjGroup) {
           ztfjGroup.position.z = ztfjGroup.position.z + 5;
           const airJinGroup = ztfjGroup.getObjectByName('JianTou1_Jin') as THREE.Object3D;
@@ -842,6 +840,8 @@ class mainWindRect {
   }
 
   destroy() {
+    this.backWindowMeshList = [];
+    this.frontWindowMeshList = [];
     this.frontSmoke.clearSmoke();
     this.backSmoke.clearSmoke();
     const fbmGroup = this.group?.getObjectByName('fbm') as THREE.Group;