<template>
  <el-dialog
    custom-class="cDialog"
    top="50px"
    v-model="dialogVisible"
    width="80%"
    @closed="dialogClosed"
  >
    <el-button
      style="position: absolute; right: 24px; top: 60px; z-index: 5000"
      type="primary"
      @click="exportPDF"
    >
      导出为PDF</el-button
    >
    <div class="pdfDom">
      <div class="title">健康评价报告概述</div>
      <!-- <el-form style="margin-top: 10px">
        <el-form-item>健康状态：2022C505513</el-form-item>
      </el-form> -->
      <div class="tableBox">
        <div class="l">
          <el-form>
            <el-form-item class="imp fw"
              >{{ reportInfo1.wpName }}{{ reportInfo1.nemCode }}</el-form-item
            >
            <el-form-item class="imp fw"
              >评级结果：{{ reportInfo1.ratingResults }}
            </el-form-item>
            <el-form-item class="imp fw"
              >评级展望：{{ reportInfo1.ratingOutlook }}</el-form-item
            >
            <el-form-item class="imp fw"
              >评级有效期：{{
                new Date(reportInfo1.ratingValidityPeriod).formatDate(
                  "yyyy-MM-dd hh:mm:ss"
                )
              }}</el-form-item
            >
            <el-form-item class="imp fw">主要参数指标数据：</el-form-item>
          </el-form>
          <el-table
            empty-text="暂无数据"
            :data="ls1"
            :header-cell-style="{
              background: 'rgb(153,204,255)',
              color: '#000',
            }"
            :cell-style="columnStyle"
            border
            stripe
            style="width: 100%; margin: 10px 0"
          >
            <el-table-column prop="name" label="指标" />
            <el-table-column prop="monthValue" label="当月值" />
            <el-table-column prop="lastMonth1Value" label="上月值" />
            <el-table-column prop="lastMonth2Value" label="前两月值" />
          </el-table>
          <el-form>
            <el-form-item class="imp fw" v-if="false"
              >报告确认人：{{ healthreport.bgqrr }}</el-form-item
            >
            <el-form-item class="imp fw"
              >报告出具时间：{{
                new Date(reportInfo1.reportCreatedate).formatDate(
                  "yyyy-MM-dd hh:mm:ss"
                )
              }}</el-form-item
            >
            <el-form-item
              >注：本报告表述了健康管理系统对该设备的健康评级观点，仅供参考，并非是最终的决策的结论、建议。</el-form-item
            >
          </el-form>
        </div>
        <div class="r">
          <el-form>
            <el-form-item class="imp fw" style="border-bottom: 8px solid #000"
              >评级观点：</el-form-item
            >
            <div class="infoBox">
              <p>
                {{ datas.wtName || reportInfo1.wtId }}
                {{
                  reportInfo1.firstIntegratedTime
                    ? `于${new Date(reportInfo1.firstIntegratedTime).formatDate(
                        "yyyy-MM-dd hh:mm:ss"
                      )}并网运行，`
                    : ""
                }}运行{{ reportInfo1.runningDays }}天，统计周期内累计发电量为{{
                  (reportInfo1.monthFdl / 10000).toFixed(2)
                }}万Kwh，风能利用率{{ reportInfo1.yfnlyl }}%，环比增加{{
                  reportInfo1.yfnlylhb
                }}%；设备可利用率{{ reportInfo1.ylyxs }}%，环比下降{{
                  reportInfo1.ylyxshb
                }}%，MTTF为{{ reportInfo1.ymttf }}小时，MTBF为{{
                  reportInfo1.ymtbf
                }}小时。
              </p>
              <p>统计期内故障发生{{ reportInfo1.ygzcs }}次</p>
              <p class="red" v-if="reportInfo1.gztop1">
                {{ reportInfo1.gztop1 }}
              </p>
              <p class="red" v-if="reportInfo1.gztop2">
                {{ reportInfo1.gztop2 }}
              </p>
              <p class="red" v-if="reportInfo1.gztop3">
                {{ reportInfo1.gztop3 }}
              </p>
              <p class="info">功率对部件温度影响较高是齿轮箱、主轴</p>
              <p class="info">部件劣化较高是发电机、主轴</p>
              <p v-if="reportInfo1.jxjgsc > 0">
                定检已超过{{ reportInfo1.jxjgsc }}个月，近{{
                  reportInfo1.jxjgsc
                }}个月无维修记录
              </p>
            </div>
          </el-form>
        </div>
      </div>

      <div class="textBox" v-if="tjjxfa.wtId">
        <el-form>
          <el-form-item class="imp fw"><b>推荐检修方案</b></el-form-item>
          <el-form-item class="imp fw text-indent-2">故障预测</el-form-item>
          <el-form-item class="text-indent-4"
            >高频：{{ tjjxfa.top1 || "" }}</el-form-item
          >
          <el-form-item class="text-indent-4"
            >中频：{{ tjjxfa.top2 || "" }}</el-form-item
          >
          <el-form-item class="m-b-10 text-indent-4"
            >低频：{{ tjjxfa.top3 || "" }}</el-form-item
          >
          <el-form-item class="text-indent-2"
            >推荐排查方法：{{ tjjxfa.gzpc || "" }}</el-form-item
          >
          <el-form-item class="text-indent-2"
            >推荐处理方法：{{ tjjxfa.gzcl || "" }}</el-form-item
          >
          <el-form-item class="text-indent-2"
            >推荐工具器：{{ tjjxfa.gqj || "" }}</el-form-item
          >
          <el-form-item class="text-indent-2"
            >平均消缺时长：{{ tjjxfa.xqsc || "---" }}小时</el-form-item
          >
          <el-form-item class="text-indent-2"
            >推荐检修日期：{{
              new Date(tjjxfa.recordDate).formatDate("yyyy-MM-dd")
            }}</el-form-item
          >
          <el-form-item>结论：健康报告达到推荐级别，推荐检修!</el-form-item>
        </el-form>
      </div>

      <div class="tableBox">
        <div class="l" style="width: 100%">
          <el-form>
            <el-form-item class="imp fw">可靠性</el-form-item>
          </el-form>
          <el-table
            empty-text="暂无数据"
            :data="alarmcountVoList"
            :header-cell-style="{
              background: 'rgb(153,204,255)',
              color: '#000',
            }"
            :cell-style="columnStyle"
            border
            stripe
            style="width: 100%; margin: 10px 0"
          >
            <el-table-column prop="description" label="描述" />
            <el-table-column prop="total" label="总次数" sortable />
            <el-table-column prop="maxSeconds" label="最大时长" sortable />
            <el-table-column prop="minSeconds" label="最小时长" sortable />
            <el-table-column prop="avgSeconds" label="平均时长" sortable />
            <el-table-column prop="totalSeconds" label="总时间" sortable />
          </el-table>
        </div>
      </div>

      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2"><b>性能</b></el-form-item>
          <el-form-item class="imp fw text-indent-2"
            >曲线拟合及偏差率</el-form-item
          >
          <el-form-item class="text-indent-2">
            统计周期内，曲线偏差率{{
              reportInfo1.yqxpcbbzsj
            }}%，其中风速在3-5m/s区间曲线偏差率{{
              reportInfo1.y35mqxpcl
            }}%，风速在5-11m/s区间曲线偏差率为{{
              reportInfo1.y511mqxpcl
            }}%，风速在11-25m/s区间曲线偏差率为{{ reportInfo1.y11mycqxpcl }}%。
          </el-form-item>
          <div>
            <div class="logHead">功率曲线拟合</div>
            <double-line-chart :height="'250px'" :list="glqxnh" />
          </div>
          <div v-if="false">
            <div class="logHead">曲线偏差率</div>
            <normal-line-chart :list="qxpcls" />
          </div>
        </el-form>
      </div>

      <!-- 对风偏差先隐藏 -->
      <div class="textBox" v-if="false">
        <el-form>
          <el-form-item class="imp fw text-indent-2">对风偏差：</el-form-item>
          <el-form-item class="text-indent-2">
            统计周期内，对应的偏航对风偏差角度信号大部分集中在0度附近，近似于正态分布，正负偏差15%以内的频率{{
              Number(healthreport.withincount)
            }}次，以外的频次{{
              Number(healthreport.beyondcount)
            }}次，对风偏差率为{{
              Number(healthreport.dfpcl).toFixed(1)
            }}，总体高于该型号机组平均值（3%）。
          </el-form-item>
          <el-form-item class="text-indent-2"
            >其中风速在3-5m/s区间的对风偏差率{{
              Number(healthreport.threedfpcl).toFixed(1)
            }}，风速在5-11m/s区间的对风偏差率{{
              Number(healthreport.fivedfpcl).toFixed(1)
            }}，风速在11-25m/s区间的对风偏差率{{
              Number(healthreport.elevendfpcl).toFixed(1)
            }}。
          </el-form-item>
          <el-form-item class="text-indent-2">
            对于功率分别在100,200,300,400,...,{{
              healthreport.glfw
            }}KW的偏航对风偏差角度信号进行统计,对风偏差率分别为{{
              healthreport.descriptiondfpcl
            }}；（如果需要查看在每一个功率等高线下偏航对风偏差角度信号在角度数值上的聚集程度，可参考能效分析中对风偏差分析模块）
          </el-form-item>

          <div class="logHead">对风偏差率（频次）</div>
          <DoubleLineChart
            style="margin: 10px 0"
            width="100%"
            height="300px"
            :list="dfpc.nipples"
          />
          <div class="logHead">对风偏差率（功率）</div>
          <DoubleLineChart
            style="margin: 10px 0"
            width="100%"
            height="300px"
            :list="dfpc.dfpclpowers"
          />
          <div class="logHead">对风偏差率（风速）</div>
          <DoubleLineChart
            style="margin: 10px 0"
            width="100%"
            height="300px"
            :list="dfpc.dfpclSpeeds"
          />
        </el-form>
      </div>

      <!-- <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2">切入切出：</el-form-item>
          <el-form-item class="text-indent-2"
            >统计周期内，该机组小风切入在{{
              Number(qrqcs[0].xfqr).toFixed(2)
            }}m/s，小风切出在{{
              Number(qrqcs[0].xfqc).toFixed(2)
            }}m/s，大风切入在{{
              Number(qrqcs[0].dfqr).toFixed(2)
            }}m/s，大风切出在{{ Number(qrqcs[0].dfqc).toFixed(2) }}m/s。
          </el-form-item>
          <div class="logHead">切入切出对比</div>
          <el-table
            empty-text="暂无数据"
            :data="qrqcs"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="foreignkeyid" label="项目"></el-table-column>
            <el-table-column prop="xfqr" label="小风切入"></el-table-column>
            <el-table-column prop="xfqc" label="小风切出"></el-table-column>
            <el-table-column prop="dfqr" label="大风切入"></el-table-column>
            <el-table-column prop="dfqc" label="大风切出"></el-table-column>
          </el-table>
        </el-form>
      </div> -->

      <!-- 可靠性暂时隐藏 -->
      <div class="textBox" v-if="false">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            ><b>可靠性</b>：</el-form-item
          >
          <el-form-item class="imp fw text-indent-2">部件隐患：</el-form-item>
          <el-form-item class="text-indent-2">
            统计周期内，传动链隐患频次为{{ yhbjcount.cdlcount }}次，持续时长{{
              yhbjcount.cdltime
            }}分钟；测风系统隐患频次为{{ yhbjcount.cfxtcount }}次，持续时长{{
              yhbjcount.cfxttime
            }}分钟；齿轮箱隐患频次为{{ yhbjcount.clxcount }}次，持续时长{{
              yhbjcount.clxtime ? yhbjcount.clxtime : 0
            }}分钟；发电机隐患频次为{{ yhbjcount.fdjcount }}次，持续时长{{
              yhbjcount.fdjtime
            }}分钟；变桨隐患频次为{{ yhbjcount.bjcount }}次，持续时长{{
              yhbjcount.bjtime
            }}分钟；机舱隐患频次为{{ yhbjcount.jccount }}次，持续时长{{
              yhbjcount.jctime
            }}分钟；偏航隐患频次为{{ yhbjcount.phcount }}次，持续时长{{
              yhbjcount.phtime
            }}分钟； 塔底柜隐患频次为{{ yhbjcount.tdgcount }}次，持续时长{{
              yhbjcount.tdgtime
            }}分钟。
          </el-form-item>
          <el-form-item class="text-indent-2" v-if="bjyhcount.length > 0">
            <font v-if="bjyhcount[0].yhmx"
              >其中以{{ bjyhcount[0].yhmx }}发生频次最高，为{{
                bjyhcount[0].count
              }}次；</font
            >
            <font v-if="bjyhcount[1].yhmx"
              >{{ bjyhcount[1].yhmx }}次之，为{{ bjyhcount[1].count }}次；</font
            >
            <font v-if="bjyhcount[2].yhmx"
              >{{ bjyhcount[2].yhmx }}第三，为{{ bjyhcount[0].count }}次。</font
            >
          </el-form-item>
          <el-form-item class="text-indent-2">
            <font v-if="bjyhcount[3].yhmx"
              >其中以{{ bjyhcount[3].yhmx }}发生时长最长，为{{
                bjyhcount[3].times
              }}分钟；</font
            >
            <font v-if="bjyhcount[4].yhmx"
              >{{ bjyhcount[4].yhmx }}次之，为{{
                bjyhcount[4].yhmx
              }}分钟；</font
            >
            <font v-if="bjyhcount[5].yhmx"
              >{{ bjyhcount[5].yhmx }}第三，为{{
                bjyhcount[5].yhmx
              }}分钟。</font
            >
          </el-form-item>
          <div class="logHead">部件隐患对比（次|分钟）</div>
          <el-table
            empty-text="暂无数据"
            :data="bjyhdbs"
            class="bjyhdb"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="foreignkeyid" label="项目"></el-table-column>
            <el-table-column label="传动链">
              <el-table-column prop="cdlcount"></el-table-column>
              <el-table-column prop="cdltimes"></el-table-column>
            </el-table-column>
            <el-table-column label="测风系统">
              <el-table-column prop="cfxtcount"></el-table-column>
              <el-table-column prop="cfxttimes"></el-table-column>
            </el-table-column>
            <el-table-column label="齿轮箱">
              <el-table-column prop="clxcount"></el-table-column>
              <el-table-column prop="clxtimes"></el-table-column>
            </el-table-column>
            <el-table-column label="发电机">
              <el-table-column prop="fdjcount"></el-table-column>
              <el-table-column prop="fdjtimes"></el-table-column>
            </el-table-column>
            <el-table-column label="变桨">
              <el-table-column prop="bjcount"></el-table-column>
              <el-table-column prop="bjtimes"></el-table-column>
            </el-table-column>
            <el-table-column label="机舱">
              <el-table-column prop="jccount"></el-table-column>
              <el-table-column prop="jctimes"></el-table-column>
            </el-table-column>
            <el-table-column label="偏航">
              <el-table-column prop="phcount"></el-table-column>
              <el-table-column prop="phtimes"></el-table-column>
            </el-table-column>
            <el-table-column label="塔底柜">
              <el-table-column prop="tdgcount"></el-table-column>
              <el-table-column prop="tdgtimes"></el-table-column>
            </el-table-column>
          </el-table>
          <div class="logHead">隐患模型对比</div>
          <el-table
            empty-text="暂无数据"
            :data="yjmxdb"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="name" label="部件" />
            <el-table-column prop="alertText" label="隐患类型" />
            <el-table-column prop="counts" label="频次" />
            <el-table-column prop="avgcounts" label="均值" />
            <el-table-column prop="times" label="时长(分钟)" />
            <el-table-column prop="avgtimes" label="均值(分钟)" />
          </el-table>
        </el-form>
      </div>

      <!-- <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2">故障分类：</el-form-item>
          <el-form-item class="text-indent-2">
            统计周期内，机舱振动类故障频次为88次，持续时长51分钟。（只显示发生故障的，如没有发生过故障的不用文字描述）
          </el-form-item>
         其中以（明细故障mwData）发生频次最高，为mwData次；（明细故障mwData）次之，为mwData次；（明细故障mwData）第三，为mwData次。 -->
      <!-- <div class="logHead">故障分类统计</div>
          <el-table
            empty-text="暂无数据"
            :data="faultclass"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="warningtype" label="分类"></el-table-column>
            <el-table-column label="频次（次数）">
              <el-table-column
                prop="monthwarningnum"
                label="统计期"
              ></el-table-column>
              <el-table-column
                prop="yearoveryearnum"
                label="上月"
              ></el-table-column>
              <el-table-column
                prop="monthonmonthnum"
                label="同期"
              ></el-table-column>
            </el-table-column>
            <el-table-column label="时长（分钟）">
              <el-table-column
                prop="monthonmonthtime"
                label="统计期"
              ></el-table-column>
              <el-table-column
                prop="monthwarningtime"
                label="上月"
              ></el-table-column>
              <el-table-column
                prop="yearoveryeartime"
                label="同期"
              ></el-table-column>
            </el-table-column>
          </el-table>
        </el-form>
      </div> -->

      <!-- <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            >功率对部件温度影响</el-form-item
          >
          <el-form-item class="text-indent-2"
            >统计周期内，齿轮箱温度“900-1050”、
            “1200-1350”大于平均值；主轴温度“450-600”、
            “1200-1350”大于平均值。（只显示大于平均值的，没有就不显示，如果完全没有就显示在统计周期内，各个部件温度良好）
          </el-form-item>
          <div class="logHead">
            功率对部件温度影响统计（红字对比平均值高，绿字对比平均值低）
          </div>
          <el-table
            empty-text="暂无数据"
            :data="partwds"
            :span-method="wdyxtjMethod"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="bj" label="部件"></el-table-column>
            <el-table-column prop="wdcd" label="温度测点"></el-table-column>
            <el-table-column prop="min0" label="0-150"></el-table-column>
            <el-table-column prop="min150" label="150-300"></el-table-column>
            <el-table-column prop="min300" label="300-450"></el-table-column>
            <el-table-column prop="min450" label="450-600"></el-table-column>
            <el-table-column prop="min600" label="600-750"></el-table-column>
            <el-table-column prop="min750" label="750-900"></el-table-column>
            <el-table-column prop="min900" label="900-1050"></el-table-column>
            <el-table-column prop="min1050" label="1050-1200"></el-table-column>
            <el-table-column prop="min1200" label="1200-1350"></el-table-column>
            <el-table-column prop="min1350" label="1350-1500"></el-table-column>
          </el-table>
        </el-form>
      </div> -->

      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            ><b>部件劣化状态</b></el-form-item
          >
          <el-form-item class="imp fw">总览：</el-form-item>
          <el-form-item class="text-indent-2"
            >统计周期内，发电机劣化频次为{{ bjlhzt.fdj }}次，齿轮箱劣化频次为{{
              bjlhzt.clx
            }}次；变桨劣化频次为{{ bjlhzt.bj }}次；主轴劣化频次为{{
              bjlhzt.zz
            }}次。
          </el-form-item>
          <div class="logHead">部件劣化频次总览</div>
          <el-table
            empty-text="暂无数据"
            :data="bjlhzt.tableData"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="dateRange" label="时间周期" />
            <el-table-column prop="fdj" label="发电机" />
            <el-table-column prop="clx" label="齿轮箱" />
            <el-table-column prop="bj" label="变桨" />
            <el-table-column prop="zz" label="主轴" />
            <el-table-column prop="total" label="总计" />
          </el-table>
        </el-form>
      </div>

      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2">发电机：</el-form-item>
          <el-form-item class="text-indent-2"
            >关键参数：发电机采用“发电机转速”、“发电机轴A温度”
            、“发电机轴B温度”为关键参数，该参数在统计周期内数据显示样本在安全运行区内，没有超过进入劣化区
          </el-form-item>
          <div class="logHead">发电机关键参数值</div>
          <el-table
            empty-text="暂无数据"
            :data="fdjgjcsz"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="gjcs" label="关键参数"></el-table-column>
            <el-table-column prop="edz" label="额定值"></el-table-column>
            <el-table-column prop="yxfw" label="允许范围"></el-table-column>
            <el-table-column prop="qz" label="权重"></el-table-column>
            <el-table-column prop="scz" label="实测值"></el-table-column>
            <el-table-column prop="df" label="得分"></el-table-column>
          </el-table>
        </el-form>
      </div>

      <div class="textBox" v-if="false">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            >震动监测：时域分析分析法</el-form-item
          >
          <el-form-item class="text-indent-2"
            >有量纲参数：均值为100，方差为49，均方幅值67，峰值，260，平均幅值44，均方值120</el-form-item
          >
          <el-form-item class="text-indent-2"
            >无量纲参数：峭度指标20，峰值指标50，波形指标90，脉冲指标77</el-form-item
          >
          <el-form-item class="text-indent-2"
            >结合两种指标都未发现明显劣化值</el-form-item
          >
          <el-form-item class="text-indent-2"
            >频域分析法：根据震动检测提供频域分析结果，现有设备运行正常</el-form-item
          >
          <!-- <multiple-line-chart
            :showLegend="true"
            :hoverType="'axis'"
            :list="wttragetreportcharts.fdj"
          /> -->
          <double-line-chart :height="'250px'" :list="fdjLineChartOptions" />
          <el-form-item class="imp fw text-indent-2">统计分析：</el-form-item>
          <el-form-item class="text-indent-2"
            >发电机类故障，平均故障周期在12个月，上次故障距此次评价时间为5个月，发电机处于平稳运行周期。</el-form-item
          >
        </el-form>
      </div>

      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2">齿轮箱：</el-form-item>
          <el-form-item class="text-indent-2">
            齿轮箱采用“齿轮箱温度”为关键参数，该参数在统计周期内数据显示样本超出了劣化区，并且有明显的瞬时的上升趋势，引发了温度超限报警一次，恢复后运行平稳，该风机齿轮箱历史总体运行正常，近期存在报警信息，状态评价为良。
          </el-form-item>
          <!-- <multiple-line-chart
            :showLegend="true"
            :hoverType="'axis'"
            :list="wttragetreportcharts.clx"
          /> -->
          <double-line-chart :height="'250px'" :list="clxLineChartOptions" />
          <el-form-item class="imp fw text-indent-2">主轴：</el-form-item>
          <el-form-item class="text-indent-2"
            >关键参数：主轴采用“主轴承温度”、“主轴承油脂启动时间间隔”
            、“主轴承油脂泵运行周期”为关键参数，该参数在统计周期内拟故障应进行检查
          </el-form-item>
          <div class="logHead">发电机关键参数值</div>
          <el-table
            empty-text="暂无数据"
            :data="fdjgjcsz2"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="gjcs" label="关键参数"></el-table-column>
            <el-table-column prop="edz" label="额定值"></el-table-column>
            <el-table-column prop="yxfw" label="允许范围"></el-table-column>
            <el-table-column prop="qz" label="权重"></el-table-column>
            <el-table-column prop="scz" label="实测值"></el-table-column>
            <el-table-column prop="df" label="得分"></el-table-column>
          </el-table>
        </el-form>
      </div>
      <div class="textBox" v-if="false">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            >震动监测：时域分析分析法</el-form-item
          >
          <el-form-item class="text-indent-2"
            >有量纲参数：均值为100，方差为49，均方幅值67，峰值，260，平均幅值44，均方值120</el-form-item
          >
          <el-form-item class="text-indent-2"
            >无量纲参数：峭度指标20，峰值指标50，波形指标90，脉冲指标77</el-form-item
          >
          <el-form-item class="text-indent-2"
            >结合两种指标都未发现明显劣化值</el-form-item
          >
          <el-form-item class="text-indent-2"
            >频域分析法：根据震动检测提供频域分析结果，现有设备运行正常</el-form-item
          >
          <!-- <multiple-line-chart
            :showLegend="true"
            :hoverType="'axis'"
            :list="wttragetreportcharts.zk"
          /> -->
          <double-line-chart :height="'250px'" :list="zzLineChartOptions" />
          <el-form-item class="imp fw">统计分析：</el-form-item>
          <el-form-item class="text-indent-2"
            >发电机类故障，平均故障周期在12个月，上次故障距此次评价时间为5个月，发电机处于平稳运行周期。</el-form-item
          >
        </el-form>
      </div>
      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2">变桨</el-form-item>
          <div class="infoBox">
            <p>
              1）关键参数：变桨采用“变桨电机温度1”、“变桨电机温度2”
              、“变桨电机温度3”、“变频器温度1”、“变频器温度2”
              、“变频器温度3”为关键参数，该参数在统计周期内数据显示样本在安全运行区内，没有超过进入劣化区
            </p>
          </div>
          <div class="logHead">发电机关键参数值</div>
          <el-table
            empty-text="暂无数据"
            :data="bjgjcs"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin: 10px 0"
          >
            <el-table-column prop="gjcs" label="关键参数"></el-table-column>
            <el-table-column prop="edz" label="额定值"></el-table-column>
            <el-table-column prop="yxfw" label="允许范围"></el-table-column>
            <el-table-column prop="qz" label="权重"></el-table-column>
            <el-table-column prop="scz" label="实测值"></el-table-column>
            <el-table-column prop="df" label="得分"></el-table-column>
          </el-table>

          <template v-if="false">
            <el-form-item class="imp fw text-indent-2">震动监测：</el-form-item>
            <el-form-item class="text-indent-2">时域分析分析法</el-form-item>
            <el-form-item class="text-indent-2"
              >有量纲参数：均值为100，方差为49，均方幅值67，峰值，260，平均幅值44，均方值120</el-form-item
            >
            <el-form-item class="text-indent-2"
              >无量纲参数：峭度指标20，峰值指标50，波形指标90，脉冲指标77</el-form-item
            >
            <el-form-item class="text-indent-2"
              >结合两种指标都未发现明显劣化值</el-form-item
            >
            <el-form-item class="text-indent-2"
              >频域分析法：根据震动检测提供频域分析结果，现有设备运行正常</el-form-item
            >
            <!-- <multiple-line-chart
            :showLegend="true"
            :hoverType="'axis'"
            :list="wttragetreportcharts.bj"
          /> -->
            <double-line-chart :height="'250px'" :list="bjLineChartOptions" />
            <el-form-item class="imp fw text-indent-2">统计分析：</el-form-item>
            <el-form-item class="text-indent-2"
              >发电机类故障，平均故障周期在12个月，上次故障距此次评价时间为5个月，发电机处于平稳运行周期。</el-form-item
            >
          </template>
        </el-form>
      </div>

      <!-- 全生命周期暂时隐藏 -->
      <div class="textBox" v-if="false">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            ><b>全生命周期管理</b>：</el-form-item
          >
          <div class="logHead">定检记录</div>
          <el-table
            empty-text="暂无数据"
            :data="djjl"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="rq" label="日期"></el-table-column>
            <el-table-column prop="ms" label="描述"></el-table-column>
          </el-table>
          <el-form-item class="imp fw text-indent-2">设备维修</el-form-item>
          <el-form-item class="text-indent-2"
            >统计周期内，
            年7月27日星期二更换测风系统中风向仪风速标；2021年7月27日星期二维修齿轮箱中齿轮箱冷却风扇。（只显示近三个月内维修换件记录，如果完全没有就显示在统计周期内，机组运行良好，未进行维修换件）
          </el-form-item>
          <div class="logHead">维修换件频次</div>
          <el-table
            empty-text="暂无数据"
            :data="wxhjpc"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="bjjg" label="部件结构"></el-table-column>
            <el-table-column label="近三个月">
              <el-table-column prop="wx1" label="维修"></el-table-column>
              <el-table-column prop="hj1" label="换件"></el-table-column>
            </el-table-column>
            <el-table-column label="近一年">
              <el-table-column prop="wx2" label="维修"></el-table-column>
              <el-table-column prop="hj2" label="换件"></el-table-column>
            </el-table-column>
            <el-table-column label="全部">
              <el-table-column prop="wx3" label="维修"></el-table-column>
              <el-table-column prop="hj3" label="换件"></el-table-column>
            </el-table-column>
          </el-table>
        </el-form>
      </div>

      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2"
            ><b>指标</b>：</el-form-item
          >
          <el-form-item class="imp fw">1、风能利用率</el-form-item>
          <!-- <div class="infoBox" style="margin: 20px 0">
            <p>
              近三月，受宁夏电网限电，及自然天气情况等因素影响，{{
                datas.wtName
              }}发电能力在这个三个月程下降趋势，但非计划损失电量和计划损失电量逐渐减少，风能利用率并未体现出递减趋势，而是逐步增长。
              {{ datas.year }}年{{
                datas.month
              }}月，非计划检修率和计划检修率分别为6%和12%，计划检修率尚可，风机产生的非计划检修率还存在，但较前两月明显较低。
              风机因自身原因造成5%的性能损失率，在可接受范围。
              总体来看，该风机逐步进入平稳期，风能利用率增长趋势，可利率较高。
            </p>
          </div> -->
          <div class="logHead">风机绩效榜（kWh）</div>
          <el-table
            empty-text="暂无数据"
            :data="ls2"
            :header-cell-style="{
              background: 'rgb(153,204,255)',
              color: '#000',
            }"
            :cell-style="columnStyle"
            border
            stripe
            style="width: 100%; margin: 10px 0"
          >
            <el-table-column prop="name" label="指标" />
            <el-table-column prop="monthValue" label="当月值" />
            <el-table-column prop="lastMonth1Value" label="上月值" />
            <el-table-column prop="lastMonth2Value" label="前两月值" />
          </el-table>

          <el-form-item class="imp fw text-indent-2"
            >2、设备可利用率</el-form-item
          >
          <!-- <div class="infoBox" style="margin: 20px 0">
            <p>
              {{
                healthreport.wpname
              }}近期温度较高，温度超限类故障较多，但近三个月，{{
                datas.wtname
              }}可利用呈增长趋势，{{ Number(datas.month) - 2 }}~{{
                Number(datas.month)
              }}月，非计划小时数分别为{{ sbklyls[2].fjhjxxs }}小时、{{
                sbklyls[1].fjhjxxs
              }}小时和{{
                sbklyls[0].fjhjxxs
              }}小时。故障次数分别是2次、3次和2次， {{ datas.month }}月，{{
                datas.wtname
              }}设备可利用率为{{
                Number(healthreport.sbklyl).toFixed(2)
              }}%，可靠性尚可。
            </p>
          </div> -->
          <div class="logHead">可靠性分析（小时）</div>
          <el-table
            empty-text="暂无数据"
            :data="ls3"
            :header-cell-style="{
              background: 'rgb(153,204,255)',
              color: '#000',
            }"
            :cell-style="columnStyle"
            border
            stripe
            style="width: 100%; margin: 10px 0"
          >
            <el-table-column prop="name" label="指标" />
            <el-table-column prop="monthValue" label="当月值" />
            <el-table-column prop="lastMonth1Value" label="上月值" />
            <el-table-column prop="lastMonth2Value" label="前两月值" />
          </el-table>
        </el-form>
      </div>
      <div class="textBox">
        <el-form>
          <el-form-item class="imp fw text-indent-2">3、性能评价</el-form-item>
          <!-- <div class="infoBox" style="margin: 20px 0">
            <p>
              {{ datas.wtName }}近三个月性能评价{{ datas.wtLevel }}，整体排名{{
                datas.wtNum
              }}，{{ datas.year }}年{{
                datas.month
              }}月性能评价指标横向对比良好。
            </p>
          </div> -->
          <!-- <div class="logHead">
            {{ datas.year }}年{{ datas.month }}月性能评价结果
          </div>
          <el-table
            empty-text="暂无数据"
            :data="xnpjjg"
            :header-cell-style="{
              background: 'rgb(224,224,224)',
              color: '#000',
            }"
            border
            stripe
            style="width: 100%; margin-bottom: 10px"
          >
            <el-table-column prop="yf" label="月份"></el-table-column>
            <el-table-column prop="jb" label="级别"></el-table-column>
            <el-table-column prop="df" label="得分"></el-table-column>
            <el-table-column prop="ph" label="排行"></el-table-column>
          </el-table> -->
          <div class="logHead">
            {{ datas.year }}年{{ datas.month }}月性能评价明细
          </div>

          <table
            border="1"
            class="xnpjfx"
            style="width: 100%"
            cellspacing=""
            cellpadding=""
          >
            <tr>
              <td align="center">
                <div class="border-b p-5">风机编号：{{ datas.wtName }}</div>
                <div class="border-b">量化评级：{{ datas.wtLevel }}</div>
                <div class="border-b">综合排名：{{ datas.wtNum }}</div>
                <normal-radar-chart
                  height="500px"
                  width="500px"
                  :value="pjmxs"
                />
              </td>
              <td valign="top"></td>
              <td style="display: flex; justify-content: center">基础指标</td>
              <el-table
                empty-text="暂无数据"
                :data="xnpjmx"
                :header-cell-style="{ color: '#000', background: '#fff' }"
                border
                stripe
                style="width: 100%"
              >
                <el-table-column prop="types" label="类型" />
                <el-table-column prop="targetName" label="指标" />
                <el-table-column prop="value" label="数值" />
                <el-table-column prop="num" label="排名" />
                <el-table-column prop="score" label="评分" />
              </el-table>
            </tr>
          </table>
        </el-form>
      </div>

      <!-- <div class="textBox">
        <el-form>
          <el-form-item class="fw" style="margin: 10px 0; text-align: center"
            >数据来源：集控中心大数据分析系统
          </el-form-item>
        </el-form>
      </div> -->
    </div>
  </el-dialog>
