fix CurrentPage ===> รายการเลื่อนค่าจ้างลูกจ้างประจำ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-07-08 11:19:40 +07:00
parent 2ce94f1ebb
commit d9f5661ac3
4 changed files with 49 additions and 26 deletions

View file

@ -382,7 +382,7 @@ watch(
bordered
:paging="true"
dense
:rows-per-page-options="[1,10, 25, 50, 100]"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
@update:pagination="updatePageSizePagination"
>

View file

@ -249,12 +249,7 @@ function fetchDataQuota(id: string) {
async function fetchDataPeriod(id: string) {
showLoader();
let formData = {
page:
formFilter.page !== 1 &&
formFilter.page === maxPage.value &&
rows.value.length === 1
? (formFilter.page - 1).toString()
: formFilter.page.toString(),
page: formFilter.page.toString(),
pageSize: formFilter.pageSize.toString(),
keyword: formFilter.keyword,
type: store.tabType,

View file

@ -3,6 +3,7 @@ import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { updateCurrentPage } from "@/utils/function";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import config from "@/app.config";
@ -31,16 +32,18 @@ const maxPage = defineModel<Number>("maxPage", { required: true });
const isClose = defineModel<boolean>("isClose", { required: true });
const snapShot = defineModel<string>("snapShot");
const props = defineProps({
rows: { type: Array },
rows: { type: Array, required: true },
fetchDataTable: {
type: Function,
required: true,
},
total: {
type: Number,
required: true,
},
type: {
type: String,
requird: true,
required: true,
},
});
@ -197,7 +200,7 @@ const columns = computed(() => {
const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); //popup
const modalDialogMoveLevel = ref<boolean>(false); //popup
const profileId = ref<string>(""); //id
const amount = ref<number>(0); //
@ -246,7 +249,7 @@ function onClickMoveLevel(
remarkVal: string = ""
) {
profileId.value = id;
modalDialogMoveLeve.value = !modalDialogMoveLeve.value;
modalDialogMoveLevel.value = !modalDialogMoveLevel.value;
typeLevel.value = typeVal;
isReserve.value = isReserveVal;
remark.value = typeVal === "NONE" ? remarkVal : "";
@ -262,7 +265,7 @@ function onClickDelete(id: string) {
await http
.delete(config.API.salaryListPeriodProfileByIdEmp(id))
.then(async () => {
await props.fetchDataTable?.();
await updateCurrentPageAndfetchData();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
@ -297,6 +300,16 @@ function searchData() {
props.fetchDataTable?.();
}
/** ฟังก์ชันอัปเดตหน้าปัจจุบันและดึงข้อมูล */
async function updateCurrentPageAndfetchData() {
formFilter.value.page = await updateCurrentPage(
formFilter.value.page,
Number(maxPage.value),
props.rows.length
);
await props.fetchDataTable?.();
}
/**
* callblack function เรยกขอมลรายชอใหม เมอมการเปลยน PageSize
*/
@ -376,7 +389,7 @@ watch(
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:rows-per-page-options="[1,10, 25, 50, 100]"
:visible-columns="visibleColumns"
@update:pagination="updatePageSizePagination"
>
@ -556,13 +569,13 @@ watch(
<DialogMoveGroup
v-model:modal="modalDialogMoveGroup"
v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:fetch-data="updateCurrentPageAndfetchData"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
/>
<DialogMoveLevel
v-model:modal="modalDialogMoveLeve"
v-model:modal="modalDialogMoveLevel"
v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:fetch-data="updateCurrentPageAndfetchData"
:type-level="typeLevel"
:is-reserve="isReserve"
:type="store.tabType"

View file

@ -3,6 +3,7 @@ import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { updateCurrentPage } from "@/utils/function";
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
import http from "@/plugins/http";
@ -42,18 +43,22 @@ const isClose = defineModel<boolean>("isClose", { required: true });
const snapShot = defineModel<string>("snapShot");
const props = defineProps({
rows: { type: Array },
rows: { type: Array, required: true },
fetchDataTable: {
type: Function,
required: true,
},
maxPage: {
type: Number,
required: true,
},
total: {
type: Number,
required: true,
},
isRetire: {
type: Boolean,
required: true,
},
});
@ -232,10 +237,10 @@ const visibleColumns = ref<string[]>([
const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); //popup
const modalDialogMoveLevel = ref<boolean>(false); //popup
const modalDialogProperties = ref<boolean>(false); //popup
const modalDialogInfo = ref<boolean>(false); //popup
const modalDialogMoveLeveMulti = ref<boolean>(false); //popup
const modalDialogMoveLevelMulti = ref<boolean>(false); //popup
/** ตัวแปร*/
const profileId = ref<string>(""); //id
@ -257,7 +262,7 @@ function onClickDelete(id: string) {
await http
.delete(config.API.salaryListPeriodProfileByIdEmp(id))
.then(async () => {
await props.fetchDataTable?.();
await updateCurrentPageAndfetchData();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
@ -303,7 +308,7 @@ function onClickMovieGroup(id: string) {
*/
function onClickMoveLevel(id: string, typeVal: string, isReserveVal: boolean) {
profileId.value = id;
modalDialogMoveLeve.value = !modalDialogMoveLeve.value;
modalDialogMoveLevel.value = !modalDialogMoveLevel.value;
typeLevel.value = typeVal;
isReserve.value = isReserveVal;
}
@ -354,7 +359,17 @@ function onClickViewInfo(type: string, id: string) {
/** function openPopup ย้ายกขั้น*/
function onClickMoveLevelMulti() {
modalDialogMoveLeveMulti.value = !modalDialogMoveLeve.value;
modalDialogMoveLevelMulti.value = !modalDialogMoveLevel.value;
}
/** ฟังก์ชันอัปเดตหน้าปัจจุบันและดึงข้อมูล */
async function updateCurrentPageAndfetchData() {
formFilter.value.page = await updateCurrentPage(
formFilter.value.page,
props.maxPage,
props.rows.length
);
await props.fetchDataTable?.();
}
/**
@ -604,15 +619,15 @@ watch(
<DialogMoveGroup
v-model:modal="modalDialogMoveGroup"
v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable"
:fetch-data="updateCurrentPageAndfetchData"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
/>
<DialogMoveLevel
v-model:modal="modalDialogMoveLeve"
v-model:modal="modalDialogMoveLevel"
v-model:profile-id="profileId"
:type-level="typeLevel"
:is-reserve="isReserve"
:fetch-data="props.fetchDataTable"
:fetch-data="updateCurrentPageAndfetchData"
:remark="''"
/>
<DialogProperties
@ -634,7 +649,7 @@ watch(
<!-- เลอนขนเลอกหลายคน -->
<DialogMoveLevelMulti
v-model:modal="modalDialogMoveLeveMulti"
v-model:modal="modalDialogMoveLevelMulti"
:fetch-data="props.fetchDataTable"
:columns="
columns.filter(