Browse Source

bug修复完毕,前后联调

Ming 4 years ago
parent
commit
05751c71a4

+ 1 - 0
src/components/topHeader.vue

@@ -53,6 +53,7 @@ export default {
   },
   watch: {
     "$store.state.wsInfo"(val) {
+      // console.log(111)
       this.messageHandle(val);
     },
 

+ 195 - 107
src/pages/eleFireCard/eleFireCard.vue

@@ -5,7 +5,7 @@
       <div class="gas-container">
         <return-back></return-back>
         <h3>电气火灾监控实时信息</h3>
-        <p>更新时间:{{time}}</p>
+        <p>更新时间:{{ time }}</p>
         <div>
           <ul class="cardTabs">
             <li class="active">数据列表</li>
@@ -18,152 +18,215 @@
                 <tr>
                   <th>
                     供电过压告警:
-                     <span v-if="getData.length > 0 " class="normal" :class="[getData[0].AlarmStatus==0?'normal':'error']">
-                      {{ getData[0].AlarmStatus==0?'正常':getData[0].AlarmStatus==1?"告警":"故障" }}
+                    <span
+                      v-if="getData.length > 0"
+                      class="normal"
+                      :class="[
+                        getData[0].AlarmStatus == 0 ? 'normal' : 'error',
+                      ]"
+                    >
+                      {{
+                        getData[0].AlarmStatus == 0
+                          ? "正常"
+                          : getData[0].AlarmStatus == 1
+                          ? "告警"
+                          : "故障"
+                      }}
                     </span>
-                    <span v-else class="normal">
-                      默认正常
-                    </span>
-                    
+                    <span v-else class="normal"> 默认正常 </span>
                   </th>
                   <th>
                     供电低压告警:
-                    <span v-if="getData.length > 0 " class="normal" :class="[getData[1].AlarmStatus==0?'normal':'error']">
-                      {{ getData[1].AlarmStatus==0?'正常':getData[1].AlarmStatus==1?"告警":"故障" }}
-                    </span>
-                    <span v-else class="normal">
-                      默认正常
+                    <span
+                      v-if="getData.length > 0"
+                      class="normal"
+                      :class="[
+                        getData[1].AlarmStatus == 0 ? 'normal' : 'error',
+                      ]"
+                    >
+                      {{
+                        getData[1].AlarmStatus == 0
+                          ? "正常"
+                          : getData[1].AlarmStatus == 1
+                          ? "告警"
+                          : "故障"
+                      }}
                     </span>
+                    <span v-else class="normal"> 默认正常 </span>
                   </th>
 
                   <th>
                     供电过流告警:
-                    <span v-if="getData.length > 0 " class="normal" :class="[getData[2].AlarmStatus==0?'normal':'error']">
-                      {{ getData[2].AlarmStatus==0?'正常':getData[2].AlarmStatus==1?"告警":"故障" }}
-                    </span>
-                    <span v-else class="normal">
-                      默认正常
+                    <span
+                      v-if="getData.length > 0"
+                      class="normal"
+                      :class="[
+                        getData[2].AlarmStatus == 0 ? 'normal' : 'error',
+                      ]"
+                    >
+                      {{
+                        getData[2].AlarmStatus == 0
+                          ? "正常"
+                          : getData[2].AlarmStatus == 1
+                          ? "告警"
+                          : "故障"
+                      }}
                     </span>
+                    <span v-else class="normal"> 默认正常 </span>
                   </th>
 
                   <th>
                     漏电告警:
-                    <span v-if="getData.length > 0 " class="normal" :class="[getData[3].AlarmStatus==0?'normal':'error']">
-                      {{ getData[3].AlarmStatus==0?'正常':getData[3].AlarmStatus==1?"告警":"故障" }}
-                    </span>
-                    <span v-else class="normal">
-                      默认正常
+                    <span
+                      v-if="getData.length > 0"
+                      class="normal"
+                      :class="[
+                        getData[3].AlarmStatus == 0 ? 'normal' : 'error',
+                      ]"
+                    >
+                      {{
+                        getData[3].AlarmStatus == 0
+                          ? "正常"
+                          : getData[3].AlarmStatus == 1
+                          ? "告警"
+                          : "故障"
+                      }}
                     </span>
