no message

This commit is contained in:
kuaifan 2021-06-12 21:32:13 +08:00
parent 24f671b135
commit c99ceeaa16
16 changed files with 188 additions and 157 deletions

View File

@ -460,7 +460,7 @@ class ProjectTask extends AbstractModel
$this->archived_at = $archived_at; $this->archived_at = $archived_at;
} }
$this->save(); $this->save();
return Base::retSuccess('修改成功'); return Base::retSuccess('修改成功', $this->toArray());
}); });
} }
@ -472,7 +472,7 @@ class ProjectTask extends AbstractModel
{ {
return AbstractModel::transaction(function () { return AbstractModel::transaction(function () {
$this->delete(); $this->delete();
return Base::retSuccess('删除成功'); return Base::retSuccess('删除成功', $this->toArray());
}); });
} }
} }

View File

@ -290,14 +290,14 @@
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'system/imgview', url: 'system/imgview',
data: {path: path ? path : ''}, data: {path: path ? path : ''},
}).then((data, msg) => { }).then(({data}) => {
this.isLoading = false; this.isLoading = false;
let dirs = data['dirs']; let dirs = data['dirs'];
for (let i = 0; i < dirs.length; i++) { for (let i = 0; i < dirs.length; i++) {
this.browseList.push(dirs[i]); this.browseList.push(dirs[i]);
} }
this.browsePictureFor(data['files']); this.browsePictureFor(data['files']);
}).catch((data, msg) => { }).catch(({msg}) => {
this.isLoading = false; this.isLoading = false;
this.browseVisible = false; this.browseVisible = false;
$A.noticeWarning(msg); $A.noticeWarning(msg);

View File

@ -150,10 +150,10 @@
}, },
take: 30 take: 30
}, },
}).then((data, msg) => { }).then(({data}) => {
this.loading = false; this.loading = false;
this.lists = data; this.lists = data;
}).catch((data, msg) => { }).catch(({msg}) => {
this.loading = false; this.loading = false;
this.lists = []; this.lists = [];
$A.messageWarning(msg); $A.messageWarning(msg);

View File

@ -52,11 +52,11 @@ export default {
data: { data: {
email: this.email, email: this.email,
}, },
}).then((data, msg) => { }).then(() => {
this.loadIng--; this.loadIng--;
this.reCode(); this.reCode();
this.codeNeed = true; this.codeNeed = true;
}).catch((data, msg) => { }).catch(() => {
this.loadIng--; this.loadIng--;
this.codeNeed = false; this.codeNeed = false;
}); });
@ -78,11 +78,11 @@ export default {
password: this.password, password: this.password,
code: this.code, code: this.code,
}, },
}).then((data, msg) => { }).then(({data}) => {
this.loadIng--; this.loadIng--;
this.$store.dispatch('saveUserInfo', data); this.$store.dispatch('saveUserInfo', data);
this.goNext(); this.goNext();
}).catch((data, msg) => { }).catch(({data, msg}) => {
this.loadIng--; this.loadIng--;
$A.noticeError(msg); $A.noticeError(msg);
if (data.code === 'need') { if (data.code === 'need') {

View File

@ -273,7 +273,7 @@ export default {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'project/add', url: 'project/add',
data: this.addData, data: this.addData,
}).then((data, msg) => { }).then(({data, msg}) => {
this.loadIng--; this.loadIng--;
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.addShow = false; this.addShow = false;
@ -281,7 +281,7 @@ export default {
this.$set(this.addData, 'template', 0); this.$set(this.addData, 'template', 0);
this.$store.dispatch('saveProject', data); this.$store.dispatch('saveProject', data);
this.toggleRoute('project/' + data.id) this.toggleRoute('project/' + data.id)
}).catch((data, msg) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
$A.modalError(msg); $A.modalError(msg);
}); });

View File

@ -105,7 +105,7 @@ export default {
data: { data: {
msg_id: this.msgData.id, msg_id: this.msgData.id,
}, },
}).then((data, msg) => { }).then(({data}) => {
this.read_list = data; this.read_list = data;
}); });
}, },

View File

