healthLineChart2.vue 8.7 KB

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