phdffx.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <div id="phdffx">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select v-model="wpId" clearable placeholder="请选择" popper-class="select" @change="(wpId) => { getTurbines() }">
  9. <el-option v-for="item in wpList" :key="item.id" :value="item.id" :label="item.name"></el-option>
  10. </el-select>
  11. </div>
  12. </div>
  13. <div class="query-item">
  14. <div class="lable">机组:</div>
  15. <div class="search-input">
  16. <el-select v-model="wtId" placeholder="请选择" popper-class="select">
  17. <el-option v-for="item in wtList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  18. </el-select>
  19. </div>
  20. </div>
  21. <div class="query-item">
  22. <div class="lable">开始日期:</div>
  23. <div class="search-input">
  24. <el-date-picker v-model="startDate" type="date" placeholder="开始日期" popper-class="date-select" value-format="YYYY-MM-DD"></el-date-picker>
  25. </div>
  26. </div>
  27. <div class="query-item">
  28. <div class="lable">结束日期:</div>
  29. <div class="search-input">
  30. <el-date-picker v-model="endDate" type="date" placeholder="开始日期" popper-class="date-select" value-format="YYYY-MM-DD"></el-date-picker>
  31. </div>
  32. </div>
  33. <div class="query-actions">
  34. <button class="btn green" @click="getCharts()">查询</button>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="mg-b-16">
  39. <panel :title="'偏航对风风速分析'" :showLine="false">
  40. <!-- <LineChart :list="statusData" :units="['']" :height="'220px'" /> -->
  41. <div class="chart" id="linechart1"></div>
  42. </panel>
  43. </div>
  44. <div class="mg-b-16">
  45. <panel :title="'偏航对风功率分析'" :showLine="false">
  46. <div class="chart" id="linechart2"></div>
  47. </panel>
  48. </div>
  49. <div class="mg-b-16">
  50. <panel :title="'偏航对风分析'" :showLine="false">
  51. <div class="chart" id="linechart3"></div>
  52. </panel>
  53. </div>
  54. <el-dialog :title="'偏航对风分析明细'" v-model="dialogShow" width="80%" top="10vh" custom-class="modal dBody" :close-on-click-modal="true">
  55. <div class="chart" id="linechartDialog"></div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import LineChart from "../../components/chart/line/normal-line-chart.vue";
  61. import Panel from "../../components/coms/panel/panel.vue";
  62. import util from "@/helper/util.js";
  63. import partten from "@/helper/partten.js";
  64. import * as echarts from "echarts";
  65. export default {
  66. name: "phdffx",
  67. components: { LineChart, Panel },
  68. data() {
  69. return {
  70. wpList: [],
  71. wpId: "MHS_FDC",
  72. wtList: [],
  73. wtId: "MG01_01",
  74. startDate: "",
  75. endDate: "",
  76. line1XData: [],
  77. line2XData: [],
  78. dialogShow: false,
  79. };
  80. },
  81. created() {
  82. this.getStations();
  83. this.getTurbines();
  84. let end = new Date();
  85. let start = new Date();
  86. start.setDate(1);
  87. this.endDate = end.formatDate("yyyy-MM-dd");
  88. this.startDate = start.formatDate("yyyy-MM-dd");
  89. this.getCharts();
  90. },
  91. methods: {
  92. // 场站
  93. async getStations() {
  94. const res = await this.API.requestData({
  95. method: "GET",
  96. baseURL: "http://10.155.32.4:9001/",
  97. subUrl: "benchmarking/wplist",
  98. });
  99. this.wpList = res.data.data;
  100. // this.wpId = res.data.data[0].id;
  101. },
  102. async getTurbines() {
  103. const res = await this.API.requestData({
  104. method: "GET",
  105. subUrl: "powercompare/windturbineAjax",
  106. data: { wpId: this.wpId },
  107. });
  108. this.wtList = res.data.data;
  109. this.wtId = res.data.data[0].id;
  110. },
  111. getCharts() {
  112. this.getChart1();
  113. this.getChart2();
  114. this.getChart3();
  115. },
  116. async getChart1() {
  117. const res = await this.API.requestData({
  118. method: "POST",
  119. subUrl: "yaw/getPassRate",
  120. data: {
  121. wtId: this.wtId,
  122. beginDate: this.startDate,
  123. endDate: this.endDate,
  124. type: 2,
  125. },
  126. });
  127. if (res && res.data && res.data.data) {
  128. const xData = [];
  129. const lData = [];
  130. res.data.data.forEach((e) => {
  131. xData.push(e.speed);
  132. lData.push(e.passrate);
  133. });
  134. this.line1XData = xData;
  135. let option = {
  136. color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
  137. tooltip: {
  138. trigger: "axis",
  139. backgroundColor: "rgba(0,0,0,0.4)",
  140. borderColor: partten.getColor("gray"),
  141. textStyle: {
  142. color: "#fff",
  143. fontSize: util.vh(16),
  144. },
  145. },
  146. legend: {
  147. show: false,
  148. data: ["合格率(%)"],
  149. right: 56,
  150. icon: "circle",
  151. itemWidth: 6,
  152. inactiveColor: "#606769",
  153. textStyle: {
  154. color: partten.getColor("grayl"),
  155. fontSize: 12,
  156. },
  157. },
  158. grid: {
  159. top: util.vh(40),
  160. left: util.vh(60),
  161. right: util.vh(100),
  162. bottom: util.vh(24),
  163. },
  164. xAxis: [
  165. {
  166. name: "风速(m/s)",
  167. type: "category",
  168. boundaryGap: false,
  169. axisLabel: {
  170. formatter: "{value}",
  171. fontSize: util.vh(14),
  172. textStyle: {
  173. color: partten.getColor("gray"),
  174. },
  175. },
  176. data: xData,
  177. },
  178. ],
  179. yAxis: [
  180. {
  181. type: "value",
  182. name: "合格率(%)",
  183. axisLabel: {
  184. formatter: "{value}",
  185. fontSize: util.vh(14),
  186. },
  187. splitLine: {
  188. lineStyle: {
  189. color: partten.getColor("gray") + 55,
  190. type: "dashed",
  191. },
  192. },
  193. },
  194. ],
  195. series: [
  196. {
  197. name: "合格率",
  198. type: "line",
  199. smooth: true,
  200. zlevel: 0,
  201. lineStyle: {
  202. normal: {
  203. color: "#05bb4c",
  204. width: 1,
  205. },
  206. },
  207. yAxisIndex: 0,
  208. data: lData,
  209. },
  210. ],
  211. };
  212. const chart = echarts.init(document.getElementById("linechart1"));
  213. chart.clear();
  214. chart.setOption(option);
  215. this.resize = function () {
  216. chart.resize();
  217. };
  218. chart.getZr().off("click");
  219. chart.getZr().on("click", (params) => {
  220. const pointInPixel = [params.offsetX, params.offsetY];
  221. if (chart.containPixel("grid", pointInPixel)) {
  222. let xIndex = chart.convertFromPixel({ seriesIndex: 0 }, [
  223. params.offsetX,
  224. params.offsetY,
  225. ])[0];
  226. // 图标点击事件
  227. this.showDetail("2", this.line1XData[xIndex]);
  228. }
  229. });
  230. window.addEventListener("resize", this.resize);
  231. }
  232. },
  233. async getChart2() {
  234. const res = await this.API.requestData({
  235. method: "POST",
  236. subUrl: "yaw/getPassRate",
  237. data: {
  238. wtId: this.wtId,
  239. beginDate: this.startDate,
  240. endDate: this.endDate,
  241. type: 1,
  242. },
  243. });
  244. if (res && res.data && res.data.data) {
  245. const xData = [];
  246. const lData = [];
  247. res.data.data.forEach((e) => {
  248. xData.push(e.power);
  249. lData.push(e.passrate);
  250. });
  251. this.line2XData = xData;
  252. let option = {
  253. color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
  254. tooltip: {
  255. trigger: "axis",
  256. backgroundColor: "rgba(0,0,0,0.4)",
  257. borderColor: partten.getColor("gray"),
  258. textStyle: {
  259. color: "#fff",
  260. fontSize: util.vh(16),
  261. },
  262. },
  263. legend: {
  264. show: false,
  265. data: ["合格率(%)"],
  266. right: 56,
  267. icon: "circle",
  268. itemWidth: 6,
  269. inactiveColor: "#606769",
  270. textStyle: {
  271. color: partten.getColor("grayl"),
  272. fontSize: 12,
  273. },
  274. },
  275. grid: {
  276. top: util.vh(40),
  277. left: util.vh(60),
  278. right: util.vh(100),
  279. bottom: util.vh(24),
  280. },
  281. xAxis: [
  282. {
  283. name: "功率(kW)",
  284. type: "category",
  285. boundaryGap: false,
  286. axisLabel: {
  287. formatter: "{value}",
  288. fontSize: util.vh(14),
  289. textStyle: {
  290. color: partten.getColor("gray"),
  291. },
  292. },
  293. data: xData,
  294. },
  295. ],
  296. yAxis: [
  297. {
  298. type: "value",
  299. name: "合格率(%)",
  300. axisLabel: {
  301. formatter: "{value}",
  302. fontSize: util.vh(14),
  303. },
  304. splitLine: {
  305. lineStyle: {
  306. color: partten.getColor("gray") + 55,
  307. type: "dashed",
  308. },
  309. },
  310. },
  311. ],
  312. series: [
  313. {
  314. name: "合格率",
  315. type: "line",
  316. smooth: true,
  317. zlevel: 0,
  318. lineStyle: {
  319. normal: {
  320. color: "#05bb4c",
  321. width: 1,
  322. },
  323. },
  324. yAxisIndex: 0,
  325. data: lData,
  326. },
  327. ],
  328. };
  329. const chart = echarts.init(document.getElementById("linechart2"));
  330. chart.clear();
  331. chart.setOption(option);
  332. this.resize = function () {
  333. chart.resize();
  334. };
  335. chart.getZr().off("click");
  336. chart.getZr().on("click", (params) => {
  337. const pointInPixel = [params.offsetX, params.offsetY];
  338. if (chart.containPixel("grid", pointInPixel)) {
  339. let xIndex = chart.convertFromPixel({ seriesIndex: 0 }, [
  340. params.offsetX,
  341. params.offsetY,
  342. ])[0];
  343. this.showDetail("1", this.line2XData[xIndex] / 100);
  344. }
  345. });
  346. window.addEventListener("resize", this.resize);
  347. }
  348. },
  349. async getChart3() {
  350. const res = await this.API.requestData({
  351. method: "POST",
  352. subUrl: "yaw/getTotalRanges",
  353. data: {
  354. wtId: this.wtId,
  355. beginDate: this.startDate,
  356. endDate: this.endDate,
  357. type: 1,
  358. },
  359. });
  360. if (res && res.data && res.data.data) {
  361. const xData = [];
  362. const lData = [];
  363. const dataMap = res.data.data;
  364. for (let key in dataMap) {
  365. let tmpKey = key.replace(/r/, "");
  366. tmpKey = tmpKey.replace(/_/, "-");
  367. if (tmpKey < 100) {
  368. xData.push(tmpKey);
  369. lData.push(dataMap[key]);
  370. }
  371. }
  372. this.line3Data = lData;
  373. let option = {
  374. color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
  375. tooltip: {
  376. trigger: "axis",
  377. backgroundColor: "rgba(0,0,0,0.4)",
  378. borderColor: partten.getColor("gray"),
  379. textStyle: {
  380. color: "#fff",
  381. fontSize: util.vh(16),
  382. },
  383. },
  384. legend: {
  385. show: false,
  386. data: ["偏航次数"],
  387. right: 56,
  388. icon: "circle",
  389. itemWidth: 6,
  390. inactiveColor: "#606769",
  391. textStyle: {
  392. color: partten.getColor("grayl"),
  393. fontSize: 12,
  394. },
  395. },
  396. grid: {
  397. top: util.vh(40),
  398. left: util.vh(60),
  399. right: util.vh(130),
  400. bottom: util.vh(24),
  401. },
  402. xAxis: [
  403. {
  404. name: "对风偏差(度)",
  405. type: "category",
  406. boundaryGap: false,
  407. axisLabel: {
  408. formatter: "{value}",
  409. fontSize: util.vh(14),
  410. textStyle: {
  411. color: partten.getColor("gray"),
  412. },
  413. },
  414. data: xData,
  415. },
  416. ],
  417. yAxis: [
  418. {
  419. type: "value",
  420. name: "数量",
  421. axisLabel: {
  422. formatter: "{value}",
  423. fontSize: util.vh(14),
  424. },
  425. splitLine: {
  426. lineStyle: {
  427. color: partten.getColor("gray") + 55,
  428. type: "dashed",
  429. },
  430. },
  431. },
  432. ],
  433. series: [
  434. {
  435. name: "数量",
  436. type: "line",
  437. smooth: true,
  438. zlevel: 0,
  439. lineStyle: {
  440. normal: {
  441. color: "#05bb4c",
  442. width: 1,
  443. },
  444. },
  445. yAxisIndex: 0,
  446. data: lData,
  447. },
  448. ],
  449. };
  450. const chart = echarts.init(document.getElementById("linechart3"));
  451. chart.clear();
  452. chart.setOption(option);
  453. this.resize = function () {
  454. chart.resize();
  455. };
  456. window.addEventListener("resize", this.resize);
  457. }
  458. },
  459. async showDetail(type, value) {
  460. this.dialogShow = true;
  461. const res = await this.API.requestData({
  462. method: "POST",
  463. subUrl: "yaw/getRanges",
  464. data: {
  465. wtId: this.wtId,
  466. beginDate: this.startDate,
  467. endDate: this.endDate,
  468. type: type,
  469. value: value,
  470. },
  471. });
  472. if (res && res.data && res.data.data) {
  473. const xData = [];
  474. const lData = [];
  475. const dataMap = res.data.data;
  476. for (let key in dataMap) {
  477. let tmpKey = key.replace(/r/, "");
  478. tmpKey = tmpKey.replace(/_/, "-");
  479. if (tmpKey < 100) {
  480. xData.push(tmpKey);
  481. lData.push(dataMap[key]);
  482. }
  483. }
  484. let option = {
  485. color: ["#05bb4c", "#4b55ae", "#fa8c16", "#f8de5b"],
  486. tooltip: {
  487. trigger: "axis",
  488. backgroundColor: "rgba(0,0,0,0.4)",
  489. borderColor: partten.getColor("gray"),
  490. textStyle: {
  491. color: "#fff",
  492. fontSize: util.vh(16),
  493. },
  494. },
  495. legend: {
  496. show: false,
  497. data: ["偏航次数"],
  498. right: 56,
  499. icon: "circle",
  500. itemWidth: 6,
  501. inactiveColor: "#606769",
  502. textStyle: {
  503. color: partten.getColor("grayl"),
  504. fontSize: 12,
  505. },
  506. },
  507. grid: {
  508. top: util.vh(40),
  509. left: util.vh(60),
  510. right: util.vh(130),
  511. bottom: util.vh(24),
  512. },
  513. xAxis: [
  514. {
  515. name: "对风偏差(度)",
  516. type: "category",
  517. boundaryGap: false,
  518. axisLabel: {
  519. formatter: "{value}",
  520. fontSize: util.vh(14),
  521. textStyle: {
  522. color: partten.getColor("gray"),
  523. },
  524. },
  525. data: xData,
  526. },
  527. ],
  528. yAxis: [
  529. {
  530. type: "value",
  531. name: "数量",
  532. axisLabel: {
  533. formatter: "{value}",
  534. fontSize: util.vh(14),
  535. },
  536. splitLine: {
  537. lineStyle: {
  538. color: partten.getColor("gray") + 55,
  539. type: "dashed",
  540. },
  541. },
  542. },
  543. ],
  544. series: [
  545. {
  546. name: "数量",
  547. type: "line",
  548. smooth: true,
  549. zlevel: 0,
  550. lineStyle: {
  551. normal: {
  552. color: "#05bb4c",
  553. width: 1,
  554. },
  555. },
  556. yAxisIndex: 0,
  557. data: lData,
  558. },
  559. ],
  560. };
  561. const chart = echarts.init(document.getElementById("linechartDialog"));
  562. chart.clear();
  563. chart.setOption(option);
  564. this.resize = function () {
  565. chart.resize();
  566. };
  567. }
  568. },
  569. },
  570. };
  571. </script>
  572. <style lang="less">
  573. #phdffx {
  574. .chart {
  575. width: 100%;
  576. height: 220px;
  577. display: block;
  578. margin: auto;
  579. }
  580. }
  581. </style>