mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-17 06:32:51 +00:00
perf: 优化快速添加任务
This commit is contained in:
parent
a160b2a471
commit
a011f82912
@ -163,7 +163,7 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.addData.project_id = this.projectId || this.$store.state.projectId;
|
this.addData.project_id = this.projectId || this.$store.state.projectId;
|
||||||
this.addData.column_id = this.columnId || '';
|
this.addData.column_id = this.columnId || this.$store.state.cacheColumns.find(item => item.project_id === this.addData.project_id)?.id || '';
|
||||||
this.addData.owner = [this.userId];
|
this.addData.owner = [this.userId];
|
||||||
this.addData.top = this.addTop ? 1 : 0;
|
this.addData.top = this.addTop ? 1 : 0;
|
||||||
return $A.cloneJSON(this.addData);
|
return $A.cloneJSON(this.addData);
|
||||||
@ -171,9 +171,16 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
openAdd() {
|
openAdd() {
|
||||||
|
if (this.windowPortrait) {
|
||||||
|
this.defaultPriority();
|
||||||
|
this.$emit("on-priority", this.getData())
|
||||||
|
this.$emit("on-close")
|
||||||
|
return
|
||||||
|
}
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.defaultPriority();
|
this.defaultPriority();
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
this.$refs.input.resizeTextarea();
|
||||||
this.$refs.input.focus();
|
this.$refs.input.focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -243,7 +250,7 @@ export default {
|
|||||||
return item.name + ' (' + days + this.$L('天') + ')';
|
return item.name + ' (' + days + this.$L('天') + ')';
|
||||||
},
|
},
|
||||||
|
|
||||||
choosePriority(item) {
|
choosePriority(item, focus = true) {
|
||||||
if ($A.runNum(item.days) > 0) {
|
if ($A.runNum(item.days) > 0) {
|
||||||
let start = $A.daytz();
|
let start = $A.daytz();
|
||||||
let end = start.clone().add($A.runNum(item.days), 'day');
|
let end = start.clone().add($A.runNum(item.days), 'day');
|
||||||
@ -254,19 +261,16 @@ export default {
|
|||||||
this.$set(this.addData, 'p_level', item.priority)
|
this.$set(this.addData, 'p_level', item.priority)
|
||||||
this.$set(this.addData, 'p_name', item.name)
|
this.$set(this.addData, 'p_name', item.name)
|
||||||
this.$set(this.addData, 'p_color', item.color)
|
this.$set(this.addData, 'p_color', item.color)
|
||||||
this.$nextTick(() => {
|
focus && this.$nextTick(() => {
|
||||||
this.$refs.input.focus();
|
this.$refs.input.focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultPriority() {
|
defaultPriority() {
|
||||||
if (this.taskPriority.length === 0) {
|
if (this.taskPriority.length === 0 || this.addData.p_name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.addData.p_name) {
|
this.choosePriority(this.taskPriority[0], false);
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.choosePriority(this.taskPriority[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user