</template>

<script>
import DoubleLineChart from "@com/chart/line/double-line-chart.vue";
// import ScatterLineChart from "@com/chart/combination/scatter-line-chart.vue";
import NormalLineChart from "@com/chart/line/normal-line-chart.vue";
import NormalRadarChart from "@com/chart/radar/normal-radar-chart.vue";
import MultipleLineChart from "@com/chart/line/double-line-chart.vue";
import Get_PDF from "@tools/htmlToPdf";
import $ from "jquery";
import api from "@api/wisdomOverhaul/health/index.js";
import axios from "axios";
export default {
  components: {
    DoubleLineChart,
    // ScatterLineChart,
    NormalLineChart,
    MultipleLineChart,
    NormalRadarChart,
  },
  data() {
    return {
      datas: {},
      reportInfo1: {},
      alarmcountVoList: [],
      ls1: [],
      ls2: [],
      ls3: [],
      yjmxdb: [],
      bjlhzt: {
        fdj: 0,
        clx: 0,
        bj: 0,
        zz: 0,
        tableData: [],
      },
      fdjLineChartOptions: [],
      clxLineChartOptions: [],
      zzLineChartOptions: [],
      bjLineChartOptions: [],
      healthreport: {},
      tjjxfa: {},
      // 对风偏差
      dfpc: {
        nipples: [
          {
            title: "频次",
            smooth: true,
            value: [],
          },
        ],
        dfpclpowers: [
          {
            title: "功率",
            smooth: true,
            value: [],
          },
        ],
        dfpclSpeeds: [
          {
            title: "风速",
            smooth: true,
            value: [],
          },
        ],
      },
      // 切入切出对比
      qrqcs: [
        {
          foreignkeyid: "",
          xfqr: 0,
          xfqc: 0,
          dfqr: 0,
          dfqc: 0,
        },
      ],
      // 曲线偏差率
      glqxnh: [],
      qxpcls: [
        {
          title: "曲线偏差率",
          yAxisIndex: 0,
          value: [
            {
              text: "1",
              value: 0,
            },
          ],
        },
        {
          title: "基准值",
          yAxisIndex: 0,
          value: [
            {
              text: "1",
              value: 0,
            },
          ],
        },
      ],
      // 隐患部件频次统计
      yhbjcount: {
        cdlcount: 0,
        cdltime: 0,
        cfxtcount: 0,
        cfxttime: 0,
        clxcount: 0,
        clxttime: 0,
        fdjcount: 0,
        fdjtime: 0,
        bjcount: 0,
        bjtime: 0,
        jccount: 0,
        jctime: 0,
        phcount: 0,
        phtime: 0,
        tdgcount: 0,
        tdgtime: 0,
      },
      // 部件隐患数据频次时长统计
      bjyhcount: [
        {
          yhmx: "主轴温度温差大于8度",
          count: 64,
        },
        {
          yhmx: "主轴温度温差大于8度",
          count: 64,
        },
        {
          yhmx: "主轴温度温差大于8度",
          count: 64,
        },
        {
          yhmx: "主轴温度温差大于8度",
          times: 64,
        },
        {
          yhmx: "主轴温度温差大于8度",
          times: 64,
        },
        {
          yhmx: "主轴温度温差大于8度",
          times: 64,
        },
      ],
      // 部件隐患对比
      bjyhdbs: [],
      // 隐患模型对比
      yhmxdbs: [],
      yhmxdbs2: [],
      // 故障分类
      faultclass: [],
      // 设备可利用率
      sbklyls: [
        {
          date: "2021-08-01",
          yxxs: 8.23,
          djxs: 15.77,
          fjhjxxs: 0.0,
          jhjxxs: 0.0,
          slxs: 0.0,
          gzcs: null,
          sbklyl: 100.0,
        },
        {
          date: "2021-08-01",
          yxxs: 8.23,
          djxs: 15.77,
          fjhjxxs: 0.0,
          jhjxxs: 0.0,
          slxs: 0.0,
          gzcs: null,
          sbklyl: 100.0,
        },
        {
          date: "2021-08-01",
          yxxs: 8.23,
          djxs: 15.77,
          fjhjxxs: 0.0,
          jhjxxs: 0.0,
          slxs: 0.0,
          gzcs: null,
          sbklyl: 100.0,
        },
      ],
      sbklyls2: [],
      // 风能利用率
      fnlyls: [],
      //功率对部件温度影响
      partwds: [],
      // 性能评价
      xnpjjg: [],
      //性能评价明细
      xnpjmx: [],
      pjmxs: [],
      wttragetreportcharts: [],

      zhrank: 2,
      // 维修换件频次
      wxhjpc: [
        {
          bjjg: "叶片",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "轮毂及变桨系统",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "主控柜",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "机舱",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "偏航系统",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "齿轮箱",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "发电机",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "液压",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "测风",
          wx1: "0",
          hj1: "1",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "联轴器",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "主轴",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "塔架",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "塔底控制柜",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "变频器",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "辅助系统",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
        {
          bjjg: "基础",
          wx1: "0",
          hj1: "0",
          wx2: "0",
          hj2: "0",
          wx3: "0",
          hj3: "0",
        },
      ],
      djjl: [
        {
          rq: "2021-7-26",
          ms: "正常",
        },
        {
          rq: "2021-7-20",
          ms: "发现齿轮箱漏油，已加油，联系厂家维修",
        },
        {
          rq: "2021-6-12",
          ms: "正常",
        },
      ],
      Powertrend: [
        {
          title: "",
          yAxisIndex: 0, // 使用单位
          value: [],
        },
      ],
      fdjgjcsz: [
        {
          gjcs: "发电机转速",
          edz: "1700",
          yxfw: "<2000",
          qz: "0.35",
          scz: "1500",
          df: "0.3",
        },
        {
          gjcs: "发电机轴A温度",
          edz: "70",
          yxfw: "<100",
          qz: "0.15",
          scz: "56",
          df: "0.12",
        },
        {
          gjcs: "发电机轴B温度",
          edz: "70",
          yxfw: "<100",
          qz: "0.15",
          scz: "54",
          df: "0.12",
        },
      ],
      fdjgjcsz2: [
        {
          gjcs: "主轴承温度",
          edz: "30",
          yxfw: "<80",
          qz: "0.35",
          scz: "36.2",
          df: "0.79",
        },
        {
          gjcs: "主轴承油脂启动时间间隔",
          edz: "",
          yxfw: "<500",
          qz: "0.15",
          scz: "394",
          df: "0.03",
        },
        {
          gjcs: "主轴承油脂泵运行周期",
          edz: "",
          yxfw: "<14",
          qz: "0.15",
          scz: "6",
          df: "0",
        },
      ],
      bjlhpczl: [
        {
          sjzq: "近1天",
          fdj: "1",
          clx: "0",
          bj: "0",
          zz: "1",
          zj: "2",
        },
        {
          sjzq: "近3天",
          fdj: "1",
          clx: "0",
          bj: "0",
          zz: "1",
          zj: "2",
        },
        {
          sjzq: "统计期内",
          fdj: "1",
          clx: "0",
          bj: "0",
          zz: "1",
          zj: "2",
        },
      ],
      // 变桨关键参数表格
      bjgjcs: [
        {
          gjcs: "变桨电机温度1",
          edz: "55",
          yxfw: "<100",
          qz: "0.12",
          scz: "68",
          df: "0.24",
        },
        {
          gjcs: "变桨电机温度2",
          edz: "55",
          yxfw: "<100",
          qz: "0.12",
          scz: "87",
          df: "0.59",
        },
        {
          gjcs: "变桨电机温度3",
          edz: "55",
          yxfw: "<100",
          qz: "0.12",
          scz: "79",
          df: "0.48",
        },
        {
          gjcs: "变频器温度1",
          edz: "25",
          yxfw: "<45",
          qz: "0.20",
          scz: "31",
          df: "0.34",
        },
        {
          gjcs: "变频器温度2",
          edz: "25",
          yxfw: "<45",
          qz: "0.20",
          scz: "31",
          df: "0.90",
        },
        {
          gjcs: "变频器温度3",
          edz: "25",
          yxfw: "<45",
          qz: "0.20",
          scz: "30",
          df: "0.12",
        },
      ],
      scatterLineData: {
        data: [
          {
            title: "男",
            value: [
              [14.49, 1537.0],
              [5.78, 368.0],
              [5.08, 247.0],
              [4.79, 171.0],
              [4.05, 120.0],
              [3.17, 49.0],
              [2.45, 5.0],
              [2.93, 28.0],
              [2.55, 6.0],
              [2.39, -6.0],
              [1.51, 0.0],
              [1.21, 0.0],
              [9.85, 1233.0],
              [11.21, 1540.0],
              [11.15, 1554.0],
              [11.64, 1534.0],
              [11.44, 1531.0],
              [10.96, 1522.0],
              [10.23, 1540.0],
              [11.26, 816.0],
              [12.43, 673.0],
              [10.37, 693.0],
              [10.83, 715.0],
              [12.66, 718.0],
              [13.49, 739.0],
              [14.78, 732.0],
              [13.16, 1414.0],
              [14.48, 1532.0],
              [12.24, 1539.0],
              [11.48, 1535.0],
              [12.82, 1538.0],
              [11.93, 1547.0],
              [10.42, 1410.0],
              [10.05, 1532.0],
              [10.05, 1497.0],
              [10.07, 1486.0],
              [9.67, 1454.0],
              [11.3, 1419.0],
              [11.14, 1510.0],
              [10.77, 1538.0],
              [10.55, 1542.0],
              [10.43, 1517.0],
              [12.58, 1541.0],
              [11.05, 1551.0],
              [10.85, 1535.0],
              [11.87, 1540.0],
              [13.79, 1530.0],
              [13.63, 1537.0],
              [12.01, 1535.0],
              [12.12, 1532.0],
              [11.53, 1524.0],
              [10.62, 1541.0],
              [10.23, 1409.0],
              [10.89, 1541.0],
              [10.45, 1541.0],
              [11.59, 1536.0],
              [12.1, 1544.0],
              [11.83, 1534.0],
              [12.57, 1544.0],
              [10.88, 1538.0],
              [11.15, 1539.0],
              [11.37, 1536.0],
              [11.62, 1546.0],
              [11.98, 1537.0],
              [11.72, 1533.0],
              [10.92, 1530.0],
              [11.77, 1547.0],
              [10.46, 1414.0],
              [10.08, 1308.0],
              [10.82, 1487.0],
              [9.68, 1485.0],
              [10.13, 1279.0],
            ],
          },
        ],
        lineData: {
          xTitle: "风速",
          yTitle: "功率",
          legends: [],
          data: [
            [
              0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
              19, 20, 21, 22, 23, 24, 25,
            ],
            [
              0, 0, 0, 93.67, 98.38, 165, 295.84, 471.84, 648.28, 871.72,
              1124.84, 1296.42, 1448.63, 1548, 1548, 1548, 1548, 1548, 1548,
              1548, 1548, 1548, 1548, 1548, 1548, 1548,
            ],
          ],
        },
      },
      qrqc: [
        {
          xm: "发电机转速",
          xfqr: "1700",
          xfqc: "2000",
          dfqr: "0.35",
          dfqc: "1500",
        },
        {
          xm: "发电机转速",
          xfqr: "1700",
          xfqc: "2000",
          dfqr: "0.35",
          dfqc: "1500",
        },
      ],
      gzfltj: [
        {
          fl: "xxx",
          pc1: "1500",
          pc2: "1500",
          pc3: "1500",
          sc1: "1500",
          sc2: "1500",
          sc3: "1500",
        },
        {
          fl: "xxx",
          pc1: "1500",
          pc2: "1500",
          pc3: "1500",
          sc1: "1500",
          sc2: "1500",
          sc3: "1500",
        },
      ],
      dialogVisible: false, // 弹窗是否显示
      chartmap: {
        fdj: [
          {
            title: "发电机",
            yAxisIndex: 0,
            value: [],
          },
        ],
        clx: [
          {
            title: "齿轮箱",
            yAxisIndex: 0,
            value: [],
          },
        ],
        zk: [
          {
            title: "主轴",
            yAxisIndex: 0,
            value: [],
          },
        ],
        bj: [
          {
            title: "变桨",
            yAxisIndex: 0,
            value: [],
          },
        ],
      },
      djpg: [],
      fnlyl: [
        {
          name: "name",
          q1ysj: "1500",
          q2ysj: "1500",
          q3ysj: "1500",
        },
        {
          name: "name",
          q1ysj: "1500",
          q2ysj: "1500",
          q3ysj: "1500",
        },
      ],
      jczbmap: {},
      kkxfx: [
        {
          name: "name",
          q1ysj: "1500",
          q2ysj: "1500",
          q3ysj: "1500",
        },
        {
          name: "name",
          q1ysj: "1500",
          q2ysj: "1500",
          q3ysj: "1500",
        },
      ],
      fnlylItem: {},
      sbklylItem: {},
      reqData: {},
    };
  },

  props: {
    show: {
      type: Boolean,
      default: false,
    },
    params: {
      type: Boolean,
      default: () => {},
    },
  },
  created() {
    this.getReport();
  },
  beforeUpdate() {
    var that = this;
    that.$nextTick(() => {
      that.others();
    });
  },
  mounted() {
    this.dialogVisible = this.show;
  },
  methods: {
    others() {
      $(".bjyhdb .el-table__header-wrapper table .is-group tr").eq(1).remove();
    },
    yhmxdbMethod({ row, column, rowIndex, columnIndex }) {
      if (rowIndex < 8) {
        if (rowIndex === 0 && columnIndex === 0) {
          return [8, 1];
        } else if (rowIndex >= 1 && columnIndex === 0) {
          return [0, 0];
        }
      } else if (rowIndex >= 8 && rowIndex < 13) {
        if (rowIndex === 8 && columnIndex === 0) {
          return [5, 1];
        } else if (rowIndex >= 9 && columnIndex === 0) {
          return [0, 0];
        }
      } else if (rowIndex >= 13 && rowIndex < 27) {
        if (rowIndex === 13 && columnIndex === 0) {
          return [14, 1];
        } else if (rowIndex >= 14 && columnIndex === 0) {
          return [0, 0];
        }
      } else if (rowIndex >= 27 && rowIndex < 63) {
        if (rowIndex === 27 && columnIndex === 0) {
          return [36, 1];
        } else if (rowIndex >= 28 && columnIndex === 0) {
          return [0, 0];
        }
      } else if (rowIndex >= 63 && rowIndex < 78) {
        if (rowIndex === 63 && columnIndex === 0) {
          return [15, 1];
        } else if (rowIndex >= 64 && columnIndex === 0) {
          return [0, 0];
        }
      } else if (rowIndex >= 78 && rowIndex < 85) {
        if (rowIndex === 78 && columnIndex === 0) {
          return [7, 1];
        } else if (rowIndex >= 79 && columnIndex === 0) {
          return [0, 0];
        }
      } else if (rowIndex >= 85 && rowIndex < 88) {
        if (rowIndex === 85 && columnIndex === 0) {
          return [3, 1];
        } else if (rowIndex >= 86 && columnIndex === 0) {
          return [0, 0];
        }
      }
    },
    // 导出PDF
    exportPDF(name) {
      this.BASE.showMsg({
        type: "success",
        msg: "正在导出...请稍后...",
      });
      Get_PDF.downloadPDF(
        document.querySelector(".pdfDom"),
        "健康评价报告概述"
      );
    },

    // 关闭弹窗
    dialogClosed() {
      this.dialogVisible = false;
      this.$emit("closed", false);
    },

    // 改变列颜色
    columnStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        return "background:rgb(204,255,255);";
      }
    },

    // 获取报告详情
    getReport(wtid, recorddate) {
      if (!wtid) {
        return;
      }

      // wtid = "SXJ_KGDL_ZK_F_WT_0048_EQ";
      // recorddate = "2023-05-18";

      api
        .getAlarmcountVoList({
          wtId: wtid,
          recordDate: recorddate,
        })
        .then((res) => {
          this.alarmcountVoList = res.data;
        });

      api
        .healthreportHealthReport({
          wtid: wtid,
          date: recorddate,
        })
        .then((res) => {
          if (res.code == 200) {
            this.reportInfo1 = res.data;
          }
        });

      // 获得健康报告指标列表信息
      axios({
        baseURL: process.env.VUE_APP_NEW_WISDOM,
        url: `/health/getconHealthReportTargetMap?wtId=${wtid}&recordDate=${recorddate}`,
      }).then((res) => {
        if (res.data.code === 200) {
          const data = res.data.data;
          this.ls1 = data.ls1 || [];
          this.ls2 = data.ls2 || [];
          this.ls3 = data.ls3 || [];
        }
      });

      // 获得等级评估结果
      axios({
        baseURL: process.env.VUE_APP_NEW_WISDOM,
        url: `/health/getEquipmentInfoDayTopVoList?wtId=${wtid}&recordDate=${recorddate}`,
      }).then((res) => {
        if (res.data.code === 200) {
          const data = res.data.data;

          let datas = {};
          let pjmxs = [
            {
              indicator: [],
              data: [
                {
                  name: data[0].wtName,
                  value: [],
                },
              ],
            },
          ];
          data?.forEach((ele) => {
            for (let key in ele) {
              if (key !== "topls") {
                datas[key] = ele[key];
              }
            }
          });

          data?.[0].topls?.forEach((ele) => {
            if (ele.types) {
              pjmxs[0].indicator.push(ele.targetName);
              pjmxs[0].data[0].value.push(ele.num);
            }
          });

          datas.year = recorddate.split("-")[0];
          datas.month = recorddate.split("-")[1];
          this.xnpjmx = data?.[0].topls || [];
          this.datas = datas;
          this.pjmxs = pjmxs;
        }
      });

      // 获取隐患模型对比
      axios({
        baseURL: process.env.VUE_APP_NEW_WISDOM,
        url: `/health/getAlarmcountVoList?wtId=${wtid}&recordDate=${recorddate}`,
      }).then((res) => {
        if (res.data.code === 200) {
          this.yjmxdb = res.data.data;
        }
      });

      // 获取曲线拟合及偏差率折线图
      axios({
        baseURL: process.env.VUE_APP_NEW_WISDOM,
        url: `/health/getHealthReportQxpc?wtId=${wtid}&recordDate=${recorddate}`,
      }).then((res) => {
        if (res.data.code === 200) {
          let glqxnh = [];

          let lineChartItem = {
            title: "曲线偏差率",
            smooth: true,
            value: [],
          };

          res.data.data?.forEach((ele) => {
            lineChartItem.value.push({
              text: new Date(ele.recordDate).formatDate("yyyy-MM-dd hh:mm:ss"),
              value: ele.value || 0,
            });
          });

          glqxnh.push(lineChartItem);

          this.glqxnh = glqxnh;
        }
      });

      // 获取部件劣化状态
      axios({
        baseURL: process.env.VUE_APP_NEW_WISDOM,
        url: `/health/getHealthNumVoList?wtId=${wtid}&recordDate=${recorddate}`,
      }).then((res) => {
        if (res.data.code === 200) {
          let bjlhzt = {
            fdj: 0,
            clx: 0,
            bj: 0,
            zz: 0,
          };
          res.data.data.forEach((ele) => {
            for (let key in bjlhzt) {
              bjlhzt[key] += ele[key] || 0;
            }
          });

          bjlhzt.tableData = res.data.data || [];
          this.bjlhzt = bjlhzt;
        }
      });

      // 获取部件劣化状态发电机、齿轮箱、主轴、变桨折线图
      [
        { key: "fdjLineChartOptions", title: "发电机" },
        { key: "clxLineChartOptions", title: "齿轮箱" },
        { key: "zzLineChartOptions", title: "主轴" },
        { key: "bjLineChartOptions", title: "变桨" },
      ].forEach((item) => {
        const key = item.key;
        const title = item.title;

        axios({
          baseURL: process.env.VUE_APP_NEW_WISDOM,
          url: `/health/getHealthDataVlueVo?wtId=${wtid}&recordDate=${recorddate}&type=${
            key.split("LineChart")[0]
          }`,
        }).then((res) => {
          if (res.data.code === 200) {
            let chartOptions = [];

            let lineChartItem = {
              title: `${title}健康趋势`,
              smooth: true,
              value: [],
            };

            res.data.data?.forEach((ele) => {
              lineChartItem.value.push({
                text: new Date(ele.recordDate).formatDate(
                  "yyyy-MM-dd hh:mm:ss"
                ),
                value: ele.value || 0,
              });
            });

            chartOptions.push(lineChartItem);

            this[key] = chartOptions;
          }
        });
      });

      // 获取推荐检修方案
      axios({
        baseURL: process.env.VUE_APP_NEW_WISDOM,
        url: `/health/getStateJudgment?wtId=${wtid}&recordDate=${recorddate}`,
      }).then((res) => {
        if (res.data.code === 200) {
          this.tjjxfa = res.data.data;
        }
      });
    },
    // 对象排序
    compare(prop) {
      return function (obj1, obj2) {
        var val1 = obj1[prop];
        var val2 = obj2[prop];
        if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
          val1 = Number(val1);
          val2 = Number(val2);
        }
        return val1 > val2 ? -1 : val1 < val2 ? 1 : 0;
      };
    },
  },

  watch: {
    show(value) {
      this.dialogVisible = value;
      // if (value) {
      //   this.datas();
      // }
    },
    params(res) {
      this.reqData = res;
    },
  },
};
</script>

