فهرست منبع

[Fix 0000] 修复沙坪均压管控页面模型加载出错、首页传感器排序错误的问题

houzekong 3 روز پیش
والد
کامیت
d338d85527
2فایلهای تغییر یافته به همراه345 افزوده شده و 74 حذف شده
  1. 95 74
      src/views/vent/home/configurable/configurable.api.ts
  2. 250 0
      src/views/vent/monitorManager/balancePressMonitor/indexSP.vue

+ 95 - 74
src/views/vent/home/configurable/configurable.api.ts

@@ -2,7 +2,8 @@ import { floor, isArray, random, slice } from 'lodash-es';
 import { defHttp } from '/@/utils/http/axios';
 import { get } from '../billboard/utils';
 import { useGlobSetting } from '/@/hooks/setting';
-import { ref, reactive } from 'vue'
+import { reactive } from 'vue';
+import _ from 'lodash';
 
 enum Api {
   list = '/safety/ventanalyDevice/homedata2',
@@ -14,7 +15,7 @@ enum Api {
   getAlarmRecord = '/ventanaly-device/safety/ventanalyAlarmLog/sysLinkDevAlarmLog',
   getTotal = '/safety/ventanalyAlarmLog/total',
   sysTypeWarnList = '/safety/ventanalyAlarmLog/sysTypeWarn',
-  getDisasterProportion = '/safety/ventanalyAlarmLog/getDisasterProportion'
+  getDisasterProportion = '/safety/ventanalyAlarmLog/getDisasterProportion',
 }
 
 // 搞这个缓存是由于:目前代码上的设计是多个模块发出多次请求,每个模块自己负责消费前者的响应。
@@ -123,6 +124,27 @@ export const list = (params) => {
         }
       });
     }
+    if (res.safetymonitor) {
+      const { sysOrgCode } = useGlobSetting();
+      // 沙坪
+      if (sysOrgCode === 'jsnyspmy') {
+        res.safetymonitor = _.sortBy(res.safetymonitor, (e) => {
+          const map = new Map([
+            ['1960160466651189249', 1],
+            ['1960160465543892994', 2],
+            ['1960160465376120833', 3],
+            ['1960160466168844289', 4],
+            ['1960160465736830977', 5],
+            ['1960160466026237954', 6],
+            ['1960160407146598402', 7],
+          ]);
+
+          const inx = map.get(e.deviceID) || 9999;
+
+          return inx;
+        });
+      }
+    }
 
     return res;
   });
