浏览代码

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

bobo04052021@163.com 3 天之前
父节点
当前提交
b85e504c2b

+ 3 - 3
.env.development

@@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = /
 
 # 跨域代理,您可以配置多个 ,请注意,没有换行符
 #VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
-VITE_PROXY = [["/sw","http://182.92.126.35:6008"],["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"], ["/python", "http://127.0.0.1:8008"], ["/tun2D", "http://127.0.0.1:8088/micro-vent-2dModal/tun2D"]]
+VITE_PROXY = [["/sw","http://182.92.126.35:6008"],["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"], ["/python", "http://127.0.0.1:8008"], ["/tun2D", "http://127.0.0.1:8088/micro-vent-2dModal/tun2D"],["/dataCenter", "http://192.168.1.88:10999"]]
 # VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://10.10.150.72:9999"],["/upload","http://localhost:3300/upload"],["/documents", "http://10.10.150.72:9050"],["/modelreq", "http://10.10.150.72:9999"],["/webRtc", "http://192.168.183.216:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://192.168.1.8:9999"],["/upload","http://localhost:3300/upload"]]
@@ -29,7 +29,7 @@ VITE_GLOB_API_URL_PREFIX=
 
 #微前端qiankun应用,命名必须以VITE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
 #VITE_APP_SUB_APP = [["micro-need-air", "//10.10.150.72:8099/"], ["micro-vent-3dModal", "//localhost:8091/"], ["micro-fire-front", "//localhost:8090/"]]
-# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.88:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.154:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
-VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"],["micro-vent-2dModal", "//localhost:8088/", "micro-vent-2dModal"],["micro-vent-doc", "//localhost:5173/", "micro-vent-doc"],["micro-need-air", "//182.92.126.35:8093/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
+VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.1.16:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
+# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"],["micro-vent-2dModal", "//localhost:8088/", "micro-vent-2dModal"],["micro-vent-doc", "//localhost:5173/", "micro-vent-doc"],["micro-need-air", "//182.92.126.35:8093/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//localhost:8091/"], ["micro-need-air", "//localhost:8099/"], ["micro-fire-front", "//localhost:8090/"]]

+ 1 - 1
src/store/constant.ts

@@ -1,2 +1,2 @@
 export const MOCK_LOGIN_UESRNAME = 'autoAdmin';
-export const MOCK_LOGIN_PASSWORD = 'TOdspLGTgSCYCmlXsE1ynw=='; //autoAdmin123;
+export const MOCK_LOGIN_PASSWORD = 'autoAdmin123';

+ 13 - 3
src/utils/http/axios/index.ts

@@ -18,9 +18,14 @@ import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog';
 import { useI18n } from '/@/hooks/web/useI18n';
 import { joinTimestamp, formatRequestDate } from './helper';
 import { useUserStoreWithOut } from '/@/store/modules/user';
+
 const globSetting = useGlobSetting();
 const urlPrefix = globSetting.urlPrefix;
 const { createMessage, createErrorModal } = useMessage();
