Bläddra i källkod

修改风机数据查询分页问题

xusl 11 månader sedan
förälder
incheckning
26c8728171

+ 25 - 7
ipp-ap/src/views/idp/data/windturbinestatusdata/index.vue

@@ -71,10 +71,7 @@
                  :data="tableData"
                  :data="tableData"
                  :table-loading="tableLoading"
                  :table-loading="tableLoading"
                  :option="tableOption"
                  :option="tableOption"
-                 @search-change="searchChange"
-                 @refresh-change="refreshChange"
-                 @size-change="sizeChange"
-                 @current-change="currentChange">
+                 @on-load="getGridOnloadData">
       </avue-crud>
       </avue-crud>
     </basic-container>
     </basic-container>
   </div>
   </div>
@@ -88,6 +85,7 @@ import {
 } from '@/api/windturbinestatusdata'
 } from '@/api/windturbinestatusdata'
 import {tableOption} from '@/const/crud/windturbinestatusdata'
 import {tableOption} from '@/const/crud/windturbinestatusdata'
 import {mapGetters} from 'vuex'
 import {mapGetters} from 'vuex'
+import {queryTableData} from "@/api/windtowerstatusdata";
 
 
 export default {
 export default {
   name: 'windturbinestatusdata',
   name: 'windturbinestatusdata',
@@ -125,13 +123,32 @@ export default {
     this.getStationCode()
     this.getStationCode()
   },
   },
   methods: {
   methods: {
+    getGridOnloadData() {
+      console.log(this.page)
+      const param = new URLSearchParams()
+      param.append('currentPage', this.page.currentPage)
+      param.append('pageSize', this.page.pageSize)
+      param.append('stationCode', this.stationCode)
+      param.append('startTime', this.startTime)
+      param.append('endTime', this.endTime)
+      param.append('equipmentId', this.equipmentId)
+      getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
+        this.tableData = response.data.data.records
+        this.page.total = response.data.data.total
+        this.page.pageSize = response.data.data.size
+        this.tableLoading = false
+      }).catch(() => {
+        this.tableLoading = false
+      })
+    },
     dateQuery() {
     dateQuery() {
       if (this.equipmentId === '' || this.equipmentId == null) {
       if (this.equipmentId === '' || this.equipmentId == null) {
         return alert("请选择所属设备")
         return alert("请选择所属设备")
       }
       }
       this.tableLoading = true
       this.tableLoading = true
       const param = new URLSearchParams()
       const param = new URLSearchParams()
-      param.append('page', this.page)
+      param.append('currentPage', this.page.currentPage)
+      param.append('pageSize', this.page.pageSize)
       param.append('stationCode', this.stationCode)
       param.append('stationCode', this.stationCode)
       param.append("equipmentId", this.equipmentId)
       param.append("equipmentId", this.equipmentId)
       param.append('startTime', this.startTime)
       param.append('startTime', this.startTime)
@@ -139,6 +156,7 @@ export default {
       getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
       getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
         this.tableData = response.data.data.records
         this.tableData = response.data.data.records
         this.page.total = response.data.data.total
         this.page.total = response.data.data.total
+        this.page.pageSize = response.data.data.size
         this.tableLoading = false
         this.tableLoading = false
       }).catch(() => {
       }).catch(() => {
         this.tableLoading = false
         this.tableLoading = false
@@ -179,11 +197,11 @@ export default {
     searchChange(form, done) {
     searchChange(form, done) {
       this.searchForm = form
       this.searchForm = form
       this.page.currentPage = 1
       this.page.currentPage = 1
-      this.dateQuery(this.page, form)
+      this.getList(this.page, form)
       done()
       done()
     },
     },
     refreshChange() {
     refreshChange() {
-      this.dateQuery()
+      this.getList(this.page)
     }
     }
   }
   }
 }
 }

+ 5 - 2
ipp-idp/src/main/java/com/jiayue/ipp/idp/controller/WindTurbineStatusDataController.java

@@ -1,5 +1,6 @@
 package com.jiayue.ipp.idp.controller;
 package com.jiayue.ipp.idp.controller;
 
 
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jiayue.ipp.common.data.entity.WindTurbineStatusData;
 import com.jiayue.ipp.common.data.entity.WindTurbineStatusData;
@@ -46,13 +47,15 @@ public class WindTurbineStatusDataController {
     /**
     /**
      * 根据场站编号和设备ID分页查询
      * 根据场站编号和设备ID分页查询
      *
      *
-     * @param page        分页
      * @param stationCode 场站编号
      * @param stationCode 场站编号
      * @return
      * @return
      */
      */
     @ApiOperation(value = "根据场站编号和设备ID和时间范围分页查询", notes = "分页查询")
     @ApiOperation(value = "根据场站编号和设备ID和时间范围分页查询", notes = "分页查询")
     @PostMapping("/getByStationCodeAndEquipmentIdAndTimeBetween")
     @PostMapping("/getByStationCodeAndEquipmentIdAndTimeBetween")
-    public R getByStationCodeAndEquipmentIdAndTimeBetween(Page page, String stationCode, String equipmentId, Long startTime, Long endTime) {
+    public R getByStationCodeAndEquipmentIdAndTimeBetween(Long currentPage, Long pageSize, String stationCode, String equipmentId, Long startTime, Long endTime) {
+        Page page = new Page(currentPage, pageSize);
+        page.addOrder(OrderItem.asc("time"));
+        page.setMaxLimit((long) -1);
         return R.ok(windTurbineStatusDataService.page(page, windTurbineStatusDataService.getByStationCodeAndEquipmentIdAndTimeBetween(stationCode, equipmentId, new Date(startTime), new Date(endTime))));
         return R.ok(windTurbineStatusDataService.page(page, windTurbineStatusDataService.getByStationCodeAndEquipmentIdAndTimeBetween(stationCode, equipmentId, new Date(startTime), new Date(endTime))));
     }
     }
 }
 }