瀏覽代碼

1. 优化设备管理中预警设置功能
2. 榆家梁新增单道风窗模型

hongrunxia 2 周之前
父節點
當前提交
79c679b96e

+ 71 - 60
src/views/vent/comment/EditRowTable.vue

@@ -17,6 +17,7 @@
   import { defineComponent, ref, nextTick, watch } from 'vue';
   import { BasicTable, useTable, TableAction, BasicColumn, ActionItem, EditRecordRow } from '/@/components/Table';
   import { useMessage } from '/@/hooks/web/useMessage';
+  import { string } from 'vue-types';
   // import { nextTick } from 'process';
 
   export default defineComponent({
@@ -50,6 +51,10 @@
         type: Object,
         default: {},
       },
+      rowKey: {
+        type: String,
+        default: 'id',
+      },
     },
     emits: ['saveOrUpdate', 'deleteById', 'rowChange'],
     setup(props, { emit, expose }) {
@@ -60,66 +65,70 @@
 
       const tableScroll = props.scroll.y ? ref({ y: props.scroll.y }) : ref({});
 
-      const [registerTable, { insertTableDataRecord, reload, getSelectRows, getDataSource, setTableData, clearSelectedRowKeys }] = !props.list
-        ? useTable({
-            title: '',
-            dataSource: props.dataSource,
-            rowKey: 'id',
-            clickToRowSelect: false,
-            columns: props.columns as BasicColumn[],
-            showIndexColumn: false,
-            showTableSetting: false,
-            rowSelection: !props.isRadio ? undefined : { type: 'radio', onChange: rowChange },
-            tableSetting: { fullScreen: true },
-            scroll: tableScroll,
-            pagination: {
-              current: 1,
-              pageSize: 10,
-              pageSizeOptions: ['10', '30', '50', '100', '500'],
-              showQuickJumper: false,
-            },
-            formConfig: {
-              labelWidth: 120,
-              schemas: props.searchFormSchema,
-              autoSubmitOnEnter: true,
-            },
-            actionColumn: {
-              width: 160,
-              title: '操作',
-              dataIndex: 'action',
-              slots: { customRender: 'action' },
-            },
-            beforeFetch(params) {
-              return { ...params, ...props.params };
-            },
-          })
-        : useTable({
-            title: '',
-            api: props.list,
-            rowKey: 'id',
-            clickToRowSelect: false,
-            columns: props.columns as BasicColumn[],
-            showIndexColumn: false,
-            showTableSetting: false,
-            pagination: {
-              current: 1,
-              pageSize: 10,
-              pageSizeOptions: ['10', '30', '50', '100', '500'],
-              showQuickJumper: false,
-            },
-            scroll: tableScroll,
-            rowSelection: !props.isRadio ? undefined : { type: 'radio', onChange: rowChange },
-            tableSetting: { fullScreen: true },
-            actionColumn: {
-              width: 160,
-              title: '操作',
-              dataIndex: 'action',
-              slots: { customRender: 'action' },
-            },
-            beforeFetch(params) {
-              return { ...params, ...props.params };
-            },
-          });
+      const [registerTable, { insertTableDataRecord, reload, getSelectRows, setSelectedRowKeys, getDataSource, setTableData, clearSelectedRowKeys }] =
+        !props.list
+          ? useTable({
+              title: '',
+              dataSource: props.dataSource,
+              rowKey: props.rowKey,
+              clickToRowSelect: false,
+              columns: props.columns as BasicColumn[],
+              showIndexColumn: false,
+              showTableSetting: false,
+              rowSelection: !props.isRadio ? undefined : { type: 'radio', onChange: rowChange },
+              tableSetting: { fullScreen: true },
+              scroll: tableScroll,
+              pagination: {
+                current: 1,
+                pageSize: 10,
+                pageSizeOptions: ['10', '30', '50', '100', '500'],
+                showQuickJumper: false,
+              },
+              formConfig: {
+                labelWidth: 120,
+                schemas: props.searchFormSchema,
+                autoSubmitOnEnter: true,
+              },
+              actionColumn: {
+                width: 160,
+                title: '操作',
+                dataIndex: 'action',
+                slots: { customRender: 'action' },
+              },
+              beforeFetch(params) {
+                return { ...params, ...props.params };
+              },
+              afterFetch(result) {
+                // emit()
+              },
+            })
+          : useTable({
+              title: '',
+              api: props.list,
+              rowKey: props.rowKey,
+              clickToRowSelect: false,
+              columns: props.columns as BasicColumn[],
+              showIndexColumn: false,
+              showTableSetting: false,
+              pagination: {
+                current: 1,
+                pageSize: 10,
+                pageSizeOptions: ['10', '30', '50', '100', '500'],
+                showQuickJumper: false,
+              },
+              scroll: tableScroll,
+              rowSelection: !props.isRadio ? undefined : { type: 'radio', onChange: rowChange },
+              tableSetting: { fullScreen: true },
+              actionColumn: {
+                width: 160,
+                title: '操作',
+                dataIndex: 'action',
+                slots: { customRender: 'action' },
+              },
+              beforeFetch(params) {
+                return { ...params, ...props.params };
+              },
+            });
 
       function rowChange(e) {
         emit('rowChange', e[0], getSelectRows()[0]);
@@ -251,6 +260,8 @@
 
       expose({
         reload,
+        setSelectedRowKeys,
+        getDataSource,
       });
 
       return {

+ 54 - 23
src/views/vent/deviceManager/comment/warningTabel/index.vue

@@ -2,6 +2,7 @@
   <div>
     <EditRowTableVue
       v-if="refreshParent"
+      ref="ParentRef"
       :columns="warningColumns"
       :list="list"
       :params="{ deviceid: deviceId }"
@@ -13,21 +14,17 @@
       :scroll="{ y: 200 }"
     >
       <template #filterCell="{ column, record }">
-        <template v-if="record.editable && column.dataIndex === 'monitorcode'">
-          <div style="position: relative">
+        <template v-if="column.dataIndex === 'monitorcode'">
+          <div v-if="record.editable" style="position: relative">
             <Select
               :options="options"
-              v-model:value="record.editValueRefs['monitorcode']"
+              v-model:value="record['monitorcode']"
               :fieldNames="{ label: 'valuename', value: 'valuecode' }"
               size="small"
               style="min-width: 100px"
             />
-            <!-- <a-popover placement="monitorcode" :visible="true">
-              <template #content>
-                <p>Content</p>
-              </template>
-            </a-popover> -->
           </div>
+          <div v-else>{{ getLabel(record['monitorcode']) }}</div>
         </template>
       </template>
     </EditRowTableVue>
@@ -54,7 +51,7 @@
   import { warningColumns, levelColumns } from './warning.data';
   import { list, limitList, edit, save, limitSave, limitEdit, deleteById, limitDeleteById } from './warning.api';
   import { list as pointList } from '../pointTabel/point.api';
-  import { defineProps, ref, nextTick, inject, onMounted } from 'vue';
+  import { defineProps, ref, nextTick, inject, onMounted, onBeforeMount } from 'vue';
 
   const props = defineProps({
     deviceId: { type: String },
@@ -63,9 +60,9 @@
       requried: true,
     },
   });
-  // const
+  const ParentRef = ref();
   const options = ref([]);
-  const RefChildComponent = ref(null);
+  const RefChildComponent = ref();
   const warningProId = ref('');
   const currentParent = ref({});
   const refresh = ref(true);
@@ -74,26 +71,45 @@
   async function saveOrUpdateParent(record) {
     try {
       if (record.id) {
+        currentParent.value = record;
         await edit({ ...record });
       } else {
-        await save({ ...record, deviceid: props.deviceId });
+        await save({ ...record, deviceid: props.deviceId, devicetype: props.pointType });
+      }
+      // refreshParent.value = false;
+      if (ParentRef.value) {
+        await ParentRef.value.reload();
+        nextTick(() => {
+          const parentList = ParentRef.value.getDataSource();
+          if (record.id) {
+            ParentRef.value.setSelectedRowKeys([record.id]);
+          } else {
+            ParentRef.value.setSelectedRowKeys([parentList[0]['id']]);
+          }
+        });
       }
-      refreshParent.value = false;
-      nextTick(() => {
-        refreshParent.value = true;
-      });
     } catch (error) {}
   }
   async function saveOrUpdateChild(record) {
     if (record.id) {
       await limitEdit({ ...record });
     } else {
-      await limitSave({ ...record, limitid: warningProId.value, code: currentParent.value['monitorcode'] });
+      await limitSave({
+        ...record.editValueRefs,
+        limitid: warningProId.value,
+        code: currentParent.value['monitorcode'],
+        devicetype: props.pointType,
+        deviceid: props.deviceId,
+      });
+    }
+    // refresh.value = false;
+    if (RefChildComponent.value) {
+      await RefChildComponent.value.reload();
+      nextTick(() => {
+        const childList = RefChildComponent.value.getDataSource();
+        RefChildComponent.value.setSelectedRowKeys([childList[0]['id']]);
+      });
     }
-    refresh.value = false;
-    nextTick(() => {
-      refresh.value = true;
-    });
   }
   function parentDeleteById(id, reload) {
     deleteById({ id: id }, reload);
@@ -109,11 +125,26 @@
       refresh.value = true;
     });
   }
