// import excelHelper from "@/utils/excelHelper";
export default {
    data() {
      return {
        formInline: {
        windfarm: "",
        project: "",
        line: "",
        },
        timedate: [],
        currentPage2: 1,
		pagesize: 10,
        gridData:[],
        options: [{
          value: '0',
          label: '风场'
        }, {
          value: '1',
          label: '项目'
        },{
          value: '2',
          label: '线路'
        },{
          value: '3',
          label: '风机'
        }],
        options2: [],
        orderByColumn:'',
        isAsc: '',
        value: '0',
        value2: ''
      }
    },
    created(){
        this.API.get('/powercompare/windfarmAjax').then((res) => {
            this.options2 = res.data;
        })
        this.UtilizationRateData();
    },
    methods:{
        queryApData() {
            this.UtilizationRateData();
        },
        
        headStyle() {
			return "text-align:center"
		},
        
        changeTableSort(column){
			this.orderByColumn = column.prop;
			if(column.order == "descending"){
				this.isAsc = 'desc';
			}else if(column.order == "ascending"){
				this.isAsc = "asc";
			}
			this.UtilizationRateData();
		},
        UtilizationRateData(){
            var newData = new Date();
            this.updateTime = this.BASE.getBzDate(newData.getTime(), 0);
            this.updateTime1 = this.BASE.getBzDate(newData.getTime(), -1);
            if(this.timedate == ''){
                this.timedate[0] = this.updateTime1;
                this.timedate[1] = this.updateTime;
                this.beginDate = this.timedate[0];
                this.endDate = this.timedate[1];
            }else{
                this.beginDate = this.timedate[0];
                this.endDate = this.timedate[1];
            }
            var utilizationRateData = new URLSearchParams();
            utilizationRateData.append('pageNum',this.currentPage2);
			utilizationRateData.append('pageSize',this.pagesize);
            utilizationRateData.append('orderByColumn',this.orderByColumn);
            utilizationRateData.append('isAsc',this.isAsc);
			utilizationRateData.append('wpId',this.value2);
			utilizationRateData.append('beginDate',this.beginDate);
            utilizationRateData.append('endDate',this.endDate);
            utilizationRateData.append('type',this.value);
            this.API.post('/leaderboard/utilizationList',utilizationRateData).then((res) => {
                this.gridData = res.data;
            })
        },
        toExcel(){
            excelHelper.exportExcel("loadratetable","曲线偏差率排行榜",".xls",true);
        }
    }
}