อัตรากำลังลูกจ้างประจำฯ => บัค pagination

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-19 15:31:12 +07:00
parent 55709b6439
commit bb0e6a69bf
3 changed files with 48 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -435,9 +435,19 @@ async function onClickDownloadReport(val: string, name: string) {
} }
const pagination = ref({ const pagination = ref({
page: 1, page: reqMaster.value.page,
rowsPerPage: 10, rowsPerPage: reqMaster.value.pageSize,
}); });
watch(
() => modalDialogMMove.value,
() => {
if (!modalDialogMMove.value) {
pagination.value.page = 1;
pagination.value.rowsPerPage = reqMaster.value.pageSize;
}
}
);
</script> </script>
<template> <template>

View file

@ -118,11 +118,26 @@ function onClickMovePos() {
} }
} }
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: any) {
reqMaster.value.pageSize = newPagination.rowsPerPage;
reqMaster.value.page = 1;
}
const pagination = ref({
page: reqMaster.value.page,
rowsPerPage: reqMaster.value.pageSize,
});
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
reqMaster.value.page = 1; reqMaster.value.page = 1;
filterTree.value = ""; filterTree.value = "";
pagination.value.rowsPerPage = reqMaster.value.pageSize;
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`; title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
if (modal.value && props.type === "SINGER") { if (modal.value && props.type === "SINGER") {
@ -166,6 +181,9 @@ watch(
no-data-label="ไม่มีข้อมูล" no-data-label="ไม่มีข้อมูล"
selection="multiple" selection="multiple"
v-model:selected="selectedFilter" v-model:selected="selectedFilter"
:rows-per-page-options="[10, 25, 50, 100]"
v-model:pagination="pagination"
@update:pagination="updatePagination"
> >
<template v-slot:header-selection="scope"> <template v-slot:header-selection="scope">
<q-checkbox <q-checkbox

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -346,6 +346,21 @@ async function onClickDownloadReport(val: string, name: string) {
messageError($q, err); messageError($q, err);
}); });
} }
const pagination = ref({
page: reqMaster.value.page,
rowsPerPage: reqMaster.value.pageSize,
});
watch(
() => modalDialogMMove.value,
() => {
if (!modalDialogMMove.value) {
pagination.value.page = 1;
pagination.value.rowsPerPage = reqMaster.value.pageSize;
}
}
);
</script> </script>
<template> <template>
@ -458,6 +473,7 @@ async function onClickDownloadReport(val: string, name: string) {
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination" @update:pagination="updatePagination"
class="tableTb" class="tableTb"
v-model:pagination="pagination"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">