utils.js 1.26 KB
export function getSelectRepeatId(recurrenceModel, repeatList) {

    for (let i = 0; i < repeatList.length; i++) {
        if (repeatList[i].recurrenceModel.model === recurrenceModel.model) {
            if (recurrenceModel.model === "weekly" && recurrenceModel.weekDayList.length === repeatList[i].recurrenceModel.weekDayList.length) {
                return repeatList[i].id
            }
            return repeatList[i].id
        }
    }
    return 0
}
export function getInitialPsarticipants(participants) {
    let people = {}
    for (let i = 0; i < participants.length; i++) {
        participants[i].participator.confirmAttendance = participants[i].confirmAttendance
        people[participants[i].participator.userId] = participants[i].participator
    }
    return people

}
// 比较增减的人
export function handleChangePeople(originUsers, nowUsers) {
    let originMap = new Map()
    let nowMap = new Map()
    for (let x of originUsers) {
        originMap.set(x.userId, x)
    }
    for (let x of nowUsers) {
        nowMap.set(x.userId, x)
    }
    const add = nowUsers.filter(it => !originMap.get(it.userId))
    const del = originUsers.filter(it => !nowMap.get(it.userId))
    return {
        add: add,
        del: del
    }
}
// 保存成功以后 修改地点