lishifeng
2020-08-29 c397b64555e1d3eda1ea28a29bff86ca536f1aa2
提交5
7个文件已修改
532 ■■■■■ 已修改文件
package-lock.json 156 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/api.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/realTime.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/realTime.vue 151 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 196 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login.vue 8 ●●●● 补丁 | 查看 | 原始文档 | 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"
          }
        }
      }
@@ -7523,6 +7594,11 @@
        "minimist": "^1.2.5"
      }
    },
    "moment": {
      "version": "2.27.0",
      "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz",
      "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ=="
    },
    "move-concurrently": {
      "version": "1.0.1",
      "resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz",
@@ -11080,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.1.0",
          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
          "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
          "dev": true,
          "optional": true,
          "requires": {
            "has-flag": "^4.0.0"
          }
        }
      }
    },
package.json
@@ -13,6 +13,7 @@
    "echarts": "^4.8.0",
    "element-ui": "^2.13.2",
    "js-md5": "^0.7.3",
    "moment": "^2.27.0",
    "vue": "^2.6.11",
    "vue-jsonp": "^0.1.8",
    "vue-layer": "^1.2.0",
@@ -41,7 +42,9 @@
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
    "rules": {
      "no-unused-vars": "off"
    }
  },
  "browserslist": [
    "> 1%",
src/assets/js/api.js
@@ -114,6 +114,18 @@
    })
}
/* 设置站点名   无参*/
export const addMapSetdian = () => {
    return axios({
        method: "post",
        url: "/yckj/zijing_sx/BattMap_informationAction!serchNotInBattMapByUid",
        data: null
    })
}
/**
 * 查询地图机房信息(结果中有机房的位置信息)
 * 参数:json = {"StationName1":"北京市","StationName2":"市辖区","StationName5":"海淀区"}
src/assets/js/realTime.js
@@ -45,8 +45,8 @@
export const realTimeGroup = (params) => {
    return axios({
        method: "post",
        url: "/yckj/zijing_sx/Batt_rtstateAction_serchByCondition?rtstate.battGroupId=" + params,
        data: params
        url: "/yckj/zijing_sx/Batt_rtstateAction_serchByCondition",
        data: "rtstate.battGroupId="+params
    })
}
src/pages/dataTest/realTime.vue
@@ -1,46 +1,44 @@
<template>
  <flex-layout direction="row" class="page-real-time">
    <home-list slot="header"
    @toggleChange="toggleChange"
    @leaf-click="leafClick"></home-list>
    <home-list slot="header" @toggleChange="toggleChange" @leaf-click="leafClick"></home-list>
    <content-box style="margin-left: 4px; margin-right: 4px;" :title="battFullName">
      <flex-layout>
        <div class="content-header" slot="header">
        <div class="content-header" slot="header" :model="inputs">
          <div class="table-layout">
            <div class="table-row">
              <div class="table-cell text-right w80">电池状态:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.batt_state" size="small" :disabled="true"></el-input>
              </div>
              <div class="table-cell text-right w80">端电压:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.group_online_vol" size="small" :disabled="true"></el-input>
              </div>
              <div class="table-cell text-right w80">电池电流:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.group_curr" size="small" :disabled="true"></el-input>
              </div>
              <div class="table-cell text-right w80">更新日期:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.rec_datetime" size="small" :disabled="true"></el-input>
              </div>
            </div>
            <div class="table-row">
              <div class="table-cell text-right w80">测试时长:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.batt_test_tlong" size="small" :disabled="true"></el-input>
              </div>
              <div class="table-cell text-right w80">测试容量:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.batt_test_cap" size="small" :disabled="true"></el-input>
              </div>
              <div class="table-cell text-right w80">剩余容量:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.batt_syrl_cap" size="small" :disabled="true"></el-input>
              </div>
              <div class="table-cell text-right w80">续航时长:</div>
              <div class="table-cell">
                <el-input placeholder size="small" :disabled="true"></el-input>
                <el-input :value="backInputs.sysc" size="small" :disabled="true"></el-input>
              </div>
            </div>
          </div>
@@ -57,7 +55,7 @@
              <bar-chart ref="res" id="res" unit="mΩ"></bar-chart>
            </el-tab-pane>
            <el-tab-pane label="温度" name="temp">
              <bar-chart ref="temp" id="temp"></bar-chart>
              <bar-chart ref="temp" id="temp" unit="℃"></bar-chart>
            </el-tab-pane>
            <el-tab-pane label="电导" name="conduct">
              <bar-chart ref="conduct" id="conduct"></bar-chart>
@@ -66,7 +64,7 @@
              <bar-chart ref="curr" id="curr"></bar-chart>
            </el-tab-pane>
            <el-tab-pane label="数据表格" name="tblData">
              <el-table border size="small" :data="table.data" height="100%">
              <el-table border size="small" :data="table.datas" height="100%">
                <el-table-column
                  v-for="header in table.headers"
                  :key="header.prop"
@@ -86,11 +84,11 @@
<script>
import ContentBox from "../../components/ContentBox";
import HomeList from './HomeList';
import HomeList from "./HomeList";
import BarChart from "../../components/chart/BarChart";
import { realTimeSearch } from "../../assets/js/realTime";
import { realTimeSearch, realTimeGroup } from "../../assets/js/realTime";
import moment from "moment";
let vol, res, temp, conduct, curr;
export default {
  components: {
@@ -100,6 +98,16 @@
  },
  data() {
    return {
      /* 电池状态 模块 组端展示 */
      inputs: {
        group_vol: 0 /* 端电压-组端电压 */,
        online_vol: 0 /* 端电压-在线电压 */,
        group_curr: 0 /* 电池电流 */,
        batt_test_tlong: "0:00:00" /* 测试时长 */,
        rec_datetime: 0 /* 更新日期 */,
        batt_test_cap: 0 /* 测试容量 */,
        batt_state: 0 /* 电池状态 */
      },
      battFullName: "电池组全称",
      acTabs: "vol",
      table: {
@@ -135,9 +143,14 @@
            width: ""
          }
        ],
        data: [
        datas: [
          {
            num1: "#1"
            num1: 0,
            vol1: 0,
            res1: 0,
            temp1: 0,
            conduct1: 0,
            curr1: 0
          }
        ]
      },
