From 14e02654e0545ee69456d64aef2f35c7c219d708 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 07 May 2021 11:26:49 +0800
Subject: [PATCH] 地图模式设备状态修改

---
 public/map/widgets/supervisoryMap/SupervisoryMap.js |  452 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 309 insertions(+), 143 deletions(-)

diff --git a/public/map/widgets/supervisoryMap/SupervisoryMap.js b/public/map/widgets/supervisoryMap/SupervisoryMap.js
index 32cbbc6..8d81a33 100644
--- a/public/map/widgets/supervisoryMap/SupervisoryMap.js
+++ b/public/map/widgets/supervisoryMap/SupervisoryMap.js
@@ -160,10 +160,16 @@
     onceTime: 300,
     // 警情缓存
     Pdata: null,
+    // 警情图标缓存
+    Pdatas: null,
     //业主缓存
     Ydata: null,
+    // 业主图标缓存
+    Ydatas: null,
     //设备缓存
     Sdata: null,
+    // 设备图标缓存
+    Sdatas: null,
 
     constructor: function (options, srcRefNode) {
       this._map = options.map;
@@ -205,6 +211,7 @@
         dataType: 'JSON',
         success: function (res) {
           var datas = res.data;
+          // console.log(datas)
           var heatmapRenderer = null;
           that.entityData = [];
           for (var i = 0; i < datas.length; i++) {
@@ -216,6 +223,7 @@
             })
           }
           that.flareClusterLayer(datas);
+          // console.log(datas)
           that.heatmapfeatureLayer = that.heatmFeaLayers();
           that._map.addLayer(that.heatmapfeatureLayer);
           // that.checkBoxSelect();//左侧控制热力图重复
@@ -232,9 +240,9 @@
         $('.analysis-and-judgment-tab li:eq(0)').addClass('on').siblings().removeClass('on');
         $($('.analysis-container > div')[0]).stop().show().siblings().stop().hide();
 
-        that.heatmapfeatureLayer_1 = that.heatmFeaLayers();
+        that.heatmapfeatureLayer = that.heatmFeaLayers();
 
-        that._map.addLayer(that.heatmapfeatureLayer_1);
+        that._map.addLayer(that.heatmapfeatureLayer);
         $('#analysis_select_time_start').val(time.tomorrow);
         $('#analysis_select_time_end').val(time.current);
 
@@ -256,7 +264,7 @@
           });
         });
         that.getArea($('#policeArea'));
-        that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), time.tomorrow, time.current, '', '');
+        // that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), time.tomorrow, time.current, '', '');
         that.clickHand();
 
       }
@@ -267,23 +275,45 @@
       objThis._map.addLayer(objThis._siteLayer);
       var that = this;
       // console.log(mySelf.clusterLayer)