-
-  onMounted(async () => {
+  function getLabel(code) {
+    const obj = options.value.find((item) => item['valuecode'] === code);
+    if (obj) {
+      return obj['valuename'];
+    }
+    return code;
+  }
+  onBeforeMount(async () => {
     const res = await pointList({ devicetype: props.pointType, valuetype_begin: 2 });
     options.value = res && res['records'] ? res['records'] : [];
   });
+  onMounted(async () => {
+    if (ParentRef.value) {
+      await ParentRef.value.reload();
+      nextTick(() => {
+        const parentList = ParentRef.value.getDataSource();
+        ParentRef.value.setSelectedRowKeys([parentList[0]['id']]);
+      });
+    }
+  });
 </script>
 
 <style scoped></style>

+ 25 - 0
src/views/vent/monitorManager/windowMonitor/dandaoFc.threejs.ts

@@ -27,6 +27,30 @@ class singleWindow {
   //   this.model.camera.updateProjectionMatrix();
   // };
 
+  addLight = () => {
+    if (!this.model) return;
+
+    const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
+    directionalLight.position.set(-110, 150, 647);
+    this.group?.add(directionalLight);
+    // directionalLight.target = group;
+
+    const pointLight2 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight2.position.set(-101, 34, 16);
+    pointLight2.shadow.bias = 0.05;
+    this.group.add(pointLight2);
+
+    const pointLight3 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight3.position.set(19, 25, -7);
+    pointLight3.shadow.bias = 0.05;
+    this.group.add(pointLight3);
+
+    const pointLight6 = new THREE.PointLight(0xffffff, 1, 300);
+    pointLight6.position.set(51, 51, 9);
+    pointLight6.shadow.bias = 0.05;
+    this.group.add(pointLight6);
+  };
+
   // 设置模型位置
   setModalPosition() {
     this.group?.scale.set(22, 22, 22);
@@ -309,6 +333,7 @@ class singleWindow {
         this.group?.add(fcModal);
         this.setModalPosition();
         this.initAnimation();
+        this.addLight();
         resolve(null);
       });
     });

+ 16 - 0
src/views/vent/monitorManager/windowMonitor/dandaoFcBet.threejs.ts

@@ -26,7 +26,23 @@ class singleWindowBet {
     const directionalLight = new THREE.DirectionalLight(0xffffff, 2);
     directionalLight.position.set(-437, 61, 559);
     this.group.add(directionalLight);
+
+    const pointLight2 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight2.position.set(-101, 34, 16);
+    pointLight2.shadow.bias = 0.05;
+    this.group.add(pointLight2);
+
+    const pointLight3 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight3.position.set(19, 25, -7);
+    pointLight3.shadow.bias = 0.05;
+    this.group.add(pointLight3);
+
+    const pointLight6 = new THREE.PointLight(0xffffff, 1, 300);
+    pointLight6.position.set(51, 51, 9);
+    pointLight6.shadow.bias = 0.05;
+    this.group.add(pointLight6);
   };
+
   // 设置模型位置
   setModalPosition() {
     this.group?.scale.set(22, 22, 22);

+ 15 - 0
src/views/vent/monitorManager/windowMonitor/dandaoFcXk.threejs.ts

@@ -23,6 +23,21 @@ class singleWindowXk {
     const directionalLight = new THREE.DirectionalLight(0xffffff, 1.5);
     directionalLight.position.set(800.0, 120.0, 80.0);
     this.group.add(directionalLight);
+
+    const pointLight2 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight2.position.set(-101, 34, 16);
+    pointLight2.shadow.bias = 0.05;
+    this.group.add(pointLight2);
+
+    const pointLight3 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight3.position.set(19, 25, -7);
+    pointLight3.shadow.bias = 0.05;
+    this.group.add(pointLight3);
+
+    const pointLight6 = new THREE.PointLight(0xffffff, 1, 300);
+    pointLight6.position.set(51, 51, 9);
+    pointLight6.shadow.bias = 0.05;
+    this.group.add(pointLight6);
   };
   // 设置模型位置
   setModalPosition() {

+ 23 - 16
src/views/vent/monitorManager/windowMonitor/dandaoFcYjl.threejs.ts

@@ -23,14 +23,14 @@ class singleWindowYjl {
   addLight = () => {
     if (!this.group || !this.group) return;
 
-    const directionalLight = new THREE.DirectionalLight(0xffffff, 2);
-    directionalLight.position.set(-437, 61, 559);
-    this.group.add(directionalLight);
+    // const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
+    // directionalLight.position.set(-437, 61, 559);
+    // this.group.add(directionalLight);
   };
   // 设置模型位置
   setModalPosition() {
-    this.group?.scale.set(22, 22, 22);
-    this.group?.position.set(-35, 25, 15);
+    // this.group?.scale.set(22, 22, 22);
+    // this.group?.position.set(-35, 25, 15);
   }
 
   addMonitorText(selectData) {
@@ -139,8 +139,8 @@ class singleWindowYjl {
         const planeGeometry = new THREE.PlaneGeometry(526, 346); // 平面3维几何体PlaneGeometry
         const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
         planeMesh.name = 'monitorText';
-        planeMesh.scale.set(0.0038, 0.004, 0.0038);
-        planeMesh.position.set(4.44, -0.165, -0.46);
+        planeMesh.scale.set(0.03, 0.032, 0.03);
+        planeMesh.position.set(42.41, 4.58, -2.67);
         this.group?.add(planeMesh);
       }
     });
@@ -148,14 +148,22 @@ class singleWindowYjl {
 
   /* 提取风门序列帧,初始化前后门动画 */
   initAnimation() {
-    const meshArr01: THREE.Object3D[] = [];
-    this.group?.children.forEach((obj) => {
-      if (obj.type === 'Mesh' && obj.name && obj.name.startsWith('FCshanye')) {
-        obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
-        meshArr01.push(obj);
-      }
-    });
-    this.windowsActionArr.frontWindow = meshArr01;
+    const sdFcModal = this.group.getObjectByName('ddFc-yjl');
+    if (!sdFcModal) return;
+    // 初始化窗的动画
+    const fengchuang = sdFcModal?.getObjectByName('FengChuang');
+    const meshArr01: THREE.Mesh[] = [];
+    if (fengchuang) {
+      fengchuang.getObjectByName('group4')?.children.forEach((item: THREE.Object3D) => {
+        item.children.forEach((obj: THREE.Mesh) => {
+          if (obj.name && obj.name.startsWith('ted__FCshanye')) {
+            obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
+            meshArr01.push(obj);
+          }
+        });
+      });
+      this.windowsActionArr.frontWindow = meshArr01;
+    }
   }
 
   play(rotationParam, flag) {
@@ -281,7 +289,6 @@ class singleWindowYjl {
       this.model.setGLTFModel(['ddFc-yjl'], this.group).then(() => {
         this.setModalPosition();
         this.initAnimation();
-        this.addLight();
         resolve(null);
       });
     });

+ 2 - 0
src/views/vent/monitorManager/windowMonitor/index.vue

@@ -21,6 +21,8 @@
         <div class="row" v-if="Number(selectData.nwindownum) > 1">
           <div v-if="hasPermission('window:control')" class="button-box" @click="setArea(1)">设定前窗面积</div>
           <div v-if="hasPermission('window:control')" class="button-box" @click="setArea(2)">设定后窗面积</div>
+          <div v-if="hasPermission('window:gateControl')" class="button-box" @click="playAnimation(1)">打开前门</div>
+          <div v-if="hasPermission('window:gateControl')" class="button-box" @click="playAnimation(2)">关闭前门</div>
           <div v-if="hasPermission('window:fltk')" class="button-box" @click="setArea(7)">前窗自主调控</div>
           <div v-if="hasPermission('window:fltk')" class="button-box" @click="setArea(8)">后窗自主调控</div>
           <!-- 展会功能 -->

+ 25 - 0
src/views/vent/monitorManager/windowMonitor/shuangdaoFc.threejs.ts

@@ -21,6 +21,30 @@ class doubleWindow {
     // this.group.name = this.modelName;
   }
 
+  addLight = () => {
+    if (!this.model) return;
+
+    const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
+    directionalLight.position.set(-110, 150, 647);
+    this.group?.add(directionalLight);
+    // directionalLight.target = group;
+
+    const pointLight2 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight2.position.set(-101, 34, 16);
+    pointLight2.shadow.bias = 0.05;
+    this.group.add(pointLight2);
+
+    const pointLight3 = new THREE.PointLight(0xffffff, 1, 150);
+    pointLight3.position.set(19, 25, -7);
+    pointLight3.shadow.bias = 0.05;
+    this.group.add(pointLight3);
+
+    const pointLight6 = new THREE.PointLight(0xffffff, 1, 300);
+    pointLight6.position.set(51, 51, 9);
+    pointLight6.shadow.bias = 0.05;
+    this.group.add(pointLight6);
+  };
+
   // 设置模型位置
   setModalPosition() {
     // this.group.getObjectByName(this.modelName)?.scale.set(9, 9, 9);
@@ -340,6 +364,7 @@ class doubleWindow {
         this.setModalPosition();
         this.initAnimation();
         resolve(null);
+        this.addLight();
         // this.initCamera(playerDom);
       });
     });

+ 156 - 116
src/views/vent/monitorManager/windowMonitor/shuangdaoFcYjl.threejs.ts

@@ -15,6 +15,13 @@ class doubleWindowYjl {
   };
   playerStartClickTime1 = new Date().getTime();
   playerStartClickTime2 = new Date().getTime();
+  mixers: THREE.AnimationMixer | undefined;
+  // fmClock = new THREE.Clock();
+
+  clipActionArr = {
+    frontDoor: null as unknown as THREE.AnimationAction,
+    backDoor: null as unknown as THREE.AnimationAction,
+  };
 
   constructor(model) {
     this.model = model;
@@ -157,28 +164,53 @@ class doubleWindowYjl {
         this.group.rotation.y += 0.00002 * 30 * this.direction;
       }
     }
+    // if (this.mixers && this.fmClock.running) {
+    //   this.mixers.update(2);
+    // }
   }
 
   /* 提取风门序列帧,初始化前后门动画 */
   initAnimation() {
-    const meshArr01: THREE.Object3D[] = [];
-    const meshArr02: THREE.Object3D[] = [];
-    const windowGroup = new THREE.Group();
-    windowGroup.name = 'hiddenGroup';
-    this.group.getObjectByName('sdFc')?.children.forEach((obj) => {
-      if (obj.type === 'Mesh' && obj.name && (obj.name.startsWith('shanye') || obj.name.startsWith('FCshanye'))) {
-        if (obj.name.startsWith('FCshanye')) {
-          obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
-          meshArr01.push(obj);
-        } else if (obj.name.startsWith('shanye')) {
-          obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
-          meshArr02.push(obj);
-        }
-      }
-    });
-    this.windowsActionArr.frontWindow = meshArr01;
-    this.windowsActionArr.backWindow = meshArr02;
-    this.group?.add(windowGroup);
+    const sdFcModal = this.group.getObjectByName('sdFc-yjl');
+    if (!sdFcModal) return;
+    // 初始化窗的动画
+    const fengchuang1 = sdFcModal?.getObjectByName('FengChuang');
+    const fengchuang2 = sdFcModal?.getObjectByName('FengChuang1');
+    const meshArr01: THREE.Mesh[] = [];
+    const meshArr02: THREE.Mesh[] = [];
+    if (fengchuang1 && fengchuang2) {
+      fengchuang1.getObjectByName('chuang')?.children.forEach((item: THREE.Object3D) => {
+        item.children.forEach((obj: THREE.Mesh) => {
+          if (obj.name && obj.name.startsWith('shanye')) {
+            obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
+            meshArr01.push(obj);
+          }
+        });
+      });
+      fengchuang2.getObjectByName('chuang001')?.children.forEach((item: THREE.Object3D) => {
+        item.children.forEach((obj: THREE.Mesh) => {
+          if (obj.name && obj.name.startsWith('d__FCshanye')) {
+            obj.rotateOnAxis(new THREE.Vector3(0, 1, 0), 0);
+            meshArr02.push(obj);
+          }
+        });
+      });
+      this.windowsActionArr.frontWindow = meshArr01;
+      this.windowsActionArr.backWindow = meshArr02;
+    }
+
+    // // 初始化门的动画
+    // this.mixers = new THREE.AnimationMixer(sdFcModal);
+    // const frontDoor = sdFcModal?.animations[0];
+    // const frontClipAction = this.mixers.clipAction(frontDoor, sdFcModal);
+    // frontClipAction.clampWhenFinished = true;
+    // frontClipAction.loop = THREE.LoopOnce;
+    // this.clipActionArr.frontDoor = frontClipAction;
+    // const backDoor = sdFcModal?.animations[1];
+    // const backClipAction = this.mixers.clipAction(backDoor, sdFcModal);
+    // backClipAction.clampWhenFinished = true;
+    // backClipAction.loop = THREE.LoopOnce;
+    // this.clipActionArr.backDoor = backClipAction;
   }
 
   /* 点击风窗,风窗全屏 */
@@ -236,119 +268,127 @@ class doubleWindowYjl {
     }
   }
 
