index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. <template>
  2. <div class="health-2">
  3. <div class="power-info mg-b-16">
  4. <div class="info-tab">
  5. <div
  6. class="tab"
  7. :class="type === '2' ? 'active' : ''"
  8. @click="changeDate('2')"
  9. >
  10. <i class="svg-icon svg-icon svg-icon-sm">
  11. <svg-icon :svgid="'svg-h-day'" />
  12. </i>
  13. <span> 7日健康趋势 </span>
  14. </div>
  15. <div
  16. class="tab"
  17. :class="type === '3' ? 'active' : ''"
  18. @click="changeDate('3')"
  19. >
  20. <i class="svg-icon svg-icon svg-icon-sm">
  21. <svg-icon :svgid="'svg-h-month'" />
  22. </i>
  23. <span>30日健康趋势</span>
  24. </div>
  25. <div class="empty"></div>
  26. <!-- <div class="tab">
  27. <span>全部风场健康趋势</span>
  28. </div> -->
  29. </div>
  30. <div class="info-chart">
  31. <!-- <panel class="info-chart-panel" :title="'损失电量分析'"> -->
  32. <panel class="info-chart-panel" :title="'健康趋势(台)'">
  33. <vertival-bar-line-chart
  34. :bardata="bardata"
  35. :lineData="lineData"
  36. :height="'250px'"
  37. />
  38. </panel>
  39. </div>
  40. </div>
  41. <div class="fc-info mg-b-16">
  42. <div class="fc-item" v-for="(item, index) in wpmap" :key="index">
  43. <div class="title" @click="jumpUrl(item)">{{ item.name }}</div>
  44. <div class="tags">
  45. <div class="tag">
  46. <i class="svg-icon svg-icon-gray-l svg-icon-lg">
  47. <svg-icon :svgid="item.svgIcon" />
  48. </i>
  49. </div>
  50. <div class="tag">
  51. <div class="tag-title">实时风速</div>
  52. <div class="tag-value">
  53. {{ item.sjfs }}<span class="unit">m/s</span>
  54. </div>
  55. </div>
  56. <div class="tag">
  57. <div class="tag-title">预测风速</div>
  58. <div class="tag-value">
  59. {{ item.ycfs }}<span class="unit">m/s</span>
  60. </div>
  61. </div>
  62. <div class="tag">
  63. <div class="tag-title">健康度(优)</div>
  64. <div class="tag-value">
  65. {{ item.ysl }}<span class="unit">台</span>
  66. </div>
  67. </div>
  68. <div class="tag">
  69. <div class="tag-title">健康度(良)</div>
  70. <div class="tag-value">
  71. {{ item.lsl }}<span class="unit">台</span>
  72. </div>
  73. </div>
  74. <div class="tag">
  75. <div class="tag-title">健康度(差)</div>
  76. <div class="tag-value">
  77. {{ item.csl }}<span class="unit">台</span>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="health-info">
  82. <div class="title">
  83. 设备健康度
  84. <div class="actions">
  85. <div
  86. class="action"
  87. :class="item.showType === '1' ? 'active' : ''"
  88. @click="changeWpShowType(index, '1')"
  89. >
  90. <i class="svg-icon svg-icon-sm">
  91. <svg-icon :svgid="'svg-wind-site'" />
  92. </i>
  93. 比例
  94. </div>
  95. <div
  96. class="action"
  97. :class="item.showType === '2' ? 'active' : ''"
  98. @click="changeWpShowType(index, '2')"
  99. >
  100. <i class="svg-icon svg-icon-sm">
  101. <svg-icon :svgid="'svg-wind-site'" />
  102. </i>
  103. 风机号
  104. </div>
  105. </div>
  106. </div>
  107. <div class="info-body">
  108. <div class="proportion-info" v-show="item.showType === '1'">
  109. <thermometer-chart
  110. :value="item.jkd"
  111. :height="'120px'"
  112. :width="'80px'"
  113. />
  114. <dashboard
  115. :value="item.gzd"
  116. :max="item.jrts"
  117. :height="'150px'"
  118. :width="'150px'"
  119. circleName=""
  120. pieName=""
  121. progressName="故障度"
  122. />
  123. </div>
  124. <div class="device-list" v-show="item.showType === '2'">
  125. <div
  126. class="item orange"
  127. v-for="(gzItem, gzIndex) in item.gzId"
  128. :key="gzIndex"
  129. @click="showDetails(item.wpId, gzItem.id)"
  130. >
  131. {{ gzItem.name }}
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="fc-list">
  139. <Table :data="tableData" />
  140. </div>
  141. </div>
  142. </template>
  143. <script>
  144. import VertivalBarLineChart from "@/components/chart/combination/health-bar-line-chart.vue";
  145. import Dashboard from "@/components/chart/other/Dashboard.vue";
  146. import ThermometerChart from "@/components/chart/other/thermometer-chart.vue";
  147. import SvgIcon from "@/components/coms/icon/svg-icon.vue";
  148. import Panel from "@/components/coms/panel/panel.vue";
  149. import Table from "@/components/coms/table/table.vue";
  150. import api from "@api/wisdomOverhaul/health/index.js";
  151. export default {
  152. name: "homepage",
  153. setup() {},
  154. components: {
  155. SvgIcon,
  156. Panel,
  157. VertivalBarLineChart,
  158. ThermometerChart,
  159. Dashboard,
  160. Table,
  161. },
  162. data() {
  163. return {
  164. type: "1",
  165. bardata: {
  166. area: [],
  167. legend: [],
  168. data: [[]],
  169. },
  170. wpmap: [],
  171. lineData: [],
  172. tableData: {
  173. column: [
  174. {
  175. name: "",
  176. field: "",
  177. is_num: false,
  178. is_light: false,
  179. },
  180. {
  181. name: "风机编号",
  182. field: "windTurbineId",
  183. is_num: false,
  184. is_light: false,
  185. },
  186. {
  187. name: "故障时间",
  188. field: "stopTime",
  189. is_num: false,
  190. is_light: false,
  191. },
  192. {
  193. name: "故障类型",
  194. field: "stopTypeId",
  195. is_num: false,
  196. is_light: false,
  197. },
  198. {
  199. name: "报警描述",
  200. field: "warningId",
  201. is_num: false,
  202. is_light: false,
  203. },
  204. ],
  205. data: [],
  206. },
  207. };
  208. },
  209. created() {
  210. this.requestData();
  211. this.getAllMap();
  212. },
  213. methods: {
  214. // 获取顶部柱状图数据
  215. requestData() {
  216. api
  217. .findAllChartjz({
  218. wpId: "0",
  219. type: this.type,
  220. })
  221. .then((res) => {
  222. if (res.code == 200) {
  223. this.bardata.legend = ["优数量", "良数量", "差数量"];
  224. this.lineData = res.data.lvchart;
  225. this.bardata.area = res.data.datechart;
  226. const barData = [
  227. res.data.yslchart || [],
  228. res.data.lslchart || [],
  229. res.data.cslchart,
  230. ];
  231. this.bardata.data = barData;
  232. }
  233. });
  234. // let that = this;
  235. // that.API.requestData({
  236. // method: "POST",
  237. // timeout: 8000,
  238. // subUrl: "recommen/findAllChartjz",
  239. // data: {
  240. // wpId: "0",
  241. // type: that.type,
  242. // },
  243. // success(res) {
  244. // if (res.code == 200) {
  245. // that.bardata.legend = ["优数量", "良数量", "差数量"];
  246. // that.lineData = res.data.lvchart;
  247. // that.bardata.area = res.data.datechart;
  248. // that.bardata.data[2] = res.data.cslchart;
  249. // that.bardata.data[1] = res.data.lslchart;
  250. // that.bardata.data[0] = res.data.yslchart;
  251. // }
  252. // },
  253. // });
  254. },
  255. getAllMap() {
  256. api.healthmainFindAllMap({}).then((res) => {
  257. res.data.wpmap.forEach((ele) => {
  258. if (ele.tqyb < 10) ele.tqyb = "0" + ele.tqyb;
  259. ele.showType = "1";
  260. ele.svgIcon = "svg-" + ele.tqyb;
  261. });
  262. this.wpmap = res.data.wpmap;
  263. this.tableData.data = res.data.gzls;
  264. });
  265. // let that = this;
  266. // that.API.requestData({
  267. // method: "POST",
  268. // subUrl: "healthmain/findAllMap",
  269. // success(res) {
  270. // res.data.wpmap.forEach((ele) => {
  271. // if (ele.tqyb < 10) ele.tqyb = "0" + ele.tqyb;
  272. // ele.showType = "1";
  273. // ele.svgIcon = "svg-" + ele.tqyb;
  274. // });
  275. // that.wpmap = res.data.wpmap;
  276. // that.tableData.data = res.data.gzls;
  277. // },
  278. // });
  279. },
  280. // 改变风场显示类型
  281. changeWpShowType(index, showType) {
  282. this.wpmap[index].showType = showType;
  283. },
  284. changeDate(type) {
  285. this.type = type;
  286. this.requestData();
  287. },
  288. // 页面跳转
  289. jumpUrl({ wpId, name }) {
  290. this.$router.push({
  291. path: `/health/healthDetail/wpHealth/${wpId}/${name}`,
  292. });
  293. },
  294. showDetails(wpId, wtId) {
  295. this.$router.push({
  296. path: `/health/healthDetail/wtHealth/${wpId}/${wtId}`,
  297. });
  298. },
  299. },
  300. };
  301. </script>
  302. <style lang="less">
  303. .health-2 {
  304. overflow-y: auto;
  305. height: 100%;
  306. // 电量健康情况
  307. .power-info {
  308. display: flex;
  309. .info-tab {
  310. flex: 0 0 156px;
  311. display: flex;
  312. flex-direction: column;
  313. height: 287px;
  314. margin-right: 1.4815vh;
  315. .tab {
  316. position: relative;
  317. flex: 0 0 auto;
  318. text-align: center;
  319. height: 33px;
  320. line-height: 33px;
  321. margin-right: 8px;
  322. color: @gray-l;
  323. font-size: 12px;
  324. background: fade(@gray, 20);
  325. border: 1px solid fade(@gray, 20);
  326. display: flex;
  327. align-items: center;
  328. i {
  329. margin: 0 1.4815vh;
  330. svg use {
  331. fill: @gray-l;
  332. }
  333. }
  334. &:hover,
  335. &.active {
  336. background: fade(@green, 20);
  337. border: 1px solid @green;
  338. color: @green;
  339. cursor: pointer;
  340. i {
  341. svg use {
  342. fill: @green;
  343. }
  344. }
  345. }
  346. &.active::after {
  347. box-sizing: content-box;
  348. width: 0px;
  349. height: 0px;
  350. position: absolute;
  351. right: -19px;
  352. padding: 0;
  353. border-bottom: 9px solid @green;
  354. border-top: 9px solid transparent;
  355. border-left: 9px solid transparent;
  356. border-right: 9px solid transparent;
  357. display: block;
  358. content: "";
  359. z-index: 10;
  360. transform: rotate(90deg);
  361. }
  362. &.active::before {
  363. box-sizing: content-box;
  364. width: 0px;
  365. height: 0px;
  366. position: absolute;
  367. right: -17px;
  368. padding: 0;
  369. border-bottom: 9px solid #063319;
  370. border-top: 9px solid transparent;
  371. border-left: 9px solid transparent;
  372. border-right: 9px solid transparent;
  373. display: block;
  374. content: "";
  375. z-index: 12;
  376. transform: rotate(90deg);
  377. }
  378. & + .tab {
  379. margin-top: 0.7407vh;
  380. }
  381. &:last-child {
  382. text-align: center;
  383. justify-content: center;
  384. }
  385. }
  386. .empty {
  387. flex: 1 0 auto;
  388. }
  389. }
  390. .info-chart {
  391. flex: 1 0 auto;
  392. }
  393. }
  394. // 风场信息
  395. .fc-info {
  396. display: flex;
  397. flex-wrap: wrap;
  398. // height: 42vh;
  399. // overflow-y: auto;
  400. .fc-item {
  401. // flex: 1 0 calc(100% / 5 - 8px);
  402. // margin-right: 8px;
  403. // margin-bottom: 5px;
  404. width: calc(25% - 10px);
  405. margin: 5px;
  406. & > .title {
  407. background: fade(@gray, 20);
  408. padding: 0 1.4815vh;
  409. line-height: 27px;
  410. color: fade(@white, 75);
  411. font-size: @fontsize-s;
  412. margin-bottom: 0.7407vh;
  413. cursor: pointer;
  414. }
  415. // & + .fc-item {
  416. // margin-left: 8px;
  417. // }
  418. .tags {
  419. display: flex;
  420. flex-wrap: wrap;
  421. .tag {
  422. flex: 1 0 calc(100% / 3 - 8px);
  423. background: fade(@gray, 20);
  424. margin-bottom: 8px;
  425. .tag-title {
  426. font-size: 12px;
  427. color: @gray-l;
  428. line-height: 24px;
  429. background: fade(@gray, 40);
  430. text-align: center;
  431. }
  432. .tag-value {
  433. position: relative;
  434. font-size: 20px;
  435. color: @green;
  436. text-align: center;
  437. padding: 12px 0;
  438. .unit {
  439. position: absolute;
  440. color: @gray;
  441. font-size: 12px;
  442. bottom: 8px;
  443. right: 8px;
  444. }
  445. }
  446. & + .tag {
  447. margin-left: 8px;
  448. }
  449. &:nth-child(1) {
  450. display: flex;
  451. justify-content: center;
  452. align-items: center;
  453. i {
  454. width: 56px;
  455. height: 56px;
  456. svg {
  457. width: 56px;
  458. height: 56px;
  459. }
  460. }
  461. }
  462. &:nth-child(3n + 1) {
  463. margin-left: 0px;
  464. }
  465. }
  466. }
  467. .health-info {
  468. .title {
  469. line-height: 24px;
  470. color: @gray-l;
  471. background: fade(@gray, 40);
  472. padding: 0 16px;
  473. font-size: 12px;
  474. .actions {
  475. float: right;
  476. display: flex;
  477. .action {
  478. display: flex;
  479. align-items: center;
  480. i {
  481. margin-right: 0.3704vh;
  482. }
  483. & + .action {
  484. margin-left: 1.4815vh;
  485. }
  486. &.active,
  487. &:hover {
  488. cursor: pointer;
  489. color: @green;
  490. svg use {
  491. fill: @green;
  492. }
  493. }
  494. }
  495. }
  496. }
  497. .info-body {
  498. height: 170px;
  499. background: fade(@gray, 20);
  500. .proportion-info {
  501. height: 100%;
  502. display: flex;
  503. justify-content: space-around;
  504. align-items: center;
  505. }
  506. .device-list {
  507. display: flex;
  508. flex-wrap: wrap;
  509. padding: 8px 16px;
  510. .item {
  511. flex: 1 0 64px;
  512. line-height: 26px;
  513. background: fade(@gray, 20);
  514. color: @gray-l;
  515. font-size: 12px;
  516. margin-bottom: 4px;
  517. text-align: center;
  518. border: 1px solid transparent;
  519. cursor: pointer;
  520. & + .item {
  521. margin-left: 4px;
  522. }
  523. &:nth-child(5n + 1) {
  524. margin-left: 0px;
  525. }
  526. &.green {
  527. color: @green;
  528. background: fade(@green, 20);
  529. border-color: @green;
  530. }
  531. &.purple {
  532. color: @purple;
  533. background: fade(@purple, 20);
  534. border-color: @purple;
  535. }
  536. &.orange {
  537. color: @orange;
  538. background: fade(@orange, 20);
  539. border-color: @orange;
  540. }
  541. &.red {
  542. color: @red;
  543. background: fade(@red, 20);
  544. border-color: @red;
  545. }
  546. }
  547. .blank {
  548. flex: 1 0 64px;
  549. margin-left: 4px;
  550. &:nth-child(5n + 1) {
  551. margin-left: 0px;
  552. }
  553. }
  554. }
  555. }
  556. }
  557. }
  558. }
  559. // 列表
  560. .fc-list {
  561. .com-table thead tr th {
  562. padding: 4px 0;
  563. }
  564. tbody {
  565. height: calc(100vh - 820px);
  566. }
  567. th,
  568. td {
  569. &:nth-child(1) {
  570. width: 32px;
  571. }
  572. }
  573. }
  574. }
  575. </style>