@@ -396,26 +418,26 @@ export const getDisasterProportion = (params) => {
 //多灾融合预警
 function getLevelNum() {
   return new Promise(async (resolve) => {
-    const list = {}
+    const list: Record<string, any> = {};
     const typeArr = ['fire', 'dust', 'vent', 'gas'];
     for (let i = 0; i < typeArr.length; i++) {
       const type = typeArr[i];
       const result = await sysTypeWarnList({ type });
       if (type == 'fire') {
-        list.fire = result.length || 0
+        list.fire = result.length || 0;
       } else if (type == 'dust') {
-        list.dust = result.length || 0
+        list.dust = result.length || 0;
       } else if (type == 'vent') {
-        list.vent = result.length || 0
+        list.vent = result.length || 0;
       } else if (type == 'gas') {
-        list.gas = result.length || 0
+        list.gas = result.length || 0;
       }
     }
     resolve(list);
   });
 }
 export const getTotal = (params) => {
-  const { sysOrgCode, sysDataType } = useGlobSetting();
+  const { sysDataType } = useGlobSetting();
 
   const key = `${Api.getTotal}?${JSON.stringify(params)}`;
   if (!cache.has(key)) {
@@ -427,29 +449,29 @@ export const getTotal = (params) => {
     );
   }
   return (cache.get(key) as Promise<any>).then(async (res) => {
-    console.log(res, '多灾融合预警数据')
+    console.log(res, '多灾融合预警数据');
 
-  let dataVent=await getLevelNum()
+    const dataVent: any = await getLevelNum();
     const levelsList = [
       {
-        name: "报警",
-        value: 0
+        name: '报警',
+        value: 0,
       },
       {
-        name: "重大风险",
-        value: 0
+        name: '重大风险',
+        value: 0,
       },
       {
-        name: "较大风险",
-        value: 0
+        name: '较大风险',
+        value: 0,
       },
       {
-        name: "一般风险",
-        value: 0
+        name: '一般风险',
+        value: 0,
       },
       {
-        name: "低风险",
-        value:  dataVent.vent || 0
+        name: '低风险',
+        value: dataVent.vent || 0,
       },
     ];
     //通风监测预警数据
@@ -459,27 +481,27 @@ export const getTotal = (params) => {
           ventJf: res.ventInfo.zongjinfeng,
           ventXf: res.ventInfo.xufengliang,
           ventHf: res.ventInfo.zonghuifeng,
-        }
+        };
         res.ventData = [
           {
-            name: "报警",
-            value: res.info.sysInfo.ventS.levels.alarm
+            name: '报警',
+            value: res.info.sysInfo.ventS.levels.alarm,
           },
           {
-            name: "重大风险",
-            value: res.info.sysInfo.ventS.levels.red
+            name: '重大风险',
+            value: res.info.sysInfo.ventS.levels.red,
           },
           {
-            name: "较大风险",
-            value: res.info.sysInfo.ventS.levels.orange
+            name: '较大风险',
+            value: res.info.sysInfo.ventS.levels.orange,
           },
           {
-            name: "一般风险",
-            value: res.info.sysInfo.ventS.levels.yellow
+            name: '一般风险',
+            value: res.info.sysInfo.ventS.levels.yellow,
           },
           {
-            name: "低风险",
-            value: dataVent.vent ? dataVent.vent : res.info.sysInfo.ventS.levels.blue
+            name: '低风险',
+            value: dataVent.vent ? dataVent.vent : res.info.sysInfo.ventS.levels.blue,
           },
         ];
 
@@ -489,42 +511,42 @@ export const getTotal = (params) => {
           ventJf: res.ventInfo.totalIntM3,
           ventXf: res.ventInfo.xufengliang,
           ventHf: res.ventInfo.totalRetM3,
-        }
-        res.ventData = levelsList
+        };
+        res.ventData = levelsList;
         break;
       default:
         res.ventWarn = {
           ventJf: res.ventInfo.totalIntM3,
           ventXf: res.ventInfo.xufengliang,
           ventHf: res.ventInfo.totalRetM3,
-        }
-        res.ventData = levelsList
+        };
+        res.ventData = levelsList;
     }
     //设备监测预警数据
-    res.deviceWarn = reactive({})
-    Object.keys(res.info.devicekindInfo).forEach((el, index) => {
+    res.deviceWarn = reactive({});
+    Object.keys(res.info.devicekindInfo).forEach((el) => {
       res.deviceWarn[`${el}_all`] = res.info.devicekindInfo[el].totalcount;
       res.deviceWarn[`${el}_warn`] = res.info.devicekindInfo[el].count;
       res.deviceWarn[`${el}_close`] = res.info.devicekindInfo[el].netstatus;
-    })
+    });
     //瓦斯监测预警数据
-    res.gasData = reactive({})
-    res.gasData.safety_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.gasNumber, 0)
-    res.gasData.gas_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.pumpNumber, 0)
-    res.gasData.monitorData = res.info.sysInfo.gasS.devices.map(el => {
+    res.gasData = reactive({});
+    res.gasData.safety_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.gasNumber, 0);
+    res.gasData.gas_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.pumpNumber, 0);
+    res.gasData.monitorData = res.info.sysInfo.gasS.devices.map((el) => {
       return {
         label: el.systemname,
         value: el.gasNumber,
-        value1: el.pumpNumber
-      }
-    })
-   
+        value1: el.pumpNumber,
+      };
+    });
+
     //火灾监测预警数据
