浏览代码

[Wip 0000] 保德均压页面

houzekong 1 周之前
父节点
当前提交
13a9648e2f

+ 369 - 0
src/views/vent/monitorManager/balancePressMonitor/components/balancePressHomeBD.vue

@@ -0,0 +1,369 @@
+<template>
+  <a-spin tip="Loading..." :spinning="loading">
+    <div class="monitor-container">
+      <div class="lr left-box">
+        <ventBox1>
+          <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 v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
+                <a-radio value="1">关闭</a-radio>
+                <a-radio value="2">开启</a-radio>
+              </a-radio-group>
+            </div>
+            <div class="input-box">
+              <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 settingParam2" 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 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" style="text-align: center">
+              <div class="btn btn1" @click="onSubmit">提交</div>
+            </div>
+          </template>
+        </ventBox1>
+      </div>
+      <div class="lr">
+        <ventBox1>
+          <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 v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
+                <a-radio value="1">关闭</a-radio>
+                <a-radio value="2">开启</a-radio>
+              </a-radio-group>
+            </div>
+            <div class="btn-box" style="text-align: center">
+              <div class="btn btn1" @click="onSubmit">提交</div>
+            </div>
+          </template>
+        </ventBox1>
+      </div>
+      <ModuleCommon
+        v-for="cfg in configs"
+        :key="cfg.deviceType"
+        :show-style="cfg.showStyle"
+        :module-data="cfg.moduleData"
+        :module-name="cfg.moduleName"
+        :device-type="cfg.deviceType"
+        :data="selectData"
+        :visible="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 { settingParam1, settingParam2, settingParam3 } from '../balancePress.data';
+  import { message } from 'ant-design-vue';
+  import ventBox1 from '/@/components/vent/ventBox1.vue';
+  // import { Config } from '../../../deviceManager/configurationTable/types';
+
+  const props = defineProps({
+    deviceId: {
+      type: String,
+      require: true,
+    },
+  });
+
+  const { sysOrgCode } = useGlobSetting();
+
+  const loading = ref(false);
+
+  // 监测数据
+  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();
+          loading.value = false;
+        },
+        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 configs = ref<Config[]>([
+  //   {
+  //     deviceType: '',
+  //     moduleName: '局扇',
+  //     pageType: 'balancePressHome',
+  //     moduleData: {
+  //       header: {
+  //         show: false,
+  //         readFrom: '',
+  //         selector: {
+  //           show: false,
+  //           value: '',
+  //         },
+  //         slot: {
+  //           show: false,
+  //           value: '',
+  //         },
+  //       },
+  //       background: {
+  //         show: false,
+  //         type: 'image',
+  //         link: '',
+  //       },
+  //       layout: {
+  //         direction: 'row',
+  //         items: [
+  //           {
+  //             name: 'complex_list',
+  //             basis: '50%',
+  //           },
+  //           {
+  //             name: 'complex_list',
+  //             basis: '50%',
+  //           },
+  //         ],
+  //       },
+  //       complex_list: [
+  //         {
+  //           type: 'G',
+  //           readFrom: 'fanlocal_steml_zj',
+  //           mapFromData: false,
+  //           items: [
+  //             {
+  //               title: '主机',
+  //               contents: [
+  //                 {
+  //                   label: '运行状态',
+  //                   value: '${datalist[0].readData.Fan1StartStatus_str}',
+  //                   color: 'blue',
+  //                 },
+  //                 {
+  //                   label: '运行频率',
+  //                   value: '${datalist[0].readData.Fan1fHz}',
+  //                   color: 'blue',
+  //                 },
+  //                 {
+  //                   label: '输出电压',
+  //                   value: '${datalist[0].readData.Fan1fHz}',
+  //                   color: 'blue',
+  //                 },
+  //               ],
+  //             },
+  //           ],
+  //         },
+  //         {
+  //           type: 'G',
+  //           readFrom: 'fanlocal_steml_zj',
+  //           mapFromData: false,
+  //           items: [
+  //             {
+  //               title: '备机',
+  //               contents: [
+  //                 {
+  //                   label: '运行状态',
+  //                   value: '${datalist[0].readData.Fan2StartStatus_str}',
+  //                   color: 'blue',
+  //                 },
+  //                 {
+  //                   label: '运行频率',
+  //                   value: '${datalist[0].readData.Fan2fHz}',
+  //                   color: 'blue',
+  //                 },
+  //                 {
+  //                   label: '输出电压',
+  //                   value: '${datalist[0].readData.Fan2fHz}',
+  //                   color: 'blue',
+  //                 },
+  //               ],
+  //             },
+  //           ],
+  //         },
+  //       ],
+  //       to: '',
+  //     },
+  //     showStyle: {
+  //       size: 'width:380px;height:200px;',
+  //       version: '原版',
+  //       position: 'top:150px;right:0;',
+  //     },
+  //   },
+  //   {
+  //     deviceType: '',
+  //     moduleName: '其他模块A',
+  //     pageType: 'balancePressHome',
+  //     moduleData: {
+  //       header: {
+  //         show: false,
+  //         readFrom: '',
+  //         selector: {
+  //           show: false,
+  //           value: '',
+  //         },
+  //         slot: {
+  //           show: false,
+  //           value: '',
+  //         },
+  //       },
+  //       background: {
+  //         show: false,
+  //         type: 'image',
+  //         link: '',
+  //       },
+  //       layout: {
+  //         direction: 'column',
+  //         items: [
+  //           {
+  //             name: 'list',
+  //             basis: '100%',
+  //           },
+  //         ],
+  //       },
+  //       list: [
+  //         {
+  //           type: 'K',
+  //           readFrom: 'windrect_ds_four.datalist[0]',
+  //           items: [
+  //             {
+  //               label: '网络状态',
+  //               value: '${readData.netStatus_str}',
+  //               color: 'blue',
+  //             },
+  //           ],
+  //         },
+  //       ],
+  //       to: '',
+  //     },
+  //     showStyle: {
+  //       size: 'width:380px;height:230px;',
+  //       version: '原版',
+  //       position: 'top:360px;right:0;',
+  //     },
+  //   },
+  // ]);
+
+  // const { configs, fetchConfigs } = useInitConfigs();
+
+  const formData = ref({});
+  // 默认初始是第一行
+  const isAutoControl = ref('1');
+  const changeType = (isAutoControl) => {
+    isAutoControl;
+    //
+  };
+
+  function onSubmit() {
+    message.success('提交成功');
+  }
+
+  const { configs, fetchConfigs } = useInitConfigs();
+
+  onMounted(() => {
+    // getMonitor()
+    fetchConfigs('balancePressHome');
+    loading.value = true;
+    mountedThree().then(async () => {
+      await setModelType('balancePressBase'); //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;
+  }
+</style>

+ 248 - 0
src/views/vent/monitorManager/balancePressMonitor/indexBD.vue

@@ -0,0 +1,248 @@
+<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, reactive, toRaw } from 'vue';
+  import { list, getTableList } from './balancePress.api';
+  import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
+  import balancePressHome from './components/balancePressHomeBD.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'];
+    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>