lishifeng
2020-08-31 0e9a99da563168bc88c9cfd346bfdfb0f1d81714
提交99
4个文件已修改
301 ■■■■ 已修改文件
package-lock.json 151 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/api.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/realTime.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -1746,6 +1746,17 @@
          "integrity": "sha1-4a1IbmxUUBY0xsOXxcEh2qODYHw=",
          "dev": true
        },
        "ansi-styles": {
          "version": "4.2.1",
          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
          "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
          "dev": true,
          "optional": true,
          "requires": {
            "@types/color-name": "^1.1.1",
            "color-convert": "^2.0.1"
          }
        },
        "cacache": {
          "version": "13.0.1",
          "resolved": "https://registry.npm.taobao.org/cacache/download/cacache-13.0.1.tgz?cache=0&sync_timestamp=1594429684526&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcacache%2Fdownload%2Fcacache-13.0.1.tgz",
@@ -1772,6 +1783,34 @@
            "unique-filename": "^1.1.1"
          }
        },
        "chalk": {
          "version": "3.0.0",
          "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
          "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
          "dev": true,
          "optional": true,
          "requires": {
            "ansi-styles": "^4.1.0",
            "supports-color": "^7.1.0"
          }
        },
        "color-convert": {
          "version": "2.0.1",
          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
          "dev": true,
          "optional": true,
          "requires": {
            "color-name": "~1.1.4"
          }
        },
        "color-name": {
          "version": "1.1.4",
          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
          "dev": true,
          "optional": true
        },
        "find-cache-dir": {
          "version": "3.3.1",
          "resolved": "https://registry.npm.taobao.org/find-cache-dir/download/find-cache-dir-3.3.1.tgz?cache=0&sync_timestamp=1583734591888&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffind-cache-dir%2Fdownload%2Ffind-cache-dir-3.3.1.tgz",
@@ -1792,6 +1831,13 @@
            "locate-path": "^5.0.0",
            "path-exists": "^4.0.0"
          }
        },
        "has-flag": {
          "version": "4.0.0",
          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
          "dev": true,
          "optional": true
        },
        "locate-path": {
          "version": "5.0.0",
@@ -1857,6 +1903,16 @@
            "minipass": "^3.1.1"
          }
        },
        "supports-color": {
          "version": "7.2.0",
          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
          "dev": true,
          "optional": true,
          "requires": {
            "has-flag": "^4.0.0"
          }
        },
        "terser-webpack-plugin": {
          "version": "2.3.8",
          "resolved": "https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-2.3.8.tgz?cache=0&sync_timestamp=1597229611059&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-2.3.8.tgz",
@@ -1872,6 +1928,21 @@
            "source-map": "^0.6.1",
            "terser": "^4.6.12",
            "webpack-sources": "^1.4.3"
          }
        },
        "vue-loader-v16": {
          "version": "npm:vue-loader@16.0.0-beta.5",
          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.5.tgz",
          "integrity": "sha512-ciWfzNefqWlmzKznCWY9hl+fPP4KlQ0A9MtHbJ/8DpyY+dAM8gDrjufIdxwTgC4szE4EZC3A6ip/BbrqM84GqA==",
          "dev": true,
          "optional": true,
          "requires": {
            "@types/mini-css-extract-plugin": "^0.9.1",
            "chalk": "^3.0.0",
            "hash-sum": "^2.0.0",
            "loader-utils": "^1.2.3",
            "merge-source-map": "^1.1.0",
            "source-map": "^0.6.1"
          }
        }
      }
@@ -11085,86 +11156,6 @@
          "resolved": "https://registry.npm.taobao.org/hash-sum/download/hash-sum-1.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhash-sum%2Fdownload%2Fhash-sum-1.0.2.tgz",
          "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=",
          "dev": true
        }
      }
    },
    "vue-loader-v16": {
      "version": "npm:vue-loader@16.0.0-beta.5",
      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.5.tgz",
      "integrity": "sha512-ciWfzNefqWlmzKznCWY9hl+fPP4KlQ0A9MtHbJ/8DpyY+dAM8gDrjufIdxwTgC4szE4EZC3A6ip/BbrqM84GqA==",
      "dev": true,
      "optional": true,
      "requires": {
        "@types/mini-css-extract-plugin": "^0.9.1",
        "chalk": "^3.0.0",
        "hash-sum": "^2.0.0",
        "loader-utils": "^1.2.3",
        "merge-source-map": "^1.1.0",
        "source-map": "^0.6.1"
      },
      "dependencies": {
        "ansi-styles": {
          "version": "4.2.1",
          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
          "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
          "dev": true,
          "optional": true,
          "requires": {
            "@types/color-name": "^1.1.1",
            "color-convert": "^2.0.1"
          }
        },
        "chalk": {
          "version": "3.0.0",
          "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
          "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
          "dev": true,
          "optional": true,
          "requires": {
            "ansi-styles": "^4.1.0",
            "supports-color": "^7.1.0"
          }
        },
        "color-convert": {
          "version": "2.0.1",
          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
          "dev": true,
          "optional": true,
          "requires": {
            "color-name": "~1.1.4"
          }
        },
        "color-name": {
          "version": "1.1.4",
          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
          "dev": true,
          "optional": true
        },
        "has-flag": {
          "version": "4.0.0",
          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
          "dev": true,
          "optional": true
        },
        "source-map": {
          "version": "0.6.1",
          "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
          "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
          "dev": true,
          "optional": true
        },
        "supports-color": {
          "version": "7.2.0",
          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
          "dev": true,
          "optional": true,
          "requires": {
            "has-flag": "^4.0.0"
          }
        }
      }
    },
