perf: 重复添加任务的情况

This commit is contained in:
kuaifan 2024-11-22 23:35:10 +08:00
parent 65b8e2270e
commit fb24c63e7f
2 changed files with 8 additions and 1 deletions

View File

@ -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--;
}); });
}, },

View File

@ -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)