:值班领导
:白班
:夜班
{{ selectedData["member_9898cif2"][0]["name"] }}
{{ selectedData["member_kvxgb9ry"][0]["name"] }}
{{ selectedData["member_bnqthlqd"][0]["name"] }}
methods:{
onClickDate(date) {
this.selectedData = this.timeData[moment(date).format("YYYY-MM-DD")];
},
// 日期添加备注
formatter(day) {
// 当前月份的日
const _time = new Date(day.date);
const year = _time.getFullYear();
const month = (_time.getMonth() + 1).toString().padStart(2, "0");
const oneday = _time.getDate().toString().padStart(2, "0");
const staDays = `${year}-${month}-${oneday}`;
if (isHoliday(staDays)) {
// 日期添加备注
day.bottomInfo = "休";
day.className = "holiday";
}
for (const key in this.timeData) {
if (staDays == key) {
if (this.timeData[key]["member_9898cif2"].length !== 0) {
day.topInfo = "排班";
} else {
// 日期添加备注
// day.topInfo = '排班'
}
}
}
this.timeData.forEach((item) => {
// 当前点击的日相同
if (date == this.timeData[i].key) {
// console.log(this.timeData[i]['member_9898cif2'])
// 判断预约次数是否为0
if (
this.timeData[i]["member_9898cif2"].length !== 0 &&
this.timeData[i]["member_9898cif2"] != null
) {
//值班领导
// 日期添加备注
day.topInfo = "已约满";
} else {
// 日期添加备注
day.topInfo = "可预约";
}
}
});
return day;
},
},



日历所需数据格式如下:

实现效果如下:

其中重要的几点:1.isHoliday(staDays) 判断是否是节假日
if (isHoliday(staDays)) {
// 日期添加备注
day.bottomInfo = "休";
day.className = "holiday";
}