Ver código fonte

对接数据,分页等

Ming 4 anos atrás
pai
commit
4fd5a1df19

+ 6 - 2
src/pages/gasCard/components/lineChart.vue

@@ -21,6 +21,7 @@ export default {
     return {
       myChart: null,
       chartA: [],
+      name:''
     };
   },
   computed:{
@@ -45,6 +46,8 @@ export default {
       console.log("子组件中的this.getData");
       console.log(this.getData);
       this.chartA = this.getData.Points[1].LIST;
+      this.name= this.getData.Points[1].PointName;
+    
  
       this.draw();
     }, 100);
@@ -59,7 +62,8 @@ export default {
       this.myChart.setOption({
         // 通过这个color修改两条线的颜色
         title: {
-          text: "一氧化碳浓度",
+          // text: "一氧化碳浓度",
+          text:this.name,
           textStyle: {
             align: "center",
             color: "#fff",
@@ -141,7 +145,7 @@ export default {
         },
         series: [
           {
-            name: "位置AAA",
+            name: "浓度值",
             type: "line",
             smooth: false, // 曲线是否平滑显示
             // data: yearData[0].data[0],

+ 0 - 2
src/pages/gasCard/gasCard.vue

@@ -4,7 +4,6 @@
     <div class="mainbox">
       <div class="gas-container">
         <return-back></return-back>
-
         <h3>可燃气体监控实时信息</h3>
         <p>更新时间:{{time}}</p>
 
@@ -13,7 +12,6 @@
             <li @click="Inv = 0" :class="{ active: Inv === 0 }">数据列表</li>
             <li @click="Inv = 1" :class="{ active: Inv === 1 }">数据可视化</li>
           </ul>
-
           <div class="tabBox">
             <div>
               <div v-if="Inv == 1" class="lineChart gas-data">

+ 2 - 2
src/pages/index/index.vue

@@ -36,7 +36,7 @@
                    {{item.KeyPoints[0].ValueList[0].Value == 0 ? "正常" : "告警"}}
                 </span>
                 <span v-else>
-                 aa
+                 默认值
                 </span>
               </p>
                <!-- 电气火灾渲染end -->
@@ -49,7 +49,7 @@
                 <span v-if="item.KeyPoints[0].ValueList.length>0">
                   {{ item.KeyPoints[0].ValueList[0].Value }}
                 </span>
-                <span v-else>aa</span>
+                <span v-else>默认值</span>
               </p>
                <!-- 可燃气体渲染end -->
 

+ 5 - 5
src/pages/inspectRecord/inspectRecord.vue

@@ -130,12 +130,12 @@ export default {
 
           this.global.sendWs(json);
 
-          setInterval(() => {
-            console.log("每隔30秒请求一次getDeviceDetail");
-            this.global.sendWs(json);
-          }, 30000);
+          // setInterval(() => {
+          //   console.log("每隔30秒请求一次getDeviceDetail");
+          //   this.global.sendWs(json);
+          // }, 30000);
 
-        }
+        } 
         if (redata.CMD == "getPatrolDetail") {
           this.recordData = redata.RESULT.LIST;
           // console.log(this.recordData);

+ 17 - 59
src/pages/recordTime/recordTime.vue

@@ -8,7 +8,7 @@
         <div class="timeList">
           <div
             class="timeItem"
-            v-for="(item, index) in recordData.slice(
+            v-for="(item, index) in getData.slice(
               (currentPage - 1) * Count,
               currentPage * Count
             )"
@@ -59,13 +59,13 @@ export default {
       StationID: "",
 
       // 总数据
-      recordData: [],
+      getData: [],
       // 默认显示第几页
       currentPage: 1,
       // 总条数,根据接口获取数据长度(注意:这里不能为空)
       TotalCount: 1,
       // 默认每页显示的条数(可修改)
-      Count: 10,
+      Count: 5,
     };
   },
   watch: {
@@ -76,53 +76,7 @@ export default {
 
   created() {
     this.StationID = this.$store.state.StationID;
-
-    (this.recordData = [
-      {
-        Time: "2021-06-15 13:01:14",
-      },
-      {
-        Time: "2021-06-15 13:01:09",
-      },
-      {
-        Time: "2021-06-15 13:01:04",
-      },
-      {
-        Time: "2021-06-15 13:00:59",
-      },
-      {
-        Time: "2021-06-15 13:00:54",
-      },
-      {
-        Time: "2021-06-15 15:01:14",
-      },
-      {
-        Time: "2021-06-15 16:01:09",
-      },
-      {
-        Time: "2021-06-15 17:01:04",
-      },
-      {
-        Time: "2021-06-15 18:00:59",
-      },
-      {
-        Time: "2021-06-15 19:00:54",
-      },
-      {
-        Time: "2021-06-15 13:00:59",
-      },
-      {
-        Time: "2021-06-15 13:00:54",
-      },
-      {
-        Time: "2021-06-15 15:01:14",
-      },
-      {
-        Time: "2021-06-15 16:01:09",
-      },
-    ]),
-      // 将数据的长度赋值给TotalCount
-      (this.TotalCount = this.recordData.length);
+      
   },
 
   mounted() {
@@ -140,24 +94,28 @@ export default {
 
           json.CMD = "getPatrolRecord";
           json.StationID = this.StationID;
-          (json.Start = 0), (json.Limit = 2), (json.Order = "DESC");
+          (json.Start = 0), (json.Limit = 5), (json.Order = "DESC");
 
-          // this.global.sendWs(json);
+          this.global.sendWs(json);
 
-          setInterval(() => {
-            console.log("每隔30秒请求一次getPatrolRecord");
-            this.global.sendWs(json);
-          }, 30000);
+          // setInterval(() => {
+          //   console.log("每隔30秒请求一次getPatrolRecord");
+          //   this.global.sendWs(json);
+          // }, 30000);
         }
 
         if (redata.CMD == "getPatrolRecord") {
-          this.recordData = redata.RESULT.LIST;
-          console.log("this.recordData");
-          console.log(this.recordData);
+          this.getData = redata.RESULT.LIST;
+          // 将数据的长度赋值给TotalCount
+           this.TotalCount = redata.TotalCount;
+          console.log("this.getData");
+          console.log(this.getData);
         }
       }
     },
 
+
+
     goInspectDetail(item) {
       this.$router.push({
         path: "/inspectRecord",