mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 优化任务提交添加继续
This commit is contained in:
parent
a730c95492
commit
a19d11061f
@ -189,7 +189,7 @@
|
|||||||
<div class="adaption">
|
<div class="adaption">
|
||||||
<Button type="default" @click="close">{{$L('取消')}}</Button>
|
<Button type="default" @click="close">{{$L('取消')}}</Button>
|
||||||
<ButtonGroup class="page-manage-add-task-button-group">
|
<ButtonGroup class="page-manage-add-task-button-group">
|
||||||
<Button type="primary" :loading="loadIng > 0" @click="onAdd">{{$L('添加任务')}}</Button>
|
<Button type="primary" :loading="loadIng > 0" @click="onAdd(false)">{{$L('添加任务')}}</Button>
|
||||||
<Dropdown @on-click="onAdd(true)" transfer>
|
<Dropdown @on-click="onAdd(true)" transfer>
|
||||||
<Button type="primary">
|
<Button type="primary">
|
||||||
<Icon type="ios-arrow-down"></Icon>
|
<Icon type="ios-arrow-down"></Icon>
|
||||||
@ -202,7 +202,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TaskExistTips ref="taskExistTipsRef" @onContinue="onAdd(again, true)"/>
|
<TaskExistTips ref="taskExistTipsRef" @onContinue="onAdd(addContinue, true)"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ export default {
|
|||||||
|
|
||||||
beforeClose: [],
|
beforeClose: [],
|
||||||
|
|
||||||
again: false
|
addContinue: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -512,34 +512,33 @@ export default {
|
|||||||
this.addData = Object.assign({}, this.addData, data);
|
this.addData = Object.assign({}, this.addData, data);
|
||||||
},
|
},
|
||||||
|
|
||||||
async onAdd(again, affirm = false) {
|
async onAdd(continued = false, affirm = false) {
|
||||||
if (!this.addData.name) {
|
if (!this.addData.name) {
|
||||||
$A.messageError("任务描述不能为空");
|
$A.messageError("任务描述不能为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadIng++;
|
|
||||||
|
|
||||||
// 存在任务提示
|
// 存在任务提示
|
||||||
if (!affirm && this.addData.owner.length > 0) {
|
if (!affirm && this.addData.owner.length > 0) {
|
||||||
|
this.loadIng++;
|
||||||
this.$refs.taskExistTipsRef.isExistTask({
|
this.$refs.taskExistTipsRef.isExistTask({
|
||||||
userids: this.addData.owner,
|
userids: this.addData.owner,
|
||||||
timerange: this.addData.times
|
timerange: this.addData.times
|
||||||
}, 600).then(res => {
|
}, 600).then(res => {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
this.onAdd(again, true)
|
this.onAdd(continued, true)
|
||||||
} else {
|
} else {
|
||||||
this.loadIng--;
|
this.addContinue = continued
|
||||||
this.again = again
|
|
||||||
}
|
}
|
||||||
|
this.loadIng--;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.loadIng++;
|
||||||
this.$store.dispatch("taskAdd", this.addData).then(({msg}) => {
|
this.$store.dispatch("taskAdd", this.addData).then(({msg}) => {
|
||||||
this.loadIng--;
|
|
||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
if (again === true) {
|
if (continued === true) {
|
||||||
this.addData = Object.assign({}, this.addData, {
|
this.addData = Object.assign({}, this.addData, {
|
||||||
name: "",
|
name: "",
|
||||||
content: "",
|
content: "",
|
||||||
@ -551,8 +550,9 @@ export default {
|
|||||||
this.close()
|
this.close()
|
||||||
}
|
}
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
this.loadIng--;
|
|
||||||
$A.modalError(msg);
|
$A.modalError(msg);
|
||||||
|
}).finally(() => {
|
||||||
|
this.loadIng--;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user