Health10.vue 20 KB

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