@@ -262,33 +275,62 @@
    },
    leafClick(data) {
      this.batt = data;
      /*   console.log('this.batt',this.batt); */
      this.realTimeGroupss();
      this.realTimeSearch();
    },
    /* 实时组端信息 */
    realTimeGroupss() {
      var batt = this.batt;
      realTimeGroup(batt.BattGroupId).then(res => {
        let rsa = JSON.parse(res.data.result);
        /*   console.log("rsa", rsa); */
        this.inputs = rsa.data[0];
        console.log("this.inputs", this.inputs);
      });
    },
    /* echars图表 */
    realTimeSearch() {
      var batt = this.batt;
      realTimeSearch({
        BattGroupId: batt.BattGroupId
      }).then(res => {
        let rs = JSON.parse(res.data.result);
        console.log("rs", rs);
        /*   console.log("rs", rs); */
        /* 数据表格 */
        let vovo = {};
        if (rs.code == 1) {
          this.vovo = rs.data.map(item => {
            return {
              num1: "#" + item.mon_num,
              vol1: item.mon_vol,
              res1: item.mon_res,
              temp1: item.mon_tmp
            };
          });
        }
        this.table.datas = this.vovo;
        // 电压值
        let volTemp = [];
        let volTempVol = [];
        if (rs.code == 1) {
          volTemp = rs.data.map(item => {
          volTempVol = rs.data.map(item => {
            return ["#" + item.mon_num, item.mon_vol];
          });
        }
        vol.series[0].data = volTemp;
        vol.series[0].data = volTempVol;
        // 内阻
        let volTempres = [];
        /*     let volTempres = [];
        if (rs.code == 1) {
          volTempres = rs.data.map(item => {
            return ["#" + item.mon_num, item.mon_res];
          });
          console.log("volTempres", volTempres);
        }
        /*  res.series[0].data = volTempres;  */
        res.series[0].data = volTempres; */
        // 温度
        let volTempte = [];
@@ -296,8 +338,8 @@
          volTempte = rs.data.map(item => {
            return ["#" + item.mon_num, item.mon_tmp];
          });
          console.log("volTempte", volTempte);
        }
        temp.series[0].data = volTempte;
        // 更新电压图表
@@ -305,6 +347,61 @@
        this.$refs.res.setOption(res);
        this.$refs.temp.setOption(temp);
      });
    },
    // 计算续航时长方法  顶部组端
    sethoubeiTime(value) {
      value = Math.abs(value);
      var str = "";
      if (value > 0) {
        var hour = parseInt(value);
        var min = parseInt((parseFloat(value) - hour) * 60);
        if (hour < 10) {
          str = "0";
        }
        str += hour + "H";
        if (min < 10) {
          str += "0";
        }
        str += min + "M";
      } else {
        str = "00H00M";
      }
      return str;
    }
  },
  computed: {
    backInputs() {
      const obj = {
          0: "未知",
          1: "浮充",
          2: "充电",
          3: "放电",
          4: "均充"
        },
        list = {};
      list.batt_state = obj[this.inputs.batt_state];
      list.group_online_vol = `在线:${this.inputs.online_vol.toFixed(
        2
      )}V;组端:${this.inputs.group_vol.toFixed(2)}V`;
      list.group_curr = this.inputs.group_curr.toFixed(2) + "A";
      list.rec_datetime = this.inputs.rec_datetime;
      list.batt_test_tlong = this.inputs.batt_test_tlong;
      list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "Ah";
      if (this.inputs.batt_state === 2) {
        list.batt_syrl_cap = "---";
      } else {
        list.batt_syrl_cap = this.inputs.batt_test_cap.toFixed(1) + "Ah";
      }
      if (this.inputs.batt_state === 3) {
        list.sysc = this.sethoubeiTime(
          parseFloat(this.inputs.batt_rest_cap) /
            parseFloat(this.inputs.group_curr)
        );
      } else {
        list.sysc = "------";
      }
      return list;
    }
  },
  mounted() {
src/pages/index.vue
@@ -48,7 +48,10 @@
  searchStation,
  searchMapStation,
  searchBattInfo,
  searchAlarm
  searchAlarm,
  addMapStation,
  searchMap,
  addMapSetdian
} from "@/assets/js/api";
let chart1, chart2, chart3, chart4;
@@ -60,59 +63,14 @@
  },
  data() {
    return {
      lat:null,
      lng:null,
      marker:null,
      infoWindow :null,
      map:null,
      panTo:null,
      /*   data: [
        {
          id: "湖北省",
          label: "湖北省",
          children: [
            {
              id: "湖北省-武汉市",
              label: "武汉市",
              children: [
                {
                  id: "湖北省-武汉市-东西湖区",
                  label: "东西湖区",
                  children: [
                    {
                      id: "湖北省-武汉市-东西湖区-测试机房",
                      label: "测试机房"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          id: "河南省",
          label: "河南省",
          children: [
            {
              id: "河南省-驻马店市",
              label: "驻马店市",
              children: [
                {
                  id: "河南省-驻马店市-驿城区",
                  label: "驿城区",
                  children: [
                    {
                      id: "河南省-驻马店市-驿城区-测试机房",
                      label: "测试机房",
                      children: []
                    }
                  ]
                }
              ]
            }
          ]
        }
      ] */
      lat: 0, //维度
      lng: 0, //经度
      marker: null,
      infoWindow: null,
      map: null,
      panTo: null,
      point: null,
      obj: null,
      defaultProps: {
        label: "label",
@@ -129,33 +87,37 @@
  methods: {
    initMap() {
      // 按住鼠标右键,修改倾斜角和角度
       this.map = new BMapGL.Map("allmap"); // 创建Map实例
      var point = new BMapGL.Point(this.lat,this.lng);
      this.map.centerAndZoom(point, 15); // 初始化地图,设置中心点坐标和地图级别
      this.map = new BMapGL.Map("allmap"); // 创建Map实例
      this.point = new BMapGL.Point(this.lng, this.lat); // 创建点坐标
      this.map.centerAndZoom(this.point, 15); // 初始化地图,设置中心点坐标和地图级别
      this.map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放
      this.map.setHeading(64.5);
      this.map.setTilt(73);
       this.marker = new BMapGL.Marker(point); // 创建点
      this.marker = new BMapGL.Marker(this.point); // 创建点
      this.map.addOverlay(this.marker); // 将标注添加到地图中
      var opts = {
        width: 350, // 信息窗口宽度
        height: 150, // 信息窗口高度
        title:
          '<p style="font-size: 16px;color: black;margin:2px;margin-bottom: 20px;">湖北省-鄂州市-东方世纪城-设备1  </p>', // 信息窗口标题
          '<p style="font-size: 16px;color: black;margin:2px;margin-bottom: 20px;">贵阳省-贵阳市-南明区-紫晶办事处-设备1  </p>', // 信息窗口标题
        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>',
        '<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>',
        opts
      ); // 创建信息窗口对象
      this.marker.addEventListener("click", function() {
        this.map.openInfoWindow(this.infoWindow, point); //开启信息窗口
      );
      // 创建信息窗口对象
      this.map.openInfoWindow(this.infoWindow, this.map.getCenter()); // 打开信息窗口
      this.onCLickMap(); //点击事件获取坐标
      /* 可托拽的标注 */
      this.marker.enableDragging();
      this.marker.addEventListener("dragend", function(e) {
        console.log("当前位置:" + e.point.lng + ", " + e.point.lat);
      });
      /*   this.marker.addEventListener("click", function(){
this.map.openInfoWindow(this.infoWindow,114.31899932245216 ,30.58005640282491   )//当点击当前的标注的时候打开创建的信息窗口
}); */
      /* 右键菜单 */
      var menu = new BMapGL.ContextMenu();
@@ -181,7 +143,7 @@
        {
          text: "放置到最大级",
          callback: function() {
           this.map.setZoom(18);
            this.map.setZoom(18);
          }
        },
        {
@@ -192,10 +154,38 @@
        },
        {
          text: "设置机房",
          callback: function(point) {
            this.marker = new BMapGL.Marker(point);
             this.map.pointToPixel(point);
            this.map.addOverlay(this.marker);
          async callback(node) {
            // this.marker = new BMapGL.Marker(point);
            // this.map.pointToPixel(point);
            // this.map.addOverlay(this.marker);
            console.log("node...", node);
             //查询已添加到地图的机房
          /*   const data = await searchMap({
              adata: { alm_cleared_type: 0, alm_id: 1 },
              bplan: { discharge_reason: 3 }
            });
            console.log("data.....", data); */
         const addSetdian = await addMapSetdian(); //设置站点名
           /*  console.log("addSetdian.....", addSetdian);  */
                 const addSetmap =JSON.parse(addSetdian.data.result).data
                 console.log('addSetmap',addSetmap);
            const res = await addMapStation({
              //添加地图上的机房
              StationName1: node.StationName1,
              StationName2: node.StationName2,
              StationName5: node.StationName5,
              StationName3: node.StationName3,
              Address: this.address,
              longitude: node.lng,
              latitude: node.lat,
              information: ""
            });
       /*  this.marker = new BMapGL.Marker(); // 创建点
       this.map.addOverlay(this.marker); // */
            console.log("res", res);
          }
        }
      ];
@@ -241,7 +231,6 @@
        /* console.log("cityList", cityList); */
      } else if (node.level === 2) {
        /* 查询区县 */
        const county = await searchCounty({
          StationName1: node.parent.data.label,
          StationName2: node.data.label
@@ -289,6 +278,7 @@
          StationName2: node.parent.parent.data.label,
          StationName5: node.parent.data.label
        }),
        /*  查询电池组信息 */
        searchBattInfo({
          StationName1: node.parent.parent.parent.data.label,
@@ -297,12 +287,12 @@
          StationName3: node.data.label
        })
      ]);
      //console.log('areaRoom',areaRoom);
      if (areaRoom.data.result && JSON.parse(areaRoom.data.result).code == 0) {
        return this.$message.error(JSON.parse(areaRoom.data.result).msg);
      }
      console.log('batteryList',batteryList);
      console.log("areaRoom", areaRoom);
      console.log("batteryList", batteryList);
      if (
        batteryList.data.result &&
        JSON.parse(batteryList.data.result).code == 0
@@ -310,14 +300,18 @@
        return this.$message.error(JSON.parse(batteryList.data.result).msg);
      }
      const list = JSON.parse(areaRoom.data.result).data;
      let obj = list.find(item => item.StationName3 == node.data.label);
      console.log('obj',obj);
      if (obj.longitude == 0 && obj.latitude == 0) {
      this.obj = list.find(item => item.StationName3 == node.data.label);
      console.log("obj", this.obj); //机房坐标
      if (this.obj.longitude == 0 && this.obj.latitude == 0) {
        this.$message.warning("机房未定位");
      }else{
       // this.batteryList = JSON.parse(batteryList.data.result).data; //电池组数目
       this.marker.setPosition(new BMapGL.Point(obj.latitude, obj.longitude))
      /*  this.panTo(this.lat,this.lng) */
      } else {
        this.batteryList = JSON.parse(batteryList.data.result).data; //电池组数目
        /* 图标移动位置 */
        this.marker.setPosition(
          new BMapGL.Point(this.obj.longitude, this.obj.latitude)
        );
        /* 地图移动位置 */
        this.map.panTo(new BMapGL.Point(this.obj.longitude, this.obj.latitude));
      }
    },
    //树形控件点击事件
@@ -447,7 +441,7 @@
      ]);
      /*  console.log('battGood',battGood); */
      /*    console.log('battState',battState); */
    /*   console.log("Alarm", Alarm); */
      /*   console.log("Alarm", Alarm); */
      if (battGood.status !== 200) {
        return this.$message.error(battGood.statusText);
      }
@@ -472,25 +466,35 @@
    // 通过IP获取当前经纬度
    async getLocationByIp() {
      // 获取到经纬度坐标后
      const ipRes = await this.$jsonp(
        "http://api.map.baidu.com/location/ip",
        {
          ak: "AWqwD701uOy6kaLIxBY2NDjATvE6x5IG",
          coor:"bd09ll",
          output: "jsonp"
        }
      );
      this.lat = ipRes.content.point.x;
      this.lng = ipRes.content.point.y;
      console.log('ipRes',ipRes)
       // 创建地图
      const ipRes = await this.$jsonp("http://api.map.baidu.com/location/ip", {
        ak: "AWqwD701uOy6kaLIxBY2NDjATvE6x5IG",
        coor: "bd09ll",
        output: "jsonp"
      });
      this.address = ipRes.address; //地址
      this.lng = ipRes.content.point.x; //经度
      this.lat = ipRes.content.point.y; //纬度
      console.log("ipRes", ipRes);
      // 创建地图
      this.$nextTick(() => {
        this.initMap();
      });
    },
    onCLickMap() {
      this.map.addEventListener("click", function(e) {
        console.log(
          "lng",
          e.latlng.lng,
          "lat",
          e.latlng.lat,
          "cityName",
          e.currentTarget.cityName
        );
      });
    }
  },
  mounted() {
    this.getLocationByIp() // 通过IP获取当前经纬度
    this.getLocationByIp(); // 通过IP获取当前经纬度
    this.getBatteryData(); // 初始化饼状图
  }
};
src/pages/login.vue
@@ -30,7 +30,7 @@
</template>
<script>
import { login } from "@/assets/js/api";
import { login,initDBPool,checkLoginSession } from "@/assets/js/api";
export default {
  data() {
@@ -49,6 +49,12 @@
    };
  },
  methods: {
    /* 初始化连接池  检测后台session*/
  async woData(){
       const [pool,sessions] =await Promise.all([initDBPool,checkLoginSession ])
            console.log('pool',pool);
               console.log('sessions',sessions);
   },
    onSubmit() {
      this.$refs.loginFormRef.validate(async valid => {
        if (!valid) return;