<template>
  <div class="analysisReport" :class="!theme ? 'themeDark' : 'themeLight'">
    <div class="analysisReportMain">
      <div class="main_top">
        <p class="topPsty">能效分析报告</p>
        <div class="seach currSearch">
          <el-form class="generat-seach" :inline="true">
            <el-form-item label="场站" class="!mb-0">
              <el-select
                style="width: 120px"
                v-model="station"
                clearable
                class="w-[150px]"
              >
                <el-option
                  v-for="item in stationList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="选择时间">
              <el-date-picker
                v-model="pickerVal"
                type="monthrange"
                value-format="YYYY-MM"
                range-separator="至"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
              />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="addform">查询</el-button>
              <!-- <el-button
                style="width: 100px"
                type="primary"
                handleReportOp
                @click="handleReportOp"
                >经济运行报告</el-button
              > -->
            </el-form-item>
          </el-form>
        </div>
      </div>
      <div class="main" :style="{ height: tableHeight }">
        <div class="tableDataMain">
          <el-table :data="tableData" size="small">
            <el-table-column
              resizable
              align="center"
              type="index"
              label="序号"
            />
            <el-table-column
              resizable
              align="center"
              prop="station"
              label="场站名称"
            />
            <el-table-column
              resizable
              align="center"
              prop="time"
              label="时间"
            />
            <el-table-column
              resizable
              align="center"
              prop="wtidcount"
              label="风机数量"
            />
            <el-table-column resizable align="center" label="操作">
              <template #default="scope">
                <el-button
                  size="small"
                  type="danger"
                  @click="handleReport(scope.$index, scope.row)"
                >
                  查看报告
                </el-button>
              </template>
            </el-table-column>
            <template #empty>
              <div class="nodata">
                <img :src="nodata" alt="" />
                <p class="nodataText">暂无数据，敬请期待</p>
              </div>
            </template>
          </el-table>
        </div>
      </div>
    </div>
  </div>
  <!-- 查看报告 -->
  <el-dialog
    class="windLifeDialog reportDia"
    v-model="centerDialogVisible"
    width="50%"
    center
    :before-close="handleClose"
    style="padding: 15px 40px"
  >
    <div
      id="pdfDom"
      :class="!theme ? 'block' : 'white'"
      :style="!theme ? 'background-color: #040c0b' : 'background-color: #fff'"
    >
      <h3
        style="
          font-weight: bolder;
          font-size: 18px;
          text-align: center;
          margin-bottom: 20px;
          text-align: center;
        "
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        风电场性能分析报告
      </h3>
      <div style="margin-bottom: 20px">
        <p>
          <span class="ml-5" style="width: 500px"
            >场站： {{ nbdata.name }}&nbsp;</span
          >
          <span class="ml-77">风机型号： {{ nbdata.model }}</span>
        </p>
        <p>
          <span class="ml-5">风机数量： {{ nbdata.jrwindQuantityLd }}</span>
          <span class="ml-87">装机容量(MW)： {{ nbdata.jrwindCapacity }}</span>
        </p>
        <p>
          <span class="ml-5">报告生成日期： {{ time }}</span>
          <span class="ml-70">数据分析周期： {{ eltime }}</span>
        </p>
      </div>
      <h3
        style="font-weight: bolder; font-size: 18px; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        概述：
      </h3>
      <p class="ml-7">
        报告基于曲线偏差率、静态偏差对风、容量系数、停机时长、分别对场站{{
          nbdata.quantity
        }}台风机进行了性能分析，其中有{{
          wtcount
        }}台风机指标严重异常，信息如下：
      </p>
      <h3
        style="font-weight: bolder; font-size: 18px; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        1、曲线偏差率
      </h3>
      <div >
        <p class="ml-7">
          曲线偏差率对不同风速区间的实际功率和保证功率做偏差率分析，高偏差率表明存在需要进一步调查潜在问题，偏差率负值表明实际功率低于保证功率
        </p>
        <el-table
          class="toolSty"
          :data="curve"
          border
          style="width: 100%; margin-top: 20px"
        >
          <el-table-column
            prop="section"
            align="center"
            label="风速区间"
            width="180"
          />
          <el-table-column prop="module" align="center" label="偏差率" />
          <el-table-column prop="wtidcount" align="center" label="风机数量" />
          <el-table-column
            prop="windturbineId"
            show-overflow-tooltip
            align="center"
            label="风机编号"
          >
            <!-- <template #default="scope">
                            <el-tooltip class="box-item" effect="dark" :content="scope.row.windturbineId"
                                placement="top-start">
                            </el-tooltip>
                        </template> -->
          </el-table-column>
        </el-table>
      </div>
      <h3
        style="font-weight: bolder; font-size: 18px; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        2、静态偏航对风
      </h3>
      <div >
        <p class="ml-7">
          静态偏航对风指风机的叶片与风向之间的偏差，偏差角度过大表明对风存在问题，以下为5-10m风速区间的对风误差
        </p>
        <el-table
          class="toolSty"
          :data="staticwind"
          border
          style="width: 100%; margin-top: 20px"
        >
          <el-table-column
            prop="section"
            align="center"
            label="严重程度"
            width="180"
          />
          <el-table-column prop="wtidcount" align="center" label="风机数量" />
          <!-- <el-table-column prop="amount1" label="风机数量" /> -->
          <el-table-column
            prop="windturbineId"
            show-overflow-tooltip
            align="center"
            label="风机编号"
          />
        </el-table>
      </div>
      <h3
        style="font-weight: bolder; font-size: 18px; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        3、容量系数
      </h3>
      <div >
        <p class="ml-7">
          容量系数是风机发电量能力的指标，数值越低，说明发电效率越低
        </p>
        <el-table
          class="toolSty"
          :data="mrlxs"
          border
          style="width: 100%; margin-top: 20px"
        >
          <el-table-column
            prop="section"
            align="center"
            label="容量系数"
            width="180"
          />
          <!-- <el-table-column prop="name" label="偏差率" /> -->
          <el-table-column prop="wtidcount" align="center" label="风机数量" />
          <el-table-column
            prop="windturbineId"
            show-overflow-tooltip
            align="center"
            label="风机编号"
          />
        </el-table>
      </div>
      <h3
        style="font-weight: bolder; font-size: 18px; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        4、桨距角
      </h3>
      <div >
        <p class="ml-7">
          桨距角分析并网开桨和停机收桨，并网状态下桨距角趋近于0度最优，停机状态下桨距角趋近于90度最优
        </p>
        <el-table
          class="toolSty"
          :data="blade"
          border
          style="width: 100%; margin-top: 20px"
        >
          <el-table-column
            prop="section"
            align="center"
            label="桨距角"
            width="180"
          />
          <!-- <el-table-column prop="name" label="偏差率" /> -->
          <el-table-column prop="wtidcount" align="center" label="风机数量" />
          <el-table-column
            prop="windturbineId"
            show-overflow-tooltip
            align="center"
            label="风机编号"
          />
        </el-table>
      </div>
      <h3
        style="font-weight: bolder; font-size: 18px; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        5、停机时间
      </h3>
      <div >
        <p class="ml-7">
          小风速下停机时间越长反应出低风速风机切入不及时，暴风天气不停机反应出风机切出不及时
        </p>
        <el-table
          class="toolSty"
          :data="stoptime"
          border
          style="width: 100%; margin-top: 20px"
        >
          <el-table-column
            prop="section"
            align="center"
            label="风速区间"
            width="180"
          />

          <el-table-column prop="wtidcount" align="center" label="风机数量" />
          <el-table-column prop="remark" align="center" label="累计时间(min)" />
          <el-table-column
            prop="windturbineId"
            show-overflow-tooltip
            align="center"
            label="风机编号"
          />
        </el-table>
      </div>
      <!-- <h3 style="font-weight: bolder; font-size: 18px; color: black">
    5、损失电量
