healthLineChart2.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="health-7">
  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 :height="'310px'" />
  22. </panel>
  23. </div>
  24. </div>
  25. <div class="fc-info mg-b-16">
  26. <panel :title="'健康走势图'" :showLine="false">
  27. <normal-line-chart :height="'150px'" />
  28. </panel>
  29. </div>
  30. <div class="data-list">
  31. <Table :data="tableData" :canScroll="true" />
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import VertivalBarLineChart from "../../components/chart/combination/vertival-bar-line-chart.vue";
  37. import NormalLineChart from "../../components/chart/line/normal-line-chart.vue";
  38. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  39. import Panel from "../../components/coms/panel/panel.vue";
  40. import Table from "../../components/coms/table/table.vue";
  41. export default {
  42. setup() {},
  43. components: { SvgIcon, Panel, VertivalBarLineChart, NormalLineChart, Table },
  44. data() {
  45. return {
  46. infoList: [
  47. // {title: '24小时健康趋势', svgid: 'svg-24-houre', active: false, type: 'houre'},
  48. { title: "7日健康趋势", svgid: "svg-h-day", active: true, type: "day" },
  49. { title: "30日健康趋势", svgid: "svg-h-month", active: false, type: "month"},
  50. ],
  51. tableData: {
  52. column: [
  53. { name: "部件名称",field: "name" },
  54. { name: "MTBF",field: "v1", is_num: true },
  55. { name: "MTTR",field: "v2", is_num: true },
  56. { name: "损失电量(kw/h)",field: "v3",is_num: true },
  57. { name: "当前状态",field: "v4",
  58. template: function(data) {
  59. if (data == 1) return "<div class='dot green'></div>";
  60. else if (data == 2) return "<div class='dot purple'></div>";
  61. else if (data == 3) return "<div class='dot yellow'></div>";
  62. else if (data == 4) return "<div class='dot orange'></div>";
  63. },
  64. },
  65. ],
  66. data: [],
  67. },
  68. wtId: undefined,
  69. hisValue: {}, //健康走势图
  70. };
  71. },
  72. created() {
  73. this.wtId = this.$route.params.wtId;
  74. this.requestHisValue()
  75. this.requestMttrrand()
  76. },
  77. methods:{
  78. // 未确认缺陷按钮下的健康趋势选项
  79. onClickInfo(item) {
  80. this.infoList.forEach((element) => {
  81. if (item.type == element.type) {
  82. item.active = true;
  83. switch (item.type) {
  84. case "day":
  85. this.requestCoulometry(2);
  86. break;
  87. case "month":
  88. this.requestCoulometry(3);
  89. }
  90. } else {
  91. element.active = false;
  92. }
  93. });
  94. },
  95. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  96. requestCoulometry(type) {
  97. let that = this;
  98. that.API.requestData({
  99. method: "POST",
  100. subUrl: "recommen/findAllChartjz",
  101. data: { wpId: 0, type: type },
  102. success(res) {
  103. if (res.code == 200) {
  104. that.bardata.legend = ["优数量", "良数量", "差数量"];
  105. that.lineData = res.data.lvchart;
  106. that.bardata.area = res.data.datechart;
  107. that.bardata.data[2] = res.data.cslchart;
  108. that.bardata.data[1] = res.data.lslchart;
  109. that.bardata.data[0] = res.data.yslchart;
  110. }
  111. },
  112. });
  113. },
  114. //风机健康走势图
  115. requestHisValue(){
  116. let that = this;
  117. that.API.requestData({
  118. method: "POST",
  119. subUrl: "healthsub/findWtHisValueForBj",
  120. data: { wtId: that.wtId },
  121. success(res) {
  122. if(res.code == 200){
  123. let data = res.data;
  124. data.time = data.time.slice(0, 65)
  125. that.hisValue = data
  126. }
  127. },
  128. });
  129. },
  130. //部件健康情况
  131. requestMttrrand(){
  132. let that = this;
  133. that.API.requestData({
  134. method: "POST",
  135. subUrl: "healthsub/getWtMttrandMtbfByBj",
  136. data: { wtId: that.wtId },
  137. success(res) {
  138. if(res.code == 200){
  139. let data = res.data;
  140. that.tableData.data = [
  141. {name:data.clx[1], v1:data.clx[4], v2:data.clx[5], v3:data.clx[6], v4:data.clx[0]},
  142. {name:data.fdj[1], v1:data.fdj[4], v2:data.fdj[5], v3:data.fdj[6], v4:data.fdj[0]},
  143. {name:data.bj[1], v1:data.bj[4], v2:data.bj[5], v3:data.bj[6], v4:data.bj[0]},
  144. {name:data.zk[1], v1:data.zk[4], v2:data.zk[5], v3:data.zk[6], v4:data.zk[0]},
  145. {name:data.zz[1], v1:data.zz[4], v2:data.zz[5], v3:data.zz[6], v4:data.zz[0]},
  146. {name:data.ph[1], v1:data.ph[4], v2:data.ph[5], v3:data.ph[6], v4:data.ph[0]},
  147. {name:data.jc[1], v1:data.jc[4], v2:data.jc[5], v3:data.jc[6], v4:data.jc[0]},
  148. {name:data.bpq[1], v1:data.bpq[4], v2:data.bpq[5], v3:data.bpq[6], v4:data.bpq[0]},
  149. ]
  150. }
  151. },
  152. });
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="less">
  158. .health-7 {
  159. // 电量健康情况
  160. .power-info {
  161. display: flex;
  162. .info-tab {
  163. flex: 0 0 156px;
  164. display: flex;
  165. flex-direction: column;
  166. height: 350px;
  167. margin-right: 1.4815vh;
  168. .tab {
  169. position: relative;
  170. flex: 0 0 auto;
  171. text-align: center;
  172. line-height: 33px;
  173. margin-right: 8px;
  174. color: @gray-l;
  175. font-size: 12px;
  176. background: fade(@gray, 20);
  177. border: 1px solid fade(@gray, 20);
  178. display: flex;
  179. align-items: center;
  180. i {
  181. margin: 0 1.4815vh;
  182. svg use {
  183. fill: @gray-l;
  184. }
  185. }
  186. &:hover,
  187. &.active {
  188. background: fade(@green, 20);
  189. border: 1px solid @green;
  190. color: @green;
  191. cursor: pointer;
  192. i {
  193. svg use {
  194. fill: @green;
  195. }
  196. }
  197. }
  198. &.active::after {
  199. box-sizing: content-box;
  200. width: 0px;
  201. height: 0px;
  202. position: absolute;
  203. right: -19px;
  204. padding: 0;
  205. border-bottom: 9px solid @green;
  206. border-top: 9px solid transparent;
  207. border-left: 9px solid transparent;
  208. border-right: 9px solid transparent;
  209. display: block;
  210. content: "";
  211. z-index: 10;
  212. transform: rotate(90deg);
  213. }
  214. &.active::before {
  215. box-sizing: content-box;
  216. width: 0px;
  217. height: 0px;
  218. position: absolute;
  219. right: -17px;
  220. padding: 0;
  221. border-bottom: 9px solid #063319;
  222. border-top: 9px solid transparent;
  223. border-left: 9px solid transparent;
  224. border-right: 9px solid transparent;
  225. display: block;
  226. content: "";
  227. z-index: 12;
  228. transform: rotate(90deg);
  229. }
  230. & + .tab {
  231. margin-top: 0.7407vh;
  232. }
  233. &:last-child {
  234. text-align: center;
  235. justify-content: center;
  236. }
  237. }
  238. .empty {
  239. flex: 1 0 auto;
  240. }
  241. }
  242. .info-chart {
  243. flex: 1 0 auto;
  244. }
  245. }
  246. .data-list {
  247. .dot {
  248. width: 12px;
  249. height: 12px;
  250. margin: auto;
  251. &.green {
  252. background: @green;
  253. }
  254. &.purple {
  255. background: @purple;
  256. }
  257. &.yellow {
  258. background: @yellow;
  259. }
  260. &.orange {
  261. background: @orange;
  262. }
  263. }
  264. }
  265. }
  266. </style>