index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!--
  2. - Copyright (c) 2018-2025, lengleng All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions are met:
  6. -
  7. - Redistributions of source code must retain the above copyright notice,
  8. - this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. - notice, this list of conditions and the following disclaimer in the
  11. - documentation and/or other materials provided with the distribution.
  12. - Neither the name of the pig4cloud.com developer nor the names of its
  13. - contributors may be used to endorse or promote products derived from
  14. - this software without specific prior written permission.
  15. - Author: lengleng (wangiegie@gmail.com)
  16. -->
  17. <template>
  18. <div class="execution">
  19. <div style="display: inline-block">
  20. <div class="startTime" style="display: inline-block">
  21. <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;起始时间:</span>
  22. <el-date-picker
  23. v-model="startTime"
  24. :clearable="false"
  25. type="datetime"
  26. value-format="timestamp"
  27. placeholder="选择日期">
  28. </el-date-picker>
  29. </div>
  30. <div class="endTime" style="display: inline-block">
  31. <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;截止时间:</span>
  32. <el-date-picker
  33. v-model="endTime"
  34. :clearable="false"
  35. type="datetime"
  36. value-format="timestamp"
  37. placeholder="选择日期">
  38. </el-date-picker>
  39. </div>
  40. <span style="font-weight: bold;font-size: 14px">&#12288;场站名称:</span>
  41. <el-select style="width:250px" v-model="stationCode" @change="getAllWindturbineInfo" size="small">
  42. <el-option
  43. v-for="item in stationList"
  44. :key="item.value"
  45. :label="item.label"
  46. :value="item.value">
  47. <span style="float: left">{{ item.label }}</span>
  48. <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
  49. </el-option>
  50. </el-select>
  51. &nbsp;
  52. <span style="font-weight: bold;font-size: 14px">&#12288;所属设备:</span>
  53. <el-select style="width:250px" v-model="equipmentId" filterable size="small">
  54. <el-option
  55. v-for="item in windturbineInfoList"
  56. :key="item.value"
  57. :label="item.label"
  58. :value="item.value">
  59. <span style="float: left">{{ item.label }}</span>
  60. <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
  61. </el-option>
  62. </el-select>
  63. &nbsp;
  64. <div class="timeQuery" style="display: inline-block">
  65. <el-button size="small" :loading="loading" @click="dateQuery">查询</el-button>
  66. </div>
  67. </div>
  68. <basic-container>
  69. <avue-crud ref="crud"
  70. :page.sync="page"
  71. :data="tableData"
  72. :table-loading="tableLoading"
  73. :option="tableOption"
  74. @search-change="searchChange"
  75. @refresh-change="refreshChange"
  76. @size-change="sizeChange"
  77. @current-change="currentChange">
  78. </avue-crud>
  79. </basic-container>
  80. </div>
  81. </template>
  82. <script>
  83. import {
  84. getStation,
  85. getAllWindturbineInfo,
  86. getByStationCodeAndEquipmentIdAndTimeBetween
  87. } from '@/api/windturbinestatusdata'
  88. import {tableOption} from '@/const/crud/windturbinestatusdata'
  89. import {mapGetters} from 'vuex'
  90. export default {
  91. name: 'windturbinestatusdata',
  92. data() {
  93. return {
  94. startTime: new Date(new Date().toLocaleDateString()).getTime(),
  95. endTime: new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000 - 1,
  96. stationList: [],
  97. stationCode: [],
  98. loading: false,
  99. windturbineInfoList: [],
  100. equipmentId: '',
  101. searchForm: {},
  102. tableData: [],
  103. page: {
  104. total: 0, // 总页数
  105. currentPage: 1, // 当前页数
  106. pageSize: 20 // 每页显示多少条
  107. },
  108. tableLoading: false,
  109. tableOption: tableOption
  110. }
  111. },
  112. computed: {
  113. ...mapGetters(['permissions']),
  114. permissionList() {
  115. return {
  116. addBtn: this.vaildData(this.permissions.idp_windturbinestatusdata_add, false),
  117. delBtn: this.vaildData(this.permissions.idp_windturbinestatusdata_del, false),
  118. editBtn: this.vaildData(this.permissions.idp_windturbinestatusdata_edit, false)
  119. };
  120. }
  121. },
  122. mounted() {
  123. this.getStationCode()
  124. },
  125. methods: {
  126. dateQuery() {
  127. if (this.equipmentId === '' || this.equipmentId == null) {
  128. return alert("请选择所属设备")
  129. }
  130. this.tableLoading = true
  131. const param = new URLSearchParams()
  132. param.append('page', this.page)
  133. param.append('stationCode', this.stationCode)
  134. param.append("equipmentId", this.equipmentId)
  135. param.append('startTime', this.startTime)
  136. param.append('endTime', this.endTime)
  137. getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
  138. this.tableData = response.data.data.records
  139. this.page.total = response.data.data.total
  140. this.tableLoading = false
  141. }).catch(() => {
  142. this.tableLoading = false
  143. })
  144. },
  145. getStationCode() {
  146. this.tableLoading = true
  147. getStation().then(response => {
  148. this.stationList = response.data.data
  149. if (this.stationList.length > 0) {
  150. this.stationCode = this.stationList[0].value
  151. }
  152. this.getAllWindturbineInfo()
  153. this.tableLoading = false
  154. })
  155. },
  156. getAllWindturbineInfo() {
  157. this.windturbineInfoList = []
  158. this.equipmentId = ''
  159. this.tableLoading = true
  160. const param = new URLSearchParams()
  161. param.append('stationCode', this.stationCode)
  162. getAllWindturbineInfo(param).then(response => {
  163. this.windturbineInfoList = response.data.data
  164. if (this.windturbineInfoList.length > 0) {
  165. this.equipmentId = this.windturbineInfoList[0].value
  166. }
  167. this.tableLoading = false
  168. })
  169. },
  170. sizeChange(pageSize) {
  171. this.page.pageSize = pageSize
  172. },
  173. currentChange(current) {
  174. this.page.currentPage = current
  175. },
  176. searchChange(form, done) {
  177. this.searchForm = form
  178. this.page.currentPage = 1
  179. this.dateQuery(this.page, form)
  180. done()
  181. },
  182. refreshChange() {
  183. this.dateQuery()
  184. }
  185. }
  186. }
  187. </script>