Forráskód Böngészése

Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base

lxh 1 hete
szülő
commit
774afee559

+ 2 - 2
src/views/vent/monitorManager/balancePressMonitor/balancePress.api.ts

@@ -7,7 +7,7 @@ enum Api {
   deviceList = '/safety/ventanalyManageSystem/linkdevicelist',
   submit = '/monitor/demo/avePress/add',
   submitEdit = '/monitor/demo/avePress/edit',
-  subList= '/monitor/demo/avePress/list'
+  subList = '/monitor/demo/avePress/list',
 }
 /**
  * 列表接口
@@ -37,7 +37,7 @@ export const submit = (params) => defHttp.post({ url: Api.submit, params });
  * 监测参数查询列表
  * @param params
  */
-export const subList = () => defHttp.get({ url: Api.subList });
+export const subList = (params) => defHttp.get({ url: Api.subList, params });
 
 /**
  * 监测参数提交-编辑

+ 11 - 8
src/views/vent/monitorManager/balancePressMonitor/components/balancePressHome2.vue

@@ -530,17 +530,20 @@
 
   const { configs, fetchConfigs } = useInitConfigs();
 
-  onMounted(() => {
+  onMounted(async () => {
     // getMonitor()
     fetchConfigs('balancePressHome');
     loading.value = true;
-    mountedThree().then(async () => {
-      await setModelType('balancePressTun'); //balancePressBase
-      loading.value = false;
-      timer = null;
-      await getMonitor(true);
-      play('startSmoke', 'top', 30, 'open', 0);
-    });
+    // mountedThree().then(async () => {
+    //   await setModelType('balancePressTun'); //balancePressBase
+    //   loading.value = false;
+    //   timer = null;
+    //   await getMonitor(true);
+    //   play('startSmoke', 'top', 30, 'open', 0);
+    // });
+    timer = null;
+    await getMonitor(true);
+    loading.value = false;
   });
 
   onUnmounted(() => {

+ 38 - 9
src/views/vent/monitorManager/balancePressMonitor/components/balancePressHomeBD.vue

@@ -35,7 +35,7 @@
               </div>
             </div>
             <div class="btn-box" style="text-align: center">
-              <div class="btn btn1" @click="onSubmit">提交</div>
+              <div class="btn btn1" @click="modalVisible = true">提交</div>
             </div>
           </template>
         </ventBox1>
@@ -48,13 +48,13 @@
           <template #container>
             <div class="vent-flex-row-between auto-control mt-10px mb-10px">
               <div class="title">自动调节:</div>
-              <a-radio-group v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
-                <a-radio value="1">关闭</a-radio>
-                <a-radio value="2">开启</a-radio>
+              <a-radio-group v-model:value="avePress.isAuto" name="radioGroup">
+                <a-radio :value="false">关闭</a-radio>
+                <a-radio :value="true">开启</a-radio>
               </a-radio-group>
             </div>
             <div class="btn-box" style="text-align: center">
-              <div class="btn btn1" @click="onSubmit">提交</div>
+              <div class="btn btn1" @click="modalVisible = true">提交</div>
             </div>
           </template>
         </ventBox1>
@@ -70,18 +70,21 @@
         :visible="true"
       />
     </div>
+    <PasswordModal :modal-is-show="modalVisible" modal-title="提交" @handle-ok="handleControl" @handle-cancel="modalVisible = false" />
   </a-spin>
 </template>
 <script setup lang="ts">
   import { ref, onMounted, onUnmounted, defineProps } from 'vue';
   import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
-  import { list } from '../balancePress.api';
+  import { list, submitEdit, subList } from '../balancePress.api';
   import ModuleCommon from '../../../home/configurable/components/ModuleCommon.vue';
   import { useInitConfigs } from '../../../home/configurable/hooks/useInit';
   import { useGlobSetting } from '/@/hooks/setting';
   import { settingParam1, settingParam2, settingParam3 } from '../balancePress.data';
   import { message } from 'ant-design-vue';
   import ventBox1 from '/@/components/vent/ventBox1.vue';
+  import PasswordModal from '../../comment/components/PasswordModal.vue';
+  import { get } from 'lodash-es';
   // import { Config } from '../../../deviceManager/configurationTable/types';
 
   const props = defineProps({
@@ -330,15 +333,41 @@
     //
   };
 
-  function onSubmit() {
-    message.success('提交成功');
+  const modalVisible = ref(false);
+
+  function handleControl(password) {
+    submitEdit({
+      id: avePress.value.id,
+      password,
+      isAuto: avePress.value.isAuto,
+    })
+      .then(() => {
+        message.success('操作成功');
+        getAvePress();
+      })
+      .catch(() => {
+        message.error('操作失败');
+      })
+      .finally(() => {
+        modalVisible.value = false;
+      });
+  }
+
+  const avePress = ref<any>({ isAuto: false });
+  function getAvePress() {
+    subList({
+      strType: 'sdg_fan_sys_gate',
+    }).then(({ records }) => {
+      avePress.value = get(records, '[0]');
+    });
   }
 
   const { configs, fetchConfigs } = useInitConfigs();
 
   onMounted(() => {
     // getMonitor()
-    fetchConfigs('balancePressHome');
+    // fetchConfigs('balancePressHome');
+    getAvePress();
     loading.value = true;
     mountedThree().then(async () => {
       await setModelType('balancePressBase'); //balancePressBase

+ 7 - 4
src/views/vent/monitorManager/balancePressMonitor/index1.vue

@@ -3,7 +3,7 @@
 
   <div class="scene-box">
     <div class="center-container">
-      <balancePressHome1 v-if="activeKey == 'monitor'" :deviceId = 'optionValue' />
+      <balancePressHome2 v-if="activeKey == 'monitor'" :deviceId = 'optionValue' />
       <div v-else class="history-group">
         <div class="device-button-group" v-if="deviceList.length > 0">
           <div class="device-button" :class="{ 'device-active': deviceActive == device.deviceType }" v-for="(device, index) in deviceList" :key="index" @click="deviceChange(index)">{{ device.deviceName }}</div>
@@ -17,7 +17,7 @@
     </div>
     <BottomMenu @change="changeActive"/>
   </div>
-  <Vent2dModal v-if="activeKey == 'monitor'" style="width: 100vw; height: 100vh; position: absolute; top: 0; left: 0;" />
+  <Vent2dModal v-if="activeKey == 'monitor'" style="width: 100%; height: 100%; position: fixed; top: 0px; left: 0px;" />
 </template>
 
 <script setup lang="ts">
@@ -25,7 +25,7 @@ import customHeader from '/@/components/vent/customHeader.vue';
 import { onBeforeMount, ref, onMounted, onUnmounted, reactive, onBeforeUnmount } from 'vue';
 import { list, getTableList } from './balancePress.api';
 import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
-import balancePressHome1 from './components/balancePressHome1.vue';
+import balancePressHome2 from './components/balancePressHome2.vue';
 import balancePressHistory from './components/balancePressHistory.vue';
 import balancePressHandleHistoryVue from './components/balancePressHandleHistory.vue';
 import balancePressAlarmHistory from './components/balancePressAlarmHistory.vue';
@@ -135,7 +135,10 @@ onBeforeUnmount(() => {
   height: 100%;
   margin-top: 20px;
   pointer-events: none;
-  position: relative;
+  // position: relative;
+  // margin: 0 !important;
+  // padding:0 !important;
+
   :deep(.left-box){
     margin-top: 0px;
   }

+ 291 - 0
src/views/vent/monitorManager/windowMonitor/sandaoFc.threejs.ts

@@ -0,0 +1,291 @@
+import * as THREE from 'three';
+import { getTextCanvas, renderVideo } from '/@/utils/threejs/util';
+import gsap from 'gsap';
+
+class threeFc_8 {
+  model;
+  modelName = 'threedFc';
+  group: THREE.Object3D = new THREE.Object3D();
+  animationTimer;
+  isLRAnimation = true;
+  direction = 1;
+  windowsActionArr = {
+    frontWindow: <THREE.Mesh[]>[],
+    centerWindow: <THREE.Mesh[]>[],
+    backWindow: <THREE.Mesh[]>[],
+  };
+
+  constructor(model) {
+    this.model = model;
+    // 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);
+    this.group?.scale.set(22, 22, 22);
+    this.group?.position.set(-15, 25, 15);
+  }
+
+  addMonitorText(selectData) {
+    if (!this.group) {
+      return;
+    }
+    const screenDownText = VENT_PARAM['modalText']
+      ? VENT_PARAM['modalText']
+      : History_Type['type'] == 'remote'
+      ? `国能神东煤炭集团监制`
+      : '煤炭科学技术研究院有限公司研制';
+
+    const screenDownTextX = 120 - (screenDownText.length - 10) * 6;
+    const textArr = [
+      {
+        text: `远程定量调节自动风窗`,
+        font: 'normal 30px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 95,
+        y: 97,
+      },
+      {
+        text: `${selectData.OpenDegree1 ? '前窗开度值(°)' : selectData.forntArea ? '前窗过风面积(㎡)' : '前窗过风面积(㎡)'}:`,
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 5,
+        y: 150,
+      },
+      {
+        text: selectData.OpenDegree1
+          ? Number(`${selectData.OpenDegree1}`).toFixed(2)
+          : selectData.forntArea
+          ? Number(`${selectData.forntArea}`).toFixed(2)
+          : '-',
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 330,
+        y: 150,
+      },
+      {
+        text: `${selectData.OpenDegree2 ? '后窗开度值(°)' : selectData.forntArea ? '后窗过风面积(㎡)' : '后窗过风面积(㎡)'}:`,
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 5,
+        y: 210,
+      },
+      {
+        text: selectData.OpenDegree2
+          ? Number(`${selectData.OpenDegree2}`).toFixed(2)
+          : selectData.rearArea
+          ? Number(`${selectData.rearArea}`).toFixed(2)
+          : '-',
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 325,
+        y: 210,
+      },
+      {
+        text: `${selectData.frontRearDP ? '风窗压差(Pa)' : selectData.windSpeed ? '风速(m/s)' : '通信状态'}:`,
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 5,
+        y: 266,
+      },
+      {
+        text: `${
+          selectData.frontRearDP
+            ? selectData.frontRearDP
+            : selectData.windSpeed
+            ? selectData.windSpeed
+            : selectData.netStatus == '0'
+            ? '断开'
+            : '连接'
+        }`,
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: 330,
+        y: 266,
+      },
+
+      {
+        text: screenDownText,
+        font: 'normal 28px Arial',
+        color: '#009900',
+        strokeStyle: '#002200',
+        x: screenDownTextX,
+        y: 322,
+      },
+    ];
+
+    getTextCanvas(570, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
+      const textMap = new THREE.CanvasTexture(canvas); // 关键一步
+      const textMaterial = new THREE.MeshBasicMaterial({
+        // 关于材质并未讲解 实操即可熟悉                 这里是漫反射类似纸张的材质,对应的就有高光类似金属的材质.
+        map: textMap, // 设置纹理贴图
+        transparent: true,
+        side: THREE.DoubleSide, // 这里是双面渲染的意思
+      });
+      textMaterial.blending = THREE.CustomBlending;
+      const monitorPlane = this.group?.getObjectByName('monitorText');
+      if (monitorPlane) {
+        monitorPlane.material = textMaterial;
+      } else {
+        const planeGeometry = new THREE.PlaneGeometry(570, 346); // 平面3维几何体PlaneGeometry
+        const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
+        planeMesh.name = 'monitorText';
+        planeMesh.scale.set(0.002, 0.002, 0.002);
+        planeMesh.position.set(4.03, 0.658, -0.27);
+        this.group?.add(planeMesh);
+      }
+      textMap.dispose();
+    });
+  }
+
+  /* 风门动画 */
+  render() {
+    if (!this.model) {
+      return;
+    }
+  }
+
+  /* 提取风门序列帧,初始化前后门动画 */
+  initAnimation() {
+    const meshArr01: THREE.Object3D[] = [];
+    const meshArr02: THREE.Object3D[] = [];
+    const meshArr03: THREE.Object3D[] = [];
+    const fcModal = this.group.getObjectByName('SanFengChuang_1');
+    const fcShanyeGroup = fcModal?.getObjectByName('FengChuang');
+    const shanye1 = fcShanyeGroup?.getObjectByName('FengChuang_1')?.getObjectByName('Men_1')?.getObjectByName('shanye_1');
+    const shanye2 = fcShanyeGroup?.getObjectByName('FengChuang_2')?.getObjectByName('Men_2')?.getObjectByName('shanye_2');
+    const shanye3 = fcShanyeGroup?.getObjectByName('FengChuang_3')?.getObjectByName('Men_3')?.getObjectByName('shanye_3');
+    if (shanye1 && shanye2 && shanye3) {
+      shanye1.children.forEach((obj) => {
+        obj.rotateOnAxis(new THREE.Vector3(0, 0, 1), 0);
+        meshArr01.push(obj);
+      });
+      shanye2.children.forEach((obj) => {
+        obj.rotateOnAxis(new THREE.Vector3(0, 0, 1), 0);
+        meshArr02.push(obj);
+      });
+      shanye3.children.forEach((obj) => {
+        obj.rotateOnAxis(new THREE.Vector3(0, 0, 1), 0);
+        meshArr03.push(obj);
+      });
+    }
+    this.windowsActionArr.frontWindow = meshArr01;
+    this.windowsActionArr.centerWindow = meshArr02;
+    this.windowsActionArr.backWindow = meshArr03;
+  }
+
+  /* 点击风窗,风窗全屏 */
+  mousedownModel(intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]) {
+    if (this.animationTimer) {
+      clearTimeout(this.animationTimer);
+      this.animationTimer = null;
+    }
+    console.log('摄像头控制信息', this.model?.orbitControls, this.model?.camera);
+    // 判断是否点击到视频
+    intersects.find((intersect) => {
+      const mesh = intersect.object;
+      return false;
+    });
+  }
+
+  mouseUpModel() {}
+
+  play(rotationParam, flag) {
+    if (this.windowsActionArr.frontWindow.length <= 0 || this.windowsActionArr.backWindow.length <= 0) {
+      return;
+    }
+    if (flag === 1) {
+      // 前风窗动画
+      this.windowsActionArr.frontWindow.forEach((mesh) => {
+        gsap.to(mesh.rotation, {
+          z: -THREE.MathUtils.degToRad(rotationParam.frontDeg1),
+          duration: (1 / 9) * Math.abs(rotationParam.frontDeg1 + mesh.rotation.z),
+          overwrite: true,
+        });
+      });
+    } else if (flag === 2) {
+      // 后风窗动画
+      this.windowsActionArr.backWindow.forEach((mesh) => {
+        gsap.to(mesh.rotation, {
+          z: -THREE.MathUtils.degToRad(rotationParam.backDeg1),
+          duration: (1 / 9) * Math.abs(rotationParam.backDeg1 + mesh.rotation.z),
+          overwrite: true,
+        });
+      });
+    } else if (flag === 3) {
+      // 后风窗动画
+      this.windowsActionArr.centerWindow.forEach((mesh) => {
+        gsap.to(mesh.rotation, {
+          z: -THREE.MathUtils.degToRad(rotationParam.centerDeg1),
+          duration: (1 / 9) * Math.abs(rotationParam.centerDeg1 + mesh.rotation.z),
+          overwrite: true,
+        });
+      });
+    } else if (flag === 0) {
+      ([...this.windowsActionArr.frontWindow, ...this.windowsActionArr.backWindow, ...this.windowsActionArr.centerWindow] as THREE.Mesh[]).forEach(
+        (mesh) => {
+          gsap.to(mesh.rotation, {
+            z: 0,
+            overwrite: true,
+          });
+        }
+      );
+    }
+  }
+  mountedThree() {
+    return new Promise((resolve) => {
+      this.model.setGLTFModel('threeFc-sdg').then((gltf) => {
+        const fcModal = gltf[0];
+        fcModal.name = this.modelName;
+        // this.group?.add(fcModal);
+        this.group = fcModal;
+        this.setModalPosition();
+        this.initAnimation();
+        resolve(null);
+        this.addLight();
+      });
+    });
+  }
+
+  destroy() {
+    this.model.clearGroup(this.group);
+    this.windowsActionArr.frontWindow = undefined;
+    this.windowsActionArr.backWindow = undefined;
+    this.model = null;
+    this.group = null;
+  }
+}
+
+export default threeFc_8;