alarm-center.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="alarm-center">
  3. <div class="action-bar">
  4. <div class="selections mg-b-16">
  5. <div v-for="(tabItem, tabIndex) in tabLists" :key="tabItem.type" class="item" :class="{ active: tabIndex == cureent }" @click="tabSelect(tabItem.type, tabIndex)">
  6. {{ tabItem.name }}
  7. </div>
  8. <!-- <div class="item" @click="tabSelect(0)" :class="{ active: tabIndex == 0 }">发电机</div>
  9. <div class="item" @click="tabSelect(1)" :class="{ active: tabIndex == 1 }">齿轮箱</div>
  10. <div class="item" @click="tabSelect(2)" :class="{ active: tabIndex == 2 }">变桨系统</div>
  11. <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 3 }">液压站</div>
  12. <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 4 }">风机震动</div>
  13. <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 5 }">其他参数</div> -->
  14. </div>
  15. <div class="query mg-b-16">
  16. <div class="query-items">
  17. <div class="query-item">
  18. <div class="lable">风场:</div>
  19. <div class="search-input">
  20. <el-select v-model="optSelectValue" clearable placeholder="请选择" popper-class="select" @change="handelSelectChange">
  21. <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"> </el-option>
  22. </el-select>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="query-actions">
  27. <button class="btn green" @click="handelSelectChange">搜索</button>
  28. </div>
  29. </div>
  30. </div>
  31. <el-scrollbar>
  32. <div class="fj">
  33. <div class="fj-item" v-for="(item, index) in tableLists" :key="index">
  34. <div class="fj-title">风机编号:{{ item[0].wtId }}</div>
  35. <div class="fj-info">
  36. <Table :data="handleTable(item)"></Table>
  37. </div>
  38. </div>
  39. </div>
  40. <!-- <div class="fj">
  41. <div class="fj-item" v-for="index in 25" :key="index">
  42. <div class="fj-title">风机编号:000</div>
  43. <div class="fj-info">
  44. <Table :data="tableData"></Table>
  45. </div>
  46. </div>
  47. </div> -->
  48. </el-scrollbar>
  49. </div>
  50. </template>
  51. <script>
  52. import Table from "../../components/coms/table/table.vue";
  53. export default {
  54. components: { Table },
  55. data() {
  56. return {
  57. cureent: 0,
  58. optSelectValue: "",
  59. tabLists: [
  60. {
  61. type: "fdj",
  62. name: "发电机",
  63. },
  64. {
  65. type: "clx",
  66. name: "齿轮箱",
  67. },
  68. {
  69. type: "bj",
  70. name: "变桨系统",
  71. },
  72. {
  73. type: "yyz",
  74. name: "液压站",
  75. },
  76. {
  77. type: "zd",
  78. name: "风机震动",
  79. },
  80. {
  81. type: "qt",
  82. name: "其他参数",
  83. },
  84. ],
  85. // tableData: {
  86. // column: [
  87. // {
  88. // name: "",
  89. // field: "name",
  90. // is_num: false,
  91. // is_light: false,
  92. // },
  93. // {
  94. // name: "",
  95. // field: "value",
  96. // is_num: false,
  97. // is_light: false,
  98. // },
  99. // ],
  100. // data: [
  101. // // {
  102. // // name: "发电机绕组U1温度",
  103. // // desc: "1234.56",
  104. // // },
  105. // ],
  106. // },
  107. tableLists: [],
  108. options: [],
  109. type: "",
  110. timmer: null, // 遮罩开关
  111. };
  112. },
  113. methods: {
  114. tabSelect(type, index) {
  115. this.cureent = index;
  116. this.type = type;
  117. this.getList(true);
  118. },
  119. handleTable(item) {
  120. let tableData = {
  121. column: [
  122. {
  123. name: "",
  124. field: "name",
  125. is_num: false,
  126. is_light: false,
  127. },
  128. {
  129. name: "",
  130. field: "value",
  131. is_num: false,
  132. is_light: false,
  133. },
  134. ],
  135. data: item,
  136. };
  137. return tableData;
  138. },
  139. handelSelectChange() {
  140. this.getList(true);
  141. },
  142. getList(showLoading) {
  143. let _this = this;
  144. _this.API.requestData({
  145. showLoading,
  146. method: "POST",
  147. subUrl: "/temperature/getTemperatureList",
  148. data: {
  149. type: this.type,
  150. wpId: this.optSelectValue,
  151. },
  152. success(res) {
  153. _this.tableLists = res.data;
  154. // this.tableData.data = res.data
  155. // debugger
  156. console.log(res);
  157. },
  158. });
  159. },
  160. getSelectLists(showLoading) {
  161. let _this = this;
  162. _this.API.requestData({
  163. showLoading,
  164. method: "GET",
  165. subUrl: "/powercompare/windfarmAjax",
  166. success(res) {
  167. _this.options = res.data;
  168. _this.optSelectValue = res.data[0].id;
  169. _this.$nextTick(() => {
  170. _this.getList(false);
  171. _this.timmer = setInterval(() => {
  172. _this.getList(false);
  173. }, _this.$store.state.websocketTimeSec);
  174. });
  175. },
  176. });
  177. },
  178. },
  179. created() {
  180. // for (let i = 1; i < 7; i++) {
  181. // this.tableData.data.push(JSON.parse(JSON.stringify(this.tableData.data[0])));
  182. // }
  183. this.type = this.tabLists[0].type;
  184. this.getSelectLists(false);
  185. // this.getList()
  186. },
  187. unmounted() {
  188. clearInterval(this.timmer);
  189. this.timmer = null;
  190. },
  191. };
  192. </script>
  193. <style lang="less">
  194. .alarm-center {
  195. .action-bar {
  196. display: flex;
  197. .selections {
  198. flex: 1 0 auto;
  199. display: flex;
  200. .item {
  201. flex: 0 0 164px;
  202. text-align: center;
  203. height: 33px;
  204. line-height: 33px;
  205. margin-right: 8px;
  206. color: @font-color;
  207. font-size: @fontsize-s;
  208. background: fade(@gray, 20);
  209. border: 1px solid fade(@gray, 20);
  210. &:hover,
  211. &.active {
  212. background: fade(@green, 20);
  213. border: 1px solid @green;
  214. color: @green;
  215. cursor: pointer;
  216. }
  217. }
  218. }
  219. .query {
  220. flex: 1 0 0;
  221. justify-content: left;
  222. }
  223. }
  224. .fj {
  225. display: flex;
  226. flex-wrap: wrap;
  227. width: 100%;
  228. height: calc(100vh - 126px);
  229. .fj-item {
  230. flex: 0 0 calc(100% / 5 - 8px);
  231. outline: 1px solid fade(@gray, 50);
  232. margin-top: 8px;
  233. .fj-title {
  234. text-align: center;
  235. height: 30px;
  236. line-height: 30px;
  237. background: fade(@gray, 30);
  238. font-size: 12px;
  239. color: @gray-l;
  240. }
  241. thead {
  242. display: none;
  243. }
  244. & + .fj-item {
  245. margin-left: 8px;
  246. }
  247. &:nth-child(5n + 1) {
  248. margin-left: 0px;
  249. }
  250. }
  251. }
  252. }
  253. </style>