yardBenchmark.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. import * as echarts from "echarts";
  2. export default {
  3. data() {
  4. return {
  5. FClist: {
  6. name: "",
  7. id: "",
  8. },
  9. fdcName1: "",
  10. fdcName2: "",
  11. date1: "2021-01-01",
  12. date2: "2020-01-03",
  13. wp_n_1: {},
  14. wp_n_2: {},
  15. selectrowdate: {},
  16. histogram: {
  17. date: [],
  18. xdss: [],
  19. gzss: [],
  20. jxss: [],
  21. xnss: [],
  22. slss: [],
  23. },
  24. wpId: [],
  25. wpName: [],
  26. lineDataOption: [],
  27. beginDate: "2021-01-01",
  28. endDate: "2021-01-03",
  29. fc: "",
  30. tableData: [],
  31. dialogTableVisible: false,
  32. getChartDataValue: [],
  33. getChartDataValue2: [],
  34. getTableData: [],
  35. };
  36. },
  37. methods: {
  38. dialog() {
  39. this.dialogTableVisible = true;
  40. this.check_wpid();
  41. this.$nextTick(function () {
  42. this.drawleidatu();
  43. this.drawhistogram_n();
  44. });
  45. },
  46. headStyle() {
  47. return "text-align:left";
  48. },
  49. check_wpid() {
  50. this.wp_n_1 = "";
  51. this.wp_n_2 = "";
  52. this.fdcName1 = "";
  53. this.fdcName2 = "";
  54. this.getChartDataValue = [];
  55. this.getChartDataValue2 = [];
  56. this.getTableData = [];
  57. if (Object.keys(this.selectrowdate).length != 2) {
  58. this.alert_jg();
  59. return;
  60. } else {
  61. this.wp_n_1 = this.selectrowdate[0];
  62. this.wp_n_2 = this.selectrowdate[1];
  63. this.fdcName1 = this.wp_n_1.wpId;
  64. this.fdcName2 = this.wp_n_2.wpId;
  65. this.getChartDataValue.push(
  66. this.wp_n_1.fnlyl,
  67. this.wp_n_1.gzssl,
  68. this.wp_n_1.jxssl,
  69. this.wp_n_1.qfl,
  70. this.wp_n_1.xnssl,
  71. this.wp_n_1.slssl,
  72. this.wp_n_1.fwjsl,
  73. this.wp_n_1.ztzhl,
  74. this.wp_n_1.xqjsl
  75. );
  76. this.getChartDataValue2.push(
  77. this.wp_n_2.fnlyl,
  78. this.wp_n_2.gzssl,
  79. this.wp_n_2.jxssl,
  80. this.wp_n_2.qfl,
  81. this.wp_n_2.xnssl,
  82. this.wp_n_2.slssl,
  83. this.wp_n_2.fwjsl,
  84. this.wp_n_2.ztzhl,
  85. this.wp_n_2.xqjsl
  86. );
  87. this.getTableData.push({
  88. index: "发电量",
  89. data1: this.wp_n_1.scadafdl,
  90. data2: this.wp_n_2.scadafdl,
  91. });
  92. this.getTableData.push({
  93. index: "故障损失电量",
  94. data1: this.wp_n_1.gzss,
  95. data2: this.wp_n_2.gzss,
  96. });
  97. this.getTableData.push({
  98. index: "检修损失电量",
  99. data1: this.wp_n_1.jxssl,
  100. data2: this.wp_n_2.jxssl,
  101. });
  102. this.getTableData.push({
  103. index: "性能未达标损失电量",
  104. data1: this.wp_n_1.xnsslfraction,
  105. data2: this.wp_n_2.xnsslfraction,
  106. });
  107. this.getTableData.push({
  108. index: "受累损失电量",
  109. data1: this.wp_n_1.slss,
  110. data2: this.wp_n_2.slss,
  111. });
  112. this.getTableData.push({
  113. index: "风能利用率",
  114. data1: this.wp_n_1.fnlyl,
  115. data2: this.wp_n_2.fnlyl,
  116. });
  117. this.getTableData.push({
  118. index: "故障损失率",
  119. data1: this.wp_n_1.gzssl,
  120. data2: this.wp_n_2.gzssl,
  121. });
  122. this.getTableData.push({
  123. index: "检修损失率",
  124. data1: this.wp_n_1.jxssl,
  125. data2: this.wp_n_2.jxssl,
  126. });
  127. this.getTableData.push({
  128. index: "弃风率",
  129. data1: this.wp_n_1.qfl,
  130. data2: this.wp_n_2.qfl,
  131. });
  132. this.getTableData.push({
  133. index: "性能损失率",
  134. data1: this.wp_n_1.xnssl,
  135. data2: this.wp_n_2.xnssl,
  136. });
  137. this.getTableData.push({
  138. index: "受累损失率",
  139. data1: this.wp_n_1.slssl,
  140. data2: this.wp_n_2.slssl,
  141. });
  142. this.getTableData.push({
  143. index: "复位及时率",
  144. data1: this.wp_n_1.fwjsl,
  145. data2: this.wp_n_2.fwjsl,
  146. });
  147. this.getTableData.push({
  148. index: "消缺及时率",
  149. data1: this.wp_n_1.xqjsl,
  150. data2: this.wp_n_2.xqjsl,
  151. });
  152. this.getTableData.push({
  153. index: "状态转换率",
  154. data1: this.wp_n_1.ztzhjsl,
  155. data2: this.wp_n_2.ztzhjsl,
  156. });
  157. }
  158. },
  159. changeFun(val) {
  160. this.selectrowdate = val;
  161. },
  162. query_fc() {
  163. let that = this ;
  164. var newData = new Date();
  165. this.beginDate = this.BASE.getBzDate(newData,-1);
  166. this.endDate = this.BASE.getBzDate(newData,0);
  167. this.API.get("powercompare/windfarmAjax?").then((res) => {
  168. that.FClist = res.data;
  169. });
  170. },
  171. alert_jg() {
  172. this.$message({
  173. message: "只能选择两条数据",
  174. type: "warning",
  175. });
  176. return;
  177. },
  178. handleEdit(a, b) {
  179. this.wpId = [];
  180. this.lineDataOption = [];
  181. if (this.selectrowdate.length == 2) {
  182. for (let i = 0; i < this.selectrowdate.length; i++) {
  183. this.wpId.push(this.selectrowdate[i].wpId);
  184. this.wpName.push(this.selectrowdate[i].wpName);
  185. this.lineDataOption.push({
  186. id: this.selectrowdate[i].wpId,
  187. name: this.selectrowdate[i].wpName,
  188. });
  189. }
  190. this.$router.push({
  191. path: "/YardBenchmark_particulars",
  192. query: {
  193. wpId: this.wpId,
  194. beginDate: this.beginDate,
  195. endDate: this.endDate,
  196. wpName: this.wpName,
  197. select: this.lineDataOption,
  198. },
  199. });
  200. } else {
  201. this.lineDataOption.push({ id: b.wpId, name: b.wpName });
  202. this.$router.push({
  203. path: "/YardBenchmark_particulars",
  204. query: {
  205. wpId: b.wpId,
  206. beginDate: this.beginDate,
  207. endDate: this.endDate,
  208. wpName: b.wpName,
  209. select: this.lineDataOption,
  210. },
  211. });
  212. }
  213. },
  214. query_benchmarkWpList() {
  215. Object.assign(this.$data.histogram, this.$options.data().histogram);
  216. let that = this;
  217. var page = new URLSearchParams();
  218. page.append("wpId", this.fc);
  219. page.append("beginDate", this.beginDate);
  220. page.append("endDate", this.endDate);
  221. this.API.post("/contrast/benchmarkWpList", page).then((res) => {
  222. this.tableData = res.data;
  223. let len = this.tableData.length;
  224. for (let i = 0; i < len; i++) {
  225. that.histogram.date[i] = this.BASE.getBzDate(
  226. new Date(res.data[i].recordDate) / 1000,0
  227. );
  228. that.histogram.xdss[i] = res.data[i].xdss;
  229. that.histogram.gzss[i] = res.data[i].gzss;
  230. that.histogram.jxss[i] = res.data[i].whss;
  231. that.histogram.xnss[i] = res.data[i].qfss;
  232. that.histogram.slss[i] = res.data[i].slss;
  233. }
  234. this.drawhistogram();
  235. });
  236. },
  237. filter_date(cellValue) {
  238. let date = new Date(cellValue.recordDate);
  239. return this.BASE.getBzDate(date / 1000,0);
  240. },
  241. drawleidatu() {
  242. var chartDom = document.getElementById("leidatu");
  243. var myChart = echarts.init(chartDom);
  244. var option;
  245. option = {
  246. title: {
  247. text: "对标排名分析",
  248. left: 400,
  249. top: -5,
  250. textStyle: {
  251. fontSize: 13,
  252. },
  253. },
  254. grid: {
  255. top: "10%",
  256. left: "10%",
  257. right: "10%",
  258. bottom: "0",
  259. },
  260. tooltip: {},
  261. legend: {
  262. orient: "vertical",
  263. x: "left", //可设定图例在左、右、居中
  264. y: "0", //可设定图例在上、下、居中
  265. padding: [0, 50, 0, 0],
  266. },
  267. radar: {
  268. // shape: 'circle',
  269. name: {
  270. textStyle: {
  271. color: "#fff",
  272. backgroundColor: "#999",
  273. borderRadius: 3,
  274. padding: [3, 5],
  275. },
  276. },
  277. indicator: [
  278. { name: "风能利用率", max: 100 },
  279. { name: "故障损失率", max: 100 },
  280. { name: "检修损失率", max: 100 },
  281. { name: "弃风率", max: 100 },
  282. { name: "性能损失率", max: 100 },
  283. { name: "受累损失率", max: 100 },
  284. { name: "复位及时率", max: 100 },
  285. { name: "状态转换率", max: 100 },
  286. { name: "消缺及时率", max: 100 },
  287. ],
  288. },
  289. series: [
  290. {
  291. name: "预算 vs 开销(Budget vs spending)",
  292. type: "radar",
  293. // areaStyle: {normal: {}},
  294. data: [
  295. {
  296. value: this.getChartDataValue,
  297. name: this.BASE.getBzDate(new Date(this.wp_n_1.recordDate) / 1000,0),
  298. },
  299. {
  300. value: this.getChartDataValue2,
  301. name: this.BASE.getBzDate(new Date(this.wp_n_2.recordDate) / 1000,0),
  302. },
  303. ],
  304. },
  305. ],
  306. };
  307. option && myChart.setOption(option);
  308. },
  309. drawhistogram_n() {
  310. var chartDom = document.getElementById("histogram_n");
  311. var myChart = echarts.init(chartDom);
  312. var option;
  313. option = {
  314. tooltip: {
  315. trigger: "axis",
  316. axisPointer: {
  317. type: "cross",
  318. crossStyle: {
  319. color: "#999",
  320. },
  321. },
  322. },
  323. title: {
  324. text: "损失电量分析",
  325. left: 100,
  326. top: 8,
  327. textStyle: {
  328. fontSize: 13,
  329. },
  330. },
  331. grid: {
  332. top: "90",
  333. left: "10%",
  334. right: "10%",
  335. bottom: "30",
  336. },
  337. legend: {
  338. orient: "vertical",
  339. x: "right", //可设定图例在左、右、居中
  340. y: 0, //可设定图例在上、下、居中
  341. padding: [0, 50, 200, 0],
  342. data: [
  343. "限电损失电量(单位:万kwh)",
  344. "故障损失电量(单位:万kwh)",
  345. "检修损失电量(单位:万kwh)",
  346. "性能损失电量(单位:万kwh)",
  347. "受累损失电量(单位:万kwh)",
  348. ],
  349. },
  350. xAxis: [
  351. {
  352. type: "category",
  353. data: [
  354. this.BASE.getBzDate(new Date(this.wp_n_1.recordDate) / 1000,0),
  355. this.BASE.getBzDate(new Date(this.wp_n_2.recordDate) / 1000,0),
  356. ],
  357. axisPointer: {
  358. type: "shadow",
  359. },
  360. },
  361. ],
  362. yAxis: [
  363. {
  364. type: "value",
  365. name: "电量",
  366. interval: 50,
  367. axisLabel: {
  368. formatter: "{value} 万kw",
  369. },
  370. },
  371. ],
  372. series: [
  373. {
  374. name: "限电损失电量(单位:万kwh)",
  375. type: "bar",
  376. yAxisIndex: 0,
  377. data: [this.wp_n_1.xdss, this.wp_n_2.xdss],
  378. },
  379. {
  380. name: "故障损失电量(单位:万kwh)",
  381. type: "bar",
  382. yAxisIndex: 0,
  383. data: [this.wp_n_1.zzss, this.wp_n_2.gzss],
  384. },
  385. {
  386. name: "检修损失电量(单位:万kwh)",
  387. type: "bar",
  388. yAxisIndex: 0,
  389. data: [this.wp_n_1.jxss, this.wp_n_2.jxss],
  390. },
  391. {
  392. name: "性能损失电量(单位:万kwh)",
  393. type: "bar",
  394. yAxisIndex: 0,
  395. data: [this.wp_n_1.xnss, this.wp_n_2.xnss],
  396. },
  397. {
  398. name: "受累损失电量(单位:万kwh)",
  399. type: "bar",
  400. yAxisIndex: 0,
  401. data: [this.wp_n_1.slss, this.wp_n_2.slss],
  402. },
  403. ],
  404. };
  405. option && myChart.setOption(option);
  406. },
  407. drawhistogram() {
  408. var app = {};
  409. var chartDom = document.getElementById("histogram");
  410. var myChart = echarts.init(chartDom);
  411. var option;
  412. option = {
  413. title: {
  414. text: "损失电量分析",
  415. },
  416. tooltip: {
  417. trigger: "axis",
  418. axisPointer: {
  419. type: "shadow",
  420. },
  421. },
  422. legend: {
  423. data: [
  424. "限电损失电量(单位:万kwh)",
  425. "故障损失电量(单位:万kwh)",
  426. "检修损失电量(单位:万kwh)",
  427. "性能损失电量(单位:万kwh)",
  428. "受累损失电量(单位:万kwh)",
  429. ],
  430. },
  431. grid: {
  432. left: "3%",
  433. right: "4%",
  434. bottom: "3%",
  435. containLabel: true,
  436. },
  437. yAxis: {
  438. type: "value",
  439. boundaryGap: [0, 0.01],
  440. },
  441. xAxis: {
  442. type: "category",
  443. data: this.histogram.date,
  444. },
  445. series: [
  446. {
  447. name: "限电损失电量(单位:万kwh)",
  448. type: "bar",
  449. data: this.histogram.xdss,
  450. },
  451. {
  452. name: "故障损失电量(单位:万kwh)",
  453. type: "bar",
  454. data: this.histogram.gzss,
  455. },
  456. ,
  457. {
  458. name: "检修损失电量(单位:万kwh)",
  459. type: "bar",
  460. data: this.histogram.jxss,
  461. },
  462. {
  463. name: "性能损失电量(单位:万kwh)",
  464. type: "bar",
  465. data: this.histogram.xnss,
  466. },
  467. {
  468. name: "受累损失电量(单位:万kwh)",
  469. type: "bar",
  470. data: this.histogram.slss,
  471. },
  472. ],
  473. };
  474. option && myChart.setOption(option);
  475. },
  476. },
  477. mounted() {
  478. this.query_fc();
  479. this.query_benchmarkWpList();
  480. },
  481. };