src/assets/js/api.js
@@ -151,11 +151,7 @@
    })
}
//查询已添加到地图的机房
/*     const data = await searchMap({
      adata: { alm_cleared_type: 0, alm_id: 1 },
      bplan: { discharge_reason: 3 }
    }); */
/**
 * 查询电池组信息
@@ -169,6 +165,11 @@
    })
}
//查询已添加到地图的机房
/*     const data = await searchMap({
      adata: { alm_cleared_type: 0, alm_id: 1 },
      bplan: { discharge_reason: 3 }
    }); */
//----------------------------
/**
 * 查询已添加到地图的机房
src/pages/dataTest/realTime.vue
@@ -94,10 +94,10 @@
import HomeList from "./HomeList";
import BarChart from "../../components/chart/BarChart";
import { realTimeSearch, realTimeGroup } from "../../assets/js/realTime";
import { realTimeSearch, realTimeGroup, realTimeAlarm } from "../../assets/js/realTime";
import {
  formatSeconds,
  sethoubeiTime
  sethoubeiTime,
} from '../../assets/js/tools'
/* import moment from "moment"; */
let vol, res, temp, conduct, curr;
@@ -284,12 +284,25 @@
      this.$refs.conduct.setOption(conduct);
      this.$refs.curr.setOption(curr);
    },
    leafClick(data) {
      this.batt = data;
      /*   console.log('this.batt',this.batt); */
      this.realTimeAlarmss();
      this.realTimeGroupss();
      this.realTimeSearch();
    },
    /* 查询电池告警参数 */
    realTimeAlarmss() {
      var batt = this.batt;
      console.log('batt',batt);
     realTimeAlarm(batt.FBSDeviceId).then(res => {
         console.log('batt.FBSDeviceId',batt.FBSDeviceId);
       /*  let rsccc = JSON.parse(res.data.result);
          console.log("rsccc", rsccc); */
      /*   this.inputs = rsa.data[0]; */
        /* console.log("this.inputs", this.inputs); */
      });
    },
    /* 实时组端信息 */
    realTimeGroupss() {
@@ -298,7 +311,7 @@
        let rsa = JSON.parse(res.data.result);
        /*   console.log("rsa", rsa); */
        this.inputs = rsa.data[0];
        console.log("this.inputs", this.inputs);
        /* console.log("this.inputs", this.inputs); */
      });
    },
