phdffx.vue 17 KB

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