<!--
 * @Author: your name
 * @Date: 2024-12-09 16:24:28
 * @LastEditTime: 2025-03-24 13:39:39
 * @LastEditors: bogon
 * @Description: In User Settings Edit
 * @FilePath: /performance-test/src/views/laserRangeFinder/components/descrBox.vue
-->
<template>
  <div class="data-origin">
    <div class="descrBox">
      <el-descriptions
        class="margin-top"
        title="叶片角度偏差"
        :column="4"
        border
      >
        <el-descriptions-item label="叶片1">
          <template #label>
            <div>叶片1</div>
            <div>角度偏差°</div>
          </template>
          -0.5
          {{ currentRow && currentRow.blade1AngleDeviation }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片2">
          <template #label>
            <div>叶片2</div>
            <div>角度偏差°</div>
          </template>
          -0.33
          {{ currentRow && currentRow.blade2AngleDeviation }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片3">
          <template #label>
            <div>叶片3</div>
            <div>角度偏差°</div>
          </template>
          0.83
          {{ currentRow && currentRow.blade3AngleDeviation }}
        </el-descriptions-item>
        <el-descriptions-item label="相对">
          <template #label>
            <div>相对</div>
            <div>角度偏差°</div>
          </template>
          1.33
          {{ currentRow && currentRow.bladeRelativeAngleDeviation }}
        </el-descriptions-item>
      </el-descriptions>
      <el-descriptions class="margin-top" title="叶片净空值" :column="4" border>
        <el-descriptions-item label="叶片1">
          <template #label>
            <div>叶片1</div>
            <div>净空值m</div>
          </template>
          2.12
          {{ currentRow && currentRow.blade1ClearanceValue }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片2">
          <template #label>
            <div>叶片2</div>
            <div>净空值m</div>
          </template>
          2.08
          {{ currentRow && currentRow.blade2ClearanceValue }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片3">
          <template #label>
            <div>叶片3</div>
            <div>净空值m</div>
          </template>
          2.10
          {{ currentRow && currentRow.blade3ClearanceValue }}
        </el-descriptions-item>
        <el-descriptions-item label="平均">
          <template #label>
            <div>平均</div>
            <div>净空值m</div>
          </template>
          2.10
          {{ currentRow && currentRow.bladeRelativeClearanceValue }}
        </el-descriptions-item>
      </el-descriptions>
      <el-descriptions
        class="margin-top"
        title="叶片扭转变形"
        :column="4"
        border
      >
        <el-descriptions-item label="叶片1">
          <template #label>
            <div>叶片1</div>
            <div>扭转角°</div>
          </template>
          0.21
          {{ currentRow && currentRow.blade1TorsionalDeformation }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片2">
          <template #label>
            <div>叶片2</div>
            <div>扭转角°</div>
          </template>
          -0.18
          {{ currentRow && currentRow.blade2TorsionalDeformation }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片3">
          <template #label>
            <div>叶片3</div>
            <div>扭转角°</div>
          </template>
          0.06
          {{ currentRow && currentRow.blade3TorsionalDeformation }}
        </el-descriptions-item>
        <el-descriptions-item label="平均">
          <template #label>
            <div>平均</div>
            <div>扭转角°</div>
          </template>
          0.05
          {{ currentRow && currentRow.bladeRelativeTorsionalDeformation }}
        </el-descriptions-item>
      </el-descriptions>
      <el-descriptions
        class="margin-top"
        title="塔筒晃动"
        style="width: 50%"
        :column="4"
        border
      >
        <el-descriptions-item label="塔筒">
          <template #label>
            <div>塔筒</div>
            <div>晃动幅值mm</div>
          </template>
          58
          {{ currentRow && currentRow.towerSwayAmplitude }}
        </el-descriptions-item>
        <el-descriptions-item label="叶片2">
          <template #label>
            <div>塔筒</div>
            <div>晃动主频Hz</div>
          </template>
          0.32
          {{ currentRow && currentRow.towerSwayMainFrequency }}
        </el-descriptions-item>
      </el-descriptions>
    </div>
    <!-- <el-table
      ref="singleTable"
      :data="tableData"
      :current-row-key="currentIndex"
      @current-change="handleCurrentChange"
      highlight-current-row
      style="width: 100%"
      :max-height="type === 'init' ? '570' : '900'"
    >
      <el-table-column type="index" label="序号" width="60"> </el-table-column>
      <el-table-column prop="address" label="场站" min-width="120">
        <template slot-scope="scope">
          {{ windName }}
        </template>
      </el-table-column>
      <el-table-column prop="address" label="风机">
        <template slot-scope="scope">
          {{ windTurbineName }}
        </template>
      </el-table-column>
      <el-table-column min-width="160" prop="acquisitionTime" label="时间">
      </el-table-column>
      <el-table-column
        min-width="160"
        prop="bladeCollectionFrequency"
        label="叶片采集频率Hz"
      >
      </el-table-column>
      <el-table-column
        min-width="160"
        prop="towerCollectionFrequency"
        label="塔筒采集频率Hz"
      >
      </el-table-column>
    </el-table> -->
  </div>
</template>
<script>
export default {
  props: {
    type: "",
    tableData: [],
    currentRow: {
      type: Object,
      default: () => ({
        acquisitionTime: "", //采样时间
        blade1AngleDeviation: "", //叶片1角度偏差
        blade1ClearanceValue: "", //叶片1净空值
        blade1TorsionalDeformation: "", //叶片1扭转变形
        blade2AngleDeviation: "", //叶片2角度偏差
        blade2ClearanceValue: "", //叶片2净空值
        blade2TorsionalDeformation: "", //叶片2扭转变形
        blade3AngleDeviation: "", //叶片3角度偏差
        blade3ClearanceValue: "", //叶片3净空值
        blade3TorsionalDeformation: "", //叶片3扭转变形
        bladeCollectionFrequency: "", //叶片采集频率(HZ)
        bladeRelativeAngleDeviation: "", //叶片角度偏差-相对偏差
        bladeRelativeClearanceValue: "", //叶片净空值-平均
        bladeRelativeTorsionalDeformation: "", //叶片扭转变形-平均
        id: "", //唯一值
        samplingFrequency: "", //采样率
        towerCollectionFrequency: "", //塔筒采集频率(HZ)
        towerSwayAmplitude: "", //塔筒晃动-晃动幅值
        towerSwayMainFrequency: "", //塔筒晃动-晃动主频
        windTurbineNumber: "", //风机编号
      }), // 用于存储当前选中的行
    },
    currentIndex: 0,
    windName: "",
    windTurbineName: "",
  },
  data() {
    return {};
  },
  watch: {
    windName(newVal, oldVal) {
      console.log(newVal, oldVal, "newVal,oldVal");
    },
    windTurbineName(newVal, oldVal) {
      console.log(newVal, oldVal, "newVal,oldVal");
    },
  },
  methods: {
    setCurrent(row) {
      this.$nextTick(() => {
        if (this.$refs.singleTable) {
          this.$refs.singleTable.setCurrentRow(row); // 设置当前行
        } else {
          console.warn("Cannot access $refs.singleTable: it's undefined.");
        }
      });
    },
    handleCurrentChange(val) {
      const index = this.tableData.indexOf(val); // 获取当前选中行的索引
      if (this.type === "init") {
        this.$emit("handleInitCurrentChange", val, index);
      } else if (this.type === "copy") {
        this.$emit("handleCopyCurrentChange", val, index);
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.data-origin {
  width: 100%;
  //   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  .descrBox {
    margin: 20px;
    ::v-deep .el-descriptions__header {
      margin: 10px !important;
    }
    ::v-deep .el-descriptions-item__cell {
      color: #666 !important;
    }
  }
}
</style>
