index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 class="startTime" style="display: inline-block">
  20. <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;起始时间:</span>
  21. <el-date-picker
  22. v-model="createDate"
  23. :clearable="false"
  24. type="date"
  25. value-format="timestamp"
  26. placeholder="选择日期">
  27. </el-date-picker>
  28. </div>
  29. <div style="display: inline-block">
  30. <span style="font-weight: bold;font-size: 14px">&#12288;场站名称:</span>
  31. <el-select style="width:250px" clearable v-model="stationCode" size="small">
  32. <el-option
  33. v-for="item in stationList"
  34. :key="item.value"
  35. :label="item.label"
  36. :value="item.value">
  37. <span style="float: left">{{ item.label }}</span>
  38. <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
  39. </el-option>
  40. </el-select>
  41. &nbsp;
  42. <span style="font-weight: bold;font-size: 14px">&#12288;文件解析状态:</span>
  43. <el-select style="width:250px" clearable v-model="statusCode" size="small">
  44. <el-option
  45. v-for="item in statusList"
  46. :key="item.value"
  47. :label="item.label"
  48. :value="item.value">
  49. <span style="float: left">{{ item.label }}</span>
  50. </el-option>
  51. </el-select>
  52. &nbsp;&nbsp;
  53. <span style="font-weight: bold;font-size: 14px">&#12288;文件类型:</span>
  54. <el-select style="width:250px" clearable v-model="fileType" size="small">
  55. <el-option
  56. v-for="item in fileTypes"
  57. :key="item.label"
  58. :label="item.label"
  59. :value="item.label">
  60. <span style="float: left">{{ item.label }}</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="dataQuery">查询</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. @on-load="dataQuery"
  75. @search-change="searchChange"
  76. @refresh-change="refreshChange"
  77. @size-change="sizeChange"
  78. @current-change="currentChange"
  79. >
  80. </avue-crud>
  81. </basic-container>
  82. </div>
  83. </template>
  84. <script>
  85. import {
  86. getByStationCodeAndCreateTimeAndFileStatusAndFileType,
  87. getStation
  88. } from '@/api/parsingLog'
  89. import {tableOption} from '@/const/crud/parsingLog'
  90. import {mapGetters} from 'vuex'
  91. export default {
  92. name: 'parsingLog',
  93. data() {
  94. return {
  95. createDate: new Date(new Date().toLocaleDateString()).getTime(),
  96. stationList: [],
  97. stationCode: [],
  98. statusCode: [],
  99. searchForm: {},
  100. tableData: [],
  101. fileType: "",
  102. fileTypes: [{
  103. value: 0,
  104. label: '短期'
  105. }, {
  106. value: 1,
  107. label: '超短期'
  108. }, {
  109. value: 2,
  110. label: '测风塔'
  111. }, {
  112. value: 3,
  113. label: '气象站'
  114. }, {
  115. value: 4,
  116. label: 'NWP'
  117. }, {
  118. value: 5,
  119. label: '风机'
  120. }, {
  121. value: 6,
  122. label: '逆变器'
  123. }, {
  124. value: 7,
  125. label: '实际功率'
  126. }],
  127. statusList: [{
  128. value: 0,
  129. label: '失败'
  130. }, {
  131. value: 1,
  132. label: '成功'
  133. }],
  134. page: {
  135. total: 0, // 总页数
  136. currentPage: 1, // 当前页数
  137. pageSize: 20 // 每页显示多少条
  138. },
  139. tableLoading: false,
  140. tableOption: tableOption,
  141. loading: false,
  142. }
  143. },
  144. computed: {
  145. ...mapGetters(['permissions']),
  146. },
  147. mounted() {
  148. this.getStationCode()
  149. },
  150. methods: {
  151. getStationCode() {
  152. this.tableLoading = true
  153. getStation().then(response => {
  154. console.log(response.data.data)
  155. this.stationList = response.data.data
  156. this.tableLoading = false
  157. })
  158. },
  159. dataQuery() {
  160. this.tableLoading = true
  161. const param = new URLSearchParams()
  162. param.append('currentPage', this.page.currentPage)
  163. param.append('pageSize', this.page.pageSize)
  164. param.append('stationCode', this.stationCode)
  165. param.append('time', this.createDate)
  166. param.append('fileStatus', this.statusCode)
  167. param.append('fileType', this.fileType)
  168. getByStationCodeAndCreateTimeAndFileStatusAndFileType(param).then(response => {
  169. this.tableData = response.data.data.records
  170. this.page.total = response.data.data.total
  171. this.tableLoading = false
  172. }).catch(() => {
  173. this.tableLoading = false
  174. })
  175. },
  176. rowDel: function (row, index) {
  177. this.$confirm('是否确认删除ID为' + row.id, '提示', {
  178. confirmButtonText: '确定',
  179. cancelButtonText: '取消',
  180. type: 'warning'
  181. }).then(function () {
  182. return delObj(row.id)
  183. }).then(data => {
  184. this.$message.success('删除成功')
  185. this.dataQuery()
  186. })
  187. },
  188. handleUpdate: function (row, index, done, loading) {
  189. putObj(row).then(data => {
  190. this.$message.success('修改成功')
  191. done()
  192. this.dataQuery()
  193. }).catch(() => {
  194. loading();
  195. });
  196. },
  197. handleSave: function (row, done, loading) {
  198. addObj(row).then(data => {
  199. this.$message.success('添加成功')
  200. done()
  201. this.dataQuery()
  202. }).catch(() => {
  203. loading();
  204. });
  205. },
  206. sizeChange(pageSize) {
  207. this.page.pageSize = pageSize
  208. },
  209. currentChange(current) {
  210. this.page.currentPage = current
  211. },
  212. searchChange(form, done) {
  213. this.searchForm = form
  214. this.page.currentPage = 1
  215. this.dataQuery()
  216. done()
  217. },
  218. refreshChange() {
  219. this.dataQuery()
  220. }
  221. }
  222. }
  223. </script>