From 500ddf6571e656f33ef7fe10c570f6345344c989 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 01 Feb 2024 15:47:38 +0800
Subject: [PATCH] fix:断线监控

---
 src/views/main/index.vue |  163 +++++++++++++++++++++++-------------------------------
 1 files changed, 69 insertions(+), 94 deletions(-)

diff --git a/src/views/main/index.vue b/src/views/main/index.vue
index c694ae5..d20cfed 100644
--- a/src/views/main/index.vue
+++ b/src/views/main/index.vue
@@ -144,6 +144,7 @@
 <script>
 // import Cookies from 'js-cookie'
 import '@/assets/icon/iconfont.css'
+import _ from 'lodash'
 // import $ from 'jquery'
 import Map from '@/components/Wind/Map.vue'
 import LineChart from '@/components/Echarts/LineChart'
@@ -154,27 +155,27 @@
 const lineChartData = {
   newVisitis: {
     expectedData: [100, 120, 161, 134, 105, 160, 165],
-    actualData: [120, 82, 91, 154, 162, 140, 145],
+    actualData: [120, 82, 91, 154, 162, 140, 145]
   },
   messages: {
     expectedData: [200, 192, 120, 144, 160, 130, 140],
-    actualData: [180, 160, 151, 106, 145, 150, 130],
+    actualData: [180, 160, 151, 106, 145, 150, 130]
   },
   purchases: {
     expectedData: [80, 100, 121, 104, 105, 90, 100],
-    actualData: [120, 90, 100, 138, 142, 130, 130],
+    actualData: [120, 90, 100, 138, 142, 130, 130]
   },
   shoppings: {
     expectedData: [130, 140, 141, 142, 145, 150, 160],
-    actualData: [120, 82, 91, 154, 162, 140, 130],
-  },
+    actualData: [120, 82, 91, 154, 162, 140, 130]
+  }
 }
 export default {
   components: {
     Map,
     LineChart,
     Charts,
-    ReportForm,
+    ReportForm
     // vLineChart
   },
   data() {
@@ -196,70 +197,43 @@
       jingdu: 0,
       weidu: 0,
       options: [],
-      newRegion: [],
+      newRegion: []
     }
   },
   computed: {
     changeCity() {
       return this.$store.state.regionCode
-    },
+    }
   },
   watch: {
     searchText(newVal, oldVal) {
-      // console.log(oldVal)
+      console.log(typeof (newVal))
       // console.log(newVal)
       // defaultData���������������������������
-      // this.openeds="['1','2','3']"
-      if (newVal !== oldVal) {
-        // let that = this
-        const newDefaultData = [
-          {
-            name: '',
-            devices: [],
-          },
-        ]
-        let ke = 1
-        this.defaultData.forEach((v, k, a) => {
-          for (let i = 0; i < v.devices.length; i++) {
-            // console.log(v.devices[i].name)
-            if (v.devices[i].name.match(newVal)) {
-              // console.log(v)
-              // console.log('������')
-              this.openeds.push((ke++).toString())
-              // return value.devices[i].name.match(newVal)
-              newDefaultData[k].name = this.defaultData[k].name
-              newDefaultData[k].devices.push(v.devices[i])
-              // this.$set(newDefaultData[k], 'name', this.defaultData[k].name)
-              // this.$set(newDefaultData[k], 'devices', v.devices[i])
-              // console.log(newDefaultData)
-            } else {
-              // console.log('���������')
-              // return value.name.match(newVal)
-            }
-            // console.log(newDefaultData)
-          }
-        })
-        // const newDevices = this.defaultData.filter(value => {
-        // const newDevices = this.defaultData.filter(value => {
-        //   for (let i = 0; i < value.devices.length; i++) {
-        //     console.log(value.devices[i].name)
-        //     if (value.devices[i].name.match(newVal)) {
-        //       console.log('������')
-        //       this.openeds.push((ke++).toString())
-        //       return value.devices[i].name.match(newVal)
-        //       this.newDefaultData.push(value.devices[i].name.match(newVal))
-        //     } else {
-        //       console.log('���������')
-        //       return value.name.match(newVal)
-        //     }
-        //   }
-        // })
-        // console.log(this.openeds)
-        this.defaultData = newDefaultData
-      }
+      const copyData = _.cloneDeep(this.defaultDataMiddle)
+      this.defaultData = copyData
+      this.openeds = []
+      const arr = []
+      let ke = 1
+      const jList = []
       if (newVal === '') {
-        this.defaultData = this.defaultDataMiddle
+        this.defaultData = copyData
         this.openeds = []
+        return
+      }
+      if (newVal !== oldVal) {
+        for (var i = 0; i < this.defaultData.length; i++) {
+          for (var j = 0; j < this.defaultData[i].devices.length; j++) {
+            if (this.defaultData[i].devices[j].name.indexOf(newVal.toUpperCase()) >= 0) {
+              this.openeds.push((ke++).toString())
+              jList.push(this.defaultData[i].devices[j])
+            }
+          }
+
+          console.log(arr)
+        }
+        this.defaultData = jList
+        console.log(this.defaultData)
       }
     },
     changeCity(newVal, oldVal) {
@@ -269,7 +243,7 @@
         // this.newRegion = newVal
         this.getRegionApi()
       }
-    },
+    }
   },
   beforeCreate() {
     // this.$store.state.regionCode = this.$route.params.cName
@@ -279,6 +253,7 @@
     this.getRegion()
   },
   methods: {
+
     // ���������������������������������
     bd09togcj02(bd_lon, bd_lat) {
       var x_pi = (3.14159265358979324 * 3000.0) / 180.0
@@ -303,39 +278,39 @@
     },
     // ���������������������
     deviceDetail(mac, item, items, indexs) {
-      this.$message.warning('���������������������������������������')
+      // this.$message.warning('���������������������������������������')
       // console.log('������������������������')
       // console.log(mac)
       // console.log(item)
       // console.log(items)
       // console.log(indexs)
-      // this.monitorPointInfo = item
-      // // console.log(this.monitorPointInfo)
-      // // this.$router.push({
-      // //   path: '/deviceDetail/index',
-      // //   query: {
-      // //     macName: mac
-      // //   }
-      // // })
-      // // console.log('items')
-      // // console.log(items)
+      this.monitorPointInfo = item
+      // console.log(this.monitorPointInfo)
       // this.$router.push({
-      //   name: 'deviceDetail',
-      //   params: {
-      //     monitorPointInfo: item,
-      //     device: items,
-      //     macName: mac,
-      //     indexs: indexs,
-      //     items: [items.latitude, items.longitude],
-      //   },
+      //   path: '/deviceDetail/index',
       //   query: {
-      //     monitorPointInfo: JSON.stringify(item),
-      //     device: JSON.stringify(items),
-      //     macName: mac,
-      //     indexs: indexs,
-      //     items: [items.latitude, items.longitude],
-      //   },
+      //     macName: mac
+      //   }
       // })
+      // console.log('items')
+      // console.log(items)
+      this.$router.push({
+        name: 'deviceDetail',
+        params: {
+          monitorPointInfo: item,
+          device: items,
+          macName: mac,
+          indexs: indexs,
+          items: [items.latitude, items.longitude]
+        },
+        query: {
+          monitorPointInfo: JSON.stringify(item),
+          device: JSON.stringify(items),
+          macName: mac,
+          indexs: indexs,
+          items: [items.latitude, items.longitude]
+        }
+      })
     },
     // ������regionCode������������������������������������������������
     getRegionApi() {
@@ -353,12 +328,12 @@
     getData() {
       this.monitorPointIds = []
       this.$request({
-        url: '/monitorPoint/queryMonitorPoints',
+        url: '/monitorPoint/queryMonitorPointsState',
         method: 'get',
         params: {
           organizationId: this.organizationId,
-          regionCode: this.$store.state.regionCode,
-        },
+          regionCode: this.$store.state.regionCode
+        }
       })
         .then((res) => {
           console.log(res, '123')
@@ -415,8 +390,8 @@
         url: '/organization/getMapPath',
         method: 'get',
         params: {
-          organizationId: this.$store.state.orgId,
-        },
+          organizationId: this.$store.state.orgId
+        }
       })
         .then((res) => {
           // console.log('������������getMapPath������')
@@ -426,19 +401,19 @@
           for (let i = 0; i < data.length; i++) {
             this.options.push({
               value: data[i].provinceCode,
-              label: data[i].provinceName,
+              label: data[i].provinceName
             })
             this.options[i].children = []
             for (let j = 0; j < data[i].cities.length; j++) {
               this.options[i].children.push({
                 value: data[i].cities[j].cityCode,
-                label: data[i].cities[j].cityName,
+                label: data[i].cities[j].cityName
               })
               this.options[i].children[j].children = []
               for (let k = 0; k < data[i].cities[j].areas.length; k++) {
                 this.options[i].children[j].children.push({
                   value: data[i].cities[j].areas[k].areaCode,
-                  label: data[i].cities[j].areas[k].areaName,
+                  label: data[i].cities[j].areas[k].areaName
                 })
               }
             }
@@ -449,7 +424,7 @@
           console.log(err)
         })
       // console.log('������Region������')
-    },
+    }
     // ������������������
     // getMap() {
     //   axios.get('http://47.99.64.149:8080/screen_api_v2/screen/newMap-page?areaCode=130900&accountId=223')
@@ -461,7 +436,7 @@
     //       console.log('������')
     //     })
     // }
-  },
+  }
 }
 </script>
 

--
Gitblit v1.8.0