添加任务后继续添加

This commit is contained in:
kuaifan 2021-12-20 18:52:24 +08:00
parent 6faf7e71ba
commit 40e8e47398
3 changed files with 28 additions and 13 deletions

View File

@ -297,6 +297,7 @@
<div slot="footer"> <div slot="footer">
<Button type="default" @click="addShow=false">{{$L('取消')}}</Button> <Button type="default" @click="addShow=false">{{$L('取消')}}</Button>
<Button type="primary" :loading="addLoad > 0" @click="onAddTask">{{$L('添加')}}</Button> <Button type="primary" :loading="addLoad > 0" @click="onAddTask">{{$L('添加')}}</Button>
<Button type="primary" :loading="addLoad > 0" @click="onAddTask(true)">{{$L('添加并继续')}}</Button>
</div> </div>
</Modal> </Modal>
@ -638,14 +639,14 @@ export default {
}); });
}, },
onAddTask() { onAddTask(again) {
this.addLoad++; this.addLoad++;
this.$refs.add.onAdd((success) => { this.$refs.add.onAdd((success) => {
this.addLoad--; this.addLoad--;
if (success) { if (success && again !== true) {
this.addShow = false; this.addShow = false;
} }
}) }, again)
}, },
addTopShow(id, show) { addTopShow(id, show) {

View File

@ -125,6 +125,8 @@ export default {
data() { data() {
return { return {
addData: { addData: {
name: "",
content: "",
owner: 0, owner: 0,
column_id: 0, column_id: 0,
times: [], times: [],
@ -283,7 +285,7 @@ export default {
setData(data) { setData(data) {
this.addData = Object.assign({}, this.addData, data); this.addData = Object.assign({}, this.addData, data);
}, },
onAdd(callback) { onAdd(callback, again) {
if (!this.addData.name) { if (!this.addData.name) {
$A.messageError("任务描述不能为空"); $A.messageError("任务描述不能为空");
callback(false) callback(false)
@ -293,15 +295,25 @@ export default {
project_id: this.projectId project_id: this.projectId
})).then(({msg}) => { })).then(({msg}) => {
$A.messageSuccess(msg); $A.messageSuccess(msg);
this.addData = { if (again === true) {
owner: 0, this.addData = Object.assign({}, this.addData, {
column_id: 0, name: "",
times: [], content: "",
subtasks: [], subtasks: [],
p_level: 0, });
p_name: '', } else {
p_color: '', this.addData = {
}; name: "",
content: "",
owner: 0,
column_id: 0,
times: [],
subtasks: [],
p_level: 0,
p_name: '',
p_color: '',
};
}
callback(true) callback(true)
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);

View File

@ -103,6 +103,7 @@ export default {
data() { data() {
return { return {
addData: { addData: {
name: "",
owner: 0, owner: 0,
column_id: 0, column_id: 0,
times: [], times: [],
@ -206,6 +207,7 @@ export default {
this.loadIng--; this.loadIng--;
this.active = false; this.active = false;
this.addData = { this.addData = {
name: "",
owner: 0, owner: 0,
column_id: 0, column_id: 0,
times: [], times: [],