temperatureMatrix.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <el-dialog
  3. width="70%"
  4. @open="opened"
  5. @closed="closed"
  6. :fullscreen="true"
  7. :show-close="true"
  8. class="dialogs"
  9. >
  10. <template #title>
  11. <div class="showTitles currentShowTitles">
  12. <div class="titles">温度矩阵</div>
  13. </div>
  14. </template>
  15. <div class="body">
  16. <div class="title">
  17. <div
  18. :class="current === item.id ? 'title-onItem' : 'title-item'"
  19. v-for="(item, index) in stationList"
  20. :key="index"
  21. @click="handleChange(item.id)"
  22. >
  23. {{ item.address }}
  24. </div>
  25. </div>
  26. <div class="tables">
  27. <el-table
  28. :data="tableData"
  29. class="table"
  30. style="width: 100%"
  31. height="83vh"
  32. stripe
  33. :header-cell-style="{
  34. background: 'rgb(30,30,30)',
  35. color: 'rgb(220,220,220)',
  36. padding: '4px',
  37. fontSize: '14px',
  38. border: 'solid 1px rgba(77, 77, 77, 1)',
  39. }"
  40. :cell-style="tableCellStyle"
  41. >
  42. <el-table-column
  43. prop="windturbineId"
  44. label="风机"
  45. width="100"
  46. align="center"
  47. >
  48. </el-table-column>
  49. <el-table-column
  50. prop="stationId"
  51. label="风场"
  52. width="100"
  53. align="center"
  54. >
  55. </el-table-column>
  56. <el-table-column
  57. prop="windSpeed"
  58. label="风速"
  59. width="100"
  60. align="center"
  61. >
  62. </el-table-column>
  63. <el-table-column prop="power" label="功率" width="100" align="center">
  64. </el-table-column>
  65. <el-table-column
  66. prop="rollSpeed"
  67. label="发电机转速"
  68. width="100"
  69. align="center"
  70. >
  71. </el-table-column>
  72. <el-table-column
  73. v-for="(item, index) in contentList"
  74. :key="index"
  75. :label="item.name"
  76. align="center"
  77. >
  78. <el-table-column
  79. v-for="(res, index) in item.children"
  80. :prop="res.name"
  81. :key="index"
  82. :label="res.name"
  83. align="center"
  84. >
  85. </el-table-column>
  86. </el-table-column>
  87. </el-table>
  88. </div>
  89. </div>
  90. </el-dialog>
  91. </template>
  92. <script>
  93. import api from "api/index";
  94. export default {
  95. data() {
  96. return {
  97. contentList: [],
  98. tableData: [],
  99. partsArr: [],
  100. coordinates: [],
  101. stationList: [],
  102. current: "all",
  103. };
  104. },
  105. mounted() {},
  106. methods: {
  107. opened() {
  108. let stationList = [
  109. {
  110. id: "all",
  111. address: "全部风机",
  112. },
  113. ];
  114. let stations = this.$store.state.stationList;
  115. stations.forEach((item) => {
  116. if (item.id.indexOf("FDC") != -1) {
  117. stationList.push(item);
  118. }
  119. });
  120. this.stationList = stationList;
  121. this.coordinates = [];
  122. this.getData("");
  123. },
  124. handleChange(val) {
  125. this.current = val;
  126. this.getData(val === "all" ? "" : val);
  127. },
  128. getData(val) {
  129. api.temperatureInfo(val).then((res) => {
  130. let contentList = [];
  131. let tableDatas = [];
  132. res.data.forEach((item, index) => {
  133. let tableData = {};
  134. tableData.windturbineId = item.windturbineId;
  135. tableData.windSpeed = item.windSpeed.toFixed(1);
  136. tableData.stationId = item.stationId;
  137. tableData.rollSpeed = item.rollSpeed.toFixed(1);
  138. tableData.power = item.power.toFixed(1);
  139. item.temperatureComponentInfos.forEach((val) => {
  140. if (index === 0) {
  141. let obj = {
  142. children: [],
  143. };
  144. obj.name = val.name;
  145. val.temperatureItemInfos.forEach((temp) => {
  146. if (index === 0) {
  147. let str = {};
  148. str.name = temp.name;
  149. obj.children.push(str);
  150. }
  151. tableData[temp.name] = temp.value.toFixed(1);
  152. tableData[`${temp.name}Status`] = temp.status;
  153. });
  154. contentList.push(obj);
  155. } else {
  156. val.temperatureItemInfos.forEach((temp) => {
  157. tableData[temp.name] = temp.value.toFixed(1);
  158. tableData[`${temp.name}Status`] = temp.status;
  159. });
  160. }
  161. });
  162. tableDatas.push(tableData);
  163. });
  164. this.contentList = contentList;
  165. let arr = [];
  166. this.contentList.forEach((item) => {
  167. item.children.forEach((val) => {
  168. arr.push(val.name);
  169. });
  170. });
  171. this.partsArr = arr;
  172. tableDatas.forEach((item, indexx) => {
  173. for (const key in item) {
  174. if (item[key] === "BadPoint") {
  175. this.partsArr.forEach((val, indexy) => {
  176. if (key === `${val}Status`) {
  177. this.coordinates.push(`${indexx},${indexy + 5}`);
  178. }
  179. });
  180. }
  181. }
  182. });
  183. this.tableData = tableDatas;
  184. });
  185. },
  186. tableCellStyle({ row, column, rowIndex, columnIndex }) {
  187. let warningColor = false;
  188. let obj = {};
  189. this.coordinates.forEach((item) => {
  190. let arr = item.split(",");
  191. if (Number(arr[0]) === rowIndex && Number(arr[1]) === columnIndex) {
  192. warningColor = true;
  193. }
  194. });
  195. if (warningColor) {
  196. obj = {
  197. height: "40px",
  198. background: "rgba(186, 50, 55, 1)",
  199. color: "#FFFFFF",
  200. padding: "3px",
  201. fontSize: "12px",
  202. "border-top": "0px solid #000000",
  203. "border-bottom": "1px solid #000000",
  204. "border-right": "1px solid #000000",
  205. };
  206. } else {
  207. obj = {
  208. height: "40px",
  209. background: "rgb(30,30,30)",
  210. color: "rgb(220,220,220)",
  211. padding: "3px",
  212. fontSize: "12px",
  213. "border-top": "0px solid #000000",
  214. "border-bottom": "1px solid #000000",
  215. "border-right": "1px solid #000000",
  216. };
  217. }
  218. return obj;
  219. },
  220. },
  221. };
  222. </script>
  223. <style lang="less" scoped>
  224. .body {
  225. background-color: #000000;
  226. height: 89vh;
  227. width: 102%;
  228. margin-left: -1%;
  229. margin-top: -40px;
  230. }
  231. .title {
  232. display: flex;
  233. flex-direction: row;
  234. align-items: center;
  235. margin-left: 3vw;
  236. padding-top: 8px;
  237. position: absolute;
  238. width: 100%;
  239. background-color: #000000;
  240. padding-bottom: 10px;
  241. .title-item {
  242. background-color: #242424;
  243. border-radius: 4px;
  244. padding: 8px 27px 7px 25px;
  245. font-size: 14px;
  246. color: #b4bdc0;
  247. margin-right: 10px;
  248. }
  249. .title-onItem {
  250. background-color: rgba(37, 116, 219, 1);
  251. border-radius: 4px;
  252. padding: 8px 27px 7px 25px;
  253. font-size: 14px;
  254. color: #b4bdc0;
  255. margin-right: 10px;
  256. }
  257. }
  258. .tables {
  259. margin-left: 3vw;
  260. padding-top: 50px;
  261. }
  262. .el-table {
  263. position: static;
  264. background-color: #141414;
  265. border: 1px solid #000000;
  266. }
  267. </style>