+                    <span v-else class="normal"> 默认正常 </span>
                   </th>
                 </tr>
                 <tr>
                   <td>
-                    <P>A相线缆温度超高:
-                      <span v-if="getData.length > 0 " class="normal" :class="[getData[4].AlarmStatus==0?'normal':'error']">
-                      {{ getData[4].AlarmStatus==0?'正常':getData[4].AlarmStatus==1?"告警":"故障" }}
-                    </span>
-                    <span v-else class="normal">
-                      默认正常
-                    </span>
+                    <P
+                      >A相线缆温度超高:
+                      <span
+                        v-if="getData.length > 0"
+                        class="normal"
+                        :class="[
+                          getData[4].AlarmStatus == 0 ? 'normal' : 'error',
+                        ]"
+                      >
+                        {{
+                          getData[4].AlarmStatus == 0
+                            ? "正常"
+                            : getData[4].AlarmStatus == 1
+                            ? "告警"
+                            : "故障"
+                        }}
+                      </span>
+                      <span v-else class="normal"> 默认正常 </span>
                     </P>
-                    <P>B相线缆温度超高:
-                       <span v-if="getData.length > 0 " class="normal" :class="[getData[5].AlarmStatus==0?'normal':'error']">
-                      {{ getData[5].AlarmStatus==0?'正常':getData[5].AlarmStatus==1?"告警":"故障" }}
-                    </span>
-                    <span v-else class="normal">
-                      默认正常
-                    </span>
+                    <P
+                      >B相线缆温度超高:
+                      <span
+                        v-if="getData.length > 0"
+                        class="normal"
+                        :class="[
+                          getData[5].AlarmStatus == 0 ? 'normal' : 'error',
+                        ]"
+                      >
+                        {{
+                          getData[5].AlarmStatus == 0
+                            ? "正常"
+                            : getData[5].AlarmStatus == 1
+                            ? "告警"
+                            : "故障"
+                        }}
+                      </span>
+                      <span v-else class="normal"> 默认正常 </span>
                     </P>
-                    <P>C相线缆温度超高:
-                       <span v-if="getData.length > 0 " class="normal" :class="[getData[6].AlarmStatus==0?'normal':'error']">
-                      {{ getData[6].AlarmStatus==0?'正常':getData[6].AlarmStatus==1?"告警":"故障" }}
-                    </span>
-                    <span v-else class="normal">
-                      默认正常
-                    </span>
+                    <P
+                      >C相线缆温度超高:
+                      <span
+                        v-if="getData.length > 0"
+                        class="normal"
+                        :class="[
+                          getData[6].AlarmStatus == 0 ? 'normal' : 'error',
+                        ]"
+                      >
+                        {{
+                          getData[6].AlarmStatus == 0
+                            ? "正常"
+                            : getData[6].AlarmStatus == 1
+                            ? "告警"
+                            : "故障"
+                        }}
+                      </span>
+                      <span v-else class="normal"> 默认正常 </span>
                     </P>
                   </td>
                   <td>
-                    <P>A相电压:
-                      <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[7].Value}}
-                      </span>
-                      <span v-else>
-                        219.00
+                    <P
+                      >A相电压:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[7].Value }}
                       </span>
+                      <span v-else> 219.00 </span>
                     </P>
-                    <P>B相电压:
-                       <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[8].Value}}
-                      </span>
-                      <span v-else>
-                        219.00
+                    <P
+                      >B相电压:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[8].Value }}
                       </span>
+                      <span v-else> 219.00 </span>
                     </P>
-                    <P>C相电压:
-                       <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[9].Value}}
-                      </span>
-                      <span v-else>
-                        219.00
+                    <P
+                      >C相电压:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[9].Value }}
                       </span>
-                      </P>
+                      <span v-else> 219.00 </span>
+                    </P>
                   </td>
                   <td>