@ -123,9 +123,9 @@ export default {
dialog_id: this.dialogId, dialog_id: this.dialogId,
text: this.msgText, text: this.msgText,
}, },
}).then((data, msg) => { }).then(({data}) => {
this.$store.dispatch('dialogMsgSplice', {id: tempId, data}); this.$store.dispatch('dialogMsgSplice', {id: tempId, data});
}).catch((data, msg) => { }).catch(({msg}) => {
$A.modalWarning({ $A.modalWarning({
title: '发送失败', title: '发送失败',
content: msg content: msg

View File

@ -577,10 +577,10 @@ export default {
sort: this.sortData, sort: this.sortData,
only_column: only_column === true ? 1 : 0 only_column: only_column === true ? 1 : 0
}, },
}).then((data, msg) => { }).then(({msg}) => {
this.sortDisabled = false; this.sortDisabled = false;
$A.messageSuccess(msg); $A.messageSuccess(msg);
}).catch((data, msg) => { }).catch(({msg}) => {
this.sortDisabled = false; this.sortDisabled = false;
this.$store.dispatch('projectDetail', this.projectDetail.id); this.$store.dispatch('projectDetail', this.projectDetail.id);
$A.modalError(msg); $A.modalError(msg);
@ -593,7 +593,7 @@ export default {
url: 'project/task/add', url: 'project/task/add',
data: this.addData, data: this.addData,
method: 'post', method: 'post',
}).then((data, msg) => { }).then(({data, msg}) => {
this.taskLoad--; this.taskLoad--;
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.addShow = false; this.addShow = false;
@ -608,7 +608,7 @@ export default {
}; };
this.$store.dispatch('projectOne', data.project_id); this.$store.dispatch('projectOne', data.project_id);
this.addTaskSuccess(data) this.addTaskSuccess(data)
}).catch((data, msg) => { }).catch(({msg}) => {
this.taskLoad--; this.taskLoad--;
$A.modalError(msg); $A.modalError(msg);
}); });
@ -669,11 +669,11 @@ export default {
project_id: this.projectDetail.id, project_id: this.projectDetail.id,
name: name, name: name,
}, },
}).then((data, msg) => { }).then(({data, msg}) => {
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.addColumnName = ''; this.addColumnName = '';
this.projectDetail.project_column.push(data) this.projectDetail.project_column.push(data)
}).catch((data, msg) => { }).catch(({msg}) => {
$A.modalError(msg, 301); $A.modalError(msg, 301);
}); });
}, },
@ -724,12 +724,12 @@ export default {
data: Object.assign(updata, { data: Object.assign(updata, {
column_id: column.id, column_id: column.id,
}), }),
}).then((data, msg) => { }).then(({data}) => {
this.$set(column, 'loading', false); this.$set(column, 'loading', false);
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {
this.$set(column, key, data[key]); this.$set(column, key, data[key]);
}); });
}).catch((data, msg) => { }).catch(({msg}) => {
this.$set(column, 'loading', false); this.$set(column, 'loading', false);
Object.keys(updata).forEach(key => { Object.keys(updata).forEach(key => {
this.$set(column, key, backup[key]); this.$set(column, key, backup[key]);
@ -754,7 +754,7 @@ export default {
data: { data: {
column_id: column.id, column_id: column.id,
}, },
}).then((data, msg) => { }).then(({msg}) => {
this.$set(column, 'loading', false); this.$set(column, 'loading', false);
this.$Modal.remove(); this.$Modal.remove();
$A.messageSuccess(msg); $A.messageSuccess(msg);
@ -763,7 +763,7 @@ export default {
this.projectDetail.project_column.splice(index, 1); this.projectDetail.project_column.splice(index, 1);
} }
this.$store.dispatch('projectDetail', this.projectDetail.id); this.$store.dispatch('projectDetail', this.projectDetail.id);
}).catch((data, msg) => { }).catch(({msg}) => {
this.$set(column, 'loading', false); this.$set(column, 'loading', false);
this.$Modal.remove(); this.$Modal.remove();
$A.modalError(msg, 301); $A.modalError(msg, 301);
@ -818,32 +818,14 @@ export default {
} }
this.$set(task, 'loading', true); this.$set(task, 'loading', true);
// //
const backup = $A.cloneJSON(task); Object.keys(updata).forEach(key => this.$set(task, key, updata[key]));
Object.keys(updata).forEach(key => { this.$store.dispatch("taskUpdate", Object.assign(updata, {
this.$set(task, key, updata[key]); task_id: task.id,
}); })).then(({data}) => {
this.$store.dispatch("call", {
url: 'project/task/update',
data: Object.assign(updata, {
task_id: task.id,
}),
method: 'post',
}).then((data, msg) => {
this.$set(task, 'loading', false); this.$set(task, 'loading', false);
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => this.$set(task, key, data[key]));
this.$set(task, key, data[key]); }).catch(({msg}) => {
});
if (data.parent_id) {
this.$store.dispatch('taskOne', data.parent_id);
}
if (typeof updata.complete_at !== "undefined") {
this.$store.dispatch('projectOne', data.project_id);
}
}).catch((data, msg) => {
this.$set(task, 'loading', false); this.$set(task, 'loading', false);
Object.keys(updata).forEach(key => {
this.$set(task, key, backup[key]);
});
$A.modalError(msg); $A.modalError(msg);
}); });
}, },
@ -853,23 +835,13 @@ export default {
return; return;
} }
this.$set(task, 'loading', true); this.$set(task, 'loading', true);
this.$store.dispatch("call", { this.$store.dispatch("taskArchivedOrRemove", {
url: 'project/task/' + type, id: task.id,
data: { type: type,
task_id: task.id, }).then(({msg}) => {
},
}).then((data, msg) => {
this.$Modal.remove(); this.$Modal.remove();
$A.messageSuccess(msg); $A.messageSuccess(msg);
let column = this.projectDetail.project_column.find(({id}) => id === task.column_id); }).catch(({msg}) => {
if (column) {
let index = column.project_task.findIndex(({id}) => id === task.id);
if (index > -1) {
column.project_task.splice(index, 1);
}
}
this.$store.dispatch('projectDetail', this.projectDetail.id);
}).catch((data, msg) => {
this.$Modal.remove(); this.$Modal.remove();
$A.modalError(msg, 301); $A.modalError(msg, 301);
}); });
@ -880,12 +852,12 @@ export default {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'project/edit', url: 'project/edit',
data: this.settingData, data: this.settingData,
}).then((data, msg) => { }).then(({data, msg}) => {
this.settingLoad--; this.settingLoad--;
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.settingShow = false; this.settingShow = false;
this.$store.dispatch("saveProject", data) this.$store.dispatch("saveProject", data)
}).catch((data, msg) => { }).catch(({msg}) => {
this.settingLoad--; this.settingLoad--;
$A.modalError(msg); $A.modalError(msg);
}); });
@ -899,12 +871,12 @@ export default {
project_id: this.userData.project_id, project_id: this.userData.project_id,
userid: this.userData.userids, userid: this.userData.userids,
}, },
}).then((data, msg) => { }).then(({msg}) => {
this.userLoad--; this.userLoad--;
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$store.dispatch('projectDetail', this.userData.project_id); this.$store.dispatch('projectDetail', this.userData.project_id);
this.userShow = false; this.userShow = false;
}).catch((data, msg) => { }).catch(({msg}) => {
this.userLoad--; this.userLoad--;
$A.modalError(msg); $A.modalError(msg);
}); });
@ -918,12 +890,12 @@ export default {
project_id: this.transferData.project_id, project_id: this.transferData.project_id,
owner_userid: this.transferData.owner_userid[0], owner_userid: this.transferData.owner_userid[0],
}, },
}).then((data, msg) => { }).then(({msg}) => {
this.transferLoad--; this.transferLoad--;
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$store.dispatch('projectDetail', this.transferData.project_id); this.$store.dispatch('projectDetail', this.transferData.project_id);
this.transferShow = false; this.transferShow = false;
}).catch((data, msg) => { }).catch(({msg}) => {
this.transferLoad--; this.transferLoad--;
$A.modalError(msg); $A.modalError(msg);
}); });
@ -940,7 +912,7 @@ export default {
data: { data: {
project_id: this.projectDetail.id, project_id: this.projectDetail.id,
}, },
}).then((data, msg) => { }).then(({msg}) => {
this.$Modal.remove(); this.$Modal.remove();
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$store.dispatch('removeProject', this.projectDetail.id); this.$store.dispatch('removeProject', this.projectDetail.id);
@ -950,7 +922,7 @@ export default {
} else { } else {
this.goForward({path: '/manage/dashboard'}, true); this.goForward({path: '/manage/dashboard'}, true);
} }
}).catch((data, msg) => { }).catch(({msg}) => {
this.$Modal.remove(); this.$Modal.remove();
$A.modalError(msg, 301); $A.modalError(msg, 301);
}); });
@ -969,7 +941,7 @@ export default {
data: { data: {
project_id: this.projectDetail.id, project_id: this.projectDetail.id,
}, },
}).then((data, msg) => { }).then(({msg}) => {
this.$Modal.remove(); this.$Modal.remove();
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.$store.dispatch('removeProject', this.projectDetail.id); this.$store.dispatch('removeProject', this.projectDetail.id);
@ -979,7 +951,7 @@ export default {
} else { } else {
this.goForward({path: '/manage/dashboard'}, true); this.goForward({path: '/manage/dashboard'}, true);
} }
}).catch((data, msg) => { }).catch(({msg}) => {
this.$Modal.remove(); this.$Modal.remove();
$A.modalError(msg, 301); $A.modalError(msg, 301);
}); });

