Explorar o código

[Feat 0000] 新增局部风机单风筒模型

hongrunxia hai 4 días
pai
achega
aa483e3025

+ 10 - 7
src/views/vent/comment/threejs/SmokePartical.ts

@@ -70,26 +70,29 @@ export default class SmokePartical {
               (Math.random() * 2 - 1) * 3 + obj.path1.z
             );
           } else {
+            const len = obj.spreadRang ? obj.spreadRang : 3;
             vec = new THREE.Vector3(
-              (Math.random() * 2 - 1) * 3 + obj.path1.x,
-              (Math.random() * 2 - 1) * 3 + obj.path1.y,
-              (Math.random() * 2 - 1) * 3 + obj.path1.z
+              (Math.random() * 2 - 1) * len + obj.path1.x,
+              (Math.random() * 2 - 1) * len + obj.path1.y,
+              (Math.random() * 2 - 1) * len + obj.path1.z
             );
           }
           obj.path1.copy(vec);
         } else if (obj.spreadDirection == -1) {
           let vec;
           if (Math.abs(obj.path0.y - obj.path1.y) > 3) {
+            const len = obj.spreadRang ? obj.spreadRang : 8;
             vec = new THREE.Vector3(
               (Math.random() * 2 - 1) * 3 + obj.path0.x,
-              Math.random() * 8 + obj.path0.y,
+              Math.random() * len + obj.path0.y,
               (Math.random() * 2 - 1) * 3 + obj.path0.z
             );
           } else {
+            const len = obj.spreadRang ? obj.spreadRang : 3;
             vec = new THREE.Vector3(
-              (Math.random() * 2 - 1) * 3 + obj.path0.x,
-              (Math.random() * 2 - 1) * 3 + obj.path0.y,
-              (Math.random() * 2 - 1) * 3 + obj.path0.z
+              (Math.random() * 2 - 1) * len + obj.path0.x,
+              (Math.random() * 2 - 1) * len + obj.path0.y,
+              (Math.random() * 2 - 1) * len + obj.path0.z
             );
           }
           obj.path0.copy(vec);

+ 1 - 1
src/views/vent/home/clique/components/3Dmap/3dMap.ts

@@ -642,7 +642,7 @@ class earthtMap {
     const geometry = new THREE.PlaneGeometry(15.0, 15.0);
     const texture = new THREE.TextureLoader().load('/texture/earth.jpg');
     const bumpTexture = new THREE.TextureLoader().load('/texture/earth.jpg');
-    texture.encoding = THREE.sRGBEncoding;
+    texture.encoding = THREE.colorSpace;
     const material = new THREE.MeshPhongMaterial({
       map: texture, // 贴图
       bumpMap: bumpTexture,

+ 15 - 116
src/views/vent/monitorManager/comment/GroupMonitorTable.vue

@@ -101,105 +101,6 @@
     }
   };
 
-  /** 定义table Columns */
-  // function setColumns(columnsType) {
-  //   const isCheckColumn = {
-  //     title: '',
-  //     dataIndex: 'isCheck',
-  //     width: 40,
-  //     align: 'center',
-  //     customCell: (_, index) => {
-
-  //       if (index % 3 == 0) {
-  //         return { rowSpan: 3 };
-  //       } else {
-  //         return { rowSpan: 0 };
-  //       }
-  //     },
-  //   };
-  //   const indexColumn = {
-  //     title: '序号',
-  //     dataIndex: 'key',
-  //     width: 80,
-  //     align: 'center',
-  //     customCell: (_, index) => {
-  //       if (index % 3 == 0) {
-  //         return { rowSpan: 3 };
-  //       } else {
-  //         return { rowSpan: 0 };
-  //       }
-  //     },
-  //     customRender: function ({ index }) {
-  //       return index / 3 + 1;
-  //     },
-  //   };
-  //   const runDevice = {
-  //     title: '风机',
-  //     dataIndex: 'runDevice',
-  //     width: 80,
-  //     align: 'center',
-  //   };
-
-  //   columns.value = getTableHeaderColumns(columnsType);
-  //   console.log('风机columns------------------>', columnsType);
-  //   if (columns.value && columns.value.length < 1) {
-  //     columns.value = getTableHeaderColumns(columnsType.split('_')[0] + '_monitor');
-  //   }
-
-  //   const strinstallpos = columns.value.find((item) => {
-  //     return item.dataIndex === 'strinstallpos' || item.dataIndex === 'strname';
-  //   });
-  //   if (strinstallpos) {
-  //     strinstallpos.customCell = (_, index) => {
-  //       if (index % 3 == 0) {
-  //         return { rowSpan: 3 };
-  //       } else {
-  //         return { rowSpan: 0 };
-  //       }
-  //     };
-  //   }
-  //   columns.value.forEach((item) => {
-  //     if (item.dataIndex === 'strinstallpos' || item.dataIndex === 'strname' || item.dataIndex.endsWith('_merge')) {
-  //       item.customCell = (_, index) => {
-  //         if (index % 3 == 0) {
-  //           return { rowSpan: 3 };
-  //         } else {
-  //           return { rowSpan: 0 };
-  //         }
-  //       };
-  //     }
-  //   });
-
-  //   columns.value.splice(1, 0, runDevice);
-  //   if (props.isShowSelect) {
-  //     columns.value = [isCheckColumn, indexColumn, ...columns.value];
-  //   } else {
-  //     columns.value = [indexColumn, ...columns.value];
-  //   }
-
-  //   if (props.isAction) {
-  //     columns.value = [
-  //       ...columns.value,
-  //       {
-  //         title: '操作',
-  //         dataIndex: 'operation',
-  //         width: 120,
-  //         align: 'center',
-  //         slots: { customRender: 'operation' },
-  //         customCell: (_, index) => {
-  //           if (index % 3 == 0) {
-  //             return { rowSpan: 3 };
-  //           } else {
-  //             return { rowSpan: 0 };
-  //           }
-  //         },
-  //       },
-  //     ];
-  //   }
-  //   // columns.value = [...columns.value, ...columns.value]
-  //   return columns;
-  // }
-
   function setColumns(columnsType) {
     const isCheckColumn = {
       title: '',
@@ -250,7 +151,6 @@
     });
     if (strinstallpos) {
       strinstallpos.customCell = (_, index) => {
-        debugger;
         const columnNum = _.modalTyoe ? (_.modalTyoe.endsWith('_3') ? 3 : _.modalTyoe.endsWith('_1') ? 1 : 2) : 2;
         if (_.rowIndex % columnNum == 0) {
           return { rowSpan: columnNum };
@@ -330,7 +230,10 @@
       const list: unknown[] = [];
       newVal.forEach((item, index) => {
         const data: any = toRaw(item);
-        const modalTyoe = data.modalTyoe; ///
+        if (data.deviceType.startsWith('fanlocal') && data.install_kind) {
+          data['modalTyoe'] = data.install_kind;
+        }
+        const modalTyoe = data.modalTyoe;
         const resultData1 = {};
         const resultData2 = {};
         const resultData3 = {};
@@ -391,34 +294,30 @@
           }
         });
         resultData1['deviceID'] = resultData2['deviceID'] = data['deviceID'];
-        debugger;
         if (props.columnsType.startsWith('fanlocal') && sysOrgCode !== 'zmhjhzmy') {
           resultData1['runDevice'] = '主机';
           resultData2['runDevice'] = '备机';
-          resultData1['rowIndex'] = 0;
-          resultData2['rowIndex'] = 1;
-          resultData1['index'] = index;
-          resultData2['index'] = index;
         } else {
           resultData1['runDevice'] = '1#风机';
           resultData2['runDevice'] = '2#风机';
           resultData3['runDevice'] = '3#风机';
-          resultData1['modalTyoe'] = modalTyoe;
-          resultData2['modalTyoe'] = modalTyoe;
-          resultData3['modalTyoe'] = modalTyoe;
+        }
+        resultData1['modalTyoe'] = modalTyoe;
+        resultData2['modalTyoe'] = modalTyoe;
+        resultData3['modalTyoe'] = modalTyoe;
 
-          resultData1['rowIndex'] = 0;
-          resultData2['rowIndex'] = 1;
-          resultData3['rowIndex'] = 2;
+        resultData1['rowIndex'] = 0;
+        resultData2['rowIndex'] = 1;
+        resultData3['rowIndex'] = 2;
 
-          resultData1['index'] = index;
-          resultData2['index'] = index;
-          resultData3['index'] = index;
-        }
+        resultData1['index'] = index;
+        resultData2['index'] = index;
+        resultData3['index'] = index;
         if (modalTyoe && modalTyoe.endsWith('_3')) {
           list.push(resultData1, resultData2, resultData3);
         } else if (modalTyoe && modalTyoe.endsWith('_1')) {
           list.push(resultData1);
+          // list.push(resultData1, resultData2);
         } else {
           list.push(resultData1, resultData2);
         }

+ 400 - 0
src/views/vent/monitorManager/fanLocalMonitor/fanLocal.threejs.single.ts

@@ -0,0 +1,400 @@
+import * as THREE from 'three';
+import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer';
+import { getTextCanvas, setModalCenter } from '/@/utils/threejs/util';
+import Smoke from '/@/views/vent/comment/threejs/Smoke';
+import gsap from 'gsap';
+
+// 本模型的上下文对象,用于实现本模型的特定功能,代码参考了旧有的 fanLocal.three.ts
+class ModelContext {
+  model;
+  modelName = 'jbfj-single';
+  group: THREE.Object3D | null = null;
+  fanType?: string;
+  topSmoke?: Smoke;
+  downSmoke?: Smoke;
+  returnSmoke?: Smoke;
+  topLife?: number;
+  downLife?: number;
+
+  constructor(model) {
+    this.model = model;
+  }
+
+  addLight() {
+    // optional implementation
+  }
+
+  mountedThree() {
+    return new Promise((resolve) => {
+      this.model.setGLTFModel([this.modelName]).then(async (gltf) => {
+        this.group = gltf[0];
+        if (this.group) {
+          setModalCenter(this.group);
+          this.addLight();
+          this.initFly();
+          this.setModalPosition();
+          resolve(null);
+        }
+      });
+    });
+  }
+
+  destroy() {
+    if (this.model) {
+      this.model.isRender = false;
+      this.clearFly();
+      this.topSmoke = undefined;
+      this.downSmoke = undefined;
+      this.returnSmoke = undefined;
+      // @ts-ignore
+      this.group = undefined;
+      this.model.destroy();
+    }
+  }
+
+  async initFly() {
+    const topCurve = [
+      {
+        path0: new THREE.Vector3(7.698, 0.398, 0.19),
+        path1: new THREE.Vector3(-0.65, 0.398, 0.19),
+        isSpread: true,
+        spreadDirection: 0, //
+      },
+      {
+        path0: new THREE.Vector3(-0.65, 0.398, 0.19),
+        path1: new THREE.Vector3(-7.599, 0.398, 0.19),
+        isSpread: true,
+        spreadRang: 1,
+        spreadDirection: 1, //
+      },
+    ];
+
+    if (!this.topSmoke) {
+      this.topSmoke = new Smoke('/model/img/texture-smoke.png', '#ffffff', 2, 0.35, 3.7, 100);
+      this.topSmoke.setPath(topCurve);
+      await this.topSmoke.setPoints();
+      this.group?.add(this.topSmoke.points);
+    }
+  }
+
+  playSmoke(selectData) {
+    // debugger;
+    if (selectData['Fan1StartStatus'] == '1') {
+      // 主风机打开
+      this.setSmokeFrequency('top', 40);
+      this.runFly('top', 'open');
+    } else {
+      // 备风机关闭
+      this.runFly('top', 'close');
+    }
+
+    if (selectData['Fan1StartStatus'] != '1') {
+      this.runFly('all', 'close');
+    }
+  }
+
+  runFly(deviceType, state) {
+    if (state === 'open') {
+      if (deviceType === 'top') {
+        if (this.downSmoke && this.downSmoke.frameId) {
+          this.downSmoke.stopSmoke();
+        }
+        if (this.topSmoke && !this.topSmoke.frameId) {
+          this.topSmoke.startSmoke();
+        }
+      }
+    } else {
+      if (deviceType === 'top') {
+        if (this.topSmoke && this.topSmoke.frameId) {
+          this.topSmoke.stopSmoke();
+        }
+      }
+    }
+    if (deviceType === 'all' && state === 'close') {
+      this.returnSmoke?.stopSmoke();
+    }
+  }
+
+  setSmokeFrequency(deviceType, frequency) {
+    const life = (frequency - 30) * 25;
+    let duration = 0;
+    let smoke;
+
+    if (deviceType === 'top') {
+      if (this.topLife == life) {
+        return;
+      }
+      this.topLife = life;
+      smoke = this.topSmoke;
+      duration = (Math.abs(life - smoke.life) / 500) * 25;
+    }
+    if (smoke) {
+      gsap.to(smoke, {
+        life: life,
+        duration: duration,
+        ease: 'easeInCubic',
+        overwrite: true,
+      });
+    }
+  }
+
+  addText(selectData) {
+    if (!this.group) {
+      return;
+    }
+    // @ts-ignore
+    const screenDownText = VENT_PARAM['modalText']
+      ? // @ts-ignore
+        VENT_PARAM['modalText']
+      : // @ts-ignore
+      History_Type['type'] == 'remote'
+      ? `国能神东煤炭集团监制`
+      : '煤炭科学技术研究院有限公司研制';
+
+    const screenDownTextX = 80 - (screenDownText.length - 10) * 6;
+    const textArr = [
+      {
+        text: `智能局部通风机监测与控制系统`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 20,
+        y: 108,
+      },
+      {
+        text: `供风距离(m):`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 0,
+        y: 152,
+      },
+      {
+        text: `${
+          selectData.airSupplyDistence_merge
+            ? selectData.airSupplyDistence_merge
+            : selectData.fchimenylength
+            ? selectData.fchimenylength
+            : selectData.airSupplyDistence_merge
+            ? selectData.airSupplyDistence_merge
+            : '-'
+        }`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 228,
+        y: 152,
+      },
+      {
+        text: `风筒直径(mm): `,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 0,
+        y: 200,
+      },
+      {
+        text: ` ${selectData.fchimenydiamlimit ? selectData.fchimenydiamlimit : selectData.ductDiameter_merge ? selectData.ductDiameter_merge : '-'}`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 220,
+        y: 200,
+      },
+      {
+        text: `故障诊断:`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 0,
+        y: 245,
+      },
+      {
+        text: `${selectData.warnLevel_str ? selectData.warnLevel_str : '-'}`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 220,
+        y: 245,
+      },
+      {
+        text: `型号功率:`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 0,
+        y: 285,
+      },
+      {
+        text: `${selectData.model_Power_merge ? selectData.model_Power_merge : '-'}`,
+        font: 'normal 26px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 220,
+        y: 285,
+      },
+      {
+        text: screenDownText,
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: screenDownTextX,
+        y: 325,
+      },
+    ];
+    getTextCanvas(526, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
+      const textMap = new THREE.CanvasTexture(canvas); // 关键一步
+      const textMaterial = new THREE.MeshBasicMaterial({
+        // 关于材质并未讲解 实操即可熟悉                 这里是漫反射类似纸张的材质,对应的就有高光类似金属的材质.
+        map: textMap, // 设置纹理贴图
+        transparent: true,
+        side: THREE.FrontSide, // 这里是双面渲染的意思
+      });
+      textMaterial.blending = THREE.CustomBlending;
+      const monitorPlane = this.group?.getObjectByName('monitorText');
+      if (monitorPlane) {
+        // @ts-ignore-next-line
+        monitorPlane.material = textMaterial;
+      } else {
+        const planeGeometry = new THREE.PlaneGeometry(526, 346); // 平面3维几何体PlaneGeometry
+        const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
+        planeMesh.name = 'monitorText';
+        planeMesh.scale.set(0.0135, 0.0135, 0.0135);
+        planeMesh.rotation.y = -Math.PI / 2;
+        planeMesh.position.set(-84.79, 0.82, 17.0);
+        this.group?.add(planeMesh);
+      }
+    });
+  }
+
+  addCssText() {
+    if (!this.group) return;
+
+    if (!this.group.getObjectByName('text1')) {
+      const element = document.getElementById('inputBox') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text1';
+        fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-85.68, 5.97, -3.39);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text2')) {
+      const element = document.getElementById('outBox') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text2';
+        fanLocalCSS3D.scale.set(0.15, 0.15, 0.15);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(85.62, 17.65, 7.71);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text3')) {
+      const element = document.getElementById('returnBox') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text3';
+        fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-25.97, 9.3, -15.09);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text4')) {
+      const element = document.getElementById('gateBox') as HTMLElement;
+      if (element) {
+        // element.innerHTML = '';
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text4';
+        fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-73.13, 8.44, -23.52);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text5')) {
+      const element = document.getElementById('windownBox') as HTMLElement;
+      if (element) {
+        // element.innerHTML = '';
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text5';
+        fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-28.44, 9.78, -40.42);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text7')) {
+      const element = document.getElementById('inputBox0') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text7';
+        fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-84.23, 4.97, -18.92);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text6')) {
+      const element = document.getElementById('inputBox1') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text6';
+        fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-84.47, 6.56, -19.47);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text8')) {
+      const element = document.getElementById('gasBox3') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text8';
+        fanLocalCSS3D.scale.set(0.03, 0.03, 0.03);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-90.04, 6, 5);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text9')) {
+      const element = document.getElementById('gasBox2') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text9';
+        fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(-8, 7.46, -35.28);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+    if (!this.group.getObjectByName('text10')) {
+      const element = document.getElementById('gasBox1') as HTMLElement;
+      if (element) {
+        const fanLocalCSS3D = new CSS3DObject(element);
+        fanLocalCSS3D.name = 'text10';
+        fanLocalCSS3D.scale.set(0.1, 0.1, 0.1);
+        fanLocalCSS3D.rotation.y = -Math.PI / 2;
+        fanLocalCSS3D.position.set(80, 9, -43);
+        this.group.add(fanLocalCSS3D);
+      }
+    }
+  }
+
+  clearFly() {
+    if (this.topSmoke) this.topSmoke.clearSmoke();
+    if (this.downSmoke) this.downSmoke.clearSmoke();
+    if (this.returnSmoke) this.returnSmoke.clearSmoke();
+  }
+
+  // 设置模型位置
+  setModalPosition() {
+    if (!this.group) return;
+    this.group.scale.set(13, 13, 13);
+    this.group.position.set(0, -10, -50);
+  }
+}
+export default ModelContext;

