Jelajahi Sumber

修改前端分页问题

xusl 7 bulan lalu
induk
melakukan
19ede96bef

+ 2 - 0
cpp-admin/src/main/java/com/cpp/web/domain/station/WindTowerStatusData.java

@@ -3,6 +3,7 @@ package com.cpp.web.domain.station;
 import com.baomidou.mybatisplus.annotation.TableName;
 
 import com.cpp.web.domain.BaseCppEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -27,6 +28,7 @@ public class WindTowerStatusData extends BaseCppEntity {
      * 时间
      */
     @ApiModelProperty(value = "时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date time;
 
     /**

+ 18 - 19
cpp-ui/src/views/configManager/inverterinfo/index.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <el-form ref="queryForm" size="small" :inline="true">
       <el-form-item label="场站名称">
-        <el-select v-model="stationCode" placeholder="请选择" @change="stationChange">
+        <el-select v-model="stationCode" placeholder="请选择">
           <el-option
               v-for="item in stationList"
               :key="item.value"
@@ -12,7 +12,7 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="beforeQuery">查询
         </el-button>
       </el-form-item>
     </el-form>
@@ -85,7 +85,7 @@
           export-config
           highlight-current-row
           show-overflow
-          max-height="700"
+          height="528"
           :data="tableData"
           :radio-config="{trigger: 'row'}">
         <vxe-column type="radio" width="60"/>
@@ -98,8 +98,8 @@
       <vxe-pager
           background
           :loading="loading"
-          :current-page.sync="currentPage"
-          :page-size.sync="pageSize"
+          :current-page="currentPage"
+          :page-size="pageSize"
           :total="total"
           @page-change="handlePageChange"
           :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
@@ -223,11 +223,19 @@ export default {
       fileList: [],
     }
   },
-  mounted() {
+  created() {
     this.getStationCode()
   },
+  mounted() {
+    this.dataQuery()
+  },
   computed: {},
   methods: {
+    beforeQuery(){
+      this.currentPage = 1
+      this.pageSize = 10
+      this.dataQuery()
+    },
     dataUpload(item) {
       const formData = new FormData()
       formData.append('file', item.file)
@@ -242,8 +250,7 @@ export default {
         }],
         data: formData
       }).then((response) => {
-        this.stationChange()
-        this.dataQuery()
+        this.beforeQuery()
         this.$message.success("导入成功")
       }).catch((error) => {
         this.$message.error("导入失败" + error)
@@ -333,8 +340,7 @@ export default {
             this.$axios.post('/inverterinfo/updateById', this.form).then((res) => {
               this.$message.success('修改成功')
               this.open = false;
-              this.stationChange()
-              this.dataQuery()
+              this.beforeQuery()
             }).catch((error) => {
             })
           } else {
@@ -344,8 +350,7 @@ export default {
                 this.$message.success('新增失败')
               } else {
                 this.$message.success('新增成功')
-                this.stationChange()
-                this.dataQuery()
+                this.beforeQuery()
                 this.open = false;
               }
             }).catch((error) => {
@@ -380,16 +385,11 @@ export default {
     doDelete(row) {
       this.$axios.post('/inverterinfo/remove', row).then((res) => {
         this.$message.success('删除成功!')
-        this.stationChange()
         this.dataQuery()
       }).catch((error) => {
       })
       this.loading = false
     },
-    stationChange() {
-      this.currentPage = 1
-      this.pageSize = 10
-    },
     stationCodeFormat({cellValue, row, column}) {
       const item = this.stationList.find(item => item.value === cellValue)
       return item ? item.label : ''
@@ -416,7 +416,7 @@ export default {
 
       this.$axios.get('/inverterinfo/getByStationCode', {params: param}).then(response => {
         this.tableData = response.data.records
-        this.page.total = response.data.total
+        this.total = response.data.total
         this.loading = false
       }).catch(() => {
         this.loading = false
@@ -427,7 +427,6 @@ export default {
         this.stationList = response.data
         if (this.stationList.length > 0) {
           this.stationCode = this.stationList[0].value
-          this.dataQuery()
         }
       })
     },

+ 16 - 17
cpp-ui/src/views/configManager/windturbineinfo/index.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <el-form ref="queryForm" size="small" :inline="true">
       <el-form-item label="场站名称">
-        <el-select v-model="stationCode" placeholder="请选择" @change="stationChange">
+        <el-select v-model="stationCode" placeholder="请选择">
           <el-option
             v-for="item in stationList"
             :key="item.value"
@@ -12,7 +12,7 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="beforeQuery">查询
         </el-button>
       </el-form-item>
     </el-form>
@@ -85,7 +85,7 @@
         export-config
         highlight-current-row
         show-overflow
-        max-height="700"
+        height="528"
         :data="tableData"
         :radio-config="{trigger: 'row'}">
         <vxe-column type="radio" width="60"/>
@@ -252,11 +252,19 @@ export default {
       fileList: [],
     }
   },
-  mounted() {
+  created() {
     this.getStationCode()
   },
+  mounted() {
+    this.dataQuery()
+  },
   computed: {},
   methods: {
+    beforeQuery(){
+      this.currentPage = 1
+      this.pageSize = 10
+      this.dataQuery()
+    },
     validateCoordinatesLongitude(rule, value, callback) {
       // 验证经度范围:73.66 到 135.05
       if (this.form.longitude < 73.66 || this.form.longitude > 135.05) {
@@ -287,8 +295,7 @@ export default {
         }],
         data: formData
       }).then((response) => {
-        this.stationChange()
-        this.dataQuery()
+        this.beforeQuery()
         this.$message.success("导入成功")
       }).catch((error) => {
         this.$message.error("导入失败" + error)
@@ -379,8 +386,7 @@ export default {
             this.$axios.post('/windturbineinfo/updateById', this.form).then((res) => {
               this.$message.success('修改成功')
               this.open = false;
-              this.stationChange()
-              this.dataQuery()
+              this.beforeQuery()
             }).catch((error) => {
             })
           } else {
@@ -390,8 +396,7 @@ export default {
                 this.$message.success('新增失败')
               } else {
                 this.$message.success('新增成功')
-                this.stationChange()
-                this.dataQuery()
+                this.beforeQuery()
                 this.open = false;
               }
             }).catch((error) => {
@@ -426,16 +431,11 @@ export default {
     doDelete(row) {
       this.$axios.post('/windturbineinfo/remove', row).then((res) => {
         this.$message.success('删除成功!')
-        this.stationChange()
         this.dataQuery()
       }).catch((error) => {
       })
       this.loading = false
     },
-    stationChange() {
-      this.currentPage = 1
-      this.pageSize = 10
-    },
     stationCodeFormat({cellValue, row, column}) {
       const item = this.stationList.find(item => item.value === cellValue)
       return item ? item.label : ''
@@ -462,7 +462,7 @@ export default {
 
       this.$axios.get('/windturbineinfo/getByStationCode', {params: param}).then(response => {
         this.tableData = response.data.records
-        this.page.total = response.data.total
+        this.total = response.data.total
         this.loading = false
       }).catch(() => {
         this.loading = false
@@ -473,7 +473,6 @@ export default {
         this.stationList = response.data
         if (this.stationList.length > 0) {
           this.stationCode = this.stationList[0].value
-          this.dataQuery()
         }
       })
     },

+ 13 - 10
cpp-ui/src/views/stationDataQuery/inverterstatusdata/index.vue

@@ -3,7 +3,6 @@
     <el-form ref="queryForm" size="small" :inline="true">
       <el-form-item label="时间">
         <el-date-picker
-          size="mini"
           :clearable="false"
           v-model="dateTime"
           type="datetimerange"
@@ -14,7 +13,7 @@
         />
       </el-form-item>
       <el-form-item label="场站名称">
-        <el-select v-model="stationCode" placeholder="请选择" @change="stationChange">
+        <el-select v-model="stationCode" placeholder="请选择">
           <el-option
             v-for="item in stationList"
             :key="item.value"
@@ -24,7 +23,7 @@
         </el-select>
       </el-form-item>
       <el-form-item label="逆变器设备">
-        <el-select size="mini" v-model="equipmentId"  multiple filterable>
+        <el-select v-model="equipmentId"  multiple filterable>
           <el-option
             v-for="item in equipmentOptions"
             :key="item.value"
@@ -34,7 +33,7 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="beforeQuery">查询
         </el-button>
       </el-form-item>
     </el-form>
@@ -49,7 +48,7 @@
         export-config
         highlight-current-row
         show-overflow
-        max-height="700"
+        height="528"
         :data="tableData"
         :radio-config="{trigger: 'row'}">
         <vxe-column type="radio" width="60"/>
@@ -100,22 +99,26 @@ export default {
     }
   },
   created(){
-    // 获取所有逆变器名称
+    // 获取所有逆变器名称(列表转义应用)
     this.$axios.get('/inverterinfo/findAll').then((res) => {
       this.nameList = res.data
     }).catch((error) => {
       this.$message.error('获取逆变器转义名称出错' + error)
     })
+    // 获取场站下拉列表
+    this.getStationCode()
   },
   mounted() {
-    this.getStationCode()
+    this.dataQuery()
   },
   computed: {},
   methods: {
-    stationChange() {
+    beforeQuery(){
       this.currentPage = 1
       this.pageSize = 10
-
+      this.dataQuery()
+    },
+    stationChange() {
       const param = {
         "stationCode": this.stationCode,
       }
@@ -170,7 +173,7 @@ export default {
 
       this.$axios.get('/inverterstatusdata/getByStationCodeAndEquipmentIdAndTimeBetween', {params: queryParams}).then(response => {
         this.tableData = response.data.records
-        this.page.total = response.data.total
+        this.total = response.data.total
         this.loading = false
       }).catch(() => {
         this.loading = false

+ 79 - 55
cpp-ui/src/views/stationDataQuery/windtowerstatusdata/index.vue

@@ -3,7 +3,6 @@
     <el-form ref="queryForm" size="small" :inline="true">
       <el-form-item label="时间">
         <el-date-picker
-          size="mini"
           :clearable="false"
           v-model="dateTime"
           type="datetimerange"
@@ -14,7 +13,7 @@
         />
       </el-form-item>
       <el-form-item label="场站名称">
-        <el-select v-model="stationCode" placeholder="请选择" @change="stationChange">
+        <el-select v-model="stationCode" placeholder="请选择">
           <el-option
             v-for="item in stationList"
             :key="item.value"
@@ -24,57 +23,68 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        <el-button type="primary" style="margin-left: 5px" icon="el-icon-search" @click="beforeQuery">查询
         </el-button>
       </el-form-item>
     </el-form>
+
     <div style="padding-top: 10px">
-      <vxe-table
-        ref="xTable"
-        align="center"
-        class="mytable-style"
-        auto-resize
-        border
-        resizable
-        export-config
-        highlight-current-row
-        show-overflow
-        max-height="700"
-        :data="tableData"
-        :radio-config="{trigger: 'row'}">
-        <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat"></vxe-table-column>
-        <vxe-table-column field="time" title="时间"></vxe-table-column>
-        <vxe-table-column field="tinst" title="温度(℃)"></vxe-table-column>
-        <vxe-table-column field="rhInst" title="湿度(%RH)"></vxe-table-column>
-        <vxe-table-column field="paInst" title="气压(hPa)"></vxe-table-column>
-        <vxe-table-column field="wsInstHubHeight" title="轮毂风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInstHubHeight" title="轮毂风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst10" title="10米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst10" title="10米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst30" title="30米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst30" title="30米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst50" title="50米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst50" title="50米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst60" title="60米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst60" title="60米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst70" title="70米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst70" title="70米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst80" title="80米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst80" title="80米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst90" title="90米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst90" title="90米风向(°)"></vxe-table-column>
-        <vxe-table-column field="wsInst100" title="100米风速(m/s)"></vxe-table-column>
-        <vxe-table-column field="wdInst100" title="100米风向(°)"></vxe-table-column>
-      </vxe-table>
-      <vxe-pager
-        background
-        :loading="loading"
-        :current-page.sync="currentPage"
-        :page-size.sync="pageSize"
-        :total="total"
-        @page-change="handlePageChange"
-        :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
-      </vxe-pager>
+      <el-tabs type="card" v-model="activeName" @tab-click="tabClick">
+        <el-tab-pane label="数据表格" name="first">
+          <vxe-table
+            ref="xTable"
+            align="center"
+            class="mytable-style"
+            auto-resize
+            border
+            resizable
+            export-config
+            highlight-current-row
+            show-overflow
+            height="528"
+            :data="tableData"
+            :radio-config="{trigger: 'row'}">
+            <vxe-table-column field="stationCode" title="场站名称" :formatter="stationCodeFormat"></vxe-table-column>
+            <vxe-table-column field="time" title="时间"></vxe-table-column>
+            <vxe-table-column field="t" title="温度(℃)"></vxe-table-column>
+            <vxe-table-column field="rh" title="湿度(%RH)"></vxe-table-column>
+            <vxe-table-column field="pa" title="气压(hPa)"></vxe-table-column>
+            <vxe-table-column field="wsHubHeight" title="轮毂风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wdHubHeight" title="轮毂风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws10" title="10米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd10" title="10米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws30" title="30米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd30" title="30米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws50" title="50米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd50" title="50米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws60" title="60米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd60" title="60米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws70" title="70米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd70" title="70米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws80" title="80米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd80" title="80米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws90" title="90米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd90" title="90米风向(°)"></vxe-table-column>
+            <vxe-table-column field="ws100" title="100米风速(m/s)"></vxe-table-column>
+            <vxe-table-column field="wd100" title="100米风向(°)"></vxe-table-column>
+          </vxe-table>
+          <vxe-pager
+            background
+            :loading="loading"
+            :current-page="currentPage"
+            :page-size="pageSize"
+            :total="total"
+            @page-change="handlePageChange"
+            :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+          </vxe-pager>
+        </el-tab-pane>
+        <el-tab-pane label="风速曲线图" name="second">
+          <div id="wsChartsId" style="float:left;width: 95%;height: 550px"></div>
+        </el-tab-pane>
+        <el-tab-pane label="风向玫瑰图" name="three">
+          <div id="roseChartsId" style="float:left;width: 95%;height: 550px"></div>
+        </el-tab-pane>
+      </el-tabs>
     </div>
   </div>
 </template>
@@ -84,6 +94,7 @@ export default {
   name: 'inverterinfo',
   data() {
     return {
+      activeName: 'first',
       dateTime: [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000-5*1000*60],
       total: 0,
       sortOrder: 'asc',
@@ -99,16 +110,24 @@ export default {
     }
   },
   created(){
-
+    this.getStationCode()
   },
   mounted() {
-    this.getStationCode()
+    this.dataQuery()
   },
   computed: {},
   methods: {
-    stationChange() {
-      this.currentPage = 1
-      this.pageSize = 10
+    tabClick(tab){
+      if (this.activeName == 'second') {
+        this.$nextTick(function() {
+          this.wschart.resize();
+        })
+      }
+      if (this.activeName == 'three') {
+        this.$nextTick(function() {
+          this.rosechart.resize();
+        })
+      }
     },
     nameFormat({cellValue, row, column}) {
       const item = this.nameList.find(item => item.value === cellValue)
@@ -123,6 +142,11 @@ export default {
       this.pageSize = pageSize
       this.dataQuery();
     },
+    beforeQuery(){
+      this.currentPage = 1
+      this.pageSize = 10
+      this.dataQuery()
+    },
     dataQuery() {
       let startTime = Math.round(this.dateTime[0])
       let endTime = Math.round(this.dateTime[1])
@@ -153,7 +177,7 @@ export default {
         this.stationList = response.data
         if (this.stationList.length > 0) {
           this.stationCode = this.stationList[0].value
-          this.stationChange()
+          // this.stationChange()
         }
       })
     },

+ 10 - 6
cpp-ui/src/views/stationDataQuery/windturbinestatusdata/index.vue

@@ -34,7 +34,7 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="beforeQuery">查询
         </el-button>
       </el-form-item>
     </el-form>
@@ -49,7 +49,7 @@
         export-config
         highlight-current-row
         show-overflow
-        max-height="700"
+        height="528"
         :data="tableData"
         :radio-config="{trigger: 'row'}">
         <vxe-column type="radio" width="60"/>
@@ -108,16 +108,20 @@ export default {
     }).catch((error) => {
       this.$message.error('获取风机转义名称出错' + error)
     })
+    // 获取场站下拉列表
+    this.getStationCode()
   },
   mounted() {
-    this.getStationCode()
+    this.dataQuery()
   },
   computed: {},
   methods: {
-    stationChange() {
+    beforeQuery(){
       this.currentPage = 1
       this.pageSize = 10
-
+      this.dataQuery()
+    },
+    stationChange() {
       const param = {
         "stationCode": this.stationCode,
       }
@@ -171,7 +175,7 @@ export default {
       }
       this.$axios.get('/windturbinestatusdata/getByStationCodeAndEquipmentIdAndTimeBetween', {params: queryParams}).then(response => {
         this.tableData = response.data.records
-        this.page.total = response.data.total
+        this.total = response.data.total
         this.loading = false
       }).catch(() => {
         this.loading = false