Commit c3cb55a9 by xiexiaoqin

fix

parent 9a3126f4
......@@ -7,7 +7,6 @@ Component({
isCanEdit: true
},
didMount() {
console.log(this.props.taskList, 1111)
},
didUpdate() {
},
......
......@@ -38,11 +38,14 @@ export function getExcludeDate(data = []) {
// 返回跨天数
export function getNextDateList(startTime, endTime) {
// if (startTime.getTime() == new Date('2020/4/15 23:55').getTime()) {
// debugger
// }
let days = 0;
const nextDateList = [];
if (startTime.getDate() !== endTime.getDate()) {
//同一个月
if (startTime.getMonth() !== endTime.getMonth()) {
if (startTime.getMonth() == endTime.getMonth()) {
days = endTime.getDate() - startTime.getDate();
}
//跨月
......@@ -55,7 +58,7 @@ export function getNextDateList(startTime, endTime) {
//跨一个月 不考虑
}
//返回跨天的日期数组
for (let i = 1; i <= days; i++) {
for (let i = 0; i <= days; i++) {
const newDate = new Date(startTime);
const nextDate = toLocaleDateString(new Date(newDate.setDate(newDate.getDate() + i)));
nextDateList.push(nextDate)
......
......@@ -241,7 +241,8 @@ create.Page({
thisDayEndTime: getFormatDate(endTime, 'HH:mm'),
confirmAttendance: item.confirmAttendance,
title: item.title,
id: item.id
id: item.id,
isBeOverdue: currentDate.getTime() > endTime.getTime() ? true : false
};
//模板会议id为空
if (type == 'repeat') {
......@@ -249,31 +250,35 @@ create.Page({
pushItem.id = ''
}
if (DateMap.has(toLocaleDateString(startTime))) {
DateMap.get(toLocaleDateString(startTime)).push(pushItem)
}
// 如果是跨天会议,需要手动在今天以后的其他天 添加会议日程
const nextDateList = getNextDateList(startTime, endTime);
if (nextDateList.length > 0) {
for (let i = 0; i < nextDateList.length; i++) {
// 如果是跨天会议,需要手动在起始天以后的其他天 添加会议日程
const nextDateList = getNextDateList(startTime, endTime);//返回日期包括起始天
if (nextDateList.length > 1) {
pushItem.isDaySpan = true;
pushItem.isFewDays = 1;
pushItem.isfirstDayOrEndDay = '0'// 0 第一天,1中间的天,2结束的天
pushItem.duration = nextDateList.length;
for (let i = 1; i < nextDateList.length; i++) {
if (DateMap.has(nextDateList[i])) {
DateMap.get(nextDateList[i]).push({
DateMap.get(nextDateList[i]).unshift({
...pushItem,
isDaySpan: true,
isfirstDayOrEndDay: i === 0 ? "0" : i === nextDateList.length ? "2" : "1", // 0 第一天,1中间的天,2结束的天
isFewDays: i + 1,
duration: nextDateList.length + 1,
isBeOverdue: currentDate.getTime() > endTime.getTime() ? true : false
isfirstDayOrEndDay: nextDateList.length - 1 === i ? "2" : "1",// 0 第一天,1中间的天,2结束的天
});
}
}
}
if (DateMap.has(toLocaleDateString(startTime))) {
DateMap.get(toLocaleDateString(startTime)).push(pushItem)
}
},
// 根据接口返回数据生成填充DateMap
setDateMapByResponse(response) {
if (response) {
const repeatIdList = []; //重复会议的ID
// 处理重复会议 templateList
console.log('deal templateList')
response.templateList.forEach(item => {
repeatIdList.push(item.id)
// 生成rrules规则
......@@ -312,21 +317,23 @@ create.Page({
}
});
console.log('deal scheduleList')
// 处理单次会议 scheduleList
response.scheduleList.forEach(item => {
if (!item.scheduleTemplateId) {
this.setDateMapValue(new Date(item.startTime.replace(/-/g, '/')), new Date(item.endTime.replace(/-/g, '/')), item);
}
// if (!item.scheduleTemplateId) {
// this.setDateMapValue(new Date(item.startTime.replace(/-/g, '/')), new Date(item.endTime.replace(/-/g, '/')), item);
// }
// 有scheduleTemplateId则是虚拟会议转成实体会议,需要替换rrule生成的模板会议
else if (repeatIdList.includes(item.scheduleTemplateId)) {
if (repeatIdList.includes(item.scheduleTemplateId)) {
const list = DateMap.get(toLocaleDateString(new Date(item.planDate.replace(/-/g, '/')))) || [];
list.forEach((o, index) => {
if (o.scheduleTemplateId == item.scheduleTemplateId) {
list.splice(index, 1, item)
list.splice(index, 1);
}
});
}
this.setDateMapValue(new Date(item.startTime.replace(/-/g, '/')), new Date(item.endTime.replace(/-/g, '/')), item);
});
}
},
......
......@@ -30,6 +30,9 @@ export function debounce(fn, delay) {
Symbol 分隔符号
*/
export function getFormatDate(time, format, symbol) {
if (typeof time == 'string') {
time = new Date(time.replace(/-/g, '/'))
}
format = format ? format : "yyyyMMdd HH:mm:ss";
symbol = symbol ? symbol : "";
let year = time.getFullYear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment