yf_zd hace 4 años
padre
commit
32063b2017

+ 8 - 4
src/components/highStand/timeSearch.vue

@@ -81,18 +81,20 @@ export default {
 			btnSelected: '2',
 			queryInfo: {
 				begin: '',
-				end: ''
+				end: '',
+				flag:'',
+				currNum:2,
 			},
 			timeRange: '',
 			switcState:true
 		}
 	},
 	mounted() {
-		this.timeBtnClick(2)
+		this.timeBtnClick(2,'auto')
 	},
 	methods: {
 		//筛选时间
-		timeBtnClick(i) {
+		timeBtnClick(i,flag) {
 			this.btnSelected = i
 			this.timeRange = ''
 			if (i == 1) {
@@ -114,7 +116,9 @@ export default {
 					(Date.now() - 24 * 3600000 * 30 * 12) / 1000
 				)
 				this.queryInfo.end = parseInt((Date.now() + 24 * 3600000) / 1000)
-            }
+			}
+			this.queryInfo.flag = flag;
+			this.queryInfo.currNum = i;
 			this.$emit('dateChange',this.queryInfo)
 		},
 		DateChange() {

+ 18 - 5
src/pages/plantGuard/plantProtection/baseComponents/equipHistoryDate.vue

@@ -1,7 +1,7 @@
 <!-- 设备历史数据 -->
 <template>
   <div class="equipInfo">
-    <DateSearch @exportData="exportData" @dateChange="dateChange" @toggleSwitcState="toggleSwitcState"></DateSearch>
+    <DateSearch @exportData="exportData" @dateChange="dateChange" ref="timeSearchRefs" @toggleSwitcState="toggleSwitcState"></DateSearch>
     <div class="charts" v-if="switcState">
       <highcharts
         class="highcharts"
@@ -66,6 +66,8 @@ export default {
         begin:"",
         end:"",
         page:1,
+        currNum:'',
+        flag:'',
       },
       switcState:true,
       options:{},
@@ -103,6 +105,8 @@ export default {
       this.queryInfo.begin = data.begin;
       this.queryInfo.end = data.end;
       this.queryInfo.page = 1;
+      this.queryInfo.currNum = data.currNum;
+      this.queryInfo.flag = data.flag;
       this.getChartLine('chart','table');
     },
     exportData(data){
@@ -301,7 +305,7 @@ export default {
 
                 })
               }else{
-                this.options = {};
+                  this.options = {};
               }
             });
           }
@@ -319,10 +323,19 @@ export default {
             }).then((res) => {
               if (res.data.message == "") {
                 this.total = res.data.data.counts;
-                var data = res.data.data.data;
-                this.tableData = [];
-                this.tableData = data
+                if(this.total !== 0){
+                  var data = res.data.data.data;
+                  this.tableData = [];
+                  this.tableData = data
+                }else{
+                  if(this.queryInfo.flag == 'auto'){
+                    this.queryInfo.currNum++;
+                    this.$refs.timeSearchRefs.timeBtnClick(this.queryInfo.currNum,this.queryInfo.flag);
+                  }
+                }
+                
               }
+              
             });
           }
           break;