|
@@ -58,26 +58,8 @@ Page({
|
|
|
// 选择成员
|
|
|
userChange(e) {
|
|
|
const that = this;
|
|
|
- const memberList = that.data.memberList
|
|
|
- const index = e.detail.value;
|
|
|
- let data = that.data.userList[index];
|
|
|
- if (data) {
|
|
|
- const res = memberList.find(i => i._id == data._id)
|
|
|
- if (!res) {
|
|
|
- memberList.push(data)
|
|
|
- that.setData({ memberList, 'form.num': memberList.length.toString() })
|
|
|
- that.setData({ member: data.name })
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 删除成员
|
|
|
- async toDel(e) {
|
|
|
- const that = this;
|
|
|
- let res = e.currentTarget.dataset.item
|
|
|
- if (res) {
|
|
|
- let memberList = that.data.memberList.filter(i => i._id != res._id);
|
|
|
- that.setData({ memberList, 'form.num': memberList.length.toString() })
|
|
|
- }
|
|
|
+ const member = e.detail.value
|
|
|
+ that.setData({ memberList: member })
|
|
|
},
|
|
|
// 提交保存
|
|
|
async toSave(e) {
|
|
@@ -164,7 +146,12 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- userList = userList.filter(i => i.name)
|
|
|
+ for (const val of arr.data.user_id) {
|
|
|
+ for (const as of userList) {
|
|
|
+ if (!as.name) as.name = '暂无';
|
|
|
+ if (as._id == val) as.checked = true
|
|
|
+ }
|
|
|
+ }
|
|
|
that.setData({ userList })
|
|
|
}
|
|
|
that.setData({ form: arr.data, memberList: arr.data.user_id })
|