Health10.vue 22 KB

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