View File

@ -155,7 +155,7 @@ export default {
url: 'project/task/add', url: 'project/task/add',
data: this.getData(), data: this.getData(),
method: 'post', method: 'post',
}).then((data, msg) => { }).then(({data, msg}) => {
this.loadIng--; this.loadIng--;
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.active = false; this.active = false;
@ -170,7 +170,7 @@ export default {
} }
this.$store.dispatch('projectOne', data.project_id); this.$store.dispatch('projectOne', data.project_id);
this.$emit("on-success", data) this.$emit("on-success", data)
}).catch((data, msg) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
$A.modalError(msg); $A.modalError(msg);
}); });

View File

@ -158,11 +158,11 @@ export default {
return; return;
} }
this.$set(task, 'loading', true); this.$set(task, 'loading', true);
this.$store.dispatch("subTask", task.id).then((data, msg) => { this.$store.dispatch("subTask", task.id).then(({data}) => {
this.$set(task, 'loading', false); this.$set(task, 'loading', false);
this.$set(task, 'sub_list', data); this.$set(task, 'sub_list', data);
this.$set(task, 'sub_open', true); this.$set(task, 'sub_open', true);
}).catch((data, msg) => { }).catch(({msg}) => {
this.$set(task, 'loading', false); this.$set(task, 'loading', false);
$A.modalError(msg); $A.modalError(msg);
}); });

