tanghaolin
2022-11-01 5c26aaf55463580a2de7163ba16b2eba941d0f9c
map/index.js
@@ -13,8 +13,8 @@
    isLoad:false,
    //地图信息
    mapInfo: {
      mapCenterLatitude: 31.981269, //地图中心经纬度
      mapCenterLongitude: 120.894522,
      mapCenterLatitude: 32.185569, //地图中心经纬度
      mapCenterLongitude: 121.020513,
      markers: [], //标记marker map
      Station: [], //泵站列表
      scale: 10, //地图放大比例
@@ -39,6 +39,7 @@
    stationID: '', //泵站id
    modalName: '', //模态框抓状态
    stationIDs: [], //所有泵站id集合
    allMarkersID:[],//所有的markesID集合
    link_box: false, //资产、监控、bim跳转条显/隐
    tuceng_active: false, //图层按钮显示隐藏
    marker_layer: {
@@ -123,7 +124,7 @@
    })
  },
  //获取地图展示的基本信息
  getMapInfo: function () {
 getMapInfo () {
    var that = this;
    wx.showLoading({
      title: '加载中...'
@@ -133,7 +134,7 @@
      url: Constant.BASE_SERVER_URL + "Map/ObjectMapInfo/Mobile/GetByKindAndPurposeUnderCorp@V1.0",
      method: 'GET',
      data: {
        CorpID: this.data.currentCorpID,
        CorpID: that.data.currentCorpID,
        Kind:"高德",
        Purpose:"定位"
      },
@@ -148,9 +149,9 @@
          content: '通讯失败',
        })
      }, //请求失败
      success: function (res) {
     success: (res)=> {
        wx.hideLoading();
        //  console.log(res.data,150)
        // console.log(res.data,150)
        var result = res.data;
        if (result.Code != 0) {
          wx.showModal({
@@ -159,18 +160,18 @@
          });
          return;
        }
        // wx.showToast({
        //   title: '加载成功',
        //   icon: "success",
        //   duration: 1000
        // });
        //console.log(result)
        let allDMA = []
        let allProduct = []
        let allFlowMeter = []
        let allPressMeter = []
        let allStation = []
        result.Data.forEach((item)=>{
        let allMarkersID = []
        for( let i = 0;i<result.Data.length;i++){
          let item = result.Data[i]
          let index = i
          item.currentIndex = index
          allMarkersID.push(item.ObjectID);
          if(item.ObjectType == "泵站"){
            item.Position = JSON.parse(item.Position)
            allStation.push(item)
@@ -191,8 +192,9 @@
              allProduct.push(item)
            }
          }
        })
        // console.log(allDMA,allProduct,174)
        }
        //  console.log(allDMA,allProduct,174)
       
        var DMA = [];
        var DmaArea = [];
@@ -237,14 +239,14 @@
        }
        for (var i = 0; i < allStation.length; i++) {
          var item = allStation[i];
          var mark = {};
          var callout = {};
          let mark = {};
          let customCallout = {};
          mark.longitude = item.Position.Point.X;
          mark.latitude = item.Position.Point.Y;
          mark.title = item.ObjectName;
          stationIDs.push(parseInt(item.ObjectID));
          mark.id = parseInt(item.ObjectID);
          stationIDs.push(item.ObjectID);
          mark.id = +item.currentIndex ;
          mark.content = item.Position.Address;
          mark.width = 32;
          mark.height = 32;
@@ -252,13 +254,17 @@
          mark.zIndex = 10;
          mark.markerInfo = item
          mark.markerType = 'Station'
          callout.content = item.ObjectName;
          callout.display = 'ALWAYS';
          callout.padding = 5;
          callout.borderRadius = 10;
          callout.borderWidth = 1;
          callout.borderColor = '#999';
          mark.callout = callout;
          customCallout.anchorY= -3
          customCallout.anchorX= 0,
          customCallout.display= 'ALWAYS'
          // customCallout.content = item.ObjectName;
          // customCallout.display = 'ALWAYS';
          // customCallout.padding = 5;
          // customCallout.borderRadius = 10;
          // customCallout.borderWidth = 1;
          // customCallout.borderColor = '#999';
          mark.customCallout = customCallout;
          markers.push(mark);
          Station.push(mark);
@@ -279,7 +285,7 @@
          mark.latitude = item.Position.Point.Y;
          mark.title = item.ObjectName;
          mark.id = parseInt(item.ObjectID);
          mark.id = parseInt(item.currentIndex);
          mark.content = item.Position.Address;
          mark.width = 32;
          mark.height = 32;
@@ -309,12 +315,11 @@
          var item = allPressMeter[i];
          var mark = {};
          var callout = {};
          mark.longitude = item.Position.Point.X;
          mark.latitude = item.Position.Point.Y;
          mark.title = item.ObjectName;
          mark.id = parseInt(item.ObjectID);
          mark.id = item.currentIndex;
          mark.content = item.Position.Address;
          mark.width = 32;
          mark.height = 32;
@@ -337,64 +342,32 @@
            latitude: item.Position.Point.Y
          });
        }
        // if (result.Data.QualityMeter == null) {
        //   result.Data.QualityMeter = []
        // }
        // for (var i = 0; i < result.Data.QualityMeter.length; i++) {
        //   var item = result.Data.QualityMeter[i];
        //   var mark = {};
        //   var callout = {};
        //   mark.longitude = item.PosiX;
        //   mark.latitude = item.PosiY;
        //   mark.title = item.Name;
        //   mark.id = item.ID;
        //   mark.content = item.Address;
        //   mark.width = 32;
        //   mark.height = 32;
        //   mark.iconPath = "/images/map/shuizhiyi_blue.png";
        //   mark.zIndex = 10;
        //   mark.markerType = 'QualityMeter'
        //   mark.markerInfo = item
        //   callout.content = item.Name;
        //   callout.display = 'ALWAYS';
        //   callout.padding = 5;
        //   callout.borderRadius = 10;
        //   callout.borderWidth = 1;
        //   callout.borderColor = '#999';
        //   mark.callout = callout;
        //   markers.push(mark);
        //   QualityMeter.push(mark);
        //   pointsList.push({
        //     longitude: item.PosiX,
        //     latitude: item.PosiY
        //   });
        // }
        
        that.setData({
          'mapInfo.Station': allProduct,
          // 'mapInfo.mapCenterLatitude': 31.121743,
          // 'mapInfo.mapCenterLongitude': 120.287392,
          'mapInfo.scale': 12,
          'mapInfo.scale': 10,
          'mapInfo.DMA': DMA,
          'mapInfo.markers': markers,
          'mapInfo.pointsList': pointsList,
           stationIDs: stationIDs,
           allMarkersID: allMarkersID,
          'mapInfo.marker.Station': Station,
          'mapInfo.marker.QualityMeter': QualityMeter,
          'mapInfo.marker.FlowMeter': FlowMeter,
          'mapInfo.marker.PressMeter': PressMeter,
          'mapInfo.marker.DmaArea': DmaArea,
        });
        console.log(that.data.mapInfo.markers,375)
        console.log(allMarkersID,"allMarkersID")
        //使所有的标记都在视野中
        // that.setIncludePoints();
        //  that.setIncludePoints();
        //获取工单
        that.getRepairFormList()
        // that.getRepairFormList()
      }
    });
  },
  getRepairFormList: function () {
@@ -492,8 +465,11 @@
  },
  //点击地图marker 
  tapMapMark: function (e) {
    //  console.log(e,484)
    var id = e.detail.markerId;
      console.log(e,484)
    // var id = e.detail.markerId;
    //20221028 thl
    var id = "1575029532937818112";//暂时写死
    //  console.log(id)
    //console.log(e)
    this.showMapTipInBottomPanel(id);
@@ -512,7 +488,7 @@
  //显示marker信息面板
async showMapTipInBottomPanel(id, label) {
    //  console.log(id)
      console.log(id)
    var markerTipInfo = null;
    var that = this;
    var markers = that.data.mapInfo.markers;
@@ -537,14 +513,14 @@
      }
    }
    for (var i = 0; i < markers.length; i++) {
      if (markers[i].markerInfo.ObjectType == '泵站' && id == markers[i].id) {
      if (markers[i].markerInfo.ObjectType == '泵站' && id == that.data.allMarkersID[markers[i].id]) {
        markerTipInfo = markers[i];
        markerTipInfo.markerInfo.Records = Record
        that.setData({
          markerTipInfo: markerTipInfo
        })
        break;
      } else if (id == markers[i].id) {
      } else if (id == that.data.allMarkersID[markers[i].id]) {
        // console.log("ddd")
        markerTipInfo = markers[i];
        // console.log(markerTipInfo)
@@ -562,14 +538,15 @@
  },
//获取泵站kpi
 getKpiByStationID(stationID){
    let that = this
   let that = this
   console.log(that.data.currentCorpID,stationID,2,567)
    return new Promise(function (resolve, reject){
      Request({
        url: Constant.BASE_SERVER_URL + "Monitor/MonitorPoint/Mobile/GetKpiByStationID@V1.0",
        method: 'GET',
        data: {
          CorpID: that.data.currentCorpID,
          StationID  :stationID,
          StationID :stationID,
          Count:2
        },
        header: {
@@ -577,6 +554,7 @@
        },
        success:res=>{
          let result = res.data
          console.log(result,580)
          if(result.Code != 0){
            result = []
            resolve(result)