reportDialog.vue 25 KB

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