From a11adad23f7f09ff65235eae6df5849b77f539d4 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 23 Dec 2021 15:10:09 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=B7=B2=E5=AE=8C=E6=88=90=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/manage/components/ProjectList.vue | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/pages/manage/components/ProjectList.vue b/resources/assets/js/pages/manage/components/ProjectList.vue index 2376b605..0ebfb8c0 100644 --- a/resources/assets/js/pages/manage/components/ProjectList.vue +++ b/resources/assets/js/pages/manage/components/ProjectList.vue @@ -52,7 +52,7 @@
{{projectData.desc}}
- {{$L('显示已完成')}} + {{$L('显示已完成')}}
@@ -423,6 +423,8 @@ export default { columnTopShow: {}, taskLoad: {}, + completeJust: [], + searchText: '', addShow: false, @@ -511,13 +513,13 @@ export default { }, myList() { - const {projectId, tasks, searchText, userId} = this; + const {projectId, tasks, searchText, userId, completeJust} = this; const array = tasks.filter((task) => { if (task.project_id != projectId) { return false; } if (!this.tablePanel('completedTask')) { - if (task.complete_at) { + if (task.complete_at && !completeJust.find(id => id == task.id)) { return false; } } @@ -539,13 +541,13 @@ export default { }, helpList() { - const {projectId, tasks, searchText, userId} = this; + const {projectId, tasks, searchText, userId, completeJust} = this; const array = tasks.filter((task) => { if (task.project_id != projectId) { return false; } if (!this.tablePanel('completedTask')) { - if (task.complete_at) { + if (task.complete_at && !completeJust.find(id => id == task.id)) { return false; } } @@ -567,13 +569,13 @@ export default { }, undoneList() { - const {projectId, tasks, searchText} = this; + const {projectId, tasks, searchText, completeJust} = this; const array = tasks.filter((task) => { if (task.project_id != projectId) { return false; } if (!this.tablePanel('completedTask')) { - if (task.complete_at) { + if (task.complete_at && !completeJust.find(id => id == task.id)) { return false; } } @@ -582,7 +584,7 @@ export default { return false; } } - return !task.complete_at; + return !task.complete_at || completeJust.find(id => id == task.id); }); return array.sort((a, b) => { if (a.p_level != b.p_level) { @@ -641,6 +643,9 @@ export default { watch: { projectData() { this.sortData = this.getSort(); + }, + '$route'() { + this.completeJust = []; } }, @@ -863,6 +868,7 @@ export default { this.updateTask(task, { complete_at: $A.formatDate("Y-m-d H:i:s") }) + this.completeJust.push(task.id) break; case 'uncomplete': @@ -1108,6 +1114,11 @@ export default { }); }, + toggleCompleted() { + this.$store.dispatch('toggleTablePanel', 'completedTask'); + this.completeJust = []; + }, + formatTime(date) { let time = Math.round($A.Date(date).getTime() / 1000), string = '';