<template>
  <div class="draught-fan-list">
    <div class="btn-group-tabs">
      <!-- <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2> -->
    </div>
    <div class="df-table">
      <ComTable :data="data"></ComTable>
    </div>
  </div>
</template>

<script>
import ComTable from "@com/coms/table/table.vue";
import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
export default {
  // 名称
  name: "DraughtFanList",
  // 使用组件
  components: {
    ComTable,
    BtnGroup2,
  },
  // 数据
  data () {
    return {
      btnGroups: [
        {
          icon: "fa fa-fire",
          btns: [
            {
              text: "某某风场",
              code: "mmfdc1",
            },
            {
              text: "某某风场",
              code: "mhsfc",
            },
            {
              text: "某某风场",
              code: "mmfdc2",
            },
            {
              text: "某某风场",
              code: "mmfdc3",
            },
            {
              text: "某某风场",
              code: "mmfdc4",
            },
          ],
        },
        {
          icon: "fa fa-fire-extinguisher",
          btns: [
            {
              text: "某某风场",
              code: "mmgf1",
            },
            {
              text: "某某风场",
              code: "mmgf2",
            },
            {
              text: "某某风场",
              code: "mmgf3",
            },
            {
              text: "某某风场",
              code: "mmgf4",
            },
          ],
        },
      ],
      data: {
        column: [
          {
            name: "风机名称",
            field: "name",
            is_num: false,
            is_light: false,
          },
          {
            name: "冷却风温度",
            field: "lqf",
            is_num: true,
            is_light: false,
          },
          {
            name: "有功功率",
            field: "yggl",
            is_num: true,
            is_light: false,
          },
          {
            name: "液压油温度",
            field: "yyy",
            is_num: true,
            is_light: false,
          },
          {
            name: "Pcspp温度",
            field: "pcspp",
            is_num: true,
            is_light: false,
          },
          {
            name: "U1绕组温度",
            field: "u1",
            is_num: true,
            is_light: false,
          },
          {
            name: "U2绕组温度",
            field: "u2",
            is_num: true,
            is_light: true,
          },
          {
            name: "V1绕组温度",
            field: "v1",
            is_num: true,
            is_light: false,
          },
          {
            name: "V2绕组温度",
            field: "v2",
            is_num: true,
            is_light: false,
          },
          {
            name: "W1绕组温度",
            field: "w1",
            is_num: true,
            is_light: false,
          },
          {
            name: "W2绕组温度",
            field: "w2",
            is_num: true,
            is_light: false,
          },
          {
            name: "轴承A温度",
            field: "zca",
            is_num: true,
            is_light: false,
          },
          {
            name: "轴承B温度",
            field: "zcb",
            is_num: true,
            is_light: false,
          },
          {
            name: "齿轮箱温度",
            field: "clx",
            is_num: true,
            is_light: false,
          },
          {
            name: "齿轮箱轴1温度",
            field: "clx1",
            is_num: true,
            is_light: false,
          },
          {
            name: "齿轮箱轴2温度",
            field: "clx2",
            is_num: true,
            is_light: false,
          },
          {
            name: "机舱温度",
            field: "jc",
            is_num: true,
            is_light: false,
          },
          {
            name: "滑环温度",
            field: "hh",
            is_num: true,
            is_light: false,
          },
          {
            name: "环境温度",
            field: "hj",
            is_num: true,
            is_light: false,
          },
        ],
        data: [
          {
            name: "1E01",
            lqf: 15.78,
            yggl: 15.79,
            yyy: 15.79,
            pcspp: 15.79,
            u1: 15.79,
            u2: 15.79,
            v1: 15.79,
            v2: 15.79,
            w1: 15.79,
            w2: 15.79,
            zca: 15.79,
            zcb: 15.79,
            clx: 15.79,
            clx1: 15.79,
            clx2: 15.79,
            jc: 15.79,
            hh: 15.79,
            hj: 15.79,
            is_light: false,
          },
        ],
      },
    };
  },
  // 函数
  methods: {
    // 请求服务
    requestData (showLoading) {
      let that = this;
      that.API.requestData({
        showLoading,
        method: "POST",
        subUrl: "matrix/matrixDetialGfPush",
        success (res) {
          console.log(123123, res);
        },
      });
    },
  },
  // 生命周期钩子
  beforeCreate () {
    // 创建前
  },
  created () {
    // 创建后
    for (let i = 1; i < 50; i++) {
      this.data.data.push(JSON.parse(JSON.stringify(this.data.data[0])));
      if (i == 16) {
        this.data.data[i].is_light = true;
      }
    }
  },

  mounted () {
    let that = this;
    that.$nextTick(() => {
      that.requestData(false);
      that.timmer = setInterval(() => {
        that.requestData(false);
      }, that.$store.state.websocketTimeSec);
    });
  },

  unmounted () {
    clearInterval(this.timmer);
    this.timmer = null;
  },
}
</script>

<style lang="less" scoped>
.draught-fan-list {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;

  .btn-group-tabs {
    display: flex;
    flex-direction: row;

    .photovoltaic {
      margin-left: 1.481vh;
    }
  }

  .df-table {
    border: 0.093vh solid fade(@darkgray, 50%);
    position: relative;
    overflow: auto;
    flex-grow: 1;
    margin-top: 1.481vh;

    &:before {
      content: '';
      width: 0.37vh;
      height: 0.37vh;
      background: @write;
      position: absolute;
      left: 0.278vh;
      top: 0.278vh;
    }

    tbody {
      height: calc(100vh - 166px);
    }
  }
}
</style>