</h3>
<p class="ml-7">
    损失电量指因故障或维护等原因导致风机未能正常发电，损失电量占比越高，存在的问题越明显
</p>
<el-table
    :data="tableData1"
    border
    style="width: 100%; margin-top: 20px"
>
    <el-table-column prop="id" align="center" label="损失占比" width="180" />

    <el-table-column prop="amount1" align="center" label="风机数量" />
    <el-table-column prop="amount2" align="center" label="风机编号" />
</el-table> -->
      <h3
        style="font-weight: bolder; font-size: 18px; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        结论及建议
      </h3>
      <p class="ml-7">
        综上统计周期内数据分析，{{ nbdata.name }}的{{
          hjwtid
        }}台风机出现频率最高为{{
          hjcount
        }}次，可做为重点检修对象，详细可参考分析系统分析功能。
      </p>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="handleClose">取消</el-button>
        <!-- <el-button type="primary" @click="centerDialogVisible = false">
        确定
    </el-button> -->
        <el-button @click="exportPDF" type="primary" :loading="loading"
          >导出 PDF</el-button
        >
      </span>
    </template>
  </el-dialog>
  <!-- 经济运行分析报告 -->
  <el-dialog
    class="windLifeDialog reportDia"
    v-model="economicalOperationVisible"
    width="50%"
    center
    :before-close="handleCloseOp"
    style="padding: 15px 40px"
  >
    <div class="repoerDateBox">
      <span>报告月份选择：</span>
      <el-date-picker
        style="width: 120px"
        v-model="reportParamDate"
        type="month"
        value-format="YYYY-MM"
        placeholder="请选择"
        @change="handleReportOp"
      />
    </div>
    <div
      id="pdfDomop"
      :class="!theme ? 'block' : 'white'"
      :style="!theme ? 'background-color: #040c0b' : 'background-color: #fff'"
    >
      <h2
        style="
          font-weight: bolder;
          text-align: center;
          margin-bottom: 20px;
          text-align: center;
        "
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        {{ OperationName }}
      </h2>

      <p style="text-indent: 2em; font-size: 16px; margin-bottom: 10px">
        根据会议安排，现将公司{{
          OperationMonth
        }}月份及年累计经济运行情况汇报如下：
      </p>

      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        一、重点指标分析
      </h3>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (一)生产指标完成情况
      </h3>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        1.月度生产指标完成情况
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，公司全口径完成发电量8895.2704万kWh，完成月度计划电量（内控值）10423万kWh的85.34%，同比（9295.3119万kWh）减少400.0416万kWh；其中，繁食沟1281.42万kWh、同比增加40.6万kWh；草山梁720.9180万kWh、同比增加329.75万kWh；吉山梁1622.04万kWh、同比减少268.1万kWh；左庄1353.24万kWh、同比减少35万kWh；新庄2254.28万kWh、同比减少335.44万kWh；雷家山1392.52万kWh、同比减少338.733万kWh；芦河光伏40.208万kWh、同比减少3.696万kWh；咸阳光伏22.9354万kWh、同比增加2.8685万kWh；兴平光伏1.7913万kWh；九宗山光伏108.1081万kWh；西社光伏97.8096万kWh。 -->
        {{ OperationData.yfdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，公司全口径综合厂用电率2.11%，同比升高0.57个百分点；风电综合厂用电率1.96%，同比升高0.42个百分点；光伏综合厂用电率6.81%，同比升高5.73个百分点。其中繁食沟2.55%、同比升高0.48个百分点；草山梁2.06%、同比降低0.61个百分点；吉山梁2.59%、同比升高0.51个百分点；左庄1.96%，同比增加0.46个百分点；新庄1.43%、同比升高0.21个百分点；雷家山1.51%、同比升高0.67个百分点；芦河光伏2.02%，同比升高0.45个百分点；九宗山光伏9.93%；西社光伏7.07%。 -->
        {{ OperationData.ycydl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        2.年度生产指标完成情况
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，公司全口径完成发电量20427.6872万kWh，同比（25259.3143万kWh）减少4831.63万kWh；其中，繁食沟3015.18万kWh、同比减少798.25万kWh；草山梁1488.184万kWh、同比减少33.42万kWh；吉山梁3686.76万kWh、同比减少879.76万kWh；左庄3121.44万kWh、同比减少878.08万kWh；新庄5342.4万kWh、同比减少1526万kWh；雷家山3215.795万kWh、同比减少1139.76万kWh；芦河光伏92.68万kWh、同比增加3.04万kWh；咸阳光伏50.1944万kWh、同比增加5.55万kWh；兴平光伏17.9517万kWh；九宗山光伏162.9198万kWh；西社光伏234.1823万kWh。 -->
        {{ OperationData.nfdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，公司全口径综合厂用电率1.74%，同比升高0.45个百分点；风电综合厂用电率1.61%，同比升高0.32个百分点；光伏综合厂用电率6.27%，同比升高5.02个百分点。其中繁食沟2.02%、同比升高0.41个百分点；草山梁1.74%、同比升高0.34个百分点；吉山梁2.13%、同比升高0.28个百分点；左庄1.51%、同比升高0.41个百分点；新庄1.18%、同比升高0.22个百分点；雷家山1.36%、同比升高0.28个百分点；芦河光伏1.98%，同比升高0.1个百分点；九宗山光伏13.46%；西社光伏4.80%。 -->
        {{ OperationData.ncydl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (二)重点指标完成情况
      </h3>
      <h3
        style="font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        1.风资源变化与利用小时变化的对应关系分析
      </h3>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        月度
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="fzylyxslistM"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="station" align="center" label="项目" />
          <el-table-column
            prop="pjfs"
            align="center"
            label="风机平均风速(m/s)"
          />
          <el-table-column
            prop="cftPjfs"
            align="center"
            label="测风塔平均风速(m/s)"
          />
          <el-table-column prop="hjwd" align="center" label="环境温度（℃）" />
          <el-table-column
            prop="lllyxs"
            align="center"
            label="理论利用小时数（h）"
          />
          <el-table-column
            prop="sjlyxs"
            align="center"
            label="实际利用小时数（h）"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径平均风速5.13m/s，较同期5.15m/s降低0.02m/s，与测风塔平均风速基本一致；各风场平均风速与测风塔平均风速偏差基本符合实际情况。从六个风场的风速、实际利用小时数与理论利用小时数比值可以看出，本月左庄风电场风速最高，理论利用小时数偏低；新庄风电场理论利用小时数与实际利用小时数偏差过大，但利用小时数最高；新庄风场风能利用率最高，吉山梁风场风能利用率最低。 -->
        {{ OperationData.yfzybh }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        年度
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="fzylyxslistY"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="station" align="center" label="项目" />
          <el-table-column
            prop="pjfs"
            align="center"
            label="风机平均风速(m/s)"
          />
          <el-table-column
            prop="cftPjfs"
            align="center"
            label="测风塔平均风速(m/s)"
          />
          <el-table-column prop="hjwd" align="center" label="环境温度（℃）" />
          <el-table-column
            prop="lllyxs"
            align="center"
            label="理论利用小时数（h）"
          />
          <el-table-column
            prop="sjlyxs"
            align="center"
            label="实际利用小时数（h）"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径平均风速5.21m/s，较同期5.59m/s降低0.38m/s，与测风塔平均风速基本一致；各风场平均风速与测风塔平均风速偏差基本符合实际情况。从六个风场的风速、实际利用小时数与理论利用小时数比值可以看出，左庄风电场风速最高，理论利用小时数偏低；新庄风电场、繁食沟风电场理论利用小时数与实际利用小时数偏差过大；新庄风场风能利用率最高，吉山梁风场风能利用率最低。 -->
        {{ OperationData.nfzybh }}
      </p>
      <h3
        style="font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        2.实际发电量与理论发电量差异
      </h3>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        月度
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="dlcylistM"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column
            prop="windpowerstationName"
            align="center"
            label="风场"
          />
          <el-table-column
            prop="llfdl"
            align="center"
            label="理论发电量（SCADA)"
          />
          <el-table-column prop="fdl" align="center" label="发电量" />
          <el-table-column prop="swdl" align="center" label="上网电量" />
          <el-table-column prop="zydl" align="center" label="35kV站用电量" />
          <el-table-column prop="ssdl" align="center" label="损失电量" />
          <el-table-column prop="xnssdl" align="center" label="性能损失电量" />
        </el-table>
      </div>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        年度
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="dlcylistY"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column
            prop="windpowerstationName"
            align="center"
            label="风场"
          />
          <el-table-column
            prop="llfdl"
            align="center"
            label="理论发电量（SCADA)"
          />
          <el-table-column prop="fdl" align="center" label="发电量" />
          <el-table-column prop="swdl" align="center" label="上网电量" />
          <el-table-column prop="zydl" align="center" label="35kV站用电量" />
          <el-table-column prop="ssdl" align="center" label="损失电量" />
          <el-table-column prop="xnssdl" align="center" label="性能损失电量" />
        </el-table>
      </div>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (1)实际发电量与理论发电量差异
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径实际发电量占理论发电量86.05%，其中：吉山梁77.90%，繁食沟94.09%，草山梁85.48%，左庄92.78%，新庄78.68%，雷家山98.69%；全口径损失电量（不包含性能损失）占理论发电量20.13%，其中：吉山梁19.39%，繁食沟10.92%，草山梁4.64%，左庄45.4%，新庄16.93%，雷家山19.77%；全口径性能损失占理论发电量5.94%，其中：吉山梁2.71%，繁食沟5.7%，草山梁2.45%，左庄13.69%，新庄6.96%；全口径性能损失占理论发电量2.94%。 -->
        {{ OperationData.yfdl_llfdlcy }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径实际发电量占理论发电量88.32%，其中：吉山梁88.50%，繁食沟81.17%，草山梁90.54%，左庄97.84%，新庄83.08%，雷家山95.93%；全口径损失电量（不包含性能损失）占理论发电量14.74%，其中：吉山梁12.06%，繁食沟5.97%，草山梁4.66%，左庄24.01%，新庄19.78%，雷家山14.1%；全口径性能损失占理论发电量5.56%，其中：吉山梁2.08%，繁食沟5.70%，草山梁2.44%，左庄8.5%，新庄7.45%，雷家山4.76%。 -->
        {{ OperationData.nfdl_llfdlcy }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (2)上网电量与实际发电量差异
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径上网电量占实际发电量98.96%，其中：吉山梁98.51%，繁食沟98.58%，草山梁99.25%，左庄99.13%，新庄99.19%，雷家山99.11%。主要原因：主变、站用变及110kV线路损耗。 -->
        {{ OperationData.yswdl_fdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径上网电量占实际发电量98.94%，其中：吉山梁98.53%，繁食沟98.61%，草山梁99.16%，左庄99.11%，新庄99.19%，雷家山99.05%。主要原因：主变、站用变及110kV线路损耗。 -->
        {{ OperationData.nswdl_fdl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (3)35kV站用电量对比分析
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径35kV站用变电量占实际发电量0.39%，其中：吉山梁0.41%，繁食沟0.40%，草山梁0.54%，左庄0.24%，新庄0.42%，雷家山0.35%。 -->
        {{ OperationData.yzydl_fdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径35kV站用变电量占实际发电量0.35%，其中：吉山梁0.39%，繁食沟0.36%，草山梁0.53%，左庄0.22%，新庄0.38%，雷家山0.33%。 -->
        {{ OperationData.nzydl_fdl }}
      </p>
      <h3
        style="font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        3.五大损失电量分析
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="wdssdlfx"
          :span-method="objectSpanMethod"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column
            prop="windpowerstationName"
            align="center"
            label="场站"
          />
          <el-table-column prop="wdss" align="center" label="五大损失" />
          <el-table-column
            prop="gzssdl"
            align="center"
            label="非计划（故障）损失电量"
          />
          <el-table-column prop="jhssdl" align="center" label="计划损失电量" />
          <el-table-column
            prop="xdssdl"
            align="center"
            label="限负荷损失电量"
          />
          <el-table-column prop="slssdl" align="center" label="受累损失电量" />
          <el-table-column
            prop="xnssdl"
            align="center"
            label="拟合性能损失电量"
          />
          <el-table-column prop="zhj" align="center" label="合计" />
          <el-table-column
            prop="hj"
            align="center"
            label="合计（无性能损失电量）"
          />
        </el-table>
      </div>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (1)计划损失电量分析
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径非计划（故障）损失电量9.7698万kWh，较同期减少6.004万kWh，其中：吉山梁损失1.745万kWh；繁食沟损失5.995万kWh;草山梁损失0.8809万kWh;左庄损失0万kWh；新庄损失1.05万kWh；雷家山损失0.0989万kWh。 -->
        {{ OperationData.ygzssdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径非计划（故障）损失电量19.9239万kWh，较同期减少8.91万kWh，其中：吉山梁损失2.8028万kWh；繁食沟损失9.8832万kWh;草山梁损失1.9975万kWh;左庄损失0.015万kWh；新庄损失4.84万kWh；雷家山损失0.3854万kWh。 -->
        {{ OperationData.ngzssdl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (2)计划损失电量分析
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径非计划损失电量11.8679万kWh，较同期增加2.7731万kWh，其中：吉山梁损失6.086万kWh；繁食沟损失2.8607万kWh;草山梁损失0.7405万kWh;左庄损失0.445万kWh；新庄损失1.7357万kWh；雷家山损失0万kWh。 -->
        {{ OperationData.yjhssdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径非计划损失电量35.3876万kWh，较同期增加12.4608万kWh，其中：吉山梁损失11.7818万kWh；繁食沟损失8.415万kWh;草山梁损失3.3606万kWh;左庄损失0.535万kWh；新庄损失5.7077万kWh；雷家山损失5.5875万kWh。全口径较同期增加主要原因是小风期间开展风机检修技改作业，2月份公司风机半年检完成38台，整年检完成1台，其中：繁食沟风场完成风机半年定检12台，左庄风场完成风机半年定检9台，吉山梁风场完成风机半年定检13台，草山梁风场完成风机半年定检4台，新庄风场二期完成风机整年定检1台，2024年度公司全口径累计完成风机半年定检维护129台；2024年度公司全口径累计完成风机整年定检维护8台。 -->
        {{ OperationData.njhssdl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (3)限负荷损失电量分析
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径限负荷损失电量1304.4314万kWh，较同期增加806.8129万kWh，其中：吉山梁损失280.73万kWh；繁食沟损失0万kWh;草山梁损失18.5333万kWh;左庄损失294.092万kWh；新庄损失384.6524万kWh；雷家山损失326.4237万kWh。 -->
        {{ OperationData.yxdssdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份，全口径限负荷损失电量2047.1078万kWh，较同期增加669.9767万kWh，其中：吉山梁损失383.5654万kWh；繁食沟损失0万kWh;草山梁损失70.0147万kWh;左庄损失500.8866万kWh；新庄损失586.8554万kWh；雷家山损失505.7857万kWh。 -->
        {{ OperationData.nxdssdl }}
      </p>
      <!-- <h3 style="text-indent: 2em;font-weight: bolder; margin: 10px 0"
                :style="!theme ? 'color: #fff' : 'color: #000'">
                (4)受累损失电量分析
            </h3>
            <div >
                <el-table class="toolSty" :data="curve" border
                    style="width: 100%; margin: 10px 0">
                    <el-table-column prop="section" align="center" label="月份" />
                    <el-table-column prop="module" align="center" label="场站" />
                    <el-table-column prop="wtidcount" align="center" label="损失电量（万千瓦时）" />
                    <el-table-column prop="wtidcount" align="center" label="受累原因" />
                </el-table>
            </div>
            <p style="text-indent: 2em;font-size:15px;text-align: justify;line-height:22px">
                2月份，全口径受累损失电量共计2099.23万kWh,较同期增加873.28万千瓦时，其中繁食沟环保风机损失电量55.99万kWh，叶片结冰受累损失270.5万kWh；吉山梁叶片结冰受累损失393万kWh；草山梁叶片结冰受累损失105.95万kWh；左庄叶片结冰受累损失384.41万kWh；新庄叶片结冰受累损失433.61万kWh；雷家山大风切出受累损失113.17万kWh，叶片结冰受累损失342.6万kWh。
            </p>
            <p style="text-indent: 2em;font-size:15px;text-align: justify;line-height:22px">
                截止2月份，全口径受累损失电量共计2172.505万kWh,较同期增加946.555万千瓦时，其中繁食沟环保风机损失电量119.74万kWh，叶片结冰受累损失270.5万kWh；吉山梁叶片结冰受累损失393万kWh；草山梁叶片结冰受累损失105.95万kWh；左庄叶片结冰受累损失390.68万kWh，新庄叶片结冰受累损失434.46万kWh，雷家山大风切出受累损失115.575万kWh，叶片结冰受累损失342.6万kWh。
            </p> -->
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        (5)性能损失电量分析
      </h3>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        性能损失主要是指风机在正常运行状态下，实际功率曲线未达到最优功率曲线形成的功率损失电量，如对风不准、桨叶角不精确或脏污等引起的降出力损失电量。
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径性能损失电量595.3638万千瓦时，较同期增加342.2639万千瓦时；其中，吉山梁损失56.4836万kWh、繁食沟损失77.63万kWh、草山梁损失20.678万kWh、左庄损失199.7145万kWh、新庄损失199.3288万kWh，雷家山损失41.5289万kWh。 -->
        {{ OperationData.yxnssdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份全口径性能损失电量1264.3083万千瓦时，较同期增加628.3524万千瓦时；其中，吉山梁损失96.7204万kWh、繁食沟损失211.74万kWh、草山梁损失40.1016万kWh、左庄损失276.9502万kWh、新庄损失479.289万kWh，雷家山损失159.5071万kWh。 -->
        {{ OperationData.nxnssdl }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        改进措施：一是充分利用集控中心指标分析系统，对单台风机性能进行分析，发现性能损失异常，及时进行针对性处理。二是集控中心日常监盘中加强风速与功率匹配情况的监盘，发现异常情况及时记录并通知检修处理；三是集控中心日常监盘中对风机桨叶角度、对风角度的监视，发现异常及时通知处理；四是在日常、定期维护中做好风机风速仪、风向标、叶片角度的校正工作。
      </p>
      <h3
        style="font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        4.各风场风机可利用率对比分析
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="fjklyl"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="stationid" align="center" label="场站" />
          <el-table-column :label="OperationMonth + '月份'" align="center">
            <el-table-column
              prop="ygztjxs"
              label="故障停机小时数(h)"
              width="120"
            />
            <el-table-column
              prop="yjhtjxs"
              label="计划停机小时数(h)"
              width="120"
            />
            <el-table-column prop="ysbklyl" label="设备可利用率(%)" />
          </el-table-column>
          <el-table-column label="年累计" align="center">
            <el-table-column
              prop="ngztjxs"
              label="故障停机小时数(h)"
              width="120"
            />
            <el-table-column
              prop="njhtjxs"
              label="计划停机小时数(h)"
              width="120"
            />
            <el-table-column prop="nsbklyl" label="设备可利用率(%)" />
          </el-table-column>
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份全口径可利用率99.94%，吉山梁可利用率99.96%；繁食沟可利用率99.84%；草山梁可利用率99.94%，左庄可利用率99.88%，新庄可利用率99.68%，雷家山可利用率99.99%。 -->
        {{ OperationData.yfjkyly }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 截止2月份全口径可利用率99.86%，吉山梁可利用率99.85%；繁食沟可利用率99.77%；草山梁可利用率99.89%，左庄可利用率99.77%，新庄可利用率99.51%，雷家山可利用率99.85%。 -->
        {{ OperationData.nfjkyly }}
      </p>
      <h3
        style="font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        5.能耗指标分析（风电）
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="nhzbfxlist"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="wpid" align="center" label="场站" />
          <el-table-column prop="type" align="center" label="类型" />
          <el-table-column
            prop="zhcydl"
            align="center"
            label="综合厂用电率（%）"
          />
          <el-table-column
            prop="fdcydl"
            align="center"
            label="发电厂用电率（%）"
          />
          <el-table-column prop="zbsh" align="center" label="主变损耗" />
          <el-table-column
            prop="xbsh"
            align="center"
            label="箱变及35kV线路损耗（万kWh）"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 2月份，全口径综合厂用电率1.96%，较同期升高0.42个百分点；截止2月份，全口径综合厂用电率1.61%，较同期升高0.32个百分点。 -->
        {{ OperationData.nhzbfx }}
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 所有场站综合厂用电率较同期偏高，主要原因是2月份发电量较同期减少，综合厂用电量较同期降幅小于发电量降幅；改进措施：各风场继续做好场站节能降耗管理，降低综合厂用电量。 -->
        {{ OperationData.nhzbfx2 }}
      </p>
      <h3
        style="font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        6.“两个细则”考核情况
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="twoxize"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="wpid" align="center" label="场站" />
          <el-table-column prop="pro" align="center" label="项目" />
          <el-table-column prop="by" align="center" label="月份" />
          <el-table-column prop="ytq" align="center" label="同期" />
          <el-table-column prop="nlj" align="center" label="年累计" />
          <el-table-column prop="ntq" align="center" label="同期" />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        1月份公司全口径“两个细则”兑现分546.8362分，同比增加239.3401分，其中调度管理考核10分，同比增加10分,风（光）考核460.4229分，同比增加142.9548分，可用功率考核29.97分，同比增加18.9196分,AGC有功调节考核14.1453分，同比增加14.1453分，AVC无功调节考核0.4937分，同比增加0.4937分，分摊分319.7573分，同比增加66.3611分，补偿分257.983分，同比减少5.3852分。
      </p>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        截止1月31日公司全口径“两个细则”兑现分546.8362分，同比增加239.3401分，其中调度管理考核10分，同比增加10分，风（光）功率预测考核460.4229分，同比增加142.9548分，可用功率考核29.97分，同比增加18.9196分,AGC有功调节考核14.1453分，同比增加14.1453分，AVC无功调节考核0.4937分，同比增加0.4937分，分摊分319.7573分，同比增加66.3611分，补偿分257.983分，同比减少5.3852分。（2024年2月份双细则考核未出）
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        二、截止{{ OperationMonth }}月份单机性能指标对比分析
      </h3>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin-bottom: 10px"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        1.繁食沟风电场
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="fanshigouXN"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="equipmentid" align="center" label="风机号" />
          <el-table-column
            prop="llfdl"
            align="center"
            label="拟合理论发电量（kWh）"
          />
          <el-table-column prop="fdl" align="center" label="发电量（kWh）" />
          <el-table-column prop="t" align="center" label="△t（kWh）" />
          <el-table-column prop="pjfs" align="center" label="平均风速(m/s)" />
          <el-table-column
            prop="qrfs"
            align="center"
            label="单机切入风速（m/s）"
          />
          <el-table-column
            prop="edfs"
            align="center"
            label="额定功率下的平均风速"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 对比分析F215、F205、F221、F210风机为性能最优风机，理论电量与实际电量相差较小；F121、F124、F118、F116风机为性能最差风机。（F113、F209、F229、F231因环保问题停机，不做分析对比） -->
        {{ OperationData.xnzbfsg }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        2.草山梁风电场
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="caoshaniangXN"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="equipmentid" align="center" label="风机号" />
          <el-table-column
            prop="llfdl"
            align="center"
            label="拟合理论发电量（kWh）"
          />
          <el-table-column prop="fdl" align="center" label="发电量（kWh）" />
          <el-table-column prop="t" align="center" label="△t（kWh）" />
          <el-table-column prop="pjfs" align="center" label="平均风速(m/s)" />
          <el-table-column
            prop="qrfs"
            align="center"
            label="单机切入风速（m/s）"
          />
          <el-table-column
            prop="edfs"
            align="center"
            label="额定功率下的平均风速"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 对比分析C1-B04、C1-B08风机，理论电量与实际电量相差较小，同时C1-B08单机发电量在25万kWh以上，性能优异；C1-B02、C1-C01、C1-B01风机为性能最差风机。 -->
        {{ OperationData.xnzbcsl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        3.吉山梁风电场
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="jishanliangXN"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="equipmentid" align="center" label="风机号" />
          <el-table-column
            prop="llfdl"
            align="center"
            label="拟合理论发电量（kWh）"
          />
          <el-table-column prop="fdl" align="center" label="发电量（kWh）" />
          <el-table-column prop="t" align="center" label="△t（kWh）" />
          <el-table-column prop="pjfs" align="center" label="平均风速(m/s)" />
          <el-table-column
            prop="qrfs"
            align="center"
            label="单机切入风速（m/s）"
          />
          <el-table-column
            prop="edfs"
            align="center"
            label="额定功率下的平均风速"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 对比分析A11、A02、A28风机为性能最优风机，理论电量与实际电量相差较小，A11风机单机发电量25万kWh以上；C02、C14、C16风机为性能最差风机。 -->
        {{ OperationData.xnzbjsl }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        4.左庄风电场
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="zuozhuangXN"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="equipmentid" align="center" label="风机号" />
          <el-table-column
            prop="llfdl"
            align="center"
            label="拟合理论发电量（kWh）"
          />
          <el-table-column prop="fdl" align="center" label="发电量（kWh）" />
          <el-table-column prop="t" align="center" label="△t（kWh）" />
          <el-table-column prop="pjfs" align="center" label="平均风速(m/s)" />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 对比分析F406、F404、F309风机理论电量与实际电量相差较小，F404风机单机发电量最高；F301、F316、F417风机理论电量与实际电量相差较大，为性能最差风机。 -->
        {{ OperationData.xnzbzz }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        5.新庄风电场
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="xingzhuangXN"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="equipmentid" align="center" label="风机号" />
          <el-table-column
            prop="llfdl"
            align="center"
            label="拟合理论发电量（kWh）"
          />
          <el-table-column prop="fdl" align="center" label="发电量（kWh）" />
          <el-table-column prop="t" align="center" label="△t（kWh）" />
          <el-table-column prop="pjfs" align="center" label="平均风速(m/s)" />
          <el-table-column
            prop="qrfs"
            align="center"
            label="单机切入风速（m/s）"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 对比分析2MW风机中F712、F602、F609风机为性能最优风机，3MW风机中F710、F706、F714风机理论电量与实际电量相差较小，F714、F713、F709风机发电量最高；F519、F718风机为性能最差风机，理论电量与实际电量相差较大。 -->
        {{ OperationData.xnzbxz }}
      </p>
      <h3
        style="text-indent: 2em; font-weight: bolder; margin: 10px 0"
        :style="!theme ? 'color: #fff' : 'color: #000'"
      >
        6.雷家山风场
      </h3>
      <div >
        <el-table
          class="toolSty"
          :data="leijiashanXN"
          border
          style="width: 100%; margin: 10px 0"
        >
          <el-table-column prop="equipmentid" align="center" label="风机号" />
          <el-table-column
            prop="llfdl"
            align="center"
            label="拟合理论发电量（kWh）"
          />
          <el-table-column prop="fdl" align="center" label="发电量（kWh）" />
          <el-table-column prop="t" align="center" label="△t（kWh）" />
          <el-table-column prop="pjfs" align="center" label="平均风速(m/s)" />
          <el-table-column
            prop="qrfs"
            align="center"
            label="单机切入风速（m/s）"
          />
          <el-table-column
            prop="edfs"
            align="center"
            label="额定功率下的平均风速"
          />
        </el-table>
      </div>
      <p
        style="
          text-indent: 2em;
          font-size: 15px;
          text-align: justify;
          line-height: 22px;
        "
      >
        <!-- 对比分析L201、L216、L114风机为性能最优风机，理论电量与实际电量相差较小，L101、L102、L103风机发电量最高；L106、L108、L116风机为性能最差风机，理论电量与实际电量相差较大。 -->
        {{ OperationData.xnzbljs }}
      </p>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="handleCloseOp">取消</el-button>
        <!-- <el-button type="primary" @click="centerDialogVisible = false">
        确定
    </el-button> -->
        <!-- <el-button @click="exportPDFop" type="danger" :loading="loading"
          >导出 PDF</el-button
        > -->
        <el-button @click="exportWORD" type="primary" :loading="loading"
          >导出 WORD</el-button
        >
      </span>
    </template>
  </el-dialog>
</template>

<script setup name="report">
import httpRequest from "@/utils/request.js";
import jsPDF from "jspdf";
import html2canvas from "html2canvas";
import htmlToPdf from "./fixGetPDF";
// import dataJson from "./dataJson"
import twoxizeJson from "./lianggexizeJson";
import { ref, onMounted, reactive, watch, nextTick } from "vue";
import { useStore } from "vuex";

import Docxtemplater from "docxtemplater";
import PizZip from "pizzip";
import JSZipUtils from "jszip-utils";
import { saveAs } from "file-saver";
import dayjs from "dayjs";

import axios from "axios";

import jsonData from "./component/data.json";

const pickerVal = ref([
  dayjs().subtract(1, "month").startOf("month").format("YYYY-MM"),
  dayjs().format("YYYY-MM"),
]);
const curve = ref([]);
const mrlxs = ref([]);
const blade = ref([]);

const staticwind = ref([]);
const stoptime = ref([]);
const nbdata = ref({});
const loading = ref(false);
const tableHeight = ref(window.innerHeight - 110 + "px");
const reportParamDate = ref(
  dayjs().subtract(1, "month").startOf("month").format("YYYY-MM")
);

const exportPDF = () => {
  loading.value = true;
  // 调用htmlToPdf工具函数
  htmlToPdf.getPdf(document.querySelector("#pdfDom"), "风电场性能分析报告");
  // 定时器模拟按钮loading动画的时间
  setTimeout(() => {
    loading.value = false;
    ElMessage.success("打印成功!");
  }, 1000);
  centerDialogVisible.value = false;
};

const exportWORD = () => {
  httpRequest
    .get(`/MeetingReport/Analysisreport?time=${reportParamDate.value}`)
    .then((tempRes) => {
      tempRes.data.titleYear = tempRes.data.title.year;
      tempRes.data.titleMonth = tempRes.data.title.month;
      tempRes.data.titleName = tempRes.data.title.name;
      tempRes.data.dlcylistM = [];
      tempRes.data.dlcylistY = [];
      tempRes.data.wdssBase = [];
      tempRes.data.wdssSum = [];

      tempRes.data.dlcylist.forEach((it) => {
        if (it.cycleType === "M") {
          tempRes.data.dlcylistM.push(it);
        } else if (it.cycleType === "Y") {
          tempRes.data.dlcylistY.push(it);
        }
      });

      tempRes.data.wdssdlfx.forEach((ele) => {
        const cycleType = ele.cycleType;
        const wpName = ele.windpowerstationName;
        const findRes = tempRes.data.wdssBase.find((findEle) => {
          return findEle.windpowerstationId === ele.windpowerstationId;
        });
        if (findRes) {
          findRes[`gzssdl${cycleType}`] = ele.gzssdl;
          findRes[`jhssdl${cycleType}`] = ele.jhssdl;
          findRes[`xdssdl${cycleType}`] = ele.xdssdl;
          findRes[`slssdl${cycleType}`] = ele.slssdl;
          findRes[`xnssdl${cycleType}`] = ele.xnssdl;
          findRes[`zhj${cycleType}`] = ele.zhj;
          findRes[`hj${cycleType}`] = ele.hj;
          findRes[`tqgzssdl${cycleType}`] = ele.tqgzssdl;
          findRes[`tqjhssdl${cycleType}`] = ele.tqjhssdl;
          findRes[`tqxdssdl${cycleType}`] = ele.tqxdssdl;
          findRes[`tqslssdl${cycleType}`] = ele.tqslssdl;
          findRes[`tqxnssdl${cycleType}`] = ele.tqxnssdl;
          findRes[`tqzhj${cycleType}`] = ele.tqzhj;
          findRes[`tqhj${cycleType}`] = ele.tqhj;
        } else {
          ele[`gzssdl${wpName === "合计" ? "" : cycleType}`] = ele.gzssdl;
          ele[`jhssdl${wpName === "合计" ? "" : cycleType}`] = ele.jhssdl;
          ele[`xdssdl${wpName === "合计" ? "" : cycleType}`] = ele.xdssdl;
          ele[`slssdl${wpName === "合计" ? "" : cycleType}`] = ele.slssdl;
          ele[`xnssdl${wpName === "合计" ? "" : cycleType}`] = ele.xnssdl;
          ele[`zhj${wpName === "合计" ? "" : cycleType}`] = ele.zhj;
          ele[`hj${wpName === "合计" ? "" : cycleType}`] = ele.hj;
          ele[`tqgzssdl${wpName === "合计" ? "" : cycleType}`] = ele.tqgzssdl;
          ele[`tqjhssdl${wpName === "合计" ? "" : cycleType}`] = ele.tqjhssdl;
          ele[`tqxdssdl${wpName === "合计" ? "" : cycleType}`] = ele.tqxdssdl;
          ele[`tqslssdl${wpName === "合计" ? "" : cycleType}`] = ele.tqslssdl;
          ele[`tqxnssdl${wpName === "合计" ? "" : cycleType}`] = ele.tqxnssdl;
          ele[`tqzhj${wpName === "合计" ? "" : cycleType}`] = ele.tqzhj;
          ele[`tqhj${wpName === "合计" ? "" : cycleType}`] = ele.tqhj;
          ele.wpName = ele.windpowerstationName;

          if (ele.windpowerstationName !== "合计") {
            tempRes.data.wdssBase.push(ele);
          } else {
            ele.wpName =
              cycleType === "M" ? `月${ele.wpName}` : `年${ele.wpName}`;
            tempRes.data.wdssSum.push(ele);
          }
        }
      });

      const lgxzList = [];
      twoxizeJson?.data?.forEach((ele) => {
        const findRes = lgxzList.find((findEle) => {
          return ele.wpid === findEle.wpid;
        });
        if (findRes) {
          ele.wpid = "";
          findRes.list.push(ele);
        } else {
          lgxzList.push({
            wpid: ele.wpid,
            list: [ele],
          });
        }
      });

      tempRes.data.twoxize = lgxzList;

      const xnzbdbfx = [];
      let xnzbdbfxIdx = 1;
      for (let wpName in tempRes.data.xnzbdbfx) {
        let xnzb = "";
        if (wpName === "吉山梁风电场") {
          xnzb = tempRes.data.xnzbjsl;
        } else if (wpName === "左庄风电场") {
          xnzb = tempRes.data.xnzbzz;
        } else if (wpName === "新庄风电场") {
          xnzb = tempRes.data.xnzbxz;
        } else if (wpName === "繁食沟风电场") {
          xnzb = tempRes.data.xnzbfsg;
        } else if (wpName === "草山梁风电场") {
          xnzb = tempRes.data.xnzbcsl;
        } else if (wpName === "雷家山风电场") {
          xnzb = tempRes.data.xnzbljs;
        }
        xnzbdbfx.push({
          wpName: `${xnzbdbfxIdx}.${wpName}`,
          list: tempRes.data.xnzbdbfx[wpName],
          xnzb,
        });
        xnzbdbfxIdx++;
      }

      tempRes.data.xnzbdbfxlist = xnzbdbfx;

      // 读取并获得模板文件的二进制内容
      JSZipUtils.getBinaryContent(
        `./static/windReport.docx`,
        (error, content) => {
          // 抛出异常
          if (error) throw error;
          // 创建一个JSZip实例，内容为模板的内容
          let zip = new PizZip(content);
          // 创建并加载docxtemplater实例对象
          let doc = new Docxtemplater();
          doc.loadZip(zip);
          doc.setData(tempRes.data);
          try {
            // 用模板变量的值替换所有模板变量
            doc.render();
          } catch (error) {
            // 抛出异常
            let e = {
              message: error.message,
              name: error.name,
              stack: error.stack,
              properties: error.properties,
            };
            console.log(JSON.stringify({ error: e }));
            throw error;
          }
          // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
          let out = doc.getZip().generate({
            type: "blob",
            mimeType:
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
          });
          // 将目标文件对象保存为目标类型的文件，并命名
          saveAs(out, `${tempRes.data.title.name}.docx`);
        }
      );
    });
};

const centerDialogVisible = ref(false);
/**场站 */
const stationList = ref([]);
const funGetStation = async () => {
  const res = await httpRequest.get("/base/station");
  stationList.value = res.data;
};
/**查询表格数据 */
const tableData = ref([]);
const station = ref("");
const addform = async () => {
  const res = await httpRequest.get(
    `/report/list?station=${station.value}&st=${
      pickerVal.value?.[0] || ""
    }&et=${pickerVal.value?.[1] || ""}`
  );

  //    res.data.forEach((ele)=>{
  //        ele.time=ele.time.slice(0, 7);
  //    })
  tableData.value = res.data;
};

let val1 = ref();
let value2 = ref();
const BeginChange = (val) => {
  // console.log(val);
  val1.value = val;
  // console.log(val);
};
const EndChange = (val) => {
  // console.log(val);
  value2.value = val;
};
let time = ref();
let eltime = ref();
let wtcount = ref();
let hjwtid = ref();
let hjcount = ref();
const handleReport = async (index, row) => {
  time.value = row.time;
  //   console.log(index, row)
  centerDialogVisible.value = true;
  // const res = await httpRequest.get(
  //   `/report/info?station=${row.station}&date=${row.time}`
  // );
  const res=jsonData.bgData;
  nbdata.value = res.data.station;
  //    console.log('nb',nbdata.value);
  if (res.data.info.curve.length) {
    res.data.info.curve.forEach((ele) => {
      ele.module = "偏差率负值";
    });
  }

  curve.value = res.data.info.curve;
  mrlxs.value = res.data.info.mrlxs;
  blade.value = res.data.info.blade;
  staticwind.value = res.data.info.staticwind;
  stoptime.value = res.data.info.stoptime;
  eltime.value = res.data.time;
  wtcount.value = res.data.wtcount;
  hjwtid.value = res.data.hjwtid;
  hjcount.value = res.data.hjcount;

  nextTick(() => {
    document.getElementsByClassName(".toolSty");
  });
};

const economicalOperationVisible = ref(false);
const OperationData = ref({});
const OperationName = ref("");
const OperationMonth = ref("");
const fzylyxslistM = ref([]);
const fzylyxslistY = ref([]);
const dlcylistM = ref([]);
const dlcylistY = ref([]);
const wdssdlfx = ref([]);
const fjklyl = ref([]);
const nhzbfxlist = ref([]);
const twoxize = ref([]);
const fanshigouXN = ref([]);
const caoshaniangXN = ref([]);
const jishanliangXN = ref([]);
const leijiashanXN = ref([]);
const xingzhuangXN = ref([]);
const zuozhuangXN = ref([]);

const handleReportOp = () => {
  if (reportParamDate.value) {
    economicalOperationVisible.value = true;
    OperationName.value = "";
    OperationMonth.value = "";
    OperationData.value = {};
    fzylyxslistM.value = [];
    fzylyxslistY.value = [];
    fjklyl.value = [];

    httpRequest
      .get(`/MeetingReport/Analysisreport?time=${reportParamDate.value}`)
      .then((res) => {
        renderReportPage(res);
      })
      .catch(() => {
        renderReportPage({ data: jsonData.reportData });
      });
  }
};

const renderReportPage = (res) => {
  OperationName.value = res.data.title.name;
  OperationMonth.value = res.data.title.month;
  OperationData.value = res.data;
  fzylyxslistM.value = res.data.yfzylyxslist;
  fzylyxslistY.value = res.data.nfzylyxslist;
  twoxize.value = twoxizeJson.data;
  fjklyl.value = res.data.fjklyl;
  res.data.dlcylist.forEach((it) => {
    if (it.cycleType === "M") {
      dlcylistM.value.push(it);
    } else if (it.cycleType === "Y") {
      dlcylistY.value.push(it);
    }
  });
  // 五项损失列表数据处理
  const stationName = [
    "吉山梁",
    "繁食沟",
    "草山梁",
    "左庄",
    "新庄",
    "雷家山",
    "月度",
    "年度",
  ];
  const typeOsY = ["月累计", "月同期"];
  const typeOsN = ["年累计", "年同期"];
  const typeOsHJ = ["合计", "同期合计"];
  let arr = [];
  stationName.forEach((iv) => {
    let obj = {};
    res.data.wdssdlfx.forEach((it) => {
      if (iv !== "月度" && iv !== "年度") {
        if (it.windpowerstationName.indexOf(iv) !== -1) {
          if (it.cycleType === "M") {
            typeOsY.forEach((ib) => {
              obj = {
                windpowerstationName: iv,
                wdss: ib,
                gzssdl: ib === "月累计" ? it.gzssdl : it.tqgzssdl,
                jhssdl: ib === "月累计" ? it.jhssdl : it.tqjhssdl,
                xdssdl: ib === "月累计" ? it.xdssdl : it.tqxdssdl,
                slssdl: ib === "月累计" ? it.slssdl : it.tqslssdl,
                xnssdl: ib === "月累计" ? it.xnssdl : it.tqxnssdl,
                zhj: ib === "月累计" ? it.zhj : it.tqzhj,
                hj: ib === "月累计" ? it.hj : it.tqhj,
              };
              arr.push(obj);
            });
          } else if (it.cycleType === "Y") {
            typeOsN.forEach((ib) => {
              obj = {
                windpowerstationName: iv,
                wdss: ib,
                gzssdl: ib === "年累计" ? it.gzssdl : it.tqgzssdl,
                jhssdl: ib === "年累计" ? it.jhssdl : it.tqjhssdl,
                xdssdl: ib === "年累计" ? it.xdssdl : it.tqxdssdl,
                slssdl: ib === "年累计" ? it.slssdl : it.tqslssdl,
                xnssdl: ib === "年累计" ? it.xnssdl : it.tqxnssdl,
                zhj: ib === "年累计" ? it.zhj : it.tqzhj,
                hj: ib === "年累计" ? it.hj : it.tqhj,
              };
              arr.push(obj);
            });
          }
        }
      } else {
        if (it.windpowerstationName === "合计") {
          if (it.cycleType === "M" && iv === "月度") {
            typeOsHJ.forEach((ib) => {
              obj = {
                windpowerstationName: iv,
                wdss: ib,
                gzssdl: ib === "合计" ? it.gzssdl : it.tqgzssdl,
                jhssdl: ib === "合计" ? it.jhssdl : it.tqjhssdl,
                xdssdl: ib === "合计" ? it.xdssdl : it.tqxdssdl,
                slssdl: ib === "合计" ? it.slssdl : it.tqslssdl,
                xnssdl: ib === "合计" ? it.xnssdl : it.tqxnssdl,
                zhj: ib === "合计" ? it.zhj : it.tqzhj,
                hj: ib === "合计" ? it.hj : it.tqhj,
              };
              arr.push(obj);
            });
          } else if (it.cycleType === "Y" && iv === "年度") {
            typeOsHJ.forEach((ib) => {
              obj = {
                windpowerstationName: iv,
                wdss: ib,
                gzssdl: ib === "合计" ? it.gzssdl : it.tqgzssdl,
                jhssdl: ib === "合计" ? it.jhssdl : it.tqjhssdl,
                xdssdl: ib === "合计" ? it.xdssdl : it.tqxdssdl,
                slssdl: ib === "合计" ? it.slssdl : it.tqslssdl,
                xnssdl: ib === "合计" ? it.xnssdl : it.tqxnssdl,
                zhj: ib === "合计" ? it.zhj : it.tqzhj,
                hj: ib === "合计" ? it.hj : it.tqhj,
              };
              arr.push(obj);
            });
          }
        }
      }
    });
  });
  console.log("wdssdl===>>", arr);
  wdssdlfx.value = arr;
  // 能耗指标分析（风电）
  const stationArr = [
    "吉山梁",
    "繁食沟",
    "草山梁",
    "左庄",
    "新庄",
    "雷家山",
    "月度",
  ];
  const typeArr = ["zhcydl", "fdcydl", "zbsh", "xbsh"];
  res.data.nhzbfxlist.forEach((it) => {
    if (it.wpid !== "月度") {
      let obj = {
        wpid: it.wpid,
        type: "月累计",
        zhcydl: it.yzhcydl,
        fdcydl: it.yfdcydl,
        zbsh: it.yzbsh,
        xbsh: it.yxbsh,
      };
      nhzbfxlist.value.push(obj);
      let obj2 = {
        wpid: it.wpid,
        type: "月同期",
        zhcydl: it.ytqzhcydl,
        fdcydl: it.ytqfdcydl,
        zbsh: it.ytqzbsh,
        xbsh: it.ytqxbsh,
      };
      nhzbfxlist.value.push(obj2);
      let obj3 = {
        wpid: it.wpid,
        type: "年累计",
        zhcydl: it.nzhcydl,
        fdcydl: it.nfdcydl,
        zbsh: it.nzbsh,
        xbsh: it.nxbsh,
      };
      nhzbfxlist.value.push(obj3);
      let obj4 = {
        wpid: it.wpid,
        type: "年同期",
        zhcydl: it.ntqzhcydl,
        fdcydl: it.ntqfdcydl,
        zbsh: it.ntqzbsh,
        xbsh: it.ntqxbsh,
      };
      nhzbfxlist.value.push(obj4);
    } else {
      let obj = {
        wpid: it.wpid,
        type: "合计",
        zhcydl: it.yzhcydl,
        fdcydl: it.yfdcydl,
        zbsh: it.yzbsh,
        xbsh: it.yxbsh,
      };
      nhzbfxlist.value.push(obj);
      let obj2 = {
        wpid: it.wpid,
        type: "同期合计",
        zhcydl: it.ytqzhcydl,
        fdcydl: it.ytqfdcydl,
        zbsh: it.ytqzbsh,
        xbsh: it.ytqxbsh,
      };
      nhzbfxlist.value.push(obj2);
    }
  });

  //单机性能指标对比分析
  for (let i in res.data.xnzbdbfx) {
    if (i === "繁食沟风电场") {
      fanshigouXN.value = res.data.xnzbdbfx[i];
    } else if (i === "草山梁风电场") {
      caoshaniangXN.value = res.data.xnzbdbfx[i];
    } else if (i === "吉山梁风电场") {
      jishanliangXN.value = res.data.xnzbdbfx[i];
    } else if (i === "左庄风电场") {
      zuozhuangXN.value = res.data.xnzbdbfx[i];
    } else if (i === "新庄风电场") {
      xingzhuangXN.value = res.data.xnzbdbfx[i];
    } else if (i === "雷家山风电场") {
      leijiashanXN.value = res.data.xnzbdbfx[i];
    }
  }
};

const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
  // if (columnIndex === 0) {
  //     const prevRow = wdssdlfx.value[rowIndex - 1];
  //     if (prevRow && row.windpowerstationName === prevRow.windpowerstationName) {
  //         return [1, 0];
  //     }
  // }
  // if (column.property === 'windpowerstationName') {
  //     const _row =
  // }
};

const handleClose = () => {
  reset();
  centerDialogVisible.value = false;
};

const handleCloseOp = () => {
  reset();
  economicalOperationVisible.value = false;
};

const exportPDFop = () => {
  loading.value = true;
  // 调用htmlToPdf工具函数
  htmlToPdf.getPdf(document.querySelector("#pdfDomop"), "经济运行分析会报告");
  // 定时器模拟按钮loading动画的时间
  setTimeout(() => {
    loading.value = false;
    ElMessage.success("打印成功!");
  }, 1000);
  economicalOperationVisible.value = false;
};

const reset = () => {
  curve.value = [];
  mrlxs.value = [];
  blade.value = [];
  staticwind.value = [];
  stoptime.value = [];
  eltime.value = "";
  wtcount.value = "";
  hjwtid.value = "";
  hjcount.value = "";
};

const theme = ref(null);
const store = useStore();
watch(
  () => store.state.theme,
  (newVal, oldVal) => {
    theme.value = newVal;
    funGetStation();
    addform();
  },
  {
    deep: true,
  }
);

const initPageData = () => {
  stationList.value = jsonData.stationData;
  tableData.value = jsonData.tableData;
};

onMounted(() => {
  initPageData();
  // funGetStation();
  // addform();
  theme.value = store.state.theme;
  tableHeight.value = window.innerHeight - 110 + "px";
});
</script>
<style lang="less" scoped>
.analysisReport {
  height: 100%;

  .analysisReportMain {
    height: 100%;

    .main_top {
      width: 100%;
      height: 40px;
      display: flex;
      align-items: center;

      .topPsty {
        position: relative;
        top: 5px;
        padding: 7px 20px;
        font-size: 12px;
        font-weight: 600;
        margin-left: 10px;
        border-radius: 3px;
      }

      .seach {
        width: calc(100% - 20px);
        padding: 20px 0 0 20px;
      }
    }

    .main {
      width: 100%;
      padding: 10px;

      .tableDataMain {
        width: calc(100% - 20px);
      }
    }
  }
}

.themeDark {
  .analysisReportMain {
    .main_top {
      .topPsty {
        color: #1c99ff;
        background: #1e2126;
      }
    }

    .main {
      background: #161f1e;

      .tableDataMain {
        margin-top: 5px;
        background: #212223;
      }
    }
  }
}

.themeLight {
  padding: 0;

  .analysisReportMain {
    .main_top {
      .topPsty {
        color: #2778ff;
        background: #ffffff;
      }
    }

    .main {
      background: #edeffb;

      .tableDataMain {
        background: #fff;
        margin-top: 5px;
      }
    }

    .analysisReportMain {
      padding: 20px 0;
      border-radius: 10px;
      background: #fff;
    }
  }
}

#pdfDom {
  p {
    color: #fff;
  }
}
</style>
<style lang="less">
.el-overlay {
  .el-overlay-dialog {
    .reportDia {
      margin-top: 0 !important;
    }
  }
}

.reportDia {
  .repoerDateBox {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
  }
}

.currSearch {
  .generat-seach {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;

    .el-form-item {
      width: auto;
      display: flex;
      justify-content: flex-start;
      align-items: center;

      .el-form-item__label {
        color: #fff !important;
      }

      .el-range-editor.el-input__inner {
        display: block;
      }
    }
  }
}
</style>