Commit 8fd652f1 by fengzhaoyu

选人

parent e4c2b8ce
......@@ -23,7 +23,10 @@ create.Page({
// 人员增量信息 减量信息 只有在编辑的时候使用
addUserList: undefined,
deleteUserList: undefined,
originUserList: []
originUserList: [],
requireUsers: [],
requireUsersInfo: [],
organizer: ''
},
onLoad(event) {
......@@ -154,52 +157,60 @@ create.Page({
title: event.detail.value
})
},
// 创建添加参会人
// 添加参会人
addParticipants() {
const _that = this
let require = []
let select = []
if (!this.data.scheduleItem || this.data.organizer === getApp().globalData.userid) {
select = this.store.data.participatorUserId
require = [getApp().globalData.userid]
select.forEach((item, index) => {
if (item.userId == getApp().globalData.userid) {
select.splice(index, 1)
}
})
} else {
select = this.store.data.participatorUserId
require = this.data.requireUsers
console.log(require)
console.log(_that.selectedelRequired(require, select).pickedUsers)
}
dd.complexChoose({
limitTips: "超出了", //超过限定人数返回提示
title: "选择参会人", //标题
multiple: true, //是否多选
pickedUsers: _that.store.data.participatorUserId, //已选用户
requiredUsers: [], //必选用户(不可取消选中状态)
responseUserOnly: true, //返回人,或者返回人和部门
success: function (res) {
_that.store.data.participatorList = []
_that.store.data.participatrUserId = []
res.users.forEach((item, index) => {
_that.store.data.participatorList.push({ userId: item.userId, username: item.name, headUrl: item.headUrl })
_that.store.data.participatorUserId.push(item.userId)
})
_that.store.data.participatorList = _that.setArrary(_that.store.data.participatorList)
_that.store.data.participatorUserId = [...new Set(_that.store.data.participatorUserId)]
_that.update()
_that.conflict()
// _that.arrayPoor(_that.data.originUserList, _that.store.data.participatorList)
},
fail: function (err) {
}
})
},
// 编辑添加参会人
editPParticipants() {
const _that = this
dd.complexChoose({
title: "选择参会人", //标题
multiple: true, //是否多选
pickedUsers: [], //已选用户
requiredUsers: [], //必选用户(不可取消选中状态)
pickedUsers: _that.selectedelRequired(require, select).pickedUsers, //已选用户
requiredUsers: require, //必选用户(不可取消选中状态)
responseUserOnly: true, //返回人,或者返回人和部门
success: function (res) {
res.users.forEach((item, index) => {
_that.store.data.participatorList.push({ userId: item.userId, username: item.name, headUrl: item.headUrl })
_that.store.data.participatorUserId.push(item.userId)
})
if (!_that.data.scheduleItem || _that.data.organizer === getApp().globalData.userid) {
_that.store.data.participatorList = []
_that.store.data.participatorUserId = []
res.users.forEach((item, index) => {
_that.store.data.participatorList.push({ userId: item.userId, username: item.name, headUrl: item.headUrl })
_that.store.data.participatorUserId.push(item.userId)
})
_that.store.data.participatorList.push({ userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar })
_that.store.data.participatorUserId.push(getApp().globalData.userid)
} else {
_that.store.data.participatorList = []
_that.store.data.participatorUserId = []
res.users.forEach((item, index) => {
_that.store.data.participatorList.push({ userId: item.userId, username: item.name, headUrl: item.headUrl })
_that.store.data.participatorUserId.push(item.userId)
})
_that.data.requireUsersInfo.forEach((item, index) => {
_that.store.data.participatorList.push({ userId: item.userId, username: item.name, headUrl: item.headUrl })
_that.store.data.participatorUserId.push(item.userId)
})
}
_that.store.data.participatorList = _that.setArrary(_that.store.data.participatorList)
_that.store.data.participatorUserId = [...new Set(_that.store.data.participatorUserId)]
_that.update()
_that.conflict()
// _that.arrayPoor(_that.data.originUserList, _that.store.data.participatorList)
_that.arrayPoor(_that.data.originUserList, _that.store.data.participatorList)
},
fail: function (err) {
}
......@@ -378,6 +389,9 @@ create.Page({
this.store.data.remark = res.data.data.remark || ''
this.store.data.recurrenceModel = res.data.data.recurrenceModel || { model: 'no-repeat' }
this.setData({
organizer: res.data.data.organizer,
requireUsersInfo: participatorList,
requireUsers: participatorUserId,
originUserList: participatorList,
title: res.data.data.title,
time1: res.data.data.startTime.replace(/-/g, '/'),
......@@ -385,9 +399,7 @@ create.Page({
week1: this.data.weekList[new Date(res.data.data.startTime.replace(/\//g, "-")).getDay()],
week2: this.data.weekList[new Date(res.data.data.endTime.replace(/\//g, "-")).getDay()]
})
console.log(2222222)
// this.store(JSON.stringify())
console.log(2222222)
this.update()
this.conflict()
})
......
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