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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -158,11 +158,11 @@ export default {
return;
}
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, 'sub_list', data);
this.$set(task, 'sub_open', true);
}).catch((data, msg) => {
}).catch(({msg}) => {
this.$set(task, 'loading', false);
$A.modalError(msg);
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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