From 8d837b97ffb27e4e26f067c1febde353bfdf91cf Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 23 Apr 2021 09:16:27 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jfpt-Vue

---
 src/views/supervisoryConsole/data.vue |  217 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 142 insertions(+), 75 deletions(-)

diff --git a/src/views/supervisoryConsole/data.vue b/src/views/supervisoryConsole/data.vue
index 1051a0e..593130d 100644
--- a/src/views/supervisoryConsole/data.vue
+++ b/src/views/supervisoryConsole/data.vue
@@ -22,49 +22,41 @@
             <div class="info-active-top">
               <div class="active-list">
                 <div>
-                  <span
-                    ng-click="menuToDetail(0)"
-                    class="dashboard_alarm ng-binding"
-                    >预警</span
-                  >
+                  <span @click.stop="StartEquipment({dxtype:2})" class="dashboard_alarm ng-binding">预警</span>
                 </div>
-                <div><span class="ng-binding">3</span></div>
-                <div class="ng-binding">占比&nbsp;1.8%</div>
+                <div>
+                  <span class="ng-binding">{{ yj }}</span>
+                </div>
+                <div class="ng-binding">占比&nbsp;{{ yjper }}</div>
               </div>
               <div class="active-list">
                 <div>
-                  <span
-                    ng-click="menuToDetail(4)"
-                    class="dashboard_malfunction ng-binding"
-                    >故障</span
-                  >
+                  <span @click.stop="StartEquipment({dxtype:3})" class="dashboard_malfunction ng-binding">故障</span>
                 </div>
-                <div><span class="ng-binding">25</span></div>
-                <div class="ng-binding">占比&nbsp;15%</div>
+                <div>
+                  <span class="ng-binding">{{ gz }}</span>
+                </div>
+                <div class="ng-binding">占比&nbsp;{{ gzper }}</div>
               </div>
             </div>
             <div class="info-active-bottom">
               <div class="active-list">
                 <div>
-                  <span
-                    ng-click="menuToDetail(1)"
-                    class="dashboard_normal ng-binding"
-                    >正常</span
-                  >
+                  <span @click.stop="StartEquipment({dxtype:1})" class="dashboard_normal ng-binding">正常</span>
                 </div>
-                <div><span class="ng-binding">125</span></div>
-                <div class="ng-binding">占比&nbsp;75%</div>
+                <div>
+                  <span class="ng-binding">{{ zx }}</span>
+                </div>
+                <div class="ng-binding">占比&nbsp;{{ zxper }}</div>
               </div>
               <div class="active-list">
                 <div>
-                  <span
-                    ng-click="menuToDetail(3)"
-                    class="dashboard_inactive ng-binding"
-                    >掉线</span
-                  >
+                  <span @click.stop="StartEquipment({dxtype:0})" class="dashboard_inactive ng-binding">掉线</span>
                 </div>
-                <div><span class="ng-binding">15</span></div>
-                <div class="ng-binding">占比&nbsp;10%</div>
+                <div>
+                  <span class="ng-binding">{{ dx }}</span>
+                </div>
+                <div class="ng-binding">占比&nbsp;{{ dxper }}</div>
               </div>
             </div>
           </div>
@@ -87,7 +79,7 @@
             :data="tableData"
             stripe
             style="width: 100%; margin: 10px"
-            max-height="352px"
+            max-height="380px"
             :resizable="false"
           >
             <el-table-column prop="waringType" label="警情类型" width="100">
@@ -116,7 +108,7 @@
           </div>
           <div class="head-right">
             <div class="head-right offset-right">
-              <a href="/#/realTimePolice/index">预警分析</a>
+              <a href="/#/alarmManagement/alarmAnalysis">预警分析</a>
             </div>
           </div>
         </div>
@@ -124,10 +116,10 @@
           <div class="alarm-bar">
             <div class="alarm-bar-title">
               <div class="title-left ng-binding">日累计预警事件数</div>
