| | |
| | | :clearable="false" |
| | | :prefix-icon="''" |
| | | @change="handleMonthChange" |
| | | :format="'YYYY年M月'" |
| | | /> |
| | | <img :src="caright" alt="" @click="selectDate('next-month')" /> |
| | | </div> |
| | |
| | | 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'); |
| | |
| | | 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 => { |
| | |
| | | // 如果是当前月份才设置选中 |
| | | if (isCurrentMonth(currentMonth.value)) { |
| | | selectedDate.value = new Date(); |
| | | |
| | | } |
| | | }; |
| | | |
| | |
| | | const getEvents = dateString => { |
| | | return events.value[dateString] || []; |
| | | }; |
| | | |
| | | // 初始化月份范围 |
| | | const monthRange = getCurrentMonthRange(); |
| | | params.value = monthRange; |
| | | |
| | | const jumpcalendar = (event, day) => { |
| | | if (event.name === '工单') { |
| | | router.push({ |
| | |
| | | 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; |
| | | } |
| | |
| | | .el-date-editor.el-input__wrapper { |
| | | height: var(--el-input-height, var(--el-component-size)); |
| | | |
| | | width: 150px !important; |
| | | width: 170px !important; |
| | | } |
| | | } |
| | | </style> |