add pagination for CreationTransactionList.vue

This commit is contained in:
ogerly 2022-09-22 10:23:49 +02:00
parent 672312a0dc
commit c62f1af0bb

View File

@ -3,6 +3,15 @@
<div class="h3">{{ $t('transactionlist.title') }}</div> <div class="h3">{{ $t('transactionlist.title') }}</div>
<b-table striped hover :fields="fields" :items="items"></b-table> <b-table striped hover :fields="fields" :items="items"></b-table>
<div> <div>
<b-pagination
pills
size="lg"
v-model="currentPage"
:per-page="perPage"
:total-rows="rows"
align="center"
:hide-ellipsis="true"
></b-pagination>
<b-button v-b-toggle.collapse-1 variant="light" size="sm">{{ $t('help.help') }}</b-button> <b-button v-b-toggle.collapse-1 variant="light" size="sm">{{ $t('help.help') }}</b-button>
<b-collapse id="collapse-1" class="mt-2"> <b-collapse id="collapse-1" class="mt-2">
<div> <div>
@ -26,6 +35,10 @@ export default {
}, },
data() { data() {
return { return {
items: [],
rows: 0,
currentPage: 1,
perPage: 25,
fields: [ fields: [
{ {
key: 'createdAt', key: 'createdAt',
@ -65,7 +78,6 @@ export default {
}, },
{ key: 'memo', label: this.$t('transactionlist.memo') }, { key: 'memo', label: this.$t('transactionlist.memo') },
], ],
items: [],
} }
}, },
methods: { methods: {
@ -74,13 +86,14 @@ export default {
.query({ .query({
query: creationTransactionList, query: creationTransactionList,
variables: { variables: {
currentPage: 1, currentPage: this.currentPage,
pageSize: 25, pageSize: this.perPage,
order: 'DESC', order: 'DESC',
userId: parseInt(this.userId), userId: parseInt(this.userId),
}, },
}) })
.then((result) => { .then((result) => {
this.rows = result.data.creationTransactionList.contributionCount
this.items = result.data.creationTransactionList.contributionList this.items = result.data.creationTransactionList.contributionList
}) })
.catch((error) => { .catch((error) => {
@ -91,5 +104,10 @@ export default {
created() { created() {
this.getTransactions() this.getTransactions()
}, },
watch: {
currentPage() {
this.getTransactions()
},
},
} }
</script> </script>