index.vue 11 KB

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