From fd934f83afae1e3fce46db8610837d0e0f4d9393 Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期四, 02 十一月 2023 10:44:56 +0800
Subject: [PATCH] 按开发清单已修改

---
 src/sfc/TimeShortCuts.vue |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/sfc/TimeShortCuts.vue b/src/sfc/TimeShortCuts.vue
index 454f525..d793bce 100644
--- a/src/sfc/TimeShortCuts.vue
+++ b/src/sfc/TimeShortCuts.vue
@@ -18,6 +18,12 @@
 import dayjs from 'dayjs';
 export default {
   props: {
+    beginAndEndTime:{
+      type:Object,
+      default: ()=>{
+        return []
+      }
+    },
     timeType: {
       type: String,
       default: 'month'
@@ -29,8 +35,19 @@
       //淇濆瓨寮�濮嬪拰缁撴潫鏃堕棿
       // 闅忎究璁剧疆鍒濆鍊� 锛宮ounted鏃跺啀璁炬纭殑锛岀洰鐨勬槸鏀瑰彉鏃堕棿浜嗚Е鍙慶hange
       time: ['2023-06-01 12:00:00', '2023-06-20 16:00:00'],
-      shortcuts: []
+      shortcuts: [],
+      defaultTime :[
+        new Date(2000, 1, 1, 0, 0, 0),
+        new Date(2000, 2, 1, 23, 59, 59),
+      ]
     };
+  },
+  watch:{
+    beginAndEndTime(){
+      if(this.beginAndEndTime.lenth!=0){
+        this.time = this.beginAndEndTime
+      }
+    }
   },
   mounted() {
     this.initShortCuts();
@@ -90,7 +107,10 @@
         case 'currentMonth':
         this.time[0] = dayjs().startOf('month').format('YYYY-MM-DD HH:mm:ss')
         this.time[1] = dayjs().subtract(1,'day').format('YYYY-MM-DD 23:59:59')
-        break  
+        // 闃叉鍦ㄦ瘡鏈堢殑1鍙凤紝鍑虹幇time[0]>time[1]鐨勬儏鍐�
+        if(this.time[0]<this.time[1]){
+          break  
+        }
         default:
           this.time[0] = dayjs().subtract(1, 'month').format('YYYY-MM-DD HH:mm:ss');
           this.time[1] = dayjs().format('YYYY-MM-DD HH:mm:ss');
@@ -113,6 +133,7 @@
       end-placeholder="缁撴潫鏃堕棿"
       value-format="YYYY-MM-DD HH:mm:ss"
       @change="$emit('submitTime', time)"
+      :default-time = "defaultTime"
       
     />
   </div>

--
Gitblit v1.9.3