index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div class="app-container">
  3. <el-form :inline="true" size="small" class="dark-el-input dark-el-button">
  4. <el-form-item label="场站名称">
  5. <el-select v-model="stationCode" placeholder="请选择" style="width: 255px" popper-class="cpp-popper">
  6. <el-option
  7. v-for="item in stationList"
  8. :key="item.value"
  9. :label="item.label"
  10. :value="item.value">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search"
  16. @click="queryByStationCode">查询
  17. </el-button>
  18. </el-form-item>
  19. </el-form>
  20. <div style="padding-top: 10px">
  21. <vxe-table
  22. ref="xTable"
  23. align="center"
  24. class="mytable-style"
  25. auto-resize
  26. border
  27. resizable
  28. export-config
  29. highlight-current-row
  30. show-overflow
  31. max-height="700"
  32. :data="tableData">
  33. <vxe-table-column field="stationCode" title="场站名称" :formatter="codeChangeName"></vxe-table-column>
  34. <vxe-table-column field="startTime" :formatter="formatDateTime" title="检修开始时间"></vxe-table-column>
  35. <vxe-table-column field="endTime" :formatter="formatDateTime" title="检修结束时间"></vxe-table-column>
  36. <vxe-table-column field="overhaulCapacity" title="检修容量(MW)"></vxe-table-column>
  37. <vxe-table-column field="forecastModel" title="预测模型"></vxe-table-column>
  38. <vxe-table-column field="useNum" title="使用次数"></vxe-table-column>
  39. <vxe-table-column field="updateTime" :formatter="formatDateTime" title="最近一次使用时间"></vxe-table-column>
  40. </vxe-table>
  41. <vxe-pager
  42. background
  43. :loading="loading"
  44. :current-page.sync="currentPage"
  45. :page-size.sync="pageSize"
  46. :total="total"
  47. @page-change="handlePageChange"
  48. :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
  49. </vxe-pager>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. name: 'overhaulPlanRecords',
  56. data() {
  57. return {
  58. title: "",
  59. // 是否显示弹出层
  60. open: false,
  61. edit: false,
  62. total: 0,
  63. sortOrder: 'asc',
  64. pageSize: 10,
  65. currentPage: 1,
  66. stationList: [],
  67. stationCode: '',
  68. stationName: undefined,
  69. searchForm: {},
  70. tableData: [],
  71. loading: false,
  72. modId: '',
  73. checkSign: '',
  74. capacity: null,
  75. }
  76. },
  77. created() {
  78. this.getStationCode()
  79. },
  80. mounted() {
  81. },
  82. computed: {},
  83. methods: {
  84. handlePageChange({currentPage, pageSize}) {
  85. this.currentPage = currentPage
  86. this.pageSize = pageSize
  87. this.queryByStationCode();
  88. },
  89. //日期转换器
  90. formatDateTime(cellValue) {
  91. if (cellValue.cellValue == null) {
  92. return ''
  93. }
  94. const date = new Date(cellValue.cellValue)
  95. const Y = date.getFullYear() + '-'
  96. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
  97. const D = date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()
  98. const h = " " + (date.getHours() < 10 ? '0' : '') + date.getHours() + ':'
  99. const m = (date.getMinutes() < 10 ? '0' : '') + date.getMinutes() + ':'
  100. const s = (date.getSeconds() < 10 ? '0' : '') + date.getSeconds()
  101. return Y + M + D + h + m + s
  102. },
  103. getStationCode() {
  104. this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
  105. this.stationList = response.data
  106. if (this.stationList.length > 0) {
  107. this.stationCode = this.stationList[0].value
  108. this.queryByStationCode()
  109. } else {
  110. this.queryByStationCode()
  111. }
  112. })
  113. },
  114. queryByStationCode() {
  115. this.loading = true
  116. const param = {
  117. "currentPage": this.currentPage,
  118. "pageSize": this.pageSize,
  119. "stationCode": this.stationCode,
  120. }
  121. this.$axios.get('/overhaulPlanRecords/findByStationCode', {params: param}).then(response => {
  122. this.tableData = response.data.records
  123. this.total = response.data.total
  124. this.loading = false
  125. })
  126. },
  127. codeChangeName(row){
  128. var codeList = this.stationList
  129. for (let i = 0; i < codeList.length; i++) {
  130. if (row.cellValue == codeList[i].value){
  131. return codeList[i].label
  132. }
  133. }
  134. }
  135. }
  136. }
  137. </script>