<style lang="less" scoped>
.cDialog {
  position: relative;

  .pdfDom {
    padding: 30px 50px;
  }

  .title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
  }

  .tableBox {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .l,
    .r {
      width: 49%;
      align-self: flex-start;
    }

    .fw {
      font-weight: 700;
    }
  }

  .infoBox {
    margin-top: 10px;
    font-size: 16px;

    .red {
      color: #f25656;
    }

    .purple {
      color: rgb(112, 88, 209);
    }

    .info {
      color: #1595fa;
    }

    p {
      text-indent: 2em;
    }
  }

  .textBox {
    width: 100%;
    margin-top: 10px;
    font-size: 16px;
  }
}

.logHead {
  display: flex;
  width: 100%;
  height: 40px;
  line-height: 40px;
  background: rgba(96, 103, 105, 0.6);
  color: #ffffff;
  justify-content: center;
  margin-top: 15px;
}

.border-b {
  border-bottom: 1px solid #c0ccda;
}

.p-5 {
  padding: 5px;
}

.m-b-10 {
  margin-bottom: 10px;
}

.text-indent-2 {
  text-indent: 2em;
}

.text-indent-4 {
  text-indent: 4em;
}
</style>

<style lang="less">
.cDialog {
  .cell {
    text-align: center;
  }

  .el-dialog__body {
    max-height: 850px;
    overflow-y: scroll;
    padding: 0;
  }

  .el-form-item.imp {
    .el-form-item__content {
      font-size: 24px;
    }
  }

  .el-form-item {
    margin-bottom: 0;
  }

  .el-table td {
    color: black;
  }

  .tableBox {
    .el-table .sort-caret.ascending {
      border-bottom-color: #000;
    }
    .el-table .sort-caret.descending {
      border-top-color: #000;
    }

    .el-table .ascending .sort-caret.ascending {
      border-bottom-color: #05bb4c;
    }
    .el-table .descending .sort-caret.descending {
      border-top-color: #05bb4c;
    }
  }
}
</style>
