Commit 0391326d by fengzhaoyu

commit -m "整理代码"

parent 704a2838
...@@ -24,7 +24,6 @@ Component({ ...@@ -24,7 +24,6 @@ Component({
didUnmount() { }, didUnmount() { },
methods: { methods: {
comSelectList(event) { comSelectList(event) {
debugger
if (this.props.multiple && event.currentTarget.dataset.item.id != -1) { if (this.props.multiple && event.currentTarget.dataset.item.id != -1) {
if (this.data.comSelectList.includes(-1)) { if (this.data.comSelectList.includes(-1)) {
this.setData({ this.setData({
......
...@@ -36,35 +36,30 @@ ...@@ -36,35 +36,30 @@
<view class="timeText" catchTap="handleTime"> <view class="timeText" catchTap="handleTime">
{{showTime}} {{showTime}}
</view> </view>
<view class="repeatModal" a:if="{{comListData.comSelectListId !== 0}}" catchTap="showPopup" data-type='repeat'> <view class="repeatModal" a:if="{{repeat.repeatable !== 0}}" catchTap="handleRepeatModal">
{{comListData.repeatList[comListData.comSelectListId].text}}重复 {{repeat.repeatList[repeat.selectRepeatId].text}}重复
</view> </view>
</view> </view>
<view class="icon iconfont iconicon_repeat1 " catchTap="handleRepeatModal" a:if="{{comListData.comSelectListId == 0}}"> <view class="icon iconfont iconicon_repeat1 " catchTap="handleRepeatModal" a:if="{{repeat.repeatable == 0}}">
</view> </view>
</view> </view>
</view> </view>
<!-- participatorList participatorUserId 参会人 --> <!-- participatorList participatorUserId 参会人 -->
<view class="participator"> <view class="participator">
<view class="iconicon_attender iconfont icon {{$data.participatorList.length>1 ? '' : 'noValueIcon'}}"> <view class="iconicon_attender iconfont icon {{$data.showParticipatorList.length>1 ? '' : 'noValueIcon'}}">
</view> </view>
<view class="participatorContaint"> <view class="participatorContaint">
<view class="participatorText" a:if="{{$data.participatorList.length < 2}}" catchTap="handleAddParticipator" data-type='participator'> <view class="participatorText" a:if="{{$data.showParticipatorList.length < 2}}" catchTap="handleAddParticipator" data-type='participator'>
添加参会人 添加参会人
</view> </view>
<view class="participatorList" a:else> <view class="participatorList" a:else>
<view class="participatorListTop"> <view class="participatorListTop">
<view class="participatorText"> <view class="participatorText">
<view> {{$data.showParticipatorList.length}}位参会人
{{$data.participatorList.length}}位参会人
</view>
<view class="conflictStatus" a:if="{{conflictPeople.length}}">
{{conflictPeople.length}}人日程安排冲突
</view>
</view> </view>
<view class="iconright iconfont icon" style=" vertical-align: middle" catchTap="nextPage" data-nextPage="participantsDetail"></view> <view class="iconright iconfont icon" style=" vertical-align: middle" catchTap="goParticipantsDetail"></view>
</view> </view>
<view class="participatorListBottom" catchTap="nextPage" data-nextPage="participantsDetail"> <view class="participatorListBottom" catchTap="goParticipantsDetail">
<view class="people" a:for="{{$data.participatorList.length > 10 ? [...$data.participatorList].splice(0, 11) : $data.participatorList}}"> <view class="people" a:for="{{$data.participatorList.length > 10 ? [...$data.participatorList].splice(0, 11) : $data.participatorList}}">
<view class="headUrl"> <view class="headUrl">
<image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" /> <image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" />
......
import { addSchedule, updateMeetingTask, getDeviceBySn } from '../../api/request.js' import { addSchedule, updateMeetingTask, getDeviceBySn } from '../../api/request.js'
import { throttle, getInterTime, getShowTime, getTwoYearToday } from './../../utils/utils.js' import { selectPeople, modifyTimeImpactRepeat, throttle, dealRepeatModal, getInterTime, getShowTime, getTwoYearToday } from './../../utils/utils.js'
import { checkFullScren } from "../../utils/checkFullScren"; import { checkFullScren } from "../../utils/checkFullScren";
import { import { repeatList, repeatWeek } from "./constant"
repeatList
} from "./constant"
import create from 'dd-store' import create from 'dd-store'
import pageStore from '../meetingDetail/store'; import pageStore from '../meetingDetail/store';
create.Page({ create.Page({
...@@ -11,43 +9,24 @@ create.Page({ ...@@ -11,43 +9,24 @@ create.Page({
data: { data: {
$data: null, $data: null,
relatedAppPlatform: null, relatedAppPlatform: null,
// 传给组件list 的所有数据 comListData
comListData: {
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 } }
],
comSelectListId: 0,
iconType: 'icon'
},
title: ``, title: ``,
remark: '', remark: '',
isShowRemark: false, isShowRemark: false,
showTime: '',
repeat: {
repeatList: repeatList,
recurrenceModel: { model: 'no_repeat' },
repeatable: 0,
selectRepeatId: ''
},
popup: { popup: {
show: false, show: false,
title: '', title: '',
mask: '', mask: '',
type: '' type: ''
}, },
showTime: '',
placeholder: '', placeholder: '',
isIPX: false, isIPX: false,
repeat: {
repeatList: repeatList,
recurrenceModel: { model: 'no_repeat' },
repeatable: 0,
},
// repeatWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'],
comType: '',
comTimeType: '',
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
week: '',
limitClick: false, limitClick: false,
}, },
onLoad(query) { onLoad(query) {
...@@ -127,24 +106,18 @@ create.Page({ ...@@ -127,24 +106,18 @@ create.Page({
showTime: getShowTime(this.$store.data.startTime, this.$store.data.endTime) showTime: getShowTime(this.$store.data.startTime, this.$store.data.endTime)
}) })
this.closePopup() this.closePopup()
this.conflictPeople()
this.resetRepeatList()
/* /*
改时间 改掉重复规则 改时间 改掉重复规则
先选重复规则 再改时间 重复规则也要改变 先选重复规则 再改时间 重复规则也要改变
暂时修改每周 每月重复问题 暂时修改每周 每月重复问题
*/ */
if (this.data.recurrenceModel.model === 'weekly' && this.data.recurrenceModel.weekDayList.length === 1) { if (this.data.repeatable !== 0) {
this.setData({ let recurrenceModel = modifyTimeImpactRepeat(this.data.repeat.recurrenceModel)
recurrenceModel: this.data.comListData.repeatList[2].recurrenceModel
})
} else if (this.data.recurrenceModel.model === 'absolute_Monthly') {
this.setData({ this.setData({
recurrenceModel: this.data.comListData.repeatList[4].recurrenceModel 'repeat.recurrenceModel': recurrenceModel
}) })
} }
}, },
// 选择重复规则 打开popup // 选择重复规则 打开popup
...@@ -157,51 +130,19 @@ create.Page({ ...@@ -157,51 +130,19 @@ create.Page({
type: 'repeat' type: 'repeat'
} }
}) })
}, },
// selectRepeatList // 选择重复
selectRepeatListItem(event) { selectRepeatListItem(event) {
const item = event.currentTarget.dataset.item const item = event.currentTarget.dataset.item
const repeatModal = dealRepeatModal(item) const repeat = dealRepeatModal(item)
this.setData({
'repeat.repeatable': repeat.repeatable,
'repeat.recurrenceModel': repeat.recurrenceModel,
'repeat.selectRepeatId': repeat.selectRepeatId,
})
this.closePopup()
}, },
// 处理重复模型
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 // 关闭popup
closePopup() { closePopup() {
...@@ -215,181 +156,27 @@ create.Page({ ...@@ -215,181 +156,27 @@ create.Page({
}) })
}, },
// 初始化 // 添加参会人
reset() { handleAddParticipator: throttle(async function () {
this.$store.resetData() const select = Object.keys(this.$store.data.participatorList)
this.$store.data.startTime = this.getTimes() const require = [getApp().globalData.userid]
this.$store.data.endTime = this.getTimes(new Date().setMinutes(new Date().getMinutes() + 30)) selectPeople(select, require).then(res => {
this.update() let participatorList = {
this.setData({ [getApp().globalData.userid]: {
showTime: getShowTime(this.$store.data.startTime, this.$store.data.endTime) userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk'
})
this.resetRepeatList()
},
Complete(data) {
this.closePop();
},
// 跳转下一页
nextPage(event) {
switch (event.target.dataset.nextPage) {
case 'participantsDetail':
dd.navigateTo({ url: './../participantsDetail/participantsDetail' })
break
}
},
// 选择循环机制 选择会议方式 选择时间 出现popup弹窗
showPopup(event) {
let iconType = ''
let popupTitle = ''
switch (event.currentTarget.dataset.type) {
case 'meetingWayModel':
iconType = 'image'
popupTitle = '选择会议方式'
break
case 'repeat':
iconType = 'icon'
popupTitle = '会议重复'
break
case 'participator':
popupTitle = '选择参会人'
break
}
this.setData({
popupTitle: popupTitle,
popupShow: true,
comType: event.currentTarget.dataset.type,
'comListData.iconType': iconType
})
},
resetRepeatList() {
let index = 0
let repeatList = []
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 = 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) {
value.recurrenceModel.daysOfMonth = [this.$store.data.startTime.replace(/\//g, "-").substring(8, 10)]
} }
} }
repeatList.push(value) for (let i = 0; i < res.users.length; i++) {
index++ participatorList[res.users[i].userId] = { userId: res.users[i].userId, username: res.users[i].name, headUrl: res.users[i].avatar, platform: 'dingtalk' }
}
this.setData({
'comListData.repeatList': repeatList,
week: this.data.weekList[new Date(this.$store.data.startTime).getDay()]
})
},
// 选择完comList后的回调
selectComList(event) {
switch (this.data.comType) {
case 'meetingWayModel':
this.setData({
'comListData.meetingWayModelId': event.currentTarget.dataset.item.id,
popupShow: false,
meetingWayModel: this.data.comListData.meetingWayList[event.currentTarget.dataset.item.id].meetingWayModel
})
break;
case 'repeat':
this.resetRepeatList()
this.setData({
popupShow: false,
'comListData.comSelectListId': event.currentTarget.dataset.item.id,
repeatable: event.currentTarget.dataset.item.repeatable,
recurrenceModel: event.currentTarget.dataset.item.recurrenceModel
})
this.conflictPeople()
break;
}
},
// 选择完水平 HList 的回调
selectComHList(event) {
switch (event.currentTarget.dataset.item.id) {
case 0:
this.addParticipator()
this.setData({
popupShow: false
})
break;
case 1:
this.setData({
popupShow: false
})
dd.navigateTo({ url: './../outLookContact/outLookContact' })
break;
}
},
// 添加参会人
handleAddParticipator: throttle(function () {
const _that = this
let require = []
let select = []
select = this.$store.data.participatorUserId
require = [getApp().globalData.userid]
select = _that.selectedelRequired(require, select).pickedUsers
dd.complexChoose({
title: "选择参会人", //标题
multiple: true, //是否多选
pickedUsers: select, //已选用户 s
requiredUsers: require, //必选用户(不可取消选中状态)
responseUserOnly: true, //返回人,或者返回人和部门
success: function (res) {
let participatorList = []
let participatorUserId = []
participatorList.push({ userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' })
participatorUserId.push(getApp().globalData.userid)
res.users.forEach((item, index) => {
participatorList.push({ userId: item.userId, username: item.name, headUrl: item.avatar, platform: 'dingtalk' })
participatorUserId.push(item.userId)
})
participatorUserId = [...new Set(participatorUserId)]
_that.$store.data.participatorList = participatorList
_that.$store.data.participatorUserId = participatorUserId
_that.update()
},
fail: function (err) {
} }
this.$store.data.participatorList = participatorList
this.$store.data.showParticipatorList = Object.values(participatorList)
this.update()
}) })
}), }),
// 已选用户去中去掉必选用户 // 参会人详情
selectedelRequired(req, pic) { goParticipantsDetail() {
for (let i = 0; i < req.length; i++) { dd.navigateTo({ url: './../participantsDetail/participantsDetail' })
for (let m = 0; m < pic.length; m++) {
if (req[i] == pic[m]) {
pic.splice(m, 1)
m--;
}
}
}
return {
requiredUsers: req,
pickedUsers: pic
}
},
// 数组 去重
setArrary(arr) {
let containt = {}
for (let x of arr) {
containt['id' + x.userId] = x
}
return Object.values(containt)
}, },
addSchedule1: throttle(async function () { addSchedule1: throttle(async function () {
...@@ -412,9 +199,9 @@ create.Page({ ...@@ -412,9 +199,9 @@ create.Page({
meetingRoomId: this.$store.data.roomId, meetingRoomId: this.$store.data.roomId,
scheduleType: this.$store.data.roomId ? 'meeting' : 'common', scheduleType: this.$store.data.roomId ? 'meeting' : 'common',
participatorList: !!this.$store.data.participatorList.length ? this.$store.data.participatorList : [{ userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' }], participatorList: !!this.$store.data.participatorList.length ? this.$store.data.participatorList : [{ userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' }],
repeatable: this.data.repeatable, repeatable: this.data.repeat.repeatable,
remark: this.data.remark, remark: this.data.remark,
recurrenceModel: this.data.recurrenceModel, recurrenceModel: this.data.repeat.recurrenceModel,
meetingWayModel: { model: null } meetingWayModel: { model: null }
} }
const res = await addSchedule(data).catch(err => { const res = await addSchedule(data).catch(err => {
...@@ -424,7 +211,7 @@ create.Page({ ...@@ -424,7 +211,7 @@ create.Page({
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.tabBarIndex = '1'; this.$store.data.tabBarIndex = '1';
this.update(); this.update();
if (this.data.repeatable === 0) { if (this.data.repeat.repeatable === 0) {
if (this.$store.addOnceMeeting) { if (this.$store.addOnceMeeting) {
await this.$store.addOnceMeeting({ await this.$store.addOnceMeeting({
startTime: new Date(this.$store.data.startTime), startTime: new Date(this.$store.data.startTime),
...@@ -445,6 +232,18 @@ create.Page({ ...@@ -445,6 +232,18 @@ create.Page({
} }
}), }),
// 初始化
reset() {
this.$store.resetData()
this.$store.data.startTime = this.getTimes()
this.$store.data.endTime = this.getTimes(new Date().setMinutes(new Date().getMinutes() + 30))
this.update()
this.setData({
showTime: getShowTime(this.$store.data.startTime, this.$store.data.endTime)
})
},
// 获取时间参数 // 获取时间参数
getTimes(time = new Date()) { getTimes(time = new Date()) {
let date = getInterTime(new Date(time)) let date = getInterTime(new Date(time))
......
<block a:if="{{getData}}"> <!--<block a:if="{{getData}}"> -->
<block>
<view class=" {{(popupShow || show || centerPopup.showCenterPopup || conToastData.showToast || conSelectPopupData.showSelectPopup || comShareData.isShow )? 'metingDetail' : ''}}"> <view class=" {{(popupShow || show || centerPopup.showCenterPopup || conToastData.showToast || conSelectPopupData.showSelectPopup || comShareData.isShow )? 'metingDetail' : ''}}">
<import src="../../template/deleteBtn/index.axml"/> <import src="../../template/deleteBtn/index.axml"/>
<view class="hideDetail" a:if="{{isExpand}}"> <view class="hideDetail" a:if="{{isExpand}}">
...@@ -6,12 +7,7 @@ ...@@ -6,12 +7,7 @@
{{title}} {{title}}
</view> </view>
<view class="hideTime"> <view class="hideTime">
<text a:if="{{isAcrossDay}}"> {{showTime}}
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${$data.startTime.substring(11, 16)}-${$data.endTime.substring(5, 7)}月${$data.endTime.substring(8, 10)}日 ${$data.endTime.substring(11, 16)}`}}
</text>
<text a:else>
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${week} ${$data.startTime.substring(11, 16)}-${$data.endTime.substring(11, 16)}`}}
</text>
</view> </view>
<view class="hideIcon iconfont iconicon_slide" onTap="expand"> <view class="hideIcon iconfont iconicon_slide" onTap="expand">
</view> </view>
...@@ -61,12 +57,7 @@ ...@@ -61,12 +57,7 @@
<view class="timeContaint"> <view class="timeContaint">
<view> <view>
<view class="timeText" catchTap="showPopup" data-type='time'> <view class="timeText" catchTap="showPopup" data-type='time'>
<text a:if="{{isAcrossDay}}"> {{showTime}}
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${$data.startTime.substring(11, 16)}`}}-{{`${$data.endTime.substring(5, 7)}月${$data.endTime.substring(8, 10)}日 ${$data.endTime.substring(11, 16)}`}}
</text>
<text a:else>
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${week} ${$data.startTime.substring(11, 16)}-${$data.endTime.substring(11, 16)}`}}
</text>
<!-- 3月1日 周日 14:00-16:00 --> <!-- 3月1日 周日 14:00-16:00 -->
</view> </view>
<view class="repeatModal" a:if="{{comListData.comSelectListId !== 0}}" catchTap="showPopup" data-type='repeat'> <view class="repeatModal" a:if="{{comListData.comSelectListId !== 0}}" catchTap="showPopup" data-type='repeat'>
...@@ -236,7 +227,4 @@ ...@@ -236,7 +227,4 @@
</view> </view>
</view> </view>
</block> </block>
<view class="loading" a:if="{{loading || !getData}}"> <!--<view class="loading" a:if="{{loading || !getData}}"><view class="image"></view></view> -->
<view class="image"> \ No newline at end of file
</view>
</view>
\ No newline at end of file
...@@ -3,11 +3,13 @@ import { checkFullScren } from "../../utils/checkFullScren"; ...@@ -3,11 +3,13 @@ import { checkFullScren } from "../../utils/checkFullScren";
import pageStore from './store'; import pageStore from './store';
import { saveFileInfo, getMeetingRoomAffairs, createMeetingTask, deleteMeetingTask, updateMeetingTask, uploadPermissions } from '../../api/request'; import { saveFileInfo, getMeetingRoomAffairs, createMeetingTask, deleteMeetingTask, updateMeetingTask, uploadPermissions } from '../../api/request';
import { getOssPermission, getuploadResource, isParticipate, deleteSchedule, getScheduleDetail, getUserScheduleInTime, modifySchedule, getMeetingRoomRepeatAffairs, updateMoment, deleteMoment } from '../../api/request.js' import { getOssPermission, getuploadResource, isParticipate, deleteSchedule, getScheduleDetail, getUserScheduleInTime, modifySchedule, getMeetingRoomRepeatAffairs, updateMoment, deleteMoment } from '../../api/request.js'
import { throttle, getCreateShowTime } from './../../utils/utils.js' import { getShowTime, throttle, getCreateShowTime, dealRepeatModal } from './../../utils/utils.js'
import { observer } from '/utils/observer.js' import { observer } from '/utils/observer.js'
import { resolve } from 'path'; import { resolve } from 'path';
import { getFileInfo, getFileInfoFromOss } from './uploadFile.js'; import { getFileInfo, getFileInfoFromOss } from './uploadFile.js';
import { comShareData } from './const.js'; import { comShareData } from './const.js';
import { repeatList } from '../createMeeting/constant'
import { getSelectRepeatId } from './utils'
create.Page({ create.Page({
store: pageStore, store: pageStore,
useAll: true, useAll: true,
...@@ -88,15 +90,30 @@ create.Page({ ...@@ -88,15 +90,30 @@ create.Page({
centerPopupId: '' centerPopupId: ''
}, },
comShareData: comShareData, //来自const.js 只做demo展示,没有实际功能 comShareData: comShareData, //来自const.js 只做demo展示,没有实际功能
title: ``, title: ``,
remark: '',
isShowRemark: false,
showTime: '',
repeat: {
repeatList: repeatList,
recurrenceModel: { model: 'no_repeat' },
repeatable: 0,
selectRepeatId: ''
},
popup: {
show: false,
title: '',
mask: '',
type: ''
},
repeatable: 0, repeatable: 0,
recurrenceModel: { model: 'no_repeat' }, recurrenceModel: { model: 'no_repeat' },
isShowRemark: false,
repeatWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'], repeatWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'],
popupTitle: '会议重复', popupTitle: '会议重复',
popupShow: false, popupShow: false,
comType: '', comType: '',
remark: '',
comTimeType: '', comTimeType: '',
meetingWayModel: { model: null }, meetingWayModel: { model: null },
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
...@@ -223,81 +240,107 @@ create.Page({ ...@@ -223,81 +240,107 @@ create.Page({
planDate: !!this.data.scheduleItem.planDate ? this.data.scheduleItem.planDate.replace(/\//g, '-') : null planDate: !!this.data.scheduleItem.planDate ? this.data.scheduleItem.planDate.replace(/\//g, '-') : null
} }
getScheduleDetail(data).then(res => { getScheduleDetail(data).then(res => {
if (res.data.code === 0) { if (res.data.code !== 0) {
return
}
if (!res.data.data.id) { if (!res.data.data.id) {
console.log('详情接口scheduleId不存在') console.log('详情接口scheduleId不存在')
} return
let participatorList = []
let originUsers = []
let originUsersId = []
let participatorUserId = []
let repeatListMap = new Map()
for (let value of res.data.data.userList) {
if (value.participator) {
participatorList.push({ userId: value.participator.userId, username: value.participator.username, headUrl: value.participator.headUrl, platform: value.participator.platform })
participatorUserId.push(value.participator.userId)
originUsersId.push(value.participator.userId)
originUsers.push({ userId: value.participator.userId, username: value.participator.username, headUrl: value.participator.headUrl, platform: value.participator.platform })
}
}
for (let item of this.data.comListData.repeatList) {
if (item.recurrenceModel.recurrenceModel !== 'weekly') {
repeatListMap.set(item.recurrenceModel.model, item.id)
}
} }
this.setData({ this.setData({
id: res.data.data.id,
currentPeople: getApp().globalData.userid,
aheadTimes: !!res.data.data.aheadTimes ? res.data.data.aheadTimes : [],
'comListData.aheadTimesListId': !!res.data.data.aheadTimes ? res.data.data.aheadTimes : [-1],
mrReserveStatus: res.data.data.mrReserveStatus,
confirmAttendance: res.data.data.confirmAttendance === null ? -9 : res.data.data.confirmAttendance,
organizer: res.data.data.organizer,
'comListData.meetingWayModelId': res.data.data.meetingWayModel.model === null ? null : (res.data.data.meetingWayModel.model === 'dingtalk' ? 0 : 1),
repeatable: res.data.data.repeatable,
recurrenceModel: res.data.data.repeatable ? { model: res.data.data.recurrenceModel.model, daysOfMonth: res.data.data.recurrenceModel.daysOfMonth, interval: 1, initialTime: res.data.data.recurrenceModel.initialTime, terminateTime: res.data.data.recurrenceModel.terminateTime, weekDayList: res.data.data.recurrenceModel.weekDayList } : { model: 'no_repeat' },
title: res.data.data.title, title: res.data.data.title,
remark: res.data.data.remark, remark: res.data.data.remark,
isExpand: res.data.data.confirmAttendance === 1 ? true : false, isShowRemark: !!res.data.data.remark,
isShowRemark: res.data.data.remark ? true : false, showTime: getShowTime(res.data.data.startTime.replace(/-/g, "/"), res.data.data.endTime.replace(/-/g, "/")),
week: this.data.weekList[new Date(res.data.data.startTime.replace(/-/g, "/")).getDay()], repeat: {
getData: true, repeatable: res.data.data.repeatable,
scheduleItem: res.data.data, repeatList: repeatList,
meetingWayModelData: res.data.data.meetingWayModel recurrenceModel: res.data.data.repeatable ? res.data.data.recurrenceModel : { model: 'no_repeat' },
}) selectRepeatId: res.data.data.repeatable ? 0 : getSelectRepeatId(res.data.data.recurrenceModel, repeatList)
if (res.data.data.repeatable) {
this.setData({
'comListData.comSelectListId': res.data.data.recurrenceModel.model === 'weekly' ? (res.data.data.recurrenceModel.weekDayList.length > 1 ? 3 : 2) : repeatListMap.get(res.data.data.recurrenceModel.model),
})
} }
this.$store.data.originalData = res.data.data })
this.$store.data.originUsers = originUsers this.store.dats.scheduleId = res.data.data.uuid
this.$store.data.locationName = res.data.data.location.locationName
this.$store.data.roomId = res.data.data.meetingRoomId < 0 ? '' : res.data.data.meetingRoomId
this.$store.data.startTime = res.data.data.startTime.replace(/-/g, "/") this.$store.data.startTime = res.data.data.startTime.replace(/-/g, "/")
this.$store.data.endTime = res.data.data.endTime.replace(/-/g, "/") this.$store.data.endTime = res.data.data.endTime.replace(/-/g, "/")
this.$store.data.participatorList = participatorList
this.$store.data.participatorUserId = participatorUserId
this.$store.data.originUsersId = originUsersId
this.update() this.update()
this.conflictPeople()
this.store.data.scheduleId = res.data.data.id;
this.store.data.groupId = res.data.data.groupId;
this.update();
this.loadAffairList(); this.loadAffairList();
this.resetRepeatList()
if (res.data.data.meetingWayModel.model === 'zoom' && res.data.data.meetingWayModel.data === null) {
setTimeout(() => {
getScheduleDetail(data).then(success => {
this.setData({
meetingWayModelData: res.data.data.meetingWayModel
})
})
}, 30000)
}
}
}) })
// getScheduleDetail(data).then(res => {
// if (res.data.code === 0) {
// if (!res.data.data.id) {
// console.log('详情接口scheduleId不存在')
// }
// let participatorList = []
// let repeatListMap = new Map()
// for (let value of res.data.data.userList) {
// if (value.participator) {
// participatorList.push({ userId: value.participator.userId, username: value.participator.username, headUrl: value.participator.headUrl, platform: value.participator.platform })
// participatorUserId.push(value.participator.userId)
// originUsersId.push(value.participator.userId)
// originUsers.push({ userId: value.participator.userId, username: value.participator.username, headUrl: value.participator.headUrl, platform: value.participator.platform })
// }
// }
// for (let item of this.data.comListData.repeatList) {
// if (item.recurrenceModel.recurrenceModel !== 'weekly') {
// repeatListMap.set(item.recurrenceModel.model, item.id)
// }
// }
// this.setData({
// id: res.data.data.id,
// currentPeople: getApp().globalData.userid,
// aheadTimes: !!res.data.data.aheadTimes ? res.data.data.aheadTimes : [],
// 'comListData.aheadTimesListId': !!res.data.data.aheadTimes ? res.data.data.aheadTimes : [-1],
// mrReserveStatus: res.data.data.mrReserveStatus,
// confirmAttendance: res.data.data.confirmAttendance === null ? -9 : res.data.data.confirmAttendance,
// organizer: res.data.data.organizer,
// 'comListData.meetingWayModelId': res.data.data.meetingWayModel.model === null ? null : (res.data.data.meetingWayModel.model === 'dingtalk' ? 0 : 1),
// repeatable: res.data.data.repeatable,
// recurrenceModel: res.data.data.repeatable ? { model: res.data.data.recurrenceModel.model, daysOfMonth: res.data.data.recurrenceModel.daysOfMonth, interval: 1, initialTime: res.data.data.recurrenceModel.initialTime, terminateTime: res.data.data.recurrenceModel.terminateTime, weekDayList: res.data.data.recurrenceModel.weekDayList } : { model: 'no_repeat' },
// title: res.data.data.title,
// remark: res.data.data.remark,
// isExpand: res.data.data.confirmAttendance === 1 ? true : false,
// isShowRemark: res.data.data.remark ? true : false,
// week: this.data.weekList[new Date(res.data.data.startTime.replace(/-/g, "/")).getDay()],
// getData: true,
// scheduleItem: res.data.data,
// meetingWayModelData: res.data.data.meetingWayModel
// })
// if (res.data.data.repeatable) {
// this.setData({
// 'comListData.comSelectListId': res.data.data.recurrenceModel.model === 'weekly' ? (res.data.data.recurrenceModel.weekDayList.length > 1 ? 3 : 2) : repeatListMap.get(res.data.data.recurrenceModel.model),
// })
// }
// // this.$store.data.originalData = res.data.data
// // this.$store.data.originUsers = originUsers
// this.$store.data.locationName = res.data.data.location.locationName
// this.$store.data.roomId = res.data.data.meetingRoomId < 0 ? '' : res.data.data.meetingRoomId
// this.$store.data.startTime = res.data.data.startTime.replace(/-/g, "/")
// this.$store.data.endTime = res.data.data.endTime.replace(/-/g, "/")
// this.$store.data.participatorList = participatorList
// this.$store.data.participatorUserId = participatorUserId
// this.$store.data.originUsersId = originUsersId
// this.update()
// this.conflictPeople()
// this.store.data.scheduleId = res.data.data.id;
// this.store.data.groupId = res.data.data.groupId;
// this.update();
// this.loadAffairList();
// this.resetRepeatList()
// // if (res.data.data.meetingWayModel.model === 'zoom' && res.data.data.meetingWayModel.data === null) {
// // setTimeout(() => {
// // getScheduleDetail(data).then(success => {
// // this.setData({
// // meetingWayModelData: res.data.data.meetingWayModel
// // })
// // })
// // }, 30000)
// // }
// }
// })
}, },
// 添加描述 // 添加描述
addRemark() { addRemark() {
...@@ -1451,6 +1494,7 @@ create.Page({ ...@@ -1451,6 +1494,7 @@ create.Page({
this.store.data.isNeedReloadList = false; this.store.data.isNeedReloadList = false;
this.update(); this.update();
}, },
//获取单次会议动态列表 //获取单次会议动态列表
getAffairList(id) { getAffairList(id) {
......
export function getSelectRepeatId(recurrenceModel, repeatList) {
for (let i = 0; i < repeatList.length; i++) {
if (repeatList[i].recurrenceModel.model === recurrenceModel.model) {
}
}
return 0
}
\ No newline at end of file
<view class="participantsDetail"> <view class="participantsDetail">
<view class="peopleContaint"> <view class="peopleContaint">
<view class="peopleList" a:for="{{!!scheduleItem ? contactPeople : $data.participatorList}}" a:for-item="item"> <view class="peopleList" a:for="{{!!scheduleItem ? contactPeople : $data.showParticipatorList}}" a:for-item="item">
<view class="headImg"> <view class="headImg">
<image a:if="{{!!item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}"/> <image a:if="{{!!item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}"/>
<text a:else>{{item.username.substring(0, 1)}}</text> <text a:else>{{item.username.substring(0, 1)}}</text>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="addParticipants" catchTap="showPopup"> <view class="addParticipants" catchTap="addParticipator">
<text class="iconfont iconicon_add "></text> <text class="iconfont iconicon_add "></text>
<text>添加参会人</text> <text>添加参会人</text>
</view> </view>
......
import create from 'dd-store' import create from 'dd-store'
import pageStore from './store'; import pageStore from './store';
import { checkFullScren } from "../../utils/checkFullScren"; import { checkFullScren } from "../../utils/checkFullScren";
import { selectPeople, selectedelRequired } from "../../utils/utils";
import { modifySchedule, addSchedule, getUserScheduleInTime, getHomeUserSchedule } from '../../api/request.js' import { modifySchedule, addSchedule, getUserScheduleInTime, getHomeUserSchedule } from '../../api/request.js'
// 传给组件 hList 水平排列 所有数据 comHListData
const comHListData = {
contactData: [
{ id: 'dd', text: '钉钉联系人', imageUrl: '../../assests/dingContact.png' },
{ id: 'outlook', text: '手动添加邮箱', imageUrl: '../../assests/emailContact.png' }
]
}
// 传给组件 comPopup 的数据
const comPopupData = {
popupTitle: '添加参会人',
popupShow: false
}
create.Page({ create.Page({
store: pageStore, store: pageStore,
useAll: true, useAll: true,
data: { data: {
$data: null, $data: null,
scheduleItem: '', scheduleItem: '',
conflictPeople: [],
// 登陆当前账户的人 权限 // 登陆当前账户的人 权限
currentPeople: '', currentPeople: '',
comHListData: comHListData,
comPopupData: comPopupData,
isIPX: false isIPX: false
}, },
onLoad(event) { onLoad(event) {
this.reset() // this.reset()
if (event.scheduleItem) { if (event.scheduleItem) {
event.scheduleItem = decodeURIComponent(event.scheduleItem) event.scheduleItem = decodeURIComponent(event.scheduleItem)
let scheduleItem = JSON.parse(event.scheduleItem) let scheduleItem = JSON.parse(event.scheduleItem)
...@@ -52,265 +38,92 @@ create.Page({ ...@@ -52,265 +38,92 @@ create.Page({
isIPX: checkFullScren(), isIPX: checkFullScren(),
currentPeople: getApp().globalData.userid currentPeople: getApp().globalData.userid
}) })
}, },
onShow() { onShow() {
this.getParticipatorLength() this.getParticipatorLength()
this.conflictPeople()
}, },
// 添加参会人 钉钉选人 // 添加参会人 钉钉选人
addParticipator() { addParticipator() {
const _that = this
let require = [] let require = []
let select = [] let select = []
let outLookConcat = []
for (let participator of _that.$store.data.participatorList) {
if (participator.platform === 'outlook') {
outLookConcat.push(participator)
}
}
// 创建的 可选 必选 // 创建的 可选 必选
if (!_that.data.scheduleItem) { if (!this.data.scheduleItem) {
select = _that.$store.data.participatorUserId
require = [getApp().globalData.userid] require = [getApp().globalData.userid]
select = selectedelRequired(Object.keys(this.$store.data.participatorList), require)
} }
// 编辑 发起人的可选必选 // 编辑 发起人的可选必选
else if (this.$store.data.originalData.organizer === getApp().globalData.userid) { else if (this.$store.data.originalData.organizer === getApp().globalData.userid) {
select = _that.store.data.contactPeopleId select = this.store.data.contactPeopleId
require = [getApp().globalData.userid] require = [getApp().globalData.userid]
} }
// 编辑 参会人可选必选 // 编辑 参会人可选必选
else { else {
select = _that.store.data.contactPeopleId select = this.store.data.contactPeopleId
require = [...this.$store.data.originUsersId] require = [...this.$store.data.originUsersId]
} }
select = _that.selectedelRequired([...require], [...select]).pickedUsers selectPeople(select, require).then(res => {
const participatorList = {}
dd.complexChoose({ if (!this.data.scheduleItem) {
title: "选择参会人", //标题 participatorList[getApp().globalData.userid] = {
multiple: true, //是否多选 userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk'
pickedUsers: select, //已选用户
requiredUsers: require, //必选用户(不可取消选中状态)
responseUserOnly: true, //返回人,或者返回人和部门
success: function (res) {
let people = []
let peopleId = []
if (!_that.data.scheduleItem || _that.$store.data.originalData.organizer === getApp().globalData.userid) {
people.push({ userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' })
res.users.forEach((item, index) => {
people.push({ userId: item.userId, username: item.name, headUrl: item.avatar, platform: 'dingtalk' })
})
} else {
_that.$store.data.originUsers.forEach((item, index) => {
people.push(item)
})
res.users.forEach((item, index) => {
people.push({ userId: item.userId, username: item.name, headUrl: item.avatar, platform: 'dingtalk' })
})
} }
people = _that.setArrary(people.concat(outLookConcat)) for (let i = 0; i < res.users.length; i++) {
for (let value of people) { participatorList[res.users[i].userId] = { userId: res.users[i].userId, username: res.users[i].name, headUrl: res.users[i].avatar, platform: 'dingtalk' }
peopleId.push(value.userId)
} }
people = _that.setArrary(people.concat(outLookConcat)) this.$store.data.participatorList = participatorList
this.$store.data.showParticipatorList = Object.values(participatorList)
// 创建 this.update()
if (!_that.data.scheduleItem) {
_that.$store.data.participatorList = people
_that.$store.data.participatorUserId = peopleId
_that.update()
} else {
_that.store.data.contactPeople = people
_that.store.data.contactPeopleId = peopleId
_that.update()
}
},
fail: function (err) {
} }
}) })
}, },
// 删除参会人 // 删除参会人
delParticipants(event) { delParticipants(event) {
let userId = event.target.dataset.userId let userId = event.target.dataset.userId
let userIdList = [] const participatorList = { ...this.$store.data.participatorList }
let userList = [] const showParticipatorList = [...this.$store.data.showParticipatorList]
delete participatorList[userId]
if (!!this.data.scheduleItem) { for (let i = 0; i < showParticipatorList.length; i++) {
userList = this.store.data.contactPeople if (showParticipatorList[i].userId === userId) {
userIdList = this.store.data.contactPeopleId showParticipatorList.splice(i, 1)
} else {
userList = this.$store.data.participatorList
userIdList = this.$store.data.participatorUserId
} }
userList.forEach((item, index) => {
if (userId === item.userId) {
let people = [...userList]
people.splice(index, 1)
if (!!this.data.scheduleItem) {
this.store.data.contactPeople = people
} else {
this.$store.data.participatorList = people
} }
this.$store.data.participatorList = participatorList
this.$store.data.showParticipatorList = showParticipatorList
this.update() this.update()
return
}
})
userIdList.forEach((item, index) => {
if (userId === item) {
let peopleId = [...userIdList]
peopleId.splice(index, 1)
if (!!this.data.scheduleItem) {
this.store.data.contactPeopleId = peopleId
} else {
this.$store.data.participatorUserId = peopleId
}
this.update()
return
}
})
this.getParticipatorLength() this.getParticipatorLength()
this.conflictPeople()
},
// 编辑时候的保存
editSave() {
if (JSON.stringify(this.$store.data.originUsers) != JSON.stringify(this.store.data.contactPeople)) {
this.$store.data.updateInfo.isUpate = true
this.$store.data.updateInfo.updateType = 'operate_user'
this.$store.data.participatorList = this.store.data.contactPeople
this.$store.data.participatorUserId = this.store.data.contactPeopleId
this.update()
}
dd.navigateBack({
delta: 1
})
}, },
// // 编辑时候的保存
// editSave() {
// if (JSON.stringify(this.$store.data.originUsers) != JSON.stringify(this.store.data.contactPeople)) {
// this.$store.data.updateInfo.isUpate = true
// this.$store.data.updateInfo.updateType = 'operate_user'
// this.$store.data.participatorList = this.store.data.contactPeople
// this.$store.data.participatorUserId = this.store.data.contactPeopleId
// this.update()
// }
// dd.navigateBack({
// delta: 1
// })
// },
// 保存信息 // // 保存信息
saveInfo() { // saveInfo() {
this.editSave() // this.editSave()
}, // },
// 获取参会人长度 // 获取参会人长度
getParticipatorLength() { getParticipatorLength() {
const length = !!this.data.scheduleItem ? this.store.data.contactPeople.length : this.$store.data.participatorList.length const length = this.$store.data.showParticipatorList.length
dd.setNavigationBar({ dd.setNavigationBar({
title: `参会人(${length}人)` title: `参会人(${length}人)`
}) })
}, },
// 重置参会人 // 重置参会人
reset() { // reset() {
this.store.data.contactPeople = [] // this.store.data.contactPeople = []
this.store.data.contactPeopleId = [] // this.store.data.contactPeopleId = []
this.update() // this.update()
}, // },
// 展示弹窗
showPopup() {
this.setData({
'comPopupData.popupShow': true
})
},
// 隐藏弹窗
closePopup() {
this.setData({
'comPopupData.popupShow': false
})
},
// 选择添加人员的方式
selectComHList(event) {
switch (event.currentTarget.dataset.item.id) {
// 选择dd加人
case "dd":
this.setData({
'comPopupData.popupShow': false
})
this.addParticipator()
break;
// 选择通过outlook添加邮箱联系人
case "outlook":
this.setData({
'comPopupData.popupShow': false
})
dd.navigateTo({ url: `./../outLookContact/outLookContact?scheduleItem=${encodeURIComponent(JSON.stringify(this.data.scheduleItem))}&toPage=participantsDetail` })
break;
}
},
// 选择弹窗
onSelectPopup(event) {
this.setData({
'conSelectPopupData.showSelectPopup': false,
'conSelectPopupData.selectPopupId': event.currentTarget.dataset.item.id,
'centerPopup.showCenterPopup': true
})
},
// 数组去重
setArrary(arr, userId) {
console.log(arr)
let containt = {}
for (let x of arr) {
containt['id' + x.userId] = x
}
return Object.values(containt)
},
// 会议冲突
conflictPeople() {
let users = []
let userIds = []
if (!!this.data.scheduleItem) {
users = this.store.data.contactPeople
} else {
users = this.$store.data.participatorList
}
for (let item of users) {
userIds.push(item.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) {
if (!!this.data.scheduleItem) {
const arr = res.data.data[value].filter(function (item) {
return item.confirmAttendance === 1
})
if (arr.length > 1) {
conflictPeople.push(value)
}
} else {
const arr = res.data.data[value].filter(function (item) {
return item.confirmAttendance === 1
})
if (arr.length > 0) {
conflictPeople.push(value)
}
}
}
this.setData({
conflictPeople: conflictPeople
})
})
},
// 已选用户去中去掉必选用户
selectedelRequired([...req], [...pic]) {
for (let i = 0; i < req.length; i++) {
for (let m = 0; m < pic.length; m++) {
if (req[i] == pic[m]) {
pic.splice(m, 1)
m--;
}
}
}
return {
requiredUsers: req,
pickedUsers: pic
}
}
}); });
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
class Store { class Store {
data = { data = {
locationName: '', locationName: '',
participatorList: [], participatorList: {},
participatorUserId: [], // 参会人的userId showParticipatorList: [],
roomId: '', roomId: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
...@@ -22,21 +22,20 @@ class Store { ...@@ -22,21 +22,20 @@ class Store {
} }
resetData() { resetData() {
this.data.roomId = '' this.data.roomId = ''
this.data.participatorList = [] this.data.participatorList = {}
this.data.participatorUserId = [] this.data.showParticipatorList = []
this.data.originUsers = [] // this.data.originUsers = []
this.data.originUsersId = [] // this.data.originUsersId = []
this.data.locationName = '' this.data.locationName = ''
this.data.onceMeetingContent = null this.data.onceMeetingContent = null
this.update(); this.update();
} }
resetEditData() { resetEditData() {
this.data.roomId = '' this.data.roomId = ''
this.data.participatorList = [] // this.data.originUsers = []
this.data.originUsers = [] // this.data.originUsersId = []
this.data.originUsersId = [] this.data.participatorList = {}
this.data.participatorList = [] this.data.showParticipatorList = []
this.data.participatorUserId = []
this.data.locationName = '' this.data.locationName = ''
this.data.updateInfo = { this.data.updateInfo = {
updateType: '', updateType: '',
......
import globalStore from "../stores/exampleStore"
import { resolve } from "path";
//防止多次重复点击 (函数节流) //防止多次重复点击 (函数节流)
export function throttle(fn, gapTime) { export function throttle(fn, gapTime) {
if (gapTime == null || gapTime == undefined) { if (gapTime == null || gapTime == undefined) {
...@@ -172,6 +174,7 @@ endTime 结束时间 ...@@ -172,6 +174,7 @@ endTime 结束时间
*/ */
export function getShowTime(startTime, endTime) { export function getShowTime(startTime, endTime) {
debugger
const weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] const weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
const weekIndex = new Date(startTime).getDay() const weekIndex = new Date(startTime).getDay()
let isAcrossDay = false let isAcrossDay = false
...@@ -196,3 +199,102 @@ export function getTwoYearToday(startTime) { ...@@ -196,3 +199,102 @@ export function getTwoYearToday(startTime) {
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return year + '-' + month + '-' + day return year + '-' + month + '-' + day
} }
// 处理重复模型
export function dealRepeatModal(item) {
const repeatWeek = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
// 不重复
if (item.repeatable === 0) {
return {
repeatable: item.repeatable,
recurrenceModel: item.recurrenceModel
}
}
const initialTime = globalStore.data.startTime.replace(/\//g, "-").substring(0, 10)
const terminateTime = getTwoYearToday(globalStore.data.startTime)
const recurrenceModel = {
model: item.recurrenceModel.model,
initialTime: initialTime,
terminateTime: terminateTime,
interval: 1
}
// 每天重复
if (item.recurrenceModel.model === "daily") {
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 每月重复
if (item.recurrenceModel.model === "absolute_Monthly") {
recurrenceModel.daysOfMonth = [new Date(globalStore.data.startTime).getDate()]
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 每周重复
if (item.recurrenceModel.weekDayList && item.recurrenceModel.weekDayList.length > 4) {
recurrenceModel.weekDayList = item.recurrenceModel.weekDayList
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 每周的一天重复
recurrenceModel.weekDayList = repeatWeek[new Date(globalStore.data.startTime).getDay()]
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 修改时间修改重复模型
export function modifyTimeImpactRepeat(recurrenceModel) {
const repeatWeek = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
const initialTime = globalStore.data.startTime.replace(/\//g, "-").substring(0, 10)
const terminateTime = getTwoYearToday(globalStore.data.startTime)
recurrenceModel.initialTime = initialTime
recurrenceModel.terminateTime = terminateTime
if (recurrenceModel.model === 'weekly' && recurrenceModel.weekDayList.length === 1) {
recurrenceModel.weekDayList = repeatWeek[new Date(globalStore.data.startTime).getDay()]
}
if (recurrenceModel.model === 'absolute_Monthly') {
recurrenceModel.daysOfMonth = [new Date(globalStore.data.startTime).getDate()]
}
return recurrenceModel
}
// 添加参会人
export function selectPeople(select, require) {
const _that = this
return new Promise((resolve) => {
dd.complexChoose({
title: "选择参会人", //标题
multiple: true, //是否多选
pickedUsers: select, //已选用户 s
requiredUsers: require, //必选用户(不可取消选中状态)
responseUserOnly: true, //返回人,或者返回人和部门
success: function (res) {
resolve(res)
},
fail: function (err) {
}
})
})
}
// 可选中去掉必选人
export function selectedelRequired(select, require) {
return select.filter(it => {
return !require.includes(it.userId)
})
}
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