浏览代码

解决冲突

hongrunxia 2 天之前
父节点
当前提交
6a5161b2cb

+ 8 - 0
src/router/guard/permissionGuard.ts

@@ -280,4 +280,12 @@ export function createPermissionGuard(router: Router) {
   router.afterEach(async (to, from) => {
     // await addBrowseLog(to, from, [...whitePathList, PAGE_NOT_FOUND_ROUTE]);
   });
+
+  window.addEventListener(
+    'beforeunload',
+    () => {
+      addBrowseLog(PAGE_NOT_FOUND_ROUTE, router.currentRoute.value, [PAGE_NOT_FOUND_ROUTE.path]);
+    },
+    { once: true }
+  );
 }

+ 61 - 59
src/router/helper/menuHelper.ts

@@ -3,12 +3,11 @@ import type { MenuModule, Menu, AppRouteRecordRaw } from '/@/router/types';
 import { findPath, treeMap } from '/@/utils/helper/treeHelper';
 import { cloneDeep } from 'lodash-es';
 import { isUrl } from '/@/utils/is';
-import { RouteParams } from 'vue-router';
+import { RouteLocationNormalized, RouteParams } from 'vue-router';
 import { toRaw } from 'vue';
 import { defHttp } from '/@/utils/http/axios';
-import { useUserStoreWithOut } from '/@/store/modules/user';
+import { Form } from 'ant-design-vue';
 
