healthLineChart2.vue 8.0 KB

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