From a7e6761ba0cfccdf33ed552eb2d3b783c8e4ab4a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 16 Apr 2025 20:49:12 +0800
Subject: [PATCH] feat:事件弹窗显示调整

---
 src/components/CommonDateTime.vue |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/components/CommonDateTime.vue b/src/components/CommonDateTime.vue
index 2cf3a06..3876c6c 100644
--- a/src/components/CommonDateTime.vue
+++ b/src/components/CommonDateTime.vue
@@ -25,8 +25,10 @@
 
 <script setup>
 import dayjs from 'dayjs';
+import { useStore } from 'vuex'
 import { ref, defineEmits } from 'vue';
 
+const store = useStore()
 const emit = defineEmits(['change']);
 
 const model = defineModel();
@@ -51,15 +53,27 @@
 };
 
 const change = value => {
-  // todo 我对接
+  // todo 待对接
   // emit('change', value);
 };
 
 let timeClick = (item,index) => {
   checked.value = item;
-  model.value = dateRanges[item];
-  emit('change', dateRanges[item],timeListEnum[index]);
+  const newDateRange = dateRanges[item];
+  model.value = newDateRange;
+  emit('change', newDateRange, timeListEnum[index],checked.value);
 };
+onMounted(() => {
+  // 如果父组件传入了值,就使用父组件的值 by cpz
+  if (model.value && model.value.length === 2) {
+    // 根据传入的日期判断是哪个时间范围
+    const startDate = model.value[0];
+    const endDate = model.value[1];
+    if (startDate !== endDate) {
+      checked.value = 'week';
+    }
+  }
+});
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.3