南昌市物联网技防平台-前端
shuishen
2021-04-19 9094dea7cd9e45e4bb0a3d22a8dc1d682ca7463b
public/map/widgets/supervisoryMap/FlareClusterLayer_v3.js
@@ -167,8 +167,84 @@
        }
      }
    },
    _mapClick: function (e) {//地图全局点击事件 标记不能点击
      // console.log('地图全局点击事件');
      if (!e.target) {
        return;
      }
    onClick: function (evt) {
      var targetClass = e.target.getAttribute("class");
      if (!targetClass || targetClass.indexOf("cluster-object") === -1) {
        //if this was not a cluster object at all then clear any active one and return
        this._clearActiveCluster();
      } else if (targetClass.indexOf("cluster-object") !== -1) {
        //if click reached map click event and it is a cluster object, make sure an info window doesn't display for the cluster graphic
        if (this.map.infoWindow.cluster) {
          this._restoreInfoWindowSettings();
        }
        this.map.infoWindow.hide();
      }
    },
    onClick: function (evt) { //标志以及聚合表示点击事件
      var eour = evt.graphic.attributes.clusterCount;
      if(eour == undefined){
        var dataO = evt
        var data = {
          nums : evt.graphic.attributes.deviceNumber,
          nams : evt.graphic.attributes.deviceName,
        }
        console.log(dataO);
        var rightCard = (num,name,posi)=>{
          var that = this;
          var url = './popup/html/FlareClusterLayer_v3.html?num=' + num + '&name=' + name;
            layui.use('layer', function () {
                that.layuiLayer = layui.layer;
                // that.layuiLayer.config({
                //     extend: 'myskin/police-details.css'
                // });
                that.layuiLayer.close(that.layuiLayer.index);
                that.layuiLayer.open({
                    title: '',
                    type: 2,
                    shadeClose: true,
                    shade: false,
                    skin: 'demo-class',
                    id: 'onelyOne',
                    maxmin: false, //开启最大化最小化按钮
                    // area: ['500px', '400px'],
                    offset: posi,
                    skin: 'police-details',
                    content: [url,'no'],
                    resize: false,
                    closeBtn: 1,
                    success: function(layero, index){//成功后添加全局点击关闭
                      console.log(layero, index);
                      // var a = window.onmousedown  = ()=>{
                      //   // parent[0].layer.close(index);
                      //   // begins();
                      // }
                      var d = document.onclick = ()=>{
                        parent[0].layer.close(index);
                        d = '';
                      }
                    },
                });
            })
        }
        var offsetMy = [+evt.screenY - 370 + 'px',+evt.screenX - 370 + 'px'];
        rightCard  (data.nums,data.nams,offsetMy);
        var begins = ()=>{
          var offsetMy = [+evt.screenY - 370 + 'px',+evt.screenX - 370 + 'px'];
          rightCard  (data.nums,data.nams,offsetMy);
        }
      }else {
        console.log(num,'zoom');
      }
      console.log(evt)
      this._restoreInfoWindowSettings();
      if (evt.graphic.attributes.isCluster) {
@@ -368,24 +444,7 @@
      dojo.query("g.cluster-group:empty", this.getNode()).forEach(dojo.destroy);
    },
    _mapClick: function (e) {
      if (!e.target) {
        return;
      }
      var targetClass = e.target.getAttribute("class");
      if (!targetClass || targetClass.indexOf("cluster-object") === -1) {
        //if this was not a cluster object at all then clear any active one and return
        this._clearActiveCluster();
      } else if (targetClass.indexOf("cluster-object") !== -1) {
        //if click reached map click event and it is a cluster object, make sure an info window doesn't display for the cluster graphic
        if (this.map.infoWindow.cluster) {
          this._restoreInfoWindowSettings();
        }
        this.map.infoWindow.hide();
      }
    },
    _graphicDraw: function (e) {
      var g = e.graphic;
      if (g.attributes.isCluster) {
@@ -653,7 +712,7 @@
      this.singles.push(single);
      delete single.graphic;
      var symbol;
      console.log(single.onlineStatus, 898989);
      console.log(single.onlineStatus, '移动事件');
      if (single.onlineStatus == 1) {
        symbol = new esri.symbol.PictureMarkerSymbol("./images/zx-jingbao.png", 40, 40);
      } else {