-      that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), '');
+      that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), '', 'once');
       // 顶部tab得切换事件
       $('.analysis-and-judgment-tab li').click(function () {
         // if (that.tabIndex == $(this).index()) return;
         // if ($(this).index() == 1) { return };
         // if ($(this).index() == 2) { return };
 
+        //解决打开热力图 切换top获取不了数据问题 警情
+        if ($('#policeHeatMap').prop('checked') == true) {
+          // console.log($('#policeHeatMap').prop('checked') == true)
+          $('#policeHeatMap').prop('checked', false);
+          that.checkBoxSelect($('#policeHeatMap'));
+        } else
+          //解决打开热力图 切换top获取不了数据问题 业主
+          if ($('#ownerHeatMap').prop('checked') == true) {
+            // console.log($('#ownerHeatMap').prop('checked') == true)
+            $('#ownerHeatMap').prop('checked', false);
+            that.checkBoxSelect($('#ownerHeatMap'));
+          } else
+            //解决打开热力图 切换top获取不了数据问题 设备
+            if ($('#equipmentHeatMap').prop('checked') == true) {
+              // console.log($('#equipmentHeatMap').prop('checked') == true)
+              $('#equipmentHeatMap').prop('checked', false);
+              that.checkBoxSelect($('#equipmentHeatMap'));
+            }
+
+
+        // console.log($('#policeHeatMap').prop('checked') == true)
         if (that.entitysData.length > 0) {
           that.analysisAddEntitys.clear();
           that.entitysData = [];
         }
 
-        if (that.heatmapfeatureLayer_1.graphics.length > 0) {
-          that.heatmapfeatureLayer_1.clear();
-          that.heatmapfeatureLayer_1.setRenderer();
+        if (that.heatmapfeatureLayer.graphics.length > 0) {
+          that.heatmapfeatureLayer.clear();
+          that.heatmapfeatureLayer.setRenderer();
           $('.analysis-category input').prop('checked', false);
         }
+
 
 
         $(this).addClass('on').siblings().removeClass('on');
@@ -356,6 +386,10 @@
 
       // 警情列表中的点击事件
       $('.analysis-container-police .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function (event) {
+        if ($('#policeHeatMap').prop('checked') == true) {// 点击关闭热力图
+          // console.log('relitu')
+          $('#policeHeatMap').click();
+        } 
         var id = $(this).attr('term-list');
         var b = mySelf.Pdata;
         for (var key in b) {
@@ -364,7 +398,7 @@
             break;
           }
         }
-        console.log(b, id);
+        // console.log(b, id);
         event.stopPropagation();
         var winSize = [+window.innerHeight / 2 - 242 + 'px', +window.innerWidth - 380 + 'px'];
 
@@ -374,8 +408,10 @@
         } else {
           // console.log('有地图经纬度')
           b.haveJW = '有地图经纬度';
-          var lgtd = Number($(this).find('input').attr('lgtd'));
-          var lttd = Number($(this).find('input').attr('lttd'));
+          // var lgtd = Number($(this).find('input').attr('lgtd'));
+          // var lttd = Number($(this).find('input').attr('lttd'));
+          var lgtd = Number(b.jd);
+          var lttd = Number(b.wd);
           // console.log($(this).find('input').attr('lttd'));
           var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
           that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
@@ -392,7 +428,7 @@
               extend: 'myskin/FlareClusterLayer.css'
             });
             that.layuiLayer.close(that.layuiLayer.index);
-            that.layuiLayer.open({ 
+            that.layuiLayer.open({
               title: '',
               type: 2,
               shadeClose: true,
@@ -439,6 +475,10 @@
 
       // 业主列表中的点击事件
       $('.analysis-container-owner .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function (event) {
+        if ($('#ownerHeatMap').prop('checked') == true) {// 点击关闭热力图
+          // console.log('relitu')
+          $('#ownerHeatMap').click();
+        } 
         var id = $(this).attr('term-list');
         var b = mySelf.Ydata;
         for (var key in b) {
@@ -447,10 +487,36 @@
             break;
           }
         }
-        console.log(b, id);
+
+        event.stopPropagation();
+        if (b.jd == '' || b.wd == '') {
+          // console.log('无地图经纬度');
+          b.haveJW = '无地图经纬度';
+        } else {
+          // console.log('有地图经纬度')
+          b.haveJW = '有地图经纬度';
+          var lgtd = Number(b.jd);
+          var lttd = Number(b.wd);
+          // console.log($(this).find('input').attr('lttd'));
+          var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
+          that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
+        }
+
+
+
+        // console.log(b, id);
         var winSize = [+window.innerHeight / 2 - 242 + 'px', +window.innerWidth - 380 + 'px'];
         var as = b;
-        var setdata = JSON.stringify(as);
+        var bs = {};
+        for (let key in as) {
+          if (typeof as[key] != 'object') {
+            bs[key] = as[key]
+            // as = as[key].attributes;
+            // console.log('youduixang ')
+            // break;
+          }
+        }
+        var setdata = JSON.stringify(bs);
         // console.log(setdata,'setdata')
         var intOpen = () => {
           layui.use('layer', function () {
@@ -459,7 +525,7 @@
               extend: 'myskin/FlareClusterLayer.css'
             });
             that.layuiLayer.close(that.layuiLayer.index);
-            that.layuiLayer.open({ 
+            that.layuiLayer.open({
               title: '',
               type: 2,
               shadeClose: true,
@@ -492,75 +558,7 @@
           }, mySelf.onceTime);
         } else {
         };
-        // var url = './popup/html/owner-details.html?id=' + id;
-        // layui.use('layer', function () {
-        //   that.layuiLayer = layui.layer;
-        //   that.layuiLayer.config({
-        //     extend: 'myskin/owner-details.css'
-        //   });
-        //   that.layuiLayer.close(that.layuiLayer.index);
-        //   that.layuiLayer.open({
-        //     title: '业主详情',
-        //     type: 2,
-        //     shadeClose: true,
-        //     shade: false,
-        //     maxmin: false, //开启最大化最小化按钮
-        //     area: ['500px', '340px'],
-        //     offset: 'auto',
-        //     skin: 'owner-details',
-        //     content: url,
-        //     closeBtn: 1,
-        //   });
-        // })
 
-        event.stopPropagation();
-        if (b.jd == '' || b.wd == '') {
-          // console.log('无地图经纬度');
-          b.haveJW = '无地图经纬度';
-        } else {
-          // console.log('有地图经纬度')
-          b.haveJW = '有地图经纬度';
-          var lgtd = Number($(this).find('input').attr('lgtd'));
-          var lttd = Number($(this).find('input').attr('lttd'));
-          // console.log($(this).find('input').attr('lttd'));
-          var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
-          that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
-        }
-
-        // var y = +window.innerHeight / 2 + 200;
-        // var x = (+window.innerWidth - 360) / 2 + 360 + 70;
-        // // document.elementFromPoint(x, y).click();
-        // // console.log(x, y)
-
-        // // var a = document.elementFromPoint(21, 122);
-        // // console.log(a);
-
-        // // console.log(that.clusterLayer, that._map, 6)
-        // // console.log(id, 'id');
-        // // console.log(that.clusterLayer);
-        // var Tattributes = null
-        //   , ds = that.clusterLayer.allData;
-        // for (var key in ds) {
-        //   if (ds[key].id == id) {
-        //     Tattributes = ds[key];
-        //   }
-        // }
-        // if (mySelf.onceTimeMethod == null) {//防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗
-        //   var evtdata = {};
-        //   evtdata = {
-        //     graphic: {
-        //       attributes: Tattributes,
-        //     },
-        //     screenX: x,
-        //     screenY: y,
-        //   }
-        //   // console.log(that.clusterLayer,5555555555555);
-        //   that.clusterLayer._clickOpenOnclick(evtdata, '控制端', that.clusterLayer.indexs);
-        //   mySelf.onceTimeMethod = setTimeout(() => {
-        //     mySelf.onceTimeMethod = null;
-        //   }, mySelf.onceTime);
-        // } else {
-        // };
       })
       $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function (event) {
         event.stopPropagation();
@@ -576,30 +574,10 @@
       // 设备列表中的点击事件
       $('.analysis-container-equipment .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function (event) {
         var id = $(this).attr('term-listid');
-        // console.log(mySelf.Sdata);
-        //   // var url = './popup/html/equipment-details.html?obj=' + id;//设备每一项钟打开警情窗口
-        //   // layui.use('layer', function () {
-        //   //   that.layuiLayer = layui.layer;
-        //   //   that.layuiLayer.config({
-        //   //     extend: 'myskin/equipment-details.css'
-        //   //   });
-        //   //   that.layuiLayer.close(that.layuiLayer.index);
-        //   //   that.layuiLayer.open({
-        //   //     title: '警情详情',
-        //   //     type: 2,
-        //   //     shadeClose: true,
-        //   //     shade: false,
-        //   //     maxmin: false, //开启最大化最小化按钮
-        //   //     area: ['520px', '320px'],
-        //   //     offset: 'auto',
-        //   //     skin: 'equipment-details',
-        //   //     content: url,
-        //   //     closeBtn: 1,
-        //   //   });
-        //   // })
-
-
-
+        if ($('#equipmentHeatMap').prop('checked') == true) {// 点击关闭热力图
+          // console.log('relitu')
+          $('#equipmentHeatMap').click();
+        } 
 
         event.stopPropagation();
         var lgtd = Number($(this).find('input').attr('lgtd'));
@@ -765,8 +743,35 @@
       $('.analysis-container > div .select-list').off('click', 'li').on('click', 'li', function (event) {
         // console.log(event.currentTarget.innerHTML,'innerhtml')
         var text = $(this).text().trim();
-        // console.log(text,'text()')
+        // console.log(this,text,'text()')
         // console.log(that.tabIndex,'tabIndex')
+
+
+        //解决打开热力图 切换top获取不了数据问题 警情
+        if ($('#policeHeatMap').prop('checked') == true) {
+          // console.log($('#policeHeatMap').prop('checked') == true)
+          $('#policeHeatMap').prop('checked', false);
+          that.checkBoxSelect($('#policeHeatMap'));
+        } else
+          //解决打开热力图 切换top获取不了数据问题 业主
+          if ($('#ownerHeatMap').prop('checked') == true) {
+            // console.log($('#ownerHeatMap').prop('checked') == true)
+            $('#ownerHeatMap').prop('checked', false);
+            that.checkBoxSelect($('#ownerHeatMap'));
+          } else
+            //解决打开热力图 切换top获取不了数据问题 设备
+            if ($('#equipmentHeatMap').prop('checked') == true) {
+              // console.log($('#equipmentHeatMap').prop('checked') == true)
+              $('#equipmentHeatMap').prop('checked', false);
+              that.checkBoxSelect($('#equipmentHeatMap'));
+              var time = setTimeout(() => {
+                // $('#equipmentHeatMap').click(function () {
+                //   that.checkBoxSelect('#equipmentHeatMap');
+                // })();
+                $('#equipmentHeatMap').click();
+              }, 500);
+            }
+
 
         $(this).parent().parent().prev().html(text + '<i></i>');
         $(this).parent().parent().stop().slideUp(0);
@@ -791,17 +796,7 @@
 
 
         } else if (that.tabIndex == 2) {
-          var categoryText = $('#ownerCategory > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerCategory > div:eq(0)').attr('ownerid');
-          var levelText = $('#ownerLevel > div:eq(0)').text().trim() == '全部' ? '' : $('#ownerLevel > div:eq(0)').text().trim();
-
-          var parentId = $(this).parent().parent().parent().attr('id');
-          if (parentId == 'ownerCategory') {
-            that.getOwnerDj($('#ownerLevel'), categoryText);
-            that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), categoryText, '');
-          } else {
-            that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), categoryText, levelText);
-          }
-
+          that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), text == '全部' ? '' : text);
         } else if (that.tabIndex == 0) {
           that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), text == '全部' ? '' : text);
         }
