Commit c3cb55a9 by xiexiaoqin

fix

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