1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
import { addSchedule, updateMeetingTask, getDeviceBySn } from '../../api/request.js'
import { selectPeople, modifyTimeImpactRepeat, throttle, dealRepeatModal, getInterTime, getShowTime, getTwoYearToday } from './../../utils/utils.js'
import { checkFullScren } from "../../utils/checkFullScren";
import { repeatList, repeatWeek, aheadTimeList } from "./constant"
import create from 'dd-store'
import pageStore from '../meetingDetail/store';
create.Page({
store: pageStore,
data: {
$data: null,
relatedAppPlatform: null,
title: ``,
meetingRemark: '',
isShowRemark: false,
showTime: '',
repeat: {
repeatList: repeatList,
recurrenceModel: { model: 'no_repeat' },
repeatable: 0,
selectRepeatId: ''
},
popup: {
show: false,
title: '',
mask: '',
type: ''
},
placeholder: '',
isIPX: false,
limitClick: false,
aheadTime: {
aheadTimeList: aheadTimeList,
aheadTimes: [15],
iconType: 'icon',
aheadTimesListId: [15],
},
},
onLoad(query) {
if (query && query.sn) {
getDeviceBySn(query.sn).then(res => {
if (res.data.code === 0) {
this.$store.data.locationName = res.data.data.meetingRooomFullName
this.$store.data.roomId = res.data.data.meetingRoomId
}
})
}
dd.setNavigationBar({
title: `创建会议`
})
this.setData({
isIPX: checkFullScren(),
placeholder: `${getApp().globalData.name}创建的会议`
})
this.reset(query)
},
onShow() {
if (this.$store.data.shouldUpdateShowTime) {
this.setData({
showTime: getShowTime(this.$store.data.startTime, this.$store.data.endTime)
})
this.$store.data.shouldUpdateShowTime = false;
this.update();
}
setTimeout(() => {
this.update()
}, 100)
},
// 添加标题
handleChangeTitle(event) {
this.setData({
title: event.detail.value
})
},
// 打开添加描述
handleOpenRemark() {
this.setData({
isShowRemark: true
})
},
// 添加描述
handleChangeRemark(event) {
this.setData({
meetingRemark: event.detail.value
})
},
// 跳转选择地点
goSelectPlace() {
dd.navigateTo({ url: './../place/place' })
},
// 删除地点
handleDeletePlace() {
this.$store.data.locationName = ''
this.$store.data.roomId = ''
this.update()
},
// 选择时间 打开popup
handleTime() {
this.setData({
popup: {
show: true,
title: "选择会议时间",
mask: true,
type: 'time'
}
})
},
// 选择时间点击完成
onComplete(event) {
this.$store.data.startTime = `${event.startTime}:00`
this.$store.data.endTime = `${event.endTime}:00`
this.update()
this.setData({
showTime: getShowTime(this.$store.data.startTime, this.$store.data.endTime)
})
this.closePopup()
/*
改时间 改掉重复规则
先选重复规则 再改时间 重复规则也要改变
暂时修改每周 每月重复问题
*/
if (this.data.repeatable !== 0) {
let recurrenceModel = modifyTimeImpactRepeat(this.data.repeat.recurrenceModel)
this.setData({
'repeat.recurrenceModel': recurrenceModel
})
}
},
// 选择重复规则 打开popup
handleRepeatModal() {
this.setData({
popup: {
show: true,
title: "重复规则",
mask: true,
type: 'repeat'
}
})
},
// 选择重复
selectRepeatListItem(event) {
const item = event.currentTarget.dataset.item
const repeat = dealRepeatModal(item)
this.setData({
'repeat.repeatable': repeat.repeatable,
'repeat.recurrenceModel': repeat.recurrenceModel,
'repeat.selectRepeatId': repeat.selectRepeatId,
})
this.closePopup()
},
// 保存重复
handleSaveRepeat() {
},
// 选择会前提醒
handleSelectAheadTime() {
this.setData({
popup: {
show: true,
title: "会前提醒",
mask: true,
type: 'aheadTime'
}
})
},
// 会前提醒点击完成
handleAheadTimeSave(event) {
this.closePopup()
this.setData({
'aheadTime.aheadTimes': event,
'aheadTime.aheadTimesListId': event,
})
},
// 关闭popup
closePopup() {
this.setData({
popup: {
show: false,
title: "",
mask: true,
type: ''
}
})
},
// 添加参会人
handleAddParticipator: throttle(async function () {
const select = Object.keys(this.$store.data.participatorList)
const require = [getApp().globalData.userid]
selectPeople(select, require).then(res => {
let participatorList = {
[getApp().globalData.userid]: {
userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk'
}
}
for (let i = 0; i < res.users.length; i++) {
participatorList[res.users[i].userId] = { userId: res.users[i].userId, username: res.users[i].name, headUrl: res.users[i].avatar, platform: 'dingtalk' }
}
this.$store.data.participatorList = participatorList
this.$store.data.showParticipatorList = Object.values(participatorList)
this.update()
})
}),
// 参会人详情
goParticipantsDetail() {
dd.navigateTo({ url: './../participantsDetail/participantsDetail' })
},
addSchedule1: throttle(async function () {
if (this.data.limitClick) {
return
}
this.setData({ limitClick: true });
dd.showLoading({
content: '正在创建...',
});
let data = {
title: this.data.title || `${getApp().globalData.name}创建的会议`,
location: {
longitude: '10',
latitude: '10',
meetingRoomName: this.$store.data.locationName
},
startTime: this.$store.data.startTime.replace(/\//g, "-"),
endTime: this.$store.data.endTime.replace(/\//g, "-"),
meetingRoomId: this.$store.data.roomId,
scheduleType: this.$store.data.roomId ? 'meeting' : 'common',
participatorList: !!this.$store.data.showParticipatorList.length ? this.$store.data.showParticipatorList : [{ userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' }],
repeatable: this.data.repeat.repeatable,
remark: this.data.meetingRemark,
recurrenceModel: this.data.repeat.recurrenceModel,
meetingWayModel: { model: null },
aheadTimes: this.data.aheadTime.aheadTimesListId
}
const res = await addSchedule(data).catch(err => {
this.setData({ limitClick: false });
dd.hideLoading();
});
if (res.data.code === 0) {
this.$store.data.tabBarIndex = '1';
this.update();
if (this.data.repeat.repeatable === 0) {
if (this.$store.addOnceMeeting) {
await this.$store.addOnceMeeting({
startTime: new Date(this.$store.data.startTime),
endTime: new Date(this.$store.data.endTime),
confirmAttendance: res.data.data.confirmAttendance,
title: res.data.data.title,
id: res.data.data.id
})
}
} else {
if (this.$store.modifyErpeatMeeting) {
await this.$store.modifyErpeatMeeting()
}
}
this.setData({ limitClick: false });
dd.hideLoading();
dd.navigateBack()
}
}),
// 初始化
reset(query) {
if (query && query.type == 'copy') {
this.$store.resetCopyData()
} else {
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()) {
let date = getInterTime(new Date(time))
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()
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`
},
});