mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-17 14:42:51 +00:00
perf: 重复添加任务的情况
This commit is contained in:
parent
65b8e2270e
commit
fb24c63e7f
@ -104,6 +104,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loadIng: 0,
|
||||||
|
|
||||||
addData: {
|
addData: {
|
||||||
name: "",
|
name: "",
|
||||||
owner: 0,
|
owner: 0,
|
||||||
@ -205,11 +207,13 @@ export default {
|
|||||||
$A.messageWarning("请输入任务描述");
|
$A.messageWarning("请输入任务描述");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.loadIng > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
let type = this.parentId > 0 ? 'taskAddSub' : 'taskAdd';
|
let type = this.parentId > 0 ? 'taskAddSub' : 'taskAdd';
|
||||||
this.$store.dispatch(type, this.getData()).then(({msg}) => {
|
this.$store.dispatch(type, this.getData()).then(({msg}) => {
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.loadIng--;
|
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.addData = {
|
this.addData = {
|
||||||
name: "",
|
name: "",
|
||||||
@ -226,6 +230,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
|
}).finally(() => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
2
resources/assets/js/store/actions.js
vendored
2
resources/assets/js/store/actions.js
vendored
@ -2136,6 +2136,7 @@ export default {
|
|||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/task/add',
|
url: 'project/task/add',
|
||||||
data: post,
|
data: post,
|
||||||
|
spinner: 600,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if (result.data.is_visible === 1) {
|
if (result.data.is_visible === 1) {
|
||||||
@ -2160,6 +2161,7 @@ export default {
|
|||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/task/addsub',
|
url: 'project/task/addsub',
|
||||||
data: data,
|
data: data,
|
||||||
|
spinner: 600,
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
dispatch("addTaskSuccess", result.data)
|
dispatch("addTaskSuccess", result.data)
|
||||||
resolve(result)
|
resolve(result)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user