Health10.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <div class="health-10">
  3. <wt-chooser @change="switchWt" :wpId="wpId" :wtId="wtId"></wt-chooser>
  4. <el-row :gutter="20" class="table-panel">
  5. <el-col :span="6">
  6. <panel :title="'等级评价'" :showLine="false">
  7. <Table :data="top5Table" :canScroll="false" />
  8. </panel>
  9. </el-col>
  10. <el-col :span="6">
  11. <panel :title="'健康报告'" :showLine="false">
  12. <Table :data="dateTable" :canScroll="false" />
  13. </panel>
  14. </el-col>
  15. <el-col :span="12" class="wrong-list">
  16. <panel :title="'故障信息'" :showLine="false">
  17. <div class="data-list" style="display: flex">
  18. <Table :data="top10TableLeft" :canScroll="false" />
  19. <Table :data="top10TableRight" :canScroll="false" />
  20. </div>
  21. </panel>
  22. </el-col>
  23. </el-row>
  24. <el-row :gutter="20" class="table-chart">
  25. <el-col :span="12">
  26. <panel :title="'八大部件'" :showLine="false">
  27. <div class="table">
  28. <table style="width: 100%" border="0" cellspacing="0">
  29. <thead>
  30. <tr>
  31. <th rowspan="1" class="type1" style="width: 50px"></th>
  32. <th rowspan="1" class="type1" style="width: 105px">健康度</th>
  33. <th rowspan="2" class="type1" style="width: 400px">MTBF(H/H)</th>
  34. <th rowspan="1" class="type1" style="width: 180px"></th>
  35. <th rowspan="1" class="type1" style="width: 100px">MTTR(H)</th>
  36. </tr>
  37. </thead>
  38. </table>
  39. <el-scrollbar>
  40. <div style="height: calc(30vh)">
  41. <table border="0" cellspacing="0">
  42. <tbody>
  43. <tr v-for="(item, index) of partsArray" :key="index">
  44. <td style="width: 50px">
  45. {{ item[1] }}
  46. </td>
  47. <td style="width: 105px">
  48. <div :style="'background-color: ' + item[0] + ';width:10px;height:10px;margin:0 auto;'"></div>
  49. </td>
  50. <td style="width: 400px">
  51. <div class="percent-item">
  52. {{ item[3] }}%
  53. <div class="percent-bar" style="margin-right: 4px">
  54. <div class="percent-value" :style="'width:' + item[3] + '%'"></div>
  55. </div>
  56. <!-- 剩余9999/建个故障9999 -->
  57. {{ item[4] }}
  58. </div>
  59. </td>
  60. <td style="width: 200px">
  61. <table-line-chart :height="'20px'" :list="item[8]" />
  62. </td>
  63. <td style="width: #00bf4d">
  64. {{ item[6] }}
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. </el-scrollbar>
  71. </div>
  72. </panel>
  73. </el-col>
  74. <el-col :span="12">
  75. <div class="chart-title">
  76. <div class="title-panel" style="">
  77. <span style="text-align: left; padding-left: 20px; font-size: 12px">故障信息 </span>
  78. <span class="des-title">预计损失电量<span class="num">73824.0</span><span class="unit">Kwh</span></span>
  79. <span class="des-title">预计检修时长<span class="num">29.33</span><span class="unit">H</span></span>
  80. </div>
  81. <!-- <img-line-chart
  82. height="270px"
  83. /> -->
  84. <weather-line-chart :list="weatherData" />
  85. </div>
  86. </el-col>
  87. </el-row>
  88. <div class="fc-info mg-b-16">
  89. <panel :title="'曲线'" :showLine="false">
  90. <zoom-line-chart height="28vh" :list="powerChartData.value" :units="powerChartData.units" />
  91. </panel>
  92. </div>
  93. <HealthReport
  94. :show="healthReportShow"
  95. :params="{ wtId: this.wtId, recorddate: this.recorddate }"
  96. @closed="
  97. (res) => {
  98. this.healthReportShow = false;
  99. }
  100. "
  101. />
  102. </div>
  103. </template>
  104. <script>
  105. import Panel from "../../components/coms/panel/panel.vue";
  106. import Table from "../../components/coms/table/table.vue";
  107. import TableLineChart from "../../components/chart/line/table-line-chart.vue";
  108. import ImgLineChart from "../../components/chart/line/img-line-chart.vue";
  109. import ZoomLineChart from "../../components/chart/line/zoom-line-chart.vue";
  110. import HealthReport from "@com/other/healthReport/index.vue";
  111. import WeatherLineChart from "@com/chart/line/weather-line-chart.vue";
  112. import WtChooser from "@com/coms/wt-chooser/wt-chooser.vue";
  113. export default {
  114. setup() {},
  115. components: {
  116. Panel,
  117. Table,
  118. TableLineChart,
  119. ImgLineChart,
  120. ZoomLineChart,
  121. HealthReport,
  122. WtChooser,
  123. WeatherLineChart,
  124. },
  125. data() {
  126. const that = this;
  127. return {
  128. top5Table: {
  129. column: [
  130. {
  131. name: "排名",
  132. field: "index",
  133. width: "10%",
  134. },
  135. {
  136. name: "日期",
  137. field: "date",
  138. width: "45%",
  139. },
  140. {
  141. name: "等级",
  142. field: "rank",
  143. width: "45%",
  144. },
  145. ],
  146. data: [],
  147. },
  148. dateTable: {
  149. column: [
  150. {
  151. name: "排名",
  152. field: "index",
  153. width: "10%",
  154. },
  155. {
  156. name: "日期",
  157. field: "date",
  158. width: "60%",
  159. },
  160. {
  161. name: "健康情况",
  162. field: "",
  163. width: "30%",
  164. template() {
  165. return "<div style='border: 1px solid #182238;background: #303f6e;width: 70%;margin: 0 auto;color:#FFF;cursor: pointer;'>查看报告</div>";
  166. },
  167. click(e, row) {
  168. that.recorddate = row.date;
  169. that.healthReportShow = true;
  170. },
  171. },
  172. ],
  173. data: [],
  174. },
  175. top10TableLeft: {
  176. column: [
  177. {
  178. name: "排名",
  179. field: "index",
  180. width: "8%",
  181. },
  182. {
  183. name: "故障名称",
  184. field: "warnDesc",
  185. },
  186. {
  187. name: "故障时间",
  188. field: "startTime",
  189. width: "35%",
  190. },
  191. {
  192. name: "修复时间",
  193. field: "stopTime",
  194. },
  195. {
  196. name: "时长",
  197. field: "stopHours",
  198. },
  199. ],
  200. data: [],
  201. },
  202. top10TableRight: {
  203. column: [
  204. {
  205. name: "排名",
  206. field: "index",
  207. width: "8%",
  208. },
  209. {
  210. name: "故障名称",
  211. field: "warnDesc",
  212. },
  213. {
  214. name: "故障时间",
  215. field: "startTime",
  216. width: "35%",
  217. },
  218. {
  219. name: "修复时间",
  220. field: "stopTime",
  221. },
  222. {
  223. name: "时长",
  224. field: "stopHours",
  225. },
  226. ],
  227. data: [],
  228. },
  229. partsArray: [],
  230. tableData4: {
  231. column: [
  232. {
  233. name: " ",
  234. field: "name",
  235. width: "8%",
  236. },
  237. {
  238. name: "故障名称",
  239. field: "v1",
  240. template: function (data) {
  241. return "<div style='overflow: hidden;text-overflow:ellipsis;white-space: nowrap;'>" + data + "</div>";
  242. },
  243. },
  244. {
  245. name: "故障时间",
  246. field: "v2",
  247. width: "35%",
  248. },
  249. {
  250. name: "修复时间",
  251. field: "v3",
  252. },
  253. {
  254. name: "时长",
  255. field: "v4",
  256. },
  257. ],
  258. data: [
  259. {
  260. name: "1",
  261. v1: "风机叶轮刹车系统",
  262. v2: "2018-05-31 16:28:38",
  263. v3: "2018-05-31",
  264. v4: "0.09",
  265. },
  266. {
  267. name: "2",
  268. v1: "风机叶轮刹车系统",
  269. v2: "2018-05-31 16:28:38",
  270. v3: "2018-05-31",
  271. v4: "0.09",
  272. },
  273. {
  274. name: "3",
  275. v1: "风机叶轮刹车系统",
  276. v2: "2018-05-31 16:28:38",
  277. v3: "2018-05-31",
  278. v4: "0.09",
  279. },
  280. {
  281. name: "4",
  282. v1: "风机叶轮刹车系统",
  283. v2: "2018-05-31 16:28:38",
  284. v3: "2018-05-31",
  285. v4: "0.09",
  286. },
  287. {
  288. name: "5",
  289. v1: "风机叶轮刹车系统",
  290. v2: "2018-05-31 16:28:38",
  291. v3: "2018-05-31",
  292. v4: "0.09",
  293. },
  294. ],
  295. },
  296. // 月发电量对比
  297. weatherData: [],
  298. powerChartData: {
  299. units: [""],
  300. value: [
  301. {
  302. title: "",
  303. yAxisIndex: 0,
  304. value: [],
  305. },
  306. ],
  307. },
  308. healthReportShow: false,
  309. };
  310. },
  311. created() {
  312. this.init();
  313. },
  314. methods: {
  315. init() {
  316. this.wpId = this.$route.params.wpId;
  317. this.wtId = this.$route.params.wtId;
  318. this.getTop5();
  319. this.renderDateTable();
  320. this.getTop10();
  321. this.getMtbfByBj();
  322. this.getFindPowerChar();
  323. this.getWeather();
  324. },
  325. switchWt(data) {
  326. this.$router.push(`/health/health10/${data.wpId}/${data.wtId}`);
  327. this.init();
  328. },
  329. // 获取等级评价
  330. getTop5() {
  331. let that = this;
  332. that.API.requestData({
  333. method: "POST",
  334. subUrl: "healthsub/gadaytop5",
  335. data: {
  336. wtId: that.wtId,
  337. },
  338. success(res) {
  339. let top5TableData = [];
  340. let index = 1;
  341. for (let key in res.data) {
  342. let ele = res.data[key];
  343. top5TableData.push({
  344. index,
  345. date: ele[1],
  346. rank: ele[2],
  347. wpId: ele[3],
  348. wtId: ele[4],
  349. });
  350. index++;
  351. }
  352. that.top5Table.data = top5TableData;
  353. },
  354. });
  355. },
  356. // 渲染健康报告表格
  357. renderDateTable(day = 5) {
  358. let tableData = [];
  359. for (let i = 0; i < day; i++) {
  360. tableData.push({
  361. index: i + 1,
  362. date: new Date(new Date().getTime() - 3600 * 1000 * 24 * (i + 1)).formatDate("yyyy-MM-dd hh:mm:ss"),
  363. wtId: this.wtId,
  364. });
  365. }
  366. this.dateTable.data = tableData;
  367. },
  368. // 获取等级评价
  369. getTop10() {
  370. let that = this;
  371. that.API.requestData({
  372. method: "POST",
  373. subUrl: "healthsub/queryStopTop10",
  374. data: {
  375. wtId: that.wtId,
  376. },
  377. success(res) {
  378. let leftData = [];
  379. let rightData = [];
  380. res.data.forEach((ele, index) => {
  381. const item = {
  382. index: index + 1,
  383. warnDesc: ele.warnDesc,
  384. startTime: new Date(ele.startTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  385. stopTime: new Date(ele.stopTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  386. stopHours: ele.stopHours,
  387. };
  388. if (index < 5) {
  389. leftData.push(item);
  390. } else {
  391. rightData.push(item);
  392. }
  393. });
  394. that.top10TableLeft.data = leftData;
  395. that.top10TableRight.data = rightData;
  396. },
  397. });
  398. },
  399. // 获取八大部件
  400. getMtbfByBj() {
  401. let that = this;
  402. that.API.requestData({
  403. method: "POST",
  404. subUrl: "healthsub/getWtMttrandMtbfByBj",
  405. data: {
  406. wtId: that.wtId,
  407. },
  408. success(res) {
  409. let partsArray = [];
  410. for (let key in res.data) {
  411. let linChartData = [];
  412. res.data[key][2].split(",").forEach((ele, index) => {
  413. linChartData.push({
  414. text: index + 1,
  415. value: ele,
  416. });
  417. });
  418. res.data[key].push(linChartData);
  419. partsArray.push(res.data[key]);
  420. }
  421. that.partsArray = partsArray;
  422. },
  423. });
  424. },
  425. // 获取发电曲线
  426. getFindPowerChar() {
  427. let that = this;
  428. that.API.requestData({
  429. method: "POST",
  430. subUrl: "healthsub/findPowerChar",
  431. data: {
  432. wtId: that.wtId,
  433. },
  434. success(res) {
  435. let chartUnits = ["(WM)", "(m/s)"];
  436. let chartData = [
  437. {
  438. title: "理论功率",
  439. yAxisIndex: 0,
  440. value: [],
  441. },
  442. {
  443. title: "实际功率",
  444. yAxisIndex: 0,
  445. value: [],
  446. },
  447. {
  448. title: "实时风速",
  449. yAxisIndex: 1,
  450. value: [],
  451. },
  452. ];
  453. res.data.timearr.forEach((time, index) => {
  454. chartData[0].value.push({
  455. text: new Date(time).formatDate("MM-dd hh:mm"),
  456. value: res.data.llgl[index],
  457. });
  458. chartData[1].value.push({
  459. text: new Date(time).formatDate("MM-dd hh:mm"),
  460. value: res.data.sjgl[index],
  461. });
  462. chartData[2].value.push({
  463. text: new Date(time).formatDate("MM-dd hh:mm"),
  464. value: res.data.ssfs[index],
  465. });
  466. });
  467. that.powerChartData.value = chartData;
  468. that.powerChartData.units = chartUnits;
  469. },
  470. });
  471. },
  472. // 获取天气信息
  473. async getWeather() {
  474. const { data } = await this.API.requestData({
  475. method: "POST",
  476. subUrl: "healthsub/getWeatherRealDay5Info",
  477. data: { wpId: this.wpId },
  478. });
  479. // console.log(data);
  480. if (data && data.data) {
  481. this.weatherData = data.data.ls;
  482. // const list = [];
  483. // data.data.ls.forEach((element) => {
  484. // console.log(element);
  485. // console.log(new Date(element.time).formatDate("yyyy-MM-dd hh:mm:ss"));
  486. // list.push();
  487. // });
  488. }
  489. },
  490. },
  491. };
  492. </script>
  493. <style lang="less">
  494. .health-10 {
  495. font-size: 12px;
  496. .com-table {
  497. tbody tr td {
  498. padding: 0;
  499. height: 30px;
  500. }
  501. }
  502. .table {
  503. tbody {
  504. td {
  505. padding: 0;
  506. height: 30px;
  507. }
  508. tr:nth-child(2n) td {
  509. background-color: fade(@gray, 20%);
  510. &.item {
  511. background-color: transparent;
  512. }
  513. }
  514. }
  515. th {
  516. background: fade(@gray, 40);
  517. font-size: 12px;
  518. font-weight: 400;
  519. line-height: 24px;
  520. color: @gray-l;
  521. border: 2px solid #07140f;
  522. &.type1 {
  523. border-left: 0;
  524. border-right: 0;
  525. }
  526. }
  527. td {
  528. color: @gray-l;
  529. text-align: center;
  530. height: 26px;
  531. line-height: 26px;
  532. &.item {
  533. width: 100px;
  534. div {
  535. color: @white;
  536. background: fade(@gray, 20);
  537. margin: 2px;
  538. border: 1px solid transparent;
  539. }
  540. }
  541. }
  542. .percent-item {
  543. display: flex;
  544. align-items: center;
  545. justify-content: center;
  546. height: 30px;
  547. .percent-bar {
  548. height: 12px;
  549. width: 170px;
  550. background: transparent;
  551. border: 1px solid @gray-l;
  552. margin-left: 8px;
  553. .percent-value {
  554. height: calc(100% - 4px);
  555. background: @green;
  556. margin: 2px;
  557. }
  558. }
  559. }
  560. .score {
  561. width: 100px;
  562. div {
  563. background: fade(@gray, 20);
  564. }
  565. }
  566. }
  567. .panel-header {
  568. margin-bottom: 0;
  569. .panel-title {
  570. text-align: center;
  571. }
  572. }
  573. .fc-info {
  574. .panel-header {
  575. margin-bottom: 8px;
  576. }
  577. .panel-title {
  578. text-align: left;
  579. padding-left: 20px;
  580. }
  581. }
  582. .table-chart {
  583. height: 312px;
  584. .panel-title {
  585. text-align: left;
  586. padding-left: 20px;
  587. }
  588. .chart-title {
  589. // color: rgba(255, 255, 255, 0.75);
  590. color: @gray-l;
  591. .title-panel {
  592. height: 30px;
  593. line-height: 30px;
  594. margin-bottom: 8px;
  595. background-color: #1e2524;
  596. .des-title {
  597. padding-left: 100px;
  598. }
  599. .num {
  600. padding-left: 20px;
  601. color: #05bb4c;
  602. font-weight: 600;
  603. }
  604. .unit {
  605. padding-left: 20px;
  606. }
  607. }
  608. }
  609. }
  610. .table-panel .wrong-list {
  611. .panel-title {
  612. text-align: left;
  613. padding-left: 20px;
  614. }
  615. }
  616. .percent-item {
  617. display: flex;
  618. align-items: center;
  619. justify-content: center;
  620. height: 34px;
  621. .percent-bar {
  622. height: 12px;
  623. width: 170px;
  624. background: transparent;
  625. border: 1px solid @gray-l;
  626. margin-left: 8px;
  627. .percent-value {
  628. height: calc(100% - 4px);
  629. background: @green;
  630. margin: 2px;
  631. }
  632. }
  633. }
  634. .score {
  635. width: 100px;
  636. div {
  637. background: fade(@gray, 20);
  638. }
  639. }
  640. .data-list {
  641. .dot {
  642. width: 12px;
  643. height: 12px;
  644. margin: auto;
  645. &.green {
  646. background: @green;
  647. }
  648. &.yellow {
  649. background: @yellow;
  650. }
  651. }
  652. }
  653. }
  654. </style>