
export default {
  data() {
    return {
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        },
        wpIdslist: {
        name:"",
        id:"",
      },
      b:[],
      fc:"",
      fj:"",
      data_01:"2021-01-01",
      data_02:"2021-01-03",
      currentPage2: 1,
      pagesize:10,
      orderByColumn: "",
      tableData:[],
    }
  },
   created() {
  },
  methods: {
     query_table(){
     let that = this;
      var digital = new URLSearchParams();
      digital.append("pageNum", this.currentPage2);
      digital.append("pageSize", this.pagesize);
      digital.append("orderByColumn", this.orderByColumn);
      digital.append("isAsc", this.isAsc);
      digital.append("wtId", this.fj);
      digital.append("beginDate", this.data_01);
      digital.append("endDate", this.data_02);
      this.API.post("/goodness/goodhistorylist", digital).then((res) => {
         this.tableData = res.data;
      });

     },
     /**改变格式 */
     data_formatter(cellValue){ return this.BASE.getBzDate(new Date(cellValue.recorddate),0)},
     gaindate() {
      let _this = this;
      if (this.fc == null || this.fc == undefined || this.fc == "") {
        _this.b = JSON.parse(sessionStorage.getItem('b'));
        _this.fc = JSON.parse(sessionStorage.getItem('fc'));
        _this.fj = JSON.parse(sessionStorage.getItem('fj'));
        _this.data_01 = JSON.parse(sessionStorage.getItem('data_01'));
        _this.data_02 = JSON.parse(sessionStorage.getItem('data_02'));
      } else {
        this.b = this.$route.query.data;
        this.fc = this.$route.query.data.windtpowerstationid;
        this.fj = this.$route.query.data.windturbineid;
        this.data_01 = this.BASE.getBzDate(
          new Date(this.$route.query.data.recorddate),-1
        );
        this.data_02 = this.BASE.getBzDate(
          new Date(this.$route.query.data.recorddate),0
        );
      }
      // this.b = this.$route.query.data;
      // this.fc = this.$route.query.data.windtpowerstationid;
      // this.fj = this.$route.query.data.windturbineid;
      // this.data_01 = this.BASE.getBzDate(
      //   new Date(this.$route.query.data.recorddate),0
      // );
      // this.data_02 = this.BASE.getBzDate(
      //   new Date(this.$route.query.data.recorddate+60*60*24*1000),0
      // );
      this.query_wpid();
    },
    /**返回 */
    goback() {
      this.$router.push({
        path: "/individualPandectinformation"
      });
    },
    /**获取id */
    query_wpid() {
      this.API.get("powercompare/windfarmAjax?").then((res) => {
        this.wpIdslist = res.data;
      });
    },
  },
  mounted() {
      this.b = this.$route.query.data;
      this.fc = this.$route.query.data.windtpowerstationid;
      this.fj = this.$route.query.data.windturbineid;
      this.data_01 = this.BASE.getBzDate(
        new Date(this.$route.query.data.recorddate),0
      );
      this.data_02 = this.BASE.getBzDate(
        new Date(this.$route.query.data.recorddate+1),0
      );
      window.addEventListener("beforeunload", () => {
        sessionStorage.setItem('b', JSON.stringify(this.$route.query.data));
        sessionStorage.setItem('fc', JSON.stringify(this.$route.query.data.windtpowerstationid));
        sessionStorage.setItem('fj', JSON.stringify(this.$route.query.data.windturbineid));
        sessionStorage.setItem('data_01', JSON.stringify(this.BASE.getBzDate(
          new Date(this.$route.query.data.recorddate),-1
        )));
        sessionStorage.setItem('data_02', JSON.stringify(this.BASE.getBzDate(
          new Date(this.$route.query.data.recorddate),0
        )));
      });
      this.gaindate();
      this.query_table();
    },
};
