From d515dcda54bde1e779df761c23205427a72b18a4 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 01 Feb 2024 16:42:37 +0800
Subject: [PATCH] fix:断线监控

---
 src/views/onlineRate/detailBox.vue |   15 ++++++---------
 src/views/onlineRate/index.vue     |    4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/views/onlineRate/detailBox.vue b/src/views/onlineRate/detailBox.vue
index 98394a2..999e7fd 100644
--- a/src/views/onlineRate/detailBox.vue
+++ b/src/views/onlineRate/detailBox.vue
@@ -101,7 +101,8 @@
               label-class-name="itemSpan"
             >
               <template slot-scope="scope">
-                <span>{{ scope.row.mun }}</span>{{ time }}
+                <span v-if="scope.row.mun!=='-'">{{ scope.row.mun }}{{ time }}</span>
+                <span v-else>-</span>
               </template>
             </el-table-column>
           </el-table>
@@ -198,7 +199,6 @@
   },
   computed: {
     onlineRate () {
-      console.log('///', ((this.macOnlineDetailData.pieChart2) / this.sum))
       return (this.macOnlineDetailData.pieChart2 / this.sum) * 100 || 0
     }
   },
@@ -211,7 +211,6 @@
         this.type = 'hour'
         this.lineType = 'hour'
       } else if (newValue === '������') {
-        this.lineType = 'hour'
         this.type = 'minute'
       }
     }
@@ -311,12 +310,12 @@
           echarts.dispose(dom)
           var myChart = echarts.init(dom)
           let starTiem = params.data[0]
-          console.log('starTiem', dayjs(starTiem).format('YYYY.MM.DD  HH:mm:ss'))
-          let endTiem = dayjs(starTiem).add(1, 'hour')
+          let data = dayjs(starTiem).add(1, 'hour')
+          let endTiem = dayjs(data).isAfter(dayjs()) ? dayjs() : data
+          console.log('.isAfter(now)', dayjs(endTiem).isAfter(dayjs()))
           this.getLineData(dayjs(starTiem).format('YYYY-MM-DD  HH:mm:ss'), dayjs(endTiem).format('YYYY-MM-DD  HH:mm:ss'), 'minute')
           myChart.setOption(option, true)
         }
-        console.log('this.lineType', this.lineType)
       })
     },
     renderBack () {
@@ -361,7 +360,6 @@
         tooltip: {
           trigger: 'item',
           formatter: function (params) {
-            console.log(params)
             var value = params.data[0]
             let tip = params.value[1] === 1 ? '������: ' + value : '������: ' + value
             return tip
@@ -394,7 +392,7 @@
             height: 20, // ������������������������
             type: 'slider', // type������������������������������������������slider������������������������������������inside���������������������������������������
             xAxisIndex: 0, // ���������x���������������������x���������������������
-            filterMode: 'filter', // ���������������������������,'filter'���������������������������������������������������������������������������'weakFilter'���������������������������������������������������������������������������
+            filterMode: 'weakFilter', // ���������������������������,'filter'���������������������������������������������������������������������������'weakFilter'���������������������������������������������������������������������������
             start: 0, // ���������������������������������
             end: 100, // ���������������������������������
           },
@@ -434,7 +432,6 @@
           this.sData = data.map((item, index) => {
             return [ this.xData[index], item ]
           })
-          console.log(this.sData)
           this.$nextTick(() => {
             this.renderLine()
           })
diff --git a/src/views/onlineRate/index.vue b/src/views/onlineRate/index.vue
index fa5a68c..717daa8 100644
--- a/src/views/onlineRate/index.vue
+++ b/src/views/onlineRate/index.vue
@@ -69,7 +69,7 @@
       </el-form>
     </div>
     <div>
-      <p>���������������������<span class="greenClor">{{ tableData.length }}</span>������������<span class="greenClor">{{ onlineData }}</span>��������������� <span :class=" onlineRate<90 ?'redClor':'greenClor'">{{ onlineRate }}%</span></p>
+      <p>���������������������<span class="greenClor">{{ tableData.length }}</span>������������<span class="greenClor">{{ onlineData }}</span>��������������� <span :class=" onlineRate<90 ?'redClor':'greenClor'">{{ onlineRate.toFixed(2) }}%</span></p>
       <div>
         <el-table
           v-loading="loading"
@@ -259,7 +259,7 @@
       return this.tableData.filter(item => item.state !== '0').length || 0
     },
     onlineRate () {
-      return Math.floor((this.onlineData / this.tableData.length) * 100) || 0
+      return (this.onlineData / this.tableData.length) * 100 || 0
     }
   },
   watch: {

--
Gitblit v1.8.0