-let currentRouter = '';
 export function getAllParentPath<T = Recordable>(treeData: T[], path: string) {
   const menuList = findPath(treeData, (n) => n.path === path) as Menu[];
   return (menuList || []).map((item) => item.path);
@@ -99,62 +98,65 @@ export function configureDynamicParamsMenu(menu: Menu, params: RouteParams) {
   menu.children?.forEach((item) => configureDynamicParamsMenu(item, params));
 }
 
-export async function addBrowseLog(to, from, whitePathList) {
-  const userStore = useUserStoreWithOut();
-  const token = userStore.getToken;
-  if (token) {
-    let currentBrowseId = '';
-    if (to.path !== '/sys/log/addBrowseLog') {
-      const url = '/sys/log/addBrowseLog';
+export async function addBrowseLog(
+  to: AppRouteRecordRaw | RouteLocationNormalized,
+  from: AppRouteRecordRaw | RouteLocationNormalized,
+  ignorePaths: string[]
+): Promise<void> {
+  // 在尝试添加浏览器记录时,应该先发出一个结束上次记录的请求(如有)再发出一个开发此次记录的请求
+  const url = '/sys/log/addBrowseLog';
 
-      // 生成时间戳函数
-      const formatTimestamp = () => {
-        const date = new Date();
-        return [
-          date.getFullYear(),
-          String(date.getMonth() + 1).padStart(2, '0'),
-          String(date.getDate()).padStart(2, '0'),
-          String(date.getHours()).padStart(2, '0'),
-          String(date.getMinutes()).padStart(2, '0'),
-          String(date.getSeconds()).padStart(2, '0'),
-          String(date.getMilliseconds()).padStart(3, '0'),
-        ].join('');
-      };
-      // 2. 记录新页面进入日志
-      currentBrowseId = formatTimestamp();
-      if (!currentRouter && !whitePathList.includes(to.path)) {
-        currentRouter = to.fullPath;
-        try {
-          await defHttp.post({
-            url,
-            params: {
-              browseId: currentBrowseId,
-              isEnd: false,
-              method: to.fullPath,
-            },
-          });
-          console.log('进入页面日志记录成功');
-        } catch (e) {
-          console.error('进入页面日志记录失败:', e);
-        }
-      } else {
-        if (from.fullPath === currentRouter) {
-          try {
-            currentRouter = '';
-            await defHttp.post({
-              url,
-              params: {
-                browseId: currentBrowseId,
-                isEnd: true,
-                method: from.fullPath,
-              },
-            });
-            console.log('进入页面日志记录成功');
-          } catch (e) {
-            console.error('进入页面日志记录失败:', e);
-          }
-        }
-      }
-    }
+  // meta.browseId 是该方法动态添加的内容,可用于判断该路径是否记录
+  if (from.meta.browseId) {
+    await defHttp.post({
+      url,
+      params: {
+        browseId: from.meta.browseId,
+        isEnd: true,
+        method: from.fullPath,
+      },
+    });
   }
+  if (!ignorePaths.includes(to.path)) {
+    const timestamp = Date.now();
+    to.meta.browseId = timestamp;
+    await defHttp.post({
+      url,
+      params: {
+        browseId: timestamp,
+        isEnd: false,
+        method: to.fullPath,
+      },
+    });
+  }
+  // if (to.path !== '/sys/log/addBrowseLog') {
+
+  //   // 2. 记录新页面进入日志
+  //   currentBrowseId = formatTimestamp();
+  //   if (!currentRouter) {
+  //     currentRouter = to.fullPath;
+  //     try {
+  //       console.log('进入页面日志记录成功');
+  //     } catch (e) {
+  //       console.error('进入页面日志记录失败:', e);
+  //     }
+  //   } else {
+  //     if (from.fullPath === currentRouter) {
+  //       try {
+  //         currentRouter = '';
+  //         await defHttp.post({
+  //           url,
+  //           params: {
+  //             browseId: currentBrowseId,
+  //             isEnd: true,
+  //             method: from.fullPath,
+  //           },
+  //         });
+  //         console.log('进入页面日志记录成功');
+  //       } catch (e) {
+  //         console.error('进入页面日志记录失败:', e);
+  //       }
+  //     }
+  //   }
+  // }
 }

+ 52 - 52
src/router/index.ts

@@ -23,59 +23,59 @@ export const router = createRouter({
 
 // TODO 【QQYUN-4517】【表单设计器】记录分享路由守卫测试
 // 存储当前页面的browseId(用于关联离开/进入日志)
-const currentBrowseId = '';
-router.beforeEach(async (to, from, next) => {
-  if (to.path === '/sys/log/addBrowseLog') {
-    // const url = '/sys/log/addBrowseLog';
-    // const currentPath = to.fullPath;
-    // // 生成时间戳函数
-    // const formatTimestamp = () => {
-    //   const date = new Date();
-    //   return [
-    //     date.getFullYear(),
-    //     String(date.getMonth() + 1).padStart(2, '0'),
-    //     String(date.getDate()).padStart(2, '0'),
-    //     String(date.getHours()).padStart(2, '0'),
-    //     String(date.getMinutes()).padStart(2, '0'),
-    //     String(date.getSeconds()).padStart(2, '0'),
-    //     String(date.getMilliseconds()).padStart(3, '0'),
-    //   ].join('');
-    // };
-    // // 1. 如果存在上一个页面的browseId,发送离开日志
-    // if (currentBrowseId && from.fullPath !== '/') {
-    //   try {
-    //     await defHttp.post({
-    //       url,
-    //       params: {
-    //         browseId: currentBrowseId,
-    //         isEnd: true,
-    //         method: from.fullPath,
-    //       },
-    //     });
-    //     console.log('离开页面日志记录成功');
-    //   } catch (e) {
-    //     console.error('离开页面日志记录失败:', e);
-    //   }
-    // }
-    // // 2. 记录新页面进入日志
-    // currentBrowseId = formatTimestamp();
-    // try {
-    //   await defHttp.post({
-    //     url,
-    //     params: {
-    //       browseId: currentBrowseId,
-    //       isEnd: false,
-    //       method: to.fullPath,
-    //     },
-    //   });
-    //   console.log('进入页面日志记录成功');
-    // } catch (e) {
-    //   console.error('进入页面日志记录失败:', e);
-    // }
-  }
+// const currentBrowseId = '';
+// router.beforeEach(async (to, from, next) => {
+//   if (to.path === '/sys/log/addBrowseLog') {
+//     // const url = '/sys/log/addBrowseLog';
+//     // const currentPath = to.fullPath;
+//     // // 生成时间戳函数
+//     // const formatTimestamp = () => {
+//     //   const date = new Date();
+//     //   return [
+//     //     date.getFullYear(),
+//     //     String(date.getMonth() + 1).padStart(2, '0'),
+//     //     String(date.getDate()).padStart(2, '0'),
+//     //     String(date.getHours()).padStart(2, '0'),
+//     //     String(date.getMinutes()).padStart(2, '0'),
+//     //     String(date.getSeconds()).padStart(2, '0'),
+//     //     String(date.getMilliseconds()).padStart(3, '0'),
+//     //   ].join('');
+//     // };
+//     // // 1. 如果存在上一个页面的browseId,发送离开日志
+//     // if (currentBrowseId && from.fullPath !== '/') {
+//     //   try {
+//     //     await defHttp.post({
+//     //       url,
+//     //       params: {
+//     //         browseId: currentBrowseId,
+//     //         isEnd: true,
+//     //         method: from.fullPath,
+//     //       },
+//     //     });
+//     //     console.log('离开页面日志记录成功');
+//     //   } catch (e) {
+//     //     console.error('离开页面日志记录失败:', e);
+//     //   }
+//     // }
+//     // // 2. 记录新页面进入日志
+//     // currentBrowseId = formatTimestamp();
+//     // try {
+//     //   await defHttp.post({
+//     //     url,
+//     //     params: {
+//     //       browseId: currentBrowseId,
+//     //       isEnd: false,
+//     //       method: to.fullPath,
+//     //     },
+//     //   });
+//     //   console.log('进入页面日志记录成功');
+//     // } catch (e) {
+//     //   console.error('进入页面日志记录失败:', e);
+//     // }
+//   }
 
-  next();
-});
+//   next();
+// });
 
 // reset router
 export function resetRouter() {

+ 12 - 5
src/views/monitor/log/index.vue

@@ -4,6 +4,7 @@
       <a-tabs defaultActiveKey="1" @change="tabChange" size="small">
         <a-tab-pane tab="登录日志" key="1" />
         <a-tab-pane tab="操作日志" key="2" />
+        <a-tab-pane tab="浏览日志" key="3" />
       </a-tabs>
     </template>
     <template #expandedRowRender="{ record }">
@@ -24,7 +25,7 @@
   import { ref } from 'vue';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
   import { getLogList } from './log.api';
-  import { columns, searchFormSchema, operationLogColumn } from './log.data';
+  import { columns, searchFormSchema, operationLogColumn, browserColumn } from './log.data';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { useListPage } from '/@/hooks/system/useListPage';
   const { createMessage } = useMessage();
@@ -55,10 +56,16 @@
   function tabChange(key) {
     searchInfo.logType = key;
     //update-begin---author:wangshuai ---date:20220506  for:[VUEN-943]vue3日志管理列表翻译不对------------
-    if (key == '1') {
-      logColumns.value = columns;
-    } else {
-      logColumns.value = operationLogColumn;
+    switch (key) {
+      case '1':
+        logColumns.value = columns;
+        break;
+      case '2':
+        logColumns.value = operationLogColumn;
+        break;
+      case '3':
+        logColumns.value = browserColumn;
+        break;
     }
     //update-end---author:wangshuai ---date:20220506  for:[VUEN-943]vue3日志管理列表翻译不对--------------
     reload();

+ 41 - 0
src/views/monitor/log/log.data.ts

@@ -71,3 +71,44 @@ export const searchFormSchema: FormSchema[] = [
     },
   },
 ];
+
+export const browserColumn: BasicColumn[] = [
+  {
+    title: '日志内容',
+    dataIndex: 'logContent',
+    width: 100,
+    align: 'left',
+  },
+  {
+    title: '操作人ID',
+    dataIndex: 'userid',
+    width: 80,
+  },
+  {
+    title: '操作人',
+    dataIndex: 'username',
+    width: 80,
+  },
+  {
+    title: 'IP',
+    dataIndex: 'ip',
+    width: 80,
+  },
+  {
+    title: '耗时(秒)',
+    dataIndex: 'costTime',
+    width: 80,
+  },
+  {
+    title: '创建时间',
+    dataIndex: 'createTime',
+    sorter: true,
+    width: 80,
+  },
+  {
+    title: '结束时间',
+    dataIndex: 'endTime',
+    sorter: true,
+    width: 80,
+  },
+];

+ 157 - 252
src/views/vent/monitorManager/compressor/components/nitrogenHome_dtyj.vue

@@ -63,55 +63,36 @@
       <div class="top-box">
         <!-- 左边监测数据 -->
         <div class="lr-box left-box">
-          <div class="item item-l" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
+          <div class="item item-l"  v-for="(prefixItem, i) in leftHalfZDMonitorData" :key="i">
             <ventBox1>
               <template #title>
-                <div>{{ monitorData[groupNum - 1]['strname'] }}</div>
+                <div>{{ MonitorTitleDic[prefixItem.prefix] || prefixItem.prefix }}</div>
               </template>
               <template #container>
                 <div class="monitor-box">
-                  <div class="parameter-title group-parameter-title"
-                    ><SvgIcon class="icon" size="38" name="device-group-paramer" /><span>机组参数</span></div
-                  >
-                  <div class="state-item" v-for="(data, index) in groupParameterData" :key="index">
-                    <div class="item-col">
-                      <span class="state-title">{{ Object.values(data)[0] }} :</span>
-                      <span class="state-val">{{
-                        (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]]) >= 0
-                          ? monitorData[groupNum - 1][Object.keys(data)[0]]
-                          : '-'
-                      }}</span>
-                    </div>
-                    <div class="item-col" v-if="Object.keys(data)[1]">
-                      <span class="state-title">{{ Object.values(data)[1] }} :</span>
-                      <span class="state-val">{{
-                        (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]]) >= 0
-                          ? monitorData[groupNum - 1][Object.keys(data)[1]]
-                          : '-'
-                      }}</span>
+                  <div class="state-item" v-for="(monitorItem, j) in prefixItem.valuelist" :key="j">
+                    <div class="item-col" >
+                      <span class="state-title">{{ monitorItem.label}}</span>
+                      <span class="state-val">{{ formatValue(monitorItem.val) || monitorItem.val }}</span>
+                      <span class="state-unit">{{ monitorItem.unit}}</span>
                     </div>
                   </div>
                 </div>
+              </template>
+            </ventBox1>
+          </div>
+          <div class="item item-l"  v-for="(prefixItem, i) in leftHalfKYMonitorData" :key="i">
+            <ventBox1>
+              <template #title>
+                <div>{{ MonitorTitleDic[prefixItem.prefix] || prefixItem.prefix }}</div>
+              </template>
+              <template #container>
                 <div class="monitor-box">
-                  <div class="parameter-title device-parameter-title"
-                    ><SvgIcon class="icon" size="32" name="device-paramer" /><span>电机数据</span></div
-                  >
-                  <div class="state-item" v-for="(data, index) in deviceParameterData" :key="index">
-                    <div class="item-col">
-                      <span class="state-title">{{ Object.values(data)[0] }} :</span>
-                      <span class="state-val">{{
-                        (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[0]]) >= 0
-                          ? monitorData[groupNum - 1][Object.keys(data)[0]]
-                          : '-'
-                      }}</span>
-                    </div>
-                    <div class="item-col" v-if="Object.keys(data)[1]">
-                      <span class="state-title">{{ Object.values(data)[1] }} :</span>
-                      <span class="state-val">{{
-                        (monitorData.length > 0 && monitorData[groupNum - 1][Object.keys(data)[1]]) >= 0
-                          ? monitorData[groupNum - 1][Object.keys(data)[1]]
-                          : '-'
-                      }}</span>
+                  <div class="state-item" v-for="(monitorItem, j) in prefixItem.valuelist" :key="j">
+                    <div class="item-col" >
+                      <span class="state-title">{{ monitorItem.label}}</span>
+                      <span class="state-val">{{ formatValue(monitorItem.val) || monitorItem.val }}</span>
+                      <span class="state-unit">{{ monitorItem.unit}}</span>
                     </div>
                   </div>
                 </div>
@@ -121,57 +102,41 @@
         </div>
         <!-- 右边控制状态 -->
         <div class="lr-box right-box">
-          <ventBox1>
-            <template #title>
-              <div>远程控制</div>
-            </template>
-            <template #container>
-              <div class="control-group">
-                <div class="control-item" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
-                  <div class="control-item-title">{{ monitorData[groupNum - 1]['strname'] }}</div>
-                  <div class="control-item-state">
-                    <a-switch
-                      v-model="airCompressorState[groupNum - 1][`compressRunSigF1`]"
-                      size="small"
-                      checked-children="开启"
-                      un-checked-children="关闭"
-                      :disabled="airCompressorState[groupNum - 1][`controlModel`]"
-                      @change="handlerDevice(airCompressorState[groupNum - 1])"
-                    />
-                  </div>
-                </div>
-                <div class="control-item" v-for="groupNum in monitorDataGroupNum" :key="groupNum">
-                  <div class="control-item-title">{{ kyjs[groupNum - 1] }}</div>
-                  <div class="control-item-state">
-                    <a-switch
-                      v-model="airCompressorState[groupNum - 1][`compressRunSigF1`]"
-                      size="small"
-                      checked-children="开启"
-                      un-checked-children="关闭"
-                      :disabled="airCompressorState[groupNum - 1][`controlModel`]"
-                      @change="handlerDevice(airCompressorState[groupNum - 1])"
-                    />
+          <div class="item item-r"  v-for="(prefixItem, i) in rightHalfZDMonitorData" :key="i">
+            <ventBox1>
+              <template #title>
+                <div>{{ MonitorTitleDic[prefixItem.prefix] || prefixItem.prefix }}</div>
+              </template>
+              <template #container>
+                <div class="monitor-box">
+                  <div class="state-item" v-for="(monitorItem, j) in prefixItem.valuelist" :key="j">
+                    <div class="item-col" >
+                      <span class="state-title">{{ monitorItem.label}}</span>
+                      <span class="state-val">{{  formatValue(monitorItem.val) || monitorItem.val }}</span>
+                      <span class="state-unit">{{ monitorItem.unit}}</span>
+                    </div>
                   </div>
                 </div>
-                <div class="control-item">
-                  <div class="control-item-title">是否开启联动</div>
-                  <div class="control-item-state">
-                    <a-radio v-model:checked="isLink">开启</a-radio>
+              </template>
+            </ventBox1>
+          </div>
+          <div class="item item-r"  v-for="(prefixItem, i) in rightHalfKYMonitorData" :key="i">
+            <ventBox1>
+              <template #title>
+                <div>{{ MonitorTitleDic[prefixItem.prefix] || prefixItem.prefix }}</div>
+              </template>
+              <template #container>
+                <div class="monitor-box">
+                  <div class="state-item" v-for="(monitorItem, j) in prefixItem.valuelist" :key="j">
+                    <div class="item-col" >
+                      <span class="state-title">{{ monitorItem.label}}</span>
+                      <span class="state-val">{{  formatValue(monitorItem.val) || monitorItem.val }}</span>
+                      <span class="state-unit">{{ monitorItem.unit}}</span>
+                    </div>
                   </div>
                 </div>
-              </div>
-            </template>
-          </ventBox1>
-          <ventBox1 class="vent-margin-t-10">
-            <template #title>
-              <div>设备实时监测曲线</div>
-            </template>
-            <template #container>
-              <BarAndLineCustom xAxisPropType="readTime" :chartData="monitorData" height="240px" :propTypeArr="['flowRate']" :option="zhudanOption" />
-            </template>
-          </ventBox1>
-          <div class="vent-margin-t-10">
-            <!-- <LivePlayer id="fm-player1" style="height: 250px;" ref="player1" :videoUrl="flvURL1()" muted live loading controls /> -->
+              </template>
+            </ventBox1>
           </div>
         </div>
       </div>
@@ -179,15 +144,12 @@
   </div>
 </template>
 <script lang="ts" setup name="nitrogenHome">
-  import { onMounted, onUnmounted, ref, watch, reactive, defineProps, nextTick } from 'vue';
+  import { onMounted, onUnmounted, ref, watch, reactive, defineProps, nextTick, computed } from 'vue';
   import ventBox1 from '/@/components/vent/ventBox1.vue';
   import fourBorderBg from '../../../comment/components/fourBorderBg.vue';
   import { mountedThree, destroy, setModelType } from '../nitrogen.threejs';
   import { list } from '../nitrogen.api';
-  import { SvgIcon } from '/@/components/Icon';
-  import LivePlayer from '@liveqing/liveplayer-v3';
-  import BarAndLineCustom from '/@/components/chart/BarAndLineCustom.vue';
-  import { zhudanOption } from '../nitrogen.data.ts';
+  import { ZDOptionList, KYOptionList} from '../nitrogen.data.dtyj.ts';
 
   const props = defineProps({
     deviceId: {
@@ -200,12 +162,6 @@
     },
   });
   const loading = ref(true);
-  const isLink = ref(true);
-  const isRefresh = ref(true);
-
-  const zdjs = ['1号制氮机', '2号制氮机', '3号制氮机', '4号制氮机'];
-  const kyjs = ['1号空压机', '1号空压机', '1号空压机', '1号空压机'];
-
   const flvURL1 = () => {
     return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
     // return ''
@@ -213,52 +169,6 @@
   const monitorNetStatus = ref(0);
   const monitorDataGroupNum = ref(0);
 
-  const airCompressorState = reactive([
-    {
-      id: '',
-      compressRunSigF1: false,
-      controlModel: false,
-    },
-    {
-      id: '',
-      compressRunSigF1: false,
-      controlModel: false,
-    },
-    {
-      id: '',
-      compressRunSigF1: false,
-      controlModel: false,
-    },
-    {
-      id: '',
-      compressRunSigF1: false,
-      controlModel: false,
-    },
-  ]);
-
-  const groupParameterData = [
-    {
-      cumulativeFlow: '累计流量(m³)',
-      centerTemperature: '加热器中心温度',
-    },
-    {
-      outletTemperature: '加热器出口温度',
-    },
-  ];
-  const deviceParameterData = [
-    {
-      Ia: 'A项电流(A)',
-      Ib: 'B项电流(A)',
-    },
-    {
-      Ic: 'c项电流(A)',
-      Vab: 'AB项间电压(V)',
-    },
-    {
-      Vac: 'AC项间电压(V)',
-      Vbc: 'BC项间电压(V)',
-    },
-  ];
 
   const monitorData = ref(
     new Array(4).fill({
@@ -281,7 +191,90 @@
       controlModel: 'LOC',
     })
   );
+  // 模块标题字典
+  const MonitorTitleDic = {
+    ZD1: '1号制氮机',
+    ZD2: '2号制氮机',
+    ZD3: '3号制氮机',
+    ZD4: '4号制氮机',
+    KY1: '1号空压机',
+    KY2: '2号空压机',
+    KY3: '3号空压机',
+    KY4: '4号空压机',
+  };
+  // 制氮机数据项
+  const ZDMonitorData = ref<{ prefix: string; valuelist: { label: string; key: string; val: string; unit: string }[] }[]>([])
+  // 初始化 ZDMonitorData,按照 prefix 分类
+  ZDOptionList.prefix.forEach(prefix => {
+    const valuelist: { label: string; key: string; val: string; unit: string }[] = [];
+    ZDOptionList.item.forEach(item => {
+      if(item.isShow) {
+        valuelist.push({
+          label: item.label,
+          key: `ZD.ZD01.SHARE.ZD_${prefix}_${item.ident}_${item.prop}`,
+          val: '-',
+          unit: item.unit || '-'
+        });
+      }
+
+    });
+    ZDMonitorData.value.push({
+      prefix: prefix,
+      valuelist: valuelist
+    });
+  });
+    // 计算属性,用于获取 ZDMonitorData 的前半部分
+  const leftHalfZDMonitorData = computed(() => {
+    const middle = Math.floor(ZDMonitorData.value.length / 2);
+    return ZDMonitorData.value.slice(0, middle);
+  });
+
+  // 计算属性,用于获取 ZDMonitorData 的后半部分
+  const rightHalfZDMonitorData = computed(() => {
+    const middle = Math.floor(ZDMonitorData.value.length / 2);
+    return ZDMonitorData.value.slice(middle);
+  });
+
+  // 空压机数据项
+  const KYMonitorData = ref<{ prefix: string; valuelist: { label: string; key: string; val: string; unit: string }[] }[]>([])
+  // 初始化 KYMonitorData,按照 prefix 分类
+  KYOptionList.prefix.forEach(prefix => {
+    const valuelist: { label: string; key: string; val: string; unit: string }[] = [];
+    KYOptionList.item.forEach(item => {
+      if(item.isShow) {
+        valuelist.push({
+          label: item.label,
+          key: `ZD.ZD01.SHARE.ZD_${prefix}_${item.ident}_${item.prop}`,
+          val: '-',
+          unit: item.unit || '-'
+        });
+      }
+
+    });
+    KYMonitorData.value.push({
+      prefix: prefix,
+      valuelist: valuelist
+    });
+  });
+  // 计算属性,用于获取 ZDMonitorData 的前半部分
+  const leftHalfKYMonitorData = computed(() => {
+    const middle = Math.floor(KYMonitorData.value.length / 2);
+    return KYMonitorData.value.slice(0, middle);
+  });
 
+  // 计算属性,用于获取 ZDMonitorData 的后半部分
+  const rightHalfKYMonitorData = computed(() => {
+    const middle = Math.floor(KYMonitorData.value.length / 2);
+    return KYMonitorData.value.slice(middle);
+  });  
+// 格式化数值的方法
+const formatValue = (value: string) => {
+  const num = parseFloat(value);
+  if (!isNaN(num) && value.includes('.')) {
+    return num.toFixed(2);
+  }
+  return value;
+};
   // https获取监测数据
   let timer: null | NodeJS.Timeout = null;
   async function getMonitor(flag?) {
@@ -313,27 +306,28 @@
             netStatus = 1;
           }
           const item = data.readData;
+          // 将接口获取到的数据赋值给制氮机数据列表和空压机数据列表
+          ZDMonitorData.value.forEach(prefixItem => {
+            prefixItem.valuelist.forEach(valItem => {
+              valItem.val = item[valItem.key] || '-';
+            });
+            
+          });
+          KYMonitorData.value.forEach(prefixItem => {
+            prefixItem.valuelist.forEach(valItem => {
+              valItem.val = item[valItem.key] || '-';
+            });
+            
+          });
           return Object.assign(data, item);
         });
         monitorNetStatus.value = netStatus;
       }
     });
     monitorDataGroupNum.value = monitorData.value.length;
