<script setup lang="ts">
import { getFixedNum } from '@/utils';
import { DevParamCtrlCabinet } from '@/constants/device-params';

import type { DevWorkCardProps } from '@/types';

defineProps<DevWorkCardProps<DevParamCtrlCabinet>>();
</script>

<template>
  <div>
    <img class="ctrl-cabinet-img" src="@/assets/img/device-ctrl-cabinet.png" />
    <div class="ctrl-cabinet-top">
      <div class="ctrl-cabinet-left">
        <div>
          <div class="device-card-label">{{ $t('deviceWorkStatus.ctrlCabinet.chilledWaterMainTempOut') }} (°C)</div>
          <div class="device-card-value" :data-param-code="DevParamCtrlCabinet.冷冻总管出水温度">
            {{ getFixedNum(realTimeData?.[DevParamCtrlCabinet.冷冻总管出水温度]) }}
          </div>
        </div>
        <div>
          <div class="device-card-label">{{ $t('deviceWorkStatus.ctrlCabinet.chilledWaterMainTempIn') }} (°C)</div>
          <div class="device-card-value" :data-param-code="DevParamCtrlCabinet.冷冻总管回水温度">
            {{ getFixedNum(realTimeData?.[DevParamCtrlCabinet.冷冻总管回水温度]) }}
          </div>
        </div>
        <div>
          <div class="device-card-label">{{ $t('deviceWorkStatus.ctrlCabinet.chilledWaterMainPreOut') }} (bar)</div>
          <div class="device-card-value" :data-param-code="DevParamCtrlCabinet.冷冻总管出水压力">
            {{ getFixedNum(realTimeData?.[DevParamCtrlCabinet.冷冻总管出水压力]) }}
          </div>
        </div>
      </div>
    </div>
    <div class="ctrl-cabinet-bottom">
      <div>
        <div class="device-card-label">{{ $t('deviceWorkStatus.ctrlCabinet.chilledWaterMainPreIn') }} (bar)</div>
        <div class="device-card-value" :data-param-code="DevParamCtrlCabinet.冷冻总管回水压力">
          {{ getFixedNum(realTimeData?.[DevParamCtrlCabinet.冷冻总管回水压力]) }}
        </div>
      </div>
      <div>
        <div class="device-card-label">{{ $t('deviceWorkStatus.ctrlCabinet.coolingWaterMainTempOut') }} (°C)</div>
        <div class="device-card-value" :data-param-code="DevParamCtrlCabinet.冷却总管出水温度">
          {{ getFixedNum(realTimeData?.[DevParamCtrlCabinet.冷却总管出水温度]) }}
        </div>
      </div>
      <div>
        <div class="device-card-label">{{ $t('deviceWorkStatus.ctrlCabinet.coolingWaterMainTempIn') }} (°C)</div>
        <div class="device-card-value" :data-param-code="DevParamCtrlCabinet.冷却总管回水温度">
          {{ getFixedNum(realTimeData?.[DevParamCtrlCabinet.冷却总管回水温度]) }}
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.ctrl-cabinet-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.ctrl-cabinet-left {
  width: 170px;
  margin-right: 28px;

  > div + div {
    margin-top: 22px;
  }
}

.ctrl-cabinet-img {
  position: absolute;
  top: 58px;
  right: 19px;
}

.ctrl-cabinet-bottom {
  display: flex;
  justify-content: space-between;
}

.ctrl-cabinet-top,
.ctrl-cabinet-bottom {
  position: relative;
  z-index: 1;
}
</style>