src/pages/index.vue
@@ -77,15 +77,6 @@
      panTo: null,
      point: null,
      obj: null,
      txtMenuItem: null,
     options: [{
          StationName1: '湖北省',
          StationName2: '武汉市',
          StationName5:'江汉区',
          StationName3:'丁香站'
        }],
      defaultProps: {
        label: "label",
        isLeaf: (data, node) => {
@@ -99,8 +90,23 @@
  },
  methods: {
    myclick(data) {
      console.log(data)
     // 向父级发送同步页面的指令
    syncPage() {
      let batt = this.batt;
      let search="?province="+batt.StationName1
      +"&city="+batt.StationName2+"&county="+batt.StationName5
      +"&home="+batt.StationName3+"&batt="+batt.BattGroupId;
      window.parent.postMessage({
        cmd: "syncPage",
        params: {
          pageInfo: {
            label: '实时监测',
            name: 'realTime',
            src: '#/real-time'+search,
            closable: true,
          }
        },
      }, "*");
    },
    initMap() {
      const that = this;
@@ -123,36 +129,40 @@
        message: "地址信息"
      };
      this.infoWindow = new BMapGL.InfoWindow(
        '<p style="font-size: 16px;color: black;margin:2px;margin-top: 10px; ">蓄电池组告警数目:50 详情>> <br> 蓄电池组落后数目:0 详情>> <br> 蓄电池组延时数目:0 详情>> <br> <span style="color:blue">实时数据 历史数据</span> <br>地址:贵阳省-贵阳市-南明区-紫晶办事处</p>',
      this.infoWindow = new BMapGL.InfoWindow( // 创建信息窗口对象
        `<p style="font-size: 16px;color: black;margin:2px;margin-top: 10px; ">蓄电池组告警数目:50 详情>> <br> 蓄电池组落后数目:0 详情>> <br> 蓄电池组延时数目:0 详情>>
         <br> <span style="color:blue" ><a href="syncPage()">实时数据</a> 历史数据</span> <br>地址:湖北省-武汉市-东西湖区-武汉源畅模拟机房</p>`,
        opts
      );
      // 创建信息窗口对象
      this.map.openInfoWindow(this.infoWindow, this.point); // 打开信息窗口
      /*   } */
      that.map.openInfoWindow(this.infoWindow, this.point);
      this.marker.addEventListener("click", e => {
        console.log("this.point", this.point);
        that.map.openInfoWindow(this.infoWindow, this.point); //开启信息窗口
      });
      /* 可托拽的标注 */
      this.marker.enableDragging();
    /*   this.marker.enableDragging();
      this.marker.addEventListener("dragend", function(e) {
        console.log("当前位置:" + e.point.lng + ", " + e.point.lat);
      });
      }); */
      this.onCLickMap(); //点击事件获取坐标
      /* map地图右键菜单 */
      var menu = new BMapGL.ContextMenu();
      this.txtMenuItem = [
      var txtMenuItem = [
        {
          text: "放大",
          callback: function() {
            this.map.zoomIn(15);
            this.map.zoomIn();
          }
        },
        {
          text: "缩小",
          callback: function() {
            this.map.zoomOut(5);
            this.map.zoomOut();
          }
        },
        {
@@ -172,15 +182,9 @@
          async callback(node) {
            //获取站点名
            const addSetdian = await addMapSetdian();
            const addSetmap = JSON.parse(addSetdian.data.result).data.map(item=>{
              item.label = item.StationName1+'-'+item.StationName2+'-'+item.StationName5+'-'+item.StationName3;
              return item;
            });
            const point = new BMapGL.Point(that.lng, that.lat);
            const marke = new BMapGL.Marker(point);
            that.map.addOverlay(marke);
            // console.log("addSetdian", addSetdian);
            // console.log("addSetmap", addSetmap);
            const addSetmap = JSON.parse(addSetdian.data.result).data;
            console.log("addSetdian", addSetdian);
            console.log("addSetmap", addSetmap);
            /* 设置站点窗口 */
            var opts = {
              width: 'auto', // 信息窗口宽度
@@ -188,31 +192,31 @@
              title:'<p style="font-size: 16px;color: black;margin:2px;margin-bottom: 10px;">设置站点位置  </p>', // 信息窗口标题
              message: "地址信息"
            };
            var geoc = new BMapGL.Geocoder();
            showInfoWindowTest.homeList = addSetmap;
            // 逆地址解析,通过经纬度获取地址信息
            geoc.getLocation(marke.getPosition(), function(rs) {
              showInfoWindowTest.address = rs.address;
              showInfoWindowTest.point = marke.getPosition();
            });
            this.infoWindow = new BMapGL.InfoWindow(showInfoWindowTest.$el, opts);
            this.infoWindow = new BMapGL.InfoWindow(
              `<p style="font-size: 16px;color: black;margin:2px;margin-top: 5px; ">地址:${
                that.cityName
              }<br> 经度:${that.lng}
              <br> 维度: ${
                that.lat
              }  <br> 设置站点名:<select style="border: 1px solid #ccc; width: 180px" ><option value="${
                addSetmap[21].StationName1
              }-${addSetmap[21].StationName2}-${addSetmap[21].StationName5}-${
                addSetmap[21].StationName3
              }">${addSetmap[5].StationName1}-${addSetmap[5].StationName2}-${
                addSetmap[5].StationName5
              }-${addSetmap[5].StationName3}</option>
              <option value="湖北省-鄂州市-鄂城区-司徒">湖北省-鄂州市-鄂城区-司徒</option>
              </select> <br><br><button style="background-color: pink"   >确定</button> </p>`,
              opts
            );
            const point = new BMapGL.Point(that.lng, that.lat);
            const marke = new BMapGL.Marker(point);
            that.map.addOverlay(marke);
            that.map.openInfoWindow(this.infoWindow, point);
            marke.addEventListener("click", e => {
              // 逆地址解析,通过经纬度获取地址信息
              geoc.getLocation(marke.getPosition(), function(rs) {
                showInfoWindowTest.address = rs.address;
                showInfoWindowTest.point = marke.getPosition();
              });
              //左击标注
              that.map.openInfoWindow(this.infoWindow, point);
            });
            //添加地图上的机房
            // const res = await addMapStation({
@@ -229,13 +233,12 @@
          }
        }
      ];
      for (var i = 0; i < this.txtMenuItem.length; i++) {
      for (var i = 0; i < txtMenuItem.length; i++) {
        menu.addItem(
          new BMapGL.MenuItem(
            this.txtMenuItem[i].text,
            this.txtMenuItem[i].callback,
            100
          )
          new BMapGL.MenuItem(txtMenuItem[i].text, txtMenuItem[i].callback, {
            width: 100, // 指定菜单项的宽度
            id: "menu" + i // 指定菜单项dom的id
          })
        );
      }
      this.map.addContextMenu(menu);
@@ -570,7 +573,6 @@
  flex-direction: column;
  box-sizing: border-box;
  height: 100%;
}
.pie-item {
  flex: 1;