-  async initCamera(dom1?, dom2?) {
-    const videoPlayer1 = dom1;
-    const videoPlayer2 = dom2;
-    let monitorPlane: THREE.Mesh | null = null;
-    if (!videoPlayer1 || !videoPlayer2) {
-      const textArr = [
-        {
-          text: `无信号输入`,
-          font: 'normal 40px Arial',
-          color: '#009900',
-          strokeStyle: '#002200',
-          x: 170,
-          y: 40,
-        },
-      ];
-      const canvas = await getTextCanvas(320, 180, '', 'noSinge.png');
-      let textMaterial: THREE.MeshBasicMaterial | null = null;
-      if (canvas) {
-        const textMap = new THREE.CanvasTexture(canvas); // 关键一步
-        textMaterial = new THREE.MeshBasicMaterial({
-          map: textMap, // 设置纹理贴图
-          transparent: true,
-          side: THREE.DoubleSide, // 这里是双面渲染的意思
-        });
-        textMaterial.blending = THREE.CustomBlending;
+  // // 播放动画
+  // doorPlay(handlerState, timeScale = 0.01) {
+  //   if (this.clipActionArr.frontDoor && this.clipActionArr.backDoor) {
+  //     let handler = () => {};
+  //     switch (handlerState) {
+  //       case 1: // 打开前门
+  //         handler = () => {
+  //           this.clipActionArr.frontDoor.paused = true;
+  //           this.clipActionArr.frontDoor.reset();
+  //           this.clipActionArr.frontDoor.time = 1.2;
+  //           this.clipActionArr.frontDoor.timeScale = timeScale;
+  //           // this.clipActionArr.frontDoor.clampWhenFinished = true;
+  //           this.clipActionArr.frontDoor.play();
+  //           this.fmClock.start();
+  //         };
+  //         break;
+  //       case 2: // 关闭前门
+  //         handler = () => {
+  //           this.clipActionArr.frontDoor.paused = true;
+  //           this.clipActionArr.frontDoor.reset(); //
+  //           this.clipActionArr.frontDoor.time = 3;
+  //           this.clipActionArr.frontDoor.timeScale = -timeScale;
+  //           // this.clipActionArr.frontDoor.clampWhenFinished = true;
+  //           this.clipActionArr.frontDoor.play();
+  //           this.fmClock.start();
+  //         };
+  //         break;
+  //       case 3: // 打开后门
+  //         handler = () => {
+  //           this.clipActionArr.backDoor.paused = true;
+  //           this.clipActionArr.backDoor.reset();
+  //           this.clipActionArr.backDoor.time = 1.2;
+  //           this.clipActionArr.backDoor.timeScale = timeScale;
+  //           // this.clipActionArr.backDoor.clampWhenFinished = true;
+  //           this.clipActionArr.backDoor.play();
+  //           this.fmClock.start();
+  //         };
+  //         break;
+  //       case 4: // 关闭后门
+  //         handler = () => {
+  //           this.clipActionArr.backDoor.paused = true;
+  //           this.clipActionArr.backDoor.reset();
+  //           this.clipActionArr.backDoor.time = 3;
+  //           this.clipActionArr.backDoor.timeScale = -timeScale;
+  //           // this.clipActionArr.backDoor.clampWhenFinished = true;
+  //           this.clipActionArr.backDoor.play();
+  //           this.fmClock.start();
+  //         };
+  //         break;
+  //       // case 5: // 打开前后门
+  //       //   handler = () => {
+  //       //     this.clipActionArr.backDoor.paused = true;
+  //       //     this.clipActionArr.frontDoor.paused = true;
 
-        const planeGeometry = new THREE.PlaneGeometry(100, 100); // 平面3维几何体PlaneGeometry
-        monitorPlane = new THREE.Mesh(planeGeometry, textMaterial);
+  //       //     this.clipActionArr.frontDoor.reset();
+  //       //     this.clipActionArr.frontDoor.time = 0;
+  //       //     this.clipActionArr.frontDoor.timeScale = 0.01;
+  //       //     this.clipActionArr.frontDoor.clampWhenFinished = true;
+  //       //     this.clipActionArr.frontDoor.play();
 
-        textMaterial.dispose();
-        planeGeometry.dispose();
-        textMap.dispose();
-      }
-    }
-    const player1 = this.group.getObjectByName('player1');
-    if (player1) {
-      this.model.clearMesh(player1);
-      this.group.remove(player1);
-    }
-    const noPlayer1 = this.group.getObjectByName('noPlayer1');
-    if (noPlayer1) {
-      this.model.clearMesh(noPlayer1);
-      this.group.remove(noPlayer1);
-    }
-    if (!videoPlayer1 && videoPlayer1 === null) {
-      if (monitorPlane && !this.group.getObjectByName('noPlayer1')) {
-        const planeMesh = monitorPlane.clone();
-        planeMesh.name = 'noPlayer1';
-        planeMesh.scale.set(0.011, 0.0053, 0.012);
-        planeMesh.position.set(-4.3, 0.13, -0.23);
-        this.group?.add(planeMesh.clone());
-      }
-    } else if (videoPlayer1) {
-      try {
-        const mesh = renderVideo(this.group, videoPlayer1, 'player1');
-        if (mesh) {
-          mesh?.scale.set(-0.034, 0.024, 1);
-          mesh?.position.set(-3.332, 0.11, -0.23);
-          mesh.rotation.y = -Math.PI;
-          this.group.add(mesh);
-        }
-      } catch (error) {
-        console.log('视频信号异常');
-      }
-    }
-    const player2 = this.group.getObjectByName('player2');
-    if (player2) {
-      this.model.clearMesh(player2);
-      this.group.remove(player2);
-    }
-    const noPlayer2 = this.group.getObjectByName('noPlayer2');
-    if (noPlayer2) {
-      this.model.clearMesh(noPlayer2);
-      this.group.remove(noPlayer2);
-    }
-    if (!videoPlayer2 && videoPlayer2 === null) {
-      if (monitorPlane && !this.group.getObjectByName('noPlayer2')) {
-        const planeMesh = monitorPlane.clone();
-        planeMesh.name = 'noPlayer2';
-        planeMesh.scale.set(0.0085, 0.0056, 0.012);
-        planeMesh.position.set(4.29, 0.02, -0.41);
-        this.group?.add(planeMesh.clone());
-      }
-    } else if (videoPlayer2) {
-      try {
-        const mesh = renderVideo(this.group, videoPlayer2, 'player2');
-        if (mesh) {
-          mesh?.scale.set(-0.034, 0.024, 1);
-          mesh?.position.set(-3.332, 0.11, -0.23);
-          mesh.rotation.y = -Math.PI;
-          this.group.add(mesh);
-        }
-      } catch (error) {
-        console.log('视频信号异常');
-      }
-    }
-  }
+  //       //     this.clipActionArr.backDoor.reset();
+  //       //     this.clipActionArr.backDoor.time = 0;
+  //       //     this.clipActionArr.backDoor.timeScale = 0.01;
+  //       //     this.clipActionArr.backDoor.clampWhenFinished = true;
+  //       //     this.clipActionArr.backDoor.play();
+  //       //     this.frontClock.start();
+  //       //     this.backClock.start();
+  //       //   };
+  //       //   break;
+  //       // case 6: // 关闭前后门
+  //       //   handler = () => {
+  //       //     debugger;
+  //       //     this.clipActionArr.backDoor.paused = true;
+  //       //     this.clipActionArr.frontDoor.paused = true;
+
+  //       //     this.clipActionArr.frontDoor.reset();
+  //       //     this.clipActionArr.frontDoor.time = 4;
+  //       //     this.clipActionArr.frontDoor.timeScale = -0.01;
+  //       //     this.clipActionArr.frontDoor.clampWhenFinished = true;
+  //       //     this.clipActionArr.frontDoor.play();
+  //       //     this.clipActionArr.backDoor.reset();
+  //       //     this.clipActionArr.backDoor.time = 4;
+  //       //     this.clipActionArr.backDoor.timeScale = -0.01;
+  //       //     this.clipActionArr.backDoor.clampWhenFinished = true;
+  //       //     this.clipActionArr.backDoor.play();
+  //       //     this.frontClock.start();
+  //       //     this.backClock.start();
+  //       //   };
+  //       //   break;
+  //       default:
+  //     }
+
+  //     handler();
+  //     // model.clock.start();
+  //     // const honglvdeng = group.getObjectByName('honglvdeng');
+  //     // const material = honglvdeng.material;
+  //     // setTimeout(() => {
+  //     //   if (handlerState === 2 || handlerState === 4 || handlerState === 6) {
+  //     //     material.color = new THREE.Color(0x00ff00);
+  //     //   } else {
+  //     //     material.color = new THREE.Color(0xff0000);
+  //     //   }
+  //     // }, 1000);
+  //   }
+  // }
 
   mountedThree(playerDom) {
     return new Promise((resolve) => {
       this.model.setGLTFModel(['sdFc-yjl'], this.group).then(() => {
+        console.log(this.group);
         this.setModalPosition();
         this.initAnimation();
         resolve(null);
-        // this.initCamera(playerDom);
       });
     });
   }
 
   destroy() {
     this.model.clearGroup(this.group);
-    this.windowsActionArr.frontWindow = undefined;
-    this.windowsActionArr.backWindow = undefined;
+    this.windowsActionArr.frontWindow = [];
+    this.windowsActionArr.backWindow = [];
     this.model = null;
     this.group = null;
   }

