소스 검색

告警管理封装

ming 3 년 전
부모
커밋
57a411371e
1개의 변경된 파일30개의 추가작업 그리고 41개의 파일을 삭제
  1. 30 41
      src/views/alarmManage/index.vue

+ 30 - 41
src/views/alarmManage/index.vue

@@ -53,7 +53,7 @@
             class="gradualBg total"
             :class="{ transparent: scope.row.totalNum == 0 }"
             :style="{
-              width: (scope.row.totalNum / this.totalNumMax) * 100 + '%',
+              width: (scope.row.totalNum / this.allMaxData.totalNumMax) * 100 + '%',
             }"
             @click="goAlarmTotal"
           >
@@ -67,7 +67,7 @@
             class="gradualBg"
             :class="{ transparent: scope.row.oneAlarming == 0 }"
             :style="{
-              width: (scope.row.oneAlarming / this.oneAlarmingMax) * 100 + '%',
+              width: (scope.row.oneAlarming / this.allMaxData.oneAlarmingMax) * 100 + '%',
             }"
             @click="goAlarmTotal"
           >
@@ -81,7 +81,7 @@
             class="gradualBg"
             :class="{ transparent: scope.row.twoAlarming == 0 }"
             :style="{
-              width: (scope.row.twoAlarming / this.twoAlarmingMax) * 100 + '%',
+              width: (scope.row.twoAlarming / this.allMaxData.twoAlarmingMax) * 100 + '%',
             }"
             @click="goAlarmTotal"
           >
@@ -96,7 +96,7 @@
             class="gradualBg"
             :class="{ transparent: scope.row.other == 0 }"
             :style="{
-              width: (scope.row.other / this.otherMax) * 100 + '%',
+              width: (scope.row.other / this.allMaxData.otherMax) * 100 + '%',
             }"
             @click="goAlarmTotal"
           >
@@ -214,46 +214,35 @@ export default {
     }
   },
   computed: {
-    // sellVendorOption() {
-    //   return (item) => {
-    //     return item.venderCode + ':' + item.venderName
-    //   }
-    // },
 
-    totalNumMax() {
-       return Math.max.apply(
-          Math,
-          this.tableData.map(function (o) {
-            return o.totalNum
-          })
-        )
-    },
-    oneAlarmingMax() {
-      return Math.max.apply(
-        Math,
-        this.tableData.map(function (o) {
-          return o.oneAlarming
-        })
-      )
-    },
-    twoAlarmingMax() {
-      return Math.max.apply(
-        Math,
-        this.tableData.map(function (o) {
-          return o.twoAlarming
-        })
-      )
-    },
-    otherMax() {
-      return Math.max.apply(
-        Math,
-        this.tableData.map(function (o) {
-          return o.other
-        })
-      )
-    },
+    allMaxData:function(){
+
+     var allMaxData = {};
+
+      var totalNumData = [];
+      var oneAlarmingData = [];
+      var twoAlarmingData = [];
+      var otherData = [];
+
+      this.tableData.forEach((element,index) => {
+        totalNumData[index] = element.totalNum;
+        oneAlarmingData[index] = element.oneAlarming;
+        twoAlarmingData[index] = element.twoAlarming;
+        otherData[index] = element.other;
+      });
+
+     allMaxData.totalNumMax = Math.max.apply(Math,totalNumData);
+     allMaxData.oneAlarmingMax = Math.max.apply(Math,oneAlarmingData);
+     allMaxData.twoAlarmingMax = Math.max.apply(Math,twoAlarmingData);
+     allMaxData.otherMax = Math.max.apply(Math,otherData);
+
+      return allMaxData;
+
+   },
   },
   methods: {
+
+    
     getMsgFormSon() {
       this.pageShow = !this.pageShow
     },