
import * as echarts from "echarts";
export default {
  data() {
    return {
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        },
      len:10,
      fc:"",
      pj:"",
      xl:"",
      tableHeight_fc:400,
      tableHeight_pj:800,
      tableHeight_xl:1200,
      autoHeight_fc: 400,
      autoHeight_pj: 800,
      autoHeight_xl: 1200,
      styleObject_fc: {
        height: '460px'
      },
      styleObject_pj: {
        height: '860px'
      },
      styleObject_xl: {
        height: '1220px'
      },
      wpIdslist: {
        name:"",
        id:"",
      },
      projectlist:{
        name:"",
        id:"",
      },
      linelist:{
        name:"",
        id:"",
      },
      powerAjaxDetailAll: {
        generation: [],
        sacadafdl: [],
        jxssdl: [],
        jxslssdl: [],
        gzssdl: [],
        gzslssdl: [],
        xdjclssdl: [],
        xdtjssdl: [],
        dwslssdl: [],
        hjslssdl: [],
        dfssdl: [],
        sdtjssdl: [],
        zcfdssdl: [],
        qxjclssdl: [],
        llfdl: [],
      },
      fc_date: [],
      pj_date: [],
      xl_date: [],
      beginDate: "",
      endDate: "",
      activeName: "first",
      tableid: "fc",
      celname: [],
      datelength: 0,
      queryAll_table_lyl:[],
    };
  },
  methods: {
    onSubmit() {
    },
    /**
     * 查询项目，线路，风场
     */
    query_wpid() {
      this.API.get("powercompare/windfarmAjax?").then((res) => {
        this.wpIdslist = res.data;
      }).catch(error =>{
        this.$message.error('获取数据失败');
      });;
    },
    query_xml(){
      this.pj = "";
      this.xl = "";
      this.API.get("powercompare/projectAjax?wpIds=" + this.fc).then((res) => {
        this.projectlist = res.data;
      }).catch(error =>{
        this.$message.error('获取数据失败');
      });
    },
    query_xl(){
      this.xl = "";
      this.API.get("powercompare/lineAjax?pjIds=" + this.pj).then((res) => {
        this.linelist = res.data;
      }).catch(error =>{
        this.$message.error('获取数据失败');
      });
    },
    /**
     * 数据格式转换
     */
    filter_llfdl(cellValue){
             return parseFloat(cellValue.llfdl).toFixed(2);
    },
    filter_scadafdl(cellValue){
             return parseFloat(cellValue.scadafdl).toFixed(2);
    },
    filter_speed(cellValue){
             return parseFloat(cellValue.speed).toFixed(2);
    },
    filter_gzssdl(cellValue){
             return parseFloat(cellValue.gzssdl).toFixed(2);
    },
    filter_gzslssdl(cellValue){
             return parseFloat(cellValue.gzslssdl).toFixed(2);
    },
    filter_jxssdl(cellValue){
             return parseFloat(cellValue.jxssdl).toFixed(2);
    },
    filter_jxslssdl(cellValue){
             return parseFloat(cellValue.jxslssdl).toFixed(2);
    },
    filter_dwslssdl(cellValue){
             return parseFloat(cellValue.dwslssdl).toFixed(2);
    },
    filter_hjslssdl(cellValue){
             return parseFloat(cellValue.hjslssdl).toFixed(2);
    },
    filter_xdjclssdl(cellValue){
             return parseFloat(cellValue.xdjclssdl).toFixed(2);
    },
    filter_xdtjssdl(cellValue){
             return parseFloat(cellValue.xdtjssdl).toFixed(2);
    },
    filter_dfssdl(cellValue){
             return parseFloat(cellValue.dfssdl).toFixed(2);
    },
    filter_sdtjssdl(cellValue){
             return parseFloat(cellValue.sdtjssdl).toFixed(2);
    },
    filter_zcfdssdl(cellValue){
             return parseFloat(cellValue.zcfdssdl).toFixed(2);
    },
    filter_qxjclssdl(cellValue){
             return parseFloat(cellValue.qxjclssdl).toFixed(2);
    },
    filter_fnlyl(cellValue){
             return parseFloat(cellValue.fnlyl).toFixed(2);
    },
    /**
     * 当前卡片状态
     */
    handleClick(tab) {
      if (tab.name === "first") {
        this.tableid = "fc";
        this.query();
      } else if (tab.name === "second") {
        this.tableid = "pj";
        this.query();
      } else if (tab.name === "jdxl") {
        this.tableid = "xl";
        this.query();
      }
    },
    deleteRow(index, rows) {
      rows.splice(index, 1);
    },
    /**
     * 数据格式转换
     */
    resetdata(){
      Object.assign(
        this.$data.powerAjaxDetailAll,
        this.$options.data().powerAjaxDetailAll
      );
      Object.assign(this.$data.datelength, this.$options.data().datelength);
      Object.assign(this.$data.fc_date, this.$options.data().fc_date);
      Object.assign(this.$data.xl_date, this.$options.data().xl_date);
      Object.assign(this.$data.pj_date, this.$options.data().ipj_date);
      Object.assign(this.$data.autoHeight_fc, this.$options.data().autoHeight_fc);
      Object.assign(this.$data.styleObject_fc, this.$options.data().styleObject_fc);
      Object.assign(this.$data.autoHeight_pj, this.$options.data().autoHeight_pj);
      Object.assign(this.$data.styleObject_pj, this.$options.data().styleObject_pj);
      Object.assign(this.$data.autoHeight_xl, this.$options.data().autoHeight_xl);
      Object.assign(this.$data.styleObject_xl, this.$options.data().styleObject_xl);
      Object.assign(this.$data.queryAll_table_lyl, this.$options.data().queryAll_table_lyl);
    },
    /**
     * 查询风场、项目、线路列表数据结果
     */
    query() {
      this.resetdata();
      this.styleObject_fc.height = '460px';
      this.autoHeight_fc = '400px';
      this.styleObject_pj.height = '860px';
      this.autoHeight_pj = '800px';
      this.styleObject_xl.height = '1260px';
      this.autoHeight_xl = '1200px';
      // this.fc_date = "";
      // this.xl_date = "";
      // this.pj_date = "";
      this.API
        .get(
          "powercomparedetail/powerAjaxDetailAll?beginDate=" +
            this.beginDate +
            "&endDate=" +
            this.endDate +
            "&queryType=" +
            this.tableid
        )
        .then((res) => {
          let that = this;
          let queryAll = res.data.list;
          let queryAll_table_lyl = res.data.lyl;
          this.datelength = queryAll.length;
          for (let i = 0; i < queryAll.length; i++) {
            this.powerAjaxDetailAll.generation[i] = queryAll[i].generation;
            this.powerAjaxDetailAll.sacadafdl[i] = queryAll[i].scadafdl.toFixed(2);
            this.powerAjaxDetailAll.jxssdl[i] = queryAll[i].jxssdl.toFixed(2);
            this.powerAjaxDetailAll.jxslssdl[i] = queryAll[i].jxslssdl.toFixed(2);
            this.powerAjaxDetailAll.gzssdl[i] = queryAll[i].gzssdl.toFixed(2);
            this.powerAjaxDetailAll.gzslssdl[i] = queryAll[i].gzslssdl.toFixed(2);
            this.powerAjaxDetailAll.xdjclssdl[i] = queryAll[i].xdjclssdl.toFixed(2);
            this.powerAjaxDetailAll.xdtjssdl[i] = queryAll[i].xdtjssdl.toFixed(2);
            this.powerAjaxDetailAll.dwslssdl[i] = queryAll[i].dwslssdl.toFixed(2);
            this.powerAjaxDetailAll.hjslssdl[i] = queryAll[i].hjslssdl.toFixed(2);
            this.powerAjaxDetailAll.dfssdl[i] = queryAll[i].dfssdl.toFixed(2);
            this.powerAjaxDetailAll.sdtjssdl[i] = queryAll[i].sdtjssdl.toFixed(2);
            this.powerAjaxDetailAll.zcfdssdl[i] = queryAll[i].zcfdssdl.toFixed(2);
            this.powerAjaxDetailAll.qxjclssdl[i] = queryAll[i].qxjclssdl.toFixed(2);
            this.powerAjaxDetailAll.llfdl[i] = queryAll[i].llfdl.toFixed(2);
          }
          if (this.tableid === "fc") {
            that.drawhistogram_fc(this.powerAjaxDetailAll,queryAll_table_lyl);
          } else if (this.tableid === "pj") {
            that.drawhistogram_pj(this.powerAjaxDetailAll,queryAll_table_lyl);
          } else if (this.tableid === "xl") {
            this.autoHeight = 1200;
            that.drawhistogram_xl(this.powerAjaxDetailAll,queryAll_table_lyl);
          }
        }).catch(error =>{
          this.$message.error('获取数据失败');
        });
      //表格数据获取
      this.API
        .get(
          "powercomparedetail/powerAjaxDetailAll?beginDate=" +
            this.beginDate +
            "&endDate=" +
            this.endDate +
            "&queryType=" +
            this.tableid
        )
        .then((res) => {
          let that = this;
          let queryAll_table = res.data.list;
          if (this.tableid === "fc") {
            that.fc_date = queryAll_table;
          } else if (this.tableid === "pj") {
            that.pj_date = queryAll_table;
          } else if (this.tableid === "xl") {
            that.xl_date = queryAll_table;
          }
        }).catch(error =>{
          this.$message.error('获取数据失败');
        });
    },
    /**
     * 
     *查询风场、项目、线路列表数据结果*
     */
     queryPowerAll() {
      this.judge = false;
      this.autoHeight = 600;
      this.resetdata();
      let that = this;
       if (this.beginDate == "" || this.endDate == "" || this.beginDate == undefined || this.endDate == undefined) {
        this.beginDate = this.$route.query.beginDate;
        that.endDate =  this.$route.query.endDate;
        that.$message.error("请选时间！");
        return;
      }
      this.fc_date = [];
      this.xl_date = [];
      this.pj_date = [];
      if (
        that.fc == "" ||
        that.fc == null ||
        that.fc == undefined
      ) {
        that.query();
      } else {
        this.API
          .get(
            "powercomparedetail/powerAjaxDetail?wpId=" +
              this.fc +
              "&pjId=" +
              this.pj +
              "&xlId=" +
              this.xl +
              "&beginDate=" +
              this.beginDate +
              "&endDate=" +
              this.endDate
          )
          .then((res) => {
            let that = this;
            let queryAll = res.data.list;
            let queryAll_table_lyl = res.data.lyl;
            this.datelength = queryAll.length;
            this.len = queryAll.length;
            if(this.len <= 10){that.autoHeight_fc = 580; that.styleObject_fc.height = '700px' }
            else if(this.len > 10 && this.len <=20){that.autoHeight_fc = 780; that.styleObject_fc.height = '800px';that.autoHeight_pj = 780; that.styleObject_pj.height = '800px';that.autoHeight_xl = 780; that.styleObject_xl.height = '800px' }
            else if(this.len > 20 && this.len <=30){that.autoHeight_fc = 980; that.styleObject_fc.height = '1000px';that.autoHeight_pj = 980; that.styleObject_pj.height = '1000px';that.autoHeight_xl = 980; that.styleObject_xl.height = '1000px' }
            else if(this.len > 30 && this.len <=40){that.autoHeight_fc = 1180; that.styleObject_fc.height = '1200px';that.autoHeight_pj = 1180; that.styleObject_pj.height = '1200px';that.autoHeight_xl = 1180; that.styleObject_xl.height = '1200px' }
            else if(this.len > 40 && this.len <=50){that.autoHeight_fc = 1380; that.styleObject_fc.height = '1400px';that.autoHeight_pj = 1380; that.styleObject_pj.height = '1400px';that.autoHeight_xl = 1380; that.styleObject_xl.height = '1400px' }
            else if(this.len > 50 && this.len <=60){that.autoHeight_fc = 1580; that.styleObject_fc.height = '1600px';that.autoHeight_pj = 1580; that.styleObject_pj.height = '1600px';that.autoHeight_xl = 1580; that.styleObject_xl.height = '1600px' }
            else if(this.len > 60 && this.len <=70){that.autoHeight_fc = 1780; that.styleObject_fc.height = '1800px';that.autoHeight_pj = 1780; that.styleObject_pj.height = '1800px';that.autoHeight_xl = 1780; that.styleObject_xl.height = '1800px' }
            else if(this.len > 70 && this.len <=80){that.autoHeight_fc = 1980; that.styleObject_fc.height = '2000px';that.autoHeight_pj = 1980; that.styleObject_pj.height = '2000px';that.autoHeight_xl = 1980; that.styleObject_xl.height = '2000px' }
            else{that.autoHeight_fc = 2180; that.styleObject_fc.height = '2200px';that.autoHeight_pj = 2180; that.styleObject_pj.height = '2200px';that.autoHeight_xl = 2180; that.styleObject_xl.height = '2200px' }
            
            for (let i = 0; i < queryAll.length; i++) {
              this.powerAjaxDetailAll.generation[i] = queryAll[i].generation;
              this.powerAjaxDetailAll.sacadafdl[i] = queryAll[i].scadafdl.toFixed(2);
              this.powerAjaxDetailAll.jxssdl[i] = queryAll[i].jxssdl.toFixed(2);
              this.powerAjaxDetailAll.jxslssdl[i] = queryAll[i].jxslssdl.toFixed(2);
              this.powerAjaxDetailAll.gzssdl[i] = queryAll[i].gzssdl.toFixed(2);
              this.powerAjaxDetailAll.gzslssdl[i] = queryAll[i].gzslssdl.toFixed(2);
              this.powerAjaxDetailAll.xdjclssdl[i] = queryAll[i].xdjclssdl.toFixed(2);
              this.powerAjaxDetailAll.xdtjssdl[i] = queryAll[i].xdtjssdl.toFixed(2);
              this.powerAjaxDetailAll.dwslssdl[i] = queryAll[i].dwslssdl.toFixed(2);
              this.powerAjaxDetailAll.hjslssdl[i] = queryAll[i].hjslssdl.toFixed(2);
              this.powerAjaxDetailAll.dfssdl[i] = queryAll[i].dfssdl.toFixed(2);
              this.powerAjaxDetailAll.sdtjssdl[i] = queryAll[i].sdtjssdl.toFixed(2);
              this.powerAjaxDetailAll.zcfdssdl[i] = queryAll[i].zcfdssdl.toFixed(2);
              this.powerAjaxDetailAll.qxjclssdl[i] = queryAll[i].qxjclssdl.toFixed(2);
              this.powerAjaxDetailAll.llfdl[i] = queryAll[i].llfdl.toFixed(2);
            }
            if (this.tableid === "fc") {
              that.drawhistogram_fc(this.powerAjaxDetailAll,queryAll_table_lyl);
            } else if (this.tableid === "pj") {
              that.drawhistogram_pj(this.powerAjaxDetailAll,queryAll_table_lyl);
            } else if (this.tableid === "xl") {
              that.drawhistogram_xl(this.powerAjaxDetailAll,queryAll_table_lyl);
            }
            let queryAll_table = res.data.list;
            if (this.tableid === "fc") {
              that.fc_date = queryAll_table;
            } else if (this.tableid === "pj") {
              that.pj_date = queryAll_table;
            } else if (this.tableid === "xl") {
              that.xl_date = queryAll_table;
            }
            this.tableHeight_fc = this.autoHeight_fc-20;
            this.tableHeight_pj = this.autoHeight_pj-20;
            this.tableHeight_xl = this.autoHeight_xl-20;
          }).catch(error =>{
            this.$message.error('获取数据失败');
          });
      }
    },
    checkwindfarm() {
      if (this.fc == "") {
        this.$message.error("请选择风场！");
        return;
      }
    },
    checkproject() {
      if (this.pj == "") {
        this.$message.error("请选择项目！");
        return;
      }
      if (new Date(this.timedate) == null) {
        this.$message.error("请选择时间");
        return;
      }
    },
    checktime() {
      if (new Date(this.timedate) == null) {
        this.$message.error("请选择时间");
        return;
      }
    },
    queryApDataMx() {
      this.$router.push({ path: "/performanceList" });
    },
    // toExcel() {
    //    let that = this;
    //         if (this.tableid === "fc") {
    //         excelHelper.exportExcel("fc_table","fc数据",".xls",true);
    //         } else if (this.tableid === "pj") {
    //         excelHelper.exportExcel("pj_table","pj数据",".xls",true);
    //         } else if (this.tableid === "xl") {
    //         excelHelper.exportExcel("xl_table","xl数据",".xls",true);
    //         }
    // },
    drawhistogram_fc(date,date2) {
      this.chartLine = echarts.init(document.getElementById("histogram_fc"));
      this.chartLine.clear();
      this.chartLine.resize({height: this.autoHeight_fc})
      var option;
      option = {
        textStyle:{fontSize:10},
        color:["#64E572","#24CBE5","#128A9D","#DDDF00","#AAAC00","#ED561A","#8E5139","#50B532","#216F0A","#048DC7","#006089","#00B3FF","#000000"],
        title: {
          text: "风机绩效榜单",
          left: 300,
          top: -5,
          textStyle: {
            fontSize: 13,
          },
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // Use axis to trigger tooltip
            type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
          },
        },
        legend: {
          left: 15,
          top: 30,
          data: [
            "实发电量",
            "检修损失",
            "检修受累损失",
            "故障损失",
            "故障受累损失",
            "限电降出力损失",
            "限电停机损失",
            "电网受累损失",
            "环境受累损失",
            "待风损失",
            "手动停机损失",
            "正常发电损失",
            "缺陷降出力损失电量",
          ],
        },
        grid: {
          top: "130",
          left: "10%",
          right: "10%",
          bottom: "50",
        },
        xAxis: {
          type: "value",
          max: Math.ceil(Math.max.apply(null, date.llfdl))+ Math.ceil((Math.max.apply(null, date.llfdl))*0.08)
        },
        yAxis: {
          type: "category",
          data: date.generation,
        },
        series: [
          {
            name: "实发电量",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: date.sacadafdl,
          },
          {
            name: "检修损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.jxssdl,
          },
          {
            name: "检修受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.jxslssdl,
          },
          {
            name: "故障损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.gzssdl,
          },
          {
            name: "故障受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.gzslssdl,
          },
          {
            name: "限电降出力损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.xdjclssdl,
          },
          {
            name: "限电停机损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.xdtjssdl,
          },
          {
            name: "电网受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.dwslssdl,
          },
          {
            name: "环境受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.hjslssdl,
          },
          {
            name: "待风损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.dfssdl,
          },
          {
            name: "手动停机损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.sdtjssdl,
          },
          {
            name: "正常发电损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.zcfdssdl,
          },
          {
            name: "缺陷降出力损失电量",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.qxjclssdl,
          },
          //曲线
          {
            name: "总和",
            data: date.llfdl,
            markPoint: {
                data: date2,
                        },
            type: "line",
            symbol: "circle",
            symbolSize: 20,
            lineStyle: {
              color: "#5470C6",
              width: 4,
              type: "dashed",
            },
            itemStyle: {
              borderWidth: 3,
              borderColor: "#EE6666",
              color: "yellow",
            },
          },
        ],
      };
      this.chartLine.setOption(option);
    },
    drawhistogram_pj(date,date2) {
      this.chartLine = echarts.init(document.getElementById("histogram_xm"));
      this.chartLine.clear();
      this.chartLine.resize({height: this.autoHeight_pj})
      var option;

      var option;
      option = {
        color:["#64E572","#24CBE5","#128A9D","#DDDF00","#AAAC00","#ED561A","#8E5139","#50B532","#216F0A","#048DC7","#006089","#00B3FF","#000000"],
        title: {
          text: "风机绩效榜单",
          left: 300,
          top: -5,
          textStyle: {
            fontSize: 13,
          },
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // Use axis to trigger tooltip
            type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
          },
        },
        legend: {
          left: 15,
          top: 30,
          data: [
            "实发电量",
            "检修损失",
            "检修受累损失",
            "故障损失",
            "故障受累损失",
            "限电降出力损失",
            "限电停机损失",
            "电网受累损失",
            "环境受累损失",
            "待风损失",
            "手动停机损失",
            "正常发电损失",
            "缺陷降出力损失电量",
          ],
        },
        grid: {
          top: "130",
          left: "10%",
          right: "10%",
          bottom: "50",
        },
        xAxis: {
          type: "value",
          max: Math.ceil(Math.max.apply(null, date.llfdl))+ Math.ceil((Math.max.apply(null, date.llfdl))*0.08)
        },
        yAxis: {
          type: "category",
          data: date.generation,
        },
        series: [
          {
            name: "实发电量",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: date.sacadafdl,
          },
          {
            name: "检修损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.jxssdl,
          },
          {
            name: "检修受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.jxslssdl,
          },
          {
            name: "故障损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.gzssdl,
          },
          {
            name: "故障受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.gzslssdl,
          },
          {
            name: "限电降出力损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.xdjclssdl,
          },
          {
            name: "限电停机损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.xdtjssdl,
          },
          {
            name: "电网受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.dwslssdl,
          },
          {
            name: "环境受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.hjslssdl,
          },
          {
            name: "待风损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.dfssdl,
          },
          {
            name: "手动停机损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.sdtjssdl,
          },
          {
            name: "正常发电损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.zcfdssdl,
          },
          {
            name: "缺陷降出力损失电量",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.qxjclssdl,
          },
          //曲线
          {
            name: "总和",
            data: date.llfdl,
            markPoint: {
                data: date2,
                        },
            type: "line",
            symbol: "circle",
            symbolSize: 20,
            lineStyle: {
              color: "#5470C6",
              width: 4,
              type: "dashed",
            },
            itemStyle: {
              borderWidth: 3,
              borderColor: "#EE6666",
              color: "yellow",
            },
          },
        ],
      };
      this.chartLine.setOption(option);
    },
    drawhistogram_xl(date,date2) {
      
      this.chartLine = echarts.init(document.getElementById("histogram_jdxl"));
      this.chartLine.clear();
      this.chartLine.resize({height: this.autoHeight_xl})
      var option;

      var option;
      option = {
        color:["#64E572","#24CBE5","#128A9D","#DDDF00","#AAAC00","#ED561A","#8E5139","#50B532","#216F0A","#048DC7","#006089","#00B3FF","#000000"],
        title: {
          text: "风机绩效榜单",
          left: 300,
          top: -5,
          textStyle: {
            fontSize: 13,
          },
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // Use axis to trigger tooltip
            type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
          },
        },
        legend: {
          left: 15,
          top: 30,
          data: [
            "实发电量",
            "检修损失",
            "检修受累损失",
            "故障损失",
            "故障受累损失",
            "限电降出力损失",
            "限电停机损失",
            "电网受累损失",
            "环境受累损失",
            "待风损失",
            "手动停机损失",
            "正常发电损失",
            "缺陷降出力损失电量",
          ],
        },
        grid: {
          top: "130",
          left: "10%",
          right: "10%",
          bottom: "50",
        },
        xAxis: {
          type: "value",
          max: Math.ceil(Math.max.apply(null, date.llfdl))+ Math.ceil((Math.max.apply(null, date.llfdl))*0.08)
        },
        yAxis: {
          type: "category",
          data: date.generation,
        },
        series: [
          {
            name: "实发电量",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: date.sacadafdl,
          },
          {
            name: "检修损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.jxssdl,
          },
          {
            name: "检修受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.jxslssdl,
          },
          {
            name: "故障损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.gzssdl,
          },
          {
            name: "故障受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.gzslssdl,
          },
          {
            name: "限电降出力损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.xdjclssdl,
          },
          {
            name: "限电停机损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.xdtjssdl,
          },
          {
            name: "电网受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.dwslssdl,
          },
          {
            name: "环境受累损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.hjslssdl,
          },
          {
            name: "待风损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.dfssdl,
          },
          {
            name: "手动停机损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.sdtjssdl,
          },
          {
            name: "正常发电损失",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.zcfdssdl,
          },
          {
            name: "缺陷降出力损失电量",
            type: "bar",
            stack: "total",
            label: {
              show: false,
            },
            emphasis: {
              focus: "series",
            },
            data: date.qxjclssdl,
          },
          //曲线
          {
            name: "总和",
            data: date.llfdl,
            markPoint: {
                data: date2,
                        },
            type: "line",
            symbol: "circle",
            symbolSize: 20,
            lineStyle: {
              color: "#5470C6",
              width: 4,
              type: "dashed",
            },
            itemStyle: {
              borderWidth: 3,
              borderColor: "#EE6666",
              color: "yellow",
            },
          },
        ],
      };
      this.chartLine.setOption(option);
    },
  },
  mounted() {
    this.beginDate = this.$route.query.beginDate,
    this.endDate = this.$route.query.endDate,
    this.$nextTick(() => {
                 
            //后面的50：根据需求空出的高度，自行调整
        });
    this.query_wpid();
    this.query();
  },
};
