Browse Source

优化水量分析报表接口对接

duanxiaoduan 1 year ago
parent
commit
9ff6023a06
1 changed files with 31 additions and 13 deletions
  1. 31 13
      src/views/report/queryWater/index.vue

+ 31 - 13
src/views/report/queryWater/index.vue

@@ -364,7 +364,7 @@ export default {
                 + '&pastureId=' + pastureId.toString()
       getJson(url,data).then(response => {
         console.log('图4', response)
-        if(response.data.data1 && response.data.data2 && response.data.data3){
+        if(response.data){
           this.chart_data4.data1 = response.data.data3
           this.chart_data4.data_name = response.data.data1
           this.chart_data4.xdata = response.data.data2
@@ -403,10 +403,12 @@ export default {
         console.log('图5', response)
         let data1 = []
         let xdata = []
-        response.data.list.forEach((item)=>{
-          data1.push(item.value)
-          xdata.push(item.name)
-        })
+        if(response.data){
+          response.data.list.forEach((item)=>{
+            data1.push(item.value)
+            xdata.push(item.name)
+          })
+        }
         this.chart_data5 = {
           data1:data1,
           xdata:xdata
@@ -433,10 +435,18 @@ export default {
       GetReportform(data).then(response => {
         console.log('图6', response)
         // this.chart_data6 = response.data.chart_data
-        this.chart_data6 = {
-          data1:response.data.chart_data.lastYear,
-          data2:response.data.chart_data.nowYear,
-          xdata:response.data.chart_data.months
+        if(response.data){
+          this.chart_data6 = {
+            data1:response.data.chart_data.lastYear,
+            data2:response.data.chart_data.nowYear,
+            xdata:response.data.chart_data.months
+          }
+        }else{
+          this.chart_data6 = {
+            data1:[],
+            data2:[],
+            xdata:[]
+          }
         }
         this.getChart7Parm.parammaps.date = response.data.chart_data.months[0]
         this.roadChart6(this.chart_data6)
@@ -458,10 +468,18 @@ export default {
       GetReportform(data).then(response => {
         console.log('图7', response)
         // this.chart_data7 = response.data.chart_data
-        this.chart_data7 = {
-          data1:response.data.chart_data.nowYear,
-          data_name:this.getChart7Parm.parammaps.pastureName,
-          xdata:response.data.chart_data.day
+        if(response.data){
+          this.chart_data7 = {
+            data1:response.data.chart_data.nowYear,
+            data_name:this.getChart7Parm.parammaps.pastureName,
+            xdata:response.data.chart_data.day
+          }
+        }else{
+          this.chart_data7 = {
+            data1:[],
+            data_name:[],
+            xdata:[]
+          }
         }
         this.roadChart7(this.chart_data7)
       })