whyczyk
2020-12-31 e6e03ce6fecf16cf5f731978213acce420541da0
逆变信息接口对接
6个文件已修改
3895 ■■■■ 已修改文件
src/components/chart/LiquidFillChart.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataMager/dialog/AddPowerMager.vue 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataMager/dialog/EditPowerMager.vue 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataMager/powerMager.vue 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/components/NiBianInfoTab.vue 216 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/realTime.vue 3481 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chart/LiquidFillChart.vue
@@ -25,10 +25,11 @@
        methods: {
            getOption(opt) {
                // 整体配置项
                let nameText, valueText;
                let nameText, valueText, unit;
                if (opt) {
                    nameText = opt.name;
                    valueText = opt.value;
                    unit = opt.unit;
                }
                let option = {
                    tooltip: {
@@ -45,7 +46,7 @@
                            bottom: "2%",
                        },
                        {
                            text: valueText,
                            text: valueText + unit,
                            textStyle: {
                                align: "center",
                                color: "#fff100",
src/pages/dataMager/dialog/AddPowerMager.vue
@@ -306,12 +306,14 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            // 遍历结果集
            for (var i = 0; i < rsData.length; i++) {
              var _rsData = rsData[i];
              var tmp = _rsData.stationName1;
              data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置省
@@ -328,12 +330,14 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            // 遍历结果集
            for (var i = 0; i < rsData.length; i++) {
              var _rsData = rsData[i];
              var tmp = _rsData.stationName1;
              data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置市
@@ -354,12 +358,14 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            // 遍历结果集
            for (var i = 0; i < rsData.length; i++) {
              var _rsData = rsData[i];
              var tmp = _rsData.stationName1;
              data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置区县
@@ -381,12 +387,14 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            // 遍历结果集
            for (var i = 0; i < rsData.length; i++) {
              var _rsData = rsData[i];
              var tmp = _rsData.stationName1;
              data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置区县
src/pages/dataMager/dialog/EditPowerMager.vue
@@ -305,18 +305,18 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            // 遍历结果集
            for (var i = 0; i < rsData.length; i++) {
              var _rsData = rsData[i];
              var tmp = _rsData.stationName1;
              data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置省
          this.linkage.provinces = data;
        });
      },
      searchCity() {
@@ -330,9 +330,13 @@
          var data = [];
          if (rs.code == 1) {
            if (rs.data) {
              data = rs.data;
            } else {
              data = [];
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置市
@@ -354,9 +358,13 @@
          var data = [];
          if (rs.code == 1) {
            if (rs.data) {
              data = rs.data;
            } else {
              data = [];
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置区县
@@ -379,16 +387,19 @@
          var data = [];
          if (rs.code == 1) {
            if (rs.data) {
              data = rs.data;
            } else {
              data = [];
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = _rsData.stationName1;
                data.push(tmp);
              }
            }
          }
          // 设置区县
          this.linkage.sites = data;
        });
      },
      provinceChange(value) {
        // 初始化市
        this.params.stationName2 = '';
src/pages/dataMager/powerMager.vue
@@ -222,15 +222,17 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            // 遍历结果集
            for (var i = 0; i < rsData.length; i++) {
              var _rsData = rsData[i];
              var tmp = {
                label: _rsData.stationName1,
                value: _rsData.stationName1
              };
              data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = {
                  label: _rsData.stationName1,
                  value: _rsData.stationName1
                };
                data.push(tmp);
              }
            }
          }
          // 设置第一笔数据
@@ -258,17 +260,18 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            if (rsData && rsData.length > 0) {
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = {
                  label: _rsData.stationName1,
                  value: _rsData.stationName1
                };
                data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              if (rsData && rsData.length > 0) {
                // 遍历结果集
                for (var i = 0; i < rsData.length; i++) {
                  var _rsData = rsData[i];
                  var tmp = {
                    label: _rsData.stationName1,
                    value: _rsData.stationName1
                  };
                  data.push(tmp);
                }
              }
            }
          }
@@ -297,16 +300,18 @@
          var rs = JSON.parse(res.data.result);
          var data = [];
          if (rs.code == 1) {
            var rsData = rs.data;
            if (rsData && rsData.length > 0) {
              // 遍历结果集
              for (var i = 0; i < rsData.length; i++) {
                var _rsData = rsData[i];
                var tmp = {
                  label: _rsData.stationName1,
                  value: _rsData.stationName1
                };
                data.push(tmp);
            if (rs.data) {
              var rsData = rs.data;
              if (rsData && rsData.length > 0) {
                // 遍历结果集
                for (var i = 0; i < rsData.length; i++) {
                  var _rsData = rsData[i];
                  var tmp = {
                    label: _rsData.stationName1,
                    value: _rsData.stationName1
                  };
                  data.push(tmp);
                }
              }
            }
          }
@@ -349,19 +354,20 @@
          console.log(rs)
          let data = [];
          if (rs.code == 1) {
            let rsData = rs.data;
            // 遍历结果集
            for (let i = 0; i < rsData.length; i++) {
              let _rsData = rsData[i];
              let index = this.checkValIsIn(_rsData.stationName1, data);
              if (index == -1) {
                let tmp = {
                  label: _rsData.stationName1,
                  value: _rsData.stationName1
                };
                data.push(tmp);
            if (rs.data) {
              let rsData = rs.data;
              // 遍历结果集
              for (let i = 0; i < rsData.length; i++) {
                let _rsData = rsData[i];
                let index = this.checkValIsIn(_rsData.stationName1, data);
                if (index == -1) {
                  let tmp = {
                    label: _rsData.stationName1,
                    value: _rsData.stationName1
                  };
                  data.push(tmp);
                }
              }
            }
          }
          // 设置第一笔数据
src/pages/dataTest/components/NiBianInfoTab.vue
@@ -26,7 +26,7 @@
                                {{item.text}}
                            </div>
                            <el-switch v-model="item.switch" v-else-if="item.id=='offControl'" active-color="#4afd88"
                                inactive-color="#f3535f">
                                inactive-color="#f3535f" disabled>
                            </el-switch>
                        </div>
                    </div>
@@ -111,7 +111,11 @@
    import CirclePieChart from "@/components/chart/CirclePieChart";
    import ArcMeterChart from "@/components/chart/ArcMeterChart.vue";
    import RingChart from "@/components/chart/ringChart.vue";
    import {
        inversionInfo
    } from "@/assets/js/realTime";
    export default {
        props: ['name', 'devId'],
        components: {
            ChartWrapper,
            GaugeChart,
@@ -213,9 +217,9 @@
                        ["#0181fe", "#9142ff"],
                    ],
                    data: [
                        [40, "A相电流(A)"],
                        [60, "B相电流(A)"],
                        [90, "C相电流(A)"],
                        [0, "A相电流(A)"],
                        [0, "B相电流(A)"],
                        [0, "C相电流(A)"],
                    ],
                },
                volChart: {
@@ -226,9 +230,9 @@
                        ["#0181fe", "#9142ff"],
                    ],
                    data: [
                        [140, "A相电压(V)"],
                        [130, "B相电压(V)"],
                        [120, "C相电压(V)"],
                        [0, "A相电压(V)"],
                        [0, "B相电压(V)"],
                        [0, "C相电压(V)"],
                    ],
                },
                tempChart1: {
@@ -236,62 +240,66 @@
                    center: ["50%", "45%"], // 布局位置
                    colorList: ["#e82d4c", "#ff8752"],
                    radius: "72%",
                    data: [0.6],
                    value: "85.8℃",
                    max: 200,
                    data: [0],
                    value: "0",
                    unit: '℃'
                },
                tempChart2: {
                    name: "模块2",
                    center: ["50%", "45%"], // 布局位置
                    colorList: ["#cfdd88", "#02be84"],
                    radius: "72%",
                    data: [0.6],
                    value: "85.8℃",
                    max: 200,
                    data: [0],
                    value: "0",
                    unit: '℃'
                },
                frequency: [{
                        id: "frequencyA",
                        name: "频率A",
                        color: "#0081ff",
                        value: 22,
                        value: 0,
                        unit: "HZ",
                        max: 30,
                        max: 100,
                    },
                    {
                        id: "frequencyB",
                        name: "频率B",
                        color: "#0081ff",
                        value: 22,
                        value: 0,
                        unit: "HZ",
                        max: 30,
                        max: 100,
                    },
                    {
                        id: "frequencyC",
                        name: "频率C",
                        color: "#0081ff",
                        value: 22,
                        value: 0,
                        unit: "HZ",
                        max: 30,
                        max: 100,
                    },
                ],
                arcMeterChart: [{
                        id: "arcMeterArc",
                        name: "直流输入电压",
                        value: 220,
                        value: 0,
                        unit: "V",
                        width: 20,
                        max: 220,
                        max: 480,
                    },
                    {
                        id: "arcMeterArc1",
                        name: "直流输入电流",
                        value: 23.5,
                        value: 0,
                        unit: "A",
                        width: 20,
                        max: 100,
                    },
                    {
                        id: "arcMeterArc2",
                        name: "直流输入电流",
                        value: 86.7,
                        name: "设定放电电流",
                        value: 0,
                        unit: "A",
                        width: 20,
                        max: 100,
@@ -301,19 +309,19 @@
                        id: "sendNum",
                        title: "发送计数",
                        ico: "el-icon-7fasongji",
                        text: 200,
                        text: 0,
                    },
                    {
                        id: "receiveNum",
                        title: "接收计数",
                        ico: "el-icon-8jieshoujishu",
                        text: 200,
                        text: 0,
                    },
                    {
                        id: "runStatus",
                        title: "运行状态",
                        ico: "el-icon-9yunhangzhuangtai",
                        islight: true,
                        islight: false,
                    },
                    {
                        id: "InvStatus",
@@ -325,7 +333,7 @@
                        id: "offControl",
                        title: "开关机控制",
                        ico: "el-icon-11kaiguanjikongzhi",
                        switch: true,
                        switch: false,
                    },
                ],
                impedance: {
@@ -337,14 +345,15 @@
                            label: {
                                show: false,
                            },
                            max: 100,
                            data: [{
                                    value: 20,
                                    value: 100,
                                    itemStyle: {
                                        color: "#2c5875",
                                    },
                                },
                                {
                                    value: 30,
                                    value: 0,
                                    itemStyle: {
                                        color: "#fa62e8",
                                    },
@@ -359,14 +368,15 @@
                            label: {
                                show: false,
                            },
                            max: 100,
                            data: [{
                                    value: 20,
                                    value: 100,
                                    itemStyle: {
                                        color: "#2c5875",
                                    },
                                },
                                {
                                    value: 30,
                                    value: 0,
                                    itemStyle: {
                                        color: "#fff100",
                                    },
@@ -379,29 +389,161 @@
        },
        mounted() {
            this.setChart();
            // 初始化echarts大小
            this.resize();
        },
        watch: {
            name() {
                this.setInfo();
            },
            devId() {
                this.setInfo();
            }
        },
        methods: {
            // 逆变信息
            inversionInfo() {
                inversionInfo(this.devId).then(res => {
                    let rs = JSON.parse(res.data.result);
                    if (rs.code == 1) {
                        if (rs.data) {
                            let data1 = rs.data[0];
                            this.gaugeChart.ACVol[0].value = data1.Power_Pa;
                            this.gaugeChart.ACVol[1].value = data1.Power_Pb;
                            this.gaugeChart.ACVol[2].value = data1.Power_Pc;
                            this.gaugeChart.ACCurr[0].value = data1.Power_Sa;
                            this.gaugeChart.ACCurr[1].value = data1.Power_Sb;
                            this.gaugeChart.ACCurr[2].value = data1.Power_Sc;
                            this.frequency[0].value = data1.A_HZ;
                            this.frequency[1].value = data1.B_HZ;
                            this.frequency[2].value = data1.C_HZ;
                            this.tempChart1.value = data1.Temp1;
                            this.tempChart1.data[0] = data1.Temp1 / this.tempChart1.max;
                            this.tempChart2.value = data1.Temp2;
                            this.tempChart2.data[0] = data1.Temp1 / this.tempChart2.max;
                            this.curChart.data = [
                                [data1.AC_ASimCur, "A相电流(A)"],
                                [data1.AC_BSimCur, "B相电流(A)"],
                                [data1.AC_CSimCur, "C相电流(A)"],
                            ]
                            this.volChart.data = [
                                [data1.AC_ASimVol, "A相电压(V)"],
                                [data1.AC_BSimVol, "B相电压(V)"],
                                [data1.AC_CSimVol, "C相电压(V)"],
                            ]
                            this.arcMeterChart[0].value = data1.DCInputVol;
                            this.arcMeterChart[1].value = data1.DCInputCur;
                            this.arcMeterChart[2].value = data1.SetDischargeCur;
                            this.centerControl[0].text = data1.CommTxCnt;
                            this.centerControl[1].text = data1.CommRxCnt;
                            let runIslight, nibianIslight, setSwitch;
                            if (data1.RunState == 0) {
                                runIslight = false;
                            } else if (data1.RunState == 1) {
                                runIslight = true;
                            }
                            if (data1.DcACState == 0) {
                                nibianIslight = false;
                            } else if (data1.DcACState == 1) {
                                nibianIslight = true;
                            }
                            if (data1.SetRun_Stop == 0) {
                                setSwitch = false;
                            } else if (data1.SetRun_Stop == 1) {
                                setSwitch = true;
                            }
                            this.centerControl[2].islight = runIslight;
                            this.centerControl[3].islight = nibianIslight;
                            this.centerControl[4].switch = setSwitch;
                            this.impedance.series[0].data[0].value = this.impedance.series[0].max - data1.InsulaTionRes1;
                            this.impedance.series[0].data[1].value = data1.InsulaTionRes1;
                            this.impedance.series[1].data[0].value = this.impedance.series[0].max - data1.InsulaTionRes2;
                            this.impedance.series[1].data[1].value = data1.InsulaTionRes2;
                        }
                    } else {
                        this.gaugeChart.ACVol[0].value = 0;
                        this.gaugeChart.ACVol[1].value = 0;
                        this.gaugeChart.ACVol[2].value = 0;
                        this.gaugeChart.ACCurr[0].value = 0;
                        this.gaugeChart.ACCurr[1].value = 0;
                        this.gaugeChart.ACCurr[2].value = 0;
                        this.frequency[0].value = 0;
                        this.frequency[1].value = 0;
                        this.frequency[2].value = 0;
                        this.tempChart1.value = 0;
                        this.tempChart1.data[0] = 0;
                        this.tempChart2.value = 0;
                        this.tempChart2.data[0] = 0;
                        this.curChart.data = [
                            [0, "A相电流(A)"],
                            [0, "B相电流(A)"],
                            [0, "C相电流(A)"],
                        ]
                        this.volChart.data = [
                            [0, "A相电压(V)"],
                            [0, "B相电压(V)"],
                            [0, "C相电压(V)"],
                        ]
                        this.arcMeterChart[0].value = 0;
                        this.arcMeterChart[1].value = 0;
                        this.arcMeterChart[2].value = 0;
                        this.centerControl[0].text = 0;
                        this.centerControl[1].text = 0;
                        this.centerControl[2].islight = false;
                        this.centerControl[3].islight = false;
                        this.centerControl[4].switch = false;
                        this.impedance.series[0].data[0].value = this.impedance.series[0].max - 0;
                        this.impedance.series[0].data[1].value = 0;
                        this.impedance.series[1].data[0].value = this.impedance.series[0].max - 0;
                        this.impedance.series[1].data[1].value = 0;
                    }
                    this.setChart();
                }).catch(error => {
                    console.log(error);
                });
            },
            setInfo() {
                if (this.name == 'niBianInfoTab') {
                    this.inversionInfo();
                    this.resize();
                }
            },
            setChart() {
                this.$nextTick(() => {
                    this.gaugeChart.ACVol.map((item) => {
                        this.$refs[item.id][0].setOption(item.value);
                    });
                    this.gaugeChart.ACCurr.map((item) => {
                        this.$refs[item.id][0].setOption(item.value);
                    });
                    this.frequency.map((item) => {
                        this.$refs[item.id][0].setOption(item);
                    });
                    this.arcMeterChart.map((item) => {
                        this.$refs[item.id][0].setOption(item);
                    });
                    this.$refs.CUR.setOption(this.curChart);
                    this.$refs.VOl.setOption(this.volChart);
                    this.$refs.temperature1.setOption(this.tempChart1);
                    this.$refs.temperature2.setOption(this.tempChart2);
                    this.arcMeterChart.map((item) => {
                        this.$refs[item.id][0].setOption(item);
                    });
                    this.$refs.ringChart.setOption(this.impedance);
                });
            },
            resize() {
                this.$nextTick(() => {
                    // 三项交流电压
                    this.gaugeChart.ACVol.map((item) => {
                        this.$refs[item.id][0].resize();
                    });
                    // 三项交流电流
                    this.gaugeChart.ACCurr.map((item) => {
                        this.$refs[item.id][0].resize();
                    });
src/pages/dataTest/realTime.vue
@@ -160,7 +160,7 @@
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane label="逆变信息" name="niBianInfoTab">
                            <ni-bian-info-tab ref="niBianInfoTab"></ni-bian-info-tab>
                            <ni-bian-info-tab ref="niBianInfoTab" :name="acTabs" :devId="batt.FBSDeviceId"></ni-bian-info-tab>
                        </el-tab-pane>
                        <el-tab-pane label="汇集器状态" name="collectState">
@@ -220,136 +220,137 @@
</template>
<script>
import ContentBox from "../../components/ContentBox";
import HomeList from "./HomeList";
import BarChart from "../../components/chart/BarChart";
import CircuitDiagram from "./CircuitDiagram";
import ScienceBox from "../../components/ScienceBox";
import DischargeDialogContent from "../../components/params/DischargeDialogContent";
import SystemParams from "../../components//params/SystemParams";
import CuringParams from "@/components/params/CuringParams";
import OutlineCuringParams from "@/components/params/OutlineCuringParams";
import RestartPlanParams from "@/components/params/RestartPlanParams";
import HistoryRealtimeData from "@/pages/dataTest/HistoryRealtimeData";
import RightMenu from "@/components/RightMenu";
import NiBian from "@/pages/dataTest/dialogs/NiBian";
import StopCuring from "@/pages/dataTest/dialogs/StopCuring";
import NiBianInfo from "@/pages/dataTest/components/NiBianInfo";
import NiBianInfoTab from "@/pages/dataTest/components/NiBianInfoTab";
import {
    realTimeSearch,
    realTimeGroup,
    realTimeAlarm,
    realTimePowerOff,
    realTimeStateList,
    inversionInfo,
} from "../../assets/js/realTime";
import {
    formatSeconds,
    sethoubeiTime,
    Timeout,
    regEquipType,
    getBarNum,
    isHasPermit,
} from "../../assets/js/tools";
    import ContentBox from "../../components/ContentBox";
    import HomeList from "./HomeList";
    import BarChart from "../../components/chart/BarChart";
    import CircuitDiagram from "./CircuitDiagram";
    import ScienceBox from "../../components/ScienceBox";
    import DischargeDialogContent from "../../components/params/DischargeDialogContent";
    import SystemParams from "../../components//params/SystemParams";
    import CuringParams from "@/components/params/CuringParams";
    import OutlineCuringParams from "@/components/params/OutlineCuringParams";
    import RestartPlanParams from "@/components/params/RestartPlanParams";
    import HistoryRealtimeData from "@/pages/dataTest/HistoryRealtimeData";
    import RightMenu from "@/components/RightMenu";
    import NiBian from "@/pages/dataTest/dialogs/NiBian";
    import StopCuring from "@/pages/dataTest/dialogs/StopCuring";
    import NiBianInfo from "@/pages/dataTest/components/NiBianInfo";
    import NiBianInfoTab from "@/pages/dataTest/components/NiBianInfoTab";
    import {
        realTimeSearch,
        realTimeGroup,
        realTimeAlarm,
        realTimePowerOff,
        realTimeStateList,
        inversionInfo,
    } from "../../assets/js/realTime";
    import {
        formatSeconds,
        sethoubeiTime,
        Timeout,
        regEquipType,
        getBarNum,
        isHasPermit,
    } from "../../assets/js/tools";
import { const_61850, const_9100 } from "../../assets/js/const";
import getMarkLineData from "@/components/chart/js/getMarkLineData";
/* import moment from "moment"; */
let vol, resChart, temp, conduct, currChart, leakVol;
let tblData = [];
export default {
    components: {
        ContentBox,
        HomeList,
        BarChart,
        CircuitDiagram,
        ScienceBox,
        DischargeDialogContent,
        SystemParams,
        CuringParams,
        OutlineCuringParams,
        RestartPlanParams,
        HistoryRealtimeData,
        RightMenu,
        NiBian,
        StopCuring,
        NiBianInfoTab,
        // NiBianInfo,
    },
    watch: {
        "$route.params.BattGroupId"(BattGroupId) {
            this.$nextTick(() => {
                this.getBattGroupInfo(BattGroupId);
            });
    import {
        const_61850,
        const_9100
    } from "../../assets/js/const";
    import getMarkLineData from "@/components/chart/js/getMarkLineData";
    /* import moment from "moment"; */
    let vol, resChart, temp, conduct, currChart, leakVol;
    let tblData = [];
    export default {
        components: {
            ContentBox,
            HomeList,
            BarChart,
            CircuitDiagram,
            ScienceBox,
            DischargeDialogContent,
            SystemParams,
            CuringParams,
            OutlineCuringParams,
            RestartPlanParams,
            HistoryRealtimeData,
            RightMenu,
            NiBian,
            StopCuring,
            NiBianInfoTab,
            // NiBianInfo,
        },
    },
    data() {
        let permits = this.$store.state.user.permits;
        let isCanTest = isHasPermit("batt_test_op_permit", permits);
        let stateList = const_61850.stateList;
        return {
            isCanTest: isCanTest,
            homeListShow: true,
            dev_version: "",
            username: sessionStorage.getItem("username"),
            rightMenu: {
                show: false,
                x: 0,
                y: 0,
        watch: {
            "$route.params.BattGroupId"(BattGroupId) {
                this.$nextTick(() => {
                    this.getBattGroupInfo(BattGroupId);
                });
            },
            /* 电池状态 模块 组端展示 */
            inputs: {
                group_vol: 0 /* 端电压-组端电压 */,
                online_vol: 0 /* 端电压-在线电压 */,
                group_curr: 0 /* 电池电流 */,
                batt_test_tlong: "0:00:00" /* 测试时长 */,
                rec_datetime: 0 /* 更新日期 */,
                batt_test_cap: 0 /* 测试容量 */,
                batt_rest_cap: 0, // 剩余容量
                batt_state: 0 /* 电池状态 */,
            },
            acTabs: "eleLine",
            table: {
                headers: [
                    {
                        prop: "num1",
                        label: "单体编号",
                        width: "",
                    },
                    {
                        prop: "vol1",
                        label: "电压(V)",
                        width: "",
                    },
                    {
                        prop: "res1",
                        label: "内阻(mΩ)",
                        width: "",
                    },
                    {
                        prop: "temp1",
                        label: "温度(℃)",
                        width: "",
                    },
                    {
                        prop: "conduct1",
                        label: "电导",
                        width: "",
                    },
                    {
                        prop: "curr1",
                        label: "均衡电流(A)",
                        width: "",
                    },
                    {
                        prop: "leakVol1",
                        label: "漏液电压(V)",
                        width: "",
                    },
                ],
                datas: [
                    {
        },
        data() {
            let permits = this.$store.state.user.permits;
            let isCanTest = isHasPermit("batt_test_op_permit", permits);
            let stateList = const_61850.stateList;
            return {
                isCanTest: isCanTest,
                homeListShow: true,
                dev_version: "",
                username: sessionStorage.getItem("username"),
                rightMenu: {
                    show: false,
                    x: 0,
                    y: 0,
                },
                /* 电池状态 模块 组端展示 */
                inputs: {
                    group_vol: 0 /* 端电压-组端电压 */ ,
                    online_vol: 0 /* 端电压-在线电压 */ ,
                    group_curr: 0 /* 电池电流 */ ,
                    batt_test_tlong: "0:00:00" /* 测试时长 */ ,
                    rec_datetime: 0 /* 更新日期 */ ,
                    batt_test_cap: 0 /* 测试容量 */ ,
                    batt_rest_cap: 0, // 剩余容量
                    batt_state: 0 /* 电池状态 */ ,
                },
                acTabs: "eleLine",
                table: {
                    headers: [{
                            prop: "num1",
                            label: "单体编号",
                            width: "",
                        },
                        {
                            prop: "vol1",
                            label: "电压(V)",
                            width: "",
                        },
                        {
                            prop: "res1",
                            label: "内阻(mΩ)",
                            width: "",
                        },
                        {
                            prop: "temp1",
                            label: "温度(℃)",
                            width: "",
                        },
                        {
                            prop: "conduct1",
                            label: "电导",
                            width: "",
                        },
                        {
                            prop: "curr1",
                            label: "均衡电流(A)",
                            width: "",
                        },
                        {
                            prop: "leakVol1",
                            label: "漏液电压(V)",
                            width: "",
                        },
                    ],
                    datas: [{
                        num1: 0,
                        vol1: 0,
                        res1: 0,
@@ -357,1775 +358,1755 @@
                        conduct1: 0,
                        curr1: 0,
                        leakVol1: 0,
                    },
                ],
            },
            batt: {},
            stateListShow: true,
            stateList: stateList,
            timer: new Timeout("realTime"),
            diagram: {
                update: true,
                type: -1,
                desc: "",
                powerCut: 1,
                temp: 0, // 设备温度
            },
            dischargeDialog: {
                show: false,
            },
            systemDialog: {
                show: false,
            },
            curingDialog: {
                show: false,
            },
            outlineCuringDialog: {
                show: false,
            },
            restartPlanDialog: {
                show: false,
            },
            historyRealTimeDataDialog: {
                show: false,
            },
            control: {
                show: false,
                data: {
                    startTest: {
                        // 启动核容测试
                        show: true,
                        typeShow: false,
                        id: 11,
                    },
                    stopTest: {
                        // 停止测试
                        show: true,
                        typeShow: false,
                        id: 12,
                    },
                    setSystemParams: {
                        // 系统参数设置
                        show: true,
                        typeShow: false,
                        id: 13,
                    },
                    clearWarn: {
                        // 清理告警
                        show: true,
                        typeShow: false,
                        id: 14,
                    },
                    startYH: {
                        // 启动养护/除硫
                        show: true,
                        typeShow: false,
                        id: 15,
                    },
                    stopYH: {
                        // 停止养护/除硫
                        show: true,
                        typeShow: false,
                        id: 16,
                    },
                    startOutlineYH: {
                        // 启动离线养护/除硫
                        show: true,
                        typeShow: false,
                        id: 17,
                    },
                    stopOutlineYH: {
                        // 停止离线养护/除硫
                        show: true,
                        typeShow: false,
                        id: 18,
                    },
                    circleRestart: {
                        // 定期重启
                        show: true,
                        typeShow: false,
                        id: 19,
                    },
                    restart: {
                        // 重启
                        show: true,
                        typeShow: false,
                        id: 20,
                    }, ],
                },
                batt: {},
                stateListShow: true,
                stateList: stateList,
                timer: new Timeout("realTime"),
                diagram: {
                    update: true,
                    type: -1,
                    desc: "",
                    powerCut: 1,
                    temp: 0, // 设备温度
                },
                dischargeDialog: {
                    show: false,
                },
                systemDialog: {
                    show: false,
                },
                curingDialog: {
                    show: false,
                },
                outlineCuringDialog: {
                    show: false,
                },
                restartPlanDialog: {
                    show: false,
                },
                historyRealTimeDataDialog: {
                    show: false,
                },
                control: {
                    show: false,
                    data: {
                        startTest: {
                            // 启动核容测试
                            show: true,
                            typeShow: false,
                            id: 11,
                        },
                        stopTest: {
                            // 停止测试
                            show: true,
                            typeShow: false,
                            id: 12,
                        },
                        setSystemParams: {
                            // 系统参数设置
                            show: true,
                            typeShow: false,
                            id: 13,
                        },
                        clearWarn: {
                            // 清理告警
                            show: true,
                            typeShow: false,
                            id: 14,
                        },
                        startYH: {
                            // 启动养护/除硫
                            show: true,
                            typeShow: false,
                            id: 15,
                        },
                        stopYH: {
                            // 停止养护/除硫
                            show: true,
                            typeShow: false,
                            id: 16,
                        },
                        startOutlineYH: {
                            // 启动离线养护/除硫
                            show: true,
                            typeShow: false,
                            id: 17,
                        },
                        stopOutlineYH: {
                            // 停止离线养护/除硫
                            show: true,
                            typeShow: false,
                            id: 18,
                        },
                        circleRestart: {
                            // 定期重启
                            show: true,
                            typeShow: false,
                            id: 19,
                        },
                        restart: {
                            // 重启
                            show: true,
                            typeShow: false,
                            id: 20,
                        },
                    },
                },
            },
            powerChart: {
                ACVol: [
                    {
                        id: "ACVolA",
                        name: "三项交流电压",
                        number: "A",
                        min: 0,
                        max: 250,
                        unit: "伏特(V)",
                        color: [
                            [0.2, "#FA62E8"],
                            [0.8, "#00FFFF"],
                            [1, "#DCFD00"],
                        ],
                    },
                    {
                        id: "ACVolB",
                        name: "三项交流电压",
                        number: "B",
                        min: 0,
                        max: 250,
                        unit: "伏特(V)",
                        color: [
                            [0.2, "#FA62E8"],
                            [0.8, "#00FFFF"],
                            [1, "#DCFD00"],
                        ],
                    },
                    {
                        id: "ACVolC",
                        name: "三项交流电压",
                        number: "C",
                        min: 0,
                        max: 250,
                        unit: "伏特(V)",
                        color: [
                            [0.2, "#FA62E8"],
                            [0.8, "#00FFFF"],
                            [1, "#DCFD00"],
                        ],
                    },
                ],
                ACCurr: [
                    {
                        id: "ACCurrA",
                        name: "三项交流电流",
                        number: "A",
                        min: 0,
                        max: 100,
                        unit: "安培(A)",
                        color: [
                            [0.2, "#0081FF"],
                            [0.8, "#90EC7D"],
                            [1, "#E5357E"],
                        ],
                    },
                    {
                        id: "ACCurrB",
                        name: "三项交流电流",
                        number: "B",
                        min: 0,
                        max: 100,
                        unit: "安培(A)",
                        color: [
                            [0.2, "#0081FF"],
                            [0.8, "#90EC7D"],
                            [1, "#E5357E"],
                        ],
                    },
                    {
                        id: "ACCurrC",
                        name: "三项交流电流",
                        number: "C",
                        min: 0,
                        max: 100,
                        unit: "安培(A)",
                        color: [
                            [0.2, "#0081FF"],
                            [0.8, "#90EC7D"],
                            [1, "#E5357E"],
                        ],
                    },
                ],
                ACPower: [
                    {
                        id: "ACPowerA",
                        name: "三项交流频率",
                        number: "A",
                        min: 40,
                        max: 80,
                        unit: "赫兹(Hz)",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                    {
                        id: "ACPowerB",
                        name: "三项交流频率",
                        number: "B",
                        min: 40,
                        max: 80,
                        unit: "赫兹(Hz)",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                    {
                        id: "ACPowerC",
                        name: "三项交流频率",
                        number: "C",
                        min: 40,
                        max: 80,
                        unit: "赫兹(Hz)",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                ],
                Cos: [
                    {
                        id: "CosA",
                        name: "三项功率因数",
                        number: "A",
                        min: 0,
                        max: 0.2,
                        unit: "",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                    {
                        id: "CosB",
                        name: "三项功率因数",
                        number: "B",
                        min: 0,
                        max: 0.2,
                        unit: "",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                    {
                        id: "CosC",
                        name: "三项功率因数",
                        number: "C",
                        min: 0,
                        max: 0.2,
                        unit: "",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                ],
                apparentPower: [
                    {
                        id: "apparentPowerA",
                        name: "三项视在功率",
                        number: "A",
                        min: 0,
                        max: 1000,
                        unit: "千伏安(KVA)",
                        color: [
                            [0.2, "#6042FA"],
                            [0.8, "#F8BD45"],
                            [1, "#00FFFF"],
                        ],
                    },
                    {
                        id: "apparentPowerB",
                        name: "三项视在功率",
                        number: "B",
                        min: 0,
                        max: 1000,
                        unit: "千伏安(KVA)",
                        color: [
                            [0.2, "#6042FA"],
                            [0.8, "#F8BD45"],
                            [1, "#00FFFF"],
                        ],
                    },
                    {
                        id: "apparentPowerC",
                        name: "三项视在功率",
                        number: "C",
                        min: 0,
                        max: 1000,
                        unit: "千伏安(KVA)",
                        color: [
                            [0.2, "#6042FA"],
                            [0.8, "#F8BD45"],
                            [1, "#00FFFF"],
                        ],
                    },
                ],
                direct: [
                    {
                        id: "directVol",
                        name: "输出直流电压",
                        number: "电压",
                        min: 0,
                        max: 60,
                        unit: "伏特(V)",
                        color: [
                            [0.2, "#FA62E8"],
                            [0.8, "#00FFFF"],
                            [1, "#DCFD00"],
                        ],
                    },
                    {
                        id: "directCurr",
                        name: "输出直流电流",
                        number: "电流",
                        min: 0,
                        max: 100,
                        unit: "安培(A)",
                        color: [
                            [0.2, "#0081FF"],
                            [0.8, "#90EC7D"],
                            [1, "#E5357E"],
                        ],
                    },
                    {
                        id: "directPower",
                        name: "输出直流功率",
                        number: "功率",
                        min: 0,
                        max: 100,
                        unit: "千瓦(KW)",
                        color: [
                            [0.2, "#F8BD45"],
                            [0.8, "#00FFFF"],
                            [1, "#F3535F"],
                        ],
                    },
                ],
            },
            nibian: {
                show: false,
            },
            stopCuringDialog: {
                show: false,
            },
            fodHeaders: [],
            fodData: [],
        };
    },
    methods: {
        tabClick(tab) {
            // 根据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.table.datas = tblData;
                powerChart: {
                    ACVol: [{
                            id: "ACVolA",
                            name: "三项交流电压",
                            number: "A",
                            min: 0,
                            max: 250,
                            unit: "伏特(V)",
                            color: [
                                [0.2, "#FA62E8"],
                                [0.8, "#00FFFF"],
                                [1, "#DCFD00"],
                            ],
                        },
                        {
                            id: "ACVolB",
                            name: "三项交流电压",
                            number: "B",
                            min: 0,
                            max: 250,
                            unit: "伏特(V)",
                            color: [
                                [0.2, "#FA62E8"],
                                [0.8, "#00FFFF"],
                                [1, "#DCFD00"],
                            ],
                        },
                        {
                            id: "ACVolC",
                            name: "三项交流电压",
                            number: "C",
                            min: 0,
                            max: 250,
                            unit: "伏特(V)",
                            color: [
                                [0.2, "#FA62E8"],
                                [0.8, "#00FFFF"],
                                [1, "#DCFD00"],
                            ],
                        },
                    ],
                    ACCurr: [{
                            id: "ACCurrA",
                            name: "三项交流电流",
                            number: "A",
                            min: 0,
                            max: 100,
                            unit: "安培(A)",
                            color: [
                                [0.2, "#0081FF"],
                                [0.8, "#90EC7D"],
                                [1, "#E5357E"],
                            ],
                        },
                        {
                            id: "ACCurrB",
                            name: "三项交流电流",
                            number: "B",
                            min: 0,
                            max: 100,
                            unit: "安培(A)",
                            color: [
                                [0.2, "#0081FF"],
                                [0.8, "#90EC7D"],
                                [1, "#E5357E"],
                            ],
                        },
                        {
                            id: "ACCurrC",
                            name: "三项交流电流",
                            number: "C",
                            min: 0,
                            max: 100,
                            unit: "安培(A)",
                            color: [
                                [0.2, "#0081FF"],
                                [0.8, "#90EC7D"],
                                [1, "#E5357E"],
                            ],
                        },
                    ],
                    ACPower: [{
                            id: "ACPowerA",
                            name: "三项交流频率",
                            number: "A",
                            min: 40,
                            max: 80,
                            unit: "赫兹(Hz)",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                        {
                            id: "ACPowerB",
                            name: "三项交流频率",
                            number: "B",
                            min: 40,
                            max: 80,
                            unit: "赫兹(Hz)",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                        {
                            id: "ACPowerC",
                            name: "三项交流频率",
                            number: "C",
                            min: 40,
                            max: 80,
                            unit: "赫兹(Hz)",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                    ],
                    Cos: [{
                            id: "CosA",
                            name: "三项功率因数",
                            number: "A",
                            min: 0,
                            max: 0.2,
                            unit: "",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                        {
                            id: "CosB",
                            name: "三项功率因数",
                            number: "B",
                            min: 0,
                            max: 0.2,
                            unit: "",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                        {
                            id: "CosC",
                            name: "三项功率因数",
                            number: "C",
                            min: 0,
                            max: 0.2,
                            unit: "",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                    ],
                    apparentPower: [{
                            id: "apparentPowerA",
                            name: "三项视在功率",
                            number: "A",
                            min: 0,
                            max: 1000,
                            unit: "千伏安(KVA)",
                            color: [
                                [0.2, "#6042FA"],
                                [0.8, "#F8BD45"],
                                [1, "#00FFFF"],
                            ],
                        },
                        {
                            id: "apparentPowerB",
                            name: "三项视在功率",
                            number: "B",
                            min: 0,
                            max: 1000,
                            unit: "千伏安(KVA)",
                            color: [
                                [0.2, "#6042FA"],
                                [0.8, "#F8BD45"],
                                [1, "#00FFFF"],
                            ],
                        },
                        {
                            id: "apparentPowerC",
                            name: "三项视在功率",
                            number: "C",
                            min: 0,
                            max: 1000,
                            unit: "千伏安(KVA)",
                            color: [
                                [0.2, "#6042FA"],
                                [0.8, "#F8BD45"],
                                [1, "#00FFFF"],
                            ],
                        },
                    ],
                    direct: [{
                            id: "directVol",
                            name: "输出直流电压",
                            number: "电压",
                            min: 0,
                            max: 60,
                            unit: "伏特(V)",
                            color: [
                                [0.2, "#FA62E8"],
                                [0.8, "#00FFFF"],
                                [1, "#DCFD00"],
                            ],
                        },
                        {
                            id: "directCurr",
                            name: "输出直流电流",
                            number: "电流",
                            min: 0,
                            max: 100,
                            unit: "安培(A)",
                            color: [
                                [0.2, "#0081FF"],
                                [0.8, "#90EC7D"],
                                [1, "#E5357E"],
                            ],
                        },
                        {
                            id: "directPower",
                            name: "输出直流功率",
                            number: "功率",
                            min: 0,
                            max: 100,
                            unit: "千瓦(KW)",
                            color: [
                                [0.2, "#F8BD45"],
                                [0.8, "#00FFFF"],
                                [1, "#F3535F"],
                            ],
                        },
                    ],
                },
                nibian: {
                    show: false,
                },
                stopCuringDialog: {
                    show: false,
                },
                fodHeaders: [],
                fodData: [],
            };
        },
        methods: {
            tabClick(tab) {
                this.acTabs = tab.name;
                // 根据tab更新电路图
                if (this.acTabs === "eleLine") {
                    this.diagram.update = true;
                } else {
                    this.diagram.update = false;
                }
            });
        },
        toggleChange() {
            this.resize();
        },
        resize() {
            if (this.acTabs === "powerInfo") {
                this.powerInfoChartResize();
            } else if (this.acTabs === "niBianInfoTab") {
                this.$refs.niBianInfoTab.resize();
            } else {
                this.$G.chartManage.resize(this.acTabs);
            }
        },
        powerInfoChartResize() {
            // 三项交流电压
            this.powerChart.ACVol.forEach((item) => {
                this.$refs[item.id][0].resize();
            });
                // 更新图表
                this.setChart();
            // 三项交流电流
            this.powerChart.ACCurr.forEach((item) => {
                this.$refs[item.id][0].resize();
            });
                // 重置图表的大小
                this.$nextTick(() => {
                    this.resize();
                    // 设置表格的数据
                    if (this.acTabs == "tblData") {
                        this.table.datas = tblData;
                    }
                });
            },
            toggleChange() {
                this.resize();
            },
            resize() {
                if (this.acTabs === "powerInfo") {
                    this.powerInfoChartResize();
                } else if (this.acTabs === "niBianInfoTab") {
                    this.$refs.niBianInfoTab.resize();
                } else {
                    this.$G.chartManage.resize(this.acTabs);
                }
            },
            powerInfoChartResize() {
                // 三项交流电压
                this.powerChart.ACVol.forEach((item) => {
                    this.$refs[item.id][0].resize();
                });
            // 三项交流频率
            this.powerChart.ACPower.forEach((item) => {
                this.$refs[item.id][0].resize();
            });
                // 三项交流电流
                this.powerChart.ACCurr.forEach((item) => {
                    this.$refs[item.id][0].resize();
                });
            // 三项功率因数
            this.powerChart.Cos.forEach((item) => {
                this.$refs[item.id][0].resize();
            });
                // 三项交流频率
                this.powerChart.ACPower.forEach((item) => {
                    this.$refs[item.id][0].resize();
                });
            // 三项视在功率
            this.powerChart.apparentPower.forEach((item) => {
                this.$refs[item.id][0].resize();
            });
                // 三项功率因数
                this.powerChart.Cos.forEach((item) => {
                    this.$refs[item.id][0].resize();
                });
            // 输出直流
            this.powerChart.direct.forEach((item) => {
                this.$refs[item.id][0].resize();
            });
        },
        initChart() {
            // 电压
            vol = {
                title: {
                    show: true,
                    text: "最大值=0V;最小值=0V;平均值=0V",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                // 三项视在功率
                this.powerChart.apparentPower.forEach((item) => {
                    this.$refs[item.id][0].resize();
                });
                // 输出直流
                this.powerChart.direct.forEach((item) => {
                    this.$refs[item.id][0].resize();
                });
            },
            initChart() {
                // 电压
                vol = {
                    title: {
                        show: true,
                        text: "最大值=0V;最小值=0V;平均值=0V",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                },
                series: [
                    {
                    series: [{
                        name: "电压",
                        type: "bar",
                        data: [],
                        markLine: {
                            data: getMarkLineData(),
                        },
                    }, ],
                };
                // 漏液电压
                leakVol = {
                    title: {
                        show: true,
                        text: "最大值=0V;最小值=0V;平均值=0V",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                ],
            };
            // 漏液电压
            leakVol = {
                title: {
                    show: true,
                    text: "最大值=0V;最小值=0V;平均值=0V",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                    },
                },
                series: [
                    {
                    series: [{
                        name: "漏液电压",
                        type: "bar",
                        data: [],
                    },
                ],
            };
                    }, ],
                };
            // 内阻
            resChart = {
                title: {
                    show: true,
                    text: "最大值=0mΩ;最小值=mΩ;平均值=0mΩ",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                // 内阻
                resChart = {
                    title: {
                        show: true,
                        text: "最大值=0mΩ;最小值=mΩ;平均值=0mΩ",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                },
                series: [
                    {
                    series: [{
                        name: "内阻",
                        type: "bar",
                        data: [],
                        markLine: {
                            data: getMarkLineData(),
                        },
                    },
                ],
            };
                    }, ],
                };
            // 温度
            temp = {
                title: {
                    show: true,
                    text: "最大值=0℃;最小值=0℃;平均值=0℃",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                // 温度
                temp = {
                    title: {
                        show: true,
                        text: "最大值=0℃;最小值=0℃;平均值=0℃",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                },
                series: [
                    {
                    series: [{
                        name: "温度",
                        type: "bar",
                        data: [],
                        markLine: {
                            data: getMarkLineData(),
                        },
                    },
                ],
            };
                    }, ],
                };
            // 电导
            conduct = {
                title: {
                    show: true,
                    text: "最大值=0;最小值=0;平均值=0",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                // 电导
                conduct = {
                    title: {
                        show: true,
                        text: "最大值=0;最小值=0;平均值=0",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                },
                series: [
                    {
                    series: [{
                        name: "电导",
                        type: "bar",
                        data: [],
                        markLine: {
                            data: getMarkLineData(),
                        },
                    }, ],
                };
                // 均衡电流
                currChart = {
                    title: {
                        show: true,
                        text: "最大值=0mA;最小值=0mA;平均值=0mA",
                        x: "center",
                        textStyle: {
                            fontSize: "14",
                        },
                    },
                ],
            };
            // 均衡电流
            currChart = {
                title: {
                    show: true,
                    text: "最大值=0mA;最小值=0mA;平均值=0mA",
                    x: "center",
                    textStyle: {
                        fontSize: "14",
                    },
                },
                series: [
                    {
                    series: [{
                        name: "均衡电流",
                        type: "bar",
                        data: [],
                    },
                ],
            };
            // 设置配置项
            this.setChart();
        },
        setChart() {
            let acTabs = this.acTabs;
            switch (acTabs) {
                case "vol":
                    this.$refs.vol.setOption(vol);
                    break;
                case "res":
                    this.$refs.res.setOption(resChart);
                    break;
                case "temp":
                    this.$refs.temp.setOption(temp);
                    break;
                case "conduct":
                    this.$refs.conduct.setOption(conduct);
                    break;
                case "curr":
                    this.$refs.curr.setOption(currChart);
                    break;
                case "leakVol":
                    this.$refs.leakVol.setOption(leakVol);
                    break;
            }
        },
        startTimer() {
            this.timer.start(() => {
                this.$axios
                    .all([
                        this.realTimeSearch(),
                        this.realTimeGroupss(),
                        this.realTimePowerOffs(),
                        this.realTimeStateList(),
                        //this.inversionInfo()
                    ])
                    .then(() => {
                        this.timer.open();
                    }, ],
                };
                // 设置配置项
                this.setChart();
            },
            setChart() {
                let acTabs = this.acTabs;
                switch (acTabs) {
                    case "vol":
                        this.$refs.vol.setOption(vol);
                        break;
                    case "res":
                        this.$refs.res.setOption(resChart);
                        break;
                    case "temp":
                        this.$refs.temp.setOption(temp);
                        break;
                    case "conduct":
                        this.$refs.conduct.setOption(conduct);
                        break;
                    case "curr":
                        this.$refs.curr.setOption(currChart);
                        break;
                    case "leakVol":
                        this.$refs.leakVol.setOption(leakVol);
                        break;
                }
            },
            startTimer() {
                this.timer.start(() => {
                    this.$axios
                        .all([
                            this.realTimeSearch(),
                            this.realTimeGroupss(),
                            this.realTimePowerOffs(),
                            this.realTimeStateList(),
                            //this.inversionInfo()
                        ])
                        .then(() => {
                            this.timer.open();
                        })
                        .catch(() => {
                            this.timer.open();
                        });
                }, 3000);
            },
            getBattGroupInfo(BattGroupId) {
                this.homeListShow = false;
                this.timer.name = "movingRingSysteRrealTime";
                this.$apis.dataMager.battGroupMager
                    .getBattGroupInfo(BattGroupId)
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        if (rs.code == 1) {
                            this.leafClick(rs.data[0]);
                        } else {
                            this.$layer.msg("未获取到电池组的信息");
                        }
                    })
                    .catch(() => {
                        this.timer.open();
                    .catch((error) => {
                        console.log(error);
                    });
            }, 3000);
        },
        getBattGroupInfo(BattGroupId) {
            this.homeListShow = false;
            this.timer.name = "movingRingSysteRrealTime";
            this.$apis.dataMager.battGroupMager
                .getBattGroupInfo(BattGroupId)
                .then((res) => {
            },
            leafClick(data) {
                this.batt = data;
                this.diagram.desc = "";
                this.realTimeAlarmss();
                // 开启循环请求
                this.startTimer();
            },
            /* 查询电池告警参数 */
            realTimeAlarmss() {
                var batt = this.batt;
                realTimeAlarm({
                    dev_id: batt.FBSDeviceId,
                }).then((res) => {
                    let rs = JSON.parse(res.data.result);
                    if (rs.code == 1) {
                        this.leafClick(rs.data[0]);
                    } else {
                        this.$layer.msg("未获取到电池组的信息");
                        let list = rs.data;
                        // 单体电压
                        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
                        );
                        // 单体电导
                        this.setChartMarkLine(
                            conduct,
                            "Conductance",
                            "Batt_Alarm_Type_MonRes",
                            list
                        );
                    }
                })
                .catch((error) => {
                    console.log(error);
                });
        },
        leafClick(data) {
            this.batt = data;
            this.diagram.desc = "";
            this.realTimeAlarmss();
            // 开启循环请求
            this.startTimer();
        },
        /* 查询电池告警参数 */
        realTimeAlarmss() {
            var batt = this.batt;
            realTimeAlarm({
                dev_id: batt.FBSDeviceId,
            }).then((res) => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    let list = rs.data;
                    // 单体电压
                    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
                    );
                    // 单体电导
                    this.setChartMarkLine(
                        conduct,
                        "Conductance",
                        "Batt_Alarm_Type_MonRes",
                        list
                    );
                }
            });
        },
        setChartMarkLine(chartData, name, alm_name, list) {
            let batt = this.batt;
            // 遍历list
            for (let i = 0; i < list.length; i++) {
                let item = list[i];
                if (item.alm_name == alm_name) {
                    let high = 0;
                    let low = 0;
                    switch (name) {
                        case "Voltage": // 电压告警
                            //单体电压
                            let std_mon_vol = batt.MonVolStd;
                            high = parseFloat(std_mon_vol * item.alm_high_coe).toHold(3);
                            low = parseFloat(std_mon_vol * item.alm_low_coe).toHold(3);
                            break;
                        case "Temperature":
                            //单体温度
                            let std_mon_tmp = 25;
                            high = parseFloat(std_mon_tmp * item.alm_high_coe).toHold(1);
                            low = parseFloat(std_mon_tmp * item.alm_low_coe).toHold(1);
                            break;
                        case "Resistance":
                            let std_mon_res =
                                (1 * (batt.MonVolStd / 2)) / (batt.MonCapStd / 100);
                            high = parseFloat(std_mon_res * item.alm_high_coe).toHold(3);
                            low = parseFloat(std_mon_res * item.alm_low_coe).toHold(3);
                            break;
                        case "Conductance":
                            let std_mon_ser = batt.MonSerStd;
                            high = parseFloat(std_mon_ser * item.alm_high_coe).toHold(0);
                            low = parseFloat(std_mon_ser * item.alm_low_coe).toHold(0);
                            break;
                    }
                    // 低告警
                    chartData.series[0].markLine.data[0].yAxis = low;
                    // 高告警
                    chartData.series[0].markLine.data[1].yAxis = high;
                    break;
                }
            }
        },
        /* 实时组端信息 */
        realTimeGroupss() {
            var batt = this.batt;
            realTimeGroup(batt.BattGroupId).then((res) => {
                let rsa = JSON.parse(res.data.result);
                if (rsa.code == 1) {
                    this.inputs = rsa.data[0];
                }
            });
        },
        /* 查询电路图开关状态和信息 */
        realTimePowerOffs() {
            let batt = this.batt;
            // 设备为61850显示右侧的面板
            if (regEquipType(batt.FBSDeviceId, "equip61850")) {
                this.stateListShow = true;
            } else {
                this.stateListShow = false;
            }
            // 查询后台数据
            realTimePowerOff({
                dev_id: batt.FBSDeviceId,
            }).then((res) => {
                let rs = JSON.parse(res.data.result);
                //console.log(rs);
                let outTime = 2 * 60; //设备超时时间(2分钟)
                let isOutTime = true; //通讯中断        判断设备是否通讯中断    true:中断    false:正常
                if (rs.code == 1) {
                    let data = rs.data[0];
                    // 设置版本号
                    this.dev_version = data.dev_version;
                    // 基础信息
                    this.setEquipBase(data);
                    // 判断是否超时
                    var nowTime = new Date(data.note).getTime(); //当前时间
                    var record = new Date(data.record_datetime).getTime();
                    if (Math.abs(nowTime - record) / 1000 > outTime) {
                        this.disconnect();
                    } else {
                        // 未超时执行逻辑
                        let dev_id = batt.FBSDeviceId;
                        this.diagram.powerCut = 0;
                        // 设备为61850
                        if (regEquipType(dev_id, "equip61850")) {
                            this.setEquip61850(data);
                        } else if (regEquipType(dev_id, ["BTS", "BTS9110", "BTS9120"])) {
                            this.setEquipBTS(data);
                        } else if (regEquipType(dev_id, "BTS9605")) {
                            this.setEquip9605(data);
                        } else {
                            this.disconnect();
            },
            setChartMarkLine(chartData, name, alm_name, list) {
                let batt = this.batt;
                // 遍历list
                for (let i = 0; i < list.length; i++) {
                    let item = list[i];
                    if (item.alm_name == alm_name) {
                        let high = 0;
                        let low = 0;
                        switch (name) {
                            case "Voltage": // 电压告警
                                //单体电压
                                let std_mon_vol = batt.MonVolStd;
                                high = parseFloat(std_mon_vol * item.alm_high_coe).toHold(3);
                                low = parseFloat(std_mon_vol * item.alm_low_coe).toHold(3);
                                break;
                            case "Temperature":
                                //单体温度
                                let std_mon_tmp = 25;
                                high = parseFloat(std_mon_tmp * item.alm_high_coe).toHold(1);
                                low = parseFloat(std_mon_tmp * item.alm_low_coe).toHold(1);
                                break;
                            case "Resistance":
                                let std_mon_res =
                                    (1 * (batt.MonVolStd / 2)) / (batt.MonCapStd / 100);
                                high = parseFloat(std_mon_res * item.alm_high_coe).toHold(3);
                                low = parseFloat(std_mon_res * item.alm_low_coe).toHold(3);
                                break;
                            case "Conductance":
                                let std_mon_ser = batt.MonSerStd;
                                high = parseFloat(std_mon_ser * item.alm_high_coe).toHold(0);
                                low = parseFloat(std_mon_ser * item.alm_low_coe).toHold(0);
                                break;
                        }
                        // 低告警
                        chartData.series[0].markLine.data[0].yAxis = low;
                        // 高告警
                        chartData.series[0].markLine.data[1].yAxis = high;
                        break;
                    }
                }
            },
            /* 实时组端信息 */
            realTimeGroupss() {
                var batt = this.batt;
                realTimeGroup(batt.BattGroupId).then((res) => {
                    let rsa = JSON.parse(res.data.result);
                    if (rsa.code == 1) {
                        this.inputs = rsa.data[0];
                    }
                });
            },
            /* 查询电路图开关状态和信息 */
            realTimePowerOffs() {
                let batt = this.batt;
                // 设备为61850显示右侧的面板
                if (regEquipType(batt.FBSDeviceId, "equip61850")) {
                    this.stateListShow = true;
                } else {
                    // 设置版本号
                    this.dev_version = "";
                    // 设备处于未连接
                    this.disconnect();
                    this.stateListShow = false;
                }
            });
        },
        disconnect() {
            // 设备未连接
            this.diagram.type = -1;
            this.setStateList("workState", "未连接");
            this.diagram.temp = 0;
            // 通讯状态
            this.setStateList("connect", "异常", "table-row-error");
            // 温度
            this.setStateList("devTemp", "未知", "table-row-warn");
            // 干接点
            this.setStateList("contact", "未知", "table-row-warn");
            // 核容终止原因
            this.setStateList("stopReason", "未知");
            // 操作失败原因
            this.setStateList("failReason", "未知");
        },
        // 基础信息
        setEquipBase(data) {
            // 设备的温度
            this.diagram.temp = data.dev_temp;
        },
        // BTS设备信息
        setEquipBTS(data) {
            let batt = this.batt;
            //  电路图类型
            let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            let battstate = this.inputs.batt_state;
            let alarmstatus = data.dev_alarmstate;
                // 查询后台数据
                realTimePowerOff({
                    dev_id: batt.FBSDeviceId,
                }).then((res) => {
                    let rs = JSON.parse(res.data.result);
                    //console.log(rs);
                    let outTime = 2 * 60; //设备超时时间(2分钟)
                    let isOutTime = true; //通讯中断        判断设备是否通讯中断    true:中断    false:正常
                    if (rs.code == 1) {
                        let data = rs.data[0];
                        // 设置版本号
                        this.dev_version = data.dev_version;
                        // 基础信息
                        this.setEquipBase(data);
            // 设置停电放电状态
            if (data.dev_onlinevollow) {
                this.inputs.batt_state = 5;
                this.diagram.type = 5;
                this.diagram.desc = "(开关闭合)";
                this.diagram.powerCut = 1;
                // 当前设备是BTS设备
                if (workstatus === 0 && data.dev_res_test_state !== 0) {
                    this.diagram.desc += "(内阻测试)";
                }
                return;
            }
            // 判断workstatus
            switch (workstatus) {
                case 0:
                    this.diagram.type = 0;
                        // 判断是否超时
                        var nowTime = new Date(data.note).getTime(); //当前时间
                        var record = new Date(data.record_datetime).getTime();
                        if (Math.abs(nowTime - record) / 1000 > outTime) {
                            this.disconnect();
                        } else {
                            // 未超时执行逻辑
                            let dev_id = batt.FBSDeviceId;
                            this.diagram.powerCut = 0;
                            // 设备为61850
                            if (regEquipType(dev_id, "equip61850")) {
                                this.setEquip61850(data);
                            } else if (regEquipType(dev_id, ["BTS", "BTS9110", "BTS9120"])) {
                                this.setEquipBTS(data);
                            } else if (regEquipType(dev_id, "BTS9605")) {
                                this.setEquip9605(data);
                            } else {
                                this.disconnect();
                            }
                        }
                    } else {
                        // 设置版本号
                        this.dev_version = "";
                        // 设备处于未连接
                        this.disconnect();
                    }
                });
            },
            disconnect() {
                // 设备未连接
                this.diagram.type = -1;
                this.setStateList("workState", "未连接");
                this.diagram.temp = 0;
                // 通讯状态
                this.setStateList("connect", "异常", "table-row-error");
                // 温度
                this.setStateList("devTemp", "未知", "table-row-warn");
                // 干接点
                this.setStateList("contact", "未知", "table-row-warn");
                // 核容终止原因
                this.setStateList("stopReason", "未知");
                // 操作失败原因
                this.setStateList("failReason", "未知");
            },
            // 基础信息
            setEquipBase(data) {
                // 设备的温度
                this.diagram.temp = data.dev_temp;
            },
            // BTS设备信息
            setEquipBTS(data) {
                let batt = this.batt;
                //  电路图类型
                let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
                this.diagram.desc = "";
                let battstate = this.inputs.batt_state;
                let alarmstatus = data.dev_alarmstate;
                // 设置停电放电状态
                if (data.dev_onlinevollow) {
                    this.inputs.batt_state = 5;
                    this.diagram.type = 5;
                    this.diagram.desc = "(开关闭合)";
                    this.diagram.powerCut = 1;
                    // 当前设备是BTS设备
                    if (data.dev_res_test_state !== 0) {
                    if (workstatus === 0 && data.dev_res_test_state !== 0) {
                        this.diagram.desc += "(内阻测试)";
                    }
                    break;
                case 1:
                    if (
                        data.dev_testgroupnum > 0 &&
                        data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1
                    ) {
                        this.diagram.type = 1;
                        this.diagram.desc = "(开关断开)";
                    } else {
                        if (battstate === 3) {
                    return;
                }
                // 判断workstatus
                switch (workstatus) {
                    case 0:
                        this.diagram.type = 0;
                        this.diagram.desc = "(开关闭合)";
                        // 当前设备是BTS设备
                        if (data.dev_res_test_state !== 0) {
                            this.diagram.desc += "(内阻测试)";
                        }
                        break;
                    case 1:
                        if (
                            data.dev_testgroupnum > 0 &&
                            data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1
                        ) {
                            this.diagram.type = 1;
                            this.diagram.desc = "(开关断开)";
                        } else {
                            if (battstate === 3) {
                                this.diagram.type = 1;
                                this.diagram.desc = "(开关断开)";
                            } else {
                                this.diagram.type = 0;
                                this.diagram.desc = "(开关闭合)";
                            }
                        }
                        // 当前设备是BTS设备
                        if (data.dev_testtype == 209) {
                            this.diagram.desc += "(KD测试)";
                            this.diagram.type = 3;
                        }
                        break;
                    case 2:
                        //辨别当前电池组是否在充电
                        if (
                            this.diagram.type == 2 ||
                            (data.dev_testgroupnum > 0 &&
                                data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1)
                        ) {
                            //充电
                            if (
                                alarmstatus === 1 ||
                                alarmstatus === 2 ||
                                alarmstatus === 3 ||
                                alarmstatus === 4 ||
                                alarmstatus === 6
                            ) {
                                //限流充电      -->常闭接触器断开
                                this.diagram.type = 2;
                                this.diagram.desc = "(开关断开)";
                            } else {
                                //直流充电     -->常闭接触器闭合
                                this.diagram.type = 2;
                                this.diagram.desc = "(开关闭合)";
                            }
                        } else {
                            this.diagram.type = 0;
                            this.diagram.desc = "(开关闭合)";
                        }
                    }
                    // 当前设备是BTS设备
                    if (data.dev_testtype == 209) {
                        this.diagram.desc += "(KD测试)";
                        this.diagram.type = 3;
                    }
                    break;
                case 2:
                    //辨别当前电池组是否在充电
                    if (
                        this.diagram.type == 2 ||
                        (data.dev_testgroupnum > 0 &&
                            data.dev_testgroupnum === batt.GroupIndexInFBSDevice + 1)
                    ) {
                        //充电
                        if (
                            alarmstatus === 1 ||
                            alarmstatus === 2 ||
                            alarmstatus === 3 ||
                            alarmstatus === 4 ||
                            alarmstatus === 6
                        ) {
                            //限流充电      -->常闭接触器断开
                            this.diagram.type = 2;
                            this.diagram.desc = "(开关断开)";
                        } else {
                            //直流充电     -->常闭接触器闭合
                            this.diagram.type = 2;
                            this.diagram.desc = "(开关闭合)";
                        }
                    } else {
                        break;
                    default:
                        this.diagram.type = -1;
                        break;
                }
            },
            // 61850设备信息
            setEquip61850(data) {
                //  电路图类型
                let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
                this.diagram.desc = "";
                switch (workstatus) {
                    case 0: //浮充状态拓扑图
                        this.diagram.type = 0;
                        this.diagram.desc = "(开关闭合)";
                    }
                    break;
                default:
                    this.diagram.type = -1;
                    break;
            }
        },
        // 61850设备信息
        setEquip61850(data) {
            //  电路图类型
            let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            switch (workstatus) {
                case 0: //浮充状态拓扑图
                    this.diagram.type = 0;
                    this.diagram.desc = "(开关闭合)";
                    break;
                case 4: //浮充状态(内阻测试)拓扑图
                    this.diagram.type = 0;
                    // 当前设备是否是内阻测试
                    this.diagram.desc = "(开关闭合)";
                    this.diagram.desc += "(内阻测试)";
                    break;
                case 1: //充电状态拓扑图
                    this.diagram.type = 2;
                    this.diagram.desc = "(开关断开)";
                    break;
                case 2: //放电状态拓扑图
                    this.diagram.type = 1;
                    this.diagram.desc = "(开关断开)";
                    break;
                case 3: //放电状态拓扑图
                    this.diagram.type = 7;
                    break;
                case 5: //放电状态(KD测试)拓扑图
                    this.diagram.type = 3;
                    this.diagram.desc = "(开关断开)";
                    this.diagram.desc += "(KD测试)";
                    break;
                case 6: // 离线养护测试
                    this.diagram.type = 4;
                    this.diagram.desc = "离线养护测试";
                    break;
                default:
                    //未知
                    this.diagram.type = -1;
                    this.diagram.desc = "(未知)";
                    break;
            }
            // 设备工作状态
            let workStates = const_61850.workstates;
            this.setStateList("workState", workStates[data.dev_workstate]);
            // 核容终止原因
            let stopReasons = const_61850.stopreasons;
            if (data.dev_workstate == 2) {
                this.setStateList("stopReason", "未知");
            } else {
                this.setStateList(
                    "stopReason",
                    stopReasons[data.dev_last_captest_stop_type]
                );
            }
            // 操作失败原因
            let failReasons = const_61850.failreasons;
            this.setStateList("failReason", failReasons[data.dev_alarmstate]);
            // 告警信息
            let alarms = data.dev_61850alarms.split(",");
            // alarms = ['false', 'false', 'true', 'false', 'true'];
            // 通讯状态
            if (alarms[1] == "true") {
                this.setStateList("connect", "异常", "table-row-error");
            } else {
                this.setStateList("connect", "正常", "");
            }
            // 温度
            if (alarms[2] == "true") {
                this.setStateList("devTemp", "异常", "table-row-error");
            } else {
                this.setStateList("devTemp", "正常", "");
            }
            // 干接点
            if (alarms[4] == "true") {
                this.setStateList("contact", "异常", "table-row-error");
            } else {
                this.setStateList("contact", "正常", "");
            }
        },
        // 9605设备
        setEquip9605(data) {
            let batt = this.batt;
            //  电路图类型
            let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
            this.diagram.desc = "";
            let battstate = this.inputs.batt_state;
            let alarmstatus = data.dev_alarmstate;
            // 设置停电放电状态
            if (data.dev_onlinevollow) {
                this.inputs.batt_state = 5;
                this.diagram.type = 5;
                this.diagram.desc = "(开关闭合)";
                this.diagram.powerCut = 1;
                // 当前设备是BTS设备
                if (workstatus === 0 && data.dev_res_test_state !== 0) {
                    this.diagram.desc += "(内阻测试)";
                }
                return;
            }
            // 判断workstatus
            switch (workstatus) {
                case 0:
                    this.diagram.type = 0;
                    //this.diagram.desc = '(开关闭合)';
                    // 当前设备是BTS设备
                    if (data.dev_res_test_state !== 0) {
                        this.diagram.type = 6;
                        break;
                    case 4: //浮充状态(内阻测试)拓扑图
                        this.diagram.type = 0;
                        // 当前设备是否是内阻测试
                        this.diagram.desc = "(开关闭合)";
                        this.diagram.desc += "(内阻测试)";
                    }
                    break;
                case 1:
                    this.diagram.type = 1;
                    //this.diagram.desc = '(开关断开)';
                    break;
                case 2:
                    this.diagram.type = 2;
                    //this.diagram.desc = '(开关断开)';
                    break;
                default:
                    this.diagram.type = -1;
                    break;
            }
        },
        // 设置stateList的值
        setStateList(name, value, type) {
            let stateList = this.stateList;
            for (let i = 0; i < stateList.length; i++) {
                let state = stateList[i];
                if (state.name == name) {
                    state.value = value;
                    state.type = type ? type : "";
                        break;
                    case 1: //充电状态拓扑图
                        this.diagram.type = 2;
                        this.diagram.desc = "(开关断开)";
                        break;
                    case 2: //放电状态拓扑图
                        this.diagram.type = 1;
                        this.diagram.desc = "(开关断开)";
                        break;
                    case 3: //放电状态拓扑图
                        this.diagram.type = 7;
                        break;
                    case 5: //放电状态(KD测试)拓扑图
                        this.diagram.type = 3;
                        this.diagram.desc = "(开关断开)";
                        this.diagram.desc += "(KD测试)";
                        break;
                    case 6: // 离线养护测试
                        this.diagram.type = 4;
                        this.diagram.desc = "离线养护测试";
                        break;
                    default:
                        //未知
                        this.diagram.type = -1;
                        this.diagram.desc = "(未知)";
                        break;
                }
            }
        },
        /* echars图表 */
        realTimeSearch() {
            var batt = this.batt;
            realTimeSearch({
                BattGroupId: batt.BattGroupId,
            }).then((res) => {
                let rs = JSON.parse(res.data.result);
                let data = [];
                if (rs.code == 1) {
                    data = rs.data.map((item) => {
                        return {
                            num1: "#" + item.mon_num,
                            vol1: item.mon_vol,
                            res1: item.mon_res,
                            temp1: item.mon_tmp,
                            conduct1: item.mon_res
                                ? ((1 / item.mon_res) * 1000).toFixed(0)
                                : 0,
                            curr1: item.mon_JH_curr,
                            leakVol1: item.mon_LY_vol,
                        };
                    });
                }
                // 更新表格
                if (this.acTabs == "tblData") {
                    this.table.datas = data;
                // 设备工作状态
                let workStates = const_61850.workstates;
                this.setStateList("workState", workStates[data.dev_workstate]);
                // 核容终止原因
                let stopReasons = const_61850.stopreasons;
                if (data.dev_workstate == 2) {
                    this.setStateList("stopReason", "未知");
                } else {
                    tblData = data;
                    this.setStateList(
                        "stopReason",
                        stopReasons[data.dev_last_captest_stop_type]
                    );
                }
                // 电压值
                let volTempVol = [];
                if (rs.code == 1) {
                    volTempVol = rs.data.map((item) => {
                        return ["#" + item.mon_num, item.mon_vol];
                    });
                }
                let volBarNum = getBarNum(volTempVol);
                vol.title.text =
                    "最大值=" +
                    volBarNum.max.toFixed(2) +
                    "V;最小值=" +
                    volBarNum.min.toFixed(2) +
                    "V;平均值=" +
                    volBarNum.avg.toFixed(2) +
                    "V";
                vol.series[0].data = volTempVol;
                // 操作失败原因
                let failReasons = const_61850.failreasons;
                this.setStateList("failReason", failReasons[data.dev_alarmstate]);
                // 内阻
                let volTempres = [];
                if (rs.code == 1) {
                    volTempres = rs.data.map((item) => {
                        return ["#" + item.mon_num, item.mon_res];
                    });
                // 告警信息
                let alarms = data.dev_61850alarms.split(",");
                // alarms = ['false', 'false', 'true', 'false', 'true'];
                // 通讯状态
                if (alarms[1] == "true") {
                    this.setStateList("connect", "异常", "table-row-error");
                } else {
                    this.setStateList("connect", "正常", "");
                }
                let resBarNum = getBarNum(volTempres);
                resChart.title.text =
                    "最大值=" +
                    resBarNum.max.toFixed(2) +
                    "mΩ;最小值=" +
                    resBarNum.min.toFixed(2) +
                    "mΩ;平均值=" +
                    resBarNum.avg.toFixed(2) +
                    "mΩ";
                resChart.series[0].data = volTempres;
                // 温度
                let volTempte = [];
                if (rs.code == 1) {
                    volTempte = rs.data.map((item) => {
                        return ["#" + item.mon_num, item.mon_tmp];
                    });
                if (alarms[2] == "true") {
                    this.setStateList("devTemp", "异常", "table-row-error");
                } else {
                    this.setStateList("devTemp", "正常", "");
                }
                let tempBarNum = getBarNum(volTempte);
                temp.title.text =
                    "最大值=" +
                    tempBarNum.max.toFixed(1) +
                    "℃;最小值=" +
                    tempBarNum.min.toFixed(1) +
                    "℃;平均值=" +
                    tempBarNum.avg.toFixed(1) +
                    "℃";
                temp.series[0].data = volTempte;
                // 电导
                let conductTemp = [];
                if (rs.code == 1) {
                    conductTemp = rs.data.map((item) => {
                        return [
                            "#" + item.mon_num,
                            item.mon_res ? ((1 / item.mon_res) * 1000).toFixed(0) : 0,
                        ];
                    });
                // 干接点
                if (alarms[4] == "true") {
                    this.setStateList("contact", "异常", "table-row-error");
                } else {
                    this.setStateList("contact", "正常", "");
                }
                let conductBarNum = getBarNum(conductTemp);
                conduct.title.text =
                    "最大值=" +
                    conductBarNum.max.toFixed(0) +
                    ";最小值=" +
                    conductBarNum.min.toFixed(0) +
                    ";平均值=" +
                    conductBarNum.avg.toFixed(0);
                conduct.series[0].data = conductTemp;
                // 均衡电流
                let currTemp = [];
                if (rs.code == 1) {
                    currTemp = rs.data.map((item) => {
                        return ["#" + item.mon_num, item.mon_JH_curr];
                    });
            },
            // 9605设备
            setEquip9605(data) {
                let batt = this.batt;
                //  电路图类型
                let workstatus = parseInt(data.dev_workstate); //[0:'在线监测',1:'放电测试',2:'充电测试',3:'内阻测试',4:'未知'];
                this.diagram.desc = "";
                let battstate = this.inputs.batt_state;
                let alarmstatus = data.dev_alarmstate;
                // 设置停电放电状态
                if (data.dev_onlinevollow) {
                    this.inputs.batt_state = 5;
                    this.diagram.type = 5;
                    this.diagram.desc = "(开关闭合)";
                    this.diagram.powerCut = 1;
                    // 当前设备是BTS设备
                    if (workstatus === 0 && data.dev_res_test_state !== 0) {
                        this.diagram.desc += "(内阻测试)";
                    }
                    return;
                }
                let currBarNum = getBarNum(currTemp);
                currChart.title.text =
                    "最大值=" +
                    currBarNum.max.toFixed(1) +
                    "mA;最小值=" +
                    currBarNum.min.toFixed(1) +
                    "mA;平均值=" +
                    currBarNum.avg.toFixed(1) +
                    "mA";
                currChart.series[0].data = currTemp;
                // 漏液电压
                let leakVolTemp = [];
                if (rs.code == 1) {
                    leakVolTemp = rs.data.map((item) => {
                        return ["#" + item.mon_num, item.mon_LY_vol];
                    });
                // 判断workstatus
                switch (workstatus) {
                    case 0:
                        this.diagram.type = 0;
                        //this.diagram.desc = '(开关闭合)';
                        // 当前设备是BTS设备
                        if (data.dev_res_test_state !== 0) {
                            this.diagram.type = 6;
                            this.diagram.desc += "(内阻测试)";
                        }
                        break;
                    case 1:
                        this.diagram.type = 1;
                        //this.diagram.desc = '(开关断开)';
                        break;
                    case 2:
                        this.diagram.type = 2;
                        //this.diagram.desc = '(开关断开)';
                        break;
                    default:
                        this.diagram.type = -1;
                        break;
                }
                let leakVolNum = getBarNum(leakVolTemp);
                leakVol.title.text =
                    "最大值=" +
                    leakVolNum.max.toFixed(1) +
                    "V;最小值=" +
                    leakVolNum.min.toFixed(1) +
                    "V;平均值=" +
                    leakVolNum.avg.toFixed(1) +
                    "V";
                leakVol.series[0].data = leakVolTemp;
                // 更新电压图表
                this.setChart();
            });
        },
        // 向父级发送同步页面的指令
        syncPage() {
            let batt = this.batt;
            let search =
                "?province=" +
                batt.StationName1 +
                "&city=" +
                batt.StationName2 +
                "&county=" +
                batt.StationName5 +
                "&home=" +
                batt.StationName3 +
                "&batt=" +
                batt.BattGroupId;
            window.parent.postMessage(
                {
                    cmd: "syncPage",
                    params: {
                        pageInfo: {
                            label: "历史数据",
                            name: "history",
                            src: "#/history" + search,
                            closable: true,
            },
            // 设置stateList的值
            setStateList(name, value, type) {
                let stateList = this.stateList;
                for (let i = 0; i < stateList.length; i++) {
                    let state = stateList[i];
                    if (state.name == name) {
                        state.value = value;
                        state.type = type ? type : "";
                    }
                }
            },
            /* echars图表 */
            realTimeSearch() {
                var batt = this.batt;
                realTimeSearch({
                    BattGroupId: batt.BattGroupId,
                }).then((res) => {
                    let rs = JSON.parse(res.data.result);
                    let data = [];
                    if (rs.code == 1) {
                        data = rs.data.map((item) => {
                            return {
                                num1: "#" + item.mon_num,
                                vol1: item.mon_vol,
                                res1: item.mon_res,
                                temp1: item.mon_tmp,
                                conduct1: item.mon_res ?
                                    ((1 / item.mon_res) * 1000).toFixed(0) : 0,
                                curr1: item.mon_JH_curr,
                                leakVol1: item.mon_LY_vol,
                            };
                        });
                    }
                    // 更新表格
                    if (this.acTabs == "tblData") {
                        this.table.datas = data;
                    } else {
                        tblData = data;
                    }
                    // 电压值
                    let volTempVol = [];
                    if (rs.code == 1) {
                        volTempVol = rs.data.map((item) => {
                            return ["#" + item.mon_num, item.mon_vol];
                        });
                    }
                    let volBarNum = getBarNum(volTempVol);
                    vol.title.text =
                        "最大值=" +
                        volBarNum.max.toFixed(2) +
                        "V;最小值=" +
                        volBarNum.min.toFixed(2) +
                        "V;平均值=" +
                        volBarNum.avg.toFixed(2) +
                        "V";
                    vol.series[0].data = volTempVol;
                    // 内阻
                    let volTempres = [];
                    if (rs.code == 1) {
                        volTempres = rs.data.map((item) => {
                            return ["#" + item.mon_num, item.mon_res];
                        });
                    }
                    let resBarNum = getBarNum(volTempres);
                    resChart.title.text =
                        "最大值=" +
                        resBarNum.max.toFixed(2) +
                        "mΩ;最小值=" +
                        resBarNum.min.toFixed(2) +
                        "mΩ;平均值=" +
                        resBarNum.avg.toFixed(2) +
                        "mΩ";
                    resChart.series[0].data = volTempres;
                    // 温度
                    let volTempte = [];
                    if (rs.code == 1) {
                        volTempte = rs.data.map((item) => {
                            return ["#" + item.mon_num, item.mon_tmp];
                        });
                    }
                    let tempBarNum = getBarNum(volTempte);
                    temp.title.text =
                        "最大值=" +
                        tempBarNum.max.toFixed(1) +
                        "℃;最小值=" +
                        tempBarNum.min.toFixed(1) +
                        "℃;平均值=" +
                        tempBarNum.avg.toFixed(1) +
                        "℃";
                    temp.series[0].data = volTempte;
                    // 电导
                    let conductTemp = [];
                    if (rs.code == 1) {
                        conductTemp = rs.data.map((item) => {
                            return [
                                "#" + item.mon_num,
                                item.mon_res ? ((1 / item.mon_res) * 1000).toFixed(0) : 0,
                            ];
                        });
                    }
                    let conductBarNum = getBarNum(conductTemp);
                    conduct.title.text =
                        "最大值=" +
                        conductBarNum.max.toFixed(0) +
                        ";最小值=" +
                        conductBarNum.min.toFixed(0) +
                        ";平均值=" +
                        conductBarNum.avg.toFixed(0);
                    conduct.series[0].data = conductTemp;
                    // 均衡电流
                    let currTemp = [];
                    if (rs.code == 1) {
                        currTemp = rs.data.map((item) => {
                            return ["#" + item.mon_num, item.mon_JH_curr];
                        });
                    }
                    let currBarNum = getBarNum(currTemp);
                    currChart.title.text =
                        "最大值=" +
                        currBarNum.max.toFixed(1) +
                        "mA;最小值=" +
                        currBarNum.min.toFixed(1) +
                        "mA;平均值=" +
                        currBarNum.avg.toFixed(1) +
                        "mA";
                    currChart.series[0].data = currTemp;
                    // 漏液电压
                    let leakVolTemp = [];
                    if (rs.code == 1) {
                        leakVolTemp = rs.data.map((item) => {
                            return ["#" + item.mon_num, item.mon_LY_vol];
                        });
                    }
                    let leakVolNum = getBarNum(leakVolTemp);
                    leakVol.title.text =
                        "最大值=" +
                        leakVolNum.max.toFixed(1) +
                        "V;最小值=" +
                        leakVolNum.min.toFixed(1) +
                        "V;平均值=" +
                        leakVolNum.avg.toFixed(1) +
                        "V";
                    leakVol.series[0].data = leakVolTemp;
                    // 更新电压图表
                    this.setChart();
                });
            },
            // 向父级发送同步页面的指令
            syncPage() {
                let batt = this.batt;
                let search =
                    "?province=" +
                    batt.StationName1 +
                    "&city=" +
                    batt.StationName2 +
                    "&county=" +
                    batt.StationName5 +
                    "&home=" +
                    batt.StationName3 +
                    "&batt=" +
                    batt.BattGroupId;
                window.parent.postMessage({
                        cmd: "syncPage",
                        params: {
                            pageInfo: {
                                label: "历史数据",
                                name: "history",
                                src: "#/history" + search,
                                closable: true,
                            },
                        },
                    },
                },
                "*"
            );
        },
        // 停止测试
        stopTest() {
            this.$layer.confirm(
                "停止测试",
                {
                    icon: 3,
                },
                (index) => {
                    // 关闭询问层
                    this.$layer.close(index);
                    // 根据设备id进行停止
                    if (regEquipType(this.batt.FBSDeviceId, "equip61850")) {
                        // 停止设备
                        this.stop61850Test();
                    } else if (
                        regEquipType(this.batt.FBSDeviceId, [
                            "BTS",
                            "BTS9110",
                            "BTS9120",
                            "BTS9605",
                        ])
                    ) {
                        // 停止设备
                        this.stopBtsTest();
                    } else {
                        // 提示信息
                        this.$layer.msg("未知设备类型,暂无法停止测试!");
                    "*"
                );
            },
            // 停止测试
            stopTest() {
                this.$layer.confirm(
                    "停止测试", {
                        icon: 3,
                    },
                    (index) => {
                        // 关闭询问层
                        this.$layer.close(index);
                        // 根据设备id进行停止
                        if (regEquipType(this.batt.FBSDeviceId, "equip61850")) {
                            // 停止设备
                            this.stop61850Test();
                        } else if (
                            regEquipType(this.batt.FBSDeviceId, [
                                "BTS",
                                "BTS9110",
                                "BTS9120",
                                "BTS9605",
                            ])
                        ) {
                            // 停止设备
                            this.stopBtsTest();
                        } else {
                            // 提示信息
                            this.$layer.msg("未知设备类型,暂无法停止测试!");
                        }
                    }
                }
            );
        },
        // 停止bts测试
        stopBtsTest() {
            // 开启等待框
            let loading = this.$layer.loading(1);
            // 请求后台
            this.$apis.dischargeTest.bts
                .stop({
                    num: const_9100.cmd.stop,
                    dev_id: this.batt.FBSDeviceId,
                })
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    if (rs.code == 1) {
                        // 提示信息
                        this.$layer.msg("停止测试成功");
                    } else {
                        // 提示信息
                        this.$layer.msg("停止测试失败!");
                    }
                    // 关闭等待框
                    this.$layer.close(loading);
                })
                .catch((error) => {
                    console.log(error);
                    // 关闭等待框
                    this.$layer.close(loading);
                    // 提示信息
                    this.$layer.msg("停止测试失败,停止测试请求异常!");
                });
        },
        // 停止61850测试
        stop61850Test() {
            // 开启等待框
            let loading = this.$layer.loading(1);
            // 请求后台
            this.$apis.dischargeTest.e61850
                .stop({
                    num: const_61850.cmd.stop,
                    dev_id: this.batt.FBSDeviceId,
                })
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    if (rs.code == 1) {
                        // 提示信息
                        this.$layer.msg("停止测试成功");
                    } else {
                        // 提示信息
                        this.$layer.msg("停止测试失败!");
                    }
                    // 关闭等待框
                    this.$layer.close(loading);
                })
                .catch((error) => {
                    console.log(error);
                    // 关闭等待框
                    this.$layer.close(loading);
                    // 提示信息
                    this.$layer.msg("停止测试失败,停止测试请求异常!");
                });
        },
        // 停止养护除硫
        stopCuring() {
            let batt = this.batt;
            let groupNum = batt.GroupIndexInFBSDevice + 1;
            this.$layer.confirm("确定停止养护/除硫", { icon: 3 }, (index) => {
                // 关闭确认框
                this.$layer.close(index);
                );
            },
            // 停止bts测试
            stopBtsTest() {
                // 开启等待框
                let loading = this.$layer.loading(1);
                this.$apis.curing
                    .stop(batt.FBSDeviceId, groupNum)
                // 请求后台
                this.$apis.dischargeTest.bts
                    .stop({
                        num: const_9100.cmd.stop,
                        dev_id: this.batt.FBSDeviceId,
                    })
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        this.$layer.msg(rs.msg);
                        if (rs.code == 1) {
                            // 提示信息
                            this.$layer.msg("停止测试成功");
                        } else {
                            // 提示信息
                            this.$layer.msg("停止测试失败!");
                        }
                        // 关闭等待框
                        this.$layer.close(loading);
                    })
                    .catch((error) => {
                        console.log(error);
                        // 关闭等待框
                        this.$layer.close(loading);
                        // 提示信息
                        this.$layer.msg("停止测试失败,停止测试请求异常!");
                    });
            });
        },
        // 查询拓扑图状态的显示
        searchStatus() {
            this.$apis.pageSetting.realTime
                .searchStatus()
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    if (rs.code == 1) {
                        let data = rs.data;
                        this.stateList.forEach((item) => {
                            item.show = this.getStateById(item.id, data);
                        });
                    }
                    // 设置养护除硫信息
                    this.setFodHeaders(this.stateList);
                })
                .catch((error) => {
                    console.log(error);
                });
        },
        setFodHeaders(stateList) {
            let result = [];
            result.push({
                prop: "num",
                label: "编号",
            });
            // 剩余天数
            let resDay = const_61850.getItemByName("resDay", stateList);
            if (resDay && resDay.show) {
                result.push({
                    prop: "RestTime_",
                    label: "天数",
                });
            }
            // 工作状态
            let workModel = const_61850.getItemByName("workMode", stateList);
            if (workModel && workModel.show) {
                result.push({
                    prop: "WorkState_",
                    label: "模式",
                });
            }
            // 组端电压
            let groupVol = const_61850.getItemByName("groupVol", stateList);
            if (groupVol && groupVol.show) {
                result.push({
                    prop: "VGroupVol_",
                    label: "组压",
                });
            }
            // 峰值电压
            let peakVol = const_61850.getItemByName("peakVol", stateList);
            if (peakVol && peakVol.show) {
                result.push({
                    prop: "VpeakVol_",
                    label: "峰压",
                });
            }
            this.fodHeaders = result;
        },
        // 查询控制按钮的内容
        searchControl() {
            this.$apis.pageSetting.realTime
                .searchControl()
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    let control = false; // 控制整体的显示
                    if (rs.code == 1) {
                        let data = rs.data;
                        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 = false;
            for (let i = 0; i < list.length; i++) {
                let item = list[i];
                if (id == item.id) {
                    result = item.status ? true : false;
                    break;
                }
            }
            return result;
        },
        clearWarn() {
            // 清除告警
            this.$layer.confirm(
                "清除设备告警",
                {
                    icon: 3,
                    title: "系统提示",
                },
                (index) => {
                    // 关闭弹出框
            },
            // 停止61850测试
            stop61850Test() {
                // 开启等待框
                let loading = this.$layer.loading(1);
                // 请求后台
                this.$apis.dischargeTest.e61850
                    .stop({
                        num: const_61850.cmd.stop,
                        dev_id: this.batt.FBSDeviceId,
                    })
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        if (rs.code == 1) {
                            // 提示信息
                            this.$layer.msg("停止测试成功");
                        } else {
                            // 提示信息
                            this.$layer.msg("停止测试失败!");
                        }
                        // 关闭等待框
                        this.$layer.close(loading);
                    })
                    .catch((error) => {
                        console.log(error);
                        // 关闭等待框
                        this.$layer.close(loading);
                        // 提示信息
                        this.$layer.msg("停止测试失败,停止测试请求异常!");
                    });
            },
            // 停止养护除硫
            stopCuring() {
                let batt = this.batt;
                let groupNum = batt.GroupIndexInFBSDevice + 1;
                this.$layer.confirm("确定停止养护/除硫", {
                    icon: 3
                }, (index) => {
                    // 关闭确认框
                    this.$layer.close(index);
                    // 开启加载等待
                    let load = this.$layer.loading(1);
                    // 执行清除告警
                    let batt = this.batt;
                    this.$apis.system
                        .clearWarn(batt.FBSDeviceId)
                    let loading = this.$layer.loading(1);
                    this.$apis.curing
                        .stop(batt.FBSDeviceId, groupNum)
                        .then((res) => {
                            let rs = JSON.parse(res.data.result);
                            if (rs.code == 1) {
                                this.$layer.msg("清除设备告警成功!");
                            } else {
                                this.$layer.msg("清除设备告警失败!");
                            }
                            // 关闭等待
                            this.$layer.close(load);
                            this.$layer.msg(rs.msg);
                            // 关闭等待框
                            this.$layer.close(loading);
                        })
                        .catch((error) => {
                            console.log(error);
                            // 关闭等待
                            this.$layer.close(load);
                            // 关闭等待框
                            this.$layer.close(loading);
                        });
                });
            },
            // 查询拓扑图状态的显示
            searchStatus() {
                this.$apis.pageSetting.realTime
                    .searchStatus()
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        if (rs.code == 1) {
                            let data = rs.data;
                            this.stateList.forEach((item) => {
                                item.show = this.getStateById(item.id, data);
                            });
                        }
                        // 设置养护除硫信息
                        this.setFodHeaders(this.stateList);
                    })
                    .catch((error) => {
                        console.log(error);
                    });
            },
            setFodHeaders(stateList) {
                let result = [];
                result.push({
                    prop: "num",
                    label: "编号",
                });
                // 剩余天数
                let resDay = const_61850.getItemByName("resDay", stateList);
                if (resDay && resDay.show) {
                    result.push({
                        prop: "RestTime_",
                        label: "天数",
                    });
                }
            );
        },
        realTimeStateList() {
            // 获取剩余天数,工作模式,组端电压,峰值电压
            let batt = this.batt;
            // 仅有编号不做任何操作
            if (this.fodHeaders.length == 1) {
                return;
            }
            realTimeStateList(batt.BattGroupId)
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    let data = [];
                    if (rs.code == 1) {
                        let rsData = rs.data[0];
                        let workModels = ["停止", "养护", "除硫"];
                        let list = ["one", "two", "three", "four", "five"];
                        let fodHeaders = this.fodHeaders;
                        data = list.map((item, index) => {
                            let workModel = rsData["WorkState_" + item];
                            return fodHeaders.map((fod) => {
                                if (fod.prop == "num") {
                                    return index + 1;
                                } else if (fod.prop == "WorkState_") {
                                    return workModels[workModel];
                                } else {
                                    return rsData[fod.prop + item];
                // 工作状态
                let workModel = const_61850.getItemByName("workMode", stateList);
                if (workModel && workModel.show) {
                    result.push({
                        prop: "WorkState_",
                        label: "模式",
                    });
                }
                // 组端电压
                let groupVol = const_61850.getItemByName("groupVol", stateList);
                if (groupVol && groupVol.show) {
                    result.push({
                        prop: "VGroupVol_",
                        label: "组压",
                    });
                }
                // 峰值电压
                let peakVol = const_61850.getItemByName("peakVol", stateList);
                if (peakVol && peakVol.show) {
                    result.push({
                        prop: "VpeakVol_",
                        label: "峰压",
                    });
                }
                this.fodHeaders = result;
            },
            // 查询控制按钮的内容
            searchControl() {
                this.$apis.pageSetting.realTime
                    .searchControl()
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        let control = false; // 控制整体的显示
                        if (rs.code == 1) {
                            let data = rs.data;
                            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;
                                }
                            });
                            //return [index+1, rsData['RestTime_'+item], workModels[workModel], rsData['VGroupVol_'+item], rsData['VpeakVol_'+item]]
                        });
                        this.fodData = data;
                        }
                        this.control.show = control; // 设置整体显示的状态
                    })
                    .catch((error) => {
                        console.log(error);
                    });
            },
            getStateById(id, list) {
                let result = false;
                for (let i = 0; i < list.length; i++) {
                    let item = list[i];
                    if (id == item.id) {
                        result = item.status ? true : false;
                        break;
                    }
                })
                .catch((error) => {
                    console.log(error);
                }
                return result;
            },
            clearWarn() {
                // 清除告警
                this.$layer.confirm(
                    "清除设备告警", {
                        icon: 3,
                        title: "系统提示",
                    },
                    (index) => {
                        // 关闭弹出框
                        this.$layer.close(index);
                        // 开启加载等待
                        let load = this.$layer.loading(1);
                        // 执行清除告警
                        let batt = this.batt;
                        this.$apis.system
                            .clearWarn(batt.FBSDeviceId)
                            .then((res) => {
                                let rs = JSON.parse(res.data.result);
                                if (rs.code == 1) {
                                    this.$layer.msg("清除设备告警成功!");
                                } else {
                                    this.$layer.msg("清除设备告警失败!");
                                }
                                // 关闭等待
                                this.$layer.close(load);
                            })
                            .catch((error) => {
                                console.log(error);
                                // 关闭等待
                                this.$layer.close(load);
                            });
                    }
                );
            },
            realTimeStateList() {
                // 获取剩余天数,工作模式,组端电压,峰值电压
                let batt = this.batt;
                // 仅有编号不做任何操作
                if (this.fodHeaders.length == 1) {
                    return;
                }
                realTimeStateList(batt.BattGroupId)
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        let data = [];
                        if (rs.code == 1) {
                            let rsData = rs.data[0];
                            let workModels = ["停止", "养护", "除硫"];
                            let list = ["one", "two", "three", "four", "five"];
                            let fodHeaders = this.fodHeaders;
                            data = list.map((item, index) => {
                                let workModel = rsData["WorkState_" + item];
                                return fodHeaders.map((fod) => {
                                    if (fod.prop == "num") {
                                        return index + 1;
                                    } else if (fod.prop == "WorkState_") {
                                        return workModels[workModel];
                                    } else {
                                        return rsData[fod.prop + item];
                                    }
                                });
                                //return [index+1, rsData['RestTime_'+item], workModels[workModel], rsData['VGroupVol_'+item], rsData['VpeakVol_'+item]]
                            });
                            this.fodData = data;
                        }
                    })
                    .catch((error) => {
                        console.log(error);
                    });
            },
            // 逆变信息
            inversionInfo() {
                let batt = this.batt;
                inversionInfo(batt.FBSDeviceId)
                    .then((res) => {
                        let rs = JSON.parse(res.data.result);
                        console.log(rs);
                    })
                    .catch((error) => {
                        console.log(error);
                    });
            },
            monitorPage() {
                // 获取缓存的session
                let name = sessionStorage.getItem("acTabs");
                let pageName = this.homeListShow ?
                    "realTime" :
                    "movingRingSysteRrealTime";
                if (name === pageName && this.acTabs === "eleLine") {
                    this.diagram.update = true;
                } else {
                    this.diagram.update = false;
                }
                // 启动监控
                requestAnimationFrame(() => {
                    this.monitorPage();
                });
            },
            setRightMenuPos(x, y) {
                this.rightMenu.show = true;
                this.rightMenu.x = x;
                this.rightMenu.y = y;
            },
            payAttentionMon() {},
        },
        // 逆变信息
        inversionInfo() {
            let batt = this.batt;
            inversionInfo(batt.FBSDeviceId)
                .then((res) => {
                    let rs = JSON.parse(res.data.result);
                    console.log(rs);
                })
                .catch((error) => {
                    console.log(error);
                });
        },
        monitorPage() {
            // 获取缓存的session
            let name = sessionStorage.getItem("acTabs");
            let pageName = this.homeListShow
                ? "realTime"
                : "movingRingSysteRrealTime";
            if (name === pageName && this.acTabs === "eleLine") {
                this.diagram.update = true;
            } else {
                this.diagram.update = false;
            }
            // 启动监控
            requestAnimationFrame(() => {
                this.monitorPage();
            });
        },
        setRightMenuPos(x, y) {
            this.rightMenu.show = true;
            this.rightMenu.x = x;
            this.rightMenu.y = y;
        },
        payAttentionMon() {},
    },
    computed: {
        battFullName() {
            let batt = this.batt;
            if (batt.StationName && batt.BattGroupName) {
                return batt.StationName + "-" + batt.BattGroupName;
            }
            return "电池组全称";
        },
        backInputs() {
            let batt = this.batt;
            const obj = {
                    0: "未知",
                    1: "浮充",
                    2: "充电",
                    3: "放电",
                    4: "均充",
                },
                list = {
                    batt_state: "未知",
                    group_online_vol: "在线:0.00V;组端:0.00V",
                    group_curr: "0.00A",
                    rec_datetime: "1982-01-01 00:00:00",
                    batt_test_tlong: formatSeconds(0),
                    batt_test_cap: "0Ah",
                    batt_syrl_cap: "---",
                    sysc: "------",
                };
            if (this.diagram.type == -1) {
                return list;
            }
            let batt_state_text = this.diagram.powerCut
                ? "停电放电"
                : obj[this.inputs.batt_state];
            list.batt_state = batt_state_text + this.diagram.desc;
            if (regEquipType(batt.FBSDeviceId, "BTS9605")) {
                list.group_online_vol = `组端:${this.inputs.group_vol.toFixed(2)}V`;
            } else {
                list.group_online_vol = `在线:${this.inputs.online_vol.toFixed(
        computed: {
            battFullName() {
                let batt = this.batt;
                if (batt.StationName && batt.BattGroupName) {
                    return batt.StationName + "-" + batt.BattGroupName;
                }
                return "电池组全称";
            },
            backInputs() {
                let batt = this.batt;
                const obj = {
                        0: "未知",
                        1: "浮充",
                        2: "充电",
                        3: "放电",
                        4: "均充",
                    },
                    list = {
                        batt_state: "未知",
                        group_online_vol: "在线:0.00V;组端:0.00V",
                        group_curr: "0.00A",
                        rec_datetime: "1982-01-01 00:00:00",
                        batt_test_tlong: formatSeconds(0),
                        batt_test_cap: "0Ah",
                        batt_syrl_cap: "---",
                        sysc: "------",
                    };
                if (this.diagram.type == -1) {
                    return list;
                }
                let batt_state_text = this.diagram.powerCut ?
                    "停电放电" :
                    obj[this.inputs.batt_state];
                list.batt_state = batt_state_text + this.diagram.desc;
                if (regEquipType(batt.FBSDeviceId, "BTS9605")) {
                    list.group_online_vol = `组端:${this.inputs.group_vol.toFixed(2)}V`;
                } else {
                    list.group_online_vol = `在线:${this.inputs.online_vol.toFixed(
                    2
                )}V;组端:${this.inputs.group_vol.toFixed(2)}V`;
            }
            list.group_curr = this.inputs.group_curr.toFixed(2) + "A";
            list.rec_datetime = this.inputs.rec_datetime;
            list.batt_test_tlong = formatSeconds(this.inputs.batt_test_tlong);
            list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "AH";
            if (this.inputs.batt_state === 2) {
                list.batt_syrl_cap = "---";
            } else {
                list.batt_syrl_cap = this.inputs.batt_rest_cap.toFixed(1) + "AH";
            }
            if (this.inputs.batt_state === 3) {
                list.sysc = sethoubeiTime(
                    parseFloat(this.inputs.batt_rest_cap) /
                        parseFloat(this.inputs.group_curr)
                );
            } else {
                list.sysc = "------";
            }
            return list;
        },
        showStateList() {
            return this.stateList.filter((item) => {
                if (item.show) {
                    return item;
                }
            });
                list.group_curr = this.inputs.group_curr.toFixed(2) + "A";
                list.rec_datetime = this.inputs.rec_datetime;
                list.batt_test_tlong = formatSeconds(this.inputs.batt_test_tlong);
                list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "AH";
                if (this.inputs.batt_state === 2) {
                    list.batt_syrl_cap = "---";
                } else {
                    list.batt_syrl_cap = this.inputs.batt_rest_cap.toFixed(1) + "AH";
                }
                if (this.inputs.batt_state === 3) {
                    list.sysc = sethoubeiTime(
                        parseFloat(this.inputs.batt_rest_cap) /
                        parseFloat(this.inputs.group_curr)
                    );
                } else {
                    list.sysc = "------";
                }
                return list;
            },
            showStateList() {
                return this.stateList.filter((item) => {
                    if (item.show) {
                        return item;
                    }
                });
            },
            dischargeDialogTitle() {
                let batt = this.batt;
                if (regEquipType(batt.FBSDeviceId, "equip61850")) {
                    return "放电参数设置";
                } else if (
                    regEquipType(batt.FBSDeviceId, ["BTS", "BTS9110", "BTS9120", "BTS9605"])
                ) {
                    return "BTS设备放电参数设置";
                } else {
                    return "未知设备(待开发)";
                }
            },
            stateListState() {
                return this.stateListShow && this.showStateList.length;
            },
            histroyDataTitle() {
                return this.batt.StationName + "-历史实时数据";
            },
            fodShow() {
                return this.fodHeaders.length === 1 || this.fodData.length === 0 ?
                    false :
                    true;
            },
        },
        dischargeDialogTitle() {
            let batt = this.batt;
            if (regEquipType(batt.FBSDeviceId, "equip61850")) {
                return "放电参数设置";
            } else if (
                regEquipType(batt.FBSDeviceId, ["BTS", "BTS9110", "BTS9120", "BTS9605"])
            ) {
                return "BTS设备放电参数设置";
            } else {
                return "未知设备(待开发)";
        mounted() {
            let BattGroupId = this.$route.params.BattGroupId;
            if (BattGroupId) {
                this.getBattGroupInfo(BattGroupId);
            }
        },
        stateListState() {
            return this.stateListShow && this.showStateList.length;
        },
        histroyDataTitle() {
            return this.batt.StationName + "-历史实时数据";
        },
        fodShow() {
            return this.fodHeaders.length === 1 || this.fodData.length === 0
                ? false
                : true;
        },
    },
    mounted() {
        let BattGroupId = this.$route.params.BattGroupId;
        if (BattGroupId) {
            this.getBattGroupInfo(BattGroupId);
        }
        // 查询拓扑图状态的显示
        this.searchStatus();
        // 查询控制按钮的配置
        this.searchControl();
        // 初始化图表
        this.initChart();
            // 查询拓扑图状态的显示
            this.searchStatus();
            // 查询控制按钮的配置
            this.searchControl();
            // 初始化图表
            this.initChart();
        this.$nextTick(() => {
            this.$G.chartManage.resize(this.acTabs);
        });
            this.$nextTick(() => {
                this.$G.chartManage.resize(this.acTabs);
            });
        // 屏幕缩放时触发
        window.addEventListener("resize", () => {
            this.resize();
        });
            // 屏幕缩放时触发
            window.addEventListener("resize", () => {
                this.resize();
            });
        // 监控是否已经切换到当前页面
        this.monitorPage();
        // 监听点击事件
        // this.$G.chartManage.get("vol").getZr().on('contextmenu', params=>{
        //     let pointInPixel= [params.offsetX, params.offsetY];
        //     console.log(this.$G.chartManage.get("vol").containPixel('grid',pointInPixel));
        //     this.setRightMenuPos(params.event.clientX, params.event.clientY);
        // });
    },
    destroyed() {
        this.timer.stop();
    },
};
            // 监控是否已经切换到当前页面
            this.monitorPage();
            // 监听点击事件
            // this.$G.chartManage.get("vol").getZr().on('contextmenu', params=>{
            //     let pointInPixel= [params.offsetX, params.offsetY];
            //     console.log(this.$G.chartManage.get("vol").containPixel('grid',pointInPixel));
            //     this.setRightMenuPos(params.event.clientX, params.event.clientY);
            // });
        },
        destroyed() {
            this.timer.stop();
        },
    };
</script>
<style scoped>
.page-real-time {
    color: #ffffff;
}
    .page-real-time {
        color: #ffffff;
    }
.table-cell.text-right {
    font-size: 14px;
}
    .table-cell.text-right {
        font-size: 14px;
    }
.table-cell.text-right .iconfont {
    margin-right: 4px;
}
    .table-cell.text-right .iconfont {
        margin-right: 4px;
    }
.table-row.table-row-error {
    color: #ff0000;
}
    .table-row.table-row-error {
        color: #ff0000;
    }
.table-row.table-row-warn {
    color: #e6a23c;
}
    .table-row.table-row-warn {
        color: #e6a23c;
    }
.table-row .table-cell {
    padding-top: 12px;
}
    .table-row .table-cell {
        padding-top: 12px;
    }
.page-content {
    position: relative;
    padding-top: 8px;
    padding-bottom: 2px;
    box-sizing: border-box;
    height: 100%;
}
    .page-content {
        position: relative;
        padding-top: 8px;
        padding-bottom: 2px;
        box-sizing: border-box;
        height: 100%;
    }
.box-tools {
    line-height: 32px;
}
    .box-tools {
        line-height: 32px;
    }
.box-tools .iconfont,
.box-tools .el-iconfont {
    font-size: 24px;
}
    .box-tools .iconfont,
    .box-tools .el-iconfont {
        font-size: 24px;
    }
.box-tools .iconfont:hover,
.box-tools .el-iconfont:hover {
    cursor: pointer;
    color: #cfcfcf;
}
    .box-tools .iconfont:hover,
    .box-tools .el-iconfont:hover {
        cursor: pointer;
        color: #cfcfcf;
    }
.box-tools .iconfont:active,
.box-tools .el-iconfont:active {
    color: #ff0000;
}
    .box-tools .iconfont:active,
    .box-tools .el-iconfont:active {
        color: #ff0000;
    }
.page-content-tools {
    position: absolute;
    top: 14px;
    right: 8px;
    z-index: 99;
}
    .page-content-tools {
        position: absolute;
        top: 14px;
        right: 8px;
        z-index: 99;
    }
.hdw-btn {
    display: inline-block;
    color: #fff;
    background-color: #409eff;
    border-color: #409eff;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    text-align: center;
    box-sizing: border-box;
    outline: none;
    margin: 0;
    transition: 0.1s;
    font-weight: 500;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 4px;
}
    .hdw-btn {
        display: inline-block;
        color: #fff;
        background-color: #409eff;
        border-color: #409eff;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        -webkit-appearance: none;
        text-align: center;
        box-sizing: border-box;
        outline: none;
        margin: 0;
        transition: 0.1s;
        font-weight: 500;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        padding: 6px 10px;
        font-size: 14px;
        border-radius: 4px;
    }
.hdw-btn:hover {
    background-color: #3c91e6;
}
    .hdw-btn:hover {
        background-color: #3c91e6;
    }
.hdw-menu-list {
    border: 1px solid #409eff;
}
    .hdw-menu-list {
        border: 1px solid #409eff;
    }
.hdw-menu-list .hdw-menu-item {
    border-top: 1px solid #0e5194;
}
    .hdw-menu-list .hdw-menu-item {
        border-top: 1px solid #0e5194;
    }
.hdw-menu-list .hdw-menu-item:first-child {
    border-top: none;
}
    .hdw-menu-list .hdw-menu-item:first-child {
        border-top: none;
    }
.hdw-menu-item a {
    display: block;
    text-align: center;
    padding: 8px;
    color: #ffffff;
    cursor: pointer;
    background-color: rgba(30, 125, 219, 0.767);
}
    .hdw-menu-item a {
        display: block;
        text-align: center;
        padding: 8px;
        color: #ffffff;
        cursor: pointer;
        background-color: rgba(30, 125, 219, 0.767);
    }
.hdw-menu-item a:hover {
    background-color: rgb(60, 135, 211);
}
    .hdw-menu-item a:hover {
        background-color: rgb(60, 135, 211);
    }
.hdw-menu-item a:active {
    background-color: rgb(34, 100, 167);
}
    .hdw-menu-item a:active {
        background-color: rgb(34, 100, 167);
    }
.hdw-state-list {
    box-sizing: border-box;
    font-size: 14px;
    padding-bottom: 8px;
}
    .hdw-state-list {
        box-sizing: border-box;
        font-size: 14px;
        padding-bottom: 8px;
    }
.table-info-list {
    width: 100%;
    font-size: 14px;
}
    .table-info-list {
        width: 100%;
        font-size: 14px;
    }
.table-info-list td {
    padding: 4px;
    text-align: center;
}
    .table-info-list td {
        padding: 4px;
        text-align: center;
    }
.noborder {
    border: none;
}
    .noborder {
        border: none;
    }
.el-table-wrapper {
    background-color: #052272;
}
    .el-table-wrapper {
        background-color: #052272;
    }
.flex-box-list,
.flex-box-list-full {
    display: flex;
    flex-direction: row;
    height: 50%;
    box-sizing: border-box;
}
    .flex-box-list,
    .flex-box-list-full {
        display: flex;
        flex-direction: row;
        height: 50%;
        box-sizing: border-box;
    }
.flex-box-list-full {
    height: 100%;
}
    .flex-box-list-full {
        height: 100%;
    }
.flex-box-mgr {
    margin: 16px;
}
    .flex-box-mgr {
        margin: 16px;
    }
.page-content .flex-box {
    flex: 1;
    overflow: hidden;
}
    .page-content .flex-box {
        flex: 1;
        overflow: hidden;
    }
</style>