浏览代码

forst资源落点 es

qinhouyu 2 年之前
父节点
当前提交
2a5258a431
共有 1 个文件被更改,包括 86 次插入12 次删除
  1. 86 12
      src/views/forest.vue

+ 86 - 12
src/views/forest.vue

@@ -85,7 +85,7 @@
             <div class="i-list-con h-27" style="padding-left: 1rem;">
               <div class="d-l-con-icon">
                 <div class="icon-con" :class="{on:iconCurrentIndex==item.type}"
-                  v-for="(item,index) in resourcesList" v-on:click="indentleftSetMarkers(item.type, item.searchName)">
+                  v-for="(item,index) in resourcesList" v-on:click="fireControlViewPoint(item.type, '','search')">
                   <!--v-on:click="indentleftSetMarkers(item.resourceTable)">-->
                   <div class="iconfont icon icon-normal" :class="item.icon"></div>
                   <div class="icon-text">
@@ -482,6 +482,8 @@
   import chart from "./from/dvCapsuleChart.vue";
   import {
     getResource,
+    fireControlViewList,
+    fireControlViewPoint,
     getResourcePoint
   } from '@/api/datacenter'
 
@@ -493,6 +495,7 @@
   import Firespread from "./firespread";
 
   /** ----------------------------------摄像头预览结束------------------------------------- */
+  import { getIconBg } from "@/api/components/sookaMapIcon";
 
   import {
     selectConfigKey
@@ -676,18 +679,89 @@
         });
       },
       getResource() {
-        let that = this
-        //获取左侧菜单列表
-        getResource().then(res => {
-          that.resourcesList = res.data
-          console.log("数据中心", that.resourcesList)
+        let that = this;
+        fireControlViewList("ziyuan").then(function (res) {
+          for (let i = 0; i < res.data.length; i++) {
+            if(res.data[i].type !='centerdata_t_forest_fireteam'){
+              that.resourcesList.push(res.data[i]);
+            }
+          }
           //截取data.resourceTable字段中“_”分隔符最后一个作为关键字,重新拼接成前端需要的图标:class,格式sj-icon-xxxx,将其set回原数组
-          res.data.forEach(function(data, index) {
-            let icon = 'sj' + '-' + 'icon' + '-' + data.type.replaceAll("_", "-").replaceAll("@", "-");
+          that.resourcesList.forEach(function (data, index) {
+            let icon =
+              "sj" +
+              "-" +
+              "icon" +
+              "-" +
+              data.type.replaceAll("_", "-").replaceAll("@", "-");
             console.log("icon_" + (index + 1) + "=", icon);
-            that.$set(that.resourcesList[index], 'icon', icon);
-          })
-        })
+            that.$set(that.resourcesList[index], "icon", icon);
+            //每个图标对应固定颜色
+            that.$set(that.resourcesList[index], "bg", getIconBg(icon));
+          });
+          that.fireControlViewPoint("ziyuan", "");
+        });
+      },
+      fireControlViewPoint(resourceTable, name, search) {
+        if(resourceTable == this.resourceTable && search != "search"){
+          resourceTable = "ziyuan"
+        }
+        this.iconCurrentIndex = resourceTable;
+        // 搜索框
+        if (name == "" || name == null || name == undefined) {
+          name = "";
+        } else {
+          this.showSearch = true;
+        }
+        console.log("name=", name);
+        console.log("this.showSearch=", this.showSearch);
+
+        let that = this;
+        that.resourceTable = resourceTable;
+        that.markersList = [];
+        that.source = [];
+        fireControlViewPoint(resourceTable, name,"").then((res) => {
+          let pointList = res.data.pointList;
+          that.deptGroupList = res.data.deptList;
+          if (res.data.deptList != null && res.data.deptList.length > 0) {
+            for (let i = 0; i < res.data.deptList.length; i++) {
+              let aa = [
+                res.data.deptList[i].deptName,
+                res.data.deptList[i].count,
+              ];
+              that.source.push(aa);
+            }
+          }
+
+          if (res.data.pointList != null && res.data.pointList.length > 0) {
+            for (let i = 0; i < res.data.pointList.length; i++) {
+              if(res.data.pointList[i].indexName != 'centerdata_t_forest_fireteam'){
+                let markersMap = {
+                  lng: res.data.pointList[i].longitude,
+                  lat: res.data.pointList[i].latitude,
+                  icon: "marker",
+                  bindPopupHtml: "",
+                  click: "",
+                  name: i,
+                  keepBindPopup: false,
+                  isAggregation: false,
+                };
+                that.markersList.push(
+                  this.getMarkersMap(
+                    resourceTable == "ziyuan" ? res.data.pointList[i].indexName:resourceTable,
+                    markersMap,
+                    res.data.pointList[i]
+                  )
+                );
+              }
+            }
+          }
+          if (this.showSearch == true) {
+            this.dataChat();
+          }
+          that.$refs.supermap.clearM(false);
+          that.$refs.supermap.setMarkers(that.markersList);
+        });
       },
       indentleftSetMarkers(resourceTable, name) {
         let that = this
@@ -1450,7 +1524,7 @@
                 }
               }
               for (let i = 0; i < types.length; i++) {
-                that.indentleftSetMarkers(types[i], '所有');
+                that.fireControlViewPoint(types[i], '','search');
               }
               //数据自动落点结束
             }, 2000)