@@ -844,6 +839,7 @@
           var oldData = data.data.records
           var result = oldData;
           that.Pdata = oldData;
+          // console.log(that.Pdata);//警情筛选
           var str = '';
           that.entitysData = [];
           that.analysisAddEntitys.clear();
@@ -853,11 +849,14 @@
               result[i].waringType = "一键求助"
             }
 
+
             that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '警情信息', {
               lgtd: result[i].jd,
               lttd: result[i].wd,
               id: result[i].id
-            }, result[i].jd, result[i].wd, './images/police-situation.png');
+            }, result[i].jd, result[i].wd,
+              //  './images/police-situation.png'
+            );
 
             t = result[i].alarmTime.substr(0, 10);
             e = result[i].alarmTime.substr(11);
@@ -866,20 +865,21 @@
             h = result[i].alarmTime.substr(11, 5);
             a = Number(i) + 1;
 
+
             str += '<tr term-list=' + result[i].id + '>';
             str += '<td>' + a + '</td>';
             str += '<td title=' + result[i].waringType + '>' + result[i].waringType + '</td>';
             str += '<td title=' + result[i].alarmPeople + '>' + result[i].alarmPeople + '</td>';
             str += "<td><a href='javascript:;' title=" + time + ">" + y + ' ' + h + "</a></td>";
