Health8.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div class="health-8">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select
  9. v-model="value1"
  10. clearable
  11. placeholder="请选择"
  12. popper-class="select"
  13. @change="searchWindTurbineHealthList"
  14. >
  15. <el-option
  16. v-for="item in options"
  17. :key="item.id"
  18. :label="item.aname"
  19. :value="item.id"
  20. >
  21. </el-option>
  22. </el-select>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="table">
  28. <table style="width: 100%" border="0" cellspacing="0">
  29. <thead>
  30. <tr>
  31. <th rowspan="2" class="type1" style="width: 50px"></th>
  32. <th rowspan="2" class="type1" style="width: 105px">风机编号</th>
  33. <th rowspan="2" class="type1" style="width: 105px">风机型号</th>
  34. <th rowspan="2" class="type1" style="width: 350px">置信度</th>
  35. <th rowspan="2" class="type1" style="width: 100px">健康分数</th>
  36. <th
  37. rowspan="2"
  38. class="type1"
  39. style="border: 2px solid #07140f; border-left: 0"
  40. >
  41. 未来风机健康程度
  42. </th>
  43. <th colspan="8">组件健康度</th>
  44. </tr>
  45. <tr>
  46. <th style="width: 100px">齿轮箱</th>
  47. <th style="width: 100px">发电机</th>
  48. <th style="width: 100px">主轴</th>
  49. <th style="width: 100px">变桨</th>
  50. <th style="width: 100px">偏航</th>
  51. <th style="width: 100px">机舱</th>
  52. <th style="width: 100px">变频器</th>
  53. <th style="width: 100px">主控</th>
  54. </tr>
  55. </thead>
  56. </table>
  57. <el-scrollbar>
  58. <div style="height: calc(100vh - 174px)">
  59. <table style="width: 100%" border="0" cellspacing="0">
  60. <tbody>
  61. <tr v-for="(item, index) in tableData" :key="index">
  62. <td class="to" style="width: 50px">{{ item.id }}</td>
  63. <td class="to" style="width: 110px">{{ item.nemCode }}</td>
  64. <td class="to" style="width: 105px">{{ item.model }}</td>
  65. <td class="to" style="width: 300px">
  66. <div class="percent-item">
  67. {{ item.zxd }}%
  68. <div class="percent-bar" style="">
  69. <div
  70. class="percent-value"
  71. :style="{ width: `${item.zxd}%` }"
  72. ></div>
  73. </div>
  74. </div>
  75. </td>
  76. <td class="score" style="width: 100px">
  77. <div>{{ item.score }}</div>
  78. </td>
  79. <td>
  80. <table-line-chart
  81. :width="'370px'"
  82. :list="item.futureHealth"
  83. />
  84. </td>
  85. <td class="item">
  86. <div :class="[color(item.clx)]">{{ item.clx }}</div>
  87. </td>
  88. <td class="item">
  89. <div :class="[color(item.fdj)]">{{ item.fdj }}</div>
  90. </td>
  91. <td class="item">
  92. <div :class="[color(item.zz)]">{{ item.zz }}</div>
  93. </td>
  94. <td class="item">
  95. <div :class="[color(item.bj)]">{{ item.bj }}</div>
  96. </td>
  97. <td class="item">
  98. <div :class="[color(item.ph)]">{{ item.ph }}</div>
  99. </td>
  100. <td class="item">
  101. <div :class="[color(item.jc)]">{{ item.jc }}</div>
  102. </td>
  103. <td class="item">
  104. <div :class="[color(item.bpq)]">{{ item.bpq }}</div>
  105. </td>
  106. <td class="item">
  107. <div :class="[color(item.zk)]">{{ item.zk }}</div>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. </div>
  113. </el-scrollbar>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. import TableLineChart from "../../components/chart/line/table-line-chart.vue";
  119. import api from "@api/wisdomOverhaul/health/index.js";
  120. import axios from "axios";
  121. export default {
  122. setup() {},
  123. components: { TableLineChart },
  124. data() {
  125. return {
  126. options: [
  127. {
  128. value: "选项1",
  129. label: "黄金糕",
  130. },
  131. {
  132. value: "选项2",
  133. label: "双皮奶",
  134. },
  135. {
  136. value: "选项3",
  137. label: "蚵仔煎",
  138. },
  139. {
  140. value: "选项4",
  141. label: "龙须面",
  142. },
  143. {
  144. value: "选项5",
  145. label: "北京烤鸭",
  146. },
  147. ],
  148. value1: "",
  149. tableData: "",
  150. colorval: {
  151. 优: "purple",
  152. 良: "orange",
  153. 差: "red",
  154. },
  155. };
  156. futureHealth: null;
  157. },
  158. created() {
  159. this.search();
  160. },
  161. methods: {
  162. color(val) {
  163. return this.colorval[val];
  164. },
  165. async search() {
  166. axios({
  167. method: "get",
  168. baseURL: process.env.VUE_APP_API,
  169. url: `/benchmarking/wpByCplist?companyids=SXJ_RGN&type=-1`,
  170. }).then((res) => {
  171. if (res.data.data.code === 200) {
  172. this.options = res.data.data?.data || [];
  173. this.value1 = this?.options?.[0].id || "";
  174. this.searchWindTurbineHealthList();
  175. }
  176. });
  177. },
  178. async searchWindTurbineHealthList() {
  179. const { data } = await api.wtHealthListWindTurbineHealthList({
  180. wpId: this.value1,
  181. });
  182. this.tableData = data;
  183. data.forEach((k) => {
  184. let arr = [];
  185. k.futureHealth.forEach((e, index) => {
  186. let obj = {
  187. text: index,
  188. value: e,
  189. };
  190. arr.push(obj);
  191. });
  192. k.futureHealth = arr;
  193. });
  194. },
  195. },
  196. };
  197. </script>
  198. <style lang="less">
  199. .health-8 {
  200. .table {
  201. tbody {
  202. tr:nth-child(2n) td {
  203. background-color: fade(@gray, 20%);
  204. &.item {
  205. background-color: transparent;
  206. }
  207. }
  208. }
  209. th {
  210. background: fade(@gray, 40);
  211. font-size: 12px;
  212. font-weight: 400;
  213. line-height: 24px;
  214. color: @gray-l;
  215. border: 2px solid #07140f;
  216. &.type1 {
  217. border-left: 0;
  218. border-right: 0;
  219. }
  220. }
  221. td {
  222. color: @gray-l;
  223. text-align: center;
  224. height: 26px;
  225. line-height: 26px;
  226. &.item {
  227. width: 100px;
  228. div {
  229. color: @white;
  230. background: fade(@gray, 20);
  231. margin: 2px;
  232. border: 1px solid transparent;
  233. &.green {
  234. color: @green;
  235. background: fade(@green, 20);
  236. border-color: @green;
  237. }
  238. &.purple {
  239. color: @purple;
  240. background: fade(@purple, 20);
  241. border-color: @purple;
  242. }
  243. &.orange {
  244. color: @orange;
  245. background: fade(@orange, 20);
  246. border-color: @orange;
  247. }
  248. &.red {
  249. color: @red;
  250. background: fade(@red, 20);
  251. border-color: @red;
  252. }
  253. }
  254. }
  255. &.to {
  256. display: inline-block;
  257. overflow: hidden;
  258. text-overflow: ellipsis;
  259. white-space: nowrap;
  260. }
  261. }
  262. .percent-item {
  263. display: flex;
  264. align-items: center;
  265. justify-content: center;
  266. height: 34px;
  267. .percent-bar {
  268. height: 12px;
  269. width: 170px;
  270. background: transparent;
  271. border: 1px solid @gray-l;
  272. margin-left: 8px;
  273. .percent-value {
  274. height: calc(100% - 4px);
  275. background: @green;
  276. margin: 2px;
  277. }
  278. }
  279. }
  280. .score {
  281. width: 100px;
  282. div {
  283. background: fade(@gray, 20);
  284. }
  285. }
  286. }
  287. }
  288. </style>