Commit 473ad2f6 by fengzhaoyu

fix:重复规则

parent f070a93d
......@@ -24,6 +24,7 @@ Component({
didUnmount() { },
methods: {
comSelectList(event) {
debugger
if (this.props.multiple && event.currentTarget.dataset.item.id != -1) {
if (this.data.comSelectList.includes(-1)) {
this.setData({
......
export const repeatWeek = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
export const repeatList = [
{ id: 0, text: '不重复', icon: 'iconicon_cycle', repeatable: 0, recurrenceModel: { model: 'no_repeat' } },
{ id: 1, text: '每天', icon: '', repeatable: 1, recurrenceModel: { model: 'daily', interval: 1, initialTime: `2020-03-23`, terminateTime: `2022-03-23`, weekDayList: null } },
{ id: 2, text: '每周', icon: '', repeatable: 1, recurrenceModel: { model: 'weekly', interval: 1, initialTime: `2020-03-23`, terminateTime: `2022-03-23`, weekDayList: ['MO'] } },
{ id: 3, text: '每周的工作日', icon: '', repeatable: 1, recurrenceModel: { model: 'weekly', interval: 1, initialTime: `2020-03-23`, terminateTime: `2022-03-23`, weekDayList: ['MO', 'TU', 'WE', 'TH', 'FR'] } },
{ id: 4, text: '每月', icon: '', repeatable: 1, recurrenceModel: { model: 'absolute_Monthly', daysOfMonth: ['23'], interval: 1, initialTime: `2020-03-23`, terminateTime: `2022-03-23`, weekDayList: null } }
]
\ No newline at end of file
<view class="createMeeting ">
<button size="default" onTap="click" type="primary">Button</button>
<!-- title remark 标题 描述 -->
<view class="createTitle">
<view class="title">
......@@ -41,7 +40,7 @@
{{comListData.repeatList[comListData.comSelectListId].text}}重复
</view>
</view>
<view class="icon iconfont iconicon_repeat1 " catchTap="showPopup" data-type='repeat' a:if="{{comListData.comSelectListId == 0}}">
<view class="icon iconfont iconicon_repeat1 " catchTap="handleRepeatModal" a:if="{{comListData.comSelectListId == 0}}">
</view>
</view>
</view>
......@@ -92,8 +91,6 @@
</view>
<popup title="{{popup.title}}" show="{{popup.show}}" mask="{{popup.mask}}" onClose="closePopup">
<meeting-time-picker a:if="{{'time' === popup.type}}" onComplete="onComplete" isIPX="{{isIPX}}"></meeting-time-picker>
<hlist a:if="{{'participator' === popup.type}}" dataComList="{{comHListData.contactData}}" onSelectComHList="selectComHList"></hlist>
<list a:if="{{popup.type=='repeat'}}" dataComList="{{comType=='repeat' ? comListData.repeatList : comListData.meetingWayList}}" onComSelectList="selectComList" comSelectListId="{{comType=='repeat' ? comListData.comSelectListId : comListData.meetingWayModelId}}" iconType="{{comListData.iconType}}">
</list>
<list a:if="{{popup.type=='repeat'}}" dataComList="{{repeat.repeatList}}" onComSelectList="selectRepeatListItem"></list>
</popup>
</view>
\ No newline at end of file
import { addSchedule, updateMeetingTask, getUserScheduleInTime, getDeviceBySn } from '../../api/request.js'
import { throttle, getInterTime, getShowTime } from './../../utils/utils.js'
import { addSchedule, updateMeetingTask, getDeviceBySn } from '../../api/request.js'
import { throttle, getInterTime, getShowTime, getTwoYearToday } from './../../utils/utils.js'
import { checkFullScren } from "../../utils/checkFullScren";
import {
repeatList
} from "./constant"
import create from 'dd-store'
import pageStore from '../meetingDetail/store';
create.Page({
......@@ -17,22 +20,10 @@ create.Page({
{ id: 3, text: '每周的工作日', icon: '', repeatable: 1, recurrenceModel: { model: 'weekly', interval: 1, initialTime: `2020-03-23`, terminateTime: `2022-03-23`, weekDayList: ['MO', 'TU', 'WE', 'TH', 'FR'] } },
{ id: 4, text: '每月', icon: '', repeatable: 1, recurrenceModel: { model: 'absolute_Monthly', daysOfMonth: ['23'], interval: 1, initialTime: `2020-03-23`, terminateTime: `2022-03-23`, weekDayList: null } }
],
meetingWayList: [
// { id: 0, text: 'Webex meeting', imageUrl: '../../assests/Webex.png', meetingWayModel: { model: 'webex' } },
{ id: 0, text: '钉钉', imageUrl: '../../assests/dingding.png', meetingWayModel: { model: 'dingtalk' } },
{ id: 1, text: 'Zoom Meeting', imageUrl: '../../assests/Zoom.png', meetingWayModel: { model: 'zoom' } }
],
comSelectListId: 0,
meetingWayModelId: null,
iconType: 'icon'
},
// 传给组件 hList 水平排列 所有数据 comHListData
comHListData: {
contactData: [
{ id: 0, text: '钉钉联系人', imageUrl: '../../assests/dingContact.png' },
{ id: 1, text: '手动添加邮箱', imageUrl: '../../assests/emailContact.png' }
]
},
title: ``,
remark: '',
isShowRemark: false,
......@@ -43,19 +34,20 @@ create.Page({
type: ''
},
showTime: '',
placeholder: '',
isIPX: false,
repeat: {
repeatList: repeatList,
recurrenceModel: { model: 'no_repeat' },
repeatable: 0,
},
repeatable: 0,
recurrenceModel: { model: 'no_repeat' },
repeatWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'],
popupTitle: '会议重复',
popupShow: false,
// repeatWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'],
comType: '',
comTimeType: '',
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
week: '',
conflictPeople: [],
placeholder: '',
isIPX: false,
limitClick: false,
},
onLoad(query) {
......@@ -77,17 +69,10 @@ create.Page({
this.reset()
},
onShow() {
if (this.$store.data.participatorList.length > 1) {
this.conflictPeople()
}
setTimeout(() => {
this.update()
}, 100)
},
click() {
updateMeetingTask()
},
// 添加标题
handleChangeTitle(event) {
......@@ -122,7 +107,7 @@ create.Page({
this.update()
},
// 选择时间
// 选择时间 打开popup
handleTime() {
this.setData({
popup: {
......@@ -161,6 +146,63 @@ create.Page({
}
},
// 选择重复规则 打开popup
handleRepeatModal() {
this.setData({
popup: {
show: true,
title: "重复规则",
mask: true,
type: 'repeat'
}
})
},
// selectRepeatList
selectRepeatListItem(event) {
const item = event.currentTarget.dataset.item
const repeatModal = dealRepeatModal(item)
},
// 处理重复模型
dealRepeatModal(item) {
// 不重复
if (item.repeatable === 0) {
return {
repeatable: item.repeatable,
recurrenceModel: item.recurrenceModel
}
}
const initialTime = this.$store.data.startTime.replace(/\//g, "-").substring(0, 10)
const terminateTime = getTwoYearToday(this.$store.data.startTime)
const recurrenceModel = {
modal: item.recurrenceModel.modal,
initialTime: initialTime,
terminateTime: terminateTime
}
// 每月重复
if (item.recurrenceModel.model === "absolute_Monthly") {
recurrenceModel.interval = 1
recurrenceModel.daysOfMonth = [new Date(this.$store.data.startTime).getDate()]
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel
}
}
// 每周重复
if (item.recurrenceModel.weekDayList && item.recurrenceModel.weekDayList.length > 4) {
}
// 每周的一天重复
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel
}
},
// 关闭popup
closePopup() {
this.setData({
......@@ -204,16 +246,6 @@ create.Page({
break
}
},
// 所有的关闭操作
close(event) {
switch (event.target.dataset.close) {
case 'meetingWayModel':
this.setData({
'comListData.meetingWayModelId': null,
meetingWayModel: null
})
}
},
// 选择循环机制 选择会议方式 选择时间 出现popup弹窗
showPopup(event) {
......@@ -247,7 +279,7 @@ create.Page({
for (let value of this.data.comListData.repeatList) {
if (index) {
value.recurrenceModel.initialTime = this.$store.data.startTime.replace(/\//g, "-").substring(0, 10)
value.recurrenceModel.terminateTime = this.getTwoYearToday(this.$store.data.startTime)
value.recurrenceModel.terminateTime = getTwoYearToday(this.$store.data.startTime)
if (index === 2) {
value.recurrenceModel.weekDayList = [this.data.repeatWeek[new Date(this.$store.data.startTime).getDay()]]
} else if (index === 4) {
......@@ -302,26 +334,12 @@ create.Page({
break;
}
},
// 获取两年后的今天
getTwoYearToday(startTime) {
let date = new Date(startTime)
date.setYear(date.getFullYear() + 2)
let year = date.getFullYear();
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return year + '-' + month + '-' + day
},
// 添加参会人
handleAddParticipator: throttle(function () {
const _that = this
let require = []
let select = []
// let outLookConcat = []
// for (let participator of _that.$store.data.participatorList) {
// if (participator.platform === 'outlook') {
// outLookConcat.push(participator)
// }
// }
select = this.$store.data.participatorUserId
require = [getApp().globalData.userid]
select = _that.selectedelRequired(require, select).pickedUsers
......@@ -340,12 +358,10 @@ create.Page({
participatorList.push({ userId: item.userId, username: item.name, headUrl: item.avatar, platform: 'dingtalk' })
participatorUserId.push(item.userId)
})
participatorList = _that.setArrary(participatorList.concat(outLookConcat))
participatorUserId = [...new Set(participatorUserId)]
_that.$store.data.participatorList = participatorList
_that.$store.data.participatorUserId = participatorUserId
_that.update()
_that.conflictPeople()
},
fail: function (err) {
}
......@@ -437,34 +453,6 @@ create.Page({
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
let hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
let miunutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
return `${year}/${month}/${day} ${hour}:${miunutes}:00`
},
// 会议冲突
conflictPeople() {
let userIds = []
for (let value of this.$store.data.participatorList) {
userIds.push(value.userId)
}
let data = {
startTime: this.$store.data.startTime.replace(/\//g, "-"),
endTime: this.$store.data.endTime.replace(/\//g, "-"),
userIds: userIds
}
getUserScheduleInTime(data).then(res => {
let conflictPeople = []
for (let value in res.data.data) {
const arr = res.data.data[value].filter(function (item) {
return item.confirmAttendance === 1
})
if (arr.length > 0) {
conflictPeople.push(value)
}
}
this.setData({
conflictPeople: conflictPeople
})
})
}
});
......@@ -180,3 +180,16 @@ export function getShowTime(startTime, endTime) {
}
return `${startTime.substring(5, 7)}${startTime.substring(8, 10)}${weekList[weekIndex]} ${startTime.substring(11, 16)}-${endTime.substring(11, 16)}`
}
/*
获取两年后的今天
*/
export function getTwoYearToday(startTime) {
let date = new Date(startTime)
date.setYear(date.getFullYear() + 2)
let year = date.getFullYear();
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return year + '-' + month + '-' + day
}
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