Health10.vue 22 KB

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