whyczyk
2022-05-05 5a087f3a8f6db1f6344dc4a79af2e4c85d27cf1b
2.0 接口对接
15个文件已修改
5个文件已添加
2458 ■■■■■ 已修改文件
src/assets/js/axios.js 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/websocket/getWsUrl.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/websocket/index.js 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/websocket/plus.js 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/units/function/getConduct.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/units/function/getQgth.js 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/units/function/getSpecialPointIndex.js 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/units/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/global/common.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmMager/batteryrHistoryquery.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmMager/batteryrTimequery.vue 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmMager/deviceHistoryquery.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmMager/deviceTimequery.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/alarmMager/js/api.js 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login/js/api.js 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login/login.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/monitoring/history-monitoring.vue 367 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/monitoring/js/api.js 222 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/monitoring/real-monitoring.vue 1316 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/axios.js
@@ -1,36 +1,18 @@
import Vue from 'vue';
import axios from 'axios';
import rejectReplay from "@/assets/js/tools/rejectReplay";
if (process.env.NODE_ENV == 'dev') {
    // 跨域请求
    axios.defaults.baseURL = 'http://localhost:8919/fg/';
    // axios.defaults.baseURL = 'http://localhost:8919/fg/';
    axios.defaults.baseURL = 'http://localhost:8091/fg/';
    axios.defaults.withCredentials = true;  // 保持请求头
} else {
    axios.defaults.baseURL = location.protocol + '//' + location.host + '/fg/';
}
let skipUrls = ["Server_stateAction_action_getTimestamp"];
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
    // 防重放操作
    let rejectReplayStr = rejectReplay();
    let url = config.url;
    let isIn = false;
    for(let i=0; i<skipUrls.length; i++) {
        let skipUrl = skipUrls[i];
        if(skipUrl == url) {
            isIn = true;
            break;
        }
    }
    if(!isIn) {
        if (url.indexOf("?") == -1) {
            url = url.trim() + "?" + rejectReplayStr;
        } else {
            url = url.trim() + "&" + rejectReplayStr;
        }
    }
    config.url = url;
    // 在发送请求之前做些什么
    return config;
}, function (error) {
src/assets/js/websocket/getWsUrl.js
New file
@@ -0,0 +1,15 @@
/**
 * 获取Websocket的连接
 * @param action
 * @returns {string}
 */
function getWsUrl(action, port) {
  let _port = port ? port : 8091;
  let hostname = window.location.hostname;
  if (process.env.NODE_ENV == 'dev') {
    hostname = "localhost";
  }
  return 'ws://' + hostname + ':' + _port + '/fg/' + action;
}
export default getWsUrl;
src/assets/js/websocket/index.js
New file
@@ -0,0 +1,77 @@
import getWsUrl from './getWsUrl';
export default function (url) {
  const wsUri = getWsUrl(url);
  // 重连时间间隔 默认10秒
  const reConnectDelay = 10 * 1000;
  return {
    data() {
      return {
        SOCKET: null,
        reConnectDelay,
        timer: null
      }
    },
    computed: {
      isWSOpen () {
        return !!(this.SOCKET && 1 == this.SOCKET.readyState);
      }
    },
    methods: {
      // 打开链接
      openSocket() {
        // 初始化WebSocket
        this.WSClose();
        this.WSInit();
      },
      // 初始化
      WSInit() {
        // 未被初始化初始化
        if (!this.isWSOpen) {
          console.log('=====WSinit, url:', wsUri);
          this.SOCKET = new WebSocket(wsUri);
          this.SOCKET.onmessage = this.onWSMessage;
          this.SOCKET.onopen = this.onWSOpen;
          this.SOCKET.onerror = this.onWSError;
          this.SOCKET.onclose = this.WSClose;
        }
      },
      onWSOpen() {
      },
      onWSMessage() {
      },
      onWSError(Event) {
        console.log('链接失败', wsUri);
        this.WSClose(Event);
      },
      WSClose(Event) {
        if (this.isWSOpen) {
          console.log('链接关闭', wsUri, Event);
          this.SOCKET.close();
          this.SOCKET = null;
          // 没有event对象 则为手动关闭
          if (Event) {
            this.reConnect();
          }
        }
      },
      // 重连
      reConnect () {
        // 重连计时开始 就不另重连
        if (this.timer) {
          return;
        }
        this.timer = setTimeout(() => {
          this.timer = null;
          this.WSInit();
        }, this.reConnectDelay);
      }
    },
    mounted () {
      this.openSocket();
    },
    beforeDestroy() {
      this.WSClose();
    }
  }
}
src/assets/js/websocket/plus.js
New file
@@ -0,0 +1,82 @@
import getWsUrl from './getWsUrl';
/**
 * @param  {...any} urls 地址可以传多个 用来初始化多个不同的websocket实例
 * 对应的websocket对象及事件都带上对应的系号 this.SOCKET1  onWSMessage1 等
 * @returns minxins对象
 */
export default function (...urls) {
  let data = {},
    computed = {},
    ourl = {},
    methods = {},
    len = urls.length;
  const fn = () => { };
  for (let i = 0; i < len; i++) {
    let idx = i + 1;
    data['SOCKET' + idx] = null;
    ourl[idx] = getWsUrl(urls[i]);
    computed['isWSOpen' + idx] = function () {
      // console.log(this, 'computed=====this');
      return !!(this['SOCKET' + idx] && 1 == this['SOCKET' + idx].readyState);
    }
    methods['onWSMessage' + idx] = fn;
    methods['onWSOpen' + idx] = fn;
    methods['onWSError' + idx] = (() => {
      return () => {
        console.log('链接失败', ourl[idx])
      }
    })(idx);
    methods['WSClose' + idx] = function () {
      if (this['isWSOpen' + idx]) {
        this['SOCKET' + idx].close();
      }
    }
  }
  return {
    data() {
      return {
        ...data
      }
    },
    computed: {
      ...computed
    },
    methods: {
      ...methods,
      // 打开链接
      openSocket() {
        // 初始化WebSocket
        this.WSClose();
        this.WSInit();
      },
      // 初始化
      WSInit() {
        // 未被初始化初始化
        for (let i = 0; i < len; i++) {
          let idx = i + 1;
          if (!this['isWSOpen' + idx]) {
            console.log('=====WSinit, url:', ourl[idx]);
            this['SOCKET' + idx] = new WebSocket(ourl[idx]);
            this['SOCKET' + idx].onmessage = this['onWSMessage' + idx];
            this['SOCKET' + idx].onopen = this['onWSOpen' + idx];
            this['SOCKET' + idx].onerror = this['onWSError' + idx];
            this['SOCKET' + idx].onclose = this['WSClose' + idx];
          }
        }
      },
      WSClose() {
        for (let i = 0; i < len; i++) {
          let idx = i + 1;
          this['WSClose' + idx]();
        }
      }
    },
    mounted() {
      this.openSocket();
    },
    beforeDestroy() {
      this.WSClose();
    }
  }
}
src/assets/units/function/getConduct.js
New file
@@ -0,0 +1,11 @@
/**
 * 获取电导的算法
 * @param res   内阻
 * @param vol   实际电压
 * @returns {number}    电导值
 */
function getConduct(res, vol) {
    return res?((1000/res)*(vol/2)).toHold(0):0;
}
export default getConduct;
src/assets/units/function/getQgth.js
src/assets/units/function/getSpecialPointIndex.js
New file
@@ -0,0 +1,76 @@
// 获取数据集的特殊点
function getSpecialPointIndex(data) {
    let rs = {
        code: 0,            // 标识是否找到驼峰锅底
        min: -Infinity,     // 锅底所在的点
        minVal: 0,
        max: Infinity,      // 驼峰所在的点
        maxVal: 0,
    };
    if(data.length < 20) {
        rs.code = 0;
        return rs;
    }
    for(let i=0; i<data.length; i++) {
        let item = data[i];
        // 检查当前点是否为锅底
        if(rs.min == -Infinity) {
            let isLow = true;
            for(let k=i-3; k<=i+3; k++) {
                if(k==i) {
                    continue;
                }
                if(data[k] == undefined || data[k]<item) {
                    rs.min = -Infinity;
                    isLow = false;
                    break;
                }
            }
            if(isLow) {
                rs.min = i;
                rs.minVal = item;
            }
        }
        // 检查是否为驼峰
        if(rs.min != -Infinity && rs.max == Infinity) {
            let isHigh = true;
            for(let k=i-2; k<=i+2; k++) {
                if(k==i) {
                    continue;
                }
                if(data[k] == undefined || data[k]>=item) {
                    rs.max = Infinity;
                    isHigh = false;
                    break;
                }
            }
            if(isHigh) {
                rs.max = i;
                rs.maxVal = item;
            }
        }
    }
    if(rs.min != -Infinity && rs.max == Infinity) {
        let index = data.length - 10;
        rs.max = index;
        rs.maxVal = data[index];
    }
    // 未找到锅底
    if(rs.min == -Infinity) {
        rs.code = 0;
    }else {
        rs.code = 1;
    }
    // 驼峰出现在锅底的前面
    if(rs.max < rs.min) {
        rs.code = 0;
    }
    return rs;
}
export default getSpecialPointIndex;
src/assets/units/index.js
@@ -61,6 +61,13 @@
// 获取Qt,Qg,Qh和电池性能的值
import getQgth from './function/getQgth'
// 获取电导的算法
import getConduct from './function/getConduct'
// 获取数据集的特殊点
import getSpecialPointIndex from './function/getSpecialPointIndex'
export default {
    deepClone,
    deepMerge,
@@ -83,4 +90,6 @@
    GetMonomerCap,
    GetHourRate,
    getQgth,
    getConduct,
    getSpecialPointIndex,
}
src/global/common.js
@@ -1,4 +1,3 @@
import store from "@/store";
//格式化时间
Date.prototype.format = function (format) {
    var o = {
@@ -26,18 +25,3 @@
    hold = Number(hold);
    return hold;
};
/* eslint-disable */
; (function (doc, win) {
    let docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
            let clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            let fontSize = 20 * (clientWidth / 1920);
            docEl.style.fontSize = fontSize + 'px';
        };
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
src/pages/alarmMager/batteryrHistoryquery.vue
@@ -126,9 +126,9 @@
<script>
import {
    dataType /* 维护区 */,
    searchProvince /* 维护区 */,
    roomsStation /* 机房站点 */,
    batterySeach /* 蓄电池组 */,
    batterySearch /* 蓄电池组 */,
    historySeroom /*告警信息 */,
    hisDelet /*删除 */
} from "@/pages/alarmMager/js/api"
@@ -264,7 +264,7 @@
    methods: {
        /* 维护区 */
        async vindicateData() {
            const resType = await dataType();
            const resType = await searchProvince();
            let typeList = JSON.parse(resType.data.result).data.map((item) => {
                return {
                    label: item,
@@ -301,7 +301,7 @@
            this.selectLable3 = "";
            this.showPicker2 = false
            // 构造查询条件
            const batteryss = await batterySeach({
            const batteryss = await batterySearch({
                UNote: this.selectValue1,
                UName: this.selectValue2,
            });
src/pages/alarmMager/batteryrTimequery.vue
@@ -114,7 +114,7 @@
            <van-picker show-toolbar :columns="newRoms" value-key="label" @confirm="storageBatterys" @cancel="showPicker2 = false" title="机房站点" />
        </van-popup>
        <van-popup v-model="showPicker3" round position="bottom">
            <van-picker show-toolbar :columns="options" value-key="BattGroupName" @confirm="selectBatter" @cancel="showPicker3 = false" title="蓄电池组" />
            <van-picker show-toolbar :columns="options" value-key="battGroupName" @confirm="selectBatter" @cancel="showPicker3 = false" title="蓄电池组" />
        </van-popup>
        <div class="refBtn" @click="onRefresh">
            <van-icon name="replay" />
@@ -124,9 +124,9 @@
<script>
import {
    dataType /* 维护区 */,
    searchProvince /* 维护区 */,
    roomsStation /* 机房站点 */,
    batterySeach /* 蓄电池组 */,
    batterySearch /* 蓄电池组 */,
    newsAlarm /*告警信息 */,
    deletionRecord /* 删除 */,
    reporTemergency /* 确认告警 */,
@@ -261,8 +261,8 @@
    methods: {
        /* 维护区 */
        async vindicateData() {
            const resType = await dataType();
            let typeList = JSON.parse(resType.data.result).data.map((item) => {
            const resType = await searchProvince();
            let typeList = resType.data.data.map((item) => {
                return {
                    label: item,
                    value: item,
@@ -276,10 +276,11 @@
        /* 机房站点 */
        async computerSite() {
            const roomsSeation = await roomsStation({
                UNote: this.selectValue1,
                stationName1: this.selectValue1,
            });
            if (roomsSeation.data.result) {
                let newRoms = JSON.parse(roomsSeation.data.result).data.map((item) => {
            let res = roomsSeation.data;
            if (res.code) {
                let newRoms = res.data.map((item) => {
                    return {
                        label: item,
                        value: item,
@@ -298,13 +299,14 @@
            this.selectLable3 = "";
            this.showPicker2 = false
            // 构造查询条件
            const batteryss = await batterySeach({
                UNote: this.selectValue1,
                UName: this.selectValue2,
            const batteryss = await batterySearch({
                stationName1: this.selectValue1,
                stationName: this.selectValue2,
            });
            if (batteryss.data.result) {
                let options = JSON.parse(batteryss.data.result).data.map((item) => {
                    item.BattGroupName = `${item.BattGroupName}-${item.MonCount}节`;
            let res = batteryss.data;
            if (res.code) {
                let options = res.data.map((item) => {
                    item.battGroupName = `${item.battGroupName}-${item.monCount}节`;
                    return item;
                });
                this.options = options;
@@ -324,8 +326,8 @@
        //选择电池组
        selectBatter(value) {
            if (value) {
                this.selectValue3 = value.BattGroupId
                this.selectLable3 = value.BattGroupName
                this.selectValue3 = value.battGroupId
                this.selectLable3 = value.battGroupName
            }
            this.showPicker3 = false
@@ -359,45 +361,33 @@
            });
            // 一级和二级告警
            params.num = this.checkbox.Level_one_warn.bol ? 1 : 0;
            params.BattGroupId = this.checkbox.Level_two_warn.bol ? 2 : 0;
            params.battGroupId = this.checkbox.Level_two_warn.bol ? 2 : 0;
            // 上限和下限告警
            params.alm_id = this.checkbox.alm_id.bol ? 1 : 100;
            params.alm_signal_id = this.checkbox.alm_signal_id.bol ? 0 : 100;
            let postData = {
                bmd: {
                almIdOne: params.usr_id,
                almIdTwo: params.fault_type_id,
                almIdThree: params.uname,
                almIdFour: params.fault_level,
                almIdFive: params.record_uid,
                almIdSix: params.maint_type_id,
                almIdSeven: params.maint_close,
                almIdEight: params.maint_done,
                almIsConfirmed: 0,
                almLevelFour: params.appoint_uid,
                almLevelOne: params.Level_one_warn,
                almLevelThree: params.master_audit,
                almLevelTwo: params.Level_two_warn,
                almSignalIdOne: params.alm_id,
                almSignalIdTwo: params.alm_signal_id,
                battGroupId: this.selectValue3 ? this.selectValue3 : 0,
                    page: {
                        pageSize: tab.page.pageSize,
                        pageCurr: tab.page.pageCurr,
                    },
                    binf: {
                        StationName1: this.selectValue1,
                        stationName: this.selectValue2,
                        BattGroupId: this.selectValue3 ? this.selectValue3 : 0,
                    },
                    mainf: {
                        usr_id: params.usr_id,
                        fault_type_id: params.fault_type_id,
                        uname: params.uname,
                        fault_level: params.fault_level,
                        record_uid: params.record_uid,
                        maint_type_id: params.maint_type_id,
                        maint_close: params.maint_close,
                        master_id: "0",
                        maint_done: params.maint_done,
                        num: params.num,
                        BattGroupId: params.BattGroupId,
                        master_audit: params.master_audit,
                        appoint_uid: params.appoint_uid,
                        fault_type: params.fault_type,
                    },
                    adata: {
                        MonNum: "0",
                        Record_Id: "0",
                        alm_id: params.alm_id,
                        alm_signal_id: params.alm_signal_id,
                        alm_is_confirmed: this.active,
                    },
                },
                stationname: this.selectValue2,
                stationname1: this.selectValue1,
            }
            newsAlarm(postData).then((res) => {
                const resData = JSON.parse(res.data.result);
@@ -409,7 +399,7 @@
                            item.battery1 =
                                item.binf && item.binf.StationName ? item.binf.StationName : "";
                            item.tes1 =
                                item.binf && item.binf.BattGroupName ? item.binf.BattGroupName : "";
                                item.binf && item.binf.battGroupName ? item.binf.battGroupName : "";
                            item.tester1 =
                                item.binf && item.binf.StationName8 ? item.binf.StationName8 : "";
                            item.current1 =
src/pages/alarmMager/deviceHistoryquery.vue
@@ -101,7 +101,7 @@
<script>
import {
    dataType /* 维护区 */,
    searchProvince /* 维护区 */,
    roomsStation /* 机房站点 */,
    deviceRecord /*告警信息 */,
    deviceArarmdel
@@ -161,7 +161,7 @@
    methods: {
        /* 维护区 */
        async vindicateData() {
            const resType = await dataType();
            const resType = await searchProvince();
            let typeList = JSON.parse(resType.data.result).data.map((item) => {
                return {
                    label: item,
src/pages/alarmMager/deviceTimequery.vue
@@ -97,7 +97,7 @@
<script>
import {
    dataType /* 维护区 */,
    searchProvince /* 维护区 */,
    roomsStation /* 机房站点 */,
    deviceAlarm /*告警信息 */,
    deviceOk,
@@ -158,7 +158,7 @@
    methods: {
        /* 维护区 */
        async vindicateData() {
            const resType = await dataType();
            const resType = await searchProvince();
            let typeList = JSON.parse(resType.data.result).data.map((item) => {
                return {
                    label: item,
src/pages/alarmMager/js/api.js
@@ -2,51 +2,56 @@
import qs from 'qs'
/*  页面加载时查询维护区中的枢纽类型
无参
/**
 * 页面加载时查询维护区 省
 * BattInfAction!serchAllStationName1 // 旧
 * 无参
*/
export const dataType = () => {
export const searchProvince = () => {
    return axios({
        method: "post",
        url: "User_battgroup_baojigroup_battgroupAction!serchStationName1InGroup",
        method: "GET",
        url: "battInf/searchAllStationName1",
        data: null
    });
}
/**
 * 根据维护区查询机房站点 (含包机组)
 * battInf/searchStationNameInGroup
 * {
 * stationName1 省
 * }
*/
export const roomsStation = (data) => {
    return axios({
        method: "GET",
        url: "battInf/searchStationNameInGroup",
        params: data,
        data: null
    })
}
/* 根据维护区查询机房站点
json={"UNote":""}
/**
 * 根据维护区和机房查询蓄电池组
 * {"stationName1":"省","stationName":"机房名称"}
*/
export const roomsStation = (data) => {
export const batterySearch = (data) => {
    return axios({
        method: "post",
        url: "User_battgroup_baojigroup_battgroupAction!serchStationNameInGroup",
        data: "json=" + JSON.stringify(data)
    })
}
/* 根据维护区和机房查询蓄电池组
json={"UNote":"","UName":""} */
export const batterySeach = (data) => {
    return axios({
        method: "post",
        url: "User_battgroup_baojigroup_battgroupAction!serchBattgroupidInGroup",
        data: "json=" + JSON.stringify(data)
    })
        method: "GET",
        url: "battInf/searchBattgroupidInGroup",
        params: data,
        data: null
    });
}
//查询当前的告警信息    
/*
bmd.page.pageCurr=1&bmd.page.pageSize=10&bmd.binf.StationName1=&bmd.binf.
stationName=&bmd.binf.BattGroupId=0&bmd.mainf.usr_id=0&bmd.mainf.fault_type_id=119002&bmd.mainf.
fault_level=119003&bmd.mainf.record_uid=119004&bmd.adata.MonNum=0&bmd.adata.Record_Id=0&bmd.mainf.
maint_type_id=119005&bmd.mainf.maint_close=119007&bmd.mainf.master_id=0&bmd.mainf.maint_done=119006&bmd.adata.
alm_id=1&bmd.adata.alm_signal_id=0&bmd.mainf.num=1&bmd.mainf.BattGroupId=2&bmd.mainf.master_audit=3&bmd.mainf.appoint_uid=4
*/
//查询当前的告警信息
export const newsAlarm = (data) => {
    return axios({
        method: "post",
        url: "Battalarm_dataAction!serchByCondition",
        data: qs.stringify(data, { allowDots: true })
        method: "POST",
        url: "Battalarm_dataAction/serchByCondition",
        data
    })
}
src/pages/login/js/api.js
@@ -6,39 +6,43 @@
 * 参数 "uinf.UName="+用户名+"&uinf.Upassword="+密码+"&uinf.UId="+是否记住密码(0,1)
 * 密码需要使用hex_md5加密
 */
export const login = (username, password, verity) => {
export const login = (userName, password, deliveredCode) => {
    return axios({
        method: "post",
        url: `LoginAction_login?uinf.UName=${username}&uinf.Upassword=${encodeURIComponent(encodeURIComponent(formatPassword(password)))}&uinf.UNote=${verity}&uinf.UId=0`,
        data: null
        url: 'login/loginByRSA',
        params: {
            userName,
            password: encodeURIComponent(formatPassword(password)),
            deliveredCode
        }
    });
};
/**
 * 获取登录用的验证码
 * MessageAction!getFontDynamicCode // 旧
 */
export const getLoginVerity = () => {
    return axios({
        method: "post",
        url: `MessageAction!getFontDynamicCode`,
        data: null
        method: "GET",
        url: 'message/getFontDynamicCode'
    });
};
}
//查询系统名称
export const searchPlatformName = () => {
    return axios({
        method: 'post',
        url: 'PageParamAction!findByCategoryId',
        data: 'json=' + JSON.stringify({ categoryId: 5 })
    })
}
        method: 'GET',
        url: '/pageParam/allList',
        params: { categoryId: 5 }
    });
};
//查询系统名称
export const getRealTabsConfig = (type) => {
    type = type ? type : 1;
    return axios({
        method: 'post',
        url: 'PageParamUserAction!getAll',
        data: "json=" + JSON.stringify({
            type,
        })
        method: 'GET',
        url: '/pageParamUser/allList',
        params: { type: type }
    })
}
src/pages/login/login.vue
@@ -42,9 +42,9 @@
        searchPlatformName() {
            searchPlatformName()
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    let rs = res.data;
                    if (rs.code == 1) {
                        let data = rs.data[0];
                        let data = rs.data["1"][0];
                        this.platformName = data.param;
                    } else {
                        this.platformName = "蓄电池后台监控管理平台";
@@ -84,7 +84,7 @@
        },
        changeVerifyCode() {
            getLoginVerity().then(res => {
                let rs = JSON.parse(res.data.result);
                let rs = res.data;
                if (rs.code == 1) {
                    this.verifyCode = rs.data + "";
                } else {
@@ -97,12 +97,12 @@
        // 登录验证
        handleLogin(res) {
            // 关闭等待
            // this.loading = false;
            let rs = JSON.parse(res.data.result);
            let rs = res.data;
            if (rs.code == 1) {
                sessionStorage.setItem('username', this.username);
                this.$store.dispatch("user/login", rs);
                this.$store.dispatch("user/login", rs.data2[0]);
                this.initPageConfig()
            } else {
                this.changeVerifyCode();
                this.$toast(rs.msg);
@@ -110,9 +110,13 @@
        },
        initPageConfig() {
            getRealTabsConfig().then(res => {
                let rs = JSON.parse(res.data.result);
                let rs = res?.data?.data || [];
                let arr = []
                for (let key in rs) {
                    arr.push(...rs[key])
                }
                // 设置pageConfig
                this.$store.dispatch('user/changeRealTabsConfig', rs.data);
                this.$store.dispatch('user/changeRealTabsConfig', arr);
                this.$toast("登录成功!");
                this.$router.push({
                    path: '/menu'
src/pages/monitoring/history-monitoring.vue
@@ -46,7 +46,7 @@
                <div class="commonTitle">
                    <div class="label">测试容量:</div>
                    <div class="text">
                        {{top.test_cap}}
                        {{top.testCap}}
                    </div>
                </div>
                <div class="commonTitle" v-if="!isLD9">
@@ -122,8 +122,8 @@
import getSpecialPointIndex from "@/assets/js/tools/getSpecialPointIndex";
import const_ld_nine from "@/assets/js/const/const_ld_nine";
import {
    searchStation,
    searchBattInfo,
    getAllStations,
    getBattList,
    getBattGroupInfo,
    searchAll_lowAction,
    searchBattresdata,
@@ -233,7 +233,7 @@
                group: "", // 端电压
                curr: "", // 电池电流
                test_long: "", // 测试时长
                test_cap: "", // 测试容量
                testCap: "", // 测试容量
                re_cap: "", // 剩余容量
                xuhang: "" // 续航时长
            },
@@ -326,19 +326,19 @@
                    {
                        value: "herongDischarge",
                        text: "核容测试",
                        test_type: 1,
                        testType: 1,
                        children: []
                    },
                    {
                        value: "jianceDischarge",
                        text: "监测放电",
                        test_type: 3,
                        testType: 3,
                        children: []
                    },
                    {
                        value: "jianceCharge",
                        text: "监测充电",
                        test_type: 4,
                        testType: 4,
                        children: []
                    },
                ],
@@ -346,8 +346,8 @@
            slider: 100,
            testTimeLong: [],
            battState: {
                test_type: -100,
                stop_reason: ''
                testType: -100,
                stopReason: ''
            },
            monBarTitle: "最大值=0V;最小值=0V;平均值=0V",
            monCurrTitle: "电池电流折线图(A)",
@@ -423,8 +423,8 @@
    computed: {
        battFullName() {
            let batt = this.batt;
            if (batt.StationName && batt.BattGroupName) {
                return batt.StationName + "-" + batt.BattGroupName;
            if (batt.stationName && batt.battGroupName) {
                return batt.stationName + "-" + batt.battGroupName;
            }
            return "电池组全称";
        },
@@ -432,10 +432,10 @@
            let battState = this.battState;
            if (this.isLD9) {
                let res = "";
                switch (battState.test_type) {
                switch (battState.testType) {
                    case 1:
                    case 3:
                        res = "放电 (终止原因:" + battState.stop_reason + ")";
                        res = "放电 (终止原因:" + battState.stopReason + ")";
                        break;
                    case 4:
                        res = "充电";
@@ -446,10 +446,10 @@
                }
                return res;
            } else {
                if (battState.test_type == 3) {
                    return "放电(终止原因:" + battState.stop_reason + ")";
                } else if (battState.test_type == 2) {
                    return "充电"
                if (battState.testType == 3) {
                    return "放电(终止原因:" + battState.stopReason + ")";
                } else if (battState.testType == 2) {
                    return "充电";
                } else {
                    return "";
                }
@@ -516,13 +516,13 @@
                group: "", // 端电压
                curr: "", // 电池电流
                test_long: "", // 测试时长
                test_cap: "", // 测试容量
                testCap: "", // 测试容量
                re_cap: "", // 剩余容量
                xuhang: "---" // 续航时长
            };
            // 初始化电池状态
            this.battState.test_type = -100;
            this.battState.testType = -100;
            // 初始化图表
            this.initChart();
@@ -531,32 +531,33 @@
        searchBattTestData() {
            let batt = this.batt;
            searchBattTestData({
                num: batt.FBSDeviceId,
                BattGroupId: batt.BattGroupId
                // num: batt.fbsdeviceId,
                battGroupId: batt.battGroupId,
            })
                .then(res => {
                    // 解析数据
                    let rs = JSON.parse(res.data.result);
                    let rs = res.data;
                    let herongDischarge = []; // 核容放电
                    let herongCharge = []; // 核容充电
                    let jianceDischarge = []; // 监测放电
                    let jianceCharge = []; // 监测充电
                    if (rs.code == 1) {
                        rs.data.forEach(item => {
                            item.text = item.test_starttime
                            item.value = item.test_starttime
                            if (item.test_type == 3) {
                        rs.data.list.forEach(item => {
                            item.value = item.testStarttime;
                            item.text = item.testStarttime;
                            item.label = item.testStarttime;
                            if (item.testType == 3) {
                                // 测试类型为放电
                                if (item.test_starttype == 3) {
                                if (item.testStarttype == 3) {
                                    //  核容放电
                                    herongDischarge.push(item);
                                } else {
                                    // 监测放电
                                    jianceDischarge.push(item);
                                }
                            } else if (item.test_type == 2) {
                            } else if (item.testType == 2) {
                                // 测试类型为充电
                                if (item.test_starttype == 3) {
                                if (item.testStarttype == 3) {
                                    //  核容充电
                                    herongCharge.push(item);
                                } else {
@@ -587,29 +588,30 @@
        searchLD9TestData() {
            let batt = this.batt;
            getLD9TestList({
                BattGroupId: batt.BattGroupId,
                battGroupId: batt.battGroupId,
            })
                .then(res => {
                    // 解析数据
                    let rs = JSON.parse(res.data.result);
                    let rs = res.data;
                    let herongDischarge = []; // 核容测试
                    let jianceDischarge = []; // 监测放电
                    let jianceCharge = []; // 监测充电
                    if (rs.code == 1) {
                        rs.data.forEach((item) => {
                            item.value = item.test_starttime;
                            item.text = item.test_starttime;
                        rs.data.list.forEach((item) => {
                            item.value = item.testStarttime;
                            item.text = item.testStarttime;
                            let list = item.ld9testdata.map((v) => {
                                v.test_type = item.test_type;
                                v.testType = item.testType;
                                v.recordNum = v.recordNums;
                                return {
                                    text: "电池单体#" + v.test_monnum,
                                    value: v.test_monnum,
                                    text: "电池单体#" + v.testMonnum,
                                    value: v.testMonnum,
                                    value1: v
                                };
                            });
                            item.children = list;
                            switch (item.test_type) {
                            switch (item.testType) {
                                case 1:
                                    herongDischarge.push(item);
                                    break;
@@ -624,6 +626,7 @@
                    } else {
                        this.$toast("未获取到充放电记录");
                    }
                    debugger
                    // 充放电记录
                    this.test_record2.list[0].children = herongDischarge;
                    this.test_record2.list[1].children = jianceDischarge;
@@ -698,13 +701,13 @@
            if (testRecord != -1) {
                let num = testRecord.record_num / this.show_num;    // 根据粒度查询数据
                if (this.isLD9) {
                    this.battState.test_type = testRecord.test_type;
                    this.currMonNum = testRecord.test_monnum;
                    this.battState.testType = testRecord.testType;
                    this.currMonNum = testRecord.testMonnum;
                    //查询LD9历史数据
                    this.getLD9TestRecord(testRecord)
                } else {
                    // 查询历史数据
                    this.searchHistory(testRecord.BattGroupId, testRecord.test_record_count, num);
                    this.searchHistory(testRecord.battGroupId, testRecord.testRecordCount, num);
                }
            }
@@ -718,43 +721,43 @@
                ])
                .then(
                    this.$axios.spread((...res) => {
                        let res0 = JSON.parse(res[0].data.result);
                        let res1 = JSON.parse(res[1].data.result);
                        let res2 = JSON.parse(res[2].data.result);
                        let res0 = res[0].data;
                        let res1 = res[1].data;
                        let res2 = res[2].data;
                        this.loading = false;
                        // 放电数据
                        if (res0.code) {
                            this.HistoryData = res0.data;
                            this.HistoryData = res0.data.list;
                            // 格式化数据
                            this.formateHisData(res0.data);
                            this.formateHisData(res0.data.list);
                            // this.searchBattresdata();
                        }
                        // 组端数据
                        if (res1.code) {
                            let data = res1.data[0];
                            let data = res1.data.list[0];
                            this.grpData = data;
                            allData.groupVol = data.group_vol;
                            allData.testCurr = data.test_curr;
                            allData.testCap = data.test_cap;
                            allData.test_timelong = data.test_timelong;
                            allData.groupVol = data.groupVol;
                            allData.testCurr = data.testCurr;
                            allData.testCap = data.testCap;
                            allData.testTimelong = data.testTimelong;
                            this.setLD9TopData();
                            const obj = const_ld_nine.test_stopreason;
                            this.battState.test_type = data.test_type;
                            this.battState.stop_reason = obj[data.test_stopreason] || "未知";
                            const obj = const_ld_nine.stopReason;
                            this.battState.testType = data.testType;
                            this.battState.stopReason = obj[data.stopReason] || "未知";
                        }
                        // 所有单体的实际容量数据
                        let monBarVol = [];
                        if (res2.code) {
                            let data = res2.data;
                            let data = res2.data.list;
                            monBarChart.series[0].data = monBarVol;
                            let batt = this.batt;
                            for (let i = 1, j = batt.MonCount; i <= j; i++) {
                                monBarVol.push(["#" + i, 0]);
                            }
                            data.forEach((v) => {
                                let idx = v.test_monnum - 1;
                                monBarVol[idx][1] = v.test_cap;
                                let idx = v.testMonnum - 1;
                                monBarVol[idx][1] = v.testCap.toHold(1);
                            });
                        }
                        this.setLD9BarChart();
@@ -808,28 +811,27 @@
                result = this.test_record2.value1;
            }
            // 设置电池状态
            this.battState.test_type = result.test_type;
            this.battState.testType = result.testType;
            if (!this.isLD9) {
                this.battState.stop_reason = result.test_stoptype_reason;
                this.battState.stopReason = result.test_stoptype_reason || '未知';
            }
            // 返回结果集
            return result;
        },
        // 查询历史信息
        searchHistory(BattGroupId, count, num) {
        searchHistory(battGroupId, count, num) {
            this.loading = true;
            this.$nextTick(() => {
                searchHistory({
                    BattGroupId: BattGroupId,
                    test_record_count: count,
                    data_new: Math.floor(num)
                    battGroupId: battGroupId,
                    testRecordCount: count,
                }).then(res => {
                    this.loading = false;
                    let rs = JSON.parse(res.data.result);
                    let rs = res.data;
                    let data = [];
                    // 数据
                    if (rs.code == 1) {
                        data = rs.data;
                        data = rs.data.list;
                    }
                    this.HistoryData = data
                    // 格式化数据
@@ -844,24 +846,29 @@
        },
        // 格式化历史信息数据
        formateHisData(data) {
            let record_time = -1; // 记录时间
            let record_num = -100; // 记录笔数
            allData.endData = data[data.length - 1];
            data.forEach(item => {
                let mon_num = item.mon_num;
                let testTimeLong = this.$units.formatSeconds(item.test_timelong);
            let filterData = data.filter((item, i) => {
                if (item.recordNum % this.show_num == 0) {
                    return item;
                }
            });
            let recordTime = -1; // 记录时间
            let recordNum = -100; // 记录笔数
            allData.endData = filterData[filterData.length - 1];
            filterData.forEach((item) => {
                let monNum = item.monNum;
                let testTimeLong = this.$units.formatSeconds(item.testTimelong);
                // 获取组端电压,在线电压,组端电流的信息和开辟一个单体柱状图
                if (record_num != item.record_num) {
                    record_time = item.record_time;
                    record_num = item.record_num;
                    allData.groupVol.push([testTimeLong, item.group_vol]);
                    allData.onlineVol.push([testTimeLong, item.online_vol]);
                    allData.testCurr.push([testTimeLong, item.test_curr]);
                if (recordNum != item.recordNum) {
                    recordTime = item.recordTime;
                    recordNum = item.recordNum;
                    allData.groupVol.push([testTimeLong, item.groupVol]);
                    allData.onlineVol.push([testTimeLong, item.onlineVol]);
                    allData.testCurr.push([testTimeLong, item.testCurr]);
                    allData.recordTime.push(testTimeLong);
                    allData.testTimeLong.push(item.test_timelong);
                    allData.testCap.push(item.test_cap);
                    allData.testTimeLong.push(item.testTimelong);
                    allData.testCap.push(item.testCap);
                    allData.dataList.push(item);
                    this.testTimeLong.push(item.test_timelong);
                    this.testTimeLong.push(item.testTimelong);
                    // 开辟空间
                    monBarData.vol.push([]);
                    monBarData.temp.push([]);
@@ -870,45 +877,39 @@
                    monBarData.preCap.push([]);
                }
                // 单体电压柱状图设置
                let mon_num_text = "#" + mon_num;
                let monNum_text = "#" + monNum;
                let monBarVol = monBarData.vol[monBarData.vol.length - 1];
                monBarVol.push([mon_num_text, item.mon_vol]);
                monBarVol.push([monNum_text, item.monVol]);
                // 单体温度柱状图
                let monBarTemp = monBarData.temp[monBarData.temp.length - 1];
                monBarTemp.push([mon_num_text, item.mon_tmp]);
                monBarTemp.push([monNum_text, item.monTmp]);
                // 设置单体折线图信息
                if (typeof monLineData.vol[mon_num - 1] != "object") {
                    let index = mon_num - 1;
                if (typeof monLineData.vol[monNum - 1] != "object") {
                    let index = monNum - 1;
                    // 开辟空间
                    monLineData.vol[index] = [];
                    monLineData.temp[index] = [];
                    monLineData.resCap[index] = [];
                }
                // 获取到需要使用的空间
                let monLineVol = monLineData.vol[mon_num - 1];
                monLineVol.push([testTimeLong, item.mon_vol]);
                let monLineVol = monLineData.vol[monNum - 1];
                monLineVol.push([testTimeLong, item.monVol]);
                let monLineTemp = monLineData.temp[mon_num - 1];
                monLineTemp.push([testTimeLong, item.mon_tmp]);
                let monLineTemp = monLineData.temp[monNum - 1];
                monLineTemp.push([testTimeLong, item.monTmp]);
            });
            if (this.isLD9) {
                // 初始化图表的配置项
                this.initLD9ChartOptions();
                // 设置折线图表
                this.setLineChart();
            } else {
                // 初始化图表的配置项
                this.initChartOptions();
                // 设置容量
                this.setCapList();
                // 设置折线图表
                this.setLineChart();
                // 执行滑动事件
                this.sliderInput();
            }
        },
        setCapList() {
            let batt = this.batt;
@@ -920,13 +921,13 @@
                });
                let max_vol = Math.max.apply(null, vol_list);
                for (let j = 0; j < vol_list.length; j++) {
                    let avg_curr = batt_test_evary_record[i].test_timelong > 0 ? batt_test_evary_record[i]
                        .test_cap * 3600 / batt_test_evary_record[i].test_timelong : batt_test_evary_record[i]
                        .test_curr;
                    let avg_curr = batt_test_evary_record[i].testTimelong > 0 ? batt_test_evary_record[i]
                        .testCap * 3600 / batt_test_evary_record[i].testTimelong : batt_test_evary_record[i]
                        .testCurr;
                    let actionvalue = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr),
                        batt_test_evary_record[i].test_cap, max_vol, vol_list[j], batt.MonVolStd, 1);
                        batt_test_evary_record[i].testCap, max_vol, vol_list[j], batt.MonVolStd, 1);
                    let restvalue = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr),
                        batt_test_evary_record[i].test_cap, max_vol, vol_list[j], batt.MonVolStd, 0);
                        batt_test_evary_record[i].testCap, max_vol, vol_list[j], batt.MonVolStd, 0);
                    let batt_num_text = "#" + (j + 1);
                    monBarData.realCap[i].push([batt_num_text, actionvalue.toFixed(0)]);
                    monBarData.resCap[i].push([batt_num_text, restvalue.toFixed(0)]);
@@ -960,8 +961,8 @@
            this.top.group = "组端:" + groupVol.toFixed(2) + "V";
            this.top.curr = testCurr.toFixed(1) + "A";
            this.top.test_cap = testCap.toFixed(1) + "AH";
            this.top.test_long = this.$units.formatSeconds(allData.test_timelong);
            this.top.testCap = testCap.toFixed(1) + "AH";
            this.top.test_long = this.$units.formatSeconds(allData.testTimelong);
        },
        // 设置顶部文本框的数据
        setTopData() {
@@ -982,15 +983,22 @@
                    groupVol[index][1].toFixed(2) +
                    "V";
                this.top.curr = testCurr[index][1].toFixed(1) + "A";
                this.top.test_cap = testCap[index].toFixed(1) + "AH";
                this.top.testCap = testCap[index].toFixed(1) + "AH";
                // 剩余容量
                let monVol = monVols[index];
                let list = dataList[index];
                let avg_curr = list.test_timelong > 0 ? list.test_cap * 3600 / list.test_timelong : list.test_curr;
                let avg_curr = list.testTimelong > 0 ? list.testCap * 3600 / list.testTimelong : list.testCurr;
                let batNum = this.$units.getBarNum(monVol);
                let over_cap = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr),
                    list.test_cap, batNum.max, batNum.min, batt.MonVolStd, 0);
                this.top.re_cap = over_cap.toFixed(1) + 'AH';
                let over_cap = this.$units.GetMonomerCap(
                    batt.monCapStd,
                    this.$units.GetHourRate(batt.monCapStd, avg_curr),
                    list.testCap,
                    batNum.max,
                    batNum.min,
                    batt.monVolStd,
                    0
                );
                this.top.re_cap = over_cap.toFixed(1) + "AH";
            }
            // 设置续航时长
@@ -999,12 +1007,22 @@
                // 实际容量
                let monVol = monVols[lastIndex];
                let list = dataList[lastIndex];
                let avg_curr = list.test_timelong > 0 ? list.test_cap * 3600 / list.test_timelong : list.test_curr;
                let avg_curr =
                    list.testTimelong > 0
                        ? (list.testCap * 3600) / list.testTimelong
                        : list.testCurr;
                let batNum = this.$units.getBarNum(monVol);
                let real_cap = this.$units.GetMonomerCap(batt.MonCapStd, this.$units.GetHourRate(batt.MonCapStd, avg_curr),
                    list.test_cap, batNum.max, batNum.min, batt.MonVolStd, 1);
                let xuhang = batt.Load_curr ? real_cap / batt.Load_curr : 0;
                this.top.xuhang = xuhang ? this.$units.sethoubeiTime(xuhang) : '---';
                let real_cap = this.$units.GetMonomerCap(
                    batt.monCapStd,
                    this.$units.GetHourRate(batt.monCapStd, avg_curr),
                    list.testCap,
                    batNum.max,
                    batNum.min,
                    batt.monVolStd,
                    1
                );
                let xuhang = batt.loadCurr ? real_cap / batt.loadCurr : 0;
                this.top.xuhang = xuhang ? this.$units.sethoubeiTime(xuhang) : "---";
            }
            let testTimeLong = this.testTimeLong;
@@ -1017,15 +1035,15 @@
        // 设置内阻信息
        searchBattresdata() {
            let batt = this.batt;
            searchBattresdata(batt.BattGroupId).then(res => {
                let rs = JSON.parse(res.data.result);
            searchBattresdata(batt.battGroupId).then(res => {
                let rs = res.data;
                if (rs.code == 1) {
                    let data = rs.data;
                    let data = rs.data.list;
                    for (let i = 0; i < data.length; i++) {
                        let item = data[i];
                        let battNumText = '#' + item.mon_num;
                        monBarData.jh_curr.push([battNumText, item.mon_JH_curr]);
                        monBarData.res.push([battNumText, item.mon_res]);
                        let battNumText = "#" + item.monNum;
                        monBarData.jh_curr.push([battNumText, item.monJhCurr]);
                        monBarData.res.push([battNumText, item.monRes]);
                    }
                }
            }).catch(error => {
@@ -1034,12 +1052,12 @@
        },
        //查询站点信息
        searchStation() {
            searchStation({
                StationName1: "",
                StationName2: "",
                StationName5: "",
            getAllStations({
                stationName1: "",
                stationName2: "",
                stationName5: "",
            }).then((res) => {
                let rs = JSON.parse(res.data.result);
                let rs = res.data;
                let data = [];
                if (rs.code == 1) {
                    data = rs.data;
@@ -1056,13 +1074,13 @@
            // 遍历数据构造树状
            data.forEach(item => {
                // 省
                let provice = this.addData(result, item.StationName1);
                let provice = this.addData(result, item.stationName1);
                // 市
                let city = this.addData(provice.children, item.StationName2, provice);
                let city = this.addData(provice.children, item.stationName2, provice);
                // 区县
                let county = this.addData(city.children, item.StationName5, city);
                let county = this.addData(city.children, item.stationName5, city);
                // 机房
                let home = this.addData(county.children, item.StationName3, county, item);
                let home = this.addData(county.children, item.stationName3, county, item);
            });
            // 设置树状列表
            this.options = result;
@@ -1107,9 +1125,9 @@
            this.getBattGroupInfo(this.cascaderValue)
        },
        //查询电池组信息
        getBattGroupInfo(BattGroupId) {
            getBattGroupInfo(BattGroupId).then(res => {
                let rs = JSON.parse(res.data.result);
        getBattGroupInfo(battGroupId) {
            getBattGroupInfo(battGroupId).then(res => {
                let rs = res.data;
                if (rs.code == 1) {
                    this.leafClick(rs.data[0]);
                } else {
@@ -1123,18 +1141,13 @@
        onChange(select) {
            if (select.tabIndex == 3) {
                let objs = select.selectedOptions[select.selectedOptions.length - 1];
                searchBattInfo({
                    StationName1: objs.data.StationName1,
                    StationName2: objs.data.StationName2,
                    StationName5: objs.data.StationName5,
                    StationName3: objs.data.StationName3
                }).then((res) => {
                    let rs = JSON.parse(res.data.result);
                getBattList(objs.data.stationId).then((res) => {
                    let rs = res.data;;
                    if (rs.code == 1) {
                        let data = rs.data;
                        data.map(item => {
                            item.text = item.StationName4 + '-' + item.BattGroupName
                            item.value = item.BattGroupId
                            item.text = item.stationName4 + '-' + item.battGroupName
                            item.value = item.battGroupId
                        })
                        this.options.map(item => {
                            item?.children.map(jtem => {
@@ -1434,14 +1447,16 @@
            // 根据allData.groupVol数据设置groupVolLineChart的值
            groupVolLineChart.series[0].data = allData.onlineVol;
            groupVolLineChart.series[1].data = allData.groupVol;
            let specialPoint = getSpecialPointIndex(allData.groupVol.map(item => {
            let specialPoint = this.$units.getSpecialPointIndex(
                allData.groupVol.map((item) => {
                return item[1];
            }));
                })
            );
            let markLine = {};
            this.groupVolQth.code = specialPoint.code;
            if (specialPoint.code && this.test_record.value[0] == "herongDischarge") {
                let batt = this.batt;
                let qgth = this.$units.getQgth(specialPoint, batt.MonVolStd * batt.MonCount);
                let qgth = this.$units.getQgth(specialPoint, batt.monVolStd * batt.monCount);
                this.groupVolTitle = qgth.title;
                // 设置groupVolQth
@@ -1456,24 +1471,24 @@
                this.groupVolQth.title = qgth.label;
                markLine = {
                    data: [{
                    data: [
                        {
                        label: {
                            show: true,
                            position: 'end',
                                position: "end",
                            formatter: [
                                '{a|' + allData.groupVol[specialPoint.min][0] + '}' + '{c|}',
                                '{b|锅底电压:' + allData.groupVol[specialPoint.min][1] + 'V}' + '{c|}'
                            ].join('\n'),
                                    "{a|" + allData.groupVol[specialPoint.min][0] + "}" + "{c|}",
                                    "{b|锅底电压:" +
                                    allData.groupVol[specialPoint.min][1] +
                                    "V}" +
                                    "{c|}",
                                ].join("\n"),
                            rich: {
                                a: {
                                },
                                b: {
                                },
                                    a: {},
                                    b: {},
                                c: {
                                    width: 60
                                }
                                        width: 60,
                                    },
                            },
                        },
                        xAxis: allData.groupVol[specialPoint.min][0],
@@ -1481,26 +1496,25 @@
                    {
                        label: {
                            show: true,
                            position: 'end',
                                position: "end",
                            formatter: [
                                '{c|}' + '{a|' + allData.groupVol[specialPoint.max][0] + '}',
                                '{c|}' + '{b|驼峰电压:' + allData.groupVol[specialPoint.max][1] + 'V}'
                            ].join('\n'),
                                    "{c|}" + "{a|" + allData.groupVol[specialPoint.max][0] + "}",
                                    "{c|}" +
                                    "{b|驼峰电压:" +
                                    allData.groupVol[specialPoint.max][1] +
                                    "V}",
                                ].join("\n"),
                            rich: {
                                a: {
                                },
                                b: {
                                },
                                    a: {},
                                    b: {},
                                c: {
                                    width: 80,
                                }
                                    },
                            },
                        },
                        xAxis: allData.groupVol[specialPoint.max][0],
                    }
                    ]
                        },
                    ],
                };
            } else {
                this.groupVolTitle = "端电压折线图(V)";
@@ -1663,12 +1677,14 @@
            return Math.floor(num * percent / 100) - 1;
        },
        searchAll_lowAction() {
            searchAll_lowAction().then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    this.low_list = rs.data;
            searchAll_lowAction()
                .then((res) => {
                    res = res.data;
                    if (res.code) {
                        this.low_list = res.data.list;
                }
            }).catch(error => {
                })
                .catch((error) => {
                console.log(error);
            });
        },
@@ -1684,9 +1700,10 @@
        },
    },
    mounted() {
        this.searchStation();
        // 初始化图表
        this.initChart();
        this.searchStation();
        this.searchAll_lowAction();
    },
}
src/pages/monitoring/js/api.js
@@ -1,117 +1,137 @@
import axios from "@/assets/js/axios";
/**
 * 查询机房信息
 * 参数:json = {"StationName1":"北京市","StationName2":"市辖区","StationName5":"海淀区"}
 * 查询站点名  带stationId fbsdeviceId (含包机组过滤)
 * stationName1
 * stationName2
 * stationName5
 * BattInfAction!serchAllStationName   // 旧
 */
export const searchStation = (params) => {
export const getAllStations = (params) => {
    return axios({
        method: "post",
        url: "BattInfAction!serchAllStationName",
        data: "json=" + JSON.stringify(params)
        method: 'GET',
        url: 'battInf/searchAllStationName',
        params
    })
}
/**
 * 查询电池组信息
 * 参数:json = {"StationName1":"北京市","StationName2":"市辖区","StationName5":"海淀区","StationName3":"紫晶科技机房"}
 * 根据机房id获取电池信息 机房下的电池组列表
 * stationId
 * BattInfAction!serchAllBattinf // 旧
 */
export const searchBattInfo = (params) => {
export const getBattList = (stationId) => {
    return axios({
        method: "post",
        url: "BattInfAction!serchAllBattinf",
        data: "json=" + JSON.stringify(params)
    })
        method: "GET",
        url: "battInf/findBattInfByStationId",
        params: {
            stationId
        }
    });
}
/**
 * 根据电池组ID查询电池组信息
 * @param data
 * BattInfAction!findByBattGroupId  // 旧
 * @returns {AxiosPromise}
 */
export const getBattGroupInfo = (params) => {
export const getBattGroupInfo = (battGroupId) => {
    return axios({
        method: 'post',
        url: 'BattInfAction!findByBattGroupId',
        data: 'bif.BattGroupId=' + params,
    })
        method: 'GET',
        url: 'battInf/findByBattGroupId',
        params: {
            battGroupId
        }
    });
}
/**
 * 查询电池告警参数
 * 参数:json={"dev_id":910000022}
 * Dev_paramAction!serchParamById // 旧
 * {devId}
 */
export const realTimeAlarm = (params) => {
    return axios({
        method: "post",
        url: "Dev_paramAction!serchParamById",
        data: "json=" + JSON.stringify(params)
        method: "GET",
        url: "Dev_paramAction/serchParamById",
        params
    })
}
/**
 * 根据设备id查询设备当前的开关状态
 * json={"dev_id":910000022}
 * {devId}
 * Fbs9100_stateAction_action_serchContactorState // 旧
 */
export const realTimePowerOff = (params) => {
    return axios({
        method: "post",
        url: "Fbs9100_stateAction_action_serchContactorState",
        data: "json=" + JSON.stringify(params)
        method: "GET",
        url: "Fbs9100_stateAction/serchContactorState",
        params
    })
}
/**
 * 根据电池组id查询该电池组中所有电池信息  (图表数据)
 * Batt_rtdataAction_serchByCondition // 旧
 * json={"BattGroupId":1005074}
 */
export const realTimeSearch = (params) => {
    return axios({
        method: "post",
        url: "Batt_rtdataAction_serchByCondition",
        data: "json=" + JSON.stringify(params)
        method: "GET",
        url: "Batt_rtdataAction/serchByCondition",
        params
    })
}
/**
 * 根据电池组id查询电池组实时组端信息
 * 参数:rtstate.battGroupId=1005074
 * Batt_rtstateAction_serchByCondition // 旧
 */
export const realTimeGroup = (params) => {
export const realTimeGroup = (battGroupId) => {
    return axios({
        method: "post",
        url: "Batt_rtstateAction_serchByCondition",
        data: "rtstate.battGroupId=" + params
        method: "GET",
        url: "BattRtstate/serchByCondition",
        params: {
            battGroupId
        }
    })
}
/**
 * 查询历史实时数据
 * @param json:{"dev_id":618500002}
 * @returns {AxiosPromise}
 * JhStateAction_action_serchByCondition // 旧
 * {devId}
 */
export const JhStateActionSerchByCondition = (params) => {
    // 查询后台
    return axios({
        method: "post",
        url: "JhStateAction_action_serchByCondition",
        data: "json=" + JSON.stringify(params)
    });
}
export const searchAll_lowAction = () => {
    return axios({
        method: "post",
        url: "Batt_param_lowAction_searchAll",
        data: null
    });
}
export const searchBattresdata = (BattGroupId) => {
    return axios({
        method: "post",
        url: "Batt_rtdataAction!serchResById",
        data: "json=" + JSON.stringify({
            BattGroupId: BattGroupId,
        })
        method: "GET",
        url: "JhStateAction/serchByCondition",
        params
    });
}
/**
 * Batt_param_lowAction_searchAll // 旧
 */
export const searchAll_lowAction = () => {
    return axios({
        method: "GET",
        url: "Batt_param_lowAction/searchAll"
    });
}
/**
 * 查询内阻信息
 * Batt_rtdataAction!serchResById // 旧
 */
export const searchBattresdata = (battGroupId) => {
    return axios({
        method: "GET",
        url: "Batt_rtdataAction/serchResById",
        params: {
            battGroupId
        }
    });
}
/**
 * 获取充放电记录
 * Batttestdata_infAction_searchBattTestInfDataById // 旧
 * 参数:json={"num":910000119,"BattGroupId":1005129}
 * 返回结果说明:
 * test_type==3&&test_starttype==3?核容放电:监测放电
@@ -123,22 +143,22 @@
export const searchBattTestData = (params) => {
    return axios({
        method: "post",
        url: "Batttestdata_infAction_searchBattTestInfDataById",
        data: "json=" + JSON.stringify(params)
        method: "POST",
        url: "Batttestdata_infAction/searchBattTestInfDataById",
        params
    })
}
/**
 * 查询LD9测试数据列表
 * Ld9testdata_infAction_ld9action_searchInfList
 * 参数:json={"BattGroupId":1005129}
 * {battGroupId}
 * Ld9testdata_infAction_ld9action_searchInfList // 旧
 */
export const getLD9TestList = (data) => {
export const getLD9TestList = (params) => {
    return axios({
        method: "post",
        url: "Ld9testdata_infAction_ld9action_searchInfList",
        data: 'json=' + JSON.stringify(data)
        method: "GET",
        url: "Ld9testdata_infAction/searchInfList",
        params
    });
}
@@ -156,60 +176,66 @@
/**
 * 查询历史数据
 * 参数: json={"BattGroupId":1005129,"test_record_count":"7"}
 * BatttestdataAction!findhistory // 旧
 * {"battGroupId":1005129,"testRecordCount":"7"}
 */
export const searchHistory = (params) => {
    params.data_new = params.data_new ? params.data_new : 1000;
    return axios({
        method: "post",
        url: "BatttestdataAction!findhistory",
        data: "json=" + JSON.stringify(params)
        method: "GET",
        url: "BatttestdataAction/findhistory",
        params
    })
}
/**
 * 查询LD9 单体测试数据
 * Ld9testdataAction_ld9action_serchByCondition
 * 参数:json={"BattGroupId":1000061,"test_record_count":39,"record_num":3,"test_monnum":1}
 * Ld9testdataAction_ld9action_serchByCondition // 旧
 * {"battGroupId":1000061,"testRecordCount":39,"recordNum":3,"testMonNum":1}
 */
export const getLD9Testdata = (data) => {
export const getLD9Testdata = (params) => {
    return axios({
        method: "post",
        url: "Ld9testdataAction_ld9action_serchByCondition",
        data: 'json=' + JSON.stringify(data)
        method: "GET",
        url: "Ld9testdataAction/serchByCondition",
        params
    });
}
/**
* 查询LD9测试组端数据
* Ld9testdatastopAction_ld9action_serchByInfo
* 参数:json={"BattGroupId":1000061,"test_record_count":39,"record_num":3,"test_monnum":1}
 * Ld9testdatastopAction_ld9action_serchByInfo // 旧
 * {"battGroupId":1000061,"testRecordCount":39,"record_num":3,"testMonNum":1}
*/
export const getLD9GrpTestdata = (data) => {
export const getLD9GrpTestdata = (params) => {
    return axios({
        method: "post",
        url: "Ld9testdatastopAction_ld9action_serchByInfo",
        data: 'json=' + JSON.stringify(data)
        method: "GET",
        url: "Ld9testdatastopAction/serchByInfo",
        params
    });
}
/**
 * 查询LD9 一次测试中所有单体的实际容量
 * Ld9testdatastopAction_ld9action_serchByCondition // 旧
 * {"battGroupId":1000061,"testRecordCount":39}
 */
export const getLD9MonCaps = (params) => {
    return axios({
        method: "GET",
        url: "Ld9testdatastopAction/serchByCondition",
        params
    });
}
/**
* 查询LD9 一次测试中所有单体的实际容量
* Ld9testdatastopAction_ld9action_serchByCondition
* 参数:json={"BattGroupId":1000061,"test_record_count":39}
 * 通过设备id查询LD9数据
 * {devId}
 * LD9_stateAction_ld9action_searchByDevId // 旧
 * @returns
*/
export const getLD9MonCaps = (data) => {
    return axios({
        method: "post",
        url: "Ld9testdatastopAction_ld9action_serchByCondition",
        data: 'json=' + JSON.stringify(data)
    });
}
export const realTimeLd9Data = (params) => {
    return axios({
        method: "post",
        url: "LD9_stateAction_ld9action_searchByDevId",
        data: "json=" + JSON.stringify(params)
        method: "GET",
        url: "LD9_stateAction/searchByDevId",
        params
    })
}
src/pages/monitoring/real-monitoring.vue
@@ -10,7 +10,7 @@
                <div class="commonTitle">
                    <div class="label">电池状态:</div>
                    <div class="text">
                        {{backInputs.batt_state}}
                        {{backInputs.battState}}
                    </div>
                </div>
                <div class="commonTitle">
@@ -22,25 +22,25 @@
                <div class="commonTitle">
                    <div class="label">电池电流:</div>
                    <div class="text">
                        {{backInputs.group_curr}}
                        {{backInputs.groupCurr}}
                    </div>
                </div>
                <div class="commonTitle">
                    <div class="label">更新日期:</div>
                    <div class="text">
                        {{backInputs.rec_datetime}}
                        {{backInputs.recDatetime}}
                    </div>
                </div>
                <div class="commonTitle">
                    <div class="label">测试时长:</div>
                    <div class="text">
                        {{backInputs.batt_test_tlong}}
                        {{backInputs.battTestTlong}}
                    </div>
                </div>
                <div class="commonTitle">
                    <div class="label">测试容量:</div>
                    <div class="text">
                        {{backInputs.batt_test_cap}}
                        {{backInputs.battTestCap}}
                    </div>
                </div>
                <div class="commonTitle">
@@ -118,16 +118,14 @@
<script>
import {
    searchStation,
    searchBattInfo,
    getAllStations,
    getBattList,
    getBattGroupInfo,
    realTimeAlarm,
    realTimePowerOff,
    realTimeSearch,
    realTimeGroup,
    JhStateActionSerchByCondition,
    realTimeLd9Data,
} from "@/pages/monitoring/js/api"
import createWs from "@/assets/js/websocket";
const WSMixin = createWs("RealTime");
import BarChart from "@/components/chart/BarChart";
import progressBlockVerticalBar from "@/components/chart/progress-block-vertical-bar";
import getMarkLineData from "@/components/chart/js/getMarkLineData";
@@ -135,8 +133,10 @@
import const_61850 from "@/assets/js/const/const_61850";
import const_9100 from "@/assets/js/const/const_9100";
import const_ld_nine from "@/assets/js/const/const_ld_nine";
let vol, resChart, temp, conduct, currChart, leakVol;
import { number } from 'echarts/lib/export';
let vol, resChart, temp, conduct, currChart, leakVol, monConnRes;
export default {
    mixins: [WSMixin],
    data() {
        let pageConfig = this.$store.getters["user/realTabsConfig"];
        let stateList = const_61850.stateList;
@@ -153,17 +153,16 @@
            options: [],
            /* 电池状态 模块 组端展示 */
            inputs: {
                group_vol: 0 /* 端电压-组端电压 */,
                online_vol: 0 /* 端电压-在线电压 */,
                group_curr: 0 /* 电池电流 */,
                batt_test_tlong: "0:00:00" /* 测试时长 */,
                rec_datetime: "1982-01-01 00:00:00" /* 更新日期 */,
                batt_test_cap: 0 /* 测试容量 */,
                batt_rest_cap: 0, // 剩余容量
                batt_state: 0 /* 电池状态 */
                groupVol: 0 /* 端电压-组端电压 */,
                onlineVol: 0 /* 端电压-在线电压 */,
                groupCurr: 0 /* 电池电流 */,
                battTestTlong: "0:00:00" /* 测试时长 */,
                recDatetime: "1982-01-01 00:00:00" /* 更新日期 */,
                battTestCap: 0 /* 测试容量 */,
                battRestCap: 0, // 剩余容量
                battState: 0 /* 电池状态 */
            },
            batt: {},
            timer: new this.$units.Timeout(),
            totolTable: [
                {
                    key: "input_vol_total",
@@ -328,6 +327,8 @@
                dropVol: 0, // 导通压降
                devType: 0, // 设备类型
            },
            fodHeaders: [],
            fodData: [],
        }
    },
    components: {
@@ -336,45 +337,75 @@
    },
    computed: {
        backInputs() {
            let obj = {
            let batt = this.batt;
            let isLd9 = this.isLd9;
            const obj = {
                0: "未知",
                1: "浮充",
                2: "充电",
                3: "放电",
                4: "均充",
            };
            let list = {
                batt_state: "未知",
                5: "内阻测试",
            },
                list = {
                    battState: "未知",
                group_online_vol: "在线:0.00V;组端:0.00V",
                group_curr: "0.00A",
                rec_datetime: "1982-01-01 00:00:00",
                batt_test_tlong: this.$units.formatSeconds(0),
                batt_test_cap: "0Ah",
                    groupCurr: "0.00A",
                    recDatetime: "1982-01-01 00:00:00",
                    battTestTlong: this.$units.formatSeconds(0),
                    battTestCap: "0Ah",
                batt_syrl_cap: "---",
                sysc: "------"
                    sysc: "------",
            };
            list.batt_state = obj[this.inputs.batt_state];
            list.group_online_vol =
                `在线:${this.inputs.online_vol.toFixed(
            if (this.diagram.type == -1) {
                return list;
            }
            let batt_state_text =
                this.diagram.powerCut && !isLd9
                    ? "停电放电"
                    : obj[this.inputs.battState];
            list.battState = batt_state_text + this.diagram.desc;
            if (this.$units.regEquipType(batt.fbsdeviceId, "BTS9605")) {
                list.group_online_vol = `组端:${this.inputs.groupVol.toFixed(2)}V`;
            } else {
                list.group_online_vol = `在线:${this.inputs.onlineVol.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.$units.formatSeconds(this.inputs.batt_test_tlong);
                )}V;组端:${this.inputs.groupVol.toFixed(2)}V`;
            }
            list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "AH";
            if (this.inputs.batt_state === 2) {
            list.groupCurr = this.inputs.groupCurr.toFixed(2) + "A";
            list.recDatetime = this.inputs.recDatetime;
            list.battTestTlong = this.$units.formatSeconds(this.inputs.battTestTlong);
            list.battTestCap = this.inputs.battTestCap.toFixed(1) + "AH";
            if (this.inputs.battState === 2) {
                list.batt_syrl_cap = "---";
            } else {
                list.batt_syrl_cap = this.inputs.batt_rest_cap.toFixed(1) + "AH";
                // 为0是不更新剩余容量
                if (this.inputs.battRestCap != 0) {
                    list.batt_syrl_cap = this.inputs.battRestCap.toFixed(1);
            }
            if (this.inputs.batt_state === 3) {
            }
            if (this.inputs.battState === 3) {
                // 为0是不更新续航时长
                if (this.inputs.battRestCap != 0) {
                list.sysc = this.$units.sethoubeiTime(
                    parseFloat(this.inputs.batt_rest_cap) /
                    parseFloat(this.inputs.group_curr)
                        parseFloat(this.inputs.battRestCap) /
                        parseFloat(this.inputs.groupCurr)
                );
                }
            } else {
                list.sysc = "------";
            }
            // 如果当前为锂电池
            let isLithium = this.$units.regEquipType(batt.fbsdeviceId, [
                "lithium",
                "lithiumPack",
            ]);
            if (isLithium) {
                list.batt_syrl_cap =
                    this.lithiumParams.analog.restCap.toFixed(1) + "AH";
            }
            return list;
        },
@@ -382,241 +413,82 @@
            let headers = this.table.headers;
            let tabConfig = this.pageConfig;
            let batt = this.batt;
            return headers.filter(item => {
            return headers.filter((item) => {
                let isShow = item.key1 ? tabConfig[item.key1] : true;
                if (item.type) {
                    isShow = this.$units.regEquipType(batt.FBSDeviceId, item.type);
                    isShow = this.$units.regEquipType(batt.fbsdeviceId, item.type);
                }
                return isShow;
            });
        }
        },
    },
    methods: {
        //定时器
        startTimer() {
            this.timer.start(() => {
                this.$axios
                    .all([
                        this.realTimeSearch(),
                        this.realTimeGroupss(),
                        this.realStateTimeData(),
                        this.search(),
                    ])
                    .then(() => {
                        this.timer.open();
                    })
                    .catch(() => {
                        this.timer.open();
                    });
            }, 3000);
        },
        search() {
            JhStateActionSerchByCondition({
                dev_id: this.batt.FBSDeviceId,
            })
                .then((res) => {
                    let resData = JSON.parse(res.data.result);
                    if (resData.code == 1) {
                        let dataObj = resData.data[0];
                        for (let key in dataObj) {
                            this.totolTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                            this.volTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                            this.eleTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                            this.otherTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                        }
                    }
                    // 设置输出电压柱状图
                    // this.$refs.outputVolList.setData({
                    //     title: {
                    //         show: true,
                    //         text: "输出电压",
                    //         x: "center",
                    //         textStyle: {
                    //             fontSize: "14",
                    //             color: '#323233'
                    //         }
                    //     },
                    //     name: "输出电压",
                    //     list: this.volTable,
                    // });
                })
                .catch((err) => {
                    console.log(err);
                });
        },
        //查询电池组信息
        getBattGroupInfo(BattGroupId) {
            getBattGroupInfo(BattGroupId).then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    this.leafClick(rs.data[0]);
                } else {
                    this.$toast('未获取到电池组的信息');
                }
            }).catch(error => {
                console.log(error);
            });
        },
        leafClick(data) {
            this.batt = data;
            this.realTimeAlarmss();
            this.table.headers = getTblHeader(data.FBSDeviceId);
            this.table.show = false;
            // 开启循环请求
            this.startTimer();
        },
        realStateTimeData() {
            let batt = this.batt;
            if (this.$units.regEquipType(batt.FBSDeviceId, ["LD9"])) {
                this.realTimeLd9Data();
            } else {
                this.realTimePowerOffs();
            }
        },
        /* 查询电路图开关状态和信息 */
        realTimePowerOffs() {
            let batt = this.batt;
            // 设备为61850显示右侧的面板
            if (this.$units.regEquipType(batt.FBSDeviceId, ["equip61850"])) {
                this.stateListShow = true;
            } else {
                this.stateListShow = false;
            }
            // 查询后台数据
            realTimePowerOff({
                dev_id: batt.FBSDeviceId,
            }).then((res) => {
                let rs = JSON.parse(res.data.result);
                let outTime = 2 * 60; //设备超时时间(2分钟)
                let isOutTime = true; //通讯中断        判断设备是否通讯中断    true:中断    false:正常
                if (rs.code == 1) {
                    let data = rs.data[0];
                    // 设置版本号
                    this.dev_version = data.dev_version;
                    // 基础信息
                    this.setEquipBase(data);
        realTimeLd9Data(res) {
            if (res) {
                // res = res.data;
                if (res.code && res.data) {
                    let data = res.data2;
                    // 判断是否超时
                    let outTime = 2 * 60; //设备超时时间(2分钟)
                    var nowTime = new Date(data.note).getTime(); //当前时间
                    var record = new Date(data.record_datetime).getTime();
                    var record = new Date(data.recordDatetime).getTime();
                    if (Math.abs(nowTime - record) / 1000 > outTime) {
                        this.disconnect();
                    } else {
                        // 未超时执行逻辑
                        let dev_id = batt.FBSDeviceId;
                        this.diagram.powerCut = 0;
                        // 设备为61850
                        if (this.$units.regEquipType(dev_id, "equip61850")) {
                            this.setEquip61850(data);
                        } else if (
                            this.$units.regEquipType(dev_id, ["BTS", "BTS9110", "BTS9120", "lithium", "LD9"])
                        ) {
                            this.setEquipBTS(data);
                        } else if (this.$units.regEquipType(dev_id, ["BTS9605", "BTS9611"])) {
                            this.setEquip9605(data);
                        } else {
                            this.disconnect();
                        }
                    }
                } else {
                    // 设置版本号
                    this.dev_version = "";
                    // 设备处于未连接
                    this.disconnect();
                }
            });
        },
        // 设置stateList的值
        setStateList(name, value, type) {
            let stateList = this.stateList;
            for (let i = 0; i < stateList.length; i++) {
                let state = stateList[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type ? type : "";
                }
            }
            let historyStateList = this.historyStateList;
            for (let i = 0; i < historyStateList.length; i++) {
                let state = historyStateList[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type ? type : "";
                }
            }
            for (let i = 0, list = this.lastCapacityTest, j = list.length; i < j; i++) {
                let state = list[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type || "";
                }
            }
        },
        // 9605设备
        setEquip9605(data) {
            let batt = this.batt;
            // 关闭遮罩层
            this.maskShow = false;
            //  电路图类型
            let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            let battstate = this.inputs.batt_state;
            let alarmstatus = data.dev_alarmstate;
            // 设置停电放电状态
            if (data.dev_onlinevollow) {
                this.inputs.batt_state = 5;
                this.diagram.type = 5;
                this.diagram.desc = "(开关闭合)";
                this.diagram.powerCut = 1;
                // 当前设备是BTS设备
                if (workstatus === 0 && data.dev_res_test_state !== 0) {
                    this.diagram.desc += "(内阻测试)";
                }
                return;
            }
            // 判断workstatus
            switch (workstatus) {
                        // 0-在线监测,1-核容测试,2-测试状态状态停止,3-内阻测试
                        switch (data.sys_state) {
                case 0:
                    this.diagram.type = 0;
                    //this.diagram.desc = '(开关闭合)';
                    // 当前设备是BTS设备
                    if (data.dev_res_test_state !== 0) {
                        this.diagram.type = 6;
                        this.diagram.desc += "(内阻测试)";
                    }
                    break;
                case 1:
                                let chargeMon = this.chargeMon;
                                let dischargeMon = this.dischargeMon;
                                // 存在放电和充电单体
                                if (dischargeMon != "" && chargeMon != "") {
                                    this.diagram.type = 6;
                                } else if (chargeMon != "") {
                                    // 存在充电单体
                                    this.diagram.type = 2;
                                } else {
                    this.diagram.type = 1;
                    //this.diagram.desc = '(开关断开)';
                                }
                    break;
                case 2:
                    this.diagram.type = 2;
                    //this.diagram.desc = '(开关断开)';
                                this.diagram.type = 0;
                    break;
                default:
                    this.diagram.type = -1;
                    this.maskShow = true;
                            case 3:
                                this.diagram.type = 3;
                                this.diagram.desc = "(内阻测试)";
                    break;
            }
                    }
                } else {
                    this.disconnect();
                }
            }
        },
        disconnect() {
            // 设备未连接
            this.diagram.type = -1;
            this.setStateList("workState", "未连接");
            this.diagram.temp = 0;
            // 通讯状态
            this.setStateList("connect", "异常", "table-row-error");
            // 温度
            this.setStateList("devTemp", "未知", "table-row-warn");
            // 干接点
            this.setStateList("contact", "未知", "table-row-warn");
            // 核容终止原因
            // this.setStateList("stopReason", "未知");
            // 操作失败原因
            this.setStateList("failReason", "未知");
            // 预估续航时长
            //this.setStateList("xuHang", "???");
            // 显示遮罩层
            this.maskShow = true;
        },
        // BTS设备信息
        setEquipBTS(data) {
@@ -624,22 +496,22 @@
            // 关闭遮罩层
            this.maskShow = false;
            //  电路图类型
            let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            let workstatus = parseInt(data.devWorkstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            let battstate = this.inputs.batt_state;
            let alarmstatus = data.dev_alarmstate;
            let battstate = this.inputs.battState;
            let alarmstatus = data.devAlarmstate;
            // 是否为锂电池
            let isLithium = this.$units.regEquipType(batt.FBSDeviceId, "lithium");
            let isLithium = this.$units.regEquipType(batt.fbsdeviceId, "lithium");
            // 设置停电放电状态
            if (data.dev_onlinevollow) {
                this.inputs.batt_state = 5;
            if (data.devOnlinevollow) {
                this.inputs.battState = 5;
                this.diagram.type = 5;
                this.diagram.desc = "(开关闭合)";
                this.diagram.powerCut = 1;
                // 当前设备是BTS设备
                if (workstatus === 0 && data.dev_res_test_state !== 0) {
                if (workstatus === 0 && data.devResTestState !== 0) {
                    this.diagram.desc += "(内阻测试)";
                }
@@ -656,14 +528,14 @@
                    this.diagram.type = 0;
                    this.diagram.desc = "(开关闭合)";
                    // 当前设备是BTS设备
                    if (data.dev_res_test_state !== 0) {
                    if (data.devResTestState !== 0) {
                        this.diagram.desc += "(内阻测试)";
                    }
                    break;
                case 1:
                    if (
                        data.dev_testgroupnum > 0 &&
                        data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1
                        data.devTestgroupnum > 0 &&
                        data.devTestgroupnum === batt.groupIndexInFBSDevice + 1
                    ) {
                        this.diagram.type = 1;
                        this.diagram.desc = "(开关断开)";
@@ -678,7 +550,7 @@
                    }
                    // 当前设备是BTS设备
                    if (data.dev_testtype == 209) {
                    if (data.devTesttype == 209) {
                        this.diagram.desc += "(KD测试)";
                        this.diagram.type = 3;
                    }
@@ -687,8 +559,8 @@
                    //辨别当前电池组是否在充电
                    if (
                        this.diagram.type == 2 ||
                        (data.dev_testgroupnum > 0 &&
                            data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1)
                        (data.devTestgroupnum > 0 &&
                            data.devTestgroupnum === batt.groupIndexInFBSDevice + 1)
                    ) {
                        //充电
                        if (
@@ -725,18 +597,18 @@
        // 61850设备信息
        setEquip61850(data) {
            //  电路图类型
            let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            let workstatus = parseInt(data.devWorkstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            // 关闭遮罩层
            this.maskShow = false;
            // 设置停电放电状态
            if (data.dev_onlinevollow) {
                this.inputs.batt_state = 5;
            if (data.devOnlinevollow) {
                this.inputs.battState = 5;
                this.diagram.type = 5;
                this.diagram.desc = "(开关闭合)";
                this.diagram.powerCut = 1;
                // 当前设备是BTS设备
                if (workstatus === 0 && data.dev_res_test_state !== 0) {
                if (workstatus === 0 && data.devResTestState !== 0) {
                    this.diagram.desc += "(内阻测试)";
                }
                return;
@@ -783,10 +655,10 @@
            // 设备工作状态
            let workStates = const_61850.workstates;
            this.setStateList("workState", workStates[data.dev_workstate]);
            this.setStateList("workState", workStates[data.devWorkstate]);
            // 核容终止原因
            // let stopReasons = const_61850.stopreasons;
            // if (data.dev_workstate == 2) {
            // if (data.devWorkstate == 2) {
            //   this.setStateList("stopReason", "未知");
            // } else {
            //   this.setStateList(
@@ -797,10 +669,10 @@
            // 操作失败原因
            let failReasons = const_61850.failreasons;
            this.setStateList("failReason", failReasons[data.dev_alarmstate]);
            this.setStateList("failReason", failReasons[data.devAlarmstate]);
            // 告警信息
            let alarms = data.dev_61850alarms.split(",");
            let alarms = data.dev61850alarms.split(",");
            // alarms = ['false', 'false', 'true', 'false', 'true'];
            // 通讯状态
            if (alarms[1] == "true") {
@@ -823,20 +695,443 @@
                this.setStateList("contact", "正常", "");
            }
        },
        // 9605设备
        setEquip9605(data) {
            let batt = this.batt;
            // 关闭遮罩层
            this.maskShow = false;
            //  电路图类型
            let workstatus = parseInt(data.devWorkstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            let battstate = this.inputs.battState;
            let alarmstatus = data.devAlarmstate;
            // 设置停电放电状态
            if (data.devOnlinevollow) {
                this.inputs.battState = 5;
                this.diagram.type = 5;
                this.diagram.desc = "(开关闭合)";
                this.diagram.powerCut = 1;
                // 当前设备是BTS设备
                if (workstatus === 0 && data.devResTestState !== 0) {
                    this.diagram.desc += "(内阻测试)";
                }
                return;
            }
            // 判断workstatus
            switch (workstatus) {
                case 0:
                    this.diagram.type = 0;
                    //this.diagram.desc = '(开关闭合)';
                    // 当前设备是BTS设备
                    if (data.devResTestState !== 0) {
                        this.diagram.type = 6;
                        this.diagram.desc += "(内阻测试)";
                    }
                    break;
                case 1:
                    this.diagram.type = 1;
                    //this.diagram.desc = '(开关断开)';
                    break;
                case 2:
                    this.diagram.type = 2;
                    //this.diagram.desc = '(开关断开)';
                    break;
                default:
                    this.diagram.type = -1;
                    this.maskShow = true;
                    break;
            }
        },
        /* echars图表 */
        realTimeSearch(res) {
            if (res) {
                let diagramType = this.diagram.type;
                // res = res.data;
                let data = [];
                let chargeMon = "";
                let dischargeMon = "";
                if (res.code && res.data && diagramType != -1) {
                    data = res.data2.list.map((item) => {
                        if (item.monState == 1) {
                            dischargeMon += (dischargeMon == "" ? "#" : ",#") + item.monNum;
                        } else if (item.monState == 2) {
                            chargeMon += (chargeMon == "" ? "#" : ",#") + item.monNum;
                        }
                        return {
                            num1: "#" + item.monNum,
                            vol1: item.monVol,
                            res1: item.monRes,
                            temp1: item.monTmp,
                            conduct1: item.monRes ? ((1 / item.monRes) * 1000).toFixed(0) : 0,
                            curr1: item.monJhCurr,
                            leakVol1: item.monLyVol,
                            monConnRes: item.monConnRes,
                            monCap: item.mon_cap,
                            monTestCap:
                                diagramType == 1 || diagramType == 2 || diagramType == 6
                                    ? item.monTestCap
                                    : "---",
                            monResCap:
                                diagramType == 1 || diagramType == 2 || diagramType == 6
                                    ? item.monRestCap
                                    : "---",
                            monDisTimeLong:
                                diagramType == 1 || diagramType == 2 || diagramType == 6
                                    ? Math.floor(item.monDisTimeLong / 60) +
                                    "时" +
                                    (item.monDisTimeLong % 60) +
                                    "分"
                                    : "---",
                            monState: item.monState,
                        };
                    });
                }
                // 添加正在测试的单体
                this.chargeMon = chargeMon;
                this.dischargeMon = dischargeMon;
                // 更新表格
                this.table.datas = data;
                this.table.show = true;
                // 电压值
                let volTempVol = [];
                if (res.code && res.data) {
                    volTempVol = res.data2.list.map((item) => {
                        let value = diagramType == -1 ? 0 : item.monVol.toFixed(3);
                        return ["#" + item.monNum, value];
                    });
                }
                // 设置电压值
                this.monVols = volTempVol.map((item) => {
                    return item[1];
                });
                let volBarNum = this.$units.getBarNum(volTempVol);
                vol.title.text =
                    "最大值=" +
                    volBarNum.max.toFixed(2) +
                    "V;最小值=" +
                    volBarNum.min.toFixed(2) +
                    "V;平均值=" +
                    volBarNum.avg.toFixed(2) +
                    "V";
                vol.series[0].data = volTempVol;
                // 内阻
                let volTempres = [];
                if (res.code && res.data) {
                    volTempres = res.data2.list.map((item) => {
                        let value = diagramType == -1 ? 0 : item.monRes;
                        return ["#" + item.monNum, value];
                    });
                }
                let resBarNum = this.$units.getBarNum(volTempres);
                resChart.title.text =
                    "最大值=" +
                    resBarNum.max.toFixed(2) +
                    "mΩ;最小值=" +
                    resBarNum.min.toFixed(2) +
                    "mΩ;平均值=" +
                    resBarNum.avg.toFixed(2) +
                    "mΩ";
                resChart.series[0].data = volTempres;
                // 温度
                let volTempte = [];
                if (res.code && res.data) {
                    volTempte = res.data2.list.map((item) => {
                        let value = diagramType == -1 ? 0 : item.monTmp;
                        return ["#" + item.monNum, value];
                    });
                }
                this.monTemps = volTempte.map((item) => {
                    return item[1];
                });
                let tempBarNum = this.$units.getBarNum(volTempte);
                temp.title.text =
                    "最大值=" +
                    tempBarNum.max.toFixed(1) +
                    "℃;最小值=" +
                    tempBarNum.min.toFixed(1) +
                    "℃;平均值=" +
                    tempBarNum.avg.toFixed(1) +
                    "℃";
                temp.series[0].data = volTempte;
                // 电导
                let conductTemp = [];
                if (res.code && res.data) {
                    conductTemp = res.data2.list.map((item) => {
                        let value =
                            diagramType == -1 ? 0 : this.$units.getConduct(item.monRes, item.monVol);
                        return ["#" + item.monNum, value];
                    });
                }
                let conductBarNum = this.$units.getBarNum(conductTemp);
                conduct.title.text =
                    "最大值=" +
                    conductBarNum.max.toFixed(0) +
                    ";最小值=" +
                    conductBarNum.min.toFixed(0) +
                    ";平均值=" +
                    conductBarNum.avg.toFixed(0);
                conduct.series[0].data = conductTemp;
                // 均衡电流
                let currTemp = [];
                if (res.code && res.data) {
                    currTemp = res.data2.list.map((item) => {
                        let value = diagramType == -1 ? 0 : item.monJhCurr;
                        return ["#" + item.monNum, value];
                    });
                }
                let currBarNum = this.$units.getBarNum(currTemp);
                currChart.title.text =
                    "最大值=" +
                    currBarNum.max.toFixed(1) +
                    "mA;最小值=" +
                    currBarNum.min.toFixed(1) +
                    "mA;平均值=" +
                    currBarNum.avg.toFixed(1) +
                    "mA";
                currChart.series[0].data = currTemp;
                // 漏液电压
                let leakVolTemp = [];
                if (res.code && res.data) {
                    leakVolTemp = res.data2.list.map((item) => {
                        let value = diagramType == -1 ? 0 : item.monLyVol;
                        return ["#" + item.monNum, value];
                    });
                }
                let leakVolNum = this.$units.getBarNum(leakVolTemp);
                leakVol.title.text =
                    "最大值=" +
                    leakVolNum.max.toFixed(1) +
                    "V;最小值=" +
                    leakVolNum.min.toFixed(1) +
                    "V;平均值=" +
                    leakVolNum.avg.toFixed(1) +
                    "V";
                leakVol.series[0].data = leakVolTemp;
                // 链接条阻值
                let monConnResData = [];
                if (res.code && res.data) {
                    monConnResData = res.data2.list.map((item) => {
                        let value = diagramType == -1 ? 0 : item.monConnRes;
                        return ["#" + item.monNum, value];
                    });
                }
                let connResBarNum = this.$units.getBarNum(monConnResData);
                monConnRes.title.text =
                    "最大值=" +
                    connResBarNum.max.toFixed(1) +
                    "mΩ;最小值=" +
                    connResBarNum.min.toFixed(1) +
                    "mΩ;平均值=" +
                    connResBarNum.avg.toFixed(1) +
                    "mΩ";
                monConnRes.series[0].data = monConnResData;
                // 更新电压图表
                this.setChart();
            }
        },
        onWSOpen() {
            this.sendMessage();
        },
        sendMessage() {
            let batt = this.batt;
            if (!batt.battGroupId) {
                return false;
            }
            let params = {
                battGroupId: batt.battGroupId,
                devId: batt.fbsdeviceId,
                powerDeviceId: 0,
                groupNum: batt.groupIndexInFBSDevice,
                pageType: "standard",
            };
            // console.log("====", params, JSON.stringify(params));
            this.SOCKET.send(JSON.stringify(params));
        },
        onWSMessage(res) {
            res = JSON.parse(res.data);
            let data = res.data.data;
            // console.log(data, "=====data");
            this.realTimeLd9Data(data.ld9);
            this.realTimePowerOffs(data.f9100state);
            this.realTimeSearch(data.rtdata);
            this.realTimeGroupss(data.rtstate);
            this.realTimeStateList(data.fod);
            this.loadDevAla(data.rtalarm, data.rsalarm);
            this.getLithiumAnalog(data.li9130); // 锂电池模拟量
            this.inversionData(data.fbs9100sBuscoupleState);
            this.dataChangeFlag = Math.random(); // 数据更新
        },
        search() {
            JhStateActionSerchByCondition({
                dev_id: this.batt.fbsdeviceId,
            })
                .then((res) => {
                    let resData = res.data;
                    if (resData.code == 1) {
                        let dataObj = resData.data[0];
                        for (let key in dataObj) {
                            this.totolTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                            this.volTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                            this.eleTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                            this.otherTable.map((item) => {
                                if (item.key == key) {
                                    item.value = dataObj[key];
                                }
                            });
                        }
                    }
                })
                .catch((err) => {
                    console.log(err);
                });
        },
        //查询电池组信息
        getBattGroupInfo(battGroupId) {
            getBattGroupInfo(battGroupId).then(res => {
                let rs = res.data;
                if (rs.code == 1) {
                    this.leafClick(rs.data[0]);
                } else {
                    this.$toast('未获取到电池组的信息');
                }
            }).catch(error => {
                console.log(error);
            });
        },
        leafClick(data) {
            this.batt = data;
            this.realTimeAlarmss();
            this.table.headers = getTblHeader(data.fbsdeviceId);
            this.table.show = false;
            // 开启循环请求
            // this.startTimer();
            this.$nextTick(() => {
                // 开启循环请求
                this.sendMessage();
            });
        },
        /* 查询电路图开关状态和信息 */
        realTimePowerOffs(res) {
            let batt = this.batt;
            // 设备为61850显示右侧的面板
            if (this.$units.regEquipType(batt.fbsdeviceId, ["equip61850"])) {
                this.stateListShow = true;
            } else {
                this.stateListShow = false;
            }
            // 查询后台数据
            if (res) {
                // res = res.data;
                let outTime = 2 * 60; //设备超时时间(2分钟)
                if (res.code && res.data) {
                    let data = res.data2;
                    // 设置版本号
                    this.devVersion = data.devVersion;
                    // 基础信息
                    this.setEquipBase(data);
                    // 判断是否超时
                    var nowTime = new Date(data.note).getTime(); //当前时间
                    var record = new Date(data.recordDatetime).getTime();
                    if (Math.abs(nowTime - record) / 1000 > outTime) {
                        this.disconnect();
                    } else {
                        // 未超时执行逻辑
                        let devId = batt.fbsdeviceId;
                        this.diagram.powerCut = 0;
                        // 设备为61850
                        if (this.$units.regEquipType(devId, "equip61850")) {
                            this.setEquip61850(data);
                        } else if (
                            this.$units.regEquipType(devId, [
                                "BTS",
                                "BTS9110",
                                "BTS9120",
                                "lithium",
                                "LD9",
                                "lithiumPack",
                            ])
                        ) {
                            this.setEquipBTS(data);
                        } else if (this.$units.regEquipType(devId, ["BTS9605", "BTS9611"])) {
                            this.setEquip9605(data);
                        } else {
                            this.disconnect();
                        }
                    }
                } else {
                    // 设置版本号
                    this.devVersion = "";
                    // 设备处于未连接
                    this.disconnect();
                }
            }
        },
        // 设置stateList的值
        setStateList(name, value, type) {
            let stateList = this.stateList;
            for (let i = 0; i < stateList.length; i++) {
                let state = stateList[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type ? type : "";
                }
            }
            let historyStateList = this.historyStateList;
            for (let i = 0; i < historyStateList.length; i++) {
                let state = historyStateList[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type ? type : "";
                }
            }
            for (let i = 0, list = this.lastCapacityTest, j = list.length; i < j; i++) {
                let state = list[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type || "";
                }
            }
        },
        // 基础信息
        setEquipBase(data) {
            let groupIndex = this.batt.GroupIndexInFBSDevice;
            let groupIndex = this.batt.groupIndexInFBSDevice;
            // 设备的温度
            this.diagram.temp = data.dev_temp;
            let contactRes = (groupIndex != 0
                ? data.dev_conresist1
                : data.dev_conresist
            this.diagram.temp = data.devTemp;
            let contactRes = (
                groupIndex != 0 ? data.devConresist1 : data.devConresist
            ).toHold(2);
            let dropVol = (groupIndex != 0
                ? data.dev_condvoldp1
                : data.dev_condvoldp
            let dropVol = (
                groupIndex != 0 ? data.devCondvoldp1 : data.devCondvoldp
            ).toHold(2);
            let alarms = data.dev_61850alarms.split(",");
            let alarms = data.dev61850alarms.split(",");
            if (alarms.length) {
                this.diagram.contactRes = alarms[0] == "true" ? "k1异常" : contactRes;
                this.diagram.dropVol = alarms[3] == "true" ? "D1异常" : dropVol;
@@ -845,101 +1140,86 @@
                this.diagram.dropVol = dropVol;
            }
        },
        realTimeLd9Data() {
            let batt = this.batt;
            realTimeLd9Data({
                dev_id: batt.FBSDeviceId,
            }).then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    let data = rs.data[0];
                    // 判断是否超时
                    let outTime = 2 * 60; //设备超时时间(2分钟)
                    let nowTime = new Date(data.note).getTime(); //当前时间
                    let record = new Date(data.record_datetime).getTime();
                    if (Math.abs(nowTime - record) / 1000 > outTime) {
                        this.disconnect();
                    } else {
                        this.diagram.desc = "";
                        // 0-在线监测,1-核容测试,2-测试状态状态停止,3-内阻测试
                        switch (data.sys_state) {
                            case 0:
                                this.diagram.type = 0;
                                break;
                            case 1:
                                this.diagram.type = 1;
                                break;
                            case 2:
                                this.diagram.type = 2;
                                break;
                            case 3:
                                this.diagram.type = 3;
                                this.diagram.desc = "(内阻测试)";
                                break;
                        }
                    }
                } else {
                    this.disconnect();
                }
            }).catch(error => {
                console.log(error);
                this.disconnect();
            });
        },
        disconnect() {
            // 设备未连接
            this.diagram.type = -1;
        },
        /* 查询电池告警参数 */
        realTimeAlarmss() {
            var batt = this.batt;
            realTimeAlarm({
                dev_id: batt.FBSDeviceId
            }).then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    let list = rs.data;
                devId: batt.fbsdeviceId,
            }).then((res) => {
                res = res.data;
                if (res.code) {
                    let list = res.data.list;
                    // 单体电压
                    this.setChartMarkLine(vol, "Voltage", "Batt_Alarm_Type_MonVol", list);
                    // 单体温度
                    this.setChartMarkLine(temp, "Temperature", "Batt_Alarm_Type_MonTmp", list);
                    this.setChartMarkLine(
                        temp,
                        "Temperature",
                        "Batt_Alarm_Type_MonTmp",
                        list
                    );
                    // 单体内阻
                    this.setChartMarkLine(resChart, "Resistance", "Batt_Alarm_Type_MonRes", list);
                    this.setChartMarkLine(
                        resChart,
                        "Resistance",
                        "Batt_Alarm_Type_MonRes",
                        list
                    );
                    // 单体电导
                    this.setChartMarkLine(conduct, "Conductance", "Batt_Alarm_Type_MonRes", list);
                    this.setChartMarkLine(
                        conduct,
                        "Conductance",
                        "Batt_Alarm_Type_MonRes",
                        list
                    );
                    // 漏液电压
                    this.setChartMarkLine(
                        leakVol,
                        "leakVol",
                        "Batt_Alarm_Type_MonLYVol",
                        list
                    );
                }
            });
        },
        setChartMarkLine(chartData, name, alm_name, list) {
        setChartMarkLine(chartData, name, almName, list) {
            let batt = this.batt;
            // 遍历list
            for (let i = 0; i < list.length; i++) {
                let item = list[i];
                if (item.alm_name == alm_name) {
                if (item.almName == almName) {
                    let high = 0;
                    let low = 0;
                    switch (name) {
                        case "Voltage":      // 电压告警
                            //单体电压
                            let std_mon_vol = batt.MonVolStd;
                            high = parseFloat(std_mon_vol * item.alm_high_coe).toHold(3);
                            low = parseFloat(std_mon_vol * item.alm_low_coe).toHold(3);
                            let std_mon_vol = batt.monVolStd;
                            high = parseFloat(std_mon_vol * item.almHighCoe).toHold(3);
                            low = parseFloat(std_mon_vol * item.almLowCoe).toHold(3);
                            break;
                        case "Temperature":
                            //单体温度
                            let std_mon_tmp = 25;
                            high = parseFloat(std_mon_tmp * item.alm_high_coe).toHold(1);
                            low = parseFloat(std_mon_tmp * item.alm_low_coe).toHold(1);
                            high = parseFloat(std_mon_tmp * item.almHighCoe).toHold(1);
                            low = parseFloat(std_mon_tmp * item.almLowCoe).toHold(1);
                            break;
                        case "Resistance":
                            let std_mon_res = (1 * (batt.MonVolStd / 2)) / (batt.MonCapStd / 100);
                            high = parseFloat(std_mon_res * item.alm_high_coe).toHold(3);
                            low = parseFloat(std_mon_res * item.alm_low_coe).toHold(3);
                            let std_mon_res =
                                (1 * (batt.monVolStd / 2)) / (batt.monCapStd / 100);
                            high = parseFloat(std_mon_res * item.almHighCoe).toHold(3);
                            low = parseFloat(std_mon_res * item.almLowCoe).toHold(3);
                            break;
                        case "Conductance":
                            let std_mon_ser = batt.MonSerStd;
                            high = parseFloat(std_mon_ser * item.alm_high_coe).toHold(0);
                            low = parseFloat(std_mon_ser * item.alm_low_coe).toHold(0);
                            let std_mon_ser = batt.monSerStd;
                            high = parseFloat(std_mon_ser * item.almHighCoe).toHold(0);
                            low = parseFloat(std_mon_ser * item.almLowCoe).toHold(0);
                            break;
                        case "leakVol":
                            high = parseFloat(item.almHighCoe);
                            low = parseFloat(item.almLowCoe);
                            break;
                    }
                    // 低告警
@@ -950,113 +1230,7 @@
                }
            }
        },
        /* echars图表 */
        realTimeSearch() {
            var batt = this.batt;
            realTimeSearch({
                BattGroupId: batt.BattGroupId
            }).then(res => {
                let diagramType = this.diagram.type;
                let rs = JSON.parse(res.data.result);
                let data = [];
                if (rs.code == 1 && diagramType != -1) {
                    data = rs.data.map(item => {
                        return {
                            num1: "#" + item.mon_num,
                            vol1: item.mon_vol,
                            res1: item.mon_res,
                            temp1: item.mon_tmp,
                            conduct1: item.mon_res
                                ? ((1 / item.mon_res) * 1000).toFixed(0)
                                : 0,
                            curr1: item.mon_JH_curr,
                            leakVol1: item.mon_LY_vol,
                            monConnRes: item.mon_conn_res,
                            monCap: item.mon_cap,
                            monTestCap: diagramType == 1 ? item.monTestCap : "---",
                            monResCap: diagramType == 1 ? item.monRestCap : "---",
                            monDisTimeLong: diagramType == 1 ? Math.floor(item.monDisTimeLong / 60) + "时" + (item.monDisTimeLong % 60) + "分" : "---",
                            monState: item.monState,
                        };
                    });
                }
                // 更新表格
                this.table.datas = data;
                this.table.show = true;
                // 电压值
                let volTempVol = [];
                if (rs.code == 1) {
                    volTempVol = rs.data.map(item => {
                        return ["#" + item.mon_num, item.mon_vol];
                    });
                }
                let volBarNum = this.$units.getBarNum(volTempVol);
                vol.title.text = "最大值=" + volBarNum.max.toFixed(2) + "V;最小值=" + volBarNum.min.toFixed(2) + "V;平均值=" + volBarNum.avg
                    .toFixed(2) + "V";
                vol.series[0].data = volTempVol;
                // 内阻
                let volTempres = [];
                if (rs.code == 1) {
                    volTempres = rs.data.map(item => {
                        return ["#" + item.mon_num, item.mon_res];
                    });
                }
                let resBarNum = this.$units.getBarNum(volTempres);
                resChart.title.text = "最大值=" + resBarNum.max.toFixed(2) + "mΩ;最小值=" + resBarNum.min.toFixed(2) + "mΩ;平均值=" +
                    resBarNum.avg.toFixed(2) + "mΩ";
                resChart.series[0].data = volTempres;
                // 温度
                let volTempte = [];
                if (rs.code == 1) {
                    volTempte = rs.data.map(item => {
                        return ["#" + item.mon_num, item.mon_tmp];
                    });
                }
                let tempBarNum = this.$units.getBarNum(volTempte);
                temp.title.text = "最大值=" + tempBarNum.max.toFixed(1) + "℃;最小值=" + tempBarNum.min.toFixed(1) + "℃;平均值=" +
                    tempBarNum.avg.toFixed(1) + "℃";
                temp.series[0].data = volTempte;
                // 电导
                let conductTemp = [];
                if (rs.code == 1) {
                    conductTemp = rs.data.map(item => {
                        return ["#" + item.mon_num, item.mon_res ? (1 / item.mon_res * 1000).toFixed(0) : 0];
                    });
                }
                let conductBarNum = this.$units.getBarNum(conductTemp);
                conduct.title.text = "最大值=" + conductBarNum.max.toFixed(0) + ";最小值=" + conductBarNum.min.toFixed(0) + ";平均值=" +
                    conductBarNum.avg.toFixed(0);
                conduct.series[0].data = conductTemp;
                // 均衡电流
                let currTemp = [];
                if (rs.code == 1) {
                    currTemp = rs.data.map(item => {
                        return ["#" + item.mon_num, item.mon_JH_curr];
                    });
                }
                let currBarNum = this.$units.getBarNum(currTemp);
                currChart.title.text = "最大值=" + currBarNum.max.toFixed(1) + "mA;最小值=" + currBarNum.min.toFixed(1) + "mA;平均值=" +
                    currBarNum.avg.toFixed(1) + "mA";
                currChart.series[0].data = currTemp;
                // 漏液电压
                let leakVolTemp = [];
                if (rs.code == 1) {
                    leakVolTemp = rs.data.map(item => {
                        return ["#" + item.mon_num, item.mon_LY_vol];
                    });
                }
                let leakVolNum = this.$units.getBarNum(leakVolTemp);
                leakVol.title.text = "最大值=" + leakVolNum.max.toFixed(1) + "V;最小值=" + leakVolNum.min.toFixed(1) + "V;平均值=" +
                    leakVolNum.avg.toFixed(1) + 'V';
                leakVol.series[0].data = leakVolTemp;
                // 更新电压图表
                this.setChart();
            });
        },
        initChart() {
            // 电压
            vol = {
@@ -1066,17 +1240,18 @@
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                        color: '#323233'
                    }
                },
                series: [{
                },
                series: [
                    {
                    name: "电压",
                    type: "bar",
                    data: [],
                    markLine: {
                        data: getMarkLineData(),
                    },
                }]
                    },
                ],
            };
            // 漏液电压
            leakVol = {
@@ -1086,14 +1261,18 @@
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                        color: '#323233'
                    }
                },
                series: [{
                },
                series: [
                    {
                    name: "漏液电压",
                    type: "bar",
                    data: [],
                }]
                        markLine: {
                            data: getMarkLineData(),
                        },
                    },
                ],
            };
            // 内阻
@@ -1104,17 +1283,18 @@
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                        color: '#323233'
                    }
                },
                series: [{
                },
                series: [
                    {
                    name: "内阻",
                    type: "bar",
                    data: [],
                    markLine: {
                        data: getMarkLineData(),
                    },
                }]
                    },
                ],
            };
            // 温度
@@ -1125,18 +1305,20 @@
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                        color: '#323233'
                    }
                },
                series: [{
                },
                series: [
                    {
                    name: "温度",
                    type: "bar",
                    data: [],
                    markLine: {
                        data: getMarkLineData(),
                    },
                }]
                    },
                ],
            };
            // 电导
            conduct = {
                title: {
@@ -1145,17 +1327,18 @@
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                        color: '#323233'
                    }
                },
                series: [{
                },
                series: [
                    {
                    name: "电导",
                    type: "bar",
                    data: [],
                    markLine: {
                        data: getMarkLineData(),
                    },
                }]
                    },
                ],
            };
            // 均衡电流
            currChart = {
@@ -1165,14 +1348,34 @@
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                        color: '#323233'
                    }
                },
                series: [{
                },
                series: [
                    {
                    name: "均衡电流",
                    type: "bar",
                    data: []
                }]
                        data: [],
                    },
                ],
            };
            // 链接条阻值
            monConnRes = {
                title: {
                    show: true,
                    text: "最大值=0mΩ;最小值=0mΩ;平均值=0mΩ",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                    },
                },
                series: [
                    {
                        name: "链接条阻值",
                        type: "bar",
                        data: [],
                    },
                ],
            };
            // 设置配置项
            this.setChart();
@@ -1186,16 +1389,111 @@
            this.$refs.leakVol.setOption(leakVol);
        },
        /* 实时组端信息 */
        realTimeGroupss() {
            var batt = this.batt;
            realTimeGroup(batt.BattGroupId).then(res => {
                let rsa = JSON.parse(res.data.result);
                if (rsa.code == 1) {
                    this.inputs = rsa.data[0];
        realTimeGroupss(res) {
            if (res) {
                // res = res.data;
                if (res.code && res.data) {
                    this.inputs = res.data2;
                }
            }).catch(err => {
                console.log(err)
            }
        },
        realTimeStateList(res) {
            // 获取剩余天数,工作模式,组端电压,峰值电压
            // let batt = this.batt;
            // 仅有编号不做任何操作
            if (this.fodHeaders.length == 1) {
                return;
            }
            if (res) {
                // res = res.data;
                let data = [];
                if (res.code && res.data) {
                    let rsData = res.data2;
                    let workModels = ["停止", "养护", "除硫"];
                    let list = ["One", "Two", "Three", "Four", "Five"];
                    let fodHeaders = this.fodHeaders;
                    data = list.map((item, index) => {
                        let workModel = rsData["workstate" + item];
                        return fodHeaders.map((fod) => {
                            if (fod.prop == "num") {
                                return index + 1;
                            } else if (fod.prop == "workstate") {
                                return workModels[workModel];
                            } else {
                                return rsData[fod.prop + item];
                            }
            });
                        //return [index+1, rsData['RestTime_'+item], workModels[workModel], rsData['vgroupvol'+item], rsData['vpeakvol'+item]]
                    });
                    this.fodData = data;
                }
            }
        },
        loadDevAla(rtalarm, rsalarm) {
            if (rtalarm) {
                let res = rtalarm;
                let list = [];
                if (res.code && res.data) {
                    list = res.data2.list;
                }
                // this.table2.datas = list;
            }
            if (rsalarm) {
                let res = rsalarm;
                let list = [];
                if (res.code && res.data) {
                    list = res.data2.list;
                }
                // this.table1.datas = list;
            }
        },
        /**
         * 读取锂电池信息 暂定读取组一的
         */
        getLithiumAnalog(res) {
            if (res) {
                // res = res.data;
                if (res.code && res.data) {
                    // 剩余容量进行累加
                    let restCap = 0;
                    let packVols = [];
                    let packCurrs = [];
                    res.data2.map((item) => {
                        restCap += item.restCap;
                        packVols.push(item.sumVol);
                        packCurrs.push(item.current);
                    });
                    this.packVols = packVols;
                    this.packCurrs = packCurrs;
                    let data = res.data2[0];
                    data.restCap = restCap;
                    this.lithiumParams.analog = data;
                } else {
                    this.lithiumParams.analog = lithiumInfo.analog().params;
                }
            }
        },
        inversionData(res) {
            // 是逆变的设备
            if (res && this.$units.regEquipType(this.batt.fbsdeviceId, "BTS9120")) {
                // res = res.data;
                let data = {
                    commustate: -1, // 通讯状态
                    fanglei_state: -1, // 防雷状态
                    rlayworkmode: -1, // 空开状态
                };
                if (res.code) {
                    data = res.data;
                }
                if (data.rlayworkmode == 1 || data.rlayworkmode == 3) {
                    this.buscoupleSwitch = 1;
                } else {
                    this.buscoupleSwitch = 0;
                }
            } else {
                this.buscoupleSwitch = 0;
            }
        },
        // 全部选项选择完毕后,会触发 finish 事件
        onFinish({ selectedOptions }) {
@@ -1207,18 +1505,13 @@
        onChange(select) {
            if (select.tabIndex == 3) {
                let objs = select.selectedOptions[select.selectedOptions.length - 1];
                searchBattInfo({
                    StationName1: objs.data.StationName1,
                    StationName2: objs.data.StationName2,
                    StationName5: objs.data.StationName5,
                    StationName3: objs.data.StationName3
                }).then((res) => {
                    let rs = JSON.parse(res.data.result);
                getBattList(objs.data.stationId).then((res) => {
                    let rs = res.data;
                    if (rs.code == 1) {
                        let data = rs.data;
                        data.map(item => {
                            item.text = item.StationName4 + '-' + item.BattGroupName
                            item.value = item.BattGroupId
                            item.text = item.stationName4 + '-' + item.battGroupName
                            item.value = item.battGroupId
                        })
                        this.options.map(item => {
                            item?.children.map(jtem => {
@@ -1238,13 +1531,13 @@
            }
        },
        //查询站点信息
        searchStation() {
            searchStation({
                StationName1: "",
                StationName2: "",
                StationName5: "",
        getAllStations() {
            getAllStations({
                stationName1: "",
                stationName2: "",
                stationName5: "",
            }).then((res) => {
                let rs = JSON.parse(res.data.result);
                let rs = res.data;
                let data = [];
                if (rs.code == 1) {
                    data = rs.data;
@@ -1261,13 +1554,13 @@
            // 遍历数据构造树状
            data.forEach(item => {
                // 省
                let provice = this.addData(result, item.StationName1);
                let provice = this.addData(result, item.stationName1);
                // 市
                let city = this.addData(provice.children, item.StationName2, provice);
                let city = this.addData(provice.children, item.stationName2, provice);
                // 区县
                let county = this.addData(city.children, item.StationName5, city);
                let county = this.addData(city.children, item.stationName5, city);
                // 机房
                let home = this.addData(county.children, item.StationName3, county, item);
                let home = this.addData(county.children, item.stationName3, county, item);
            });
            // 设置树状列表
            this.options = result;
@@ -1315,12 +1608,13 @@
        },
    },
    mounted() {
        this.searchStation();
        // 初始化图表
        this.initChart();
        this.getAllStations();
    },
    destroyed() {
        this.timer.stop();
    }
}
</script>
src/store/modules/user.js
@@ -26,10 +26,10 @@
    },
    mutations: {
        login(state, provider) {
            state.userId = provider.data;
            state.userPower = provider.data2;
            sessionStorage.setItem('userId', provider.data);
            sessionStorage.setItem('userPower', provider.data2);
            state.userId = provider.uid;
            state.userPower = provider.urole;
            sessionStorage.setItem('userId', provider.uid);
            sessionStorage.setItem('userPower', provider.urole);
        },
        changeRealTabsConfig(state, data) {
            state.realTabsConfig = Array.isArray(data) ? data : [];