he wei
2025-01-17 6e342e088b287a0e758e31b658e29306a4c7e6be
U 61853 全功能逆变 假负载 柱状图上参考线问题修复
3个文件已修改
3587 ■■■■ 已修改文件
src/views/dataTest/realTime6183.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataTest/realTime6184.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataTest/realTime61853.vue 3489 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataTest/realTime6183.vue
@@ -508,6 +508,9 @@
            let permits = this.$store.state.user.permits;
            let isCanTest = isHasPermit("batt_test_op_permit", permits);
            return {
        alarmParams: {},
        battInf0: {},
        battInf1: {},
        currWorkGrp: 0,
                currentGroup: 0,
                stationInf: null,
@@ -658,6 +661,7 @@
            },
            changeGroup(idx) {
                this.currentGroup = idx;
        this.setLin();
                // 更新图表
                this.setChart();
                this.updateTable();
@@ -917,7 +921,8 @@
                let data = res.data.data;
                // console.log(data, "=====111data");
                let {
                    binf,
                    binf0,
                    binf1,
                    f9100state,
                    rtdata0,
                    rtdata1,
@@ -927,7 +932,11 @@
                    qgnRes,
                } = data;
                if (!this.stationInf) {
                    this.getStation(binf);
                    this.getStation(binf0);
          this.battInf0 = binf0;
          this.battInf1 = binf1;
          this.setLin();
                }
                //
@@ -1223,26 +1232,29 @@
                realTimeAlarm({
                    devId,
                }).then((res) => {
                    res = res.data;
                    this.setLin(res);
                    // res = res.data;
          this.alarmParams = res.data;
                    // this.setLin(res);
                });
            },
            // 设置高低线参考线
            setLin: function (res) {
            setLin: function () {
        let res = this.alarmParams;
        let idx = this.currentGroup;
                if (res.code) {
                    let list = res.data.list;
                    // 单体电压
                    this.setChartMarkLine(vol, "Voltage", "Batt_Alarm_Type_MonVol", list);
                    this.setChartMarkLine(chartDatas['vol' + idx], "Voltage", "Batt_Alarm_Type_MonVol", list);
                    // 单体温度
                    this.setChartMarkLine(
                        temp,
                        chartDatas['temp' + idx],
                        "Temperature",
                        "Batt_Alarm_Type_MonTmp",
                        list
                    );
                    // 单体内阻
                    this.setChartMarkLine(
                        resChart,
                        chartDatas['resChart' + idx],
                        "Resistance",
                        "Batt_Alarm_Type_MonRes",
                        list
@@ -1250,7 +1262,7 @@
                }
            },
            setChartMarkLine(chartData, name, almName, list) {
                let batt = {};
                let batt = this['battInf' + this.currentGroup];
                // 遍历list
                for (let i = 0; i < list.length; i++) {
                    let item = list[i];
@@ -1272,9 +1284,7 @@
                                lowLow = parseFloat(std_mon_vol * item.almLowCoeLower).toHold(
                                    VOL
                                );
                                if (this.cdshStatus == "cdsh") {
                                    guides = this.guidesData.monVol;
                                }
                                break;
                            case "Temperature":
                                //单体温度
@@ -1287,9 +1297,7 @@
                                lowLow = parseFloat(std_mon_tmp * item.almLowCoeLower).toHold(
                                    TEMP
                                );
                                if (this.cdshStatus == "cdsh") {
                                    guides = this.guidesData.monTemp;
                                }
                                break;
                            case "Resistance":
                                // 单体电阻
@@ -1305,9 +1313,7 @@
                                lowLow = parseFloat(std_mon_res * item.almLowCoeLower).toHold(
                                    RES
                                );
                                if (this.cdshStatus == "cdsh") {
                                    guides = this.guidesData.monRes;
                                }
                                break;
                        }
                        // debugger
@@ -1319,10 +1325,7 @@
                        chartData.series[0].markLine.data[2].yAxis = high;
                        // 上限告警
                        chartData.series[0].markLine.data[3].yAxis = highHigh;
                        if (this.cdshStatus == "cdsh") {
                            //参考线
                            chartData.series[0].markLine.data[4].yAxis = guides;
                        }
                        // 单体电压柱状图添加标称电压横线
                        if (name === "Voltage") {
@@ -2058,6 +2061,7 @@
            }
            // 初始化图表
            this.initChart();
      this.realTimeAlarmss();
            this.$nextTick(() => {
                this.$G.chartManage.resize(this.acTabs);
src/views/dataTest/realTime6184.vue
@@ -289,6 +289,9 @@
            let permits = this.$store.state.user.permits;
            let isCanTest = isHasPermit("batt_test_op_permit", permits);
            return {
        alarmParams: {},
        battInf0: {},
        battInf1: {},
                currWorkGrp: 0,
                currentGroup: 0,
                stationInf: null,
@@ -457,6 +460,8 @@
            },
            changeGroup(idx) {
                this.currentGroup = idx;
        this.setLin();
                // 更新图表
                this.setChart();
                this.updateTable();
@@ -716,7 +721,8 @@
                let data = res.data.data;
                // console.log(data, "=====111data");
                let {
                    binf,
                    binf0,
                    binf1,
                    f9100state,
                    rtdata0,
                    rtdata1,
@@ -726,7 +732,12 @@
                    fbs9100sBuscoupleState,
                } = data;
                if (!this.stationInf) {
                    this.getStation(binf);
                    this.getStation(binf0);
          this.battInf0 = binf0;
          this.battInf1 = binf1;
          this.setLin();
                }
                //
@@ -1047,26 +1058,29 @@
                realTimeAlarm({
                    devId,
                }).then((res) => {
                    res = res.data;
                    this.setLin(res);
                    // res = res.data;
          this.alarmParams = res.data;
                    // this.setLin(res);
                });
            },
            // 设置高低线参考线
            setLin: function (res) {
            setLin: function () {
        let res = this.alarmParams;
        let idx = this.currentGroup;
                if (res.code) {
                    let list = res.data.list;
                    // 单体电压
                    this.setChartMarkLine(vol, "Voltage", "Batt_Alarm_Type_MonVol", list);
                    this.setChartMarkLine(chartDatas['vol' + idx], "Voltage", "Batt_Alarm_Type_MonVol", list);
                    // 单体温度
                    this.setChartMarkLine(
                        temp,
                        chartDatas['temp' + idx],
                        "Temperature",
                        "Batt_Alarm_Type_MonTmp",
                        list
                    );
                    // 单体内阻
                    this.setChartMarkLine(
                        resChart,
                        chartDatas['resChart' + idx],
                        "Resistance",
                        "Batt_Alarm_Type_MonRes",
                        list
@@ -1074,7 +1088,7 @@
                }
            },
            setChartMarkLine(chartData, name, almName, list) {
                let batt = {};
                let batt = this['battInf' + this.currentGroup];
                // 遍历list
                for (let i = 0; i < list.length; i++) {
                    let item = list[i];
@@ -1096,9 +1110,7 @@
                                lowLow = parseFloat(std_mon_vol * item.almLowCoeLower).toHold(
                                    VOL
                                );
                                if (this.cdshStatus == "cdsh") {
                                    guides = this.guidesData.monVol;
                                }
                                break;
                            case "Temperature":
                                //单体温度
@@ -1111,9 +1123,7 @@
                                lowLow = parseFloat(std_mon_tmp * item.almLowCoeLower).toHold(
                                    TEMP
                                );
                                if (this.cdshStatus == "cdsh") {
                                    guides = this.guidesData.monTemp;
                                }
                                break;
                            case "Resistance":
                                // 单体电阻
@@ -1129,9 +1139,7 @@
                                lowLow = parseFloat(std_mon_res * item.almLowCoeLower).toHold(
                                    RES
                                );
                                if (this.cdshStatus == "cdsh") {
                                    guides = this.guidesData.monRes;
                                }
                                break;
                        }
                        // debugger
@@ -1143,10 +1151,7 @@
                        chartData.series[0].markLine.data[2].yAxis = high;
                        // 上限告警
                        chartData.series[0].markLine.data[3].yAxis = highHigh;
                        if (this.cdshStatus == "cdsh") {
                            //参考线
                            chartData.series[0].markLine.data[4].yAxis = guides;
                        }
                        // 单体电压柱状图添加标称电压横线
                        if (name === "Voltage") {
@@ -1876,6 +1881,7 @@
            }
            // 初始化图表
            this.initChart();
      this.realTimeAlarmss();
            this.$nextTick(() => {
                this.$G.chartManage.resize(this.acTabs);
src/views/dataTest/realTime61853.vue
@@ -1,103 +1,40 @@
<template>
  <flex-layout direction="row" class="page-real-time" :no-bg="true">
    <home-list
      v-if="homeListShow"
      slot="header"
      @toggleChange="toggleChange"
      @leaf-click="leafClick"
    ></home-list>
    <content-box
      style="margin-left: 4px; margin-right: 4px"
      :title="stationFullName"
    >
    <home-list v-if="homeListShow" slot="header" @toggleChange="toggleChange" @leaf-click="leafClick"></home-list>
    <content-box style="margin-left: 4px; margin-right: 4px" :title="stationFullName">
      <div slot="box-tools" class="box-tools">
        <el-tooltip
          class="item"
          effect="dark"
          content="历史数据"
          placement="bottom"
        >
        <el-tooltip class="item" effect="dark" content="历史数据" placement="bottom">
          <i class="iconfont el-icon-jinru" @click="syncPage"></i>
        </el-tooltip>
      </div>
      <div slot="box-tools" class="box-tools" style="right: 40px">
        <el-tooltip
          class="item"
          effect="dark"
          content="历史实时数据"
          placement="bottom"
        >
          <i
            class="el-iconfont el-icon-s-marketing"
            @click="historyRealTimeDataDialog.show = true"
          ></i>
        <el-tooltip class="item" effect="dark" content="历史实时数据" placement="bottom">
          <i class="el-iconfont el-icon-s-marketing" @click="historyRealTimeDataDialog.show = true"></i>
        </el-tooltip>
      </div>
      <div
        slot="box-tools"
        class="box-tools"
        style="right: 72px"
        v-if="esVideoSn"
      >
        <el-tooltip
          class="item"
          effect="dark"
          content="视频监控"
          placement="bottom"
        >
          <i
            class="el-iconfont el-icon-video-camera-solid"
            @click="showEsVideoDialog"
          ></i>
      <div slot="box-tools" class="box-tools" style="right: 72px" v-if="esVideoSn">
        <el-tooltip class="item" effect="dark" content="视频监控" placement="bottom">
          <i class="el-iconfont el-icon-video-camera-solid" @click="showEsVideoDialog"></i>
        </el-tooltip>
      </div>
      <div style="right: 72px" slot="box-tools" class="box-tools">
        <el-tooltip
          class="item"
          effect="dark"
          content="通讯状态"
          placement="bottom"
        >
        <el-tooltip class="item" effect="dark" content="通讯状态" placement="bottom">
          <hdw-light :type="isLink"></hdw-light>
        </el-tooltip>
      </div>
      <div slot="box-tools" class="box-tools" style="right: 106px">
        <el-tooltip
          class="item"
          effect="dark"
          content="3D机房"
          placement="bottom"
        >
          <i
            class="el-iconfont el-icon-office-building"
            @click="station.show = true"
          ></i>
        <el-tooltip class="item" effect="dark" content="3D机房" placement="bottom">
          <i class="el-iconfont el-icon-office-building" @click="station.show = true"></i>
        </el-tooltip>
      </div>
      <div slot="box-tools" class="box-tools" style="right: 140px">
        <el-tooltip
          class="item"
          effect="dark"
          content="机房环境图集"
          placement="bottom"
        >
          <i
            class="el-iconfont el-icon-picture"
            @click="homeImageDialog = true"
          ></i>
        <el-tooltip class="item" effect="dark" content="机房环境图集" placement="bottom">
          <i class="el-iconfont el-icon-picture" @click="homeImageDialog = true"></i>
        </el-tooltip>
      </div>
      <div slot="box-tools" class="box-tools" style="right: 140px">
        <el-tooltip
          class="item"
          effect="dark"
          content="电池告警参数设置"
          placement="bottom"
        >
          <i
            class="el-iconfont el-icon-warning"
            @click="goToBattWarnSetting"
          ></i>
        <el-tooltip class="item" effect="dark" content="电池告警参数设置" placement="bottom">
          <i class="el-iconfont el-icon-warning" @click="goToBattWarnSetting"></i>
        </el-tooltip>
      </div>
      <flex-layout :no-bg="true">
@@ -108,127 +45,46 @@
              {{ currentGroup == 0 ? "电池组: 1" : "电池组: 2" }}
            </div>
            <!-- 按钮组 -->
            <el-button
              type="warning"
              size="mini"
              :disabled="false"
              @click="stopTest"
              >停止核容</el-button
            >
            <el-button
              type="primary"
              size="mini"
              :disabled="!canTest"
              @click="confirmStartResTest"
              >启动内阻测试</el-button
            >
            <el-button type="warning" size="mini" :disabled="false" @click="stopTest">停止核容</el-button>
            <el-button type="primary" size="mini" :disabled="!canTest" @click="confirmStartResTest">启动内阻测试</el-button>
            <template v-if="subType != 1">
              <el-button
                type="warning"
                size="mini"
                v-if="currentGroup == 1"
                @click="changeGroup(0)"
                >切换电池组1</el-button
              >
              <el-button
                type="warning"
                size="mini"
                v-else
                @click="changeGroup(1)"
                >切换电池组2</el-button
              >
              <el-button type="warning" size="mini" v-if="currentGroup == 1" @click="changeGroup(0)">切换电池组1</el-button>
              <el-button type="warning" size="mini" v-else @click="changeGroup(1)">切换电池组2</el-button>
            </template>
          </div>
          <el-tabs
            v-model="acTabs"
            type="border-card"
            class="flex-layout noborder"
            @tab-click="tabClick"
          >
          <el-tabs v-model="acTabs" type="border-card" class="flex-layout noborder" @tab-click="tabClick">
            <el-tab-pane key="eleLine" label="电路拓扑图" name="eleLine">
              <svg-hr
                v-show="devId"
                :rtData="svgRtdate"
                :type="subType"
                @starthr="startHr"
              ></svg-hr>
              <svg-hr v-show="devId" :rtData="svgRtdate" :type="subType" @starthr="startHr"></svg-hr>
            </el-tab-pane>
            <el-tab-pane key="vol" label="电压" name="vol">
              <bar-chart
                ref="vol"
                id="vol"
                unit="V"
                :show-tools="true"
                @right-click="chartRightCLick"
              ></bar-chart>
              <bar-chart ref="vol" id="vol" unit="V" :show-tools="true" @right-click="chartRightCLick"></bar-chart>
            </el-tab-pane>
            <el-tab-pane key="res" label="内阻" name="res">
              <bar-chart
                ref="res"
                id="res"
                unit="mΩ"
                :show-tools="true"
                @right-click="chartRightCLick"
              ></bar-chart>
              <bar-chart ref="res" id="res" unit="mΩ" :show-tools="true" @right-click="chartRightCLick"></bar-chart>
              <!-- max-color="red"
                min-color="green" -->
                  min-color="green" -->
            </el-tab-pane>
            <el-tab-pane key="temp" label="温度" name="temp">
              <bar-chart
                ref="temp"
                id="temp"
                unit="℃"
                :show-tools="true"
                @right-click="chartRightCLick"
              ></bar-chart>
              <bar-chart ref="temp" id="temp" unit="℃" :show-tools="true" @right-click="chartRightCLick"></bar-chart>
              <!-- max-color="red"
                min-color="green" -->
                  min-color="green" -->
            </el-tab-pane>
            <el-tab-pane key="curr" label="均衡电流" name="curr">
              <bar-chart
                ref="curr"
                id="curr"
                unit="A"
                :show-tools="true"
                @right-click="chartRightCLick"
              >
              <bar-chart ref="curr" id="curr" unit="A" :show-tools="true" @right-click="chartRightCLick">
              </bar-chart>
            </el-tab-pane>
            <el-tab-pane
              key="tblData"
              label="数据表格"
              name="tblData"
              class="el-table-wrapper"
            >
            <el-tab-pane key="tblData" label="数据表格" name="tblData" class="el-table-wrapper">
              <div class="tbl-data-container">
                <div class="tbl-data-body">
                  <el-table
                    stripe
                    size="small"
                    :data="table.datas"
                    :row-class-name="setTableRowClass"
                    height="100%"
                  >
                    <el-table-column
                      v-for="header in dataHeaders"
                      :key="header.prop"
                      :prop="header.prop"
                      :label="header.label"
                      :width="header.width"
                      :sortable="header.sortable"
                      align="center"
                    ></el-table-column>
                  <el-table stripe size="small" :data="table.datas" :row-class-name="setTableRowClass" height="100%">
                    <el-table-column v-for="header in dataHeaders" :key="header.prop" :prop="header.prop"
                      :label="header.label" :width="header.width" :sortable="header.sortable"
                      align="center"></el-table-column>
                  </el-table>
                </div>
                <div class="tbl-data-footer">
                  <el-button
                    type="primary"
                    size="mini"
                    round
                    @click="exportFile"
                    >导出</el-button
                  >
                  <el-button type="primary" size="mini" round @click="exportFile">导出</el-button>
                </div>
              </div>
            </el-tab-pane>
@@ -237,46 +93,18 @@
      </flex-layout>
    </content-box>
    <!-- 放电参数设置 -->
    <el-dialog
      title="操作指引"
      width="780px"
      :visible.sync="dischargeDialog.show"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false"
    >
      <hr61853-content
        v-if="dischargeDialog.show"
        :devId="devId"
        :idx="startIdx"
        :workStatus="systemData.workState"
        :battGroupId="battGroupIds[startIdx]"
        @close="closeDisChargeDialog"
      >
    <el-dialog title="操作指引" width="780px" :visible.sync="dischargeDialog.show" :close-on-click-modal="false" top="0"
      class="dialog-center" :modal-append-to-body="false">
      <hr61853-content v-if="dischargeDialog.show" :devId="devId" :idx="startIdx" :workStatus="systemData.workState"
        :battGroupId="battGroupIds[startIdx]" @close="closeDisChargeDialog">
      </hr61853-content>
    </el-dialog>
    <!-- 实时历史数据 -->
    <el-dialog
      :title="histroyDataTitle"
      width="1200px"
      :visible.sync="historyRealTimeDataDialog.show"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center no-bg"
      :modal-append-to-body="false"
    >
      <history-realtime-data
        :batt="currentBattObj"
        v-if="historyRealTimeDataDialog.show"
      ></history-realtime-data>
    <el-dialog :title="histroyDataTitle" width="1200px" :visible.sync="historyRealTimeDataDialog.show"
      :close-on-click-modal="false" top="0" class="dialog-center no-bg" :modal-append-to-body="false">
      <history-realtime-data :batt="currentBattObj" v-if="historyRealTimeDataDialog.show"></history-realtime-data>
    </el-dialog>
    <modal
      name="videoModal"
      :draggable="true"
      height="auto"
      :clickToClose="false"
    >
    <modal name="videoModal" :draggable="true" height="auto" :clickToClose="false">
      <div class="modal-title-wrapper">
        <div class="modal-title-content">视频监控</div>
        <div class="modal-title-tools">
@@ -285,1691 +113,1658 @@
      </div>
      <ez-video v-if="esVideoDialog" :sn="esVideoSn"></ez-video>
    </modal>
    <el-dialog
      title="历史内阻数据"
      width="1200px"
      :visible.sync="hisResDialog"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false"
    >
    <el-dialog title="历史内阻数据" width="1200px" :visible.sync="hisResDialog" :close-on-click-modal="false" top="0"
      class="dialog-center" :modal-append-to-body="false">
      <history-res v-if="hisResDialog" :batt="{}"></history-res>
    </el-dialog>
    <right-menu
      :visible.sync="rightMenu.show"
      :x="rightMenu.x"
      :y="rightMenu.y"
    >
    <right-menu :visible.sync="rightMenu.show" :x="rightMenu.x" :y="rightMenu.y">
      <div class="right-menu-list">
        <ul>
          <li>
            <a href="javascript:;" @click="payAttentionMon">添加关注单体</a>
          </li>
          <li>
            <a href="javascript:;" @click="hisResDialog = true"
              >导出历史内阻数据</a
            >
            <a href="javascript:;" @click="hisResDialog = true">导出历史内阻数据</a>
          </li>
        </ul>
      </div>
    </right-menu>
    <!-- 3d机房 -->
    <el-dialog
      title="3d机房"
      class="threeD-dialog"
      :visible.sync="station.show"
      :close-on-click-modal="false"
    >
    <el-dialog title="3d机房" class="threeD-dialog" :visible.sync="station.show" :close-on-click-modal="false">
      <div class="station-contain">
        <three-station :data="station.data"></three-station>
      </div>
      <!-- <div slot="footer">
          v-if="station.data.stationId"
        <el-button @click="station.show = false">关闭</el-button>
      </div> -->
            v-if="station.data.stationId"
          <el-button @click="station.show = false">关闭</el-button>
        </div> -->
    </el-dialog>
    <!-- 机房环境图集 -->
    <el-dialog
      title="机房环境图集"
      width="auto"
      :visible.sync="homeImageDialog"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false"
    >
      <home-image-list
        v-if="homeImageDialog"
        :batt="{}"
        :images="stationImages"
        @success="getStationPic"
      ></home-image-list>
    <el-dialog title="机房环境图集" width="auto" :visible.sync="homeImageDialog" :close-on-click-modal="false" top="0"
      class="dialog-center" :modal-append-to-body="false">
      <home-image-list v-if="homeImageDialog" :batt="{}" :images="stationImages"
        @success="getStationPic"></home-image-list>
    </el-dialog>
    <stop-outline-curing
      :dev-id="devId"
      :stop-time="stopTime"
    ></stop-outline-curing>
    <stop-outline-curing :dev-id="devId" :stop-time="stopTime"></stop-outline-curing>
    <!--  重启设备使用人脸识别  -->
    <el-dialog
      title="人脸校验"
      width="480px"
      :visible.sync="restartFaceShow"
      :close-on-click-modal="false"
      top="0"
      :modal="false"
      class="dialog-center"
      :modal-append-to-body="false"
      :destroy-on-close="true"
    >
      <check-face
        v-if="restartFaceShow"
        @checkSuccess="restartFaceSuccess"
      ></check-face>
    <el-dialog title="人脸校验" width="480px" :visible.sync="restartFaceShow" :close-on-click-modal="false" top="0"
      :modal="false" class="dialog-center" :modal-append-to-body="false" :destroy-on-close="true">
      <check-face v-if="restartFaceShow" @checkSuccess="restartFaceSuccess"></check-face>
    </el-dialog>
  </flex-layout>
</template>
<script>
import ContentBox from "@/components/ContentBox";
import BarChart from "@/components/chart/BarChart";
import ScienceBox from "@/components/ScienceBox";
import HdwLight from "@/components/HdwLight.vue";
import stopOutlineCuring from "./components/stopOutlineCuring";
// import HomeList from "./components/HomeList";
import HomeList from "./movingRingSystem/HomeList";
import DischargeDialogContent from "./components/DischargeDialogContent";
// import RestartPlanParams from "./components/RestartPlanParams";
import HistoryRealtimeData from "./components/HistoryRealtimeData";
import SvgHr from "@/components/svg/svgHr61853";
import RightMenu from "./components/RightMenu";
import historyRes from "./components/historyRes";
import ezVideo from "@/components/ezVideo";
import ElePriceTpl from "./components/elePriceTpl";
import qrCode from "@/assets/js/outside/qrCode";
import sysConfig from "@/assets/js/config";
    import ContentBox from "@/components/ContentBox";
    import BarChart from "@/components/chart/BarChart";
    import ScienceBox from "@/components/ScienceBox";
    import HdwLight from "@/components/HdwLight.vue";
    import stopOutlineCuring from "./components/stopOutlineCuring";
    // import HomeList from "./components/HomeList";
    import HomeList from "./movingRingSystem/HomeList";
    import DischargeDialogContent from "./components/DischargeDialogContent";
    // import RestartPlanParams from "./components/RestartPlanParams";
    import HistoryRealtimeData from "./components/HistoryRealtimeData";
    import SvgHr from "@/components/svg/svgHr61853";
    import RightMenu from "./components/RightMenu";
    import historyRes from "./components/historyRes";
    import ezVideo from "@/components/ezVideo";
    import ElePriceTpl from "./components/elePriceTpl";
    import qrCode from "@/assets/js/outside/qrCode";
    import sysConfig from "@/assets/js/config";
import {
  btsControl,
  getGuidesData,
  getStationPic,
  outlineControl as restart,
  realTimeAdd,
  realTimeAlarm,
  realTimeNot,
  searchInfo,
  startResTest,
} from "./js/realTime";
import {
  getBattGroupInfo,
  getBattRecords,
  getStationBattInfo,
} from "../dataMager/js/battGroupMager";
import { formatSeconds, getBarNum, isHasPermit } from "@/assets/js/tools";
    import {
        btsControl,
        getGuidesData,
        getStationPic,
        outlineControl as restart,
        realTimeAdd,
        realTimeAlarm,
        realTimeNot,
        searchInfo,
        startResTest,
    } from "./js/realTime";
    import {
        getBattGroupInfo,
        getBattRecords,
        getStationBattInfo,
    } from "../dataMager/js/battGroupMager";
    import { formatSeconds, getBarNum, isHasPermit } from "@/assets/js/tools";
import getMarkLineData from "@/components/chart/js/getMarkLineDataPlus";
    import getMarkLineData from "@/components/chart/js/getMarkLineDataPlus";
import getTblHeader from "./js/getTblHeader";
import ThreeStation from "@/components/threeStation";
    import getTblHeader from "./js/getTblHeader";
    import ThreeStation from "@/components/threeStation";
import createWs from "@/assets/js/websocket";
import HomeImageList from "@/components/homeImageList";
import { ExportFile } from "@/assets/js/tools/exportFile";
import const_digit from "@/assets/js/const/const_digit";
import FlexBox from "@/components/FlexBox.vue";
import BattAssetInfo from "@/views/dataMager/components/battAssetInfo.vue";
import { checkUserPwd } from "@/views/login/js/api";
import BattGroupAlarm from "@/views/dataTest/components/battGroupAlarm.vue";
import { getBit } from "@/assets/js/const/const_storage";
import RegularTestResParams from "@/views/dataTest/components/RegularTestResParams.vue";
import CheckFace from "@/components/checkFace.vue";
import hr61853Content from "./components/hr61853Content.vue";
import const_61853 from "@/assets/js/const/const_61853";
    import createWs from "@/assets/js/websocket";
    import HomeImageList from "@/components/homeImageList";
    import { ExportFile } from "@/assets/js/tools/exportFile";
    import const_digit from "@/assets/js/const/const_digit";
    import FlexBox from "@/components/FlexBox.vue";
    import BattAssetInfo from "@/views/dataMager/components/battAssetInfo.vue";
    import { checkUserPwd } from "@/views/login/js/api";
    import BattGroupAlarm from "@/views/dataTest/components/battGroupAlarm.vue";
    import { getBit } from "@/assets/js/const/const_storage";
    import RegularTestResParams from "@/views/dataTest/components/RegularTestResParams.vue";
    import CheckFace from "@/components/checkFace.vue";
    import hr61853Content from "./components/hr61853Content.vue";
    import const_61853 from "@/assets/js/const/const_61853";
const WSMixin = createWs("RealTime");
const {
  cap: CAP,
  vol: VOL,
  curr: CURR,
  res: RES,
  conduct: CONDUCT,
  temp: TEMP,
  hum: HUM,
} = const_digit;
    const WSMixin = createWs("RealTime");
    const {
        cap: CAP,
        vol: VOL,
        curr: CURR,
        res: RES,
        conduct: CONDUCT,
        temp: TEMP,
        hum: HUM,
    } = const_digit;
/* import moment from "moment"; */
let chartDatas = {
  vol0: {},
  vol1: {},
  resChart0: {},
  resChart1: {},
  temp0: {},
  temp1: {},
  curr0: {},
  curr1: {},
};
let tblData = [[], []];
export default {
  name: "movingRingSysteRrealTime",
  mixins: [WSMixin],
  components: {
    CheckFace,
    RegularTestResParams,
    BattGroupAlarm,
    BattAssetInfo,
    FlexBox,
    HomeImageList,
    stopOutlineCuring,
    ElePriceTpl,
    ezVideo,
    ContentBox,
    HomeList,
    BarChart,
    SvgHr,
    ScienceBox,
    DischargeDialogContent,
    HistoryRealtimeData,
    RightMenu,
    HdwLight,
    historyRes,
    ThreeStation,
    hr61853Content,
  },
  watch: {
    // "$route.params.BattGroupId"(battGroupId) {
    //   this.$nextTick(() => {
    //     this.getBattGroupInfo(battGroupId);
    //   });
    // },
    "$store.state.theme.collapse"() {
      this.$nextTick(() => {
        this.resize();
      });
    },
  },
  data() {
    let permits = this.$store.state.user.permits;
    let isCanTest = isHasPermit("batt_test_op_permit", permits);
    return {
      currentGroup: 0,
      stationInf: null,
      devId: "",
      startIdx: 0,
      battGroupIds: [0, 0],
      battDatas: [{}, {}],
      // 系统数据
      systemData: {
        workState: 0,
      },
      // 拓扑图上的实时数据
      svgRtdate: {
        workState: "浮充",
        workStateNum: 0,
        testGroupNum: 0,
        testTimeLong: 0,
        testCap: 0,
        batt0MinVol: 0,
        batt0MaxTemp: 0,
        batt0MinTemp: 0,
        batt1MaxVol: 0,
        batt1MinVol: 0,
        batt1MaxTemp: 0,
        batt1MinTemp: 0,
      },
      restartFaceShow: false,
      testNumber: 0,
      flowInfo: null,
      battRecords: [],
      lastTimeTestInfo: {
        realCap: 0,
        xuHang: 0,
      },
      guidesDialog: false,
      guidesVal: "",
      guidesData: {},
      // autoCheck: false,
      homeImageDialog: false,
      workPlanDialog: false,
      dcdcWorkDialog: false,
      balanceControlDialog: false,
      jcParamsDialog: false,
      hisResDialog: false,
      esVideoDialog: false,
      esVideoSn: "",
      maskShow: false,
      isCanTest: isCanTest,
      homeListShow: true,
      devVersion: "",
      username: sessionStorage.getItem("username"),
      stopTime: 0,
      stationImages: [],
      rightMenu: {
        show: false,
        x: 0,
        y: 0,
        xIndex: 0,
      },
      chargeMon: "",
      dischargeMon: "",
      acTabs: "eleLine",
      table: {
        headers: [
          {
            prop: "num1",
            label: "单体编号",
            width: "",
            key1: "",
            sortable: false,
          },
          {
            prop: "vol1",
            label: "电压(V)",
            width: "",
            sortable: true,
            key1: "vol",
          },
          {
            prop: "res1",
            label: "内阻(mΩ)",
            width: "",
            sortable: true,
            key1: "res",
          },
          {
            prop: "temp1",
            label: "温度(℃)",
            sortable: true,
            width: "",
            key1: "temp",
          },
          {
            prop: "curr1",
            label: "均衡电流(A)",
            sortable: true,
            width: "",
            key1: "curr",
          },
        ],
        datas: [],
      },
      stateListShow: false,
      // stateList: stateList,
      // lastCapacityTest: lastCapacityTest,
      diagram: {
        update: true,
        type: -1,
      },
      dischargeDialog: {
        show: false,
      },
      systemDialog: {
        show: false,
      },
      curingDialog: {
        show: false,
      },
      outlineCuringDialog: {
        show: false,
      },
      // restartPlanDialog: {
      //   show: false,
      // },
      historyRealTimeDataDialog: {
        show: false,
      },
      // 数据更新标识
      dataChangeFlag: 0,
      // 单体电压信息
      monVols: [],
      // 单体温度信息
      monTemps: [],
      station: {
        show: false,
        data: {
          stationId: 0,
          info: null,
        },
      },
    };
  },
  methods: {
    startHr(idx) {
      console.log("idx", idx, "=============");
      this.startIdx = idx;
      this.dischargeDialog.show = true;
    },
    changeGroup(idx) {
      this.currentGroup = idx;
      // 更新图表
      this.setChart();
      this.updateTable();
    },
    showEsVideoDialog() {
      this.esVideoDialog = true;
      this.$nextTick(() => {
        this.$modal.show("videoModal");
      });
    },
    closeEsVideoDialog() {
      this.$modal.hide("videoModal");
      this.$nextTick(() => {
        this.esVideoDialog = false;
      });
    },
    tabClick(tab) {
      this.acTabs = tab.name;
      // 根据tab更新电路图
      if (this.acTabs === "eleLine") {
        this.diagram.update = true;
      } else {
        this.diagram.update = false;
      }
      // 更新图表
      this.setChart();
    /* import moment from "moment"; */
    let chartDatas = {
        vol0: {},
        vol1: {},
        resChart0: {},
        resChart1: {},
        temp0: {},
        temp1: {},
        curr0: {},
        curr1: {},
    };
    let tblData = [[], []];
    export default {
        name: "movingRingSysteRrealTime",
        mixins: [WSMixin],
        components: {
            CheckFace,
            RegularTestResParams,
            BattGroupAlarm,
            BattAssetInfo,
            FlexBox,
            HomeImageList,
            stopOutlineCuring,
            ElePriceTpl,
            ezVideo,
            ContentBox,
            HomeList,
            BarChart,
            SvgHr,
            ScienceBox,
            DischargeDialogContent,
            HistoryRealtimeData,
            RightMenu,
            HdwLight,
            historyRes,
            ThreeStation,
            hr61853Content,
        },
        watch: {
            // "$route.params.BattGroupId"(battGroupId) {
            //   this.$nextTick(() => {
            //     this.getBattGroupInfo(battGroupId);
            //   });
            // },
            "$store.state.theme.collapse"() {
                this.$nextTick(() => {
                    this.resize();
                });
            },
        },
        data() {
            let permits = this.$store.state.user.permits;
            let isCanTest = isHasPermit("batt_test_op_permit", permits);
            return {
        alarmParams: {},
                currentGroup: 0,
                stationInf: null,
                devId: "",
                startIdx: 0,
                battGroupIds: [0, 0],
                battDatas: [{}, {}],
                // 系统数据
                systemData: {
                    workState: 0,
                },
                // 拓扑图上的实时数据
                svgRtdate: {
                    workState: "浮充",
                    workStateNum: 0,
                    testGroupNum: 0,
                    testTimeLong: 0,
                    testCap: 0,
                    batt0MinVol: 0,
                    batt0MaxTemp: 0,
                    batt0MinTemp: 0,
                    batt1MaxVol: 0,
                    batt1MinVol: 0,
                    batt1MaxTemp: 0,
                    batt1MinTemp: 0,
                },
                restartFaceShow: false,
                testNumber: 0,
                flowInfo: null,
                battRecords: [],
                lastTimeTestInfo: {
                    realCap: 0,
                    xuHang: 0,
                },
                guidesDialog: false,
                guidesVal: "",
                guidesData: {},
                // autoCheck: false,
                homeImageDialog: false,
                workPlanDialog: false,
                dcdcWorkDialog: false,
                balanceControlDialog: false,
                jcParamsDialog: false,
                hisResDialog: false,
                esVideoDialog: false,
                esVideoSn: "",
                maskShow: false,
                isCanTest: isCanTest,
                homeListShow: true,
                devVersion: "",
                username: sessionStorage.getItem("username"),
                stopTime: 0,
                stationImages: [],
                rightMenu: {
                    show: false,
                    x: 0,
                    y: 0,
                    xIndex: 0,
                },
                chargeMon: "",
                dischargeMon: "",
                acTabs: "eleLine",
                table: {
                    headers: [
                        {
                            prop: "num1",
                            label: "单体编号",
                            width: "",
                            key1: "",
                            sortable: false,
                        },
                        {
                            prop: "vol1",
                            label: "电压(V)",
                            width: "",
                            sortable: true,
                            key1: "vol",
                        },
                        {
                            prop: "res1",
                            label: "内阻(mΩ)",
                            width: "",
                            sortable: true,
                            key1: "res",
                        },
                        {
                            prop: "temp1",
                            label: "温度(℃)",
                            sortable: true,
                            width: "",
                            key1: "temp",
                        },
                        {
                            prop: "curr1",
                            label: "均衡电流(A)",
                            sortable: true,
                            width: "",
                            key1: "curr",
                        },
                    ],
                    datas: [],
                },
                stateListShow: false,
                // stateList: stateList,
                // lastCapacityTest: lastCapacityTest,
                diagram: {
                    update: true,
                    type: -1,
                },
                dischargeDialog: {
                    show: false,
                },
                systemDialog: {
                    show: false,
                },
                curingDialog: {
                    show: false,
                },
                outlineCuringDialog: {
                    show: false,
                },
                // restartPlanDialog: {
                //   show: false,
                // },
                historyRealTimeDataDialog: {
                    show: false,
                },
                // 数据更新标识
                dataChangeFlag: 0,
                // 单体电压信息
                monVols: [],
                // 单体温度信息
                monTemps: [],
        battInf0: {},
        battInf1: {},
                station: {
                    show: false,
                    data: {
                        stationId: 0,
                        info: null,
                    },
                },
            };
        },
        methods: {
            startHr(idx) {
                console.log("idx", idx, "=============");
                this.startIdx = idx;
                this.dischargeDialog.show = true;
            },
            changeGroup(idx) {
                this.currentGroup = idx;
        this.setLin();
                // 更新图表
                this.setChart();
                this.updateTable();
            },
            showEsVideoDialog() {
                this.esVideoDialog = true;
                this.$nextTick(() => {
                    this.$modal.show("videoModal");
                });
            },
            closeEsVideoDialog() {
                this.$modal.hide("videoModal");
                this.$nextTick(() => {
                    this.esVideoDialog = false;
                });
            },
            tabClick(tab) {
                this.acTabs = tab.name;
                // 根据tab更新电路图
                if (this.acTabs === "eleLine") {
                    this.diagram.update = true;
                } else {
                    this.diagram.update = false;
                }
                // 更新图表
                this.setChart();
      // 重置图表的大小
      this.$nextTick(() => {
        this.resize();
        // 设置表格的数据
        if (this.acTabs == "tblData") {
          this.updateTable();
        }
      });
    },
    toggleChange() {
      this.resize();
    },
    resize() {
      this.$G.chartManage.resize(this.acTabs);
      // if (isToggleChange) {
      const acTabs = this.acTabs;
      this.acTabs = "";
      this.$nextTick(() => {
        this.acTabs = acTabs;
      });
      // }
    },
    initChart() {
      // 电压
      chartDatas.vol0 = {
        title: {
          show: true,
          text: "最大值=0V;最小值=0V;平均值=0V",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "电压",
            type: "bar",
            data: [],
            markLine: {
              data: getMarkLineData(),
            },
          },
        ],
      };
      chartDatas.vol1 = {
        title: {
          show: true,
          text: "最大值=0V;最小值=0V;平均值=0V",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "电压",
            type: "bar",
            data: [],
            markLine: {
              data: getMarkLineData(),
            },
          },
        ],
      };
                // 重置图表的大小
                this.$nextTick(() => {
                    this.resize();
                    // 设置表格的数据
                    if (this.acTabs == "tblData") {
                        this.updateTable();
                    }
                });
            },
            toggleChange() {
                this.resize();
            },
            resize() {
                this.$G.chartManage.resize(this.acTabs);
                // if (isToggleChange) {
                const acTabs = this.acTabs;
                this.acTabs = "";
                this.$nextTick(() => {
                    this.acTabs = acTabs;
                });
                // }
            },
            initChart() {
                // 电压
                chartDatas.vol0 = {
                    title: {
                        show: true,
                        text: "最大值=0V;最小值=0V;平均值=0V",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "电压",
                            type: "bar",
                            data: [],
                            markLine: {
                                data: getMarkLineData(),
                            },
                        },
                    ],
                };
                chartDatas.vol1 = {
                    title: {
                        show: true,
                        text: "最大值=0V;最小值=0V;平均值=0V",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "电压",
                            type: "bar",
                            data: [],
                            markLine: {
                                data: getMarkLineData(),
                            },
                        },
                    ],
                };
      // 内阻
      chartDatas.resChart0 = {
        title: {
          show: true,
          text: "最大值=0mΩ;最小值=mΩ;平均值=0mΩ",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "内阻",
            type: "bar",
            data: [],
            markLine: {
              data: getMarkLineData(),
            },
          },
        ],
      };
      chartDatas.resChart1 = {
        title: {
          show: true,
          text: "最大值=0mΩ;最小值=mΩ;平均值=0mΩ",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "内阻",
            type: "bar",
            data: [],
            markLine: {
              data: getMarkLineData(),
            },
          },
        ],
      };
                // 内阻
                chartDatas.resChart0 = {
                    title: {
                        show: true,
                        text: "最大值=0mΩ;最小值=mΩ;平均值=0mΩ",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "内阻",
                            type: "bar",
                            data: [],
                            markLine: {
                                data: getMarkLineData(),
                            },
                        },
                    ],
                };
                chartDatas.resChart1 = {
                    title: {
                        show: true,
                        text: "最大值=0mΩ;最小值=mΩ;平均值=0mΩ",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "内阻",
                            type: "bar",
                            data: [],
                            markLine: {
                                data: getMarkLineData(),
                            },
                        },
                    ],
                };
      // 温度
      chartDatas.temp0 = {
        title: {
          show: true,
          text: "最大值=0℃;最小值=0℃;平均值=0℃",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "温度",
            type: "bar",
            data: [],
            markLine: {
              data: getMarkLineData(),
            },
          },
        ],
      };
      chartDatas.temp1 = {
        title: {
          show: true,
          text: "最大值=0℃;最小值=0℃;平均值=0℃",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "温度",
            type: "bar",
            data: [],
            markLine: {
              data: getMarkLineData(),
            },
          },
        ],
      };
                // 温度
                chartDatas.temp0 = {
                    title: {
                        show: true,
                        text: "最大值=0℃;最小值=0℃;平均值=0℃",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "温度",
                            type: "bar",
                            data: [],
                            markLine: {
                                data: getMarkLineData(),
                            },
                        },
                    ],
                };
                chartDatas.temp1 = {
                    title: {
                        show: true,
                        text: "最大值=0℃;最小值=0℃;平均值=0℃",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "温度",
                            type: "bar",
                            data: [],
                            markLine: {
                                data: getMarkLineData(),
                            },
                        },
                    ],
                };
      // 均衡电流
      chartDatas.curr0 = {
        title: {
          show: true,
          text: "最大值=0A;最小值=0A;平均值=0A",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "均衡电流",
            type: "bar",
            data: [],
          },
        ],
      };
      // 均衡电流
      chartDatas.curr1 = {
        title: {
          show: true,
          text: "最大值=0A;最小值=0A;平均值=0A",
          x: "center",
          textStyle: {
            fontSize: "14",
          },
        },
        series: [
          {
            name: "均衡电流",
            type: "bar",
            data: [],
          },
        ],
      };
                // 均衡电流
                chartDatas.curr0 = {
                    title: {
                        show: true,
                        text: "最大值=0A;最小值=0A;平均值=0A",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "均衡电流",
                            type: "bar",
                            data: [],
                        },
                    ],
                };
                // 均衡电流
                chartDatas.curr1 = {
                    title: {
                        show: true,
                        text: "最大值=0A;最小值=0A;平均值=0A",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                    series: [
                        {
                            name: "均衡电流",
                            type: "bar",
                            data: [],
                        },
                    ],
                };
      // 设置配置项
      this.setChart();
    },
    setChart() {
      let acTabs = this.acTabs;
      if (!this.$refs[acTabs]) {
        return;
      }
      let idx = this.currentGroup;
      switch (acTabs) {
        case "vol":
          this.$refs.vol.setOption(chartDatas["vol" + idx]);
          break;
        case "res":
          this.$refs.res.setOption(chartDatas["resChart" + idx]);
          break;
        case "temp":
          this.$refs.temp.setOption(chartDatas["temp" + idx]);
          break;
        case "curr":
          this.$refs.curr.setOption(chartDatas["curr" + idx]);
          break;
      }
    },
    onWSOpen() {
      this.$nextTick(() => {
        this.sendMessage();
      });
    },
    sendMessage() {
      let devId = this.devId;
      if (!devId || !this.isWSOpen) {
        return false;
      }
      let params = {
        devId,
        pageType: "intellect61853",
      };
      // console.log("=====9=", 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, "=====111data");
      let { binf, f9100state, rtdata0, rtdata1, rtstate0, rtstate1 } = data;
      if (!this.stationInf) {
        this.getStation(binf);
      }
                // 设置配置项
                this.setChart();
            },
            setChart() {
                let acTabs = this.acTabs;
                if (!this.$refs[acTabs]) {
                    return;
                }
                let idx = this.currentGroup;
                switch (acTabs) {
                    case "vol":
                        this.$refs.vol.setOption(chartDatas["vol" + idx]);
                        break;
                    case "res":
                        this.$refs.res.setOption(chartDatas["resChart" + idx]);
                        break;
                    case "temp":
                        this.$refs.temp.setOption(chartDatas["temp" + idx]);
                        break;
                    case "curr":
                        this.$refs.curr.setOption(chartDatas["curr" + idx]);
                        break;
                }
            },
            onWSOpen() {
                this.$nextTick(() => {
                    this.sendMessage();
                });
            },
            sendMessage() {
                let devId = this.devId;
                if (!devId || !this.isWSOpen) {
                    return false;
                }
                let params = {
                    devId,
                    pageType: "intellect61853",
                };
                // console.log("=====9=", 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, "=====111data");
                let { binf0, binf1, f9100state, rtdata0, rtdata1, rtstate0, rtstate1 } = data;
                if (!this.stationInf) {
                    this.getStation(binf0);
          this.battInf0 = binf0;
          this.battInf1 = binf1;
      //
      this.realTimePowerOffs(f9100state);
      this.realTimeSearch(rtdata0, 0);
      this.realTimeSearch(rtdata1, 1);
      // 准备拓扑图实时数据
      this.realTimeTopology(f9100state, rtdata0, rtdata1, rtstate0, rtstate1);
          this.setLin();
                }
      if (rtstate0.code && rtstate0.data) {
        this.battGroupIds[0] = rtstate0.data2.battGroupId;
        this.battDatas[0] = rtstate0.data2;
      }
      if (rtstate1 && rtstate1.code && rtstate1.data) {
        this.battGroupIds[1] = rtstate1.data2.battGroupId;
        this.battDatas[1] = rtstate1.data2;
      }
                //
                this.realTimePowerOffs(f9100state);
                this.realTimeSearch(rtdata0, 0);
                this.realTimeSearch(rtdata1, 1);
                // 准备拓扑图实时数据
                this.realTimeTopology(f9100state, rtdata0, rtdata1, rtstate0, rtstate1);
      this.dataChangeFlag = Math.random(); // 数据更新
    },
    realTimeTopology(f9100state, rtdata0, rtdata1, rtstate0, rtstate1) {
      if (this.isLink) {
        this.svgRtdate = {
          workState: "浮充",
          workStateNum: 0,
          testGroupNum: 0,
          testTimelong: 0,
          testCap: 0,
          batt0MaxVol: 0,
          batt0MinVol: 0,
          batt0MaxTemp: 0,
          batt0MinTemp: 0,
          batt1MaxVol: 0,
          batt1MinVol: 0,
          batt1MaxTemp: 0,
          batt1MinTemp: 0,
        };
        return false;
      }
      let testTimelong = 0;
      let testCap = 0;
      let testGroupNum = 0;
      if (f9100state.code && f9100state.data) {
        let _data = f9100state.data2;
        testTimelong = _data.devCaptestTimelong;
        testCap = _data.devCaptestCap.toHold(CAP);
        testGroupNum = _data.devTestgroupnum;
      }
      let batt0Rtdata,
        batt1Rtdata,
        batt0MinVol,
        batt0MaxVol,
        batt0MinTemp,
        batt0MaxTemp,
        batt1MinVol,
        batt1MaxVol,
        batt1MinTemp,
        batt1MaxTemp,
        batt0MinVolIdx,
        batt0MaxVolIdx,
        batt0MinTempIdx,
        batt0MaxTempIdx,
        batt1MinVolIdx,
        batt1MaxVolIdx,
        batt1MinTempIdx,
        batt1MaxTempIdx;
                if (rtstate0.code && rtstate0.data) {
                    this.battGroupIds[0] = rtstate0.data2.battGroupId;
                    this.battDatas[0] = rtstate0.data2;
                }
                if (rtstate1 && rtstate1.code && rtstate1.data) {
                    this.battGroupIds[1] = rtstate1.data2.battGroupId;
                    this.battDatas[1] = rtstate1.data2;
                }
      if (rtstate0.code && rtstate0.data) {
        batt0Rtdata = rtstate0.data2;
      }
      if (rtstate1 && rtstate1.code && rtstate1.data) {
        batt1Rtdata = rtstate1.data2;
      }
      if (rtdata0.code && rtdata0.data) {
        let _list = rtdata0.data2.list;
        for (let i = 0, len = _list.length; i < len; i++) {
          if (i === 0) {
            batt0MinVol = _list[i].monVol;
            batt0MaxVol = _list[i].monVol;
            batt0MinTemp = _list[i].monTmp;
            batt0MaxTemp = _list[i].monTmp;
            batt0MinVolIdx = i;
            batt0MaxVolIdx = i;
            batt0MinTempIdx = i;
            batt0MaxTempIdx = i;
          } else {
            if (_list[i].monVol < batt0MinVol) {
              batt0MinVol = _list[i].monVol;
              batt0MinVolIdx = i;
            }
            if (_list[i].monVol > batt0MaxVol) {
              batt0MaxVol = _list[i].monVol;
              batt0MaxVolIdx = i;
            }
            if (_list[i].monTmp < batt0MinTemp) {
              batt0MinTemp = _list[i].monTmp;
              batt0MinTempIdx = i;
            }
            if (_list[i].monTmp > batt0MaxTemp) {
              batt0MaxTemp = _list[i].monTmp;
              batt0MaxTempIdx = i;
            }
          }
        }
      }
      if (rtdata1 && rtdata1.code && rtdata1.data) {
        let _list = rtdata1.data2.list;
        for (let i = 0, len = _list.length; i < len; i++) {
          if (i === 0) {
            batt1MinVol = _list[i].monVol;
            batt1MaxVol = _list[i].monVol;
            batt1MinTemp = _list[i].monTmp;
            batt1MaxTemp = _list[i].monTmp;
            batt1MinVolIdx = i;
            batt1MaxVolIdx = i;
            batt1MinTempIdx = i;
            batt1MaxTempIdx = i;
          } else {
            if (_list[i].monVol < batt1MinVol) {
              batt1MinVol = _list[i].monVol;
              batt1MinVolIdx = i;
            }
            if (_list[i].monVol > batt1MaxVol) {
              batt1MaxVol = _list[i].monVol;
              batt1MaxVolIdx = i;
            }
            if (_list[i].monTmp < batt1MinTemp) {
              batt1MinTemp = _list[i].monTmp;
              batt1MinTempIdx = i;
            }
            if (_list[i].monTmp > batt1MaxTemp) {
              batt1MaxTemp = _list[i].monTmp;
              batt1MaxTempIdx = i;
            }
          }
        }
      }
                this.dataChangeFlag = Math.random(); // 数据更新
            },
            realTimeTopology(f9100state, rtdata0, rtdata1, rtstate0, rtstate1) {
                if (this.isLink) {
                    this.svgRtdate = {
                        workState: "浮充",
                        workStateNum: 0,
                        testGroupNum: 0,
                        testTimelong: 0,
                        testCap: 0,
                        batt0MaxVol: 0,
                        batt0MinVol: 0,
                        batt0MaxTemp: 0,
                        batt0MinTemp: 0,
                        batt1MaxVol: 0,
                        batt1MinVol: 0,
                        batt1MaxTemp: 0,
                        batt1MinTemp: 0,
                    };
                    return false;
                }
                let testTimelong = 0;
                let testCap = 0;
                let testGroupNum = 0;
                if (f9100state.code && f9100state.data) {
                    let _data = f9100state.data2;
                    testTimelong = _data.devCaptestTimelong;
                    testCap = _data.devCaptestCap.toHold(CAP);
                    testGroupNum = _data.devTestgroupnum;
                }
                let batt0Rtdata,
                    batt1Rtdata,
                    batt0MinVol,
                    batt0MaxVol,
                    batt0MinTemp,
                    batt0MaxTemp,
                    batt1MinVol,
                    batt1MaxVol,
                    batt1MinTemp,
                    batt1MaxTemp,
                    batt0MinVolIdx,
                    batt0MaxVolIdx,
                    batt0MinTempIdx,
                    batt0MaxTempIdx,
                    batt1MinVolIdx,
                    batt1MaxVolIdx,
                    batt1MinTempIdx,
                    batt1MaxTempIdx;
      this.svgRtdate = {
        workState: this.workState,
        workStateNum: this.systemData.workState,
        testGroupNum,
        testTimelong,
        testCap,
        batt0Rtdata,
        batt1Rtdata,
        batt0MaxVol: `${batt0MaxVolIdx + 1}# ${batt0MaxVol}`,
        batt0MinVol: `${batt0MinVolIdx + 1}# ${batt0MinVol}`,
        batt0MaxTemp: `${batt0MaxTempIdx + 1}# ${batt0MaxTemp}`,
        batt0MinTemp: `${batt0MinTempIdx + 1}# ${batt0MinTemp}`,
        batt1MaxVol: `${batt1MaxVolIdx + 1}# ${batt1MaxVol}`,
        batt1MinVol: `${batt1MinVolIdx + 1}# ${batt1MinVol}`,
        batt1MaxTemp: `${batt1MaxTempIdx + 1}# ${batt1MaxTemp}`,
        batt1MinTemp: `${batt1MinTempIdx + 1}# ${batt1MinTemp}`,
      };
    },
    getStation(obj) {
      if (obj) {
        this.stationInf = {
          stationName1: obj.stationName1,
          stationName2: obj.stationName2,
          stationName3: obj.stationName3,
          stationName4: obj.stationName4,
          stationName5: obj.stationName5,
          stationName:
            obj.stationName1 +
            "-" +
            obj.stationName2 +
            "-" +
            obj.stationName5 +
            "-" +
            obj.stationName3,
        };
      }
    },
    checkDischarge(testNumber, params) {
      if (
        testNumber &&
        testNumber.code &&
        testNumber.data &&
        testNumber.data2
      ) {
        // 年度已放过电
        this.testNumber = testNumber.data2;
      } else {
        this.testNumber = 0;
      }
      if (params && params.code && params.data) {
        this.flowInfo = params.data2;
      } else {
        this.flowInfo = null;
      }
    },
    // getBattGroupInfo(battGroupId) {
    //   this.homeListShow = false;
    //   getBattGroupInfo(battGroupId)
    //     .then((res) => {
    //       res = res.data;
    //       if (res.code) {
    //         this.leafClick(res.data[0]);
    //       } else {
    //         this.$layer.msg("未获取到电池组的信息");
    //       }
    //     })
    //     .catch((error) => {
    //       console.log(error);
    //     });
    // },
    leafClick(data) {
      // 查询机房电池组信息(3D用)
      this.getStationBattInfo(data.stationId);
      this.realTimeAlarmss();
      this.getBattRecords(data.battGroupId);
      this.esVideoSn = data.videoUrl;
      this.table.headers = getTblHeader(data.fbsdeviceId);
      this.$nextTick(() => {
        this.changeTabsName();
        // 开启循环请求
        this.sendMessage();
        // 获取机房的图片
        this.getStationPic();
      });
    },
    getStationBattInfo(id) {
      getStationBattInfo(id).then((res) => {
        res = res.data;
        // console.log(res, '======res?a');
        if (res.code && res.data.length) {
          this.station.data.stationId = res.data[0].stationId;
          this.station.data.info = res.data;
        }
      });
    },
    /**
     * 根据设备类型修改Tabs选中状态
     */
    changeTabsName() {
      // if (this.isLd9) {
      //   this.acTabs = "vol";
      // }
                if (rtstate0.code && rtstate0.data) {
                    batt0Rtdata = rtstate0.data2;
                }
                if (rtstate1 && rtstate1.code && rtstate1.data) {
                    batt1Rtdata = rtstate1.data2;
                }
                if (rtdata0.code && rtdata0.data) {
                    let _list = rtdata0.data2.list;
                    for (let i = 0, len = _list.length; i < len; i++) {
                        if (i === 0) {
                            batt0MinVol = _list[i].monVol;
                            batt0MaxVol = _list[i].monVol;
                            batt0MinTemp = _list[i].monTmp;
                            batt0MaxTemp = _list[i].monTmp;
                            batt0MinVolIdx = i;
                            batt0MaxVolIdx = i;
                            batt0MinTempIdx = i;
                            batt0MaxTempIdx = i;
                        } else {
                            if (_list[i].monVol < batt0MinVol) {
                                batt0MinVol = _list[i].monVol;
                                batt0MinVolIdx = i;
                            }
                            if (_list[i].monVol > batt0MaxVol) {
                                batt0MaxVol = _list[i].monVol;
                                batt0MaxVolIdx = i;
                            }
                            if (_list[i].monTmp < batt0MinTemp) {
                                batt0MinTemp = _list[i].monTmp;
                                batt0MinTempIdx = i;
                            }
                            if (_list[i].monTmp > batt0MaxTemp) {
                                batt0MaxTemp = _list[i].monTmp;
                                batt0MaxTempIdx = i;
                            }
                        }
                    }
                }
                if (rtdata1 && rtdata1.code && rtdata1.data) {
                    let _list = rtdata1.data2.list;
                    for (let i = 0, len = _list.length; i < len; i++) {
                        if (i === 0) {
                            batt1MinVol = _list[i].monVol;
                            batt1MaxVol = _list[i].monVol;
                            batt1MinTemp = _list[i].monTmp;
                            batt1MaxTemp = _list[i].monTmp;
                            batt1MinVolIdx = i;
                            batt1MaxVolIdx = i;
                            batt1MinTempIdx = i;
                            batt1MaxTempIdx = i;
                        } else {
                            if (_list[i].monVol < batt1MinVol) {
                                batt1MinVol = _list[i].monVol;
                                batt1MinVolIdx = i;
                            }
                            if (_list[i].monVol > batt1MaxVol) {
                                batt1MaxVol = _list[i].monVol;
                                batt1MaxVolIdx = i;
                            }
                            if (_list[i].monTmp < batt1MinTemp) {
                                batt1MinTemp = _list[i].monTmp;
                                batt1MinTempIdx = i;
                            }
                            if (_list[i].monTmp > batt1MaxTemp) {
                                batt1MaxTemp = _list[i].monTmp;
                                batt1MaxTempIdx = i;
                            }
                        }
                    }
                }
      this.$nextTick(() => {
        this.resize();
      });
    },
    /* 查询电池告警参数 */
    realTimeAlarmss() {
      let devId = this.devId;
      realTimeAlarm({
        devId,
      }).then((res) => {
        res = res.data;
        this.setLin(res);
      });
    },
    // 设置高低线参考线
    setLin: function (res) {
      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(
          resChart,
          "Resistance",
          "Batt_Alarm_Type_MonRes",
          list
        );
      }
    },
    setChartMarkLine(chartData, name, almName, list) {
      let batt = {};
      // 遍历list
      for (let i = 0; i < list.length; i++) {
        let item = list[i];
        if (item.almName == almName) {
          let high = 0;
          let highHigh = 0;
          let low = 0;
          let lowLow = 0;
          let guides = 0;
          switch (name) {
            case "Voltage": // 电压告警
              //单体电压
              let std_mon_vol = batt.monVolStd;
              high = parseFloat(std_mon_vol * item.almHighCoe).toHold(VOL);
              highHigh = parseFloat(std_mon_vol * item.almHighCoeUpper).toHold(
                VOL
              );
              low = parseFloat(std_mon_vol * item.almLowCoe).toHold(VOL);
              lowLow = parseFloat(std_mon_vol * item.almLowCoeLower).toHold(
                VOL
              );
              if (this.cdshStatus == "cdsh") {
                guides = this.guidesData.monVol;
              }
              break;
            case "Temperature":
              //单体温度
              let std_mon_tmp = 25;
              high = parseFloat(std_mon_tmp * item.almHighCoe).toHold(TEMP);
              highHigh = parseFloat(std_mon_tmp * item.almHighCoeUpper).toHold(
                TEMP
              );
              low = parseFloat(std_mon_tmp * item.almLowCoe).toHold(TEMP);
              lowLow = parseFloat(std_mon_tmp * item.almLowCoeLower).toHold(
                TEMP
              );
              if (this.cdshStatus == "cdsh") {
                guides = this.guidesData.monTemp;
              }
              break;
            case "Resistance":
              // 单体电阻
              // 单位内阻告警基准值从电池信息中取标称内阻值来计算  20240428
              // let std_mon_res =
              //   (1 * (batt.monVolStd / 2)) / (batt.monCapStd / 100);
              let std_mon_res = batt.monResStd;
              high = parseFloat(std_mon_res * item.almHighCoe).toHold(RES);
              highHigh = parseFloat(std_mon_res * item.almHighCoeUpper).toHold(
                RES
              );
              low = parseFloat(std_mon_res * item.almLowCoe).toHold(RES);
              lowLow = parseFloat(std_mon_res * item.almLowCoeLower).toHold(
                RES
              );
              if (this.cdshStatus == "cdsh") {
                guides = this.guidesData.monRes;
              }
              break;
          }
          // debugger
          // 下限预告警
          chartData.series[0].markLine.data[0].yAxis = low;
          // 下限告警
          chartData.series[0].markLine.data[1].yAxis = lowLow;
          // 上限预告警
          chartData.series[0].markLine.data[2].yAxis = high;
          // 上限告警
          chartData.series[0].markLine.data[3].yAxis = highHigh;
          if (this.cdshStatus == "cdsh") {
            //参考线
            chartData.series[0].markLine.data[4].yAxis = guides;
          }
                this.svgRtdate = {
                    workState: this.workState,
                    workStateNum: this.systemData.workState,
                    testGroupNum,
                    testTimelong,
                    testCap,
                    batt0Rtdata,
                    batt1Rtdata,
                    batt0MaxVol: `${batt0MaxVolIdx + 1}# ${batt0MaxVol}`,
                    batt0MinVol: `${batt0MinVolIdx + 1}# ${batt0MinVol}`,
                    batt0MaxTemp: `${batt0MaxTempIdx + 1}# ${batt0MaxTemp}`,
                    batt0MinTemp: `${batt0MinTempIdx + 1}# ${batt0MinTemp}`,
                    batt1MaxVol: `${batt1MaxVolIdx + 1}# ${batt1MaxVol}`,
                    batt1MinVol: `${batt1MinVolIdx + 1}# ${batt1MinVol}`,
                    batt1MaxTemp: `${batt1MaxTempIdx + 1}# ${batt1MaxTemp}`,
                    batt1MinTemp: `${batt1MinTempIdx + 1}# ${batt1MinTemp}`,
                };
            },
            getStation(obj) {
                if (obj) {
                    this.stationInf = {
                        stationName1: obj.stationName1,
                        stationName2: obj.stationName2,
                        stationName3: obj.stationName3,
                        stationName4: obj.stationName4,
                        stationName5: obj.stationName5,
                        stationName:
                            obj.stationName1 +
                            "-" +
                            obj.stationName2 +
                            "-" +
                            obj.stationName5 +
                            "-" +
                            obj.stationName3,
                    };
                }
            },
            checkDischarge(testNumber, params) {
                if (
                    testNumber &&
                    testNumber.code &&
                    testNumber.data &&
                    testNumber.data2
                ) {
                    // 年度已放过电
                    this.testNumber = testNumber.data2;
                } else {
                    this.testNumber = 0;
                }
                if (params && params.code && params.data) {
                    this.flowInfo = params.data2;
                } else {
                    this.flowInfo = null;
                }
            },
            // getBattGroupInfo(battGroupId) {
            //   this.homeListShow = false;
            //   getBattGroupInfo(battGroupId)
            //     .then((res) => {
            //       res = res.data;
            //       if (res.code) {
            //         this.leafClick(res.data[0]);
            //       } else {
            //         this.$layer.msg("未获取到电池组的信息");
            //       }
            //     })
            //     .catch((error) => {
            //       console.log(error);
            //     });
            // },
            leafClick(data) {
                // 查询机房电池组信息(3D用)
                this.getStationBattInfo(data.stationId);
                this.realTimeAlarmss();
                this.getBattRecords(data.battGroupId);
                this.esVideoSn = data.videoUrl;
                this.table.headers = getTblHeader(data.fbsdeviceId);
                this.$nextTick(() => {
                    this.changeTabsName();
                    // 开启循环请求
                    this.sendMessage();
                    // 获取机房的图片
                    this.getStationPic();
                });
            },
            getStationBattInfo(id) {
                getStationBattInfo(id).then((res) => {
                    res = res.data;
                    // console.log(res, '======res?a');
                    if (res.code && res.data.length) {
                        this.station.data.stationId = res.data[0].stationId;
                        this.station.data.info = res.data;
                    }
                });
            },
            /**
             * 根据设备类型修改Tabs选中状态
             */
            changeTabsName() {
                // if (this.isLd9) {
                //   this.acTabs = "vol";
                // }
          // 单体电压柱状图添加标称电压横线
          if (name === "Voltage") {
            chartData.series[0].markLine.data.push({
              name: "浮充电压",
              yAxis: (batt.monVolStd / 2) * 2.25,
              lineStyle: {
                width: 2,
                color: "#073ff6",
              },
              label: {
                color: "#ffffff",
                fontSize: 16,
                formatter: "{b}:{c}V",
                position: "insideEndTop",
                padding: [6, 4, 2, 4],
                backgroundColor: "#073ff680",
                borderWidth: 2,
                borderColor: "#ffffff80",
              },
              emphasis: {
                type: "dashed",
              },
            });
          }
          break;
        }
      }
    },
    // 获取电池组参考线
    getGuides: function (resdata) {
      let vm = this;
      let batt = {};
      let obj = {
        battGroupId: batt.battGroupId,
      };
      getGuidesData(obj).then((res) => {
        let rs = res.data;
        if (rs.code == 1) {
          vm.guidesData = rs.data;
          //console.log(vm.guidesData);
          vm.setLin(resdata);
        }
        //console.log(vm.guidesData);
      });
    },
                this.$nextTick(() => {
                    this.resize();
                });
            },
            /* 查询电池告警参数 */
            realTimeAlarmss() {
                let devId = this.devId;
                realTimeAlarm({
                    devId,
                }).then((res) => {
                    // res = res.data;
          this.alarmParams = res.data;
    /* 查询电路图开关状态和信息 */
    realTimePowerOffs(res) {
      // 查询后台数据
      if (res) {
        // res = res.data;
        let outTime = 2 * 60; //设备超时时间(2分钟)
        if (res.code && res.data) {
          let data = res.data2;
          // 设置版本号
          this.devVersion = data.devVersion;
          // 判断是否超时
          let nowTime = new Date(data.note).getTime(); //当前时间
          let record = new Date(data.recordDatetime).getTime();
          // 开启模拟
          if (sysConfig.analogData.value) {
            nowTime = new Date(data.recordDatetime).getTime();
          }
          if (Math.abs(nowTime - record) / 1000 > outTime) {
            this.disconnect();
          } else {
            this.diagram.type = 1;
            this.systemData.workState = data.devWorkstate;
          }
        } else {
          // 设置版本号
          this.devVersion = "";
          // 设备处于未连接
          this.disconnect();
        }
      }
    },
    disconnect() {
      // 设备未连接
      this.diagram.type = -1;
      this.diagram.temp = 0;
                    // this.setLin();
                });
            },
            // 设置高低线参考线
            setLin: function () {
        let res = this.alarmParams;
        let idx = this.currentGroup;
                if (res.code) {
                    let list = res.data.list;
                    // 单体电压
                    this.setChartMarkLine(chartDatas['vol' + idx], "Voltage", "Batt_Alarm_Type_MonVol", list);
                    // 单体温度
                    this.setChartMarkLine(
                        chartDatas['temp' + idx],
                        "Temperature",
                        "Batt_Alarm_Type_MonTmp",
                        list
                    );
                    // 单体内阻
                    this.setChartMarkLine(
                        chartDatas['resChart' + idx],
                        "Resistance",
                        "Batt_Alarm_Type_MonRes",
                        list
                    );
                }
            },
            setChartMarkLine(chartData, name, almName, list) {
                let batt = this['battInf' + this.currentGroup];
                // 遍历list
                for (let i = 0; i < list.length; i++) {
                    let item = list[i];
                    if (item.almName == almName) {
                        let high = 0;
                        let highHigh = 0;
                        let low = 0;
                        let lowLow = 0;
                        let guides = 0;
                        switch (name) {
                            case "Voltage": // 电压告警
                                //单体电压
                                let std_mon_vol = batt.monVolStd;
                                high = parseFloat(std_mon_vol * item.almHighCoe).toHold(VOL);
                                highHigh = parseFloat(std_mon_vol * item.almHighCoeUpper).toHold(
                                    VOL
                                );
                                low = parseFloat(std_mon_vol * item.almLowCoe).toHold(VOL);
                                lowLow = parseFloat(std_mon_vol * item.almLowCoeLower).toHold(
                                    VOL
                                );
                                // if (this.cdshStatus == "cdsh") {
                                //   guides = this.guidesData.monVol;
                                // }
                                break;
                            case "Temperature":
                                //单体温度
                                let std_mon_tmp = 25;
                                high = parseFloat(std_mon_tmp * item.almHighCoe).toHold(TEMP);
                                highHigh = parseFloat(std_mon_tmp * item.almHighCoeUpper).toHold(
                                    TEMP
                                );
                                low = parseFloat(std_mon_tmp * item.almLowCoe).toHold(TEMP);
                                lowLow = parseFloat(std_mon_tmp * item.almLowCoeLower).toHold(
                                    TEMP
                                );
                                // if (this.cdshStatus == "cdsh") {
                                //   guides = this.guidesData.monTemp;
                                // }
                                break;
                            case "Resistance":
                                // 单体电阻
                                // 单位内阻告警基准值从电池信息中取标称内阻值来计算  20240428
                                // let std_mon_res =
                                //   (1 * (batt.monVolStd / 2)) / (batt.monCapStd / 100);
                                let std_mon_res = batt.monResStd;
                                high = parseFloat(std_mon_res * item.almHighCoe).toHold(RES);
                                highHigh = parseFloat(std_mon_res * item.almHighCoeUpper).toHold(
                                    RES
                                );
                                low = parseFloat(std_mon_res * item.almLowCoe).toHold(RES);
                                lowLow = parseFloat(std_mon_res * item.almLowCoeLower).toHold(
                                    RES
                                );
                                // if (this.cdshStatus == "cdsh") {
                                //   guides = this.guidesData.monRes;
                                // }
                                break;
                        }
                        // debugger
                        // 下限预告警
                        chartData.series[0].markLine.data[0].yAxis = low;
                        // 下限告警
                        chartData.series[0].markLine.data[1].yAxis = lowLow;
                        // 上限预告警
                        chartData.series[0].markLine.data[2].yAxis = high;
                        // 上限告警
                        chartData.series[0].markLine.data[3].yAxis = highHigh;
      // 显示遮罩层
      this.maskShow = true;
    },
    setTableRowClass({ row }) {
      if (row.monState == 1) {
        return "red-row";
      } else if (row.monState == 2) {
        return "green-row";
      }
      return "";
    },
    /* echars图表 */
    realTimeSearch(res, idx) {
      //console.log(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.toHold(VOL),
              res1: item.monRes.toHold(RES),
              temp1: item.monTmp.toHold(TEMP),
              conduct1: item.monRes
                ? ((1 / item.monRes) * 1000).toHold(CONDUCT)
                : 0,
              curr1: item.monJhCurr.toHold(CURR),
              leakVol1: item.monLyVol.toHold(VOL),
              monConnRes: item.monConnRes.toHold(RES),
              monCap: item.monCap.toHold(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,
            };
          });
        }
                        // 单体电压柱状图添加标称电压横线
                        if (name === "Voltage") {
                            chartData.series[0].markLine.data.push({
                                name: "浮充电压",
                                yAxis: (batt.monVolStd / 2) * 2.25,
                                lineStyle: {
                                    width: 2,
                                    color: "#073ff6",
                                },
                                label: {
                                    color: "#ffffff",
                                    fontSize: 16,
                                    formatter: "{b}:{c}V",
                                    position: "insideEndTop",
                                    padding: [6, 4, 2, 4],
                                    backgroundColor: "#073ff680",
                                    borderWidth: 2,
                                    borderColor: "#ffffff80",
                                },
                                emphasis: {
                                    type: "dashed",
                                },
                            });
                        }
                        break;
                    }
                }
            },
            // 获取电池组参考线
            getGuides: function (resdata) {
                let vm = this;
                let batt = {};
                let obj = {
                    battGroupId: batt.battGroupId,
                };
                getGuidesData(obj).then((res) => {
                    let rs = res.data;
                    if (rs.code == 1) {
                        vm.guidesData = rs.data;
                        //console.log(vm.guidesData);
                        vm.setLin(resdata);
                    }
                    //console.log(vm.guidesData);
                });
            },
        // 添加正在测试的单体
        this.chargeMon = chargeMon;
        this.dischargeMon = dischargeMon;
            /* 查询电路图开关状态和信息 */
            realTimePowerOffs(res) {
                // 查询后台数据
                if (res) {
                    // res = res.data;
                    let outTime = 2 * 60; //设备超时时间(2分钟)
                    if (res.code && res.data) {
                        let data = res.data2;
                        // 设置版本号
                        this.devVersion = data.devVersion;
        tblData[idx] = data;
                        // 判断是否超时
                        let nowTime = new Date(data.note).getTime(); //当前时间
                        let record = new Date(data.recordDatetime).getTime();
                        // 开启模拟
                        if (sysConfig.analogData.value) {
                            nowTime = new Date(data.recordDatetime).getTime();
                        }
                        if (Math.abs(nowTime - record) / 1000 > outTime) {
                            this.disconnect();
                        } else {
                            this.diagram.type = 1;
                            this.systemData.workState = data.devWorkstate;
                        }
                    } else {
                        // 设置版本号
                        this.devVersion = "";
                        // 设备处于未连接
                        this.disconnect();
                    }
                }
            },
            disconnect() {
                // 设备未连接
                this.diagram.type = -1;
                this.diagram.temp = 0;
        // 电压值
        let volTempVol = [];
        if (res.code && res.data) {
          volTempVol = res.data2.list.map((item) => {
            let value = diagramType == -1 ? 0 : item.monVol.toHold(VOL);
            return ["#" + item.monNum, value];
          });
        }
                // 显示遮罩层
                this.maskShow = true;
            },
            setTableRowClass({ row }) {
                if (row.monState == 1) {
                    return "red-row";
                } else if (row.monState == 2) {
                    return "green-row";
                }
                return "";
            },
            /* echars图表 */
            realTimeSearch(res, idx) {
                //console.log(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.toHold(VOL),
                                res1: item.monRes.toHold(RES),
                                temp1: item.monTmp.toHold(TEMP),
                                conduct1: item.monRes
                                    ? ((1 / item.monRes) * 1000).toHold(CONDUCT)
                                    : 0,
                                curr1: item.monJhCurr.toHold(CURR),
                                leakVol1: item.monLyVol.toHold(VOL),
                                monConnRes: item.monConnRes.toHold(RES),
                                monCap: item.monCap.toHold(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.monVols = volTempVol.map((item) => {
          return item[1];
        });
                    // 添加正在测试的单体
                    this.chargeMon = chargeMon;
                    this.dischargeMon = dischargeMon;
        let volBarNum = getBarNum(volTempVol);
        chartDatas["vol" + idx].title.text =
          "最大值=" +
          volBarNum.max.toHold(VOL) +
          "V  最小值=" +
          volBarNum.min.toHold(VOL) +
          "V  平均值=" +
          volBarNum.avg.toHold(VOL) +
          "V";
        chartDatas["vol" + idx].series[0].data = volTempVol;
                    tblData[idx] = data;
        // 内阻
        let volTempres = [];
        if (res.code && res.data) {
          volTempres = res.data2.list.map((item) => {
            let value = diagramType == -1 ? 0 : item.monRes.toHold(RES);
            return ["#" + item.monNum, value];
          });
        }
        let resBarNum = getBarNum(volTempres);
        chartDatas["resChart" + idx].title.text =
          "最大值=" +
          resBarNum.max.toHold(RES) +
          "mΩ  最小值=" +
          resBarNum.min.toHold(RES) +
          "mΩ  平均值=" +
          resBarNum.avg.toHold(RES) +
          "mΩ";
        chartDatas["resChart" + idx].series[0].data = volTempres;
                    // 电压值
                    let volTempVol = [];
                    if (res.code && res.data) {
                        volTempVol = res.data2.list.map((item) => {
                            let value = diagramType == -1 ? 0 : item.monVol.toHold(VOL);
                            return ["#" + item.monNum, value];
                        });
                    }
        // 温度
        let volTempte = [];
        if (res.code && res.data) {
          volTempte = res.data2.list.map((item) => {
            let value = diagramType == -1 ? 0 : item.monTmp.toHold(TEMP);
            return ["#" + item.monNum, value];
          });
        }
                    // 设置电压值
                    this.monVols = volTempVol.map((item) => {
                        return item[1];
                    });
        this.monTemps = volTempte.map((item) => {
          return item[1];
        });
                    let volBarNum = getBarNum(volTempVol);
                    chartDatas["vol" + idx].title.text =
                        "最大值=" +
                        volBarNum.max.toHold(VOL) +
                        "V  最小值=" +
                        volBarNum.min.toHold(VOL) +
                        "V  平均值=" +
                        volBarNum.avg.toHold(VOL) +
                        "V";
                    chartDatas["vol" + idx].series[0].data = volTempVol;
        let tempBarNum = getBarNum(volTempte);
        chartDatas["temp" + idx].title.text =
          "最大值=" +
          tempBarNum.max.toHold(TEMP) +
          "℃  最小值=" +
          tempBarNum.min.toHold(TEMP) +
          "℃  平均值=" +
          tempBarNum.avg.toHold(TEMP) +
          "℃";
        chartDatas["temp" + idx].series[0].data = volTempte;
                    // 内阻
                    let volTempres = [];
                    if (res.code && res.data) {
                        volTempres = res.data2.list.map((item) => {
                            let value = diagramType == -1 ? 0 : item.monRes.toHold(RES);
                            return ["#" + item.monNum, value];
                        });
                    }
                    let resBarNum = getBarNum(volTempres);
                    chartDatas["resChart" + idx].title.text =
                        "最大值=" +
                        resBarNum.max.toHold(RES) +
                        "mΩ  最小值=" +
                        resBarNum.min.toHold(RES) +
                        "mΩ  平均值=" +
                        resBarNum.avg.toHold(RES) +
                        "mΩ";
                    chartDatas["resChart" + idx].series[0].data = volTempres;
        // 均衡电流
        let currTemp = [];
        if (res.code && res.data) {
          currTemp = res.data2.list.map((item) => {
            let value = diagramType == -1 ? 0 : item.monJhCurr.toHold(CURR);
            return ["#" + item.monNum, value];
          });
        }
        let currBarNum = getBarNum(currTemp);
        chartDatas["curr" + idx].title.text =
          "最大值=" +
          currBarNum.max.toHold(CURR) +
          "A  最小值=" +
          currBarNum.min.toHold(CURR) +
          "A  平均值=" +
          currBarNum.avg.toHold(CURR) +
          "A";
        chartDatas["curr" + idx].series[0].data = currTemp;
                    // 温度
                    let volTempte = [];
                    if (res.code && res.data) {
                        volTempte = res.data2.list.map((item) => {
                            let value = diagramType == -1 ? 0 : item.monTmp.toHold(TEMP);
                            return ["#" + item.monNum, value];
                        });
                    }
        // 更新电压图表
        this.setChart();
        this.updateTable();
      }
    },
    updateTable() {
      this.table.datas = tblData[this.currentGroup];
    },
    getMonStates(battGroupId, monNum, monState) {
      return {
        battGroupId,
        monNum,
        commFail: getBit(monState, 0), // 通信故障
        volHigh: getBit(monState, 1), // 过压
        volLow: getBit(monState, 2), // 欠压
        tempHigh: getBit(monState, 3), // 超温
        resHigh: getBit(monState, 4), // 内阻高
        posLeak: getBit(monState, 5), // 正极漏液
        negLeak: getBit(monState, 6), // 负极漏液
        tempError: getBit(monState, 7), // 温度故障
        resError: getBit(monState, 8), // 内阻故障
        battBulging: getBit(monState, 9), // 电池鼓胀
        junHengError: getBit(monState, 10), // 均衡维护故障
        monTempLow: getBit(monState, 11), // 单体温度超下限
        battMainting: getBit(monState, 12), // 电池处于维护中
      };
    },
    // 向父级发送同步页面的指令
    syncPage() {
      // 第一组
      let stationInf = this.stationInf;
      let search =
        "?province=" +
        stationInf.stationName1 +
        "&city=" +
        stationInf.stationName2 +
        "&county=" +
        stationInf.stationName5 +
        "&home=" +
        stationInf.stationName3 +
        "&batt=" +
        this.battGroupIds[this.currentGroup] +
        "&pageFlag=" +
        Math.random();
      let url = "/dataTest/history";
      this.$router.push(url + search);
    },
    // 停止测试
    stopTest() {
      this.$layer.confirm(
        "停止测试",
        {
          icon: 3,
        },
        (index) => {
          // 关闭询问层
          this.$layer.close(index);
          // 根据设备id进行停止
          console.log("stop", "=============");
          this.stop61853Test();
        }
      );
    },
    stop61853Test() {
      // 开启等待框
      let loading = this.$layer.loading(1);
      // 请求后台
      btsControl({
        num: const_61853.cmd.stop,
        devId: this.devId,
        battGroupNum: this.currentGroup + 1,
      })
        .then((res) => {
          res = res.data;
          if (res.code) {
            // 提示信息
            this.$layer.msg("停止测试成功");
          } else {
            // 提示信息
            this.$layer.msg("停止测试失败!");
          }
          // 关闭等待框
          this.$layer.close(loading);
        })
        .catch((error) => {
          console.log(error);
          // 关闭等待框
          this.$layer.close(loading);
          // 提示信息
          this.$layer.msg("停止测试失败,停止测试请求异常!");
        });
    },
    // 查询控制按钮的内容
    searchControl() {
      searchInfo({ categoryId: 2 })
        .then((res) => {
          res = res.data;
          let control = false; // 控制整体的显示
          if (res.code) {
            let data = res.data.list;
            Object.keys(this.control.data).forEach((key) => {
              let item = this.control.data[key];
              item.show = this.getStateById(item.id, data); // 根据id设置按钮的状态
              // 存在控制
              if (item.show) {
                control = item.show;
              }
            });
          }
          this.control.show = control; // 设置整体显示的状态
        })
        .catch((error) => {
          console.log(error);
        });
    },
    getStateById(id, list) {
      let result = true;
      for (let i = 0; i < list.length; i++) {
        let item = list[i];
        if (id == item.id) {
          result = item.status ? true : false;
          break;
        }
      }
      return result;
    },
    // 初始化时lifeFlag传true 页面销毁时传false
    monitorPage(lifeFlag) {
      if (!lifeFlag) {
        return;
      }
      let url = this.$route.meta.url || "";
      if (url == "/dataTest/realTime61853" && this.acTabs === "eleLine") {
        this.diagram.update = true;
      } else {
        this.diagram.update = false;
      }
      // 启动监控
      requestAnimationFrame(() => {
        this.monitorPage(true);
      });
    },
    setRightMenuPos(x, y) {
      this.rightMenu.show = true;
      this.rightMenu.x = x;
      this.rightMenu.y = y;
    },
    chartRightCLick(params) {
      this.rightMenu.show = true;
      this.rightMenu.x = params.x;
      this.rightMenu.y = params.y;
      this.rightMenu.xIndex = params.xIndex;
    },
    payAttentionMon() {
      let searchParams = {
        battGroupId: this.batt.battGroupId,
        monNum: this.rightMenu.xIndex + 1,
      };
                    this.monTemps = volTempte.map((item) => {
                        return item[1];
                    });
      // 查询
      realTimeNot(searchParams)
        .then((res) => {
          res = res.data;
          if (res.code && res.data) {
            this.$layer.msg("单体#" + searchParams.monNum + "已被关注");
          } else {
            this.addAttentionMon(searchParams);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    addAttentionMon(params) {
      let loading = this.$layer.loading(1);
      // 请求后台添加
      realTimeAdd(params)
        .then((res) => {
          res = res.data;
          if (res.code && res.data) {
            this.$layer.msg("成功关注单体#" + params.monNum);
          } else {
            this.$layer.msg("添加失败");
          }
          this.$layer.close(loading);
        })
        .catch((error) => {
          this.$layer.close(loading);
          console.log(error);
        });
    },
    closeDisChargeDialog() {
      this.dischargeDialog.show = false;
    },
    restartSystem() {
      if (sysConfig.restartDevByFace.value) {
        this.restartFaceShow = true;
      } else {
        let resetPwd = "restart123456";
        this.$prompt("请输入重启密码", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          inputType: "password",
        })
          .then(({ value }) => {
            if (value == resetPwd) {
              this.restartSystemReq();
            } else {
              this.$layer.msg("密码不正确");
            }
          })
          .catch(() => {});
      }
    },
    restartFaceSuccess() {
      this.restartFaceShow = false;
      this.restartSystemReq();
    },
    restartSystemReq() {
      let loading = this.$layer.loading();
      let batt = this.batt;
      restart({
        devId: batt.fbsdeviceId,
        opCmd: 16,
      })
        .then((res) => {
          res = res.data;
          if (res.code && res.data) {
            this.$alert("发送重启命令成功", "系统提示");
          } else {
            this.$alert("发送重启命令失败!", "系统提示");
          }
          this.$layer.close(loading);
        })
        .catch((error) => {});
    },
    stopOutLineCuring() {
      this.stopTime = new Date().getTime();
      console.log(this.stopTime);
    },
    getStationPic() {
      let batt = this.batt;
      if (sysConfig.clientName.name == "sxty") {
        this.getQRStationPic();
      } else {
        getStationPic(batt.stationId)
          .then((res) => {
            let rs = res.data;
            let data = [];
            if (rs.code == 1) {
              data = rs.data ? rs.data : [];
            }
            this.stationImages = data;
          })
          .catch((error) => {
            console.log(error);
          });
      }
    },
    getQRStationPic() {
      let mId = this.batt.mid;
      qrCode
        .battery(mId)
        .then((res) => {
          let rs = res.data;
          let pics = "";
          if (rs.code == 200) {
            pics = rs.data.pics;
          }
          this.stationImages = pics ? pics.split(",") : [];
        })
        .catch((error) => {
          this.stationImages = [];
        });
    },
    // 导出表格
    exportFile() {
      let time = new Date().getTime();
      if (this.table.datas.length === 0) {
        this.$message.warning("暂无数据,无需导出");
        return false;
      }
      ExportFile(
        this.dataHeaders,
        this.table.datas,
        this.stationInf.stationName + "-电池实时数据(" + time + ")"
      );
    },
    goToBattWarnSetting() {
      let fbsdeviceId = this.devId;
      const search =
        "?fbsdeviceId=" + fbsdeviceId + "&pageFlag=" + Math.random();
      // 电源参数设置界面
      this.$router.push(
        "/alarmMager/devicepaSetting" + search + "&fromType=fromIndex"
      );
    },
    getBattRecords(battGroupId) {
      // 查询
      getBattRecords(battGroupId)
        .then((res) => {
          let { code, data, data2 } = res.data;
          let list = [];
          if (code && data) {
            list = data2;
          }
          //console.log(list);
          this.battRecords = list;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    showSend() {
      this.dischargeDialog.show = true;
    },
    startTest() {
      if (this.isSxty && this.isInflow) {
        this.$message.error("流程审批中, 暂时无法放电");
        return false;
      }
      this.dischargeDialog.show = true;
    },
    confirmStartResTest() {
      this.$layer.prompt(
        {
          title: "输入启动口令,并确认",
          formType: 2,
          area: ["300px", "180px"],
        },
        (pass, index) => {
          // 请求后台校验密码
          checkUserPwd(pass)
            .then((res) => {
              res = res.data;
              if (res.code) {
                // 关闭弹出框
                this.$layer.close(index);
                // 启动内阻测试
                this.startResTest();
              } else {
                this.$layer.msg("启动口令错误!");
              }
            })
            .catch((error) => {
              console.log(error);
              this.$layer.msg("网络请求异常");
            });
        }
      );
    },
    async startResTest() {
      let loading = this.$layer.loading(1);
      try {
        const res = await startResTest(this.devId, this.currentGroup + 1);
        this.$layer.close(loading);
        const rs = res.data;
        if (rs.code && rs.data) {
          // 提示信息
          this.$layer.msg("启动测试成功");
        } else {
          // 提示信息
          this.$layer.msg("启动测试失败!");
        }
      } catch (e) {
        console.log(e);
        this.$layer.close(loading);
        // 提示信息
        this.$layer.msg("启动测试失败, 请检查网络!");
      }
    },
    refreshFN() {
      // 如果是跳过来放电  则要验证条件 1 通讯正常   2 状态为停止
      let disCharge = this.$route.query.disCharge;
      if (disCharge) {
        this.checkLink();
      }
    },
    checkLink() {
      setTimeout(() => {
        if (this.dataChangeFlag) {
          // console.log(this.isLink, this.inputs.battState == 1, '====', Date.now());
          if (this.isLink) {
            this.$message.error("当前设置未连接, 无法放电");
          } else if (this.inputs.battState != 1) {
            this.$message.error("当前状态不能直接放电");
          } else {
            this.dischargeDialog.show = true;
          }
          return false;
        }
        this.checkLink();
      }, 500);
    },
  },
  computed: {
    // 判断是哪种子类  0为之前的61853  1为新的618531 2为新的618532
    subType() {
      let devId = this.devId;
      return devId.slice(5, 6) * 1 || 0;
    },
    stationFullName() {
      let station = this.stationInf;
      if (station && station.stationName3 && station.stationName4) {
        return station.stationName3 + "-" + station.stationName4;
      }
      return "设备全称";
    },
    workState() {
      return (
        const_61853.workState[this.systemData.workState] ||
        `未知(${this.systemData.workState})`
      );
    },
    currentBattObj() {
      return {
        battGroupId: this.battGroupIds[this.currentGroup],
        monCount: this.battDatas[this.currentGroup].battCount,
      };
    },
    canTest() {
      return this.systemData.workState == 0;
    },
    showStateList() {
      return this.stateList.filter((item) => {
        if (item.show) {
          return item;
        }
      });
    },
    stateListState() {
      return this.stateListShow && this.showStateList.length && !this.isLd9;
    },
    historyStateListState() {
      return this.stateListShow && this.showHistoryStateList.length;
    },
    histroyDataTitle() {
      return (
        this.stationInf?.stationName +
        `-电池组${this.currentGroup + 1}` +
        "-历史实时数据"
      );
    },
    fodShow() {
      return this.fodHeaders.length === 1 || this.fodData.length === 0
        ? false
        : true;
    },
    // 设备连接状态1为未连接 0正常
    isLink() {
      return this.diagram.type == -1 ? 1 : 0;
    },
    dataHeaders() {
      return this.table.headers;
    },
  },
  mounted() {
    let devId = this.$route.params.devId;
    // console.log("mounted======", devId);
    if (devId) {
      this.devId = devId;
      this.homeListShow = false;
    }
    // 初始化图表
    this.initChart();
                    let tempBarNum = getBarNum(volTempte);
                    chartDatas["temp" + idx].title.text =
                        "最大值=" +
                        tempBarNum.max.toHold(TEMP) +
                        "℃  最小值=" +
                        tempBarNum.min.toHold(TEMP) +
                        "℃  平均值=" +
                        tempBarNum.avg.toHold(TEMP) +
                        "℃";
                    chartDatas["temp" + idx].series[0].data = volTempte;
    this.$nextTick(() => {
      this.$G.chartManage.resize(this.acTabs);
    });
    // 屏幕缩放时触发
    window.addEventListener("resize", this.resize);
    // 监控是否已经切换到当前页面
    this.monitorPage(true);
  },
  destroyed() {
    window.removeEventListener("resize", this.resize);
    this.monitorPage(false);
  },
};
                    // 均衡电流
                    let currTemp = [];
                    if (res.code && res.data) {
                        currTemp = res.data2.list.map((item) => {
                            let value = diagramType == -1 ? 0 : item.monJhCurr.toHold(CURR);
                            return ["#" + item.monNum, value];
                        });
                    }
                    let currBarNum = getBarNum(currTemp);
                    chartDatas["curr" + idx].title.text =
                        "最大值=" +
                        currBarNum.max.toHold(CURR) +
                        "A  最小值=" +
                        currBarNum.min.toHold(CURR) +
                        "A  平均值=" +
                        currBarNum.avg.toHold(CURR) +
                        "A";
                    chartDatas["curr" + idx].series[0].data = currTemp;
                    // 更新电压图表
                    this.setChart();
                    this.updateTable();
                }
            },
            updateTable() {
                this.table.datas = tblData[this.currentGroup];
            },
            getMonStates(battGroupId, monNum, monState) {
                return {
                    battGroupId,
                    monNum,
                    commFail: getBit(monState, 0), // 通信故障
                    volHigh: getBit(monState, 1), // 过压
                    volLow: getBit(monState, 2), // 欠压
                    tempHigh: getBit(monState, 3), // 超温
                    resHigh: getBit(monState, 4), // 内阻高
                    posLeak: getBit(monState, 5), // 正极漏液
                    negLeak: getBit(monState, 6), // 负极漏液
                    tempError: getBit(monState, 7), // 温度故障
                    resError: getBit(monState, 8), // 内阻故障
                    battBulging: getBit(monState, 9), // 电池鼓胀
                    junHengError: getBit(monState, 10), // 均衡维护故障
                    monTempLow: getBit(monState, 11), // 单体温度超下限
                    battMainting: getBit(monState, 12), // 电池处于维护中
                };
            },
            // 向父级发送同步页面的指令
            syncPage() {
                // 第一组
                let stationInf = this.stationInf;
                let search =
                    "?province=" +
                    stationInf.stationName1 +
                    "&city=" +
                    stationInf.stationName2 +
                    "&county=" +
                    stationInf.stationName5 +
                    "&home=" +
                    stationInf.stationName3 +
                    "&batt=" +
                    this.battGroupIds[this.currentGroup] +
                    "&pageFlag=" +
                    Math.random();
                let url = "/dataTest/history";
                this.$router.push(url + search);
            },
            // 停止测试
            stopTest() {
                this.$layer.confirm(
                    "停止测试",
                    {
                        icon: 3,
                    },
                    (index) => {
                        // 关闭询问层
                        this.$layer.close(index);
                        // 根据设备id进行停止
                        console.log("stop", "=============");
                        this.stop61853Test();
                    }
                );
            },
            stop61853Test() {
                // 开启等待框
                let loading = this.$layer.loading(1);
                // 请求后台
                btsControl({
                    num: const_61853.cmd.stop,
                    devId: this.devId,
                    battGroupNum: this.currentGroup + 1,
                })
                    .then((res) => {
                        res = res.data;
                        if (res.code) {
                            // 提示信息
                            this.$layer.msg("停止测试成功");
                        } else {
                            // 提示信息
                            this.$layer.msg("停止测试失败!");
                        }
                        // 关闭等待框
                        this.$layer.close(loading);
                    })
                    .catch((error) => {
                        console.log(error);
                        // 关闭等待框
                        this.$layer.close(loading);
                        // 提示信息
                        this.$layer.msg("停止测试失败,停止测试请求异常!");
                    });
            },
            // 查询控制按钮的内容
            searchControl() {
                searchInfo({ categoryId: 2 })
                    .then((res) => {
                        res = res.data;
                        let control = false; // 控制整体的显示
                        if (res.code) {
                            let data = res.data.list;
                            Object.keys(this.control.data).forEach((key) => {
                                let item = this.control.data[key];
                                item.show = this.getStateById(item.id, data); // 根据id设置按钮的状态
                                // 存在控制
                                if (item.show) {
                                    control = item.show;
                                }
                            });
                        }
                        this.control.show = control; // 设置整体显示的状态
                    })
                    .catch((error) => {
                        console.log(error);
                    });
            },
            getStateById(id, list) {
                let result = true;
                for (let i = 0; i < list.length; i++) {
                    let item = list[i];
                    if (id == item.id) {
                        result = item.status ? true : false;
                        break;
                    }
                }
                return result;
            },
            // 初始化时lifeFlag传true 页面销毁时传false
            monitorPage(lifeFlag) {
                if (!lifeFlag) {
                    return;
                }
                let url = this.$route.meta.url || "";
                if (url == "/dataTest/realTime61853" && this.acTabs === "eleLine") {
                    this.diagram.update = true;
                } else {
                    this.diagram.update = false;
                }
                // 启动监控
                requestAnimationFrame(() => {
                    this.monitorPage(true);
                });
            },
            setRightMenuPos(x, y) {
                this.rightMenu.show = true;
                this.rightMenu.x = x;
                this.rightMenu.y = y;
            },
            chartRightCLick(params) {
                this.rightMenu.show = true;
                this.rightMenu.x = params.x;
                this.rightMenu.y = params.y;
                this.rightMenu.xIndex = params.xIndex;
            },
            payAttentionMon() {
                let searchParams = {
                    battGroupId: this.batt.battGroupId,
                    monNum: this.rightMenu.xIndex + 1,
                };
                // 查询
                realTimeNot(searchParams)
                    .then((res) => {
                        res = res.data;
                        if (res.code && res.data) {
                            this.$layer.msg("单体#" + searchParams.monNum + "已被关注");
                        } else {
                            this.addAttentionMon(searchParams);
                        }
                    })
                    .catch((error) => {
                        console.log(error);
                    });
            },
            addAttentionMon(params) {
                let loading = this.$layer.loading(1);
                // 请求后台添加
                realTimeAdd(params)
                    .then((res) => {
                        res = res.data;
                        if (res.code && res.data) {
                            this.$layer.msg("成功关注单体#" + params.monNum);
                        } else {
                            this.$layer.msg("添加失败");
                        }
                        this.$layer.close(loading);
                    })
                    .catch((error) => {
                        this.$layer.close(loading);
                        console.log(error);
                    });
            },
            closeDisChargeDialog() {
                this.dischargeDialog.show = false;
            },
            restartSystem() {
                if (sysConfig.restartDevByFace.value) {
                    this.restartFaceShow = true;
                } else {
                    let resetPwd = "restart123456";
                    this.$prompt("请输入重启密码", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        inputType: "password",
                    })
                        .then(({ value }) => {
                            if (value == resetPwd) {
                                this.restartSystemReq();
                            } else {
                                this.$layer.msg("密码不正确");
                            }
                        })
                        .catch(() => { });
                }
            },
            restartFaceSuccess() {
                this.restartFaceShow = false;
                this.restartSystemReq();
            },
            restartSystemReq() {
                let loading = this.$layer.loading();
                let batt = this.batt;
                restart({
                    devId: batt.fbsdeviceId,
                    opCmd: 16,
                })
                    .then((res) => {
                        res = res.data;
                        if (res.code && res.data) {
                            this.$alert("发送重启命令成功", "系统提示");
                        } else {
                            this.$alert("发送重启命令失败!", "系统提示");
                        }
                        this.$layer.close(loading);
                    })
                    .catch((error) => { });
            },
            stopOutLineCuring() {
                this.stopTime = new Date().getTime();
                console.log(this.stopTime);
            },
            getStationPic() {
                let batt = this.batt;
                if (sysConfig.clientName.name == "sxty") {
                    this.getQRStationPic();
                } else {
                    getStationPic(batt.stationId)
                        .then((res) => {
                            let rs = res.data;
                            let data = [];
                            if (rs.code == 1) {
                                data = rs.data ? rs.data : [];
                            }
                            this.stationImages = data;
                        })
                        .catch((error) => {
                            console.log(error);
                        });
                }
            },
            getQRStationPic() {
                let mId = this.batt.mid;
                qrCode
                    .battery(mId)
                    .then((res) => {
                        let rs = res.data;
                        let pics = "";
                        if (rs.code == 200) {
                            pics = rs.data.pics;
                        }
                        this.stationImages = pics ? pics.split(",") : [];
                    })
                    .catch((error) => {
                        this.stationImages = [];
                    });
            },
            // 导出表格
            exportFile() {
                let time = new Date().getTime();
                if (this.table.datas.length === 0) {
                    this.$message.warning("暂无数据,无需导出");
                    return false;
                }
                ExportFile(
                    this.dataHeaders,
                    this.table.datas,
                    this.stationInf.stationName + "-电池实时数据(" + time + ")"
                );
            },
            goToBattWarnSetting() {
                let fbsdeviceId = this.devId;
                const search =
                    "?fbsdeviceId=" + fbsdeviceId + "&pageFlag=" + Math.random();
                // 电源参数设置界面
                this.$router.push(
                    "/alarmMager/devicepaSetting" + search + "&fromType=fromIndex"
                );
            },
            getBattRecords(battGroupId) {
                // 查询
                getBattRecords(battGroupId)
                    .then((res) => {
                        let { code, data, data2 } = res.data;
                        let list = [];
                        if (code && data) {
                            list = data2;
                        }
                        //console.log(list);
                        this.battRecords = list;
                    })
                    .catch((err) => {
                        console.log(err);
                    });
            },
            showSend() {
                this.dischargeDialog.show = true;
            },
            startTest() {
                if (this.isSxty && this.isInflow) {
                    this.$message.error("流程审批中, 暂时无法放电");
                    return false;
                }
                this.dischargeDialog.show = true;
            },
            confirmStartResTest() {
                this.$layer.prompt(
                    {
                        title: "输入启动口令,并确认",
                        formType: 2,
                        area: ["300px", "180px"],
                    },
                    (pass, index) => {
                        // 请求后台校验密码
                        checkUserPwd(pass)
                            .then((res) => {
                                res = res.data;
                                if (res.code) {
                                    // 关闭弹出框
                                    this.$layer.close(index);
                                    // 启动内阻测试
                                    this.startResTest();
                                } else {
                                    this.$layer.msg("启动口令错误!");
                                }
                            })
                            .catch((error) => {
                                console.log(error);
                                this.$layer.msg("网络请求异常");
                            });
                    }
                );
            },
            async startResTest() {
                let loading = this.$layer.loading(1);
                try {
                    const res = await startResTest(this.devId, this.currentGroup + 1);
                    this.$layer.close(loading);
                    const rs = res.data;
                    if (rs.code && rs.data) {
                        // 提示信息
                        this.$layer.msg("启动测试成功");
                    } else {
                        // 提示信息
                        this.$layer.msg("启动测试失败!");
                    }
                } catch (e) {
                    console.log(e);
                    this.$layer.close(loading);
                    // 提示信息
                    this.$layer.msg("启动测试失败, 请检查网络!");
                }
            },
            refreshFN() {
                // 如果是跳过来放电  则要验证条件 1 通讯正常   2 状态为停止
                let disCharge = this.$route.query.disCharge;
                if (disCharge) {
                    this.checkLink();
                }
            },
            checkLink() {
                setTimeout(() => {
                    if (this.dataChangeFlag) {
                        // console.log(this.isLink, this.inputs.battState == 1, '====', Date.now());
                        if (this.isLink) {
                            this.$message.error("当前设置未连接, 无法放电");
                        } else if (this.inputs.battState != 1) {
                            this.$message.error("当前状态不能直接放电");
                        } else {
                            this.dischargeDialog.show = true;
                        }
                        return false;
                    }
                    this.checkLink();
                }, 500);
            },
        },
        computed: {
            // 判断是哪种子类  0为之前的61853  1为新的618531 2为新的618532
            subType() {
                let devId = this.devId;
                return devId.slice(5, 6) * 1 || 0;
            },
            stationFullName() {
                let station = this.stationInf;
                if (station && station.stationName3 && station.stationName4) {
                    return station.stationName3 + "-" + station.stationName4;
                }
                return "设备全称";
            },
            workState() {
                return (
                    const_61853.workState[this.systemData.workState] ||
                    `未知(${this.systemData.workState})`
                );
            },
            currentBattObj() {
                return {
                    battGroupId: this.battGroupIds[this.currentGroup],
                    monCount: this.battDatas[this.currentGroup].battCount,
                };
            },
            canTest() {
                return this.systemData.workState == 0;
            },
            showStateList() {
                return this.stateList.filter((item) => {
                    if (item.show) {
                        return item;
                    }
                });
            },
            stateListState() {
                return this.stateListShow && this.showStateList.length && !this.isLd9;
            },
            historyStateListState() {
                return this.stateListShow && this.showHistoryStateList.length;
            },
            histroyDataTitle() {
                return (
                    this.stationInf?.stationName +
                    `-电池组${this.currentGroup + 1}` +
                    "-历史实时数据"
                );
            },
            fodShow() {
                return this.fodHeaders.length === 1 || this.fodData.length === 0
                    ? false
                    : true;
            },
            // 设备连接状态1为未连接 0正常
            isLink() {
                return this.diagram.type == -1 ? 1 : 0;
            },
            dataHeaders() {
                return this.table.headers;
            },
        },
        mounted() {
            let devId = this.$route.params.devId;
            // console.log("mounted======", devId);
            if (devId) {
                this.devId = devId;
                this.homeListShow = false;
            }
            // 初始化图表
            this.initChart();
            this.realTimeAlarmss();
            this.$nextTick(() => {
                this.$G.chartManage.resize(this.acTabs);
            });
            // 屏幕缩放时触发
            window.addEventListener("resize", this.resize);
            // 监控是否已经切换到当前页面
            this.monitorPage(true);
        },
        destroyed() {
            window.removeEventListener("resize", this.resize);
            this.monitorPage(false);
        },
    };
