From a011f829129c2598119b1cee0588afcd05e9c523 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 1 Dec 2024 02:46:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=BF=AB=E9=80=9F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/manage/components/TaskAddSimple.vue | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/pages/manage/components/TaskAddSimple.vue b/resources/assets/js/pages/manage/components/TaskAddSimple.vue index 54ba62dcd..09627c495 100644 --- a/resources/assets/js/pages/manage/components/TaskAddSimple.vue +++ b/resources/assets/js/pages/manage/components/TaskAddSimple.vue @@ -163,7 +163,7 @@ export default { } } else { 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.top = this.addTop ? 1 : 0; return $A.cloneJSON(this.addData); @@ -171,9 +171,16 @@ export default { }, openAdd() { + if (this.windowPortrait) { + this.defaultPriority(); + this.$emit("on-priority", this.getData()) + this.$emit("on-close") + return + } this.active = true; this.defaultPriority(); this.$nextTick(() => { + this.$refs.input.resizeTextarea(); this.$refs.input.focus(); }); }, @@ -243,7 +250,7 @@ export default { return item.name + ' (' + days + this.$L('天') + ')'; }, - choosePriority(item) { + choosePriority(item, focus = true) { if ($A.runNum(item.days) > 0) { let start = $A.daytz(); 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_name', item.name) this.$set(this.addData, 'p_color', item.color) - this.$nextTick(() => { + focus && this.$nextTick(() => { this.$refs.input.focus(); }); }, defaultPriority() { - if (this.taskPriority.length === 0) { + if (this.taskPriority.length === 0 || this.addData.p_name) { return; } - if (this.addData.p_name) { - return; - } - this.choosePriority(this.taskPriority[0]); + this.choosePriority(this.taskPriority[0], false); } } }