mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 04:32:49 +00:00
no message
This commit is contained in:
parent
8462e9c097
commit
173631f115
34
resources/assets/js/store/actions.js
vendored
34
resources/assets/js/store/actions.js
vendored
@ -1655,11 +1655,12 @@ export default {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存任务数据
|
* 保存任务数据
|
||||||
|
* @param commit
|
||||||
* @param state
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
saveTask({state, dispatch}, data) {
|
saveTask({commit, state, dispatch}, data) {
|
||||||
$A.execMainDispatch("saveTask", data)
|
$A.execMainDispatch("saveTask", data)
|
||||||
//
|
//
|
||||||
if ($A.isArray(data)) {
|
if ($A.isArray(data)) {
|
||||||
@ -1689,9 +1690,9 @@ export default {
|
|||||||
//
|
//
|
||||||
const index = state.cacheTasks.findIndex(({id}) => id == data.id);
|
const index = state.cacheTasks.findIndex(({id}) => id == data.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.cacheTasks.splice(index, 1, Object.assign({}, state.cacheTasks[index], data));
|
commit("CACHE_TASKS_SPLICE", {index, data: Object.assign({}, state.cacheTasks[index], data)});
|
||||||
} else {
|
} else {
|
||||||
state.cacheTasks.push(data);
|
commit("CACHE_TASKS_PUSH", data);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (updateMarking.is_update_maintask === true || (data.parent_id > 0 && state.cacheTasks.findIndex(({id}) => id == data.parent_id) === -1)) {
|
if (updateMarking.is_update_maintask === true || (data.parent_id > 0 && state.cacheTasks.findIndex(({id}) => id == data.parent_id) === -1)) {
|
||||||
@ -1721,18 +1722,17 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//
|
|
||||||
$A.IDBSave("cacheTasks", state.cacheTasks);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 忘记任务数据
|
* 忘记任务数据
|
||||||
|
* @param commit
|
||||||
* @param state
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param task_id
|
* @param task_id
|
||||||
*/
|
*/
|
||||||
forgetTask({state, dispatch}, task_id) {
|
forgetTask({commit, state, dispatch}, task_id) {
|
||||||
$A.execMainDispatch("forgetTask", task_id)
|
$A.execMainDispatch("forgetTask", task_id)
|
||||||
//
|
//
|
||||||
const ids = ($A.isArray(task_id) ? task_id : [task_id]).filter(id => id != state.taskArchiveView);
|
const ids = ($A.isArray(task_id) ? task_id : [task_id]).filter(id => id != state.taskArchiveView);
|
||||||
@ -1745,13 +1745,13 @@ export default {
|
|||||||
parent_ids.push(state.cacheTasks[index].parent_id)
|
parent_ids.push(state.cacheTasks[index].parent_id)
|
||||||
}
|
}
|
||||||
project_ids.push(state.cacheTasks[index].project_id)
|
project_ids.push(state.cacheTasks[index].project_id)
|
||||||
state.cacheTasks.splice(index, 1);
|
commit("CACHE_TASKS_SPLICE", {index})
|
||||||
}
|
}
|
||||||
state.cacheTasks.filter(task => task.parent_id == id).some(childTask => {
|
state.cacheTasks.filter(task => task.parent_id == id).some(childTask => {
|
||||||
let cIndex = state.cacheTasks.findIndex(task => task.id == childTask.id);
|
let cIndex = state.cacheTasks.findIndex(task => task.id == childTask.id);
|
||||||
if (cIndex > -1) {
|
if (cIndex > -1) {
|
||||||
project_ids.push(childTask.project_id)
|
project_ids.push(childTask.project_id)
|
||||||
state.cacheTasks.splice(cIndex, 1);
|
commit("CACHE_TASKS_SPLICE", {index: cIndex})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -1761,8 +1761,6 @@ export default {
|
|||||||
if (ids.includes(state.taskId)) {
|
if (ids.includes(state.taskId)) {
|
||||||
state.taskId = 0;
|
state.taskId = 0;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
$A.IDBSave("cacheTasks", state.cacheTasks);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2631,11 +2629,12 @@ export default {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新会话数据
|
* 更新会话数据
|
||||||
|
* @param commit
|
||||||
* @param state
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
saveDialog({state, dispatch}, data) {
|
saveDialog({commit, state, dispatch}, data) {
|
||||||
$A.execMainDispatch("saveDialog", data)
|
$A.execMainDispatch("saveDialog", data)
|
||||||
//
|
//
|
||||||
if ($A.isArray(data)) {
|
if ($A.isArray(data)) {
|
||||||
@ -2677,12 +2676,10 @@ export default {
|
|||||||
delete data.last_at
|
delete data.last_at
|
||||||
delete data.last_msg
|
delete data.last_msg
|
||||||
}
|
}
|
||||||
state.cacheDialogs.splice(index, 1, Object.assign({}, original, data));
|
commit("CACHE_DIALOGS_SPLICE", {index, data: Object.assign({}, original, data)})
|
||||||
} else {
|
} else {
|
||||||
state.cacheDialogs.push(data);
|
commit("CACHE_DIALOGS_PUSH", data)
|
||||||
}
|
}
|
||||||
//
|
|
||||||
$A.IDBSave("cacheDialogs", state.cacheDialogs);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -3001,11 +2998,12 @@ export default {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 忘记对话数据
|
* 忘记对话数据
|
||||||
|
* @param commit
|
||||||
* @param state
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param dialog_id
|
* @param dialog_id
|
||||||
*/
|
*/
|
||||||
forgetDialog({state, dispatch}, dialog_id) {
|
forgetDialog({commit, state, dispatch}, dialog_id) {
|
||||||
$A.execMainDispatch("forgetDialog", dialog_id)
|
$A.execMainDispatch("forgetDialog", dialog_id)
|
||||||
//
|
//
|
||||||
const ids = $A.isArray(dialog_id) ? dialog_id : [dialog_id];
|
const ids = $A.isArray(dialog_id) ? dialog_id : [dialog_id];
|
||||||
@ -3013,14 +3011,12 @@ export default {
|
|||||||
const index = state.cacheDialogs.findIndex(dialog => dialog.id == id);
|
const index = state.cacheDialogs.findIndex(dialog => dialog.id == id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
dispatch("forgetDialogMsg", state.dialogMsgs.filter(item => item.dialog_id == dialog_id).map(item => item.id))
|
dispatch("forgetDialogMsg", state.dialogMsgs.filter(item => item.dialog_id == dialog_id).map(item => item.id))
|
||||||
state.cacheDialogs.splice(index, 1);
|
commit("CACHE_DIALOGS_SPLICE", {index})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (ids.includes(state.dialogId)) {
|
if (ids.includes(state.dialogId)) {
|
||||||
state.dialogId = 0
|
state.dialogId = 0
|
||||||
}
|
}
|
||||||
//
|
|
||||||
$A.IDBSave("cacheDialogs", state.cacheDialogs);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
40
resources/assets/js/store/mutations.js
vendored
40
resources/assets/js/store/mutations.js
vendored
@ -21,6 +21,46 @@ export default {
|
|||||||
$A.IDBSave("dialogMsgs", state.dialogMsgs, 600)
|
$A.IDBSave("dialogMsgs", state.dialogMsgs, 600)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 添加任务
|
||||||
|
CACHE_TASKS_PUSH(state, data) {
|
||||||
|
state.cacheTasks.push(data)
|
||||||
|
$A.IDBSave("cacheTasks", state.cacheTasks, 600)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改、删除任务
|
||||||
|
CACHE_TASKS_SPLICE(state, {index, data, count = 1}) {
|
||||||
|
if (typeof data === "undefined") {
|
||||||
|
state.cacheTasks.splice(index, count)
|
||||||
|
} else {
|
||||||
|
state.cacheTasks.splice(index, count, data)
|
||||||
|
}
|
||||||
|
$A.IDBSave("cacheTasks", state.cacheTasks, 600)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 添加对话
|
||||||
|
CACHE_DIALOGS_PUSH(state, data) {
|
||||||
|
state.cacheDialogs.push(data)
|
||||||
|
$A.IDBSave("cacheDialogs", state.cacheDialogs, 600)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改、删除对话
|
||||||
|
CACHE_DIALOGS_SPLICE(state, {index, data, count = 1}) {
|
||||||
|
if (typeof data === "undefined") {
|
||||||
|
state.cacheDialogs.splice(index, count)
|
||||||
|
} else {
|
||||||
|
state.cacheDialogs.splice(index, count, data)
|
||||||
|
}
|
||||||
|
$A.IDBSave("cacheDialogs", state.cacheDialogs, 600)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 设置草稿
|
// 设置草稿
|
||||||
SET_DIALOG_DRAFT(state, {id, content}) {
|
SET_DIALOG_DRAFT(state, {id, content}) {
|
||||||
const index = state.dialogDrafts.findIndex(item => item.id === id)
|
const index = state.dialogDrafts.findIndex(item => item.id === id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user