-            str += "<td class='location' style='display: none'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
+            // str += "<td class='location' style='display: none'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
             if (result[i].jtype == 0) {
-              str += "<td class='location'> <input style='color:#000000;background-color:#ffffff;background-image:linear-gradient(to right, #fffff , #fffff' type='button' value='未处理'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
+              str += "<td class='location'> <input style='color:#fff;background-color:#F35B5B;width: 50px' type='button' value='未处理'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
             } else {
               if (result[i].jtype == 1) {
-                str += "<td class='location'> <input style='color:#000000;background-color:#ffffff;background-image:linear-gradient(to right, #fffff , #fffff' type='button' value='处理中'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
+                str += "<td class='location'> <input style='color:#fff;background-color:rgb(18, 145, 230);width: 50px' type='button' value='处理中'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
 
               } else {
-                str += "<td class='location'> <input style='color:#000000;background-color:#ffffff;background-image:linear-gradient(to right, #fffff , #fffff' type='button' value='已处理'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
+                str += "<td class='location'> <input style='color:#fff;background-color:#32C1A2;width: 50px' type='button' value='已处理'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
 
               }
             }
@@ -890,6 +890,26 @@
 
 
           }
+
+          that.clearLayer();//图标清除
+          that.entityData = [];
+          for (var i = 0; i < result.length; i++) {
+            result[i].x = Number(result[i].jd);
+            result[i].y = Number(result[i].wd);
+            that.entityData.push({
+              lgtd: Number(result[i].jd),
+              lttd: Number(result[i].wd)
+            })
+          }
+          // console.log(result);//警情
+          if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+            that.heatmapfeatureLayer.clear();
+            that.heatmapfeatureLayer.setRenderer();
+            $('.analysis-category input').prop('checked', false);
+          };
+          that.flareClusterLayer(result);//图标渲染
+          that.Pdatas = result;
+          that.clusterLayer._setUserState('警情');//切换聚合图标点击事件
 
           for (var i = 0; i < 1000; i++) {
             var dd = Math.random();
@@ -931,46 +951,115 @@
       // })
     },
     // 获取业主信息列表