-              <div class="title-right week">
-                <span class="ng-binding">0</span
-                ><span class="ng-binding">1.00</span>
-              </div>
+<!--              <div class="title-right week">-->
+<!--                <span class="ng-binding">0</span-->
+<!--                ><span class="ng-binding">1.00</span>-->
+<!--              </div>-->
             </div>
             <div class="week-alarm-bar" id="day_warn_echarts"></div>
           </div>
@@ -137,10 +129,10 @@
               <div class="title-left change-flex-alarm ng-binding">
                 日累计预警设备数
               </div>
-              <div class="title-right week">
-                <span class="ng-binding">0</span
-                ><span class="ng-binding">1.00</span>
-              </div>
+<!--              <div class="title-right week">-->
+<!--                <span class="ng-binding">0</span-->
+<!--                ><span class="ng-binding">1.00</span>-->
+<!--              </div>-->
             </div>
             <div class="week-device-line" id="day_equipment_echarts"></div>
           </div>
@@ -155,29 +147,44 @@
   getList,
   getEquipmentList,
   getDayWarnList,
+  getEquipment,
 } from "@/api/supervisory/data";
 
 export default {
   data() {
     return {
       tableData: [],
+      dx: null,
+      zx: null,
+      gz: null,
+      yj: null,
+      dxper: null,
+      zxper: null,
+      gzper: null,
+      yjper: null,
     };
   },
   created() {
     var that = this;
     getList().then((res) => {
       res.data.data.forEach((item) => {
-        that.tableData.push({
-          waringType:
-            item.waringType == "紧急求救" ? "一键求助" : item.waringType,
-          alarmTime: item.alarmTime,
-          oneContacts: item.oneContacts,
-          onePhone: item.onePhone,
-          galarmPeople: item.galarmPeople,
-          jtype:
-            item.jtype == 0 ? "未处理" : item.jtype == 1 ? "处理中" : "已处理",
-          alarmPeople: item.alarmPeople,
-        });
+        if (item.waringType == "紧急求救") {
+          that.tableData.push({
+            waringType:
+              item.waringType == "紧急求救" ? "一键求助" : item.waringType,
+            alarmTime: item.alarmTime,
+            oneContacts: item.oneContacts,
+            onePhone: item.onePhone,
+            galarmPeople: item.galarmPeople,
+            jtype:
+              item.jtype == 0
+                ? "未处理"
+                : item.jtype == 1
+                ? "处理中"
+                : "已处理",
+            alarmPeople: item.alarmPeople,
+          });
+        }
       });
     });
 
@@ -186,36 +193,58 @@
     });
 
     getDayWarnList().then((res) => {
-      that.drawPillar(res.data.data[0]);
+      that.drawPillar(res.data.data);
+    });
+
+    getEquipment().then((res) => {
+      console.log(res.data.data, 123);
+
+      var total = 0;
+
+      total += res.data.data.zx;
+      total += res.data.data.dx;
+      total += res.data.data.gz;
+
+      console.log(total, 45);
+
+      that.dx = res.data.data.dx;
+      that.zx = res.data.data.zx;
+      that.gz = res.data.data.gz;
+      that.yj = res.data.data.yj;
+      that.dxper = ((res.data.data.dx / total) * 100).toFixed(2) + "%";
+      that.zxper = ((res.data.data.zx / total) * 100).toFixed(2) + "%";
+      that.gzper = ((res.data.data.gz / total) * 100).toFixed(2) + "%";
+      that.yjper = ((res.data.data.yj / total) * 100).toFixed(2) + "%";
+
+      that.drawPie();
     });
   },
