healthLineChart2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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
  23. :height="'310px'"
  24. :bardata="bardata"
  25. :lineData="lineData"
  26. />
  27. </panel>
  28. </div>
  29. </div>
  30. <div class="fc-info mg-b-16">
  31. <panel :title="'健康走势图'" :showLine="false">
  32. <normal-line-chart :list="hisValue" :height="'150px'" :units="['']" />
  33. </panel>
  34. </div>
  35. <div class="data-list">
  36. <Table :data="tableData" :canScroll="true" />
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import VertivalBarLineChart from "../../components/chart/combination/health-bar-line-chart.vue";
  42. import NormalLineChart from "../../components/chart/line/normal-line-chart.vue";
  43. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  44. import Panel from "../../components/coms/panel/panel.vue";
  45. import Table from "../../components/coms/table/table.vue";
  46. import WtChooser from "@com/coms/wt-chooser/wt-chooser.vue";
  47. import api from "@api/wisdomOverhaul/health/index.js";
  48. export default {
  49. setup() {},
  50. components: {
  51. SvgIcon,
  52. Panel,
  53. VertivalBarLineChart,
  54. NormalLineChart,
  55. Table,
  56. WtChooser,
  57. },
  58. data() {
  59. return {
  60. infoList: [
  61. // {title: '24小时健康趋势', svgid: 'svg-24-houre', active: false, type: 'houre'},
  62. { title: "7日健康趋势", svgid: "svg-h-day", active: true, type: "day" },
  63. {
  64. title: "30日健康趋势",
  65. svgid: "svg-h-month",
  66. active: false,
  67. type: "month",
  68. },
  69. ],
  70. tableData: {
  71. column: [
  72. { name: "部件名称", field: "name" },
  73. { name: "MTBF(h)", field: "mtbf", is_num: true },
  74. { name: "MTTR(h)", field: "mttr", is_num: true },
  75. { name: "损失电量(kw/h)", field: "lost", is_num: true },
  76. {
  77. name: "当前状态",
  78. field: "status",
  79. template: function (data, row) {
  80. return `<div class="dot" style="background:${row.status}"></div>`;
  81. },
  82. },
  83. ],
  84. data: [],
  85. },
  86. bardata: { area: [], legend: [], data: [] }, // 损失电量分析echart数值
  87. lineData: [],
  88. wtId: undefined,
  89. wpId: undefined,
  90. //健康走势图
  91. hisValue: [
  92. {
  93. title: "",
  94. yAxisIndex: 0,
  95. value: [],
  96. },
  97. ],
  98. };
  99. },
  100. created() {
  101. this.init();
  102. },
  103. methods: {
  104. init() {
  105. this.wtId = this.$route.params.wtId;
  106. this.wpId = this.$route.params.wpId;
  107. this.requestCoulometry(2);
  108. this.requestHisValue();
  109. this.requestMttrrand();
  110. },
  111. switchWt(data) {
  112. this.$router.push(
  113. `/health/health4/healthLineChart2/${data.wpId}/${data.wtId}`
  114. );
  115. this.init();
  116. },
  117. // 未确认缺陷按钮下的健康趋势选项
  118. onClickInfo(item) {
  119. this.infoList.forEach((element) => {
  120. if (item.type == element.type) {
  121. item.active = true;
  122. switch (item.type) {
  123. case "day":
  124. this.requestCoulometry(2);
  125. break;
  126. case "month":
  127. this.requestCoulometry(3);
  128. }
  129. } else {
  130. element.active = false;
  131. }
  132. });
  133. },
  134. // 损失电量分析 type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
  135. requestCoulometry(type) {
  136. api
  137. .findAllChartjz({
  138. wpId: 0,
  139. type: type,
  140. })
  141. .then((res) => {
  142. if (res.code == 200) {
  143. this.bardata.legend = ["优数量", "良数量", "差数量"];
  144. this.lineData = res.data.lvchart;
  145. this.bardata.area = res.data.datechart;
  146. this.bardata.data[2] = res.data.cslchart;
  147. this.bardata.data[1] = res.data.lslchart;
  148. this.bardata.data[0] = res.data.yslchart;
  149. }
  150. });
  151. // let that = this;
  152. // that.API.requestData({
  153. // method: "POST",
  154. // timeout: 8000,
  155. // subUrl: "recommen/findAllChartjz",
  156. // data: { wpId: 0, type: type },
  157. // success(res) {
  158. // if (res.code == 200) {
  159. // that.bardata.legend = ["优数量", "良数量", "差数量"];
  160. // that.lineData = res.data.lvchart;
  161. // that.bardata.area = res.data.datechart;
  162. // that.bardata.data[2] = res.data.cslchart;
  163. // that.bardata.data[1] = res.data.lslchart;
  164. // that.bardata.data[0] = res.data.yslchart;
  165. // }
  166. // },
  167. // });
  168. },
  169. //风机健康走势图
  170. requestHisValue() {
  171. api
  172. .healthsubFindWtHisValueForBj({
  173. wtId: this.wtId,
  174. })
  175. .then((res) => {
  176. if (res.code == 200) {
  177. let hisValue = [];
  178. res.data.data.forEach((pELe, pIndex) => {
  179. let value = [];
  180. pELe.forEach((cEle, cIndex) => {
  181. value.push({
  182. text: res.data.time[cIndex],
  183. value: cEle,
  184. });
  185. });
  186. let hisValueItem = {
  187. title: res.data.name[pIndex],
  188. yAxisIndex: 0,
  189. value,
  190. };
  191. hisValue.push(hisValueItem);
  192. });
  193. this.hisValue = hisValue;
  194. }
  195. });
  196. },
  197. //部件健康情况
  198. requestMttrrand() {
  199. api
  200. .healthsubGetWtMttrandMtbfByBj({
  201. wtId: this.wtId,
  202. })
  203. .then((res) => {
  204. if (res.code == 200) {
  205. let tableData = [];
  206. const sortKey = ["clx", "fdj", "bj", "zk", "zz", "ph", "jc", "bpq"];
  207. sortKey.forEach((key) => {
  208. const tableItem = {
  209. name: res.data[key][1],
  210. mtbf: res.data[key][4],
  211. mttr: res.data[key][5],
  212. lost: res.data[key][6],
  213. status: res.data[key][0],
  214. };
  215. tableData.push(tableItem);
  216. });
  217. this.tableData.data = tableData;
  218. }
  219. });
  220. // let that = this;
  221. // that.API.requestData({
  222. // method: "POST",
  223. // subUrl: "healthsub/getWtMttrandMtbfByBj",
  224. // data: { wtId: that.wtId },
  225. // success(res) {
  226. // if (res.code == 200) {
  227. // let data = res.data;
  228. // that.tableData.data = [
  229. // {
  230. // name: data.clx[1],
  231. // v1: data.clx[4],
  232. // v2: data.clx[5],
  233. // v3: data.clx[6],
  234. // v4: data.clx[0],
  235. // },
  236. // {
  237. // name: data.fdj[1],
  238. // v1: data.fdj[4],
  239. // v2: data.fdj[5],
  240. // v3: data.fdj[6],
  241. // v4: data.fdj[0],
  242. // },
  243. // {
  244. // name: data.bj[1],
  245. // v1: data.bj[4],
  246. // v2: data.bj[5],
  247. // v3: data.bj[6],
  248. // v4: data.bj[0],
  249. // },
  250. // {
  251. // name: data.zk[1],
  252. // v1: data.zk[4],
  253. // v2: data.zk[5],
  254. // v3: data.zk[6],
  255. // v4: data.zk[0],
  256. // },
  257. // {
  258. // name: data.zz[1],
  259. // v1: data.zz[4],
  260. // v2: data.zz[5],
  261. // v3: data.zz[6],
  262. // v4: data.zz[0],
  263. // },
  264. // {
  265. // name: data.ph[1],
  266. // v1: data.ph[4],
  267. // v2: data.ph[5],
  268. // v3: data.ph[6],
  269. // v4: data.ph[0],
  270. // },
  271. // {
  272. // name: data.jc[1],
  273. // v1: data.jc[4],
  274. // v2: data.jc[5],
  275. // v3: data.jc[6],
  276. // v4: data.jc[0],
  277. // },
  278. // {
  279. // name: data.bpq[1],
  280. // v1: data.bpq[4],
  281. // v2: data.bpq[5],
  282. // v3: data.bpq[6],
  283. // v4: data.bpq[0],
  284. // },
  285. // ];
  286. // }
  287. // },
  288. // });
  289. },
  290. },
  291. };
  292. </script>
  293. <style lang="less">
  294. .health-7 {
  295. // 电量健康情况
  296. .power-info {
  297. display: flex;
  298. .info-tab {
  299. flex: 0 0 156px;
  300. display: flex;
  301. flex-direction: column;
  302. height: 350px;
  303. margin-right: 1.4815vh;
  304. .tab {
  305. position: relative;
  306. flex: 0 0 auto;
  307. text-align: center;
  308. line-height: 33px;
  309. margin-right: 8px;
  310. color: @gray-l;
  311. font-size: 12px;
  312. background: fade(@gray, 20);
  313. border: 1px solid fade(@gray, 20);
  314. display: flex;
  315. align-items: center;
  316. i {
  317. margin: 0 1.4815vh;
  318. svg use {
  319. fill: @gray-l;
  320. }
  321. }
  322. &:hover,
  323. &.active {
  324. background: fade(@green, 20);
  325. border: 1px solid @green;
  326. color: @green;
  327. cursor: pointer;
  328. i {
  329. svg use {
  330. fill: @green;
  331. }
  332. }
  333. }
  334. &.active::after {
  335. box-sizing: content-box;
  336. width: 0px;
  337. height: 0px;
  338. position: absolute;
  339. right: -19px;
  340. padding: 0;
  341. border-bottom: 9px solid @green;
  342. border-top: 9px solid transparent;
  343. border-left: 9px solid transparent;
  344. border-right: 9px solid transparent;
  345. display: block;
  346. content: "";
  347. z-index: 10;
  348. transform: rotate(90deg);
  349. }
  350. &.active::before {
  351. box-sizing: content-box;
  352. width: 0px;
  353. height: 0px;
  354. position: absolute;
  355. right: -17px;
  356. padding: 0;
  357. border-bottom: 9px solid #063319;
  358. border-top: 9px solid transparent;
  359. border-left: 9px solid transparent;
  360. border-right: 9px solid transparent;
  361. display: block;
  362. content: "";
  363. z-index: 12;
  364. transform: rotate(90deg);
  365. }
  366. & + .tab {
  367. margin-top: 0.7407vh;
  368. }
  369. &:last-child {
  370. text-align: center;
  371. justify-content: center;
  372. }
  373. }
  374. .empty {
  375. flex: 1 0 auto;
  376. }
  377. }
  378. .info-chart {
  379. flex: 1 0 auto;
  380. }
  381. }
  382. .data-list {
  383. .dot {
  384. width: 12px;
  385. height: 12px;
  386. margin: auto;
  387. &.green {
  388. background: @green;
  389. }
  390. &.purple {
  391. background: @purple;
  392. }
  393. &.yellow {
  394. background: @yellow;
  395. }
  396. &.orange {
  397. background: @orange;
  398. }
  399. }
  400. }
  401. }
  402. </style>