<template>
  <div class="monitor" v-loading="loading">
    <div class="monitor-content">
      <!-- 天气数据 -->
      <div class="weather">
        <div class="weather-li">
          <span>室外温度：</span>
          <span class="deepColor">{{ weatherObj.temperature }}</span>
          <span>℃</span>
        </div>
        <div class="weather-li">
          <span>室外湿度：</span>
          <span class="deepColor">{{ weatherObj.humidity }}</span>
          <span>%</span>
        </div>
        <div class="weather-li">
          <span>室外含湿：</span>
          <span class="deepColor">{{ weatherObj.humidityRatio }}</span>
          <span>g/kg</span>
        </div>
        <div class="weather-li">
          <span>室外焓值：</span>
          <span class="deepColor">{{ weatherObj.enthalpy }}</span>
          <span>kj/kg</span>
        </div>
        <div class="weather-li">
          <span>室外露点：</span>
          <span class="deepColor">{{ weatherObj.dewPointTemp }}</span>
          <span>℃</span>
        </div>
        <div class="weather-li">
          <span>室外湿球：</span>
          <span class="deepColor">{{ weatherObj.wetBulbTemp }}</span>
          <span>℃</span>
        </div>
      </div>
      <!-- 系统性能数据 -->
      <div class="performance">
        <div class="title">系 统 性 能</div>
        <div class="perdformance-bg">
          <div class="weather-li">
            <span>实时EER：</span>
            <span class="deepColor">{{ performanceObj.realEER }}</span>
            <span>kw/kw</span>
          </div>
          <div class="weather-li">
            <span>实时功率：</span>
            <span class="deepColor">{{ performanceObj.realPower }}</span>
            <span>kw</span>
          </div>
          <div class="weather-li">
            <span>实时冷量：</span>
            <span class="deepColor">{{ performanceObj.realCold }}</span>
            <span>kw</span>
          </div>
          <div class="weather-li">
            <span>全年EER：</span>
            <span class="deepColor">{{ performanceObj.yearEER }}</span>
            <span>kw</span>
          </div>
          <div class="weather-li">
            <span>全年用电：</span>
            <span class="deepColor">{{ performanceObj.yearPower }}</span>
            <span>kw/h</span>
          </div>
          <div class="weather-li">
            <span>全年产冷：</span>
            <span class="deepColor">{{ performanceObj.yearCold }}</span>
            <span>kw</span>
          </div>
        </div>
      </div>
      <!-- 一键启停 -->
      <div class="offClass" @click="handleOneKeyButton">
        <div v-if="isShowOn" class="off-bg on-animation">ON</div>
        <div v-else class="off-bg">OFF</div>
      </div>
      <!-- 系统提示 -->
      <div class="sysTips" v-if="startOrStopStatus">
        <img class="step" src="../../../assets/images/step.png" alt="" />
        <div class="tips-text">{{ startOrStopStatus }}</div>
      </div>
      <!-- 整体图 -->
      <img
        class="monitor-img"
        src="../../../assets/images/haiwang.png"
        alt=""
      />
      <!-- 主机1数据定位 -->
      <div class="hostName1" v-if="hostList.length > 0">
        {{ hostList[0].deviceName }}
      </div>
      <div
        class="hostStatus1"
        :class="{ startClass: hostListControlClass(0) }"
      ></div>
      <img
        class="host-img1"
        v-if="hostListRunClass(0)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass: hostListRunClass(0) }"
      />
      <div class="hostLoad1" v-if="hostLoadData(0) && hostListRunClass(0)">
        {{ hostLoad0 }}%
      </div>
      <div class="water-flow1">
        <div class="water-flow-li">
          <span>1#冷却水流:</span>
          <span v-if="hostCoolingWaterFlowClass(0)">接通</span>
          <span v-else>断开</span>
          <span
            class="break"
            :class="{ connect: hostCoolingWaterFlowClass(0) }"
          ></span>
        </div>
        <div class="water-flow-li">
          <span>1#冷冻水流:</span>
          <span v-if="hostCoolingWaterFlowClass(0)">接通</span>
          <span v-else>断开</span>
          <span
            class="break"
            :class="{ connect: hostFreezeWaterFlowClass(0) }"
          ></span>
        </div>
      </div>
      <line-children
        :angle1="-0"
        :angle2="-30"
        :lineWidth1="200"
        :lineWidth2="100"
        class="host-line1"
      ></line-children>
      <!-- 主机2数据定位 -->
      <div class="hostName2" v-if="hostList.length > 0">
        {{ hostList[1].deviceName }}
      </div>
      <div
        class="hostStatus2"
        :class="{ startClass: hostListControlClass(1) }"
      ></div>
      <img
        class="host-img2"
        v-if="hostListRunClass(1)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass: hostListRunClass(1) }"
      />
      <div class="hostLoad2" v-if="hostLoadData(1) && hostListRunClass(1)">
        {{ hostLoad1 }}%
      </div>
      <div class="water-flow2">
        <div class="water-flow-li">
          <span>2#冷却水流:</span>
          <span v-if="hostCoolingWaterFlowClass(1)">接通</span>
          <span v-else>断开</span>
          <span
            class="break"
            :class="{ connect: hostCoolingWaterFlowClass(1) }"
          ></span>
        </div>
        <div class="water-flow-li">
          <span>2#冷冻水流:</span>
          <span v-if="hostCoolingWaterFlowClass(1)">接通</span>
          <span v-else>断开</span>
          <span
            class="break"
            :class="{ connect: hostFreezeWaterFlowClass(1) }"
          ></span>
        </div>
      </div>
      <line-children
        :angle1="-0"
        :angle2="-45"
        :lineWidth1="250"
        :lineWidth2="300"
        class="host-line2"
      ></line-children>
      <!-- 主机3数据定位 -->
      <div class="hostName3" v-if="hostList.length > 0">
        {{ hostList[2].deviceName }}
      </div>
      <!-- 主机启停状态 -->
      <div
        class="hostStatus3"
        :class="{ startClass: hostListControlClass(2) }"
      ></div>
      <!-- 主机运行状态 -->
      <img
        class="host-img3"
        v-if="hostListRunClass(2)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass: hostListRunClass(2) }"
      />
      <!-- 主机负载 -->
      <div class="hostLoad3" v-if="hostLoadData(2) && hostListRunClass(2)">
        {{ hostLoad2 }}%
      </div>
      <!-- 主机冷却冷冻水流信息 -->
      <div class="water-flow3">
        <div class="water-flow-li">
          <span>3#冷却水流:</span>
          <span v-if="hostCoolingWaterFlowClass(2)">接通</span>
          <span v-else>断开</span>
          <span
            class="break"
            :class="{ connect: hostCoolingWaterFlowClass(2) }"
          ></span>
        </div>
        <div class="water-flow-li">
          <span>3#冷冻水流:</span>
          <span v-if="hostCoolingWaterFlowClass(2)">接通</span>
          <span v-else>断开</span>
          <span
            class="break"
            :class="{ connect: hostFreezeWaterFlowClass(2) }"
          ></span>
        </div>
      </div>
      <!-- 线+主机冷却水流状态 -->
      <line-children
        :angle1="-0"
        :angle2="-48"
        :lineWidth1="350"
        :lineWidth2="490"
        class="host-line3"
      ></line-children>

      <!-- 冷却泵数据定位 -->
      <div class="coolingPump1">1#</div>
      <div class="coolingPump2">2#</div>
      <div class="coolingPump3">3#</div>
      <!-- 运行状态 -->
      <img
        class="cooling-img1"
        v-if="coolingPumpRunClass(0)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass2: coolingPumpRunClass(0) }"
      />
      <img
        class="cooling-img2"
        v-if="coolingPumpRunClass(1)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass2: coolingPumpRunClass(1) }"
      />
      <img
        class="cooling-img3"
        v-if="coolingPumpRunClass(2)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass2: coolingPumpRunClass(2) }"
      />
      <!-- 频率反馈 -->
      <div
        class="cooling-hz1"
        v-if="coolingPumpHz(0) && coolingPumpRunClass(0)"
      >
        {{ coolingPumpHz0 }}Hz
      </div>
      <div
        class="cooling-hz2"
        v-if="coolingPumpHz(1) && coolingPumpRunClass(1)"
      >
        {{ coolingPumpHz1 }}Hz
      </div>
      <div
        class="cooling-hz3"
        v-if="coolingPumpHz(2) && coolingPumpRunClass(2)"
      >
        {{ coolingPumpHz2 }}Hz
      </div>
      <!-- 冷冻泵数据定位 -->
      <div class="freezingPump1">1#</div>
      <div class="freezingPump2">2#</div>
      <div class="freezingPump3">3#</div>
      <img
        class="freezing-img1"
        v-if="freezingPumpRunClass(0)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass2: freezingPumpRunClass(0) }"
      />
      <img
        class="freezing-img2"
        v-if="freezingPumpRunClass(1)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass2: freezingPumpRunClass(1) }"
      />
      <img
        class="freezing-img3"
        v-if="freezingPumpRunClass(2)"
        src="../../../assets/images/fan-img.png"
        alt=""
        :class="{ moveClass2: freezingPumpRunClass(2) }"
      />
      <!-- 频率反馈 旋转+有频率反馈才显示 -->
      <div
        class="freezing-hz1"
        v-if="freezingPumpHz(0) && freezingPumpRunClass(0)"
      >
        {{ freezingPumpHz0 }}Hz
      </div>
      <div
        class="freezing-hz2"
        v-if="freezingPumpHz(1) && freezingPumpRunClass(1)"
      >
        {{ freezingPumpHz1 }}Hz
      </div>
      <div
        class="freezing-hz3"
        v-if="freezingPumpHz(2) && freezingPumpRunClass(2)"
      >
        {{ freezingPumpHz2 }}Hz
      </div>
      <!-- 冷却塔数据定位 五个风机 三个出水阀 -->
      <div class="coolingTower3">3#-1</div>
      <div class="coolingTower22">2#-2</div>
      <div class="coolingTower21">2#-1</div>
      <div class="coolingTower12">1#-2</div>
      <div class="coolingTower11">1#-1</div>
      <!-- 风机频率 -->
      <div
        class="coolingTowerHz3"
        v-if="coolingTowerHz(2, 1) && coolingTowerRunClass(2, 1)"
      >
        {{ coolingTowerHz31 }}Hz
      </div>
      <div
        class="coolingTowerHz22"
        v-if="coolingTowerHz(1, 2) && coolingTowerRunClass(1, 2)"
      >
        {{ coolingTowerHz22 }}Hz
      </div>
      <div
        class="coolingTowerHz21"
        v-if="coolingTowerHz(1, 1) && coolingTowerRunClass(1, 1)"
      >
        {{ coolingTowerHz21 }}Hz
      </div>
      <div
        class="coolingTowerHz12"
        v-if="coolingTowerHz(0, 2) && coolingTowerRunClass(0, 2)"
      >
        {{ coolingTowerHz12 }}Hz
      </div>
      <div
        class="coolingTowerHz11"
        v-if="coolingTowerHz(0, 1) && coolingTowerRunClass(0, 1)"
      >
        {{ coolingTowerHz11 }}Hz
      </div>
      <!-- 3号冷却塔风机1 -->
      <img
        class="fan-img1"
        v-if="coolingTowerRunClass(2, 1)"
        :class="{ moveClass2: coolingTowerRunClass(2, 1) }"
        src="../../../assets/images/fan-img.png"
        alt=""
      />
      <!-- 2号冷却塔风机1 -->
      <img
        class="fan-img3"
        v-if="coolingTowerRunClass(1, 1)"
        :class="{ moveClass2: coolingTowerRunClass(1, 1) }"
        src="../../../assets/images/fan-img.png"
        alt=""
      />
      <!-- 2号冷却塔风机2 -->
      <img
        class="fan-img2"
        v-if="coolingTowerRunClass(1, 2)"
        :class="{ moveClass2: coolingTowerRunClass(1, 2) }"
        src="../../../assets/images/fan-img.png"
        alt=""
      />
      <!-- 1 号冷却塔风机1 -->
      <img
        class="fan-img5"
        v-if="coolingTowerRunClass(0, 1)"
        :class="{ moveClass2: coolingTowerRunClass(0, 1) }"
        src="../../../assets/images/fan-img.png"
        alt=""
      />
      <!-- 1号冷却塔风机2 -->
      <img
        class="fan-img4"
        v-if="coolingTowerRunClass(0, 2)"
        :class="{ moveClass2: coolingTowerRunClass(0, 2) }"
        src="../../../assets/images/fan-img.png"
        alt=""
      />
      <div
        class="towerValve1"
        :class="{ startClass: towerValveControlClass(2) }"
      ></div>
      <div
        class="towerValve2"
        :class="{ startClass: towerValveControlClass(1) }"
      ></div>
      <div
        class="towerValve3"
        :class="{ startClass: towerValveControlClass(0) }"
      ></div>
      <!-- 冷冻蝶阀数据定位 -->
      <div
        class="frozenValve1"
        :class="{ startClass: frozenValveControlClass(0) }"
      ></div>
      <div
        class="frozenValve2"
        :class="{ startClass: frozenValveControlClass(1) }"
      ></div>
      <div
        class="frozenValve3"
        :class="{ startClass: frozenValveControlClass(2) }"
      ></div>
      <!-- 冷却蝶阀数据定位 -->
      <div
        class="coolingValue1"
        :class="{ startClass: coolingValueControlClass(0) }"
      ></div>
      <div
        class="coolingValue2"
        :class="{ startClass: coolingValueControlClass(1) }"
      ></div>
      <div
        class="coolingValue3"
        :class="{ startClass: coolingValueControlClass(2) }"
      ></div>
      <!-- 箭头 -->
      <img class="in-arrow" src="../../../assets/images/in-arrow.png" alt="" />
      <img
        class="out-arrow"
        src="../../../assets/images/out-arrow.png"
        alt=""
      />
      <!-- 冷冻进出水温度 0是out供(出)水，1是in回(进)水 -->
      <div class="freezingInTem">{{ freezingInTem }}℃</div>
      <div class="freezingOutTem">{{ freezingOutTem }}℃</div>
      <!-- 冷冻水流 -->
      <div class="freezingOutWater">{{ freezingOutWater }}m³/h</div>
      <!-- 冷冻进出水压力 -->
      <div class="freezingInPre">{{ freezingInPre }}kpa</div>
      <div class="freezingOutPre">{{ freezingOutPre }}kpa</div>
      <!-- 冷却进出水温度 -->
      <div class="coolingInTem">{{ coolingInTem }}℃</div>
      <div class="coolingOutTem">{{ coolingOutTem }}℃</div>
      <!-- 报警状态与系统模式 -->
      <div class="statusAndModel" v-if="isWarning">
        <img src="../../../assets/images/red.png" class="warnStatus" alt="" />
        <img
          src="../../../assets/images/border6.png"
          class="modelStatus"
          alt=""
        />
        <div class="sysWarning" @click="showAlarm">Warning</div>
        <div class="sysStatus">{{ sysStatus }}</div>
      </div>
      <div class="statusAndModel" v-else>
        <img src="../../../assets/images/blue.png" class="warnStatus" alt="" />
        <img
          src="../../../assets/images/border5.png"
          class="modelStatus"
          alt=""
        />
        <div class="sysNormal">Normal</div>
        <div class="sysStatus">{{ sysStatus }}</div>
      </div>
    </div>
    <!-- 报警弹框内容 -->
    <el-dialog
      title="报警内容"
      :visible.sync="openDialog"
      width="680px"
      append-to-body
    >
      <el-table :data="alarmList">
        <el-table-column
          prop="otherName"
          label="报警位置"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          prop="curTime"
          label="报警时间"
          :show-overflow-tooltip="true"
        ></el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import {
  weatherData,
  sysPerformance,
  oneKeyButton,
  monitorList,
  operationConrol,
  systemMode,
} from "@/api/centerairC/sysMonitor";
import LineChildren from "./lineChildren.vue";
export default {
  name: "sysControl",
  components: { LineChildren },
  data() {
    return {
      loading: false,
      weatherObj: {},
      performanceObj: {},
      hostList: [], //主机列表
      coolingPump: [], //冷却泵
      freezingPump: [], //冷冻泵
      coolingTower: [], //冷却塔
      frozenValve: [], //冷冻蝶阀
      coolingValue: [], //冷却蝶阀
      coolingTowerInlet: [], //冷却塔进水阀
      coolingTowerOutlet: [], //冷却塔出水阀
      freezingManifold: [], //冷冻总管
      isShowOn: false, //一键启停,false是Off,true显示On
      oneKeyButtonId: "",

      // 主机负载
      hostLoad0: "",
      hostLoad1: "",
      hostLoad2: "",
      // 冷却泵频率反馈
      coolingPumpHz0: "",
      coolingPumpHz1: "",
      coolingPumpHz2: "",
      // 冷冻泵频率反馈
      freezingPumpHz0: "",
      freezingPumpHz1: "",
      freezingPumpHz2: "",
      // 冷却塔风机频率
      coolingTowerHz31: "",
      coolingTowerHz22: "",
      coolingTowerHz21: "",
      coolingTowerHz12: "",
      coolingTowerHz11: "",
      // 冷冻泵进出水温度
      freezingInTem: "",
      freezingOutTem: "",
      // 冷冻水流
      freezingOutWater: "",
      // 冷冻泵进出压力
      freezingInPre: "",
      freezingOutPre: "",
      // 冷却进出水温度
      coolingInTem: "",
      coolingOutTem: "",

      // 报警标志
      isWarning: false,
      // 报警列表
      alarmList: [],
      // 系统模式
      sysStatus: "",
      // 模式提示
      startOrStopStatus: "",
      openDialog: false,
      timer: null, // 用于存储定时器 ID
    };
  },
  created() {},
  mounted() {
    // 首次进入页面时执行
    this.getWeatherData();
    this.getSystemMode();
    this.getPerformance();
    this.getOneKeyButton();
    this.getMonitorList();

    // 设置定时器，每 10 秒执行一次
    this.timer = setInterval(() => {
      this.getWeatherData();
      this.getSystemMode();
      this.getPerformance();
      this.getOneKeyButton();
      this.getMonitorList();
    }, 10000);
  },
  beforeDestroy() {
    // 组件销毁前清除定时器
    if (this.timer) {
      clearInterval(this.timer);
    }
  },
  methods: {
    // 获取天气相关数据
    getWeatherData() {
      weatherData().then((res) => {
        if (res.code == 200) {
          this.weatherObj = res.data;
        }
      });
    },
    // 获取系统性能数据
    getPerformance() {
      sysPerformance().then((res) => {
        if (res.code == 200) {
          this.performanceObj = res.data;
        }
      });
    },
    // 获取当前系统模式/启动、停止运行状态/报警列表
    getSystemMode() {
      let data = {
        systemType: "0",
        paramType: "27",
      };
      systemMode(data).then((res) => {
        console.log("当前系统模式与报警列表返回", res);
        if (res.code == 200) {
          this.sysStatus = res.data.autoType;
          this.alarmList = res.data.alarmList;
          if (res.data.alarmList.length > 0) {
            this.isWarning = true;
          } else {
            this.isWarning = false;
          }
          this.startOrStopStatus = res.data.startOrStopStatus;
        }
      });
    },
    showAlarm() {
      this.openDialog = true;
    },
    // 获取一键启停信息
    getOneKeyButton() {
      return new Promise((resolve, reject) => {
        let data = {
          systemType: 0,
          paramType: "23",
        };
        oneKeyButton(data)
          .then((res) => {
            console.log("一键启停返回信息", res);
            if (res.code === 200) {
              this.oneKeyButtonId = res.data.id;
              if (Number(res.data.curValue) == 0) {
                this.isShowOn = false;
              } else {
                this.isShowOn = true;
              }
            } else {
              this.oneKeyButtonId = "";
              this.isShowOn = false;
            }
            // 成功时解析 Promise
            resolve(res);
          })
          .catch((error) => {
            // 失败时拒绝 Promise
            reject(error);
          });
      });
    },
    // 一键启停按钮
    handleOneKeyButton() {
      let param = "";
      let paramText = "";
      if (this.isShowOn) {
        // this.isShowOn为true代表ON,此时点击按钮想OFF
        param = 0;
        paramText = "一键关闭";
      } else {
        param = 1;
        paramText = "一键开启";
      }
      this.$confirm(`确定要${paramText}吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let data = {
            id: this.oneKeyButtonId,
            param: param,
          };
          operationConrol([data])
            .then((res) => {
              if (res.code == 200) {
                this.$modal.msgSuccess("指令下发成功!");
                // 开启 loading 效果
                this.loading = true;
                // 更新状态;
                setTimeout(() => {
                  this.getOneKeyButton().finally(() => {
                    // 关闭 loading 效果
                    this.loading = false;
                  });
                }, 6000);
              } else {
                this.getOneKeyButton();
              }
            })
            .catch((error) => {
              console.log("请求发生错误，更新设备状态", error);
              this.ggetOneKeyButton();
            });
        })
        .catch(() => {});
    },
    // 系统监测数据
    getMonitorList() {
      monitorList({ systemType: 0 }).then((res) => {
        if (res.code === 200) {
          console.log("设备监测列表返回", res);

          // 初始化各个设备列表
          this.hostList = [];
          this.coolingPump = [];
          this.freezingPump = [];
          this.coolingTower = [];
          this.frozenValve = [];
          this.coolingValue = [];
          this.coolingTowerInlet = [];
          this.coolingTowerOutlet = [];
          this.freezingManifold = [];

          res.rows.forEach((row) => {
            switch (row.name) {
              case "0":
                this.hostList = this.processDeviceList(row.values);
                console.log("主机列表", this.hostList);
                break;
              case "1":
                this.coolingPump = this.processDeviceList(row.values);
                console.log("冷却泵列表", this.coolingPump);
                break;
              case "2":
                this.freezingPump = this.processDeviceList(row.values);
                console.log("冷冻泵列表", this.freezingPump);
                break;
              case "3":
                this.coolingTower = this.processDeviceList(row.values);
                console.log("冷却塔列表", this.coolingTower);
                break;
              case "4":
                this.frozenValve = this.processDeviceList(row.values);
                console.log("冷冻蝶阀列表", this.frozenValve);
                break;
              case "7":
                this.coolingValue = this.processDeviceList(row.values);
                console.log("冷却蝶阀列表", this.coolingValue);
                break;
              case "8":
                this.coolingTowerInlet = this.processDeviceList(row.values);
                console.log("冷却塔进水阀列表", this.coolingTowerInlet);
                break;
              case "9":
                this.coolingTowerOutlet = this.processDeviceList(row.values);
                console.log("冷却塔出水阀列表", this.coolingTowerOutlet);
                break;
              case "15":
                this.freezingManifold = row.values;
                console.log("冷冻总管", this.freezingManifold);
                this.freezingManifoldData();
                break;
              default:
                break;
            }
          });
        }
      });
    },
    // 封装一个通用函数来处理设备列表
    processDeviceList(values) {
      const deviceList = [];
      // 遍历每个设备属性
      values.forEach((item) => {
        // 提取设备编号
        const match = item.deviceName.match(/(\d+)号/);
        if (match) {
          const deviceNumber = parseInt(match[1]);
          // 如果 deviceList 中对应编号的对象还不存在，则创建一个新对象
          if (!deviceList[deviceNumber - 1]) {
            deviceList[deviceNumber - 1] = {
              deviceName: item.deviceName,
              properties: [],
            };
          }
          // 将当前属性添加到对应设备的 properties 数组中
          deviceList[deviceNumber - 1].properties.push(item);
        }
      });
      // 过滤掉 deviceList 中可能存在的空元素
      return deviceList.filter((item) => item);
    },
    // 主机负载
    hostLoadData(index) {
      // 检查 hostList 长度是否足够
      if (this.hostList.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    hostList[index]数组的properties数组
      const properties = this.hostList[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 28表示主机负载
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "28") {
          // 动态构造属性名
          const propertyName = `hostLoad${index}`;
          // 使用方括号语法动态设置属性值
          this[propertyName] = item.collectValue;
          return true;
        }
      }
      // 否则代表启停控制中的停止
      return false;
    },
    // 主机启停状态
    hostListControlClass(index) {
      // 检查 hostList 长度是否足够
      if (this.hostList.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    hostList[index]数组的properties数组
      const properties = this.hostList[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 2并且item.collectValue !== "0.00"则便是启停控制中的开启
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "2" && Number(item.collectValue) !== 0) {
          return true;
        }
      }
      // 否则代表启停控制中的停止
      return false;
    },
    // 主机运行状态
    hostListRunClass(index) {
      // 检查 hostList 长度是否足够
      if (this.hostList.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    hostList[index]数组的properties数组
      const properties = this.hostList[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 1并且item.collectValue !== "0.00"则便是运行状态中的运行
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "1" && Number(item.collectValue) !== 0) {
          return true;
        }
      }
      // 否则代表运行状态中的不运行
      return false;
    },
    // 主机冷却水流信号
    hostCoolingWaterFlowClass(index) {
      // 检查 hostList 长度是否足够
      if (this.hostList.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    hostList[index]数组的properties数组
      const properties = this.hostList[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 21并且item.collectValue !== "0.00"则便是主机冷却水流信号：接通
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "21" && Number(item.collectValue) !== 0) {
          return true;
        }
      }
      // 否则代表主机冷却水流信号：断开
      return false;
    },
    // 主机冷冻水流信号
    hostFreezeWaterFlowClass(index) {
      // 检查 hostList 长度是否足够
      if (this.hostList.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    hostList[index]数组的properties数组
      const properties = this.hostList[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 20并且item.collectValue !== "0.00"则便是主机冷冻水流信号：接通
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "20" && Number(item.collectValue) !== 0) {
          return true;
        }
      }
      // 否则代表主机冷冻水流信号：断开
      return false;
    },
    // 冷却泵运行状态
    coolingPumpRunClass(index) {
      // 检查 coolingPump 长度是否足够
      if (this.coolingPump.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    coolingPump[index]数组的properties数组
      const properties = this.coolingPump[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 1并且item.collectValue !== "0.00"则便是运行状态中的运行
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "1" && Number(item.collectValue) !== 0) {
          return true;
        }
      }
      // 否则代表运行状态中的不运行
      return false;
    },
    // 冷却泵频率
    coolingPumpHz(index) {
      // 检查 coolingPump 长度是否足够
      if (this.coolingPump.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    coolingPump[index]数组的properties数组
      const properties = this.coolingPump[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 4则有频率反馈
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "4") {
          // 动态构造属性名
          const propertyName = `coolingPumpHz${index}`;
          // 使用方括号语法动态设置属性值
          this[propertyName] = item.collectValue;
          // this.coolingPumpHz[index] = item.collectValue;
          return true;
        }
      }
      // 否则代表运行状态中的不运行
      return false;
    },
    // 冷冻泵运行状态
    freezingPumpRunClass(index) {
      // 检查 freezingPump 长度是否足够
      if (this.freezingPump.length <= index) {
        return false;
      }
      // console.log("打印this.freezingPump数组", this.freezingPump);
      // 检查 properties 数组是否存在    freezingPump[index]数组的properties数组
      const properties = this.freezingPump[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 1并且item.collectValue !== "0.00"则便是运行状态中的运行
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "1" && Number(item.collectValue) !== 0) {
          return true;
        }
      }
      // 否则代表运行状态中的不运行
      return false;
    },
    //冷冻泵频率
    freezingPumpHz(index) {
      // 检查 freezingPump 长度是否足够
      if (this.freezingPump.length <= index) {
        return false;
      }
      // 检查 properties 数组是否存在    freezingPump[index]数组的properties数组
      const properties = this.freezingPump[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }
      // 遍历 properties 数组，如果当前对象paramType === 4则有频率反馈
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "4") {
          // 动态构造属性名
          const propertyName = `freezingPumpHz${index}`;
          // 使用方括号语法动态设置属性值
          this[propertyName] = item.collectValue;
          // this.freezingPumpHz[index] = item.collectValue;
          return true;
        }
      }
      // 否则代表运行状态中的不运行
      return false;
    },
    // 冷却塔风机运行状态,index为多少号风机,0表示1号风机;item表示风机x
    coolingTowerRunClass(index, item) {
      // 检查 coolingTower 长度是否足够
      if (this.coolingTower.length <= index) {
        return false;
      }

      // 获取指定索引的 coolingTower 元素的 properties 数组
      const properties = this.coolingTower[index].properties;

      // 检查 properties 数组是否存在
      if (!properties || properties.length === 0) {
        return false;
      }

      // 创建一个新数组，用于存储 paramType === 1 的对象
      const filteredProperties = [];
      let filterItem = {};
      for (let i = 0; i < properties.length; i++) {
        // console.log('properties[i].paramType',properties[i].paramType)
        if (properties[i].paramType === "1") {
          filteredProperties.push(properties[i]);
          // filterItem  = properties[i]
        }
      }
      // // 将处理后的对象添加到 deviceList 中
      // if (Object.keys(filterItem).length > 1) {
      //   filteredProperties.push(filterItem);
      // }
      // console.log("paramType为1的对象", filteredProperties);
      // console.log("index, item", index, item);
      // 根据 index 和 item 生成目标属性名称
      const towerNumber = index + 1;
      const targetPropertyName = `${towerNumber}号冷却塔风机${item}运行`;
      // console.log("targetPropertyName",targetPropertyName)
      // 在新数组中查找与目标名称匹配的对象，并检查其 collectValue 是否不为 "0.00"
      for (let i = 0; i < filteredProperties.length; i++) {
        if (
          filteredProperties[i].collectName === targetPropertyName &&
          Number(filteredProperties[i].collectValue) !== 0
        ) {
          if (index === 0 && item === 1) {
            // console.log(
            //   "返回的true",
            //   filteredProperties[i].collectName === targetPropertyName &&
            //     Number(filteredProperties[i].collectValue) !== 0
            // );
          }
          return true;
        }
      }

      // 否则代表运行状态中的不运行
      return false;
    },
    // 冷却塔风机频率,index为多少号风机,0表示1号风机;item表示风机x
    coolingTowerHz(index, item) {
      // 检查 coolingTower 长度是否足够
      if (this.coolingTower.length <= index) {
        return false;
      }

      // 获取指定索引的 coolingTower 元素的 properties 数组
      const properties = this.coolingTower[index].properties;

      // 检查 properties 数组是否存在
      if (!properties || properties.length === 0) {
        return false;
      }

      // 创建一个新数组，用于存储 paramType === 4 的对象
      const filteredProperties = [];
      let filterItem = {};
      for (let i = 0; i < properties.length; i++) {
        // console.log('properties[i].paramType',properties[i].paramType)
        if (properties[i].paramType === "4") {
          filteredProperties.push(properties[i]);
          // filterItem  = properties[i]
        }
      }
      // // 将处理后的对象添加到 deviceList 中
      // if (Object.keys(filterItem).length > 1) {
      //   filteredProperties.push(filterItem);
      // }
      // console.log("paramType为4的对象", filteredProperties);
      // console.log("index, item", index, item);
      // 根据 index 和 item 生成目标属性名称
      const towerNumber = index + 1;
      const targetPropertyName = `${towerNumber}号冷却塔风机${item}频率反馈`;
      // console.log("targetPropertyName",targetPropertyName)
      // 在新数组中查找与目标名称匹配的对象，并检查其 collectValue 是否不为 "0.00"
      for (let i = 0; i < filteredProperties.length; i++) {
        if (filteredProperties[i].collectName === targetPropertyName) {
          // 动态构造 coolingTowerHz 相关属性名
          const coolingTowerHzPropertyName = `coolingTowerHz${towerNumber}${item}`;
          // console.log(
          //   "coolingTowerHzPropertyName---",
          //   coolingTowerHzPropertyName
          // );
          // 获取 collectValue 转换为数字后的值
          const value = Number(filteredProperties[i].collectValue);
          // 使用方括号语法动态设置属性值
          this[coolingTowerHzPropertyName] = value;
          // console.log("Number(filteredProperties[i].collectValue)", value);
          return true;
        }
      }

      // 否则代表运行状态中的不运行
      return false;
    },
    // 冷却塔出水蝶阀启停状态
    towerValveControlClass(index) {
      // 检查 coolingTowerOutlet 长度是否足够
      if (this.coolingTowerOutlet.length <= index) {
        return false;
      }
      // console.log("打印this.coolingTowerOutlet数组", this.coolingTowerOutlet);
      // 检查 properties 数组是否存在    coolingTowerOutlet[index]数组的properties数组
      const properties = this.coolingTowerOutlet[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }

      let valveOpenFeedbackFound = false;
      let valveCloseFeedbackFound = false;
      // 遍历 properties 数组
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "7") {
          // console.log("item.collectName", item.collectName);
          // console.log("item.collectValue", item.collectValue);
          // 阀开到位是开启
          if (
            item.collectName.includes("阀开到位") &&
            Number(item.collectValue) == 1
          ) {
            valveOpenFeedbackFound = true;
          }
          // 阀关到位是关闭
          if (
            item.collectName.includes("阀关到位") &&
            Number(item.collectValue) == 0
          ) {
            valveCloseFeedbackFound = true;
          }
        }
      }

      // 当阀开到位和阀关到位的条件都满足时返回 true ,才是真正的阀门开启,其他都是阀门关闭
      return valveOpenFeedbackFound && valveCloseFeedbackFound;
    },
    // 冷冻蝶阀启停状态
    frozenValveControlClass(index) {
      // 检查 frozenValve 长度是否足够
      if (this.frozenValve.length <= index) {
        return false;
      }
      // console.log("打印this.frozenValve数组", this.frozenValve);
      // 检查 properties 数组是否存在    frozenValve[index]数组的properties数组
      const properties = this.frozenValve[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }

      let valveOpenFeedbackFound = false;
      let valveCloseFeedbackFound = false;

      // 遍历 properties 数组
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "7") {
          // 阀开到位是开启
          if (
            item.collectName.includes("阀开到位") &&
            Number(item.collectValue) !== 0
          ) {
            valveOpenFeedbackFound = true;
          }
          // 阀关到位是关闭
          if (
            item.collectName.includes("阀关到位") &&
            Number(item.collectValue) === 0
          ) {
            valveCloseFeedbackFound = true;
          }
        }
      }

      // 当阀开到位和阀关到位的条件都满足时返回 true ,才是真正的阀门开启,其他都是阀门关闭
      return valveOpenFeedbackFound && valveCloseFeedbackFound;
    },
    // 冷却蝶阀启停状态
    coolingValueControlClass(index) {
      // 检查 coolingValue 长度是否足够
      if (this.coolingValue.length <= index) {
        return false;
      }
      // console.log("打印this.coolingValue数组", this.coolingValue);
      // 检查 properties 数组是否存在    coolingValue[index]数组的properties数组
      const properties = this.coolingValue[index].properties;
      if (!properties || properties.length === 0) {
        return false;
      }

      let valveOpenFeedbackFound = false;
      let valveCloseFeedbackFound = false;

      // 遍历 properties 数组
      for (let i = 0; i < properties.length; i++) {
        const item = properties[i];
        if (item.paramType === "7") {
          // 阀开到位是开启
          if (
            item.collectName.includes("阀开到位") &&
            Number(item.collectValue) !== 0
          ) {
            valveOpenFeedbackFound = true;
          }
          // 阀关到位是关闭
          if (
            item.collectName.includes("阀关到位") &&
            Number(item.collectValue) === 0
          ) {
            valveCloseFeedbackFound = true;
            // console.log("冷冻蝶阀阀关到位应该是true才对呀");
          }
        }
      }

      // 当阀开到位和阀关到位的条件都满足时返回 true ,才是真正的阀门开启,其他都是阀门关闭
      return valveOpenFeedbackFound && valveCloseFeedbackFound;
    },
    // 冷冻总管数据 供回水温度、压力等
    freezingManifoldData(index, val) {
      console.log("this.freezingManifold", this.freezingManifold);
      // 检查 freezingManifold 长度是否足够
      if (this.freezingManifold.length <= index) {
        return false;
      }
      this.freezingManifold.forEach((item) => {
        if (item.collectName === "冷冻供水温度") {
          this.freezingOutTem = item.collectValue;
          console.log("item.collectName", item.collectName);
        } else if (item.collectName === "冷冻回水温度") {
          this.freezingInTem = item.collectValue;
        } else if (item.collectName === "冷冻供水压力") {
          this.freezingOutPre = item.collectValue;
        } else if (item.collectName === "冷冻回水压力") {
          this.freezingInPre = item.collectValue;
        } else if (item.collectName === "冷却供水温度") {
          this.coolingOutTem = item.collectValue;
        } else if (item.collectName === "冷却回水温度") {
          this.coolingInTem = item.collectValue;
        } else if (item.collectName === "总冷量计瞬时流量") {
          this.freezingOutWater = item.collectValue;
        }
      });
      return true;
    },
  },
};
</script>

<style lang="scss" scoped>
.monitor {
  width: 100%;
  .monitor-content {
    width: 16rem;
    // height: 9.65rem;
    position: relative;
    margin-left: calc((100% - 16rem) / 2);
    .monitor-img {
      position: absolute;
      top: -0.2rem;
      left: calc((100% - 16rem) / 2);
      width: 15.5rem;
      height: 9.65rem;
      z-index: 1;
    }
    .fan-img1 {
      z-index: 10;
      position: absolute;
      top: 0.7rem;
      left: 4.96rem;
      width: 0.5rem;
      height: 0.5rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .fan-img2 {
      z-index: 10;
      position: absolute;
      top: 0.39rem;
      left: 5.92rem;
      width: 0.5rem;
      height: 0.5rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .fan-img3 {
      z-index: 10;
      position: absolute;
      top: 0.27rem;
      left: 6.41rem;
      width: 0.5rem;
      height: 0.5rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .fan-img4 {
      z-index: 10;
      position: absolute;
      top: 0.06rem;
      left: 7.25rem;
      width: 0.5rem;
      height: 0.5rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .fan-img5 {
      z-index: 10;
      position: absolute;
      top: -0.04rem;
      left: 7.7rem;
      width: 0.5rem;
      height: 0.5rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    /* 定义 fan 动画关键帧 */
    @keyframes fan {
      0% {
        /* 修改初始旋转角度 */
        transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
      }
      100% {
        /* 修改结束旋转角度 */
        transform: translateX(-50%) rotateX(60deg) rotateZ(360deg);
      }
    }
    .towerValve1 {
      z-index: 10;
      position: absolute;
      top: 1.17rem;
      left: 5.66rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .towerValve2 {
      z-index: 10;
      position: absolute;
      top: 0.9rem;
      left: 6.75rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .towerValve3 {
      z-index: 10;
      position: absolute;
      top: 0.56rem;
      left: 8.05rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .in-arrow {
      position: absolute;
      top: 2.5rem;
      right: 3.7rem;
      transform: rotate(180deg);
      width: 0.4rem;
      height: 0.6rem;
      z-index: 10;
    }
    .out-arrow {
      position: absolute;
      top: 3.4rem;
      right: 1.3rem;
      width: 0.4rem;
      height: 0.6rem;
      z-index: 10;
    }
    .coolingInTem {
      z-index: 10;
      position: absolute;
      top: 2.1rem;
      left: 8.35rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .coolingOutTem {
      z-index: 10;
      position: absolute;
      top: 3rem;
      left: 4.77rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezingInTem {
      z-index: 10;
      position: absolute;
      top: 4.54rem;
      right: 5.3rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezingOutTem {
      z-index: 10;
      position: absolute;
      top: 5.2rem;
      right: 3.8rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezingOutWater {
      z-index: 10;
      position: absolute;
      top: 6.2rem;
      right: 4.9rem;
      font-size: 0.16rem;
      font-weight: bold;
    }

    .freezingInPre {
      z-index: 10;
      position: absolute;
      top: 5rem;
      right: 5.3rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezingOutPre {
      z-index: 10;
      position: absolute;
      top: 5.7rem;
      right: 3.7rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .host-line1 {
      position: absolute;
      left: -0.96rem;
      top: 6.57rem;
      z-index: 10;
    }
    .host-line2 {
      position: absolute;
      left: -0.48rem;
      top: 7.48rem;
      z-index: 10;
    }
    .host-line3 {
      position: absolute;
      left: -0.3rem;
      top: 8.24rem;
      z-index: 10;
    }
    .hostName1 {
      border-bottom: 1px solid rgba(0, 255, 255, 1);
      z-index: 10;
      font-size: 0.22rem;
      font-weight: bold;
      color: aqua;
      position: absolute;
      top: 6.8rem;
      left: 2.5rem;
      transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg); /* 分别在 X、Y、Z 轴上旋转 */
      transform-origin: bottom center; /* 设置旋转的基点为底部中心 */
      text-shadow: 0.02rem 0.02rem 0.04rem rgba(0, 0, 0, 0.9); /* 添加文字阴影增强立体感 */
    }
    .hostName2 {
      border-bottom: 1px solid rgba(0, 255, 255, 1);
      z-index: 10;
      font-size: 0.22rem;
      font-weight: bold;
      color: aqua;
      position: absolute;
      top: 6rem;
      left: 4.6rem;
      transform: rotateX(50deg) rotateY(0deg) rotateZ(42deg);
      transform-origin: bottom center;
      text-shadow: 0.02rem 0.02rem 0.04rem rgba(0, 0, 0, 0.9);
    }
    .hostName3 {
      border-bottom: 1px solid rgba(0, 255, 255, 1);
      z-index: 10;
      font-size: 0.22rem;
      font-weight: bold;
      color: aqua;
      position: absolute;
      top: 5.12rem;
      left: 6.5rem;
      transform: rotateX(50deg) rotateY(0deg) rotateZ(39deg);
      transform-origin: bottom center;
      text-shadow: 0.02rem 0.02rem 0.04rem rgba(0, 0, 0, 0.9);
    }
    /* 定义 host 动画关键帧 */
    @keyframes host {
      0% {
        /* 修改初始旋转角度 */
        transform: translateX(-50%) rotateX(15deg) rotateZ(0deg);
      }
      100% {
        /* 修改结束旋转角度 */
        transform: translateX(-50%) rotateX(15deg) rotateZ(360deg);
      }
    }
    .host-img1 {
      z-index: 10;
      position: absolute;
      top: 6.72rem;
      left: 4.02rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateY(0deg) rotateX(0deg) rotateZ(0deg);
    }
    .host-img2 {
      z-index: 10;
      position: absolute;
      top: 5.85rem;
      left: 6.04rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(0deg) rotateZ(0deg);
    }
    .host-img3 {
      z-index: 10;
      position: absolute;
      top: 5.02rem;
      left: 8.2rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(15deg) rotateZ(0deg);
    }
    .hostLoad1 {
      z-index: 10;
      position: absolute;
      top: 5.9rem;
      left: 3.7rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .hostLoad2 {
      z-index: 10;
      position: absolute;
      top: 5.12rem;
      left: 5.7rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .hostLoad3 {
      z-index: 10;
      position: absolute;
      top: 4.4rem;
      left: 7.65rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .water-flow1 {
      z-index: 10;
      position: absolute;
      top: 7.03rem;
      left: 0.1rem;
      font-size: 0.16rem;
    }
    .water-flow2 {
      z-index: 10;
      position: absolute;
      top: 7.93rem;
      left: 0.58rem;
      font-size: 0.16rem;
    }
    .water-flow3 {
      z-index: 10;
      position: absolute;
      top: 8.71rem;
      left: 0.78rem;
      font-size: 0.16rem;
    }
    .water-flow-li {
      margin-bottom: 0.04rem;
      color: #46f1e3;
      display: flex;
      flex-direction: row;
      align-items: center;
      span {
        background-color: rgba(0, 255, 255, 0.2);
        border-radius: 0.1rem;
        padding: 0.01rem 0.03rem;
      }
      .break {
        margin-left: 0.07rem;
        display: inline-block;
        width: 0.18rem;
        height: 0.18rem;
        border-radius: 50%;
        border: 1px solid #46f1e3;
        background-color: transparent !important;
      }
      .connect {
        animation: blink 1s infinite;
        background-color: #38fc52 !important;
      }
    }
    .moveClass {
      animation: host 2s linear infinite;
    }
    .moveClass2 {
      animation: fan 2s linear infinite;
    }
    .startClass {
      /* 应用动画 */
      animation: blink 1s infinite;
      background-color: #38fc52 !important;
    }
    .hostStatus1 {
      z-index: 10;
      position: absolute;
      top: 6.5rem;
      left: 3.3rem;
      width: 0.18rem;
      height: 0.18rem;
      border-radius: 50%;
    }
    .hostStatus2 {
      z-index: 10;
      position: absolute;
      top: 5.7rem;
      left: 5.4rem;
      width: 0.18rem;
      height: 0.18rem;
      border-radius: 50%;
    }
    .hostStatus3 {
      z-index: 10;
      position: absolute;
      top: 4.8rem;
      left: 7.5rem;
      width: 0.18rem;
      height: 0.18rem;
      border-radius: 50%;
    }
    .coolingPump1 {
      z-index: 10;
      font-size: 0.15rem;
      font-weight: bold;
      color: #46f1e3;
      position: absolute;
      top: 3.8rem;
      left: 7.3rem;
    }
    .coolingPump2 {
      z-index: 10;
      font-size: 0.15rem;
      font-weight: bold;
      color: #46f1e3;
      position: absolute;
      top: 3.45rem;
      left: 8.28rem;
    }
    .coolingPump3 {
      z-index: 10;
      font-size: 0.15rem;
      font-weight: bold;
      color: #46f1e3;
      position: absolute;
      top: 3.11rem;
      left: 9.12rem;
    }
    .cooling-img1 {
      z-index: 10;
      position: absolute;
      top: 3.31rem;
      left: 7.4rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .cooling-img2 {
      z-index: 10;
      position: absolute;
      top: 2.98rem;
      left: 8.34rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .cooling-img3 {
      z-index: 10;
      position: absolute;
      top: 2.66rem;
      left: 9.25rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .cooling-hz1 {
      z-index: 10;
      position: absolute;
      top: 3.25rem;
      left: 7.16rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .cooling-hz2 {
      z-index: 10;
      position: absolute;
      top: 2.94rem;
      left: 8.15rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .cooling-hz3 {
      z-index: 10;
      position: absolute;
      top: 2.6rem;
      left: 9.1rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezingPump1 {
      z-index: 10;
      font-size: 0.15rem;
      font-weight: bold;
      color: #46f1e3;
      position: absolute;
      top: 7.5rem;
      left: 6.8rem;
    }
    .freezingPump2 {
      z-index: 10;
      font-size: 0.15rem;
      font-weight: bold;
      color: #46f1e3;
      position: absolute;
      top: 6.82rem;
      left: 8.15rem;
    }
    .freezingPump3 {
      z-index: 10;
      font-size: 0.15rem;
      font-weight: bold;
      color: #46f1e3;
      position: absolute;
      top: 6.28rem;
      left: 9.3rem;
    }
    .freezing-img1 {
      z-index: 10;
      position: absolute;
      top: 6.91rem;
      left: 6.93rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .freezing-img2 {
      z-index: 10;
      position: absolute;
      top: 6.28rem;
      left: 8.26rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .freezing-img3 {
      z-index: 10;
      position: absolute;
      top: 5.72rem;
      left: 9.38rem;
      width: 0.4rem;
      height: 0.4rem;
      transform-style: preserve-3d;
      transform: translateX(-50%) rotateX(60deg) rotateZ(0deg);
    }
    .freezing-hz1 {
      z-index: 10;
      position: absolute;
      top: 6.83rem;
      left: 6.7rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezing-hz2 {
      z-index: 10;
      position: absolute;
      top: 6.24rem;
      left: 8.05rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .freezing-hz3 {
      z-index: 10;
      position: absolute;
      top: 5.66rem;
      left: 9.16rem;
      font-size: 0.16rem;
      font-weight: bold;
    }
    .coolingTower3 {
      z-index: 10;
      font-size: 0.18rem;
      color: #46f1e3;
      position: absolute;
      top: 1.8rem;
      left: 5.05rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTower22 {
      z-index: 10;
      font-size: 0.18rem;
      color: #46f1e3;
      position: absolute;
      top: 1.5rem;
      left: 5.98rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTower21 {
      z-index: 10;
      font-size: 0.18rem;
      color: #46f1e3;
      position: absolute;
      top: 1.38rem;
      left: 6.42rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTower12 {
      z-index: 10;
      font-size: 0.18rem;
      color: #46f1e3;
      position: absolute;
      top: 1.1rem;
      left: 7.3rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTower11 {
      z-index: 10;
      font-size: 0.18rem;
      color: #46f1e3;
      position: absolute;
      top: 1rem;
      left: 7.7rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTowerHz11 {
      z-index: 10;
      font-size: 0.16rem;
      color: #ffffff;
      position: absolute;
      top: -0.08rem;
      left: 7.36rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTowerHz12 {
      z-index: 10;
      font-size: 0.16rem;
      color: #ffffff;
      position: absolute;
      top: 0.04rem;
      left: 6.76rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTowerHz21 {
      z-index: 10;
      font-size: 0.16rem;
      color: #ffffff;
      position: absolute;
      top: 0.22rem;
      left: 6.06rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTowerHz22 {
      z-index: 10;
      font-size: 0.16rem;
      color: #ffffff;
      position: absolute;
      top: 0.37rem;
      left: 5.49rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    .coolingTowerHz3 {
      z-index: 10;
      font-size: 0.16rem;
      color: #ffffff;
      position: absolute;
      top: 0.64rem;
      left: 4.4rem;
      font-weight: bold;
      transform: rotateX(20deg) rotateY(-25deg) rotateZ(-5deg);
    }
    /* 定义灯闪烁的动画 */
    @keyframes blink {
      0% {
        opacity: 1;
      }
      50% {
        opacity: 0.7;
      }
      100% {
        opacity: 1;
      }
    }
    .frozenValve1 {
      z-index: 10;
      position: absolute;
      top: 6.67rem;
      left: 4.62rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .frozenValve2 {
      z-index: 10;
      position: absolute;
      top: 5.8rem;
      left: 6.62rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .frozenValve3 {
      z-index: 10;
      position: absolute;
      top: 4.8rem;
      left: 8.46rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .coolingValue1 {
      z-index: 10;
      position: absolute;
      top: 5.8rem;
      left: 2.7rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .coolingValue2 {
      z-index: 10;
      position: absolute;
      top: 5rem;
      left: 4.73rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .coolingValue3 {
      z-index: 10;
      position: absolute;
      top: 4.24rem;
      left: 6.86rem;
      width: 0.18rem;
      height: 0.18rem;
      background-color: #ebebeb;
      border-radius: 50%;
    }
    .statusAndModel {
      z-index: 10;
      position: absolute;
      top: 8.4rem;
      right: 3rem;
      width: 3rem;
      .warnStatus {
        position: absolute;
        left: 0.04rem;
        top: 0.3rem;
        width: 0.45rem;
        height: 0.45rem;
        animation: breathe 4s ease-in-out infinite;
      }
      @keyframes breathe {
        0% {
          transform: scale(1);
          opacity: 0.5;
        }
        50% {
          transform: scale(1.1);
          opacity: 1;
        }
        100% {
          transform: scale(1);
          opacity: 0.5;
        }
      }
      .modelStatus {
        position: absolute;
        top: 0;
        right: 0rem;
        width: 2.65rem;
        height: 0.83rem;
      }
      .sysNormal {
        position: absolute;
        top: 0.63rem;
        right: 0.7rem;
        font-size: 0.14rem;
        font-weight: bold;
        color: #3bb3f8;
        letter-spacing: 0.02rem;
      }
      .sysWarning {
        position: absolute;
        top: 0.63rem;
        right: 0.7rem;
        font-size: 0.14rem;
        font-weight: bold;
        cursor: pointer;
        color: #ffffff;
        letter-spacing: 0.02rem;
        animation: blink 0.5s ease-in-out infinite;
      }
      .sysStatus {
        position: absolute;
        top: 0.2rem;
        left: 0.8rem;
        font-size: 0.18rem;
        font-weight: bold;
        color: #1fb7f3;
        letter-spacing: 0.02rem;
      }
    }
  }
  .weather {
    min-width: 2.5rem;
    z-index: 10;
    position: absolute;
    top: 0.4rem;
    left: -0rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 0.2rem;
    color: rgb(18, 155, 209);
    background-image: url(../../../assets/images/border1.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 0.15rem 0.1rem 0.25rem 0rem;
  }
  .weather-li {
    width: 100%;
    padding: 0.05rem 0 0.05rem 0.3rem;
    /* 初始设置上下边框宽度为 1px，颜色和样式可以先设为透明，后续由 border-image 覆盖 */
    border-top: 1px solid transparent;
    border-bottom: 1px dashed #1a3f8f;
    position: relative;
    .deepColor {
      display: inline-block;
      margin: 0 0.1rem 0 0.05rem;
      color: #20ebfa;
      font-weight: bold;
      font-family: DIN;
      font-size: 0.24rem;
    }
  }

  .performance {
    position: absolute;
    top: 6.1rem !important;
    right: 0.1rem !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 0.16rem;
    color: rgb(18, 155, 209);
  }
  .perdformance-bg {
    min-width: 2.5rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 0.2rem;
    color: rgb(18, 155, 209);
    background-image: url(../../../assets/images/border4.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 0.15rem 0.1rem 0.25rem 0rem;
  }
  .title {
    z-index: 10;
    width: 100%;
    background-image: url(../../../assets/images/text_img_title.png);
    background-repeat: no-repeat;
    background-repeat: no-repeat;
    background-size: 2rem 0.45rem;
    background-position: bottom left;
    font-family: SourceHanSansCN-Medium;
    font-size: 0.2rem;
    font-style: italic;
    font-weight: bold;
    line-height: 0.6rem;
    color: rgba(209, 214, 223, 1);
    padding-left: 0.5rem;
    margin-bottom: 0.01rem;
    margin-left: 0.4rem;
  }
  .offClass {
    position: absolute;
    width: 1.6rem;
    height: 1.6rem;
    background-image: url(../../../assets/images/border2.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    top: 0;
    right: 1.7rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    .off-bg {
      position: absolute;
      left: 0.38rem;
      top: 0.32rem;
      width: 1rem;
      height: 1rem;
      background-image: url(../../../assets/images/border3.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
      text-align: center;
      line-height: 1rem;
      font-family: DIN;
      font-size: 0.3rem;
      color: #20ebfa;
      font-weight: bold;
    }
    .on-animation {
      animation: rotateZ 5s linear infinite;
      transition: 0.6s; /* 设置过渡时间，控制翻转速度 */
      transform-style: preserve-3d; /* 保持子元素的 3D 效果 */
    }
    /* 定义旋转动画 */
    @keyframes rotateZ {
      0% {
        transform: rotateY(0deg); /* 初始状态，不旋转 */
      }
      50% {
        transform: rotateY(180deg); /* 旋转到 180 度，呈现翻面效果 */
      }
      100% {
        transform: rotateY(360deg); /* 旋转回 360 度，回到初始状态 */
      }
    }
  }
  /* 鼠标悬停时移除动画 */
  .offClass:hover .on-animation {
    animation: none;
  }
  .sysTips {
    position: absolute;
    top: 1.7rem;
    left: 13rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    z-index: 10;
    .step {
      width: 0.2rem;
      height: 0.3rem;
    }
    .tips-text {
      border: 0.01rem solid transparent;
      border-image: linear-gradient(to right, #007bff, #00ffff);
      border-image-slice: 1;
      font-size: 0.18rem;
      color: #1fecf3;
      padding: 0.01rem 0.03rem;
    }
  }
}
// @media (min-width: 1240px) and (max-width: 1440px) {
// }
@media (max-width: 1440px) {
  .monitor-content {
    transform: scale(0.9);
  }
}
</style>
<style scoped>
.monitor >>> .el-dialog:not(.is-fullscreen) {
  margin-top: 15% !important;
}
</style>