+debugger;
+const proxyFixList = JSON.parse(import.meta.env.VITE_PROXY + '').map((item) => {
+  return item[0].replace(/\//g, '');
+});
 
 /**
  * @description: 数据处理,方便区分多种处理方式
@@ -105,16 +110,21 @@ const transform: AxiosTransform = {
   // 请求之前处理config
   beforeRequestHook: (config, options) => {
     const { apiUrl, joinPrefix, joinParamsToUrl, formatDate, joinTime = true, urlPrefix } = options;
+    debugger;
     if (!config.url.startsWith('http')) {
       if (joinPrefix) {
         config.url = `${urlPrefix}${config.url}`;
       }
       if (apiUrl && isString(apiUrl)) {
-        if (config.url?.startsWith('/gasServerImg')) {
-          config.url = `/sw${config.url}`;
-        } else {
+        const firstCode = config.url?.split('/')[1];
+        if (!proxyFixList || !proxyFixList.includes(firstCode)) {
           config.url = `${apiUrl}${config.url}`;
         }
+        // if (config.url?.startsWith('/gasServerImg')) {
+        //   config.url = `/sw${config.url}`;
+        // } else {
+        //   config.url = `${apiUrl}${config.url}`;
+        // }
       }
       const params = config.params || {};
       const data = config.data || false;

+ 3 - 3
src/views/vent/gas/gasReport/gas-report.api.ts

@@ -8,8 +8,8 @@ enum Api {
   getIsReviewPass = '/safety/gasDayReport/getIsReviewPass',
   getAllUserInfo = '/safety/gasInsCard/getAllUserInfo',
   exportReportByPoi = '/safety/reportInfo/exportReportByPoi',
- queryUserByRoleCode= '/safety/gasInsCard/queryUserByRoleCode',//通过角色编码查询角色下所有用户
- gasServerImg='/gasServerImg',//获取瓦斯巡检图片
+  queryUserByRoleCode = '/safety/gasInsCard/queryUserByRoleCode', //通过角色编码查询角色下所有用户
+  gasServerImg = '/sw/gasServerImg', //获取瓦斯巡检图片
 }
 /**
  * 获取瓦斯日报区队,检测地点下拉选项
@@ -45,4 +45,4 @@ export const exportReportByPoi = (params) => defHttp.post({ url: Api.exportRepor
 
 export const queryUserByRoleCode = (params) => defHttp.get({ url: Api.queryUserByRoleCode, params });
 
-export const gasServerImg = (params) => defHttp.post({ url: Api.gasServerImg, params,responseType: 'blob' });
+export const gasServerImg = (params) => defHttp.post({ url: Api.gasServerImg, params, responseType: 'blob' });

+ 486 - 454
src/views/vent/gas/gasReport/index.vue

@@ -7,8 +7,13 @@
           <a-col :span="4">
             <div class="area-item">
               <div class="item-text">日期区间:</div>
-              <a-date-picker style="width: 220px" :showTime="false" valueFormat="YYYY-MM-DD"
-                v-model:value="searchData.reportTime" placeholder="请选择填报日期" />
+              <a-date-picker
+                style="width: 220px"
+                :showTime="false"
+                valueFormat="YYYY-MM-DD"
+                v-model:value="searchData.reportTime"
+                placeholder="请选择填报日期"
+              />
             </div>
           </a-col>
 
@@ -22,21 +27,18 @@
             <div class="area-item">
               <div class="item-text">上报地点:</div>
               <a-select v-model:value="searchData.strInstallPos" style="width: 220px" placeholder="请选择上报地点">
-                <a-select-option v-for="item in addressList" :key="item" :value="item.value">{{ item.label
-                }}</a-select-option>
+                <a-select-option v-for="item in addressList" :key="item" :value="item.value">{{ item.label }}</a-select-option>
               </a-select>
             </div>
           </a-col>
 
           <a-button type="primary" preIcon="ant-design:search-outlined" @click="getSearch">查询</a-button>
           <a-button preIcon="ant-design:sync-outlined" style="margin: 0px 10px" @click="onReset">重置</a-button>
-          <a-button type="primary" preIcon="ant-design:check-circle-outlined" style="margin-right: 10px"
-            @click="getPassSh">审核通过</a-button>
+          <a-button type="primary" preIcon="ant-design:check-circle-outlined" style="margin-right: 10px" @click="getPassSh">审核通过</a-button>
           <a-button type="primary" preIcon="ant-design:download-outlined" @click="getExport">导出日报表</a-button>
           <!-- <a-button type="primary" preIcon="ant-design:download-outlined" @click="getExport1"
             style="margin: 0px 10px">导出瓦斯三对照报表</a-button> -->
-          <a-button type="primary" preIcon="ant-design:download-outlined" @click="getExport2"
-            style="margin: 0px 10px">导出瓦斯检查小票</a-button>
+          <a-button type="primary" preIcon="ant-design:download-outlined" @click="getExport2" style="margin: 0px 10px">导出瓦斯检查小票</a-button>
           <a-button type="primary" preIcon="ant-design:download-outlined" @click="handleMenuClick">导出班报表</a-button>
           <!-- <a-dropdown>
             <template #overlay>
@@ -64,64 +66,86 @@
 </a-dropdown> -->
         </a-row>
       </div>
-      <a-table :columns="columns" :data-source="tableData" size="small" :scroll="{ y: 500 }" class="tableW"
-        :pagination="pagination" @change="pageChange">
+      <a-table
+        :columns="columns"
+        :data-source="tableData"
+        size="small"
+        :scroll="{ y: 500 }"
+        class="tableW"
+        :pagination="pagination"
+        @change="pageChange"
+      >
         <template #bodyCell="{ column, text, record }">
           <template
-            v-if="column.dataIndex == 'night1' || column.dataIndex == 'night2' || column.dataIndex == 'early1' || column.dataIndex == 'early2' || column.dataIndex == 'noon1' || column.dataIndex == 'noon2'">
-            <a-button class="img-view" type="text" size="small"
-              @click="imgViewClick({ record, dataIndex: column.dataIndex })">查看</a-button>
+            v-if="
+              column.dataIndex == 'night1' ||
+              column.dataIndex == 'night2' ||
+              column.dataIndex == 'early1' ||
+              column.dataIndex == 'early2' ||
+              column.dataIndex == 'noon1' ||
+              column.dataIndex == 'noon2'
+            "
+          >
+            <a-button class="img-view" type="text" size="small" @click="imgViewClick({ record, dataIndex: column.dataIndex })">查看</a-button>
           </template>
-          <template v-if="
-            column.dataIndex == 'o2Night1' ||
-            column.dataIndex == 'o2Night2' ||
-            column.dataIndex == 'o2Early1' ||
-            column.dataIndex == 'o2Early2' ||
-            column.dataIndex == 'o2Noon1' ||
-            column.dataIndex == 'o2Noon2'
-          ">
-            <div :style="{ color: Number(text) >= 18 && Number(text) <= 20.9 ? '#0ae715' : '#ff2313' }">{{ text }}
-            </div>
+          <template
+            v-if="
+              column.dataIndex == 'o2Night1' ||
+              column.dataIndex == 'o2Night2' ||
+              column.dataIndex == 'o2Early1' ||
+              column.dataIndex == 'o2Early2' ||
+              column.dataIndex == 'o2Noon1' ||
+              column.dataIndex == 'o2Noon2'
+            "
+          >
+            <div :style="{ color: Number(text) >= 18 && Number(text) <= 20.9 ? '#0ae715' : '#ff2313' }">{{ text }} </div>
           </template>
-          <template v-if="
-            column.dataIndex == 'coNight1' ||
-            column.dataIndex == 'coNight2' ||
-            column.dataIndex == 'coEarly1' ||
-            column.dataIndex == 'coEarly2' ||
-            column.dataIndex == 'coNoon1' ||
-            column.dataIndex == 'coNoon2'
-          ">
+          <template
+            v-if="
+              column.dataIndex == 'coNight1' ||
+              column.dataIndex == 'coNight2' ||
+              column.dataIndex == 'coEarly1' ||
+              column.dataIndex == 'coEarly2' ||
+              column.dataIndex == 'coNoon1' ||
+              column.dataIndex == 'coNoon2'
+            "
+          >
             <div :style="{ color: Number(text) >= 0 && Number(text) <= 23 ? '#0ae715' : '#ff2313' }">{{ text }}</div>
           </template>
-          <template v-if="
-            column.dataIndex == 'tnight1' ||
-            column.dataIndex == 'tnight2' ||
-            column.dataIndex == 'tearly1' ||
-            column.dataIndex == 'tearly2' ||
-            column.dataIndex == 'tnoon1' ||
-            column.dataIndex == 'tnoon2'
-          ">
+          <template
+            v-if="
+              column.dataIndex == 'tnight1' ||
+              column.dataIndex == 'tnight2' ||
+              column.dataIndex == 'tearly1' ||
+              column.dataIndex == 'tearly2' ||
+              column.dataIndex == 'tnoon1' ||
+              column.dataIndex == 'tnoon2'
+            "
+          >
             <div :style="{ color: Number(text) >= 3 && Number(text) <= 25 ? '#0ae715' : '#ff2313' }">{{ text }}</div>
           </template>
-          <template v-if="
-            column.dataIndex == 'co2Night1' ||
-            column.dataIndex == 'co2Night2' ||
-            column.dataIndex == 'co2Early1' ||
-            column.dataIndex == 'co2Early2' ||
-            column.dataIndex == 'co2Noon1' ||
-            column.dataIndex == 'co2Noon2'
-          ">
-            <div :style="{ color: Number(text) >= 0.04 && Number(text) <= 0.1 ? '#0ae715' : '#ff2313' }">{{ text }}
-            </div>
+          <template
+            v-if="
+              column.dataIndex == 'co2Night1' ||
+              column.dataIndex == 'co2Night2' ||
+              column.dataIndex == 'co2Early1' ||
+              column.dataIndex == 'co2Early2' ||
+              column.dataIndex == 'co2Noon1' ||
+              column.dataIndex == 'co2Noon2'
+            "
+          >
+            <div :style="{ color: Number(text) >= 0.04 && Number(text) <= 0.1 ? '#0ae715' : '#ff2313' }">{{ text }} </div>
           </template>
-          <template v-if="
-            column.dataIndex == 'ch4Night1' ||
-            column.dataIndex == 'ch4Night2' ||
-            column.dataIndex == 'ch4Early1' ||
-            column.dataIndex == 'ch4Early2' ||
-            column.dataIndex == 'ch4Noon1' ||
-            column.dataIndex == 'ch4Noon2'
-          ">
+          <template
+            v-if="
+              column.dataIndex == 'ch4Night1' ||
+              column.dataIndex == 'ch4Night2' ||
+              column.dataIndex == 'ch4Early1' ||
+              column.dataIndex == 'ch4Early2' ||
+              column.dataIndex == 'ch4Noon1' ||
+              column.dataIndex == 'ch4Noon2'
+            "
+          >
             <div :style="{ color: Number(text) >= 0 && Number(text) <= 0.1 ? '#0ae715' : '#ff2313' }">{{ text }}</div>
           </template>
         </template>
@@ -131,446 +155,454 @@
       <BasicForm @register="registerForm" />
     </BasicModal>
 
-    <BasicModal @register="registerPageTypeModal" :showCancelBtn="false" :showOkBtn="false" :footer="null"
-      :defaultFullscreen="true" destroyOnClose>
-      <img style="width:100%;height:100%" :src="imgSrcView">
+    <BasicModal @register="registerPageTypeModal" :showCancelBtn="false" :showOkBtn="false" :footer="null" :defaultFullscreen="true" destroyOnClose>
+      <img style="width: 100%; height: 100%" :src="imgSrcView" />
     </BasicModal>
   </div>
 </template>
 
 <script setup lang="ts">
-import { ref, onMounted, reactive } from 'vue';
-import { columns } from './gas-report.data';
-import { getGasAddressList, getList, expComReportByParam, reviewPass, getIsReviewPass, getAllUserInfo, exportReportByPoi, queryUserByRoleCode, gasServerImg } from './gas-report.api';
-import customHeader from '/@/components/vent/customHeader.vue';
-import { message } from 'ant-design-vue';
-import dayjs from 'dayjs';
-import { BasicModal, useModal } from '/@/components/Modal';
-import { BasicForm, useForm } from '/@/components/Form';
+  import { ref, onMounted, reactive } from 'vue';
+  import { columns } from './gas-report.data';
+  import {
+    getGasAddressList,
+    getList,
+    expComReportByParam,
+    reviewPass,
+    getIsReviewPass,
+    getAllUserInfo,
+    exportReportByPoi,
+    queryUserByRoleCode,
+    gasServerImg,
+  } from './gas-report.api';
+  import customHeader from '/@/components/vent/customHeader.vue';
+  import { message } from 'ant-design-vue';
+  import dayjs from 'dayjs';
+  import { BasicModal, useModal } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form';
 
-let imgSrcView = ref('')
-let searchData = reactive({
-  reportTime: dayjs().format('YYYY-MM-DD'),
-  sbr: '',
-  strInstallPos: '',
-});
-let addressList = ref<any[]>([]); //上报地点下拉列表
-let pagination = reactive({
-  current: 1, // 当前页码
-  pageSize: 10, // 每页显示条数
-  total: 0, // 总条目数,后端返回
-  // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
-  showSizeChanger: true, // 是否可改变每页显示条数
-  pageSizeOptions: ['10', '20', '50'], // 可选的每页显示条数
-});
-let tableData = ref<any[]>([]);
-const [registerPageTypeModal, pageTypeModalCtx] = useModal();
-const [registerModal, { openModal }] = useModal();
+  let imgSrcView = ref('');
+  let searchData = reactive({
+    reportTime: dayjs().format('YYYY-MM-DD'),
+    sbr: '',
+    strInstallPos: '',
+  });
+  let addressList = ref<any[]>([]); //上报地点下拉列表
+  let pagination = reactive({
+    current: 1, // 当前页码
+    pageSize: 10, // 每页显示条数
+    total: 0, // 总条目数,后端返回
+    // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
+    showSizeChanger: true, // 是否可改变每页显示条数
+    pageSizeOptions: ['10', '20', '50'], // 可选的每页显示条数
+  });
+  let tableData = ref<any[]>([]);
+  const [registerPageTypeModal, pageTypeModalCtx] = useModal();
+  const [registerModal, { openModal }] = useModal();
 
-//打开瓦斯巡检预览弹窗
-function imgViewClick(record) {
-  imgSrcView.value = ''
-  pageTypeModalCtx.openModal()
-  getImage(record)
-}
-//获取瓦斯巡检图片
-function getImage(record) {
-  console.log(record, '000===')
-  let params
-  switch (record.dataIndex) {
-    case 'night1':
-      params = {
-        reportdate: record.record.reportTime,
-        checkpath: record.record.strInstallPos,
-        order: '夜班',
-        checkorder: 1,
-      }
-      getImageList(params)
-      break;
-    case 'night2':
-      params = {
-        reportdate: record.record.reportTime,
-        checkpath: record.record.strInstallPos,
-        order: '夜班',
-        checkorder: 2,
-      }
-      getImageList(params)
-      break;
-    case 'early1':
-      params = {
-        reportdate: record.record.reportTime,
-        checkpath: record.record.strInstallPos,
-        order: '早班',
-        checkorder: 1,
-      }
-      getImageList(params)
-      break;
-    case 'early2':
-      params = {
-        reportdate: record.record.reportTime,
-        checkpath: record.record.strInstallPos,
-        order: '早班',
-        checkorder: 2,
-      }
-      getImageList(params)
-      break;
-    case 'noon1':
-      params = {
-        reportdate: record.record.reportTime,
-        checkpath: record.record.strInstallPos,
-        order: '中班',
-        checkorder: 1,
-      }
-      getImageList(params)
-      break;
-    case 'noon2':
-      params = {
-        reportdate: record.record.reportTime,
-        checkpath: record.record.strInstallPos,
-        order: '中班',
-        checkorder: 2,
-      }
-      getImageList(params)
-      break;
+  //打开瓦斯巡检预览弹窗
+  function imgViewClick(record) {
+    imgSrcView.value = '';
+    pageTypeModalCtx.openModal();
+    getImage(record);
+  }
+  //获取瓦斯巡检图片
+  function getImage(record) {
+    console.log(record, '000===');
+    let params;
+    switch (record.dataIndex) {
+      case 'night1':
+        params = {
+          reportdate: record.record.reportTime,
+          checkpath: record.record.strInstallPos,
+          order: '夜班',
+          checkorder: 1,
+        };
+        getImageList(params);
+        break;
+      case 'night2':
+        params = {
+          reportdate: record.record.reportTime,
+          checkpath: record.record.strInstallPos,
+          order: '夜班',
+          checkorder: 2,
+        };
+        getImageList(params);
+        break;
+      case 'early1':
+        params = {
+          reportdate: record.record.reportTime,
+          checkpath: record.record.strInstallPos,
+          order: '早班',
+          checkorder: 1,
+        };
+        getImageList(params);
+        break;
+      case 'early2':
+        params = {
+          reportdate: record.record.reportTime,
+          checkpath: record.record.strInstallPos,
+          order: '早班',
+          checkorder: 2,
+        };
+        getImageList(params);
+        break;
+      case 'noon1':
+        params = {
+          reportdate: record.record.reportTime,
+          checkpath: record.record.strInstallPos,
+          order: '中班',
+          checkorder: 1,
+        };
+        getImageList(params);
+        break;
+      case 'noon2':
+        params = {
+          reportdate: record.record.reportTime,
+          checkpath: record.record.strInstallPos,
+          order: '中班',
+          checkorder: 2,
+        };
+        getImageList(params);
+        break;
+    }
   }
-}
-
-
-async function getImageList(params) {
-  let res = await gasServerImg(params)
-  const img = new Blob(res, { type: 'image/png' }); // 创建Blob对象
-  imgSrcView.value = URL.createObjectURL(img); // 创建可访问的URL
-}
-//获取日报列表数据
-async function getTableList() {
-  let res = await getList({ pageNo: pagination.current, pageSize: pagination.pageSize, ...searchData });
-  res.records.forEach((el) => {
-    el.jwSdzNight1 = el.jwSdzNight1 || '-';
-    el.jwSdzNight2 = el.jwSdzNight2 || '-';
-    el.jwSdzEarly1 = el.jwSdzEarly1 || '-';
-    el.jwSdzEarly2 = el.jwSdzEarly2 || '-';
-    el.jwSdzNoon1 = el.jwSdzNoon1 || '-';
-    el.jwSdzNoon2 = el.jwSdzNoon2 || '-';
-  });
-  tableData.value = res.records;
-  pagination.total = res.total;
-}
-//查询
-function getSearch() {
-  pagination.current = 1;
-  getTableList();
-}
-//重置
-function onReset() {
-  pagination.current = 1;
-  searchData.reportTime = '';
-  searchData.strInstallPos = '';
-  searchData.sbr = '';
-  getTableList();
-}
-//分页切换
-function pageChange(val) {
-  pagination.current = val.current;
-  pagination.pageSize = val.pageSize;
-  getTableList();
-}
 
-//获取安装位置下拉选项
-async function getSelectList() {
-  let res = await getGasAddressList({ coalseam: '', devicekind: 'gasDayReport' });
-  if (res.length != 0) {
-    addressList.value = res.map((el) => {
-      return { label: el.strinstallpos, value: el.strinstallpos }
+  async function getImageList(params) {
+    let res = await gasServerImg(params);
+    const img = new Blob(res, { type: 'image/png' }); // 创建Blob对象
+    imgSrcView.value = URL.createObjectURL(img); // 创建可访问的URL
+  }
+  //获取日报列表数据
+  async function getTableList() {
+    let res = await getList({ pageNo: pagination.current, pageSize: pagination.pageSize, ...searchData });
+    res.records.forEach((el) => {
+      el.jwSdzNight1 = el.jwSdzNight1 || '-';
+      el.jwSdzNight2 = el.jwSdzNight2 || '-';
+      el.jwSdzEarly1 = el.jwSdzEarly1 || '-';
+      el.jwSdzEarly2 = el.jwSdzEarly2 || '-';
+      el.jwSdzNoon1 = el.jwSdzNoon1 || '-';
+      el.jwSdzNoon2 = el.jwSdzNoon2 || '-';
     });
+    tableData.value = res.records;
+    pagination.total = res.total;
   }
-}
-//导出报表
-async function getExport() {
-  if (getTs()) {
-    message.warning('数据异常!');
-  } else {
-    if (searchData.reportTime) {
-      let data = await getIsReviewPass({ reportTime: searchData.reportTime });
-      if (data == '已审核通过!') {
-        let res = await expComReportByParam({ tempName: 'wsrb', reportTime: searchData.reportTime });
-        let filename = searchData.reportTime + '.xlsx';
-        downFilePublic(res, filename);
-      }
+  //查询
+  function getSearch() {
+    pagination.current = 1;
+    getTableList();
+  }
+  //重置
+  function onReset() {
+    pagination.current = 1;
+    searchData.reportTime = '';
+    searchData.strInstallPos = '';
+    searchData.sbr = '';
+    getTableList();
+  }
+  //分页切换
+  function pageChange(val) {
+    pagination.current = val.current;
+    pagination.pageSize = val.pageSize;
+    getTableList();
+  }
+
+  //获取安装位置下拉选项
+  async function getSelectList() {
+    let res = await getGasAddressList({ coalseam: '', devicekind: 'gasDayReport' });
+    if (res.length != 0) {
+      addressList.value = res.map((el) => {
+        return { label: el.strinstallpos, value: el.strinstallpos };
+      });
+    }
+  }
+  //导出报表
+  async function getExport() {
+    if (getTs()) {
+      message.warning('数据异常!');
     } else {
+      if (searchData.reportTime) {
+        let data = await getIsReviewPass({ reportTime: searchData.reportTime });
+        if (data == '已审核通过!') {
+          let res = await expComReportByParam({ tempName: 'wsrb', reportTime: searchData.reportTime });
+          let filename = searchData.reportTime + '.xlsx';
+          downFilePublic(res, filename);
+        }
+      } else {
+        message.warning('请选择需要导出数据的填报日期!');
+      }
+    }
+  }
+  //导出三对照报表
+  // async function getExport1() {
+  //   if (searchData.reportTime) {
+  //     let res = await expComReportByParam({ tempName: 'wssdz', reportTime: searchData.reportTime });
+  //     let filename = searchData.reportTime + '.xlsx';
+  //     downFilePublic(res, filename);
+  //   } else {
+  //     message.warning('请选择需要导出数据的填报日期!');
+  //   }
+  // }
+  //导出瓦斯检查小票
+  async function getExport2() {
+    if (searchData.reportTime) {
+      openModal();
+    } else if (!searchData.reportTime) {
       message.warning('请选择需要导出数据的填报日期!');
+    } else if (!searchData.sbr) {
+      message.warning('请输入检查工名称!');
     }
   }
-}
-//导出三对照报表
-// async function getExport1() {
-//   if (searchData.reportTime) {
-//     let res = await expComReportByParam({ tempName: 'wssdz', reportTime: searchData.reportTime });
-//     let filename = searchData.reportTime + '.xlsx';
-//     downFilePublic(res, filename);
-//   } else {
-//     message.warning('请选择需要导出数据的填报日期!');
-//   }
-// }
-//导出瓦斯检查小票
-async function getExport2() {
-  if (searchData.reportTime) {
-    openModal();
-  } else if (!searchData.reportTime) {
-    message.warning('请选择需要导出数据的填报日期!');
-  } else if (!searchData.sbr) {
-    message.warning('请输入检查工名称!');
+
+  function getTs() {
+    let param = true;
+    tableData.value.forEach((el) => {
+      if (
+        Number(el.o2Night1) >= 18 &&
+        Number(el.o2Night1) <= 20.9 &&
+        Number(el.o2Night2) >= 18 &&
+        Number(el.o2Night2) <= 20.9 &&
+        Number(el.o2Early1) >= 18 &&
+        Number(el.o2Early1) <= 20.9 &&
+        Number(el.o2Early2) >= 18 &&
+        Number(el.o2Early2) <= 20.9 &&
+        Number(el.o2Noon1) >= 18 &&
+        Number(el.o2Noon1) <= 20.9 &&
+        Number(el.o2Noon2) >= 18 &&
+        Number(el.o2Noon2) <= 20.9
+      ) {
+        param = false;
+      } else if (
+        Number(el.coNight1) >= 0 &&
+        Number(el.coNight1) <= 23 &&
+        Number(el.coNight2) >= 0 &&
+        Number(el.coNight2) <= 23 &&
+        Number(el.coEarly1) >= 0 &&
+        Number(el.coEarly1) <= 23 &&
+        Number(el.coEarly2) >= 0 &&
+        Number(el.coEarly2) <= 23 &&
+        Number(el.coNoon1) >= 0 &&
+        Number(el.coNoon1) <= 23 &&
+        Number(el.coNoon2) >= 0 &&
+        Number(el.coNoon2) <= 23
+      ) {
+        param = false;
+      } else if (
+        Number(el.co2Night1) >= 0.04 &&
+        Number(el.co2Night1) <= 0.1 &&
+        Number(el.co2Night2) >= 0.04 &&
+        Number(el.co2Night2) <= 0.1 &&
+        Number(el.co2Early1) >= 0.04 &&
+        Number(el.co2Early1) <= 0.1 &&
+        Number(el.co2Early2) >= 0.04 &&
+        Number(el.co2Early2) <= 0.1 &&
+        Number(el.co2Noon1) >= 0.04 &&
+        Number(el.co2Noon1) <= 0.1 &&
+        Number(el.co2Noon2) >= 0.04 &&
+        Number(el.co2Noon2) <= 0.1
+      ) {
+        param = false;
+      } else if (
+        Number(el.tnight1) >= 3 &&
+        Number(el.tnight1) <= 25 &&
+        Number(el.tnight2) >= 3 &&
+        Number(el.tnight2) <= 25 &&
+        Number(el.tearly1) >= 3 &&
+        Number(el.tearly1) <= 25 &&
+        Number(el.tearly2) >= 3 &&
+        Number(el.tearly2) <= 25 &&
+        Number(el.tnoon1) >= 3 &&
+        Number(el.tnoon1) <= 25 &&
+        Number(el.tnoon2) >= 3 &&
+        Number(el.tnoon2) <= 25
+      ) {
+        param = false;
+      } else if (
+        Number(el.ch4Night1) >= 0 &&
+        Number(el.ch4Night1) <= 0.1 &&
+        Number(el.ch4Night2) >= 0 &&
+        Number(el.ch4Night2) <= 0.1 &&
+        Number(el.ch4Early1) >= 0 &&
+        Number(el.ch4Early1) <= 0.1 &&
+        Number(el.ch4Early2) >= 0 &&
+        Number(el.ch4Early2) <= 0.1 &&
+        Number(el.ch4Noon1) >= 0 &&
+        Number(el.ch4Noon1) <= 0.1 &&
+        Number(el.ch4Noon2) >= 0 &&
+        Number(el.ch4Noon2) <= 0.1
+      ) {
+        param = false;
+      } else {
+        param = true;
+        return;
+      }
+    });
+    return param;
   }
-}
 
-function getTs() {
-  let param = true;
-  tableData.value.forEach((el) => {
-    if (
-      Number(el.o2Night1) >= 18 &&
-      Number(el.o2Night1) <= 20.9 &&
-      Number(el.o2Night2) >= 18 &&
-      Number(el.o2Night2) <= 20.9 &&
-      Number(el.o2Early1) >= 18 &&
-      Number(el.o2Early1) <= 20.9 &&
-      Number(el.o2Early2) >= 18 &&
-      Number(el.o2Early2) <= 20.9 &&
-      Number(el.o2Noon1) >= 18 &&
-      Number(el.o2Noon1) <= 20.9 &&
-      Number(el.o2Noon2) >= 18 &&
-      Number(el.o2Noon2) <= 20.9
-    ) {
-      param = false;
-    } else if (
-      Number(el.coNight1) >= 0 &&
-      Number(el.coNight1) <= 23 &&
-      Number(el.coNight2) >= 0 &&
-      Number(el.coNight2) <= 23 &&
-      Number(el.coEarly1) >= 0 &&
-      Number(el.coEarly1) <= 23 &&
-      Number(el.coEarly2) >= 0 &&
-      Number(el.coEarly2) <= 23 &&
-      Number(el.coNoon1) >= 0 &&
-      Number(el.coNoon1) <= 23 &&
-      Number(el.coNoon2) >= 0 &&
-      Number(el.coNoon2) <= 23
-    ) {
-      param = false;
-    } else if (
-      Number(el.co2Night1) >= 0.04 &&
-      Number(el.co2Night1) <= 0.1 &&
-      Number(el.co2Night2) >= 0.04 &&
-      Number(el.co2Night2) <= 0.1 &&
-      Number(el.co2Early1) >= 0.04 &&
-      Number(el.co2Early1) <= 0.1 &&
-      Number(el.co2Early2) >= 0.04 &&
-      Number(el.co2Early2) <= 0.1 &&
-      Number(el.co2Noon1) >= 0.04 &&
-      Number(el.co2Noon1) <= 0.1 &&
-      Number(el.co2Noon2) >= 0.04 &&
-      Number(el.co2Noon2) <= 0.1
-    ) {
-      param = false;
-    } else if (
-      Number(el.tnight1) >= 3 &&
-      Number(el.tnight1) <= 25 &&
-      Number(el.tnight2) >= 3 &&
-      Number(el.tnight2) <= 25 &&
-      Number(el.tearly1) >= 3 &&
-      Number(el.tearly1) <= 25 &&
-      Number(el.tearly2) >= 3 &&
-      Number(el.tearly2) <= 25 &&
-      Number(el.tnoon1) >= 3 &&
-      Number(el.tnoon1) <= 25 &&
-      Number(el.tnoon2) >= 3 &&
-      Number(el.tnoon2) <= 25
-    ) {
-      param = false;
-    } else if (
-      Number(el.ch4Night1) >= 0 &&
-      Number(el.ch4Night1) <= 0.1 &&
-      Number(el.ch4Night2) >= 0 &&
-      Number(el.ch4Night2) <= 0.1 &&
-      Number(el.ch4Early1) >= 0 &&
-      Number(el.ch4Early1) <= 0.1 &&
-      Number(el.ch4Early2) >= 0 &&
-      Number(el.ch4Early2) <= 0.1 &&
-      Number(el.ch4Noon1) >= 0 &&
-      Number(el.ch4Noon1) <= 0.1 &&
-      Number(el.ch4Noon2) >= 0 &&
-      Number(el.ch4Noon2) <= 0.1
-    ) {
-      param = false;
+  //审核通过
+  async function getPassSh() {
+    if (getTs()) {
+      message.warning('数据异常!');
     } else {
-      param = true;
-      return;
-    }
-  });
-  return param;
-}
-
-//审核通过
-async function getPassSh() {
-  if (getTs()) {
-    message.warning('数据异常!');
-  } else {
-    let res = await reviewPass({ reportTime: searchData.reportTime });
-    if (res) {
-      getTableList();
+      let res = await reviewPass({ reportTime: searchData.reportTime });
+      if (res) {
+        getTableList();
+      }
     }
   }
-}
 
-// 下载公用方法
-function downFilePublic(content, fileName) {
-  const blob = new Blob([content], { type: 'application/xlsx;charset=UTF-8' }); // 构造一个blob对象来处理数据
-  // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
-  // IE10以上支持blob但是依然不支持download
-  if ('download' in document.createElement('a')) {
-    // 支持a标签download的浏览器
-    const link = document.createElement('a'); // 创建a标签
-    link.download = fileName; // a标签添加属性
-    link.style.display = 'none';
-    link.href = URL.createObjectURL(blob);
-    document.body.appendChild(link);
-    link.click(); // 执行下载
-    URL.revokeObjectURL(link.href); // 释放url
-    document.body.removeChild(link); // 释放标签
-  } else {
-    // 其他浏览器
-    navigator.msSaveBlob(blob, fileName);
+  // 下载公用方法
+  function downFilePublic(content, fileName) {
+    const blob = new Blob([content], { type: 'application/xlsx;charset=UTF-8' }); // 构造一个blob对象来处理数据
+    // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
+    // IE10以上支持blob但是依然不支持download
+    if ('download' in document.createElement('a')) {
+      // 支持a标签download的浏览器
+      const link = document.createElement('a'); // 创建a标签
+      link.download = fileName; // a标签添加属性
+      link.style.display = 'none';
+      link.href = URL.createObjectURL(blob);
+      document.body.appendChild(link);
+      link.click(); // 执行下载
+      URL.revokeObjectURL(link.href); // 释放url
+      document.body.removeChild(link); // 释放标签
+    } else {
+      // 其他浏览器
+      navigator.msSaveBlob(blob, fileName);
+    }
   }
-}
-//导出瓦斯班报表
-async function handleMenuClick(val) {
-  if (searchData.reportTime) {
-    let res = await expComReportByParam({ tempName: 'wsrbshb', reportTime: searchData.reportTime });
-    let filename = searchData.reportTime + '.xlsx';
-    downFilePublic(res, filename);
-  } else {
-    message.warning('请选择需要导出数据的填报日期!');
+  //导出瓦斯班报表
+  async function handleMenuClick(val) {
+    if (searchData.reportTime) {
+      let res = await expComReportByParam({ tempName: 'wsrbshb', reportTime: searchData.reportTime });
+      let filename = searchData.reportTime + '.xlsx';
+      downFilePublic(res, filename);
+    } else {
+      message.warning('请选择需要导出数据的填报日期!');
+    }
   }
-}
-const [registerForm, { validate, setFieldsValue }] = useForm({
-  schemas: [
-    {
-      label: '检查工',
-      field: 'checkName',
-      component: 'ApiSelect',
-      required: true,
-      show: false,
-    },
-    {
-      label: '交班瓦检员',
-      field: 'agoCheckPerson',
-      component: 'ApiSelect',
-      required: true,
-      componentProps: {
-        api: queryUserByRoleCode,
-        params: { roleCode: 'gasCheck' },
-        labelField: 'realname',
-        valueField: 'username',
-        showSearch: true,
+  const [registerForm, { validate, setFieldsValue }] = useForm({
+    schemas: [
+      {
+        label: '检查工',
+        field: 'checkName',
+        component: 'ApiSelect',
+        required: true,
+        show: false,
       },
-    },
-    {
-      label: '当班瓦检员',
-      field: 'nowCheckPerson',
-      component: 'ApiSelect',
-      required: true,
-      componentProps: {
-        api: queryUserByRoleCode,
-        params: { roleCode: 'gasCheck' },
-        labelField: 'realname',
-        valueField: 'username',
-        showSearch: true,
-        onChange(__, { label }) {
-          setFieldsValue({
-            checkName: label,
-          });
+      {
+        label: '交班瓦检员',
+        field: 'agoCheckPerson',
+        component: 'ApiSelect',
+        required: true,
+        componentProps: {
+          api: queryUserByRoleCode,
+          params: { roleCode: 'gasCheck' },
+          labelField: 'realname',
+          valueField: 'username',
+          showSearch: true,
         },
       },
-    },
-    {
-      label: '接班瓦检员',
-      field: 'nextCheckPerson',
-      component: 'ApiSelect',
-      required: true,
-      componentProps: {
-        api: queryUserByRoleCode,
-        params: { roleCode: 'gasCheck' },
-        labelField: 'realname',
-        valueField: 'username',
-        showSearch: true,
+      {
+        label: '当班瓦检员',
+        field: 'nowCheckPerson',
+        component: 'ApiSelect',
+        required: true,
+        componentProps: {
+          api: queryUserByRoleCode,
+          params: { roleCode: 'gasCheck' },
+          labelField: 'realname',
+          valueField: 'username',
+          showSearch: true,
+          onChange(__, { label }) {
+            setFieldsValue({
+              checkName: label,
+            });
+          },
+        },
+      },
+      {
+        label: '接班瓦检员',
+        field: 'nextCheckPerson',
+        component: 'ApiSelect',
+        required: true,
+        componentProps: {
+          api: queryUserByRoleCode,
+          params: { roleCode: 'gasCheck' },
+          labelField: 'realname',
+          valueField: 'username',
+          showSearch: true,
+        },
       },
-    },
-  ],
-  labelWidth: 100,
-  showActionButtonGroup: false,
-});
+    ],
+    labelWidth: 100,
+    showActionButtonGroup: false,
+  });
 
-/** 导出瓦斯检查小票 */
-async function submitHandler() {
-  const params = await validate();
-  const res = await exportReportByPoi({ tempName: 'wsjcxp', reportTime: searchData.reportTime, ...params });
-  const filename = searchData.reportTime + '.xlsx';
-  downFilePublic(res, filename);
-}
+  /** 导出瓦斯检查小票 */
+  async function submitHandler() {
+    const params = await validate();
+    const res = await exportReportByPoi({ tempName: 'wsjcxp', reportTime: searchData.reportTime, ...params });
+    const filename = searchData.reportTime + '.xlsx';
+    downFilePublic(res, filename);
+  }
 
-onMounted(() => {
-  getSelectList();
-  getTableList();
-});
+  onMounted(() => {
+    getSelectList();
+    getTableList();
+  });
 </script>
 
 <style lang="less" scoped>
-@import '/@/design/theme.less';
+  @import '/@/design/theme.less';
 
-.gasReport {
-  width: 100%;
-  height: 100%;
-  padding: 80px 10px 15px 10px;
-  box-sizing: border-box;
-  position: relative;
+  .gasReport {
+    width: 100%;
+    height: 100%;
+    padding: 80px 10px 15px 10px;
+    box-sizing: border-box;
+    position: relative;
 
-  .search-area {
-    margin: 20px 0px;
+    .search-area {
+      margin: 20px 0px;
 
-    .area-item {
-      display: flex;
-      align-items: center;
+      .area-item {
+        display: flex;
+        align-items: center;
 
-      .item-text {
-        color: #fff;
+        .item-text {
+          color: #fff;
+        }
       }
     }
-  }
 
-  .zxm-picker,
-  .zxm-input {
-    border: 1px solid var(--vent-form-item-border) !important;
-    background-color: #ffffff00 !important;
-    color: #fff !important;
-  }
+    .zxm-picker,
+    .zxm-input {
+      border: 1px solid var(--vent-form-item-border) !important;
+      background-color: #ffffff00 !important;
+      color: #fff !important;
+    }
 
-  .img-view {
-    color: #1ff5e3;
+    .img-view {
+      color: #1ff5e3;
+    }
   }
-}
 
-:deep(.zxm-table-thead > tr > th:last-child) {
-  border-right: 1px solid #91e9fe !important;
-}
+  :deep(.zxm-table-thead > tr > th:last-child) {
+    border-right: 1px solid #91e9fe !important;
+  }
 
-:deep(.zxm-picker-input > input) {
-  color: #fff;
-}
+  :deep(.zxm-picker-input > input) {
+    color: #fff;
+  }
 
-:deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
-  border: 1px solid var(--vent-form-item-border) !important;
-  background-color: #ffffff00 !important;
-}
+  :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
+    border: 1px solid var(--vent-form-item-border) !important;
+    background-color: #ffffff00 !important;
+  }
 
-:deep(.zxm-select-selection-item) {
-  color: #fff !important;
-}
+  :deep(.zxm-select-selection-item) {
+    color: #fff !important;
+  }
 </style>

+ 78 - 78
src/views/vent/home/configurable/components/ModuleCommon.vue

@@ -23,102 +23,102 @@
   </Transition>
 </template>
 <script lang="ts" setup>
-import Header from './header.vue';
-import Content from './content.vue';
-// import ModuleLeft from './original/moduleLeft.vue';
-// import ModuleBottom from './original/moduleBottom.vue';
-import { computed, ref } from 'vue';
-import ventBox1 from '/@/components/vent/ventBox1.vue';
-import { openWindow } from '/@/utils';
-import { getFormattedText } from '../hooks/helper';
-// import { ModuleProps } from '../types';
+  import Header from './header.vue';
+  import Content from './content.vue';
+  // import ModuleLeft from './original/moduleLeft.vue';
+  // import ModuleBottom from './original/moduleBottom.vue';
+  import { computed, ref } from 'vue';
+  import ventBox1 from '/@/components/vent/ventBox1.vue';
+  import { openWindow } from '/@/utils';
+  import { getFormattedText } from '../hooks/helper';
+  // import { ModuleProps } from '../types';
 
-const props = defineProps<{
-  /** 配置的详细模块信息 */
-  moduleData: any;
-  /** 配置的详细样式信息 */
-  showStyle: any;
-  /** 该模块配置中的设备标识符 */
-  deviceType: string;
-  /** api返回的数据 */
-  data: any;
-  moduleName: string;
-  visible: boolean;
-  chartData: any;
-}>();
-defineEmits(['close', 'click']);
+  const props = defineProps<{
+    /** 配置的详细模块信息 */
+    moduleData: any;
+    /** 配置的详细样式信息 */
+    showStyle: any;
+    /** 该模块配置中的设备标识符 */
+    deviceType: string;
+    /** api返回的数据 */
+    data: any;
+    moduleName: string;
+    visible: boolean;
+    chartData?: any;
+  }>();
+  defineEmits(['close', 'click']);
 
-const { header } = props.moduleData;
-const selectedData = ref();
+  const { header } = props.moduleData;
+  const selectedData = ref();
 
-const style = computed(() => {
-  const size = props.showStyle.size;
-  const position = props.showStyle.position;
-  return size + position + 'position: absolute; pointer-events: auto; z-index: 1';
-});
+  const style = computed(() => {
+    const size = props.showStyle.size;
+    const position = props.showStyle.position;
+    return size + position + 'position: absolute; pointer-events: auto; z-index: 1';
+  });
 
-const capitalizedPosition = computed(() => {
-  return props.showStyle.position.includes('left') ? 'Left' : 'Right';
-});
+  const capitalizedPosition = computed(() => {
+    return props.showStyle.position.includes('left') ? 'Left' : 'Right';
+  });
 
-// 根据配置里的定位判断应该使用哪个class
-function getModuleClass({ size, position }) {
-  const [_, width] = size.match(/width:([0-9]+)px/) || [];
-  if (position.includes('bottom') || parseInt(width) > 800) {
-    return 'module-common module-common-longer';
+  // 根据配置里的定位判断应该使用哪个class
+  function getModuleClass({ size, position }) {
+    const [_, width] = size.match(/width:([0-9]+)px/) || [];
+    if (position.includes('bottom') || parseInt(width) > 800) {
+      return 'module-common module-common-longer';
+    }
+    return 'module-common';
   }
-  return 'module-common';
-}
 
-function redirectTo() {
-  const { to } = props.moduleData;
-  if (!to) return;
-  openWindow(getFormattedText(selectedData.value, to));
-}
+  function redirectTo() {
+    const { to } = props.moduleData;
+    if (!to) return;
+    openWindow(getFormattedText(selectedData.value, to));
+  }
 </script>
 <style lang="less" scoped>
-@import '/@/design/theme.less';
+  @import '/@/design/theme.less';
 
-.module-common .box1-center {
-  height: calc(100% - 48px);
-}
+  .module-common .box1-center {
+    height: calc(100% - 48px);
+  }
 
-:deep(.box1-center) {
-  height: calc(100% - 48px);
-}
-:deep(.box1-center > .box-container) {
-  height: 100%;
-  padding: 0 !important;
-  width: 100% !important;
-}
-@{theme-green} {
-  .module-common-longer {
-    :deep(.box1-top) {
-      --image-box1-top: url('/@/assets/images/themify/green/vent/border/box-top.png');
+  :deep(.box1-center) {
+    height: calc(100% - 48px);
+  }
+  :deep(.box1-center > .box-container) {
+    height: 100%;
+    padding: 0 !important;
+    width: 100% !important;
+  }
+  @{theme-green} {
+    .module-common-longer {
+      :deep(.box1-top) {
+        --image-box1-top: url('/@/assets/images/themify/green/vent/border/box-top.png');
+      }
+      :deep(.box1-bottom) {
+        --image-box1-bottom: url('/@/assets/images/themify/green/vent/border/box-bottom.png');
+      }
     }
-    :deep(.box1-bottom) {
-      --image-box1-bottom:  url('/@/assets/images/themify/green/vent/border/box-bottom.png');
+  }
+  @{theme-deepblue} {
+    .module-common-longer {
+      :deep(.box1-top) {
+        --image-box1-top: url('/@/assets/images/themify/deepblue/vent/border/box2-top-long.png');
+      }
+      :deep(.box1-bottom) {
+        --image-box1-bottom: none;
+      }
     }
   }
-}
-@{theme-deepblue} {
   .module-common-longer {
     :deep(.box1-top) {
-      --image-box1-top: url('/@/assets/images/themify/deepblue/vent/border/box2-top-long.png');
+      --image-box1-top: url('/@/assets/images/vent/box-top-bg.png');
+      background-image: var(--image-box1-top);
     }
     :deep(.box1-bottom) {
-      --image-box1-bottom: none;
+      --image-box1-bottom: url('/@/assets/images/vent/box-bottom-bg.png');
+      background-image: var(--image-box1-bottom);
     }
   }
-}
-.module-common-longer {
-  :deep(.box1-top) {
-    --image-box1-top: url('/@/assets/images/vent/box-top-bg.png');
-    background-image: var(--image-box1-top);
-  }
-  :deep(.box1-bottom) {
-    --image-box1-bottom: url('/@/assets/images/vent/box-bottom-bg.png');
-    background-image: var(--image-box1-bottom);
-  }
-}
 </style>

+ 33 - 0
src/views/vent/monitorManager/balancePressMonitor/balancePress.data.ts

@@ -215,3 +215,36 @@ export const settingParam4 = [
     unit: '%',
   },
 ];
+
+export const settingParam5 = [
+  {
+    title: '水柱计压差上限',
+    code: 'waterPressureMax',
+    value: '',
+    unit: 'pa',
+  },
+  {
+    title: '水柱计压差下限',
+    code: 'waterPressureMin',
+    value: '',
+    unit: 'pa',
+  },
+  {
+    title: '压差变化值',
+    code: 'pressureDiffMax',
+    value: '',
+    unit: 'pa',
+  },
+  {
+    title: 'CO上限',
+    code: 'coMaxVal',
+    value: '',
+    unit: '%',
+  },
+  {
+    title: 'CO下限',
+    code: 'coMinVal',
+    value: '',
+    unit: '%',
+  },
+];

+ 351 - 0
src/views/vent/monitorManager/balancePressMonitor/components/balancePressHomeSP.vue

@@ -0,0 +1,351 @@
+<template>
+  <a-spin tip="Loading..." :spinning="loading">
+    <div class="monitor-container">
+      <div class="lr left-box">
+        <Transition enter-active-class="animate__animated  animate__fadeInLeft" leave-active-class="animate__animated  animate__fadeOutLeft">
+          <ventBox1 v-if="showModules">
+            <template #title>
+              <div>均压与低氧参数监测与设置</div>
+            </template>
+            <template #container>
+              <div class="vent-flex-row-between auto-control mt-10px mb-10px">
+                <div class="title">自动调节:</div>
+                <a-radio-group :value="avePressSetting.isAuto" name="radioGroup" @change="changeAvePressState($event, 'isAuto')">
+                  <a-radio :value="false">关闭</a-radio>
+                  <a-radio :value="true">开启</a-radio>
+                </a-radio-group>
+              </div>
+              <div class="vent-flex-row-between auto-control mt-10px mb-10px">
+                <div class="title">调节类型:</div>
+                <a-radio-group :value="avePressSetting.controlType" name="radioGroup" @change="changeAvePressState($event, 'controlType')">
+                  <a-radio value="co">CO</a-radio>
+                  <a-radio value="pressure">压差</a-radio>
+                </a-radio-group>
+              </div>
+              <div>
+                <!-- <div class="divider-line">开始条件</div>
+              <div v-for="(item, index) in settingParam1" class="input-item" :key="index">
+                <div class="title">{{ item.title }}:</div>
+                <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
+                <div class="unit">{{ item.unit }}</div>
+              </div> -->
+                <div class="divider-line"></div>
+                <div v-for="(item, index) in settingParam5" class="input-item" :key="index">
+                  <div class="title">{{ item.title }}:</div>
+                  <a-input-number class="input-value" v-model:value="avePressSetting[item.code]" placeholder="" :disabled="settingFormDisabled" />
+                  <div class="unit">&nbsp;{{ item.unit }}</div>
+                </div>
+                <!-- <div class="divider-line">结束时间</div>
+              <div v-for="(item, index) in settingParam3" class="input-item" :key="index">
+                <div class="title">{{ item.title }}:</div>
+                <a-input-number class="input-value" v-model:value="formData[item.code]" placeholder="" />
+                <div class="unit">{{ item.unit }}</div>
+              </div> -->
+              </div>
+              <div class="btn-box flex" style="text-align: center">
+                <div class="btn btn1 flex-1" @click="editSettingForm">{{ settingFormDisabled ? '编辑' : '取消' }}</div>
+                <div class="btn btn1 flex-1" @click="submitSettingForm">提交</div>
+              </div>
+            </template>
+          </ventBox1>
+        </Transition>
+      </div>
+
+      <ModuleCommon
+        v-for="(cfg, index) in configs"
+        :key="`svvmbcb${index}`"
+        :show-style="cfg.showStyle"
+        :module-data="cfg.moduleData"
+        :module-name="cfg.moduleName"
+        :device-type="cfg.deviceType"
+        :data="selectData"
+        :visible="showModules"
+      />
+    </div>
+    <PasswordModal z-index="2000" :modal-is-show="modalVisible" modal-title="提交" @handle-ok="handleResolve" @handle-cancel="handleReject" />
+    <UpdatePassword @register="updatePwdRegister" @submit="handleChangePassword" />
+    <!-- <BasicModal title="风门状态监测" :mask="false" :bodyStyle="{ height: '50px' }" style="top: 20px" :show-ok-btn="false" @register="warnRegister2">
+      {{ warnModalText2 }}
+    </BasicModal>
+    <BasicModal
+      title="压差状态监测"
+      :mask="false"
+      :bodyStyle="{ height: '50px' }"
+      centered
+      ok-text="下发联动控制指令"
+      @ok="autoControl"
+      @register="warnRegister1"
+    >
+      {{ warnModalText1 }}
+    </BasicModal>
+    <BasicModal title="局扇状态监测" :mask="false" :bodyStyle="{ height: '50px' }" style="top: 420px" :show-ok-btn="false" @register="warnRegister3">
+      {{ warnModalText3 }}
+    </BasicModal> -->
+
+    <div class="switch-button icon-goto right-10px top-70px" :class="{ 'right-390px': showModules }" @click="showModules = !showModules"></div>
+    <!-- <div v-else class="switch-button icon-goto right-10px top-70px" @click="showModules = true"></div> -->
+  </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 ModuleCommon from '../../../home/configurable/components/ModuleCommon.vue';
+  import { useInitConfigs } from '../../../home/configurable/hooks/useInit';
+  import { useGlobSetting } from '/@/hooks/setting';
+  import { settingParam5 } from '../balancePress.data';
+  // import { Modal } from 'ant-design-vue';
+  import ventBox1 from '/@/components/vent/ventBox1.vue';
+  import PasswordModal from '../../comment/components/PasswordModal.vue';
+  import UpdatePassword from '../../comment/components/UpdatePassword.vue';
+  import { useModal } from '/@/components/Modal';
+  // import { connectWebSocket, onWebSocket } from '/@/hooks/web/useWebSocket';
+  // import { getToken } from '/@/utils/auth';
+  // import { useUserStore } from '/@/store/modules/user';
+  import { usePressControl } from '../hooks/useControl';
+  // import dayjs from 'dayjs';
+  // import { Config } from '../../../deviceManager/configurationTable/types';
+
+  const props = defineProps({
+    deviceId: {
+      type: String,
+      require: true,
+    },
+  });
+
+  const { sysOrgCode } = useGlobSetting();
+
+  const loading = ref(false);
+  const showModules = ref(true);
+
+  // 监测数据
+  const selectData = ref();
+
+  // https获取监测数据
+  let timer: any = null;
+  function getMonitor(flag?) {
+    if (Object.prototype.toString.call(timer) === '[object Null]') {
+      timer = setTimeout(
+        async () => {
+          if (props.deviceId) {
+            const data = await getDataSource(props.deviceId);
+            // Object.assign(selectData, data);
+            updateText(selectData);
+            selectData.value = data;
+          }
+          if (timer) {
+            timer = null;
+          }
+          await getMonitor();
+        },
+        flag ? 0 : 1000
+      );
+    }
+  }
+
+  async function getDataSource(systemID) {
+    const res = await list({ devicetype: 'sys', systemID });
+
+    const result = Array.from(res.msgTxt).reduce(
+      (obj: any, e: any) => {
+        obj[e.type] = e;
+
+        // if (true) {
+        if (sysOrgCode === 'sdmtjtswmk') {
+          if (e.type.startsWith('fanlocal')) {
+            obj.fanlocal.datalist.push(...e.datalist);
+          }
+          if (e.type.startsWith('safetymonitor')) {
+            e.datalist.forEach((ele) => {
+              if (ele.strinstallpos.includes('风门')) {
+                obj.gate.datalist.push(ele);
+              } else if (ele.strinstallpos.includes('风窗')) {
+                obj.window.datalist.push(ele);
+              } else if (ele.strinstallpos.includes('工作面')) {
+                obj.work_surface.datalist.push(ele);
+              } else {
+                obj.others.datalist.push(ele);
+              }
+            });
+          }
+        }
+
+        return obj;
+      },
+      {
+        /** 用于归类fanlocal */
+        fanlocal: { datalist: [] },
+        /** 用于归类gate */
+        gate: { datalist: [] },
+        /** 用于归类window */
+        window: { datalist: [] },
+        /** 用于归类work_surface */
+        work_surface: { datalist: [] },
+        others: { datalist: [] },
+      }
+    );
+
+    return result;
+  }
+
+  const {
+    avePressSetting,
+    // avePressLinkage,
+    // gateLinkage,
+    formData,
+    // getAvePress,
+    changePassword,
+    // linkageControl,
+    // settingControl,
+    // autoControl,
+    // cancelControl,
+  } = usePressControl();
+
+  const modalVisible = ref(false);
+
+  const { configs, fetchConfigs } = useInitConfigs();
+
+  const [updatePwdRegister, { closeModal, setModalProps }] = useModal();
+
+  function handleChangePassword(values) {
+    setModalProps({ confirmLoading: true });
+    changePassword(values).finally(() => {
+      setModalProps({ confirmLoading: false });
+      closeModal();
+    });
+  }
+
+  // function changeIsAuto({ target }, id) {
+  //   formData.value.isAuto = target.value;
+  //   modalVisible.value = true;
+  //   resolver = (password) => {
+  //     linkageControl(
+  //       { password, id },
+  //       {
+  //         isAuto: formData.value.isAuto,
+  //       }
+  //     ).finally(() => {
+  //       modalVisible.value = false;
+  //     });
+  //   };
+  // }
+  function changeAvePressState({ target }, __key) {
+    formData.value.temp = target.value;
+    modalVisible.value = true;
+    // resolver = (password) => {
+    //   settingControl(
+    //     { password, id: avePressSetting.value.id },
+    //     {
+    //       [key]: formData.value.temp,
+    //     }
+    //   ).finally(() => {
+    //     modalVisible.value = false;
+    //   });
+    // };
+  }
+
+  // function submitLinkageForm(password) {}
+  function submitSettingForm() {
+    modalVisible.value = true;
+    // resolver = (password) => {
+    //   settingControl({ password, id: avePressSetting.value.id }, avePressSetting.value).finally(() => {
+    //     modalVisible.value = false;
+    //     settingFormDisabled.value = true;
+    //   });
+    // };
+  }
+
+  let resolver: any = null;
+  let rejecter: any = null;
+  function handleResolve(password) {
+    if (resolver) {
+      resolver(password);
+    } else {
+      modalVisible.value = false;
+    }
+    resolver = null;
+    rejecter = null;
+  }
+  function handleReject() {
+    if (rejecter) {
+      rejecter();
+    } else {
+      modalVisible.value = false;
+    }
+    resolver = null;
+    rejecter = null;
+  }
+
+  const settingFormDisabled = ref(true);
+  function editSettingForm() {
+    settingFormDisabled.value = !settingFormDisabled.value;
+    /**  如果取消了编辑模式,那么需要重置表单 */
+    if (settingFormDisabled.value) {
+      // getAvePress();
+    }
+  }
+
+  onMounted(() => {
+    fetchConfigs('balancePressHome');
+    // getAvePress();
+    loading.value = true;
+    mountedThree().then(async () => {
+      if (sysOrgCode === 'jsnyspmy') {
+        await setModelType('balancePressSp'); //balancePressBase
+      } else {
+        await setModelType('balancePressTun'); //balancePressBase
+      }
+      loading.value = false;
+      timer = null;
+      await getMonitor(true);
+      play('startSmoke', 'top', 30, 'open', 0);
+    });
+    // loading.value = false;
+    // timer = null;
+    // getMonitor(true);
+  });
+
+  onUnmounted(() => {
+    destroy();
+    if (timer) {
+      clearTimeout(timer);
+    }
+  });
+</script>
+<style lang="less" scoped>
+  @import '/@/design/vent/modal.less';
+  @import '../../comment/less/workFace.less';
+  @ventSpace: zxm;
+  .monitor-container {
+    margin-top: 60px;
+  }
+
+  .switch-button {
+    width: 34px;
+    height: 34px;
+    position: fixed;
+    // right: 5px;
+    // bottom: 300px;
+    z-index: 1000;
+    background-repeat: no-repeat;
+    background-size: 100% 100%;
+    pointer-events: auto;
+    transition: right 1s;
+  }
+  .icon-goto {
+    --image-monitor-goto: url('/@/assets/images/company/monitor-goto.png');
+    background-image: var(--image-monitor-goto);
+  }
+
+  .divider-line {
+    border-bottom: 1px solid white;
+  }
+</style>
+<style>
+  /* .balancePress .zxm-modal-confirm-title {
+    font-size: 20px;
+  } */
+  .balancePress .zxm-modal-confirm-content {
+    font-size: 22px;
+  }
+</style>

+ 171 - 0
src/views/vent/monitorManager/fireDoorMonitor/fireDoor.threejs.fire.redGate.ts

@@ -0,0 +1,171 @@
+import * as THREE from 'three';
+import { useAppStore } from '/@/store/modules/app';
+
+// import * as dat from 'dat.gui';
+// const gui = new dat.GUI();
+// gui.domElement.style = 'position:absolute;top:100px;left:10px;z-index:99999999999999';
+
+class FireDoor {
+  modelName = 'fireDoor-redGate';
+  model; //
+  group;
+  isLRAnimation = true; // 是否开启左右摇摆动画
+  direction = 1; // 摇摆方向
+  animationTimer: NodeJS.Timeout | null = null; // 摇摆开启定时器
+  player1;
+  player2;
+  deviceDetailCSS3D;
+  playerStartClickTime1 = new Date().getTime();
+  playerStartClickTime2 = new Date().getTime();
+
+  fmClock = new THREE.Clock();
+  mixers: THREE.AnimationMixer | undefined;
+  appStore = useAppStore();
+  damperOpenMesh;
+  damperClosedMesh;
+
+  clipActionArr = {
+    door: null as unknown as THREE.AnimationAction,
+  };
+
+  constructor(model) {
+    this.model = model;
+  }
+
+  addLight() {
+    const directionalLight = new THREE.DirectionalLight(0xffffff, 1.5);
+    directionalLight.position.set(344, 690, 344);
+    this.group?.add(directionalLight);
+    directionalLight.target = this.group as THREE.Object3D;
+
+    const pointLight2 = new THREE.PointLight(0xffeeee, 1, 300);
+    pointLight2.position.set(-4, 10, 1.8);
+    pointLight2.shadow.bias = 0.05;
+    this.group?.add(pointLight2);
+
+    const pointLight3 = new THREE.PointLight(0xffeeee, 1, 200);
+    pointLight3.position.set(-0.5, -0.5, 0.75);
+    pointLight3.shadow.bias = 0.05;
+    this.group?.add(pointLight3);
+  }
+  resetCamera() {
+    this.model.camera.far = 274;
+    this.model.orbitControls?.update();
+    this.model.camera.updateProjectionMatrix();
+  }
+  // 设置模型位置
+  setModalPosition() {
+    this.group?.scale.set(22, 22, 22);
+    this.group?.position.set(-20, 20, 9);
+  }
+
+  /* 风门动画 */
+  render() {
+    if (!this.model) {
+      return;
+    }
+    if (this.mixers && this.fmClock.running) {
+      this.mixers.update(2);
+    }
+  }
+
+  /* 点击风门 */
+  mousedownModel(intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]) {
+    console.log('摄像头控制信息', this.model?.orbitControls, this.model?.camera);
+  }
+
+  mouseUpModel() {}
+
+  /* 提取风门序列帧,初始化前后门动画 */
+  initAnimation() {
+    const fireGroup = this.group.children[0]?.getObjectByName('fireDoor-redGate');
+    if (fireGroup) {
+      const tracks = fireGroup.animations[0].tracks;
+
+      this.mixers = new THREE.AnimationMixer(fireGroup);
+
+      const door = new THREE.AnimationClip('door', 100, tracks);
+      const frontClipAction = this.mixers.clipAction(door, fireGroup);
+      frontClipAction.clampWhenFinished = true;
+      frontClipAction.loop = THREE.LoopOnce;
+      this.clipActionArr.door = frontClipAction;
+    }
+  }
+
+  // 播放动画
+  play(handlerState, timeScale = 0.01) {
+    let handler = () => {};
+    if (this.clipActionArr.door) {
+      switch (handlerState) {
+        case 1: // 打开门
+          handler = () => {
+            this.clipActionArr.door.paused = true;
+            this.clipActionArr.door.reset();
+            this.clipActionArr.door.time = 1.7;
+            this.clipActionArr.door.timeScale = -timeScale;
+            // this.clipActionArr.door.clampWhenFinished = true;
+            this.clipActionArr.door.play();
+            this.fmClock.start();
+
+            // 显示打开前门文字
+            if (this.damperOpenMesh) this.damperOpenMesh.visible = true;
+          };
+          break;
+        case 2: // 关闭门
+          handler = () => {
+            this.clipActionArr.door.paused = true;
+            this.clipActionArr.door.reset(); //
+            this.clipActionArr.door.time = 0;
+            this.clipActionArr.door.timeScale = timeScale;
+            // this.clipActionArr.door.clampWhenFinished = true;
+            this.clipActionArr.door.play();
+            this.fmClock.start();
+
+            if (this.damperOpenMesh) this.damperOpenMesh.visible = false;
+          };
+          break;
+        default:
+      }
+      handler();
+    }
+  }
+
+  mountedThree() {
+    this.group = new THREE.Object3D();
+    this.group.name = this.modelName;
+
+    return new Promise((resolve) => {
+      if (!this.model) {
+        resolve(null);
+      }
+      this.model.setGLTFModel([this.modelName], this.group).then(() => {
+        this.setModalPosition();
+        console.log(this.group);
+        // 初始化左右摇摆动画;
+        this.initAnimation();
+        // this.addLight();
+        // this.model.animate();
+        // resolve(this.model);
+      });
+    });
+  }
+
+  destroy() {
+    if (this.model) {
+      if (this.mixers) {
+        this.mixers.uncacheClip(this.clipActionArr.door.getClip());
+        this.mixers.uncacheAction(this.clipActionArr.door.getClip(), this.group);
+        this.mixers.uncacheRoot(this.group);
+
+        if (this.model.animations[0]) this.model.animations[0].tracks = [];
+      }
+      this.model.clearGroup(this.group);
+      this.clipActionArr.door = undefined;
+
+      this.mixers = undefined;
+
+      // document.getElementById('damper3D').parentElement.remove(document.getElementById('damper3D'))
+    }
+  }
+}
+export default FireDoor;

+ 179 - 89
src/views/vent/monitorManager/fireDoorMonitor/fireDoor.threejs.ts

@@ -1,16 +1,15 @@
 import * as THREE from 'three';
 import UseThree from '../../../../utils/threejs/useThree';
-import FireDoor from './fireDoor.threejs.fire';
-import FireDoorF from './fireDoor.threejs.fireF';
-import FireDoorSsl from './fireDoor.threejs.ssl';
+import { getDictItemsByCode } from '/@/utils/dict';
 import { animateCamera } from '/@/utils/threejs/util';
 import useEvent from '../../../../utils/threejs/useEvent';
 
 // 模型对象、 文字对象
 let model,
   fireDoor, //液压风门
-  fireDoorF, //液压风门
+  fireDoorF, //保德风门
   fireDoorSsl, // 思山岭防火门
+  fireDoorRed, // 防火门
   group: THREE.Object3D,
   fhmType = '';
 
@@ -32,6 +31,9 @@ const startAnimation = () => {
     if (fhmType === 'fireDoorSsl') {
       fireDoorSsl?.mouseUpModel.call(fireDoorSsl);
     }
+    if (fhmType === 'fireDoorRed') {
+      fireDoorRed?.mouseUpModel.call(fireDoorRed);
+    }
   });
 };
 
@@ -48,6 +50,9 @@ const mouseEvent = (event) => {
       if (fhmType === 'fireDoorSsl' && fireDoorSsl) {
         fireDoorSsl?.mousedownModel.call(fireDoorSsl, intersects);
       }
+      if (fhmType === 'fireDoorRed' && fireDoorRed) {
+        fireDoorRed?.mousedownModel.call(fireDoorRed, intersects);
+      }
     });
     // console.log('摄像头控制信息', model.orbitControls, model.camera);
   }