-    res.fireInfos = reactive({})
-    res.fireInfos.dataOn = []
-   
+    res.fireInfos = reactive({});
+    res.fireInfos.dataOn = [];
+
     if (res.bundletubeInfo && res.bundletubeInfo.msgTxt.length != 0 && res.bundletubeInfo.msgTxt[0].datalist.length != 0) {
-      res.bundletubeInfo.msgTxt[0].datalist.forEach((el, ind) => {
+      res.bundletubeInfo.msgTxt[0].datalist.forEach((el) => {
         res.fireInfos.dataOn.push({
           warnLevel: el.syswarnLevel_str,
           smokeJd: el.syswarnLevel_des,
@@ -532,7 +554,7 @@ export const getTotal = (params) => {
         });
       });
     } else {
-      res.fireInfos.dataOn = []
+      res.fireInfos.dataOn = [];
     }
     res.fireInfos.tempVal = res.info.sysInfo.fireS.summaryInfo
       ? res.info.sysInfo.fireS.summaryInfo.external.temperature && res.info.sysInfo.fireS.summaryInfo.external.temperature.maxlevel == '0'
@@ -561,29 +583,28 @@ export const getTotal = (params) => {
         : '-'
       : '';
     //粉尘监测预警数据
-     res.dustInfo = [
-          {
-            name: "报警",
-            value: res.info.sysInfo.dustS.levels.alarm
-          },
-          {
-            name: "重大风险",
-            value: res.info.sysInfo.dustS.levels.red
-          },
-          {
-            name: "较大风险",
-            value: res.info.sysInfo.dustS.levels.orange
-          },
-          {
-            name: "一般风险",
-            value: res.info.sysInfo.dustS.levels.yellow
-          },
-          {
-            name: "低风险",
-            value: dataVent.dust ? dataVent.dust : res.info.sysInfo.dustS.levels.blue
-          },
-        ];
-   
+    res.dustInfo = [
+      {
+        name: '报警',
+        value: res.info.sysInfo.dustS.levels.alarm,
+      },
+      {
+        name: '重大风险',
+        value: res.info.sysInfo.dustS.levels.red,
+      },
+      {
+        name: '较大风险',
+        value: res.info.sysInfo.dustS.levels.orange,
+      },
+      {
+        name: '一般风险',
+        value: res.info.sysInfo.dustS.levels.yellow,
+      },
+      {
+        name: '低风险',
+        value: dataVent.dust ? dataVent.dust : res.info.sysInfo.dustS.levels.blue,
+      },
+    ];
 
     return res;
   });

+ 250 - 0
src/views/vent/monitorManager/balancePressMonitor/indexSP.vue

@@ -0,0 +1,250 @@
+<template>
+  <customHeader
+    :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }"
+    :options="options"
+    @change="getSelectRow"
+    :optionValue="optionValue"
+    >均压与低氧管控</customHeader
+  >
+  <div class="bg" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; z-index: 0">
+    <a-spin :spinning="loading" />
+    <div id="balancePress3D" v-show="!loading" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
+    <!-- <div id="damper3DCSS" v-show="!loading" style="width: 100%; height: 100%; top:0; left: 0; position: absolute; overflow: hidden;">
+      <div>
+        <div ref="elementContent" class="elementContent">
+          <p><span class="data-title">压力(Pa):</span>{{selectData.frontRearDP}}</p>
+          <p><span class="data-title">动力源压力(MPa):</span>{{selectData.sourcePressure}}</p>
+          <p><span class="data-title">故障诊断:</span>
+            <i
+              :class="{'state-icon': true, 'open': selectData.messageBoxStatus, 'close': !selectData.messageBoxStatus}"
+            ></i>{{selectData.fault}}</p>
+        </div>
+      </div>
+    </div> -->
+  </div>
+  <div class="scene-box">
+    <div class="center-container">
+      <balancePressHome 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
+          >
+        </div>
+        <div class="history-container">
+          <balancePressHistory
+            v-if="activeKey == 'monitor_history'"
+            ref="historyTable"
+            class="vent-margin-t-20"
+            :deviceId="optionValue"
+            :device-type="deviceType"
+          />
+          <balancePressHandleHistoryVue
+            v-if="activeKey == 'handler_history'"
+            ref="alarmHistoryTable"
+            class="vent-margin-t-20"
+            :deviceId="optionValue"
+            :device-type="deviceType"
+          />
+          <balancePressAlarmHistory
+            v-if="activeKey == 'faultRecord'"
+            ref="handlerHistoryTable"
+            class="vent-margin-t-20"
+            :deviceId="optionValue"
+            :device-type="deviceType"
+          />
+        </div>
+      </div>
+    </div>
+    <BottomMenu @change="changeActive" />
+  </div>
+</template>
+
+<script setup lang="ts">
+  import customHeader from '/@/components/vent/customHeader.vue';
+  import { onBeforeMount, ref, onMounted, onUnmounted } from 'vue';
+  import { list, getTableList } from './balancePress.api';
+  import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
+  import balancePressHome from './components/balancePressHomeSP.vue';
+  import balancePressHistory from './components/balancePressHistory.vue';
+  import balancePressHandleHistoryVue from './components/balancePressHandleHistory.vue';
+  import balancePressAlarmHistory from './components/balancePressAlarmHistory.vue';
+  import { useRouter } from 'vue-router';
+
+  type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
+
+  const { currentRoute } = useRouter();
+  const activeKey = ref('monitor');
+  const loading = ref(false);
+
+  const historyTable = ref();
+  const alarmHistoryTable = ref();
+  const handlerHistoryTable = ref();
+
+  //关联设备
+  const deviceList = ref<DeviceType[]>([]);
+  const deviceActive = ref('');
+  const deviceType = ref('');
+
+  const options = ref();
+  const optionValue = ref('');
+
+  function changeActive(activeValue) {
+    activeKey.value = activeValue;
+  }
+
+  function deviceChange(index) {
+    deviceActive.value = deviceType.value = deviceList.value[index].deviceType;
+  }
+
+  // 查询关联设备列表
+  async function getDeviceList() {
+    const res = await list({ devicetype: 'sys', systemID: optionValue.value });
+
+    const result = res.msgTxt;
+    const deviceArr: DeviceType[] = [];
+    result.forEach((item) => {
+      const data = item['datalist'].filter((data: any) => {
+        const readData = data.readData;
+        return Object.assign(data, readData);
+      });
+      if (item.type != 'sys') {
+        deviceArr.unshift({
+          deviceType: item.type,
+          deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'],
+          datalist: data,
+        });
+      }
+    });
+    deviceList.value = deviceArr;
+    deviceActive.value = deviceArr[0].deviceType;
+    deviceChange(0);
+  }
+
+  async function getSysDataSource() {
+    const res = await getTableList({ strtype: 'sys_surface_junya', pagetype: 'normal' });
+    if (!options.value) {
+      // 初始时选择第一条数据
+      options.value = res.records || [];
+      if (!optionValue.value) {
+        optionValue.value = options.value[0]['id'];
+        getDeviceList();
+      }
+    }
+  }
+
+  // 切换检测数据
+  function getSelectRow(deviceID) {
+    // const currentData = options.value.find((item: any) => {
+    //   return item.id == deviceID
+    // })
+    optionValue.value = deviceID;
+    getDeviceList();
+  }
+
+  onBeforeMount(() => {});
+
+  onMounted(async () => {
+    if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
+      optionValue.value = currentRoute.value['query']['id'] as string;
+    }
+    await getSysDataSource();
+  });
+
+  onUnmounted(() => {});
+</script>
+<style lang="less" scoped>
+  @import '/@/design/vent/modal.less';
+  @ventSpace: zxm;
+  .scene-box {
+    margin-top: 20px;
+    pointer-events: none;
+    .history-group {
+      padding: 0 20px;
+      .history-container {
+        position: relative;
+        background: #6195af1a;
+        width: calc(100% + 10px);
+        top: 0px;
+        left: -10px;
+        border: 1px solid #00fffd22;
+        padding: 10px 0;
+        box-shadow: 0 0 20px #44b4ff33 inset;
+      }
+    }
+    .device-button-group {
+      // margin: 0 20px;
+      display: flex;
+      pointer-events: auto;
+      position: relative;
+      margin-top: 90px;
+      &::after {
+        position: absolute;
+        content: '';
+        width: calc(100% + 10px);
+        height: 2px;
+        top: 30px;
+        left: -10px;
+        border-bottom: 1px solid #0efcff;
+      }
+      .device-button {
+        padding: 4px 15px;
+        position: relative;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        font-size: 14px;
+
+        color: #fff;
+        cursor: pointer;
+        margin: 0 3px;
+
+        &::before {
+          content: '';
+          position: absolute;
+          top: 0;
+          right: 0;
+          bottom: 0;
+          left: 0;
+          border: 1px solid #6176af;
+          transform: skewX(-38deg);
+          background-color: rgba(0, 77, 103, 85%);
+          z-index: -1;
+        }
+      }
+      .device-active {
+        // color: #0efcff;
+        &::before {
+          border-color: #0efcff;
+          box-shadow: 1px 1px 3px 1px #0efcff inset;
+        }
+      }
+    }
+  }
+  .center-container {
+    width: 100%;
+    height: calc(100% - 200px);
+  }
+
+  .input-box {
+    display: flex;
+    align-items: center;
+    padding-left: 10px;
+
+    .input-title {
+      color: #73e8fe;
+      width: auto;
+    }
+
+    .@{ventSpace}-input-number {
+      border-color: #ffffff88 !important;
+    }
+
+    margin-right: 10px;
+  }
+</style>