View File

@ -148,7 +148,7 @@ export default {
data: { data: {
take: 50 take: 50
}, },
}).then((data, msg) => { }).then(({data}) => {
this.contactsLoad--; this.contactsLoad--;
data.some((user) => { data.some((user) => {
if (user.userid === this.userId) { if (user.userid === this.userId) {
@ -164,7 +164,7 @@ export default {
this.contactsLists[az].push(user); this.contactsLists[az].push(user);
} }
}); });
}).catch((data, msg) => { }).catch(() => {
this.contactsLoad--; this.contactsLoad--;
}); });
}, },

View File

@ -82,12 +82,12 @@ export default {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/editpass', url: 'users/editpass',
data: this.formDatum, data: this.formDatum,
}).then((data, msg) => { }).then(({data}) => {
this.loadIng--; this.loadIng--;
$A.messageSuccess('修改成功'); $A.messageSuccess('修改成功');
this.$store.dispatch('saveUserInfo', data); this.$store.dispatch('saveUserInfo', data);
this.$refs.formDatum.resetFields(); this.$refs.formDatum.resetFields();
}).catch((data, msg) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
$A.modalError(msg); $A.modalError(msg);
}); });

View File

@ -75,11 +75,11 @@ export default {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/editdata', url: 'users/editdata',
data: this.formDatum, data: this.formDatum,
}).then((data, msg) => { }).then(() => {
this.loadIng--; this.loadIng--;
$A.messageSuccess('修改成功'); $A.messageSuccess('修改成功');
this.$store.dispatch('userInfo'); this.$store.dispatch('userInfo');
}).catch((data, msg) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
$A.modalError(msg); $A.modalError(msg);
}); });

View File