@@ -63,93 +68,137 @@ export const play = (handlerState, flag?) => {
   if (fhmType === 'fireDoorSsl' && fireDoorSsl) {
     return fireDoorSsl.play.call(fireDoorSsl, handlerState, flag);
   }
+  if (fhmType === 'fireDoorRed' && fireDoorRed) {
+    return fireDoorRed.play.call(fireDoorRed, handlerState, flag);
+  }
 };
 
 // 切换风门类型
 export const setModelType = (type) => {
   fhmType = type;
+  const fhmConfigurations = {
+    fireDoor: {
+      render: fireDoor ? () => fireDoor.render() : null,
+      group: fireDoor ? fireDoor.group : null,
+      newP: { x: -654.2006991449887, y: 103.16181473511944, z: -30.348656073478562 },
+      newT: { x: -7.380506513422206, y: 56.36967052459397, z: -29.230675020846963 },
+    },
+    fireDoorF: {
+      render: fireDoorF ? () => fireDoorF.render() : null,
+      group: fireDoorF ? fireDoorF.group : null,
+      newP: { x: -655.0169729333649, y: 47.24181078408825, z: -9.781926649842067 },
+      newT: { x: -7.380506513422206, y: 47.24181078408821, z: -37.9244016972381 },
+    },
+    fireDoorSsl: {
+      render: fireDoorSsl ? () => fireDoorSsl.render() : null,
+      group: fireDoorSsl ? fireDoorSsl.group : null,
+      newP: { x: 342.74781900192056, y: 183.50210411099545, z: 451.0806333923029 },
+      newT: { x: 72.33938301176254, y: -35.03891296652319, z: -37.91742549963208 },
+    },
+    fireDoorRed: {
+      render: fireDoorRed ? () => fireDoorRed.render() : null,
+      group: fireDoorRed ? fireDoorRed.group : null,
+      newP: { x: 66.257, y: 57.539, z: 94.313 },
+      newT: { x: -2.28, y: -0.91, z: -5.68 },
+    },
+  };
+  const config = fhmConfigurations[fhmType];
+  const oldCameraPosition = { x: -1000, y: 100, z: 500 };
   return new Promise((resolve) => {
     // 暂停风门1动画
-    if (fhmType === 'fireDoor' && fireDoor && fireDoor.group) {
-      if (fireDoor.clipActionArr.door) {
-        fireDoor.clipActionArr.door.reset();
-        fireDoor.clipActionArr.door.time = 0.5;
-        fireDoor.clipActionArr.door.stop();
-      }
+    // if (fhmType === 'fireDoor' && fireDoor && fireDoor.group) {
+    //   if (fireDoor.clipActionArr.door) {
+    //     fireDoor.clipActionArr.door.reset();
+    //     fireDoor.clipActionArr.door.time = 0.5;
+    //     fireDoor.clipActionArr.door.stop();
+    //   }
+
+    //   if (fireDoor.damperOpenMesh) fireDoor.damperOpenMesh.visible = false;
+    //   if (fireDoor.damperClosedMesh) fireDoor.damperClosedMesh.visible = true;
+    //   model.scene.remove(group);
+    //   model.startAnimation = fireDoor.render.bind(fireDoor);
+    //   group = fireDoor.group;
+    //   group.rotation.y = 0;
+    //   const oldCameraPosition = { x: -1000, y: 100, z: 500 };
+    //   setTimeout(async () => {
+    //     resolve(null);
+    //     model.scene.add(fireDoor.group);
+    //     await animateCamera(
+    //       oldCameraPosition,
+    //       { x: 0, y: 0, z: 0 },
+    //       { x: -654.2006991449887, y: 103.16181473511944, z: -30.348656073478562 },
+    //       { x: -7.380506513422206, y: 56.36967052459397, z: -29.230675020846963 },
+    //       model,
+    //       0.8
+    //     );
+    //   }, 300);
+    // } else if (fhmType === 'fireDoorF' && fireDoorF && fireDoorF.group) {
+    //   if (fireDoorF.clipActionArr.door) {
+    //     fireDoorF.clipActionArr.door.reset();
+    //     fireDoorF.clipActionArr.door.time = 0;
+    //     fireDoorF.clipActionArr.door.stop();
+    //   }
+    //   model.scene.remove(group);
+    //   model.startAnimation = fireDoorF.render.bind(fireDoorF);
+    //   group = fireDoorF.group;
+    //   group.rotation.y = 0;
+    //   const oldCameraPosition = { x: -1000, y: 100, z: 500 };
+    //   setTimeout(async () => {
+    //     resolve(null);
+    //     model.scene.add(fireDoorF.group);
+    //     await animateCamera(
+    //       oldCameraPosition,
+    //       { x: 0, y: 0, z: 0 },
+    //       { x: -655.0169729333649, y: 47.24181078408825, z: -9.781926649842067 },
+    //       { x: -7.380506513422206, y: 47.24181078408821, z: -37.9244016972381 },
+    //       model,
+    //       0.8
+    //     );
+    //   }, 300);
+    // } else if (fhmType === 'fireDoorSsl' && fireDoorSsl && fireDoorSsl.group) {
+    //   // if (fireDoorSsl.clipActionArr.door) {
+    //   //   fireDoorSsl.clipActionArr.door.reset();
+    //   //   fireDoorSsl.clipActionArr.door.time = 0;
+    //   //   fireDoorSsl.clipActionArr.door.stop();
+    //   // }
+    //   // model.scene.remove(group);
+    //   // model.startAnimation = fireDoorSsl.render.bind(fireDoorSsl);
+    //   group = fireDoorSsl.group;
+    //   group.rotation.y = 0;
+    //   const oldCameraPosition = { x: -1000, y: 100, z: 500 };
+    //   setTimeout(async () => {
+    //     resolve(null);
+    //     model.scene.add(fireDoorSsl.group);
+    //     await animateCamera(
+    //       oldCameraPosition,
+    //       { x: 0, y: 0, z: 0 },
+    //       {
+    //         x: 342.74781900192056,
+    //         y: 183.50210411099545,
+    //         z: 451.0806333923029,
+    //       },
+    //       {
+    //         x: 72.33938301176254,
+    //         y: -35.03891296652319,
+    //         z: -37.91742549963208,
+    //       },
+    //       model,
+    //       0.8
+    //     );
+    //   }, 300);
+    // }
+    if (config && config.group) {
+      model.startAnimation = config.render;
+      group = config.group;
 
-      if (fireDoor.damperOpenMesh) fireDoor.damperOpenMesh.visible = false;
-      if (fireDoor.damperClosedMesh) fireDoor.damperClosedMesh.visible = true;
-      model.scene.remove(group);
-      model.startAnimation = fireDoor.render.bind(fireDoor);
-      group = fireDoor.group;
-      group.rotation.y = 0;
-      const oldCameraPosition = { x: -1000, y: 100, z: 500 };
-      setTimeout(async () => {
-        resolve(null);
-        model.scene.add(fireDoor.group);
-        await animateCamera(
-          oldCameraPosition,
-          { x: 0, y: 0, z: 0 },
-          { x: -654.2006991449887, y: 103.16181473511944, z: -30.348656073478562 },
-          { x: -7.380506513422206, y: 56.36967052459397, z: -29.230675020846963 },
-          model,
-          0.8
-        );
-      }, 300);
-    } else if (fhmType === 'fireDoorF' && fireDoorF && fireDoorF.group) {
-      if (fireDoorF.clipActionArr.door) {
-        fireDoorF.clipActionArr.door.reset();
-        fireDoorF.clipActionArr.door.time = 0;
-        fireDoorF.clipActionArr.door.stop();
-      }
-      model.scene.remove(group);
-      model.startAnimation = fireDoorF.render.bind(fireDoorF);
-      group = fireDoorF.group;
-      group.rotation.y = 0;
-      const oldCameraPosition = { x: -1000, y: 100, z: 500 };
-      setTimeout(async () => {
-        resolve(null);
-        model.scene.add(fireDoorF.group);
-        await animateCamera(
-          oldCameraPosition,
-          { x: 0, y: 0, z: 0 },
-          { x: -655.0169729333649, y: 47.24181078408825, z: -9.781926649842067 },
-          { x: -7.380506513422206, y: 47.24181078408821, z: -37.9244016972381 },
-          model,
-          0.8
-        );
-      }, 300);
-    } else if (fhmType === 'fireDoorSsl' && fireDoorSsl && fireDoorSsl.group) {
-      // if (fireDoorSsl.clipActionArr.door) {
-      //   fireDoorSsl.clipActionArr.door.reset();
-      //   fireDoorSsl.clipActionArr.door.time = 0;
-      //   fireDoorSsl.clipActionArr.door.stop();
-      // }
-      // model.scene.remove(group);
-      // model.startAnimation = fireDoorSsl.render.bind(fireDoorSsl);
-      group = fireDoorSsl.group;
-      group.rotation.y = 0;
-      const oldCameraPosition = { x: -1000, y: 100, z: 500 };
       setTimeout(async () => {
+        await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, config.newP, config.newT, model);
+        model.scene?.add(config.group);
         resolve(null);
-        model.scene.add(fireDoorSsl.group);
-        await animateCamera(
-          oldCameraPosition,
-          { x: 0, y: 0, z: 0 },
-          {
-            x: 342.74781900192056,
-            y: 183.50210411099545,
-            z: 451.0806333923029,
-          },
-          {
-            x: 72.33938301176254,
-            y: -35.03891296652319,
-            z: -37.91742549963208,
-          },
-          model,
-          0.8
-        );
-      }, 300);
+      }, 1000);
+    } else {
+      resolve(null);
+      throw new Error(`Unsupported fhmType: ${fhmType}`);
     }
   });
 };
