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,15 +116,7 @@ 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') {
data.taskModifyModel = taskCreateModel;
//是否发送通知
dd.confirm({
title: '通知',
......@@ -125,13 +125,15 @@ create.Page({
cancelButtonText: '不通知',
success: (ret) => {
if (ret.confirm) {
if (res.data.data) {
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.data[0].commentListDataModelList[0];
const addData = res.data[0].commentListDataModelList[0];
addData.replyCommentList = deleteData[0].replyCommentList;
addData.updateTime = getCreateShowTime(addData.updateTime);
this.store.data.affairList.unshift(addData);
......@@ -148,10 +150,12 @@ create.Page({
this.update();
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;
......@@ -160,15 +164,19 @@ create.Page({
this.update();
dd.navigateBack();
})
}
}
})
} else {
data.taskCreateModel = taskCreateModel
this.updateTask(data, (res) => {
// 修改动态列表
if (res.data.data) {
const addData = res.data.data[0].commentListDataModelList[0];
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);
......@@ -182,12 +190,7 @@ create.Page({
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