</script>
<style scoped>
@@ -2163,47 +1958,58 @@
.lampImg {
  height: 28px;
}
.box-header {
  font-size: 14px;
  padding: 0;
}
.threeD-dialog >>> .el-dialog {
.threeD-dialog>>>.el-dialog {
  width: 960px;
}
.station-contain {
  height: 600px;
}
.wx_guides {
  height: 150px;
  text-align: center;
  background-color: #ffffff;
  padding-top: 15%;
}
.wx_guides p {
  display: inline-block;
  margin-right: 10px;
}
.wx_guides p /deep/.el-input__inner {
  color: #000;
}
.tbl-data-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.tbl-data-body {
  flex: 1;
  overflow: hidden;
}
.tbl-data-footer {
  text-align: center;
}
.center-box {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
}
.row-info {
  font-size: 14px;
  color: #00fefe;
@@ -2215,6 +2021,7 @@
  background-color: #ffffff;
  padding: 8px;
  text-align: center;
  .update-dev-form-footer {
    padding-top: 8px;
    text-align: right;
@@ -2227,11 +2034,13 @@
  font-weight: bold;
  display: flex;
  padding: 8px 0;
  .modal-title-content {
    flex: 1;
    padding: 0 8px;
    cursor: move;
  }
  .modal-title-tools {
    padding: 0 8px;
    cursor: pointer;