
import * as echarts from "echarts";
export default {
  data() {
    return {
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        },
      loading: true,
      activeName: "no_1",
      b: [],
      wpIdslist: {
        name: "",
        id: "",
      },
      wtIdslist: {
        name: "",
        id: "",
      },
      biaogeDate: [{ ks: "234", js: "234", sk: "jki", jl: "oio" }],
      fc: "",
      fj: "",
      data_01: "",
      dialogVisible: false,
      linechartdate: {},
      linechartdate_01: {},
      currentPage2_bj: 1,
      currentPage3_bj: 1,
      pagesize_bj: 3,
      orderByColumn_bj: "",
      tableData_02_bj: [],

      currentPage3_01_bj: 1,
      pagesize_01_bj: 3,
      currentPage2_01_bj: 1,
      orderByColumn_01_bj: "",

      currentPage3_01_gz: 1,
      pagesize_01_gz: 3,
      currentPage2_01_gz: 1,
      orderByColumn_01_gz: "",

      currentPage3_01_xd: 1,
      pagesize_01_xd: 3,
      currentPage2_01_xd: 1,
      orderByColumn_01_xd: "",

      currentPage2_gz: 1,
      currentPage3_gz: 1,
      pagesize_gz: 3,
      orderByColumn_gz: "",
      tableData_02_gz: [],

      tableData_01_bj: [],
      tableData_01_gz: [],
      tableData_01_xd: [],

      currentPage2_ybj: 1,
      currentPage3_ybj: 1,
      pagesize_ybj: 3,
      orderByColumn_ybj: "",
      tableData_02_ybj: [],

      leida_list: [],
      leida_name: [],
      jfpl: "",
      leida_list_fc_01: [],
      jfpl_fc_01: "",
      leida_list_fc_02: [],
      jfpl_fc_02: "",
      leida_list_fc_03: [],
      jfpl_fc_03: "",
      leida_list_fc_04: [],
      jfpl_fc_04: "",
      leida_list_fc_05: [],
      jfpl_fc_05: "",
      leida_list_fc_06: [],
      jfpl_fc_06: "",
      leida_list_fj_01: [],
      jfpl_fj_01: "",
      leida_list_fj_02: [],
      jfpl_fj_02: "",
      leida_list_fj_03: [],
      jfpl_fj_03: "",
      leida_list_fj_04: [],
      jfpl_fj_04: "",
      leida_list_fj_05: [],
      jfpl_fj_05: "",
      leida_list_fj_06: [],
      jfpl_fj_06: "",
      isAsc: "asc",
      formInline: {},
      pie_data: [],
      // pie_data2: [],
      // pie_data3: [],
      // pie_data4: [],
      // pie_data5: [],
      // pie_data6: [],
      gztabledate: {
        sjnh: [],
        zynh: [],
        bzgl: [],
        len: [],
      },
      tabledate_01_line: {
        rfdl: [],
        gzss: [],
        jxss: [],
        xdss: [],
        xnss: [],
        fs: [],
      },
      datezoom_table: [],
      zoomline_date: {},
      zoom: {
        sfgl: [],
        bzgl: [],
        fs: [],
        zt: [],
        time: [],
      },
      qrfd: [],
      pages01_bj: 8,
      pages02_bj: 8,
      pages02_gz: 8,
      pages01_xd: 8,
    };
  },
  methods: {
    /**返回 */
    goback() {
      this.$router.push({ path: "/individualPandectinformation" });
    },
    handleClose() { },
    /**改变数据格式 */
    formatter_date(cellValue) {
      return this.BASE.getBzDate(new Date(cellValue.warningtime), 0);
    },
    startTime(cellValue) {
      return this.BASE.getBzDate(new Date(cellValue.startTime), 0);
    },
    stopTime(cellValue) {
      return this.BASE.getBzDate(new Date(cellValue.stopTime), 0);
    },
    starttime(cellValue) {
      return this.BASE.getBzDate(new Date(cellValue.starttime), 0);
    },
    stoptime(cellValue) {
      return this.BASE.getBzDate(new Date(cellValue.stoptime), 0);
    },
    warningtime(cellValue) {
      return this.BASE.getBzDate(new Date(cellValue.warningtime), 0);
    },
    headStyle() {
      return "text-align:center";
    },
    /**刷新 */
    gaindate() {
      let _this = this;
      if (this.fc == null || this.fc == undefined || this.fc == "") {
        _this.fc = JSON.parse(sessionStorage.getItem('fc'));
        _this.fj = JSON.parse(sessionStorage.getItem('fj'));
        _this.data_01 = JSON.parse(sessionStorage.getItem('data_01'));
      } 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),
        );
      }

      this.query1();
    },
    query() {
      this.fj = '';
      this.query1();
    },
    /**查询风场 */
    query1() {
      this.wtIdslist = [];
      let that = this;
      this.API
        .get("powercompare/windturbineAjax?wpId=" + that.fc)
        .then((res) => {
          this.wtIdslist = res.data;
        });
    },
    query_wpid() {
      this.API.get("powercompare/windfarmAjax?").then((res) => {
        this.wpIdslist = res.data;
      });
    },
    query_Data02() {
      this.gztabledate.sjnh = [];
      this.gztabledate.zynh = [];
      this.gztabledate.bzgl = [];
      this.gztabledate.len = [];
      let that = this;
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/glchat", digital).then((res) => {
        that.linechartdate = res.data;
        for (let i = 0; i < Object.keys(that.linechartdate).length; i++) {
          that.gztabledate.sjnh.push(that.linechartdate[i].value2);
          that.gztabledate.zynh.push(that.linechartdate[i].value3);
          that.gztabledate.bzgl.push(that.linechartdate[i].value4);
          that.gztabledate.len.push(i);
        }
        that.drawlinechart();
      });
      this.ybjtable();
    },
    /**查询数据 */
    ybjtable() {
      let that = this;
      var digital1 = new URLSearchParams();
      digital1.append("pageNum", this.currentPage2_ybj);
      digital1.append("pageSize", this.pagesize_ybj);
      digital1.append("orderByColumn", this.orderByColumn_ybj);
      digital1.append("isAsc", this.isAsc);
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/bjphlist", digital1).then((res) => {
        that.tableData_02_ybj = res.data;
      });
      this.gztable();
    },
    gztable() {
      let that = this;
      var digital1 = new URLSearchParams();
      digital1.append("pageNum", this.currentPage2_gz);
      digital1.append("pageSize", this.pagesize_gz);
      digital1.append("orderByColumn", this.orderByColumn_gz);
      digital1.append("isAsc", this.isAsc);
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/gzjllist", digital1).then((res) => {
        that.tableData_02_gz = res.data.list;
        this.pages02_gz = res.data.lastPage;
      });
      this.rbjtable();
    },
    rbjtable() {
      let that = this;
      var digital1 = new URLSearchParams();
      digital1.append("pageNum", this.currentPage2_bj);
      digital1.append("pageSize", this.pagesize_bj);
      digital1.append("orderByColumn", this.orderByColumn_bj);
      digital1.append("isAsc", this.isAsc);
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/bjjllist", digital1).then((res) => {
        that.tableData_02_bj = res.data.list;
        this.pages02_bj = res.data.lastPage;
      });
      this.fzy();
    },
    fzy() {
      let that = this;
      this.leida_list = [];
      //this.leida_name = [];
      let value_list = [];
      var digital1 = new URLSearchParams();
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/fjfzy", digital1).then((res) => {
        that.jfpl = res.data.jfpl;
        value_list = res.data.data;
        for (let i = 0; i < value_list.length; i++) {
          that.leida_list.push(value_list[i].data1);
          //that.leida_name.push(value_list[i].name)
        }
        this.drawleidatu(this.leida_list);
      });

      this.detail();
    },
    detail() {
      var digital1 = new URLSearchParams();
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/wadAjax", digital1).then((res) => {
        this.formInline = res.data;
      });
    },
    /**查看当前卡片状态 */
    handleClick() {
      if (this.activeName == "no_3") {
        this.queryleidatu_fc_01();
      } else if (this.activeName == "no_4") {
        this.queryleidatu_fj_01();
      } else if (this.activeName == "no_5") {
        this.query_01();
      } else if (this.activeName == "no_2") {
        this.query_Data02();
      } else if (this.activeName == "no_1") {
        this.zoom = {};
        this.zoomline_date = {};
        this.datezoom_table = [];
        this.query_cutin_windspeed();
      }
    },
    query_cutin_windspeed() {
      if (this.fj == '') {
        this.$message.error("请选择风机！");
      } else (
        this.query_cutin_windspeed1()
      )
    },
    /**查询数据 */
    query_cutin_windspeed1() {
      this.loading = true;
      let that = this;
      this.qrfd = [];
      Object.assign(this.$data.zoom, this.$options.data().zoom);
      Object.assign(this.$data.qrfd, this.$options.data().qrfd);
      Object.assign(
        this.$data.zoomline_date,
        this.$options.data().zoomline_date
      );
      Object.assign(
        this.$data.datezoom_table,
        this.$options.data().datezoom_table
      );
      var digital1 = new URLSearchParams();
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/getplotBands", digital1).then((res) => {
        this.datezoom_table = res.data;
        var digital2 = new URLSearchParams();
        digital2.append("wtId", this.fj);
        digital2.append("recorddate", this.data_01);
        this.API.post("/goodness/findWtRealPowerChar", digital2).then((res) => {
          that.zoomline_date = res.data;
          for (let i = 0; i < Object.keys(that.zoomline_date).length; i++) {
            that.zoom.sfgl.push(that.zoomline_date[i].value1);
            that.zoom.bzgl.push(that.zoomline_date[i].value2);
            that.zoom.fs.push(that.zoomline_date[i].value3);
            that.zoom.zt.push(that.zoomline_date[i].value4);
            that.zoom.time.push(
              this.BASE.getBztime(new Date(that.zoomline_date[i].time) / 1000)
            );
          }
          this.loading = false;
          this.draw_linedataZoom();
          this.query_power();
        });
      });

      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/getInputSmall", digital).then((res) => {
        this.qrfd.push(res.data);
      });

    },
    query_power() {
      Object.assign(
        this.$data.tabledate_01_line,
        this.$options.data().tabledate_01_line
      );
      let that = this;
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API
        .post("/goodness/findRealPowerCharBy24", digital)
        .then((res) => {
          that.linechartdate_01 = res.data;
          for (let i = 0; i < Object.keys(that.linechartdate_01).length; i++) {
            that.tabledate_01_line.rfdl.push(that.linechartdate_01[i].value1);
            that.tabledate_01_line.jxss.push(that.linechartdate_01[i].value2);
            that.tabledate_01_line.gzss.push(that.linechartdate_01[i].value3);
            that.tabledate_01_line.xdss.push(that.linechartdate_01[i].value4);
            that.tabledate_01_line.xnss.push(that.linechartdate_01[i].value5);
            that.tabledate_01_line.fs.push(that.linechartdate_01[i].value6);
          }
          this.draw_line();
        });
      this.querydaybj();
    },
    querydaybj() {
      let that = this;
      var digital1 = new URLSearchParams();
      digital1.append("pageNum", this.currentPage2_01_bj);
      digital1.append("pageSize", this.pagesize_01_bj);
      digital1.append("orderByColumn", this.orderByColumn_01_bj);
      digital1.append("isAsc", this.isAsc);
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/bjjllist", digital1).then((res) => {
        this.tableData_01_bj = res.data.list;
        this.pages01_bj = res.data.lastPage;
        this.querydaygz();
      });
    },
    querydaygz() {
      let that = this;
      var digital1 = new URLSearchParams();
      digital1.append("pageNum", this.currentPage2_01_gz);
      digital1.append("pageSize", this.pagesize_01_gz);
      digital1.append("orderByColumn", this.orderByColumn_01_gz);
      digital1.append("isAsc", this.isAsc);
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/gzjllist", digital1).then((res) => {
        this.tableData_01_gz = res.data.list;
      });
      this.querydayxd();
    },
    querydayxd() {
      let that = this;
      var digital1 = new URLSearchParams();
      digital1.append("pageNum", this.currentPage2_01_xd);
      digital1.append("pageSize", this.pagesize_01_xd);
      digital1.append("orderByColumn", this.orderByColumn_01_xd);
      digital1.append("isAsc", this.isAsc);
      digital1.append("wtId", this.fj);
      digital1.append("recorddate", this.data_01);
      this.API.post("/goodness/xdjllist", digital1).then((res) => {
        this.tableData_01_xd = res.data.list;
        this.pages01_xd = res.data.lastPage;
      });
    },
    draw_linedataZoom() {
      let that = this;
      var chartDom = document.getElementById("line_dataZoom");
      var myChart = echarts.init(chartDom);
      myChart.on("click", (params) => {
        this.tanchu(params);
      });
      var option;

      option = {
        legend: {
          x: "1388px", //可设定图例在左、右、居中
          y: "9px", //可设定图例在上、下、居中
          data: ["实发功率", "应发功率", "平均风速"],
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
          },
        },
        toolbox: {
          show: true,
          feature: {
            saveAsImage: {},
          },
        },
        dataZoom: [
          {
            show: true,
            type: "inside",
            throttle: 50,
          },
        ],
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: this.zoom.time,
        },
        yAxis: [
          {
            name: "功率",
            type: "value",
            axisLabel: {
              formatter: "{value} kW",
            },
            axisPointer: {
              snap: true,
            },
          },
          {
            type: "value",
            name: "风速",
            min: -5,
            max: 15,
            axisLabel: {
              formatter: "{value} m/s",
            },
          },
        ],
        series: [
          {
            yAxisIndex: 1,
            name: "实发功率",
            type: "line",
            smooth: true,
            data: this.zoom.sfgl,
            markArea: {
              data: this.datezoom_table,
            },
            markLine: {
              symbol: "circle",

              //symbol:"none",               //去掉警戒线最后面的箭头
              label: {
                position: "start", //将警示值放在哪个位置，三个值“start”,"middle","end"  开始  中点 结束
              },
              data: [

                {
                  silent: true, //鼠标悬停事件  true没有，false有
                  lineStyle: {
                    //警戒线的样式  ，虚实  颜色
                    type: "dotted",
                    color: "#3398DB",
                  },
                  label: {
                    position: "end",
                    formatter: "切入风速" + this.qrfd + "m/s",
                  },
                  yAxis: this.qrfd, // 警戒线的标注值，可以有多个yAxis,多条警示线   或者采用   {type : 'average', name: '平均值'}，type值有  max  min  average，分为最大，最小，平均值
                },
              ],
            },
          },
          {
            name: "应发功率",
            type: "line",
            smooth: true,
            data: this.zoom.bzgl,
            markArea: {
              data: this.datezoom_table,
            },
          },
          {
            name: "平均风速",
            type: "line",
            smooth: true,
            yAxisIndex: 1,
            data: this.zoom.fs,
          },
        ],
      };

      option && myChart.setOption(option);
    },
    draw_line() {
      var chartDom = document.getElementById("echart_line");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        title: {},
        color: [
          "#0BFEFA",
          "#FD0100",
          "#FF7003",
          "#D201D8",
          "#8085E9",
          "#000000",
        ],
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        legend: {
          x: "center", //可设定图例在左、右、居中
          y: "19px", //可设定图例在上、下、居中
          padding: [0, 0, 0, 0],
          data: [
            "日发电量",
            "故障损失电量",
            "检修损失电量",
            "限电损失电量",
            "性能损失电量",
            "风速",
          ],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        yAxis: [
          {
            name: "电量",
            type: "value",
            min: -5000,
            max: 15000,
            axisLabel: {
              formatter: "{value} kw",
            },
          },
          {
            type: "value",
            name: "风速",
            min: -5,
            max: 15,
            axisLabel: {
              formatter: "{value} m/s",
            },
          },
        ],
        xAxis: {
          type: "category",
          data: [
            "01:00",
            "02:00",
            "03:00",
            "04:00",
            "05:00",
            "06:00",
            "07:00",
            "08:00",
            "09:00",
            "10:00",
            "11:00",
            "12:00",
            "13:00",
            "14:00",
            "15:00",
            "16:00",
            "17:00",
            "18:00",
            "19:00",
            "20:00",
            "21:00",
            "22:00",
            "23:00",
            "24:00",
          ],
        },
        series: [
          {
            name: "日发电量",
            type: "bar",
            data: this.tabledate_01_line.rfdl,
            barWidth: 10,
          },
          {
            name: "故障损失电量",
            type: "bar",
            data: this.tabledate_01_line.gzss,
          },
          {
            name: "检修损失电量",
            type: "bar",
            data: this.tabledate_01_line.jxss,
          },
          {
            name: "限电损失电量",
            type: "bar",
            data: this.tabledate_01_line.xdss,
          },
          {
            name: "性能损失电量",
            type: "bar",
            data: this.tabledate_01_line.xnss,
          },
          {
            name: "风速",
            type: "line",
            yAxisIndex: 1,
            data: this.tabledate_01_line.fs,
          },
        ],
      };

      option && myChart.setOption(option);
    },
    /**弹出 */
    async tanchu(params) {
      var digital1 = new URLSearchParams();
      digital1.append("wtId", this.fj);
      digital1.append("beginDate", params.data.time1);
      digital1.append("endDate", params.data.time2);
      const res = await this.API.post("/goodness/plotBandAjax", digital1);
      const arr = [];
      arr.push(res.data);
      this.biaogeDate = arr;
      this.dialogVisible = true;
    },
    queryleidatu_fc_01() {
      let that = this;
      this.leida_list_fc_01 = [];
      let value_list_fc_01 = [];
      var digital = new URLSearchParams();
      digital.append("wpId", this.fc);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wprzdfs", digital).then((res) => {
        that.jfpl_fc_01 = res.data.jfpl;
        value_list_fc_01 = res.data.data;
        for (let i = 0; i < value_list_fc_01.length; i++) {
          that.leida_list_fc_01.push(value_list_fc_01[i].data1);
        }
        this.queryleidatu_fc_02();
      });
    },
    queryleidatu_fj_01() {
      let that = this;
      this.leida_list_fj_01 = [];
      let value_list_fj_01 = [];
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wtrzdfs", digital).then((res) => {
        that.jfpl_fj_01 = res.data.jfpl;
        value_list_fj_01 = res.data.data;
        for (let i = 0; i < value_list_fj_01.length; i++) {
          that.leida_list_fj_01.push(value_list_fj_01[i].data1);
        }
        this.queryleidatu_fj_02();
      });
    },
    queryleidatu_fc_02() {
      let that = this;
      this.leida_list_fc_02 = [];
      let value_list_fc_02 = [];
      var digital = new URLSearchParams();
      digital.append("wpId", this.fc);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wpyzdfs", digital).then((res) => {
        that.jfpl_fc_02 = res.data.jfpl;
        value_list_fc_02 = res.data.data;
        for (let i = 0; i < value_list_fc_02.length; i++) {
          that.leida_list_fc_02.push(value_list_fc_02[i].data1);
        }
        this.queryleidatu_fc_03();
      });
    },
    queryleidatu_fj_02() {
      let that = this;
      this.leida_list_fj_02 = [];
      let value_list_fj_02 = [];
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wtyzdfs", digital).then((res) => {
        that.jfpl_fj_02 = res.data.jfpl;
        value_list_fj_02 = res.data.data;
        for (let i = 0; i < value_list_fj_02.length; i++) {
          that.leida_list_fj_02.push(value_list_fj_02[i].data1);
        }
        this.queryleidatu_fj_03();
      });
    },
    queryleidatu_fc_03() {
      let that = this;
      this.leida_list_fc_03 = [];
      let value_list_fc_03 = [];
      var digital = new URLSearchParams();
      digital.append("wpId", this.fc);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wpnzdfs", digital).then((res) => {
        that.jfpl_fc_03 = res.data.jfpl;
        value_list_fc_03 = res.data.data;
        for (let i = 0; i < value_list_fc_03.length; i++) {
          that.leida_list_fc_03.push(value_list_fc_03[i].data1);
        }
        this.queryleidatu_fc_04();
      });
    },
    queryleidatu_fj_03() {
      let that = this;
      this.leida_list_fj_03 = [];
      let value_list_fj_03 = [];
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wtnzdfs", digital).then((res) => {
        that.jfpl_fj_03 = res.data.jfpl;
        value_list_fj_03 = res.data.data;
        for (let i = 0; i < value_list_fj_03.length; i++) {
          that.leida_list_fj_03.push(value_list_fj_03[i].data1);
        }
        this.queryleidatu_fj_04();
      });
    },
    queryleidatu_fc_04() {
      let that = this;
      this.leida_list_fc_04 = [];
      let value_list_fc_04 = [];
      var digital = new URLSearchParams();
      digital.append("wpId", this.fc);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wprfxpl", digital).then((res) => {
        that.jfpl_fc_04 = res.data.jfpl;
        value_list_fc_04 = res.data.data;
        for (let i = 0; i < value_list_fc_04.length; i++) {
          that.leida_list_fc_04.push(value_list_fc_04[i].data1);
        }
        this.queryleidatu_fc_05();
      });
    },
    queryleidatu_fj_04() {
      let that = this;
      this.leida_list_fj_04 = [];
      let value_list_fj_04 = [];
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wtrfxpl", digital).then((res) => {
        that.jfpl_fj_04 = res.data.jfpl;
        value_list_fj_04 = res.data.data;
        for (let i = 0; i < value_list_fj_04.length; i++) {
          that.leida_list_fj_04.push(value_list_fj_04[i].data1);
        }
        this.queryleidatu_fj_05();
      });
    },
    queryleidatu_fc_05() {
      let that = this;
      this.leida_list_fc_05 = [];
      let value_list_fc_05 = [];
      var digital = new URLSearchParams();
      digital.append("wpId", this.fc);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wpyfxpl", digital).then((res) => {
        that.jfpl_fc_05 = res.data.jfpl;
        value_list_fc_05 = res.data.data;
        for (let i = 0; i < value_list_fc_05.length; i++) {
          that.leida_list_fc_05.push(value_list_fc_05[i].data1);
        }
        this.queryleidatu_fc_06();
      });
    },
    queryleidatu_fj_05() {
      let that = this;
      this.leida_list_fj_05 = [];
      let value_list_fj_05 = [];
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wtyfxpl", digital).then((res) => {
        that.jfpl_fj_05 = res.data.jfpl;
        value_list_fj_05 = res.data.data;
        for (let i = 0; i < value_list_fj_05.length; i++) {
          that.leida_list_fj_05.push(value_list_fj_05[i].data1);
        }
        this.queryleidatu_fj_06();
      });
    },
    queryleidatu_fc_06() {
      let that = this;
      this.leida_list_fc_06 = [];
      let value_list_fc_06 = [];
      var digital = new URLSearchParams();
      digital.append("wpId", this.fc);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wpnfxpl", digital).then((res) => {
        that.jfpl_fc_06 = res.data.jfpl;
        value_list_fc_06 = res.data.data;
        for (let i = 0; i < value_list_fc_06.length; i++) {
          that.leida_list_fc_06.push(value_list_fc_06[i].data1);
        }
        this.ECZM.bar_DJXNFX("leidatu_fc_01", this.leida_list_fc_01, this.jfpl_fc_01);
        this.ECZM.bar_DJXNFX("leidatu_fc_02", this.leida_list_fc_02, this.jfpl_fc_02);
        this.ECZM.bar_DJXNFX("leidatu_fc_03", this.leida_list_fc_03, this.jfpl_fc_03);
        this.ECZM.bar_DJXNFX("leidatu_fc_04", this.leida_list_fc_04, this.jfpl_fc_04);
        this.ECZM.bar_DJXNFX("leidatu_fc_05", this.leida_list_fc_05, this.jfpl_fc_05);
        this.ECZM.bar_DJXNFX("leidatu_fc_06", this.leida_list_fc_06, this.jfpl_fc_06);
      });
    },
    queryleidatu_fj_06() {
      let that = this;
      this.leida_list_fj_06 = [];
      let value_list_fj_06 = [];
      var digital = new URLSearchParams();
      digital.append("wtId", this.fj);
      digital.append("recorddate", this.data_01);
      this.API.post("/goodness/wtnfxpl", digital).then((res) => {
        that.jfpl_fj_06 = res.data.jfpl;
        value_list_fj_06 = res.data.data;
        for (let i = 0; i < value_list_fj_06.length; i++) {
          that.leida_list_fj_06.push(value_list_fj_06[i].data1);
        }
        this.ECZM.bar_DJXNFX("leidatu_fj_01", this.leida_list_fj_01, this.jfpl_fj_01);
        this.ECZM.bar_DJXNFX("leidatu_fj_02", this.leida_list_fj_02, this.jfpl_fj_02);
        this.ECZM.bar_DJXNFX("leidatu_fj_03", this.leida_list_fj_03, this.jfpl_fj_03);
        this.ECZM.bar_DJXNFX("leidatu_fj_04", this.leida_list_fj_04, this.jfpl_fj_04);
        this.ECZM.bar_DJXNFX("leidatu_fj_05", this.leida_list_fj_05, this.jfpl_fj_05);
        this.ECZM.bar_DJXNFX("leidatu_fj_06", this.leida_list_fj_06, this.jfpl_fj_06);

      });
    },
    query_01() {
      // this.pie_data2 = [];
      // this.pie_data3 = [];
      // this.pie_data4 = [];
      // this.pie_data5 = [];
      // this.pie_data6 = [];
      let _this = this;



      let api = [];

      for (var i = 0; i < 6; i++) {
        var digital = new URLSearchParams();
        digital.append("wtId", this.fj);
        digital.append("recorddate", this.data_01);
        digital.append("type", (i + 1) + "");
        api.push(this.API.post("/goodness/pieChart", digital));
      }

      Promise.all(api).then(function (res) {
        res.forEach((item, index) => {

          _this.pie_data = [];
          let piedata = [];
          piedata = item.data;
          for (let i = 0; i < Object.keys(piedata).length; i++) {
            _this.pie_data.push({
              value: piedata[i].value1,
              name: piedata[i].name,
            });
          }
          _this.ECZM.qt_DJXNFX("line_0" + (index + 1), _this.pie_data);
        });
      });
      return;
      this.API.post("/goodness/pieChart", digital).then((res) => {
        let piedata = [];
        piedata = res.data;
        for (let i = 0; i < Object.keys(piedata).length; i++) {
          this.pie_data.push({
            value: piedata[i].value1,
            name: piedata[i].name,
          });
        }
        // this.query_02();
      });
    },
    handleSizeChange_bj(val) {
      this.pagesize_bj = val;
      this.rbjtable();
    },
    handleCurrentChange_bj(val) {
      this.currentPage2_bj = val;
      this.rbjtable();
    },
    handleSizeChange_gz(val) {
      this.pagesize_gz = val;
      this.gztable();
    },
    handleCurrentChange_gz(val) {
      this.currentPage2_gz = val;
      this.gztable();
    },
    /**分页 */
    handleSizeChange_ybj(val) {
      this.pagesize_ybj = val;
      this.ybjtable();
    },
    handleCurrentChange_ybj(val) {
      this.currentPage2_ybj = val;
      this.ybjtable();
    },
    handleSizeChange_01_bj(val) {
      this.pagesize_01_bj = val;
      //this.
    },
    handleCurrentChange_01_bj(val) {
      this.currentPage2_01_bj = val;
      this.querydaybj();
    },
    handleSizeChange_01_gz(val) {
      this.pagesize_01_bj = val;
      //this.
    },
    handleCurrentChange_01_gz(val) {
      this.currentPage2_01_bj = val;
      //this.
    },
    handleSizeChange_01_xd(val) {
      this.pagesize_01_bj = val;
      //this.
    },
    handleCurrentChange_01_xd(val) {
      this.currentPage2_01_bj = val;
      //this.
    },
    drawleidatu(qqq) {
      var chartDom = document.getElementById("leidatu");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        title: {},
        tooltip: {},
        legend: {
          top: "93%",
          left: "10%",
        },
        radar: {
          // shape: 'circle',
          name: {
            textStyle: {
              color: "#fff",
              backgroundColor: "#999",
              borderRadius: 3,
              padding: [3, 5],
            },
          },
          indicator: [
            { name: "北", max: 99 },
            { name: "北北东", max: 99 },
            { name: "北东", max: 99 },
            { name: "东北东", max: 99 },
            { name: "东", max: 99 },
            { name: "东南东", max: 99 },
            { name: "南东", max: 99 },
            { name: "南南东", max: 99 },
            { name: "南", max: 99 },
            { name: "南南西", max: 99 },
            { name: "南西", max: 99 },
            { name: "西南西", max: 99 },
            { name: "西", max: 99 },
            { name: "西北西", max: 99 },
            { name: "北西", max: 99 },
            { name: "北北西", max: 99 },
          ],
        },
        series: [
          {
            type: "radar",
            // areaStyle: {normal: {}},
            data: [
              {
                value: qqq,
                name: this.jfpl,
                // label: {
                //   show: true,
                //   formatter: function (params) {
                //     return params.value;
                //   },
                // },
                areaStyle: {
                  opacity: 0.9,
                  color: new echarts.graphic.RadialGradient(0.5, 0.5, 1, [
                    {
                      color: "#B8D3E4",
                      offset: 0,
                    },
                    {
                      color: "#72ACD1",
                      offset: 1,
                    },
                  ]),
                },
              },
            ],

          },
        ],
        tooltip: {
          position: function (p) { //其中p为当前鼠标的位置
            return [p[0] + 10, p[1] - 480];
          },
          textStyle: {
            fontWeight: "16px",
            fontSize: 16,
            lineHeight: 0,

          }
          // formatter: (params) => {
          //   for(var i=0;i<Object.keys(params.data.value).length;i++){
          //   return params.data.name[0]+':'+params.data.value[0];
          //   }
          // },
        },
      };

      option && myChart.setOption(option);
    },
    drawlinechart() {
      var chartDom = document.getElementById("echartline");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        title: {
          text: "折线图堆叠",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["实际拟合功率", "最优拟合功率", "保证功率"],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: this.gztabledate.len,
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            name: "实际拟合功率",
            type: "line",
            stack: "总量",
            data: this.gztabledate.sjnh,
          },
          {
            name: "最优拟合功率",
            type: "line",
            stack: "总量",
            data: this.gztabledate.zynh,
          },
          {
            name: "保证功率",
            type: "line",
            stack: "总量",
            data: this.gztabledate.bzgl,
          },
        ],
      };

      option && myChart.setOption(option);
    },
  },
  created() {
    
  },
  mounted(){
    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)
    );
    window.addEventListener("beforeunload", () => {
      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),0
      )));
    });
    this.gaindate();
    this.query_cutin_windspeed1();
    this.query_power();
    this.query_wpid();
  }
  // activated() {
    
  // },
};
