Health8.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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.name"
  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 style="width: 50px">{{ item.id }}</td>
  63. <td style="width: 105px">{{ item.wtname }}</td>
  64. <td style="width: 105px">{{ item.model }}</td>
  65. <td style="width: 350px">
  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 :list="item.futureHealth" />
  81. </td>
  82. <td class="item">
  83. <div :class="[color(item.clx)]">{{ item.clx }}</div>
  84. </td>
  85. <td class="item">
  86. <div :class="[color(item.fdj)]">{{ item.fdj }}</div>
  87. </td>
  88. <td class="item">
  89. <div :class="[color(item.zz)]">{{ item.zz }}</div>
  90. </td>
  91. <td class="item">
  92. <div :class="[color(item.bj)]">{{ item.bj }}</div>
  93. </td>
  94. <td class="item">
  95. <div :class="[color(item.ph)]">{{ item.ph }}</div>
  96. </td>
  97. <td class="item">
  98. <div :class="[color(item.jc)]">{{ item.jc }}</div>
  99. </td>
  100. <td class="item">
  101. <div :class="[color(item.bpq)]">{{ item.bpq }}</div>
  102. </td>
  103. <td class="item">
  104. <div :class="[color(item.zk)]">{{ item.zk }}</div>
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. </div>
  110. </el-scrollbar>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import TableLineChart from "../../components/chart/line/table-line-chart.vue";
  116. export default {
  117. setup() {},
  118. components: { TableLineChart },
  119. data() {
  120. return {
  121. options: [
  122. {
  123. value: "选项1",
  124. label: "黄金糕",
  125. },
  126. {
  127. value: "选项2",
  128. label: "双皮奶",
  129. },
  130. {
  131. value: "选项3",
  132. label: "蚵仔煎",
  133. },
  134. {
  135. value: "选项4",
  136. label: "龙须面",
  137. },
  138. {
  139. value: "选项5",
  140. label: "北京烤鸭",
  141. },
  142. ],
  143. value1: "",
  144. tableData: "",
  145. colorval: {
  146. 优: "purple",
  147. 良: "orange",
  148. 差: "red",
  149. },
  150. };
  151. futureHealth: null;
  152. },
  153. created() {
  154. this.search();
  155. },
  156. methods: {
  157. color(val) {
  158. return this.colorval[val];
  159. },
  160. async search() {
  161. const { data } = await this.API.requestData({
  162. subUrl: "powercompare/windfarmAjax",
  163. });
  164. this.options = data.data;
  165. this.value1 = data.data[0].id;
  166. this.searchWindTurbineHealthList();
  167. },
  168. async searchWindTurbineHealthList() {
  169. const { data } = await this.API.requestData({
  170. subUrl: "wtHealthList/windTurbineHealthList",
  171. method: "POST",
  172. data: {
  173. wpId: this.value1,
  174. },
  175. });
  176. this.tableData = data.data;
  177. console.warn(data.data);
  178. data.data.forEach((k) => {
  179. let arr =[]
  180. k.futureHealth.forEach((e, index) => {
  181. let obj = {
  182. text: index,
  183. value: e,
  184. };
  185. arr.push(obj)
  186. });
  187. k.futureHealth = arr
  188. });
  189. console.warn(this.tableData);
  190. },
  191. },
  192. };
  193. </script>
  194. <style lang="less">
  195. .health-8 {
  196. .table {
  197. tbody {
  198. tr:nth-child(2n) td {
  199. background-color: fade(@gray, 20%);
  200. &.item {
  201. background-color: transparent;
  202. }
  203. }
  204. }
  205. th {
  206. background: fade(@gray, 40);
  207. font-size: 12px;
  208. font-weight: 400;
  209. line-height: 24px;
  210. color: @gray-l;
  211. border: 2px solid #07140f;
  212. &.type1 {
  213. border-left: 0;
  214. border-right: 0;
  215. }
  216. }
  217. td {
  218. color: @gray-l;
  219. text-align: center;
  220. height: 26px;
  221. line-height: 26px;
  222. &.item {
  223. width: 100px;
  224. div {
  225. color: @white;
  226. background: fade(@gray, 20);
  227. margin: 2px;
  228. border: 1px solid transparent;
  229. &.green {
  230. color: @green;
  231. background: fade(@green, 20);
  232. border-color: @green;
  233. }
  234. &.purple {
  235. color: @purple;
  236. background: fade(@purple, 20);
  237. border-color: @purple;
  238. }
  239. &.orange {
  240. color: @orange;
  241. background: fade(@orange, 20);
  242. border-color: @orange;
  243. }
  244. &.red {
  245. color: @red;
  246. background: fade(@red, 20);
  247. border-color: @red;
  248. }
  249. }
  250. }
  251. }
  252. .percent-item {
  253. display: flex;
  254. align-items: center;
  255. justify-content: center;
  256. height: 34px;
  257. .percent-bar {
  258. height: 12px;
  259. width: 170px;
  260. background: transparent;
  261. border: 1px solid @gray-l;
  262. margin-left: 8px;
  263. .percent-value {
  264. height: calc(100% - 4px);
  265. background: @green;
  266. margin: 2px;
  267. }
  268. }
  269. }
  270. .score {
  271. width: 100px;
  272. div {
  273. background: fade(@gray, 20);
  274. }
  275. }
  276. }
  277. }
  278. </style>