-  mounted() {
-    this.drawPie();
-  },
+  mounted() {},
   methods: {
     drawPie() {
+      var that = this;
       var myChart = this.$echarts.init(
         document.getElementById("base_information_pie_echarts")
       );
 
       var m2R2Data = [
         {
-          value: 125,
+          value: that.zx,
           legendname: "正常",
           name: "正常",
           itemStyle: { color: "#29c194" },
         },
         {
-          value: 25,
+          value: that.gz,
           legendname: "故障",
           name: "故障",
           itemStyle: { color: "#b6b6b6" },
         },
         {
-          value: 15,
+          value: that.dx,
           legendname: "掉线",
           name: "掉线",
-          itemStyle: { color: "#6d5eac" },
+          itemStyle: { color: "#F48F57" },
         },
       ];
 
@@ -248,8 +277,6 @@
           trigger: "item",
           formatter: function (parms) {
             var str =
-              parms.seriesName +
-              "</br>" +
               parms.marker +
               "" +
               parms.data.legendname +
@@ -265,7 +292,6 @@
         },
         series: [
           {
-            name: "标题",
             type: "pie",
             center: ["50%", "50%"],
             radius: ["66%", "86%"],
@@ -286,6 +312,19 @@
         ],
       };
       myChart.setOption(option);
+      myChart.on('click', function (params) {
+        if (params.name == "正常"){
+          //跳转在线设备
+          that.StartEquipment({dxtype:1});
+        }else if(params.name == "掉线"){
+          //跳转离线设备
+          that.StartEquipment({dxtype:0});
+        }else if(params.name == "故障"){
+          //跳转故障设备
+          that.StartEquipment({dxtype:3});
+        }
+
+      });
     },
 
     drawLine(result) {
@@ -370,6 +409,7 @@
     },
 
     drawPillar(data) {
+      var that = this;
       var myChart = this.$echarts.init(
         document.getElementById("day_warn_echarts")
       );
@@ -377,15 +417,14 @@
       var xData = [];
       var yData = [];
 
-      data.lists.forEach((item) => {
-        xData.push(item.time.substr(5));
-        var sum = 0;
+      data.times.forEach((item) => {
+        xData.push(item.substr(5));
+      });
 
-        Object.values(item).forEach((it) => {
-          !isNaN(Number(it)) == true ? (sum += it) : "";
-        });
-
-        yData.push(sum);
+      data.dataList.forEach((item) => {
+        if (item.name == "一键求助") {
+          yData = item.alarmData;
+        }
       });
 
       var option = {
@@ -445,8 +484,36 @@
         ],
       };
       myChart.setOption(option);
+      myChart.on('click', function (params) {
+        var data = [];
+        var date=new Date;
+        var y = date.getFullYear()
+        data.push({
+          startTime: y + "-" + params.name+" 00:00:00",
+          endTime:y + "-" + params.name+" 23:59:59",
+          waringType:'紧急求救',
+        })
+        that.handleStartAlarm(data);
+      });
+
+
+    },
+    //在线设备分页数据
+    StartEquipment(data) {
+      this.$router.push({
+        path: `/clientManagement/index`,
+        query: data,
+      });
+    },
+    //日累计预警数量跳转
+    handleStartAlarm(data) {
+      this.$router.push({
+        path: `/realTimePolice/index`,
+        query: data[0],
+      });
     },
   },
+
 };
 </script>
 
@@ -456,7 +523,7 @@
   flex-direction: column;
   justify-content: space-between;
   margin-bottom: 0px !important;
-  height: 96% !important;
+  height: 100% !important;
   font-size: 14px;
   &:nth-child(2) {
     padding-left: 10px;
@@ -512,7 +579,7 @@
             background-color: #29c093;
           }
           &:nth-child(3)::before {
-            background-color: #6d5eac;
+            background-color: #f48f57;
           }
           &:nth-child(4)::before {
             background-color: #dfdfdf;
@@ -573,20 +640,20 @@
             color: #29c194;
           }
           .active-list:nth-child(2) > div:nth-child(1) span {
-            border: 1px solid #6d5eac;
-            color: #6d5eac;
+            border: 1px solid #f48f57;
+            color: #f48f57;
           }
           .active-list:nth-child(1) > div:nth-child(1) span:hover {
             background: rgba(41, 192, 147, 0.15);
           }
           .active-list:nth-child(2) > div:nth-child(1) span:hover {
-            background: #e9e7f3;
+            background: #f3ab8448;
           }
           .active-list:nth-child(1) > div:nth-child(2) span {
             color: #29c194;
           }
           .active-list:nth-child(2) > div:nth-child(2) span {
-            color: #6d5eac;
+            color: #f48f57;
           }
         }
         .info-active-top,
@@ -708,4 +775,4 @@
     border-bottom: 0px !important;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3