From 379ab2ceed662c2e38b7ad134189bdd4c6116ba1 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 05 Feb 2024 11:07:18 +0800
Subject: [PATCH] fix:bug修复

---
 src/views/onlineRate/detailBox.vue |   42 +++++++++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/src/views/onlineRate/detailBox.vue b/src/views/onlineRate/detailBox.vue
index 98394a2..27e06ea 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>
@@ -139,30 +140,37 @@
 
       pickerOptions: {
         shortcuts: [{
+          text: '������',
+          onClick (picker) {
+            const end = dayjs()
+            const start = new Date(dayjs().startOf('day'))
+            picker.$emit('pick', [new Date(start), new Date(end)])
+          }
+        }, {
           text: '���1���',
           onClick (picker) {
-            const end = dayjs().subtract(1, 'hour')
+            const end = dayjs()
             const start = dayjs().subtract(1, 'day')
             picker.$emit('pick', [new Date(start), new Date(end)])
           }
         }, {
           text: '���3���',
           onClick (picker) {
-            const end = dayjs().subtract(1, 'hour')
+            const end = dayjs()
             const start = dayjs().subtract(3, 'day')
             picker.$emit('pick', [new Date(start), new Date(end)])
           }
         }, {
           text: '���5���',
           onClick (picker) {
-            const end = dayjs().subtract(1, 'hour')
+            const end = dayjs()
             const start = dayjs().subtract(5, 'day')
             picker.$emit('pick', [new Date(start), new Date(end)])
           }
         }, {
           text: '���7���',
           onClick (picker) {
-            const end = dayjs().subtract(1, 'hour')
+            const end = dayjs()
             const start = dayjs().subtract(7, 'day')
             picker.$emit('pick', [new Date(start), new Date(end)])
           }
@@ -198,7 +206,6 @@
   },
   computed: {
     onlineRate () {
-      console.log('///', ((this.macOnlineDetailData.pieChart2) / this.sum))
       return (this.macOnlineDetailData.pieChart2 / this.sum) * 100 || 0
     }
   },
@@ -211,15 +218,14 @@
         this.type = 'hour'
         this.lineType = 'hour'
       } else if (newValue === '������') {
-        this.lineType = 'hour'
         this.type = 'minute'
       }
     }
   },
   mounted () {
     this.title = `${this.macDate.name}������`
-    this.startTime = this.macDate.startTime
-    this.endTime = this.macDate.endTime
+    this.startTime = dayjs(this.macDate.startTime).format('YYYY-MM-DD  HH:mm')
+    this.endTime = dayjs(this.macDate.endTime).format('YYYY-MM-DD  HH:mm')
     this.$set(this.selectTime, 0, new Date(this.macDate.startTime))
     this.$set(this.selectTime, 1, new Date(this.macDate.endTime))
     this.getLineData()
@@ -239,8 +245,12 @@
       this.startTime = !this.selectTime ? '' : dayjs(this.selectTime[0]).format('YYYY-MM-DD  HH:mm')
       this.endTime = !this.selectTime ? '' : dayjs(this.selectTime[1]).format('YYYY-MM-DD  HH:mm')
       this.getMacDetail()
-      if (this.type !== 'minute') {
-        this.getLineData()
+      if (this.type === 'minute') {
+        this.lineType = 'hour'
+        this.getLineData(this.startTime, this.endTime, 'hour')
+      } else {
+        this.lineType = this.type
+        this.getLineData(this.startTime, this.endTime, this.type)
       }
     },
     initPieChart (pieChartData) {
@@ -311,12 +321,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 +371,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 +403,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 +443,6 @@
           this.sData = data.map((item, index) => {
             return [ this.xData[index], item ]
           })
-          console.log(this.sData)
           this.$nextTick(() => {
             this.renderLine()
           })

--
Gitblit v1.8.0