Commit 8d1b4217 by xiexiaoqin

fix:修改任务先询问通不通知再调接口

parent eb7ab39f
......@@ -70,6 +70,14 @@ create.Page({
this.update();
this.closePopup();
},
updateTasks(data, callBack) {
updateMeetingTask(data).then(res => {
if (res.data.code == 0) {
callBack(res.data)
}
this.setData({ limitClick: false });
})
},
addTask() {
const task = this.store.data.currentTask;
......@@ -108,86 +116,81 @@ create.Page({
taskCreateModel.removeUserList = [task.originExcutor]
}
}
data.taskModifyModel = taskCreateModel
} else {
data.taskCreateModel = taskCreateModel
}
updateMeetingTask(data).then(res => {
if (res.data.code == 0) {
if (this.data.type === 'edit') {
//是否发送通知
dd.confirm({
title: '通知',
content: '是否更新动态列表通知其他成员?',
confirmButtonText: '通知',
cancelButtonText: '不通知',
success: (ret) => {
if (ret.confirm) {
if (res.data.data) {
const affairListIndex = this.store.data.affairList.findIndex(it => it.commentId === data.taskModifyModel.commentId)
const tasksIndex = this.store.data.tasks.findIndex(it => it.commentId === data.taskModifyModel.commentId)
const deleteData = this.store.data.affairList.splice(affairListIndex, 1);
this.store.data.tasks.splice(tasksIndex, 1)
const addData = res.data.data[0].commentListDataModelList[0];
addData.replyCommentList = deleteData[0].replyCommentList;
addData.updateTime = getCreateShowTime(addData.updateTime);
this.store.data.affairList.unshift(addData);
this.store.data.tasks.unshift(addData);
this.store.data.isNeedReloadIndexList = true;
if (affairListIndex > this.store.data.separateIndex && this.store.data.separateIndex !== -1) {
this.store.data.separateIndex += 1;
this.store.data.separateIndex = fixSeperateIndex(this.store.data.separateIndex, this.store.data.affairList)
}
//重置
this.store.data.currentTask = {};
this.update();
dd.navigateBack();
data.taskModifyModel = taskCreateModel;
//是否发送通知
dd.confirm({
title: '通知',
content: '是否更新动态列表通知其他成员?',
confirmButtonText: '通知',
cancelButtonText: '不通知',
success: (ret) => {
if (ret.confirm) {
data.notice = true;
this.updateTasks(data, (res) => {
if (res.data) {
const affairListIndex = this.store.data.affairList.findIndex(it => it.commentId === data.taskModifyModel.commentId)
const tasksIndex = this.store.data.tasks.findIndex(it => it.commentId === data.taskModifyModel.commentId)
const deleteData = this.store.data.affairList.splice(affairListIndex, 1);
this.store.data.tasks.splice(tasksIndex, 1)
const addData = res.data[0].commentListDataModelList[0];
addData.replyCommentList = deleteData[0].replyCommentList;
addData.updateTime = getCreateShowTime(addData.updateTime);
this.store.data.affairList.unshift(addData);
this.store.data.tasks.unshift(addData);
this.store.data.isNeedReloadIndexList = true;
if (affairListIndex > this.store.data.separateIndex && this.store.data.separateIndex !== -1) {
this.store.data.separateIndex += 1;
this.store.data.separateIndex = fixSeperateIndex(this.store.data.separateIndex, this.store.data.affairList)
}
} else {
const updateAffair = this.store.data.affairList.find(it => it.commentId === data.taskModifyModel.commentId);
const updateTask = this.store.data.tasks.find(it => it.commentId === data.taskModifyModel.commentId);
updateAffair.meetingTaskSimpleViewModel.title = updateTask.title = taskCreateModel.title;
updateAffair.meetingTaskSimpleViewModel.endTime = updateTask.endTime = taskCreateModel.endTime;
updateAffair.meetingTaskSimpleViewModel.executor = updateTask.excutor = excutor;
//重置
this.store.data.currentTask = {};
this.update();
dd.navigateBack();
dd.navigateBack();
}
}
})
})
} else {
data.notice = false;
this.updateTasks(data, (res) => {
const updateAffair = this.store.data.affairList.find(it => it.commentId === data.taskModifyModel.commentId);
const updateTask = this.store.data.tasks.find(it => it.commentId === data.taskModifyModel.commentId);
updateAffair.meetingTaskSimpleViewModel.title = updateTask.title = taskCreateModel.title;
updateAffair.meetingTaskSimpleViewModel.endTime = updateTask.endTime = taskCreateModel.endTime;
updateAffair.meetingTaskSimpleViewModel.executor = updateTask.excutor = excutor;
this.update();
dd.navigateBack();
})
} else {
// 修改动态列表
if (res.data.data) {
const addData = res.data.data[0].commentListDataModelList[0];
addData.updateTime = getCreateShowTime(addData.updateTime);
this.store.data.affairList.unshift(addData);
this.store.data.tasks.unshift(addData);
this.store.data.isNeedReloadIndexList = true;
if (this.store.data.separateIndex !== -1) {
this.store.data.separateIndex += 1;
}
this.store.data.currentTask = {};
this.update();
dd.navigateBack();
}
}
})
} else {
data.taskCreateModel = taskCreateModel
this.updateTask(data, (res) => {
// 修改动态列表
if (res.data) {
const addData = res.data[0].commentListDataModelList[0];
addData.updateTime = getCreateShowTime(addData.updateTime);
this.store.data.affairList.unshift(addData);
this.store.data.tasks.unshift(addData);
this.store.data.isNeedReloadIndexList = true;
if (this.store.data.separateIndex !== -1) {
this.store.data.separateIndex += 1;
}
this.store.data.currentTask = {};
this.update();
dd.navigateBack();
}
this.setData({ limitClick: false });
})
}
})
}
}
});
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