<template>
  <div class="icingBox">
    <div class="icingContain">
      <leftTree ref="sideTree"></leftTree>
      <div class="rightTable">
        <div class="dataBox">
          <div class="childBox">
            <div class="searchBox" ref="searchref">
              <el-form
                :inline="true"
                :model="formdata"
                class="demo-form-inline"
              >
                <el-form-item label="开始日期">
                  <el-date-picker
                    v-model="formdata.starttime"
                    type="date"
                    placeholder="开始日期"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="结束日期">
                  <el-date-picker
                    v-model="formdata.endtime"
                    type="date"
                    placeholder="结束日期"
                    class="ml10"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="onSubmit">查询</el-button>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" @click="onSubmit"
                    >导出数据</el-button
                  >
                </el-form-item>
              </el-form>
            </div>
            <div class="childTableShowBox">
              <el-table :data="tableData" style="width: 100%">
                <el-table-column
                  prop="terminalNumber"
                  label="监测终端编号"
                ></el-table-column>
                <el-table-column prop="time" label="时间"></el-table-column>
                <el-table-column
                  prop="functionalUnitIdentifier"
                  label="功能单元识别码"
                ></el-table-column>
                <el-table-column
                  prop="maxPullForceKg"
                  label="最大拉力(Kg)"
                ></el-table-column>
                <el-table-column
                  prop="maxPullForceWindBiasAngle"
                  label="最大拉力时风偏角(°)"
                ></el-table-column>
                <el-table-column
                  prop="maxPullForceTiltAngle"
                  label="最大拉力时倾斜角(°)"
                ></el-table-column>
                <el-table-column
                  prop="minPullForceKg"
                  label="最小拉力(Kg)"
                ></el-table-column>
                <el-table-column
                  prop="minPullForceWindBiasAngle"
                  label="最小拉力时风偏角(°)"
                ></el-table-column>
                <el-table-column
                  prop="minPullForceTiltAngle"
                  label="最小拉力时倾斜角(°)"
                ></el-table-column>
                <el-table-column
                  prop="maxWindBiasAngle"
                  label="最大风偏角(°)"
                ></el-table-column>
                <el-table-column
                  prop="maxWindBiasAngleTiltAngle"
                  label="最大风偏角时倾斜角(°)"
                ></el-table-column>
                <el-table-column
                  prop="maxWindBiasAnglePullForceKg"
                  label="最大风偏角时拉力(Kg)"
                ></el-table-column>
                <el-table-column
                  prop="minWindBiasAngle"
                  label="最小风偏角(°)"
                ></el-table-column>
                <el-table-column
                  prop="minWindBiasAngleTiltAngle"
                  label="最小风偏角时倾斜角(°)"
                ></el-table-column>
                <el-table-column
                  prop="minWindBiasAnglePullForceKg"
                  label="最小风偏角时拉力(Kg)"
                ></el-table-column>
              </el-table>
            </div>
            <div class="pageNation">
              <el-pagination
                @current-change="handleCurrentChange"
                @size-change="handleSizeChange"
                :current-page="page"
                :page-size="pageSize"
                layout="sizes, prev, pager, next, jumper,total"
                :total="total"
              >
              </el-pagination>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import leftTree from "../../fubingCommon/leftTree";
