Health10.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  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.getTop5();
  488. this.renderDateTable();
  489. this.getTop10();
  490. this.getMtbfByBj();
  491. this.getFindPowerChar();
  492. },
  493. methods: {
  494. // 获取等级评价
  495. getTop5 () {
  496. let that = this;
  497. that.API.requestData({
  498. method: "POST",
  499. subUrl: "healthsub/gadaytop5",
  500. data: {
  501. wtId: that.wtId
  502. },
  503. success (res) {
  504. let top5TableData = [];
  505. let index = 1;
  506. for (let key in res.data) {
  507. let ele = res.data[key];
  508. top5TableData.push({
  509. index,
  510. date: ele[1],
  511. rank: ele[2],
  512. wpId: ele[3],
  513. wtId: ele[4]
  514. });
  515. index++;
  516. }
  517. that.top5Table.data = top5TableData;
  518. }
  519. });
  520. },
  521. // 渲染健康报告表格
  522. renderDateTable (day = 5) {
  523. let tableData = [];
  524. for (let i = 0; i < day; i++) {
  525. tableData.push({
  526. index: (i + 1),
  527. date: new Date((new Date().getTime() - 3600 * 1000 * 24 * (i + 1))).formatDate("yyyy-MM-dd hh:mm:ss"),
  528. wtId: this.wtId
  529. });
  530. }
  531. this.dateTable.data = tableData;
  532. },
  533. // 获取等级评价
  534. getTop10 () {
  535. let that = this;
  536. that.API.requestData({
  537. method: "POST",
  538. subUrl: "healthsub/queryStopTop10",
  539. data: {
  540. wtId: that.wtId
  541. },
  542. success (res) {
  543. let leftData = [];
  544. let rightData = [];
  545. res.data.forEach((ele, index) => {
  546. const item = {
  547. index: (index + 1),
  548. warnDesc: ele.warnDesc,
  549. startTime: new Date(ele.startTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  550. stopTime: new Date(ele.stopTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  551. stopHours: ele.stopHours
  552. };
  553. if (index < 5) {
  554. leftData.push(item);
  555. } else {
  556. rightData.push(item);
  557. }
  558. });
  559. that.top10TableLeft.data = leftData;
  560. that.top10TableRight.data = rightData;
  561. }
  562. });
  563. },
  564. // 获取八大部件
  565. getMtbfByBj () {
  566. let that = this;
  567. that.API.requestData({
  568. method: "POST",
  569. subUrl: "healthsub/getWtMttrandMtbfByBj",
  570. data: {
  571. wtId: that.wtId
  572. },
  573. success (res) {
  574. let partsArray = [];
  575. for (let key in res.data) {
  576. let linChartData = [];
  577. res.data[key][2].split(",").forEach((ele, index) => {
  578. linChartData.push({
  579. text: (index + 1),
  580. value: ele,
  581. });
  582. });
  583. res.data[key].push(linChartData);
  584. partsArray.push(res.data[key])
  585. }
  586. that.partsArray = partsArray;
  587. }
  588. });
  589. },
  590. // 获取发电曲线
  591. getFindPowerChar () {
  592. let that = this;
  593. that.API.requestData({
  594. method: "POST",
  595. subUrl: "healthsub/findPowerChar",
  596. timeout: 300000,
  597. data: {
  598. wtId: that.wtId
  599. },
  600. success (res) {
  601. let chartUnits = ["(WM)", "(m/s)"];
  602. let chartData = [{
  603. title: "理论功率",
  604. yAxisIndex: 0,
  605. value: []
  606. }, {
  607. title: "实际功率",
  608. yAxisIndex: 0,
  609. value: []
  610. }, {
  611. title: "实时风速",
  612. yAxisIndex: 1,
  613. value: []
  614. }];
  615. res.data.timearr.forEach((time, index) => {
  616. chartData[0].value.push({
  617. text: new Date(time).formatDate("MM-dd hh:mm"),
  618. value: res.data.llgl[index]
  619. });
  620. chartData[1].value.push({
  621. text: new Date(time).formatDate("MM-dd hh:mm"),
  622. value: res.data.sjgl[index]
  623. });
  624. chartData[2].value.push({
  625. text: new Date(time).formatDate("MM-dd hh:mm"),
  626. value: res.data.ssfs[index]
  627. });
  628. });
  629. that.powerChartData.value = chartData;
  630. that.powerChartData.units = chartUnits;
  631. }
  632. });
  633. },
  634. }
  635. };
  636. </script>
  637. <style lang="less">
  638. .health-10 {
  639. font-size: 12px;
  640. .com-table {
  641. tbody tr td {
  642. padding: 0;
  643. height: 30px;
  644. }
  645. }
  646. .table {
  647. tbody {
  648. td {
  649. padding: 0;
  650. height: 30px;
  651. }
  652. tr:nth-child(2n) td {
  653. background-color: fade(@gray, 20%);
  654. &.item {
  655. background-color: transparent;
  656. }
  657. }
  658. }
  659. th {
  660. background: fade(@gray, 40);
  661. font-size: 12px;
  662. font-weight: 400;
  663. line-height: 24px;
  664. color: @gray-l;
  665. border: 2px solid #07140f;
  666. &.type1 {
  667. border-left: 0;
  668. border-right: 0;
  669. }
  670. }
  671. td {
  672. color: @gray-l;
  673. text-align: center;
  674. height: 26px;
  675. line-height: 26px;
  676. &.item {
  677. width: 100px;
  678. div {
  679. color: @white;
  680. background: fade(@gray, 20);
  681. margin: 2px;
  682. border: 1px solid transparent;
  683. }
  684. }
  685. }
  686. .percent-item {
  687. display: flex;
  688. align-items: center;
  689. justify-content: center;
  690. height: 30px;
  691. .percent-bar {
  692. height: 12px;
  693. width: 170px;
  694. background: transparent;
  695. border: 1px solid @gray-l;
  696. margin-left: 8px;
  697. .percent-value {
  698. height: calc(100% - 4px);
  699. background: @green;
  700. margin: 2px;
  701. }
  702. }
  703. }
  704. .score {
  705. width: 100px;
  706. div {
  707. background: fade(@gray, 20);
  708. }
  709. }
  710. }
  711. .panel-header {
  712. margin-bottom: 0;
  713. .panel-title {
  714. text-align: center;
  715. }
  716. }
  717. .fc-info {
  718. .panel-header {
  719. margin-bottom: 8px;
  720. }
  721. .panel-title {
  722. text-align: left;
  723. padding-left: 20px;
  724. }
  725. }
  726. .table-chart {
  727. height: 312px;
  728. .panel-title {
  729. text-align: left;
  730. padding-left: 20px;
  731. }
  732. .chart-title {
  733. // color: rgba(255, 255, 255, 0.75);
  734. color: @gray-l;
  735. .title-panel {
  736. height: 30px;
  737. line-height: 30px;
  738. margin-bottom: 8px;
  739. background-color: #1e2524;
  740. .des-title {
  741. padding-left: 100px;
  742. }
  743. .num {
  744. padding-left: 20px;
  745. color: #05bb4c;
  746. font-weight: 600;
  747. }
  748. .unit {
  749. padding-left: 20px;
  750. }
  751. }
  752. }
  753. }
  754. .table-panel .wrong-list {
  755. .panel-title {
  756. text-align: left;
  757. padding-left: 20px;
  758. }
  759. }
  760. .percent-item {
  761. display: flex;
  762. align-items: center;
  763. justify-content: center;
  764. height: 34px;
  765. .percent-bar {
  766. height: 12px;
  767. width: 170px;
  768. background: transparent;
  769. border: 1px solid @gray-l;
  770. margin-left: 8px;
  771. .percent-value {
  772. height: calc(100% - 4px);
  773. background: @green;
  774. margin: 2px;
  775. }
  776. }
  777. }
  778. .score {
  779. width: 100px;
  780. div {
  781. background: fade(@gray, 20);
  782. }
  783. }
  784. .data-list {
  785. .dot {
  786. width: 12px;
  787. height: 12px;
  788. margin: auto;
  789. &.green {
  790. background: @green;
  791. }
  792. &.yellow {
  793. background: @yellow;
  794. }
  795. }
  796. }
  797. }
  798. </style>