提交 332c4e5e 编写于 作者: qian.jie's avatar qian.jie

Merge branch 'develop' of...

Merge branch 'develop' of 192.168.110.53:com.pica.cloud.education.frontend/pica-admin-consultation into feature/jq_1
......@@ -332,3 +332,17 @@
word-wrap: break-word;
white-space: normal;
}
/deep/.fc-col-header-cell-cushion {
background: #fff;
border: 1px solid #0d9078;
color: #0d9078;
border-radius: 20px;
height: 30px;
line-height: 25px;
font-size: 14px;
margin: 10px 0;
text-decoration: none;
}
/deep/a:hover {
text-decoration: none;
}
......@@ -175,6 +175,7 @@
week: 1, // 1:当前周 2:上一周 3:下一周
currentIndex: 3,
haveWeek: [1],
businessHours: true,
calendarOptions: {
// 引入的插件,比如fullcalendar/daygrid,fullcalendar/timegrid引入后才可显示月,周,日
plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
......@@ -186,6 +187,10 @@
select: this.selectInfo,
selectMinDistance: 0,
eventResize: this.eventResize,
eventOverlap: false,
navLinks: true,
navLinkDayClick: this.navLinkDayClick,
// eventDurationEditable:false,
eventDrop: this.eventDrop,
editable: true,
overlap: false,
......@@ -322,6 +327,42 @@
}
});
},
navLinkDayClick(date) {
const day = dayjs(date).day();
const dayDate = dayjs(date).date();
const dayFormat = dayjs(date).format('YYYY-MM-DD');
let isAddAllDay = true;
const data = this.calendarOptions.events;
const len = data.length;
for (var i = 0; i < len; i++) {
const itemDay = dayjs(data[i].start).day();
if (!data[i].constraint && day === itemDay) {
data[i].allStatus && (isAddAllDay = false);
const index = this.getIdDeleteData(data[i].id);
this.isDoIt = true;
this.calendarOptions.events.splice(index, 1);
i--;
}
}
if (isAddAllDay) {
// 添加日期
const list = [
{ startTime: '09:00:00', endTime: '12:00:00' },
{ startTime: '13:00:00', endTime: '17:00:00' },
{ startTime: '18:00:00', endTime: '21:00:00' },
];
list.forEach((item) => {
const obj = {};
obj.id = dayDate + (this.calendarOptions.events.length + 1) * 10;
obj.week = this.week;
obj.end = dayFormat + ' ' + item.endTime;
obj.start = dayFormat + ' ' + item.startTime;
obj.allStatus = true;
console.log(obj);
this.calendarOptions.events.push(obj);
});
}
},
getCopyData(data) {
const copyList = [];
const addDay = 7;
......@@ -404,11 +445,39 @@
}
this.calendarOptions.events.push(dataObj);
});
this.limmitDateFun();
},
limmitDateFun() {
const list = [];
for (let i = 0; i < 7; i++) {
const obj = {};
const lastObj = {};
const day = dayjs(this.getEveryDay)
.add(i, 'day')
.format('YYYY-MM-DD HH:mm:ss');
obj.start = dayjs(day).add(12, 'hour').format('YYYY-MM-DD HH:mm:ss');
obj.end = dayjs(day).add(13, 'hour').format('YYYY-MM-DD HH:mm:ss');
lastObj.start = dayjs(day)
.add(17, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
lastObj.end = dayjs(day).add(18, 'hour').format('YYYY-MM-DD HH:mm:ss');
obj.constraint = 'businessHours';
obj.color = '#ccc';
obj.display = 'background';
obj.editable = false;
lastObj.constraint = 'businessHours';
lastObj.color = '#ccc';
lastObj.display = 'background';
lastObj.editable = false;
this.calendarOptions.events.push(obj);
this.calendarOptions.events.push(lastObj);
}
console.log(list, 'obj', this.getEveryDay);
},
handleDatesSet(dataInfo) {
this.getEveryDay = dayjs(dataInfo.startStr).format('YYYY-MM-DD HH:mm:ss');
this.getEveryDay = dayjs(dataInfo.start).format('YYYY-MM-DD HH:mm:ss');
const currentTime = new Date().getTime(); // 今天的时间戳
const getTime = new Date(dataInfo.startStr).getTime(); // 每周周一的时间戳
const getTime = new Date(dataInfo.start).getTime(); // 每周周一的时间戳
const cz = currentTime - getTime; // 每周周一时间戳 - 今天的时间
const oneHour = 1 * 60 * 60 * 1000 * 24; // 一天的时间戳
const timeDifference = (cz / oneHour) | 0; // 每周一时间距离今天时间数量
......@@ -459,9 +528,10 @@
this.getHandleTime(dataObj);
},
handleEventClick(event) {
if (!this.calendarOptions.selectable) {
if (!this.calendarOptions.selectable || event.event.constraint) {
return;
}
console.log(event, event, 'iiiieventeventevent');
this.$confirm('你要取消日期吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -512,38 +582,8 @@
},
selectInfo(info) {
console.log(info, 'infoinfoinfo');
const startDay = new Date(info.start).getDay();
const endDay = new Date(info.end).getDay();
// const chooseStartH = new Date(info.start).getHours();
// const chooseEndH = new Date(info.end).getHours();
// // const startH = 9;
// const middleH = 12;
// // const middleEH = 18;
// const endH = 21;
// const timeList = [];
// const timeObj = {};
// if (chooseStartH < middleH && chooseEndH >= endH ) {
// console.log(chooseStartH, chooseEndH, 'endDayendDayendDayendDay1111');
// timeList.push(
// {
// start:'2021-11-25 09:00:00',
// end:'2021-11-25 12:00:00'
// },
// {
// start:'2021-11-25 13:00:00',
// end:'2021-11-25 17:00:00'
// },
// {
// start:'2021-11-25 18:00:00',
// end:'2021-11-25 21:00:00'
// }
// );
// }
// this.calendarOptions.events = timeList;
if (startDay != endDay) {
return this.$toast('不能夸天选择排班');
}
const id = (this.calendarOptions.events.length + 1) * 10;
const day = dayjs(info.start).date();
const id = day + (this.calendarOptions.events.length + 1) * 10;
info.id = id;
const keyAll = ['end', 'endStr', 'id', 'start', 'startStr', 'week'];
const dataObj = {};
......@@ -554,30 +594,26 @@
dataObj[item] = info[item];
}
});
console.log(dataObj, 'dataObjdataObj');
this.calendarOptions.events.push(dataObj);
// this.calendarOptions.events.forEach(item=>{
// if(!item.constraint){
// console.log(item.id);
// }
// });
},
selectAllow(info) {
this.isDoIt = true;
const startDay = new Date(info.start).getDay();
const endDay = new Date(info.end).getDay();
const startHour = dayjs(info.start).hour();
const endHour = dayjs(info.end).hour();
console.log(dayjs(info.start).format('YYYY-MM-DD HH:mm:ss'));
if (startDay != endDay) {
return false;
}
// if (dayjs(info.start).format('YYYY-MM-DD HH:mm:ss').split(' ')[1] == '12:00:00' || dayjs(info.start).format('YYYY-MM-DD HH:mm:ss').split(' ')[1] == '17:00:00') {
// return false;
// }
if (startHour <= 12 && endHour <= 21) {
return false;
} else if (startHour >= 12 && endHour <= 21) {
if (startHour == 12 || startHour == 17) {
return false;
}
const currentDate = new Date();
const start = info.start;
const end = info.end;
......@@ -633,7 +669,7 @@
const data = this.calendarOptions.events;
console.log('data=======', data);
data.forEach((item) => {
if (item.week == (weekV ? weekV : this.week)) {
if (item.week == (weekV ? weekV : this.week) && !item.constraint) {
const obj = {};
obj.startTime = this.dateFormat('YYYY-mm-dd HH:MM:SS', item.start);
obj.endTime = this.dateFormat('YYYY-mm-dd HH:MM:SS', item.end);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册