<template>
  <div class="parcel-box">
    <div class="title">
      <div class="station">
        开始日期
        <div class="search-input">
          <el-date-picker
            v-model="starTime"
            type="date"
            value-format="YYYY-MM-DD"
            placeholder="选择日期"
            popper-class="date-select"
          >
          </el-date-picker>
        </div>
      </div>
      <div class="station">
        结束日期
        <div class="search-input">
          <el-date-picker
            v-model="endTime"
            type="date"
            value-format="YYYY-MM-DD"
            placeholder="选择日期"
            popper-class="date-select"
          >
          </el-date-picker>
        </div>
      </div>
      <el-button round size="mini" class="searchColor" @click="getTableDate"
        >搜 索</el-button
      >
      <!-- <el-button round size="mini">导出</el-button> -->
    </div>
    <div class="data-bodys">
      <div class="line clearfix">
        <div class="leftContent left" :data-type="$store.state.moreSty"><span>值际对标</span></div>
      </div>
      <div class="economicTable">
        <!-- theoreticalgeneratity 理论发电量
				generatity  发电量
				faultLoss 故障损失率
				mainLoss 检修损失率
				performanceLoss 性能损失
				rationingLoss 限电损失
				involvesloss 受累损失 -->
        <el-table
          :data="tableData"
          style="width: 100%"
          size="mini"
          stripe
          height="85vh"
        >
          <el-table-column
            align="center"
            prop="dutyName"
            label="值班员"
            width="200"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="theoreticalGeneratity"
            label="理论发电量"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="generatity"
            label="发电量"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="faultLoss"
            label="故障损失"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="mainLoss"
            label="检修损失"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="performanceLoss"
            label="性能损失"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="rationingLoss"
            label="限电损失"
            sortable
          ></el-table-column>
          <el-table-column
            align="center"
            prop="involvesLoss"
            label="受累损失"
            sortable
          ></el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
import dayjs from "dayjs";
import { zjdb } from "@/api/performance";
export default {
  name: "curveAnalyse",
  components: {},
  data() {
    return {
      starTime: "",
      endTime: "",
      company: "",
      companyOptions: [],
      tableData: [],
    };
  },
  watch: {},
  filters: {},
  computed: {},
  created() {
    let date = new Date();
    date.setDate(1);
    let month = parseInt(date.getMonth() + 1);
    let day = date.getDate();
    if (month < 10) {
      month = "0" + month;
    }
    if (day < 10) {
      day = "0" + day;
    }
    this.starTime = date.getFullYear() + "-" + month + "-" + day;
    this.endTime = dayjs(new Date().getTime()).format("YYYY-MM-DD");
    this.initialization();
  },
  methods: {
    initialization() {
      this.getTableDate();
    },
    getTableDate() {
      zjdb({
        beginDate: this.starTime,
        endDate: this.endTime,
      }).then(({ data: res }) => {
        if (res) {
          this.tableData = res.data;
        }
      });
    },
  },
  mounted() {},
  beforeUnmount() {},
};
</script>

<style lang="less" scoped>
.title {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-top: 10px;
  padding-left: 20px;

  .station {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #b3b3b3;
    margin-left: 10px;
  }

  .search-input {
    margin-left: 10px;
  }

  .but {
    display: flex;
    flex-direction: row;
    align-content: center;
    margin-left: 20px;
  }

  .buttons {
    background-color: rgba(5, 187, 76, 0.2);
    border: 1px solid #3b6c53;
    color: #b3b3b3;
    font-size: 14px;

    &:hover {
      background-color: rgba(5, 187, 76, 0.5);
      color: #ffffff;
    }
  }
}

.data-bodys {
  display: flex;
  flex-direction: column;
  background-color: rgba(0, 0, 0, 0.45);
  border-radius: 5px;
  padding: 5px;
}

.parcel-box {
  padding: 0 20px;
  box-sizing: border-box;

  .economicTable {
  }

  .line {
    padding-bottom: 5px;
    .leftContent[data-type~="greenSty"] {
            background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
        }
        .leftContent[data-type~="blueSty"] {
            background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
        }
    .leftContent {
      width: 242px;
      height: 41px;
      line-height: 41px;

      span {
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #05bb4c;
        margin-left: 25px;
      }
    }

    .rightContent {
      width: 212px;
      height: 28px;
      margin-top: 13px;
      background: url("../../../../assets/imgs/title_right_bg.png");
    }
  }
}

.clearfix::after {
  content: "";
  clear: both;
  height: 0;
  line-height: 0;
  visibility: hidden;
  display: block;
}

.clearfix {
  zoom: 1;
}

.left {
  float: left;
}

.right {
  float: right;
}

.searchColor {
  background-color: rgba(5, 187, 76, 0.2);
  border: 1px solid #3b6c53;
  color: #b3b3b3;
  font-size: 14px;

  &:hover {
    background-color: rgba(5, 187, 76, 0.5);
    color: #ffffff;
  }
}
</style>
