<!--
 * @Author: your name
 * @Date: 2024-12-09 16:41:31
 * @LastEditTime: 2025-03-05 17:32:53
 * @LastEditors: bogon
 * @Description: In User Settings Edit
 * @FilePath: /performance-test/src/views/laserRangeFinder/components/MultilevelTable.vue
-->
<template>
  <el-table :data="tableData" id="Table1">
    <el-table-column type="index" label="序号" width="60"> </el-table-column>
    <el-table-column prop="acquisitionTime" label="时间" min-width="160">
    </el-table-column>
    <el-table-column prop="date" label="场站" min-width="120">
      {{ windName }}
      <template slot-scope="scope"> </template>
    </el-table-column>
    <el-table-column prop="date" label="风机">
      {{ windTurbineName }}
      <template slot-scope="scope"> </template>
    </el-table-column>
    <el-table-column label="叶片角度偏差（°）" align="center">
      <el-table-column prop="blade1AngleDeviation" label="叶片1">
        -0.5
      </el-table-column>
      <el-table-column prop="blade2AngleDeviation" label="叶片2">
        -0.33
      </el-table-column>
      <el-table-column prop="blade3AngleDeviation" label="叶片3">
        0.83
      </el-table-column>
      <el-table-column prop="bladeRelativeAngleDeviation" label="相对偏差">
        1.33
      </el-table-column>
    </el-table-column>
    <el-table-column label="叶片净空值（m）" align="center">
      <el-table-column prop="blade1ClearanceValue" label="叶片1">
        2.12
      </el-table-column>
      <el-table-column prop="blade2ClearanceValue" label="叶片2">
        2.08
      </el-table-column>
      <el-table-column prop="blade3ClearanceValue" label="叶片3">
        2.10
      </el-table-column>
      <el-table-column prop="bladeRelativeClearanceValue" label="平均">
        2.10
      </el-table-column>
    </el-table-column>
    <el-table-column label="叶片扭转变形（°）" align="center">
      <el-table-column prop="blade1TorsionalDeformation" label="叶片1">
        0.21
      </el-table-column>
      <el-table-column prop="blade2TorsionalDeformation" label="叶片2">
        -0.18
      </el-table-column>
      <el-table-column prop="blade3TorsionalDeformation" label="叶片3">
        0.06
      </el-table-column>
      <el-table-column prop="bladeRelativeTorsionalDeformation" label="平均">
        0.05
      </el-table-column>
    </el-table-column>
    <el-table-column label="塔筒晃动" align="center">
      <el-table-column
        min-width="140"
        prop="towerSwayAmplitude"
        label="晃动幅值（mm）"
      >
        58
      </el-table-column>
      <el-table-column
        min-width="140"
        prop="towerSwayMainFrequency"
        label="晃动主频（Hz）"
      >
        0.32
      </el-table-column>
    </el-table-column>
    <el-table-column
      min-width="160"
      prop="bladeCollectionFrequency"
      label="叶片采集频率（Hz）"
    >
      200K
    </el-table-column>
    <el-table-column
      min-width="160"
      prop="towerCollectionFrequency"
      label="塔筒采集频率（Hz）"
    >
      1K
    </el-table-column>
  </el-table>
</template>

<script>
import * as FileSaver from "file-saver";
import * as XLSX from "xlsx";
export default {
  props: {
    windName: "",
    windTurbineName: "",
    tableData: [],
  },
  methods: {
    //表格导出方法
    outputFile() {
      var ws1 = XLSX.utils.table_to_book(document.querySelector("#Table1")); //对应要导出的表格id
      var wbOut = XLSX.write(ws1, {
        bookType: "xlsx",
        bookSST: true,
        type: "array",
      });
      try {
        FileSaver.saveAs(
          new Blob([wbOut], { type: "application/octet-stream" }),
          "TableAllData.xlsx"
        );
      } catch (e) {
        if (typeof console !== "undefined") console.log(e, wbOut);
      }
      return wbOut;
    },
  },
};
</script>
