From 305b8894034581c612eb65f9d6e0fca88425f1b8 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Tue, 14 Jul 2020 22:29:52 +0900 Subject: [PATCH] Enable to filter documents --- .../containers/annotation/FilterButton.vue | 26 +--------------- frontend/layouts/annotation.vue | 30 +++++++++++++------ 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/frontend/components/containers/annotation/FilterButton.vue b/frontend/components/containers/annotation/FilterButton.vue index 58646b82..8e7b81f0 100644 --- a/frontend/components/containers/annotation/FilterButton.vue +++ b/frontend/components/containers/annotation/FilterButton.vue @@ -40,7 +40,6 @@ diff --git a/frontend/layouts/annotation.vue b/frontend/layouts/annotation.vue index f0a7ffa1..660c852d 100644 --- a/frontend/layouts/annotation.vue +++ b/frontend/layouts/annotation.vue @@ -32,7 +32,9 @@ :approved="approved" :disabled="currentDoc ? false : true" /> - + @@ -92,12 +94,13 @@ export default { data() { return { drawerLeft: null, + filterOption: null, limit: 10 } }, computed: { - ...mapGetters('projects', ['getLink', 'getCurrentUserRole']), + ...mapGetters('projects', ['getLink', 'getCurrentUserRole', 'getFilterOption']), ...mapState('documents', ['loading', 'total']), ...mapGetters('documents', ['currentDoc', 'approved']), page: { @@ -124,15 +127,14 @@ export default { watch: { offset: { handler() { - this.getDocumentList({ - projectId: this.$route.params.id, - limit: this.limit, - offset: this.offset, - q: this.$route.query.q - }) + this.search() }, immediate: true }, + filterOption() { + this.page = 1 + this.search() + }, current: { handler() { this.setCurrent(this.current) @@ -148,7 +150,17 @@ export default { methods: { ...mapActions('projects', ['setCurrentProject']), ...mapActions('documents', ['getDocumentList']), - ...mapMutations('documents', ['setCurrent']) + ...mapMutations('documents', ['setCurrent']), + search() { + this.getDocumentList({ + projectId: this.$route.params.id, + limit: this.limit, + offset: this.offset, + q: this.$route.query.q, + isChecked: this.filterOption, + filterName: this.getFilterOption + }) + } }, validate({ params, query }) {