HealthTab2.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="health-tab-2">
  3. <div class="power-info mg-b-16">
  4. <div class="info-tab">
  5. <div
  6. class="tab"
  7. v-for="(item, index) in infoList"
  8. :key="index"
  9. :class="item.active ? 'active' : ''"
  10. @click="onClickInfo(item)"
  11. >
  12. <i class="svg-icon svg-icon svg-icon-sm">
  13. <svg-icon :svgid="item.svgid" />
  14. </i>
  15. <span> {{ item.title }} </span>
  16. </div>
  17. <div class="empty"></div>
  18. </div>
  19. <div class="info-chart">
  20. <panel class="info-chart-panel" :title="'健康趋势'">
  21. <vertival-bar-line-chart
  22. :height="'310px'"
  23. :bardata="bardata"
  24. :lineData="lineData"
  25. />
  26. </panel>
  27. </div>
  28. </div>
  29. <div class="health-report">
  30. <panel class="health-report-panel" :title="'已推荐风机'" :showLine="false">
  31. <div class="report-items scroll">
  32. <div class="item" v-for="(item, index) in recommenList" :key="index">
  33. <div class="title">风机编号:{{ item.wtid }}</div>
  34. <div class="info">
  35. <p>推荐理由:{{ item.reason }}</p>
  36. <p>推荐检修时间:{{ new Date(item.recodedate).formatDate("yyyy-MM-dd hh:mm:ss") }}</p>
  37. <p>推荐时间对应风速:{{ item.speed }} m/s</p>
  38. <p>判断时间:{{ new Date(item.createdate).formatDate("yyyy-MM-dd hh:mm:ss")}}</p>
  39. </div>
  40. </div>
  41. </div>
  42. </panel>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import VertivalBarLineChart from "../../components/chart/combination/vertival-bar-line-chart.vue";
  48. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  49. import Panel from "../../components/coms/panel/panel.vue";
  50. export default {
  51. components: { SvgIcon, Panel, VertivalBarLineChart },
  52. data() {
  53. return {
  54. infoList: [
  55. // {title: '24小时健康趋势', svgid: 'svg-24-houre', active: false, type: 'houre'},
  56. { title: "7日健康趋势", svgid: "svg-h-day", active: true, type: "day" },
  57. { title: "30日健康趋势", svgid: "svg-h-month", active: false, type: "month"},
  58. ],
  59. bardata: { area: [], legend: [], data: [] }, // 损失电量分析echart数值
  60. lineData: [],
  61. recommenList: [], // 健康报告推荐
  62. };
  63. },
  64. created() {
  65. this.requestCoulometry(2);
  66. this.requestRecommen();
  67. },
  68. methods: {
  69. // 未确认缺陷按钮下的健康趋势选项
  70. onClickInfo(item) {
  71. this.infoList.forEach((element) => {
  72. if (item.type == element.type) {
  73. item.active = true;
  74. switch (item.type) {
  75. case "day":
  76. this.requestCoulometry(2);
  77. break;
  78. case "month":
  79. this.requestCoulometry(3);
  80. }
  81. } else {
  82. element.active = false;
  83. }
  84. });
  85. },
  86. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  87. requestCoulometry(type) {
  88. let that = this;
  89. that.API.requestData({
  90. method: "POST",
  91. subUrl: "recommen/findAllChartjz",
  92. data: { wpId: 0, type: type },
  93. success(res) {
  94. if (res.code == 200) {
  95. that.bardata.legend = ["优数量", "良数量", "差数量"];
  96. that.lineData = res.data.lvchart;
  97. that.bardata.area = res.data.datechart;
  98. that.bardata.data[2] = res.data.cslchart;
  99. that.bardata.data[1] = res.data.lslchart;
  100. that.bardata.data[0] = res.data.yslchart;
  101. }
  102. },
  103. });
  104. },
  105. // 已确认健康报告推荐
  106. requestRecommen() {
  107. let that = this;
  108. that.API.requestData({
  109. method: "POST",
  110. subUrl: 'recommen/recommenConfirmedList',
  111. success(res) {
  112. if (res.code == 200) that.recommenList = res.data;
  113. },
  114. });
  115. },
  116. },
  117. };
  118. </script>
  119. <style lang="less" scoped>
  120. .health-tab-2 {
  121. .power-info {
  122. display: flex;
  123. .info-tab {
  124. flex: 0 0 156px;
  125. display: flex;
  126. flex-direction: column;
  127. height: 350px;
  128. margin-right: 1.4815vh;
  129. .tab {
  130. position: relative;
  131. flex: 0 0 auto;
  132. text-align: center;
  133. line-height: 33px;
  134. margin-right: 8px;
  135. color: @gray-l;
  136. font-size: 12px;
  137. background: fade(@gray, 20);
  138. border: 1px solid fade(@gray, 20);
  139. display: flex;
  140. align-items: center;
  141. i {
  142. margin: 0 1.4815vh;
  143. svg use {
  144. fill: @gray-l;
  145. }
  146. }
  147. &:hover,
  148. &.active {
  149. background: fade(@green, 20);
  150. border: 1px solid @green;
  151. color: @green;
  152. cursor: pointer;
  153. i svg use {
  154. fill: @green;
  155. }
  156. }
  157. &.active::after {
  158. box-sizing: content-box;
  159. width: 0px;
  160. height: 0px;
  161. position: absolute;
  162. right: -19px;
  163. padding: 0;
  164. border-bottom: 9px solid @green;
  165. border-top: 9px solid transparent;
  166. border-left: 9px solid transparent;
  167. border-right: 9px solid transparent;
  168. display: block;
  169. content: "";
  170. z-index: 10;
  171. transform: rotate(90deg);
  172. }
  173. &.active::before {
  174. box-sizing: content-box;
  175. width: 0px;
  176. height: 0px;
  177. position: absolute;
  178. right: -17px;
  179. padding: 0;
  180. border-bottom: 9px solid #063319;
  181. border-top: 9px solid transparent;
  182. border-left: 9px solid transparent;
  183. border-right: 9px solid transparent;
  184. display: block;
  185. content: "";
  186. z-index: 12;
  187. transform: rotate(90deg);
  188. }
  189. & + .tab {
  190. margin-top: 0.7407vh;
  191. }
  192. &:last-child {
  193. text-align: center;
  194. justify-content: center;
  195. }
  196. }
  197. .empty {
  198. flex: 1 0 auto;
  199. }
  200. }
  201. .info-chart {
  202. flex: 1 0 auto;
  203. }
  204. }
  205. .health-report {
  206. .report-items {
  207. display: flex;
  208. flex-wrap: wrap;
  209. height: calc(100vh - 592px);
  210. .item {
  211. flex: 0 0 calc(100% / 6 - 16px);
  212. margin-bottom: 16px;
  213. & + .item {
  214. margin-left: 16px;
  215. }
  216. &:nth-child(6n + 1) {
  217. margin-left: 0px;
  218. }
  219. .title {
  220. background: fade(@gray, 40);
  221. // color: fade(@white, 75);
  222. color: @gray-l;
  223. line-height: 37px;
  224. padding-left: 16px;
  225. font-size: @fontsize-s;
  226. }
  227. .info {
  228. background: fade(@gray, 20);
  229. padding: 16px;
  230. font-size: @fontsize-s;
  231. color: @font-color;
  232. line-height: 1.5;
  233. p {
  234. margin: 0;
  235. line-height: 2;
  236. overflow:hidden;
  237. text-overflow:ellipsis;
  238. display:-webkit-box;
  239. -webkit-box-orient:vertical;
  240. -webkit-line-clamp:2;
  241. }
  242. .actions {
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. .success {
  247. border-color: #05bb4c;
  248. color: #05bb4c;
  249. background: rgba(5, 187, 76, 0.2);
  250. }
  251. }
  252. }
  253. }
  254. }
  255. }
  256. }
  257. </style>