From 500ddf6571e656f33ef7fe10c570f6345344c989 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 01 Feb 2024 15:47:38 +0800
Subject: [PATCH] fix:断线监控

---
 src/views/onlineRate/index.vue |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/views/onlineRate/index.vue b/src/views/onlineRate/index.vue
index 4b07158..3c664be 100644
--- a/src/views/onlineRate/index.vue
+++ b/src/views/onlineRate/index.vue
@@ -19,9 +19,9 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="������:">
+        <el-form-item label="������������:">
           <el-select
-            v-model="formInline.state"
+            v-model="formInline.hourState"
             clearable
             placeholder="������������"
           >
@@ -69,7 +69,7 @@
       </el-form>
     </div>
     <div>
-      <p>���������������{{ tableData.length }}������������ {{ onlineData }}��������������� <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 }}%</span></p>
       <div>
         <el-table
           v-loading="loading"
@@ -131,7 +131,11 @@
             label="���������"
             width="100px"
             align="center"
-          />
+          >
+            <template slot-scope="scope">
+              <span :class=" scope.row.onlineRate<90 ?'redClor':'greenClor'">{{ scope.row.onlineRate }}%</span>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="onlineTime"
             label-class-name="itemSpan"
@@ -140,15 +144,15 @@
             align="center"
           />
           <el-table-column
-            prop="state"
+            prop="hourState"
             label-class-name="itemSpan"
-            label="������"
-            width="80px"
+            label="������������"
+            width="90px"
             align="center"
           >
             <template slot-scope="scope">
               <el-button
-                v-if="scope.row.state === '0'"
+                v-if="scope.row.hourState === '0'"
                 style="color:red;font-size:15px"
                 type="text"
               >
@@ -195,6 +199,7 @@
 <script>
 import dayjs from 'dayjs'
 import detailBox from '@/views/onlineRate/detailBox'
+import _ from 'lodash'
 export default {
   components: {
     detailBox
@@ -203,6 +208,8 @@
     return {
       formInline: {
         organizationId: '',
+        hourState: '',
+        state: '',
         startTime: dayjs().startOf('day').format('YYYY-MM-DD  HH:mm'),
         endTime: dayjs().subtract(1, 'hour').format('YYYY-MM-DD  HH:mm')
       },
@@ -290,12 +297,16 @@
     handleDetail (row) {
       console.log(row)
       this.handleShow = true
-      this.macDate = row
+      this.macDate = _.cloneDeep(row)
       this.macDate.startTime = this.formInline.startTime
       this.macDate.endTime = this.formInline.endTime
     },
     handleSearch () {
       if (this.formInline.organizationId !== '') {
+        if (this.time === '������') {
+          this.formInline.startTime = dayjs().startOf('day').format('YYYY-MM-DD  HH:mm')
+          this.formInline.endTime = dayjs().subtract(1, 'hour').format('YYYY-MM-DD  HH:mm')
+        }
         this.loading = true
         this.$request({
           url: '/onlineRate/page',
@@ -305,7 +316,7 @@
           }
         })
           .then(res => {
-            this.tableData = res.data
+            this.tableData = res.data || []
             this.loading = false
           })
           .catch(err => {

--
Gitblit v1.8.0