Commit 4acc0b2b by fengzhaoyu

fix:添加编辑任务

parent c889abea
......@@ -3,6 +3,7 @@ import pageStore from '../meetingDetail/store';
import { debounce, getCreateShowTime } from '../../utils/utils';
import { checkFullScren } from "../../utils/checkFullScren";
import { updateMeetingTask } from '../../api/request';
import { fixSeperateIndex } from "../meetingDetail/meetingDetail"
create.Page({
store: pageStore,
......@@ -84,37 +85,61 @@ create.Page({
title: task.title,
innerTaskExecutorList: excutor
}
const data = {
meetingId: this.data.meetingId,
platform: 'dingTalk',
}
if (this.data.type === 'edit') {
delete taskCreateModel.innerTaskExecutorList;
taskCreateModel.taskId = task.taskId
taskCreateModel.commentId = task.commentId
if (excutor) {
if (task.originExcutorId !== excutor[0].id) {
taskCreateModel.userList = excutor;
}
if (task.originExcutorId) {
taskCreateModel.removeUserList = [originExcutor]
taskCreateModel.removeUserList = [task.originExcutor]
}
} else {
if (task.originExcutorId) {
taskCreateModel.removeUserList = [originExcutor]
taskCreateModel.removeUserList = [task.originExcutor]
}
}
data.taskModifyModel = taskCreateModel
} else {
data.taskCreateModel = taskCreateModel
}
updateMeetingTask({
meetingId: this.data.meetingId,
platform: 'dingTalk',
taskCreateModel
}).then(res => {
updateMeetingTask(data).then(res => {
if (res.data.code == 0) {
//重置
this.store.data.currentTask = {};
this.update();
// const addData = res.data.data[0].commentListDataModelList[0];
// addData.updateTime = getCreateShowTime(addData.updateTime);
if (this.data.type === 'edit') {
// 修改动态列表
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)
this.store.data.affairList.splice(affairListIndex, 1)
this.store.data.tasks.splice(tasksIndex, 1)
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 (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.update();
}
} else {
......@@ -125,13 +150,15 @@ create.Page({
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.update();
dd.navigateBack();
}
}
dd.navigateBack();
}
......
......@@ -1049,7 +1049,7 @@ create.Page({
dd.navigateTo({ url: '/pages/createTask/createTask?meetingId=' + this.store.data.scheduleId })
},
editTask(e) {
const { task } = e.currentTarget.dataset;
const { task, commentId } = e.currentTarget.dataset;
console.log(task)
const executor = (task.executor && task.executor.length > 0) ? task.executor[0] : {}
this.store.data.currentTask = {
......@@ -1058,7 +1058,9 @@ create.Page({
originExcutor: executor,
originExcutorId: executor.userId,
title: task.title,
excutorId: executor.userId
excutorId: executor.userId,
taskId: task.taskId,
commentId: commentId
};
this.store.data.modifyDynamicId = '';
this.update();
......@@ -1362,6 +1364,9 @@ create.Page({
}
this.store.data.modifyDynamicId = ''
this.update()
},
blank() {
debugger
}
});
......
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