-                    <P>A相电流:
-                       <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[10].Value}}
-                      </span>
-                      <span v-else>
-                        9.00
+                    <P
+                      >A相电流:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[10].Value }}
                       </span>
+                      <span v-else> 9.00 </span>
                     </P>
-                    <P>B相电流:
+                    <P
+                      >B相电流:
                       <!-- <span class="error">3.00</span> -->
-                      <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[11].Value}}
-                      </span>
-                      <span v-else>
-                        9.00
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[11].Value }}
                       </span>
+                      <span v-else> 9.00 </span>
                     </P>
-                    <P>C相电流:
-                      <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[12].Value}}
-                      </span>
-                      <span v-else>
-                        9.00
+                    <P
+                      >C相电流:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[12].Value }}
                       </span>
+                      <span v-else> 9.00 </span>
                       <!-- <span class="normal">9.00</span> -->
-                      </P>
+                    </P>
                   </td>
                   <td>
-                    <P>A相线缆温度:
-                      <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[13].Value}}
-                      </span>
-                      <span v-else>
-                        29.00
+                    <P
+                      >A相线缆温度:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[13].Value }}
                       </span>
+                      <span v-else> 29.00 </span>
                       <!-- <span class="normal">29.00</span> -->
                     </P>
-                    <P>B相线缆温度:
-                      <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[14].Value}}
-                      </span>
-                      <span v-else>
-                        29.00
+                    <P
+                      >B相线缆温度:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[14].Value }}
                       </span>
-                      
+                      <span v-else> 29.00 </span>
+
                       <!-- <span class="error">56.00</span> -->
-                      </P>
-                    <P>C相线缆温度:
-                      <span class="normal"  v-if="getData.length > 0 ">
-                        {{getData[15].Value}}
-                      </span>
-                      <span v-else>
-                        29.00
+                    </P>
+                    <P
+                      >C相线缆温度:
+                      <span class="normal" v-if="getData.length > 0">
+                        {{ getData[15].Value }}
                       </span>
+                      <span v-else> 29.00 </span>
                       <!-- <span class="normal">29.00</span> -->
                     </P>
                   </td>
@@ -191,9 +254,15 @@ export default {
       StationID: "",
       DeviceID: "",
       getData: [],
-      time:''
+      time: "",
+      timer: null, //定时器名称
     };
   },
+  // 最后在beforeDestroy()生命周期内清除定时器:
+  beforeDestroy() {
+    clearInterval(this.timer);
+    this.timer = null;
+  },
   watch: {
     "$store.state.wsInfo"(val) {
       this.messageHandle(val);
@@ -222,16 +291,35 @@ export default {
 
           this.global.sendWs(json);
 
-          // setInterval(() => {
-          //   // console.log("每隔30秒请求一次getDeviceDetail");
-          //   this.global.sendWs(json);
-          // }, 30000);
+          this.timer = setInterval(() => {
+            // console.log("每隔30秒请求一次getDeviceDetail");
+            this.global.sendWs(json);
+          }, 30000);
         }
 
         if (redata.CMD == "getDeviceDetail") {
           console.log("redata.RESULT");
           this.getData = redata.RESULT.Device[0].Points;
-          this.time=redata.time
+          this.time = redata.time;
+
+          // 排序start
+          // console.log("排序前");
+          // console.log(this.getData);
+          let sortPointer = [
+            1, 2, 3, 4, 5, 6, 7, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+          ];
+          let sortPointerArr = [];
+          this.getData.forEach((element3) => {
+            sortPointer.forEach((index) => {
+              if (element3.BusAddr == index) {
+                sortPointerArr.push(element3);
+              }
+            });
+          });
+          this.getData.Points = sortPointerArr;
+          // console.log("排序后");
+          // console.log(this.getData);
+          // 排序 end
         }
       }
     },

+ 23 - 16
src/pages/eleFireData/components/cableTemChart.vue

@@ -1,5 +1,5 @@
 <template>