export default {
  name: "icing",
  components: {
    leftTree,
  },
  data() {
    return {
      msg: "",
      childFlag: false,
      tableData: [],
      formdata: {},
      page: 1, // 当前页数
      pageSize: 20, // 每页数量
      total: 0, //总条数
    };
  },
  created() {
    var that = this;
    document.onkeydown = function (e) {
      var key = window.event.keyCode;
      if (key === 13) {
        that.onSubmit(); // 触发事件
      }
    };
  },
  mounted() {
    this.$set(
      this.formdata,
      "starttime",
      new Date(new Date().toLocaleDateString()).getTime()
    );
    this.$set(this.formdata, "endtime", new Date().getTime());
  },
  methods: {
    getCurrentData(data) {
      console.log("执行父组件", data);
      if (data.dyValue) {
        console.log("电压");

        this.tableData = [
          {
            terminalNumber: "终端A",
            time: "2023-03-15 08:00:00",
            functionalUnitIdentifier: "功能单元1",
            maxPullForceKg: "20Kg",
            maxPullForceWindBiasAngle: "60°",
            maxPullForceTiltAngle: "30°",
            minPullForceKg: "5Kg",
            minPullForceWindBiasAngle: "30°",
            minPullForceTiltAngle: "20°",
            maxWindBiasAngle: "70°",
            maxWindBiasAngleTiltAngle: "45°",
            maxWindBiasAnglePullForceKg: "15Kg",
            minWindBiasAngle: "20°",
            minWindBiasAngleTiltAngle: "30°",
            minWindBiasAnglePullForceKg: "8Kg",
          },
          {
            terminalNumber: "终端A",
            time: "2023-03-15 08:00:00",
            functionalUnitIdentifier: "功能单元1",
            maxPullForceKg: "20Kg",
            maxPullForceWindBiasAngle: "60°",
            maxPullForceTiltAngle: "30°",
            minPullForceKg: "5Kg",
            minPullForceWindBiasAngle: "30°",
            minPullForceTiltAngle: "20°",
            maxWindBiasAngle: "70°",
            maxWindBiasAngleTiltAngle: "45°",
            maxWindBiasAnglePullForceKg: "15Kg",
            minWindBiasAngle: "20°",
            minWindBiasAngleTiltAngle: "30°",
            minWindBiasAnglePullForceKg: "8Kg",
          },
          {
            terminalNumber: "终端A",
            time: "2023-03-15 08:00:00",
            functionalUnitIdentifier: "功能单元1",
            maxPullForceKg: "20Kg",
            maxPullForceWindBiasAngle: "60°",
            maxPullForceTiltAngle: "30°",
            minPullForceKg: "5Kg",
            minPullForceWindBiasAngle: "30°",
            minPullForceTiltAngle: "20°",
            maxWindBiasAngle: "70°",
            maxWindBiasAngleTiltAngle: "45°",
            maxWindBiasAnglePullForceKg: "15Kg",
            minWindBiasAngle: "20°",
            minWindBiasAngleTiltAngle: "30°",
            minWindBiasAnglePullForceKg: "8Kg",
          },
        ];
      } else if (data.bsManufacturer) {
        this.tableData = [
          {
            terminalNumber: "终端A",
            time: "2023-03-15 08:00:00",
            functionalUnitIdentifier: "功能单元1",
            maxPullForceKg: "20Kg",
            maxPullForceWindBiasAngle: "60°",
            maxPullForceTiltAngle: "30°",
            minPullForceKg: "5Kg",
            minPullForceWindBiasAngle: "30°",
            minPullForceTiltAngle: "20°",
            maxWindBiasAngle: "70°",
            maxWindBiasAngleTiltAngle: "45°",
            maxWindBiasAnglePullForceKg: "15Kg",
            minWindBiasAngle: "20°",
            minWindBiasAngleTiltAngle: "30°",
            minWindBiasAnglePullForceKg: "8Kg",
          },
          {
            terminalNumber: "终端A",
            time: "2023-03-15 08:00:00",
            functionalUnitIdentifier: "功能单元1",
            maxPullForceKg: "20Kg",
            maxPullForceWindBiasAngle: "60°",
            maxPullForceTiltAngle: "30°",
            minPullForceKg: "5Kg",
            minPullForceWindBiasAngle: "30°",
            minPullForceTiltAngle: "20°",
            maxWindBiasAngle: "70°",
            maxWindBiasAngleTiltAngle: "45°",
            maxWindBiasAnglePullForceKg: "15Kg",
            minWindBiasAngle: "20°",
            minWindBiasAngleTiltAngle: "30°",
            minWindBiasAnglePullForceKg: "8Kg",
          },
        ];
      } else {
        console.log("杆塔");
        this.tableData = [
          {
            terminalNumber: "终端A",
            time: "2023-03-15 08:00:00",
            functionalUnitIdentifier: "功能单元1",
            maxPullForceKg: "20Kg",
            maxPullForceWindBiasAngle: "60°",
            maxPullForceTiltAngle: "30°",
            minPullForceKg: "5Kg",
            minPullForceWindBiasAngle: "30°",
            minPullForceTiltAngle: "20°",
            maxWindBiasAngle: "70°",
            maxWindBiasAngleTiltAngle: "45°",
            maxWindBiasAnglePullForceKg: "15Kg",
            minWindBiasAngle: "20°",
            minWindBiasAngleTiltAngle: "30°",
            minWindBiasAnglePullForceKg: "8Kg",
          },
        ];
      }
    },
    onSubmit() {},
    //点击分页
    handleCurrentChange(val) {
      this.page = val;
      // this.picList = [];
      // this.getPicData();
    },
    //每页条数
    handleSizeChange(val) {
      this.pageSize = val;
      //this.getPicData();
    },
  },
};
</script>
<style lang="less">
.icingBox {
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  padding: 12px 12px;
  background: #fff;
  .icingContain {
    display: flex;
    height: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  .rightTable {
    display: flex;
    width: 100%;
    height: 100%;
    flex: 1;
    overflow: hidden;
    border-left: 1px solid #ddd;
    .dataBox {
      width: calc(100% - 24px);
      height: calc(100% - 24px);
      padding: 12px 12px;
      background: #fff;
    }
    // .fatherTableShowBox {
    //   height: calc(100% - 0px);
    // }
    .childBox {
      height: calc(100% - 50px);
      .childTableShowBox {
        height: calc(100% - 50px);
      }
    }
  }
}
</style>
