南昌市物联网技防平台-前端
liuyg
2021-04-23 e060b5724d307c1a3bc8015bf8d8a815c2aaca52
public/map/widgets/supervisoryMap/SupervisoryMap.js
@@ -260,6 +260,7 @@
      var mySelf = this;
      objThis._map.addLayer(objThis._siteLayer);
      var that = this;
      // console.log(mySelf.clusterLayer)
      that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), '');
      // 顶部tab得切换事件
      $('.analysis-and-judgment-tab li').click(function () {
@@ -462,13 +463,13 @@
        // console.log(that.clusterLayer, that._map, 6)
        // console.log(id, 'id');
        // console.log(that.clusterLayer.indexs);
        // console.log(that.clusterLayer);
        var Tattributes = null
          , ds = that.clusterLayer.allData;
        for (var key in ds) {
          if (ds[key].id == id){
          if (ds[key].id == id) {
            Tattributes = ds[key];
          }
          }
        }
        if (mySelf.onceTimeMethod == null) {//防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗
          var evtdata = {};
@@ -491,47 +492,47 @@
      // $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function (event) {
      //   event.stopPropagation();
      // })
      $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function (event) {
        event.stopPropagation();
        var lgtd = Number($(this).attr('lgtd'));
        var lttd = Number($(this).attr('lttd'));
        var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
        that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
      // $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function (event) {
      //   event.stopPropagation();
      //   var lgtd = Number($(this).attr('lgtd'));
      //   var lttd = Number($(this).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 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);
      //   // var a = document.elementFromPoint(21, 122);
      //   // console.log(a);
        // console.log(that.clusterLayer, that._map, 6)
        // console.log(id, 'id');
        // console.log(that.clusterLayer.indexs);
        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,
          }
          that.clusterLayer._clickOpenOnclick(evtdata, '控制端', that.clusterLayer.indexs);
          mySelf.onceTimeMethod = setTimeout(() => {
            mySelf.onceTimeMethod = null;
          }, mySelf.onceTime);
        } else {
        };
      })
      //   // console.log(that.clusterLayer, that._map, 6)
      //   // console.log(id, 'id');
      //   // console.log(that.clusterLayer.indexs);
      //   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,
      //     }
      //     that.clusterLayer._clickOpenOnclick(evtdata, '控制端', that.clusterLayer.indexs);
      //     mySelf.onceTimeMethod = setTimeout(() => {
      //       mySelf.onceTimeMethod = null;
      //     }, mySelf.onceTime);
      //   } else {
      //   };
      // })
      // 警情列表中得热力图是否选中事件
      $('#policeHeatMap').click(function () {
        that.checkBoxSelect(this);
@@ -797,6 +798,7 @@
    getEquipmentTable: function (dom, deviceType) {
      dom.empty();
      var that = this;
      // console.log(that.clusterLayer)
      // console.log(dom, deviceType);
      // dom.append(deviceType);
      // var str = "<td class='locationb'> <input type='button' value='定位'" + ' lgtd=' + 114.9285 + ' lttd=' + 25.850693 + "></td>"
@@ -810,12 +812,12 @@
      // dom.append(str)
      $.ajax({
        url: '/api/blade-jfpts/equipment/equipment/selectList?deviceType=' + deviceType,
        url: '/api/blade-jfpts/equipment/equipment/listAll?deviceType=' + deviceType,
        type: 'GET',
        dataType: 'JSON',
        success: function (data) {
          var result = data.data;
          // console.log(data)
          console.log(result)
          var str = '';
          that.entitysData = [];
          that.analysisAddEntitys.clear();
@@ -825,20 +827,38 @@
              lttd: result[i].wd,
              id: result[i].id
            }, result[i].jd, result[i].wd, './images/ceshi.png');
            var stares = '';
            a = Number(i) + 1;
            str += "<tr term-listid=" + result[i].id + ">";
            str += '<td>' + a + '</td>';
            str += '<td title=' + result[i].deviceName + '>' + result[i].deviceName + '</td>';
            str += '<td title=' + result[i].deviceType + '>' + result[i].deviceType + '</td>';
            // str += '<td title=' + result[i].deviceType + '>' + result[i].deviceType + '</td>';
            str += '<td>' + result[i].deviceNumber + '</td>';
            str += "<td class='location'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
            // console.log(result[i].state);
            if (result[i].state != '') {
              stares = '故障';
              str += "<td class='location'> <input style='background-image:linear-gradient(to right, #F49966 , #F49966' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
            } else {
              if (result[i].jtype != 1) {
                if (result[i].onlineStatus == 1) {//el-tabs__active-bar
                  stares = '在线';
                  str += "<td class='location'> <input style='background-image:linear-gradient(to right, #32C1A2 , #32C1A2' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                } else {
                  stares = '离线';
                  str += "<td class='location'> <input style='background-image:linear-gradient(to right, #CDCDCD , #CDCDCD' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                }
              } else {
                stares = '警报';
                str += "<td class='location'> <input style='background-image:linear-gradient(to right, #F35B5B , #F35B5B' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
              }
            }
            str += '</tr>';
            dom.append(str);
            str = '';
          }
        }
      })
    },