From 40136e63ea1a8d534fb9fabdfdd523d9fdb9a495 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 22 Jul 2025 16:16:13 +0800
Subject: [PATCH] feat:日历样式调整
---
src/views/wel/components/calendarBox.vue | 31 +++++++++----------------------
1 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/src/views/wel/components/calendarBox.vue b/src/views/wel/components/calendarBox.vue
index 4e9db2c..1680383 100644
--- a/src/views/wel/components/calendarBox.vue
+++ b/src/views/wel/components/calendarBox.vue
@@ -10,6 +10,7 @@
:clearable="false"
:prefix-icon="''"
@change="handleMonthChange"
+ :format="'YYYY年M月'"
/>
<img :src="caright" alt="" @click="selectDate('next-month')" />
</div>
@@ -56,11 +57,16 @@
end_date: undefined,
start_date: undefined,
});
-
+const formatDate = (date, format = 'YYYY年M月') => {
+ return dayjs(date).format(format);
+};
const eventIcons = ref({
'work-order': ev1,
task: ev2,
});
+// 初始化月份范围
+const monthRange = getCurrentMonthRange();
+params.value = monthRange;
// 检查日期是否是当前月份
const isCurrentMonth = date => {
return dayjs(date).isSame(dayjs(), 'month');
@@ -124,9 +130,7 @@
currentMonth.value = dayjs(currentMonth.value).add(1, 'month').toDate();
}
- // 等待DOM更新
await nextTick();
-
// 强制清除所有选中状态
const selectedCells = document.querySelectorAll('.el-calendar-table td.is-selected');
selectedCells.forEach(cell => {
@@ -136,6 +140,7 @@
// 如果是当前月份才设置选中
if (isCurrentMonth(currentMonth.value)) {
selectedDate.value = new Date();
+
}
};
@@ -170,11 +175,6 @@
const getEvents = dateString => {
return events.value[dateString] || [];
};
-
-// 初始化月份范围
-const monthRange = getCurrentMonthRange();
-params.value = monthRange;
-
const jumpcalendar = (event, day) => {
if (event.name === '工单') {
router.push({
@@ -254,19 +254,6 @@
margin-right: 5px;
margin-bottom: 8px;
}
-
- // 非选中日期的样式
- .el-calendar-table td:not(.is-selected) {
- .el-calendar-day {
- background: #f5f7fa;
- border: 1px solid #efefef;
-
- .date-number {
- font-weight: normal;
- color: inherit;
- }
- }
- }
.el-input__prefix-inner {
display: none !important;
}
@@ -290,7 +277,7 @@
.el-date-editor.el-input__wrapper {
height: var(--el-input-height, var(--el-component-size));
- width: 150px !important;
+ width: 170px !important;
}
}
</style>
--
Gitblit v1.9.3