From f752f50a484f63fc3786ab1c7ad563f3b17cce77 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 15 Nov 2024 15:58:32 +0800
Subject: [PATCH] fix: 国控站

---
 src/views/main/index.vue |   73 +++++++++++++++++++++---------------
 1 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/src/views/main/index.vue b/src/views/main/index.vue
index e8bcd35..9b477bd 100644
--- a/src/views/main/index.vue
+++ b/src/views/main/index.vue
@@ -1,8 +1,11 @@
 <template>
-  <div class="dashboard-container" style="height: 100%">
+  <div
+    class="dashboard-container"
+    style="height: 100%"
+  >
     <el-container style="height: 100%; border: 1px solid #eee">
       <el-aside
-        v-if="this.$store.state.aside"
+        v-if="$store.state.aside"
         width="260px"
         style="background-color: rgb(238, 241, 246)"
       >
@@ -42,7 +45,10 @@
             prefix-icon="el-icon-search"
           />
         </div>
-        <el-menu :default-openeds="openeds" class="elwidth">
+        <el-menu
+          :default-openeds="openeds"
+          class="elwidth"
+        >
           <el-submenu
             v-for="(item, index) in defaultData"
             :key="index"
@@ -70,7 +76,7 @@
                   'circle-3': item.state == 3,
                   'circle-4': item.state == 4,
                   'circle-5': item.state == 5,
-                  'circle-6': item.state == 6,
+                  'circle-6': item.state >= 6,
                 }"
               />
 
@@ -100,7 +106,7 @@
                   'circle-3': items.state == 3,
                   'circle-4': items.state == 4,
                   'circle-5': items.state == 5,
-                  'circle-6': items.state == 6,
+                  'circle-6': items.state >= 6,
                 }"
               />
               <span>{{ items.name }}</span>
@@ -122,7 +128,7 @@
       <el-container>
         <!-- <Map :mpid="monitorPointId" :rc="regionCode" /> -->
         <compoment
-          :is="this.$store.state.type"
+          :is="$store.state.type"
           v-if="weidu && jingdu"
           ref="child"
           :weidu="weidu"
@@ -144,6 +150,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'
@@ -177,7 +184,7 @@
     ReportForm
     // vLineChart
   },
-  data() {
+  data () {
     return {
       openeds: [],
       searchText: '',
@@ -200,38 +207,42 @@
     }
   },
   computed: {
-    changeCity() {
+    changeCity () {
       return this.$store.state.regionCode
     }
   },
   watch: {
-    searchText(newVal, oldVal) {
-      // console.log(oldVal)
+    searchText (newVal, oldVal) {
+      console.log(typeof (newVal))
       // console.log(newVal)
       // defaultData���������������������������
+      const copyData = _.cloneDeep(this.defaultDataMiddle)
+      this.defaultData = copyData
       this.openeds = []
+      const arr = []
       let ke = 1
+      const jList = []
+      if (newVal === '') {
+        this.defaultData = copyData
+        this.openeds = []
+        return
+      }
       if (newVal !== oldVal) {
-        var arr = []
         for (var i = 0; i < this.defaultData.length; i++) {
-          this.openeds.push((ke++).toString())
           for (var j = 0; j < this.defaultData[i].devices.length; j++) {
-            if (this.defaultData[i].devices[j].name.indexOf(newVal) >= 0) {
-              let a = []
-              a = this.defaultData[i]
-              a.devices = [this.defaultData[i].devices[j]]
-              arr.push(a)
+            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 = arr
-      }
-      if (newVal === '') {
-        this.defaultData = this.defaultDataMiddle
-        this.openeds = []
+        this.defaultData = jList
+        console.log(this.defaultData)
       }
     },
-    changeCity(newVal, oldVal) {
+    changeCity (newVal, oldVal) {
       // console.log(newVal)
       if (newVal !== oldVal) {
         // this.$store.state.regionCode = newVal
@@ -240,17 +251,17 @@
       }
     }
   },
-  beforeCreate() {
+  beforeCreate () {
     // this.$store.state.regionCode = this.$route.params.cName
   },
-  created() {
+  created () {
     this.getData()
     this.getRegion()
   },
   methods: {
 
     // ���������������������������������
-    bd09togcj02(bd_lon, bd_lat) {
+    bd09togcj02 (bd_lon, bd_lat) {
       var x_pi = (3.14159265358979324 * 3000.0) / 180.0
       var x = bd_lon - 0.0065
       var y = bd_lat - 0.006
@@ -261,7 +272,7 @@
       return [gg_lat, gg_lng]
     },
     // ������������������������������������������������������
-    jump(items) {
+    jump (items) {
       console.log(items)
       this.jumpData = []
       // const newLL = this.bd09togcj02(items.longitude, items.latitude)
@@ -272,7 +283,7 @@
       this.$refs.child.jumpMap(this.jumpData)
     },
     // ���������������������
-    deviceDetail(mac, item, items, indexs) {
+    deviceDetail (mac, item, items, indexs) {
       // this.$message.warning('���������������������������������������')
       // console.log('������������������������')
       // console.log(mac)
@@ -308,7 +319,7 @@
       })
     },
     // ������regionCode������������������������������������������������
-    getRegionApi() {
+    getRegionApi () {
       // console.log('������getRegionApi')
       // console.log(this.newRegion[this.newRegion.length - 1])
       this.$store.state.regionCode = this.newRegion[this.newRegion.length - 1]
@@ -320,7 +331,7 @@
       console.log(this.jingdu, '������')
     },
     // ������������������������
-    getData() {
+    getData () {
       this.monitorPointIds = []
       this.$request({
         url: '/monitorPoint/queryMonitorPointsState',
@@ -380,7 +391,7 @@
           this.defaultData = []
         })
     },
-    getRegion() {
+    getRegion () {
       this.$request({
         url: '/organization/getMapPath',
         method: 'get',

--
Gitblit v1.8.0