Health10.vue 21 KB

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