From afb9e7c8c9865be6a73d19e35819b5aa6b8afbdd Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 17 Jun 2024 15:05:29 +0800
Subject: [PATCH] fix: bug修改

---
 src/components/Wind/Map.vue |   73 ++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/src/components/Wind/Map.vue b/src/components/Wind/Map.vue
index 082c2ef..c2dc060 100644
--- a/src/components/Wind/Map.vue
+++ b/src/components/Wind/Map.vue
@@ -28,7 +28,20 @@
           alt=""
           @click="turnState"
         >
-        <span class="text_Time">{{ dateFormat }}</span>
+        <span class="text_Time">
+          <el-date-picker
+            v-model="selectData"
+            popper-class="tpc"
+            value-format="yyyy-MM-dd HH"
+            format="yyyy-MM-dd HH"
+            :clearable="false"
+            :editable="false"
+            type="datetime"
+            :picker-options="pickerOptions"
+            placeholder="������������������"
+            @change="changeData"
+          />
+        </span>
         <img
           class="drop-icon"
           :src="turnImg"
@@ -396,6 +409,11 @@
       timerKey: '', // ���������������������������
       map: null,
       code: [],
+      pickerOptions: {
+        disabledDate: (time) => {
+          return time.getTime() > Date.now() - 1 * 24 * 3600 * 1000
+        },
+      },
       latlng: [],
       noneData: false,
       params: ['PM10', 'PM2.5', 'SO2', 'NO2', 'CO', 'O3', 'TVOC'],
@@ -507,6 +525,7 @@
       turnImg: require('@/assets/images/regionalOverview/dropDown.png'),
       showOrHidden: true,
       dateFormat: '',
+      selectData: new Date(),
       alarmTableVisible: false,
       chooseTimeInfo: false, // ������������������������
       chooseTime: false,
@@ -517,7 +536,8 @@
       clickmac: '',
       childerItem: {},
       farterItem: {},
-      indexsLaber: 0
+      indexsLaber: 0,
+      time: new Date()
     }
   },
   computed: {
@@ -580,10 +600,10 @@
   methods: {
     // ������������������������������
     getDayXQ (day) {
-      var days = new Date().getDay() // ������
+      var days = new Date().getDay() // ������ // ������
       var rq = '' // ������
       if (day === 'today') {
-        rq = this.newData(0)
+        rq = this.newData(0) // ������������
       } else if (day === 'yesterday') {
         days = (days + 7 - 1) % 7
         rq = this.newData(-1) // ������������
@@ -672,6 +692,7 @@
               inText2.innerHTML = times + ':00'
               this.chooseTimeInfo = true // ���������������
               this.chooseTime = true // ���������������
+              console.log('times', times)
               if ((i + 1) / 24 < 1) {
                 this.nyr = this.newData(-2, 'nyr') + ' ' + times + ':00'
               } else if ((i + 1) / 24 < 2 && (i + 1) / 24 >= 1) {
@@ -705,6 +726,7 @@
               inText2.innerHTML = times + ':00'
               this.chooseTimeInfo = true // ���������������
               this.chooseTime = true // ���������������
+              console.log('times', times)
               if (i / 24 < 1) {
                 this.nyr = this.newData(-2, 'nyr') + ' ' + times + ':00'
               } else if (i / 24 < 2 && i / 24 >= 1) {
@@ -1968,6 +1990,22 @@
       // })
       window.map = map
     },
+    changeData (val) {
+      console.log(val)
+      this.nyr = val + ':00'
+      const date = new Date(this.nyr.replace(/(\d{4}-\d{2}-\d{2}) (\d{2})(?!\d)/, '$1 $2:00'))
+
+      console.log(date)
+      this.chooseTime = true
+      // var p1 = document.querySelector('.p1')
+      // var p2 = document.querySelector('.p2')
+      // var p3 = document.querySelector('.p3')
+      // this.time = date
+      // p3.innerHTML = this.getDayXQ('today')
+      // p2.innerHTML = this.getDayXQ('yesterday')
+      // p1.innerHTML = this.getDayXQ('beforeYea')
+      this.initData()
+    },
     // ������������������������
     change (index) {
       this.changeColor = index
@@ -2437,11 +2475,36 @@
   margin-top: 9px;
   margin-left: 10px;
 }
-
 .text_Time {
   float: left;
   margin-left: 37px;
+  .el-date-editor{
+    width: 145px!important;
+    .el-input__prefix{
+      display: none!important;
+    }
+    .el-input__inner{
+      cursor: pointer;
+      font-size: 18px;
+      color: #fff;
+      padding: 0px!important;
+      border: none;
+      background: inherit;
+
+    }
+  }
 }
+.tpc{
+  left: unset!important;
+  right: 60px;
+}
+.tpc .el-time-spinner__wrapper {
+  width:100% !important;
+}
+.tpc .el-scrollbar:nth-of-type(2) {
+  display: none !important;
+}
+
 .my-div-icon {
   font-size: 14px;
   text-align: center;

--
Gitblit v1.8.0