diff --git a/src/views/property-marketing/assignment-management/components/date-selector.vue b/src/views/property-marketing/assignment-management/components/date-selector.vue
index 7cb81f8..e4bf860 100644
--- a/src/views/property-marketing/assignment-management/components/date-selector.vue
+++ b/src/views/property-marketing/assignment-management/components/date-selector.vue
@@ -7,6 +7,7 @@
@change="handleDateChange"
v-model="currentDate"
format="YYYY年MM月DD日周dd"
+ value-format="YYYY-MM-DD"
/>
@@ -43,7 +46,13 @@
-
+
{{ choseType }}
日
@@ -141,7 +150,7 @@ const handleTypeChange = (val: '日' | '周' | '月') => {
const today = new Date();
currentDate.value = today;
emitChange();
-
+
// 选择后隐藏下拉菜单
setTimeout(() => {
dropdownVisible.value = false;
@@ -151,7 +160,22 @@ const handleTypeChange = (val: '日' | '周' | '月') => {
// 6. 日期选择器变更处理
const handleDateChange = (val: Date | string | undefined) => {
if (!val) return;
- const selectedDate = val instanceof Date ? val : new Date(val);
+
+ let selectedDate: Date;
+ if (val instanceof Date) {
+ selectedDate = val;
+ } else {
+ // 处理字符串格式的日期
+ if (choseType.value === '月') {
+ // 月份选择器返回 YYYY-MM 格式
+ const [year, month] = val.split('-').map(Number);
+ selectedDate = new Date(year, month - 1, 1);
+ } else {
+ // 日和周选择器返回 YYYY-MM-DD 格式
+ selectedDate = new Date(val);
+ }
+ }
+
currentDate.value = selectedDate;
emitChange();
};
@@ -245,7 +269,7 @@ setTimeout(() => {
color: #211f24 !important;
}
.doption {
- width: 80px !important;
+ width: 78px !important;
}
.prv-today {
color: #211f24 !important;
@@ -256,4 +280,4 @@ setTimeout(() => {
display: flex;
justify-content: space-between;
}
-
\ No newline at end of file
+