export default {
  data() {
    return {
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        },
      FClist: [
      ],
      pjlist: [
      ],
      lxlist: [
      ],
      fjlist: [
      ],
      fc1list: [
      ],
      lxlist: [
        {
          name: "风场",
          id: "0",
        },
        {
          name: "项目",
          id: "1",
        },
        {
          name: "线路",
          id: "2",
        },
        {
          name: "风机",
          id: "3",
        },
      ],
      tableData: [],
      beginDate: "2021-01-01",
      endDate: "2021-01-03",
      lx: "0",
      fc: "",
      selectrowdate: {},
    };
  },
  methods: {
    query_gb(){
      this.fc = "";
      if (this.lx == "0") {
        this.FClist={};
        this.FClist = this.fc1list;
      } else if (this.lx == "1") {
        this.FClist = {};
        this.FClist = this.pjlist;
      } else if (this.lx == "2") {
        this.FClist = {};
        this.FClist = this.xllist;
      }else if (this.lx == "3") {
        this.FClist = {};
        this.FClist = this.fjlist;
      }
    },
    query_fc() {
      this.API.get("powercompare/windfarmAjax?").then((res) => {
        this.fc1list = res.data;
        this.FClist = res.data;
      });
       this.API.get("powercompare/projectAllAjax?").then((res) => {
        this.pjlist = res.data;
      });
       this.API.get("powercompare/lineAllAjax?").then((res) => {
        this.xllist = res.data;
      });
       this.API.get("powercompare/windturbineAllAjax?").then((res) => {
        this.fjlist = res.data;
      });
    },
    query_table() {

      this.API
        .get(
          "leaderboard/lossList?wpId=" +
            this.fc +
            "&pageNum=" +
            1 +
            "&pageSize=" +
            10 +
            "&orderByColumn=" +
            "" +
            "&isAsc=" +
            "asc" +
            "&beginDate=" +
            this.beginDate +
            "&endDate=" +
            this.endDate +
            "&type=" +
            this.lx
        )
        .then((res) => {
          this.tableData = res.data;
        });
    },
    // toExcel() {
    //   excelHelper.exportExcel("tableData", "损失率排行", ".xls", true);
    // },
    headStyle() {
      return "text-align:center";
    },
    changeFun(val) {
      this.selectrowdate = val;
    },
  },
  mounted() {
    var newData = new Date();
    this.beginDate = this.BASE.getBzDate(newData.getTime(),-1);
    this.endDate = this.BASE.getBzDate(newData.getTime(),0);
    this.query_fc();
    this.query_table();
  },
};