+ 15 - 17
src/views/vent/monitorManager/windowMonitor/window.threejs.ts

@@ -161,14 +161,16 @@ export const setModelType = (type) => {
       model.scene?.remove(group);
       group = doubleWindowObj.group;
       const oldCameraPosition = { x: 100, y: 0, z: 10 };
-      let newP, newT;
-      if (sysOrgCode === 'sdmtjtyjlmk') {
-        newP = { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 };
-        newT = { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 };
-      } else {
-        newP = { x: 66.257, y: 57.539, z: 94.313 };
-        newT = { x: 0, y: 0, z: 0 };
-      }
+      // let newP, newT;
+      // if (sysOrgCode === 'sdmtjtyjlmk') {
+      //   newP = { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 };
+      //   newT = { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 };
+      // } else {
+      //   newP = { x: 66.257, y: 57.539, z: 94.313 };
+      //   newT = { x: 0, y: 0, z: 0 };
+      // }
+      const newP = { x: 66.257, y: 57.539, z: 94.313 };
+      const newT = { x: 0, y: 0, z: 0 };
       model.scene?.add(doubleWindowObj.group);
       setTimeout(async () => {
         resolve(null);
@@ -182,8 +184,8 @@ export const setModelType = (type) => {
       const oldCameraPosition = { x: 100, y: 0, z: 10 };
       let newP, newT;
       if (sysOrgCode === 'sdmtjtyjlmk') {
-        newP = { x: 66.257, y: 57.539, z: 94.313 };
-        newT = { x: 0, y: 0, z: 0 };
+        newP = { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 };
+        newT = { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 };
       } else {
         newP = { x: 66.257, y: 57.539, z: 94.313 };
         newT = { x: 0, y: 0, z: 0 };
@@ -223,27 +225,23 @@ export const mountedThree = (playerDom) => {
     model.setEnvMap('test1');
 
     model.camera.position.set(100, 0, 1000);
-
+    doubleWindowObj = new doubleWindow(model);
     singleWindowXkObj = new singleWindowXk(model);
     if (sysOrgCode === 'sdmtjtbetmk') {
       const singleWindowBet = await import('./dandaoFcBet.threejs');
       if (singleWindowBet) singleWindowObj = new singleWindowBet.default(model);
-      doubleWindowObj = new doubleWindow(model);
     } else if (sysOrgCode === 'sdmtjtyjlmk') {
-      // 单
+      // 单
       const singleWindowYjl = await import('./dandaoFcYjl.threejs');
       if (singleWindowYjl) singleWindowObj = new singleWindowYjl.default(model);
-      const doubleWindowYjl = await import('./shuangdaoFcYjl.threejs');
-      if (doubleWindowYjl) doubleWindowObj = new doubleWindowYjl.default(model);
     } else {
       singleWindowObj = new singleWindow(model);
-      doubleWindowObj = new doubleWindow(model);
     }
     doubleWindowObj.mountedThree(playerDom);
     singleWindowXkObj.mountedThree();
     singleWindowObj.mountedThree(playerDom);
     model.animate();
-    addLight();
+    // addLight();
     startAnimation();
     resolve(null);
   });