@@ -161,6 +210,8 @@ export const initCameraCanvas = async (playerVal1) => {
     return await fireDoorF.initCamera.call(fireDoorF, playerVal1);
   } else if (fhmType === 'fireDoorSsl' && fireDoorSsl) {
     return await fireDoorSsl.initCamera.call(fireDoorSsl, playerVal1);
+  } else if (fhmType === 'fireDoorRed' && fireDoorRed) {
+    return await fireDoorRed.initCamera.call(fireDoorRed, playerVal1);
   }
 };
 const setControls = () => {
@@ -172,20 +223,53 @@ const setControls = () => {
   }
 };
 
+const loadModel = (code): Promise<any> => {
+  if (code === 'fireDoor') return import('./fireDoor.threejs.fire').then((r) => r.default);
+  if (code === 'fireDoorF') return import('./fireDoor.threejs.fireF').then((r) => r.default);
+  if (code === 'fireDoorSsl') return import('./fireDoor.threejs.ssl').then((r) => r.default);
+  if (code === 'fireDoorRed') return import('./fireDoor.threejs.fire.redGate').then((r) => r.default);
+  return import('./fireDoor.threejs.fire.redGate').then((r) => r.default);
+};
+
 export const mountedThree = () => {
   return new Promise(async (resolve) => {
     model = new UseThree('#damper3D', '', '#deviceDetail');
     model.setEnvMap('test1.hdr');
     model.renderer.toneMappingExposure = 1.0;
     model.camera.position.set(100, 0, 1000);
-    fireDoor = new FireDoor(model);
-    fireDoor.mountedThree();
-
-    fireDoorF = new FireDoorF(model);
-    fireDoorF.mountedThree();
-
-    fireDoorSsl = new FireDoorSsl(model);
-    fireDoorSsl.mountedThree();
+    const dictCodes = getDictItemsByCode('fireDoorStyle');
+    if (dictCodes && dictCodes.length > 0) {
+      for (let i = 0; i < dictCodes.length; i++) {
+        const dict = dictCodes[i];
+        switch (dict.value) {
+          case 'fireDoor':
+            const FireDoor = await loadModel('fireDoor');
+            fireDoor = new FireDoor(model);
+            fireDoor.mountedThree();
+            break;
+          case 'fireDoorF':
+            const FireDoorF = await loadModel('fireDoorF');
+            fireDoorF = new FireDoorF(model);
+            fireDoorF.mountedThree();
+            break;
+          case 'fireDoorSsl':
+            const FireDoorSsl = await loadModel('fireDoorSsl');
+            fireDoorSsl = new FireDoorSsl(model);
+            fireDoorSsl.mountedThree();
+            break;
+          case 'fireDoorRed':
+            const FireDoorRed = await loadModel('fireDoorRed');
+            fireDoorRed = new FireDoorRed(model);
+            fireDoorRed.mountedThree();
+            break;
+        }
+      }
+      resolve(null);
+    } else {
+      const FireDoorRed = await loadModel('');
+      fireDoorRed = new FireDoorRed(model);
+      fireDoorRed.mountedThree();
+    }
     resolve(null);
     setControls();
     model.animate();
@@ -204,6 +288,12 @@ export const destroy = () => {
     model.isRender = false;
     if (fireDoor) fireDoor.destroy();
     fireDoor = null;
+    if (fireDoorF) fireDoorF.destroy();
+    fireDoorF = null;
+    if (fireDoorSsl) fireDoorSsl.destroy();
+    fireDoorSsl = null;
+    if (fireDoorRed) fireDoorRed.destroy();
+    fireDoorRed = null;
     // @ts-ignore-next-line
     group = null;
     model.mixers = [];

+ 7 - 7
src/views/vent/monitorManager/fireDoorMonitor/index.vue

@@ -205,7 +205,7 @@
   const MonitorDataTable = ref();
   let contrlValue = '';
   const playerRef = ref();
-  const deviceType = ref('door');
+  const deviceType = ref('gate');
   // const deviceType = ref('firedoor');
   const activeKey = ref('1'); // tab
   const loading = ref(false);
@@ -316,12 +316,12 @@
     const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
     Object.assign(selectData, initData, selectRow, baseData);
     doorDeviceState = 1; //记录设备状态,为了与下一次监测数据做比较
-    let type = 'fireDoor';
-    if (selectData.modelType == 'bd_qt') {
-      type = 'fireDoor';
-    } else if (selectData.modelType == 'bd_kj') {
-      type = 'fireDoorF';
-    }
+    let type = 'fireDoorRed';
+    // if (selectData.modelType == 'bd_qt') {
+    //   type = 'fireDoor';
+    // } else if (selectData.modelType == 'bd_kj') {
+    //   type = 'fireDoorF';
+    // }
     await setModelType(type);
     loading.value = false;
     isdoorOpenRunning = true; //开关门动作是否在进行