Health10.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  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: 0,
  287. value: [
  288. {
  289. text: "05-02 00:00",
  290. value: 11,
  291. },
  292. {
  293. text: "05-04 00:00",
  294. value: 11,
  295. },
  296. {
  297. text: "05-06 00:00",
  298. value: 13,
  299. },
  300. {
  301. text: "05-08 00:00",
  302. value: 12,
  303. },
  304. {
  305. text: "05-10 00:00",
  306. value: 13,
  307. },
  308. {
  309. text: "05-12 00:00",
  310. value: 12,
  311. },
  312. {
  313. text: "05-14 00:00",
  314. value: 11,
  315. },
  316. {
  317. text: "05-16 00:00",
  318. value: 11,
  319. },
  320. {
  321. text: "05-18 00:00",
  322. value: 13,
  323. },
  324. {
  325. text: "05-20 00:00",
  326. value: 11,
  327. },
  328. {
  329. text: "05-22 00:00",
  330. value: 12,
  331. },
  332. ],
  333. },
  334. {
  335. title: "实际功率",
  336. yAxisIndex: 0,
  337. value: [
  338. {
  339. text: "05-02 00:00",
  340. value: 1,
  341. },
  342. {
  343. text: "05-04 00:00",
  344. value: 3,
  345. },
  346. {
  347. text: "05-06 00:00",
  348. value: 4,
  349. },
  350. {
  351. text: "05-08 00:00",
  352. value: 1,
  353. },
  354. {
  355. text: "05-10 00:00",
  356. value: 3,
  357. },
  358. {
  359. text: "05-12 00:00",
  360. value: 5,
  361. },
  362. {
  363. text: "05-14 00:00",
  364. value: 1,
  365. },
  366. {
  367. text: "05-16 00:00",
  368. value: 5,
  369. },
  370. {
  371. text: "05-18 00:00",
  372. value: 4,
  373. },
  374. {
  375. text: "05-20 00:00",
  376. value: 1,
  377. },
  378. {
  379. text: "05-22 00:00",
  380. value: 3,
  381. },
  382. ],
  383. },
  384. ],
  385. },
  386. powerChartData: {
  387. units: [""],
  388. value: [{
  389. title: "",
  390. yAxisIndex: 0,
  391. value: []
  392. }],
  393. },
  394. line2: {
  395. units: ["功率", "风速"],
  396. value: [
  397. {
  398. title: "应发功率",
  399. yAxisIndex: 0,
  400. value: [
  401. {
  402. text: "05-02 00:00",
  403. value: 1,
  404. },
  405. {
  406. text: "05-04 00:00",
  407. value: 3,
  408. },
  409. {
  410. text: "05-06 00:00",
  411. value: 4,
  412. },
  413. {
  414. text: "05-08 00:00",
  415. value: 2,
  416. },
  417. {
  418. text: "05-10 00:00",
  419. value: 3,
  420. },
  421. {
  422. text: "05-12 00:00",
  423. value: 5,
  424. },
  425. {
  426. text: "05-14 00:00",
  427. value: 1,
  428. },
  429. {
  430. text: "05-16 00:00",
  431. value: 1,
  432. },
  433. {
  434. text: "05-18 00:00",
  435. value: 3,
  436. },
  437. {
  438. text: "05-20 00:00",
  439. value: 4,
  440. },
  441. {
  442. text: "05-22 00:00",
  443. value: 2,
  444. },
  445. {
  446. text: "05-24 00:00",
  447. value: 3,
  448. },
  449. {
  450. text: "05-26 00:00",
  451. value: 5,
  452. },
  453. {
  454. text: "05-28 00:00",
  455. value: 1,
  456. },
  457. ],
  458. },
  459. ],
  460. },
  461. };
  462. },
  463. created () {
  464. this.wtId = this.$route.params.wtId;
  465. this.getTop5();
  466. this.renderDateTable();
  467. this.getTop10();
  468. this.getMtbfByBj();
  469. this.getFindPowerChar();
  470. },
  471. methods: {
  472. // 获取等级评价
  473. getTop5 () {
  474. let that = this;
  475. that.API.requestData({
  476. method: "POST",
  477. subUrl: "healthsub/gadaytop5",
  478. data: {
  479. wtId: that.wtId
  480. },
  481. success (res) {
  482. let top5TableData = [];
  483. let index = 1;
  484. for (let key in res.data) {
  485. let ele = res.data[key];
  486. top5TableData.push({
  487. index,
  488. date: ele[1],
  489. rank: ele[2],
  490. wpId: ele[3],
  491. wtId: ele[4]
  492. });
  493. index++;
  494. }
  495. that.top5Table.data = top5TableData;
  496. }
  497. });
  498. },
  499. // 渲染健康报告表格
  500. renderDateTable (day = 5) {
  501. let tableData = [];
  502. for (let i = 0; i < day; i++) {
  503. tableData.push({
  504. index: (i + 1),
  505. date: new Date((new Date().getTime() - 3600 * 1000 * 24 * (i + 1))).formatDate("yyyy-MM-dd hh:mm:ss"),
  506. wtId: this.wtId
  507. });
  508. }
  509. this.dateTable.data = tableData;
  510. },
  511. // 获取等级评价
  512. getTop10 () {
  513. let that = this;
  514. that.API.requestData({
  515. method: "POST",
  516. subUrl: "healthsub/queryStopTop10",
  517. data: {
  518. wtId: that.wtId
  519. },
  520. success (res) {
  521. let leftData = [];
  522. let rightData = [];
  523. res.data.forEach((ele, index) => {
  524. const item = {
  525. index: (index + 1),
  526. warnDesc: ele.warnDesc,
  527. startTime: new Date(ele.startTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  528. stopTime: new Date(ele.stopTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  529. stopHours: ele.stopHours
  530. };
  531. if (index < 5) {
  532. leftData.push(item);
  533. } else {
  534. rightData.push(item);
  535. }
  536. });
  537. that.top10TableLeft.data = leftData;
  538. that.top10TableRight.data = rightData;
  539. }
  540. });
  541. },
  542. // 获取八大部件
  543. getMtbfByBj () {
  544. let that = this;
  545. that.API.requestData({
  546. method: "POST",
  547. subUrl: "healthsub/getWtMttrandMtbfByBj",
  548. data: {
  549. wtId: that.wtId
  550. },
  551. success (res) {
  552. let partsArray = [];
  553. for (let key in res.data) {
  554. let linChartData = [];
  555. res.data[key][2].split(",").forEach((ele, index) => {
  556. linChartData.push({
  557. text: (index + 1),
  558. value: ele,
  559. });
  560. });
  561. res.data[key].push(linChartData);
  562. partsArray.push(res.data[key])
  563. }
  564. that.partsArray = partsArray;
  565. }
  566. });
  567. },
  568. // 获取发电曲线
  569. getFindPowerChar () {
  570. let that = this;
  571. that.API.requestData({
  572. method: "POST",
  573. subUrl: "healthsub/findPowerChar",
  574. data: {
  575. wtId: that.wtId
  576. },
  577. success (res) {
  578. let chartUnits = ["(WM)", "(m/s)"];
  579. let chartData = [{
  580. title: "理论功率",
  581. yAxisIndex: 0,
  582. value: []
  583. }, {
  584. title: "实际功率",
  585. yAxisIndex: 0,
  586. value: []
  587. }, {
  588. title: "实时风速",
  589. yAxisIndex: 1,
  590. value: []
  591. }];
  592. res.data.timearr.forEach((time, index) => {
  593. chartData[0].value.push({
  594. text: new Date(time).formatDate("MM-dd hh:mm"),
  595. value: res.data.llgl[index]
  596. });
  597. chartData[1].value.push({
  598. text: new Date(time).formatDate("MM-dd hh:mm"),
  599. value: res.data.sjgl[index]
  600. });
  601. chartData[2].value.push({
  602. text: new Date(time).formatDate("MM-dd hh:mm"),
  603. value: res.data.ssfs[index]
  604. });
  605. });
  606. that.powerChartData.value = chartData;
  607. that.powerChartData.units = chartUnits;
  608. }
  609. });
  610. },
  611. }
  612. };
  613. </script>
  614. <style lang="less">
  615. .health-10 {
  616. font-size: 12px;
  617. .com-table {
  618. tbody tr td {
  619. padding: 0;
  620. height: 30px;
  621. }
  622. }
  623. .table {
  624. tbody {
  625. td {
  626. padding: 0;
  627. height: 30px;
  628. }
  629. tr:nth-child(2n) td {
  630. background-color: fade(@gray, 20%);
  631. &.item {
  632. background-color: transparent;
  633. }
  634. }
  635. }
  636. th {
  637. background: fade(@gray, 40);
  638. font-size: 12px;
  639. font-weight: 400;
  640. line-height: 24px;
  641. color: @gray-l;
  642. border: 2px solid #07140f;
  643. &.type1 {
  644. border-left: 0;
  645. border-right: 0;
  646. }
  647. }
  648. td {
  649. color: @gray-l;
  650. text-align: center;
  651. height: 26px;
  652. line-height: 26px;
  653. &.item {
  654. width: 100px;
  655. div {
  656. color: @white;
  657. background: fade(@gray, 20);
  658. margin: 2px;
  659. border: 1px solid transparent;
  660. }
  661. }
  662. }
  663. .percent-item {
  664. display: flex;
  665. align-items: center;
  666. justify-content: center;
  667. height: 30px;
  668. .percent-bar {
  669. height: 12px;
  670. width: 170px;
  671. background: transparent;
  672. border: 1px solid @gray-l;
  673. margin-left: 8px;
  674. .percent-value {
  675. height: calc(100% - 4px);
  676. background: @green;
  677. margin: 2px;
  678. }
  679. }
  680. }
  681. .score {
  682. width: 100px;
  683. div {
  684. background: fade(@gray, 20);
  685. }
  686. }
  687. }
  688. .panel-header {
  689. margin-bottom: 0;
  690. .panel-title {
  691. text-align: center;
  692. }
  693. }
  694. .fc-info {
  695. .panel-header {
  696. margin-bottom: 8px;
  697. }
  698. .panel-title {
  699. text-align: left;
  700. padding-left: 20px;
  701. }
  702. }
  703. .table-chart {
  704. height: 312px;
  705. .panel-title {
  706. text-align: left;
  707. padding-left: 20px;
  708. }
  709. .chart-title {
  710. // color: rgba(255, 255, 255, 0.75);
  711. color: @gray-l;
  712. .title-panel {
  713. height: 30px;
  714. line-height: 30px;
  715. margin-bottom: 8px;
  716. background-color: #1e2524;
  717. .des-title {
  718. padding-left: 100px;
  719. }
  720. .num {
  721. padding-left: 20px;
  722. color: #05bb4c;
  723. font-weight: 600;
  724. }
  725. .unit {
  726. padding-left: 20px;
  727. }
  728. }
  729. }
  730. }
  731. .table-panel .wrong-list {
  732. .panel-title {
  733. text-align: left;
  734. padding-left: 20px;
  735. }
  736. }
  737. .percent-item {
  738. display: flex;
  739. align-items: center;
  740. justify-content: center;
  741. height: 34px;
  742. .percent-bar {
  743. height: 12px;
  744. width: 170px;
  745. background: transparent;
  746. border: 1px solid @gray-l;
  747. margin-left: 8px;
  748. .percent-value {
  749. height: calc(100% - 4px);
  750. background: @green;
  751. margin: 2px;
  752. }
  753. }
  754. }
  755. .score {
  756. width: 100px;
  757. div {
  758. background: fade(@gray, 20);
  759. }
  760. }
  761. .data-list {
  762. .dot {
  763. width: 12px;
  764. height: 12px;
  765. margin: auto;
  766. &.green {
  767. background: @green;
  768. }
  769. &.yellow {
  770. background: @yellow;
  771. }
  772. }
  773. }
  774. }
  775. </style>