reportDialog.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. <template>
  2. <div class="exportPDF">
  3. <el-button round size="mini" class="buttons" @click="savePdf"
  4. >导出PDF</el-button
  5. >
  6. <!-- <el-button round size="mini" class="buttons" @click="exportWord"
  7. >导出Word</el-button
  8. > -->
  9. </div>
  10. <div
  11. :class="showWhite ? 'monthReportWhite' : 'monthReport'"
  12. v-loading="loading"
  13. >
  14. <div class="dialogHeader">
  15. <span
  16. >{{ rowData?.windPowerStationName }}{{ dialogTitle }}号风机{{
  17. pickerTimerYear
  18. }}年{{ pickerTimerMonth }}月运行指标性能分析</span
  19. >
  20. </div>
  21. <div class="monthReportTable">
  22. <el-table :data="monthReportData" stripe size="mini" style="width: 100%">
  23. <el-table-column
  24. v-for="(item, index) in tableHeader"
  25. :key="index"
  26. :prop="item.field"
  27. :label="item.name"
  28. header-align="center"
  29. :align="item.field == 'name' ? 'left' : 'right'"
  30. :width="item.width"
  31. >
  32. </el-table-column>
  33. </el-table>
  34. </div>
  35. <div class="monthReportMsage">
  36. <div class="textIndent">
  37. 1.本月{{ rowData?.windPowerStationName
  38. }}{{ dialogTitle }}号风机风机设备利用小时数{{
  39. tableVal.byzb && (tableVal.byzb.lyxs || 0)
  40. }}小时、同比{{ tableVal.tqzb && (tableVal.tqzb.lyxs || 0) }}小时,
  41. 设备可利用率{{ tableVal.byzb && (tableVal.byzb.sbklyl || 0) }}%、同比{{
  42. tableVal.tqzb && (tableVal.tqzb.sbklyl || 0)
  43. }}%, 等效可用系数{{
  44. tableVal.byzb && (tableVal.byzb.dxklyxs || 0)
  45. }}%、同比{{ tableVal.tqzb && (tableVal.tqzb.dxklyxs || 0) }}%,
  46. 静风频率达到{{ tableVal.byzb && (tableVal.byzb.jfpl || 0) }}%、同比{{
  47. tableVal.tqzb && (tableVal.tqzb.jfpl || 0)
  48. }}%, 机组功率特性一致性系数达到{{
  49. tableVal.byzb && (tableVal.byzb.glyzxxs || 0)
  50. }}%、同比{{ tableVal.tqzb && (tableVal.tqzb.glyzxxs || 0) }}%。
  51. </div>
  52. <div class="textIndent">
  53. 2.{{ rowData?.windPowerStationName }}{{ dialogTitle }}风机{{
  54. pickerTimerYear
  55. }}年{{ pickerTimerMonth }}月平均风速{{
  56. tableVal.byzb && (tableVal.byzb.fs || 0)
  57. }}m/s、同比{{ tableVal.tqzb && (tableVal.tqzb.fs || 0) }}m/s,
  58. 小风平均切入风速{{
  59. tableVal.byzb && (tableVal.byzb.xfqr || 0)
  60. }}m/s、同比{{ tableVal.tqzb && (tableVal.tqzb.xfqr || 0) }}m/s,
  61. 有效风时数{{ tableVal.byzb && (tableVal.byzb.yxfss || 0) }}小时、同比{{
  62. tableVal.tqzb && (tableVal.tqzb.yxfss || 0)
  63. }}小时, 实际发电电量{{
  64. tableVal.byzb && (tableVal.byzb.fdl || 0)
  65. }}万kwh、同比{{ tableVal.tqzb && (tableVal.tqzb.fdl || 0) }}万kwh,
  66. 同比增长率{{
  67. tableVal.byzb && tableVal.tqzb && tableVal.tqzb.fdl > 0
  68. ? (
  69. ((tableVal.byzb.fdl - tableVal.tqzb.fdl) / tableVal.tqzb.fdl) *
  70. 100
  71. ).toFixed(2)
  72. : 0
  73. }}%,各项损失电量累计{{
  74. tableVal.byzb && (tableVal.byzb.llfdl - tableVal.byzb.fdl).toFixed(2)
  75. }}万kwh、 同比{{
  76. tableVal.byzb &&
  77. tableVal.tqzb &&
  78. (tableVal.tqzb.llfdl - tableVal.tqzb.fdl).toFixed(2)
  79. }}万kwh,同比增长率{{
  80. tableVal.byzb &&
  81. tableVal.tqzb &&
  82. tableVal.tqzb.llfdl - tableVal.tqzb.fdl > 0
  83. ? (
  84. ((tableVal.byzb.llfdl -
  85. tableVal.byzb.fdl -
  86. (tableVal.tqzb.llfdl - tableVal.tqzb.fdl)) /
  87. (tableVal.tqzb.llfdl - tableVal.tqzb.fdl)) *
  88. 100
  89. ).toFixed(2)
  90. : 0
  91. }}%, 理论发电量{{
  92. tableVal.byzb && tableVal.byzb.llfdl
  93. }}万kwh,实际发电量与理论发电量相差{{
  94. tableVal.tbzb && (tableVal.byzb.llfdl - tableVal.byzb.fdl).toFixed(2)
  95. }}万kwh。
  96. </div>
  97. <div class="textIndent">
  98. 3.本月静风频率{{
  99. tableVal.byzb && (tableVal.byzb.jfpl || 0)
  100. }}%,月累计待机小时{{
  101. tableVal.byzb && (tableVal.byzb.djxs || 0)
  102. }}小时,待机占比{{
  103. tableVal.byzb &&
  104. ((tableVal.byzb.djxs / tableVal.byzb.rlxs) * 100).toFixed(2)
  105. }}%。
  106. </div>
  107. </div>
  108. <div class="monthReportEcharts">
  109. <div id="ffEchart" style="width: 100%; height: 350px"></div>
  110. <div id="fiveEchart" style="width: 100%; height: 350px"></div>
  111. <!-- <div id="jfdjEchart" style="width: 100%; height: 350px"></div> -->
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import {
  117. getApisingleanalysisSub,
  118. getApisingleanalysisChart,
  119. } from "@/api/monthlyPerformanceAnalysis";
  120. import * as echarts from "echarts";
  121. import Get_PDF from "@/tools/htmlToPdf.js";
  122. // import { exportWord, getBase64Sync } from "@/tools/exportFile.js";
  123. import dayjs from "dayjs";
  124. import PizZip from "pizzip";
  125. import docxtemplater from "docxtemplater";
  126. import JSZipUtils from "jszip-utils";
  127. import { saveAs } from "file-saver";
  128. export default {
  129. data() {
  130. return {
  131. img0: "",
  132. img1: "",
  133. img2: "",
  134. showWhite: true,
  135. dialogTitle: "",
  136. pickerTimerYear: "",
  137. pickerTimerMonth: "",
  138. monthReportData: [],
  139. loading: false,
  140. tableHeader: [
  141. { name: "指标名称", field: "name", width: "270" },
  142. { name: "本月值", field: "byzb" },
  143. { name: "去年同期", field: "tqzb" },
  144. { name: "同比增长率(%)", field: "tbzb" },
  145. { name: "上月", field: "hqzb" },
  146. { name: "环比增长率(%)", field: "hbzb" },
  147. ],
  148. tabrow: {
  149. fdl: "实际发电量(万千瓦时)",
  150. fs: "平均风速(m/s)",
  151. gzss: "故障损失电量(万千瓦时)",
  152. jxss: "计划检修损失电量(万千瓦时)",
  153. xdss: "调度限电损失电量(万千瓦时)",
  154. xnss: "性能未达标损失电量(万千瓦时)",
  155. slss: "受累损失电量(万千瓦时)",
  156. llfdl: "理论发电量(万千瓦时)",
  157. gzxs: "故障停运时间(小时)",
  158. jxxs: "检修停运时间(小时)",
  159. djxs: "待机时间(小时)",
  160. zdxs: "通讯中断时间(小时)",
  161. yxxs: "并网时间(小时)",
  162. lyxs: "设备利用小时(小时)",
  163. sbklyl: "设备利用率(%)",
  164. dxklyxs: "等效可用系数(%)",
  165. xfqr: "小风切入风速(m/s)",
  166. glyzxxs: "功率特性一致性系数(%)",
  167. yxfss: "有效风时数(小时)",
  168. xfqrhgl: "小风切入合格率(%)",
  169. jfpl: "静风频率(%)",
  170. },
  171. tableVal: "",
  172. rowData: {},
  173. form: {},
  174. };
  175. },
  176. methods: {
  177. init(row) {
  178. this.monthReportData = [];
  179. this.tableVal = "";
  180. this.showWhite = true;
  181. this.rowData = row;
  182. this.getTableData(row);
  183. },
  184. changeModel() {
  185. this.showWhite = !this.showWhite;
  186. if (!this.showWhite) {
  187. document.querySelector(".monthReport").style.background = "#000";
  188. } else {
  189. document.querySelector(".monthReportWhite").style.background = "#fff";
  190. }
  191. this.getEchartsData(this.rowData);
  192. },
  193. savePdf() {
  194. let dom = "";
  195. if (!this.showWhite) {
  196. dom = document.querySelector(".monthReport");
  197. } else {
  198. dom = document.querySelector(".monthReportWhite");
  199. }
  200. Get_PDF.downloadPDF(
  201. dom,
  202. "运行指标性能分析报告" +
  203. dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
  204. this.showWhite
  205. );
  206. // exportWord(dom, "运行指标性能分析报告.docx", this.showWhite);
  207. },
  208. base64DataURLToArrayBuffer(dataURL) {
  209. const base64Regex = /^data:image\/(png|jpg|svg|svg\+xml);base64,/;
  210. if (!base64Regex.test(dataURL)) {
  211. return false;
  212. }
  213. const stringBase64 = dataURL.replace(base64Regex, "");
  214. let binaryString;
  215. if (typeof window !== "undefined") {
  216. binaryString = window.atob(stringBase64);
  217. } else {
  218. binaryString = new Buffer(stringBase64, "base64").toString("binary");
  219. }
  220. const len = binaryString.length;
  221. const bytes = new Uint8Array(len);
  222. for (let i = 0; i < len; i++) {
  223. const ascii = binaryString.charCodeAt(i);
  224. bytes[i] = ascii;
  225. }
  226. return bytes.buffer;
  227. },
  228. //点击按钮导出word (形参作为word发送到邮箱标识 无需考虑)
  229. exportWord(fileExport) {
  230. //这里要引入处理图片的插件,下载docxtemplater后,引入的就在其中了
  231. //编写docx模板 本文后续有文档模板语法教学
  232. var ImageModule = require("docxtemplater-image-module-free");
  233. var fs = require("fs");
  234. let _this = this;
  235. // 读取并获得模板文件的二进制内容,放在项目根目录public中即可
  236. JSZipUtils.getBinaryContent(
  237. "dataStatistics.docx",
  238. function (error, content) {
  239. if (error) {
  240. throw error;
  241. }
  242. // 图片处理
  243. let opts = {};
  244. opts = { centered: false };
  245. opts.getImage = (chartId) => {
  246. return _this.base64DataURLToArrayBuffer(chartId);
  247. };
  248. opts.getSize = function (img, tagValue, tagName) {
  249. //自定义指定图像大小,此处可动态调试各别图片的大小
  250. return [650, 300]; //例子:宽50px 高度100px
  251. };
  252. // 创建一个PizZip实例,内容为模板的内容
  253. let zip = new PizZip(content);
  254. // 创建并加载docxtemplater实例对象
  255. let doc = new docxtemplater();
  256. doc.attachModule(new ImageModule(opts));
  257. doc.loadZip(zip);
  258. // 设置模板变量的值
  259. doc.setData({
  260. dialogTitle: _this.dialogTitle,
  261. pickerTimerYear: _this.pickerTimerYear,
  262. pickerTimerMonth: _this.pickerTimerMonth,
  263. ..._this.articleParams, //详情内容字段(Object)
  264. table: _this.detailParams, //表格内容(Array)
  265. img0: _this.img0, // echarts图片
  266. img1: _this.img1,
  267. img2: _this.img2,
  268. monthReportData: _this.monthReportData,
  269. lyxs: _this.tableVal.byzb.lyxs,
  270. tplyxs: _this.tableVal.tqzb.lyxs,
  271. sbklyl: _this.tableVal.byzb.sbklyl,
  272. tpsbklyl: _this.tableVal.tqzb.sbklyl,
  273. dxklyxs: _this.tableVal.byzb.dxklyxs,
  274. tpdxklyxs: _this.tableVal.tqzb.dxklyxs,
  275. jfpl: _this.tableVal.byzb.jfpl,
  276. tpjfpl: _this.tableVal.tqzb.jfpl,
  277. glyzxxs: _this.tableVal.byzb.glyzxxs,
  278. tpglyzxxs: _this.tableVal.tqzb.glyzxxs,
  279. // fs: _this.tableVal.byzb.fs,
  280. // tpfs: _this.tableVal.tqzb.fs,
  281. // xfqr: _this.tableVal.byzb.xfqr,
  282. // tpxfqr: _this.tableVal.tqzb.xfqr,
  283. // yxfss : _this.tableVal.byzb.yxfss ,
  284. // tpyxfss : _this.tableVal.tqzb.yxfss ,
  285. // fdl: _this.tableVal.byzb.fdl,
  286. // tpfdl: _this.tableVal.tqzb.fdl,
  287. // tbfdl: _this.tableVal.tbzb.fdl,
  288. // ssfdl: _this.tableVal.byzb.llfdl - _this.tableVal.byzb.fdl,
  289. // tbsfdl: _this.tableVal.tqzb.llfdl - _this.tableVal.tqzb.fdl,
  290. // zzl: _this.tableVal.byzb.llfdl - _this.tableVal.tbzb.fdl,
  291. // llfdl: _this.tableVal.byzb.llfdl,
  292. // xcfdl: _this.tableVal.tbzb.llfdl,
  293. });
  294. try {
  295. // 用模板变量的值替换所有模板变量
  296. doc.render();
  297. } catch (error) {
  298. // 抛出异常
  299. let e = {
  300. message: error.message,
  301. name: error.name,
  302. stack: error.stack,
  303. properties: error.properties,
  304. };
  305. throw error;
  306. }
  307. // 生成一个代表docxtemplater对象的zip文件(不是一个真实的文件,而是在内存中的表示)
  308. let out = doc.getZip().generate({
  309. type: "blob",
  310. mimeType:
  311. "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  312. });
  313. //此文件流 可以传送到后端服务器生成二进制文件(包含上传到阿里云服务器)
  314. if (fileExport == "export") {
  315. let formData = new FormData(); //创建formdata来存文件
  316. const chunkfile = new File([out], "性能分析.docx");
  317. formData.append("file", chunkfile); //存入文件
  318. formData.append("toEmailList", _this.mailForm.toEmailList);
  319. formData.append("customSubject", _this.mailForm.customSubject);
  320. //formData文件 需注意此api请求方式 下文会描述
  321. dataDetailsEmailApi(formData).then((res) => {
  322. if (res.data.code == 200) {
  323. _this.$message.success("发送成功");
  324. }
  325. });
  326. } else {
  327. // 将目标文件对象保存为目标类型的文件,并命名
  328. saveAs(out, "性能分析.docx");
  329. }
  330. }
  331. );
  332. },
  333. async getTableData(row) {
  334. this.loading = true;
  335. let params = {
  336. wtId: row.windturbineid,
  337. year: this.pickerTimerYear,
  338. month: this.pickerTimerMonth,
  339. };
  340. const { data: datas } = await getApisingleanalysisSub(params);
  341. this.tableVal = datas.data;
  342. let arr = [];
  343. let keyarr = Object.keys(datas.data.byzb);
  344. let jarr = Object.keys(datas.data);
  345. for (let k of keyarr) {
  346. let obj = {
  347. name: k,
  348. byzb: null,
  349. hbzb: null,
  350. hqzb: null,
  351. tbzb: null,
  352. tqzb: null,
  353. };
  354. for (let i in datas.data) {
  355. for (let j of jarr) {
  356. if (i == j) {
  357. obj[j] = datas.data[i][k] || 0;
  358. }
  359. }
  360. }
  361. if (k != "tjxs") {
  362. arr.push(obj);
  363. }
  364. }
  365. console.log(arr);
  366. arr = arr.filter((e) => {
  367. return (
  368. e.name != undefined &&
  369. e.name != "wtcode" &&
  370. e.name != "id" &&
  371. e.name != "windturbineid" &&
  372. e.name != "companyId" &&
  373. e.name != "types" &&
  374. e.name != "windturbineName" &&
  375. e.name != "windPowerStationId" &&
  376. e.name != "windPowerStationName" &&
  377. e.name != "recorddate" &&
  378. e.name != "swdl" &&
  379. e.name != "gwdl" &&
  380. e.name != "rlxs" &&
  381. e.name != "fjrl"
  382. );
  383. });
  384. console.log(arr);
  385. arr.forEach((e) => {
  386. e.name = this.tabrow[e.name];
  387. });
  388. this.monthReportData = arr;
  389. this.getEchartsData(row);
  390. },
  391. async getEchartsData(row) {
  392. let params = {
  393. wtId: row.windturbineid,
  394. year: this.pickerTimerYear,
  395. month: this.pickerTimerMonth,
  396. };
  397. const { data: datas } = await getApisingleanalysisChart(params);
  398. const res = datas;
  399. // 日发电量与风速
  400. this.makePowerAndWind(res);
  401. // 五项损失
  402. this.makeFiveBarEchart(res);
  403. //静风频率和待机时间
  404. // this.makeQuietAirStandby(res);
  405. this.loading = false;
  406. },
  407. //日发电量与风速----数据整体与展示
  408. makePowerAndWind(res) {
  409. let arrfffdl = [];
  410. let arrfffs = [];
  411. let xAxis = [];
  412. res.ff.forEach((e) => {
  413. let date = e.recorddate;
  414. xAxis.push(date);
  415. let objfdl = {
  416. name: "日发电量",
  417. value: e.fdl,
  418. itemStyle: {
  419. color: "#1c99ff",
  420. },
  421. };
  422. let objfs = {
  423. name: "风速",
  424. value: e.fs,
  425. itemStyle: {
  426. color: "#dcc652",
  427. },
  428. };
  429. arrfffdl.push(objfdl);
  430. arrfffs.push(objfs);
  431. });
  432. this.getPowerAndWind(xAxis, arrfffdl, arrfffs);
  433. },
  434. getPowerAndWind(xAxis, barData, lineData) {
  435. let option = {
  436. backgroundColor: this.showWhite ? "#fff" : "",
  437. color: ["#1c99ff", "#dcc652"],
  438. title: {
  439. text: "日发电量",
  440. textStyle: {
  441. color: this.showWhite ? "#000" : "#fff",
  442. },
  443. },
  444. tooltip: {
  445. trigger: "axis",
  446. },
  447. legend: {
  448. right: "20",
  449. data: ["日发电量", "风速"],
  450. textStyle: {
  451. color: this.showWhite ? "#000" : "#fff",
  452. },
  453. },
  454. xAxis: [
  455. {
  456. type: "category",
  457. data: xAxis,
  458. axisLabel: {
  459. color: this.showWhite ? "#000" : "#fff",
  460. },
  461. },
  462. ],
  463. yAxis: [
  464. {
  465. type: "value",
  466. name: "日发电量(kWh)",
  467. // min: 0,
  468. // max: 250,
  469. // interval: 50,
  470. nameTextStyle: {
  471. color: this.showWhite ? "#000" : "#fff",
  472. },
  473. axisLabel: {
  474. color: this.showWhite ? "#000" : "#fff",
  475. formatter: "{value}",
  476. },
  477. },
  478. {
  479. type: "value",
  480. name: "风速(m/s)",
  481. nameTextStyle: {
  482. color: this.showWhite ? "#000" : "#fff",
  483. },
  484. axisLabel: {
  485. color: this.showWhite ? "#000" : "#fff",
  486. formatter: "{value}",
  487. },
  488. },
  489. ],
  490. series: [
  491. {
  492. name: "日发电量",
  493. type: "bar",
  494. barWidth: 25,
  495. yAxisIndex: 0,
  496. data: barData,
  497. },
  498. {
  499. name: "风速",
  500. type: "line",
  501. yAxisIndex: 1,
  502. data: lineData,
  503. },
  504. ],
  505. };
  506. // 基于准备好的dom,初始化echarts实例
  507. let dom = document.getElementById("ffEchart");
  508. dom.removeAttribute("_echarts_instance_");
  509. let myChart = echarts.init(dom);
  510. myChart.setOption(option, this.showWhite ? "" : "dark");
  511. this.img0 = myChart.getDataURL({
  512. pixelRatio: 1, // 导出的图片分辨率比例,默认为 1。
  513. backgroundColor: "#ffffff", // 导出的图片背景色,默认使用 option 里的 backgroundColor
  514. });
  515. window.addEventListener("resize", function () {
  516. myChart.resize();
  517. });
  518. },
  519. //五项损失
  520. makeFiveBarEchart(res) {
  521. let arrwslegend = [
  522. "检修损失电量",
  523. "故障损失电量",
  524. "限电损失电量",
  525. "受累损失电量",
  526. "性能未达标损失电量",
  527. ];
  528. let arrwsdata = [
  529. {
  530. name: "检修损失电量",
  531. type: "bar",
  532. stack: "one",
  533. barWidth: "25",
  534. data: res.ws.map((i) => i.jxss),
  535. },
  536. {
  537. name: "故障损失电量",
  538. type: "bar",
  539. stack: "one",
  540. barWidth: "25",
  541. data: res.ws.map((i) => i.gzss),
  542. },
  543. {
  544. name: "限电损失电量",
  545. type: "bar",
  546. stack: "one",
  547. barWidth: "25",
  548. data: res.ws.map((i) => i.xdss),
  549. },
  550. {
  551. name: "受累损失电量",
  552. type: "bar",
  553. stack: "one",
  554. barWidth: "25",
  555. data: res.ws.map((i) => i.slss),
  556. },
  557. {
  558. name: "性能未达标损失电量",
  559. type: "bar",
  560. stack: "one",
  561. barWidth: "25",
  562. data: res.ws.map((i) => i.xnss),
  563. },
  564. ];
  565. let xAxis = res.ws.map((i) => dayjs(i.recorddate).format("YYYY-MM-DD"));
  566. this.getFiveBarEchart(xAxis, arrwslegend, arrwsdata);
  567. },
  568. getFiveBarEchart(xAxis, lenged, series) {
  569. let option = {
  570. backgroundColor: this.showWhite ? "#fff" : "",
  571. color: ["#e17e23", "#ba3237", "#c531c7", "#000", "#05bb4c"],
  572. title: {
  573. text: "损失电量分析",
  574. textStyle: {
  575. color: this.showWhite ? "#000" : "#fff",
  576. },
  577. },
  578. tooltip: {
  579. trigger: "axis",
  580. textStyle: {
  581. color: this.showWhite ? "#000" : "#fff",
  582. },
  583. },
  584. legend: {
  585. data: lenged,
  586. right: 20,
  587. textStyle: {
  588. color: this.showWhite ? "#000" : "#fff",
  589. },
  590. },
  591. xAxis: [
  592. {
  593. type: "category",
  594. axisLabel: {
  595. color: this.showWhite ? "#000" : "#fff",
  596. },
  597. data: xAxis,
  598. },
  599. ],
  600. yAxis: [
  601. {
  602. type: "value",
  603. name: "kWh",
  604. nameTextStyle: {
  605. color: this.showWhite ? "#000" : "#fff",
  606. },
  607. axisLabel: {
  608. color: this.showWhite ? "#000" : "#fff",
  609. },
  610. },
  611. ],
  612. series: series,
  613. };
  614. // 基于准备好的dom,初始化echarts实例
  615. let dom = document.getElementById("fiveEchart");
  616. dom.removeAttribute("_echarts_instance_");
  617. let myChart = echarts.init(dom);
  618. myChart.setOption(option, this.showWhite ? "" : "dark");
  619. setTimeout(() => {
  620. this.img1 = myChart.getDataURL({
  621. pixelRatio: 1, // 导出的图片分辨率比例,默认为 1。
  622. backgroundColor: "#ffffff", // 导出的图片背景色,默认使用 option 里的 backgroundColor
  623. });
  624. }, 2000);
  625. window.addEventListener("resize", function () {
  626. myChart.resize();
  627. });
  628. },
  629. //静风频率和待机时间
  630. makeQuietAirStandby(res) {
  631. // let arrjdjf = [];
  632. // let arrjddj = [];
  633. // let xAxis = [];
  634. // let series = [];
  635. // res.jd.forEach((e) => {
  636. // series;
  637. // let date = e.recorddate.substring(
  638. // e.recorddate.indexOf("-") + 1,
  639. // e.recorddate.indexOf("T")
  640. // );
  641. // xAxis.push(date);
  642. // arrjdjf.push(e.jfpl);
  643. // arrjddj.push(e.tjxs);
  644. // });
  645. // let obj = {
  646. // title: "静风时长(小时)",
  647. // type: "line",
  648. // value: arrjdjf,
  649. // };
  650. // series.push(obj);
  651. // let obj1 = {
  652. // title: "待机时长(小时)",
  653. // type: "line",
  654. // value: arrjddj,
  655. // };
  656. // series.push(obj1);
  657. // this.getQuietAirStandbyLineEchart(xAxis, series);
  658. },
  659. getQuietAirStandbyLineEchart(xAxis, series) {
  660. let option = {
  661. backgroundColor: this.showWhite ? "#fff" : "",
  662. color: ["#05bb4c", "#4b55ae"],
  663. title: {
  664. text: "损失电量分析",
  665. textAlign: "left",
  666. textStyle: {
  667. color: this.showWhite ? "#000" : "#fff",
  668. },
  669. },
  670. tooltip: {
  671. trigger: "axis",
  672. },
  673. legend: {
  674. right: "20",
  675. data: ["静风时长(小时)", "待机时长(小时)"],
  676. },
  677. xAxis: {
  678. type: "category",
  679. boundaryGap: false,
  680. data: xAxis,
  681. },
  682. yAxis: {
  683. type: "value",
  684. },
  685. series: series,
  686. };
  687. // 基于准备好的dom,初始化echarts实例
  688. let dom = document.getElementById("jfdjEchart");
  689. dom.removeAttribute("_echarts_instance_");
  690. let myChart = echarts.init(dom, this.showWhite ? "" : "dark");
  691. myChart.setOption(option);
  692. this.img2 = myChart.getDataURL({
  693. pixelRatio: 2, // 导出的图片分辨率比例,默认为 1。
  694. backgroundColor: "#999999", // 导出的图片背景色,默认使用 option 里的 backgroundColor
  695. });
  696. window.addEventListener("resize", function () {
  697. myChart.resize();
  698. });
  699. },
  700. },
  701. };
  702. </script>
  703. <style lang="less">
  704. .exportPDF {
  705. float: right;
  706. margin-right: 35px;
  707. margin-top: 10px;
  708. .buttons {
  709. background-color: rgba(5, 187, 76, 1);
  710. border: 1px solid #3b6c53;
  711. color: #fff;
  712. font-size: 14px;
  713. border: none;
  714. width: 108px;
  715. min-height: 25px !important;
  716. // &:hover {
  717. // background-color: rgba(5, 187, 76, 0.6);
  718. // color: #000;
  719. // }
  720. }
  721. }
  722. .monthReport {
  723. padding: 0 23px;
  724. padding-top: 20px;
  725. .dialogHeader {
  726. text-align: center;
  727. color: #fff;
  728. font-weight: 600;
  729. font-size: 16px;
  730. margin-bottom: 40px;
  731. span {
  732. position: relative;
  733. left: 5%;
  734. }
  735. }
  736. .el-button {
  737. min-height: 25px;
  738. height: 25px;
  739. span {
  740. position: relative;
  741. top: -8px;
  742. }
  743. }
  744. .monthReportTable {
  745. margin: 10px;
  746. padding-bottom: 10px;
  747. background: rgba(0, 0, 0, 0.4);
  748. }
  749. .monthReportMsage {
  750. .textIndent {
  751. color: #fff;
  752. font-size: 16px;
  753. line-height: 30px;
  754. text-indent: 2em;
  755. }
  756. }
  757. .monthReportEcharts {
  758. margin-top: 20px;
  759. }
  760. .el-loading-mask {
  761. background-color: rgba(0, 0, 0, 1) !important;
  762. }
  763. }
  764. .monthReportWhite {
  765. padding: 0 23px;
  766. background: #fff;
  767. padding-top: 20px;
  768. .dialogHeader {
  769. text-align: center;
  770. color: #000;
  771. font-weight: 600;
  772. font-size: 16px;
  773. margin-bottom: 40px;
  774. span {
  775. position: relative;
  776. left: 5%;
  777. }
  778. }
  779. .el-button {
  780. min-height: 25px;
  781. height: 25px;
  782. span {
  783. position: relative;
  784. top: -8px;
  785. }
  786. }
  787. .monthReportTable {
  788. margin: 10px;
  789. padding-bottom: 10px;
  790. background: rgba(255, 255, 255, 0.4);
  791. .el-table th.el-table__cell {
  792. border-right: 0px !important;
  793. }
  794. .el-table__header-wrapper {
  795. .has-gutter {
  796. tr {
  797. color: #000;
  798. th {
  799. background: #9e9d9d;
  800. color: #000;
  801. font-weight: 700;
  802. }
  803. }
  804. }
  805. }
  806. .el-table__body-wrapper {
  807. .el-table__body {
  808. tr {
  809. td {
  810. color: #000;
  811. }
  812. // &.el-table__row--striped {
  813. // background: #464444;
  814. // }
  815. }
  816. }
  817. }
  818. }
  819. .monthReportMsage {
  820. .textIndent {
  821. color: #000;
  822. font-size: 16px;
  823. line-height: 30px;
  824. text-indent: 2em;
  825. }
  826. }
  827. .monthReportEcharts {
  828. margin-top: 20px;
  829. }
  830. .el-loading-mask {
  831. // background-color: rgba(0,0,0,1) !important;
  832. }
  833. }
  834. </style>