likang пре 3 година
родитељ
комит
028e322fc8
1 измењених фајлова са 35 додато и 22 уклоњено
  1. 35 22
      src/views/tag_history/index.vue

+ 35 - 22
src/views/tag_history/index.vue

@@ -53,23 +53,13 @@
           icon="el-icon-video-pause
 "
           @click="beforhandleRefresh"
-          > {{timer}}</el-button
+          > 结束</el-button
         >
       
-        <el-button
-          class="filter-item search fl"
-          icon="el-icon-refresh-right"
-          @click="refresh"
-          >刷新</el-button
-        >
-
 
     </div>
 
 
-
-
-
     <el-table
       :data="data"
       v-loading="loading"
@@ -104,14 +94,14 @@
       />
        <el-table-column
         prop="time"
-        label="上报时间"
+        label="标签上报时间"
         align="center"
         sortable
         :show-overflow-tooltip="true"
       />
        <el-table-column
         prop="addTime"
-        label="标签上报时间"
+        label="上报时间"
         align="center"
         sortable
         :show-overflow-tooltip="true"
@@ -198,7 +188,8 @@ export default {
         mac: "",
         tage: '',
         meter: '',
-        time:''
+        time: '',
+        endtime:'',
       },
       current_type: {
         0: "success",
@@ -234,7 +225,7 @@ export default {
     };
   },
   created() {
-    this.queryParam.time = parseInt(new Date().getTime() / 1000);
+    this.getTime();
     this.refreshTagAndSta();
   
   },
@@ -296,18 +287,36 @@ export default {
     beforehandleSearch() {
      
       this.start = false;
-      this.queryParam.time = parseInt(new Date().getTime() / 1000); //开始计时
-      this.timetool()
+      this.getTime();
+      this.timetool();
       this.handleSearch(); 
+
+      clearInterval(this.refreshData);
+      this.refreshData = null;
+      this.refreshData =
+        setInterval(() => {
+          this.getData()
+        }, 1000 * 2);
+     
     },
     beforhandleRefresh()
     {
+      clearInterval(this.refreshData);
       clearInterval(this.refreshTime);
+      this.refreshData = null;
       this.refreshTime = null
       this.start = true
-      
+
       //this.handleRefresh()
     },
+    getTime()
+    {
+      let times = null;
+      this.$http.get("getTime").then((response) => {
+        this.queryParam.time = response.data;
+      });
+     
+    },
     handleChange(val) {
       //  console.log(val)
       this.queryParam.department_id = val;
@@ -346,17 +355,21 @@ export default {
           };
       
        this.timer = i + ':' + j + ':' + k;
-      
        //this.$set(this.timer, 'timer', i1 + ':' + j1 + ':' + k1)
-       console.log(this.timer);
 
   }, 1000);
 
   
     },
     refresh() {
-      this.queryParam.page = this.paginate.current;
-      this.getList();
+      this.queryParam = {
+        mac: "",
+        tage: '',
+        meter: '',
+        time: '',
+        endtime: '',
+      }
+      this.getTime();
     },
     //定时请求数据
     getData()