-    getOwnerTable: function (dom, type, dj) {
+    getOwnerTable: function (dom, deviceType) {
       dom.empty();
       var that = this;
       $.ajax({
-        url: '/api/blade-jfpts/suser/suser/selectList?type=' + type + '&dj=' + dj,
-        type: 'GET',
+        // url: '/api/blade-system/tenant/page',
+        // type: 'GET',
+        url: '/api/blade-system/tenant/selectListTe',
+        type: 'POST',
         dataType: 'JSON',
         success: function (data) {
           // var result = data.data;
-          var oldData = data.data
-          var result = oldData;
+          var oldData = data.data;
+          // console.log(deviceType)
+          var result = [];
           that.Ydata = oldData;
+
+          if (deviceType == '') {
+            result = oldData;
+          } else if (deviceType == '医院') {
+            for (var key in oldData) {
+              // console.log(oldData[key]);
+              if (oldData[key].type == '0') {
+                result.push(oldData[key]);
+              }
+            }
+          } else if (deviceType == '学校') {
+            for (var key in oldData) {
+              // console.log(oldData[key]);
+              if (oldData[key].type == '1') {
+                result.push(oldData[key]);
+              }
+            }
+          } else if (deviceType == '小区') {
+            for (var key in oldData) {
+              // console.log(oldData[key]);
+              if (oldData[key].type == '2') {
+                result.push(oldData[key]);
+              }
+            }
+          }
+
+
+
+          that.clearLayer();//图标清除
+          that.entityData = [];
+          for (var i = 0; i < result.length; i++) {
+            result[i].x = Number(result[i].jd);
+            result[i].y = Number(result[i].wd);
+            that.entityData.push({
+              lgtd: Number(result[i].jd),
+              lttd: Number(result[i].wd)
+            })
+          }
+          // console.log(result);//业主
+          if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+            that.heatmapfeatureLayer.clear();
+            that.heatmapfeatureLayer.setRenderer();
+            $('.analysis-category input').prop('checked', false);
+          };
+
+          that.flareClusterLayer(result);//图标渲染
+          that.Ydatas = result;
+          that.clusterLayer._setUserState('业主');//切换聚合图标点击事件
+
+
           var str = '';
           that.entitysData = [];
           that.analysisAddEntitys.clear();
+          var createD = (id, a, name, dj, type) => {
+            str += "<tr term-list=" + id + ">";
+            str += '<td>' + a + '</td>';
+            str += '<td>' + name + '</td>';
+            str += '<td>' + dj + '</td>';
+            str += '<td>' + type + '</td>';
+            // str += "<td class='location' style='display: none'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
+            str += '</tr>';
+            dom.append(str);
+            str = '';
+          }
           for (var a, i = 0; i < result.length; i++) {
 
             that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '业主信息', {
               lgtd: result[i].jd,
               lttd: result[i].wd,
               id: result[i].id
-            }, result[i].jd, result[i].wd, './images/owner.png');
+            }, result[i].jd, result[i].wd,
+              // './images/业主.png'
+            );
 
             a = Number(i) + 1;
-            str += "<tr term-list=" + result[i].id + ">";
-            str += '<td>' + a + '</td>';
-            str += '<td>' + result[i].type + '</td>';
-            str += '<td>' + result[i].dj + '</td>';
-            str += '<td>' + result[i].yname + '</td>';
-            str += "<td class='location' style='display: none'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
-            str += '</tr>';
-            dom.append(str);
-            str = '';
+            if (result[i].type === "0") {
+              createD(result[i].id, a, result[i].tenant_name, result[i].dj, '医院')
+            } else if (result[i].type === "1") {
+              createD(result[i].id, a, result[i].tenant_name, result[i].nature, '学校')
+            } else if (result[i].type === "2") {
+              createD(result[i].id, a, result[i].tenant_name, result[i].housetype, '小区')
+            } else {
+              createD(result[i].id, a, result[i].tenant_name, result[i].dj, '其他')
+            }
+
           }
 
+
+          // console.log(that.Ydata);//业主筛选
         }
       })
     },
     // 获取设备信息列表
