Update TableHistory.vue

This commit is contained in:
AnandaTon 2023-11-15 11:04:14 +07:00
parent d47ea34dd9
commit 592365d001

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { QTableProps } from 'quasar'
import { ref } from 'vue'
import { ref, watch } from 'vue'
// importStores
import { useChekIn } from '@/stores/chekin'
@ -9,7 +9,87 @@ import { useChekIn } from '@/stores/chekin'
import Popup from '@/components/PopUp.vue'
const stores = useChekIn()
const props = defineProps({
paging: {
type: Boolean,
defualt: false,
},
pageSize: {
type: Number,
defualt: 25,
},
page: {
type: Number,
defualt: 1,
},
maxPage: {
type: Number,
defualt: 1,
},
total: {
type: Number,
defualt: 0,
},
nornmalData: {
type: Boolean,
defualt: false,
},
nextPageVisible: {
type: Boolean,
defualt: false,
},
publicData: {
type: Boolean,
defualt: true,
required: false,
},
updateData: {
type: Boolean,
defualt: true,
required: false,
},
statusPayment: {
type: Boolean,
required: false,
},
setSeat: {
type: Boolean,
required: false,
},
publicNoBtn: {
type: Boolean,
defualt: false,
},
fetchData: {
type: Function,
default: () => console.log('not function'),
},
changePage: {
type: Function,
default: () => console.log('not function'),
},
})
// Pagination - page & change page & get new data
const currentPage = ref<number>(1)
watch(currentPage, () => {
console.log(currentPage.value)
props.changePage(currentPage.value, props.pageSize, true)
})
// Pagination - initial pagination
const initialPagination = ref<any>({
sortBy: null,
descending: false,
page: 1,
rowsPerPage: props.pageSize,
})
// Pagination - update rowsPerPage
async function updatePagination(newPagination: any) {
props.changePage(1, newPagination.rowsPerPage, true)
initialPagination.value = newPagination
}
const columns = ref<QTableProps['columns']>([
{
name: 'date',
@ -127,6 +207,7 @@ const pagination = ref({
:style="$q.screen.gt.xs ? 'max-height: 64vh' : ''"
:grid="$q.screen.gt.xs ? false : true"
v-model:pagination="pagination"
@update:pagination="updatePagination"
>
<template v-slot:header="props">
<q-tr :props="props">