日历
Showing
2 changed files
with
49 additions
and
5 deletions
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | <el-calendar v-model="currentDate" :range="calendarRange"> | 3 | <el-calendar ref="calendar" v-model="currentDate" :range="calendarRange"> |
| 4 | <template #header="{ date }"> | ||
| 5 | <div class="father"> | ||
| 6 | <span class="textDay">{{ date }}</span> | ||
| 7 | <el-button-group class="son"> | ||
| 8 | <el-button size="small" type="primary" @click="selectDateCalendar('prev-month')"> | ||
| 9 | 上一月 | ||
| 10 | </el-button> | ||
| 11 | <el-button size="small" type="primary" @click="selectDateCalendar('today')">今天</el-button> | ||
| 12 | <el-button size="small" type="primary" @click="selectDateCalendar('next-month')"> | ||
| 13 | 下一月 | ||
| 14 | </el-button> | ||
| 15 | </el-button-group> | ||
| 16 | </div> | ||
| 17 | |||
| 18 | </template> | ||
| 4 | <template #date-cell="data"> | 19 | <template #date-cell="data"> |
| 5 | <div :class="data.data.day==query.currentDate?'primaryDate date':'date'" @click="selectDate(data.data.day)"> | 20 | <div :class="data.data.day==query.currentDate?'primaryDate date':'date'" @click="selectDate(data.data.day)"> |
| 6 | {{ data.data.day.slice(8, 10) }} | 21 | {{ data.data.day.slice(8, 10) }} |
| 7 | </div> | 22 | </div> |
| 8 | |||
| 9 | </template> | 23 | </template> |
| 10 | </el-calendar> | 24 | </el-calendar> |
| 11 | <div class="calendarList"> | 25 | <div class="calendarList"> |
| ... | @@ -30,14 +44,15 @@ import { dayjs } from 'element-plus' | ... | @@ -30,14 +44,15 @@ import { dayjs } from 'element-plus' |
| 30 | import { getIndexScheduleList } from '@/apiPc/common' | 44 | import { getIndexScheduleList } from '@/apiPc/common' |
| 31 | import { useRouter } from 'vue-router' | 45 | import { useRouter } from 'vue-router' |
| 32 | 46 | ||
| 47 | const calendar = ref('') | ||
| 33 | const router = useRouter() | 48 | const router = useRouter() |
| 34 | const currentDate = ref(new Date()) | 49 | const currentDate = ref(new Date()) |
| 35 | const calendarRange = ref([dayjs('2025-07-17').toDate(), dayjs('2025-07-17').toDate()]) | 50 | // const calendarRange = ref([dayjs().toDate(), dayjs().toDate()]) |
| 36 | const schList = ref([]) | 51 | const schList = ref([]) |
| 37 | const loading = ref(false) | 52 | const loading = ref(false) |
| 38 | const query = ref({ | 53 | const query = ref({ |
| 39 | // currentDate:dayjs().format('YYYY-MM-DD') | 54 | // currentDate:dayjs().format('YYYY-MM-DD') |
| 40 | currentDate: '2025-07-17' | 55 | currentDate: dayjs().format('YYYY-MM-DD') |
| 41 | }) | 56 | }) |
| 42 | getScheduleList() | 57 | getScheduleList() |
| 43 | 58 | ||
| ... | @@ -68,6 +83,16 @@ function goMatch(n) { | ... | @@ -68,6 +83,16 @@ function goMatch(n) { |
| 68 | } | 83 | } |
| 69 | }) | 84 | }) |
| 70 | } | 85 | } |
| 86 | |||
| 87 | const selectDateCalendar = (val) => { | ||
| 88 | if (!calendar.value) return | ||
| 89 | calendar.value.selectDate(val) | ||
| 90 | if (val == 'today') { | ||
| 91 | query.value.currentDate = dayjs().toDate() | ||
| 92 | getScheduleList() | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 71 | </script> | 96 | </script> |
| 72 | 97 | ||
| 73 | <style lang="scss" scoped> | 98 | <style lang="scss" scoped> |
| ... | @@ -190,4 +215,23 @@ function goMatch(n) { | ... | @@ -190,4 +215,23 @@ function goMatch(n) { |
| 190 | } | 215 | } |
| 191 | } | 216 | } |
| 192 | 217 | ||
| 218 | .father { | ||
| 219 | text-align: center; | ||
| 220 | position: relative; | ||
| 221 | width: 100%; | ||
| 222 | } | ||
| 223 | |||
| 224 | .son { | ||
| 225 | position: absolute; | ||
| 226 | right: 0; | ||
| 227 | width: 200px; | ||
| 228 | } | ||
| 229 | |||
| 230 | .textDay { | ||
| 231 | font-weight: bold; | ||
| 232 | background: linear-gradient(to right, #8623FC, #453DEA); /* 定义渐变方向和颜色 */ | ||
| 233 | -webkit-background-clip: text; /* 兼容 WebKit 浏览器 */ | ||
| 234 | background-clip: text; /* 标准语法 */ | ||
| 235 | -webkit-text-fill-color: transparent; /* 文字颜色透明 */ | ||
| 236 | } | ||
| 193 | </style> | 237 | </style> | ... | ... |
| ... | @@ -174,7 +174,7 @@ | ... | @@ -174,7 +174,7 @@ |
| 174 | <template #default="scope"> | 174 | <template #default="scope"> |
| 175 | <div> | 175 | <div> |
| 176 | <span :class="`flag-icon flag-icon-${scope.row.code}`" /> | 176 | <span :class="`flag-icon flag-icon-${scope.row.code}`" /> |
| 177 | {{ language == 0 ? scope.row.name : scope.row.countryNameEn }} | 177 | {{ language == 0 ? scope.row.name : scope.row.enName }} |
| 178 | </div> | 178 | </div> |
| 179 | </template> | 179 | </template> |
| 180 | </el-table-column> | 180 | </el-table-column> | ... | ... |
-
Please register or sign in to post a comment