yusheng 1 week geleden
bovenliggende
commit
346a4842ed
2 gewijzigde bestanden met toevoegingen van 88 en 41 verwijderingen
  1. 8 0
      src/api/pcsData/index.js
  2. 80 41
      src/views/home/yuxin.vue

+ 8 - 0
src/api/pcsData/index.js

@@ -84,3 +84,11 @@ export async function getRealAlarmLogInfo(data) {
   }
   return ''
 }
+
+export async function listRealData(data) {
+  const res = await request.post(`main/asset/listRealData`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return ''
+}

+ 80 - 41
src/views/home/yuxin.vue

@@ -784,7 +784,11 @@
 
 <script>
   import { component } from 'vue-fullscreen';
-  import { getRealData, getRealAlarmLogInfo } from '@/api/pcsData/index.js';
+  import {
+    getRealData,
+    getRealAlarmLogInfo,
+    listRealData
+  } from '@/api/pcsData/index.js';
   import audioManager from '@/utils/audioManager.js';
   import GlobalAudioUnlockButton from '@/components/GlobalAudioUnlockButton.vue';
 
@@ -844,7 +848,7 @@
 
           SO2: {
             5: 'AI0067',
-            6: 'AI0042',
+            6: 'AI0067',
             7: 'AI0045',
             value: {
               value: '',
@@ -881,7 +885,7 @@
           进口流量: {
             5: 'AI0043',
             6: 'AI0024',
-            7: '0',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -899,7 +903,7 @@
           给水压力: {
             5: 'AI0013',
             6: 'AI0013',
-            7: 'AI0009',
+            7: 'AI0013',
             value: {
               value: '',
               unit: ''
@@ -926,25 +930,25 @@
           出口水温: {
             5: 'AI0022',
             6: 'AI0022',
-            7: 'AI0066',
+            7: '',
             value: {
               value: '',
               unit: ''
             }
           }
         },
-        //气泡
+        //汽包
         qp: {
           alarm: { alarmLevel: '', deviceData: [] },
           deviceId: {
             5: '2036027832722305025',
             6: '2036033116354162689',
-            7: '0'
+            7: ''
           },
           汽包进口温度: {
             5: 'AI0069',
-            6: '0',
-            7: '0',
+            6: '',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -953,7 +957,7 @@
           汽包液位: {
             5: 'AI0071',
             6: 'AI0075',
-            7: '0',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -961,8 +965,8 @@
           },
           汽包出口温度: {
             5: 'AI0075',
-            6: '0',
-            7: '0',
+            6: '',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -1006,18 +1010,18 @@
             7: '2036020850602848258'
           },
           进口蒸汽压力: {
-            5: '0',
-            6: '0',
-            7: '0',
+            5: '',
+            6: '',
+            7: '',
             value: {
               value: '',
               unit: ''
             }
           },
           出口温度: {
-            5: '0',
-            6: '0',
-            7: '0',
+            5: '',
+            6: '',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -1044,7 +1048,7 @@
           进口温度: {
             5: 'AI0068',
             6: 'AI0069',
-            7: '0',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -1178,7 +1182,7 @@
           炉膛温度左: {
             5: 'AI0066',
             6: 'AI0066',
-            7: '0',
+            7: '',
             value: {
               value: '',
               unit: ''
@@ -1448,12 +1452,45 @@
 
         let ids = [];
         devices.forEach((key) => {
-          this.getDeviceData(key);
+          // this.getDeviceData(key);
           ids.push(this[key].deviceId[this.currentId]);
           this[key].alarm.alarmLevel = '';
           this[key].alarm.deviceData = [];
+          const keys = Object.keys(this[key]).filter(
+            (k) => k !== 'deviceId' && k !== 'alarm'
+          );
+          keys.forEach((newKey) => {
+            this[key][newKey].value = {
+              value: '',
+              unit: ''
+            };
+          });
         });
         if (ids.length) {
+          listRealData({ ids }).then((res) => {
+            devices.forEach((key) => {
+              const device = this[key];
+
+              if (!device || !device.deviceId) return;
+              const realData = res.find(
+                (item) => item.substanceId == device.deviceId[this.currentId]
+              )?.realData;
+              const keys = Object.keys(device).filter(
+                (k) => k !== 'deviceId' && k !== 'alarm'
+              );
+              if (!realData) return;
+              realData.forEach((item) => {
+                keys.forEach((newKey) => {
+                  if (item.identifier == device[newKey][this.currentId]) {
+                    device[newKey].value = {
+                      value: item.value,
+                      unit: item.unit
+                    };
+                  }
+                });
+              });
+            });
+          });
           //获取告警
           getRealAlarmLogInfo(ids).then((res) => {
             res.forEach((item) => {
@@ -1470,26 +1507,28 @@
         }
       },
 
-      getDeviceData(deviceKey) {
-        const device = this[deviceKey];
-        if (!device || !device.deviceId) return;
-        const keys = Object.keys(device).filter(
-          (k) => k !== 'deviceId' && k !== 'alarm'
-        );
-        getRealData(device.deviceId[this.currentId]).then((res) => {
-          res &&
-            res.forEach((item) => {
-              keys.forEach((key) => {
-                if (item.identifier == device[key][this.currentId]) {
-                  device[key].value = {
-                    value: item.value,
-                    unit: item.unit
-                  };
-                }
-              });
-            });
-        });
-      },
+      // getDeviceData(deviceKey) {
+      //   const device = this[deviceKey];
+      //   if (!device || !device.deviceId) return;
+      //   const keys = Object.keys(device).filter(
+      //     (k) => k !== 'deviceId' && k !== 'alarm'
+      //   );
+      //   if (device.deviceId[this.currentId]) {
+      //     getRealData(device.deviceId[this.currentId]).then((res) => {
+      //       res &&
+      //         res.forEach((item) => {
+      //           keys.forEach((key) => {
+      //             if (item.identifier == device[key][this.currentId]) {
+      //               device[key].value = {
+      //                 value: item.value,
+      //                 unit: item.unit
+      //               };
+      //             }
+      //           });
+      //         });
+      //     });
+      //   }
+      // },
 
       onFullscreen() {
         this.isFullscreen = !this.isFullscreen;