@ -96,7 +96,7 @@ export default {
data: { data: {
list: this.formDatum list: this.formDatum
}, },
}).then((data, msg) => { }).then(({data}) => {
this.loadIng--; this.loadIng--;
this.$store.state.taskPriority = $A.cloneJSON(data); this.$store.state.taskPriority = $A.cloneJSON(data);
this.formDatum = data; this.formDatum = data;
@ -107,7 +107,7 @@ export default {
if (save) { if (save) {
$A.messageSuccess('修改成功'); $A.messageSuccess('修改成功');
} }
}).catch((data, msg) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
if (save) { if (save) {
$A.modalError(msg); $A.modalError(msg);

View File

@ -54,14 +54,14 @@ export default {
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'system/setting?type=' + (save ? 'save' : 'get'), url: 'system/setting?type=' + (save ? 'save' : 'get'),
data: this.formDatum, data: this.formDatum,
}).then((data, msg) => { }).then(({data}) => {
this.loadIng--; this.loadIng--;
this.formDatum = data; this.formDatum = data;
this.formDatum_bak = $A.cloneJSON(this.formDatum); this.formDatum_bak = $A.cloneJSON(this.formDatum);
if (save) { if (save) {
$A.messageSuccess('修改成功'); $A.messageSuccess('修改成功');
} }
}).catch((data, msg) => { }).catch(({msg}) => {
this.loadIng--; this.loadIng--;
if (save) { if (save) {
$A.modalError(msg); $A.modalError(msg);

View File

@ -40,7 +40,8 @@ export default {
// //
params.success = (result, status, xhr) => { params.success = (result, status, xhr) => {
if (!state.method.isJson(result)) { if (!state.method.isJson(result)) {
resolve(result, status, xhr); console.log(result, status, xhr);
reject({data: {}, msg: "Return error"})
return; return;
} }
const {ret, data, msg} = result; const {ret, data, msg} = result;
@ -55,13 +56,13 @@ export default {
return; return;
} }
if (ret === 1) { if (ret === 1) {
resolve(data, msg); resolve({data, msg});
} else { } else {
reject(data, msg || "Unknown error") reject({data, msg: msg || "Unknown error"})
} }
}; };
params.error = () => { params.error = () => {
reject({}, "System error") reject({data: {}, msg: "System error"})
}; };
// //
if (params.websocket === true || params.ws === true) { if (params.websocket === true || params.ws === true) {
@ -140,12 +141,12 @@ export default {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
dispatch("call", { dispatch("call", {
url: 'users/info', url: 'users/info',
}).then((data, msg) => { }).then(result => {
dispatch('saveUserInfo', data); dispatch('saveUserInfo', result.data);
resolve(data, msg) resolve(result)
}).catch((data, msg) => { }).catch(result => {
dispatch("logout"); dispatch("logout");
reject(data, msg) reject(result)
}); });
}); });
}, },
@ -229,10 +230,10 @@ export default {
data: { data: {
userid: array userid: array
}, },
}).then((data, msg) => { }).then(result => {
state.cacheUserBasic["::load"] = false; state.cacheUserBasic["::load"] = false;
typeof complete === "function" && complete() typeof complete === "function" && complete()
data.forEach((item) => { result.data.forEach((item) => {
state.cacheUserBasic[item.userid] = { state.cacheUserBasic[item.userid] = {
time, time,
data: item data: item
@ -241,10 +242,10 @@ export default {
dispatch('saveUserOnlineStatus', item); dispatch('saveUserOnlineStatus', item);
typeof success === "function" && success(item, true) typeof success === "function" && success(item, true)
}); });
}).catch((data, msg) => { }).catch(result => {
state.cacheUserBasic["::load"] = false; state.cacheUserBasic["::load"] = false;
typeof complete === "function" && complete() typeof complete === "function" && complete()
$A.modalError(msg); $A.modalError(result.msg);
}); });
}, },
@ -274,10 +275,10 @@ export default {
} }
dispatch("call", { dispatch("call", {
url: 'project/lists', url: 'project/lists',
}).then((data, msg) => { }).then(result => {
dispatch('saveProject', data.data); dispatch('saveProject', result.data);
}).catch((data, msg) => { }).catch(result => {
$A.modalError(msg); $A.modalError(result.msg);
}); });
}, },
@ -296,8 +297,8 @@ export default {
data: { data: {
project_id: project_id, project_id: project_id,
}, },
}).then((data, msg) => { }).then(result => {
dispatch('saveProject', data); dispatch('saveProject', result.data);
}); });
}, },
@ -323,12 +324,12 @@ export default {
data: { data: {
project_id: project_id, project_id: project_id,
}, },
}).then((data, msg) => { }).then(result => {
state.projectLoad--; state.projectLoad--;
dispatch('saveProject', data); dispatch('saveProject', result.data);
}).catch((data, msg) => { }).catch(result => {
state.projectLoad--; state.projectLoad--;
$A.modalError(msg); $A.modalError(result.msg);
}); });
}, },
@ -387,20 +388,20 @@ export default {
data: { data: {
task_id, task_id,
}, },
}).then((data, msg) => { }).then(result => {
state.projectDetail.project_column.some(({project_task}) => { state.projectDetail.project_column.some(({project_task}) => {
let index = project_task.findIndex(({id}) => id === task_id); let index = project_task.findIndex(({id}) => id === task_id);
if (index > -1) { if (index > -1) {
project_task.splice(index, 1, Object.assign(project_task[index], data)) project_task.splice(index, 1, Object.assign(project_task[index], result.data))
return true; return true;
} }
}); });
if (task_id == state.projectOpenTask.id) { if (task_id == state.projectOpenTask.id) {
state.projectOpenTask = Object.assign({}, state.projectOpenTask, data); state.projectOpenTask = Object.assign({}, state.projectOpenTask, result.data);
} }
resolve(data, msg) resolve(result)
}).catch((data, msg) => { }).catch(result => {
reject(data, msg) reject(result)
}); });
}); });
}, },
@ -419,14 +420,14 @@ export default {
data: { data: {
task_id, task_id,
}, },
}).then((data, msg) => { }).then(result => {
state.projectTaskContent[task_id] = data; state.projectTaskContent[task_id] = result.data;
if (task_id == state.projectOpenTask.id) { if (task_id == state.projectOpenTask.id) {
state.projectOpenTask = Object.assign({}, state.projectOpenTask, {content: data || {}}); state.projectOpenTask = Object.assign({}, state.projectOpenTask, {content: result.data || {}});
} }
resolve(data, msg) resolve(result)
}).catch((data, msg) => { }).catch(result => {
reject(data, msg) reject(result)
}); });
}); });
}, },
@ -445,14 +446,14 @@ export default {
data: { data: {
task_id, task_id,
}, },
}).then((data, msg) => { }).then(result => {
state.projectTaskFiles[task_id] = data; state.projectTaskFiles[task_id] = result.data;
if (task_id == state.projectOpenTask.id) { if (task_id == state.projectOpenTask.id) {
state.projectOpenTask = Object.assign({}, state.projectOpenTask, {files: data}); state.projectOpenTask = Object.assign({}, state.projectOpenTask, {files: result.data});
} }
resolve(data, msg) resolve(result)
}).catch((data, msg) => { }).catch(result => {
reject(data, msg) reject(result)
}); });
}); });
}, },
@ -471,14 +472,14 @@ export default {
data: { data: {
task_id, task_id,
}, },
}).then((data, msg) => { }).then(result => {
state.projectSubTask[task_id] = data; state.projectSubTask[task_id] = result.data;
if (task_id == state.projectOpenTask.id) { if (task_id == state.projectOpenTask.id) {
state.projectOpenTask = Object.assign({}, state.projectOpenTask, {sub_task: data}); state.projectOpenTask = Object.assign({}, state.projectOpenTask, {sub_task: result.data});
} }
resolve(data, msg) resolve(result)
}).catch((data, msg) => { }).catch(result => {
reject(data, msg) reject(result)
}); });
}); });
}, },
@ -520,11 +521,69 @@ export default {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
dispatch("call", { dispatch("call", {
url: 'system/priority', url: 'system/priority',
}).then((data, msg) => { }).then(result => {
state.taskPriority = data; state.taskPriority = result.data;
resolve(data, msg) resolve(result)
}).catch((data, msg) => { }).catch(result => {
reject(data, msg) reject(result)
});
});
},
/**
* 更新任务
* @param dispatch
* @param data
* @returns {Promise<unknown>}
*/
taskUpdate({dispatch}, data) {
return new Promise(function (resolve, reject) {
dispatch("call", {
url: 'project/task/update',
data: data,
method: 'post',
}).then(result => {
if (result.data.parent_id) {
dispatch('taskOne', result.data.parent_id);
}
if (typeof updata.complete_at !== "undefined") {
dispatch('projectOne', result.data.project_id);
}
resolve(result)
}).catch(result => {
dispatch('taskOne', data.id);
reject(result)
});
});
},
/**
* 删除或归档任务
* @param state
* @param dispatch
* @param data
* @returns {Promise<unknown>}
*/
taskArchivedOrRemove({state, dispatch}, data) {
let {id, type} = data;
return new Promise(function (resolve, reject) {
dispatch("call", {
url: 'project/task/' + type,
data: {
task_id: id,
},
}).then(result => {
const column = state.projectDetail.project_column.find(({id}) => id === result.data.column_id);
if (column) {
let index = column.project_task.findIndex(({id}) => id === result.data.id);
if (index > -1) {
column.project_task.splice(index, 1);
}
}
dispatch('projectDetail', result.data.project_id);
resolve(result);
}).catch(result => {
reject(result)
}); });
}); });
}, },
@ -538,10 +597,10 @@ export default {
dialogList({state, dispatch}, afterCallback) { dialogList({state, dispatch}, afterCallback) {
dispatch("call", { dispatch("call", {
url: 'dialog/lists', url: 'dialog/lists',
}).then((data, msg) => { }).then(result => {
state.dialogList = data.data; state.dialogList = result.data.data;
typeof afterCallback === "function" && afterCallback(); typeof afterCallback === "function" && afterCallback();
}).catch((data, msg) => { }).catch(result => {
typeof afterCallback === "function" && afterCallback(); typeof afterCallback === "function" && afterCallback();
}); });
}, },
@ -576,8 +635,8 @@ export default {
data: { data: {
dialog_id, dialog_id,
}, },
}).then((data, msg) => { }).then(result => {
dispatch('dialogUpdate', data); dispatch('dialogUpdate', result.data);
}); });
}, },
@ -596,12 +655,12 @@ export default {
data: { data: {
userid, userid,
}, },
}).then((data, msg) => { }).then(result => {
state.method.setStorage('messengerDialogId', data.id) state.method.setStorage('messengerDialogId', result.data.id)
dispatch('dialogMsgList', data.id); dispatch('dialogMsgList', result.data.id);
dispatch('dialogUpdate', data); dispatch('dialogUpdate', result.data);
}).catch((data, msg) => { }).catch(result => {
$A.modalError(msg); $A.modalError(result.msg);
}); });
}, },
@ -641,11 +700,11 @@ export default {
data: { data: {
dialog_id: dialog_id, dialog_id: dialog_id,
}, },
}).then((data, msg) => { }).then(result => {
state.dialogMsgLoad--; state.dialogMsgLoad--;
state.cacheDialogList[dialog_id + "::load"] = false; state.cacheDialogList[dialog_id + "::load"] = false;
const dialog = data.dialog; const dialog = result.data.dialog;
const reverse = data.data.reverse(); const reverse = result.data.data.reverse();
// 更新缓存 // 更新缓存
state.cacheDialogList[dialog_id] = { state.cacheDialogList[dialog_id] = {
dialog, dialog,
@ -666,7 +725,7 @@ export default {
} }
// 更新会话数据 // 更新会话数据
dispatch('dialogUpdate', dialog); dispatch('dialogUpdate', dialog);
}).catch((data, msg) => { }).catch(result => {
state.dialogMsgLoad--; state.dialogMsgLoad--;
state.cacheDialogList[dialog_id + "::load"] = false; state.cacheDialogList[dialog_id + "::load"] = false;
}); });
@ -685,9 +744,9 @@ export default {
const unread = state.dialogMsgUnread; const unread = state.dialogMsgUnread;
dispatch("call", { dispatch("call", {
url: 'dialog/msg/unread', url: 'dialog/msg/unread',
}).then((data, msg) => { }).then(result => {
if (unread == state.dialogMsgUnread) { if (unread == state.dialogMsgUnread) {
state.dialogMsgUnread = data.unread; state.dialogMsgUnread = result.data.unread;
} else { } else {
setTimeout(() => { setTimeout(() => {
dispatch('dialogMsgUnread'); dispatch('dialogMsgUnread');