|
|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
<div class="index-lists" v-loading="loading"> |
|
|
|
|
|
|
|
|
|
<el-card class="!border-none" shadow="never"> |
|
|
|
|
<el-form :inline="true" style="display: flex; justify-content: center;margin-top: 10px;margin-right: 70px;"> |
|
|
|
|
<el-form :inline="true" style="display: flex; margin-top: 10px;margin-right: 70px;"> |
|
|
|
|
<el-form-item label="请选择年份"> |
|
|
|
|
<el-date-picker type="year" v-model="currenYear" placeholder="请选择年份" value-format="YYYY"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
@ -21,10 +21,7 @@
|
|
|
|
|
<div class="holiday-cell" v-show="data.type === 'current-month'" |
|
|
|
|
:id="index + '-' + data.day" |
|
|
|
|
:class="{ 'is-holiday': ifHoliday(data.day) }, { 'is-adjust': ifAdjustDay(data.day) }"> |
|
|
|
|
{{ data.day.split('-')[2] }} |
|
|
|
|
<span class="holiday-text">{{ ifHoliday(data.day) ? '休' : '' }}</span> |
|
|
|
|
<span class="adjust-text">{{ ifAdjustDay(data.day) ? '班' : '' }}</span> |
|
|
|
|
<span class="content-text">{{ dayContent(data.day) }}</span> |
|
|
|
|
{{ formatDay(data.day).split('-')[2] }} |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-calendar> |
|
|
|
|
@ -59,6 +56,16 @@ const getDateData = () => {
|
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
const formatDay = (day) => { |
|
|
|
|
// 假设 day 是形如 "2023-09-05" 的字符串 |
|
|
|
|
const [year, month, dayWithZero] = day.split('-'); |
|
|
|
|
// 使用 parseInt 移除开头的0,并用 toString 保证是数字类型 |
|
|
|
|
const formattedDay = parseInt(dayWithZero, 10).toString(); |
|
|
|
|
// 如果需要补全为两位数(虽然题目要求去掉0,但这里提供一个补全的方法) |
|
|
|
|
// const formattedDay = dayWithZero.padStart(2, '0'); |
|
|
|
|
// 返回完整的格式化后的日期字符串 |
|
|
|
|
return `${year}-${month}-${formattedDay}`; |
|
|
|
|
} |
|
|
|
|
onBeforeMount(() => { |
|
|
|
|
getDateData(); |
|
|
|
|
}) |
|
|
|
|
@ -156,10 +163,12 @@ const dayContent = (day) => {
|
|
|
|
|
} |
|
|
|
|
.holiday-cell { |
|
|
|
|
position: relative; |
|
|
|
|
width: 50px; |
|
|
|
|
width: 40px; |
|
|
|
|
height: 40px; |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
align-items: center; |
|
|
|
|
left: 5px; |
|
|
|
|
} |
|
|
|
|
.holiday-text { |
|
|
|
|
position: absolute; |
|
|
|
|
@ -186,21 +195,21 @@ const dayContent = (day) => {
|
|
|
|
|
white-space: nowrap; |
|
|
|
|
} |
|
|
|
|
.is-holiday { |
|
|
|
|
border-radius: 5px; |
|
|
|
|
background: linear-gradient(145deg, #a7d2b3, #c6f9d5); |
|
|
|
|
|
|
|
|
|
border-radius: 50px 50px 50px 50px; |
|
|
|
|
background: #298F17; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
.is-adjust { |
|
|
|
|
/* .is-adjust { |
|
|
|
|
border-radius: 5px; |
|
|
|
|
background: linear-gradient(145deg, #d9a2a2, #ffc1c1); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} */ |
|
|
|
|
.scrollbar-container { |
|
|
|
|
height: calc(100vh - 200px); |
|
|
|
|
} |
|
|
|
|
.is-today { |
|
|
|
|
/* .is-today { |
|
|
|
|
border-radius: 5px; |
|
|
|
|
background: linear-gradient(145deg, #d9a2a2, #ffc1c1); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} */ |
|
|
|
|
</style> |