// import {formatDate} from '../../utils/fomatDate';
// import excelHelper from "@/utils/excelHelper";
export default {
    data() {
      return {
        formInline: {
        windfarm: "",
        project: "",
        line: "",
        },
        time: '2021-01-01',
        timedate: [
            
        ],
        currentPage2: 1,
	      pagesize: 10,
        gridData:[],
        gridDataChart:[],
        charFreData:[],
        charNameData:[],
        options: [],
        options2: [],
        orderByColumn:'',
        isAsc: '',
        value: '',
        value2:'',
        wtid:'',
        endDate:'',
      }
    },
    created(){
        this.callAndSpeedData();
    },
    methods:{
        queryApData() {
            this.callAndSpeedData();
        },
        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.callAndSpeedData();
        },
        callAndSpeedData(){
            this.API.get('/powercompare/windfarmAjax').then((res) => {
                this.options = res.data;
            })
            // this.value = this.$route.query.wpId;
            if(this.value == ''){
                this.value = this.$route.query.wpId;
                this.API.get('/powercompare/windturbineAjax?wpId=' + this.value).then((res) => {
                    this.options2 = res.data;
                })
            }else{
               this.API.get('/powercompare/windturbineAjax?wpId=' + this.value).then((res) => {
                    this.options2 = res.data;
                }) 
            }
            var callAndSpeedData = new URLSearchParams();
            callAndSpeedData.append('pageNum',this.currentPage2);
		    callAndSpeedData.append('pageSize',this.pagesize);
            callAndSpeedData.append('orderByColumn',this.orderByColumn);
            callAndSpeedData.append('isAsc',this.isAsc);
            if(this.value == ''){
                this.value = this.$route.query.wpId;
                callAndSpeedData.append('wpId',this.value);
            }else{
                callAndSpeedData.append('wpId',this.value);
            }
		  	if(this.value2 == ''){
                this.value2 = this.$route.query.wtId;
                callAndSpeedData.append('wtId',this.value2);
            }else{
                callAndSpeedData.append('wtId',this.value2);
            }
            if(this.timedate == ''){
                this.timedate[0] = this.$route.query.beginDate;
                this.timedate[1] = this.$route.query.endDate;
                callAndSpeedData.append('beginDate',this.timedate[0]);
                callAndSpeedData.append('endDate',this.timedate[1]);
            }else{
                callAndSpeedData.append('beginDate',this.timedate[0]);
                callAndSpeedData.append('endDate',this.timedate[1]);
            }
            this.API.post('/outputspeed/outputspeedhistorylist',callAndSpeedData).then((res) => {
                this.gridData = res.data
            })
        },
        goReturn(){
            this.$router.push('/cutAndSpeed')
          },
        toExcel(){
            excelHelper.exportExcel("callthepolicetable","负荷率排行榜",".xls",true);
        },
    }
}