Commit 852ada78 by liang ce

Merge branch 'dev' of http://gitlab.roboming.com/fengzhaoyu/schedule into dev

parents 53efb5cd d7d0558a
import {
getDynamicList,
meetingCollection,
updateMeetingTask
} from "../../api/request";
import { getCreateShowTime } from "../../utils/utils";
import create from 'dd-store';
create.Component({
mixins: [],
data: {
traceTime: '1970-03-01 00:00:00',
isStopBodyScroll: false,
dynamicList: [],
current: 1,
pages: 1,
loading: true
},
props: {},
didMount() {
this.getPages(1);
},
didUpdate() {
console.log(this.data.dynamicList, 111)
},
didUnmount() { },
methods: {
setBodyDisableScroll(isStopBodyScroll) {
this.setData({
isStopBodyScroll
})
},
//点击页面关闭侧滑模块
closeSwipe() {
if (this.$store.closeActiveSwipe) {
this.$store.closeActiveSwipe()
}
},
getPages(current, callBack) {
getDynamicList({
current,
size: 10
}).then(res => {
if (!res.data.data) {
this.setData({
loading: false
})
return;
}
const dynamicList = res.data.data.records.map((item, index) => {
for (let i = 0; i < item.meetingLogDataList.length; i++) {
item.meetingLogDataList[i].meetingLogResource.groupId = item.groupId
if (item.meetingLogDataList[i].creatorInfo) {
item.meetingLogDataList[i].creatorInfo = JSON.parse(
item.meetingLogDataList[i].creatorInfo
);
}
if (item.meetingLogDataList[i].createTime) {
item.meetingLogDataList[i].createTime = getCreateShowTime(
item.meetingLogDataList[i].createTime
);
}
let itemData = item.meetingLogDataList[i].meetingLogResource;
if (itemData) {
if (itemData.taskInfos || itemData.fileInfos) {
if (itemData.creatorInfo) {
itemData.creatorInfo = JSON.parse(itemData.creatorInfo);
}
if (itemData.fileInfos) {
itemData.fileInfos = JSON.parse(itemData.fileInfos);
}
if (itemData.taskInfos) {
itemData.taskInfos = JSON.parse(itemData.taskInfos);
}
if (itemData.acceptorInfo) {
itemData.acceptorInfo = JSON.parse(itemData.acceptorInfo);
}
}
}
}
return item
});
//第一页数据会重新请求需要替换
if (current === 1) {
this.setData({
dynamicList
});
} else {
const newDynamicList = this.data.dynamicList.concat(dynamicList);
this.setData({
dynamicList: newDynamicList
});
}
this.setData({
loading: false,
current: res.data.data.current,
pages: res.data.data.pages,
});
if (callBack) {
callBack()
}
});
},
changeCollection(e) {
const { index, scheduleId, collection } = e.target.dataset;
meetingCollection({
scheduleId,
collection
}).then(res => {
//取消置顶
if (collection === "N") {
// 重新获取第一页的数据
this.getPages(1, () => {
dd.showToast({
content: '取消成功'
})
});
} else {
//置顶
const dynamicList = this.data.dynamicList;
const replaceItem = dynamicList[index];
dynamicList[index].traceTime = res.data.data;
dynamicList.splice(index, 1);
dynamicList.unshift(replaceItem);
this.setData({
dynamicList: dynamicList
}, () => {
dd.showToast({
content: '置顶成功'
})
});
}
});
},
onScrollToLower() {
if (this.data.current < this.data.pages) {
this.getPages(this.data.current + 1);
}
},
onChangeTaskStatusOnList(e) {
const data = {
groupId: e.groupId,
scheduleId: e.scheduleId,
resourceType: "task",
creatorId: getApp().globalData.userid,
creatorInfo: getApp().globalData.userInfo,
id: e.id,
logType: "task_status_modify",
taskStatus: e.status
};
updateMeetingTask(data).then(res => {
if (res.data.code === 0) {
let dataIndex1 = "";
let dataIndex2 = "";
this.data.dynamicList.forEach((item, index) => {
if (item.scheduleId === e.scheduleId) {
dataIndex1 = index;
item.meetingLogDataList.forEach((it, index2) => {
if (it.meetingLogResource.id == e.id) {
dataIndex2 = index2;
}
});
}
});
const setData = `dynamicList[${dataIndex1}].meetingLogDataList[${dataIndex2}].meetingLogResource.taskStatus`;
this.setData({
[setData]: e.status
});
}
});
},
nextPage(event) {
this.$store.data.tabBarIndex = '0'
this.update()
dd.navigateTo({ url: `./../meetingDetail/meetingDetail?scheduleItem=${JSON.stringify(event.currentTarget.dataset.item)}` });
},
}
});
......@@ -7,7 +7,6 @@ Component({
isCanEdit: true
},
didMount() {
console.log(this.props.taskList, 1111)
},
didUpdate() {
},
......
{
"dependencies": {
"dd-store": "^1.8.4",
"less": "^3.11.1",
"dd-store": "^1.9.0",
"rrule": "^2.6.4"
}
}
......@@ -12,7 +12,7 @@
</view>
<!-- $data.$data.roomId locationName 地点 -->
<view class="place">
<view class="iconicon_room1 iconfont icon " a:if="{{$data.roomId}}">
<view class="iconicon_room iconfont icon " a:if="{{$data.roomId}}">
</view>
<view class="iconicon_location1 iconfont icon {{$data.locationName ? '' : 'noValueIcon'}}" a:else>
</view>
......
......@@ -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)
......
......@@ -56,6 +56,7 @@ create.Page({
this.getPages(1);
//获取日程列表
this.getData();
this.isFirstLoad = true;
},
//动态列表侧滑的时候禁止页面上下滑动
setBodyDisableScroll(isStopBodyScroll) {
......@@ -82,6 +83,7 @@ create.Page({
}
const dynamicList = res.data.data.records.map((item, index) => {
for (let i = 0; i < item.meetingLogDataList.length; i++) {
if (item.meetingLogDataList[i].creatorInfo) {
item.meetingLogDataList[i].creatorInfo = JSON.parse(
item.meetingLogDataList[i].creatorInfo
......@@ -94,6 +96,7 @@ create.Page({
}
let itemData = item.meetingLogDataList[i].meetingLogResource;
if (itemData) {
itemData.groupId = item.groupId
if (itemData.taskInfos || itemData.fileInfos) {
if (itemData.creatorInfo) {
itemData.creatorInfo = JSON.parse(itemData.creatorInfo);
......@@ -240,7 +243,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') {
......@@ -248,31 +252,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规则
......@@ -311,21 +319,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);
});
}
},
......@@ -608,5 +618,9 @@ create.Page({
if (tabbar == '1' && lastTimeTabBarIndex == tabbar) {
this.backToToday();
}
if (this.isFirstLoad) {
this.backToToday();
this.isFirstLoad = false;
}
}
});
......@@ -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