+ 
   }
 
-  function handlerDevice(data) {
-    // if (data.length < 1) return
-    // handleAirCompressor({ id: data.id, compressRunF1: data.compressRunSigF1 }).then(res => {
-    //   if (res.success) {
-    //     message.success('操作成功')
-    //   } else {
-    //     message.warning(data.msg)
-    //   }
-    // })
-  }
-  function resetDevice(data) {}
-
-  function handlerControlModel(data) {}
 
   watch([monitorDataGroupNum, loading], ([newMonitorDataGroupNum, newLoading]) => {
     debugger;
@@ -460,14 +454,12 @@
           .state-item {
             display: flex;
             flex-direction: row;
-            padding: 5px;
 
             .item-col {
-              width: calc(50% - 5px);
+              width: 100%;
               display: flex;
               justify-content: center;
               align-items: center;
-              padding-right: 4px;
               background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
               &:first-child {
                 margin-right: 10px;
@@ -537,104 +529,17 @@
           }
         }
 
-        .item-l {
+        .item-l, .item-r {
           width: 100%;
           .monitor-box {
             width: 100%;
-            .parameter-title {
-              position: relative;
-              width: 100%;
-              height: 14px;
-              margin-top: 10px;
-              .icon,
-              span {
-                position: absolute;
-                top: -10px;
-              }
-            }
-            .group-parameter-title {
-              background-image: linear-gradient(to right, #39a3ff50, #39a3ff00);
-
-              .icon {
-                left: -12px;
-                top: -17px;
-              }
-              span {
-                left: 18px;
-              }
-              .item-col {
-                background-image: linear-gradient(to right, #39a3ff00, #39a3ff10);
-              }
-            }
-            .device-parameter-title {
-              background-image: linear-gradient(to right, #3df6ff40, #3df6ff00);
-              .icon {
-                left: -10px;
-                top: -14px;
-              }
-              span {
-                left: 18px;
-              }
-              .item-col {
-                background-image: linear-gradient(to right, #3df6ff10, #3df6ff00);
-              }
-            }
-          }
-        }
-
-        .right-box {
-          width: 330px;
-          margin-top: 50px;
-          .control-group {
-            display: flex;
-            // justify-content: space-around;
-            flex-wrap: wrap;
-            .control-item {
-              display: flex;
-              flex-direction: column;
-              justify-content: center;
-              align-items: center;
-              padding: 0 4px;
-              .control-item-title {
-                color: #a6dce9;
-                position: relative;
-                top: 5px;
-              }
-              .control-item-state {
-                width: 94px;
-                height: 47px;
-                background: url('/@/assets/images/vent/control-switch-bg.png');
-                display: flex;
-                justify-content: center;
-                align-items: center;
-                color: #fff;
-              }
-
-              .button-box {
-                position: relative;
-                padding: 5px;
-                border: 1px transparent solid;
-                background-clip: border-box;
-                border-radius: 5px;
-                margin-left: 8px;
-              }
-
-              .a-button {
-                pointer-events: auto;
-              }
-
-              &::v-deep .a-button--mini {
-                padding: 6px 10px;
-              }
-
-              &::v-deep .a-button--mini.is-round {
-                padding: 6px 10px;
-              }
-            }
+              display: grid;
+              grid-template-columns: 1fr 1fr; /* 两列布局 */
+              gap: 10px; /* 间距 */
           }
         }
 
-        .left-box {
+        .left-box, .right-box {
           width: 365px;
           margin-top: 80px;
         }

+ 282 - 0
src/views/vent/monitorManager/compressor/nitrogen.data.dtyj.ts

@@ -0,0 +1,282 @@
+// 制氮机
+export const ZDOptionList = {
+  // ZD + prefix + item.ident + item.prop
+  'prefix': [
+    'ZD1',
+    'ZD2',
+    'ZD3',
+    'ZD4'
+  ],
+  'item': [
+    {
+      'label': '氮气纯度',
+      'ident':'AI',
+      'prop': 'CD',
+      'unit': '%',
+      'isShow': true
+    },
+    {
+      'label': '氮气流量',
+      'ident':'AI',
+      'prop': 'LL',
+      'unit': 'm³/h',
+      'isShow': true
+    },
+    {
+      'label': '流量累计',
+      'ident':'AI',
+      'prop': 'LLj',
+      'unit': 'm³',
+      'isShow': true
+    },
+    {
+      'label': '氮气温度',
+      'ident':'AI',
+      'prop': 'PT',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '氮气压力',
+      'ident':'AI',
+      'prop': 'YL',
+      'unit': 'Mpa',
+      'isShow': true
+    },
+    {
+      'label': '冻干机备妥',
+      'ident':'DI',
+      'prop': 'DGready',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '冻干机运行',
+      'ident':'DI',
+      'prop': 'DGrun',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '冻干机停止',
+      'ident':'DI',
+      'prop': 'DGstop',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机远方',
+      'ident':'DI',
+      'prop': 'DGyk',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机报警',
+      'ident':'DI',
+      'prop': 'ZDalarm',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机故障',
+      'ident':'DI',
+      'prop': 'ZDfault',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机备妥',
+      'ident':'DI',
+      'prop': 'ZDready',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机运行',
+      'ident':'DI',
+      'prop': 'ZDrun',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机停止',
+      'ident':'DI',
+      'prop': 'ZDstop',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机远方',
+      'ident':'DI',
+      'prop': 'ZDyk',
+      'unit': '-',
+      'isShow': false
+    },
+    {
+      'label': '制氮机通讯',
+      'ident':'GZ',
+      'prop': 'ZDtx',
+      'unit': '-',
+      'isShow': false
+    },
+  ]
+};
+
+// 空压机
+
+
+export const KYOptionList = {
+  // ZD + prefix + item.ident + item.prop
+  'prefix': [
+    'KY1',
+    'KY2',
+    'KY3',
+    'KY4'
+  ],
+  'item': [
+    {
+      'label': '单次加载时间h',
+      'ident':'',
+      'prop': 'LOATh',
+      'unit': 'H',
+      'isShow': false
+    },
+    {
+      'label': '单次加载时间m',
+      'ident':'',
+      'prop': 'LOATm',
+      'unit': 'M',
+      'isShow': false
+    },
+    {
+      'label': '单次加载时间s',
+      'ident':'',
+      'prop': 'LOATs',
+      'unit': 'S',
+      'isShow': false
+    },
+    {
+      'label': '单次运行时间h',
+      'ident':'',
+      'prop': 'RUNh',
+      'unit': 'H',
+      'isShow': false
+    },
+    {
+      'label': '单次运行时间m',
+      'ident':'',
+      'prop': 'RUNm',
+      'unit': 'M',
+      'isShow': false
+    },
+    {
+      'label': '单次运行时间s',
+      'ident':'',
+      'prop': 'RUNs',
+      'unit': 'S',
+      'isShow': false
+    },
+    {
+      'label': '运行电流',
+      'ident':'AI',
+      'prop': 'A',
+      'unit': 'A',
+      'isShow': false
+    },
+    {
+      'label': '风扇电流',
+      'ident':'AI',
+      'prop': 'FSa',
+      'unit': 'A',
+      'isShow': false
+    },
+    {
+      'label': '出口流量',
+      'ident':'AI',
+      'prop': 'LL',
+      'unit': 'm³',
+      'isShow': false
+    },
+    {
+      'label': '累计加载',
+      'ident':'AI',
+      'prop': 'LOATt',
+      'unit': 'H',
+      'isShow': true
+    },
+    {
+      'label': '排气温度',
+      'ident':'AI',
+      'prop': 'PT',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '电机温度a',
+      'ident':'AI',
+      'prop': 'PTa',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '电机温度b',
+      'ident':'AI',
+      'prop': 'PTb',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '电机温度c',
+      'ident':'AI',
+      'prop': 'PTc',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '后轴温度',
+      'ident':'AI',
+      'prop': 'PTh',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '前轴温度',
+      'ident':'AI',
+      'prop': 'PTq',
+      'unit': '℃',
+      'isShow': true
+    },
+    {
+      'label': '累计运行',
+      'ident':'AI',
+      'prop': 'RUNt',
+      'unit': 'H',
+      'isShow': true
+    },{
+      'label': '电源电压',
+      'ident':'AI',
+      'prop': 'V',
+      'unit': 'V',
+      'isShow': true
+    },{
+      'label': '排气压力',
+      'ident':'AI',
+      'prop': 'YL',
+      'unit': 'Mpa',
+      'isShow': true
+    },{
+      'label': '水平震动',
+      'ident':'AI',
+      'prop': 'ZDx',
+      'unit': 'mm/s',
+      'isShow': false
+    },{
+      'label': '垂直振动',
+      'ident':'AI',
+      'prop': 'ZDy',
+      'unit': 'mm/s',
+      'isShow': false
+    },
+  ]
+};

+ 2 - 2
src/views/vent/monitorManager/dedustMonitor/components/AlarmHistory.vue

@@ -2,7 +2,7 @@
   <div class="alarm-history">
     <AlarmHistoryTable
       columns-type="alarm"
-      device-type="sys_surface_juejin"
+      :device-type="deviceType"
       :device-list-api="workFaceDeviceList.bind(null, { id: deviceId })"
       :list="list"
       :sys-id="deviceId"
@@ -15,7 +15,7 @@
   import { workFaceDeviceList } from '../../../deviceManager/comment/warningTabel/warning.api';
   import { defHttp } from '/@/utils/http/axios';
 
-  const props = defineProps({
+  defineProps({
     deviceType: {
       type: String,
       required: true,

+ 28 - 0
src/views/vent/monitorManager/dedustMonitor/components/AlarmHistoryBet.vue

@@ -0,0 +1,28 @@
+<template>
+  <div class="alarm-history">
+    <AlarmHistoryTable columns-type="alarm" :device-type="deviceType" designScope="alarm-history" />
+  </div>
+</template>
+<script setup lang="ts">
+  import AlarmHistoryTable from '../../comment/WorkFaceAlarmHistoryTable.vue';
+  // import { workFaceDeviceList } from '../../../deviceManager/comment/warningTabel/warning.api';
+  // import { defHttp } from '/@/utils/http/axios';
+
+  defineProps({
+    deviceType: {
+      type: String,
+      required: true,
+    },
+    deviceId: {
+      type: String,
+      required: true,
+    },
+  });
+
+  // const list = (params) => defHttp.get({ url: '/safety/managesysAutoLog/list', params });
+</script>
+<style lang="less" scoped>
+  .alarm-history {
+    pointer-events: auto;
+  }
+</style>

+ 13 - 3
src/views/vent/monitorManager/dedustMonitor/index.vue

@@ -41,12 +41,13 @@
             :deviceId="optionValue"
             :device-type="deviceType"
           />
-          <AlarmHistory
+          <component
             v-if="activeKey == 'faultRecord'"
+            :is="AlarmHistoryComponent"
             ref="handlerHistoryTable"
             class="vent-margin-t-20"
             :deviceId="optionValue"
-            :device-type="deviceType"
+            :device-type="calcDeviceType"
           />
         </div>
       </div>
@@ -61,7 +62,6 @@
   import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
   import DedustHistory from './components/DedustHistory.vue';
   import HandleHistory from './components/HandleHistory.vue';
-  import AlarmHistory from './components/AlarmHistory.vue';
   import { useRouter } from 'vue-router';
   import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
   import { useGlobSetting } from '/@/hooks/setting';
@@ -77,6 +77,16 @@
         return defineAsyncComponent(() => import('./components/DedustHome.vue'));
     }
   });
+  const AlarmHistoryComponent = computed(() => {
+    // const sysOrgCode = 'sdmtjtbltmk';
+    switch (sysOrgCode) {
+      // 布尔台
+      case 'sdmtjtbetmk':
+        return defineAsyncComponent(() => import('./components/AlarmHistoryBet.vue'));
+      default:
+        return defineAsyncComponent(() => import('./components/AlarmHistory.vue'));
+    }
+  });
 
   const { currentRoute } = useRouter();
   const activeKey = ref('monitor');