Browse Source

高频感知事件 接口对接

psj 6 months ago
parent
commit
f2b21f058c
1 changed files with 28 additions and 10 deletions
  1. 28 10
      src/views/IOTDataAnalysis/components/IOTLeft.vue

+ 28 - 10
src/views/IOTDataAnalysis/components/IOTLeft.vue

@@ -108,6 +108,7 @@ import {
 } from "../../../service/iotService";
 //设备类型统计数据
 const equipmentData = ref([]);
+const sbfbData = ref([]);
 const equipmentColor = ref([
   "#549bf1",
   "#67d470",
@@ -169,6 +170,7 @@ const GetListEquipment = async () => {
     if (res?.data?.code == "200") {
       const data = res?.data?.data;
       const typeObj = {};
+      sbfbData.value = data.list;
       data.list.forEach((item) => {
         if (typeObj[item.monitorScene]) {
           typeObj[item.monitorScene].num++;
@@ -207,23 +209,39 @@ const deviceDistrubuteArr = computed(() => {
       : deviceStatus.value == "unline"
       ? "unlineNum"
       : "num";
-  equipmentData.value.forEach((item) => {
-    if (
-      selectDeviceType.value.length > 0 &&
-      !selectDeviceType.value.includes(item.monitorScene)
-    ) {
-      return;
+  // equipmentData.value.forEach((item) => {
+  //   if (
+  //     selectDeviceType.value.length > 0 &&
+  //     !selectDeviceType.value.includes(item.monitorScene)
+  //   ) {
+  //     return;
+  //   }
+  //   //统计数量筛选
+  //   if (deviceDistruibute[item.district]) {
+  //     deviceDistruibute[item.district].num += item[numName];
+  //   } else {
+  //     deviceDistruibute[item.district] = {
+  //       name: item.district,
+  //       num: item[numName],
+  //     };
+  //   }
+  // });
+
+  sbfbData.value.forEach((item) => {
+    if(item.district == null){
+      item.district = "未知";
     }
     //统计数量筛选
     if (deviceDistruibute[item.district]) {
-      deviceDistruibute[item.district].num += item[numName];
+      deviceDistruibute[item.district].num += 1;
     } else {
       deviceDistruibute[item.district] = {
         name: item.district,
-        num: item[numName],
+        num: 1,
       };
     }
   });
+
   return Object.values(deviceDistruibute);
 });
 
@@ -407,7 +425,7 @@ onMounted(() => {
         .name {
           font-size: 14px;
           color: #bfd5e0;
-          width: 50px;
+          width: 60px;
         }
         .num {
           font-size: 18px;
@@ -422,7 +440,7 @@ onMounted(() => {
           color: #c6daeb;
         }
         :deep(.el-progress) {
-          width: calc(100% - 160px);
+          width: calc(100% - 170px);
           margin-left: 13px;
           .el-progress-bar__outer {
             background-color: rgba(35, 64, 95, 0.51);