+ 56 - 37
src/views/vent/monitorManager/fanLocalMonitor/fanLocal.threejs.ts

@@ -1,10 +1,9 @@
 import * as THREE from 'three';
 import UseThree from '../../../../utils/threejs/useThree';
-import FanLocal from './fanLocal.threejs.base';
-import FanLocalTwo from './fanLocal.threejs.Two';
-import FanLocalDual from './fanLocalDual.threejs.base';
+
 import { animateCamera } from '/@/utils/threejs/util';
 import useEvent from '../../../../utils/threejs/useEvent';
+import { getDictItemsByCode } from '/@/utils/dict';
 
 /** 模型总控制器 */
 let model: UseThree;
@@ -66,7 +65,7 @@ function initEventListender() {
 // }
 
 /** 设置模型类型并切换,不同的类型通常对应不同的具体模型,在模型总控制器下的具体模型会根据传入的参数彼此交互、切换 */
-export function setModelType(modelType: 'fanLocal' | 'fanLocalDual' | string, subModelType: string, data?: any) {
+export function setModelType(modelType: 'fanLocal' | 'fanLocalDual' | 'fanLocalSingle' | string, subModelType: string, data?: any) {
   return new Promise((resolve, reject) => {
     if (!model) return reject('模型控制器未初始化');
     // 判断是否是同一个/类模型
@@ -86,7 +85,7 @@ export function setModelType(modelType: 'fanLocal' | 'fanLocalDual' | string, su
 
       if (modelType === type) {
         group = context?.group as THREE.Object3D;
-        context.setModelType(subModelType, data);
+        if (context.setModelType) context.setModelType(subModelType, data);
 
         // 还没添加到控制器的添加进去
         if (!model.scene?.getObjectByName(group.name) && group) {
@@ -107,10 +106,8 @@ export function setModelType(modelType: 'fanLocal' | 'fanLocalDual' | string, su
           animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, { x: -1.85, y: 13.58, z: 37.39 }, { x: -1.83, y: 2.58, z: -0.75 }, model, 0.8);
         }
         if (type == 'fanLocalDual') {
-          // if (!isUpdate) {
           const oldCameraPosition = { x: -693, y: 474, z: 398 };
           animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, { x: 14.83, y: 16.9, z: 36.46 }, { x: 0, y: 0, z: 0 }, model, 0.8);
-          // }
         }
 
         resolve(null);
@@ -131,29 +128,55 @@ export function mountedThree(sceneSelctor: string, cssSelectors: string[]) {
       model.renderer.sortObjects = true;
     }
 
-    const model1 = new FanLocal(model);
-    await model1.mountedThree();
-    modelContextList.push({
-      type: 'fanLocal',
-      context: model1,
-    });
-
-    const model2 = new FanLocalDual(model);
-    await model2.mountedThree();
-    // 暂时先不加双行
-    modelContextList.push({
-      type: 'fanLocalDual',
-      context: model2,
-    });
-
-    const model3 = new FanLocalTwo(model);
-    const flag = await model3.mountedThree();
-
-    if (flag)
-      modelContextList.push({
-        type: 'fanLocalTwo',
-        context: model3,
-      });
+    // 这里根据字典判断
+    const dictCodes = getDictItemsByCode('fanlocal_install_kind');
+    if (dictCodes && dictCodes.length > 0) {
+      for (let i = 0; i < dictCodes.length; i++) {
+        const dict = dictCodes[i];
+        switch (dict.value) {
+          case 'single':
+            const FanLocal = await import('./fanLocal.threejs.base');
+            const model1 = new FanLocal.default(model);
+            await model1.mountedThree();
+            modelContextList.push({
+              type: 'fanLocal',
+              context: model1,
+            });
+            break;
+          case 'dual_inner':
+          case 'dual_outer':
+            if (modelContextList.find((item) => item.type == 'fanLocalDual')) continue;
+            const FanLocalDual = await import('./fanLocalDual.threejs.base');
+            const model2 = new FanLocalDual.default(model);
+            await model2.mountedThree();
+            // 暂时先不加双行
+            modelContextList.push({
+              type: 'fanLocalDual',
+              context: model2,
+            });
+            break;
+          case 'fanLocalTwo':
+            const FanLocalTwo = await import('./fanLocal.threejs.Two');
+            const model3 = new FanLocalTwo.default(model);
+            const flag = await model3.mountedThree();
+            if (flag)
+              modelContextList.push({
+                type: 'fanLocalTwo',
+                context: model3,
+              });
+            break;
+          case 'fanlocal_1':
+            const FanLocalSingle = await import('./fanLocal.threejs.single');
+            const model4 = new FanLocalSingle.default(model);
+            await model4.mountedThree();
+            modelContextList.push({
+              type: 'fanLocalSingle',
+              context: model4,
+            });
+            break;
+        }
+      }
+    }
 
     initEventListender();
     setCamera();
@@ -182,12 +205,8 @@ export function addCssText() {
   if (modelContextList[2] && modelContextList[2].context && modelContextList[2].context['addCssText']) modelContextList[2].context['addCssText']();
 }
 export function playSmoke(d) {
-  if (modelContextList[0]) {
-    // @ts-ignore
-    modelContextList[0].context?.playSmoke(d);
-  }
-  if (modelContextList[2]) {
-    // @ts-ignore
-    modelContextList[2].context?.playSmoke(d);
+  for (let i = 0; i < modelContextList.length; i++) {
+    const item = modelContextList[i];
+    if (item.context && item.context.playSmoke) item.context.playSmoke(d);
   }
 }

+ 16 - 7
src/views/vent/monitorManager/fanLocalMonitor/index.vue

@@ -271,7 +271,7 @@
               fanTitles[0]
             }}</div>
             <div
-              v-if="selectData && ((selectData['modalTyoe'] && !selectData['modalTyoe'].endsWith('_1')) || !selectData['modalTyoe'])"
+              v-if="selectData && ((selectData['install_kind'] && !selectData['install_kind'].endsWith('_1')) || !selectData['install_kind'])"
               class="tab-item"
               :class="{ 'tab-item-active-r': warningMonitorRowIndex === 1 }"
               @click="selectDevice('warningMonitorRowIndex', 1)"
@@ -342,7 +342,7 @@
                 fanTitles[0]
               }}</div>
               <div
-                v-if="selectData && ((selectData['modalTyoe'] && !selectData['modalTyoe'].endsWith('_1')) || !selectData['modalTyoe'])"
+                v-if="selectData && ((selectData['install_kind'] && !selectData['install_kind'].endsWith('_1')) || !selectData['install_kind'])"
                 class="tab-item"
                 :class="{ 'tab-item-active-r': dataMonitorRowIndex == 1 }"
                 @click="selectDevice('dataMonitorRowIndex', 1)"
@@ -609,7 +609,10 @@
             <a-radio value="stop">停止</a-radio>
           </a-radio-group>
         </div>
-        <div class="startSmoke-select">
+        <div
+          v-if="selectData && ((selectData['install_kind'] && !selectData['install_kind'].endsWith('_1')) || !selectData['install_kind'])"
+          class="startSmoke-select"
+        >
           <div class="label">备机:</div>
           <a-radio-group v-model:value="mainWindIsShow2" @change="changeMotor" name="localWind2">
             <a-radio value="open">开启</a-radio>
@@ -625,7 +628,10 @@
           <div :class="{ 'button-box': true, 'button-disable': false }" @click="handleOk('Fan1Stop')">停止</div>
           <div :class="{ 'button-box': true, 'button-disable': false }" @click="handleOk('Fan1Reset')">复位</div>
         </div>
-        <div class="startSmoke-select">
+        <div
+          v-if="selectData && ((selectData['install_kind'] && !selectData['install_kind'].endsWith('_1')) || !selectData['install_kind'])"
+          class="startSmoke-select"
+        >
           <div class="label">备机:</div>
           <div :class="{ 'button-box': true, 'button-disable': false }" @click="handleOk('Fan2Open')">开启</div>
           <div :class="{ 'button-box': true, 'button-disable': false }" @click="handleOk('Fan2Stop')">停止</div>
@@ -638,7 +644,10 @@
           <div class="label">主机:</div>
           <div :class="{ 'button-box': true, 'button-disable': false }" @click="handleOk('Fan1remote')">远程/就地切换</div>
         </div>
-        <div class="startSmoke-select">
+        <div
+          v-if="selectData && ((selectData['install_kind'] && !selectData['install_kind'].endsWith('_1')) || !selectData['install_kind'])"
+          class="startSmoke-select"
+        >
           <div class="label">备机:</div>
           <div :class="{ 'button-box': true, 'button-disable': false }" @click="handleOk('Fan2remote')">远程/就地切换</div>
         </div>
@@ -1332,16 +1341,16 @@
         if (data['install_kind']) {
           const keymap = {
             fanLocalTwo: ['fanLocalTwo', modalType.value],
-            single: ['fanLocal', modalType.value],
+            single: ['fanLocal', modalType.value], //单巷(默认两风筒)
             dual_inner: ['fanLocalDual', 'inner'],
             dual_outer: ['fanLocalDual', 'outer'],
+            fanlocal_1: ['fanLocalSingle', modalType.value], //单巷单风筒
           };
           mainModelType.value = keymap[data['install_kind']][0];
           modalType.value = keymap[data['install_kind']][1];
         } else {
           // 为了兼容没有添加 install_kind 的旧的单巷
           mainModelType.value = 'fanLocal';
-          // mainModelType.value = 'fanLocalTwo';
         }
       }
       setModelType(mainModelType.value, modalType.value, fanDualArray.value);

+ 12 - 12
src/views/vent/monitorManager/gateMonitor/gate.threejs.ts

@@ -1,18 +1,18 @@
 import * as THREE from 'three';
 import UseThree from '../../../../utils/threejs/useThree';
-import Fm1 from './gate.threejs.yy';
-import Fm3 from './gate.threejs.qd';
+// import Fm1 from './gate.threejs.yy';
+// import Fm3 from './gate.threejs.qd';
 import FmXR from './gate.threejs.xr';
-import Fm2 from './gate.threejs.three';
-import FmTwoSs from './gate.threejs.two.ss';
-import FmThreeTl from './gate.threejs.three.tl';
-import FmDc from './gate.threejs.window';
-import FmDcHJG from './gate.threejs.window.hjg';
-import FmDcZHQ from './gate.threejs.window.zhq';
-import FmHsw3 from './gate.threejs.three.hsw';
-import FmYjXr from './gate.threejs.two.yj'; // 窑街行人
-import FmYj from './gate.threejs.yj'; // 窑街
-import FmSp1 from './gate.threejs.one.sp';
+// import Fm2 from './gate.threejs.three';
+// import FmTwoSs from './gate.threejs.two.ss';
+// import FmThreeTl from './gate.threejs.three.tl';
+// import FmDc from './gate.threejs.window';
+// import FmDcHJG from './gate.threejs.window.hjg';
+// import FmDcZHQ from './gate.threejs.window.zhq';
+// import FmHsw3 from './gate.threejs.three.hsw';
+// import FmYjXr from './gate.threejs.two.yj'; // 窑街行人
+// import FmYj from './gate.threejs.yj'; // 窑街
+// import FmSp1 from './gate.threejs.one.sp';
 import { animateCamera } from '/@/utils/threejs/util';
 import useEvent from '../../../../utils/threejs/useEvent';
 import { getDictItemsByCode } from '/@/utils/dict';

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

@@ -351,7 +351,7 @@
             console.error('Error', error);
           } finally {
             timer = null;
-            getMonitor(flag);
+            getMonitor();
           }
         },
         flag ? 0 : 1000