Commit 4acc0b2b by fengzhaoyu

fix:添加编辑任务

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