Browse Source

修改WS推送数据插入方式为从主线程处理至副线程处理,修改实时报警页面样式与字段绑定

Koishi 1 year ago
parent
commit
55e87c56fc
5 changed files with 54 additions and 22 deletions
  1. 8 2
      src/api/api.js
  2. 15 6
      src/components/alarmPopupa/index.vue
  3. 23 10
      src/pages/safe/safecomponent.vue
  4. 6 2
      src/store/index.js
  5. 2 2
      vite.config.js

+ 8 - 2
src/api/api.js

@@ -804,6 +804,12 @@ export const getReportDetail = (id) => {
 export const getAlarmConfig = () => {
     return request.get(`/alertrule/queryalarmtypellist`);
 };
-export const confirmAlart = (params) => {
-    return request.post("/alarm/history/updateAlarms", params)
+export const confirmAlart = (data) => {
+    return request({
+        method: "post",
+        url: "/alarm/history/updateAlarms",
+        data,
+        timeout: 60000
+    });
+    // return request.post("/alarm/history/updateAlarms", data)
 };

+ 15 - 6
src/components/alarmPopupa/index.vue

@@ -63,17 +63,19 @@ export default {
     getAlarmName(alarmItem) {
       let alarmName = "";
       if (alarmItem.deviceType === "booststation") {
-        alarmName += "升压站";
+        alarmName = "升压站报警";
       } else if (alarmItem.deviceType === "inverter") {
-        alarmName += "逆变器";
+        alarmName = "逆变器报警";
       } else if (alarmItem.deviceType === "windturbine") {
-        alarmName += "风机";
+        alarmName = "设备报警";
+      } else if (alarmItem.deviceType === "station") {
+        alarmName = "场站";
       }
 
       if (alarmItem.alarmType === "custom") {
-        alarmName += "自定义";
+        alarmName = "自定义报警";
       }
-      return `${alarmName}报警`;
+      return alarmName;
     },
 
     getLvName(alarmItem) {
@@ -206,7 +208,8 @@ export default {
               lvName: this.getLvName(alarmItem),
               rank: alarmItem.rank,
               class: `animate__bounceInRight lv${alarmItem.rank}`,
-              confirm: alarmItem.isClose,
+              isClose: alarmItem.isClose,
+              isCloseName: alarmItem.isClose ? "是" : "否",
               alarmType: alarmItem.alarmType,
               alarmName: this.getAlarmName(alarmItem),
               description: alarmItem.description,
@@ -215,6 +218,12 @@ export default {
               triggerType: alarmItem.triggerType,
               ts: alarmItem.ts,
               tsName: new Date(alarmItem.ts).formatDate("yyyy-MM-dd hh:mm:ss"),
+              deviceId: alarmItem.deviceId,
+              deviceType: alarmItem.deviceType,
+              faultCause: alarmItem.faultCause,
+              resolvent: alarmItem.resolvent,
+              characteristic: alarmItem.characteristic,
+              code: alarmItem.code,
             };
             this.alarmList.push(alarmOption);
             this.$store.commit("setWarning", alarmOption);

+ 23 - 10
src/pages/safe/safecomponent.vue

@@ -22,9 +22,8 @@
         show-overflow-tooltip
       />
       <el-table-column
-        prop="lv"
-        label="级别"
-        width="50"
+        prop="lvName"
+        label="报警等级"
         show-overflow-tooltip
       />
       <el-table-column
@@ -33,8 +32,8 @@
         show-overflow-tooltip
       />
       <el-table-column
-        prop="description"
-        label="报警信息"
+        prop="isCloseName"
+        label="是否解除"
         show-overflow-tooltip
       />
     </el-table>
@@ -66,9 +65,8 @@
             show-overflow-tooltip
           />
           <el-table-column
-            prop="lv"
-            label="级别"
-            width="50"
+            prop="code"
+            label="报警设备"
             show-overflow-tooltip
           />
           <el-table-column
@@ -77,8 +75,23 @@
             show-overflow-tooltip
           />
           <el-table-column
-            prop="description"
-            label="报警信息"
+            prop="characteristic"
+            label="报警特征"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            prop="isCloseName"
+            label="报警是否解除"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            prop="faultCause"
+            label="报警故障原因"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            prop="resolvent"
+            label="报警解决方法"
             show-overflow-tooltip
           />
           <el-table-column label="操作">

+ 6 - 2
src/store/index.js

@@ -67,7 +67,9 @@ export default createStore({
         // --------------------------------------------------------------------
         //实时报警
         setWarning(state, data) {
-            state.warningList.unshift(data);
+            setTimeout(() => {
+                state.warningList.unshift(data);
+            }, 0);
         },
 
         removeWarning(state, data) {
@@ -75,7 +77,9 @@ export default createStore({
                 data.forEach(ele => {
                     for (let i = 0; i < state.warningList.length; i++) {
                         if (`${ele.id}${ele.ts}` === `${data.id}${data.ts}`) {
-                            state.warningList.splice(i, 1);
+                            setTimeout(() => {
+                                state.warningList.splice(i, 1);
+                            }, 0);
                             break;
                         }
                     }

+ 2 - 2
vite.config.js

@@ -30,8 +30,8 @@ export default defineConfig({
             // 正则表达式写法
             "^/sharding": {
                 // target: 'http://wanghs.nat300.top',
-                // target: "http://10.81.3.154:6015",
-                target: "http://192.168.1.109:6015",
+                target: "http://10.81.3.154:6015",
+                // target: "http://192.168.1.109:6015",
                 changeOrigin: true, //开启代理
                 rewrite: (path) => path.replace(/^\/sharding/, ""),
             },