-    getEquipmentTable: function (dom, deviceType) {
+    getEquipmentTable: function (dom, deviceType, once) {
       dom.empty();
       var that = this;
       // console.log(that.clusterLayer)
@@ -994,7 +1083,7 @@
           var oldData = data.data;
           var result = [];
           that.Sdata = oldData;
-          // console.log(result)
+
           var str = '';
           that.entitysData = [];
           that.analysisAddEntitys.clear();
@@ -1032,13 +1121,37 @@
             }
           }
 
+          if (once != 'once') {
+            that.clearLayer();//图标清除
+            that.entityData = [];
+            for (var i = 0; i < result.length; i++) {
+              result[i].x = Number(result[i].jd);
+              result[i].y = Number(result[i].wd);
+              that.entityData.push({
+                lgtd: Number(result[i].jd),
+                lttd: Number(result[i].wd)
+              })
+            }
+            // console.log(result);//设备筛选
+            if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+              that.heatmapfeatureLayer.clear();
+              that.heatmapfeatureLayer.setRenderer();
+              $('.analysis-category input').prop('checked', false);
+            };
+            that.flareClusterLayer(result);//图标渲染
+            that.clusterLayer._setUserState('设备');//切换聚合图标点击事件
+
+          }
+          that.Sdatas = result;
 
           for (var a, i = 0; i < result.length; i++) {
             that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '设备信息', {
               lgtd: result[i].jd,
               lttd: result[i].wd,
               id: result[i].id
-            }, result[i].jd, result[i].wd, './images/ceshi.png');
+            }, result[i].jd, result[i].wd,
+              // './images/ceshi.png'
+            );
             var stares = '';
 
             a = Number(i) + 1;