-  <div id="cableRemChart" :style="{ width: '100%', height: ' 100% ' }"  ></div>
+  <div id="cableRemChart" :style="{ width: '100%', height: ' 100% ' }"></div>
 </template>
 <script>
 // var yearData = [
@@ -25,14 +25,13 @@ export default {
       cableRemC: [],
     };
   },
-  watch:{
-
-  },
+  watch: {},
   computed: {
     A: function () {
       var aa = [];
       this.cableRemA.forEach(function (item) {
         aa.push(item.Value);
+        aa.reverse()
       });
       return aa;
     },
@@ -41,6 +40,7 @@ export default {
       var bb = [];
       this.cableRemB.forEach(function (item) {
         bb.push(item.Value);
+        bb.reverse()
       });
       return bb;
     },
@@ -50,21 +50,23 @@ export default {
       this.cableRemC.forEach(function (item) {
         cc.push(item.Value);
       });
+      cc.reverse()
       return cc;
     },
     Time: function () {
       var time = [];
       this.cableRemC.forEach(function (item) {
         time.push(item.Time);
+        
       });
+      time.reverse()
       return time;
     },
   },
   mounted() {
-
     setTimeout(() => {
-      console.log("子组件中的this.getData");
-      console.log(this.getData);
+      // console.log("子组件中的this.getData");
+      // console.log(this.getData);
       this.cableRemA = this.getData[13].LIST;
       this.cableRemB = this.getData[14].LIST;
       this.cableRemC = this.getData[15].LIST;
@@ -74,10 +76,15 @@ export default {
     window.addEventListener("resize", () => {
       this.myChart.resize();
     });
+
+   
   },
   methods: {
+   
     draw() {
-      this.myChart = this.$echarts.init(document.getElementById("cableRemChart"));
+      this.myChart = this.$echarts.init(
+        document.getElementById("cableRemChart")
+      );
       this.myChart.setOption({
         // 通过这个color修改两条线的颜色
         title: {
@@ -85,8 +92,8 @@ export default {
           textStyle: {
             align: "center",
             color: "#fff",
-            fontSize: '.225rem ',
-            fontWeight:'400'
+            fontSize: ".225rem ",
+            fontWeight: "400",
           },
           left: "center",
         },
@@ -97,13 +104,13 @@ export default {
         },
         // 图列组件
         legend: {
-        //   show:false,
+          //   show:false,
           itemGap: 100,
           /* 如果series对象有name值,则legend可以不用写data */
           // 修改图列组件文字颜色
           textStyle: {
             color: "#fff",
-            fontSize:'.225rem '
+            fontSize: ".225rem ",
           },
 
           bottom: "-2%",
@@ -133,7 +140,7 @@ export default {
           //   "05:00",
           //   "07:00",
           // ],
-          data:this.Time,
+          data: this.Time,
           axisTick: {
             show: false, //去除刻度线
           },
@@ -170,7 +177,7 @@ export default {
             type: "line",
             smooth: false, // 曲线是否平滑显示
             // data: yearData[0].data[0],
-            data:this.A,
+            data: this.A,
             symbolSize: 10, //拐点圆的大小
           },
           {
@@ -178,7 +185,7 @@ export default {
             type: "line",
             smooth: false, // 曲线是否平滑显示
             // data: yearData[0].data[1],
-           data: this.B,
+            data: this.B,
             symbolSize: 10, //拐点圆的大小
           },
           {
@@ -186,7 +193,7 @@ export default {
             type: "line",
             smooth: false, // 曲线是否平滑显示
             // data: yearData[0].data[2],
-            data:this.C,
+            data: this.C,
             symbolSize: 10, //拐点圆的大小
           },
         ],

+ 4 - 0
src/pages/eleFireData/components/eleCurrentChart.vue

@@ -40,7 +40,9 @@ export default {
       this.eleCurrentB.forEach(function (item) {
         bb.push(item.Value);
       });
+       bb.reverse()
       return bb;
+     
     },
 
     C: function () {
@@ -48,6 +50,7 @@ export default {
       this.eleCurrentC.forEach(function (item) {
         cc.push(item.Value);
       });
+      cc.reverse()
       return cc;
     },
     Time: function () {
@@ -55,6 +58,7 @@ export default {
       this.eleCurrentC.forEach(function (item) {
         time.push(item.Time);
       });
+      time.reverse()
       return time;
     },
   },

+ 5 - 0
src/pages/eleFireData/components/voltageChart.vue

@@ -31,6 +31,8 @@ export default {
       this.voltageA.forEach(function (item) {
         aa.push(item.Value);
       });
+
+      aa.reverse()
       return aa;
     },
 
@@ -39,6 +41,7 @@ export default {
       this.voltageB.forEach(function (item) {
         bb.push(item.Value);
       });
+      bb.reverse()
       return bb;
     },
 
@@ -47,6 +50,7 @@ export default {
       this.voltageC.forEach(function (item) {
         cc.push(item.Value);
       });
+      cc.reverse()
       return cc;
     },
     Time: function () {
@@ -54,6 +58,7 @@ export default {
       this.voltageC.forEach(function (item) {
         time.push(item.Time);
       });
+       time.reverse()
       return time;
     },
   },

+ 32 - 5
src/pages/eleFireData/eleFireData.vue

@@ -205,9 +205,15 @@ export default {
       DeviceID: "",
       getData: [],
       eleCurrent: [],
-      time:''
+      time:'',
+       timer: null, //定时器名称
    
     };
+  },
+   // 最后在beforeDestroy()生命周期内清除定时器:
+  beforeDestroy() {
+    clearInterval(this.timer);
+    this.timer = null;
   },
   watch: {
     "$store.state.wsInfo"(val) {
@@ -231,9 +237,8 @@ export default {
 
           this.global.sendWs(json);
 
-          setInterval(() => {
-            // console.log("每隔30秒请求一次getDeviceDetail");
-            // this.global.sendWs(json);
+          this.timer=setInterval(() => {
+            this.global.sendWs(json);
           }, 30000);
         }
 
@@ -241,7 +246,29 @@ export default {
           console.log("redata.RESULT");
           console.log(redata.RESULT.Device[0].Points);
           this.getData = redata.RESULT.Device[0].Points;
-          this.time=redata.time
+          this.time=redata.time;
+
+          // 排序start
+          console.log("排序前");
+          console.log(this.getData);
+          let sortPointer = [
+            1, 2, 3, 4, 5, 6, 7, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+          ];
+          let sortPointerArr = [];
+          this.getData.forEach((element3) => {
+            sortPointer.forEach((index) => {
+              if (element3.BusAddr == index) {
+                sortPointerArr.push(element3);
+              }
+            });
+          });
+          this.getData.Points = sortPointerArr;
+          console.log("排序后");
+          console.log(this.getData);
+          // 排序 end
+
+
+          
         }
       }
     },

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

@@ -43,12 +43,10 @@ export default {
   mounted() {
 
     setTimeout(() => {
-      console.log("子组件中的this.getData");
-      console.log(this.getData);
+      // 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);
  

+ 13 - 9
src/pages/gasCard/gasCard.vue

@@ -76,8 +76,15 @@ export default {
       nongDu: "",
       chartPoint: [],
       chartDate: [],
+      timer: null, //定时器名称
     };
   },
+
+  // 最后在beforeDestroy()生命周期内清除定时器:
+  beforeDestroy() {
+    clearInterval(this.timer);
+    this.timer = null;
+  },
   watch: {
     "$store.state.wsInfo"(val) {
       this.messageHandle(val);
@@ -103,11 +110,12 @@ export default {
           json.DeviceID = this.DeviceID;
 
           this.global.sendWs(json);
-            setInterval(() => {
-              // console.log("每隔30秒请求一次getDeviceDetail");
-              // this.global.sendWs(json);
-            }, 30000);
-          
+          this.timer = setInterval(() => {
+            this.global.sendWs(json);
+          }, 30000);
+
+          // if (this.$route.path == "/gasCard") {
+          // }
         }
 
         if (redata.CMD == "getDeviceDetail") {
@@ -117,10 +125,6 @@ export default {
           this.AlarmStatus = this.getData.Points[0].AlarmStatus;
           this.nongDu = this.getData.Points[1].Value;
 
-          if(this.$route.path== "/gasCard"&& this.DeviceID==this.getData.DeviceID){
-            // alert(this.DeviceID)
-
-          }
         }
       }
     },

+ 31 - 26
src/pages/index/index.vue

@@ -7,7 +7,6 @@
     <div class="mainbox">
       <div style="margin: 0rem auto; width: 15rem">
         <div class="column" v-for="item in homeData" :key="item.StationID">
-
           <div
             class="panel"
             @click="goInnerCard(item)"
@@ -19,42 +18,37 @@
             <div>
               <p>
                 状态:
-                <span v-if="item.DeviceStatus==0">正常</span>
-                <span v-if="item.DeviceStatus==1">告警</span>
-                <span v-if="item.DeviceStatus==2">故障</span>
+                <span v-if="item.DeviceStatus == 0">正常</span>
+                <span v-if="item.DeviceStatus == 1">告警</span>
+                <span v-if="item.DeviceStatus == 2">故障</span>
               </p>
               <p class="light-color">{{ item.DeviceName }}</p>
 
-
               <!-- 电气火灾渲染start -->
               <p
                 v-if="item.DeviceType == '电气火灾监测装置'"
                 class="light-color"
               >
                 {{ item.KeyPoints[0].PointName }}:
-                <span v-if="item.KeyPoints[0].ValueList.length>0">
-                   {{item.KeyPoints[0].ValueList[0].Value == 0 ? "正常" : "告警"}}
-                </span>
-                <span v-else>
-                 -
+                <span v-if="item.KeyPoints[0].ValueList.length > 0">
+                  {{
+                    item.KeyPoints[0].ValueList[0].Value == 0 ? "正常" : "告警"
+                  }}
                 </span>
+                <span v-else> - </span>
               </p>
-               <!-- 电气火灾渲染end -->
+              <!-- 电气火灾渲染end -->
 
-
-               <!-- 可燃气体渲染start -->
+              <!-- 可燃气体渲染start -->
               <p v-else class="light-color">
                 {{ item.KeyPoints[0].PointName }}:
 
-                <span v-if="item.KeyPoints[0].ValueList.length>0">
+                <span v-if="item.KeyPoints[0].ValueList.length > 0">
                   {{ item.KeyPoints[0].ValueList[0].Value }}
                 </span>
                 <span v-else>-</span>
               </p>
-               <!-- 可燃气体渲染end -->
-
-
-
+              <!-- 可燃气体渲染end -->
             </div>
           </div>
         </div>
@@ -86,8 +80,15 @@ export default {
     return {
       StationID: "",
       homeData: [],
+      timer: null, //定时器名称
     };
   },
+   // 最后在beforeDestroy()生命周期内清除定时器:
+  beforeDestroy() {
+    clearInterval(this.timer);
+    this.timer = null;
+  },
+ 
   watch: {
     "$store.state.wsInfo"(val) {
       this.messageHandle(val);
@@ -103,26 +104,30 @@ export default {
     messageHandle(e) {
       if (e.data.search("{") != -1) {
         const redata = JSON.parse(e.data);
-        
+        // console.log("good boy");
+        // console.log(redata);
         if (redata.CMD == "getStationInfo" && redata.RESULT[0].StationID) {
           var json = {};
           json.CMD = "getStationDetail";
-          json.StationID = this.StationID;
+          json.StationID = this.StationID
+            ? this.StationID
+            : redata.RESULT[0].StationID;
+          this.$store.commit("changeStationID", this.StationID);
+          // console.log("json");
+          // console.log(json);
 
           this.global.sendWs(json);
 
-          setInterval(() => {
+           this.timer=setInterval(() => {
             // console.log("每隔30秒请求一次getStationDetail");
             this.global.sendWs(json);
           }, 30000);
         }
 
         if (redata.CMD == "getStationDetail") {
-
-         
           this.homeData = redata.RESULT.LIST;
-           console.log('首页数据') 
-        console.log(redata)
+          console.log("首页数据");
+          console.log(redata);
           console.log(this.homeData);
         }
       }
@@ -141,7 +146,7 @@ export default {
         });
       }
     },
-    
+
     goGasCard() {},
   },
 };

+ 14 - 7
src/pages/inspectRecord/inspectRecord.vue

@@ -195,8 +195,8 @@
           </table>
         </div>
 
-        <h3 >可燃气体监控信息</h3>
-        <div class="gasRecord">
+        <h3  v-if="JSON.stringify(getData[0]) != '{}'">可燃气体监控信息</h3>
+        <div class="gasRecord" v-if="JSON.stringify(getData[0]) != '{}'">
           <div
             class="recordItem"
             v-for="(item, index) in getData.slice(0, 3)"
@@ -215,7 +215,7 @@
                 <li v-for="(innerItem, index) in item.Points" :key="index">
                   <span
                     v-if="'Value' in innerItem"
-                    :class="[innerItem.Value == 0 ? 'normal' : 'error']"
+                    :class="[index == 0?innerItem.Value == 0 ? 'normal' : 'error':'']"
                   >
                     {{
                       index == 0
@@ -251,7 +251,13 @@ export default {
       eleData: [],
       Inv: 0,
       Time: "",
+      timer: null, //定时器名称
     };
+  },
+   // 最后在beforeDestroy()生命周期内清除定时器:
+  beforeDestroy() {
+    clearInterval(this.timer);
+    this.timer = null;
   },
   watch: {
     "$store.state.wsInfo"(val) {
@@ -275,16 +281,17 @@ export default {
 
           this.global.sendWs(json);
 
-          // setInterval(() => {
-          //   console.log("每隔30秒请求一次getDeviceDetail");
-          //   this.global.sendWs(json);
-          // }, 30000);
+           this.timer=setInterval(() => {
+            this.global.sendWs(json);
+          }, 30000);
         }
         if (redata.CMD == "getPatrolDetail") {
           this.recordData = redata.RESULT.LIST;
           // console.log(this.recordData);
           this.getData = this.recordData;
           this.eleData = this.recordData.slice(3, 6);
+  console.log('getData[0]')
+          console.log(this.getData[0])
 
           console.log("排序前");
           console.log(this.eleData);

+ 4 - 5
src/pages/recordTime/recordTime.vue

@@ -94,11 +94,10 @@ export default {
           (json.Start = 1), (json.Limit = this.Count), (json.Order = "DESC");
           this.global.sendWs(json);
 
-          setInterval(() => {
-            // console.log("每隔30秒请求一次getPatrolRecord");
-            this.global.sendWs(json);
-            this.currentPage=1
-          }, 30000);
+          // setInterval(() => {
+          //   this.global.sendWs(json);
+          //   this.currentPage=1
+          // }, 30000);
         }
 
         if (redata.CMD == "getPatrolRecord") {

+ 2 - 2
src/router/index.js

@@ -26,7 +26,7 @@ const routes = [{
     {
         path: '/index',
         component: Home,
-        meta: { title: '站点信息' },
+        meta: { title: '站点信息' },
     }, {
         path: '/gasCard',
         component: gasCard,
@@ -34,7 +34,7 @@ const routes = [{
     }, {
         path: '/eleFireCard',
         component: eleFireCard,
-        meta: { title: '电气火灾卡片页' },
+        meta: { title: '电气火灾' },
     }, {
         path: '/eleFireData',
         component: eleFireData,

+ 2 - 2
src/store/index.js

@@ -6,8 +6,8 @@ Vue.use(Vuex)
 export default new Vuex.Store({
     state: {
         wsInfo: null,
-        StationID: 'a5f41517-44be-4565-b27b-c9cc044c5061',
-        // StationID: '',
+        // StationID: 'a5f41517-44be-4565-b27b-c9cc044c5061',
+        StationID: '',
         wsTimer: 30
     },
     mutations: {