Bladeren bron

查询多次点击bug

yl 6 maanden geleden
bovenliggende
commit
1cdb1cf707
1 gewijzigde bestanden met toevoegingen van 27 en 13 verwijderingen
  1. 27 13
      cpp-ui/src/views/regulation/modelAccuracyStatistics/index.vue

+ 27 - 13
cpp-ui/src/views/regulation/modelAccuracyStatistics/index.vue

@@ -100,6 +100,7 @@ export default {
   name: 'inverterinfo',
   data() {
     return {
+      ifclick: true,
       total: 0,
       pageSize: 10,
       currentPage: 1,
@@ -179,6 +180,9 @@ export default {
       })
     },
     dataQuery(){
+      if (!this.ifclick){
+        return;
+      }
       var find = this.stationList.find(s=>s.value == this.stationCode);
       this.stationName = find.label
       this.xData = []
@@ -194,21 +198,31 @@ export default {
         "uploadDataSources": 'E4',
         "stationName":this.stationName
       }
-      this.$axios.get('/accuracyPassRate/getByMonthBetweenAndForecastTypeAndStationCode', {params: queryParams}).then(response => {
-        if (response.data){
-          for (const [key,value] of Object.entries(response.data)){
-            this.xData.push(key)
-            this.yData.push(value.toFixed(2))
+      this.ifclick = false
+      const accuracyPassRateByMonthPromise = new Promise((resolve,reject)=>{
+        this.$axios.get('/accuracyPassRate/getByMonthBetweenAndForecastTypeAndStationCode', {params: queryParams}).then(response => {
+          if (response.data){
+            for (const [key,value] of Object.entries(response.data)){
+              this.xData.push(key)
+              this.yData.push(value.toFixed(2))
+            }
           }
-        }
-      }).catch(() => {}).finally(()=>{
-        this.initChart()
+          resolve();
+        }).catch(() => {}).finally(()=>{
+          this.initChart()
+        })
       })
-      this.$axios.get('/accuracyPassRate/getBySingleMonthBetweenAndForecastTypeAndStationCode', {params: queryParams}).then(response => {
-        if (response.data){
-          this.tableData = response.data || []
-          this.total = response.data.length
-        }
+      const accuracyPassRateSingleMonthPromise = new Promise((resolve,reject)=>{
+        this.$axios.get('/accuracyPassRate/getBySingleMonthBetweenAndForecastTypeAndStationCode', {params: queryParams}).then(response => {
+          if (response.data){
+            this.tableData = response.data || []
+            this.total = response.data.length
+          }
+          resolve();
+        })
+      })
+      Promise.all([accuracyPassRateByMonthPromise,accuracyPassRateSingleMonthPromise]).then(()=>{
+        this.ifclick = true
       })
     },
     getStationCode() {