@@ -1120,9 +1233,12 @@
     checkBoxSelect: function (self) {//选择热力图
       var that = this;
       var heatmapRenderer = null;
+      // console.log(self);
       // // return
       // 选中
       if ($(self).prop('checked') == true) {
+        that.clearLayer();//图标清除
+        // console.log($(self).attr('id'), 1);
         // if (1) {
         heatmapRenderer = new HeatmapRenderer({
           colorStops: [
@@ -1144,6 +1260,56 @@
           this.heatmapfeatureLayer.add(new esri.Graphic(point));
         }
       } else {
+        // console.log(self, 2);
+        if ($(self).attr('class') == 'p') {
+          that.entityData = [];
+          for (var i = 0; i < this.Pdatas.length; i++) {
+            this.Pdatas[i].x = Number(this.Pdatas[i].jd);
+            this.Pdatas[i].y = Number(this.Pdatas[i].wd);
+            that.entityData.push({
+              lgtd: Number(this.Pdatas[i].jd),
+              lttd: Number(this.Pdatas[i].wd)
+            })
+          }
+          if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+            that.heatmapfeatureLayer.clear();
+            that.heatmapfeatureLayer.setRenderer();
+            // $('.analysis-category input').prop('checked', false);
+          };
+          that.flareClusterLayer(this.Pdatas);//图标渲染
+        } else if ($(self).attr('class') == 'Y') {
+          that.entityData = [];
+          for (var i = 0; i < this.Ydatas.length; i++) {
+            this.Ydatas[i].x = Number(this.Ydatas[i].jd);
+            this.Ydatas[i].y = Number(this.Ydatas[i].wd);
+            that.entityData.push({
+              lgtd: Number(this.Ydatas[i].jd),
+              lttd: Number(this.Ydatas[i].wd)
+            })
+          }
+          if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+            that.heatmapfeatureLayer.clear();
+            that.heatmapfeatureLayer.setRenderer();
+            // $('.analysis-category input').prop('checked', false);
+          };
+          that.flareClusterLayer(this.Ydatas);//图标渲染
+        } else if ($(self).attr('class') == 'S') {
+          that.entityData = [];
+          for (var i = 0; i < this.Sdatas.length; i++) {
+            this.Sdatas[i].x = Number(this.Sdatas[i].jd);
+            this.Sdatas[i].y = Number(this.Sdatas[i].wd);
+            that.entityData.push({
+              lgtd: Number(this.Sdatas[i].jd),
+              lttd: Number(this.Sdatas[i].wd)
+            })
+          }
+          if (that.heatmapfeatureLayer.graphics.length > 0) {//热力图数据映射
+            that.heatmapfeatureLayer.clear();
+            that.heatmapfeatureLayer.setRenderer();
+            // $('.analysis-category input').prop('checked', false);
+          };
+          that.flareClusterLayer(this.Sdatas);//图标渲染
+        }
         this.heatmapfeatureLayer.clear();
         this.heatmapfeatureLayer.setRenderer();
       }
@@ -1227,7 +1393,7 @@
 
 
     //聚合图层事件
-    flareClusterLayer: function (datas) {  //top聚合事件,导航
+    flareClusterLayer: function (datas, userState) {  //top聚合事件,导航
 
       var that = this;
 
@@ -1260,7 +1426,7 @@
       });
 
       //set up a class breaks renderer to render different symbols based on the cluster count. Use the required clusterCount property to break on.
-      var defaultSym = new PictureMarkerSymbol("./images/jingbaored.png", 33, 48).setOffset(0, 15);
+      var defaultSym = new PictureMarkerSymbol("./images/jingbaored.png", 33, 48).setOffset(0, 1);
       var renderer = new ClassBreaksRenderer(defaultSym, "clusterCount");
       var xlSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 32, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([200, 52, 59, 0.8]), 1), new dojo.Color([250, 65, 74, 0.8]));
       var lgSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 28, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([41, 163, 41, 0.8]), 1), new dojo.Color([51, 204, 51, 0.8]));

--
Gitblit v1.9.3